@lucern/events 0.3.0-alpha.10 → 0.3.0-alpha.11

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/webhooks.js CHANGED
@@ -1,6 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  import { v } from 'convex/values';
3
3
 
4
+ // ../contracts/src/types/reasoning-method.ts
5
+ var REASONING_METHODS = [
6
+ "deductive",
7
+ "inductive",
8
+ "abductive",
9
+ "analogical",
10
+ "causal",
11
+ "correlational",
12
+ "testimonial",
13
+ "statistical",
14
+ "implicit",
15
+ "pattern_match"
16
+ ];
17
+
4
18
  // ../contracts/src/graph-intelligence.contract.ts
5
19
  var GRAPH_INTELLIGENCE_MODE_TOOL_NAMES = {
6
20
  core: [
@@ -692,7 +706,7 @@ defineTable({
692
706
  });
693
707
  defineTable({
694
708
  name: "agents",
695
- component: "identity",
709
+ component: "control-plane",
696
710
  category: "agent",
697
711
  shape: z.object({
698
712
  "slug": z.string(),
@@ -723,6 +737,7 @@ defineTable({
723
737
  category: "tenant",
724
738
  shape: z.object({
725
739
  "tenantId": idOf("tenants"),
740
+ "workspaceId": idOf("workspaces").optional(),
726
741
  "keyPrefix": z.enum(["luc", "stk"]),
727
742
  "keyHash": z.string(),
728
743
  "keyHint": z.string(),
@@ -750,7 +765,7 @@ defineTable({
750
765
  shape: z.object({
751
766
  "tenantId": idOf("tenants").optional(),
752
767
  "apiKeyId": idOf("apiKeys").optional(),
753
- "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"]),
768
+ "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_token_lease_issued", "proxy_token_lease_renewed", "proxy_token_lease_revoked", "proxy_request_recorded", "tenant_created", "tenant_updated", "tenant_suspended", "tenant_archived", "tenant_reactivated", "principal_created", "principal_updated", "principal_suspended", "principal_identity_alias_upserted", "principal_identity_alias_revoked", "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", "deployment_host_registered", "deployment_host_revoked", "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", "permit_sync_enqueued", "permit_sync_succeeded", "permit_sync_failed", "permit_sync_skipped", "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"]),
754
769
  "actorClerkId": z.string(),
755
770
  "details": z.any().optional(),
756
771
  "createdAt": z.number()
@@ -1629,29 +1644,37 @@ defineTable({
1629
1644
  component: "mc",
1630
1645
  category: "runtime",
1631
1646
  shape: z.object({
1632
- "shimId": z.string(),
1633
- "gateId": z.string(),
1634
- "removalDate": z.string(),
1635
- "removalPriority": z.enum(["P1", "P2", "P3"]),
1636
- "description": z.string(),
1637
- "owner": z.string(),
1638
- "createdAt": z.string(),
1639
- "status": z.enum(["active", "overdue", "removed"]),
1640
- "bridgeType": z.enum(["tool", "agent"]),
1641
- "bridgeTarget": z.object({
1642
- "type": z.enum(["tool", "agent"]),
1643
- "legacyPath": z.string(),
1644
- "harnessPath": z.string()
1647
+ shimId: z.string(),
1648
+ gateId: z.string(),
1649
+ removalDate: z.string(),
1650
+ removalPriority: z.enum(["P1", "P2", "P3"]),
1651
+ description: z.string(),
1652
+ owner: z.string(),
1653
+ createdAt: z.string(),
1654
+ status: z.enum(["active", "overdue", "removed"]),
1655
+ bridgeType: z.enum(["tool", "agent"]),
1656
+ bridgeTarget: z.object({
1657
+ type: z.enum(["tool", "agent"]),
1658
+ legacyPath: z.string(),
1659
+ harnessPath: z.string()
1645
1660
  }),
1646
- "shimBehavior": z.enum(["passthrough_with_logging", "adapter", "feature_flag_gate"]),
1647
- "producesLedgerEntries": z.boolean(),
1648
- "lastAuditedAt": z.number(),
1649
- "metadata": z.record(z.any()).optional()
1661
+ shimBehavior: z.enum([
1662
+ "passthrough_with_logging",
1663
+ "adapter",
1664
+ "feature_flag_gate"
1665
+ ]),
1666
+ producesLedgerEntries: z.boolean(),
1667
+ lastAuditedAt: z.number(),
1668
+ metadata: z.record(z.any()).optional()
1650
1669
  }),
1651
1670
  indices: [
1652
1671
  { kind: "index", name: "by_shimId", columns: ["shimId"] },
1653
1672
  { kind: "index", name: "by_status", columns: ["status"] },
1654
- { kind: "index", name: "by_bridgeType_status", columns: ["bridgeType", "status"] }
1673
+ {
1674
+ kind: "index",
1675
+ name: "by_bridgeType_status",
1676
+ columns: ["bridgeType", "status"]
1677
+ }
1655
1678
  ]
1656
1679
  });
1657
1680
  defineTable({
@@ -1659,12 +1682,23 @@ defineTable({
1659
1682
  component: "mc",
1660
1683
  category: "runtime",
1661
1684
  shape: z.object({
1662
- "domain": z.enum(["graph", "schema", "identity", "policy", "audit", "admin", "agent", "tool", "prompt", "intelligence"]),
1663
- "state": z.enum(["legacy", "cutover", "disabled"]),
1664
- "metadata": z.record(z.any()).optional(),
1665
- "updatedBy": z.string(),
1666
- "createdAt": z.number(),
1667
- "updatedAt": z.number()
1685
+ domain: z.enum([
1686
+ "graph",
1687
+ "schema",
1688
+ "identity",
1689
+ "policy",
1690
+ "audit",
1691
+ "admin",
1692
+ "agent",
1693
+ "tool",
1694
+ "prompt",
1695
+ "intelligence"
1696
+ ]),
1697
+ state: z.enum(["legacy", "cutover", "disabled"]),
1698
+ metadata: z.record(z.any()).optional(),
1699
+ updatedBy: z.string(),
1700
+ createdAt: z.number(),
1701
+ updatedAt: z.number()
1668
1702
  }),
1669
1703
  indices: [
1670
1704
  { kind: "index", name: "by_domain", columns: ["domain"] },
@@ -1676,57 +1710,193 @@ defineTable({
1676
1710
  component: "mc",
1677
1711
  category: "runtime",
1678
1712
  shape: z.object({
1679
- "credentialRef": z.string(),
1680
- "tenantId": idOf("tenants"),
1681
- "target": z.enum(["kernelDeployment", "appDeployment"]),
1682
- "environment": z.enum(["dev", "staging", "prod"]),
1683
- "encryptedDeployKey": z.string(),
1684
- "encryptionVersion": z.string(),
1685
- "keyFingerprint": z.string(),
1686
- "keyHint": z.string(),
1687
- "status": z.enum(["active", "revoked"]),
1688
- "rotatedFromCredentialRef": z.string().optional(),
1689
- "revokedAt": z.number().optional(),
1690
- "revokedBy": z.string().optional(),
1691
- "lastUsedAt": z.number().optional(),
1692
- "metadata": z.record(z.any()).optional(),
1693
- "createdBy": z.string(),
1694
- "createdAt": z.number(),
1695
- "updatedAt": z.number()
1713
+ credentialRef: z.string(),
1714
+ tenantId: idOf("tenants"),
1715
+ workspaceId: idOf("workspaces").optional(),
1716
+ target: z.enum(["kernelDeployment", "appDeployment"]),
1717
+ environment: z.enum(["dev", "staging", "prod"]),
1718
+ encryptedDeployKey: z.string(),
1719
+ encryptionVersion: z.string(),
1720
+ keyFingerprint: z.string(),
1721
+ keyHint: z.string(),
1722
+ status: z.enum(["active", "revoked"]),
1723
+ rotatedFromCredentialRef: z.string().optional(),
1724
+ revokedAt: z.number().optional(),
1725
+ revokedBy: z.string().optional(),
1726
+ lastUsedAt: z.number().optional(),
1727
+ metadata: z.record(z.any()).optional(),
1728
+ createdBy: z.string(),
1729
+ createdAt: z.number(),
1730
+ updatedAt: z.number()
1696
1731
  }),
1697
1732
  indices: [
1698
1733
  { kind: "index", name: "by_credentialRef", columns: ["credentialRef"] },
1699
1734
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1700
- { kind: "index", name: "by_tenant_target", columns: ["tenantId", "target"] },
1701
- { kind: "index", name: "by_tenant_target_environment", columns: ["tenantId", "target", "environment"] },
1702
- { kind: "index", name: "by_tenant_target_environment_status", columns: ["tenantId", "target", "environment", "status"] },
1735
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
1736
+ {
1737
+ kind: "index",
1738
+ name: "by_tenant_target",
1739
+ columns: ["tenantId", "target"]
1740
+ },
1741
+ {
1742
+ kind: "index",
1743
+ name: "by_tenant_target_environment",
1744
+ columns: ["tenantId", "target", "environment"]
1745
+ },
1746
+ {
1747
+ kind: "index",
1748
+ name: "by_tenant_target_environment_status",
1749
+ columns: ["tenantId", "target", "environment", "status"]
1750
+ },
1751
+ {
1752
+ kind: "index",
1753
+ name: "by_tenant_workspace_target_environment_status",
1754
+ columns: ["tenantId", "workspaceId", "target", "environment", "status"]
1755
+ },
1703
1756
  { kind: "index", name: "by_status", columns: ["status"] }
1704
1757
  ]
1705
1758
  });
1759
+ defineTable({
1760
+ name: "permitSyncStates",
1761
+ component: "mc",
1762
+ category: "runtime",
1763
+ shape: z.object({
1764
+ syncKey: z.string(),
1765
+ objectType: z.enum([
1766
+ "resource",
1767
+ "role",
1768
+ "resource_role",
1769
+ "resource_relation",
1770
+ "tenant",
1771
+ "workspace",
1772
+ "principal",
1773
+ "membership",
1774
+ "group",
1775
+ "resource_instance",
1776
+ "relationship_tuple",
1777
+ "role_assignment"
1778
+ ]),
1779
+ objectId: z.string(),
1780
+ tenantId: idOf("tenants").optional(),
1781
+ workspaceId: idOf("workspaces").optional(),
1782
+ principalId: z.string().optional(),
1783
+ permitTenantKey: z.string().optional(),
1784
+ permitResourceType: z.string().optional(),
1785
+ permitResourceKey: z.string().optional(),
1786
+ desiredPayload: z.record(z.any()),
1787
+ lastAppliedPayloadHash: z.string().optional(),
1788
+ status: z.enum(["pending", "synced", "error", "skipped"]),
1789
+ attemptCount: z.number(),
1790
+ lastError: z.string().optional(),
1791
+ nextAttemptAt: z.number().optional(),
1792
+ lastSyncedAt: z.number().optional(),
1793
+ createdBy: z.string(),
1794
+ updatedBy: z.string().optional(),
1795
+ createdAt: z.number(),
1796
+ updatedAt: z.number()
1797
+ }),
1798
+ indices: [
1799
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
1800
+ { kind: "index", name: "by_status", columns: ["status"] },
1801
+ {
1802
+ kind: "index",
1803
+ name: "by_tenant_status",
1804
+ columns: ["tenantId", "status"]
1805
+ },
1806
+ {
1807
+ kind: "index",
1808
+ name: "by_workspace_status",
1809
+ columns: ["workspaceId", "status"]
1810
+ },
1811
+ {
1812
+ kind: "index",
1813
+ name: "by_principal_status",
1814
+ columns: ["principalId", "status"]
1815
+ }
1816
+ ]
1817
+ });
1818
+ defineTable({
1819
+ name: "secretSyncDriftReports",
1820
+ component: "mc",
1821
+ category: "runtime",
1822
+ shape: z.object({
1823
+ reportId: z.string(),
1824
+ source: z.enum(["infisical_manifest", "manual", "ci"]),
1825
+ generatedAt: z.number(),
1826
+ recordedAt: z.number(),
1827
+ recordedBy: z.string(),
1828
+ status: z.enum([
1829
+ "in_sync",
1830
+ "drift",
1831
+ "exception",
1832
+ "blocked",
1833
+ "not_observed"
1834
+ ]),
1835
+ reportHash: z.string(),
1836
+ manifestHash: z.string().optional(),
1837
+ dryRunReceiptId: z.string().optional(),
1838
+ appliedReceiptId: z.string().optional(),
1839
+ summary: z.object({
1840
+ totalPipelines: z.number(),
1841
+ inSync: z.number(),
1842
+ drift: z.number(),
1843
+ exception: z.number(),
1844
+ blocked: z.number(),
1845
+ notObserved: z.number(),
1846
+ missingKeys: z.number(),
1847
+ valueDriftKeys: z.number(),
1848
+ extraKeys: z.number(),
1849
+ deniedConvexLeakage: z.number(),
1850
+ approvedExceptions: z.number()
1851
+ }),
1852
+ redactedReport: z.record(z.any()),
1853
+ metadata: z.record(z.any()).optional()
1854
+ }),
1855
+ indices: [
1856
+ { kind: "index", name: "by_reportId", columns: ["reportId"] },
1857
+ { kind: "index", name: "by_reportHash", columns: ["reportHash"] },
1858
+ { kind: "index", name: "by_generatedAt", columns: ["generatedAt"] },
1859
+ {
1860
+ kind: "index",
1861
+ name: "by_status_generatedAt",
1862
+ columns: ["status", "generatedAt"]
1863
+ }
1864
+ ]
1865
+ });
1706
1866
  defineTable({
1707
1867
  name: "controlPlaneTenantModelSlotBindings",
1708
1868
  component: "mc",
1709
1869
  category: "runtime",
1710
1870
  shape: z.object({
1711
- "bindingId": z.string(),
1712
- "tenantId": idOf("tenants"),
1713
- "providerId": z.string(),
1714
- "modelSlotId": z.string(),
1715
- "secretRef": z.string(),
1716
- "status": z.enum(["active", "revoked"]),
1717
- "passThroughOnly": z.boolean(),
1718
- "revokedAt": z.number().optional(),
1719
- "revokedBy": z.string().optional(),
1720
- "metadata": z.record(z.any()).optional(),
1721
- "createdBy": z.string(),
1722
- "createdAt": z.number(),
1723
- "updatedAt": z.number()
1871
+ bindingId: z.string(),
1872
+ tenantId: idOf("tenants"),
1873
+ workspaceId: idOf("workspaces").optional(),
1874
+ environment: z.enum(["dev", "staging", "prod"]).optional(),
1875
+ providerId: z.string(),
1876
+ modelSlotId: z.string(),
1877
+ secretRef: z.string(),
1878
+ status: z.enum(["active", "revoked"]),
1879
+ passThroughOnly: z.boolean(),
1880
+ revokedAt: z.number().optional(),
1881
+ revokedBy: z.string().optional(),
1882
+ metadata: z.record(z.any()).optional(),
1883
+ createdBy: z.string(),
1884
+ createdAt: z.number(),
1885
+ updatedAt: z.number()
1724
1886
  }),
1725
1887
  indices: [
1726
1888
  { kind: "index", name: "by_bindingId", columns: ["bindingId"] },
1727
1889
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1728
- { kind: "index", name: "by_tenant_slot", columns: ["tenantId", "modelSlotId"] },
1729
- { kind: "index", name: "by_tenant_provider_slot", columns: ["tenantId", "providerId", "modelSlotId"] },
1890
+ {
1891
+ kind: "index",
1892
+ name: "by_tenant_slot",
1893
+ columns: ["tenantId", "modelSlotId"]
1894
+ },
1895
+ {
1896
+ kind: "index",
1897
+ name: "by_tenant_provider_slot",
1898
+ columns: ["tenantId", "providerId", "modelSlotId"]
1899
+ },
1730
1900
  { kind: "index", name: "by_secretRef", columns: ["secretRef"] },
1731
1901
  { kind: "index", name: "by_status", columns: ["status"] }
1732
1902
  ]
@@ -1736,29 +1906,42 @@ defineTable({
1736
1906
  component: "mc",
1737
1907
  category: "runtime",
1738
1908
  shape: z.object({
1739
- "secretRef": z.string(),
1740
- "tenantId": idOf("tenants"),
1741
- "providerId": z.string(),
1742
- "label": z.string().optional(),
1743
- "encryptedSecret": z.string(),
1744
- "encryptionVersion": z.string(),
1745
- "secretFingerprint": z.string(),
1746
- "keyHint": z.string(),
1747
- "status": z.enum(["active", "revoked"]),
1748
- "rotatedFromSecretRef": z.string().optional(),
1749
- "revokedAt": z.number().optional(),
1750
- "revokedBy": z.string().optional(),
1751
- "lastUsedAt": z.number().optional(),
1752
- "metadata": z.record(z.any()).optional(),
1753
- "createdBy": z.string(),
1754
- "createdAt": z.number(),
1755
- "updatedAt": z.number()
1909
+ secretRef: z.string(),
1910
+ tenantId: idOf("tenants"),
1911
+ workspaceId: idOf("workspaces").optional(),
1912
+ environment: z.enum(["dev", "staging", "prod"]).optional(),
1913
+ providerId: z.string(),
1914
+ label: z.string().optional(),
1915
+ encryptedSecret: z.string().optional(),
1916
+ infisicalPath: z.string().optional(),
1917
+ infisicalSecretKey: z.string().optional(),
1918
+ infisicalProjectId: z.string().optional(),
1919
+ encryptionVersion: z.string(),
1920
+ secretFingerprint: z.string(),
1921
+ keyHint: z.string(),
1922
+ status: z.enum(["active", "revoked"]),
1923
+ rotatedFromSecretRef: z.string().optional(),
1924
+ revokedAt: z.number().optional(),
1925
+ revokedBy: z.string().optional(),
1926
+ lastUsedAt: z.number().optional(),
1927
+ metadata: z.record(z.any()).optional(),
1928
+ createdBy: z.string(),
1929
+ createdAt: z.number(),
1930
+ updatedAt: z.number()
1756
1931
  }),
1757
1932
  indices: [
1758
1933
  { kind: "index", name: "by_secretRef", columns: ["secretRef"] },
1759
1934
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1760
- { kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId"] },
1761
- { kind: "index", name: "by_tenant_provider_status", columns: ["tenantId", "providerId", "status"] },
1935
+ {
1936
+ kind: "index",
1937
+ name: "by_tenant_provider",
1938
+ columns: ["tenantId", "providerId"]
1939
+ },
1940
+ {
1941
+ kind: "index",
1942
+ name: "by_tenant_provider_status",
1943
+ columns: ["tenantId", "providerId", "status"]
1944
+ },
1762
1945
  { kind: "index", name: "by_status", columns: ["status"] }
1763
1946
  ]
1764
1947
  });
@@ -1767,35 +1950,93 @@ defineTable({
1767
1950
  component: "mc",
1768
1951
  category: "runtime",
1769
1952
  shape: z.object({
1770
- "usageId": z.string(),
1771
- "tenantId": idOf("tenants"),
1772
- "providerId": z.string(),
1773
- "modelSlotId": z.string(),
1774
- "secretRef": z.string(),
1775
- "proxyTokenId": z.string(),
1776
- "sessionId": z.string(),
1777
- "principalId": z.string(),
1778
- "workspaceId": z.string().optional(),
1779
- "modelId": z.string().optional(),
1780
- "requestPath": z.string(),
1781
- "status": z.enum(["success", "error"]),
1782
- "responseStatus": z.number().optional(),
1783
- "inputTokens": z.number().optional(),
1784
- "outputTokens": z.number().optional(),
1785
- "tokenCount": z.number().optional(),
1786
- "latencyMs": z.number(),
1787
- "estimatedCostUsd": z.number().optional(),
1788
- "failureCode": z.string().optional(),
1789
- "metadata": z.record(z.any()).optional(),
1790
- "createdAt": z.number(),
1791
- "updatedAt": z.number()
1953
+ usageId: z.string(),
1954
+ tenantId: idOf("tenants"),
1955
+ providerId: z.string(),
1956
+ modelSlotId: z.string(),
1957
+ secretRef: z.string(),
1958
+ proxyTokenId: z.string(),
1959
+ sessionId: z.string(),
1960
+ principalId: z.string(),
1961
+ workspaceId: z.string().optional(),
1962
+ modelId: z.string().optional(),
1963
+ requestPath: z.string(),
1964
+ status: z.enum(["success", "error"]),
1965
+ responseStatus: z.number().optional(),
1966
+ inputTokens: z.number().optional(),
1967
+ outputTokens: z.number().optional(),
1968
+ tokenCount: z.number().optional(),
1969
+ latencyMs: z.number(),
1970
+ estimatedCostUsd: z.number().optional(),
1971
+ failureCode: z.string().optional(),
1972
+ metadata: z.record(z.any()).optional(),
1973
+ createdAt: z.number(),
1974
+ updatedAt: z.number()
1792
1975
  }),
1793
1976
  indices: [
1794
1977
  { kind: "index", name: "by_usageId", columns: ["usageId"] },
1795
1978
  { kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
1796
- { kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId", "createdAt"] },
1797
- { kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId", "createdAt"] },
1798
- { kind: "index", name: "by_sessionId", columns: ["sessionId", "createdAt"] }
1979
+ {
1980
+ kind: "index",
1981
+ name: "by_tenant_provider",
1982
+ columns: ["tenantId", "providerId", "createdAt"]
1983
+ },
1984
+ {
1985
+ kind: "index",
1986
+ name: "by_proxyTokenId",
1987
+ columns: ["proxyTokenId", "createdAt"]
1988
+ },
1989
+ {
1990
+ kind: "index",
1991
+ name: "by_sessionId",
1992
+ columns: ["sessionId", "createdAt"]
1993
+ }
1994
+ ]
1995
+ });
1996
+ defineTable({
1997
+ name: "controlPlaneTenantProxyTokenLeases",
1998
+ component: "mc",
1999
+ category: "runtime",
2000
+ shape: z.object({
2001
+ leaseId: z.string(),
2002
+ proxyTokenId: z.string(),
2003
+ tenantId: idOf("tenants"),
2004
+ workspaceId: idOf("workspaces").optional(),
2005
+ environment: z.enum(["dev", "staging", "prod"]),
2006
+ providerId: z.string(),
2007
+ modelSlotId: z.string(),
2008
+ bindingId: z.string(),
2009
+ secretRef: z.string(),
2010
+ sessionId: z.string(),
2011
+ principalId: z.string(),
2012
+ agentSessionId: z.string().optional(),
2013
+ status: z.enum(["active", "revoked"]),
2014
+ expiresAt: z.number(),
2015
+ renewedAt: z.number().optional(),
2016
+ revokedAt: z.number().optional(),
2017
+ revokedBy: z.string().optional(),
2018
+ revokeReason: z.string().optional(),
2019
+ permitDecisionLogId: idOf("policyDecisionLogs").optional(),
2020
+ permitTraceId: z.string().optional(),
2021
+ metadata: z.record(z.any()).optional(),
2022
+ createdAt: z.number(),
2023
+ updatedAt: z.number()
2024
+ }),
2025
+ indices: [
2026
+ { kind: "index", name: "by_leaseId", columns: ["leaseId"] },
2027
+ { kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId"] },
2028
+ { kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
2029
+ { kind: "index", name: "by_sessionId", columns: ["sessionId", "createdAt"] },
2030
+ {
2031
+ kind: "index",
2032
+ name: "by_principalId",
2033
+ columns: ["principalId", "createdAt"]
2034
+ },
2035
+ {
2036
+ kind: "index",
2037
+ name: "by_status_expiresAt",
2038
+ columns: ["status", "expiresAt"]
2039
+ }
1799
2040
  ]
1800
2041
  });
1801
2042
  defineTable({
@@ -2128,6 +2369,7 @@ defineTable({
2128
2369
  "questionType": z.enum(["validation", "falsification", "assumption_probe", "prediction_test", "counterfactual", "discovery", "clarification", "comparison", "causal", "mechanism", "general"]).optional(),
2129
2370
  "questionPriority": z.enum(["critical", "high", "medium", "low"]).optional(),
2130
2371
  "answerQuality": z.enum(["definitive", "strong", "moderate", "weak", "speculative", "unanswered"]).optional(),
2372
+ "themeStatus": z.enum(["emerging", "active", "mature", "declining", "archived"]).optional(),
2131
2373
  "themeConviction": z.enum(["high", "medium", "low", "negative"]).optional(),
2132
2374
  "decisionType": z.enum(["invest", "pass", "follow_on", "exit", "deep_dive", "monitor", "deprioritize", "thesis_adopt", "thesis_revise", "thesis_abandon"]).optional(),
2133
2375
  "decisionOutcome": z.enum(["pending", "successful", "unsuccessful", "mixed", "unknown"]).optional(),
@@ -2278,6 +2520,7 @@ defineTable({
2278
2520
  indices: [
2279
2521
  { kind: "index", name: "by_principalId", columns: ["principalId"] },
2280
2522
  { kind: "index", name: "by_principal_tenant", columns: ["principalId", "tenantId"] },
2523
+ { kind: "index", name: "by_principal_tenant_workspace", columns: ["principalId", "tenantId", "workspaceId"] },
2281
2524
  { kind: "index", name: "by_workspace_principal", columns: ["workspaceId", "principalId"] },
2282
2525
  { kind: "index", name: "by_tenant_role", columns: ["tenantId", "role"] },
2283
2526
  { kind: "index", name: "by_status", columns: ["status"] }
@@ -2309,6 +2552,36 @@ defineTable({
2309
2552
  { kind: "index", name: "by_status", columns: ["status"] }
2310
2553
  ]
2311
2554
  });
2555
+ defineTable({
2556
+ name: "principalIdentityAliases",
2557
+ component: "mc",
2558
+ category: "identity",
2559
+ shape: z.object({
2560
+ "principalId": z.string(),
2561
+ "principalRefId": idOf("principals").optional(),
2562
+ "provider": z.string(),
2563
+ "providerProjectId": z.string().optional(),
2564
+ "externalSubjectId": z.string(),
2565
+ "tenantId": idOf("tenants").optional(),
2566
+ "workspaceId": idOf("workspaces").optional(),
2567
+ "email": z.string().optional(),
2568
+ "status": z.enum(["active", "revoked"]),
2569
+ "metadata": z.record(z.any()).optional(),
2570
+ "createdBy": z.string(),
2571
+ "revokedAt": z.number().optional(),
2572
+ "revokedBy": z.string().optional(),
2573
+ "createdAt": z.number(),
2574
+ "updatedAt": z.number()
2575
+ }),
2576
+ indices: [
2577
+ { kind: "index", name: "by_provider_subject", columns: ["provider", "externalSubjectId"] },
2578
+ { kind: "index", name: "by_provider_project_subject", columns: ["provider", "providerProjectId", "externalSubjectId"] },
2579
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
2580
+ { kind: "index", name: "by_principal_status", columns: ["principalId", "status"] },
2581
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "externalSubjectId"] },
2582
+ { kind: "index", name: "by_workspace_provider_subject", columns: ["workspaceId", "provider", "externalSubjectId"] }
2583
+ ]
2584
+ });
2312
2585
  defineTable({
2313
2586
  name: "rateLimitWindows",
2314
2587
  component: "mc",
@@ -2898,7 +3171,7 @@ defineTable({
2898
3171
  });
2899
3172
  defineTable({
2900
3173
  name: "mcpWritePolicy",
2901
- component: "identity",
3174
+ component: "control-plane",
2902
3175
  category: "platform",
2903
3176
  shape: z.object({
2904
3177
  "topicId": z.string().optional(),
@@ -2921,7 +3194,7 @@ defineTable({
2921
3194
  });
2922
3195
  defineTable({
2923
3196
  name: "platformAudienceGrants",
2924
- component: "identity",
3197
+ component: "control-plane",
2925
3198
  category: "platform",
2926
3199
  shape: z.object({
2927
3200
  "tenantId": z.string(),
@@ -2947,7 +3220,7 @@ defineTable({
2947
3220
  });
2948
3221
  defineTable({
2949
3222
  name: "platformAudiences",
2950
- component: "identity",
3223
+ component: "control-plane",
2951
3224
  category: "platform",
2952
3225
  shape: z.object({
2953
3226
  "tenantId": z.string(),
@@ -2972,7 +3245,7 @@ defineTable({
2972
3245
  });
2973
3246
  defineTable({
2974
3247
  name: "platformPolicyDecisionLogs",
2975
- component: "identity",
3248
+ component: "control-plane",
2976
3249
  category: "platform",
2977
3250
  shape: z.object({
2978
3251
  "principalId": z.string(),
@@ -3008,7 +3281,7 @@ defineTable({
3008
3281
  });
3009
3282
  defineTable({
3010
3283
  name: "tenantApiKeys",
3011
- component: "identity",
3284
+ component: "control-plane",
3012
3285
  category: "platform",
3013
3286
  shape: z.object({
3014
3287
  "tenantId": z.string(),
@@ -3035,7 +3308,7 @@ defineTable({
3035
3308
  });
3036
3309
  defineTable({
3037
3310
  name: "tenantConfig",
3038
- component: "identity",
3311
+ component: "control-plane",
3039
3312
  category: "platform",
3040
3313
  shape: z.object({
3041
3314
  "tenantId": z.string(),
@@ -3054,7 +3327,7 @@ defineTable({
3054
3327
  });
3055
3328
  defineTable({
3056
3329
  name: "tenantIntegrations",
3057
- component: "identity",
3330
+ component: "control-plane",
3058
3331
  category: "platform",
3059
3332
  shape: z.object({
3060
3333
  "tenantId": z.string(),
@@ -3109,7 +3382,7 @@ defineTable({
3109
3382
  });
3110
3383
  defineTable({
3111
3384
  name: "tenantModelSlotBindings",
3112
- component: "identity",
3385
+ component: "control-plane",
3113
3386
  category: "platform",
3114
3387
  shape: z.object({
3115
3388
  "bindingId": z.string(),
@@ -3137,7 +3410,7 @@ defineTable({
3137
3410
  });
3138
3411
  defineTable({
3139
3412
  name: "tenantPolicies",
3140
- component: "identity",
3413
+ component: "control-plane",
3141
3414
  category: "platform",
3142
3415
  shape: z.object({
3143
3416
  "tenantId": z.string(),
@@ -3162,7 +3435,7 @@ defineTable({
3162
3435
  });
3163
3436
  defineTable({
3164
3437
  name: "tenantProviderSecrets",
3165
- component: "identity",
3438
+ component: "control-plane",
3166
3439
  category: "platform",
3167
3440
  shape: z.object({
3168
3441
  "secretRef": z.string(),
@@ -3193,7 +3466,7 @@ defineTable({
3193
3466
  });
3194
3467
  defineTable({
3195
3468
  name: "tenantProxyGatewayUsage",
3196
- component: "identity",
3469
+ component: "control-plane",
3197
3470
  category: "platform",
3198
3471
  shape: z.object({
3199
3472
  "usageId": z.string(),
@@ -3228,7 +3501,7 @@ defineTable({
3228
3501
  });
3229
3502
  defineTable({
3230
3503
  name: "tenantProxyTokenMints",
3231
- component: "identity",
3504
+ component: "control-plane",
3232
3505
  category: "platform",
3233
3506
  shape: z.object({
3234
3507
  "proxyTokenId": z.string(),
@@ -3251,7 +3524,7 @@ defineTable({
3251
3524
  });
3252
3525
  defineTable({
3253
3526
  name: "tenantSandboxAuditEvents",
3254
- component: "identity",
3527
+ component: "control-plane",
3255
3528
  category: "platform",
3256
3529
  shape: z.object({
3257
3530
  "eventId": z.string(),
@@ -3285,7 +3558,7 @@ defineTable({
3285
3558
  });
3286
3559
  defineTable({
3287
3560
  name: "tenantSecrets",
3288
- component: "identity",
3561
+ component: "control-plane",
3289
3562
  category: "platform",
3290
3563
  shape: z.object({
3291
3564
  "tenantId": z.string(),
@@ -3307,7 +3580,7 @@ defineTable({
3307
3580
  });
3308
3581
  defineTable({
3309
3582
  name: "toolAcls",
3310
- component: "identity",
3583
+ component: "control-plane",
3311
3584
  category: "platform",
3312
3585
  shape: z.object({
3313
3586
  "role": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]),
@@ -3322,7 +3595,7 @@ defineTable({
3322
3595
  });
3323
3596
  defineTable({
3324
3597
  name: "toolRegistry",
3325
- component: "identity",
3598
+ component: "control-plane",
3326
3599
  category: "platform",
3327
3600
  shape: z.object({
3328
3601
  "toolName": z.string(),
@@ -3403,7 +3676,7 @@ defineTable({
3403
3676
  });
3404
3677
  defineTable({
3405
3678
  name: "modelCallLogs",
3406
- component: "identity",
3679
+ component: "control-plane",
3407
3680
  category: "model",
3408
3681
  shape: z.object({
3409
3682
  "slot": z.string(),
@@ -3429,7 +3702,7 @@ defineTable({
3429
3702
  });
3430
3703
  defineTable({
3431
3704
  name: "modelFunctionSlots",
3432
- component: "identity",
3705
+ component: "control-plane",
3433
3706
  category: "model",
3434
3707
  shape: z.object({
3435
3708
  "slot": z.string(),
@@ -3454,7 +3727,7 @@ defineTable({
3454
3727
  });
3455
3728
  defineTable({
3456
3729
  name: "modelRegistry",
3457
- component: "identity",
3730
+ component: "control-plane",
3458
3731
  category: "model",
3459
3732
  shape: z.object({
3460
3733
  "key": z.string(),
@@ -3481,7 +3754,7 @@ defineTable({
3481
3754
  });
3482
3755
  defineTable({
3483
3756
  name: "modelSlotConfigs",
3484
- component: "identity",
3757
+ component: "control-plane",
3485
3758
  category: "model",
3486
3759
  shape: z.object({
3487
3760
  "slot": z.string(),
@@ -3868,7 +4141,7 @@ defineTable({
3868
4141
  "workspaceId": idOf("workspaces").optional(),
3869
4142
  "resourceType": z.string(),
3870
4143
  "resourceId": z.string(),
3871
- "action": z.enum(["read", "summarize", "export", "mutate", "admin", "comment", "escalate", "resolve", "vote"]),
4144
+ "action": z.enum(["read", "summarize", "export", "mutate", "admin", "comment", "escalate", "resolve", "vote", "route", "invoke", "manage", "deploy", "promote", "rollback", "audit", "read_ref", "fetch_value", "rotate", "administer", "mint", "delegate", "revoke"]),
3872
4145
  "decision": z.enum(["allow", "deny"]),
3873
4146
  "reasonCode": z.string(),
3874
4147
  "policyVersion": z.string(),
@@ -3930,7 +4203,7 @@ defineTable({
3930
4203
  });
3931
4204
  defineTable({
3932
4205
  name: "projectGrants",
3933
- component: "identity",
4206
+ component: "control-plane",
3934
4207
  category: "project",
3935
4208
  shape: z.object({
3936
4209
  "projectId": z.string().optional(),
@@ -3962,9 +4235,648 @@ defineTable({
3962
4235
  { kind: "index", name: "by_topic_cluster_status", columns: ["topicId", "beliefClusterId", "status"] }
3963
4236
  ]
3964
4237
  });
4238
+ var permitActorType = z.enum([
4239
+ "human",
4240
+ "agent",
4241
+ "service_principal",
4242
+ "external_stakeholder",
4243
+ "system"
4244
+ ]);
4245
+ var permitMembershipStatus = z.enum([
4246
+ "active",
4247
+ "invited",
4248
+ "revoked",
4249
+ "suspended",
4250
+ "disabled"
4251
+ ]);
4252
+ var permitDecision = z.enum(["allow", "deny"]);
4253
+ var permitAccessReviewStatus = z.enum([
4254
+ "open",
4255
+ "in_progress",
4256
+ "approved",
4257
+ "denied",
4258
+ "expired",
4259
+ "cancelled"
4260
+ ]);
4261
+ var permitReviewScope = z.enum([
4262
+ "tenant",
4263
+ "workspace",
4264
+ "resource_instance",
4265
+ "group",
4266
+ "principal",
4267
+ "api_key",
4268
+ "admin_action"
4269
+ ]);
4270
+ var permitRecordStatus = z.enum([
4271
+ "queued",
4272
+ "inflight",
4273
+ "completed",
4274
+ "failed",
4275
+ "skipped",
4276
+ "stale"
4277
+ ]);
4278
+ var permitObjectType = z.enum([
4279
+ "resource",
4280
+ "role",
4281
+ "resource_role",
4282
+ "resource_relation",
4283
+ "tenant",
4284
+ "workspace",
4285
+ "principal",
4286
+ "membership",
4287
+ "group",
4288
+ "resource_instance",
4289
+ "relationship_tuple",
4290
+ "role_assignment"
4291
+ ]);
4292
+ var permitOutboxOperation = z.enum([
4293
+ "upsert",
4294
+ "delete",
4295
+ "sync",
4296
+ "resync",
4297
+ "delete_sync",
4298
+ "noop"
4299
+ ]);
4300
+ var permitPolicyBundleStatus = z.enum([
4301
+ "draft",
4302
+ "validated",
4303
+ "enforced",
4304
+ "archived"
4305
+ ]);
4306
+ var permitSyncStatus = z.enum([
4307
+ "pending",
4308
+ "synced",
4309
+ "error",
4310
+ "skipped"
4311
+ ]);
4312
+ var permitAccessReviewSubjectType = z.enum([
4313
+ "principal",
4314
+ "group",
4315
+ "role_assignment",
4316
+ "resource_instance"
4317
+ ]);
4318
+ var permitAttributeType = z.enum([
4319
+ "string",
4320
+ "number",
4321
+ "bool",
4322
+ "json",
4323
+ "time"
4324
+ ]);
4325
+ var permitAttributeOperator = z.enum([
4326
+ "eq",
4327
+ "neq",
4328
+ "in",
4329
+ "not_in",
4330
+ "gt",
4331
+ "gte",
4332
+ "lt",
4333
+ "lte",
4334
+ "contains",
4335
+ "not_contains",
4336
+ "matches"
4337
+ ]);
4338
+ var permitRoleBindingTarget = z.enum([
4339
+ "principal",
4340
+ "group"
4341
+ ]);
4342
+ defineTable({
4343
+ name: "permitPrincipals",
4344
+ component: "control-plane",
4345
+ category: "access-control",
4346
+ shape: z.object({
4347
+ principalId: z.string(),
4348
+ tenantId: z.string(),
4349
+ workspaceId: z.optional(z.string()),
4350
+ principalType: permitActorType,
4351
+ status: permitMembershipStatus,
4352
+ displayName: z.string().optional(),
4353
+ metadata: z.record(z.any()).optional(),
4354
+ createdBy: z.string(),
4355
+ createdAt: z.number(),
4356
+ updatedAt: z.number(),
4357
+ updatedBy: z.string().optional(),
4358
+ lastSeenAt: z.number().optional()
4359
+ }),
4360
+ indices: [
4361
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4362
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4363
+ { kind: "index", name: "by_tenant_principalId", columns: ["tenantId", "principalId"] },
4364
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4365
+ {
4366
+ kind: "index",
4367
+ name: "by_tenant_principalType_status",
4368
+ columns: ["tenantId", "principalType", "status"]
4369
+ }
4370
+ ]
4371
+ });
4372
+ defineTable({
4373
+ name: "permitPrincipalAliases",
4374
+ component: "control-plane",
4375
+ category: "access-control",
4376
+ shape: z.object({
4377
+ principalId: z.string(),
4378
+ tenantId: z.string(),
4379
+ workspaceId: z.optional(z.string()),
4380
+ provider: z.string(),
4381
+ providerSubjectId: z.string(),
4382
+ providerProjectId: z.string().optional(),
4383
+ alias: z.string(),
4384
+ aliasKind: z.string(),
4385
+ status: permitMembershipStatus,
4386
+ metadata: z.record(z.any()).optional(),
4387
+ createdBy: z.string(),
4388
+ createdAt: z.number(),
4389
+ updatedAt: z.number(),
4390
+ revokedBy: z.string().optional(),
4391
+ revokedAt: z.number().optional(),
4392
+ updatedBy: z.string().optional()
4393
+ }),
4394
+ indices: [
4395
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
4396
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "providerSubjectId"] },
4397
+ {
4398
+ kind: "index",
4399
+ name: "by_tenant_provider_alias",
4400
+ columns: ["tenantId", "provider", "alias"]
4401
+ },
4402
+ { kind: "index", name: "by_tenant_alias", columns: ["tenantId", "alias"] },
4403
+ {
4404
+ kind: "index",
4405
+ name: "by_tenant_provider_status",
4406
+ columns: ["tenantId", "provider", "status"]
4407
+ }
4408
+ ]
4409
+ });
4410
+ defineTable({
4411
+ name: "permitGroups",
4412
+ component: "control-plane",
4413
+ category: "access-control",
4414
+ shape: z.object({
4415
+ tenantId: z.string(),
4416
+ workspaceId: z.optional(z.string()),
4417
+ groupId: z.string(),
4418
+ groupKey: z.string(),
4419
+ groupName: z.string(),
4420
+ groupType: z.enum(["tenant", "workspace", "external", "system", "dynamic"]),
4421
+ status: permitMembershipStatus,
4422
+ description: z.string().optional(),
4423
+ metadata: z.record(z.any()).optional(),
4424
+ createdBy: z.string(),
4425
+ createdAt: z.number(),
4426
+ updatedAt: z.number(),
4427
+ updatedBy: z.string().optional()
4428
+ }),
4429
+ indices: [
4430
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4431
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4432
+ { kind: "index", name: "by_tenant_groupId", columns: ["tenantId", "groupId"] },
4433
+ { kind: "index", name: "by_tenant_groupKey", columns: ["tenantId", "groupKey"] },
4434
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4435
+ ]
4436
+ });
4437
+ defineTable({
4438
+ name: "permitGroupMemberships",
4439
+ component: "control-plane",
4440
+ category: "access-control",
4441
+ shape: z.object({
4442
+ tenantId: z.string(),
4443
+ workspaceId: z.optional(z.string()),
4444
+ groupId: z.string(),
4445
+ memberType: z.enum(["principal", "group"]),
4446
+ memberId: z.string(),
4447
+ principalId: z.string().optional(),
4448
+ childGroupId: z.string().optional(),
4449
+ status: permitMembershipStatus,
4450
+ addedBy: z.string().optional(),
4451
+ revokedBy: z.string().optional(),
4452
+ expiresAt: z.number().optional(),
4453
+ revocationReason: z.string().optional(),
4454
+ metadata: z.record(z.any()).optional(),
4455
+ createdAt: z.number(),
4456
+ updatedAt: z.number(),
4457
+ updatedBy: z.string().optional()
4458
+ }),
4459
+ indices: [
4460
+ { kind: "index", name: "by_tenant_principal", columns: ["tenantId", "principalId"] },
4461
+ { kind: "index", name: "by_tenant_member", columns: ["tenantId", "memberType", "memberId"] },
4462
+ {
4463
+ kind: "index",
4464
+ name: "by_tenant_member_group",
4465
+ columns: ["tenantId", "memberType", "memberId", "groupId"]
4466
+ },
4467
+ { kind: "index", name: "by_tenant_group", columns: ["tenantId", "groupId"] },
4468
+ { kind: "index", name: "by_member_group", columns: ["memberType", "memberId", "groupId"] },
4469
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4470
+ {
4471
+ kind: "index",
4472
+ name: "by_workspace_principal",
4473
+ columns: ["workspaceId", "principalId"]
4474
+ }
4475
+ ]
4476
+ });
4477
+ defineTable({
4478
+ name: "permitResourceInstances",
4479
+ component: "control-plane",
4480
+ category: "access-control",
4481
+ shape: z.object({
4482
+ tenantId: z.string(),
4483
+ workspaceId: z.optional(z.string()),
4484
+ resourceType: z.string(),
4485
+ resourceKey: z.string(),
4486
+ resourceId: z.string(),
4487
+ status: z.enum(["active", "deleted", "archived"]),
4488
+ attributes: z.record(z.any()).optional(),
4489
+ ownerPrincipalId: z.string().optional(),
4490
+ metadata: z.record(z.any()).optional(),
4491
+ createdBy: z.string(),
4492
+ updatedBy: z.string().optional(),
4493
+ createdAt: z.number(),
4494
+ updatedAt: z.number()
4495
+ }),
4496
+ indices: [
4497
+ {
4498
+ kind: "index",
4499
+ name: "by_tenant_resource_type",
4500
+ columns: ["tenantId", "resourceType"]
4501
+ },
4502
+ {
4503
+ kind: "index",
4504
+ name: "by_tenant_resource_key",
4505
+ columns: ["tenantId", "resourceType", "resourceKey"]
4506
+ },
4507
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4508
+ { kind: "index", name: "by_status", columns: ["status"] },
4509
+ {
4510
+ kind: "index",
4511
+ name: "by_tenant_status",
4512
+ columns: ["tenantId", "status"]
4513
+ },
4514
+ {
4515
+ kind: "index",
4516
+ name: "by_ownerPrincipalId",
4517
+ columns: ["ownerPrincipalId"]
4518
+ }
4519
+ ]
4520
+ });
4521
+ defineTable({
4522
+ name: "permitRoleAssignments",
4523
+ component: "control-plane",
4524
+ category: "access-control",
4525
+ shape: z.object({
4526
+ tenantId: z.string(),
4527
+ workspaceId: z.optional(z.string()),
4528
+ role: z.string(),
4529
+ targetType: permitRoleBindingTarget,
4530
+ targetId: z.string(),
4531
+ resourceType: z.string(),
4532
+ resourceKey: z.string(),
4533
+ resourceInstanceId: z.string().optional(),
4534
+ status: permitMembershipStatus,
4535
+ expiresAt: z.number().optional(),
4536
+ attributes: z.record(z.any()).optional(),
4537
+ grantedBy: z.string().optional(),
4538
+ updatedBy: z.string().optional(),
4539
+ revokedBy: z.string().optional(),
4540
+ createdAt: z.number(),
4541
+ updatedAt: z.number()
4542
+ }),
4543
+ indices: [
4544
+ {
4545
+ kind: "index",
4546
+ name: "by_tenant_target",
4547
+ columns: ["tenantId", "targetType", "targetId"]
4548
+ },
4549
+ {
4550
+ kind: "index",
4551
+ name: "by_tenant_resource",
4552
+ columns: ["tenantId", "resourceType", "resourceKey"]
4553
+ },
4554
+ {
4555
+ kind: "index",
4556
+ name: "by_tenant_role",
4557
+ columns: ["tenantId", "role", "status"]
4558
+ },
4559
+ { kind: "index", name: "by_status", columns: ["status"] },
4560
+ {
4561
+ kind: "index",
4562
+ name: "by_workspace_resource",
4563
+ columns: ["workspaceId", "resourceType", "resourceKey"]
4564
+ }
4565
+ ]
4566
+ });
4567
+ defineTable({
4568
+ name: "permitRelationshipTuples",
4569
+ component: "control-plane",
4570
+ category: "access-control",
4571
+ shape: z.object({
4572
+ tenantId: z.string(),
4573
+ workspaceId: z.optional(z.string()),
4574
+ relation: z.string(),
4575
+ subject: z.string(),
4576
+ object: z.string(),
4577
+ resourceType: z.string().optional(),
4578
+ resourceKey: z.string().optional(),
4579
+ status: permitRecordStatus,
4580
+ attributes: z.record(z.any()).optional(),
4581
+ createdBy: z.string(),
4582
+ createdAt: z.number(),
4583
+ updatedAt: z.number(),
4584
+ lastSeenAt: z.number().optional(),
4585
+ updatedBy: z.string().optional()
4586
+ }),
4587
+ indices: [
4588
+ { kind: "index", name: "by_tenant_subject", columns: ["tenantId", "subject"] },
4589
+ { kind: "index", name: "by_tenant_object", columns: ["tenantId", "object"] },
4590
+ { kind: "index", name: "by_tenant_relation", columns: ["tenantId", "relation"] },
4591
+ {
4592
+ kind: "index",
4593
+ name: "by_tenant_relation_subject",
4594
+ columns: ["tenantId", "relation", "subject"]
4595
+ },
4596
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4597
+ ]
4598
+ });
4599
+ defineTable({
4600
+ name: "permitAttributeBindings",
4601
+ component: "control-plane",
4602
+ category: "access-control",
4603
+ shape: z.object({
4604
+ tenantId: z.string(),
4605
+ workspaceId: z.optional(z.string()),
4606
+ targetType: permitRoleBindingTarget,
4607
+ targetId: z.string(),
4608
+ attributeName: z.string(),
4609
+ attributeType: permitAttributeType,
4610
+ attributeOperator: permitAttributeOperator,
4611
+ attributeValue: z.any(),
4612
+ status: permitRecordStatus,
4613
+ source: z.string().optional(),
4614
+ sourceRef: z.string().optional(),
4615
+ metadata: z.record(z.any()).optional(),
4616
+ createdAt: z.number(),
4617
+ updatedAt: z.number(),
4618
+ createdBy: z.string(),
4619
+ updatedBy: z.string().optional(),
4620
+ expiresAt: z.number().optional()
4621
+ }),
4622
+ indices: [
4623
+ {
4624
+ kind: "index",
4625
+ name: "by_tenant_target",
4626
+ columns: ["tenantId", "targetType", "targetId"]
4627
+ },
4628
+ {
4629
+ kind: "index",
4630
+ name: "by_tenant_target_attribute",
4631
+ columns: ["tenantId", "targetType", "targetId", "attributeName"]
4632
+ },
4633
+ {
4634
+ kind: "index",
4635
+ name: "by_tenant_name",
4636
+ columns: ["tenantId", "attributeName"]
4637
+ },
4638
+ {
4639
+ kind: "index",
4640
+ name: "by_tenant_status",
4641
+ columns: ["tenantId", "status"]
4642
+ }
4643
+ ]
4644
+ });
4645
+ defineTable({
4646
+ name: "permitPolicyBundles",
4647
+ component: "control-plane",
4648
+ category: "access-control",
4649
+ shape: z.object({
4650
+ tenantId: z.string(),
4651
+ workspaceId: z.optional(z.string()),
4652
+ bundleKey: z.string(),
4653
+ version: z.number(),
4654
+ status: permitPolicyBundleStatus,
4655
+ policyHash: z.string().optional(),
4656
+ policyPayload: z.record(z.any()),
4657
+ metadata: z.record(z.any()).optional(),
4658
+ createdBy: z.string(),
4659
+ reviewedBy: z.string().optional(),
4660
+ createdAt: z.number(),
4661
+ updatedAt: z.number(),
4662
+ retiredAt: z.number().optional()
4663
+ }),
4664
+ indices: [
4665
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4666
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4667
+ {
4668
+ kind: "index",
4669
+ name: "by_tenant_bundleKey",
4670
+ columns: ["tenantId", "bundleKey"]
4671
+ },
4672
+ {
4673
+ kind: "index",
4674
+ name: "by_tenant_bundle_version",
4675
+ columns: ["tenantId", "bundleKey", "version"]
4676
+ },
4677
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4678
+ ]
4679
+ });
4680
+ defineTable({
4681
+ name: "permitProjectionOutbox",
4682
+ component: "control-plane",
4683
+ category: "access-control",
4684
+ shape: z.object({
4685
+ syncKey: z.string(),
4686
+ objectType: permitObjectType,
4687
+ objectId: z.string(),
4688
+ operation: permitOutboxOperation,
4689
+ payload: z.record(z.any()),
4690
+ status: permitRecordStatus,
4691
+ attemptCount: z.number(),
4692
+ nextAttemptAt: z.number().optional(),
4693
+ lastError: z.string().optional(),
4694
+ tenantId: z.string().optional(),
4695
+ workspaceId: z.optional(z.string()),
4696
+ principalId: z.string().optional(),
4697
+ permitTenantKey: z.string().optional(),
4698
+ permitResourceType: z.string().optional(),
4699
+ permitResourceKey: z.string().optional(),
4700
+ createdAt: z.number(),
4701
+ updatedAt: z.number(),
4702
+ lastHandledAt: z.number().optional()
4703
+ }),
4704
+ indices: [
4705
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4706
+ { kind: "index", name: "by_status", columns: ["status"] },
4707
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4708
+ {
4709
+ kind: "index",
4710
+ name: "by_tenant_status",
4711
+ columns: ["tenantId", "status"]
4712
+ },
4713
+ {
4714
+ kind: "index",
4715
+ name: "by_objectType",
4716
+ columns: ["objectType", "status"]
4717
+ }
4718
+ ]
4719
+ });
4720
+ defineTable({
4721
+ name: "tenantPermitSyncStates",
4722
+ component: "control-plane",
4723
+ category: "access-control",
4724
+ shape: z.object({
4725
+ syncKey: z.string(),
4726
+ objectType: permitObjectType,
4727
+ objectId: z.string(),
4728
+ tenantId: z.string().optional(),
4729
+ workspaceId: z.string().optional(),
4730
+ principalId: z.string().optional(),
4731
+ permitTenantKey: z.string().optional(),
4732
+ permitResourceType: z.string().optional(),
4733
+ permitResourceKey: z.string().optional(),
4734
+ desiredPayload: z.record(z.any()),
4735
+ lastAppliedPayloadHash: z.string().optional(),
4736
+ status: permitSyncStatus,
4737
+ attemptCount: z.number(),
4738
+ lastError: z.string().optional(),
4739
+ nextAttemptAt: z.number().optional(),
4740
+ lastSyncedAt: z.number().optional(),
4741
+ createdBy: z.string(),
4742
+ updatedBy: z.string().optional(),
4743
+ createdAt: z.number(),
4744
+ updatedAt: z.number()
4745
+ }),
4746
+ indices: [
4747
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4748
+ { kind: "index", name: "by_status", columns: ["status"] },
4749
+ {
4750
+ kind: "index",
4751
+ name: "by_tenant_status",
4752
+ columns: ["tenantId", "status"]
4753
+ },
4754
+ {
4755
+ kind: "index",
4756
+ name: "by_workspace_status",
4757
+ columns: ["workspaceId", "status"]
4758
+ },
4759
+ {
4760
+ kind: "index",
4761
+ name: "by_principal_status",
4762
+ columns: ["principalId", "status"]
4763
+ }
4764
+ ]
4765
+ });
4766
+ defineTable({
4767
+ name: "permitPolicyDecisionReceipts",
4768
+ component: "control-plane",
4769
+ category: "access-control",
4770
+ shape: z.object({
4771
+ tenantId: z.string().optional(),
4772
+ workspaceId: z.string().optional(),
4773
+ principalId: z.string(),
4774
+ subjectType: permitAccessReviewSubjectType.optional(),
4775
+ subjectId: z.string().optional(),
4776
+ resourceType: z.string(),
4777
+ resourceId: z.string(),
4778
+ action: z.string(),
4779
+ decision: permitDecision,
4780
+ reasonCode: z.string(),
4781
+ policyBundleId: z.string().optional(),
4782
+ policyVersion: z.string(),
4783
+ traceId: z.string().optional(),
4784
+ requestId: z.string().optional(),
4785
+ audienceMode: z.string().optional(),
4786
+ audienceKey: z.string().optional(),
4787
+ audienceClass: z.enum(["internal", "restricted_external", "public"]).optional(),
4788
+ metadata: z.record(z.any()).optional(),
4789
+ createdAt: z.number(),
4790
+ expiresAt: z.number().optional(),
4791
+ createdBy: z.string().optional()
4792
+ }),
4793
+ indices: [
4794
+ { kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
4795
+ { kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
4796
+ { kind: "index", name: "by_resource", columns: ["resourceType", "resourceId"] },
4797
+ { kind: "index", name: "by_decision_createdAt", columns: ["decision", "createdAt"] },
4798
+ { kind: "index", name: "by_traceId", columns: ["traceId"] },
4799
+ { kind: "index", name: "by_action", columns: ["action"] }
4800
+ ]
4801
+ });
4802
+ defineTable({
4803
+ name: "permitAccessReviews",
4804
+ component: "control-plane",
4805
+ category: "access-control",
4806
+ shape: z.object({
4807
+ tenantId: z.string(),
4808
+ workspaceId: z.optional(z.string()),
4809
+ reviewKey: z.string(),
4810
+ scope: permitReviewScope,
4811
+ status: permitAccessReviewStatus,
4812
+ subjectType: permitAccessReviewSubjectType,
4813
+ subjectId: z.string(),
4814
+ resourceType: z.string().optional(),
4815
+ resourceKey: z.string().optional(),
4816
+ outcome: z.enum(["allow", "deny"]).optional(),
4817
+ requestedBy: z.string(),
4818
+ reviewedBy: z.string().optional(),
4819
+ requestedAt: z.number(),
4820
+ reviewedAt: z.number().optional(),
4821
+ dueAt: z.number().optional(),
4822
+ justification: z.string().optional(),
4823
+ rationale: z.string().optional(),
4824
+ policyBundleId: z.string().optional(),
4825
+ metadata: z.record(z.any()).optional(),
4826
+ createdAt: z.number(),
4827
+ updatedAt: z.number()
4828
+ }),
4829
+ indices: [
4830
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4831
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4832
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4833
+ {
4834
+ kind: "index",
4835
+ name: "by_tenant_subject",
4836
+ columns: ["tenantId", "subjectType", "subjectId"]
4837
+ },
4838
+ { kind: "index", name: "by_outcome", columns: ["outcome"] },
4839
+ {
4840
+ kind: "index",
4841
+ name: "by_workspace_status",
4842
+ columns: ["workspaceId", "status"]
4843
+ }
4844
+ ]
4845
+ });
4846
+ defineTable({
4847
+ name: "permitAccessReviewItems",
4848
+ component: "control-plane",
4849
+ category: "access-control",
4850
+ shape: z.object({
4851
+ reviewKey: z.string(),
4852
+ itemKey: z.string(),
4853
+ tenantId: z.string(),
4854
+ workspaceId: z.string().optional(),
4855
+ subjectType: permitAccessReviewSubjectType,
4856
+ subjectId: z.string(),
4857
+ resourceType: z.string().optional(),
4858
+ resourceKey: z.string().optional(),
4859
+ role: z.string().optional(),
4860
+ relation: z.string().optional(),
4861
+ status: z.enum(["open", "approved", "revoked", "changed", "deferred"]),
4862
+ reviewerId: z.string().optional(),
4863
+ decisionAt: z.number().optional(),
4864
+ rationale: z.string().optional(),
4865
+ metadata: z.record(z.any()).optional(),
4866
+ createdAt: z.number(),
4867
+ updatedAt: z.number()
4868
+ }),
4869
+ indices: [
4870
+ { kind: "index", name: "by_reviewKey", columns: ["reviewKey"] },
4871
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4872
+ { kind: "index", name: "by_tenant_itemKey", columns: ["tenantId", "itemKey"] },
4873
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4874
+ { kind: "index", name: "by_status", columns: ["status"] }
4875
+ ]
4876
+ });
3965
4877
  defineTable({
3966
4878
  name: "reasoningPermissions",
3967
- component: "identity",
4879
+ component: "control-plane",
3968
4880
  category: "epistemic",
3969
4881
  shape: z.object({
3970
4882
  "topicId": z.string().optional(),
@@ -4211,7 +5123,7 @@ defineTable({
4211
5123
  });
4212
5124
  defineTable({
4213
5125
  name: "users",
4214
- component: "identity",
5126
+ component: "control-plane",
4215
5127
  category: "user",
4216
5128
  shape: z.object({
4217
5129
  "clerkId": z.string(),
@@ -4325,7 +5237,6 @@ defineTable({
4325
5237
  "deployments": z.record(z.object({
4326
5238
  "url": z.string(),
4327
5239
  "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
4328
- "encryptedDeployKey": z.string().optional(),
4329
5240
  "credentialRef": z.string().optional()
4330
5241
  })).optional(),
4331
5242
  "metadata": z.record(z.any()).optional(),
@@ -4340,6 +5251,39 @@ defineTable({
4340
5251
  { kind: "index", name: "by_status", columns: ["status"] }
4341
5252
  ]
4342
5253
  });
5254
+ defineTable({
5255
+ name: "deploymentHosts",
5256
+ component: "mc",
5257
+ category: "workspace",
5258
+ shape: z.object({
5259
+ "host": z.string(),
5260
+ "tenantId": idOf("tenants"),
5261
+ "workspaceId": idOf("workspaces"),
5262
+ "environment": z.enum(["dev", "staging", "prod"]),
5263
+ "target": z.enum(["kernelDeployment", "appDeployment"]),
5264
+ "deploymentUrl": z.string().optional(),
5265
+ "deploymentName": z.string().optional(),
5266
+ "vercelProjectName": z.string().optional(),
5267
+ "vercelProjectId": z.string().optional(),
5268
+ "vercelEnvironment": z.enum(["development", "preview", "staging", "production"]).optional(),
5269
+ "source": z.enum(["vercel_preview", "vercel_production", "vercel_custom_environment", "custom_domain", "manual"]),
5270
+ "status": z.enum(["active", "revoked"]),
5271
+ "metadata": z.record(z.any()).optional(),
5272
+ "createdBy": z.string(),
5273
+ "createdAt": z.number(),
5274
+ "updatedAt": z.number(),
5275
+ "revokedAt": z.number().optional(),
5276
+ "revokedBy": z.string().optional()
5277
+ }),
5278
+ indices: [
5279
+ { kind: "index", name: "by_host", columns: ["host"] },
5280
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
5281
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
5282
+ { kind: "index", name: "by_tenant_workspace_environment", columns: ["tenantId", "workspaceId", "environment"] },
5283
+ { kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
5284
+ { kind: "index", name: "by_status", columns: ["status"] }
5285
+ ]
5286
+ });
4343
5287
  defineTable({
4344
5288
  name: "worktreeBeliefCluster",
4345
5289
  component: "kernel",
@@ -4647,8 +5591,8 @@ defineTable({
4647
5591
  });
4648
5592
  z.object({
4649
5593
  manifestVersion: z.string(),
4650
- componentName: z.enum(["kernel", "identity"]),
4651
- tier: z.enum(["K", "I"]),
5594
+ componentName: z.enum(["kernel", "control-plane"]),
5595
+ tier: z.enum(["K", "CP"]),
4652
5596
  packageVersion: z.string(),
4653
5597
  tables: z.array(
4654
5598
  z.object({
@@ -4774,129 +5718,994 @@ var edgePolicyManifest = {
4774
5718
  // ../contracts/src/tenant-client.contract.ts
4775
5719
  var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
4776
5720
  {
4777
- packageName: "@lucern/access-control",
4778
- role: "runtime_entrypoint",
4779
- directTenantImport: true
5721
+ packageName: "@lucern/access-control",
5722
+ role: "runtime_entrypoint",
5723
+ directTenantImport: true
5724
+ },
5725
+ {
5726
+ packageName: "@lucern/agent",
5727
+ role: "platform_runtime",
5728
+ directTenantImport: false
5729
+ },
5730
+ {
5731
+ packageName: "@lucern/auth",
5732
+ role: "sdk_dependency",
5733
+ directTenantImport: false
5734
+ },
5735
+ {
5736
+ packageName: "@lucern/cli",
5737
+ role: "developer_tool",
5738
+ directTenantImport: false
5739
+ },
5740
+ {
5741
+ packageName: "@lucern/client-core",
5742
+ role: "sdk_dependency",
5743
+ directTenantImport: false
5744
+ },
5745
+ {
5746
+ packageName: "@lucern/confidence",
5747
+ role: "sdk_dependency",
5748
+ directTenantImport: false
5749
+ },
5750
+ {
5751
+ packageName: "@lucern/config",
5752
+ role: "configuration",
5753
+ directTenantImport: false
5754
+ },
5755
+ {
5756
+ packageName: "@lucern/contracts",
5757
+ role: "contract_entrypoint",
5758
+ directTenantImport: true
5759
+ },
5760
+ {
5761
+ packageName: "@lucern/control-plane",
5762
+ role: "component_runtime",
5763
+ directTenantImport: false
5764
+ },
5765
+ {
5766
+ packageName: "@lucern/developer-kit",
5767
+ role: "developer_tool",
5768
+ directTenantImport: false
5769
+ },
5770
+ {
5771
+ packageName: "@lucern/events",
5772
+ role: "sdk_dependency",
5773
+ directTenantImport: false
5774
+ },
5775
+ {
5776
+ packageName: "@lucern/graph-primitives",
5777
+ role: "sdk_dependency",
5778
+ directTenantImport: false
5779
+ },
5780
+ {
5781
+ packageName: "@lucern/graph-sync",
5782
+ role: "host_addon_runtime",
5783
+ directTenantImport: true
5784
+ },
5785
+ {
5786
+ packageName: "@lucern/mcp",
5787
+ role: "runtime_entrypoint",
5788
+ directTenantImport: true
5789
+ },
5790
+ {
5791
+ packageName: "@lucern/pack-host",
5792
+ role: "platform_runtime",
5793
+ directTenantImport: false
5794
+ },
5795
+ {
5796
+ packageName: "@lucern/pack-installer",
5797
+ role: "developer_tool",
5798
+ directTenantImport: false
5799
+ },
5800
+ {
5801
+ packageName: "@lucern/proof-compiler",
5802
+ role: "developer_tool",
5803
+ directTenantImport: false
5804
+ },
5805
+ {
5806
+ packageName: "@lucern/react",
5807
+ role: "runtime_entrypoint",
5808
+ directTenantImport: true
5809
+ },
5810
+ {
5811
+ packageName: "@lucern/reasoning-kernel",
5812
+ role: "component_runtime",
5813
+ directTenantImport: false
5814
+ },
5815
+ {
5816
+ packageName: "@lucern/sdk",
5817
+ role: "runtime_entrypoint",
5818
+ directTenantImport: true
5819
+ },
5820
+ {
5821
+ packageName: "@lucern/secrets",
5822
+ role: "sdk_dependency",
5823
+ directTenantImport: false
5824
+ },
5825
+ {
5826
+ packageName: "@lucern/server-core",
5827
+ role: "platform_runtime",
5828
+ directTenantImport: false
5829
+ },
5830
+ {
5831
+ packageName: "@lucern/testing",
5832
+ role: "test_support",
5833
+ directTenantImport: false
5834
+ },
5835
+ {
5836
+ packageName: "@lucern/types",
5837
+ role: "contract_entrypoint",
5838
+ directTenantImport: true
5839
+ }
5840
+ ];
5841
+ TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
5842
+ (entry) => entry.packageName
5843
+ );
5844
+
5845
+ // ../contracts/src/infisical-runtime.contract.ts
5846
+ var INFISICAL_TENANT_SOFTWARE_SYSTEMS = [
5847
+ {
5848
+ id: "stack-frontend",
5849
+ tenantKey: "stack",
5850
+ workspaceKey: "frontend",
5851
+ vercelProjectName: "ai-chatbot-diao",
5852
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5853
+ vercelProjectId: "prj_PihFw8kohSSw14nZs9YQV3xVo517",
5854
+ repository: {
5855
+ owner: "stack-vc",
5856
+ name: "front-end"
5857
+ },
5858
+ sharedSourcePath: "/tenants/stack",
5859
+ sharedVariablePolicy: "tenant_shared_all_systems",
5860
+ convex: {
5861
+ urlEnv: "CONVEX_FRONTEND_URL",
5862
+ deployKeyEnv: "CONVEX_FRONTEND_DEPLOY_KEY",
5863
+ preprodDeployment: "rugged-lobster-664",
5864
+ prodDeployment: "wonderful-toucan-0"
5865
+ }
5866
+ },
5867
+ {
5868
+ id: "stackos",
5869
+ tenantKey: "stack",
5870
+ workspaceKey: "stackos",
5871
+ vercelProjectName: "stackos",
5872
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5873
+ vercelProjectId: "prj_rXLAL0Z6v9p1fasKbomby6GI7kau",
5874
+ repository: {
5875
+ owner: "stack-vc",
5876
+ name: "stackos"
5877
+ },
5878
+ sharedSourcePath: "/tenants/stack",
5879
+ sharedVariablePolicy: "tenant_shared_all_systems",
5880
+ convex: {
5881
+ urlEnv: "CONVEX_STACKOS_URL",
5882
+ deployKeyEnv: "CONVEX_STACKOS_DEPLOY_KEY",
5883
+ preprodDeployment: "giant-mandrill-761",
5884
+ prodDeployment: "good-snake-515"
5885
+ }
5886
+ },
5887
+ {
5888
+ id: "stack-eng",
5889
+ tenantKey: "stack",
5890
+ workspaceKey: "engineering",
5891
+ vercelProjectName: "stackos-engineering-graph",
5892
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5893
+ vercelProjectId: "prj_zAU0Zn9GkbHjHI63dxW4vLpmoqTJ",
5894
+ repository: {
5895
+ owner: "stack-vc",
5896
+ name: "stackos-engineering-graph"
5897
+ },
5898
+ sharedSourcePath: "/tenants/stack/engineering",
5899
+ sharedVariablePolicy: "tenant_shared_all_systems",
5900
+ convex: {
5901
+ urlEnv: "CONVEX_STACK_ENG_URL",
5902
+ deployKeyEnv: "CONVEX_STACK_ENG_DEPLOY_KEY",
5903
+ preprodDeployment: "small-oyster-270",
5904
+ prodDeployment: "bold-cuttlefish-804"
5905
+ }
5906
+ },
5907
+ {
5908
+ id: "lucern-graph",
5909
+ tenantKey: "lucern",
5910
+ workspaceKey: "lucern",
5911
+ vercelProjectName: "lucern-graph",
5912
+ vercelTeamId: "team_vTHxxs8GAoAFUe6RWMlYt7fY",
5913
+ vercelProjectId: "prj_KJ8EKV8vGM5xURpqmwTwmECEGPgQ",
5914
+ repository: {
5915
+ owner: "LucernAI",
5916
+ name: "lucern-graph"
5917
+ },
5918
+ sharedSourcePath: "/tenants/lucern/shared",
5919
+ sharedVariablePolicy: "tenant_shared_all_systems",
5920
+ convex: {
5921
+ urlEnv: "CONVEX_LUCERN_URL",
5922
+ deployKeyEnv: "CONVEX_LUCERN_DEPLOY_KEY",
5923
+ preprodDeployment: "good-blackbird-774",
5924
+ prodDeployment: "precious-dog-365"
5925
+ }
5926
+ }
5927
+ ];
5928
+ var TENANT_SHARED_SECRET_DEFINITION_TEMPLATES = [
5929
+ {
5930
+ idSuffix: "clerk.publishable",
5931
+ canonicalName: "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
5932
+ aliases: ["CLERK_PUBLISHABLE_KEY"],
5933
+ required: true,
5934
+ secret: false,
5935
+ public: true,
5936
+ description: "Tenant-owned Clerk browser key. For Stack this is the master clerk.stack.vc project shared by front-end, StackOS, and the engineering workspace."
5937
+ },
5938
+ {
5939
+ idSuffix: "clerk.secret",
5940
+ canonicalName: "CLERK_SECRET_KEY",
5941
+ required: true,
5942
+ secret: true,
5943
+ public: false,
5944
+ description: "Tenant-owned Clerk backend secret used only by that tenant's server runtimes."
5945
+ },
5946
+ {
5947
+ idSuffix: "clerk.project",
5948
+ canonicalName: "CLERK_PROJECT_ID",
5949
+ required: true,
5950
+ secret: false,
5951
+ public: false,
5952
+ description: "Tenant-owned Clerk project id used to resolve canonical Clerk aliases."
5953
+ },
5954
+ {
5955
+ idSuffix: "clerk.jwks",
5956
+ canonicalName: "CLERK_JWT_ISSUER_DOMAIN",
5957
+ aliases: ["CLERK_ISSUER_URL", "CLERK_JWKS_URL"],
5958
+ required: false,
5959
+ secret: false,
5960
+ public: false,
5961
+ description: "Tenant Clerk issuer/JWKS URL consumed by Convex auth.config.ts."
5962
+ },
5963
+ {
5964
+ idSuffix: "clerk.jwt-key",
5965
+ canonicalName: "CLERK_JWT_KEY",
5966
+ required: false,
5967
+ secret: true,
5968
+ public: false,
5969
+ description: "Tenant Clerk JWT public verification key used by bearer-token API routes."
5970
+ },
5971
+ {
5972
+ idSuffix: "clerk.authorized-parties",
5973
+ canonicalName: "CLERK_AUTHORIZED_PARTIES",
5974
+ aliases: ["CLERK_MOBILE_AUTHORIZED_PARTIES"],
5975
+ required: false,
5976
+ secret: false,
5977
+ public: false,
5978
+ description: "Comma-separated Clerk authorized parties for browser and mobile bearer-token validation."
5979
+ },
5980
+ {
5981
+ idSuffix: "clerk.sign-in-url",
5982
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
5983
+ required: false,
5984
+ secret: false,
5985
+ public: true,
5986
+ description: "Tenant Clerk sign-in route for custom app login surfaces."
5987
+ },
5988
+ {
5989
+ idSuffix: "clerk.sign-up-url",
5990
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
5991
+ required: false,
5992
+ secret: false,
5993
+ public: true,
5994
+ description: "Tenant Clerk sign-up route for custom app login surfaces."
5995
+ }
5996
+ ];
5997
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
5998
+ (system) => TENANT_SHARED_SECRET_DEFINITION_TEMPLATES.map(
5999
+ (template) => ({
6000
+ id: `tenant.${system.id}.${template.idSuffix}`,
6001
+ canonicalName: template.canonicalName,
6002
+ aliases: "aliases" in template ? template.aliases : void 0,
6003
+ owner: "tenant",
6004
+ scope: "tenant",
6005
+ sourcePath: system.sharedSourcePath,
6006
+ environmentPolicy: "environment_specific",
6007
+ required: template.required,
6008
+ secret: template.secret,
6009
+ public: template.public,
6010
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6011
+ destinations: [
6012
+ {
6013
+ kind: "vercel",
6014
+ target: system.vercelProjectName,
6015
+ environmentPolicy: "preprod_staging_prod_prod"
6016
+ },
6017
+ {
6018
+ kind: "convex",
6019
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6020
+ environmentPolicy: "preprod_staging_prod_prod"
6021
+ }
6022
+ ],
6023
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6024
+ })
6025
+ )
6026
+ );
6027
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.map(
6028
+ (system) => ({
6029
+ id: `tenant.${system.id}.install-lucern-npm`,
6030
+ canonicalName: "INSTALL_LUCERN_NPM",
6031
+ owner: "provider",
6032
+ scope: "global",
6033
+ sourcePath: "/tenants/shared",
6034
+ environmentPolicy: "same_all_environments",
6035
+ required: true,
6036
+ secret: true,
6037
+ public: false,
6038
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6039
+ destinations: [
6040
+ {
6041
+ kind: "vercel",
6042
+ target: system.vercelProjectName,
6043
+ environmentPolicy: "same_all_environments"
6044
+ },
6045
+ {
6046
+ kind: "github_actions",
6047
+ target: `${system.repository.owner}/${system.repository.name}`,
6048
+ environmentPolicy: "same_all_environments"
6049
+ }
6050
+ ],
6051
+ description: `${system.tenantKey}/${system.workspaceKey}: read-only npm install token for published @lucern/* packages.`
6052
+ })
6053
+ );
6054
+ var TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS = ["stack-frontend", "stackos"];
6055
+ var TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES = [
6056
+ {
6057
+ idSuffix: "ai.openai-api-key",
6058
+ canonicalName: "OPENAI_API_KEY",
6059
+ required: false,
6060
+ secret: true,
6061
+ public: false,
6062
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6063
+ description: "Tenant-owned OpenAI key for product runtime LLM calls."
4780
6064
  },
4781
6065
  {
4782
- packageName: "@lucern/agent",
4783
- role: "platform_runtime",
4784
- directTenantImport: false
6066
+ idSuffix: "ai.anthropic-api-key",
6067
+ canonicalName: "ANTHROPIC_API_KEY",
6068
+ required: false,
6069
+ secret: true,
6070
+ public: false,
6071
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6072
+ description: "Tenant-owned Anthropic key for product runtime LLM calls."
4785
6073
  },
4786
6074
  {
4787
- packageName: "@lucern/auth",
4788
- role: "sdk_dependency",
4789
- directTenantImport: false
6075
+ idSuffix: "ai.gemini-api-key",
6076
+ canonicalName: "GEMINI_API_KEY",
6077
+ aliases: ["GOOGLE_AI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
6078
+ required: false,
6079
+ secret: true,
6080
+ public: false,
6081
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6082
+ description: "Tenant-owned Google/Gemini key for product runtime LLM calls."
4790
6083
  },
4791
6084
  {
4792
- packageName: "@lucern/cli",
4793
- role: "developer_tool",
4794
- directTenantImport: false
6085
+ idSuffix: "langfuse.secret-key",
6086
+ canonicalName: "LANGFUSE_SECRET_KEY",
6087
+ required: false,
6088
+ secret: true,
6089
+ public: false,
6090
+ consumers: [
6091
+ "tenant-vercel-app",
6092
+ "tenant-convex-deployment",
6093
+ "tenant-observability"
6094
+ ],
6095
+ description: "Tenant-owned Langfuse secret key for product AI tracing."
4795
6096
  },
4796
6097
  {
4797
- packageName: "@lucern/client-core",
4798
- role: "sdk_dependency",
4799
- directTenantImport: false
6098
+ idSuffix: "langfuse.public-key",
6099
+ canonicalName: "LANGFUSE_PUBLIC_KEY",
6100
+ required: false,
6101
+ secret: false,
6102
+ public: false,
6103
+ consumers: [
6104
+ "tenant-vercel-app",
6105
+ "tenant-convex-deployment",
6106
+ "tenant-observability"
6107
+ ],
6108
+ description: "Tenant-owned Langfuse public key for product AI tracing."
4800
6109
  },
4801
6110
  {
4802
- packageName: "@lucern/confidence",
4803
- role: "sdk_dependency",
4804
- directTenantImport: false
6111
+ idSuffix: "langfuse.base-url",
6112
+ canonicalName: "LANGFUSE_BASE_URL",
6113
+ aliases: ["LANGFUSE_BASEURL", "LANGFUSE_HOST"],
6114
+ required: false,
6115
+ secret: false,
6116
+ public: false,
6117
+ consumers: [
6118
+ "tenant-vercel-app",
6119
+ "tenant-convex-deployment",
6120
+ "tenant-observability"
6121
+ ],
6122
+ description: "Tenant-owned Langfuse API origin."
4805
6123
  },
4806
6124
  {
4807
- packageName: "@lucern/config",
4808
- role: "configuration",
4809
- directTenantImport: false
6125
+ idSuffix: "graph.neo4j-uri",
6126
+ canonicalName: "NEO4J_URI",
6127
+ required: false,
6128
+ secret: false,
6129
+ public: false,
6130
+ consumers: [
6131
+ "tenant-vercel-app",
6132
+ "tenant-convex-deployment",
6133
+ "tenant-graph-sync"
6134
+ ],
6135
+ description: "Tenant-owned Neo4j URI for product graph-sync."
4810
6136
  },
4811
6137
  {
4812
- packageName: "@lucern/contracts",
4813
- role: "contract_entrypoint",
4814
- directTenantImport: true
6138
+ idSuffix: "graph.neo4j-user",
6139
+ canonicalName: "NEO4J_USER",
6140
+ aliases: ["NEO4J_USERNAME"],
6141
+ required: false,
6142
+ secret: false,
6143
+ public: false,
6144
+ consumers: [
6145
+ "tenant-vercel-app",
6146
+ "tenant-convex-deployment",
6147
+ "tenant-graph-sync"
6148
+ ],
6149
+ description: "Tenant-owned Neo4j user for product graph-sync."
4815
6150
  },
4816
6151
  {
4817
- packageName: "@lucern/control-plane",
4818
- role: "platform_runtime",
4819
- directTenantImport: false
6152
+ idSuffix: "graph.neo4j-password",
6153
+ canonicalName: "NEO4J_PASSWORD",
6154
+ required: false,
6155
+ secret: true,
6156
+ public: false,
6157
+ consumers: [
6158
+ "tenant-vercel-app",
6159
+ "tenant-convex-deployment",
6160
+ "tenant-graph-sync"
6161
+ ],
6162
+ description: "Tenant-owned Neo4j password for product graph-sync."
4820
6163
  },
4821
6164
  {
4822
- packageName: "@lucern/developer-kit",
4823
- role: "developer_tool",
4824
- directTenantImport: false
6165
+ idSuffix: "graph.neo4j-sync-secret",
6166
+ canonicalName: "NEO4J_SYNC_SECRET",
6167
+ required: false,
6168
+ secret: true,
6169
+ public: false,
6170
+ consumers: [
6171
+ "tenant-vercel-app",
6172
+ "tenant-convex-deployment",
6173
+ "tenant-graph-sync"
6174
+ ],
6175
+ description: "Tenant-owned shared secret for product Convex-to-HTTP graph-sync calls."
4825
6176
  },
4826
6177
  {
4827
- packageName: "@lucern/events",
4828
- role: "sdk_dependency",
4829
- directTenantImport: false
6178
+ idSuffix: "graph.neo4j-database",
6179
+ canonicalName: "NEO4J_DATABASE",
6180
+ required: false,
6181
+ secret: false,
6182
+ public: false,
6183
+ consumers: [
6184
+ "tenant-vercel-app",
6185
+ "tenant-convex-deployment",
6186
+ "tenant-graph-sync"
6187
+ ],
6188
+ description: "Tenant-owned Neo4j database name for product graph-sync."
4830
6189
  },
4831
6190
  {
4832
- packageName: "@lucern/graph-primitives",
4833
- role: "sdk_dependency",
4834
- directTenantImport: false
6191
+ idSuffix: "vector.pinecone-api-key",
6192
+ canonicalName: "PINECONE_API_KEY",
6193
+ required: false,
6194
+ secret: true,
6195
+ public: false,
6196
+ consumers: [
6197
+ "tenant-vercel-app",
6198
+ "tenant-convex-deployment",
6199
+ "tenant-vector-store"
6200
+ ],
6201
+ description: "Tenant-owned Pinecone API key for product vector search."
4835
6202
  },
4836
6203
  {
4837
- packageName: "@lucern/graph-sync",
4838
- role: "host_addon_runtime",
4839
- directTenantImport: true
6204
+ idSuffix: "vector.pinecone-index-name",
6205
+ canonicalName: "PINECONE_INDEX_NAME",
6206
+ aliases: ["PINECONE_INDEX"],
6207
+ required: false,
6208
+ secret: false,
6209
+ public: false,
6210
+ consumers: [
6211
+ "tenant-vercel-app",
6212
+ "tenant-convex-deployment",
6213
+ "tenant-vector-store"
6214
+ ],
6215
+ description: "Tenant-owned Pinecone index name for product vector search."
4840
6216
  },
4841
6217
  {
4842
- packageName: "@lucern/identity",
4843
- role: "component_runtime",
4844
- directTenantImport: false
6218
+ idSuffix: "vector.pinecone-host",
6219
+ canonicalName: "PINECONE_HOST",
6220
+ aliases: ["PINECONE_INDEX_HOST"],
6221
+ required: false,
6222
+ secret: false,
6223
+ public: false,
6224
+ consumers: [
6225
+ "tenant-vercel-app",
6226
+ "tenant-convex-deployment",
6227
+ "tenant-vector-store"
6228
+ ],
6229
+ description: "Tenant-owned Pinecone host for product vector search."
4845
6230
  },
4846
6231
  {
4847
- packageName: "@lucern/mcp",
4848
- role: "runtime_entrypoint",
4849
- directTenantImport: true
6232
+ idSuffix: "vector.pinecone-namespace",
6233
+ canonicalName: "PINECONE_NAMESPACE",
6234
+ required: false,
6235
+ secret: false,
6236
+ public: false,
6237
+ consumers: [
6238
+ "tenant-vercel-app",
6239
+ "tenant-convex-deployment",
6240
+ "tenant-vector-store"
6241
+ ],
6242
+ description: "Tenant-owned Pinecone namespace for product vector search isolation."
4850
6243
  },
4851
6244
  {
4852
- packageName: "@lucern/pack-host",
4853
- role: "platform_runtime",
4854
- directTenantImport: false
6245
+ idSuffix: "storage.aws-access-key-id",
6246
+ canonicalName: "AWS_ACCESS_KEY_ID",
6247
+ required: false,
6248
+ secret: true,
6249
+ public: false,
6250
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6251
+ description: "Tenant-owned AWS access key id for document/file ingestion."
4855
6252
  },
4856
6253
  {
4857
- packageName: "@lucern/pack-installer",
4858
- role: "developer_tool",
4859
- directTenantImport: false
6254
+ idSuffix: "storage.aws-secret-access-key",
6255
+ canonicalName: "AWS_SECRET_ACCESS_KEY",
6256
+ required: false,
6257
+ secret: true,
6258
+ public: false,
6259
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6260
+ description: "Tenant-owned AWS secret access key for document/file ingestion."
4860
6261
  },
4861
6262
  {
4862
- packageName: "@lucern/proof-compiler",
4863
- role: "developer_tool",
4864
- directTenantImport: false
6263
+ idSuffix: "storage.aws-region",
6264
+ canonicalName: "AWS_REGION",
6265
+ required: false,
6266
+ secret: false,
6267
+ public: false,
6268
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6269
+ description: "Tenant-owned AWS region for document/file ingestion."
4865
6270
  },
4866
6271
  {
4867
- packageName: "@lucern/react",
4868
- role: "runtime_entrypoint",
4869
- directTenantImport: true
6272
+ idSuffix: "observability.sentry-dsn",
6273
+ canonicalName: "NEXT_PUBLIC_SENTRY_DSN",
6274
+ aliases: ["NEXT_PUBLIC_SENTRY_DSN_NEXTJS", "SENTRY_DSN"],
6275
+ required: false,
6276
+ secret: false,
6277
+ public: true,
6278
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6279
+ description: "Tenant-owned Sentry DSN for app telemetry."
4870
6280
  },
4871
6281
  {
4872
- packageName: "@lucern/reasoning-kernel",
4873
- role: "component_runtime",
4874
- directTenantImport: false
6282
+ idSuffix: "observability.sentry-auth-token",
6283
+ canonicalName: "SENTRY_AUTH_TOKEN",
6284
+ required: false,
6285
+ secret: true,
6286
+ public: false,
6287
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6288
+ description: "Tenant-owned Sentry release token for app deployments."
4875
6289
  },
4876
6290
  {
4877
- packageName: "@lucern/sdk",
4878
- role: "runtime_entrypoint",
4879
- directTenantImport: true
6291
+ idSuffix: "observability.sentry-org",
6292
+ canonicalName: "SENTRY_ORG",
6293
+ aliases: ["SENTRY_ORG_SLUG"],
6294
+ required: false,
6295
+ secret: false,
6296
+ public: false,
6297
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6298
+ description: "Tenant-owned Sentry org slug for release uploads."
4880
6299
  },
4881
6300
  {
4882
- packageName: "@lucern/server-core",
4883
- role: "platform_runtime",
4884
- directTenantImport: false
6301
+ idSuffix: "observability.sentry-project",
6302
+ canonicalName: "SENTRY_PROJECT",
6303
+ aliases: ["SENTRY_PROJECT_NEXTJS"],
6304
+ required: false,
6305
+ secret: false,
6306
+ public: false,
6307
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6308
+ description: "Tenant-owned Sentry project slug for release uploads."
4885
6309
  },
4886
6310
  {
4887
- packageName: "@lucern/testing",
4888
- role: "test_support",
4889
- directTenantImport: false
6311
+ idSuffix: "observability.sentry-environment",
6312
+ canonicalName: "NEXT_PUBLIC_SENTRY_ENVIRONMENT",
6313
+ aliases: ["SENTRY_ENVIRONMENT"],
6314
+ required: false,
6315
+ secret: false,
6316
+ public: true,
6317
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6318
+ description: "Tenant-owned Sentry environment label."
4890
6319
  },
4891
6320
  {
4892
- packageName: "@lucern/types",
4893
- role: "contract_entrypoint",
4894
- directTenantImport: true
6321
+ idSuffix: "observability.sentry-release",
6322
+ canonicalName: "NEXT_PUBLIC_SENTRY_RELEASE",
6323
+ aliases: ["SENTRY_RELEASE"],
6324
+ required: false,
6325
+ secret: false,
6326
+ public: true,
6327
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6328
+ description: "Tenant-owned Sentry release label."
6329
+ },
6330
+ {
6331
+ idSuffix: "observability.sentry-client-options",
6332
+ canonicalName: "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE",
6333
+ aliases: [
6334
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS",
6335
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS_NEXTJS",
6336
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS",
6337
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS_NEXTJS",
6338
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS",
6339
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS_NEXTJS",
6340
+ "NEXT_PUBLIC_SENTRY_ENABLE_LOGS",
6341
+ "NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE",
6342
+ "NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE",
6343
+ "NEXT_PUBLIC_SENTRY_SEND_DEFAULT_PII",
6344
+ "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE_NEXTJS"
6345
+ ],
6346
+ required: false,
6347
+ secret: false,
6348
+ public: true,
6349
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6350
+ description: "Tenant-owned public Sentry tuning values for Next.js client instrumentation."
6351
+ },
6352
+ {
6353
+ idSuffix: "observability.sentry-webhook-secret",
6354
+ canonicalName: "SENTRY_WEBHOOK_SECRET",
6355
+ required: false,
6356
+ secret: true,
6357
+ public: false,
6358
+ consumers: ["tenant-convex-deployment", "tenant-observability"],
6359
+ description: "Tenant-owned Sentry webhook verification secret."
6360
+ },
6361
+ {
6362
+ idSuffix: "lucern.gateway-api-key",
6363
+ canonicalName: "LUCERN_API_KEY",
6364
+ aliases: ["STACK_API_KEY"],
6365
+ required: false,
6366
+ secret: true,
6367
+ public: false,
6368
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6369
+ description: "Tenant-scoped Lucern/MC gateway API key for product front-door calls."
6370
+ },
6371
+ {
6372
+ idSuffix: "lucern.gateway-base-url",
6373
+ canonicalName: "LUCERN_BASE_URL",
6374
+ aliases: ["LUCERN_API_BASE_URL", "LUCERN_GATEWAY_BASE_URL"],
6375
+ required: false,
6376
+ secret: false,
6377
+ public: false,
6378
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6379
+ description: "Lucern/MC gateway base URL used by tenant product apps."
6380
+ },
6381
+ {
6382
+ idSuffix: "lucern.proxy-token-secret",
6383
+ canonicalName: "LUCERN_PROXY_TOKEN_SECRET",
6384
+ required: false,
6385
+ secret: true,
6386
+ public: false,
6387
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6388
+ description: "Tenant-owned secret for signing internal proxy/session tokens in product apps."
6389
+ },
6390
+ {
6391
+ idSuffix: "tenant.integrations.linear-api-key",
6392
+ canonicalName: "LINEAR_API_KEY",
6393
+ required: false,
6394
+ secret: true,
6395
+ public: false,
6396
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6397
+ description: "Tenant-owned Linear API key for support/slash-command flows."
6398
+ },
6399
+ {
6400
+ idSuffix: "tenant.vercel.bypass-token",
6401
+ canonicalName: "VERCEL_AUTOMATION_BYPASS_SECRET",
6402
+ aliases: ["NEXT_PUBLIC_VERCEL_BYPASS_TOKEN"],
6403
+ required: false,
6404
+ secret: true,
6405
+ public: false,
6406
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6407
+ description: "Tenant-owned Vercel automation bypass token. Public alias is legacy and should be removed from app code."
4895
6408
  }
4896
6409
  ];
4897
- TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
4898
- (entry) => entry.packageName
6410
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.filter(
6411
+ (system) => TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS.includes(system.id)
6412
+ ).flatMap(
6413
+ (system) => TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES.map(
6414
+ (template) => ({
6415
+ id: `tenant.${system.id}.${template.idSuffix}`,
6416
+ canonicalName: template.canonicalName,
6417
+ aliases: "aliases" in template ? template.aliases : void 0,
6418
+ owner: "tenant",
6419
+ scope: "tenant",
6420
+ sourcePath: system.sharedSourcePath,
6421
+ environmentPolicy: "environment_specific",
6422
+ required: template.required,
6423
+ secret: template.secret,
6424
+ public: template.public,
6425
+ consumers: template.consumers,
6426
+ destinations: [
6427
+ {
6428
+ kind: "vercel",
6429
+ target: system.vercelProjectName,
6430
+ environmentPolicy: "preprod_staging_prod_prod"
6431
+ },
6432
+ {
6433
+ kind: "convex",
6434
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6435
+ environmentPolicy: "preprod_staging_prod_prod"
6436
+ },
6437
+ {
6438
+ kind: "github_actions",
6439
+ target: `${system.repository.owner}/${system.repository.name}`,
6440
+ environmentPolicy: "preprod_staging_prod_prod"
6441
+ }
6442
+ ],
6443
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6444
+ })
6445
+ )
6446
+ );
6447
+ function tenantVercelConvexUrlWriteNames(system) {
6448
+ const names = [system.convex.urlEnv, "NEXT_PUBLIC_CONVEX_URL"];
6449
+ if (system.id === "stack-eng") {
6450
+ return [...names, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6451
+ }
6452
+ return names;
6453
+ }
6454
+ function tenantRepositoryConvexUrlWriteNames(system) {
6455
+ if (system.id === "stack-eng") {
6456
+ return [system.convex.urlEnv, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6457
+ }
6458
+ return [system.convex.urlEnv];
6459
+ }
6460
+ function tenantRepositoryConvexDeployKeyWriteNames(system) {
6461
+ if (system.id === "stack-eng") {
6462
+ return [system.convex.deployKeyEnv, "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6463
+ }
6464
+ return [system.convex.deployKeyEnv];
6465
+ }
6466
+ function tenantConvexUrlAliases(system) {
6467
+ if (system.id === "stack-frontend") {
6468
+ return [
6469
+ "CONVEX_PROD_URL",
6470
+ "CONVEX_STACK_V2_PROD_URL",
6471
+ "CONVEX_STACK_V2_STAGING_URL",
6472
+ "STACK_CONVEX_URL"
6473
+ ];
6474
+ }
6475
+ if (system.id === "stackos") {
6476
+ return [
6477
+ "CONVEX_CLOUD_URL",
6478
+ "CONVEX_STACK_URL",
6479
+ "CONVEX_URL",
6480
+ "CONVEX_URL_DEVELOPMENT",
6481
+ "CONVEX_URL_PRODUCTION",
6482
+ "STACK_CONVEX_URL"
6483
+ ];
6484
+ }
6485
+ if (system.id === "stack-eng") {
6486
+ return ["STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6487
+ }
6488
+ if (system.id === "lucern-graph") {
6489
+ return [
6490
+ "CONVEX_GRAPH_URL",
6491
+ "LUCERN_PROD_URL",
6492
+ "NEXT_PUBLIC_LUCERN_GRAPH_URL"
6493
+ ];
6494
+ }
6495
+ return void 0;
6496
+ }
6497
+ function tenantConvexDeployKeyAliases(system) {
6498
+ if (system.id === "stack-frontend") {
6499
+ return [
6500
+ "CONVEX_STACK_V2_PROD_DEPLOY_KEY",
6501
+ "CONVEX_STACK_V2_STAGING_DEPLOY_KEY",
6502
+ "STACK_DEPLOY_KEY"
6503
+ ];
6504
+ }
6505
+ if (system.id === "stackos") {
6506
+ return [
6507
+ "CONVEX_DEPLOY_KEY",
6508
+ "CONVEX_DEV_DEPLOY_KEY",
6509
+ "CONVEX_PROD_DEPLOY_KEY",
6510
+ "CONVEX_STACK_DEPLOY_KEY",
6511
+ "STACK_DEPLOY_KEY"
6512
+ ];
6513
+ }
6514
+ if (system.id === "stack-eng") {
6515
+ return ["CONVEX_DEPLOY_KEY", "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6516
+ }
6517
+ if (system.id === "lucern-graph") {
6518
+ return [
6519
+ "CONVEX_DEPLOY_KEY",
6520
+ "CONVEX_GRAPH_DEPLOY_KEY",
6521
+ "LUCERN_CONVEX_DEPLOY_KEY",
6522
+ "LUCERN_DEV_DEPLOY_KEY",
6523
+ "LUCERN_PROD_DEPLOY_KEY"
6524
+ ];
6525
+ }
6526
+ return void 0;
6527
+ }
6528
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6529
+ (system) => {
6530
+ if (system.id === "lucern-graph") {
6531
+ return [
6532
+ {
6533
+ id: "tenant.lucern-graph.public.tenant-id",
6534
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_ID",
6535
+ aliases: ["NEXT_PUBLIC_LUCERN_TENANT_ID"],
6536
+ owner: "tenant",
6537
+ scope: "workspace",
6538
+ sourcePath: system.sharedSourcePath,
6539
+ environmentPolicy: "environment_specific",
6540
+ required: false,
6541
+ secret: false,
6542
+ public: true,
6543
+ consumers: ["tenant-vercel-app"],
6544
+ destinations: [
6545
+ {
6546
+ kind: "vercel",
6547
+ target: system.vercelProjectName,
6548
+ environmentPolicy: "preprod_staging_prod_prod"
6549
+ }
6550
+ ],
6551
+ description: "Lucern graph public tenant id used by the standalone graph explorer."
6552
+ },
6553
+ {
6554
+ id: "tenant.lucern-graph.public.tenant-label",
6555
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_LABEL",
6556
+ owner: "tenant",
6557
+ scope: "workspace",
6558
+ sourcePath: system.sharedSourcePath,
6559
+ environmentPolicy: "environment_specific",
6560
+ required: false,
6561
+ secret: false,
6562
+ public: true,
6563
+ consumers: ["tenant-vercel-app"],
6564
+ destinations: [
6565
+ {
6566
+ kind: "vercel",
6567
+ target: system.vercelProjectName,
6568
+ environmentPolicy: "preprod_staging_prod_prod"
6569
+ }
6570
+ ],
6571
+ description: "Lucern graph public tenant label used by the standalone graph explorer."
6572
+ }
6573
+ ];
6574
+ }
6575
+ if (system.id === "stack-eng") {
6576
+ return [
6577
+ {
6578
+ id: "tenant.stack-eng.public.tenant-id",
6579
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_ID",
6580
+ owner: "tenant",
6581
+ scope: "workspace",
6582
+ sourcePath: system.sharedSourcePath,
6583
+ environmentPolicy: "environment_specific",
6584
+ required: false,
6585
+ secret: false,
6586
+ public: true,
6587
+ consumers: ["tenant-vercel-app"],
6588
+ destinations: [
6589
+ {
6590
+ kind: "vercel",
6591
+ target: system.vercelProjectName,
6592
+ environmentPolicy: "preprod_staging_prod_prod"
6593
+ }
6594
+ ],
6595
+ description: "Stack engineering graph public tenant id used by the graph explorer."
6596
+ },
6597
+ {
6598
+ id: "tenant.stack-eng.public.tenant-label",
6599
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_LABEL",
6600
+ owner: "tenant",
6601
+ scope: "workspace",
6602
+ sourcePath: system.sharedSourcePath,
6603
+ environmentPolicy: "environment_specific",
6604
+ required: false,
6605
+ secret: false,
6606
+ public: true,
6607
+ consumers: ["tenant-vercel-app"],
6608
+ destinations: [
6609
+ {
6610
+ kind: "vercel",
6611
+ target: system.vercelProjectName,
6612
+ environmentPolicy: "preprod_staging_prod_prod"
6613
+ }
6614
+ ],
6615
+ description: "Stack engineering graph public tenant label used by the graph explorer."
6616
+ },
6617
+ {
6618
+ id: "tenant.stack-eng.public.environment",
6619
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_ENV",
6620
+ owner: "tenant",
6621
+ scope: "workspace",
6622
+ sourcePath: system.sharedSourcePath,
6623
+ environmentPolicy: "environment_specific",
6624
+ required: false,
6625
+ secret: false,
6626
+ public: true,
6627
+ consumers: ["tenant-vercel-app"],
6628
+ destinations: [
6629
+ {
6630
+ kind: "vercel",
6631
+ target: system.vercelProjectName,
6632
+ environmentPolicy: "preprod_staging_prod_prod"
6633
+ }
6634
+ ],
6635
+ description: "Stack engineering graph public environment label used by the graph explorer."
6636
+ }
6637
+ ];
6638
+ }
6639
+ return [];
6640
+ }
4899
6641
  );
6642
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap((system) => [
6643
+ {
6644
+ id: `tenant.${system.id}.convex.url`,
6645
+ canonicalName: system.convex.urlEnv,
6646
+ aliases: tenantConvexUrlAliases(system),
6647
+ owner: "tenant",
6648
+ scope: "software_system",
6649
+ sourcePath: system.sharedSourcePath,
6650
+ environmentPolicy: "preprod_staging_prod_prod",
6651
+ required: true,
6652
+ secret: false,
6653
+ public: false,
6654
+ consumers: [
6655
+ "tenant-vercel-app",
6656
+ "tenant-agent-runtime",
6657
+ "mc-operator-tooling"
6658
+ ],
6659
+ destinations: [
6660
+ {
6661
+ kind: "vercel",
6662
+ target: system.vercelProjectName,
6663
+ environmentPolicy: "preprod_staging_prod_prod",
6664
+ writeNames: tenantVercelConvexUrlWriteNames(system)
6665
+ },
6666
+ {
6667
+ kind: "github_actions",
6668
+ target: `${system.repository.owner}/${system.repository.name}`,
6669
+ environmentPolicy: "preprod_staging_prod_prod",
6670
+ writeNames: tenantRepositoryConvexUrlWriteNames(system),
6671
+ notes: "Only if that repository deploy/test workflow owns this software system."
6672
+ }
6673
+ ],
6674
+ description: `${system.tenantKey}/${system.workspaceKey} Convex URL. Pre-prod resolves to ${system.convex.preprodDeployment}; prod resolves to ${system.convex.prodDeployment}.`
6675
+ },
6676
+ {
6677
+ id: `tenant.${system.id}.convex.deploy-key`,
6678
+ canonicalName: system.convex.deployKeyEnv,
6679
+ aliases: tenantConvexDeployKeyAliases(system),
6680
+ owner: "tenant",
6681
+ scope: "software_system",
6682
+ sourcePath: system.sharedSourcePath,
6683
+ environmentPolicy: "preprod_staging_prod_prod",
6684
+ required: true,
6685
+ secret: true,
6686
+ public: false,
6687
+ consumers: [
6688
+ "tenant-vercel-app",
6689
+ "tenant-agent-runtime",
6690
+ "mc-operator-tooling"
6691
+ ],
6692
+ destinations: [
6693
+ {
6694
+ kind: "vercel",
6695
+ target: system.vercelProjectName,
6696
+ environmentPolicy: "preprod_staging_prod_prod"
6697
+ },
6698
+ {
6699
+ kind: "github_actions",
6700
+ target: `${system.repository.owner}/${system.repository.name}`,
6701
+ environmentPolicy: "preprod_staging_prod_prod",
6702
+ writeNames: tenantRepositoryConvexDeployKeyWriteNames(system),
6703
+ notes: "Only if that repository deploy/test workflow owns this software system."
6704
+ }
6705
+ ],
6706
+ description: `${system.tenantKey}/${system.workspaceKey} Convex deploy/admin key. Never route to sibling workspaces.`
6707
+ }
6708
+ ]);
4900
6709
  z.object({
4901
6710
  manifestVersion: z.literal("1.0.0"),
4902
6711
  rules: z.array(
@@ -4937,7 +6746,7 @@ var createEvidenceInputSchemaBase = z.object({
4937
6746
  targetId: z.string().optional(),
4938
6747
  targetNodeId: z.string().optional(),
4939
6748
  linkedBeliefNodeId: z.string().optional(),
4940
- evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
6749
+ evidenceRelation: z.enum(["supports", "contradicts"]).optional(),
4941
6750
  confidence: z.number().optional(),
4942
6751
  weight: z.number().optional(),
4943
6752
  reasoning: z.string().optional(),
@@ -5022,8 +6831,7 @@ var createEvidenceProjection = defineProjection({
5022
6831
  evidenceRelation: v.optional(
5023
6832
  v.union(
5024
6833
  v.literal("supports"),
5025
- v.literal("contradicts"),
5026
- v.literal("neutral")
6834
+ v.literal("contradicts")
5027
6835
  )
5028
6836
  ),
5029
6837
  confidence: v.optional(v.number()),
@@ -5072,12 +6880,17 @@ var listBeliefsProjection = defineProjection({
5072
6880
  });
5073
6881
  var taskStatusSchema = z.enum(["todo", "in_progress", "blocked", "done"]).optional().describe("Filter by task status");
5074
6882
  var listTasksInputSchema = z.object({
5075
- topicId: z.string().describe("Topic scope"),
6883
+ topicId: z.string().optional().describe("Topic scope"),
5076
6884
  worktreeId: z.string().optional().describe("Alias for linkedWorktreeId"),
5077
6885
  linkedWorktreeId: z.string().optional().describe("Filter to tasks linked to this worktree"),
5078
6886
  status: taskStatusSchema,
5079
6887
  limit: z.number().optional().describe("Maximum results")
5080
- });
6888
+ }).refine(
6889
+ (input) => Boolean(input.topicId || input.worktreeId || input.linkedWorktreeId),
6890
+ {
6891
+ message: "topicId or worktreeId is required"
6892
+ }
6893
+ );
5081
6894
  function compactRecord3(input) {
5082
6895
  return Object.fromEntries(
5083
6896
  Object.entries(input).filter(([, value]) => value !== void 0)
@@ -5094,7 +6907,7 @@ var listTasksProjection = defineProjection({
5094
6907
  linkedWorktreeId: input.linkedWorktreeId ?? input.worktreeId
5095
6908
  }),
5096
6909
  convexArgsValidator: v.object({
5097
- topicId: v.string(),
6910
+ topicId: v.optional(v.string()),
5098
6911
  status: v.optional(
5099
6912
  v.union(
5100
6913
  v.literal("todo"),
@@ -6098,7 +7911,7 @@ var CREATE_EDGE = {
6098
7911
  reasoningMethod: {
6099
7912
  type: "string",
6100
7913
  description: "How this was determined",
6101
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
7914
+ enum: [...REASONING_METHODS]
6102
7915
  },
6103
7916
  metadata: {
6104
7917
  type: "object",
@@ -7825,6 +9638,10 @@ var CREATE_TASK = {
7825
9638
  tags: {
7826
9639
  type: "array",
7827
9640
  description: "Free-form string tags"
9641
+ },
9642
+ metadata: {
9643
+ type: "object",
9644
+ description: "Structured task metadata for handoff context and routing hints"
7828
9645
  }
7829
9646
  },
7830
9647
  required: ["title"],
@@ -7898,6 +9715,10 @@ var UPDATE_TASK = {
7898
9715
  type: "string",
7899
9716
  description: "Updated status",
7900
9717
  enum: ["todo", "in_progress", "blocked", "done"]
9718
+ },
9719
+ metadata: {
9720
+ type: "object",
9721
+ description: "Structured task metadata to replace or refine"
7901
9722
  }
7902
9723
  },
7903
9724
  required: ["taskId"],
@@ -9353,6 +11174,9 @@ var BEGIN_BUILD_SESSION = {
9353
11174
  sessionMode: "string \u2014 async | interactive",
9354
11175
  targetBeliefIds: "array \u2014 scoped belief IDs",
9355
11176
  targetQuestionIds: "array \u2014 scoped question IDs",
11177
+ taskIds: "array \u2014 assigned task IDs for this worktree",
11178
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
11179
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
9356
11180
  topBeliefs: "array \u2014 highest-confidence scoped beliefs",
9357
11181
  openQuestions: "array \u2014 open scoped questions",
9358
11182
  resolvedDecisions: "array \u2014 answered questions summarized for the session",
@@ -9953,12 +11777,20 @@ function unwrapMcpParameterSchema(schema) {
9953
11777
  current = current._def.schema;
9954
11778
  continue;
9955
11779
  default:
9956
- return { schema: current, required, description: description ?? current.description };
11780
+ return {
11781
+ schema: current,
11782
+ required,
11783
+ description: description ?? current.description
11784
+ };
9957
11785
  }
9958
11786
  }
9959
11787
  }
9960
11788
  function mcpParameterFromZod(fieldName, schema, contractName) {
9961
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
11789
+ const {
11790
+ schema: unwrapped,
11791
+ required,
11792
+ description: schemaDescription
11793
+ } = unwrapMcpParameterSchema(schema);
9962
11794
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
9963
11795
  switch (unwrapped._def.typeName) {
9964
11796
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -10003,10 +11835,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
10003
11835
  const entries2 = Object.entries(getObjectShape(args)).sort(
10004
11836
  ([left], [right]) => left.localeCompare(right)
10005
11837
  );
10006
- const converted = entries2.map(([fieldName, schema]) => [
10007
- fieldName,
10008
- mcpParameterFromZod(fieldName, schema, contractName)
10009
- ]);
11838
+ const converted = entries2.map(
11839
+ ([fieldName, schema]) => [
11840
+ fieldName,
11841
+ mcpParameterFromZod(fieldName, schema, contractName)
11842
+ ]
11843
+ );
10010
11844
  return {
10011
11845
  ...base,
10012
11846
  parameters: Object.fromEntries(
@@ -10118,6 +11952,7 @@ function surfaceContract(args) {
10118
11952
  allowedPrincipalTypes: ["user", "service", "agent"]
10119
11953
  },
10120
11954
  convex: args.convex,
11955
+ gateway: args.gateway,
10121
11956
  args: canonicalArgs,
10122
11957
  returns: canonicalReturns,
10123
11958
  input,
@@ -10604,7 +12439,7 @@ var beliefsContracts = [
10604
12439
  })
10605
12440
  ];
10606
12441
  var jsonRecordSchema4 = z.record(z.unknown());
10607
- var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
12442
+ var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
10608
12443
  var createEvidenceArgs = z.object({
10609
12444
  topicId: z.string().optional().describe("Topic scope for the evidence."),
10610
12445
  text: z.string().describe("Canonical evidence text."),
@@ -12527,7 +14362,8 @@ var createTaskArgs = z.object({
12527
14362
  linkedQuestionId: z.string().optional().describe("Question this task addresses."),
12528
14363
  assigneeId: z.string().optional().describe("Principal assigned to the task."),
12529
14364
  dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
12530
- tags: z.array(z.string()).optional().describe("Free-form tags.")
14365
+ tags: z.array(z.string()).optional().describe("Free-form tags."),
14366
+ metadata: z.record(z.unknown()).optional().describe("Structured task metadata for handoff context and routing hints.")
12531
14367
  });
12532
14368
  var createTaskInput = (input) => compactRecord4({
12533
14369
  title: input.title,
@@ -12541,7 +14377,8 @@ var createTaskInput = (input) => compactRecord4({
12541
14377
  linkedQuestionId: input.linkedQuestionId,
12542
14378
  assigneeId: input.assigneeId,
12543
14379
  dueDate: input.dueDate,
12544
- tags: input.tags
14380
+ tags: input.tags,
14381
+ metadata: input.metadata
12545
14382
  });
12546
14383
  var taskInput = (input) => compactRecord4({
12547
14384
  ...input,
@@ -12558,8 +14395,7 @@ var taskTopicInput = (input) => {
12558
14395
  };
12559
14396
  var completeTaskInput = (input) => compactRecord4({
12560
14397
  taskId: input.taskId ?? input.id,
12561
- outputSummary: input.outputSummary ?? input.summary,
12562
- userId: input.userId
14398
+ outputSummary: input.outputSummary ?? input.summary
12563
14399
  });
12564
14400
  var tasksContracts = [
12565
14401
  surfaceContract({
@@ -12577,6 +14413,7 @@ var tasksContracts = [
12577
14413
  kind: "mutation",
12578
14414
  inputProjection: createTaskInput
12579
14415
  },
14416
+ gateway: { handler: "tasks.create" },
12580
14417
  args: createTaskArgs
12581
14418
  }),
12582
14419
  surfaceContract({
@@ -12595,6 +14432,7 @@ var tasksContracts = [
12595
14432
  kind: "query",
12596
14433
  inputProjection: taskTopicInput
12597
14434
  },
14435
+ gateway: { handler: "tasks.list" },
12598
14436
  args: listTasksInputSchema
12599
14437
  }),
12600
14438
  surfaceContract({
@@ -12612,7 +14450,8 @@ var tasksContracts = [
12612
14450
  functionName: "update",
12613
14451
  kind: "mutation",
12614
14452
  inputProjection: taskInput
12615
- }
14453
+ },
14454
+ gateway: { handler: "tasks.update" }
12616
14455
  }),
12617
14456
  surfaceContract({
12618
14457
  name: "complete_task",
@@ -12628,12 +14467,14 @@ var tasksContracts = [
12628
14467
  functionName: "complete",
12629
14468
  kind: "mutation",
12630
14469
  inputProjection: completeTaskInput
12631
- }
14470
+ },
14471
+ gateway: { handler: "tasks.complete" }
12632
14472
  })
12633
14473
  ];
12634
14474
  var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
12635
14475
  (policy) => policy.edgeType
12636
14476
  );
14477
+ var REASONING_METHOD_TYPES = [...REASONING_METHODS];
12637
14478
  var createEdgeArgs = z.object({
12638
14479
  from: GraphRefSchema,
12639
14480
  to: GraphRefSchema,
@@ -12643,6 +14484,7 @@ var createEdgeArgs = z.object({
12643
14484
  confidence: z.number().optional(),
12644
14485
  context: z.string().optional(),
12645
14486
  reasoning: z.string().optional(),
14487
+ reasoningMethod: z.enum(REASONING_METHOD_TYPES).optional(),
12646
14488
  derivationType: z.string().optional(),
12647
14489
  metadata: z.record(z.unknown()).optional(),
12648
14490
  topicId: z.string().optional(),
@@ -12721,6 +14563,7 @@ var edgesContracts = [
12721
14563
  weight: parsed.weight,
12722
14564
  confidence: parsed.confidence,
12723
14565
  context: parsed.context ?? parsed.reasoning,
14566
+ reasoningMethod: parsed.reasoningMethod,
12724
14567
  derivationType: parsed.derivationType,
12725
14568
  metadata: parsed.metadata,
12726
14569
  skipLayerValidation: true,
@@ -12845,6 +14688,7 @@ var edgesContracts = [
12845
14688
  weight: edge.weight,
12846
14689
  confidence: edge.confidence,
12847
14690
  context: edge.context ?? edge.reasoning,
14691
+ reasoningMethod: edge.reasoningMethod,
12848
14692
  derivationType: edge.derivationType,
12849
14693
  metadata: edge.metadata,
12850
14694
  topicId: edge.topicId
@@ -13579,6 +15423,69 @@ var pipelineContracts = [
13579
15423
  }
13580
15424
  })
13581
15425
  ];
15426
+ function isRecord3(value) {
15427
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15428
+ }
15429
+ function stringValues(value) {
15430
+ if (typeof value === "string") {
15431
+ return [value];
15432
+ }
15433
+ if (Array.isArray(value)) {
15434
+ return value.flatMap((item) => stringValues(item));
15435
+ }
15436
+ return [];
15437
+ }
15438
+ function nestedEvidenceRows(value) {
15439
+ if (Array.isArray(value)) {
15440
+ return value.flatMap((item) => nestedEvidenceRows(item));
15441
+ }
15442
+ if (!isRecord3(value)) {
15443
+ return [];
15444
+ }
15445
+ const nestedKeys = ["evidence", "items", "nodes"];
15446
+ const nestedRows = nestedKeys.flatMap((key) => nestedEvidenceRows(value[key]));
15447
+ return nestedRows.length > 0 ? nestedRows : [value];
15448
+ }
15449
+ function isFailedAttemptRow(row) {
15450
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15451
+ return metadata?.failedApproach === true || metadata?.isFailedAttempt === true;
15452
+ }
15453
+ function failureLogSearchFields(row) {
15454
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15455
+ return [
15456
+ ...stringValues(row.id),
15457
+ ...stringValues(row._id),
15458
+ ...stringValues(row.title),
15459
+ ...stringValues(row.text),
15460
+ ...stringValues(row.canonicalText),
15461
+ ...stringValues(row.content),
15462
+ ...stringValues(metadata?.codeAnchor),
15463
+ ...stringValues(metadata?.codeAnchors),
15464
+ ...stringValues(metadata?.anchor),
15465
+ ...stringValues(metadata?.anchors),
15466
+ ...stringValues(metadata?.filePath),
15467
+ ...stringValues(metadata?.filePaths),
15468
+ ...stringValues(metadata?.path),
15469
+ ...stringValues(metadata?.paths),
15470
+ ...stringValues(metadata?.sourceRef),
15471
+ ...stringValues(metadata?.touchedPaths)
15472
+ ];
15473
+ }
15474
+ function projectFailureLog(output, input) {
15475
+ const rawQuery = typeof input.query === "string" && input.query.trim().length > 0 ? input.query.trim() : void 0;
15476
+ const searchKey = rawQuery?.toLowerCase();
15477
+ const failures = nestedEvidenceRows(output).filter((row) => isFailedAttemptRow(row)).filter(
15478
+ (row) => !searchKey ? true : failureLogSearchFields(row).some(
15479
+ (field) => field.toLowerCase().includes(searchKey)
15480
+ )
15481
+ );
15482
+ return {
15483
+ query: rawQuery,
15484
+ failures,
15485
+ totalFound: failures.length,
15486
+ showing: failures.length
15487
+ };
15488
+ }
13582
15489
  var recordScopeLearningArgs = z.object({
13583
15490
  topicId: z.string().optional().describe("Topic scope ID"),
13584
15491
  summary: z.string().describe("Atomic learning statement"),
@@ -13668,6 +15575,8 @@ var attemptInput = (input, context) => withUserId(
13668
15575
  tags: ["code_attempt"],
13669
15576
  metadata: compactRecord4({
13670
15577
  ...recordValue2(input.metadata),
15578
+ failedApproach: true,
15579
+ isFailedAttempt: true,
13671
15580
  filePaths: input.filePaths,
13672
15581
  filePath: input.filePath,
13673
15582
  errorMessage: input.errorMessage,
@@ -13798,7 +15707,8 @@ var codingContracts = [
13798
15707
  limit: input.limit,
13799
15708
  status: input.status,
13800
15709
  userId: input.userId
13801
- })
15710
+ }),
15711
+ outputProjection: (output, input) => projectFailureLog(output, input)
13802
15712
  }
13803
15713
  })
13804
15714
  ];
@@ -14260,14 +16170,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14260
16170
  description: "Worktrees are tenant/runtime planning data."
14261
16171
  },
14262
16172
  {
14263
- component: "identity",
16173
+ component: "control-plane",
14264
16174
  table: "agents",
14265
16175
  prepopulation: "runtime_bootstrap",
14266
16176
  copyMode: "none",
14267
16177
  description: "Service agents are provisioned per tenant or service, not copied."
14268
16178
  },
14269
16179
  {
14270
- component: "identity",
16180
+ component: "control-plane",
14271
16181
  table: "mcpWritePolicy",
14272
16182
  prepopulation: "required_template",
14273
16183
  copyMode: "template_global",
@@ -14276,14 +16186,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14276
16186
  description: "Global write policy defaults govern service and interactive MCP writes."
14277
16187
  },
14278
16188
  {
14279
- component: "identity",
16189
+ component: "control-plane",
14280
16190
  table: "modelCallLogs",
14281
16191
  prepopulation: "runtime_log",
14282
16192
  copyMode: "none",
14283
16193
  description: "Model call logs are runtime telemetry."
14284
16194
  },
14285
16195
  {
14286
- component: "identity",
16196
+ component: "control-plane",
14287
16197
  table: "modelFunctionSlots",
14288
16198
  prepopulation: "required_template",
14289
16199
  copyMode: "template_global",
@@ -14292,7 +16202,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14292
16202
  description: "Function-to-model slots are required by model runtime resolution."
14293
16203
  },
14294
16204
  {
14295
- component: "identity",
16205
+ component: "control-plane",
14296
16206
  table: "modelRegistry",
14297
16207
  prepopulation: "required_template",
14298
16208
  copyMode: "template_global",
@@ -14301,7 +16211,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14301
16211
  description: "Model catalog defaults are required by model runtime clients."
14302
16212
  },
14303
16213
  {
14304
- component: "identity",
16214
+ component: "control-plane",
14305
16215
  table: "modelSlotConfigs",
14306
16216
  prepopulation: "required_template",
14307
16217
  copyMode: "template_global",
@@ -14310,14 +16220,105 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14310
16220
  description: "Slot-level defaults are required before tenant overrides exist."
14311
16221
  },
14312
16222
  {
14313
- component: "identity",
16223
+ component: "control-plane",
16224
+ table: "permitAccessReviewItems",
16225
+ prepopulation: "runtime_data",
16226
+ copyMode: "none",
16227
+ description: "Permit access-review item rows are tenant review data projected from Permit."
16228
+ },
16229
+ {
16230
+ component: "control-plane",
16231
+ table: "permitAccessReviews",
16232
+ prepopulation: "runtime_data",
16233
+ copyMode: "none",
16234
+ description: "Permit access-review campaigns are tenant review data projected from Permit."
16235
+ },
16236
+ {
16237
+ component: "control-plane",
16238
+ table: "permitAttributeBindings",
16239
+ prepopulation: "runtime_data",
16240
+ copyMode: "none",
16241
+ description: "Permit ABAC attribute bindings are tenant policy projection rows."
16242
+ },
16243
+ {
16244
+ component: "control-plane",
16245
+ table: "permitGroups",
16246
+ prepopulation: "runtime_data",
16247
+ copyMode: "none",
16248
+ description: "Permit groups are tenant-defined policy subjects, not template data."
16249
+ },
16250
+ {
16251
+ component: "control-plane",
16252
+ table: "permitGroupMemberships",
16253
+ prepopulation: "runtime_data",
16254
+ copyMode: "none",
16255
+ description: "Permit group memberships are tenant-specific policy projection rows."
16256
+ },
16257
+ {
16258
+ component: "control-plane",
16259
+ table: "permitPolicyBundles",
16260
+ prepopulation: "runtime_derived",
16261
+ copyMode: "none",
16262
+ description: "Permit policy bundles are derived from the Permit control plane."
16263
+ },
16264
+ {
16265
+ component: "control-plane",
16266
+ table: "permitPolicyDecisionReceipts",
16267
+ prepopulation: "runtime_log",
16268
+ copyMode: "none",
16269
+ description: "Permit decision receipts are runtime authorization audit logs."
16270
+ },
16271
+ {
16272
+ component: "control-plane",
16273
+ table: "permitPrincipalAliases",
16274
+ prepopulation: "runtime_data",
16275
+ copyMode: "none",
16276
+ description: "Permit principal aliases are tenant-specific identity projection rows."
16277
+ },
16278
+ {
16279
+ component: "control-plane",
16280
+ table: "permitPrincipals",
16281
+ prepopulation: "runtime_data",
16282
+ copyMode: "none",
16283
+ description: "Permit principals are projected from Clerk, Permit, and tenant onboarding flows."
16284
+ },
16285
+ {
16286
+ component: "control-plane",
16287
+ table: "permitProjectionOutbox",
16288
+ prepopulation: "runtime_queue",
16289
+ copyMode: "none",
16290
+ description: "Permit projection outbox rows are runtime sync queue data."
16291
+ },
16292
+ {
16293
+ component: "control-plane",
16294
+ table: "permitRelationshipTuples",
16295
+ prepopulation: "runtime_data",
16296
+ copyMode: "none",
16297
+ description: "Permit ReBAC relationship tuples are tenant policy projection rows."
16298
+ },
16299
+ {
16300
+ component: "control-plane",
16301
+ table: "permitResourceInstances",
16302
+ prepopulation: "runtime_data",
16303
+ copyMode: "none",
16304
+ description: "Permit resource instances are tenant/workspace graph and deployment projection rows."
16305
+ },
16306
+ {
16307
+ component: "control-plane",
16308
+ table: "permitRoleAssignments",
16309
+ prepopulation: "runtime_data",
16310
+ copyMode: "none",
16311
+ description: "Permit role assignments are tenant-specific policy projection rows."
16312
+ },
16313
+ {
16314
+ component: "control-plane",
14314
16315
  table: "platformAudienceGrants",
14315
16316
  prepopulation: "runtime_data",
14316
16317
  copyMode: "none",
14317
16318
  description: "Audience grants are principal/group-specific access rows."
14318
16319
  },
14319
16320
  {
14320
- component: "identity",
16321
+ component: "control-plane",
14321
16322
  table: "platformAudiences",
14322
16323
  prepopulation: "required_template",
14323
16324
  copyMode: "template_tenant_rewrite",
@@ -14326,35 +16327,35 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14326
16327
  description: "Default tenant audience taxonomy rows are rewritten into each tenant."
14327
16328
  },
14328
16329
  {
14329
- component: "identity",
16330
+ component: "control-plane",
14330
16331
  table: "platformPolicyDecisionLogs",
14331
16332
  prepopulation: "runtime_log",
14332
16333
  copyMode: "none",
14333
16334
  description: "Policy decisions are runtime audit logs."
14334
16335
  },
14335
16336
  {
14336
- component: "identity",
16337
+ component: "control-plane",
14337
16338
  table: "projectGrants",
14338
16339
  prepopulation: "runtime_data",
14339
16340
  copyMode: "none",
14340
16341
  description: "Project/topic grants are principal or group-specific access rows."
14341
16342
  },
14342
16343
  {
14343
- component: "identity",
16344
+ component: "control-plane",
14344
16345
  table: "reasoningPermissions",
14345
16346
  prepopulation: "runtime_data",
14346
16347
  copyMode: "none",
14347
16348
  description: "Reasoning permissions are principal-specific policy rows."
14348
16349
  },
14349
16350
  {
14350
- component: "identity",
16351
+ component: "control-plane",
14351
16352
  table: "tenantApiKeys",
14352
16353
  prepopulation: "runtime_secret",
14353
16354
  copyMode: "none",
14354
16355
  description: "API keys are tenant credentials and must never be copied."
14355
16356
  },
14356
16357
  {
14357
- component: "identity",
16358
+ component: "control-plane",
14358
16359
  table: "tenantConfig",
14359
16360
  prepopulation: "required_template",
14360
16361
  copyMode: "template_tenant_rewrite",
@@ -14363,7 +16364,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14363
16364
  description: "Tenant-local config defaults are rewritten during bootstrap."
14364
16365
  },
14365
16366
  {
14366
- component: "identity",
16367
+ component: "control-plane",
14367
16368
  table: "tenantIntegrations",
14368
16369
  prepopulation: "required_template",
14369
16370
  copyMode: "template_tenant_rewrite",
@@ -14372,14 +16373,21 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14372
16373
  description: "Non-secret integration descriptors are rewritten into each tenant."
14373
16374
  },
14374
16375
  {
14375
- component: "identity",
16376
+ component: "control-plane",
14376
16377
  table: "tenantModelSlotBindings",
14377
16378
  prepopulation: "runtime_secret",
14378
16379
  copyMode: "none",
14379
16380
  description: "Tenant model slot bindings reference provider secrets and are runtime-only."
14380
16381
  },
14381
16382
  {
14382
- component: "identity",
16383
+ component: "control-plane",
16384
+ table: "tenantPermitSyncStates",
16385
+ prepopulation: "runtime_derived",
16386
+ copyMode: "none",
16387
+ description: "Tenant Permit sync state rows are runtime reconciliation state."
16388
+ },
16389
+ {
16390
+ component: "control-plane",
14383
16391
  table: "tenantPolicies",
14384
16392
  prepopulation: "required_template",
14385
16393
  copyMode: "template_tenant_rewrite",
@@ -14388,42 +16396,42 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14388
16396
  description: "Default tenant policy roles are rewritten during bootstrap."
14389
16397
  },
14390
16398
  {
14391
- component: "identity",
16399
+ component: "control-plane",
14392
16400
  table: "tenantProviderSecrets",
14393
16401
  prepopulation: "runtime_secret",
14394
16402
  copyMode: "none",
14395
16403
  description: "Provider secrets are credentials and must never be copied."
14396
16404
  },
14397
16405
  {
14398
- component: "identity",
16406
+ component: "control-plane",
14399
16407
  table: "tenantProxyGatewayUsage",
14400
16408
  prepopulation: "runtime_log",
14401
16409
  copyMode: "none",
14402
16410
  description: "Proxy gateway usage rows are runtime telemetry."
14403
16411
  },
14404
16412
  {
14405
- component: "identity",
16413
+ component: "control-plane",
14406
16414
  table: "tenantProxyTokenMints",
14407
16415
  prepopulation: "runtime_secret",
14408
16416
  copyMode: "none",
14409
16417
  description: "Proxy token mints are ephemeral secret-bearing runtime rows."
14410
16418
  },
14411
16419
  {
14412
- component: "identity",
16420
+ component: "control-plane",
14413
16421
  table: "tenantSandboxAuditEvents",
14414
16422
  prepopulation: "runtime_log",
14415
16423
  copyMode: "none",
14416
16424
  description: "Sandbox audit rows are runtime security logs."
14417
16425
  },
14418
16426
  {
14419
- component: "identity",
16427
+ component: "control-plane",
14420
16428
  table: "tenantSecrets",
14421
16429
  prepopulation: "runtime_secret",
14422
16430
  copyMode: "none",
14423
16431
  description: "Tenant secrets are credentials and must never be copied."
14424
16432
  },
14425
16433
  {
14426
- component: "identity",
16434
+ component: "control-plane",
14427
16435
  table: "toolAcls",
14428
16436
  prepopulation: "required_template",
14429
16437
  copyMode: "template_global",
@@ -14432,7 +16440,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14432
16440
  description: "Default role-to-tool grants are required for SDK/MCP tool access."
14433
16441
  },
14434
16442
  {
14435
- component: "identity",
16443
+ component: "control-plane",
14436
16444
  table: "toolRegistry",
14437
16445
  prepopulation: "required_template",
14438
16446
  copyMode: "template_global",
@@ -14441,7 +16449,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14441
16449
  description: "Core tool catalog rows are required before pack or tenant tools exist."
14442
16450
  },
14443
16451
  {
14444
- component: "identity",
16452
+ component: "control-plane",
14445
16453
  table: "users",
14446
16454
  prepopulation: "runtime_bootstrap",
14447
16455
  copyMode: "none",