@lucern/contracts 0.1.2-alpha.5 → 0.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/defineFunction-DO97DKs4.d.ts +14 -0
- package/dist/defineTable-CBQ03FXl.d.ts +36 -0
- package/dist/dsl-BgpoVOVQ.d.ts +110 -0
- package/dist/dsl.d.ts +5 -0
- package/dist/dsl.js +678 -0
- package/dist/dsl.js.map +1 -0
- package/dist/function-registry/beliefs.d.ts +479 -0
- package/dist/function-registry/beliefs.js +4677 -0
- package/dist/function-registry/beliefs.js.map +1 -0
- package/dist/function-registry/coding.d.ts +323 -0
- package/dist/function-registry/coding.js +4451 -0
- package/dist/function-registry/coding.js.map +1 -0
- package/dist/function-registry/context.d.ts +206 -0
- package/dist/function-registry/context.js +4336 -0
- package/dist/function-registry/context.js.map +1 -0
- package/dist/function-registry/contracts.d.ts +206 -0
- package/dist/function-registry/contracts.js +4284 -0
- package/dist/function-registry/contracts.js.map +1 -0
- package/dist/function-registry/coordination.d.ts +440 -0
- package/dist/function-registry/coordination.js +4405 -0
- package/dist/function-registry/coordination.js.map +1 -0
- package/dist/function-registry/edges.d.ts +167 -0
- package/dist/function-registry/edges.js +4425 -0
- package/dist/function-registry/edges.js.map +1 -0
- package/dist/function-registry/evidence.d.ts +401 -0
- package/dist/function-registry/evidence.js +4598 -0
- package/dist/function-registry/evidence.js.map +1 -0
- package/dist/function-registry/graph.d.ts +596 -0
- package/dist/function-registry/graph.js +4489 -0
- package/dist/function-registry/graph.js.map +1 -0
- package/dist/function-registry/helpers.d.ts +84 -0
- package/dist/function-registry/helpers.js +4280 -0
- package/dist/function-registry/helpers.js.map +1 -0
- package/dist/function-registry/identity.d.ts +206 -0
- package/dist/function-registry/identity.js +4295 -0
- package/dist/function-registry/identity.js.map +1 -0
- package/dist/function-registry/index.d.ts +32 -0
- package/dist/function-registry/index.js +4384 -0
- package/dist/function-registry/index.js.map +1 -0
- package/dist/function-registry/judgments.d.ts +167 -0
- package/dist/function-registry/judgments.js +4308 -0
- package/dist/function-registry/judgments.js.map +1 -0
- package/dist/function-registry/legacy.d.ts +128 -0
- package/dist/function-registry/legacy.js +4259 -0
- package/dist/function-registry/legacy.js.map +1 -0
- package/dist/function-registry/lenses.d.ts +245 -0
- package/dist/function-registry/lenses.js +4343 -0
- package/dist/function-registry/lenses.js.map +1 -0
- package/dist/function-registry/manifest.d.ts +36 -0
- package/dist/function-registry/manifest.js +367 -0
- package/dist/function-registry/manifest.js.map +1 -0
- package/dist/function-registry/ontologies.d.ts +518 -0
- package/dist/function-registry/ontologies.js +4442 -0
- package/dist/function-registry/ontologies.js.map +1 -0
- package/dist/function-registry/pipeline.d.ts +206 -0
- package/dist/function-registry/pipeline.js +4295 -0
- package/dist/function-registry/pipeline.js.map +1 -0
- package/dist/function-registry/questions.d.ts +557 -0
- package/dist/function-registry/questions.js +4528 -0
- package/dist/function-registry/questions.js.map +1 -0
- package/dist/function-registry/tasks.d.ts +245 -0
- package/dist/function-registry/tasks.js +4373 -0
- package/dist/function-registry/tasks.js.map +1 -0
- package/dist/function-registry/topics.d.ts +284 -0
- package/dist/function-registry/topics.js +4350 -0
- package/dist/function-registry/topics.js.map +1 -0
- package/dist/function-registry/types.d.ts +84 -0
- package/dist/function-registry/types.js +3 -0
- package/dist/function-registry/types.js.map +1 -0
- package/dist/function-registry/worktrees.d.ts +479 -0
- package/dist/function-registry/worktrees.js +4522 -0
- package/dist/function-registry/worktrees.js.map +1 -0
- package/dist/generated/convexSchemas.d.ts +20 -0
- package/dist/generated/convexSchemas.js +161 -0
- package/dist/generated/convexSchemas.js.map +1 -0
- package/dist/generated/schema-manifest.json +5231 -0
- package/dist/generated/tableOwnership.d.ts +128 -0
- package/dist/generated/tableOwnership.js +278 -0
- package/dist/generated/tableOwnership.js.map +1 -0
- package/dist/generated/tier-expectations.json +363 -0
- package/dist/idOf-DR8tkhQS.d.ts +10 -0
- package/dist/index-CV-0_VWJ.d.ts +25 -0
- package/dist/index.d.ts +421 -2
- package/dist/index.js +7634 -1607
- package/dist/index.js.map +1 -1
- package/dist/schema-helpers/enumValidation.d.ts +17 -0
- package/dist/schema-helpers/enumValidation.js +143 -0
- package/dist/schema-helpers/enumValidation.js.map +1 -0
- package/dist/schema-helpers/spine/nodes/decision.d.ts +19 -0
- package/dist/schema-helpers/spine/nodes/decision.js +81 -0
- package/dist/schema-helpers/spine/nodes/decision.js.map +1 -0
- package/dist/schema-helpers/spine/tables/epistemicNodes.d.ts +9 -0
- package/dist/schema-helpers/spine/tables/epistemicNodes.js +62 -0
- package/dist/schema-helpers/spine/tables/epistemicNodes.js.map +1 -0
- package/dist/schema-helpers/topicIds.d.ts +17 -0
- package/dist/schema-helpers/topicIds.js +21 -0
- package/dist/schema-helpers/topicIds.js.map +1 -0
- package/dist/schema-helpers/topicLegacyScope.d.ts +19 -0
- package/dist/schema-helpers/topicLegacyScope.js +44 -0
- package/dist/schema-helpers/topicLegacyScope.js.map +1 -0
- package/dist/schema-helpers/validators.d.ts +8 -0
- package/dist/schema-helpers/validators.js +18 -0
- package/dist/schema-helpers/validators.js.map +1 -0
- package/dist/schemas/component-table-manifest.d.ts +74 -0
- package/dist/schemas/component-table-manifest.js +26 -0
- package/dist/schemas/component-table-manifest.js.map +1 -0
- package/dist/schemas/enums.d.ts +12 -0
- package/dist/schemas/enums.js +11 -0
- package/dist/schemas/enums.js.map +1 -0
- package/dist/schemas/index.d.ts +7 -0
- package/dist/schemas/index.js +4298 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/manifest.d.ts +24586 -0
- package/dist/schemas/manifest.js +4269 -0
- package/dist/schemas/manifest.js.map +1 -0
- package/dist/schemas/sl-opinion.d.ts +31 -0
- package/dist/schemas/sl-opinion.js +19 -0
- package/dist/schemas/sl-opinion.js.map +1 -0
- package/dist/schemas/tables/identity/agent.d.ts +21 -0
- package/dist/schemas/tables/identity/agent.js +41 -0
- package/dist/schemas/tables/identity/agent.js.map +1 -0
- package/dist/schemas/tables/identity/epistemic.d.ts +18 -0
- package/dist/schemas/tables/identity/epistemic.js +38 -0
- package/dist/schemas/tables/identity/epistemic.js.map +1 -0
- package/dist/schemas/tables/identity/model.d.ts +62 -0
- package/dist/schemas/tables/identity/model.js +110 -0
- package/dist/schemas/tables/identity/model.js.map +1 -0
- package/dist/schemas/tables/identity/platform.d.ts +392 -0
- package/dist/schemas/tables/identity/platform.js +475 -0
- package/dist/schemas/tables/identity/platform.js.map +1 -0
- package/dist/schemas/tables/identity/project.d.ts +22 -0
- package/dist/schemas/tables/identity/project.js +48 -0
- package/dist/schemas/tables/identity/project.js.map +1 -0
- package/dist/schemas/tables/identity/user.d.ts +26 -0
- package/dist/schemas/tables/identity/user.js +47 -0
- package/dist/schemas/tables/identity/user.js.map +1 -0
- package/dist/schemas/tables/kernel/config.d.ts +20 -0
- package/dist/schemas/tables/kernel/config.js +39 -0
- package/dist/schemas/tables/kernel/config.js.map +1 -0
- package/dist/schemas/tables/kernel/coordination.d.ts +30 -0
- package/dist/schemas/tables/kernel/coordination.js +57 -0
- package/dist/schemas/tables/kernel/coordination.js.map +1 -0
- package/dist/schemas/tables/kernel/decision.d.ts +246 -0
- package/dist/schemas/tables/kernel/decision.js +371 -0
- package/dist/schemas/tables/kernel/decision.js.map +1 -0
- package/dist/schemas/tables/kernel/embedding.d.ts +18 -0
- package/dist/schemas/tables/kernel/embedding.js +48 -0
- package/dist/schemas/tables/kernel/embedding.js.map +1 -0
- package/dist/schemas/tables/kernel/epistemic.d.ts +317 -0
- package/dist/schemas/tables/kernel/epistemic.js +329 -0
- package/dist/schemas/tables/kernel/epistemic.js.map +1 -0
- package/dist/schemas/tables/kernel/idempotency.d.ts +13 -0
- package/dist/schemas/tables/kernel/idempotency.js +31 -0
- package/dist/schemas/tables/kernel/idempotency.js.map +1 -0
- package/dist/schemas/tables/kernel/infra.d.ts +183 -0
- package/dist/schemas/tables/kernel/infra.js +182 -0
- package/dist/schemas/tables/kernel/infra.js.map +1 -0
- package/dist/schemas/tables/kernel/intelligence.d.ts +293 -0
- package/dist/schemas/tables/kernel/intelligence.js +207 -0
- package/dist/schemas/tables/kernel/intelligence.js.map +1 -0
- package/dist/schemas/tables/kernel/lens.d.ts +192 -0
- package/dist/schemas/tables/kernel/lens.js +122 -0
- package/dist/schemas/tables/kernel/lens.js.map +1 -0
- package/dist/schemas/tables/kernel/ontology.d.ts +89 -0
- package/dist/schemas/tables/kernel/ontology.js +91 -0
- package/dist/schemas/tables/kernel/ontology.js.map +1 -0
- package/dist/schemas/tables/kernel/platform.d.ts +353 -0
- package/dist/schemas/tables/kernel/platform.js +349 -0
- package/dist/schemas/tables/kernel/platform.js.map +1 -0
- package/dist/schemas/tables/kernel/spine.d.ts +206 -0
- package/dist/schemas/tables/kernel/spine.js +243 -0
- package/dist/schemas/tables/kernel/spine.js.map +1 -0
- package/dist/schemas/tables/kernel/task.d.ts +614 -0
- package/dist/schemas/tables/kernel/task.js +189 -0
- package/dist/schemas/tables/kernel/task.js.map +1 -0
- package/dist/schemas/tables/kernel/topic.d.ts +25 -0
- package/dist/schemas/tables/kernel/topic.js +62 -0
- package/dist/schemas/tables/kernel/topic.js.map +1 -0
- package/dist/schemas/tables/kernel/workflow.d.ts +45 -0
- package/dist/schemas/tables/kernel/workflow.js +94 -0
- package/dist/schemas/tables/kernel/workflow.js.map +1 -0
- package/dist/schemas/tables/kernel/worktree.d.ts +823 -0
- package/dist/schemas/tables/kernel/worktree.js +330 -0
- package/dist/schemas/tables/kernel/worktree.js.map +1 -0
- package/dist/schemas/tables/mc/identity.d.ts +134 -0
- package/dist/schemas/tables/mc/identity.js +221 -0
- package/dist/schemas/tables/mc/identity.js.map +1 -0
- package/dist/schemas/tables/mc/methodology.d.ts +46 -0
- package/dist/schemas/tables/mc/methodology.js +69 -0
- package/dist/schemas/tables/mc/methodology.js.map +1 -0
- package/dist/schemas/tables/mc/pack.d.ts +540 -0
- package/dist/schemas/tables/mc/pack.js +294 -0
- package/dist/schemas/tables/mc/pack.js.map +1 -0
- package/dist/schemas/tables/mc/policy.d.ts +57 -0
- package/dist/schemas/tables/mc/policy.js +121 -0
- package/dist/schemas/tables/mc/policy.js.map +1 -0
- package/dist/schemas/tables/mc/registry.d.ts +155 -0
- package/dist/schemas/tables/mc/registry.js +164 -0
- package/dist/schemas/tables/mc/registry.js.map +1 -0
- package/dist/schemas/tables/mc/runtime.d.ts +119 -0
- package/dist/schemas/tables/mc/runtime.js +199 -0
- package/dist/schemas/tables/mc/runtime.js.map +1 -0
- package/dist/schemas/tables/mc/tenant.d.ts +106 -0
- package/dist/schemas/tables/mc/tenant.js +114 -0
- package/dist/schemas/tables/mc/tenant.js.map +1 -0
- package/dist/schemas/tables/mc/workspace.d.ts +28 -0
- package/dist/schemas/tables/mc/workspace.js +52 -0
- package/dist/schemas/tables/mc/workspace.js.map +1 -0
- package/dist/sdk-methods.contract.d.ts +5 -2
- package/dist/{sdk-tools.contract-BnV0hKLp.d.ts → sdk-tools.contract-S4ia0TTo.d.ts} +3 -7
- package/dist/sdk-tools.contract.d.ts +2 -2
- package/dist/sdk-tools.contract.js +810 -218
- package/dist/sdk-tools.contract.js.map +1 -1
- package/dist/tool-contracts-C92-9ueT.d.ts +290 -0
- package/dist/tool-contracts.d.ts +1 -0
- package/dist/{mcp-tools.contract.js → tool-contracts.js} +812 -159
- package/dist/tool-contracts.js.map +1 -0
- package/dist/workflow-runtime.contract.js +1 -1
- package/dist/workflow-runtime.contract.js.map +1 -1
- package/package.json +137 -2
- package/dist/mcp-tools.contract-D8kXcP6d.d.ts +0 -254
- package/dist/mcp-tools.contract.d.ts +0 -1
- package/dist/mcp-tools.contract.js.map +0 -1
|
@@ -0,0 +1,4298 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/schemas/enums.ts
|
|
4
|
+
var NODE_TYPE = z.enum(["decision", "belief", "question", "theme", "deal", "topic", "claim", "evidence", "synthesis", "answer", "atomic_fact", "excerpt", "source", "company", "person", "investor", "function", "value_chain"]);
|
|
5
|
+
var EDGE_TYPE = z.enum(["supports", "informs", "depends_on", "extracted_from", "contains", "tests", "supersedes", "responds_to", "belongs_to", "relates_to_thesis", "works_at", "invested_in", "competes_with", "participates_in", "founded_by", "evaluates", "performs", "function_in", "impacts", "raised_from", "mentioned_in", "perspective_on", "plays_theme", "answers", "explores", "qualifies", "based_on", "based_on_belief", "based_on_question", "blocked_by_contradiction", "informed_by_theme", "same_as", "reinforces", "parent_of", "child_of", "falsified_by", "exclusive_with", "collapses_if", "cascade_from", "counterfactual_of", "cascade_to", "mutually_exclusive", "correlates_with", "amplifies", "precondition_for", "in_tension_with", "strengthened_by", "weakened_by", "alternative_to", "subsumes", "validated_by", "required_for", "blocks", "prerequisite_for", "parallel_to", "corroborates", "extends", "same_source_as", "same_theme_as", "assumes", "would_predict", "analogous_to", "independent_of", "implements", "violates", "co_changes_with", "migrating_from", "migrating_to", "scoped_by", "about_entity", "entity_referenced_in", "contradicts", "cites", "summarizes", "related_to", "partially_answers", "refines", "branches_from"]);
|
|
6
|
+
var TOPIC_STATUS = z.enum(["active", "archived", "watching"]);
|
|
7
|
+
var TOPIC_VISIBILITY = z.enum(["private", "team", "firm", "external", "public"]);
|
|
8
|
+
|
|
9
|
+
// src/dsl/defineTable.ts
|
|
10
|
+
function defineTable(spec) {
|
|
11
|
+
return spec;
|
|
12
|
+
}
|
|
13
|
+
var CONVEX_ID_TABLE = /* @__PURE__ */ Symbol.for("lucern.contracts.convexIdTable");
|
|
14
|
+
function idOf(table) {
|
|
15
|
+
const schema = z.string().brand();
|
|
16
|
+
Object.defineProperty(schema, CONVEX_ID_TABLE, {
|
|
17
|
+
configurable: false,
|
|
18
|
+
enumerable: false,
|
|
19
|
+
value: table,
|
|
20
|
+
writable: false
|
|
21
|
+
});
|
|
22
|
+
return schema;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/schemas/tables/kernel/coordination.ts
|
|
26
|
+
var agentMessages = defineTable({
|
|
27
|
+
name: "agentMessages",
|
|
28
|
+
component: "kernel",
|
|
29
|
+
category: "coordination",
|
|
30
|
+
shape: z.object({
|
|
31
|
+
"fromSessionId": z.string(),
|
|
32
|
+
"toSessionId": z.string(),
|
|
33
|
+
"content": z.string(),
|
|
34
|
+
"messageType": z.enum(["note", "question", "answer", "alert", "handoff"]),
|
|
35
|
+
"relatedBeliefId": z.string().optional(),
|
|
36
|
+
"relatedWorktreeId": z.string().optional(),
|
|
37
|
+
"readAt": z.number().optional(),
|
|
38
|
+
"expiresAt": z.number().optional(),
|
|
39
|
+
"createdAt": z.number()
|
|
40
|
+
}),
|
|
41
|
+
indices: [
|
|
42
|
+
{ kind: "index", name: "by_toSessionId", columns: ["toSessionId", "createdAt"] },
|
|
43
|
+
{ kind: "index", name: "by_fromSessionId", columns: ["fromSessionId", "createdAt"] }
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
var agentSessions = defineTable({
|
|
47
|
+
name: "agentSessions",
|
|
48
|
+
component: "kernel",
|
|
49
|
+
category: "coordination",
|
|
50
|
+
shape: z.object({
|
|
51
|
+
"sessionId": z.string(),
|
|
52
|
+
"sessionName": z.string().optional(),
|
|
53
|
+
"agentType": z.string().optional(),
|
|
54
|
+
"topicId": z.string().optional(),
|
|
55
|
+
"worktreeId": z.string().optional(),
|
|
56
|
+
"gitBranch": z.string().optional(),
|
|
57
|
+
"touchedFiles": z.array(z.string()).optional(),
|
|
58
|
+
"status": z.enum(["active", "idle", "ended"]),
|
|
59
|
+
"lastHeartbeatAt": z.number(),
|
|
60
|
+
"startedAt": z.number(),
|
|
61
|
+
"endedAt": z.number().optional(),
|
|
62
|
+
"metadata": z.any().optional()
|
|
63
|
+
}),
|
|
64
|
+
indices: [
|
|
65
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
66
|
+
{ kind: "index", name: "by_sessionId", columns: ["sessionId"] }
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
var agentRegistryEntries = defineTable({
|
|
70
|
+
name: "agentRegistryEntries",
|
|
71
|
+
component: "mc",
|
|
72
|
+
category: "registry",
|
|
73
|
+
shape: z.object({
|
|
74
|
+
"tenantId": idOf("tenants"),
|
|
75
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
76
|
+
"agentDefinitionId": z.string(),
|
|
77
|
+
"agentKey": z.string(),
|
|
78
|
+
"displayName": z.string(),
|
|
79
|
+
"description": z.string(),
|
|
80
|
+
"version": z.string(),
|
|
81
|
+
"status": z.enum(["active", "deprecated", "disabled"]),
|
|
82
|
+
"executionAdapter": z.enum(["convex_mutation", "convex_action", "http_callback", "mcp_tool", "sdk_invocation", "external_observed"]),
|
|
83
|
+
"scopeRequirements": z.array(z.string()),
|
|
84
|
+
"promptReleaseChannel": z.enum(["dev", "staging", "prod"]),
|
|
85
|
+
"promptName": z.string().optional(),
|
|
86
|
+
"systemPrompt": z.string().optional(),
|
|
87
|
+
"toolIds": z.array(z.string()).optional(),
|
|
88
|
+
"modelSlot": z.string().optional(),
|
|
89
|
+
"requiredModelCapabilities": z.array(z.string()).optional(),
|
|
90
|
+
"parameterSchema": z.record(z.any()),
|
|
91
|
+
"outputSchema": z.record(z.any()).optional(),
|
|
92
|
+
"guardrails": z.object({
|
|
93
|
+
"isolationMode": z.enum(["direct", "sandbox"]).optional(),
|
|
94
|
+
"maxExecutionMs": z.number().optional(),
|
|
95
|
+
"heartbeatIntervalMs": z.number().optional(),
|
|
96
|
+
"maxToolCalls": z.number().optional(),
|
|
97
|
+
"allowNetworkEgress": z.boolean().optional(),
|
|
98
|
+
"allowedOrigins": z.array(z.string()).optional()
|
|
99
|
+
}).optional(),
|
|
100
|
+
"runtimeConfig": z.object({
|
|
101
|
+
"entryPoint": z.string().optional(),
|
|
102
|
+
"callbackUrl": z.string().optional(),
|
|
103
|
+
"modelRouting": z.enum(["model_machine", "tenant_proxy", "bring_your_own"]).optional(),
|
|
104
|
+
"auditMode": z.enum(["harness", "master_control"]).optional()
|
|
105
|
+
}).optional(),
|
|
106
|
+
"exampleInvocations": z.array(z.object({
|
|
107
|
+
"input": z.record(z.any()),
|
|
108
|
+
"expectedOutput": z.record(z.any()).optional()
|
|
109
|
+
})),
|
|
110
|
+
"metadata": z.record(z.any()).optional(),
|
|
111
|
+
"createdBy": z.string(),
|
|
112
|
+
"createdAt": z.number(),
|
|
113
|
+
"updatedAt": z.number()
|
|
114
|
+
}),
|
|
115
|
+
indices: [
|
|
116
|
+
{ kind: "index", name: "by_agentDefinitionId", columns: ["agentDefinitionId"] },
|
|
117
|
+
{ kind: "index", name: "by_tenant_agentDefinitionId", columns: ["tenantId", "agentDefinitionId"] },
|
|
118
|
+
{ kind: "index", name: "by_tenant_agentDefinitionId_version", columns: ["tenantId", "agentDefinitionId", "version"] },
|
|
119
|
+
{ kind: "index", name: "by_tenant_agentKey", columns: ["tenantId", "agentKey"] },
|
|
120
|
+
{ kind: "index", name: "by_tenant_agentKey_version", columns: ["tenantId", "agentKey", "version"] },
|
|
121
|
+
{ kind: "index", name: "by_workspace_agentKey_version", columns: ["workspaceId", "agentKey", "version"] },
|
|
122
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
|
|
123
|
+
]
|
|
124
|
+
});
|
|
125
|
+
var toolCatalog = defineTable({
|
|
126
|
+
name: "toolCatalog",
|
|
127
|
+
component: "mc",
|
|
128
|
+
category: "registry",
|
|
129
|
+
shape: z.object({
|
|
130
|
+
"toolName": z.string(),
|
|
131
|
+
"description": z.string(),
|
|
132
|
+
"version": z.string(),
|
|
133
|
+
"distribution": z.enum(["base", "pack_only"]),
|
|
134
|
+
"status": z.enum(["active", "deprecated", "draft"]),
|
|
135
|
+
"category": z.enum(["read", "write", "admin", "system"]),
|
|
136
|
+
"requiredRole": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]),
|
|
137
|
+
"requiredAction": z.enum(["read", "mutate", "admin", "summarize", "export", "create", "delete", "grant", "revoke"]),
|
|
138
|
+
"surfaces": z.array(z.enum(["mcp", "chat", "voice", "sprint", "api", "sdk", "cli"])),
|
|
139
|
+
"parameterSchema": z.record(z.any()).optional(),
|
|
140
|
+
"returnSchema": z.record(z.any()).optional(),
|
|
141
|
+
"handlerRef": z.string().optional(),
|
|
142
|
+
"executionAdapter": z.enum(["convex_mutation", "convex_action", "http_callback", "mcp_tool", "sdk_invocation", "external_observed"]).optional(),
|
|
143
|
+
"safetyMetadata": z.object({
|
|
144
|
+
"readOnly": z.boolean(),
|
|
145
|
+
"idempotent": z.boolean(),
|
|
146
|
+
"sideEffectLevel": z.enum(["none", "low", "high"])
|
|
147
|
+
}).optional(),
|
|
148
|
+
"metadata": z.record(z.any()).optional(),
|
|
149
|
+
"createdAt": z.number(),
|
|
150
|
+
"updatedAt": z.number()
|
|
151
|
+
}),
|
|
152
|
+
indices: [
|
|
153
|
+
{ kind: "index", name: "by_toolName", columns: ["toolName"] },
|
|
154
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
155
|
+
{ kind: "index", name: "by_distribution", columns: ["distribution"] },
|
|
156
|
+
{ kind: "index", name: "by_distribution_status", columns: ["distribution", "status"] },
|
|
157
|
+
{ kind: "index", name: "by_category", columns: ["category"] },
|
|
158
|
+
{ kind: "index", name: "by_requiredRole", columns: ["requiredRole"] }
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
var toolRegistryEntries = defineTable({
|
|
162
|
+
name: "toolRegistryEntries",
|
|
163
|
+
component: "mc",
|
|
164
|
+
category: "registry",
|
|
165
|
+
shape: z.object({
|
|
166
|
+
"tenantId": idOf("tenants"),
|
|
167
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
168
|
+
"toolId": z.string(),
|
|
169
|
+
"toolName": z.string(),
|
|
170
|
+
"description": z.string(),
|
|
171
|
+
"version": z.string(),
|
|
172
|
+
"status": z.enum(["active", "deprecated", "disabled"]),
|
|
173
|
+
"executionAdapter": z.enum(["convex_mutation", "convex_action", "http_callback", "mcp_tool", "sdk_invocation", "external_observed"]),
|
|
174
|
+
"gateClassification": z.enum(["core", "shimmed"]),
|
|
175
|
+
"scopeRequirements": z.array(z.string()),
|
|
176
|
+
"parameterSchema": z.record(z.any()),
|
|
177
|
+
"safetyMetadata": z.object({
|
|
178
|
+
"readOnly": z.boolean(),
|
|
179
|
+
"idempotent": z.boolean(),
|
|
180
|
+
"sideEffectLevel": z.enum(["none", "low", "high"])
|
|
181
|
+
}),
|
|
182
|
+
"exampleInvocations": z.array(z.object({
|
|
183
|
+
"input": z.record(z.any()),
|
|
184
|
+
"expectedOutput": z.record(z.any()).optional()
|
|
185
|
+
})),
|
|
186
|
+
"requiredRole": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]).optional(),
|
|
187
|
+
"requiredAction": z.enum(["read", "mutate", "admin", "summarize", "export", "create", "delete", "grant", "revoke"]).optional(),
|
|
188
|
+
"surfaces": z.array(z.enum(["mcp", "chat", "voice", "sprint", "api", "sdk", "cli"])).optional(),
|
|
189
|
+
"approvalGateId": z.string().optional(),
|
|
190
|
+
"isCore": z.boolean().optional(),
|
|
191
|
+
"category": z.enum(["read", "write", "admin", "system"]).optional(),
|
|
192
|
+
"metadata": z.record(z.any()).optional(),
|
|
193
|
+
"createdBy": z.string(),
|
|
194
|
+
"createdAt": z.number(),
|
|
195
|
+
"updatedAt": z.number()
|
|
196
|
+
}),
|
|
197
|
+
indices: [
|
|
198
|
+
{ kind: "index", name: "by_toolId", columns: ["toolId"] },
|
|
199
|
+
{ kind: "index", name: "by_tenant_toolId", columns: ["tenantId", "toolId"] },
|
|
200
|
+
{ kind: "index", name: "by_tenant_toolId_version", columns: ["tenantId", "toolId", "version"] },
|
|
201
|
+
{ kind: "index", name: "by_tenant_toolName", columns: ["tenantId", "toolName"] },
|
|
202
|
+
{ kind: "index", name: "by_tenant_toolName_version", columns: ["tenantId", "toolName", "version"] },
|
|
203
|
+
{ kind: "index", name: "by_workspace_toolName_version", columns: ["workspaceId", "toolName", "version"] },
|
|
204
|
+
{ kind: "index", name: "by_tenant_gateClassification", columns: ["tenantId", "gateClassification"] },
|
|
205
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
|
|
206
|
+
]
|
|
207
|
+
});
|
|
208
|
+
var agents = defineTable({
|
|
209
|
+
name: "agents",
|
|
210
|
+
component: "identity",
|
|
211
|
+
category: "agent",
|
|
212
|
+
shape: z.object({
|
|
213
|
+
"slug": z.string(),
|
|
214
|
+
"displayName": z.string().optional(),
|
|
215
|
+
"principalId": z.string(),
|
|
216
|
+
"principalType": z.literal("service"),
|
|
217
|
+
"tenantId": z.string(),
|
|
218
|
+
"workspaceId": z.string(),
|
|
219
|
+
"roles": z.array(z.string()),
|
|
220
|
+
"permittedToolNames": z.array(z.string()).optional(),
|
|
221
|
+
"permittedPackKeys": z.array(z.string()).optional(),
|
|
222
|
+
"groupIds": z.array(z.string()).optional(),
|
|
223
|
+
"status": z.enum(["active", "suspended", "disabled"]),
|
|
224
|
+
"createdAt": z.number(),
|
|
225
|
+
"updatedAt": z.number(),
|
|
226
|
+
"createdBy": z.string()
|
|
227
|
+
}),
|
|
228
|
+
indices: [
|
|
229
|
+
{ kind: "index", name: "by_slug", columns: ["slug"] },
|
|
230
|
+
{ kind: "index", name: "by_principalId", columns: ["principalId"] },
|
|
231
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
232
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
233
|
+
]
|
|
234
|
+
});
|
|
235
|
+
var apiKeys = defineTable({
|
|
236
|
+
name: "apiKeys",
|
|
237
|
+
component: "mc",
|
|
238
|
+
category: "tenant",
|
|
239
|
+
shape: z.object({
|
|
240
|
+
"tenantId": idOf("tenants"),
|
|
241
|
+
"keyPrefix": z.enum(["luc", "stk"]),
|
|
242
|
+
"keyHash": z.string(),
|
|
243
|
+
"keyHint": z.string(),
|
|
244
|
+
"label": z.string().optional(),
|
|
245
|
+
"status": z.enum(["active", "revoked", "expired"]),
|
|
246
|
+
"expiresAt": z.number().optional(),
|
|
247
|
+
"lastUsedAt": z.number().optional(),
|
|
248
|
+
"revokedAt": z.number().optional(),
|
|
249
|
+
"revokedBy": z.string().optional(),
|
|
250
|
+
"createdBy": z.string(),
|
|
251
|
+
"createdAt": z.number(),
|
|
252
|
+
"updatedAt": z.number()
|
|
253
|
+
}),
|
|
254
|
+
indices: [
|
|
255
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
256
|
+
{ kind: "index", name: "by_keyHash", columns: ["keyHash"] },
|
|
257
|
+
{ kind: "index", name: "by_tenant_prefix", columns: ["tenantId", "keyPrefix"] },
|
|
258
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
259
|
+
]
|
|
260
|
+
});
|
|
261
|
+
var auditLog = defineTable({
|
|
262
|
+
name: "auditLog",
|
|
263
|
+
component: "mc",
|
|
264
|
+
category: "tenant",
|
|
265
|
+
shape: z.object({
|
|
266
|
+
"tenantId": idOf("tenants").optional(),
|
|
267
|
+
"apiKeyId": idOf("apiKeys").optional(),
|
|
268
|
+
"action": z.enum(["key_created", "key_revoked", "key_expired", "key_used", "tenant_secret_created", "tenant_secret_rotated", "tenant_secret_revoked", "tenant_slot_binding_upserted", "tenant_slot_binding_revoked", "proxy_token_minted", "proxy_request_recorded", "tenant_created", "tenant_updated", "tenant_suspended", "tenant_archived", "tenant_reactivated", "principal_created", "principal_updated", "principal_suspended", "membership_created", "membership_updated", "membership_revoked", "group_created", "group_updated", "group_deleted", "group_member_added", "group_member_removed", "workspace_created", "workspace_updated", "workspace_archived", "workspace_deployment_set", "workspace_deployment_removed", "service_key_created", "service_key_rotated", "service_key_revoked", "service_key_used", "service_key_auth_failed", "session_created", "session_validated", "session_revoked", "session_cascade_revoked", "session_expired", "sandbox_created", "sandbox_secret_injected", "sandbox_execution_started", "sandbox_execution_completed", "sandbox_limit_violated", "policy_created", "policy_updated", "policy_enforced", "policy_archived", "agent_registered", "agent_updated", "tool_registered", "tool_updated", "pack_entitled", "pack_installed", "pack_enabled", "pack_disabled", "pack_entitlement_revoked", "pack_upgraded", "pack_upgrade_committed", "pack_upgrade_rolled_back", "pack_group_assigned", "pack_group_unassigned", "methodology_pack_created", "methodology_pack_updated", "methodology_pack_assigned", "methodology_pack_removed", "pack_assigned_to_group", "pack_revoked_from_group", "pack_ontology_materialized", "pack_ontology_topic_bound", "cutover_flag_set", "cutover_flag_cleared"]),
|
|
269
|
+
"actorClerkId": z.string(),
|
|
270
|
+
"details": z.any().optional(),
|
|
271
|
+
"createdAt": z.number()
|
|
272
|
+
}),
|
|
273
|
+
indices: [
|
|
274
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
|
|
275
|
+
{ kind: "index", name: "by_apiKeyId", columns: ["apiKeyId", "createdAt"] },
|
|
276
|
+
{ kind: "index", name: "by_action", columns: ["action", "createdAt"] }
|
|
277
|
+
]
|
|
278
|
+
});
|
|
279
|
+
var tenants = defineTable({
|
|
280
|
+
name: "tenants",
|
|
281
|
+
component: "mc",
|
|
282
|
+
category: "tenant",
|
|
283
|
+
shape: z.object({
|
|
284
|
+
"slug": z.string(),
|
|
285
|
+
"name": z.string(),
|
|
286
|
+
"status": z.enum(["provisioning", "active", "suspended", "archived"]),
|
|
287
|
+
"tier": z.enum(["free", "developer", "team", "enterprise"]),
|
|
288
|
+
"kernelDeployment": z.object({
|
|
289
|
+
"devUrl": z.string(),
|
|
290
|
+
"devId": z.string(),
|
|
291
|
+
"stagingUrl": z.string().optional(),
|
|
292
|
+
"stagingId": z.string().optional(),
|
|
293
|
+
"prodUrl": z.string().optional(),
|
|
294
|
+
"prodId": z.string().optional()
|
|
295
|
+
}).optional(),
|
|
296
|
+
"lucernDeployment": z.object({
|
|
297
|
+
"devUrl": z.string(),
|
|
298
|
+
"devId": z.string(),
|
|
299
|
+
"stagingUrl": z.string().optional(),
|
|
300
|
+
"stagingId": z.string().optional(),
|
|
301
|
+
"prodUrl": z.string().optional(),
|
|
302
|
+
"prodId": z.string().optional()
|
|
303
|
+
}).optional(),
|
|
304
|
+
"appDeployment": z.object({
|
|
305
|
+
"devUrl": z.string(),
|
|
306
|
+
"devId": z.string(),
|
|
307
|
+
"stagingUrl": z.string().optional(),
|
|
308
|
+
"stagingId": z.string().optional(),
|
|
309
|
+
"prodUrl": z.string().optional(),
|
|
310
|
+
"prodId": z.string().optional()
|
|
311
|
+
}).optional(),
|
|
312
|
+
"ownerClerkId": z.string(),
|
|
313
|
+
"ownerEmail": z.string().optional(),
|
|
314
|
+
"metadata": z.any().optional(),
|
|
315
|
+
"createdAt": z.number(),
|
|
316
|
+
"updatedAt": z.number()
|
|
317
|
+
}),
|
|
318
|
+
indices: [
|
|
319
|
+
{ kind: "index", name: "by_slug", columns: ["slug"] },
|
|
320
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
321
|
+
{ kind: "index", name: "by_ownerClerkId", columns: ["ownerClerkId"] }
|
|
322
|
+
]
|
|
323
|
+
});
|
|
324
|
+
var autofixJobs = defineTable({
|
|
325
|
+
name: "autofixJobs",
|
|
326
|
+
component: "kernel",
|
|
327
|
+
category: "infra",
|
|
328
|
+
shape: z.object({
|
|
329
|
+
"sentryIssueId": z.string(),
|
|
330
|
+
"sentryEventId": z.string(),
|
|
331
|
+
"fingerprint": z.string(),
|
|
332
|
+
"dedupeKey": z.string(),
|
|
333
|
+
"errorType": z.string(),
|
|
334
|
+
"errorMessage": z.string(),
|
|
335
|
+
"stackTrace": z.string().optional(),
|
|
336
|
+
"filePaths": z.array(z.string()),
|
|
337
|
+
"environment": z.string(),
|
|
338
|
+
"sentryProjectSlug": z.string(),
|
|
339
|
+
"sentryOrgSlug": z.string(),
|
|
340
|
+
"sentryIssueUrl": z.string().optional(),
|
|
341
|
+
"triggeredRule": z.string(),
|
|
342
|
+
"sentryPayload": z.record(z.any()),
|
|
343
|
+
"allowlistEligible": z.boolean(),
|
|
344
|
+
"allowlistReason": z.string(),
|
|
345
|
+
"status": z.enum(["pending", "claimed", "running", "iterating", "succeeded", "failed", "cancelled"]),
|
|
346
|
+
"claimedBy": z.string().optional(),
|
|
347
|
+
"claimedAt": z.number().optional(),
|
|
348
|
+
"startedAt": z.number().optional(),
|
|
349
|
+
"completedAt": z.number().optional(),
|
|
350
|
+
"error": z.string().optional(),
|
|
351
|
+
"prNumber": z.number().optional(),
|
|
352
|
+
"prUrl": z.string().optional(),
|
|
353
|
+
"commitSha": z.string().optional(),
|
|
354
|
+
"branchName": z.string().optional(),
|
|
355
|
+
"harnessReceipt": z.object({
|
|
356
|
+
"runnerSessionId": z.string(),
|
|
357
|
+
"startedAt": z.number(),
|
|
358
|
+
"completedAt": z.number(),
|
|
359
|
+
"fixDescription": z.string().optional(),
|
|
360
|
+
"filesChanged": z.array(z.string()),
|
|
361
|
+
"verificationResults": z.array(z.object({
|
|
362
|
+
"command": z.string(),
|
|
363
|
+
"status": z.enum(["pass", "fail", "skipped"]),
|
|
364
|
+
"summary": z.string().optional()
|
|
365
|
+
})),
|
|
366
|
+
"commitShas": z.array(z.string()),
|
|
367
|
+
"prCreated": z.boolean(),
|
|
368
|
+
"errorSummary": z.string().optional()
|
|
369
|
+
}).optional(),
|
|
370
|
+
"iterationReceipts": z.array(z.object({
|
|
371
|
+
"iteration": z.number(),
|
|
372
|
+
"startedAt": z.number(),
|
|
373
|
+
"completedAt": z.number(),
|
|
374
|
+
"checkConclusion": z.string(),
|
|
375
|
+
"failureSummary": z.string().optional(),
|
|
376
|
+
"actionTaken": z.string(),
|
|
377
|
+
"commitSha": z.string().optional(),
|
|
378
|
+
"filesChanged": z.array(z.string()).optional(),
|
|
379
|
+
"agentConfidence": z.number().optional(),
|
|
380
|
+
"errorSignature": z.string().optional()
|
|
381
|
+
})).optional(),
|
|
382
|
+
"iterationCount": z.number().optional(),
|
|
383
|
+
"maxIterations": z.number().optional(),
|
|
384
|
+
"lastCheckConclusion": z.string().optional(),
|
|
385
|
+
"stopReason": z.string().optional(),
|
|
386
|
+
"iterationPolicy": z.object({
|
|
387
|
+
"maxIterations": z.number(),
|
|
388
|
+
"pollIntervalMs": z.number(),
|
|
389
|
+
"flakeThreshold": z.number(),
|
|
390
|
+
"confidenceFloor": z.number()
|
|
391
|
+
}).optional(),
|
|
392
|
+
"attemptCount": z.number(),
|
|
393
|
+
"maxAttempts": z.number(),
|
|
394
|
+
"createdAt": z.number(),
|
|
395
|
+
"updatedAt": z.number()
|
|
396
|
+
}),
|
|
397
|
+
indices: [
|
|
398
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
399
|
+
{ kind: "index", name: "by_dedupeKey", columns: ["dedupeKey"] },
|
|
400
|
+
{ kind: "index", name: "by_sentryIssueId", columns: ["sentryIssueId"] },
|
|
401
|
+
{ kind: "index", name: "by_status_createdAt", columns: ["status", "createdAt"] },
|
|
402
|
+
{ kind: "index", name: "by_environment", columns: ["environment"] },
|
|
403
|
+
{ kind: "index", name: "by_claimedBy", columns: ["claimedBy"] },
|
|
404
|
+
{ kind: "index", name: "by_createdAt", columns: ["createdAt"] }
|
|
405
|
+
]
|
|
406
|
+
});
|
|
407
|
+
var neo4jSyncQueue = defineTable({
|
|
408
|
+
name: "neo4jSyncQueue",
|
|
409
|
+
component: "kernel",
|
|
410
|
+
category: "infra",
|
|
411
|
+
shape: z.object({
|
|
412
|
+
"entityType": z.enum(["node", "edge"]),
|
|
413
|
+
"entityId": z.string(),
|
|
414
|
+
"operation": z.enum(["upsert", "delete"]),
|
|
415
|
+
"attempts": z.number(),
|
|
416
|
+
"maxAttempts": z.number(),
|
|
417
|
+
"lastAttemptAt": z.number().optional(),
|
|
418
|
+
"lastError": z.string().optional(),
|
|
419
|
+
"status": z.enum(["pending", "in_progress", "failed", "succeeded"]),
|
|
420
|
+
"createdAt": z.number(),
|
|
421
|
+
"updatedAt": z.number()
|
|
422
|
+
}),
|
|
423
|
+
indices: [
|
|
424
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
425
|
+
{ kind: "index", name: "by_entity", columns: ["entityType", "entityId"] },
|
|
426
|
+
{ kind: "index", name: "by_status_attempts", columns: ["status", "attempts"] }
|
|
427
|
+
]
|
|
428
|
+
});
|
|
429
|
+
var backgroundJobRuns = defineTable({
|
|
430
|
+
name: "backgroundJobRuns",
|
|
431
|
+
component: "kernel",
|
|
432
|
+
category: "infra",
|
|
433
|
+
shape: z.object({
|
|
434
|
+
"jobKey": z.string(),
|
|
435
|
+
"scheduler": z.string(),
|
|
436
|
+
"triggeredBy": z.string(),
|
|
437
|
+
"status": z.enum(["running", "completed", "failed", "skipped"]),
|
|
438
|
+
"startedAt": z.number(),
|
|
439
|
+
"completedAt": z.number().optional(),
|
|
440
|
+
"durationMs": z.number().optional(),
|
|
441
|
+
"resultSummary": z.string().optional(),
|
|
442
|
+
"error": z.string().optional()
|
|
443
|
+
}),
|
|
444
|
+
indices: [
|
|
445
|
+
{ kind: "index", name: "by_jobKey", columns: ["jobKey"] },
|
|
446
|
+
{ kind: "index", name: "by_startedAt", columns: ["startedAt"] },
|
|
447
|
+
{ kind: "index", name: "by_jobKey_startedAt", columns: ["jobKey", "startedAt"] },
|
|
448
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
449
|
+
]
|
|
450
|
+
});
|
|
451
|
+
var backgroundJobSettings = defineTable({
|
|
452
|
+
name: "backgroundJobSettings",
|
|
453
|
+
component: "kernel",
|
|
454
|
+
category: "infra",
|
|
455
|
+
shape: z.object({
|
|
456
|
+
"jobKey": z.string(),
|
|
457
|
+
"enabled": z.boolean(),
|
|
458
|
+
"notes": z.string().optional(),
|
|
459
|
+
"updatedAt": z.number(),
|
|
460
|
+
"updatedBy": z.string()
|
|
461
|
+
}),
|
|
462
|
+
indices: [
|
|
463
|
+
{ kind: "index", name: "by_jobKey", columns: ["jobKey"] },
|
|
464
|
+
{ kind: "index", name: "by_enabled", columns: ["enabled"] },
|
|
465
|
+
{ kind: "index", name: "by_updatedAt", columns: ["updatedAt"] }
|
|
466
|
+
]
|
|
467
|
+
});
|
|
468
|
+
var systemLogs = defineTable({
|
|
469
|
+
name: "systemLogs",
|
|
470
|
+
component: "kernel",
|
|
471
|
+
category: "infra",
|
|
472
|
+
shape: z.object({
|
|
473
|
+
"chatId": z.string().optional(),
|
|
474
|
+
"workflowId": z.string().optional(),
|
|
475
|
+
"threadId": z.string().optional(),
|
|
476
|
+
"level": z.string(),
|
|
477
|
+
"source": z.string(),
|
|
478
|
+
"message": z.string(),
|
|
479
|
+
"metadata": z.record(z.any()).optional(),
|
|
480
|
+
"traceId": z.string().optional(),
|
|
481
|
+
"createdAt": z.number()
|
|
482
|
+
}),
|
|
483
|
+
indices: [
|
|
484
|
+
{ kind: "index", name: "by_chatId", columns: ["chatId"] },
|
|
485
|
+
{ kind: "index", name: "by_workflowId", columns: ["workflowId"] },
|
|
486
|
+
{ kind: "index", name: "by_threadId", columns: ["threadId"] },
|
|
487
|
+
{ kind: "index", name: "by_traceId", columns: ["traceId"] },
|
|
488
|
+
{ kind: "index", name: "by_level", columns: ["level"] },
|
|
489
|
+
{ kind: "index", name: "by_source", columns: ["source"] }
|
|
490
|
+
]
|
|
491
|
+
});
|
|
492
|
+
var beliefConfidence = defineTable({
|
|
493
|
+
name: "beliefConfidence",
|
|
494
|
+
component: "kernel",
|
|
495
|
+
category: "epistemic",
|
|
496
|
+
shape: z.object({
|
|
497
|
+
"beliefId": z.string(),
|
|
498
|
+
"belief": z.number(),
|
|
499
|
+
"disbelief": z.number(),
|
|
500
|
+
"uncertainty": z.number(),
|
|
501
|
+
"baseRate": z.number(),
|
|
502
|
+
"slOperator": z.string().optional(),
|
|
503
|
+
"confidence": z.number(),
|
|
504
|
+
"confidenceLevel": z.enum(["high", "medium", "low"]).optional(),
|
|
505
|
+
"valence": z.number().optional(),
|
|
506
|
+
"certainty": z.number().optional(),
|
|
507
|
+
"assessedAt": z.number(),
|
|
508
|
+
"assessedBy": z.string(),
|
|
509
|
+
"trigger": z.enum(["initial", "evidence_added", "evidence_removed", "contradiction_detected", "contradiction_resolved", "propagation", "agent_assessment", "worktree_outcome", "worktree_completed", "fusion", "discount", "deduction", "backfill_synthetic"]),
|
|
510
|
+
"rationale": z.string().optional(),
|
|
511
|
+
"triggeringEvidenceId": z.string().optional(),
|
|
512
|
+
"triggeringEvidenceIds": z.array(z.string()).optional(),
|
|
513
|
+
"triggeringQuestionId": z.string().optional(),
|
|
514
|
+
"triggeringAnswerId": z.string().optional(),
|
|
515
|
+
"triggeringContradictionId": idOf("contradictions").optional(),
|
|
516
|
+
"triggeringWorktreeId": z.string().optional(),
|
|
517
|
+
"triggeringAgentId": z.string().optional(),
|
|
518
|
+
"isAgentAssessment": z.boolean().optional()
|
|
519
|
+
}),
|
|
520
|
+
indices: [
|
|
521
|
+
{ kind: "index", name: "by_beliefId", columns: ["beliefId"] },
|
|
522
|
+
{ kind: "index", name: "by_beliefId_time", columns: ["beliefId", "assessedAt"] },
|
|
523
|
+
{ kind: "index", name: "by_trigger", columns: ["trigger"] }
|
|
524
|
+
]
|
|
525
|
+
});
|
|
526
|
+
var beliefEvidenceLinks = defineTable({
|
|
527
|
+
name: "beliefEvidenceLinks",
|
|
528
|
+
component: "kernel",
|
|
529
|
+
category: "epistemic",
|
|
530
|
+
shape: z.object({
|
|
531
|
+
"beliefId": z.string(),
|
|
532
|
+
"insightId": z.string(),
|
|
533
|
+
"relation": z.enum(["supports", "contradicts"]),
|
|
534
|
+
"confidence": z.number().optional(),
|
|
535
|
+
"rationale": z.string().optional(),
|
|
536
|
+
"status": z.enum(["suggested", "approved", "dismissed"]).optional(),
|
|
537
|
+
"createdBy": z.string(),
|
|
538
|
+
"createdAt": z.number()
|
|
539
|
+
}),
|
|
540
|
+
indices: [
|
|
541
|
+
{ kind: "index", name: "by_beliefId", columns: ["beliefId"] },
|
|
542
|
+
{ kind: "index", name: "by_insightId", columns: ["insightId"] },
|
|
543
|
+
{ kind: "index", name: "by_relation", columns: ["beliefId", "relation"] },
|
|
544
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
545
|
+
]
|
|
546
|
+
});
|
|
547
|
+
var beliefHistory = defineTable({
|
|
548
|
+
name: "beliefHistory",
|
|
549
|
+
component: "kernel",
|
|
550
|
+
category: "epistemic",
|
|
551
|
+
shape: z.object({
|
|
552
|
+
"beliefId": z.string(),
|
|
553
|
+
"timestamp": z.number(),
|
|
554
|
+
"previousStatus": z.string().optional(),
|
|
555
|
+
"newStatus": z.string(),
|
|
556
|
+
"justification": z.string().optional(),
|
|
557
|
+
"triggeredByEvidenceIds": z.array(z.string()).optional(),
|
|
558
|
+
"triggeredByUserId": z.string().optional()
|
|
559
|
+
}),
|
|
560
|
+
indices: [
|
|
561
|
+
{ kind: "index", name: "by_beliefId", columns: ["beliefId"] }
|
|
562
|
+
]
|
|
563
|
+
});
|
|
564
|
+
var beliefScenarios = defineTable({
|
|
565
|
+
name: "beliefScenarios",
|
|
566
|
+
component: "kernel",
|
|
567
|
+
category: "epistemic",
|
|
568
|
+
shape: z.object({
|
|
569
|
+
"topicId": z.string().optional(),
|
|
570
|
+
"testedBeliefId": z.string(),
|
|
571
|
+
"scenarioType": z.enum(["falsification", "strengthening", "alternative", "collapse", "critical_path"]),
|
|
572
|
+
"assumedState": z.enum(["false", "true", "weakened", "strengthened"]),
|
|
573
|
+
"title": z.string(),
|
|
574
|
+
"description": z.string(),
|
|
575
|
+
"cascadeEffects": z.array(z.object({
|
|
576
|
+
"beliefId": z.string(),
|
|
577
|
+
"beliefText": z.string(),
|
|
578
|
+
"currentConfidence": z.string(),
|
|
579
|
+
"projectedConfidence": z.string(),
|
|
580
|
+
"reason": z.string()
|
|
581
|
+
})),
|
|
582
|
+
"thesisImpact": z.enum(["thesis_fails", "thesis_weakens", "pillar_fails", "localized", "minimal"]),
|
|
583
|
+
"pillarImpacts": z.array(z.object({
|
|
584
|
+
"pillar": z.string(),
|
|
585
|
+
"impactLevel": z.string(),
|
|
586
|
+
"reason": z.string()
|
|
587
|
+
})).optional(),
|
|
588
|
+
"keyInsights": z.array(z.string()),
|
|
589
|
+
"recommendedActions": z.array(z.object({
|
|
590
|
+
"action": z.string(),
|
|
591
|
+
"priority": z.string(),
|
|
592
|
+
"rationale": z.string()
|
|
593
|
+
})).optional(),
|
|
594
|
+
"sourceWorktreeId": z.string().optional(),
|
|
595
|
+
"sourceChatId": idOf("chats").optional(),
|
|
596
|
+
"sourceMessageId": idOf("messages").optional(),
|
|
597
|
+
"createdAt": z.number(),
|
|
598
|
+
"createdBy": z.string()
|
|
599
|
+
}),
|
|
600
|
+
indices: [
|
|
601
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
602
|
+
{ kind: "index", name: "by_topic_scenarioType", columns: ["topicId", "scenarioType"] },
|
|
603
|
+
{ kind: "index", name: "by_topic_thesisImpact", columns: ["topicId", "thesisImpact"] },
|
|
604
|
+
{ kind: "index", name: "by_testedBelief", columns: ["testedBeliefId"] },
|
|
605
|
+
{ kind: "index", name: "by_sourceWorktreeId", columns: ["sourceWorktreeId"] }
|
|
606
|
+
]
|
|
607
|
+
});
|
|
608
|
+
var contractEvaluations = defineTable({
|
|
609
|
+
name: "contractEvaluations",
|
|
610
|
+
component: "kernel",
|
|
611
|
+
category: "epistemic",
|
|
612
|
+
shape: z.object({
|
|
613
|
+
"contractId": z.string(),
|
|
614
|
+
"beliefNodeId": z.string(),
|
|
615
|
+
"result": z.enum(["confirmed", "disconfirmed", "partial", "expired", "error", "inconclusive"]),
|
|
616
|
+
"evaluatedAt": z.number(),
|
|
617
|
+
"evaluator": z.string(),
|
|
618
|
+
"trigger": z.string(),
|
|
619
|
+
"resultData": z.union([z.string(), z.number(), z.boolean(), z.null(), z.record(z.any()), z.array(z.any())]).optional(),
|
|
620
|
+
"modulationApplied": z.boolean(),
|
|
621
|
+
"confidenceDelta": z.number().optional(),
|
|
622
|
+
"confidenceBefore": z.number().optional(),
|
|
623
|
+
"confidenceAfter": z.number().optional(),
|
|
624
|
+
"beliefConfidenceId": idOf("beliefConfidence").optional(),
|
|
625
|
+
"modulationRationale": z.string().optional(),
|
|
626
|
+
"topicId": z.string().optional()
|
|
627
|
+
}),
|
|
628
|
+
indices: [
|
|
629
|
+
{ kind: "index", name: "by_contract", columns: ["contractId"] },
|
|
630
|
+
{ kind: "index", name: "by_contract_time", columns: ["contractId", "evaluatedAt"] },
|
|
631
|
+
{ kind: "index", name: "by_belief", columns: ["beliefNodeId"] },
|
|
632
|
+
{ kind: "index", name: "by_result", columns: ["result"] },
|
|
633
|
+
{ kind: "index", name: "by_time", columns: ["evaluatedAt"] },
|
|
634
|
+
{ kind: "index", name: "by_topic_time", columns: ["topicId", "evaluatedAt"] }
|
|
635
|
+
]
|
|
636
|
+
});
|
|
637
|
+
var contradictions = defineTable({
|
|
638
|
+
name: "contradictions",
|
|
639
|
+
component: "kernel",
|
|
640
|
+
category: "epistemic",
|
|
641
|
+
shape: z.object({
|
|
642
|
+
"topicId": z.string().optional(),
|
|
643
|
+
"beliefId": z.string(),
|
|
644
|
+
"supportingInsightIds": z.array(z.string()),
|
|
645
|
+
"contradictingInsightIds": z.array(z.string()),
|
|
646
|
+
"resolutionStatus": z.enum(["unresolved", "investigating", "accepted_as_permanent", "resolved_by_fork", "resolved_by_evidence", "resolved_by_reinterpretation", "superseded"]),
|
|
647
|
+
"status": z.enum(["unresolved", "investigating", "resolved_support", "resolved_contra", "belief_forked"]).optional(),
|
|
648
|
+
"blocksDecisionFinalization": z.boolean().optional(),
|
|
649
|
+
"blockingReason": z.string().optional(),
|
|
650
|
+
"severity": z.enum(["critical", "significant", "minor"]),
|
|
651
|
+
"aiAnalysis": z.object({
|
|
652
|
+
"summary": z.string(),
|
|
653
|
+
"likelyExplanation": z.string(),
|
|
654
|
+
"suggestedResolution": z.string(),
|
|
655
|
+
"confidenceInAnalysis": z.number(),
|
|
656
|
+
"analyzedAt": z.number()
|
|
657
|
+
}).optional(),
|
|
658
|
+
"resolutionWorktreeId": z.string().optional(),
|
|
659
|
+
"resolution": z.object({
|
|
660
|
+
"verdict": z.string(),
|
|
661
|
+
"reasoning": z.string(),
|
|
662
|
+
"beliefUpdate": z.string(),
|
|
663
|
+
"resolvedBy": z.string()
|
|
664
|
+
}).optional(),
|
|
665
|
+
"resultingBeliefIds": z.array(z.string()).optional(),
|
|
666
|
+
"detectionMethod": z.enum(["semantic", "keyword", "manual", "agent"]).optional(),
|
|
667
|
+
"similarityScore": z.number().optional(),
|
|
668
|
+
"detectedAt": z.number(),
|
|
669
|
+
"resolvedAt": z.number().optional(),
|
|
670
|
+
"lastReviewedAt": z.number().optional(),
|
|
671
|
+
"createdBy": z.string()
|
|
672
|
+
}),
|
|
673
|
+
indices: [
|
|
674
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
675
|
+
{ kind: "index", name: "by_topic_resolutionStatus", columns: ["topicId", "resolutionStatus"] },
|
|
676
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] },
|
|
677
|
+
{ kind: "index", name: "by_topic_severity", columns: ["topicId", "severity"] },
|
|
678
|
+
{ kind: "index", name: "by_topic_blocking", columns: ["topicId", "blocksDecisionFinalization"] },
|
|
679
|
+
{ kind: "index", name: "by_beliefId", columns: ["beliefId"] }
|
|
680
|
+
]
|
|
681
|
+
});
|
|
682
|
+
var epistemicAudit = defineTable({
|
|
683
|
+
name: "epistemicAudit",
|
|
684
|
+
component: "kernel",
|
|
685
|
+
category: "epistemic",
|
|
686
|
+
shape: z.object({
|
|
687
|
+
"entityType": z.enum(["belief", "evidence", "question", "answer", "contradiction", "decision", "proposal", "edge", "node", "entity", "source", "belief_conditional", "belief_scenario", "ontologyDefinition", "ontologyVersion"]),
|
|
688
|
+
"entityId": z.string(),
|
|
689
|
+
"changeType": z.enum(["created", "status_changed", "confidence_changed", "criticality_changed", "formulation_modified", "forked", "superseded", "archived", "resolved", "severity_changed", "edge_added", "edge_removed", "annotated", "blocked", "unblocked", "decision_finalized", "proposal_accepted", "proposal_rejected", "pillar_changed", "updated", "deleted", "entity_merged", "entity_attributes_updated", "entity_archived", "published", "deprecated", "source_created", "source_metadata_updated"]),
|
|
690
|
+
"changedAt": z.number(),
|
|
691
|
+
"changedBy": z.string(),
|
|
692
|
+
"isAgent": z.boolean(),
|
|
693
|
+
"agentType": z.string().optional(),
|
|
694
|
+
"previousState": z.union([z.record(z.any()), z.null()]).optional(),
|
|
695
|
+
"newState": z.union([z.record(z.any()), z.null()]).optional(),
|
|
696
|
+
"rationale": z.string().optional(),
|
|
697
|
+
"triggeringAction": z.string().optional(),
|
|
698
|
+
"topicId": z.string().optional(),
|
|
699
|
+
"proposalId": z.string().optional(),
|
|
700
|
+
"mcpSessionId": z.string().optional(),
|
|
701
|
+
"mcpToolName": z.string().optional(),
|
|
702
|
+
"sourceCommit": z.string().optional()
|
|
703
|
+
}),
|
|
704
|
+
indices: [
|
|
705
|
+
{ kind: "index", name: "by_entityId", columns: ["entityId"] },
|
|
706
|
+
{ kind: "index", name: "by_entityType", columns: ["entityType"] },
|
|
707
|
+
{ kind: "index", name: "by_entityType_id", columns: ["entityType", "entityId"] },
|
|
708
|
+
{ kind: "index", name: "by_changedAt", columns: ["changedAt"] },
|
|
709
|
+
{ kind: "index", name: "by_changedBy", columns: ["changedBy"] },
|
|
710
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
711
|
+
{ kind: "index", name: "by_changeType", columns: ["changeType"] },
|
|
712
|
+
{ kind: "index", name: "by_mcpSessionId", columns: ["mcpSessionId"] }
|
|
713
|
+
]
|
|
714
|
+
});
|
|
715
|
+
var epistemicContracts = defineTable({
|
|
716
|
+
name: "epistemicContracts",
|
|
717
|
+
component: "kernel",
|
|
718
|
+
category: "epistemic",
|
|
719
|
+
shape: z.object({
|
|
720
|
+
"beliefNodeId": z.string(),
|
|
721
|
+
"contractId": z.string(),
|
|
722
|
+
"title": z.string(),
|
|
723
|
+
"description": z.string().optional(),
|
|
724
|
+
"conditionType": z.enum(["assertion", "temporal", "evidential", "threshold", "composite"]),
|
|
725
|
+
"direction": z.enum(["confirms", "falsifies"]),
|
|
726
|
+
"condition": z.object({
|
|
727
|
+
"expression": z.string(),
|
|
728
|
+
"evaluator": z.string(),
|
|
729
|
+
"evaluatorConfig": z.union([z.string(), z.number(), z.boolean(), z.null(), z.record(z.any()), z.array(z.any())]).optional()
|
|
730
|
+
}),
|
|
731
|
+
"deadline": z.number().optional(),
|
|
732
|
+
"compositeOf": z.array(z.string()).optional(),
|
|
733
|
+
"compositeOperator": z.enum(["all", "any", "majority"]).optional(),
|
|
734
|
+
"modulation": z.object({
|
|
735
|
+
"onConfirmed": z.object({
|
|
736
|
+
"delta": z.number(),
|
|
737
|
+
"ceiling": z.number().optional()
|
|
738
|
+
}),
|
|
739
|
+
"onDisconfirmed": z.object({
|
|
740
|
+
"delta": z.number(),
|
|
741
|
+
"floor": z.number().optional()
|
|
742
|
+
}),
|
|
743
|
+
"onExpired": z.object({
|
|
744
|
+
"delta": z.number()
|
|
745
|
+
}).optional(),
|
|
746
|
+
"onPartial": z.object({
|
|
747
|
+
"threshold": z.number(),
|
|
748
|
+
"delta": z.number()
|
|
749
|
+
}).optional()
|
|
750
|
+
}),
|
|
751
|
+
"evaluationSchedule": z.enum(["on_demand", "on_evidence", "periodic", "event_driven"]),
|
|
752
|
+
"periodicIntervalMs": z.number().optional(),
|
|
753
|
+
"status": z.enum(["active", "satisfied", "violated", "expired", "suspended", "archived"]),
|
|
754
|
+
"lineageSource": z.enum(["declared", "inherited"]),
|
|
755
|
+
"inheritedFromContractId": z.string().optional(),
|
|
756
|
+
"inheritedFromBeliefNodeId": z.string().optional(),
|
|
757
|
+
"inheritedAt": z.number().optional(),
|
|
758
|
+
"lastEvaluatedAt": z.number().optional(),
|
|
759
|
+
"evaluationCount": z.number().optional(),
|
|
760
|
+
"topicId": z.string().optional(),
|
|
761
|
+
"createdAt": z.number(),
|
|
762
|
+
"createdBy": z.string(),
|
|
763
|
+
"updatedAt": z.number()
|
|
764
|
+
}),
|
|
765
|
+
indices: [
|
|
766
|
+
{ kind: "index", name: "by_contractId", columns: ["contractId"] },
|
|
767
|
+
{ kind: "index", name: "by_belief", columns: ["beliefNodeId"] },
|
|
768
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
769
|
+
{ kind: "index", name: "by_evaluator", columns: ["condition.evaluator"] },
|
|
770
|
+
{ kind: "index", name: "by_topic", columns: ["topicId"] },
|
|
771
|
+
{ kind: "index", name: "by_schedule", columns: ["evaluationSchedule"] }
|
|
772
|
+
]
|
|
773
|
+
});
|
|
774
|
+
var questionEvidenceLinks = defineTable({
|
|
775
|
+
name: "questionEvidenceLinks",
|
|
776
|
+
component: "kernel",
|
|
777
|
+
category: "epistemic",
|
|
778
|
+
shape: z.object({
|
|
779
|
+
"questionId": z.string(),
|
|
780
|
+
"insightId": z.string(),
|
|
781
|
+
"helpsAnswer": z.boolean(),
|
|
782
|
+
"relevance": z.number().optional(),
|
|
783
|
+
"rationale": z.string().optional(),
|
|
784
|
+
"impactScore": z.number().optional(),
|
|
785
|
+
"impact": z.enum(["supports", "contradicts", "neutral"]).optional(),
|
|
786
|
+
"status": z.enum(["suggested", "approved", "dismissed"]).optional(),
|
|
787
|
+
"createdBy": z.string(),
|
|
788
|
+
"createdAt": z.number()
|
|
789
|
+
}),
|
|
790
|
+
indices: [
|
|
791
|
+
{ kind: "index", name: "by_questionId", columns: ["questionId"] },
|
|
792
|
+
{ kind: "index", name: "by_insightId", columns: ["insightId"] },
|
|
793
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
794
|
+
]
|
|
795
|
+
});
|
|
796
|
+
var beliefVotes = defineTable({
|
|
797
|
+
name: "beliefVotes",
|
|
798
|
+
component: "kernel",
|
|
799
|
+
category: "decision",
|
|
800
|
+
shape: z.object({
|
|
801
|
+
"decisionEventId": idOf("decisionEvents"),
|
|
802
|
+
"topicId": z.string().optional(),
|
|
803
|
+
"tenantId": z.string().optional(),
|
|
804
|
+
"workspaceId": z.string().optional(),
|
|
805
|
+
"voterPrincipalId": z.string(),
|
|
806
|
+
"voterUserId": z.string().optional(),
|
|
807
|
+
"voterRole": z.enum(["owner", "facilitator", "decision_maker", "advisor", "observer", "recorder"]).optional(),
|
|
808
|
+
"stakeholderGroupId": idOf("stakeholderGroups").optional(),
|
|
809
|
+
"beliefId": idOf("epistemicNodes"),
|
|
810
|
+
"domainCategory": z.string().optional(),
|
|
811
|
+
"voteDirection": z.enum(["support", "oppose", "abstain", "uncertain"]),
|
|
812
|
+
"confidence": z.number(),
|
|
813
|
+
"probability": z.number().optional(),
|
|
814
|
+
"comment": z.string().optional(),
|
|
815
|
+
"isHingeVote": z.boolean().optional(),
|
|
816
|
+
"status": z.enum(["active", "superseded", "withdrawn"]),
|
|
817
|
+
"supersedesVoteId": idOf("beliefVotes").optional(),
|
|
818
|
+
"supersededByVoteId": idOf("beliefVotes").optional(),
|
|
819
|
+
"weightingModelVersion": z.string(),
|
|
820
|
+
"weightingInput": z.record(z.any()).optional(),
|
|
821
|
+
"effectiveWeight": z.number().optional(),
|
|
822
|
+
"policyTraceId": z.string().optional(),
|
|
823
|
+
"createdBy": z.string(),
|
|
824
|
+
"createdAt": z.number(),
|
|
825
|
+
"updatedAt": z.number()
|
|
826
|
+
}),
|
|
827
|
+
indices: [
|
|
828
|
+
{ kind: "index", name: "by_decisionEventId", columns: ["decisionEventId"] },
|
|
829
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
830
|
+
{ kind: "index", name: "by_decision_belief", columns: ["decisionEventId", "beliefId"] },
|
|
831
|
+
{ kind: "index", name: "by_decision_belief_voter", columns: ["decisionEventId", "beliefId", "voterPrincipalId"] },
|
|
832
|
+
{ kind: "index", name: "by_decision_status", columns: ["decisionEventId", "status"] },
|
|
833
|
+
{ kind: "index", name: "by_supersedesVoteId", columns: ["supersedesVoteId"] }
|
|
834
|
+
]
|
|
835
|
+
});
|
|
836
|
+
var calibrationScores = defineTable({
|
|
837
|
+
name: "calibrationScores",
|
|
838
|
+
component: "kernel",
|
|
839
|
+
category: "decision",
|
|
840
|
+
shape: z.object({
|
|
841
|
+
"principalId": z.string(),
|
|
842
|
+
"topicId": z.string().optional(),
|
|
843
|
+
"tenantId": z.string().optional(),
|
|
844
|
+
"workspaceId": z.string().optional(),
|
|
845
|
+
"decisionEventId": idOf("decisionEvents").optional(),
|
|
846
|
+
"snapshotId": idOf("decisionSnapshots").optional(),
|
|
847
|
+
"scoreType": z.enum(["confidence_alignment", "outcome_accuracy", "weighting_alignment", "readiness_alignment", "brier"]),
|
|
848
|
+
"score": z.number(),
|
|
849
|
+
"inputCount": z.number().optional(),
|
|
850
|
+
"windowStartAt": z.number().optional(),
|
|
851
|
+
"windowEndAt": z.number().optional(),
|
|
852
|
+
"metadata": z.record(z.any()).optional(),
|
|
853
|
+
"createdAt": z.number()
|
|
854
|
+
}),
|
|
855
|
+
indices: [
|
|
856
|
+
{ kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
|
|
857
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
858
|
+
{ kind: "index", name: "by_topic_principal_createdAt", columns: ["topicId", "principalId", "createdAt"] },
|
|
859
|
+
{ kind: "index", name: "by_decisionEventId", columns: ["decisionEventId"] },
|
|
860
|
+
{ kind: "index", name: "by_snapshotId", columns: ["snapshotId"] },
|
|
861
|
+
{ kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] }
|
|
862
|
+
]
|
|
863
|
+
});
|
|
864
|
+
var decisionComputedSummaries = defineTable({
|
|
865
|
+
name: "decisionComputedSummaries",
|
|
866
|
+
component: "kernel",
|
|
867
|
+
category: "decision",
|
|
868
|
+
shape: z.object({
|
|
869
|
+
"decisionEventId": idOf("decisionEvents"),
|
|
870
|
+
"topicId": z.string().optional(),
|
|
871
|
+
"tenantId": z.string().optional(),
|
|
872
|
+
"workspaceId": z.string().optional(),
|
|
873
|
+
"summaryKind": z.enum(["contradiction_map", "hinge_fragility", "certainty_map", "unknown_concentration", "risk_ledger_draft", "readiness_breakdown", "quorum_suggestion", "vote_weighting", "cross_group_divergence", "cross_theme_concentration"]),
|
|
874
|
+
"schemaVersion": z.string(),
|
|
875
|
+
"status": z.enum(["draft", "current", "superseded"]),
|
|
876
|
+
"payload": z.record(z.any()),
|
|
877
|
+
"inputHash": z.string().optional(),
|
|
878
|
+
"policyTraceId": z.string().optional(),
|
|
879
|
+
"supersededBySummaryId": idOf("decisionComputedSummaries").optional(),
|
|
880
|
+
"computedBy": z.string().optional(),
|
|
881
|
+
"computedAt": z.number(),
|
|
882
|
+
"createdAt": z.number(),
|
|
883
|
+
"updatedAt": z.number()
|
|
884
|
+
}),
|
|
885
|
+
indices: [
|
|
886
|
+
{ kind: "index", name: "by_decisionEventId", columns: ["decisionEventId"] },
|
|
887
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
888
|
+
{ kind: "index", name: "by_topic_kind_createdAt", columns: ["topicId", "summaryKind", "computedAt"] },
|
|
889
|
+
{ kind: "index", name: "by_decision_kind_createdAt", columns: ["decisionEventId", "summaryKind", "computedAt"] },
|
|
890
|
+
{ kind: "index", name: "by_decision_status", columns: ["decisionEventId", "status"] }
|
|
891
|
+
]
|
|
892
|
+
});
|
|
893
|
+
var decisionEvents = defineTable({
|
|
894
|
+
name: "decisionEvents",
|
|
895
|
+
component: "kernel",
|
|
896
|
+
category: "decision",
|
|
897
|
+
shape: z.object({
|
|
898
|
+
"eventKey": z.string(),
|
|
899
|
+
"topicId": z.string().optional(),
|
|
900
|
+
"tenantId": z.string().optional(),
|
|
901
|
+
"workspaceId": z.string().optional(),
|
|
902
|
+
"ownerPrincipalId": z.string().optional(),
|
|
903
|
+
"audienceLabel": z.string().optional(),
|
|
904
|
+
"policyTags": z.array(z.string()).optional(),
|
|
905
|
+
"sensitivityTier": z.enum(["low", "medium", "high"]).optional(),
|
|
906
|
+
"exportClass": z.enum(["public_safe", "client_safe", "internal_only"]).optional(),
|
|
907
|
+
"anonymizationClass": z.enum(["none", "standard", "strict"]).optional(),
|
|
908
|
+
"title": z.string(),
|
|
909
|
+
"summary": z.string().optional(),
|
|
910
|
+
"eventType": z.enum(["investment", "deal", "portfolio", "strategy", "operations", "other"]),
|
|
911
|
+
"status": z.enum(["draft", "pre_ic_preparing", "pre_ic_ready", "ic_in_session", "risk_confirmed", "snapshot_locked", "finalized", "reopened", "superseded"]),
|
|
912
|
+
"outcome": z.enum(["approve", "conditional", "defer", "reject", "reopen_on_trigger"]).optional(),
|
|
913
|
+
"scheduledAt": z.number().optional(),
|
|
914
|
+
"startedAt": z.number().optional(),
|
|
915
|
+
"riskConfirmedAt": z.number().optional(),
|
|
916
|
+
"snapshotLockedAt": z.number().optional(),
|
|
917
|
+
"finalizedAt": z.number().optional(),
|
|
918
|
+
"supersedesDecisionEventId": idOf("decisionEvents").optional(),
|
|
919
|
+
"supersededByDecisionEventId": idOf("decisionEvents").optional(),
|
|
920
|
+
"weightingModelVersion": z.string(),
|
|
921
|
+
"weightingParameters": z.record(z.any()).optional(),
|
|
922
|
+
"advisoryReadinessScore": z.number().optional(),
|
|
923
|
+
"advisoryReadinessFactors": z.record(z.any()).optional(),
|
|
924
|
+
"policyTraceId": z.string().optional(),
|
|
925
|
+
"metadata": z.record(z.any()).optional(),
|
|
926
|
+
"createdBy": z.string(),
|
|
927
|
+
"updatedBy": z.string().optional(),
|
|
928
|
+
"createdAt": z.number(),
|
|
929
|
+
"updatedAt": z.number()
|
|
930
|
+
}),
|
|
931
|
+
indices: [
|
|
932
|
+
{ kind: "index", name: "by_eventKey", columns: ["eventKey"] },
|
|
933
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
934
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] },
|
|
935
|
+
{ kind: "index", name: "by_topic_updatedAt", columns: ["topicId", "updatedAt"] },
|
|
936
|
+
{ kind: "index", name: "by_status_scheduledAt", columns: ["status", "scheduledAt"] },
|
|
937
|
+
{ kind: "index", name: "by_supersedesDecisionEventId", columns: ["supersedesDecisionEventId"] },
|
|
938
|
+
{ kind: "index", name: "by_supersededByDecisionEventId", columns: ["supersededByDecisionEventId"] }
|
|
939
|
+
]
|
|
940
|
+
});
|
|
941
|
+
var decisionParticipants = defineTable({
|
|
942
|
+
name: "decisionParticipants",
|
|
943
|
+
component: "kernel",
|
|
944
|
+
category: "decision",
|
|
945
|
+
shape: z.object({
|
|
946
|
+
"decisionEventId": idOf("decisionEvents"),
|
|
947
|
+
"topicId": z.string().optional(),
|
|
948
|
+
"tenantId": z.string().optional(),
|
|
949
|
+
"workspaceId": z.string().optional(),
|
|
950
|
+
"principalId": z.string(),
|
|
951
|
+
"userId": z.string().optional(),
|
|
952
|
+
"role": z.enum(["owner", "facilitator", "decision_maker", "advisor", "observer", "recorder"]),
|
|
953
|
+
"stakeholderGroupId": idOf("stakeholderGroups").optional(),
|
|
954
|
+
"weight": z.number().optional(),
|
|
955
|
+
"calibrationWeight": z.number().optional(),
|
|
956
|
+
"status": z.enum(["active", "invited", "removed"]),
|
|
957
|
+
"metadata": z.record(z.any()).optional(),
|
|
958
|
+
"createdBy": z.string(),
|
|
959
|
+
"createdAt": z.number(),
|
|
960
|
+
"updatedAt": z.number()
|
|
961
|
+
}),
|
|
962
|
+
indices: [
|
|
963
|
+
{ kind: "index", name: "by_decisionEventId", columns: ["decisionEventId"] },
|
|
964
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
965
|
+
{ kind: "index", name: "by_decision_principal", columns: ["decisionEventId", "principalId"] },
|
|
966
|
+
{ kind: "index", name: "by_decision_role", columns: ["decisionEventId", "role"] },
|
|
967
|
+
{ kind: "index", name: "by_group", columns: ["stakeholderGroupId"] }
|
|
968
|
+
]
|
|
969
|
+
});
|
|
970
|
+
var decisionRiskLedger = defineTable({
|
|
971
|
+
name: "decisionRiskLedger",
|
|
972
|
+
component: "kernel",
|
|
973
|
+
category: "decision",
|
|
974
|
+
shape: z.object({
|
|
975
|
+
"decisionEventId": idOf("decisionEvents"),
|
|
976
|
+
"topicId": z.string().optional(),
|
|
977
|
+
"tenantId": z.string().optional(),
|
|
978
|
+
"workspaceId": z.string().optional(),
|
|
979
|
+
"riskType": z.string(),
|
|
980
|
+
"riskDescription": z.string(),
|
|
981
|
+
"relatedBeliefId": idOf("epistemicNodes").optional(),
|
|
982
|
+
"probabilityBand": z.enum(["very_low", "low", "medium", "high", "very_high"]),
|
|
983
|
+
"impactBand": z.enum(["very_low", "low", "medium", "high", "very_high"]),
|
|
984
|
+
"ownerPrincipalId": z.string().optional(),
|
|
985
|
+
"triggerCondition": z.string().optional(),
|
|
986
|
+
"monitoringPlan": z.string().optional(),
|
|
987
|
+
"status": z.enum(["draft", "confirmed", "resolved", "dismissed"]),
|
|
988
|
+
"confirmationMetadata": z.record(z.any()).optional(),
|
|
989
|
+
"confirmedAt": z.number().optional(),
|
|
990
|
+
"confirmedBy": z.string().optional(),
|
|
991
|
+
"metadata": z.record(z.any()).optional(),
|
|
992
|
+
"createdBy": z.string(),
|
|
993
|
+
"createdAt": z.number(),
|
|
994
|
+
"updatedAt": z.number()
|
|
995
|
+
}),
|
|
996
|
+
indices: [
|
|
997
|
+
{ kind: "index", name: "by_decisionEventId", columns: ["decisionEventId"] },
|
|
998
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
999
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] },
|
|
1000
|
+
{ kind: "index", name: "by_decision_status", columns: ["decisionEventId", "status"] }
|
|
1001
|
+
]
|
|
1002
|
+
});
|
|
1003
|
+
var decisionSnapshots = defineTable({
|
|
1004
|
+
name: "decisionSnapshots",
|
|
1005
|
+
component: "kernel",
|
|
1006
|
+
category: "decision",
|
|
1007
|
+
shape: z.object({
|
|
1008
|
+
"decisionEventId": idOf("decisionEvents"),
|
|
1009
|
+
"topicId": z.string().optional(),
|
|
1010
|
+
"tenantId": z.string().optional(),
|
|
1011
|
+
"workspaceId": z.string().optional(),
|
|
1012
|
+
"ownerPrincipalId": z.string().optional(),
|
|
1013
|
+
"audienceLabel": z.string().optional(),
|
|
1014
|
+
"policyTags": z.array(z.string()).optional(),
|
|
1015
|
+
"sensitivityTier": z.enum(["low", "medium", "high"]).optional(),
|
|
1016
|
+
"exportClass": z.enum(["public_safe", "client_safe", "internal_only"]).optional(),
|
|
1017
|
+
"anonymizationClass": z.enum(["none", "standard", "strict"]).optional(),
|
|
1018
|
+
"version": z.number(),
|
|
1019
|
+
"snapshotLabel": z.string().optional(),
|
|
1020
|
+
"payload": z.record(z.any()),
|
|
1021
|
+
"payloadHash": z.string(),
|
|
1022
|
+
"weightingModelVersion": z.string(),
|
|
1023
|
+
"weightingParameters": z.record(z.any()).optional(),
|
|
1024
|
+
"outcome": z.enum(["approve", "conditional", "defer", "reject", "reopen_on_trigger"]).optional(),
|
|
1025
|
+
"lineageParentSnapshotId": idOf("decisionSnapshots").optional(),
|
|
1026
|
+
"lineageParentDecisionEventId": idOf("decisionEvents").optional(),
|
|
1027
|
+
"policyTraceId": z.string().optional(),
|
|
1028
|
+
"metadata": z.record(z.any()).optional(),
|
|
1029
|
+
"lockedBy": z.string(),
|
|
1030
|
+
"lockedAt": z.number(),
|
|
1031
|
+
"createdAt": z.number()
|
|
1032
|
+
}),
|
|
1033
|
+
indices: [
|
|
1034
|
+
{ kind: "index", name: "by_decisionEventId", columns: ["decisionEventId"] },
|
|
1035
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
1036
|
+
{ kind: "index", name: "by_topic_lockedAt", columns: ["topicId", "lockedAt"] },
|
|
1037
|
+
{ kind: "index", name: "by_decision_version", columns: ["decisionEventId", "version"] },
|
|
1038
|
+
{ kind: "index", name: "by_decision_lockedAt", columns: ["decisionEventId", "lockedAt"] },
|
|
1039
|
+
{ kind: "index", name: "by_payloadHash", columns: ["payloadHash"] }
|
|
1040
|
+
]
|
|
1041
|
+
});
|
|
1042
|
+
var deliberationContributions = defineTable({
|
|
1043
|
+
name: "deliberationContributions",
|
|
1044
|
+
component: "kernel",
|
|
1045
|
+
category: "decision",
|
|
1046
|
+
shape: z.object({
|
|
1047
|
+
"sessionId": idOf("deliberationSessions"),
|
|
1048
|
+
"topicId": z.string().optional(),
|
|
1049
|
+
"principalId": z.string(),
|
|
1050
|
+
"slot": z.string(),
|
|
1051
|
+
"modelKey": z.string().optional(),
|
|
1052
|
+
"promptName": z.string().optional(),
|
|
1053
|
+
"role": z.enum(["support", "oppose", "uncertain", "synthesize"]),
|
|
1054
|
+
"answer": z.string(),
|
|
1055
|
+
"confidence": z.number(),
|
|
1056
|
+
"reasoningChain": z.array(z.string()),
|
|
1057
|
+
"uncertaintyZones": z.array(z.object({
|
|
1058
|
+
"label": z.string(),
|
|
1059
|
+
"explanation": z.string()
|
|
1060
|
+
})),
|
|
1061
|
+
"escalationQuestions": z.array(z.string()),
|
|
1062
|
+
"contradictionHypotheses": z.array(z.string()),
|
|
1063
|
+
"rawResponse": z.string(),
|
|
1064
|
+
"parsedResponse": z.any().optional(),
|
|
1065
|
+
"traceId": z.string().optional(),
|
|
1066
|
+
"createdAt": z.number(),
|
|
1067
|
+
"updatedAt": z.number()
|
|
1068
|
+
}),
|
|
1069
|
+
indices: [
|
|
1070
|
+
{ kind: "index", name: "by_sessionId", columns: ["sessionId"] },
|
|
1071
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
1072
|
+
{ kind: "index", name: "by_session_slot", columns: ["sessionId", "slot"] }
|
|
1073
|
+
]
|
|
1074
|
+
});
|
|
1075
|
+
var deliberationSessions = defineTable({
|
|
1076
|
+
name: "deliberationSessions",
|
|
1077
|
+
component: "kernel",
|
|
1078
|
+
category: "decision",
|
|
1079
|
+
shape: z.object({
|
|
1080
|
+
"topicId": z.string().optional(),
|
|
1081
|
+
"tenantId": z.string().optional(),
|
|
1082
|
+
"workspaceId": z.string().optional(),
|
|
1083
|
+
"principalId": z.string(),
|
|
1084
|
+
"question": z.string(),
|
|
1085
|
+
"status": z.enum(["running", "completed", "failed"]),
|
|
1086
|
+
"modelSlots": z.array(z.string()),
|
|
1087
|
+
"linkedBeliefNodeId": idOf("epistemicNodes").optional(),
|
|
1088
|
+
"replayBaselineAt": z.number(),
|
|
1089
|
+
"replayHeadAt": z.number().optional(),
|
|
1090
|
+
"replayBaseline": z.any().optional(),
|
|
1091
|
+
"replayDelta": z.any().optional(),
|
|
1092
|
+
"contextBrief": z.string().optional(),
|
|
1093
|
+
"contextSnapshot": z.any().optional(),
|
|
1094
|
+
"contradictionIds": z.array(idOf("contradictions")),
|
|
1095
|
+
"escalationQuestionIds": z.array(idOf("epistemicNodes")),
|
|
1096
|
+
"uncertaintyZones": z.array(z.object({
|
|
1097
|
+
"label": z.string(),
|
|
1098
|
+
"explanation": z.string(),
|
|
1099
|
+
"slots": z.array(z.string())
|
|
1100
|
+
})),
|
|
1101
|
+
"outcomeSummary": z.any().optional(),
|
|
1102
|
+
"traceId": z.string().optional(),
|
|
1103
|
+
"error": z.string().optional(),
|
|
1104
|
+
"createdBy": z.string(),
|
|
1105
|
+
"createdAt": z.number(),
|
|
1106
|
+
"updatedAt": z.number(),
|
|
1107
|
+
"completedAt": z.number().optional()
|
|
1108
|
+
}),
|
|
1109
|
+
indices: [
|
|
1110
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
1111
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
1112
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] },
|
|
1113
|
+
{ kind: "index", name: "by_createdBy", columns: ["createdBy"] }
|
|
1114
|
+
]
|
|
1115
|
+
});
|
|
1116
|
+
var stakeholderGroups = defineTable({
|
|
1117
|
+
name: "stakeholderGroups",
|
|
1118
|
+
component: "kernel",
|
|
1119
|
+
category: "decision",
|
|
1120
|
+
shape: z.object({
|
|
1121
|
+
"decisionEventId": idOf("decisionEvents"),
|
|
1122
|
+
"topicId": z.string().optional(),
|
|
1123
|
+
"tenantId": z.string().optional(),
|
|
1124
|
+
"workspaceId": z.string().optional(),
|
|
1125
|
+
"groupKey": z.string(),
|
|
1126
|
+
"name": z.string(),
|
|
1127
|
+
"description": z.string().optional(),
|
|
1128
|
+
"weight": z.number(),
|
|
1129
|
+
"status": z.enum(["active", "archived"]),
|
|
1130
|
+
"metadata": z.record(z.any()).optional(),
|
|
1131
|
+
"createdBy": z.string(),
|
|
1132
|
+
"createdAt": z.number(),
|
|
1133
|
+
"updatedAt": z.number()
|
|
1134
|
+
}),
|
|
1135
|
+
indices: [
|
|
1136
|
+
{ kind: "index", name: "by_decisionEventId", columns: ["decisionEventId"] },
|
|
1137
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
1138
|
+
{ kind: "index", name: "by_decision_groupKey", columns: ["decisionEventId", "groupKey"] },
|
|
1139
|
+
{ kind: "index", name: "by_decision_status", columns: ["decisionEventId", "status"] }
|
|
1140
|
+
]
|
|
1141
|
+
});
|
|
1142
|
+
var compatibilityShims = defineTable({
|
|
1143
|
+
name: "compatibilityShims",
|
|
1144
|
+
component: "mc",
|
|
1145
|
+
category: "runtime",
|
|
1146
|
+
shape: z.object({
|
|
1147
|
+
"shimId": z.string(),
|
|
1148
|
+
"gateId": z.string(),
|
|
1149
|
+
"removalDate": z.string(),
|
|
1150
|
+
"removalPriority": z.enum(["P1", "P2", "P3"]),
|
|
1151
|
+
"description": z.string(),
|
|
1152
|
+
"owner": z.string(),
|
|
1153
|
+
"createdAt": z.string(),
|
|
1154
|
+
"status": z.enum(["active", "overdue", "removed"]),
|
|
1155
|
+
"bridgeType": z.enum(["tool", "agent"]),
|
|
1156
|
+
"bridgeTarget": z.object({
|
|
1157
|
+
"type": z.enum(["tool", "agent"]),
|
|
1158
|
+
"legacyPath": z.string(),
|
|
1159
|
+
"harnessPath": z.string()
|
|
1160
|
+
}),
|
|
1161
|
+
"shimBehavior": z.enum(["passthrough_with_logging", "adapter", "feature_flag_gate"]),
|
|
1162
|
+
"producesLedgerEntries": z.boolean(),
|
|
1163
|
+
"lastAuditedAt": z.number(),
|
|
1164
|
+
"metadata": z.record(z.any()).optional()
|
|
1165
|
+
}),
|
|
1166
|
+
indices: [
|
|
1167
|
+
{ kind: "index", name: "by_shimId", columns: ["shimId"] },
|
|
1168
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
1169
|
+
{ kind: "index", name: "by_bridgeType_status", columns: ["bridgeType", "status"] }
|
|
1170
|
+
]
|
|
1171
|
+
});
|
|
1172
|
+
var cutoverFlags = defineTable({
|
|
1173
|
+
name: "cutoverFlags",
|
|
1174
|
+
component: "mc",
|
|
1175
|
+
category: "runtime",
|
|
1176
|
+
shape: z.object({
|
|
1177
|
+
"domain": z.enum(["graph", "schema", "identity", "policy", "audit", "admin", "agent", "tool", "prompt", "intelligence"]),
|
|
1178
|
+
"state": z.enum(["legacy", "cutover", "disabled"]),
|
|
1179
|
+
"metadata": z.record(z.any()).optional(),
|
|
1180
|
+
"updatedBy": z.string(),
|
|
1181
|
+
"createdAt": z.number(),
|
|
1182
|
+
"updatedAt": z.number()
|
|
1183
|
+
}),
|
|
1184
|
+
indices: [
|
|
1185
|
+
{ kind: "index", name: "by_domain", columns: ["domain"] },
|
|
1186
|
+
{ kind: "index", name: "by_state", columns: ["state"] }
|
|
1187
|
+
]
|
|
1188
|
+
});
|
|
1189
|
+
var tenantDeploymentCredentials = defineTable({
|
|
1190
|
+
name: "tenantDeploymentCredentials",
|
|
1191
|
+
component: "mc",
|
|
1192
|
+
category: "runtime",
|
|
1193
|
+
shape: z.object({
|
|
1194
|
+
"credentialRef": z.string(),
|
|
1195
|
+
"tenantId": idOf("tenants"),
|
|
1196
|
+
"target": z.enum(["kernelDeployment", "appDeployment"]),
|
|
1197
|
+
"environment": z.enum(["dev", "staging", "prod"]),
|
|
1198
|
+
"encryptedDeployKey": z.string(),
|
|
1199
|
+
"encryptionVersion": z.string(),
|
|
1200
|
+
"keyFingerprint": z.string(),
|
|
1201
|
+
"keyHint": z.string(),
|
|
1202
|
+
"status": z.enum(["active", "revoked"]),
|
|
1203
|
+
"rotatedFromCredentialRef": z.string().optional(),
|
|
1204
|
+
"revokedAt": z.number().optional(),
|
|
1205
|
+
"revokedBy": z.string().optional(),
|
|
1206
|
+
"lastUsedAt": z.number().optional(),
|
|
1207
|
+
"metadata": z.record(z.any()).optional(),
|
|
1208
|
+
"createdBy": z.string(),
|
|
1209
|
+
"createdAt": z.number(),
|
|
1210
|
+
"updatedAt": z.number()
|
|
1211
|
+
}),
|
|
1212
|
+
indices: [
|
|
1213
|
+
{ kind: "index", name: "by_credentialRef", columns: ["credentialRef"] },
|
|
1214
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1215
|
+
{ kind: "index", name: "by_tenant_target", columns: ["tenantId", "target"] },
|
|
1216
|
+
{ kind: "index", name: "by_tenant_target_environment", columns: ["tenantId", "target", "environment"] },
|
|
1217
|
+
{ kind: "index", name: "by_tenant_target_environment_status", columns: ["tenantId", "target", "environment", "status"] },
|
|
1218
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
1219
|
+
]
|
|
1220
|
+
});
|
|
1221
|
+
var controlPlaneTenantModelSlotBindings = defineTable({
|
|
1222
|
+
name: "controlPlaneTenantModelSlotBindings",
|
|
1223
|
+
component: "mc",
|
|
1224
|
+
category: "runtime",
|
|
1225
|
+
shape: z.object({
|
|
1226
|
+
"bindingId": z.string(),
|
|
1227
|
+
"tenantId": idOf("tenants"),
|
|
1228
|
+
"providerId": z.string(),
|
|
1229
|
+
"modelSlotId": z.string(),
|
|
1230
|
+
"secretRef": z.string(),
|
|
1231
|
+
"status": z.enum(["active", "revoked"]),
|
|
1232
|
+
"passThroughOnly": z.boolean(),
|
|
1233
|
+
"revokedAt": z.number().optional(),
|
|
1234
|
+
"revokedBy": z.string().optional(),
|
|
1235
|
+
"metadata": z.record(z.any()).optional(),
|
|
1236
|
+
"createdBy": z.string(),
|
|
1237
|
+
"createdAt": z.number(),
|
|
1238
|
+
"updatedAt": z.number()
|
|
1239
|
+
}),
|
|
1240
|
+
indices: [
|
|
1241
|
+
{ kind: "index", name: "by_bindingId", columns: ["bindingId"] },
|
|
1242
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1243
|
+
{ kind: "index", name: "by_tenant_slot", columns: ["tenantId", "modelSlotId"] },
|
|
1244
|
+
{ kind: "index", name: "by_tenant_provider_slot", columns: ["tenantId", "providerId", "modelSlotId"] },
|
|
1245
|
+
{ kind: "index", name: "by_secretRef", columns: ["secretRef"] },
|
|
1246
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
1247
|
+
]
|
|
1248
|
+
});
|
|
1249
|
+
var controlPlaneTenantProviderSecrets = defineTable({
|
|
1250
|
+
name: "controlPlaneTenantProviderSecrets",
|
|
1251
|
+
component: "mc",
|
|
1252
|
+
category: "runtime",
|
|
1253
|
+
shape: z.object({
|
|
1254
|
+
"secretRef": z.string(),
|
|
1255
|
+
"tenantId": idOf("tenants"),
|
|
1256
|
+
"providerId": z.string(),
|
|
1257
|
+
"label": z.string().optional(),
|
|
1258
|
+
"encryptedSecret": z.string(),
|
|
1259
|
+
"encryptionVersion": z.string(),
|
|
1260
|
+
"secretFingerprint": z.string(),
|
|
1261
|
+
"keyHint": z.string(),
|
|
1262
|
+
"status": z.enum(["active", "revoked"]),
|
|
1263
|
+
"rotatedFromSecretRef": z.string().optional(),
|
|
1264
|
+
"revokedAt": z.number().optional(),
|
|
1265
|
+
"revokedBy": z.string().optional(),
|
|
1266
|
+
"lastUsedAt": z.number().optional(),
|
|
1267
|
+
"metadata": z.record(z.any()).optional(),
|
|
1268
|
+
"createdBy": z.string(),
|
|
1269
|
+
"createdAt": z.number(),
|
|
1270
|
+
"updatedAt": z.number()
|
|
1271
|
+
}),
|
|
1272
|
+
indices: [
|
|
1273
|
+
{ kind: "index", name: "by_secretRef", columns: ["secretRef"] },
|
|
1274
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1275
|
+
{ kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId"] },
|
|
1276
|
+
{ kind: "index", name: "by_tenant_provider_status", columns: ["tenantId", "providerId", "status"] },
|
|
1277
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
1278
|
+
]
|
|
1279
|
+
});
|
|
1280
|
+
var controlPlaneTenantProxyGatewayUsage = defineTable({
|
|
1281
|
+
name: "controlPlaneTenantProxyGatewayUsage",
|
|
1282
|
+
component: "mc",
|
|
1283
|
+
category: "runtime",
|
|
1284
|
+
shape: z.object({
|
|
1285
|
+
"usageId": z.string(),
|
|
1286
|
+
"tenantId": idOf("tenants"),
|
|
1287
|
+
"providerId": z.string(),
|
|
1288
|
+
"modelSlotId": z.string(),
|
|
1289
|
+
"secretRef": z.string(),
|
|
1290
|
+
"proxyTokenId": z.string(),
|
|
1291
|
+
"sessionId": z.string(),
|
|
1292
|
+
"principalId": z.string(),
|
|
1293
|
+
"workspaceId": z.string().optional(),
|
|
1294
|
+
"modelId": z.string().optional(),
|
|
1295
|
+
"requestPath": z.string(),
|
|
1296
|
+
"status": z.enum(["success", "error"]),
|
|
1297
|
+
"responseStatus": z.number().optional(),
|
|
1298
|
+
"inputTokens": z.number().optional(),
|
|
1299
|
+
"outputTokens": z.number().optional(),
|
|
1300
|
+
"tokenCount": z.number().optional(),
|
|
1301
|
+
"latencyMs": z.number(),
|
|
1302
|
+
"estimatedCostUsd": z.number().optional(),
|
|
1303
|
+
"failureCode": z.string().optional(),
|
|
1304
|
+
"metadata": z.record(z.any()).optional(),
|
|
1305
|
+
"createdAt": z.number(),
|
|
1306
|
+
"updatedAt": z.number()
|
|
1307
|
+
}),
|
|
1308
|
+
indices: [
|
|
1309
|
+
{ kind: "index", name: "by_usageId", columns: ["usageId"] },
|
|
1310
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
|
|
1311
|
+
{ kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId", "createdAt"] },
|
|
1312
|
+
{ kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId", "createdAt"] },
|
|
1313
|
+
{ kind: "index", name: "by_sessionId", columns: ["sessionId", "createdAt"] }
|
|
1314
|
+
]
|
|
1315
|
+
});
|
|
1316
|
+
var crossProjectConnections = defineTable({
|
|
1317
|
+
name: "crossProjectConnections",
|
|
1318
|
+
component: "kernel",
|
|
1319
|
+
category: "intelligence",
|
|
1320
|
+
shape: z.object({
|
|
1321
|
+
"sourceProjectId": z.string().optional(),
|
|
1322
|
+
"sourceTopicId": idOf("topics").optional(),
|
|
1323
|
+
"sourceNodeId": idOf("epistemicNodes"),
|
|
1324
|
+
"targetProjectId": z.string().optional(),
|
|
1325
|
+
"targetTopicId": idOf("topics").optional(),
|
|
1326
|
+
"targetNodeId": idOf("epistemicNodes"),
|
|
1327
|
+
"semanticSimilarity": z.number(),
|
|
1328
|
+
"matchSignals": z.object({
|
|
1329
|
+
"beliefTextSimilarity": z.number(),
|
|
1330
|
+
"themeOverlap": z.boolean(),
|
|
1331
|
+
"sharedThemeNames": z.array(z.string()).optional(),
|
|
1332
|
+
"themeSimilarity": z.number().optional(),
|
|
1333
|
+
"ontologyOverlap": z.boolean(),
|
|
1334
|
+
"sharedFunctions": z.array(z.string()).optional(),
|
|
1335
|
+
"sharedValueChains": z.array(z.string()).optional()
|
|
1336
|
+
}),
|
|
1337
|
+
"suggestedEdgeType": z.string(),
|
|
1338
|
+
"suggestedWeight": z.number().optional(),
|
|
1339
|
+
"rationale": z.string(),
|
|
1340
|
+
"decision": z.enum(["pending", "accepted", "declined"]),
|
|
1341
|
+
"acceptedEdgeId": idOf("epistemicEdges").optional(),
|
|
1342
|
+
"declineReason": z.string().optional(),
|
|
1343
|
+
"declineCategory": z.enum(["not_relevant", "too_generic", "already_known", "different_context", "wrong_relationship", "premature", "other"]).optional(),
|
|
1344
|
+
"surfacedDuring": z.enum(["worktree_clustering", "chat", "morning_brief", "manual"]),
|
|
1345
|
+
"worktreeId": z.string().optional(),
|
|
1346
|
+
"userId": z.string(),
|
|
1347
|
+
"createdAt": z.number(),
|
|
1348
|
+
"decidedAt": z.number().optional()
|
|
1349
|
+
}),
|
|
1350
|
+
indices: [
|
|
1351
|
+
{ kind: "index", name: "by_source_project", columns: ["sourceProjectId"] },
|
|
1352
|
+
{ kind: "index", name: "by_sourceTopicId", columns: ["sourceTopicId"] },
|
|
1353
|
+
{ kind: "index", name: "by_target_project", columns: ["targetProjectId"] },
|
|
1354
|
+
{ kind: "index", name: "by_targetTopicId", columns: ["targetTopicId"] },
|
|
1355
|
+
{ kind: "index", name: "by_source_node", columns: ["sourceNodeId"] },
|
|
1356
|
+
{ kind: "index", name: "by_decision", columns: ["decision"] },
|
|
1357
|
+
{ kind: "index", name: "by_user_decision", columns: ["userId", "decision"] }
|
|
1358
|
+
]
|
|
1359
|
+
});
|
|
1360
|
+
var graphAnalysisCache = defineTable({
|
|
1361
|
+
name: "graphAnalysisCache",
|
|
1362
|
+
component: "kernel",
|
|
1363
|
+
category: "intelligence",
|
|
1364
|
+
shape: z.object({
|
|
1365
|
+
"topicId": z.string().optional(),
|
|
1366
|
+
"healthScore": z.number(),
|
|
1367
|
+
"findings": z.array(z.object({
|
|
1368
|
+
"id": z.string(),
|
|
1369
|
+
"severity": z.enum(["critical", "warning", "info"]),
|
|
1370
|
+
"category": z.enum(["structural_risk", "evidence_gap", "reasoning_flaw", "staleness", "opportunity", "propagation_risk", "epistemology", "temporal", "semantic_gap"]),
|
|
1371
|
+
"title": z.string(),
|
|
1372
|
+
"description": z.string(),
|
|
1373
|
+
"nodeIds": z.array(z.string()),
|
|
1374
|
+
"nodeLabels": z.array(z.string()),
|
|
1375
|
+
"detector": z.string(),
|
|
1376
|
+
"importance": z.number().optional(),
|
|
1377
|
+
"totalCount": z.number().optional()
|
|
1378
|
+
})),
|
|
1379
|
+
"stats": z.object({
|
|
1380
|
+
"totalNodes": z.number(),
|
|
1381
|
+
"totalEdges": z.number(),
|
|
1382
|
+
"beliefs": z.number(),
|
|
1383
|
+
"questions": z.number(),
|
|
1384
|
+
"evidence": z.number(),
|
|
1385
|
+
"cycleCount": z.number(),
|
|
1386
|
+
"ungroundedCount": z.number(),
|
|
1387
|
+
"bridgeNodeCount": z.number(),
|
|
1388
|
+
"orphanCount": z.number(),
|
|
1389
|
+
"overconfidentCount": z.number(),
|
|
1390
|
+
"communityCount": z.number(),
|
|
1391
|
+
"sccCount": z.number(),
|
|
1392
|
+
"algebraicConnectivity": z.number(),
|
|
1393
|
+
"coherenceScore": z.number(),
|
|
1394
|
+
"averageResilience": z.number(),
|
|
1395
|
+
"tensionPairs": z.number(),
|
|
1396
|
+
"propagationRisks": z.number(),
|
|
1397
|
+
"temporalDecayCount": z.number(),
|
|
1398
|
+
"beliefStatus": z.object({
|
|
1399
|
+
"assumption": z.number(),
|
|
1400
|
+
"hypothesis": z.number(),
|
|
1401
|
+
"belief": z.number(),
|
|
1402
|
+
"fact": z.number()
|
|
1403
|
+
}).optional(),
|
|
1404
|
+
"evidenceTemporalNature": z.object({
|
|
1405
|
+
"factual": z.number(),
|
|
1406
|
+
"forecast": z.number(),
|
|
1407
|
+
"unknown": z.number()
|
|
1408
|
+
}).optional()
|
|
1409
|
+
}),
|
|
1410
|
+
"killerQueryResults": z.object({
|
|
1411
|
+
"confirmationBias": z.array(z.any()).optional(),
|
|
1412
|
+
"anchoringBias": z.array(z.any()).optional(),
|
|
1413
|
+
"sourceConcentration": z.array(z.any()).optional(),
|
|
1414
|
+
"contradictionTensions": z.array(z.any()).optional(),
|
|
1415
|
+
"reasoningDepth": z.array(z.any()).optional(),
|
|
1416
|
+
"knowledgeFrontier": z.array(z.any()).optional(),
|
|
1417
|
+
"portfolioConviction": z.array(z.any()).optional(),
|
|
1418
|
+
"staleThemes": z.array(z.any()).optional(),
|
|
1419
|
+
"missingQuestions": z.array(z.any()).optional(),
|
|
1420
|
+
"nonConsensusBeliefs": z.array(z.any()).optional(),
|
|
1421
|
+
"minimumFalsificationSet": z.union([z.string(), z.number(), z.boolean(), z.null(), z.record(z.any()), z.array(z.any())]).optional()
|
|
1422
|
+
}).optional(),
|
|
1423
|
+
"analyzedAt": z.number(),
|
|
1424
|
+
"isStale": z.boolean(),
|
|
1425
|
+
"changesSinceRefresh": z.number(),
|
|
1426
|
+
"lastGraphChange": z.number().optional(),
|
|
1427
|
+
"analysisVersion": z.string()
|
|
1428
|
+
}),
|
|
1429
|
+
indices: [
|
|
1430
|
+
{ kind: "index", name: "by_topic", columns: ["topicId"] },
|
|
1431
|
+
{ kind: "index", name: "by_topic_stale", columns: ["topicId", "isStale"] },
|
|
1432
|
+
{ kind: "index", name: "by_analyzedAt", columns: ["analyzedAt"] }
|
|
1433
|
+
]
|
|
1434
|
+
});
|
|
1435
|
+
var graphAnalysisResults = defineTable({
|
|
1436
|
+
name: "graphAnalysisResults",
|
|
1437
|
+
component: "kernel",
|
|
1438
|
+
category: "intelligence",
|
|
1439
|
+
shape: z.object({
|
|
1440
|
+
"topicId": z.string().optional(),
|
|
1441
|
+
"userId": z.string(),
|
|
1442
|
+
"findingId": z.string().optional(),
|
|
1443
|
+
"customQuery": z.string().optional(),
|
|
1444
|
+
"mode": z.enum(["explain", "query"]),
|
|
1445
|
+
"analysisText": z.string(),
|
|
1446
|
+
"modelId": z.string().optional(),
|
|
1447
|
+
"findingSnapshot": z.object({
|
|
1448
|
+
"title": z.string(),
|
|
1449
|
+
"description": z.string(),
|
|
1450
|
+
"severity": z.string(),
|
|
1451
|
+
"category": z.string(),
|
|
1452
|
+
"nodeIds": z.array(z.string()),
|
|
1453
|
+
"nodeLabels": z.array(z.string())
|
|
1454
|
+
}).optional(),
|
|
1455
|
+
"status": z.enum(["active", "archived", "deleted"]),
|
|
1456
|
+
"createdAt": z.number(),
|
|
1457
|
+
"archivedAt": z.number().optional()
|
|
1458
|
+
}),
|
|
1459
|
+
indices: [
|
|
1460
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
1461
|
+
{ kind: "index", name: "by_topic_user", columns: ["topicId", "userId"] },
|
|
1462
|
+
{ kind: "index", name: "by_topic_finding", columns: ["topicId", "findingId"] },
|
|
1463
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] },
|
|
1464
|
+
{ kind: "index", name: "by_createdAt", columns: ["createdAt"] }
|
|
1465
|
+
]
|
|
1466
|
+
});
|
|
1467
|
+
var graphSuggestions = defineTable({
|
|
1468
|
+
name: "graphSuggestions",
|
|
1469
|
+
component: "kernel",
|
|
1470
|
+
category: "intelligence",
|
|
1471
|
+
shape: z.object({
|
|
1472
|
+
"topicId": z.string().optional(),
|
|
1473
|
+
"userId": z.string(),
|
|
1474
|
+
"analysisResultId": idOf("graphAnalysisResults"),
|
|
1475
|
+
"suggestionHash": z.string(),
|
|
1476
|
+
"suggestionType": z.string(),
|
|
1477
|
+
"title": z.string(),
|
|
1478
|
+
"rationale": z.string(),
|
|
1479
|
+
"priority": z.enum(["critical", "high", "medium", "low"]),
|
|
1480
|
+
"targetNodeId": z.string().optional(),
|
|
1481
|
+
"secondaryNodeId": z.string().optional(),
|
|
1482
|
+
"payload": z.union([z.string(), z.number(), z.boolean(), z.null(), z.record(z.any()), z.array(z.any())]),
|
|
1483
|
+
"status": z.enum(["pending", "accepted", "declined", "failed", "superseded"]),
|
|
1484
|
+
"resultNodeId": z.string().optional(),
|
|
1485
|
+
"errorMessage": z.string().optional(),
|
|
1486
|
+
"createdAt": z.number(),
|
|
1487
|
+
"actedAt": z.number().optional()
|
|
1488
|
+
}),
|
|
1489
|
+
indices: [
|
|
1490
|
+
{ kind: "index", name: "by_analysis", columns: ["analysisResultId"] },
|
|
1491
|
+
{ kind: "index", name: "by_suggestion_hash", columns: ["topicId", "suggestionHash"] },
|
|
1492
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
1493
|
+
{ kind: "index", name: "by_topic_user", columns: ["topicId", "userId"] },
|
|
1494
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] },
|
|
1495
|
+
{ kind: "index", name: "by_createdAt", columns: ["createdAt"] }
|
|
1496
|
+
]
|
|
1497
|
+
});
|
|
1498
|
+
var epistemicEdges = defineTable({
|
|
1499
|
+
name: "epistemicEdges",
|
|
1500
|
+
component: "kernel",
|
|
1501
|
+
category: "spine",
|
|
1502
|
+
shape: z.object({
|
|
1503
|
+
"globalId": z.string(),
|
|
1504
|
+
"fromNodeId": z.string(),
|
|
1505
|
+
"toNodeId": z.string().optional(),
|
|
1506
|
+
"sourceGlobalId": z.string().optional(),
|
|
1507
|
+
"targetGlobalId": z.string().optional(),
|
|
1508
|
+
"edgeType": EDGE_TYPE,
|
|
1509
|
+
"edgeTier": z.string().optional(),
|
|
1510
|
+
"domainNamespace": z.string().optional(),
|
|
1511
|
+
"constraint": z.string().optional(),
|
|
1512
|
+
"normalization": z.string().optional(),
|
|
1513
|
+
"causal": z.boolean().optional(),
|
|
1514
|
+
"propagation": z.string().optional(),
|
|
1515
|
+
"blocking": z.boolean().optional(),
|
|
1516
|
+
"implicit": z.boolean().optional(),
|
|
1517
|
+
"conditionalA": z.object({
|
|
1518
|
+
"b": z.number(),
|
|
1519
|
+
"d": z.number(),
|
|
1520
|
+
"u": z.number(),
|
|
1521
|
+
"a": z.number()
|
|
1522
|
+
}).optional(),
|
|
1523
|
+
"conditionalNotA": z.object({
|
|
1524
|
+
"b": z.number(),
|
|
1525
|
+
"d": z.number(),
|
|
1526
|
+
"u": z.number(),
|
|
1527
|
+
"a": z.number()
|
|
1528
|
+
}).optional(),
|
|
1529
|
+
"derivation": z.string().optional(),
|
|
1530
|
+
"containment": z.string().optional(),
|
|
1531
|
+
"interrogation": z.string().optional(),
|
|
1532
|
+
"weight": z.number().optional(),
|
|
1533
|
+
"confidence": z.number().optional(),
|
|
1534
|
+
"context": z.string().optional(),
|
|
1535
|
+
"reasoningMethod": z.enum(["deductive", "inductive", "abductive", "analogical", "causal", "correlational", "testimonial", "statistical", "implicit", "pattern_match"]).optional(),
|
|
1536
|
+
"logicalRole": z.enum(["necessary", "sufficient", "necessary_sufficient", "contributory", "corroborative"]).optional(),
|
|
1537
|
+
"surpriseScore": z.number().optional(),
|
|
1538
|
+
"validFrom": z.number().optional(),
|
|
1539
|
+
"validUntil": z.number().optional(),
|
|
1540
|
+
"temporalClass": z.enum(["structural", "cyclical", "transient", "point_in_time"]).optional(),
|
|
1541
|
+
"analogyBasis": z.string().optional(),
|
|
1542
|
+
"disanalogies": z.array(z.string()).optional(),
|
|
1543
|
+
"analogyStrength": z.number().optional(),
|
|
1544
|
+
"defeatType": z.enum(["rebuts", "undercuts", "undermines"]).optional(),
|
|
1545
|
+
"predictionFulfilled": z.boolean().optional(),
|
|
1546
|
+
"predictionFulfilledAt": z.number().optional(),
|
|
1547
|
+
"predictionFulfilledBy": z.string().optional(),
|
|
1548
|
+
"derivationType": z.string().optional(),
|
|
1549
|
+
"startDate": z.number().optional(),
|
|
1550
|
+
"endDate": z.number().optional(),
|
|
1551
|
+
"keywords": z.array(z.string()).optional(),
|
|
1552
|
+
"evidence": z.string().optional(),
|
|
1553
|
+
"metadata": z.record(z.any()).optional(),
|
|
1554
|
+
"tenantId": z.string().optional(),
|
|
1555
|
+
"workspaceId": z.string().optional(),
|
|
1556
|
+
"ownerPrincipalId": z.string().optional(),
|
|
1557
|
+
"audienceLabel": z.string().optional(),
|
|
1558
|
+
"policyTags": z.array(z.string()).optional(),
|
|
1559
|
+
"sensitivityTier": z.enum(["low", "medium", "high", "restricted"]).optional(),
|
|
1560
|
+
"exportClass": z.enum(["internal_only", "client_safe", "public_safe", "restricted"]).optional(),
|
|
1561
|
+
"anonymizationClass": z.enum(["none", "standard", "strict"]).optional(),
|
|
1562
|
+
"createdBy": z.string(),
|
|
1563
|
+
"createdAt": z.number(),
|
|
1564
|
+
"updatedAt": z.number().optional(),
|
|
1565
|
+
"topicId": z.string().optional(),
|
|
1566
|
+
"projectId": z.string().optional(),
|
|
1567
|
+
"fromNodeType": z.string().optional(),
|
|
1568
|
+
"toNodeType": z.string().optional(),
|
|
1569
|
+
"fromLayer": z.enum(["L4", "L3", "L2", "L1", "ontological", "organizational"]).optional(),
|
|
1570
|
+
"toLayer": z.enum(["L4", "L3", "L2", "L1", "ontological", "organizational"]).optional()
|
|
1571
|
+
}),
|
|
1572
|
+
indices: [
|
|
1573
|
+
{ kind: "index", name: "by_globalId", columns: ["globalId"] },
|
|
1574
|
+
{ kind: "index", name: "by_from", columns: ["fromNodeId"] },
|
|
1575
|
+
{ kind: "index", name: "by_to", columns: ["toNodeId"] },
|
|
1576
|
+
{ kind: "index", name: "by_from_type", columns: ["fromNodeId", "edgeType"] },
|
|
1577
|
+
{ kind: "index", name: "by_to_type", columns: ["toNodeId", "edgeType"] },
|
|
1578
|
+
{ kind: "index", name: "by_topic", columns: ["topicId"] },
|
|
1579
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1580
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
1581
|
+
{ kind: "index", name: "by_tenant_workspace", columns: ["tenantId", "workspaceId"] },
|
|
1582
|
+
{ kind: "index", name: "by_audienceLabel", columns: ["audienceLabel"] },
|
|
1583
|
+
{ kind: "index", name: "by_sensitivityTier", columns: ["sensitivityTier"] },
|
|
1584
|
+
{ kind: "index", name: "by_exportClass", columns: ["exportClass"] },
|
|
1585
|
+
{ kind: "index", name: "by_type", columns: ["edgeType"] },
|
|
1586
|
+
{ kind: "index", name: "by_from_to", columns: ["fromNodeId", "toNodeId"] },
|
|
1587
|
+
{ kind: "index", name: "by_fromLayer", columns: ["fromLayer"] },
|
|
1588
|
+
{ kind: "index", name: "by_toLayer", columns: ["toLayer"] },
|
|
1589
|
+
{ kind: "index", name: "by_layer_pair", columns: ["fromLayer", "toLayer"] },
|
|
1590
|
+
{ kind: "index", name: "by_source_global_id", columns: ["sourceGlobalId"] },
|
|
1591
|
+
{ kind: "index", name: "by_target_global_id", columns: ["targetGlobalId"] },
|
|
1592
|
+
{ kind: "index", name: "by_reasoning_method", columns: ["edgeType", "reasoningMethod"] },
|
|
1593
|
+
{ kind: "index", name: "by_logical_role", columns: ["edgeType", "logicalRole"] },
|
|
1594
|
+
{ kind: "index", name: "by_temporal_class", columns: ["temporalClass", "validUntil"] },
|
|
1595
|
+
{ kind: "index", name: "by_surprise", columns: ["edgeType", "surpriseScore"] }
|
|
1596
|
+
]
|
|
1597
|
+
});
|
|
1598
|
+
var epistemicNodes = defineTable({
|
|
1599
|
+
name: "epistemicNodes",
|
|
1600
|
+
component: "kernel",
|
|
1601
|
+
category: "spine",
|
|
1602
|
+
shape: z.object({
|
|
1603
|
+
"globalId": z.string(),
|
|
1604
|
+
"nodeType": NODE_TYPE,
|
|
1605
|
+
"epistemicLayer": z.enum(["L4", "L3", "L2", "L1", "ontological", "organizational"]).optional(),
|
|
1606
|
+
"subtype": z.string().optional(),
|
|
1607
|
+
"canonicalText": z.string(),
|
|
1608
|
+
"contentHash": z.string(),
|
|
1609
|
+
"content": z.string().optional(),
|
|
1610
|
+
"contentType": z.string().optional(),
|
|
1611
|
+
"title": z.string().optional(),
|
|
1612
|
+
"tags": z.array(z.string()).optional(),
|
|
1613
|
+
"domain": z.string().optional(),
|
|
1614
|
+
"metadata": z.record(z.any()).optional(),
|
|
1615
|
+
"tenantId": z.string().optional(),
|
|
1616
|
+
"workspaceId": z.string().optional(),
|
|
1617
|
+
"ownerPrincipalId": z.string().optional(),
|
|
1618
|
+
"audienceLabel": z.string().optional(),
|
|
1619
|
+
"policyTags": z.array(z.string()).optional(),
|
|
1620
|
+
"sensitivityTier": z.enum(["low", "medium", "high", "restricted"]).optional(),
|
|
1621
|
+
"exportClass": z.enum(["internal_only", "client_safe", "public_safe", "restricted"]).optional(),
|
|
1622
|
+
"anonymizationClass": z.enum(["none", "standard", "strict"]).optional(),
|
|
1623
|
+
"beliefType": z.string().optional(),
|
|
1624
|
+
"beliefStatus": z.enum(["assumption", "hypothesis", "belief", "fact"]).optional(),
|
|
1625
|
+
"epistemicStatus": z.enum(["hypothesis", "emerging", "established", "challenged", "assumption", "deprecated"]).optional(),
|
|
1626
|
+
"reversibility": z.enum(["irreversible", "hard_to_reverse", "reversible", "trivial"]).optional(),
|
|
1627
|
+
"predictionMeta": z.object({
|
|
1628
|
+
"isPrediction": z.boolean(),
|
|
1629
|
+
"registeredAt": z.number(),
|
|
1630
|
+
"expectedBy": z.number().optional(),
|
|
1631
|
+
"outcome": z.enum(["pending", "confirmed", "disconfirmed", "partial", "expired"]).optional(),
|
|
1632
|
+
"outcomeRecordedAt": z.number().optional(),
|
|
1633
|
+
"outcomeEvidenceId": z.string().optional(),
|
|
1634
|
+
"confidenceAtPrediction": z.number().optional(),
|
|
1635
|
+
"actualVsPredicted": z.string().optional()
|
|
1636
|
+
}).optional(),
|
|
1637
|
+
"consensusView": z.enum(["aligned", "ahead_of", "contrarian", "orthogonal", "unknown"]).optional(),
|
|
1638
|
+
"consensusConfidence": z.number().optional(),
|
|
1639
|
+
"consensusSource": z.string().optional(),
|
|
1640
|
+
"methodology": z.enum(["primary_research", "expert_interview", "customer_interview", "field_observation", "proprietary_data", "desk_research", "regulatory_filing", "news_article", "academic_paper", "ai_synthesis", "ai_extraction"]).optional(),
|
|
1641
|
+
"informationAsymmetry": z.enum(["proprietary", "early", "common"]).optional(),
|
|
1642
|
+
"temporalNature": z.enum(["factual", "forecast", "unknown"]).optional(),
|
|
1643
|
+
"questionType": z.enum(["validation", "falsification", "assumption_probe", "prediction_test", "counterfactual", "discovery", "clarification", "comparison", "causal", "mechanism", "general"]).optional(),
|
|
1644
|
+
"questionPriority": z.enum(["critical", "high", "medium", "low"]).optional(),
|
|
1645
|
+
"answerQuality": z.enum(["definitive", "strong", "moderate", "weak", "speculative", "unanswered"]).optional(),
|
|
1646
|
+
"themeConviction": z.enum(["high", "medium", "low", "negative"]).optional(),
|
|
1647
|
+
"decisionType": z.enum(["invest", "pass", "follow_on", "exit", "deep_dive", "monitor", "deprioritize", "thesis_adopt", "thesis_revise", "thesis_abandon"]).optional(),
|
|
1648
|
+
"decisionOutcome": z.enum(["pending", "successful", "unsuccessful", "mixed", "unknown"]).optional(),
|
|
1649
|
+
"externalIds": z.object({
|
|
1650
|
+
"crunchbase": z.string().optional(),
|
|
1651
|
+
"linkedin": z.string().optional(),
|
|
1652
|
+
"pitchbook": z.string().optional(),
|
|
1653
|
+
"twitter": z.string().optional(),
|
|
1654
|
+
"website": z.string().optional()
|
|
1655
|
+
}).optional(),
|
|
1656
|
+
"sourceType": z.enum(["human", "ai_extracted", "ai_generated", "imported", "system", "verified", "proprietary"]),
|
|
1657
|
+
"aiProvider": z.string().optional(),
|
|
1658
|
+
"extractedFromNodeId": idOf("epistemicNodes").optional(),
|
|
1659
|
+
"extractionModel": z.string().optional(),
|
|
1660
|
+
"extractionPromptName": z.string().optional(),
|
|
1661
|
+
"extractionPromptVersion": z.number().optional(),
|
|
1662
|
+
"extractionTemperature": z.number().optional(),
|
|
1663
|
+
"extractionLangfuseTraceId": z.string().optional(),
|
|
1664
|
+
"groundingVerified": z.boolean().optional(),
|
|
1665
|
+
"groundingConfidence": z.number().optional(),
|
|
1666
|
+
"groundingMatchedText": z.string().optional(),
|
|
1667
|
+
"groundingStartOffset": z.number().optional(),
|
|
1668
|
+
"groundingEndOffset": z.number().optional(),
|
|
1669
|
+
"groundingRejectionReason": z.string().optional(),
|
|
1670
|
+
"confidence": z.number().optional(),
|
|
1671
|
+
"verificationStatus": z.enum(["unverified", "human_verified", "ai_verified", "contradicted", "outdated"]).optional(),
|
|
1672
|
+
"status": z.enum(["active", "superseded", "archived", "deleted"]),
|
|
1673
|
+
"supersededBy": idOf("epistemicNodes").optional(),
|
|
1674
|
+
"topicId": z.string().optional(),
|
|
1675
|
+
"projectId": z.string().optional(),
|
|
1676
|
+
"createdBy": z.string(),
|
|
1677
|
+
"createdAt": z.number(),
|
|
1678
|
+
"updatedAt": z.number(),
|
|
1679
|
+
"syncStatus": z.enum(["synced", "pending_edges", "edge_creation_failed"]).optional(),
|
|
1680
|
+
"syncError": z.string().optional()
|
|
1681
|
+
}),
|
|
1682
|
+
indices: [
|
|
1683
|
+
{ kind: "index", name: "by_globalId", columns: ["globalId"] },
|
|
1684
|
+
{ kind: "index", name: "by_contentHash", columns: ["contentHash"] },
|
|
1685
|
+
{ kind: "index", name: "by_nodeType", columns: ["nodeType"] },
|
|
1686
|
+
{ kind: "index", name: "by_subtype", columns: ["nodeType", "subtype"] },
|
|
1687
|
+
{ kind: "index", name: "by_domain", columns: ["domain"] },
|
|
1688
|
+
{ kind: "index", name: "by_topic", columns: ["topicId"] },
|
|
1689
|
+
{ kind: "index", name: "by_topic_type", columns: ["topicId", "nodeType"] },
|
|
1690
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1691
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
1692
|
+
{ kind: "index", name: "by_tenant_workspace", columns: ["tenantId", "workspaceId"] },
|
|
1693
|
+
{ kind: "index", name: "by_audienceLabel", columns: ["audienceLabel"] },
|
|
1694
|
+
{ kind: "index", name: "by_sensitivityTier", columns: ["sensitivityTier"] },
|
|
1695
|
+
{ kind: "index", name: "by_exportClass", columns: ["exportClass"] },
|
|
1696
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
1697
|
+
{ kind: "index", name: "by_sourceType", columns: ["sourceType"] },
|
|
1698
|
+
{ kind: "index", name: "by_verification", columns: ["verificationStatus"] },
|
|
1699
|
+
{ kind: "index", name: "by_layer", columns: ["epistemicLayer"] },
|
|
1700
|
+
{ kind: "index", name: "by_layer_type", columns: ["epistemicLayer", "nodeType"] },
|
|
1701
|
+
{ kind: "index", name: "by_syncStatus", columns: ["syncStatus"] },
|
|
1702
|
+
{ kind: "index", name: "by_belief_status", columns: ["nodeType", "beliefStatus"] },
|
|
1703
|
+
{ kind: "index", name: "by_epistemic_status", columns: ["nodeType", "epistemicStatus"] },
|
|
1704
|
+
{ kind: "index", name: "by_temporal_nature", columns: ["nodeType", "temporalNature"] },
|
|
1705
|
+
{ kind: "index", name: "by_methodology", columns: ["nodeType", "methodology"] },
|
|
1706
|
+
{ kind: "index", name: "by_reversibility", columns: ["nodeType", "reversibility"] },
|
|
1707
|
+
{ kind: "index", name: "by_questionType", columns: ["nodeType", "questionType"] },
|
|
1708
|
+
{ kind: "index", name: "by_questionPriority", columns: ["nodeType", "questionPriority"] },
|
|
1709
|
+
{ kind: "search", name: "search_canonicalText", searchField: "canonicalText", filterFields: ["nodeType", "topicId", "topicId", "status"] }
|
|
1710
|
+
]
|
|
1711
|
+
});
|
|
1712
|
+
var epistemicNodeEmbeddings = defineTable({
|
|
1713
|
+
name: "epistemicNodeEmbeddings",
|
|
1714
|
+
component: "kernel",
|
|
1715
|
+
category: "embedding",
|
|
1716
|
+
shape: z.object({
|
|
1717
|
+
"nodeId": idOf("epistemicNodes"),
|
|
1718
|
+
"topicId": z.string().optional(),
|
|
1719
|
+
"nodeType": z.enum(["belief", "question", "evidence", "answer", "synthesis", "theme", "source"]),
|
|
1720
|
+
"embedding": z.array(z.number()),
|
|
1721
|
+
"createdBy": z.string(),
|
|
1722
|
+
"hasAnswer": z.boolean().optional(),
|
|
1723
|
+
"confidence": z.number().optional(),
|
|
1724
|
+
"importance": z.enum(["critical", "high", "medium", "low"]).optional(),
|
|
1725
|
+
"createdAt": z.number(),
|
|
1726
|
+
"updatedAt": z.number().optional()
|
|
1727
|
+
}),
|
|
1728
|
+
indices: [
|
|
1729
|
+
{ kind: "index", name: "by_nodeId", columns: ["nodeId"] },
|
|
1730
|
+
{ kind: "index", name: "by_topicId_type", columns: ["topicId", "nodeType"] },
|
|
1731
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
1732
|
+
{ kind: "vector", name: "by_embedding", vectorField: "embedding", dimensions: 1024, filterFields: ["nodeType", "createdBy"] }
|
|
1733
|
+
]
|
|
1734
|
+
});
|
|
1735
|
+
var groupMemberships = defineTable({
|
|
1736
|
+
name: "groupMemberships",
|
|
1737
|
+
component: "mc",
|
|
1738
|
+
category: "identity",
|
|
1739
|
+
shape: z.object({
|
|
1740
|
+
"groupId": idOf("groups"),
|
|
1741
|
+
"principalId": z.string(),
|
|
1742
|
+
"tenantId": idOf("tenants"),
|
|
1743
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
1744
|
+
"status": z.enum(["active", "invited", "revoked"]),
|
|
1745
|
+
"addedBy": z.string().optional(),
|
|
1746
|
+
"createdAt": z.number(),
|
|
1747
|
+
"updatedAt": z.number()
|
|
1748
|
+
}),
|
|
1749
|
+
indices: [
|
|
1750
|
+
{ kind: "index", name: "by_groupId", columns: ["groupId"] },
|
|
1751
|
+
{ kind: "index", name: "by_principalId", columns: ["principalId"] },
|
|
1752
|
+
{ kind: "index", name: "by_principal_group", columns: ["principalId", "groupId"] },
|
|
1753
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
1754
|
+
]
|
|
1755
|
+
});
|
|
1756
|
+
var groups = defineTable({
|
|
1757
|
+
name: "groups",
|
|
1758
|
+
component: "mc",
|
|
1759
|
+
category: "identity",
|
|
1760
|
+
shape: z.object({
|
|
1761
|
+
"tenantId": idOf("tenants"),
|
|
1762
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
1763
|
+
"groupKey": z.string(),
|
|
1764
|
+
"name": z.string(),
|
|
1765
|
+
"groupType": z.enum(["internal", "external", "system"]),
|
|
1766
|
+
"description": z.string().optional(),
|
|
1767
|
+
"metadata": z.record(z.any()).optional(),
|
|
1768
|
+
"createdAt": z.number(),
|
|
1769
|
+
"updatedAt": z.number()
|
|
1770
|
+
}),
|
|
1771
|
+
indices: [
|
|
1772
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1773
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
1774
|
+
{ kind: "index", name: "by_tenantId_groupKey", columns: ["tenantId", "groupKey"] }
|
|
1775
|
+
]
|
|
1776
|
+
});
|
|
1777
|
+
var memberships = defineTable({
|
|
1778
|
+
name: "memberships",
|
|
1779
|
+
component: "mc",
|
|
1780
|
+
category: "identity",
|
|
1781
|
+
shape: z.object({
|
|
1782
|
+
"principalId": z.string(),
|
|
1783
|
+
"principalRefId": idOf("principals").optional(),
|
|
1784
|
+
"tenantId": idOf("tenants"),
|
|
1785
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
1786
|
+
"role": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]),
|
|
1787
|
+
"status": z.enum(["active", "invited", "revoked"]),
|
|
1788
|
+
"source": z.enum(["manual", "sso", "bootstrap", "api", "scim"]),
|
|
1789
|
+
"grantedBy": z.string().optional(),
|
|
1790
|
+
"createdAt": z.number(),
|
|
1791
|
+
"updatedAt": z.number()
|
|
1792
|
+
}),
|
|
1793
|
+
indices: [
|
|
1794
|
+
{ kind: "index", name: "by_principalId", columns: ["principalId"] },
|
|
1795
|
+
{ kind: "index", name: "by_principal_tenant", columns: ["principalId", "tenantId"] },
|
|
1796
|
+
{ kind: "index", name: "by_workspace_principal", columns: ["workspaceId", "principalId"] },
|
|
1797
|
+
{ kind: "index", name: "by_tenant_role", columns: ["tenantId", "role"] },
|
|
1798
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
1799
|
+
]
|
|
1800
|
+
});
|
|
1801
|
+
var principals = defineTable({
|
|
1802
|
+
name: "principals",
|
|
1803
|
+
component: "mc",
|
|
1804
|
+
category: "identity",
|
|
1805
|
+
shape: z.object({
|
|
1806
|
+
"principalId": z.string(),
|
|
1807
|
+
"principalType": z.enum(["user", "group", "service", "external_viewer"]),
|
|
1808
|
+
"clerkId": z.string().optional(),
|
|
1809
|
+
"email": z.string().optional(),
|
|
1810
|
+
"displayName": z.string().optional(),
|
|
1811
|
+
"groupIds": z.array(idOf("groups")).optional(),
|
|
1812
|
+
"tenantId": idOf("tenants").optional(),
|
|
1813
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
1814
|
+
"status": z.enum(["active", "invited", "suspended", "disabled"]),
|
|
1815
|
+
"metadata": z.record(z.any()).optional(),
|
|
1816
|
+
"createdAt": z.number(),
|
|
1817
|
+
"updatedAt": z.number()
|
|
1818
|
+
}),
|
|
1819
|
+
indices: [
|
|
1820
|
+
{ kind: "index", name: "by_principalId", columns: ["principalId"] },
|
|
1821
|
+
{ kind: "index", name: "by_clerkId", columns: ["clerkId"] },
|
|
1822
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1823
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
1824
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
1825
|
+
]
|
|
1826
|
+
});
|
|
1827
|
+
var rateLimitWindows = defineTable({
|
|
1828
|
+
name: "rateLimitWindows",
|
|
1829
|
+
component: "mc",
|
|
1830
|
+
category: "identity",
|
|
1831
|
+
shape: z.object({
|
|
1832
|
+
"principalId": z.string(),
|
|
1833
|
+
"keyId": z.string().optional(),
|
|
1834
|
+
"tenantId": idOf("tenants").optional(),
|
|
1835
|
+
"windowType": z.enum(["minute", "hour"]),
|
|
1836
|
+
"windowStartMs": z.number(),
|
|
1837
|
+
"windowEndMs": z.number(),
|
|
1838
|
+
"requestCount": z.number(),
|
|
1839
|
+
"limit": z.number(),
|
|
1840
|
+
"tier": z.enum(["free", "developer", "partner"]),
|
|
1841
|
+
"createdAt": z.number(),
|
|
1842
|
+
"updatedAt": z.number()
|
|
1843
|
+
}),
|
|
1844
|
+
indices: [
|
|
1845
|
+
{ kind: "index", name: "by_principal_window", columns: ["principalId", "windowType", "windowStartMs"] },
|
|
1846
|
+
{ kind: "index", name: "by_window_type_start", columns: ["windowType", "windowStartMs"] },
|
|
1847
|
+
{ kind: "index", name: "by_window_end", columns: ["windowEndMs"] },
|
|
1848
|
+
{ kind: "index", name: "by_tier_window_end", columns: ["tier", "windowEndMs"] }
|
|
1849
|
+
]
|
|
1850
|
+
});
|
|
1851
|
+
var servicePrincipalKeys = defineTable({
|
|
1852
|
+
name: "servicePrincipalKeys",
|
|
1853
|
+
component: "mc",
|
|
1854
|
+
category: "identity",
|
|
1855
|
+
shape: z.object({
|
|
1856
|
+
"keyId": z.string(),
|
|
1857
|
+
"tokenHash": z.string(),
|
|
1858
|
+
"principalId": z.string(),
|
|
1859
|
+
"tenantId": idOf("tenants"),
|
|
1860
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
1861
|
+
"scopes": z.array(z.string()),
|
|
1862
|
+
"environment": z.enum(["sandbox", "production"]),
|
|
1863
|
+
"status": z.enum(["active", "rotating", "rotated", "expired", "revoked"]),
|
|
1864
|
+
"expiresAt": z.number(),
|
|
1865
|
+
"rotationGracePeriod": z.number().optional(),
|
|
1866
|
+
"rotatedToKeyId": z.string().optional(),
|
|
1867
|
+
"rateLimitTier": z.enum(["free", "developer", "partner"]).optional(),
|
|
1868
|
+
"metadata": z.record(z.any()).optional(),
|
|
1869
|
+
"createdBy": z.string(),
|
|
1870
|
+
"revokedBy": z.string().optional(),
|
|
1871
|
+
"revokedAt": z.number().optional(),
|
|
1872
|
+
"lastUsedAt": z.number().optional(),
|
|
1873
|
+
"createdAt": z.number(),
|
|
1874
|
+
"updatedAt": z.number()
|
|
1875
|
+
}),
|
|
1876
|
+
indices: [
|
|
1877
|
+
{ kind: "index", name: "by_keyId", columns: ["keyId"] },
|
|
1878
|
+
{ kind: "index", name: "by_tokenHash", columns: ["tokenHash"] },
|
|
1879
|
+
{ kind: "index", name: "by_principalId", columns: ["principalId"] },
|
|
1880
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1881
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
1882
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
1883
|
+
{ kind: "index", name: "by_principal_status", columns: ["principalId", "status"] }
|
|
1884
|
+
]
|
|
1885
|
+
});
|
|
1886
|
+
var userSessions = defineTable({
|
|
1887
|
+
name: "userSessions",
|
|
1888
|
+
component: "mc",
|
|
1889
|
+
category: "identity",
|
|
1890
|
+
shape: z.object({
|
|
1891
|
+
"sessionId": z.string(),
|
|
1892
|
+
"tenantId": idOf("tenants"),
|
|
1893
|
+
"clerkUserId": z.string(),
|
|
1894
|
+
"principalId": z.string().optional(),
|
|
1895
|
+
"principalType": z.enum(["human", "service", "agent"]).optional(),
|
|
1896
|
+
"workspaceId": z.string().optional(),
|
|
1897
|
+
"apiKeyId": idOf("apiKeys"),
|
|
1898
|
+
"sessionType": z.enum(["user", "agent"]),
|
|
1899
|
+
"authMode": z.enum(["interactive_user", "service_principal", "tenant_api_key", "session_token"]).optional(),
|
|
1900
|
+
"role": z.string().optional(),
|
|
1901
|
+
"scopes": z.array(z.string()).optional(),
|
|
1902
|
+
"delegationChain": z.array(z.object({
|
|
1903
|
+
"principalId": z.string(),
|
|
1904
|
+
"principalType": z.enum(["human", "service", "agent"]),
|
|
1905
|
+
"authMode": z.enum(["interactive_user", "service_principal", "tenant_api_key", "session_token"]).optional(),
|
|
1906
|
+
"sessionId": z.string().optional(),
|
|
1907
|
+
"delegatedAt": z.number().optional(),
|
|
1908
|
+
"reason": z.string().optional()
|
|
1909
|
+
})).optional(),
|
|
1910
|
+
"sourceSessionId": z.string().optional(),
|
|
1911
|
+
"status": z.enum(["active", "expired", "revoked"]),
|
|
1912
|
+
"sessionExpiresAt": z.number().optional(),
|
|
1913
|
+
"jwtIssuedAt": z.number().optional(),
|
|
1914
|
+
"jwtExpiresAt": z.number().optional(),
|
|
1915
|
+
"lastActivityAt": z.number(),
|
|
1916
|
+
"lastValidatedAt": z.number().optional(),
|
|
1917
|
+
"revokedAt": z.number().optional(),
|
|
1918
|
+
"revokedBy": z.string().optional(),
|
|
1919
|
+
"revokeReason": z.string().optional(),
|
|
1920
|
+
"createdAt": z.number(),
|
|
1921
|
+
"updatedAt": z.number()
|
|
1922
|
+
}),
|
|
1923
|
+
indices: [
|
|
1924
|
+
{ kind: "index", name: "by_sessionId", columns: ["sessionId"] },
|
|
1925
|
+
{ kind: "index", name: "by_sourceSessionId", columns: ["sourceSessionId"] },
|
|
1926
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
1927
|
+
{ kind: "index", name: "by_clerkUserId", columns: ["clerkUserId"] },
|
|
1928
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
1929
|
+
]
|
|
1930
|
+
});
|
|
1931
|
+
var harnessReplays = defineTable({
|
|
1932
|
+
name: "harnessReplays",
|
|
1933
|
+
component: "kernel",
|
|
1934
|
+
category: "platform",
|
|
1935
|
+
shape: z.object({
|
|
1936
|
+
"replayId": z.string(),
|
|
1937
|
+
"runId": z.string(),
|
|
1938
|
+
"traceVersion": z.string(),
|
|
1939
|
+
"status": z.enum(["captured", "partial", "failed"]),
|
|
1940
|
+
"entrypoints": z.array(z.string()),
|
|
1941
|
+
"steps": z.array(z.object({
|
|
1942
|
+
"stepId": z.string(),
|
|
1943
|
+
"phase": z.string(),
|
|
1944
|
+
"kind": z.string(),
|
|
1945
|
+
"status": z.enum(["completed", "failed", "skipped"]),
|
|
1946
|
+
"startedAt": z.number(),
|
|
1947
|
+
"completedAt": z.number().optional(),
|
|
1948
|
+
"summary": z.string().optional(),
|
|
1949
|
+
"metadata": z.record(z.any()).optional()
|
|
1950
|
+
})),
|
|
1951
|
+
"inputSnapshot": z.record(z.any()).optional(),
|
|
1952
|
+
"outputSnapshot": z.record(z.any()).optional(),
|
|
1953
|
+
"sandboxAudit": z.array(z.record(z.any())).optional(),
|
|
1954
|
+
"workflowReceipt": z.record(z.any()).optional(),
|
|
1955
|
+
"metadata": z.record(z.any()).optional(),
|
|
1956
|
+
"createdAt": z.number()
|
|
1957
|
+
}),
|
|
1958
|
+
indices: [
|
|
1959
|
+
{ kind: "index", name: "by_replayId", columns: ["replayId"] },
|
|
1960
|
+
{ kind: "index", name: "by_runId", columns: ["runId"] },
|
|
1961
|
+
{ kind: "index", name: "by_status_createdAt", columns: ["status", "createdAt"] }
|
|
1962
|
+
]
|
|
1963
|
+
});
|
|
1964
|
+
var harnessRuns = defineTable({
|
|
1965
|
+
name: "harnessRuns",
|
|
1966
|
+
component: "kernel",
|
|
1967
|
+
category: "platform",
|
|
1968
|
+
shape: z.object({
|
|
1969
|
+
"runId": z.string(),
|
|
1970
|
+
"replayId": z.string().optional(),
|
|
1971
|
+
"agentId": z.string(),
|
|
1972
|
+
"agentVersion": z.string().optional(),
|
|
1973
|
+
"runKind": z.enum(["sandbox", "live_runner", "workflow", "bi", "chat", "sdk", "mcp", "external"]),
|
|
1974
|
+
"executionAdapter": z.enum(["convex_mutation", "convex_action", "http_callback", "mcp_tool", "sdk_invocation", "external_observed"]),
|
|
1975
|
+
"principalId": z.string(),
|
|
1976
|
+
"tenantId": z.string(),
|
|
1977
|
+
"workspaceId": z.string().optional(),
|
|
1978
|
+
"authMode": z.enum(["interactive_user", "service_principal"]),
|
|
1979
|
+
"environment": z.enum(["sandbox", "production"]),
|
|
1980
|
+
"promptReleaseChannel": z.enum(["dev", "staging", "prod"]),
|
|
1981
|
+
"isolationMode": z.enum(["sandbox", "direct", "workflow", "observed"]).optional(),
|
|
1982
|
+
"langfuseTraceId": z.string().optional(),
|
|
1983
|
+
"chatId": z.string().optional(),
|
|
1984
|
+
"worktreeId": z.string().optional(),
|
|
1985
|
+
"topicId": z.string().optional(),
|
|
1986
|
+
"startedAt": z.number(),
|
|
1987
|
+
"completedAt": z.number().optional(),
|
|
1988
|
+
"durationMs": z.number().optional(),
|
|
1989
|
+
"status": z.enum(["running", "completed", "failed", "timeout"]),
|
|
1990
|
+
"outcome": z.object({
|
|
1991
|
+
"verdict": z.enum(["success", "partial", "failure", "timeout", "cancelled"]),
|
|
1992
|
+
"summary": z.string(),
|
|
1993
|
+
"errorCategory": z.enum(["policy_denied", "tool_execution", "prompt_resolution", "model_error", "timeout", "heartbeat_timeout", "input_validation", "internal", "external_service"]).optional(),
|
|
1994
|
+
"errorMessage": z.string().optional()
|
|
1995
|
+
}),
|
|
1996
|
+
"toolCalls": z.array(z.object({
|
|
1997
|
+
"toolCallId": z.string(),
|
|
1998
|
+
"toolName": z.string(),
|
|
1999
|
+
"success": z.boolean(),
|
|
2000
|
+
"durationMs": z.number(),
|
|
2001
|
+
"policyDecisionId": z.string().optional(),
|
|
2002
|
+
"gateClassification": z.enum(["core", "shimmed"]).optional(),
|
|
2003
|
+
"requiredScopes": z.array(z.string()).optional(),
|
|
2004
|
+
"graphWriteCount": z.number().optional(),
|
|
2005
|
+
"metadata": z.record(z.any()).optional()
|
|
2006
|
+
})),
|
|
2007
|
+
"toolCallCount": z.number(),
|
|
2008
|
+
"graphReads": z.array(z.object({
|
|
2009
|
+
"operationId": z.string(),
|
|
2010
|
+
"surface": z.enum(["belief", "question", "evidence", "worktree", "workflow", "topic", "document", "external"]),
|
|
2011
|
+
"action": z.string(),
|
|
2012
|
+
"targetId": z.string().optional(),
|
|
2013
|
+
"summary": z.string().optional(),
|
|
2014
|
+
"metadata": z.record(z.any()).optional()
|
|
2015
|
+
})),
|
|
2016
|
+
"graphReadCount": z.number(),
|
|
2017
|
+
"graphWrites": z.array(z.object({
|
|
2018
|
+
"operationId": z.string(),
|
|
2019
|
+
"surface": z.enum(["belief", "question", "evidence", "worktree", "workflow", "topic", "document", "external"]),
|
|
2020
|
+
"action": z.string(),
|
|
2021
|
+
"targetId": z.string().optional(),
|
|
2022
|
+
"summary": z.string().optional(),
|
|
2023
|
+
"metadata": z.record(z.any()).optional()
|
|
2024
|
+
})),
|
|
2025
|
+
"graphWriteCount": z.number(),
|
|
2026
|
+
"workflow": z.object({
|
|
2027
|
+
"workflowId": z.string(),
|
|
2028
|
+
"workflowVersion": z.string().optional(),
|
|
2029
|
+
"triggerKind": z.enum(["manual", "schedule", "hook"]),
|
|
2030
|
+
"mutationTier": z.enum(["read_only", "low_risk_write", "high_risk_write"]).optional(),
|
|
2031
|
+
"approvalMode": z.enum(["none", "audit_only", "human_required", "auto_approve"]).optional(),
|
|
2032
|
+
"actionCount": z.number().optional()
|
|
2033
|
+
}).optional(),
|
|
2034
|
+
"cost": z.object({
|
|
2035
|
+
"totalInputTokens": z.number().optional(),
|
|
2036
|
+
"totalOutputTokens": z.number().optional(),
|
|
2037
|
+
"estimatedTotalCostUsd": z.number().optional(),
|
|
2038
|
+
"llmCallCount": z.number().optional(),
|
|
2039
|
+
"toolCallCount": z.number().optional(),
|
|
2040
|
+
"modelsUsed": z.array(z.string()).optional()
|
|
2041
|
+
}).optional(),
|
|
2042
|
+
"metadata": z.record(z.any()).optional(),
|
|
2043
|
+
"createdAt": z.number(),
|
|
2044
|
+
"updatedAt": z.number()
|
|
2045
|
+
}),
|
|
2046
|
+
indices: [
|
|
2047
|
+
{ kind: "index", name: "by_runId", columns: ["runId"] },
|
|
2048
|
+
{ kind: "index", name: "by_status_startedAt", columns: ["status", "startedAt"] },
|
|
2049
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
|
|
2050
|
+
{ kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
|
|
2051
|
+
{ kind: "index", name: "by_agent_createdAt", columns: ["agentId", "createdAt"] },
|
|
2052
|
+
{ kind: "index", name: "by_runKind_createdAt", columns: ["runKind", "createdAt"] },
|
|
2053
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] }
|
|
2054
|
+
]
|
|
2055
|
+
});
|
|
2056
|
+
var platformAgentRunPolicyDecisions = defineTable({
|
|
2057
|
+
name: "platformAgentRunPolicyDecisions",
|
|
2058
|
+
component: "kernel",
|
|
2059
|
+
category: "platform",
|
|
2060
|
+
shape: z.object({
|
|
2061
|
+
"runId": z.string(),
|
|
2062
|
+
"decisionId": z.string(),
|
|
2063
|
+
"action": z.string(),
|
|
2064
|
+
"result": z.enum(["allow", "deny", "shadow_allow"]),
|
|
2065
|
+
"reasonCode": z.string(),
|
|
2066
|
+
"scopesChecked": z.array(z.string()),
|
|
2067
|
+
"scopesGranted": z.array(z.string()),
|
|
2068
|
+
"evaluatedAt": z.number(),
|
|
2069
|
+
"createdAt": z.number()
|
|
2070
|
+
}),
|
|
2071
|
+
indices: [
|
|
2072
|
+
{ kind: "index", name: "by_decisionId", columns: ["decisionId"] },
|
|
2073
|
+
{ kind: "index", name: "by_run_createdAt", columns: ["runId", "createdAt"] }
|
|
2074
|
+
]
|
|
2075
|
+
});
|
|
2076
|
+
var platformAgentRunPromptResolutions = defineTable({
|
|
2077
|
+
name: "platformAgentRunPromptResolutions",
|
|
2078
|
+
component: "kernel",
|
|
2079
|
+
category: "platform",
|
|
2080
|
+
shape: z.object({
|
|
2081
|
+
"runId": z.string(),
|
|
2082
|
+
"promptResolutionId": z.string(),
|
|
2083
|
+
"sequenceIndex": z.number(),
|
|
2084
|
+
"promptName": z.string(),
|
|
2085
|
+
"promptVersion": z.string(),
|
|
2086
|
+
"releaseChannel": z.enum(["dev", "staging", "prod"]),
|
|
2087
|
+
"usedFallback": z.boolean(),
|
|
2088
|
+
"modelSlot": z.string(),
|
|
2089
|
+
"modelKey": z.string(),
|
|
2090
|
+
"provider": z.string(),
|
|
2091
|
+
"inputTokens": z.number().optional(),
|
|
2092
|
+
"outputTokens": z.number().optional(),
|
|
2093
|
+
"durationMs": z.number().optional(),
|
|
2094
|
+
"estimatedCostUsd": z.number().optional(),
|
|
2095
|
+
"resolvedAt": z.number(),
|
|
2096
|
+
"metadata": z.record(z.any()).optional(),
|
|
2097
|
+
"createdAt": z.number()
|
|
2098
|
+
}),
|
|
2099
|
+
indices: [
|
|
2100
|
+
{ kind: "index", name: "by_promptResolutionId", columns: ["promptResolutionId"] },
|
|
2101
|
+
{ kind: "index", name: "by_run_createdAt", columns: ["runId", "createdAt"] },
|
|
2102
|
+
{ kind: "index", name: "by_prompt_createdAt", columns: ["promptName", "createdAt"] }
|
|
2103
|
+
]
|
|
2104
|
+
});
|
|
2105
|
+
var platformAgentRuns = defineTable({
|
|
2106
|
+
name: "platformAgentRuns",
|
|
2107
|
+
component: "kernel",
|
|
2108
|
+
category: "platform",
|
|
2109
|
+
shape: z.object({
|
|
2110
|
+
"runId": z.string(),
|
|
2111
|
+
"reportingToken": z.string(),
|
|
2112
|
+
"agentDefinitionId": z.string(),
|
|
2113
|
+
"agentVersion": z.string(),
|
|
2114
|
+
"principalId": z.string(),
|
|
2115
|
+
"tenantId": z.string(),
|
|
2116
|
+
"workspaceId": z.string().optional(),
|
|
2117
|
+
"authMode": z.enum(["interactive_user", "service_principal"]),
|
|
2118
|
+
"executionAdapter": z.enum(["convex_mutation", "convex_action", "http_callback", "mcp_tool", "sdk_invocation", "external_observed"]),
|
|
2119
|
+
"environment": z.enum(["sandbox", "production"]),
|
|
2120
|
+
"promptReleaseChannel": z.enum(["dev", "staging", "prod"]),
|
|
2121
|
+
"status": z.enum(["running", "completed", "failed", "timeout"]),
|
|
2122
|
+
"startedAt": z.number(),
|
|
2123
|
+
"finalizedAt": z.number().optional(),
|
|
2124
|
+
"durationMs": z.number().optional(),
|
|
2125
|
+
"lastHeartbeatAt": z.number().optional(),
|
|
2126
|
+
"langfuseTraceId": z.string().optional(),
|
|
2127
|
+
"chatId": z.string().optional(),
|
|
2128
|
+
"topicId": z.string().optional(),
|
|
2129
|
+
"error": z.object({
|
|
2130
|
+
"category": z.enum(["policy_denied", "tool_execution", "prompt_resolution", "model_error", "timeout", "heartbeat_timeout", "input_validation", "internal", "external_service"]),
|
|
2131
|
+
"message": z.string(),
|
|
2132
|
+
"code": z.string().optional(),
|
|
2133
|
+
"stack": z.string().optional()
|
|
2134
|
+
}).optional(),
|
|
2135
|
+
"costMetrics": z.record(z.any()).optional(),
|
|
2136
|
+
"metadata": z.record(z.any()).optional(),
|
|
2137
|
+
"createdAt": z.number(),
|
|
2138
|
+
"updatedAt": z.number()
|
|
2139
|
+
}),
|
|
2140
|
+
indices: [
|
|
2141
|
+
{ kind: "index", name: "by_runId", columns: ["runId"] },
|
|
2142
|
+
{ kind: "index", name: "by_status_lastHeartbeatAt", columns: ["status", "lastHeartbeatAt"] },
|
|
2143
|
+
{ kind: "index", name: "by_status_startedAt", columns: ["status", "startedAt"] },
|
|
2144
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
|
|
2145
|
+
{ kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
|
|
2146
|
+
{ kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
|
|
2147
|
+
{ kind: "index", name: "by_agentDefinition_createdAt", columns: ["agentDefinitionId", "createdAt"] },
|
|
2148
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] }
|
|
2149
|
+
]
|
|
2150
|
+
});
|
|
2151
|
+
var platformAgentRunToolCalls = defineTable({
|
|
2152
|
+
name: "platformAgentRunToolCalls",
|
|
2153
|
+
component: "kernel",
|
|
2154
|
+
category: "platform",
|
|
2155
|
+
shape: z.object({
|
|
2156
|
+
"runId": z.string(),
|
|
2157
|
+
"toolCallId": z.string(),
|
|
2158
|
+
"sequenceIndex": z.number(),
|
|
2159
|
+
"toolName": z.string(),
|
|
2160
|
+
"toolVersion": z.string().optional(),
|
|
2161
|
+
"policyDecisionId": z.string(),
|
|
2162
|
+
"requiredScopes": z.array(z.string()),
|
|
2163
|
+
"policyResult": z.enum(["allowed", "denied", "shadow_allowed"]),
|
|
2164
|
+
"policyReasonCode": z.string(),
|
|
2165
|
+
"executionAdapter": z.enum(["convex_mutation", "convex_action", "http_callback", "mcp_tool", "sdk_invocation", "external_observed"]),
|
|
2166
|
+
"inputHash": z.string(),
|
|
2167
|
+
"outputHash": z.string(),
|
|
2168
|
+
"durationMs": z.number().optional(),
|
|
2169
|
+
"success": z.boolean(),
|
|
2170
|
+
"error": z.string().optional(),
|
|
2171
|
+
"startedAt": z.number(),
|
|
2172
|
+
"completedAt": z.number(),
|
|
2173
|
+
"metadata": z.record(z.any()).optional(),
|
|
2174
|
+
"createdAt": z.number()
|
|
2175
|
+
}),
|
|
2176
|
+
indices: [
|
|
2177
|
+
{ kind: "index", name: "by_toolCallId", columns: ["toolCallId"] },
|
|
2178
|
+
{ kind: "index", name: "by_run_createdAt", columns: ["runId", "createdAt"] },
|
|
2179
|
+
{ kind: "index", name: "by_tool_createdAt", columns: ["toolName", "createdAt"] }
|
|
2180
|
+
]
|
|
2181
|
+
});
|
|
2182
|
+
var platformHarnessShadowAudit = defineTable({
|
|
2183
|
+
name: "platformHarnessShadowAudit",
|
|
2184
|
+
component: "kernel",
|
|
2185
|
+
category: "platform",
|
|
2186
|
+
shape: z.object({
|
|
2187
|
+
"shadowAuditId": z.string(),
|
|
2188
|
+
"runId": z.string(),
|
|
2189
|
+
"toolCallId": z.string(),
|
|
2190
|
+
"policyDecisionId": z.string(),
|
|
2191
|
+
"toolName": z.string(),
|
|
2192
|
+
"gateClassification": z.enum(["core", "shimmed"]),
|
|
2193
|
+
"requiredScopes": z.array(z.string()),
|
|
2194
|
+
"grantedScopes": z.array(z.string()),
|
|
2195
|
+
"shadowResult": z.literal("shadow_allow"),
|
|
2196
|
+
"wouldHaveDenied": z.boolean(),
|
|
2197
|
+
"reason": z.string(),
|
|
2198
|
+
"retentionExpiresAt": z.number(),
|
|
2199
|
+
"createdAt": z.number(),
|
|
2200
|
+
"metadata": z.record(z.any()).optional()
|
|
2201
|
+
}),
|
|
2202
|
+
indices: [
|
|
2203
|
+
{ kind: "index", name: "by_shadowAuditId", columns: ["shadowAuditId"] },
|
|
2204
|
+
{ kind: "index", name: "by_run_createdAt", columns: ["runId", "createdAt"] },
|
|
2205
|
+
{ kind: "index", name: "by_policyDecisionId", columns: ["policyDecisionId"] },
|
|
2206
|
+
{ kind: "index", name: "by_retentionExpiresAt", columns: ["retentionExpiresAt"] }
|
|
2207
|
+
]
|
|
2208
|
+
});
|
|
2209
|
+
var publicationRules = defineTable({
|
|
2210
|
+
name: "publicationRules",
|
|
2211
|
+
component: "kernel",
|
|
2212
|
+
category: "platform",
|
|
2213
|
+
shape: z.object({
|
|
2214
|
+
"tenantId": z.string(),
|
|
2215
|
+
"packKey": z.string().optional(),
|
|
2216
|
+
"workspaceId": z.string().optional(),
|
|
2217
|
+
"name": z.string(),
|
|
2218
|
+
"description": z.string().optional(),
|
|
2219
|
+
"conditionType": z.enum(["confidence_threshold", "node_type_match", "epistemic_layer_match", "tag_match", "composite"]),
|
|
2220
|
+
"conditions": z.any(),
|
|
2221
|
+
"enabled": z.boolean(),
|
|
2222
|
+
"priority": z.number().optional(),
|
|
2223
|
+
"createdBy": z.string(),
|
|
2224
|
+
"createdAt": z.number(),
|
|
2225
|
+
"updatedAt": z.number()
|
|
2226
|
+
}),
|
|
2227
|
+
indices: [
|
|
2228
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
2229
|
+
{ kind: "index", name: "by_tenantId_enabled", columns: ["tenantId", "enabled"] },
|
|
2230
|
+
{ kind: "index", name: "by_tenantId_packKey", columns: ["tenantId", "packKey"] },
|
|
2231
|
+
{ kind: "index", name: "by_tenantId_workspaceId", columns: ["tenantId", "workspaceId"] }
|
|
2232
|
+
]
|
|
2233
|
+
});
|
|
2234
|
+
var researchJobs = defineTable({
|
|
2235
|
+
name: "researchJobs",
|
|
2236
|
+
component: "kernel",
|
|
2237
|
+
category: "platform",
|
|
2238
|
+
shape: z.object({
|
|
2239
|
+
"tenantId": z.string(),
|
|
2240
|
+
"jobId": z.string(),
|
|
2241
|
+
"type": z.enum(["search", "deep_research", "scrape"]),
|
|
2242
|
+
"query": z.string(),
|
|
2243
|
+
"topicId": z.string().optional(),
|
|
2244
|
+
"depth": z.string().optional(),
|
|
2245
|
+
"integrationKey": z.string(),
|
|
2246
|
+
"status": z.enum(["pending", "running", "completed", "failed", "cancelled"]),
|
|
2247
|
+
"results": z.record(z.any()).optional(),
|
|
2248
|
+
"resultCount": z.number().optional(),
|
|
2249
|
+
"error": z.string().optional(),
|
|
2250
|
+
"langfuseTraceId": z.string().optional(),
|
|
2251
|
+
"autoCommitEvidence": z.boolean(),
|
|
2252
|
+
"committedEvidenceIds": z.array(z.string()).optional(),
|
|
2253
|
+
"requestedBy": z.string(),
|
|
2254
|
+
"createdAt": z.number(),
|
|
2255
|
+
"startedAt": z.number().optional(),
|
|
2256
|
+
"completedAt": z.number().optional(),
|
|
2257
|
+
"durationMs": z.number().optional()
|
|
2258
|
+
}),
|
|
2259
|
+
indices: [
|
|
2260
|
+
{ kind: "index", name: "by_tenant", columns: ["tenantId"] },
|
|
2261
|
+
{ kind: "index", name: "by_jobId", columns: ["jobId"] },
|
|
2262
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
|
|
2263
|
+
{ kind: "index", name: "by_topic", columns: ["topicId"] }
|
|
2264
|
+
]
|
|
2265
|
+
});
|
|
2266
|
+
var idempotencyTokens = defineTable({
|
|
2267
|
+
name: "idempotencyTokens",
|
|
2268
|
+
component: "kernel",
|
|
2269
|
+
category: "idempotency",
|
|
2270
|
+
shape: z.object({
|
|
2271
|
+
"tenantId": z.string(),
|
|
2272
|
+
"fnName": z.string(),
|
|
2273
|
+
"key": z.string(),
|
|
2274
|
+
"resultJson": z.string(),
|
|
2275
|
+
"recordedAt": z.number(),
|
|
2276
|
+
"expiresAt": z.number()
|
|
2277
|
+
}),
|
|
2278
|
+
indices: [
|
|
2279
|
+
{ kind: "index", name: "by_tenant_fn_key", columns: ["tenantId", "fnName", "key"] },
|
|
2280
|
+
{ kind: "index", name: "by_expiry", columns: ["expiresAt"] }
|
|
2281
|
+
]
|
|
2282
|
+
});
|
|
2283
|
+
var lenses = defineTable({
|
|
2284
|
+
name: "lenses",
|
|
2285
|
+
component: "kernel",
|
|
2286
|
+
category: "lens",
|
|
2287
|
+
shape: z.object({
|
|
2288
|
+
"globalId": z.string(),
|
|
2289
|
+
"name": z.string(),
|
|
2290
|
+
"description": z.string().optional(),
|
|
2291
|
+
"workspaceId": z.string(),
|
|
2292
|
+
"topicId": z.string().optional(),
|
|
2293
|
+
"perspectiveType": z.string(),
|
|
2294
|
+
"promptTemplates": z.array(z.object({
|
|
2295
|
+
"key": z.string(),
|
|
2296
|
+
"promptRef": z.string(),
|
|
2297
|
+
"phase": z.string().optional(),
|
|
2298
|
+
"role": z.string().optional(),
|
|
2299
|
+
"version": z.string().optional(),
|
|
2300
|
+
"required": z.boolean().optional(),
|
|
2301
|
+
"metadata": z.any().optional()
|
|
2302
|
+
})),
|
|
2303
|
+
"workflowTemplates": z.array(z.object({
|
|
2304
|
+
"key": z.string(),
|
|
2305
|
+
"name": z.string(),
|
|
2306
|
+
"description": z.string().optional(),
|
|
2307
|
+
"steps": z.array(z.object({
|
|
2308
|
+
"key": z.string(),
|
|
2309
|
+
"title": z.string(),
|
|
2310
|
+
"description": z.string().optional(),
|
|
2311
|
+
"promptTemplateKey": z.string().optional(),
|
|
2312
|
+
"taskTemplateKeys": z.array(z.string()).optional(),
|
|
2313
|
+
"metadata": z.any().optional()
|
|
2314
|
+
})),
|
|
2315
|
+
"metadata": z.any().optional()
|
|
2316
|
+
})),
|
|
2317
|
+
"taskTemplates": z.array(z.object({
|
|
2318
|
+
"key": z.string(),
|
|
2319
|
+
"title": z.string(),
|
|
2320
|
+
"description": z.string().optional(),
|
|
2321
|
+
"priority": z.enum(["critical", "high", "medium", "low"]).optional(),
|
|
2322
|
+
"phase": z.string().optional(),
|
|
2323
|
+
"metadata": z.any().optional()
|
|
2324
|
+
})),
|
|
2325
|
+
"questionTemplates": z.array(z.object({
|
|
2326
|
+
"key": z.string(),
|
|
2327
|
+
"text": z.string(),
|
|
2328
|
+
"priority": z.enum(["critical", "high", "medium", "low"]).optional(),
|
|
2329
|
+
"linkedBeliefKey": z.string().optional(),
|
|
2330
|
+
"metadata": z.any().optional()
|
|
2331
|
+
})).optional(),
|
|
2332
|
+
"filterCriteria": z.object({
|
|
2333
|
+
"version": z.literal(1),
|
|
2334
|
+
"kind": z.literal("taxonomy"),
|
|
2335
|
+
"entityTypeFilters": z.array(z.object({
|
|
2336
|
+
"entityTypeValue": z.string(),
|
|
2337
|
+
"subtypeValues": z.array(z.string()).optional()
|
|
2338
|
+
})),
|
|
2339
|
+
"ontologyScope": z.object({
|
|
2340
|
+
"ontologyKey": z.string().optional()
|
|
2341
|
+
}).optional()
|
|
2342
|
+
}).optional(),
|
|
2343
|
+
"metadata": z.any().optional(),
|
|
2344
|
+
"status": z.enum(["draft", "active", "archived"]),
|
|
2345
|
+
"createdBy": z.string(),
|
|
2346
|
+
"createdAt": z.number(),
|
|
2347
|
+
"updatedAt": z.number()
|
|
2348
|
+
}),
|
|
2349
|
+
indices: [
|
|
2350
|
+
{ kind: "index", name: "by_workspace", columns: ["workspaceId"] },
|
|
2351
|
+
{ kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
|
|
2352
|
+
{ kind: "index", name: "by_workspace_perspective", columns: ["workspaceId", "perspectiveType"] },
|
|
2353
|
+
{ kind: "index", name: "by_topic", columns: ["topicId"] }
|
|
2354
|
+
]
|
|
2355
|
+
});
|
|
2356
|
+
var lensTopicBindings = defineTable({
|
|
2357
|
+
name: "lensTopicBindings",
|
|
2358
|
+
component: "kernel",
|
|
2359
|
+
category: "lens",
|
|
2360
|
+
shape: z.object({
|
|
2361
|
+
"lensId": idOf("lenses"),
|
|
2362
|
+
"topicId": z.string(),
|
|
2363
|
+
"workspaceId": z.string(),
|
|
2364
|
+
"status": z.enum(["active", "removed"]),
|
|
2365
|
+
"metadata": z.any().optional(),
|
|
2366
|
+
"appliedBy": z.string(),
|
|
2367
|
+
"appliedAt": z.number(),
|
|
2368
|
+
"removedBy": z.string().optional(),
|
|
2369
|
+
"removedAt": z.number().optional(),
|
|
2370
|
+
"updatedAt": z.number()
|
|
2371
|
+
}),
|
|
2372
|
+
indices: [
|
|
2373
|
+
{ kind: "index", name: "by_lens", columns: ["lensId"] },
|
|
2374
|
+
{ kind: "index", name: "by_lens_status", columns: ["lensId", "status"] },
|
|
2375
|
+
{ kind: "index", name: "by_topic", columns: ["topicId"] },
|
|
2376
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] },
|
|
2377
|
+
{ kind: "index", name: "by_topic_lens", columns: ["topicId", "lensId"] }
|
|
2378
|
+
]
|
|
2379
|
+
});
|
|
2380
|
+
var mcpWritePolicy = defineTable({
|
|
2381
|
+
name: "mcpWritePolicy",
|
|
2382
|
+
component: "identity",
|
|
2383
|
+
category: "platform",
|
|
2384
|
+
shape: z.object({
|
|
2385
|
+
"topicId": z.string().optional(),
|
|
2386
|
+
"role": z.string(),
|
|
2387
|
+
"toolCategory": z.string(),
|
|
2388
|
+
"permission": z.enum(["allow", "deny", "review_required"]),
|
|
2389
|
+
"maxWritesPerSession": z.number().optional(),
|
|
2390
|
+
"enabled": z.boolean(),
|
|
2391
|
+
"rationale": z.string().optional(),
|
|
2392
|
+
"createdAt": z.number(),
|
|
2393
|
+
"updatedAt": z.number(),
|
|
2394
|
+
"createdBy": z.string()
|
|
2395
|
+
}),
|
|
2396
|
+
indices: [
|
|
2397
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
2398
|
+
{ kind: "index", name: "by_role", columns: ["role"] },
|
|
2399
|
+
{ kind: "index", name: "by_topicId_role", columns: ["topicId", "role"] },
|
|
2400
|
+
{ kind: "index", name: "by_enabled", columns: ["enabled"] }
|
|
2401
|
+
]
|
|
2402
|
+
});
|
|
2403
|
+
var platformAudienceGrants = defineTable({
|
|
2404
|
+
name: "platformAudienceGrants",
|
|
2405
|
+
component: "identity",
|
|
2406
|
+
category: "platform",
|
|
2407
|
+
shape: z.object({
|
|
2408
|
+
"tenantId": z.string(),
|
|
2409
|
+
"workspaceId": z.string().optional(),
|
|
2410
|
+
"principalId": z.string().optional(),
|
|
2411
|
+
"groupId": z.string().optional(),
|
|
2412
|
+
"audienceKey": z.string(),
|
|
2413
|
+
"audienceClass": z.enum(["internal", "restricted_external", "public"]),
|
|
2414
|
+
"status": z.enum(["active", "revoked", "expired"]),
|
|
2415
|
+
"grantedBy": z.string().optional(),
|
|
2416
|
+
"expiresAt": z.number().optional(),
|
|
2417
|
+
"metadata": z.record(z.any()).optional(),
|
|
2418
|
+
"createdAt": z.number(),
|
|
2419
|
+
"updatedAt": z.number()
|
|
2420
|
+
}),
|
|
2421
|
+
indices: [
|
|
2422
|
+
{ kind: "index", name: "by_tenant_principal", columns: ["tenantId", "principalId"] },
|
|
2423
|
+
{ kind: "index", name: "by_tenant_group", columns: ["tenantId", "groupId"] },
|
|
2424
|
+
{ kind: "index", name: "by_tenant_audienceKey", columns: ["tenantId", "audienceKey"] },
|
|
2425
|
+
{ kind: "index", name: "by_principal_status", columns: ["principalId", "status"] },
|
|
2426
|
+
{ kind: "index", name: "by_group_status", columns: ["groupId", "status"] }
|
|
2427
|
+
]
|
|
2428
|
+
});
|
|
2429
|
+
var platformAudiences = defineTable({
|
|
2430
|
+
name: "platformAudiences",
|
|
2431
|
+
component: "identity",
|
|
2432
|
+
category: "platform",
|
|
2433
|
+
shape: z.object({
|
|
2434
|
+
"tenantId": z.string(),
|
|
2435
|
+
"workspaceId": z.string().optional(),
|
|
2436
|
+
"audienceKey": z.string(),
|
|
2437
|
+
"audienceLabel": z.string(),
|
|
2438
|
+
"audienceClass": z.enum(["internal", "restricted_external", "public"]),
|
|
2439
|
+
"status": z.enum(["active", "disabled", "archived"]),
|
|
2440
|
+
"description": z.string().optional(),
|
|
2441
|
+
"metadata": z.record(z.any()).optional(),
|
|
2442
|
+
"createdBy": z.string().optional(),
|
|
2443
|
+
"createdAt": z.number(),
|
|
2444
|
+
"updatedAt": z.number()
|
|
2445
|
+
}),
|
|
2446
|
+
indices: [
|
|
2447
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
2448
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
2449
|
+
{ kind: "index", name: "by_tenant_audienceKey", columns: ["tenantId", "audienceKey"] },
|
|
2450
|
+
{ kind: "index", name: "by_tenant_workspace_audienceKey", columns: ["tenantId", "workspaceId", "audienceKey"] },
|
|
2451
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
|
|
2452
|
+
]
|
|
2453
|
+
});
|
|
2454
|
+
var platformPolicyDecisionLogs = defineTable({
|
|
2455
|
+
name: "platformPolicyDecisionLogs",
|
|
2456
|
+
component: "identity",
|
|
2457
|
+
category: "platform",
|
|
2458
|
+
shape: z.object({
|
|
2459
|
+
"principalId": z.string(),
|
|
2460
|
+
"tenantId": z.string().optional(),
|
|
2461
|
+
"workspaceId": z.string().optional(),
|
|
2462
|
+
"topicId": z.string().optional(),
|
|
2463
|
+
"resourceType": z.string(),
|
|
2464
|
+
"resourceId": z.string(),
|
|
2465
|
+
"action": z.enum(["read", "summarize", "export", "mutate", "admin", "comment", "escalate", "resolve", "vote"]),
|
|
2466
|
+
"decision": z.enum(["allow", "deny"]),
|
|
2467
|
+
"reasonCode": z.string(),
|
|
2468
|
+
"policyVersion": z.string(),
|
|
2469
|
+
"policyBundleId": z.string().optional(),
|
|
2470
|
+
"audienceKey": z.string().optional(),
|
|
2471
|
+
"audienceClass": z.enum(["internal", "restricted_external", "public"]).optional(),
|
|
2472
|
+
"audienceMode": z.string().optional(),
|
|
2473
|
+
"traceId": z.string().optional(),
|
|
2474
|
+
"packKey": z.string().optional(),
|
|
2475
|
+
"metadata": z.record(z.any()).optional(),
|
|
2476
|
+
"createdAt": z.number()
|
|
2477
|
+
}),
|
|
2478
|
+
indices: [
|
|
2479
|
+
{ kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
|
|
2480
|
+
{ kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
|
|
2481
|
+
{ kind: "index", name: "by_pack_createdAt", columns: ["packKey", "createdAt"] },
|
|
2482
|
+
{ kind: "index", name: "by_audienceKey_createdAt", columns: ["audienceKey", "createdAt"] },
|
|
2483
|
+
{ kind: "index", name: "by_audienceClass_createdAt", columns: ["audienceClass", "createdAt"] },
|
|
2484
|
+
{ kind: "index", name: "by_decision_createdAt", columns: ["decision", "createdAt"] },
|
|
2485
|
+
{ kind: "index", name: "by_traceId", columns: ["traceId"] },
|
|
2486
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
2487
|
+
{ kind: "index", name: "by_topic_createdAt", columns: ["topicId", "createdAt"] }
|
|
2488
|
+
]
|
|
2489
|
+
});
|
|
2490
|
+
var tenantApiKeys = defineTable({
|
|
2491
|
+
name: "tenantApiKeys",
|
|
2492
|
+
component: "identity",
|
|
2493
|
+
category: "platform",
|
|
2494
|
+
shape: z.object({
|
|
2495
|
+
"tenantId": z.string(),
|
|
2496
|
+
"workspaceId": z.string().optional(),
|
|
2497
|
+
"label": z.string().optional(),
|
|
2498
|
+
"keyPrefix": z.string(),
|
|
2499
|
+
"hashedKey": z.string(),
|
|
2500
|
+
"scopes": z.array(z.string()),
|
|
2501
|
+
"status": z.enum(["active", "revoked", "expired"]),
|
|
2502
|
+
"expiresAt": z.number().optional(),
|
|
2503
|
+
"lastUsedAt": z.number().optional(),
|
|
2504
|
+
"revokedAt": z.number().optional(),
|
|
2505
|
+
"revokedBy": z.string().optional(),
|
|
2506
|
+
"createdBy": z.string(),
|
|
2507
|
+
"createdAt": z.number(),
|
|
2508
|
+
"updatedAt": z.number()
|
|
2509
|
+
}),
|
|
2510
|
+
indices: [
|
|
2511
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
2512
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
2513
|
+
{ kind: "index", name: "by_hashedKey", columns: ["hashedKey"] },
|
|
2514
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
|
|
2515
|
+
]
|
|
2516
|
+
});
|
|
2517
|
+
var tenantConfig = defineTable({
|
|
2518
|
+
name: "tenantConfig",
|
|
2519
|
+
component: "identity",
|
|
2520
|
+
category: "platform",
|
|
2521
|
+
shape: z.object({
|
|
2522
|
+
"tenantId": z.string(),
|
|
2523
|
+
"authPolicyMode": z.enum(["open", "invite_only", "sso_required"]),
|
|
2524
|
+
"defaultSessionTTL": z.number(),
|
|
2525
|
+
"defaultTopicVisibility": z.enum(["private", "tenant", "public"]),
|
|
2526
|
+
"featureFlags": z.record(z.boolean()),
|
|
2527
|
+
"maxWorkspaceCount": z.number(),
|
|
2528
|
+
"defaultModelSlotOverrides": z.record(z.string()),
|
|
2529
|
+
"updatedAt": z.number(),
|
|
2530
|
+
"updatedBy": z.string()
|
|
2531
|
+
}),
|
|
2532
|
+
indices: [
|
|
2533
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] }
|
|
2534
|
+
]
|
|
2535
|
+
});
|
|
2536
|
+
var tenantIntegrations = defineTable({
|
|
2537
|
+
name: "tenantIntegrations",
|
|
2538
|
+
component: "identity",
|
|
2539
|
+
category: "platform",
|
|
2540
|
+
shape: z.object({
|
|
2541
|
+
"tenantId": z.string(),
|
|
2542
|
+
"integrationKey": z.string(),
|
|
2543
|
+
"displayName": z.string(),
|
|
2544
|
+
"description": z.string().optional(),
|
|
2545
|
+
"category": z.enum(["search", "scraper", "llm", "analysis", "custom"]),
|
|
2546
|
+
"capabilities": z.array(z.enum(["search", "deep_research", "scrape", "summarize", "generate"])),
|
|
2547
|
+
"config": z.object({
|
|
2548
|
+
"apiBaseUrl": z.string(),
|
|
2549
|
+
"authType": z.enum(["api_key", "bearer", "basic", "none"]),
|
|
2550
|
+
"authHeaderName": z.string().optional(),
|
|
2551
|
+
"credentialSecretName": z.string().optional(),
|
|
2552
|
+
"defaultParams": z.record(z.any()).optional(),
|
|
2553
|
+
"timeout": z.number().optional(),
|
|
2554
|
+
"customHeaders": z.record(z.any()).optional()
|
|
2555
|
+
}),
|
|
2556
|
+
"endpoints": z.object({
|
|
2557
|
+
"search": z.object({
|
|
2558
|
+
"path": z.string(),
|
|
2559
|
+
"method": z.string().optional(),
|
|
2560
|
+
"queryParamName": z.string().optional(),
|
|
2561
|
+
"resultPath": z.string().optional()
|
|
2562
|
+
}).optional(),
|
|
2563
|
+
"deepResearch": z.object({
|
|
2564
|
+
"path": z.string(),
|
|
2565
|
+
"method": z.string().optional(),
|
|
2566
|
+
"resultPath": z.string().optional(),
|
|
2567
|
+
"async": z.boolean().optional(),
|
|
2568
|
+
"pollPath": z.string().optional(),
|
|
2569
|
+
"pollIntervalMs": z.number().optional()
|
|
2570
|
+
}).optional(),
|
|
2571
|
+
"scrape": z.object({
|
|
2572
|
+
"path": z.string(),
|
|
2573
|
+
"method": z.string().optional(),
|
|
2574
|
+
"resultPath": z.string().optional()
|
|
2575
|
+
}).optional()
|
|
2576
|
+
}).optional(),
|
|
2577
|
+
"status": z.enum(["active", "disabled", "error"]),
|
|
2578
|
+
"lastUsedAt": z.number().optional(),
|
|
2579
|
+
"lastError": z.string().optional(),
|
|
2580
|
+
"usageCount": z.number().optional(),
|
|
2581
|
+
"createdAt": z.number(),
|
|
2582
|
+
"updatedAt": z.number(),
|
|
2583
|
+
"createdBy": z.string().optional()
|
|
2584
|
+
}),
|
|
2585
|
+
indices: [
|
|
2586
|
+
{ kind: "index", name: "by_tenant", columns: ["tenantId"] },
|
|
2587
|
+
{ kind: "index", name: "by_tenant_key", columns: ["tenantId", "integrationKey"] },
|
|
2588
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
|
|
2589
|
+
]
|
|
2590
|
+
});
|
|
2591
|
+
var tenantModelSlotBindings = defineTable({
|
|
2592
|
+
name: "tenantModelSlotBindings",
|
|
2593
|
+
component: "identity",
|
|
2594
|
+
category: "platform",
|
|
2595
|
+
shape: z.object({
|
|
2596
|
+
"bindingId": z.string(),
|
|
2597
|
+
"tenantId": z.string(),
|
|
2598
|
+
"providerId": z.string(),
|
|
2599
|
+
"modelSlotId": z.string(),
|
|
2600
|
+
"secretRef": z.string(),
|
|
2601
|
+
"status": z.enum(["active", "revoked"]),
|
|
2602
|
+
"passThroughOnly": z.boolean(),
|
|
2603
|
+
"revokedAt": z.number().optional(),
|
|
2604
|
+
"revokedBy": z.string().optional(),
|
|
2605
|
+
"metadata": z.record(z.any()).optional(),
|
|
2606
|
+
"createdBy": z.string(),
|
|
2607
|
+
"createdAt": z.number(),
|
|
2608
|
+
"updatedAt": z.number()
|
|
2609
|
+
}),
|
|
2610
|
+
indices: [
|
|
2611
|
+
{ kind: "index", name: "by_bindingId", columns: ["bindingId"] },
|
|
2612
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
2613
|
+
{ kind: "index", name: "by_tenant_slot", columns: ["tenantId", "modelSlotId"] },
|
|
2614
|
+
{ kind: "index", name: "by_tenant_provider_slot", columns: ["tenantId", "providerId", "modelSlotId"] },
|
|
2615
|
+
{ kind: "index", name: "by_secretRef", columns: ["secretRef"] },
|
|
2616
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
2617
|
+
]
|
|
2618
|
+
});
|
|
2619
|
+
var tenantPolicies = defineTable({
|
|
2620
|
+
name: "tenantPolicies",
|
|
2621
|
+
component: "identity",
|
|
2622
|
+
category: "platform",
|
|
2623
|
+
shape: z.object({
|
|
2624
|
+
"tenantId": z.string(),
|
|
2625
|
+
"workspaceId": z.string().optional(),
|
|
2626
|
+
"roleName": z.string(),
|
|
2627
|
+
"description": z.string().optional(),
|
|
2628
|
+
"permissions": z.array(z.object({
|
|
2629
|
+
"resource": z.string(),
|
|
2630
|
+
"actions": z.array(z.string())
|
|
2631
|
+
})),
|
|
2632
|
+
"groupBindings": z.array(z.string()),
|
|
2633
|
+
"createdAt": z.number(),
|
|
2634
|
+
"updatedAt": z.number(),
|
|
2635
|
+
"createdBy": z.string(),
|
|
2636
|
+
"updatedBy": z.string().optional()
|
|
2637
|
+
}),
|
|
2638
|
+
indices: [
|
|
2639
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
2640
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
2641
|
+
{ kind: "index", name: "by_tenant_roleName", columns: ["tenantId", "roleName"] }
|
|
2642
|
+
]
|
|
2643
|
+
});
|
|
2644
|
+
var tenantProviderSecrets = defineTable({
|
|
2645
|
+
name: "tenantProviderSecrets",
|
|
2646
|
+
component: "identity",
|
|
2647
|
+
category: "platform",
|
|
2648
|
+
shape: z.object({
|
|
2649
|
+
"secretRef": z.string(),
|
|
2650
|
+
"tenantId": z.string(),
|
|
2651
|
+
"providerId": z.string(),
|
|
2652
|
+
"label": z.string().optional(),
|
|
2653
|
+
"encryptedSecret": z.string(),
|
|
2654
|
+
"encryptionVersion": z.string(),
|
|
2655
|
+
"secretFingerprint": z.string(),
|
|
2656
|
+
"keyHint": z.string(),
|
|
2657
|
+
"status": z.enum(["active", "rotated", "revoked"]),
|
|
2658
|
+
"rotatedFromSecretRef": z.string().optional(),
|
|
2659
|
+
"revokedAt": z.number().optional(),
|
|
2660
|
+
"revokedBy": z.string().optional(),
|
|
2661
|
+
"lastUsedAt": z.number().optional(),
|
|
2662
|
+
"metadata": z.record(z.any()).optional(),
|
|
2663
|
+
"createdBy": z.string(),
|
|
2664
|
+
"createdAt": z.number(),
|
|
2665
|
+
"updatedAt": z.number()
|
|
2666
|
+
}),
|
|
2667
|
+
indices: [
|
|
2668
|
+
{ kind: "index", name: "by_secretRef", columns: ["secretRef"] },
|
|
2669
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
2670
|
+
{ kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId"] },
|
|
2671
|
+
{ kind: "index", name: "by_tenant_provider_status", columns: ["tenantId", "providerId", "status"] },
|
|
2672
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
2673
|
+
]
|
|
2674
|
+
});
|
|
2675
|
+
var tenantProxyGatewayUsage = defineTable({
|
|
2676
|
+
name: "tenantProxyGatewayUsage",
|
|
2677
|
+
component: "identity",
|
|
2678
|
+
category: "platform",
|
|
2679
|
+
shape: z.object({
|
|
2680
|
+
"usageId": z.string(),
|
|
2681
|
+
"tenantId": z.string(),
|
|
2682
|
+
"providerId": z.string(),
|
|
2683
|
+
"modelSlotId": z.string(),
|
|
2684
|
+
"secretRef": z.string(),
|
|
2685
|
+
"proxyTokenId": z.string(),
|
|
2686
|
+
"sessionId": z.string(),
|
|
2687
|
+
"principalId": z.string(),
|
|
2688
|
+
"workspaceId": z.string().optional(),
|
|
2689
|
+
"modelId": z.string().optional(),
|
|
2690
|
+
"requestPath": z.string(),
|
|
2691
|
+
"status": z.enum(["success", "error"]),
|
|
2692
|
+
"responseStatus": z.number().optional(),
|
|
2693
|
+
"inputTokens": z.number().optional(),
|
|
2694
|
+
"outputTokens": z.number().optional(),
|
|
2695
|
+
"tokenCount": z.number().optional(),
|
|
2696
|
+
"latencyMs": z.number(),
|
|
2697
|
+
"estimatedCostUsd": z.number().optional(),
|
|
2698
|
+
"failureCode": z.string().optional(),
|
|
2699
|
+
"metadata": z.record(z.any()).optional(),
|
|
2700
|
+
"createdAt": z.number(),
|
|
2701
|
+
"updatedAt": z.number()
|
|
2702
|
+
}),
|
|
2703
|
+
indices: [
|
|
2704
|
+
{ kind: "index", name: "by_usageId", columns: ["usageId"] },
|
|
2705
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
|
|
2706
|
+
{ kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId", "createdAt"] },
|
|
2707
|
+
{ kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId", "createdAt"] }
|
|
2708
|
+
]
|
|
2709
|
+
});
|
|
2710
|
+
var tenantProxyTokenMints = defineTable({
|
|
2711
|
+
name: "tenantProxyTokenMints",
|
|
2712
|
+
component: "identity",
|
|
2713
|
+
category: "platform",
|
|
2714
|
+
shape: z.object({
|
|
2715
|
+
"proxyTokenId": z.string(),
|
|
2716
|
+
"tenantId": z.string(),
|
|
2717
|
+
"providerId": z.string(),
|
|
2718
|
+
"modelSlotId": z.string(),
|
|
2719
|
+
"sessionId": z.string(),
|
|
2720
|
+
"principalId": z.string(),
|
|
2721
|
+
"workspaceId": z.string().optional(),
|
|
2722
|
+
"secretRef": z.string(),
|
|
2723
|
+
"expiresAt": z.number(),
|
|
2724
|
+
"metadata": z.record(z.any()).optional(),
|
|
2725
|
+
"createdAt": z.number()
|
|
2726
|
+
}),
|
|
2727
|
+
indices: [
|
|
2728
|
+
{ kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId"] },
|
|
2729
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
|
|
2730
|
+
{ kind: "index", name: "by_sessionId", columns: ["sessionId", "createdAt"] }
|
|
2731
|
+
]
|
|
2732
|
+
});
|
|
2733
|
+
var tenantSandboxAuditEvents = defineTable({
|
|
2734
|
+
name: "tenantSandboxAuditEvents",
|
|
2735
|
+
component: "identity",
|
|
2736
|
+
category: "platform",
|
|
2737
|
+
shape: z.object({
|
|
2738
|
+
"eventId": z.string(),
|
|
2739
|
+
"tenantId": z.string(),
|
|
2740
|
+
"actorClerkId": z.string(),
|
|
2741
|
+
"action": z.enum(["sandbox_created", "sandbox_secret_injected", "sandbox_execution_started", "sandbox_execution_completed", "sandbox_limit_violated"]),
|
|
2742
|
+
"executionId": z.string(),
|
|
2743
|
+
"sessionId": z.string().optional(),
|
|
2744
|
+
"principalId": z.string().optional(),
|
|
2745
|
+
"workspaceId": z.string().optional(),
|
|
2746
|
+
"providerId": z.string().optional(),
|
|
2747
|
+
"secretRef": z.string().optional(),
|
|
2748
|
+
"toolCallId": z.string().optional(),
|
|
2749
|
+
"correlationId": z.string().optional(),
|
|
2750
|
+
"sandboxDir": z.string().optional(),
|
|
2751
|
+
"timeoutMs": z.number().optional(),
|
|
2752
|
+
"memoryLimitMb": z.number().optional(),
|
|
2753
|
+
"allowedOrigins": z.array(z.string()).optional(),
|
|
2754
|
+
"limitName": z.string().optional(),
|
|
2755
|
+
"outcome": z.string().optional(),
|
|
2756
|
+
"responseStatus": z.number().optional(),
|
|
2757
|
+
"durationMs": z.number().optional(),
|
|
2758
|
+
"metadata": z.record(z.any()).optional(),
|
|
2759
|
+
"createdAt": z.number()
|
|
2760
|
+
}),
|
|
2761
|
+
indices: [
|
|
2762
|
+
{ kind: "index", name: "by_eventId", columns: ["eventId"] },
|
|
2763
|
+
{ kind: "index", name: "by_executionId", columns: ["executionId", "createdAt"] },
|
|
2764
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] }
|
|
2765
|
+
]
|
|
2766
|
+
});
|
|
2767
|
+
var tenantSecrets = defineTable({
|
|
2768
|
+
name: "tenantSecrets",
|
|
2769
|
+
component: "identity",
|
|
2770
|
+
category: "platform",
|
|
2771
|
+
shape: z.object({
|
|
2772
|
+
"tenantId": z.string(),
|
|
2773
|
+
"workspaceId": z.string().optional(),
|
|
2774
|
+
"name": z.string(),
|
|
2775
|
+
"description": z.string().optional(),
|
|
2776
|
+
"encryptedValue": z.string(),
|
|
2777
|
+
"lastRotated": z.number(),
|
|
2778
|
+
"createdBy": z.string(),
|
|
2779
|
+
"updatedBy": z.string().optional(),
|
|
2780
|
+
"createdAt": z.number(),
|
|
2781
|
+
"updatedAt": z.number()
|
|
2782
|
+
}),
|
|
2783
|
+
indices: [
|
|
2784
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
2785
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
2786
|
+
{ kind: "index", name: "by_tenant_name", columns: ["tenantId", "name"] }
|
|
2787
|
+
]
|
|
2788
|
+
});
|
|
2789
|
+
var toolAcls = defineTable({
|
|
2790
|
+
name: "toolAcls",
|
|
2791
|
+
component: "identity",
|
|
2792
|
+
category: "platform",
|
|
2793
|
+
shape: z.object({
|
|
2794
|
+
"role": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]),
|
|
2795
|
+
"toolName": z.string(),
|
|
2796
|
+
"createdBy": z.string().optional(),
|
|
2797
|
+
"createdAt": z.number().optional()
|
|
2798
|
+
}),
|
|
2799
|
+
indices: [
|
|
2800
|
+
{ kind: "index", name: "by_role", columns: ["role"] },
|
|
2801
|
+
{ kind: "index", name: "by_toolName", columns: ["toolName"] }
|
|
2802
|
+
]
|
|
2803
|
+
});
|
|
2804
|
+
var toolRegistry = defineTable({
|
|
2805
|
+
name: "toolRegistry",
|
|
2806
|
+
component: "identity",
|
|
2807
|
+
category: "platform",
|
|
2808
|
+
shape: z.object({
|
|
2809
|
+
"toolName": z.string(),
|
|
2810
|
+
"description": z.string().optional(),
|
|
2811
|
+
"version": z.string().optional(),
|
|
2812
|
+
"status": z.enum(["active", "deprecated", "disabled"]),
|
|
2813
|
+
"requiredRole": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]).optional(),
|
|
2814
|
+
"requiredAction": z.enum(["read", "mutate", "admin", "summarize", "export", "create", "delete", "grant", "revoke"]).optional(),
|
|
2815
|
+
"surfaces": z.array(z.enum(["mcp", "chat", "voice", "sprint", "api", "sdk", "cli"])).optional(),
|
|
2816
|
+
"approvalGateId": z.string().optional(),
|
|
2817
|
+
"category": z.enum(["read", "write", "admin", "system"]).optional(),
|
|
2818
|
+
"parameterSchema": z.record(z.any()).optional(),
|
|
2819
|
+
"handlerRef": z.string().optional(),
|
|
2820
|
+
"returnSchema": z.record(z.any()).optional(),
|
|
2821
|
+
"executionAdapter": z.enum(["convex_mutation", "convex_action", "http_callback", "mcp_tool", "sdk_invocation", "external_observed"]).optional(),
|
|
2822
|
+
"safetyMetadata": z.object({
|
|
2823
|
+
"readOnly": z.boolean(),
|
|
2824
|
+
"idempotent": z.boolean(),
|
|
2825
|
+
"sideEffectLevel": z.enum(["none", "low", "high"])
|
|
2826
|
+
}).optional(),
|
|
2827
|
+
"packKey": z.string().optional(),
|
|
2828
|
+
"packVersion": z.string().optional(),
|
|
2829
|
+
"isCore": z.boolean(),
|
|
2830
|
+
"mcVersion": z.string().optional(),
|
|
2831
|
+
"registeredBy": z.string().optional(),
|
|
2832
|
+
"registeredAt": z.number().optional()
|
|
2833
|
+
}),
|
|
2834
|
+
indices: [
|
|
2835
|
+
{ kind: "index", name: "by_toolName", columns: ["toolName"] },
|
|
2836
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
2837
|
+
{ kind: "index", name: "by_isCore", columns: ["isCore"] },
|
|
2838
|
+
{ kind: "index", name: "by_packKey", columns: ["packKey"] }
|
|
2839
|
+
]
|
|
2840
|
+
});
|
|
2841
|
+
var methodologyPacks = defineTable({
|
|
2842
|
+
name: "methodologyPacks",
|
|
2843
|
+
component: "mc",
|
|
2844
|
+
category: "methodology",
|
|
2845
|
+
shape: z.object({
|
|
2846
|
+
"packId": z.string(),
|
|
2847
|
+
"name": z.string(),
|
|
2848
|
+
"description": z.string(),
|
|
2849
|
+
"version": z.string(),
|
|
2850
|
+
"enforcementLevel": z.enum(["strict", "guided", "advisory"]),
|
|
2851
|
+
"phases": z.array(z.object({
|
|
2852
|
+
"name": z.string(),
|
|
2853
|
+
"title": z.string(),
|
|
2854
|
+
"description": z.string(),
|
|
2855
|
+
"requiredTools": z.array(z.string()),
|
|
2856
|
+
"gate": z.string().optional(),
|
|
2857
|
+
"instructions": z.string()
|
|
2858
|
+
})),
|
|
2859
|
+
"principles": z.array(z.string()),
|
|
2860
|
+
"status": z.enum(["active", "draft", "archived"]),
|
|
2861
|
+
"createdAt": z.number(),
|
|
2862
|
+
"updatedAt": z.number()
|
|
2863
|
+
}),
|
|
2864
|
+
indices: [
|
|
2865
|
+
{ kind: "index", name: "by_packId", columns: ["packId"] },
|
|
2866
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
2867
|
+
]
|
|
2868
|
+
});
|
|
2869
|
+
var tenantMethodologyAssignments = defineTable({
|
|
2870
|
+
name: "tenantMethodologyAssignments",
|
|
2871
|
+
component: "mc",
|
|
2872
|
+
category: "methodology",
|
|
2873
|
+
shape: z.object({
|
|
2874
|
+
"tenantId": idOf("tenants"),
|
|
2875
|
+
"methodologyPackId": idOf("methodologyPacks"),
|
|
2876
|
+
"isDefault": z.boolean(),
|
|
2877
|
+
"assignedAt": z.number(),
|
|
2878
|
+
"assignedBy": z.string()
|
|
2879
|
+
}),
|
|
2880
|
+
indices: [
|
|
2881
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
2882
|
+
{ kind: "index", name: "by_methodologyPackId", columns: ["methodologyPackId"] }
|
|
2883
|
+
]
|
|
2884
|
+
});
|
|
2885
|
+
var modelCallLogs = defineTable({
|
|
2886
|
+
name: "modelCallLogs",
|
|
2887
|
+
component: "identity",
|
|
2888
|
+
category: "model",
|
|
2889
|
+
shape: z.object({
|
|
2890
|
+
"slot": z.string(),
|
|
2891
|
+
"modelKey": z.string(),
|
|
2892
|
+
"provider": z.string(),
|
|
2893
|
+
"inputTokens": z.number().optional(),
|
|
2894
|
+
"outputTokens": z.number().optional(),
|
|
2895
|
+
"durationMs": z.number().optional(),
|
|
2896
|
+
"cost": z.number().optional(),
|
|
2897
|
+
"success": z.boolean(),
|
|
2898
|
+
"error": z.string().optional(),
|
|
2899
|
+
"userId": z.string().optional(),
|
|
2900
|
+
"sessionId": z.string().optional(),
|
|
2901
|
+
"traceId": z.string().optional(),
|
|
2902
|
+
"timestamp": z.number()
|
|
2903
|
+
}),
|
|
2904
|
+
indices: [
|
|
2905
|
+
{ kind: "index", name: "by_slot", columns: ["slot"] },
|
|
2906
|
+
{ kind: "index", name: "by_model", columns: ["modelKey"] },
|
|
2907
|
+
{ kind: "index", name: "by_timestamp", columns: ["timestamp"] },
|
|
2908
|
+
{ kind: "index", name: "by_user", columns: ["userId"] }
|
|
2909
|
+
]
|
|
2910
|
+
});
|
|
2911
|
+
var modelFunctionSlots = defineTable({
|
|
2912
|
+
name: "modelFunctionSlots",
|
|
2913
|
+
component: "identity",
|
|
2914
|
+
category: "model",
|
|
2915
|
+
shape: z.object({
|
|
2916
|
+
"slot": z.string(),
|
|
2917
|
+
"category": z.string(),
|
|
2918
|
+
"description": z.string(),
|
|
2919
|
+
"modelKey": z.string(),
|
|
2920
|
+
"promptName": z.string().optional(),
|
|
2921
|
+
"temperature": z.number().optional(),
|
|
2922
|
+
"maxTokens": z.number().optional(),
|
|
2923
|
+
"requiredCapabilities": z.array(z.string()).optional(),
|
|
2924
|
+
"enabled": z.boolean(),
|
|
2925
|
+
"isDefault": z.boolean(),
|
|
2926
|
+
"notes": z.string().optional(),
|
|
2927
|
+
"createdAt": z.number(),
|
|
2928
|
+
"updatedAt": z.number()
|
|
2929
|
+
}),
|
|
2930
|
+
indices: [
|
|
2931
|
+
{ kind: "index", name: "by_slot", columns: ["slot"] },
|
|
2932
|
+
{ kind: "index", name: "by_category", columns: ["category"] },
|
|
2933
|
+
{ kind: "index", name: "by_enabled", columns: ["enabled"] }
|
|
2934
|
+
]
|
|
2935
|
+
});
|
|
2936
|
+
var modelRegistry = defineTable({
|
|
2937
|
+
name: "modelRegistry",
|
|
2938
|
+
component: "identity",
|
|
2939
|
+
category: "model",
|
|
2940
|
+
shape: z.object({
|
|
2941
|
+
"key": z.string(),
|
|
2942
|
+
"name": z.string(),
|
|
2943
|
+
"modelId": z.string(),
|
|
2944
|
+
"provider": z.string(),
|
|
2945
|
+
"capabilities": z.array(z.string()),
|
|
2946
|
+
"contextWindow": z.number(),
|
|
2947
|
+
"maxOutputTokens": z.number(),
|
|
2948
|
+
"defaultTemperature": z.number(),
|
|
2949
|
+
"inputCostPer1M": z.number(),
|
|
2950
|
+
"outputCostPer1M": z.number(),
|
|
2951
|
+
"recommended": z.boolean(),
|
|
2952
|
+
"enabled": z.boolean(),
|
|
2953
|
+
"notes": z.string().optional(),
|
|
2954
|
+
"createdAt": z.number(),
|
|
2955
|
+
"updatedAt": z.number()
|
|
2956
|
+
}),
|
|
2957
|
+
indices: [
|
|
2958
|
+
{ kind: "index", name: "by_key", columns: ["key"] },
|
|
2959
|
+
{ kind: "index", name: "by_provider", columns: ["provider"] },
|
|
2960
|
+
{ kind: "index", name: "by_enabled", columns: ["enabled"] }
|
|
2961
|
+
]
|
|
2962
|
+
});
|
|
2963
|
+
var modelSlotConfigs = defineTable({
|
|
2964
|
+
name: "modelSlotConfigs",
|
|
2965
|
+
component: "identity",
|
|
2966
|
+
category: "model",
|
|
2967
|
+
shape: z.object({
|
|
2968
|
+
"slot": z.string(),
|
|
2969
|
+
"modelKey": z.string(),
|
|
2970
|
+
"temperature": z.number().optional(),
|
|
2971
|
+
"maxTokens": z.number().optional(),
|
|
2972
|
+
"enabled": z.boolean(),
|
|
2973
|
+
"notes": z.string().optional(),
|
|
2974
|
+
"createdAt": z.number(),
|
|
2975
|
+
"updatedAt": z.number()
|
|
2976
|
+
}),
|
|
2977
|
+
indices: [
|
|
2978
|
+
{ kind: "index", name: "by_slot", columns: ["slot"] }
|
|
2979
|
+
]
|
|
2980
|
+
});
|
|
2981
|
+
var ontologyDefinitions = defineTable({
|
|
2982
|
+
name: "ontologyDefinitions",
|
|
2983
|
+
component: "kernel",
|
|
2984
|
+
category: "ontology",
|
|
2985
|
+
shape: z.object({
|
|
2986
|
+
"ontologyKey": z.string(),
|
|
2987
|
+
"name": z.string(),
|
|
2988
|
+
"description": z.string().optional(),
|
|
2989
|
+
"tenantId": z.string().optional(),
|
|
2990
|
+
"tier": z.enum(["platform", "pack", "tenant"]),
|
|
2991
|
+
"parentOntologyId": idOf("ontologyDefinitions").optional(),
|
|
2992
|
+
"status": z.enum(["draft", "active", "deprecated", "archived"]),
|
|
2993
|
+
"createdBy": z.string(),
|
|
2994
|
+
"createdAt": z.number(),
|
|
2995
|
+
"updatedAt": z.number()
|
|
2996
|
+
}),
|
|
2997
|
+
indices: [
|
|
2998
|
+
{ kind: "index", name: "by_ontologyKey", columns: ["ontologyKey"] },
|
|
2999
|
+
{ kind: "index", name: "by_tenant_ontologyKey", columns: ["tenantId", "ontologyKey"] },
|
|
3000
|
+
{ kind: "index", name: "by_tier", columns: ["tier"] },
|
|
3001
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
3002
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
|
|
3003
|
+
{ kind: "index", name: "by_parentOntologyId", columns: ["parentOntologyId"] }
|
|
3004
|
+
]
|
|
3005
|
+
});
|
|
3006
|
+
var ontologyVersions = defineTable({
|
|
3007
|
+
name: "ontologyVersions",
|
|
3008
|
+
component: "kernel",
|
|
3009
|
+
category: "ontology",
|
|
3010
|
+
shape: z.object({
|
|
3011
|
+
"ontologyId": idOf("ontologyDefinitions"),
|
|
3012
|
+
"ontologyKey": z.string(),
|
|
3013
|
+
"version": z.string(),
|
|
3014
|
+
"status": z.enum(["draft", "published", "deprecated"]),
|
|
3015
|
+
"entityTypes": z.array(z.object({
|
|
3016
|
+
"value": z.string(),
|
|
3017
|
+
"label": z.string(),
|
|
3018
|
+
"description": z.string().optional(),
|
|
3019
|
+
"schema": z.any().optional(),
|
|
3020
|
+
"subtypes": z.array(z.object({
|
|
3021
|
+
"value": z.string(),
|
|
3022
|
+
"label": z.string(),
|
|
3023
|
+
"description": z.string().optional()
|
|
3024
|
+
})).optional()
|
|
3025
|
+
})),
|
|
3026
|
+
"edgeTypes": z.array(z.object({
|
|
3027
|
+
"value": z.string(),
|
|
3028
|
+
"label": z.string(),
|
|
3029
|
+
"description": z.string().optional(),
|
|
3030
|
+
"sourceTypes": z.array(z.string()).optional(),
|
|
3031
|
+
"targetTypes": z.array(z.string()).optional(),
|
|
3032
|
+
"constraintSeverity": z.enum(["warn", "info"]).optional()
|
|
3033
|
+
})),
|
|
3034
|
+
"releaseNotes": z.string().optional(),
|
|
3035
|
+
"publishedBy": z.string().optional(),
|
|
3036
|
+
"publishedAt": z.number().optional(),
|
|
3037
|
+
"createdAt": z.number()
|
|
3038
|
+
}),
|
|
3039
|
+
indices: [
|
|
3040
|
+
{ kind: "index", name: "by_ontologyId", columns: ["ontologyId"] },
|
|
3041
|
+
{ kind: "index", name: "by_ontologyKey", columns: ["ontologyKey"] },
|
|
3042
|
+
{ kind: "index", name: "by_ontologyKey_version", columns: ["ontologyKey", "version"] },
|
|
3043
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
3044
|
+
{ kind: "index", name: "by_publishedAt", columns: ["publishedAt"] }
|
|
3045
|
+
]
|
|
3046
|
+
});
|
|
3047
|
+
var packAssignments = defineTable({
|
|
3048
|
+
name: "packAssignments",
|
|
3049
|
+
component: "mc",
|
|
3050
|
+
category: "pack",
|
|
3051
|
+
shape: z.object({
|
|
3052
|
+
"groupId": idOf("groups"),
|
|
3053
|
+
"packKey": z.string(),
|
|
3054
|
+
"tenantId": idOf("tenants"),
|
|
3055
|
+
"status": z.enum(["active", "revoked"]),
|
|
3056
|
+
"assignedBy": z.string(),
|
|
3057
|
+
"createdAt": z.number(),
|
|
3058
|
+
"updatedAt": z.number()
|
|
3059
|
+
}),
|
|
3060
|
+
indices: [
|
|
3061
|
+
{ kind: "index", name: "by_groupId", columns: ["groupId"] },
|
|
3062
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
3063
|
+
{ kind: "index", name: "by_tenant_packKey", columns: ["tenantId", "packKey"] },
|
|
3064
|
+
{ kind: "index", name: "by_group_packKey", columns: ["groupId", "packKey"] },
|
|
3065
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
3066
|
+
]
|
|
3067
|
+
});
|
|
3068
|
+
var packDefinitions = defineTable({
|
|
3069
|
+
name: "packDefinitions",
|
|
3070
|
+
component: "mc",
|
|
3071
|
+
category: "pack",
|
|
3072
|
+
shape: z.object({
|
|
3073
|
+
"packKey": z.string(),
|
|
3074
|
+
"name": z.string(),
|
|
3075
|
+
"description": z.string().optional(),
|
|
3076
|
+
"category": z.enum(["developer", "strategy", "data", "methodology", "ontology", "custom"]),
|
|
3077
|
+
"lifecycle": z.enum(["active", "beta", "experimental"]),
|
|
3078
|
+
"tierRequirement": z.enum(["free", "developer", "team", "enterprise"]),
|
|
3079
|
+
"installScope": z.enum(["tenant", "workspace"]).optional(),
|
|
3080
|
+
"toolNames": z.array(z.string()),
|
|
3081
|
+
"promptNames": z.array(z.string()).optional(),
|
|
3082
|
+
"agentKeys": z.array(z.string()).optional(),
|
|
3083
|
+
"methodologyPackIds": z.array(z.string()).optional(),
|
|
3084
|
+
"ontologyConfig": z.object({
|
|
3085
|
+
"ontologyKey": z.string(),
|
|
3086
|
+
"ontologyVersion": z.string().optional(),
|
|
3087
|
+
"topicBindings": z.array(z.object({
|
|
3088
|
+
"topicType": z.string(),
|
|
3089
|
+
"autoBindNewTopics": z.boolean()
|
|
3090
|
+
})).optional()
|
|
3091
|
+
}).optional(),
|
|
3092
|
+
"lensConfig": z.array(z.object({
|
|
3093
|
+
"lensKey": z.string(),
|
|
3094
|
+
"perspectiveType": z.string()
|
|
3095
|
+
})).optional(),
|
|
3096
|
+
"configTemplates": z.record(z.any()).optional(),
|
|
3097
|
+
"topicIds": z.array(z.string()).optional(),
|
|
3098
|
+
"status": z.enum(["draft", "active", "archived"]),
|
|
3099
|
+
"createdBy": z.string(),
|
|
3100
|
+
"createdAt": z.number(),
|
|
3101
|
+
"updatedAt": z.number()
|
|
3102
|
+
}),
|
|
3103
|
+
indices: [
|
|
3104
|
+
{ kind: "index", name: "by_packKey", columns: ["packKey"] },
|
|
3105
|
+
{ kind: "index", name: "by_category", columns: ["category"] },
|
|
3106
|
+
{ kind: "index", name: "by_lifecycle", columns: ["lifecycle"] },
|
|
3107
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
3108
|
+
{ kind: "index", name: "by_tierRequirement", columns: ["tierRequirement"] }
|
|
3109
|
+
]
|
|
3110
|
+
});
|
|
3111
|
+
var packEntitlements = defineTable({
|
|
3112
|
+
name: "packEntitlements",
|
|
3113
|
+
component: "mc",
|
|
3114
|
+
category: "pack",
|
|
3115
|
+
shape: z.object({
|
|
3116
|
+
"tenantId": idOf("tenants"),
|
|
3117
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
3118
|
+
"packKey": z.string(),
|
|
3119
|
+
"status": z.enum(["active", "disabled", "revoked"]),
|
|
3120
|
+
"allowedLifecycles": z.array(z.enum(["active", "beta", "experimental"])).optional(),
|
|
3121
|
+
"minVersion": z.string().optional(),
|
|
3122
|
+
"maxVersion": z.string().optional(),
|
|
3123
|
+
"metadata": z.record(z.any()).optional(),
|
|
3124
|
+
"grantedBy": z.string().optional(),
|
|
3125
|
+
"createdAt": z.number(),
|
|
3126
|
+
"updatedAt": z.number()
|
|
3127
|
+
}),
|
|
3128
|
+
indices: [
|
|
3129
|
+
{ kind: "index", name: "by_packKey", columns: ["packKey"] },
|
|
3130
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
3131
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
3132
|
+
{ kind: "index", name: "by_tenant_packKey", columns: ["tenantId", "packKey"] },
|
|
3133
|
+
{ kind: "index", name: "by_tenant_workspace_packKey", columns: ["tenantId", "workspaceId", "packKey"] },
|
|
3134
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
|
|
3135
|
+
{ kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] }
|
|
3136
|
+
]
|
|
3137
|
+
});
|
|
3138
|
+
var packGroupAssignments = defineTable({
|
|
3139
|
+
name: "packGroupAssignments",
|
|
3140
|
+
component: "mc",
|
|
3141
|
+
category: "pack",
|
|
3142
|
+
shape: z.object({
|
|
3143
|
+
"groupId": idOf("groups"),
|
|
3144
|
+
"tenantId": idOf("tenants"),
|
|
3145
|
+
"packKey": z.string(),
|
|
3146
|
+
"packVersion": z.string().optional(),
|
|
3147
|
+
"status": z.enum(["active", "disabled"]),
|
|
3148
|
+
"assignedBy": z.string(),
|
|
3149
|
+
"createdAt": z.number(),
|
|
3150
|
+
"updatedAt": z.number()
|
|
3151
|
+
}),
|
|
3152
|
+
indices: [
|
|
3153
|
+
{ kind: "index", name: "by_groupId", columns: ["groupId"] },
|
|
3154
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
3155
|
+
{ kind: "index", name: "by_tenant_packKey", columns: ["tenantId", "packKey"] },
|
|
3156
|
+
{ kind: "index", name: "by_group_packKey", columns: ["groupId", "packKey"] }
|
|
3157
|
+
]
|
|
3158
|
+
});
|
|
3159
|
+
var packInstallations = defineTable({
|
|
3160
|
+
name: "packInstallations",
|
|
3161
|
+
component: "mc",
|
|
3162
|
+
category: "pack",
|
|
3163
|
+
shape: z.object({
|
|
3164
|
+
"tenantId": idOf("tenants"),
|
|
3165
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
3166
|
+
"installScope": z.enum(["tenant", "workspace"]).optional(),
|
|
3167
|
+
"packKey": z.string(),
|
|
3168
|
+
"packVersion": z.string(),
|
|
3169
|
+
"candidateVersion": z.string().optional(),
|
|
3170
|
+
"versionWindowState": z.enum(["none", "prepared", "canary", "committed", "rolled_back"]).optional(),
|
|
3171
|
+
"upgradeStartedAt": z.number().optional(),
|
|
3172
|
+
"upgradeCompletedAt": z.number().optional(),
|
|
3173
|
+
"runtimeState": z.enum(["registered", "validated", "installed", "enabled", "degraded", "disabled", "removed"]),
|
|
3174
|
+
"healthStatus": z.enum(["unknown", "healthy", "degraded", "failing"]),
|
|
3175
|
+
"installStatus": z.enum(["installing", "installed", "partial_failure", "uninstalling"]).optional(),
|
|
3176
|
+
"componentStatus": z.record(z.any()).optional(),
|
|
3177
|
+
"lastError": z.string().optional(),
|
|
3178
|
+
"installedBy": z.string().optional(),
|
|
3179
|
+
"enabledBy": z.string().optional(),
|
|
3180
|
+
"disabledBy": z.string().optional(),
|
|
3181
|
+
"lastHealthCheckAt": z.number().optional(),
|
|
3182
|
+
"metadata": z.record(z.any()).optional(),
|
|
3183
|
+
"createdAt": z.number(),
|
|
3184
|
+
"updatedAt": z.number()
|
|
3185
|
+
}),
|
|
3186
|
+
indices: [
|
|
3187
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
3188
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
3189
|
+
{ kind: "index", name: "by_packKey", columns: ["packKey"] },
|
|
3190
|
+
{ kind: "index", name: "by_packKey_version", columns: ["packKey", "packVersion"] },
|
|
3191
|
+
{ kind: "index", name: "by_tenant_packKey", columns: ["tenantId", "packKey"] },
|
|
3192
|
+
{ kind: "index", name: "by_tenant_workspace_packKey", columns: ["tenantId", "workspaceId", "packKey"] },
|
|
3193
|
+
{ kind: "index", name: "by_tenant_runtimeState", columns: ["tenantId", "runtimeState"] },
|
|
3194
|
+
{ kind: "index", name: "by_workspace_runtimeState", columns: ["workspaceId", "runtimeState"] },
|
|
3195
|
+
{ kind: "index", name: "by_tenant_healthStatus", columns: ["tenantId", "healthStatus"] },
|
|
3196
|
+
{ kind: "index", name: "by_workspace_healthStatus", columns: ["workspaceId", "healthStatus"] }
|
|
3197
|
+
]
|
|
3198
|
+
});
|
|
3199
|
+
var packVersions = defineTable({
|
|
3200
|
+
name: "packVersions",
|
|
3201
|
+
component: "mc",
|
|
3202
|
+
category: "pack",
|
|
3203
|
+
shape: z.object({
|
|
3204
|
+
"packKey": z.string(),
|
|
3205
|
+
"version": z.string(),
|
|
3206
|
+
"status": z.enum(["draft", "published", "deprecated"]),
|
|
3207
|
+
"toolManifest": z.array(z.object({
|
|
3208
|
+
"toolName": z.string(),
|
|
3209
|
+
"toolVersion": z.string(),
|
|
3210
|
+
"description": z.string().optional(),
|
|
3211
|
+
"category": z.enum(["read", "write", "admin", "system"]).optional(),
|
|
3212
|
+
"requiredRole": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]).optional(),
|
|
3213
|
+
"requiredAction": z.enum(["read", "mutate", "admin", "summarize", "export", "create", "delete", "grant", "revoke"]).optional(),
|
|
3214
|
+
"surfaces": z.array(z.enum(["mcp", "chat", "voice", "sprint", "api", "sdk", "cli"])).optional(),
|
|
3215
|
+
"handlerRef": z.string().optional(),
|
|
3216
|
+
"parameterSchema": z.record(z.any()).optional(),
|
|
3217
|
+
"returnSchema": z.record(z.any()).optional(),
|
|
3218
|
+
"executionAdapter": z.enum(["convex_mutation", "convex_action", "http_callback", "mcp_tool", "sdk_invocation", "external_observed"]).optional(),
|
|
3219
|
+
"safetyMetadata": z.object({
|
|
3220
|
+
"readOnly": z.boolean(),
|
|
3221
|
+
"idempotent": z.boolean(),
|
|
3222
|
+
"sideEffectLevel": z.enum(["none", "low", "high"])
|
|
3223
|
+
}).optional()
|
|
3224
|
+
})),
|
|
3225
|
+
"promptManifest": z.array(z.string()).optional(),
|
|
3226
|
+
"agentManifest": z.array(z.string()).optional(),
|
|
3227
|
+
"methodologyManifest": z.array(z.string()).optional(),
|
|
3228
|
+
"ontologySnapshot": z.object({
|
|
3229
|
+
"ontologyKey": z.string(),
|
|
3230
|
+
"version": z.string(),
|
|
3231
|
+
"entityTypes": z.array(z.object({
|
|
3232
|
+
"value": z.string(),
|
|
3233
|
+
"label": z.string(),
|
|
3234
|
+
"description": z.string().optional(),
|
|
3235
|
+
"schema": z.any().optional(),
|
|
3236
|
+
"subtypes": z.array(z.object({
|
|
3237
|
+
"value": z.string(),
|
|
3238
|
+
"label": z.string(),
|
|
3239
|
+
"description": z.string().optional()
|
|
3240
|
+
})).optional()
|
|
3241
|
+
})),
|
|
3242
|
+
"edgeTypes": z.array(z.object({
|
|
3243
|
+
"value": z.string(),
|
|
3244
|
+
"label": z.string(),
|
|
3245
|
+
"description": z.string().optional(),
|
|
3246
|
+
"sourceTypes": z.array(z.string()).optional(),
|
|
3247
|
+
"targetTypes": z.array(z.string()).optional(),
|
|
3248
|
+
"constraintSeverity": z.enum(["warn", "info"]).optional()
|
|
3249
|
+
})),
|
|
3250
|
+
"topicBindings": z.array(z.object({
|
|
3251
|
+
"topicType": z.string(),
|
|
3252
|
+
"autoBindNewTopics": z.boolean()
|
|
3253
|
+
})).optional()
|
|
3254
|
+
}).optional(),
|
|
3255
|
+
"lensManifest": z.array(z.object({
|
|
3256
|
+
"lensKey": z.string(),
|
|
3257
|
+
"name": z.string(),
|
|
3258
|
+
"description": z.string().optional(),
|
|
3259
|
+
"perspectiveType": z.string(),
|
|
3260
|
+
"promptTemplates": z.array(z.object({
|
|
3261
|
+
"key": z.string(),
|
|
3262
|
+
"promptRef": z.string(),
|
|
3263
|
+
"phase": z.string().optional(),
|
|
3264
|
+
"role": z.string().optional(),
|
|
3265
|
+
"version": z.string().optional(),
|
|
3266
|
+
"required": z.boolean().optional(),
|
|
3267
|
+
"metadata": z.any().optional()
|
|
3268
|
+
})),
|
|
3269
|
+
"workflowTemplates": z.array(z.object({
|
|
3270
|
+
"key": z.string(),
|
|
3271
|
+
"name": z.string(),
|
|
3272
|
+
"description": z.string().optional(),
|
|
3273
|
+
"steps": z.array(z.object({
|
|
3274
|
+
"key": z.string(),
|
|
3275
|
+
"title": z.string(),
|
|
3276
|
+
"description": z.string().optional(),
|
|
3277
|
+
"promptTemplateKey": z.string().optional(),
|
|
3278
|
+
"taskTemplateKeys": z.array(z.string()).optional(),
|
|
3279
|
+
"metadata": z.any().optional()
|
|
3280
|
+
})),
|
|
3281
|
+
"metadata": z.any().optional()
|
|
3282
|
+
})),
|
|
3283
|
+
"taskTemplates": z.array(z.object({
|
|
3284
|
+
"key": z.string(),
|
|
3285
|
+
"title": z.string(),
|
|
3286
|
+
"description": z.string().optional(),
|
|
3287
|
+
"priority": z.enum(["critical", "high", "medium", "low"]).optional(),
|
|
3288
|
+
"phase": z.string().optional(),
|
|
3289
|
+
"metadata": z.any().optional()
|
|
3290
|
+
})),
|
|
3291
|
+
"questionTemplates": z.array(z.object({
|
|
3292
|
+
"key": z.string(),
|
|
3293
|
+
"text": z.string(),
|
|
3294
|
+
"priority": z.enum(["critical", "high", "medium", "low"]).optional(),
|
|
3295
|
+
"linkedBeliefKey": z.string().optional(),
|
|
3296
|
+
"metadata": z.any().optional()
|
|
3297
|
+
})).optional(),
|
|
3298
|
+
"filterCriteria": z.any().optional(),
|
|
3299
|
+
"topicTypeAffinity": z.array(z.string()).optional(),
|
|
3300
|
+
"metadata": z.any().optional()
|
|
3301
|
+
})).optional(),
|
|
3302
|
+
"configSnapshot": z.record(z.any()).optional(),
|
|
3303
|
+
"topicIds": z.array(z.string()).optional(),
|
|
3304
|
+
"releaseNotes": z.string().optional(),
|
|
3305
|
+
"releasedBy": z.string(),
|
|
3306
|
+
"publishedAt": z.number().optional(),
|
|
3307
|
+
"createdAt": z.number()
|
|
3308
|
+
}),
|
|
3309
|
+
indices: [
|
|
3310
|
+
{ kind: "index", name: "by_packKey", columns: ["packKey"] },
|
|
3311
|
+
{ kind: "index", name: "by_packKey_version", columns: ["packKey", "version"] },
|
|
3312
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
3313
|
+
{ kind: "index", name: "by_publishedAt", columns: ["publishedAt"] }
|
|
3314
|
+
]
|
|
3315
|
+
});
|
|
3316
|
+
var policyBundles = defineTable({
|
|
3317
|
+
name: "policyBundles",
|
|
3318
|
+
component: "mc",
|
|
3319
|
+
category: "policy",
|
|
3320
|
+
shape: z.object({
|
|
3321
|
+
"bundleKey": z.string(),
|
|
3322
|
+
"version": z.number(),
|
|
3323
|
+
"scope": z.enum(["platform", "tenant", "workspace"]),
|
|
3324
|
+
"tenantId": idOf("tenants").optional(),
|
|
3325
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
3326
|
+
"status": z.enum(["draft", "validated", "enforced", "archived"]),
|
|
3327
|
+
"policyHash": z.string().optional(),
|
|
3328
|
+
"rules": z.record(z.any()),
|
|
3329
|
+
"metadata": z.record(z.any()).optional(),
|
|
3330
|
+
"createdBy": z.string().optional(),
|
|
3331
|
+
"createdAt": z.number(),
|
|
3332
|
+
"updatedAt": z.number()
|
|
3333
|
+
}),
|
|
3334
|
+
indices: [
|
|
3335
|
+
{ kind: "index", name: "by_bundle_key", columns: ["bundleKey"] },
|
|
3336
|
+
{ kind: "index", name: "by_bundle_key_version", columns: ["bundleKey", "version"] },
|
|
3337
|
+
{ kind: "index", name: "by_scope_status", columns: ["scope", "status"] },
|
|
3338
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
|
|
3339
|
+
{ kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] }
|
|
3340
|
+
]
|
|
3341
|
+
});
|
|
3342
|
+
var policyDecisionLogs = defineTable({
|
|
3343
|
+
name: "policyDecisionLogs",
|
|
3344
|
+
component: "mc",
|
|
3345
|
+
category: "policy",
|
|
3346
|
+
shape: z.object({
|
|
3347
|
+
"principalId": z.string(),
|
|
3348
|
+
"tenantId": idOf("tenants").optional(),
|
|
3349
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
3350
|
+
"resourceType": z.string(),
|
|
3351
|
+
"resourceId": z.string(),
|
|
3352
|
+
"action": z.enum(["read", "summarize", "export", "mutate", "admin", "comment", "escalate", "resolve", "vote"]),
|
|
3353
|
+
"decision": z.enum(["allow", "deny"]),
|
|
3354
|
+
"reasonCode": z.string(),
|
|
3355
|
+
"policyVersion": z.string(),
|
|
3356
|
+
"policyBundleId": idOf("policyBundles").optional(),
|
|
3357
|
+
"audienceKey": z.string().optional(),
|
|
3358
|
+
"audienceClass": z.enum(["internal", "restricted_external", "public"]).optional(),
|
|
3359
|
+
"audienceMode": z.string().optional(),
|
|
3360
|
+
"traceId": z.string().optional(),
|
|
3361
|
+
"packKey": z.string().optional(),
|
|
3362
|
+
"metadata": z.record(z.any()).optional(),
|
|
3363
|
+
"createdAt": z.number()
|
|
3364
|
+
}),
|
|
3365
|
+
indices: [
|
|
3366
|
+
{ kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
|
|
3367
|
+
{ kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
|
|
3368
|
+
{ kind: "index", name: "by_pack_createdAt", columns: ["packKey", "createdAt"] },
|
|
3369
|
+
{ kind: "index", name: "by_audienceKey_createdAt", columns: ["audienceKey", "createdAt"] },
|
|
3370
|
+
{ kind: "index", name: "by_decision_createdAt", columns: ["decision", "createdAt"] },
|
|
3371
|
+
{ kind: "index", name: "by_traceId", columns: ["traceId"] }
|
|
3372
|
+
]
|
|
3373
|
+
});
|
|
3374
|
+
var policySimulations = defineTable({
|
|
3375
|
+
name: "policySimulations",
|
|
3376
|
+
component: "mc",
|
|
3377
|
+
category: "policy",
|
|
3378
|
+
shape: z.object({
|
|
3379
|
+
"simulationKey": z.string(),
|
|
3380
|
+
"tenantId": idOf("tenants").optional(),
|
|
3381
|
+
"workspaceId": idOf("workspaces").optional(),
|
|
3382
|
+
"actorPrincipalId": z.string(),
|
|
3383
|
+
"input": z.record(z.any()),
|
|
3384
|
+
"result": z.record(z.any()),
|
|
3385
|
+
"metadata": z.record(z.any()).optional(),
|
|
3386
|
+
"createdAt": z.number()
|
|
3387
|
+
}),
|
|
3388
|
+
indices: [
|
|
3389
|
+
{ kind: "index", name: "by_simulation_key", columns: ["simulationKey"] },
|
|
3390
|
+
{ kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
|
|
3391
|
+
{ kind: "index", name: "by_workspace_createdAt", columns: ["workspaceId", "createdAt"] },
|
|
3392
|
+
{ kind: "index", name: "by_actor_createdAt", columns: ["actorPrincipalId", "createdAt"] }
|
|
3393
|
+
]
|
|
3394
|
+
});
|
|
3395
|
+
var controlPlaneToolAcls = defineTable({
|
|
3396
|
+
name: "controlPlaneToolAcls",
|
|
3397
|
+
component: "mc",
|
|
3398
|
+
category: "policy",
|
|
3399
|
+
shape: z.object({
|
|
3400
|
+
"tenantId": idOf("tenants"),
|
|
3401
|
+
"role": z.string(),
|
|
3402
|
+
"toolName": z.string(),
|
|
3403
|
+
"createdBy": z.string(),
|
|
3404
|
+
"createdAt": z.number(),
|
|
3405
|
+
"updatedAt": z.number()
|
|
3406
|
+
}),
|
|
3407
|
+
indices: [
|
|
3408
|
+
{ kind: "index", name: "by_tenant_role", columns: ["tenantId", "role"] },
|
|
3409
|
+
{ kind: "index", name: "by_tenant_toolName", columns: ["tenantId", "toolName"] }
|
|
3410
|
+
]
|
|
3411
|
+
});
|
|
3412
|
+
var projectGrants = defineTable({
|
|
3413
|
+
name: "projectGrants",
|
|
3414
|
+
component: "identity",
|
|
3415
|
+
category: "project",
|
|
3416
|
+
shape: z.object({
|
|
3417
|
+
"projectId": z.string().optional(),
|
|
3418
|
+
"topicId": z.string().optional(),
|
|
3419
|
+
"beliefClusterId": z.string().optional(),
|
|
3420
|
+
"tenantId": z.string().optional(),
|
|
3421
|
+
"workspaceId": z.string().optional(),
|
|
3422
|
+
"subjectType": z.enum(["principal", "group"]),
|
|
3423
|
+
"principalId": z.string().optional(),
|
|
3424
|
+
"groupId": z.string().optional(),
|
|
3425
|
+
"role": z.enum(["viewer", "editor", "owner_delegate"]),
|
|
3426
|
+
"status": z.enum(["active", "revoked", "expired"]),
|
|
3427
|
+
"source": z.enum(["owner_share", "group_share", "external_share", "policy", "api", "migration"]),
|
|
3428
|
+
"grantedBy": z.string().optional(),
|
|
3429
|
+
"expiresAt": z.number().optional(),
|
|
3430
|
+
"createdAt": z.number(),
|
|
3431
|
+
"updatedAt": z.number()
|
|
3432
|
+
}),
|
|
3433
|
+
indices: [
|
|
3434
|
+
{ kind: "index", name: "by_principal_status", columns: ["principalId", "status"] },
|
|
3435
|
+
{ kind: "index", name: "by_group_status", columns: ["groupId", "status"] },
|
|
3436
|
+
{ kind: "index", name: "by_tenant_workspace", columns: ["tenantId", "workspaceId"] },
|
|
3437
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
3438
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
3439
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] },
|
|
3440
|
+
{ kind: "index", name: "by_topic_principal", columns: ["topicId", "principalId"] },
|
|
3441
|
+
{ kind: "index", name: "by_topic_group", columns: ["topicId", "groupId"] },
|
|
3442
|
+
{ kind: "index", name: "by_topic_cluster", columns: ["topicId", "beliefClusterId"] },
|
|
3443
|
+
{ kind: "index", name: "by_topic_cluster_status", columns: ["topicId", "beliefClusterId", "status"] }
|
|
3444
|
+
]
|
|
3445
|
+
});
|
|
3446
|
+
var reasoningPermissions = defineTable({
|
|
3447
|
+
name: "reasoningPermissions",
|
|
3448
|
+
component: "identity",
|
|
3449
|
+
category: "epistemic",
|
|
3450
|
+
shape: z.object({
|
|
3451
|
+
"topicId": z.string().optional(),
|
|
3452
|
+
"principalId": z.string(),
|
|
3453
|
+
"nodeType": z.enum(["belief", "evidence", "action", "approval", "artifact"]),
|
|
3454
|
+
"action": z.enum(["view_conclusion", "view_evidence", "propose_action", "approve_action", "view_derived_artifact"]),
|
|
3455
|
+
"effect": z.enum(["allow", "deny"]),
|
|
3456
|
+
"policyReference": z.string().optional(),
|
|
3457
|
+
"rationale": z.string().optional(),
|
|
3458
|
+
"metadata": z.record(z.any()).optional(),
|
|
3459
|
+
"createdAt": z.number(),
|
|
3460
|
+
"createdBy": z.string(),
|
|
3461
|
+
"updatedAt": z.number()
|
|
3462
|
+
}),
|
|
3463
|
+
indices: [
|
|
3464
|
+
{ kind: "index", name: "by_topic_principal", columns: ["topicId", "principalId"] },
|
|
3465
|
+
{ kind: "index", name: "by_topic_principal_action", columns: ["topicId", "principalId", "action"] },
|
|
3466
|
+
{ kind: "index", name: "by_topic_principal_node_action", columns: ["topicId", "principalId", "nodeType", "action"] },
|
|
3467
|
+
{ kind: "index", name: "by_principal_action", columns: ["principalId", "action"] }
|
|
3468
|
+
]
|
|
3469
|
+
});
|
|
3470
|
+
var schemaEnumConfig = defineTable({
|
|
3471
|
+
name: "schemaEnumConfig",
|
|
3472
|
+
component: "kernel",
|
|
3473
|
+
category: "config",
|
|
3474
|
+
shape: z.object({
|
|
3475
|
+
"tenantId": z.string().optional(),
|
|
3476
|
+
"category": z.string(),
|
|
3477
|
+
"value": z.string(),
|
|
3478
|
+
"label": z.string(),
|
|
3479
|
+
"description": z.string().optional(),
|
|
3480
|
+
"tier": z.enum(["platform", "tenant"]),
|
|
3481
|
+
"domainNamespace": z.string().optional(),
|
|
3482
|
+
"metadata": z.any().optional(),
|
|
3483
|
+
"isDefault": z.boolean().optional(),
|
|
3484
|
+
"sortOrder": z.number().optional(),
|
|
3485
|
+
"status": z.enum(["active", "deprecated"]),
|
|
3486
|
+
"createdAt": z.number(),
|
|
3487
|
+
"updatedAt": z.number()
|
|
3488
|
+
}),
|
|
3489
|
+
indices: [
|
|
3490
|
+
{ kind: "index", name: "by_category", columns: ["category"] },
|
|
3491
|
+
{ kind: "index", name: "by_tenant_category", columns: ["tenantId", "category"] },
|
|
3492
|
+
{ kind: "index", name: "by_category_value", columns: ["category", "value"] }
|
|
3493
|
+
]
|
|
3494
|
+
});
|
|
3495
|
+
var tasks = defineTable({
|
|
3496
|
+
name: "tasks",
|
|
3497
|
+
component: "kernel",
|
|
3498
|
+
category: "task",
|
|
3499
|
+
shape: z.object({
|
|
3500
|
+
"topicId": z.string().optional(),
|
|
3501
|
+
"tenantId": z.string().optional(),
|
|
3502
|
+
"workspaceId": z.string().optional(),
|
|
3503
|
+
"title": z.string(),
|
|
3504
|
+
"description": z.string().optional(),
|
|
3505
|
+
"status": z.enum(["todo", "in_progress", "blocked", "done"]),
|
|
3506
|
+
"priority": z.enum(["urgent", "high", "medium", "low"]),
|
|
3507
|
+
"dueDate": z.number().optional(),
|
|
3508
|
+
"linkedWorktreeId": idOf("worktrees").optional(),
|
|
3509
|
+
"linkedBeliefId": z.string().optional(),
|
|
3510
|
+
"linkedQuestionId": z.string().optional(),
|
|
3511
|
+
"taskType": z.enum(["general", "find_evidence", "verify_claim", "research", "review", "interview", "analysis", "track_metrics"]).optional(),
|
|
3512
|
+
"assigneeId": z.string().optional(),
|
|
3513
|
+
"blockedReason": z.string().optional(),
|
|
3514
|
+
"blockedBy": z.array(idOf("tasks")).optional(),
|
|
3515
|
+
"blocks": z.array(idOf("tasks")).optional(),
|
|
3516
|
+
"sortOrder": z.number().optional(),
|
|
3517
|
+
"executionOrder": z.number().optional(),
|
|
3518
|
+
"subtasks": z.array(z.object({
|
|
3519
|
+
"id": z.string(),
|
|
3520
|
+
"title": z.string(),
|
|
3521
|
+
"completed": z.boolean(),
|
|
3522
|
+
"completedAt": z.number().optional()
|
|
3523
|
+
})).optional(),
|
|
3524
|
+
"comments": z.array(z.object({
|
|
3525
|
+
"id": z.string(),
|
|
3526
|
+
"userId": z.string(),
|
|
3527
|
+
"content": z.string(),
|
|
3528
|
+
"createdAt": z.number()
|
|
3529
|
+
})).optional(),
|
|
3530
|
+
"attachments": z.array(z.object({
|
|
3531
|
+
"id": z.string(),
|
|
3532
|
+
"type": z.enum(["call_script", "email_template", "research_plan", "framework", "checklist", "note", "file", "transcript"]),
|
|
3533
|
+
"title": z.string(),
|
|
3534
|
+
"content": z.string(),
|
|
3535
|
+
"metadata": z.object({
|
|
3536
|
+
"items": z.array(z.object({
|
|
3537
|
+
"id": z.string(),
|
|
3538
|
+
"text": z.string(),
|
|
3539
|
+
"completed": z.boolean()
|
|
3540
|
+
})).optional(),
|
|
3541
|
+
"fileUrl": z.string().optional(),
|
|
3542
|
+
"fileName": z.string().optional(),
|
|
3543
|
+
"fileSize": z.number().optional(),
|
|
3544
|
+
"frameworkType": z.string().optional(),
|
|
3545
|
+
"variables": z.array(z.string()).optional(),
|
|
3546
|
+
"mappedQuestions": z.array(z.object({
|
|
3547
|
+
"id": z.string(),
|
|
3548
|
+
"questionText": z.string(),
|
|
3549
|
+
"linkedQuestionId": z.string().optional(),
|
|
3550
|
+
"linkedBeliefId": z.string().optional(),
|
|
3551
|
+
"category": z.string().optional(),
|
|
3552
|
+
"priority": z.enum(["must_ask", "nice_to_have"]).optional(),
|
|
3553
|
+
"answered": z.boolean().optional(),
|
|
3554
|
+
"answerExcerpt": z.string().optional(),
|
|
3555
|
+
"answerTimestamp": z.string().optional(),
|
|
3556
|
+
"capturedAsInsight": z.boolean().optional(),
|
|
3557
|
+
"insightId": idOf("epistemicNodes").optional()
|
|
3558
|
+
})).optional(),
|
|
3559
|
+
"linkedCallScriptId": z.string().optional(),
|
|
3560
|
+
"editable": z.boolean().optional(),
|
|
3561
|
+
"executionTool": z.string().optional(),
|
|
3562
|
+
"linkedQuestionId": z.string().optional(),
|
|
3563
|
+
"linkedBeliefId": z.string().optional(),
|
|
3564
|
+
"workflowStepId": z.string().optional(),
|
|
3565
|
+
"workflowOrder": z.number().optional(),
|
|
3566
|
+
"dependsOnStepIds": z.array(z.string()).optional(),
|
|
3567
|
+
"runCondition": z.string().optional(),
|
|
3568
|
+
"continueOnFailure": z.boolean().optional(),
|
|
3569
|
+
"stepStatus": z.enum(["pending", "running", "completed", "failed", "skipped"]).optional(),
|
|
3570
|
+
"stepRunCount": z.number().optional(),
|
|
3571
|
+
"stepLastRunAt": z.number().optional(),
|
|
3572
|
+
"stepOutputSummary": z.string().optional(),
|
|
3573
|
+
"stepOutputData": z.string().optional(),
|
|
3574
|
+
"stepFailureReason": z.string().optional(),
|
|
3575
|
+
"researchResult": z.string().optional(),
|
|
3576
|
+
"researchStatus": z.enum(["pending", "running", "completed", "failed"]).optional(),
|
|
3577
|
+
"researchCompletedAt": z.number().optional(),
|
|
3578
|
+
"researchCitations": z.array(z.union([z.string(), z.object({
|
|
3579
|
+
"url": z.string(),
|
|
3580
|
+
"title": z.string().optional(),
|
|
3581
|
+
"snippet": z.string().optional()
|
|
3582
|
+
})])).optional(),
|
|
3583
|
+
"generatedPersonas": z.array(z.any()).optional(),
|
|
3584
|
+
"personasGeneratedAt": z.number().optional(),
|
|
3585
|
+
"expertSearchResults": z.array(z.any()).optional(),
|
|
3586
|
+
"expertSearchAt": z.number().optional(),
|
|
3587
|
+
"capturedAsEvidence": z.boolean().optional(),
|
|
3588
|
+
"capturedInsightId": z.string().optional(),
|
|
3589
|
+
"capturedAt": z.number().optional(),
|
|
3590
|
+
"capturedImpact": z.number().optional(),
|
|
3591
|
+
"tools": z.array(z.object({
|
|
3592
|
+
"tool": z.string(),
|
|
3593
|
+
"purpose": z.string(),
|
|
3594
|
+
"suggestedQuery": z.string()
|
|
3595
|
+
})).optional(),
|
|
3596
|
+
"metrics": z.array(z.object({
|
|
3597
|
+
"metric": z.string(),
|
|
3598
|
+
"source": z.string(),
|
|
3599
|
+
"frequency": z.string(),
|
|
3600
|
+
"currentValue": z.string().optional()
|
|
3601
|
+
})).optional(),
|
|
3602
|
+
"personas": z.array(z.object({
|
|
3603
|
+
"role": z.string(),
|
|
3604
|
+
"title": z.string(),
|
|
3605
|
+
"company": z.string(),
|
|
3606
|
+
"rationale": z.string()
|
|
3607
|
+
})).optional(),
|
|
3608
|
+
"experts": z.array(z.object({
|
|
3609
|
+
"expertise": z.string(),
|
|
3610
|
+
"potentialSources": z.array(z.string()),
|
|
3611
|
+
"questions": z.array(z.string()),
|
|
3612
|
+
"searchStrategy": z.string().optional()
|
|
3613
|
+
})).optional(),
|
|
3614
|
+
"factChecker": z.object({
|
|
3615
|
+
"claimsToVerify": z.array(z.string()),
|
|
3616
|
+
"sourcesToCheck": z.array(z.string()),
|
|
3617
|
+
"verificationCriteria": z.array(z.string())
|
|
3618
|
+
}).optional()
|
|
3619
|
+
}).optional(),
|
|
3620
|
+
"capturedAsEvidence": z.boolean().optional(),
|
|
3621
|
+
"capturedInsightId": idOf("epistemicNodes").optional(),
|
|
3622
|
+
"capturedAt": z.number().optional(),
|
|
3623
|
+
"createdBy": z.string(),
|
|
3624
|
+
"createdAt": z.number()
|
|
3625
|
+
})).optional(),
|
|
3626
|
+
"tags": z.array(z.string()).optional(),
|
|
3627
|
+
"executionType": z.enum(["research_search", "find_news", "identify_experts", "market_research", "generate_primer", "verify_claim", "manual", "mcp_research", "mcp_web_search", "mcp_capture", "mcp_network_search"]).optional(),
|
|
3628
|
+
"executionStatus": z.enum(["pending", "running", "completed", "failed"]).optional(),
|
|
3629
|
+
"executionResults": z.union([z.string(), z.number(), z.boolean(), z.null(), z.record(z.any()), z.array(z.any())]).optional(),
|
|
3630
|
+
"executionStartedAt": z.number().optional(),
|
|
3631
|
+
"executionCompletedAt": z.number().optional(),
|
|
3632
|
+
"executionError": z.string().optional(),
|
|
3633
|
+
"mcpDatasetIds": z.array(z.string()).optional(),
|
|
3634
|
+
"mcpSkillIds": z.array(z.string()).optional(),
|
|
3635
|
+
"mcpExecutionId": z.string().optional(),
|
|
3636
|
+
"linkedChatId": z.string().optional(),
|
|
3637
|
+
"createdBy": z.string(),
|
|
3638
|
+
"createdAt": z.number(),
|
|
3639
|
+
"updatedAt": z.number(),
|
|
3640
|
+
"completedAt": z.number().optional(),
|
|
3641
|
+
"completedBy": z.string().optional()
|
|
3642
|
+
}),
|
|
3643
|
+
indices: [
|
|
3644
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
3645
|
+
{ kind: "index", name: "by_topicId_status", columns: ["topicId", "status"] },
|
|
3646
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
3647
|
+
{ kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
|
|
3648
|
+
{ kind: "index", name: "by_worktreeId", columns: ["linkedWorktreeId"] },
|
|
3649
|
+
{ kind: "index", name: "by_beliefId", columns: ["linkedBeliefId"] },
|
|
3650
|
+
{ kind: "index", name: "by_questionId", columns: ["linkedQuestionId"] },
|
|
3651
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
3652
|
+
{ kind: "index", name: "by_assigneeId", columns: ["assigneeId"] },
|
|
3653
|
+
{ kind: "index", name: "by_dueDate", columns: ["dueDate"] },
|
|
3654
|
+
{ kind: "index", name: "by_priority", columns: ["priority"] },
|
|
3655
|
+
{ kind: "index", name: "by_executionType", columns: ["executionType"] },
|
|
3656
|
+
{ kind: "index", name: "by_executionStatus", columns: ["executionStatus"] }
|
|
3657
|
+
]
|
|
3658
|
+
});
|
|
3659
|
+
var topics = defineTable({
|
|
3660
|
+
name: "topics",
|
|
3661
|
+
component: "kernel",
|
|
3662
|
+
category: "topic",
|
|
3663
|
+
shape: z.object({
|
|
3664
|
+
"globalId": z.string(),
|
|
3665
|
+
"name": z.string(),
|
|
3666
|
+
"description": z.string().optional(),
|
|
3667
|
+
"parentTopicId": idOf("topics").optional(),
|
|
3668
|
+
"depth": z.number(),
|
|
3669
|
+
"path": z.array(z.string()),
|
|
3670
|
+
"type": z.string(),
|
|
3671
|
+
"ontologyId": idOf("ontologyDefinitions").optional(),
|
|
3672
|
+
"graphScopeProjectId": z.string().optional(),
|
|
3673
|
+
"metadata": z.any().optional(),
|
|
3674
|
+
"tenantId": z.string().optional(),
|
|
3675
|
+
"workspaceId": z.string().optional(),
|
|
3676
|
+
"status": TOPIC_STATUS,
|
|
3677
|
+
"visibility": TOPIC_VISIBILITY.optional(),
|
|
3678
|
+
"createdBy": z.string(),
|
|
3679
|
+
"createdAt": z.number(),
|
|
3680
|
+
"updatedAt": z.number()
|
|
3681
|
+
}),
|
|
3682
|
+
indices: [
|
|
3683
|
+
{ kind: "index", name: "by_parent", columns: ["parentTopicId"] },
|
|
3684
|
+
{ kind: "index", name: "by_type", columns: ["type"] },
|
|
3685
|
+
{ kind: "index", name: "by_graph_scope_project", columns: ["graphScopeProjectId"] },
|
|
3686
|
+
{ kind: "index", name: "by_tenant", columns: ["tenantId"] },
|
|
3687
|
+
{ kind: "index", name: "by_ontology", columns: ["ontologyId"] },
|
|
3688
|
+
{ kind: "index", name: "by_path", columns: ["path"] },
|
|
3689
|
+
{ kind: "search", name: "search_name", searchField: "name", filterFields: ["tenantId", "type"] }
|
|
3690
|
+
]
|
|
3691
|
+
});
|
|
3692
|
+
var users = defineTable({
|
|
3693
|
+
name: "users",
|
|
3694
|
+
component: "identity",
|
|
3695
|
+
category: "user",
|
|
3696
|
+
shape: z.object({
|
|
3697
|
+
"clerkId": z.string(),
|
|
3698
|
+
"email": z.string(),
|
|
3699
|
+
"name": z.string().optional(),
|
|
3700
|
+
"imageUrl": z.string().optional(),
|
|
3701
|
+
"lastSeenAt": z.number(),
|
|
3702
|
+
"chatCount": z.number(),
|
|
3703
|
+
"messageCount": z.number(),
|
|
3704
|
+
"isAdmin": z.boolean().optional(),
|
|
3705
|
+
"mcRole": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]).optional(),
|
|
3706
|
+
"mcRoleSyncedAt": z.number().optional(),
|
|
3707
|
+
"defaultTenantId": z.string().optional(),
|
|
3708
|
+
"defaultWorkspaceId": z.string().optional(),
|
|
3709
|
+
"defaultPrincipalId": z.string().optional(),
|
|
3710
|
+
"principalGroupIds": z.array(z.string()).optional(),
|
|
3711
|
+
"permittedPackKeys": z.array(z.string()).optional(),
|
|
3712
|
+
"permittedToolNames": z.array(z.string()).optional(),
|
|
3713
|
+
"governanceGrantsSyncedAt": z.number().optional(),
|
|
3714
|
+
"createdAt": z.number(),
|
|
3715
|
+
"updatedAt": z.number()
|
|
3716
|
+
}),
|
|
3717
|
+
indices: [
|
|
3718
|
+
{ kind: "index", name: "by_clerkId", columns: ["clerkId"] },
|
|
3719
|
+
{ kind: "index", name: "by_email", columns: ["email"] },
|
|
3720
|
+
{ kind: "index", name: "by_lastSeenAt", columns: ["lastSeenAt"] },
|
|
3721
|
+
{ kind: "index", name: "by_defaultTenantId", columns: ["defaultTenantId"] },
|
|
3722
|
+
{ kind: "index", name: "by_defaultWorkspaceId", columns: ["defaultWorkspaceId"] }
|
|
3723
|
+
]
|
|
3724
|
+
});
|
|
3725
|
+
var workflowDefinitions = defineTable({
|
|
3726
|
+
name: "workflowDefinitions",
|
|
3727
|
+
component: "kernel",
|
|
3728
|
+
category: "workflow",
|
|
3729
|
+
shape: z.object({
|
|
3730
|
+
"tenantId": z.string(),
|
|
3731
|
+
"name": z.string(),
|
|
3732
|
+
"displayName": z.string(),
|
|
3733
|
+
"description": z.string().optional(),
|
|
3734
|
+
"status": z.enum(["draft", "active", "deprecated"]),
|
|
3735
|
+
"version": z.number(),
|
|
3736
|
+
"metadata": z.record(z.any()).optional(),
|
|
3737
|
+
"createdBy": z.string(),
|
|
3738
|
+
"createdAt": z.number(),
|
|
3739
|
+
"updatedAt": z.number()
|
|
3740
|
+
}),
|
|
3741
|
+
indices: [
|
|
3742
|
+
{ kind: "index", name: "by_tenant", columns: ["tenantId"] },
|
|
3743
|
+
{ kind: "index", name: "by_tenant_name", columns: ["tenantId", "name"] },
|
|
3744
|
+
{ kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
|
|
3745
|
+
]
|
|
3746
|
+
});
|
|
3747
|
+
var workflowPullRequests = defineTable({
|
|
3748
|
+
name: "workflowPullRequests",
|
|
3749
|
+
component: "kernel",
|
|
3750
|
+
category: "workflow",
|
|
3751
|
+
shape: z.object({
|
|
3752
|
+
"topicId": z.string().optional(),
|
|
3753
|
+
"worktreeId": idOf("worktrees"),
|
|
3754
|
+
"status": z.enum(["pending_review", "changes_requested", "approved", "blocked"]),
|
|
3755
|
+
"summary": z.string(),
|
|
3756
|
+
"reviewers": z.array(z.string()).optional(),
|
|
3757
|
+
"createdBy": z.string(),
|
|
3758
|
+
"createdAt": z.number(),
|
|
3759
|
+
"updatedAt": z.number(),
|
|
3760
|
+
"resolvedAt": z.number().optional(),
|
|
3761
|
+
"resolvedBy": z.string().optional(),
|
|
3762
|
+
"metadata": z.record(z.any()).optional()
|
|
3763
|
+
}),
|
|
3764
|
+
indices: [
|
|
3765
|
+
{ kind: "index", name: "by_worktreeId", columns: ["worktreeId"] },
|
|
3766
|
+
{ kind: "index", name: "by_status", columns: ["status"] },
|
|
3767
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
3768
|
+
{ kind: "index", name: "by_topic_status", columns: ["topicId", "status"] }
|
|
3769
|
+
]
|
|
3770
|
+
});
|
|
3771
|
+
var workflowStages = defineTable({
|
|
3772
|
+
name: "workflowStages",
|
|
3773
|
+
component: "kernel",
|
|
3774
|
+
category: "workflow",
|
|
3775
|
+
shape: z.object({
|
|
3776
|
+
"workflowDefinitionId": idOf("workflowDefinitions"),
|
|
3777
|
+
"name": z.string(),
|
|
3778
|
+
"displayName": z.string(),
|
|
3779
|
+
"description": z.string().optional(),
|
|
3780
|
+
"order": z.number(),
|
|
3781
|
+
"entryConditions": z.record(z.any()).optional(),
|
|
3782
|
+
"exitConditions": z.record(z.any()).optional(),
|
|
3783
|
+
"gateRules": z.record(z.any()).optional(),
|
|
3784
|
+
"isOptional": z.boolean().optional(),
|
|
3785
|
+
"metadata": z.record(z.any()).optional(),
|
|
3786
|
+
"createdAt": z.number(),
|
|
3787
|
+
"updatedAt": z.number()
|
|
3788
|
+
}),
|
|
3789
|
+
indices: [
|
|
3790
|
+
{ kind: "index", name: "by_workflow", columns: ["workflowDefinitionId"] },
|
|
3791
|
+
{ kind: "index", name: "by_workflow_order", columns: ["workflowDefinitionId", "order"] }
|
|
3792
|
+
]
|
|
3793
|
+
});
|
|
3794
|
+
var workspaces = defineTable({
|
|
3795
|
+
name: "workspaces",
|
|
3796
|
+
component: "mc",
|
|
3797
|
+
category: "workspace",
|
|
3798
|
+
shape: z.object({
|
|
3799
|
+
"tenantId": idOf("tenants"),
|
|
3800
|
+
"key": z.string(),
|
|
3801
|
+
"slug": z.string(),
|
|
3802
|
+
"name": z.string(),
|
|
3803
|
+
"status": z.enum(["active", "archived"]),
|
|
3804
|
+
"defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
|
|
3805
|
+
"deployments": z.record(z.object({
|
|
3806
|
+
"url": z.string(),
|
|
3807
|
+
"encryptedDeployKey": z.string()
|
|
3808
|
+
})).optional(),
|
|
3809
|
+
"metadata": z.record(z.any()).optional(),
|
|
3810
|
+
"createdBy": z.string().optional(),
|
|
3811
|
+
"createdAt": z.number(),
|
|
3812
|
+
"updatedAt": z.number()
|
|
3813
|
+
}),
|
|
3814
|
+
indices: [
|
|
3815
|
+
{ kind: "index", name: "by_tenantId", columns: ["tenantId"] },
|
|
3816
|
+
{ kind: "index", name: "by_tenantId_key", columns: ["tenantId", "key"] },
|
|
3817
|
+
{ kind: "index", name: "by_tenantId_slug", columns: ["tenantId", "slug"] },
|
|
3818
|
+
{ kind: "index", name: "by_status", columns: ["status"] }
|
|
3819
|
+
]
|
|
3820
|
+
});
|
|
3821
|
+
var worktreeBeliefCluster = defineTable({
|
|
3822
|
+
name: "worktreeBeliefCluster",
|
|
3823
|
+
component: "kernel",
|
|
3824
|
+
category: "worktree",
|
|
3825
|
+
shape: z.object({
|
|
3826
|
+
"worktreeId": idOf("worktrees"),
|
|
3827
|
+
"beliefId": z.string(),
|
|
3828
|
+
"relationType": z.enum(["primary", "counterfactual", "dependency", "cascade", "conditional", "supporting", "contradicting", "alternative", "prerequisite"]),
|
|
3829
|
+
"relationDescription": z.string().optional(),
|
|
3830
|
+
"counterfactualText": z.string().optional(),
|
|
3831
|
+
"dependencyText": z.string().optional(),
|
|
3832
|
+
"cascadeText": z.string().optional(),
|
|
3833
|
+
"initialConfidence": z.number().optional(),
|
|
3834
|
+
"initialEvidenceCount": z.number().optional(),
|
|
3835
|
+
"finalConfidence": z.number().optional(),
|
|
3836
|
+
"finalEvidenceCount": z.number().optional(),
|
|
3837
|
+
"confidenceDelta": z.number().optional(),
|
|
3838
|
+
"llmValence": z.number().optional(),
|
|
3839
|
+
"llmCertainty": z.number().optional(),
|
|
3840
|
+
"llmReasoning": z.string().optional(),
|
|
3841
|
+
"llmEvidenceScores": z.string().optional(),
|
|
3842
|
+
"llmAssessedAt": z.number().optional(),
|
|
3843
|
+
"addedAt": z.number(),
|
|
3844
|
+
"updatedAt": z.number()
|
|
3845
|
+
}),
|
|
3846
|
+
indices: [
|
|
3847
|
+
{ kind: "index", name: "by_worktree", columns: ["worktreeId"] },
|
|
3848
|
+
{ kind: "index", name: "by_belief", columns: ["beliefId"] },
|
|
3849
|
+
{ kind: "index", name: "by_worktree_relation", columns: ["worktreeId", "relationType"] }
|
|
3850
|
+
]
|
|
3851
|
+
});
|
|
3852
|
+
var worktrees = defineTable({
|
|
3853
|
+
name: "worktrees",
|
|
3854
|
+
component: "kernel",
|
|
3855
|
+
category: "worktree",
|
|
3856
|
+
shape: z.object({
|
|
3857
|
+
"topicId": z.string().optional(),
|
|
3858
|
+
"index": z.number(),
|
|
3859
|
+
"name": z.string(),
|
|
3860
|
+
"beliefFocus": z.string().optional(),
|
|
3861
|
+
"objective": z.string(),
|
|
3862
|
+
"worktreeType": z.string().optional(),
|
|
3863
|
+
"rationale": z.string().optional(),
|
|
3864
|
+
"confidenceImpact": z.enum(["high", "medium", "low"]).optional(),
|
|
3865
|
+
"hypothesis": z.string().optional(),
|
|
3866
|
+
"dependsOn": z.array(idOf("worktrees")).optional(),
|
|
3867
|
+
"blocks": z.array(idOf("worktrees")).optional(),
|
|
3868
|
+
"gate": z.string().optional(),
|
|
3869
|
+
"campaign": z.number().optional(),
|
|
3870
|
+
"lane": z.string().optional(),
|
|
3871
|
+
"laneOrderInCampaign": z.number().optional(),
|
|
3872
|
+
"orderInLane": z.number().optional(),
|
|
3873
|
+
"startDate": z.number(),
|
|
3874
|
+
"endDate": z.number(),
|
|
3875
|
+
"durationWeeks": z.number(),
|
|
3876
|
+
"status": z.enum(["suggested", "planning", "active", "paused", "completed", "dismissed", "abandoned"]),
|
|
3877
|
+
"generatedBy": z.string().optional(),
|
|
3878
|
+
"epistemicOrigin": z.string().optional(),
|
|
3879
|
+
"priority": z.number().optional(),
|
|
3880
|
+
"dismissedReason": z.string().optional(),
|
|
3881
|
+
"userId": z.string().optional(),
|
|
3882
|
+
"createdAt": z.number().optional(),
|
|
3883
|
+
"updatedAt": z.number().optional(),
|
|
3884
|
+
"chatId": z.string().optional(),
|
|
3885
|
+
"tasks": z.union([z.string(), z.number(), z.boolean(), z.null(), z.record(z.any()), z.array(z.any())]).optional(),
|
|
3886
|
+
"targetBeliefIds": z.array(z.string()),
|
|
3887
|
+
"targetQuestionIds": z.array(z.string()),
|
|
3888
|
+
"keyQuestions": z.array(z.object({
|
|
3889
|
+
"question": z.string(),
|
|
3890
|
+
"status": z.enum(["open", "answered", "forked"]),
|
|
3891
|
+
"answer": z.string().optional(),
|
|
3892
|
+
"answerConfidence": z.enum(["high", "medium", "low"]).optional(),
|
|
3893
|
+
"linkedQuestionId": z.string().optional()
|
|
3894
|
+
})).optional(),
|
|
3895
|
+
"evidenceSignals": z.array(z.object({
|
|
3896
|
+
"signal": z.string(),
|
|
3897
|
+
"collected": z.boolean(),
|
|
3898
|
+
"progress": z.string().optional(),
|
|
3899
|
+
"notes": z.string().optional()
|
|
3900
|
+
})).optional(),
|
|
3901
|
+
"decisionGate": z.object({
|
|
3902
|
+
"goCriteria": z.array(z.string()),
|
|
3903
|
+
"noGoSignals": z.array(z.string()),
|
|
3904
|
+
"verdict": z.enum(["go", "no_go", "pivot", "pending"]).optional(),
|
|
3905
|
+
"verdictRationale": z.string().optional(),
|
|
3906
|
+
"decidedAt": z.number().optional(),
|
|
3907
|
+
"decidedBy": z.string().optional()
|
|
3908
|
+
}).optional(),
|
|
3909
|
+
"beliefRefinement": z.object({
|
|
3910
|
+
"isRefined": z.boolean(),
|
|
3911
|
+
"refinedAt": z.number().optional(),
|
|
3912
|
+
"refinedBy": z.string().optional(),
|
|
3913
|
+
"originalText": z.string().optional(),
|
|
3914
|
+
"refinedText": z.string().optional(),
|
|
3915
|
+
"testingCriteria": z.string().optional(),
|
|
3916
|
+
"measurableCriteria": z.string().optional(),
|
|
3917
|
+
"timeframe": z.string().optional(),
|
|
3918
|
+
"checklist": z.object({
|
|
3919
|
+
"hasSpecificClaim": z.boolean(),
|
|
3920
|
+
"hasTimeframe": z.boolean(),
|
|
3921
|
+
"hasMeasurableCriteria": z.boolean(),
|
|
3922
|
+
"hasTestability": z.boolean()
|
|
3923
|
+
}).optional()
|
|
3924
|
+
}).optional(),
|
|
3925
|
+
"beliefRefinements": z.array(z.any()).optional(),
|
|
3926
|
+
"startingConfidence": z.object({
|
|
3927
|
+
"overall": z.number(),
|
|
3928
|
+
"beliefConfidences": z.array(z.object({
|
|
3929
|
+
"beliefId": z.string(),
|
|
3930
|
+
"confidence": z.number()
|
|
3931
|
+
}))
|
|
3932
|
+
}).optional(),
|
|
3933
|
+
"endingConfidence": z.object({
|
|
3934
|
+
"overall": z.number(),
|
|
3935
|
+
"beliefConfidences": z.array(z.object({
|
|
3936
|
+
"beliefId": z.string(),
|
|
3937
|
+
"confidence": z.number()
|
|
3938
|
+
}))
|
|
3939
|
+
}).optional(),
|
|
3940
|
+
"outcome": z.object({
|
|
3941
|
+
"verdict": z.enum(["validated", "invalidated", "forked", "inconclusive"]),
|
|
3942
|
+
"summary": z.string(),
|
|
3943
|
+
"whatChanged": z.string(),
|
|
3944
|
+
"confidenceChange": z.number()
|
|
3945
|
+
}).optional(),
|
|
3946
|
+
"epistemicChain": z.object({
|
|
3947
|
+
"capturedAt": z.number(),
|
|
3948
|
+
"capturedBy": z.string(),
|
|
3949
|
+
"worktreeId": idOf("worktrees"),
|
|
3950
|
+
"topicId": z.string().optional(),
|
|
3951
|
+
"primaryBelief": z.object({
|
|
3952
|
+
"id": z.string(),
|
|
3953
|
+
"text": z.string(),
|
|
3954
|
+
"startingConfidence": z.number(),
|
|
3955
|
+
"startingConfidenceLabel": z.string().optional(),
|
|
3956
|
+
"endingConfidence": z.number(),
|
|
3957
|
+
"endingConfidenceLabel": z.string().optional(),
|
|
3958
|
+
"confidenceScore": z.number().optional(),
|
|
3959
|
+
"status": z.string().optional(),
|
|
3960
|
+
"criticality": z.string().optional()
|
|
3961
|
+
}).optional(),
|
|
3962
|
+
"clusterEdges": z.array(z.object({
|
|
3963
|
+
"edgeId": z.string().optional(),
|
|
3964
|
+
"edgeType": z.string(),
|
|
3965
|
+
"sourceId": z.string(),
|
|
3966
|
+
"targetId": z.string(),
|
|
3967
|
+
"weight": z.number().optional(),
|
|
3968
|
+
"createdAt": z.number().optional()
|
|
3969
|
+
})),
|
|
3970
|
+
"relatedBeliefs": z.array(z.object({
|
|
3971
|
+
"id": z.string(),
|
|
3972
|
+
"text": z.string().optional(),
|
|
3973
|
+
"confidence": z.string().optional(),
|
|
3974
|
+
"confidenceScore": z.number().optional()
|
|
3975
|
+
})).optional(),
|
|
3976
|
+
"questions": z.array(z.object({
|
|
3977
|
+
"id": z.string(),
|
|
3978
|
+
"text": z.string(),
|
|
3979
|
+
"status": z.string(),
|
|
3980
|
+
"priority": z.string().optional(),
|
|
3981
|
+
"answer": z.string().optional(),
|
|
3982
|
+
"answerStatus": z.string().optional(),
|
|
3983
|
+
"answeredBy": z.string().optional(),
|
|
3984
|
+
"answeredAt": z.number().optional(),
|
|
3985
|
+
"evidenceCount": z.number()
|
|
3986
|
+
})),
|
|
3987
|
+
"evidence": z.array(z.object({
|
|
3988
|
+
"id": z.string(),
|
|
3989
|
+
"text": z.string(),
|
|
3990
|
+
"sourceType": z.string().optional(),
|
|
3991
|
+
"verificationStatus": z.string().optional(),
|
|
3992
|
+
"verified": z.boolean(),
|
|
3993
|
+
"createdAt": z.number().optional()
|
|
3994
|
+
})),
|
|
3995
|
+
"tasksCompleted": z.number().optional(),
|
|
3996
|
+
"totalTasks": z.number().optional(),
|
|
3997
|
+
"outcome": z.object({
|
|
3998
|
+
"verdict": z.string(),
|
|
3999
|
+
"summary": z.string(),
|
|
4000
|
+
"confidenceChange": z.number(),
|
|
4001
|
+
"startingConfidence": z.number(),
|
|
4002
|
+
"endingConfidence": z.number()
|
|
4003
|
+
}),
|
|
4004
|
+
"confidenceHistory": z.array(z.object({
|
|
4005
|
+
"beliefId": z.string(),
|
|
4006
|
+
"recentChanges": z.array(z.object({
|
|
4007
|
+
"confidence": z.string().optional(),
|
|
4008
|
+
"trigger": z.string().optional(),
|
|
4009
|
+
"timestamp": z.number().optional()
|
|
4010
|
+
}))
|
|
4011
|
+
})).optional()
|
|
4012
|
+
}).optional(),
|
|
4013
|
+
"keyFindings": z.array(z.string()).optional(),
|
|
4014
|
+
"decisionsReached": z.array(z.string()).optional(),
|
|
4015
|
+
"nextSteps": z.array(z.string()).optional(),
|
|
4016
|
+
"retrospective": z.object({
|
|
4017
|
+
"whatWorked": z.array(z.string()),
|
|
4018
|
+
"whatDidnt": z.array(z.string()),
|
|
4019
|
+
"lessonsLearned": z.array(z.string()),
|
|
4020
|
+
"confidenceChange": z.number()
|
|
4021
|
+
}).optional(),
|
|
4022
|
+
"thesisReportId": z.string().optional(),
|
|
4023
|
+
"branchThesis": z.object({
|
|
4024
|
+
"content": z.string(),
|
|
4025
|
+
"memoContent": z.string().optional(),
|
|
4026
|
+
"status": z.enum(["ai_draft", "user_draft", "final"]),
|
|
4027
|
+
"generatedAt": z.number().optional(),
|
|
4028
|
+
"approvedAt": z.number().optional(),
|
|
4029
|
+
"approvedBy": z.string().optional(),
|
|
4030
|
+
"generationMetadata": z.object({
|
|
4031
|
+
"modelUsed": z.string(),
|
|
4032
|
+
"promptName": z.string(),
|
|
4033
|
+
"langfuseTraceId": z.string().optional()
|
|
4034
|
+
}).optional()
|
|
4035
|
+
}).optional(),
|
|
4036
|
+
"generatedAt": z.number().optional(),
|
|
4037
|
+
"sourceProposalId": z.string().optional(),
|
|
4038
|
+
"triggerReason": z.string().optional(),
|
|
4039
|
+
"linkedEvidenceIds": z.array(z.string()).optional(),
|
|
4040
|
+
"linkedDocumentIds": z.array(z.string()).optional(),
|
|
4041
|
+
"linkedCallIds": z.array(z.string()).optional(),
|
|
4042
|
+
"linkedNewsIds": z.array(z.string()).optional(),
|
|
4043
|
+
"linkedPrimerIds": z.array(z.string()).optional(),
|
|
4044
|
+
"linkedDeepResearchIds": z.array(z.string()).optional(),
|
|
4045
|
+
"notes": z.array(z.object({
|
|
4046
|
+
"id": z.string(),
|
|
4047
|
+
"content": z.string(),
|
|
4048
|
+
"createdAt": z.number(),
|
|
4049
|
+
"createdBy": z.string(),
|
|
4050
|
+
"linkedTaskId": z.string().optional(),
|
|
4051
|
+
"linkedQuestionId": z.string().optional(),
|
|
4052
|
+
"linkedBeliefId": z.string().optional()
|
|
4053
|
+
})).optional(),
|
|
4054
|
+
"targetBranch": z.string().optional(),
|
|
4055
|
+
"worktreeScope": z.enum(["belief", "branch"]).optional(),
|
|
4056
|
+
"synthesisState": z.object({
|
|
4057
|
+
"originalBeliefIds": z.array(z.string()),
|
|
4058
|
+
"synthesizedBeliefIds": z.array(z.string()),
|
|
4059
|
+
"synthesisComplete": z.boolean(),
|
|
4060
|
+
"synthesisRationale": z.string().optional(),
|
|
4061
|
+
"synthesisCompletedAt": z.number().optional(),
|
|
4062
|
+
"synthesisCompletedBy": z.string().optional()
|
|
4063
|
+
}).optional(),
|
|
4064
|
+
"evidenceReviewState": z.object({
|
|
4065
|
+
"existingEvidenceReviewed": z.boolean(),
|
|
4066
|
+
"evidenceGaps": z.array(z.string()),
|
|
4067
|
+
"strengthAreas": z.array(z.string()),
|
|
4068
|
+
"evidenceQuestionMapping": z.array(z.object({
|
|
4069
|
+
"evidenceId": z.string(),
|
|
4070
|
+
"questionIds": z.array(z.string()),
|
|
4071
|
+
"coverageNote": z.string().optional()
|
|
4072
|
+
})).optional(),
|
|
4073
|
+
"reviewCompletedAt": z.number().optional(),
|
|
4074
|
+
"reviewCompletedBy": z.string().optional()
|
|
4075
|
+
}).optional(),
|
|
4076
|
+
"phase": z.string().optional(),
|
|
4077
|
+
"clusterStatus": z.object({
|
|
4078
|
+
"totalConditionals": z.number(),
|
|
4079
|
+
"hasCounterfactuals": z.boolean(),
|
|
4080
|
+
"hasDependencies": z.boolean(),
|
|
4081
|
+
"hasCascades": z.boolean(),
|
|
4082
|
+
"conditionalsByType": z.object({
|
|
4083
|
+
"counterfactuals": z.number(),
|
|
4084
|
+
"dependencies": z.number(),
|
|
4085
|
+
"cascades": z.number(),
|
|
4086
|
+
"other": z.number()
|
|
4087
|
+
}).optional(),
|
|
4088
|
+
"mappingCompletedAt": z.number().optional(),
|
|
4089
|
+
"mappingCompletedBy": z.string().optional()
|
|
4090
|
+
}).optional(),
|
|
4091
|
+
"phaseHistory": z.array(z.object({
|
|
4092
|
+
"phase": z.string(),
|
|
4093
|
+
"enteredAt": z.number(),
|
|
4094
|
+
"pausedAt": z.number().optional(),
|
|
4095
|
+
"resumedAt": z.number().optional(),
|
|
4096
|
+
"completedAt": z.number().optional(),
|
|
4097
|
+
"completedBy": z.string().optional()
|
|
4098
|
+
})).optional(),
|
|
4099
|
+
"questionsCoverage": z.object({
|
|
4100
|
+
"totalQuestions": z.number(),
|
|
4101
|
+
"clusterNodesCovered": z.number(),
|
|
4102
|
+
"coveragePercent": z.number(),
|
|
4103
|
+
"gapsIdentified": z.array(z.string()).optional()
|
|
4104
|
+
}).optional(),
|
|
4105
|
+
"researchEfficiency": z.object({
|
|
4106
|
+
"totalTasks": z.number(),
|
|
4107
|
+
"questionsPerTask": z.number(),
|
|
4108
|
+
"clusterCoverage": z.number(),
|
|
4109
|
+
"efficiencyScore": z.number()
|
|
4110
|
+
}).optional(),
|
|
4111
|
+
"createdBy": z.string(),
|
|
4112
|
+
"metadata": z.any().optional()
|
|
4113
|
+
}),
|
|
4114
|
+
indices: [
|
|
4115
|
+
{ kind: "index", name: "by_topicId", columns: ["topicId"] },
|
|
4116
|
+
{ kind: "index", name: "by_topicId_status", columns: ["topicId", "status"] },
|
|
4117
|
+
{ kind: "index", name: "by_topicId_index", columns: ["topicId", "index"] },
|
|
4118
|
+
{ kind: "index", name: "by_worktreeType", columns: ["topicId", "worktreeType"] },
|
|
4119
|
+
{ kind: "index", name: "by_topicId_priority", columns: ["topicId", "priority"] },
|
|
4120
|
+
{ kind: "index", name: "by_topicId_campaign_lane_order", columns: ["topicId", "campaign", "laneOrderInCampaign", "orderInLane"] },
|
|
4121
|
+
{ kind: "index", name: "by_topicId_lane_order", columns: ["topicId", "lane", "orderInLane"] },
|
|
4122
|
+
{ kind: "index", name: "by_topicId_branch", columns: ["topicId", "targetBranch"] },
|
|
4123
|
+
{ kind: "index", name: "by_topicId_scope", columns: ["topicId", "worktreeScope"] }
|
|
4124
|
+
]
|
|
4125
|
+
});
|
|
4126
|
+
|
|
4127
|
+
// src/schemas/manifest.ts
|
|
4128
|
+
var KERNEL_TABLE_CONTRACTS = [
|
|
4129
|
+
schemaEnumConfig,
|
|
4130
|
+
agentMessages,
|
|
4131
|
+
agentSessions,
|
|
4132
|
+
beliefVotes,
|
|
4133
|
+
calibrationScores,
|
|
4134
|
+
decisionComputedSummaries,
|
|
4135
|
+
decisionEvents,
|
|
4136
|
+
decisionParticipants,
|
|
4137
|
+
decisionRiskLedger,
|
|
4138
|
+
decisionSnapshots,
|
|
4139
|
+
deliberationContributions,
|
|
4140
|
+
deliberationSessions,
|
|
4141
|
+
stakeholderGroups,
|
|
4142
|
+
epistemicNodeEmbeddings,
|
|
4143
|
+
beliefConfidence,
|
|
4144
|
+
beliefEvidenceLinks,
|
|
4145
|
+
beliefHistory,
|
|
4146
|
+
beliefScenarios,
|
|
4147
|
+
contractEvaluations,
|
|
4148
|
+
contradictions,
|
|
4149
|
+
epistemicAudit,
|
|
4150
|
+
epistemicContracts,
|
|
4151
|
+
questionEvidenceLinks,
|
|
4152
|
+
idempotencyTokens,
|
|
4153
|
+
autofixJobs,
|
|
4154
|
+
neo4jSyncQueue,
|
|
4155
|
+
backgroundJobRuns,
|
|
4156
|
+
backgroundJobSettings,
|
|
4157
|
+
systemLogs,
|
|
4158
|
+
crossProjectConnections,
|
|
4159
|
+
graphAnalysisCache,
|
|
4160
|
+
graphAnalysisResults,
|
|
4161
|
+
graphSuggestions,
|
|
4162
|
+
lenses,
|
|
4163
|
+
lensTopicBindings,
|
|
4164
|
+
ontologyDefinitions,
|
|
4165
|
+
ontologyVersions,
|
|
4166
|
+
harnessReplays,
|
|
4167
|
+
harnessRuns,
|
|
4168
|
+
platformAgentRunPolicyDecisions,
|
|
4169
|
+
platformAgentRunPromptResolutions,
|
|
4170
|
+
platformAgentRuns,
|
|
4171
|
+
platformAgentRunToolCalls,
|
|
4172
|
+
platformHarnessShadowAudit,
|
|
4173
|
+
publicationRules,
|
|
4174
|
+
researchJobs,
|
|
4175
|
+
epistemicEdges,
|
|
4176
|
+
epistemicNodes,
|
|
4177
|
+
tasks,
|
|
4178
|
+
topics,
|
|
4179
|
+
workflowDefinitions,
|
|
4180
|
+
workflowPullRequests,
|
|
4181
|
+
workflowStages,
|
|
4182
|
+
worktreeBeliefCluster,
|
|
4183
|
+
worktrees
|
|
4184
|
+
];
|
|
4185
|
+
var IDENTITY_TABLE_CONTRACTS = [
|
|
4186
|
+
agents,
|
|
4187
|
+
reasoningPermissions,
|
|
4188
|
+
modelCallLogs,
|
|
4189
|
+
modelFunctionSlots,
|
|
4190
|
+
modelRegistry,
|
|
4191
|
+
modelSlotConfigs,
|
|
4192
|
+
mcpWritePolicy,
|
|
4193
|
+
platformAudienceGrants,
|
|
4194
|
+
platformAudiences,
|
|
4195
|
+
platformPolicyDecisionLogs,
|
|
4196
|
+
tenantApiKeys,
|
|
4197
|
+
tenantConfig,
|
|
4198
|
+
tenantIntegrations,
|
|
4199
|
+
tenantModelSlotBindings,
|
|
4200
|
+
tenantPolicies,
|
|
4201
|
+
tenantProviderSecrets,
|
|
4202
|
+
tenantProxyGatewayUsage,
|
|
4203
|
+
tenantProxyTokenMints,
|
|
4204
|
+
tenantSandboxAuditEvents,
|
|
4205
|
+
tenantSecrets,
|
|
4206
|
+
toolAcls,
|
|
4207
|
+
toolRegistry,
|
|
4208
|
+
projectGrants,
|
|
4209
|
+
users
|
|
4210
|
+
];
|
|
4211
|
+
var MC_TABLE_CONTRACTS = [
|
|
4212
|
+
groupMemberships,
|
|
4213
|
+
groups,
|
|
4214
|
+
memberships,
|
|
4215
|
+
principals,
|
|
4216
|
+
rateLimitWindows,
|
|
4217
|
+
servicePrincipalKeys,
|
|
4218
|
+
userSessions,
|
|
4219
|
+
methodologyPacks,
|
|
4220
|
+
tenantMethodologyAssignments,
|
|
4221
|
+
packAssignments,
|
|
4222
|
+
packDefinitions,
|
|
4223
|
+
packEntitlements,
|
|
4224
|
+
packGroupAssignments,
|
|
4225
|
+
packInstallations,
|
|
4226
|
+
packVersions,
|
|
4227
|
+
policyBundles,
|
|
4228
|
+
policyDecisionLogs,
|
|
4229
|
+
policySimulations,
|
|
4230
|
+
controlPlaneToolAcls,
|
|
4231
|
+
agentRegistryEntries,
|
|
4232
|
+
toolCatalog,
|
|
4233
|
+
toolRegistryEntries,
|
|
4234
|
+
compatibilityShims,
|
|
4235
|
+
cutoverFlags,
|
|
4236
|
+
tenantDeploymentCredentials,
|
|
4237
|
+
controlPlaneTenantModelSlotBindings,
|
|
4238
|
+
controlPlaneTenantProviderSecrets,
|
|
4239
|
+
controlPlaneTenantProxyGatewayUsage,
|
|
4240
|
+
apiKeys,
|
|
4241
|
+
auditLog,
|
|
4242
|
+
tenants,
|
|
4243
|
+
workspaces
|
|
4244
|
+
];
|
|
4245
|
+
var TABLE_CONTRACTS_BY_COMPONENT = {
|
|
4246
|
+
kernel: KERNEL_TABLE_CONTRACTS,
|
|
4247
|
+
identity: IDENTITY_TABLE_CONTRACTS,
|
|
4248
|
+
mc: MC_TABLE_CONTRACTS,
|
|
4249
|
+
"developer-pack": []
|
|
4250
|
+
};
|
|
4251
|
+
var ALL_TABLE_CONTRACTS = [
|
|
4252
|
+
...KERNEL_TABLE_CONTRACTS,
|
|
4253
|
+
...IDENTITY_TABLE_CONTRACTS,
|
|
4254
|
+
...MC_TABLE_CONTRACTS
|
|
4255
|
+
];
|
|
4256
|
+
function listTableContractsByName(name) {
|
|
4257
|
+
return ALL_TABLE_CONTRACTS.filter((contract) => contract.name === name);
|
|
4258
|
+
}
|
|
4259
|
+
function getTableContract(name, component) {
|
|
4260
|
+
return ALL_TABLE_CONTRACTS.find(
|
|
4261
|
+
(contract) => contract.name === name && (component ? contract.component === component : true)
|
|
4262
|
+
);
|
|
4263
|
+
}
|
|
4264
|
+
var ComponentTableManifestSchema = z.object({
|
|
4265
|
+
manifestVersion: z.string(),
|
|
4266
|
+
componentName: z.enum(["kernel", "identity"]),
|
|
4267
|
+
tier: z.enum(["K", "I"]),
|
|
4268
|
+
packageVersion: z.string(),
|
|
4269
|
+
tables: z.array(
|
|
4270
|
+
z.object({
|
|
4271
|
+
name: z.string(),
|
|
4272
|
+
fields: z.array(
|
|
4273
|
+
z.object({
|
|
4274
|
+
name: z.string(),
|
|
4275
|
+
type: z.string(),
|
|
4276
|
+
optional: z.boolean(),
|
|
4277
|
+
validator: z.string().optional()
|
|
4278
|
+
})
|
|
4279
|
+
)
|
|
4280
|
+
})
|
|
4281
|
+
)
|
|
4282
|
+
});
|
|
4283
|
+
var SL_EPSILON = 1e-9;
|
|
4284
|
+
var SLOpinionInputSchema = z.object({
|
|
4285
|
+
belief: z.number(),
|
|
4286
|
+
disbelief: z.number(),
|
|
4287
|
+
uncertainty: z.number(),
|
|
4288
|
+
baseRate: z.number()
|
|
4289
|
+
}).refine(
|
|
4290
|
+
(o) => Math.abs(o.belief + o.disbelief + o.uncertainty - 1) < SL_EPSILON,
|
|
4291
|
+
{
|
|
4292
|
+
message: "SL invariant b+d+u=1 violated at API boundary"
|
|
4293
|
+
}
|
|
4294
|
+
);
|
|
4295
|
+
|
|
4296
|
+
export { ALL_TABLE_CONTRACTS, ComponentTableManifestSchema, EDGE_TYPE, IDENTITY_TABLE_CONTRACTS, KERNEL_TABLE_CONTRACTS, MC_TABLE_CONTRACTS, NODE_TYPE, SLOpinionInputSchema, TABLE_CONTRACTS_BY_COMPONENT, TOPIC_STATUS, TOPIC_VISIBILITY, getTableContract, listTableContractsByName };
|
|
4297
|
+
//# sourceMappingURL=index.js.map
|
|
4298
|
+
//# sourceMappingURL=index.js.map
|