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

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,650 @@ 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
+ "attribute_binding",
4292
+ "policy_bundle"
4293
+ ]);
4294
+ var permitOutboxOperation = z.enum([
4295
+ "upsert",
4296
+ "delete",
4297
+ "sync",
4298
+ "resync",
4299
+ "delete_sync",
4300
+ "noop"
4301
+ ]);
4302
+ var permitPolicyBundleStatus = z.enum([
4303
+ "draft",
4304
+ "validated",
4305
+ "enforced",
4306
+ "archived"
4307
+ ]);
4308
+ var permitSyncStatus = z.enum([
4309
+ "pending",
4310
+ "synced",
4311
+ "error",
4312
+ "skipped"
4313
+ ]);
4314
+ var permitAccessReviewSubjectType = z.enum([
4315
+ "principal",
4316
+ "group",
4317
+ "role_assignment",
4318
+ "resource_instance"
4319
+ ]);
4320
+ var permitAttributeType = z.enum([
4321
+ "string",
4322
+ "number",
4323
+ "bool",
4324
+ "json",
4325
+ "time"
4326
+ ]);
4327
+ var permitAttributeOperator = z.enum([
4328
+ "eq",
4329
+ "neq",
4330
+ "in",
4331
+ "not_in",
4332
+ "gt",
4333
+ "gte",
4334
+ "lt",
4335
+ "lte",
4336
+ "contains",
4337
+ "not_contains",
4338
+ "matches"
4339
+ ]);
4340
+ var permitRoleBindingTarget = z.enum([
4341
+ "principal",
4342
+ "group"
4343
+ ]);
4344
+ defineTable({
4345
+ name: "permitPrincipals",
4346
+ component: "control-plane",
4347
+ category: "access-control",
4348
+ shape: z.object({
4349
+ principalId: z.string(),
4350
+ tenantId: z.string(),
4351
+ workspaceId: z.optional(z.string()),
4352
+ principalType: permitActorType,
4353
+ status: permitMembershipStatus,
4354
+ displayName: z.string().optional(),
4355
+ metadata: z.record(z.any()).optional(),
4356
+ createdBy: z.string(),
4357
+ createdAt: z.number(),
4358
+ updatedAt: z.number(),
4359
+ updatedBy: z.string().optional(),
4360
+ lastSeenAt: z.number().optional()
4361
+ }),
4362
+ indices: [
4363
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4364
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4365
+ { kind: "index", name: "by_tenant_principalId", columns: ["tenantId", "principalId"] },
4366
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4367
+ {
4368
+ kind: "index",
4369
+ name: "by_tenant_principalType_status",
4370
+ columns: ["tenantId", "principalType", "status"]
4371
+ }
4372
+ ]
4373
+ });
4374
+ defineTable({
4375
+ name: "permitPrincipalAliases",
4376
+ component: "control-plane",
4377
+ category: "access-control",
4378
+ shape: z.object({
4379
+ principalId: z.string(),
4380
+ tenantId: z.string(),
4381
+ workspaceId: z.optional(z.string()),
4382
+ provider: z.string(),
4383
+ providerSubjectId: z.string(),
4384
+ providerProjectId: z.string().optional(),
4385
+ alias: z.string(),
4386
+ aliasKind: z.string(),
4387
+ status: permitMembershipStatus,
4388
+ metadata: z.record(z.any()).optional(),
4389
+ createdBy: z.string(),
4390
+ createdAt: z.number(),
4391
+ updatedAt: z.number(),
4392
+ revokedBy: z.string().optional(),
4393
+ revokedAt: z.number().optional(),
4394
+ updatedBy: z.string().optional()
4395
+ }),
4396
+ indices: [
4397
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
4398
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "providerSubjectId"] },
4399
+ {
4400
+ kind: "index",
4401
+ name: "by_tenant_provider_alias",
4402
+ columns: ["tenantId", "provider", "alias"]
4403
+ },
4404
+ { kind: "index", name: "by_tenant_alias", columns: ["tenantId", "alias"] },
4405
+ {
4406
+ kind: "index",
4407
+ name: "by_tenant_provider_status",
4408
+ columns: ["tenantId", "provider", "status"]
4409
+ }
4410
+ ]
4411
+ });
4412
+ defineTable({
4413
+ name: "permitGroups",
4414
+ component: "control-plane",
4415
+ category: "access-control",
4416
+ shape: z.object({
4417
+ tenantId: z.string(),
4418
+ workspaceId: z.optional(z.string()),
4419
+ groupId: z.string(),
4420
+ groupKey: z.string(),
4421
+ groupName: z.string(),
4422
+ groupType: z.enum(["tenant", "workspace", "external", "system", "dynamic"]),
4423
+ status: permitMembershipStatus,
4424
+ description: z.string().optional(),
4425
+ metadata: z.record(z.any()).optional(),
4426
+ createdBy: z.string(),
4427
+ createdAt: z.number(),
4428
+ updatedAt: z.number(),
4429
+ updatedBy: z.string().optional()
4430
+ }),
4431
+ indices: [
4432
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4433
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4434
+ { kind: "index", name: "by_tenant_groupId", columns: ["tenantId", "groupId"] },
4435
+ { kind: "index", name: "by_tenant_groupKey", columns: ["tenantId", "groupKey"] },
4436
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4437
+ ]
4438
+ });
4439
+ defineTable({
4440
+ name: "permitGroupMemberships",
4441
+ component: "control-plane",
4442
+ category: "access-control",
4443
+ shape: z.object({
4444
+ tenantId: z.string(),
4445
+ workspaceId: z.optional(z.string()),
4446
+ groupId: z.string(),
4447
+ memberType: z.enum(["principal", "group"]),
4448
+ memberId: z.string(),
4449
+ principalId: z.string().optional(),
4450
+ childGroupId: z.string().optional(),
4451
+ status: permitMembershipStatus,
4452
+ addedBy: z.string().optional(),
4453
+ revokedBy: z.string().optional(),
4454
+ expiresAt: z.number().optional(),
4455
+ revocationReason: z.string().optional(),
4456
+ metadata: z.record(z.any()).optional(),
4457
+ createdAt: z.number(),
4458
+ updatedAt: z.number(),
4459
+ updatedBy: z.string().optional()
4460
+ }),
4461
+ indices: [
4462
+ { kind: "index", name: "by_tenant_principal", columns: ["tenantId", "principalId"] },
4463
+ { kind: "index", name: "by_tenant_member", columns: ["tenantId", "memberType", "memberId"] },
4464
+ {
4465
+ kind: "index",
4466
+ name: "by_tenant_member_group",
4467
+ columns: ["tenantId", "memberType", "memberId", "groupId"]
4468
+ },
4469
+ { kind: "index", name: "by_tenant_group", columns: ["tenantId", "groupId"] },
4470
+ { kind: "index", name: "by_member_group", columns: ["memberType", "memberId", "groupId"] },
4471
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4472
+ {
4473
+ kind: "index",
4474
+ name: "by_workspace_principal",
4475
+ columns: ["workspaceId", "principalId"]
4476
+ }
4477
+ ]
4478
+ });
4479
+ defineTable({
4480
+ name: "permitResourceInstances",
4481
+ component: "control-plane",
4482
+ category: "access-control",
4483
+ shape: z.object({
4484
+ tenantId: z.string(),
4485
+ workspaceId: z.optional(z.string()),
4486
+ resourceType: z.string(),
4487
+ resourceKey: z.string(),
4488
+ resourceId: z.string(),
4489
+ status: z.enum(["active", "deleted", "archived"]),
4490
+ attributes: z.record(z.any()).optional(),
4491
+ ownerPrincipalId: z.string().optional(),
4492
+ metadata: z.record(z.any()).optional(),
4493
+ createdBy: z.string(),
4494
+ updatedBy: z.string().optional(),
4495
+ createdAt: z.number(),
4496
+ updatedAt: z.number()
4497
+ }),
4498
+ indices: [
4499
+ {
4500
+ kind: "index",
4501
+ name: "by_tenant_resource_type",
4502
+ columns: ["tenantId", "resourceType"]
4503
+ },
4504
+ {
4505
+ kind: "index",
4506
+ name: "by_tenant_resource_key",
4507
+ columns: ["tenantId", "resourceType", "resourceKey"]
4508
+ },
4509
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4510
+ { kind: "index", name: "by_status", columns: ["status"] },
4511
+ {
4512
+ kind: "index",
4513
+ name: "by_tenant_status",
4514
+ columns: ["tenantId", "status"]
4515
+ },
4516
+ {
4517
+ kind: "index",
4518
+ name: "by_ownerPrincipalId",
4519
+ columns: ["ownerPrincipalId"]
4520
+ }
4521
+ ]
4522
+ });
4523
+ defineTable({
4524
+ name: "permitRoleAssignments",
4525
+ component: "control-plane",
4526
+ category: "access-control",
4527
+ shape: z.object({
4528
+ tenantId: z.string(),
4529
+ workspaceId: z.optional(z.string()),
4530
+ role: z.string(),
4531
+ targetType: permitRoleBindingTarget,
4532
+ targetId: z.string(),
4533
+ resourceType: z.string(),
4534
+ resourceKey: z.string(),
4535
+ resourceInstanceId: z.string().optional(),
4536
+ status: permitMembershipStatus,
4537
+ expiresAt: z.number().optional(),
4538
+ attributes: z.record(z.any()).optional(),
4539
+ grantedBy: z.string().optional(),
4540
+ updatedBy: z.string().optional(),
4541
+ revokedBy: z.string().optional(),
4542
+ createdAt: z.number(),
4543
+ updatedAt: z.number()
4544
+ }),
4545
+ indices: [
4546
+ {
4547
+ kind: "index",
4548
+ name: "by_tenant_target",
4549
+ columns: ["tenantId", "targetType", "targetId"]
4550
+ },
4551
+ {
4552
+ kind: "index",
4553
+ name: "by_tenant_resource",
4554
+ columns: ["tenantId", "resourceType", "resourceKey"]
4555
+ },
4556
+ {
4557
+ kind: "index",
4558
+ name: "by_tenant_role",
4559
+ columns: ["tenantId", "role", "status"]
4560
+ },
4561
+ { kind: "index", name: "by_status", columns: ["status"] },
4562
+ {
4563
+ kind: "index",
4564
+ name: "by_workspace_resource",
4565
+ columns: ["workspaceId", "resourceType", "resourceKey"]
4566
+ }
4567
+ ]
4568
+ });
4569
+ defineTable({
4570
+ name: "permitRelationshipTuples",
4571
+ component: "control-plane",
4572
+ category: "access-control",
4573
+ shape: z.object({
4574
+ tenantId: z.string(),
4575
+ workspaceId: z.optional(z.string()),
4576
+ relation: z.string(),
4577
+ subject: z.string(),
4578
+ object: z.string(),
4579
+ resourceType: z.string().optional(),
4580
+ resourceKey: z.string().optional(),
4581
+ status: permitRecordStatus,
4582
+ attributes: z.record(z.any()).optional(),
4583
+ createdBy: z.string(),
4584
+ createdAt: z.number(),
4585
+ updatedAt: z.number(),
4586
+ lastSeenAt: z.number().optional(),
4587
+ updatedBy: z.string().optional()
4588
+ }),
4589
+ indices: [
4590
+ { kind: "index", name: "by_tenant_subject", columns: ["tenantId", "subject"] },
4591
+ { kind: "index", name: "by_tenant_object", columns: ["tenantId", "object"] },
4592
+ { kind: "index", name: "by_tenant_relation", columns: ["tenantId", "relation"] },
4593
+ {
4594
+ kind: "index",
4595
+ name: "by_tenant_relation_subject",
4596
+ columns: ["tenantId", "relation", "subject"]
4597
+ },
4598
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4599
+ ]
4600
+ });
4601
+ defineTable({
4602
+ name: "permitAttributeBindings",
4603
+ component: "control-plane",
4604
+ category: "access-control",
4605
+ shape: z.object({
4606
+ tenantId: z.string(),
4607
+ workspaceId: z.optional(z.string()),
4608
+ targetType: permitRoleBindingTarget,
4609
+ targetId: z.string(),
4610
+ attributeName: z.string(),
4611
+ attributeType: permitAttributeType,
4612
+ attributeOperator: permitAttributeOperator,
4613
+ attributeValue: z.any(),
4614
+ status: permitRecordStatus,
4615
+ source: z.string().optional(),
4616
+ sourceRef: z.string().optional(),
4617
+ metadata: z.record(z.any()).optional(),
4618
+ createdAt: z.number(),
4619
+ updatedAt: z.number(),
4620
+ createdBy: z.string(),
4621
+ updatedBy: z.string().optional(),
4622
+ expiresAt: z.number().optional()
4623
+ }),
4624
+ indices: [
4625
+ {
4626
+ kind: "index",
4627
+ name: "by_tenant_target",
4628
+ columns: ["tenantId", "targetType", "targetId"]
4629
+ },
4630
+ {
4631
+ kind: "index",
4632
+ name: "by_tenant_target_attribute",
4633
+ columns: ["tenantId", "targetType", "targetId", "attributeName"]
4634
+ },
4635
+ {
4636
+ kind: "index",
4637
+ name: "by_tenant_name",
4638
+ columns: ["tenantId", "attributeName"]
4639
+ },
4640
+ {
4641
+ kind: "index",
4642
+ name: "by_tenant_status",
4643
+ columns: ["tenantId", "status"]
4644
+ }
4645
+ ]
4646
+ });
4647
+ defineTable({
4648
+ name: "permitPolicyBundles",
4649
+ component: "control-plane",
4650
+ category: "access-control",
4651
+ shape: z.object({
4652
+ tenantId: z.string(),
4653
+ workspaceId: z.optional(z.string()),
4654
+ bundleKey: z.string(),
4655
+ version: z.number(),
4656
+ status: permitPolicyBundleStatus,
4657
+ policyHash: z.string().optional(),
4658
+ policyPayload: z.record(z.any()),
4659
+ metadata: z.record(z.any()).optional(),
4660
+ createdBy: z.string(),
4661
+ reviewedBy: z.string().optional(),
4662
+ createdAt: z.number(),
4663
+ updatedAt: z.number(),
4664
+ retiredAt: z.number().optional()
4665
+ }),
4666
+ indices: [
4667
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4668
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4669
+ {
4670
+ kind: "index",
4671
+ name: "by_tenant_bundleKey",
4672
+ columns: ["tenantId", "bundleKey"]
4673
+ },
4674
+ {
4675
+ kind: "index",
4676
+ name: "by_tenant_bundle_version",
4677
+ columns: ["tenantId", "bundleKey", "version"]
4678
+ },
4679
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4680
+ ]
4681
+ });
4682
+ defineTable({
4683
+ name: "permitProjectionOutbox",
4684
+ component: "control-plane",
4685
+ category: "access-control",
4686
+ shape: z.object({
4687
+ syncKey: z.string(),
4688
+ objectType: permitObjectType,
4689
+ objectId: z.string(),
4690
+ operation: permitOutboxOperation,
4691
+ payload: z.record(z.any()),
4692
+ status: permitRecordStatus,
4693
+ attemptCount: z.number(),
4694
+ nextAttemptAt: z.number().optional(),
4695
+ lastError: z.string().optional(),
4696
+ tenantId: z.string().optional(),
4697
+ workspaceId: z.optional(z.string()),
4698
+ principalId: z.string().optional(),
4699
+ permitTenantKey: z.string().optional(),
4700
+ permitResourceType: z.string().optional(),
4701
+ permitResourceKey: z.string().optional(),
4702
+ createdAt: z.number(),
4703
+ updatedAt: z.number(),
4704
+ lastHandledAt: z.number().optional()
4705
+ }),
4706
+ indices: [
4707
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4708
+ { kind: "index", name: "by_status", columns: ["status"] },
4709
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4710
+ {
4711
+ kind: "index",
4712
+ name: "by_tenant_status",
4713
+ columns: ["tenantId", "status"]
4714
+ },
4715
+ {
4716
+ kind: "index",
4717
+ name: "by_objectType",
4718
+ columns: ["objectType", "status"]
4719
+ }
4720
+ ]
4721
+ });
4722
+ defineTable({
4723
+ name: "tenantPermitSyncStates",
4724
+ component: "control-plane",
4725
+ category: "access-control",
4726
+ shape: z.object({
4727
+ syncKey: z.string(),
4728
+ objectType: permitObjectType,
4729
+ objectId: z.string(),
4730
+ tenantId: z.string().optional(),
4731
+ workspaceId: z.string().optional(),
4732
+ principalId: z.string().optional(),
4733
+ permitTenantKey: z.string().optional(),
4734
+ permitResourceType: z.string().optional(),
4735
+ permitResourceKey: z.string().optional(),
4736
+ desiredPayload: z.record(z.any()),
4737
+ lastAppliedPayloadHash: z.string().optional(),
4738
+ status: permitSyncStatus,
4739
+ attemptCount: z.number(),
4740
+ lastError: z.string().optional(),
4741
+ nextAttemptAt: z.number().optional(),
4742
+ lastSyncedAt: z.number().optional(),
4743
+ createdBy: z.string(),
4744
+ updatedBy: z.string().optional(),
4745
+ createdAt: z.number(),
4746
+ updatedAt: z.number()
4747
+ }),
4748
+ indices: [
4749
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4750
+ { kind: "index", name: "by_status", columns: ["status"] },
4751
+ {
4752
+ kind: "index",
4753
+ name: "by_tenant_status",
4754
+ columns: ["tenantId", "status"]
4755
+ },
4756
+ {
4757
+ kind: "index",
4758
+ name: "by_workspace_status",
4759
+ columns: ["workspaceId", "status"]
4760
+ },
4761
+ {
4762
+ kind: "index",
4763
+ name: "by_principal_status",
4764
+ columns: ["principalId", "status"]
4765
+ }
4766
+ ]
4767
+ });
4768
+ defineTable({
4769
+ name: "permitPolicyDecisionReceipts",
4770
+ component: "control-plane",
4771
+ category: "access-control",
4772
+ shape: z.object({
4773
+ tenantId: z.string().optional(),
4774
+ workspaceId: z.string().optional(),
4775
+ principalId: z.string(),
4776
+ subjectType: permitAccessReviewSubjectType.optional(),
4777
+ subjectId: z.string().optional(),
4778
+ resourceType: z.string(),
4779
+ resourceId: z.string(),
4780
+ action: z.string(),
4781
+ decision: permitDecision,
4782
+ reasonCode: z.string(),
4783
+ policyBundleId: z.string().optional(),
4784
+ policyVersion: z.string(),
4785
+ traceId: z.string().optional(),
4786
+ requestId: z.string().optional(),
4787
+ audienceMode: z.string().optional(),
4788
+ audienceKey: z.string().optional(),
4789
+ audienceClass: z.enum(["internal", "restricted_external", "public"]).optional(),
4790
+ metadata: z.record(z.any()).optional(),
4791
+ createdAt: z.number(),
4792
+ expiresAt: z.number().optional(),
4793
+ createdBy: z.string().optional()
4794
+ }),
4795
+ indices: [
4796
+ { kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
4797
+ { kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
4798
+ { kind: "index", name: "by_resource", columns: ["resourceType", "resourceId"] },
4799
+ { kind: "index", name: "by_decision_createdAt", columns: ["decision", "createdAt"] },
4800
+ { kind: "index", name: "by_traceId", columns: ["traceId"] },
4801
+ { kind: "index", name: "by_action", columns: ["action"] }
4802
+ ]
4803
+ });
4804
+ defineTable({
4805
+ name: "permitAccessReviews",
4806
+ component: "control-plane",
4807
+ category: "access-control",
4808
+ shape: z.object({
4809
+ tenantId: z.string(),
4810
+ workspaceId: z.optional(z.string()),
4811
+ reviewKey: z.string(),
4812
+ scope: permitReviewScope,
4813
+ status: permitAccessReviewStatus,
4814
+ subjectType: permitAccessReviewSubjectType,
4815
+ subjectId: z.string(),
4816
+ resourceType: z.string().optional(),
4817
+ resourceKey: z.string().optional(),
4818
+ outcome: z.enum(["allow", "deny"]).optional(),
4819
+ requestedBy: z.string(),
4820
+ reviewedBy: z.string().optional(),
4821
+ requestedAt: z.number(),
4822
+ reviewedAt: z.number().optional(),
4823
+ dueAt: z.number().optional(),
4824
+ justification: z.string().optional(),
4825
+ rationale: z.string().optional(),
4826
+ policyBundleId: z.string().optional(),
4827
+ metadata: z.record(z.any()).optional(),
4828
+ createdAt: z.number(),
4829
+ updatedAt: z.number()
4830
+ }),
4831
+ indices: [
4832
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4833
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4834
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4835
+ {
4836
+ kind: "index",
4837
+ name: "by_tenant_subject",
4838
+ columns: ["tenantId", "subjectType", "subjectId"]
4839
+ },
4840
+ { kind: "index", name: "by_outcome", columns: ["outcome"] },
4841
+ {
4842
+ kind: "index",
4843
+ name: "by_workspace_status",
4844
+ columns: ["workspaceId", "status"]
4845
+ }
4846
+ ]
4847
+ });
4848
+ defineTable({
4849
+ name: "permitAccessReviewItems",
4850
+ component: "control-plane",
4851
+ category: "access-control",
4852
+ shape: z.object({
4853
+ reviewKey: z.string(),
4854
+ itemKey: z.string(),
4855
+ tenantId: z.string(),
4856
+ workspaceId: z.string().optional(),
4857
+ subjectType: permitAccessReviewSubjectType,
4858
+ subjectId: z.string(),
4859
+ resourceType: z.string().optional(),
4860
+ resourceKey: z.string().optional(),
4861
+ role: z.string().optional(),
4862
+ relation: z.string().optional(),
4863
+ status: z.enum(["open", "approved", "revoked", "changed", "deferred"]),
4864
+ reviewerId: z.string().optional(),
4865
+ decisionAt: z.number().optional(),
4866
+ rationale: z.string().optional(),
4867
+ metadata: z.record(z.any()).optional(),
4868
+ createdAt: z.number(),
4869
+ updatedAt: z.number()
4870
+ }),
4871
+ indices: [
4872
+ { kind: "index", name: "by_reviewKey", columns: ["reviewKey"] },
4873
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4874
+ { kind: "index", name: "by_tenant_itemKey", columns: ["tenantId", "itemKey"] },
4875
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4876
+ { kind: "index", name: "by_status", columns: ["status"] }
4877
+ ]
4878
+ });
3965
4879
  defineTable({
3966
4880
  name: "reasoningPermissions",
3967
- component: "identity",
4881
+ component: "control-plane",
3968
4882
  category: "epistemic",
3969
4883
  shape: z.object({
3970
4884
  "topicId": z.string().optional(),
@@ -4211,7 +5125,7 @@ defineTable({
4211
5125
  });
4212
5126
  defineTable({
4213
5127
  name: "users",
4214
- component: "identity",
5128
+ component: "control-plane",
4215
5129
  category: "user",
4216
5130
  shape: z.object({
4217
5131
  "clerkId": z.string(),
@@ -4325,7 +5239,6 @@ defineTable({
4325
5239
  "deployments": z.record(z.object({
4326
5240
  "url": z.string(),
4327
5241
  "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
4328
- "encryptedDeployKey": z.string().optional(),
4329
5242
  "credentialRef": z.string().optional()
4330
5243
  })).optional(),
4331
5244
  "metadata": z.record(z.any()).optional(),
@@ -4340,6 +5253,39 @@ defineTable({
4340
5253
  { kind: "index", name: "by_status", columns: ["status"] }
4341
5254
  ]
4342
5255
  });
5256
+ defineTable({
5257
+ name: "deploymentHosts",
5258
+ component: "mc",
5259
+ category: "workspace",
5260
+ shape: z.object({
5261
+ "host": z.string(),
5262
+ "tenantId": idOf("tenants"),
5263
+ "workspaceId": idOf("workspaces"),
5264
+ "environment": z.enum(["dev", "staging", "prod"]),
5265
+ "target": z.enum(["kernelDeployment", "appDeployment"]),
5266
+ "deploymentUrl": z.string().optional(),
5267
+ "deploymentName": z.string().optional(),
5268
+ "vercelProjectName": z.string().optional(),
5269
+ "vercelProjectId": z.string().optional(),
5270
+ "vercelEnvironment": z.enum(["development", "preview", "staging", "production"]).optional(),
5271
+ "source": z.enum(["vercel_preview", "vercel_production", "vercel_custom_environment", "custom_domain", "manual"]),
5272
+ "status": z.enum(["active", "revoked"]),
5273
+ "metadata": z.record(z.any()).optional(),
5274
+ "createdBy": z.string(),
5275
+ "createdAt": z.number(),
5276
+ "updatedAt": z.number(),
5277
+ "revokedAt": z.number().optional(),
5278
+ "revokedBy": z.string().optional()
5279
+ }),
5280
+ indices: [
5281
+ { kind: "index", name: "by_host", columns: ["host"] },
5282
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
5283
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
5284
+ { kind: "index", name: "by_tenant_workspace_environment", columns: ["tenantId", "workspaceId", "environment"] },
5285
+ { kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
5286
+ { kind: "index", name: "by_status", columns: ["status"] }
5287
+ ]
5288
+ });
4343
5289
  defineTable({
4344
5290
  name: "worktreeBeliefCluster",
4345
5291
  component: "kernel",
@@ -4647,8 +5593,8 @@ defineTable({
4647
5593
  });
4648
5594
  z.object({
4649
5595
  manifestVersion: z.string(),
4650
- componentName: z.enum(["kernel", "identity"]),
4651
- tier: z.enum(["K", "I"]),
5596
+ componentName: z.enum(["kernel", "control-plane"]),
5597
+ tier: z.enum(["K", "CP"]),
4652
5598
  packageVersion: z.string(),
4653
5599
  tables: z.array(
4654
5600
  z.object({
@@ -4774,129 +5720,994 @@ var edgePolicyManifest = {
4774
5720
  // ../contracts/src/tenant-client.contract.ts
4775
5721
  var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
4776
5722
  {
4777
- packageName: "@lucern/access-control",
4778
- role: "runtime_entrypoint",
4779
- directTenantImport: true
5723
+ packageName: "@lucern/access-control",
5724
+ role: "runtime_entrypoint",
5725
+ directTenantImport: true
5726
+ },
5727
+ {
5728
+ packageName: "@lucern/agent",
5729
+ role: "platform_runtime",
5730
+ directTenantImport: false
5731
+ },
5732
+ {
5733
+ packageName: "@lucern/auth",
5734
+ role: "sdk_dependency",
5735
+ directTenantImport: false
5736
+ },
5737
+ {
5738
+ packageName: "@lucern/cli",
5739
+ role: "developer_tool",
5740
+ directTenantImport: false
5741
+ },
5742
+ {
5743
+ packageName: "@lucern/client-core",
5744
+ role: "sdk_dependency",
5745
+ directTenantImport: false
5746
+ },
5747
+ {
5748
+ packageName: "@lucern/confidence",
5749
+ role: "sdk_dependency",
5750
+ directTenantImport: false
5751
+ },
5752
+ {
5753
+ packageName: "@lucern/config",
5754
+ role: "configuration",
5755
+ directTenantImport: false
5756
+ },
5757
+ {
5758
+ packageName: "@lucern/contracts",
5759
+ role: "contract_entrypoint",
5760
+ directTenantImport: true
5761
+ },
5762
+ {
5763
+ packageName: "@lucern/control-plane",
5764
+ role: "component_runtime",
5765
+ directTenantImport: false
5766
+ },
5767
+ {
5768
+ packageName: "@lucern/developer-kit",
5769
+ role: "developer_tool",
5770
+ directTenantImport: false
5771
+ },
5772
+ {
5773
+ packageName: "@lucern/events",
5774
+ role: "sdk_dependency",
5775
+ directTenantImport: false
5776
+ },
5777
+ {
5778
+ packageName: "@lucern/graph-primitives",
5779
+ role: "sdk_dependency",
5780
+ directTenantImport: false
5781
+ },
5782
+ {
5783
+ packageName: "@lucern/graph-sync",
5784
+ role: "host_addon_runtime",
5785
+ directTenantImport: true
5786
+ },
5787
+ {
5788
+ packageName: "@lucern/mcp",
5789
+ role: "runtime_entrypoint",
5790
+ directTenantImport: true
5791
+ },
5792
+ {
5793
+ packageName: "@lucern/pack-host",
5794
+ role: "platform_runtime",
5795
+ directTenantImport: false
5796
+ },
5797
+ {
5798
+ packageName: "@lucern/pack-installer",
5799
+ role: "developer_tool",
5800
+ directTenantImport: false
5801
+ },
5802
+ {
5803
+ packageName: "@lucern/proof-compiler",
5804
+ role: "developer_tool",
5805
+ directTenantImport: false
5806
+ },
5807
+ {
5808
+ packageName: "@lucern/react",
5809
+ role: "runtime_entrypoint",
5810
+ directTenantImport: true
5811
+ },
5812
+ {
5813
+ packageName: "@lucern/reasoning-kernel",
5814
+ role: "component_runtime",
5815
+ directTenantImport: false
5816
+ },
5817
+ {
5818
+ packageName: "@lucern/sdk",
5819
+ role: "runtime_entrypoint",
5820
+ directTenantImport: true
5821
+ },
5822
+ {
5823
+ packageName: "@lucern/secrets",
5824
+ role: "sdk_dependency",
5825
+ directTenantImport: false
5826
+ },
5827
+ {
5828
+ packageName: "@lucern/server-core",
5829
+ role: "platform_runtime",
5830
+ directTenantImport: false
5831
+ },
5832
+ {
5833
+ packageName: "@lucern/testing",
5834
+ role: "test_support",
5835
+ directTenantImport: false
5836
+ },
5837
+ {
5838
+ packageName: "@lucern/types",
5839
+ role: "contract_entrypoint",
5840
+ directTenantImport: true
5841
+ }
5842
+ ];
5843
+ TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
5844
+ (entry) => entry.packageName
5845
+ );
5846
+
5847
+ // ../contracts/src/infisical-runtime.contract.ts
5848
+ var INFISICAL_TENANT_SOFTWARE_SYSTEMS = [
5849
+ {
5850
+ id: "stack-frontend",
5851
+ tenantKey: "stack",
5852
+ workspaceKey: "frontend",
5853
+ vercelProjectName: "ai-chatbot-diao",
5854
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5855
+ vercelProjectId: "prj_PihFw8kohSSw14nZs9YQV3xVo517",
5856
+ repository: {
5857
+ owner: "stack-vc",
5858
+ name: "front-end"
5859
+ },
5860
+ sharedSourcePath: "/tenants/stack",
5861
+ sharedVariablePolicy: "tenant_shared_all_systems",
5862
+ convex: {
5863
+ urlEnv: "CONVEX_FRONTEND_URL",
5864
+ deployKeyEnv: "CONVEX_FRONTEND_DEPLOY_KEY",
5865
+ preprodDeployment: "rugged-lobster-664",
5866
+ prodDeployment: "wonderful-toucan-0"
5867
+ }
5868
+ },
5869
+ {
5870
+ id: "stackos",
5871
+ tenantKey: "stack",
5872
+ workspaceKey: "stackos",
5873
+ vercelProjectName: "stackos",
5874
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5875
+ vercelProjectId: "prj_rXLAL0Z6v9p1fasKbomby6GI7kau",
5876
+ repository: {
5877
+ owner: "stack-vc",
5878
+ name: "stackos"
5879
+ },
5880
+ sharedSourcePath: "/tenants/stack",
5881
+ sharedVariablePolicy: "tenant_shared_all_systems",
5882
+ convex: {
5883
+ urlEnv: "CONVEX_STACKOS_URL",
5884
+ deployKeyEnv: "CONVEX_STACKOS_DEPLOY_KEY",
5885
+ preprodDeployment: "giant-mandrill-761",
5886
+ prodDeployment: "good-snake-515"
5887
+ }
5888
+ },
5889
+ {
5890
+ id: "stack-eng",
5891
+ tenantKey: "stack",
5892
+ workspaceKey: "engineering",
5893
+ vercelProjectName: "stackos-engineering-graph",
5894
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5895
+ vercelProjectId: "prj_zAU0Zn9GkbHjHI63dxW4vLpmoqTJ",
5896
+ repository: {
5897
+ owner: "stack-vc",
5898
+ name: "stackos-engineering-graph"
5899
+ },
5900
+ sharedSourcePath: "/tenants/stack/engineering",
5901
+ sharedVariablePolicy: "tenant_shared_all_systems",
5902
+ convex: {
5903
+ urlEnv: "CONVEX_STACK_ENG_URL",
5904
+ deployKeyEnv: "CONVEX_STACK_ENG_DEPLOY_KEY",
5905
+ preprodDeployment: "small-oyster-270",
5906
+ prodDeployment: "bold-cuttlefish-804"
5907
+ }
5908
+ },
5909
+ {
5910
+ id: "lucern-graph",
5911
+ tenantKey: "lucern",
5912
+ workspaceKey: "lucern",
5913
+ vercelProjectName: "lucern-graph",
5914
+ vercelTeamId: "team_vTHxxs8GAoAFUe6RWMlYt7fY",
5915
+ vercelProjectId: "prj_KJ8EKV8vGM5xURpqmwTwmECEGPgQ",
5916
+ repository: {
5917
+ owner: "LucernAI",
5918
+ name: "lucern-graph"
5919
+ },
5920
+ sharedSourcePath: "/tenants/lucern/shared",
5921
+ sharedVariablePolicy: "tenant_shared_all_systems",
5922
+ convex: {
5923
+ urlEnv: "CONVEX_LUCERN_URL",
5924
+ deployKeyEnv: "CONVEX_LUCERN_DEPLOY_KEY",
5925
+ preprodDeployment: "good-blackbird-774",
5926
+ prodDeployment: "precious-dog-365"
5927
+ }
5928
+ }
5929
+ ];
5930
+ var TENANT_SHARED_SECRET_DEFINITION_TEMPLATES = [
5931
+ {
5932
+ idSuffix: "clerk.publishable",
5933
+ canonicalName: "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
5934
+ aliases: ["CLERK_PUBLISHABLE_KEY"],
5935
+ required: true,
5936
+ secret: false,
5937
+ public: true,
5938
+ 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."
5939
+ },
5940
+ {
5941
+ idSuffix: "clerk.secret",
5942
+ canonicalName: "CLERK_SECRET_KEY",
5943
+ required: true,
5944
+ secret: true,
5945
+ public: false,
5946
+ description: "Tenant-owned Clerk backend secret used only by that tenant's server runtimes."
5947
+ },
5948
+ {
5949
+ idSuffix: "clerk.project",
5950
+ canonicalName: "CLERK_PROJECT_ID",
5951
+ required: true,
5952
+ secret: false,
5953
+ public: false,
5954
+ description: "Tenant-owned Clerk project id used to resolve canonical Clerk aliases."
5955
+ },
5956
+ {
5957
+ idSuffix: "clerk.jwks",
5958
+ canonicalName: "CLERK_JWT_ISSUER_DOMAIN",
5959
+ aliases: ["CLERK_ISSUER_URL", "CLERK_JWKS_URL"],
5960
+ required: false,
5961
+ secret: false,
5962
+ public: false,
5963
+ description: "Tenant Clerk issuer/JWKS URL consumed by Convex auth.config.ts."
5964
+ },
5965
+ {
5966
+ idSuffix: "clerk.jwt-key",
5967
+ canonicalName: "CLERK_JWT_KEY",
5968
+ required: false,
5969
+ secret: true,
5970
+ public: false,
5971
+ description: "Tenant Clerk JWT public verification key used by bearer-token API routes."
5972
+ },
5973
+ {
5974
+ idSuffix: "clerk.authorized-parties",
5975
+ canonicalName: "CLERK_AUTHORIZED_PARTIES",
5976
+ aliases: ["CLERK_MOBILE_AUTHORIZED_PARTIES"],
5977
+ required: false,
5978
+ secret: false,
5979
+ public: false,
5980
+ description: "Comma-separated Clerk authorized parties for browser and mobile bearer-token validation."
5981
+ },
5982
+ {
5983
+ idSuffix: "clerk.sign-in-url",
5984
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
5985
+ required: false,
5986
+ secret: false,
5987
+ public: true,
5988
+ description: "Tenant Clerk sign-in route for custom app login surfaces."
5989
+ },
5990
+ {
5991
+ idSuffix: "clerk.sign-up-url",
5992
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
5993
+ required: false,
5994
+ secret: false,
5995
+ public: true,
5996
+ description: "Tenant Clerk sign-up route for custom app login surfaces."
5997
+ }
5998
+ ];
5999
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6000
+ (system) => TENANT_SHARED_SECRET_DEFINITION_TEMPLATES.map(
6001
+ (template) => ({
6002
+ id: `tenant.${system.id}.${template.idSuffix}`,
6003
+ canonicalName: template.canonicalName,
6004
+ aliases: "aliases" in template ? template.aliases : void 0,
6005
+ owner: "tenant",
6006
+ scope: "tenant",
6007
+ sourcePath: system.sharedSourcePath,
6008
+ environmentPolicy: "environment_specific",
6009
+ required: template.required,
6010
+ secret: template.secret,
6011
+ public: template.public,
6012
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6013
+ destinations: [
6014
+ {
6015
+ kind: "vercel",
6016
+ target: system.vercelProjectName,
6017
+ environmentPolicy: "preprod_staging_prod_prod"
6018
+ },
6019
+ {
6020
+ kind: "convex",
6021
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6022
+ environmentPolicy: "preprod_staging_prod_prod"
6023
+ }
6024
+ ],
6025
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6026
+ })
6027
+ )
6028
+ );
6029
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.map(
6030
+ (system) => ({
6031
+ id: `tenant.${system.id}.install-lucern-npm`,
6032
+ canonicalName: "INSTALL_LUCERN_NPM",
6033
+ owner: "provider",
6034
+ scope: "global",
6035
+ sourcePath: "/tenants/shared",
6036
+ environmentPolicy: "same_all_environments",
6037
+ required: true,
6038
+ secret: true,
6039
+ public: false,
6040
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6041
+ destinations: [
6042
+ {
6043
+ kind: "vercel",
6044
+ target: system.vercelProjectName,
6045
+ environmentPolicy: "same_all_environments"
6046
+ },
6047
+ {
6048
+ kind: "github_actions",
6049
+ target: `${system.repository.owner}/${system.repository.name}`,
6050
+ environmentPolicy: "same_all_environments"
6051
+ }
6052
+ ],
6053
+ description: `${system.tenantKey}/${system.workspaceKey}: read-only npm install token for published @lucern/* packages.`
6054
+ })
6055
+ );
6056
+ var TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS = ["stack-frontend", "stackos"];
6057
+ var TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES = [
6058
+ {
6059
+ idSuffix: "ai.openai-api-key",
6060
+ canonicalName: "OPENAI_API_KEY",
6061
+ required: false,
6062
+ secret: true,
6063
+ public: false,
6064
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6065
+ description: "Tenant-owned OpenAI key for product runtime LLM calls."
4780
6066
  },
4781
6067
  {
4782
- packageName: "@lucern/agent",
4783
- role: "platform_runtime",
4784
- directTenantImport: false
6068
+ idSuffix: "ai.anthropic-api-key",
6069
+ canonicalName: "ANTHROPIC_API_KEY",
6070
+ required: false,
6071
+ secret: true,
6072
+ public: false,
6073
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6074
+ description: "Tenant-owned Anthropic key for product runtime LLM calls."
4785
6075
  },
4786
6076
  {
4787
- packageName: "@lucern/auth",
4788
- role: "sdk_dependency",
4789
- directTenantImport: false
6077
+ idSuffix: "ai.gemini-api-key",
6078
+ canonicalName: "GEMINI_API_KEY",
6079
+ aliases: ["GOOGLE_AI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
6080
+ required: false,
6081
+ secret: true,
6082
+ public: false,
6083
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6084
+ description: "Tenant-owned Google/Gemini key for product runtime LLM calls."
4790
6085
  },
4791
6086
  {
4792
- packageName: "@lucern/cli",
4793
- role: "developer_tool",
4794
- directTenantImport: false
6087
+ idSuffix: "langfuse.secret-key",
6088
+ canonicalName: "LANGFUSE_SECRET_KEY",
6089
+ required: false,
6090
+ secret: true,
6091
+ public: false,
6092
+ consumers: [
6093
+ "tenant-vercel-app",
6094
+ "tenant-convex-deployment",
6095
+ "tenant-observability"
6096
+ ],
6097
+ description: "Tenant-owned Langfuse secret key for product AI tracing."
4795
6098
  },
4796
6099
  {
4797
- packageName: "@lucern/client-core",
4798
- role: "sdk_dependency",
4799
- directTenantImport: false
6100
+ idSuffix: "langfuse.public-key",
6101
+ canonicalName: "LANGFUSE_PUBLIC_KEY",
6102
+ required: false,
6103
+ secret: false,
6104
+ public: false,
6105
+ consumers: [
6106
+ "tenant-vercel-app",
6107
+ "tenant-convex-deployment",
6108
+ "tenant-observability"
6109
+ ],
6110
+ description: "Tenant-owned Langfuse public key for product AI tracing."
4800
6111
  },
4801
6112
  {
4802
- packageName: "@lucern/confidence",
4803
- role: "sdk_dependency",
4804
- directTenantImport: false
6113
+ idSuffix: "langfuse.base-url",
6114
+ canonicalName: "LANGFUSE_BASE_URL",
6115
+ aliases: ["LANGFUSE_BASEURL", "LANGFUSE_HOST"],
6116
+ required: false,
6117
+ secret: false,
6118
+ public: false,
6119
+ consumers: [
6120
+ "tenant-vercel-app",
6121
+ "tenant-convex-deployment",
6122
+ "tenant-observability"
6123
+ ],
6124
+ description: "Tenant-owned Langfuse API origin."
4805
6125
  },
4806
6126
  {
4807
- packageName: "@lucern/config",
4808
- role: "configuration",
4809
- directTenantImport: false
6127
+ idSuffix: "graph.neo4j-uri",
6128
+ canonicalName: "NEO4J_URI",
6129
+ required: false,
6130
+ secret: false,
6131
+ public: false,
6132
+ consumers: [
6133
+ "tenant-vercel-app",
6134
+ "tenant-convex-deployment",
6135
+ "tenant-graph-sync"
6136
+ ],
6137
+ description: "Tenant-owned Neo4j URI for product graph-sync."
4810
6138
  },
4811
6139
  {
4812
- packageName: "@lucern/contracts",
4813
- role: "contract_entrypoint",
4814
- directTenantImport: true
6140
+ idSuffix: "graph.neo4j-user",
6141
+ canonicalName: "NEO4J_USER",
6142
+ aliases: ["NEO4J_USERNAME"],
6143
+ required: false,
6144
+ secret: false,
6145
+ public: false,
6146
+ consumers: [
6147
+ "tenant-vercel-app",
6148
+ "tenant-convex-deployment",
6149
+ "tenant-graph-sync"
6150
+ ],
6151
+ description: "Tenant-owned Neo4j user for product graph-sync."
4815
6152
  },
4816
6153
  {
4817
- packageName: "@lucern/control-plane",
4818
- role: "platform_runtime",
4819
- directTenantImport: false
6154
+ idSuffix: "graph.neo4j-password",
6155
+ canonicalName: "NEO4J_PASSWORD",
6156
+ required: false,
6157
+ secret: true,
6158
+ public: false,
6159
+ consumers: [
6160
+ "tenant-vercel-app",
6161
+ "tenant-convex-deployment",
6162
+ "tenant-graph-sync"
6163
+ ],
6164
+ description: "Tenant-owned Neo4j password for product graph-sync."
4820
6165
  },
4821
6166
  {
4822
- packageName: "@lucern/developer-kit",
4823
- role: "developer_tool",
4824
- directTenantImport: false
6167
+ idSuffix: "graph.neo4j-sync-secret",
6168
+ canonicalName: "NEO4J_SYNC_SECRET",
6169
+ required: false,
6170
+ secret: true,
6171
+ public: false,
6172
+ consumers: [
6173
+ "tenant-vercel-app",
6174
+ "tenant-convex-deployment",
6175
+ "tenant-graph-sync"
6176
+ ],
6177
+ description: "Tenant-owned shared secret for product Convex-to-HTTP graph-sync calls."
4825
6178
  },
4826
6179
  {
4827
- packageName: "@lucern/events",
4828
- role: "sdk_dependency",
4829
- directTenantImport: false
6180
+ idSuffix: "graph.neo4j-database",
6181
+ canonicalName: "NEO4J_DATABASE",
6182
+ required: false,
6183
+ secret: false,
6184
+ public: false,
6185
+ consumers: [
6186
+ "tenant-vercel-app",
6187
+ "tenant-convex-deployment",
6188
+ "tenant-graph-sync"
6189
+ ],
6190
+ description: "Tenant-owned Neo4j database name for product graph-sync."
4830
6191
  },
4831
6192
  {
4832
- packageName: "@lucern/graph-primitives",
4833
- role: "sdk_dependency",
4834
- directTenantImport: false
6193
+ idSuffix: "vector.pinecone-api-key",
6194
+ canonicalName: "PINECONE_API_KEY",
6195
+ required: false,
6196
+ secret: true,
6197
+ public: false,
6198
+ consumers: [
6199
+ "tenant-vercel-app",
6200
+ "tenant-convex-deployment",
6201
+ "tenant-vector-store"
6202
+ ],
6203
+ description: "Tenant-owned Pinecone API key for product vector search."
4835
6204
  },
4836
6205
  {
4837
- packageName: "@lucern/graph-sync",
4838
- role: "host_addon_runtime",
4839
- directTenantImport: true
6206
+ idSuffix: "vector.pinecone-index-name",
6207
+ canonicalName: "PINECONE_INDEX_NAME",
6208
+ aliases: ["PINECONE_INDEX"],
6209
+ required: false,
6210
+ secret: false,
6211
+ public: false,
6212
+ consumers: [
6213
+ "tenant-vercel-app",
6214
+ "tenant-convex-deployment",
6215
+ "tenant-vector-store"
6216
+ ],
6217
+ description: "Tenant-owned Pinecone index name for product vector search."
4840
6218
  },
4841
6219
  {
4842
- packageName: "@lucern/identity",
4843
- role: "component_runtime",
4844
- directTenantImport: false
6220
+ idSuffix: "vector.pinecone-host",
6221
+ canonicalName: "PINECONE_HOST",
6222
+ aliases: ["PINECONE_INDEX_HOST"],
6223
+ required: false,
6224
+ secret: false,
6225
+ public: false,
6226
+ consumers: [
6227
+ "tenant-vercel-app",
6228
+ "tenant-convex-deployment",
6229
+ "tenant-vector-store"
6230
+ ],
6231
+ description: "Tenant-owned Pinecone host for product vector search."
4845
6232
  },
4846
6233
  {
4847
- packageName: "@lucern/mcp",
4848
- role: "runtime_entrypoint",
4849
- directTenantImport: true
6234
+ idSuffix: "vector.pinecone-namespace",
6235
+ canonicalName: "PINECONE_NAMESPACE",
6236
+ required: false,
6237
+ secret: false,
6238
+ public: false,
6239
+ consumers: [
6240
+ "tenant-vercel-app",
6241
+ "tenant-convex-deployment",
6242
+ "tenant-vector-store"
6243
+ ],
6244
+ description: "Tenant-owned Pinecone namespace for product vector search isolation."
4850
6245
  },
4851
6246
  {
4852
- packageName: "@lucern/pack-host",
4853
- role: "platform_runtime",
4854
- directTenantImport: false
6247
+ idSuffix: "storage.aws-access-key-id",
6248
+ canonicalName: "AWS_ACCESS_KEY_ID",
6249
+ required: false,
6250
+ secret: true,
6251
+ public: false,
6252
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6253
+ description: "Tenant-owned AWS access key id for document/file ingestion."
4855
6254
  },
4856
6255
  {
4857
- packageName: "@lucern/pack-installer",
4858
- role: "developer_tool",
4859
- directTenantImport: false
6256
+ idSuffix: "storage.aws-secret-access-key",
6257
+ canonicalName: "AWS_SECRET_ACCESS_KEY",
6258
+ required: false,
6259
+ secret: true,
6260
+ public: false,
6261
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6262
+ description: "Tenant-owned AWS secret access key for document/file ingestion."
4860
6263
  },
4861
6264
  {
4862
- packageName: "@lucern/proof-compiler",
4863
- role: "developer_tool",
4864
- directTenantImport: false
6265
+ idSuffix: "storage.aws-region",
6266
+ canonicalName: "AWS_REGION",
6267
+ required: false,
6268
+ secret: false,
6269
+ public: false,
6270
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6271
+ description: "Tenant-owned AWS region for document/file ingestion."
4865
6272
  },
4866
6273
  {
4867
- packageName: "@lucern/react",
4868
- role: "runtime_entrypoint",
4869
- directTenantImport: true
6274
+ idSuffix: "observability.sentry-dsn",
6275
+ canonicalName: "NEXT_PUBLIC_SENTRY_DSN",
6276
+ aliases: ["NEXT_PUBLIC_SENTRY_DSN_NEXTJS", "SENTRY_DSN"],
6277
+ required: false,
6278
+ secret: false,
6279
+ public: true,
6280
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6281
+ description: "Tenant-owned Sentry DSN for app telemetry."
4870
6282
  },
4871
6283
  {
4872
- packageName: "@lucern/reasoning-kernel",
4873
- role: "component_runtime",
4874
- directTenantImport: false
6284
+ idSuffix: "observability.sentry-auth-token",
6285
+ canonicalName: "SENTRY_AUTH_TOKEN",
6286
+ required: false,
6287
+ secret: true,
6288
+ public: false,
6289
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6290
+ description: "Tenant-owned Sentry release token for app deployments."
4875
6291
  },
4876
6292
  {
4877
- packageName: "@lucern/sdk",
4878
- role: "runtime_entrypoint",
4879
- directTenantImport: true
6293
+ idSuffix: "observability.sentry-org",
6294
+ canonicalName: "SENTRY_ORG",
6295
+ aliases: ["SENTRY_ORG_SLUG"],
6296
+ required: false,
6297
+ secret: false,
6298
+ public: false,
6299
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6300
+ description: "Tenant-owned Sentry org slug for release uploads."
4880
6301
  },
4881
6302
  {
4882
- packageName: "@lucern/server-core",
4883
- role: "platform_runtime",
4884
- directTenantImport: false
6303
+ idSuffix: "observability.sentry-project",
6304
+ canonicalName: "SENTRY_PROJECT",
6305
+ aliases: ["SENTRY_PROJECT_NEXTJS"],
6306
+ required: false,
6307
+ secret: false,
6308
+ public: false,
6309
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6310
+ description: "Tenant-owned Sentry project slug for release uploads."
4885
6311
  },
4886
6312
  {
4887
- packageName: "@lucern/testing",
4888
- role: "test_support",
4889
- directTenantImport: false
6313
+ idSuffix: "observability.sentry-environment",
6314
+ canonicalName: "NEXT_PUBLIC_SENTRY_ENVIRONMENT",
6315
+ aliases: ["SENTRY_ENVIRONMENT"],
6316
+ required: false,
6317
+ secret: false,
6318
+ public: true,
6319
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6320
+ description: "Tenant-owned Sentry environment label."
4890
6321
  },
4891
6322
  {
4892
- packageName: "@lucern/types",
4893
- role: "contract_entrypoint",
4894
- directTenantImport: true
6323
+ idSuffix: "observability.sentry-release",
6324
+ canonicalName: "NEXT_PUBLIC_SENTRY_RELEASE",
6325
+ aliases: ["SENTRY_RELEASE"],
6326
+ required: false,
6327
+ secret: false,
6328
+ public: true,
6329
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6330
+ description: "Tenant-owned Sentry release label."
6331
+ },
6332
+ {
6333
+ idSuffix: "observability.sentry-client-options",
6334
+ canonicalName: "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE",
6335
+ aliases: [
6336
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS",
6337
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS_NEXTJS",
6338
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS",
6339
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS_NEXTJS",
6340
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS",
6341
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS_NEXTJS",
6342
+ "NEXT_PUBLIC_SENTRY_ENABLE_LOGS",
6343
+ "NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE",
6344
+ "NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE",
6345
+ "NEXT_PUBLIC_SENTRY_SEND_DEFAULT_PII",
6346
+ "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE_NEXTJS"
6347
+ ],
6348
+ required: false,
6349
+ secret: false,
6350
+ public: true,
6351
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6352
+ description: "Tenant-owned public Sentry tuning values for Next.js client instrumentation."
6353
+ },
6354
+ {
6355
+ idSuffix: "observability.sentry-webhook-secret",
6356
+ canonicalName: "SENTRY_WEBHOOK_SECRET",
6357
+ required: false,
6358
+ secret: true,
6359
+ public: false,
6360
+ consumers: ["tenant-convex-deployment", "tenant-observability"],
6361
+ description: "Tenant-owned Sentry webhook verification secret."
6362
+ },
6363
+ {
6364
+ idSuffix: "lucern.gateway-api-key",
6365
+ canonicalName: "LUCERN_API_KEY",
6366
+ aliases: ["STACK_API_KEY"],
6367
+ required: false,
6368
+ secret: true,
6369
+ public: false,
6370
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6371
+ description: "Tenant-scoped Lucern/MC gateway API key for product front-door calls."
6372
+ },
6373
+ {
6374
+ idSuffix: "lucern.gateway-base-url",
6375
+ canonicalName: "LUCERN_BASE_URL",
6376
+ aliases: ["LUCERN_API_BASE_URL", "LUCERN_GATEWAY_BASE_URL"],
6377
+ required: false,
6378
+ secret: false,
6379
+ public: false,
6380
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6381
+ description: "Lucern/MC gateway base URL used by tenant product apps."
6382
+ },
6383
+ {
6384
+ idSuffix: "lucern.proxy-token-secret",
6385
+ canonicalName: "LUCERN_PROXY_TOKEN_SECRET",
6386
+ required: false,
6387
+ secret: true,
6388
+ public: false,
6389
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6390
+ description: "Tenant-owned secret for signing internal proxy/session tokens in product apps."
6391
+ },
6392
+ {
6393
+ idSuffix: "tenant.integrations.linear-api-key",
6394
+ canonicalName: "LINEAR_API_KEY",
6395
+ required: false,
6396
+ secret: true,
6397
+ public: false,
6398
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6399
+ description: "Tenant-owned Linear API key for support/slash-command flows."
6400
+ },
6401
+ {
6402
+ idSuffix: "tenant.vercel.bypass-token",
6403
+ canonicalName: "VERCEL_AUTOMATION_BYPASS_SECRET",
6404
+ aliases: ["NEXT_PUBLIC_VERCEL_BYPASS_TOKEN"],
6405
+ required: false,
6406
+ secret: true,
6407
+ public: false,
6408
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6409
+ description: "Tenant-owned Vercel automation bypass token. Public alias is legacy and should be removed from app code."
4895
6410
  }
4896
6411
  ];
4897
- TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
4898
- (entry) => entry.packageName
6412
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.filter(
6413
+ (system) => TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS.includes(system.id)
6414
+ ).flatMap(
6415
+ (system) => TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES.map(
6416
+ (template) => ({
6417
+ id: `tenant.${system.id}.${template.idSuffix}`,
6418
+ canonicalName: template.canonicalName,
6419
+ aliases: "aliases" in template ? template.aliases : void 0,
6420
+ owner: "tenant",
6421
+ scope: "tenant",
6422
+ sourcePath: system.sharedSourcePath,
6423
+ environmentPolicy: "environment_specific",
6424
+ required: template.required,
6425
+ secret: template.secret,
6426
+ public: template.public,
6427
+ consumers: template.consumers,
6428
+ destinations: [
6429
+ {
6430
+ kind: "vercel",
6431
+ target: system.vercelProjectName,
6432
+ environmentPolicy: "preprod_staging_prod_prod"
6433
+ },
6434
+ {
6435
+ kind: "convex",
6436
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6437
+ environmentPolicy: "preprod_staging_prod_prod"
6438
+ },
6439
+ {
6440
+ kind: "github_actions",
6441
+ target: `${system.repository.owner}/${system.repository.name}`,
6442
+ environmentPolicy: "preprod_staging_prod_prod"
6443
+ }
6444
+ ],
6445
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6446
+ })
6447
+ )
6448
+ );
6449
+ function tenantVercelConvexUrlWriteNames(system) {
6450
+ const names = [system.convex.urlEnv, "NEXT_PUBLIC_CONVEX_URL"];
6451
+ if (system.id === "stack-eng") {
6452
+ return [...names, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6453
+ }
6454
+ return names;
6455
+ }
6456
+ function tenantRepositoryConvexUrlWriteNames(system) {
6457
+ if (system.id === "stack-eng") {
6458
+ return [system.convex.urlEnv, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6459
+ }
6460
+ return [system.convex.urlEnv];
6461
+ }
6462
+ function tenantRepositoryConvexDeployKeyWriteNames(system) {
6463
+ if (system.id === "stack-eng") {
6464
+ return [system.convex.deployKeyEnv, "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6465
+ }
6466
+ return [system.convex.deployKeyEnv];
6467
+ }
6468
+ function tenantConvexUrlAliases(system) {
6469
+ if (system.id === "stack-frontend") {
6470
+ return [
6471
+ "CONVEX_PROD_URL",
6472
+ "CONVEX_STACK_V2_PROD_URL",
6473
+ "CONVEX_STACK_V2_STAGING_URL",
6474
+ "STACK_CONVEX_URL"
6475
+ ];
6476
+ }
6477
+ if (system.id === "stackos") {
6478
+ return [
6479
+ "CONVEX_CLOUD_URL",
6480
+ "CONVEX_STACK_URL",
6481
+ "CONVEX_URL",
6482
+ "CONVEX_URL_DEVELOPMENT",
6483
+ "CONVEX_URL_PRODUCTION",
6484
+ "STACK_CONVEX_URL"
6485
+ ];
6486
+ }
6487
+ if (system.id === "stack-eng") {
6488
+ return ["STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6489
+ }
6490
+ if (system.id === "lucern-graph") {
6491
+ return [
6492
+ "CONVEX_GRAPH_URL",
6493
+ "LUCERN_PROD_URL",
6494
+ "NEXT_PUBLIC_LUCERN_GRAPH_URL"
6495
+ ];
6496
+ }
6497
+ return void 0;
6498
+ }
6499
+ function tenantConvexDeployKeyAliases(system) {
6500
+ if (system.id === "stack-frontend") {
6501
+ return [
6502
+ "CONVEX_STACK_V2_PROD_DEPLOY_KEY",
6503
+ "CONVEX_STACK_V2_STAGING_DEPLOY_KEY",
6504
+ "STACK_DEPLOY_KEY"
6505
+ ];
6506
+ }
6507
+ if (system.id === "stackos") {
6508
+ return [
6509
+ "CONVEX_DEPLOY_KEY",
6510
+ "CONVEX_DEV_DEPLOY_KEY",
6511
+ "CONVEX_PROD_DEPLOY_KEY",
6512
+ "CONVEX_STACK_DEPLOY_KEY",
6513
+ "STACK_DEPLOY_KEY"
6514
+ ];
6515
+ }
6516
+ if (system.id === "stack-eng") {
6517
+ return ["CONVEX_DEPLOY_KEY", "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6518
+ }
6519
+ if (system.id === "lucern-graph") {
6520
+ return [
6521
+ "CONVEX_DEPLOY_KEY",
6522
+ "CONVEX_GRAPH_DEPLOY_KEY",
6523
+ "LUCERN_CONVEX_DEPLOY_KEY",
6524
+ "LUCERN_DEV_DEPLOY_KEY",
6525
+ "LUCERN_PROD_DEPLOY_KEY"
6526
+ ];
6527
+ }
6528
+ return void 0;
6529
+ }
6530
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6531
+ (system) => {
6532
+ if (system.id === "lucern-graph") {
6533
+ return [
6534
+ {
6535
+ id: "tenant.lucern-graph.public.tenant-id",
6536
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_ID",
6537
+ aliases: ["NEXT_PUBLIC_LUCERN_TENANT_ID"],
6538
+ owner: "tenant",
6539
+ scope: "workspace",
6540
+ sourcePath: system.sharedSourcePath,
6541
+ environmentPolicy: "environment_specific",
6542
+ required: false,
6543
+ secret: false,
6544
+ public: true,
6545
+ consumers: ["tenant-vercel-app"],
6546
+ destinations: [
6547
+ {
6548
+ kind: "vercel",
6549
+ target: system.vercelProjectName,
6550
+ environmentPolicy: "preprod_staging_prod_prod"
6551
+ }
6552
+ ],
6553
+ description: "Lucern graph public tenant id used by the standalone graph explorer."
6554
+ },
6555
+ {
6556
+ id: "tenant.lucern-graph.public.tenant-label",
6557
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_LABEL",
6558
+ owner: "tenant",
6559
+ scope: "workspace",
6560
+ sourcePath: system.sharedSourcePath,
6561
+ environmentPolicy: "environment_specific",
6562
+ required: false,
6563
+ secret: false,
6564
+ public: true,
6565
+ consumers: ["tenant-vercel-app"],
6566
+ destinations: [
6567
+ {
6568
+ kind: "vercel",
6569
+ target: system.vercelProjectName,
6570
+ environmentPolicy: "preprod_staging_prod_prod"
6571
+ }
6572
+ ],
6573
+ description: "Lucern graph public tenant label used by the standalone graph explorer."
6574
+ }
6575
+ ];
6576
+ }
6577
+ if (system.id === "stack-eng") {
6578
+ return [
6579
+ {
6580
+ id: "tenant.stack-eng.public.tenant-id",
6581
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_ID",
6582
+ owner: "tenant",
6583
+ scope: "workspace",
6584
+ sourcePath: system.sharedSourcePath,
6585
+ environmentPolicy: "environment_specific",
6586
+ required: false,
6587
+ secret: false,
6588
+ public: true,
6589
+ consumers: ["tenant-vercel-app"],
6590
+ destinations: [
6591
+ {
6592
+ kind: "vercel",
6593
+ target: system.vercelProjectName,
6594
+ environmentPolicy: "preprod_staging_prod_prod"
6595
+ }
6596
+ ],
6597
+ description: "Stack engineering graph public tenant id used by the graph explorer."
6598
+ },
6599
+ {
6600
+ id: "tenant.stack-eng.public.tenant-label",
6601
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_LABEL",
6602
+ owner: "tenant",
6603
+ scope: "workspace",
6604
+ sourcePath: system.sharedSourcePath,
6605
+ environmentPolicy: "environment_specific",
6606
+ required: false,
6607
+ secret: false,
6608
+ public: true,
6609
+ consumers: ["tenant-vercel-app"],
6610
+ destinations: [
6611
+ {
6612
+ kind: "vercel",
6613
+ target: system.vercelProjectName,
6614
+ environmentPolicy: "preprod_staging_prod_prod"
6615
+ }
6616
+ ],
6617
+ description: "Stack engineering graph public tenant label used by the graph explorer."
6618
+ },
6619
+ {
6620
+ id: "tenant.stack-eng.public.environment",
6621
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_ENV",
6622
+ owner: "tenant",
6623
+ scope: "workspace",
6624
+ sourcePath: system.sharedSourcePath,
6625
+ environmentPolicy: "environment_specific",
6626
+ required: false,
6627
+ secret: false,
6628
+ public: true,
6629
+ consumers: ["tenant-vercel-app"],
6630
+ destinations: [
6631
+ {
6632
+ kind: "vercel",
6633
+ target: system.vercelProjectName,
6634
+ environmentPolicy: "preprod_staging_prod_prod"
6635
+ }
6636
+ ],
6637
+ description: "Stack engineering graph public environment label used by the graph explorer."
6638
+ }
6639
+ ];
6640
+ }
6641
+ return [];
6642
+ }
4899
6643
  );
6644
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap((system) => [
6645
+ {
6646
+ id: `tenant.${system.id}.convex.url`,
6647
+ canonicalName: system.convex.urlEnv,
6648
+ aliases: tenantConvexUrlAliases(system),
6649
+ owner: "tenant",
6650
+ scope: "software_system",
6651
+ sourcePath: system.sharedSourcePath,
6652
+ environmentPolicy: "preprod_staging_prod_prod",
6653
+ required: true,
6654
+ secret: false,
6655
+ public: false,
6656
+ consumers: [
6657
+ "tenant-vercel-app",
6658
+ "tenant-agent-runtime",
6659
+ "mc-operator-tooling"
6660
+ ],
6661
+ destinations: [
6662
+ {
6663
+ kind: "vercel",
6664
+ target: system.vercelProjectName,
6665
+ environmentPolicy: "preprod_staging_prod_prod",
6666
+ writeNames: tenantVercelConvexUrlWriteNames(system)
6667
+ },
6668
+ {
6669
+ kind: "github_actions",
6670
+ target: `${system.repository.owner}/${system.repository.name}`,
6671
+ environmentPolicy: "preprod_staging_prod_prod",
6672
+ writeNames: tenantRepositoryConvexUrlWriteNames(system),
6673
+ notes: "Only if that repository deploy/test workflow owns this software system."
6674
+ }
6675
+ ],
6676
+ description: `${system.tenantKey}/${system.workspaceKey} Convex URL. Pre-prod resolves to ${system.convex.preprodDeployment}; prod resolves to ${system.convex.prodDeployment}.`
6677
+ },
6678
+ {
6679
+ id: `tenant.${system.id}.convex.deploy-key`,
6680
+ canonicalName: system.convex.deployKeyEnv,
6681
+ aliases: tenantConvexDeployKeyAliases(system),
6682
+ owner: "tenant",
6683
+ scope: "software_system",
6684
+ sourcePath: system.sharedSourcePath,
6685
+ environmentPolicy: "preprod_staging_prod_prod",
6686
+ required: true,
6687
+ secret: true,
6688
+ public: false,
6689
+ consumers: [
6690
+ "tenant-vercel-app",
6691
+ "tenant-agent-runtime",
6692
+ "mc-operator-tooling"
6693
+ ],
6694
+ destinations: [
6695
+ {
6696
+ kind: "vercel",
6697
+ target: system.vercelProjectName,
6698
+ environmentPolicy: "preprod_staging_prod_prod"
6699
+ },
6700
+ {
6701
+ kind: "github_actions",
6702
+ target: `${system.repository.owner}/${system.repository.name}`,
6703
+ environmentPolicy: "preprod_staging_prod_prod",
6704
+ writeNames: tenantRepositoryConvexDeployKeyWriteNames(system),
6705
+ notes: "Only if that repository deploy/test workflow owns this software system."
6706
+ }
6707
+ ],
6708
+ description: `${system.tenantKey}/${system.workspaceKey} Convex deploy/admin key. Never route to sibling workspaces.`
6709
+ }
6710
+ ]);
4900
6711
  z.object({
4901
6712
  manifestVersion: z.literal("1.0.0"),
4902
6713
  rules: z.array(
@@ -4937,7 +6748,7 @@ var createEvidenceInputSchemaBase = z.object({
4937
6748
  targetId: z.string().optional(),
4938
6749
  targetNodeId: z.string().optional(),
4939
6750
  linkedBeliefNodeId: z.string().optional(),
4940
- evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
6751
+ evidenceRelation: z.enum(["supports", "contradicts"]).optional(),
4941
6752
  confidence: z.number().optional(),
4942
6753
  weight: z.number().optional(),
4943
6754
  reasoning: z.string().optional(),
@@ -5022,8 +6833,7 @@ var createEvidenceProjection = defineProjection({
5022
6833
  evidenceRelation: v.optional(
5023
6834
  v.union(
5024
6835
  v.literal("supports"),
5025
- v.literal("contradicts"),
5026
- v.literal("neutral")
6836
+ v.literal("contradicts")
5027
6837
  )
5028
6838
  ),
5029
6839
  confidence: v.optional(v.number()),
@@ -5072,12 +6882,17 @@ var listBeliefsProjection = defineProjection({
5072
6882
  });
5073
6883
  var taskStatusSchema = z.enum(["todo", "in_progress", "blocked", "done"]).optional().describe("Filter by task status");
5074
6884
  var listTasksInputSchema = z.object({
5075
- topicId: z.string().describe("Topic scope"),
6885
+ topicId: z.string().optional().describe("Topic scope"),
5076
6886
  worktreeId: z.string().optional().describe("Alias for linkedWorktreeId"),
5077
6887
  linkedWorktreeId: z.string().optional().describe("Filter to tasks linked to this worktree"),
5078
6888
  status: taskStatusSchema,
5079
6889
  limit: z.number().optional().describe("Maximum results")
5080
- });
6890
+ }).refine(
6891
+ (input) => Boolean(input.topicId || input.worktreeId || input.linkedWorktreeId),
6892
+ {
6893
+ message: "topicId or worktreeId is required"
6894
+ }
6895
+ );
5081
6896
  function compactRecord3(input) {
5082
6897
  return Object.fromEntries(
5083
6898
  Object.entries(input).filter(([, value]) => value !== void 0)
@@ -5094,7 +6909,7 @@ var listTasksProjection = defineProjection({
5094
6909
  linkedWorktreeId: input.linkedWorktreeId ?? input.worktreeId
5095
6910
  }),
5096
6911
  convexArgsValidator: v.object({
5097
- topicId: v.string(),
6912
+ topicId: v.optional(v.string()),
5098
6913
  status: v.optional(
5099
6914
  v.union(
5100
6915
  v.literal("todo"),
@@ -6098,7 +7913,7 @@ var CREATE_EDGE = {
6098
7913
  reasoningMethod: {
6099
7914
  type: "string",
6100
7915
  description: "How this was determined",
6101
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
7916
+ enum: [...REASONING_METHODS]
6102
7917
  },
6103
7918
  metadata: {
6104
7919
  type: "object",
@@ -7825,6 +9640,10 @@ var CREATE_TASK = {
7825
9640
  tags: {
7826
9641
  type: "array",
7827
9642
  description: "Free-form string tags"
9643
+ },
9644
+ metadata: {
9645
+ type: "object",
9646
+ description: "Structured task metadata for handoff context and routing hints"
7828
9647
  }
7829
9648
  },
7830
9649
  required: ["title"],
@@ -7898,6 +9717,10 @@ var UPDATE_TASK = {
7898
9717
  type: "string",
7899
9718
  description: "Updated status",
7900
9719
  enum: ["todo", "in_progress", "blocked", "done"]
9720
+ },
9721
+ metadata: {
9722
+ type: "object",
9723
+ description: "Structured task metadata to replace or refine"
7901
9724
  }
7902
9725
  },
7903
9726
  required: ["taskId"],
@@ -9353,6 +11176,9 @@ var BEGIN_BUILD_SESSION = {
9353
11176
  sessionMode: "string \u2014 async | interactive",
9354
11177
  targetBeliefIds: "array \u2014 scoped belief IDs",
9355
11178
  targetQuestionIds: "array \u2014 scoped question IDs",
11179
+ taskIds: "array \u2014 assigned task IDs for this worktree",
11180
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
11181
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
9356
11182
  topBeliefs: "array \u2014 highest-confidence scoped beliefs",
9357
11183
  openQuestions: "array \u2014 open scoped questions",
9358
11184
  resolvedDecisions: "array \u2014 answered questions summarized for the session",
@@ -9953,12 +11779,20 @@ function unwrapMcpParameterSchema(schema) {
9953
11779
  current = current._def.schema;
9954
11780
  continue;
9955
11781
  default:
9956
- return { schema: current, required, description: description ?? current.description };
11782
+ return {
11783
+ schema: current,
11784
+ required,
11785
+ description: description ?? current.description
11786
+ };
9957
11787
  }
9958
11788
  }
9959
11789
  }
9960
11790
  function mcpParameterFromZod(fieldName, schema, contractName) {
9961
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
11791
+ const {
11792
+ schema: unwrapped,
11793
+ required,
11794
+ description: schemaDescription
11795
+ } = unwrapMcpParameterSchema(schema);
9962
11796
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
9963
11797
  switch (unwrapped._def.typeName) {
9964
11798
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -10003,10 +11837,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
10003
11837
  const entries2 = Object.entries(getObjectShape(args)).sort(
10004
11838
  ([left], [right]) => left.localeCompare(right)
10005
11839
  );
10006
- const converted = entries2.map(([fieldName, schema]) => [
10007
- fieldName,
10008
- mcpParameterFromZod(fieldName, schema, contractName)
10009
- ]);
11840
+ const converted = entries2.map(
11841
+ ([fieldName, schema]) => [
11842
+ fieldName,
11843
+ mcpParameterFromZod(fieldName, schema, contractName)
11844
+ ]
11845
+ );
10010
11846
  return {
10011
11847
  ...base,
10012
11848
  parameters: Object.fromEntries(
@@ -10118,6 +11954,7 @@ function surfaceContract(args) {
10118
11954
  allowedPrincipalTypes: ["user", "service", "agent"]
10119
11955
  },
10120
11956
  convex: args.convex,
11957
+ gateway: args.gateway,
10121
11958
  args: canonicalArgs,
10122
11959
  returns: canonicalReturns,
10123
11960
  input,
@@ -10604,7 +12441,7 @@ var beliefsContracts = [
10604
12441
  })
10605
12442
  ];
10606
12443
  var jsonRecordSchema4 = z.record(z.unknown());
10607
- var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
12444
+ var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
10608
12445
  var createEvidenceArgs = z.object({
10609
12446
  topicId: z.string().optional().describe("Topic scope for the evidence."),
10610
12447
  text: z.string().describe("Canonical evidence text."),
@@ -12527,7 +14364,8 @@ var createTaskArgs = z.object({
12527
14364
  linkedQuestionId: z.string().optional().describe("Question this task addresses."),
12528
14365
  assigneeId: z.string().optional().describe("Principal assigned to the task."),
12529
14366
  dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
12530
- tags: z.array(z.string()).optional().describe("Free-form tags.")
14367
+ tags: z.array(z.string()).optional().describe("Free-form tags."),
14368
+ metadata: z.record(z.unknown()).optional().describe("Structured task metadata for handoff context and routing hints.")
12531
14369
  });
12532
14370
  var createTaskInput = (input) => compactRecord4({
12533
14371
  title: input.title,
@@ -12541,7 +14379,8 @@ var createTaskInput = (input) => compactRecord4({
12541
14379
  linkedQuestionId: input.linkedQuestionId,
12542
14380
  assigneeId: input.assigneeId,
12543
14381
  dueDate: input.dueDate,
12544
- tags: input.tags
14382
+ tags: input.tags,
14383
+ metadata: input.metadata
12545
14384
  });
12546
14385
  var taskInput = (input) => compactRecord4({
12547
14386
  ...input,
@@ -12558,8 +14397,7 @@ var taskTopicInput = (input) => {
12558
14397
  };
12559
14398
  var completeTaskInput = (input) => compactRecord4({
12560
14399
  taskId: input.taskId ?? input.id,
12561
- outputSummary: input.outputSummary ?? input.summary,
12562
- userId: input.userId
14400
+ outputSummary: input.outputSummary ?? input.summary
12563
14401
  });
12564
14402
  var tasksContracts = [
12565
14403
  surfaceContract({
@@ -12577,6 +14415,7 @@ var tasksContracts = [
12577
14415
  kind: "mutation",
12578
14416
  inputProjection: createTaskInput
12579
14417
  },
14418
+ gateway: { handler: "tasks.create" },
12580
14419
  args: createTaskArgs
12581
14420
  }),
12582
14421
  surfaceContract({
@@ -12595,6 +14434,7 @@ var tasksContracts = [
12595
14434
  kind: "query",
12596
14435
  inputProjection: taskTopicInput
12597
14436
  },
14437
+ gateway: { handler: "tasks.list" },
12598
14438
  args: listTasksInputSchema
12599
14439
  }),
12600
14440
  surfaceContract({
@@ -12612,7 +14452,8 @@ var tasksContracts = [
12612
14452
  functionName: "update",
12613
14453
  kind: "mutation",
12614
14454
  inputProjection: taskInput
12615
- }
14455
+ },
14456
+ gateway: { handler: "tasks.update" }
12616
14457
  }),
12617
14458
  surfaceContract({
12618
14459
  name: "complete_task",
@@ -12628,12 +14469,14 @@ var tasksContracts = [
12628
14469
  functionName: "complete",
12629
14470
  kind: "mutation",
12630
14471
  inputProjection: completeTaskInput
12631
- }
14472
+ },
14473
+ gateway: { handler: "tasks.complete" }
12632
14474
  })
12633
14475
  ];
12634
14476
  var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
12635
14477
  (policy) => policy.edgeType
12636
14478
  );
14479
+ var REASONING_METHOD_TYPES = [...REASONING_METHODS];
12637
14480
  var createEdgeArgs = z.object({
12638
14481
  from: GraphRefSchema,
12639
14482
  to: GraphRefSchema,
@@ -12643,6 +14486,7 @@ var createEdgeArgs = z.object({
12643
14486
  confidence: z.number().optional(),
12644
14487
  context: z.string().optional(),
12645
14488
  reasoning: z.string().optional(),
14489
+ reasoningMethod: z.enum(REASONING_METHOD_TYPES).optional(),
12646
14490
  derivationType: z.string().optional(),
12647
14491
  metadata: z.record(z.unknown()).optional(),
12648
14492
  topicId: z.string().optional(),
@@ -12721,6 +14565,7 @@ var edgesContracts = [
12721
14565
  weight: parsed.weight,
12722
14566
  confidence: parsed.confidence,
12723
14567
  context: parsed.context ?? parsed.reasoning,
14568
+ reasoningMethod: parsed.reasoningMethod,
12724
14569
  derivationType: parsed.derivationType,
12725
14570
  metadata: parsed.metadata,
12726
14571
  skipLayerValidation: true,
@@ -12845,6 +14690,7 @@ var edgesContracts = [
12845
14690
  weight: edge.weight,
12846
14691
  confidence: edge.confidence,
12847
14692
  context: edge.context ?? edge.reasoning,
14693
+ reasoningMethod: edge.reasoningMethod,
12848
14694
  derivationType: edge.derivationType,
12849
14695
  metadata: edge.metadata,
12850
14696
  topicId: edge.topicId
@@ -13579,6 +15425,69 @@ var pipelineContracts = [
13579
15425
  }
13580
15426
  })
13581
15427
  ];
15428
+ function isRecord3(value) {
15429
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15430
+ }
15431
+ function stringValues(value) {
15432
+ if (typeof value === "string") {
15433
+ return [value];
15434
+ }
15435
+ if (Array.isArray(value)) {
15436
+ return value.flatMap((item) => stringValues(item));
15437
+ }
15438
+ return [];
15439
+ }
15440
+ function nestedEvidenceRows(value) {
15441
+ if (Array.isArray(value)) {
15442
+ return value.flatMap((item) => nestedEvidenceRows(item));
15443
+ }
15444
+ if (!isRecord3(value)) {
15445
+ return [];
15446
+ }
15447
+ const nestedKeys = ["evidence", "items", "nodes"];
15448
+ const nestedRows = nestedKeys.flatMap((key) => nestedEvidenceRows(value[key]));
15449
+ return nestedRows.length > 0 ? nestedRows : [value];
15450
+ }
15451
+ function isFailedAttemptRow(row) {
15452
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15453
+ return metadata?.failedApproach === true || metadata?.isFailedAttempt === true;
15454
+ }
15455
+ function failureLogSearchFields(row) {
15456
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15457
+ return [
15458
+ ...stringValues(row.id),
15459
+ ...stringValues(row._id),
15460
+ ...stringValues(row.title),
15461
+ ...stringValues(row.text),
15462
+ ...stringValues(row.canonicalText),
15463
+ ...stringValues(row.content),
15464
+ ...stringValues(metadata?.codeAnchor),
15465
+ ...stringValues(metadata?.codeAnchors),
15466
+ ...stringValues(metadata?.anchor),
15467
+ ...stringValues(metadata?.anchors),
15468
+ ...stringValues(metadata?.filePath),
15469
+ ...stringValues(metadata?.filePaths),
15470
+ ...stringValues(metadata?.path),
15471
+ ...stringValues(metadata?.paths),
15472
+ ...stringValues(metadata?.sourceRef),
15473
+ ...stringValues(metadata?.touchedPaths)
15474
+ ];
15475
+ }
15476
+ function projectFailureLog(output, input) {
15477
+ const rawQuery = typeof input.query === "string" && input.query.trim().length > 0 ? input.query.trim() : void 0;
15478
+ const searchKey = rawQuery?.toLowerCase();
15479
+ const failures = nestedEvidenceRows(output).filter((row) => isFailedAttemptRow(row)).filter(
15480
+ (row) => !searchKey ? true : failureLogSearchFields(row).some(
15481
+ (field) => field.toLowerCase().includes(searchKey)
15482
+ )
15483
+ );
15484
+ return {
15485
+ query: rawQuery,
15486
+ failures,
15487
+ totalFound: failures.length,
15488
+ showing: failures.length
15489
+ };
15490
+ }
13582
15491
  var recordScopeLearningArgs = z.object({
13583
15492
  topicId: z.string().optional().describe("Topic scope ID"),
13584
15493
  summary: z.string().describe("Atomic learning statement"),
@@ -13668,6 +15577,8 @@ var attemptInput = (input, context) => withUserId(
13668
15577
  tags: ["code_attempt"],
13669
15578
  metadata: compactRecord4({
13670
15579
  ...recordValue2(input.metadata),
15580
+ failedApproach: true,
15581
+ isFailedAttempt: true,
13671
15582
  filePaths: input.filePaths,
13672
15583
  filePath: input.filePath,
13673
15584
  errorMessage: input.errorMessage,
@@ -13798,7 +15709,8 @@ var codingContracts = [
13798
15709
  limit: input.limit,
13799
15710
  status: input.status,
13800
15711
  userId: input.userId
13801
- })
15712
+ }),
15713
+ outputProjection: (output, input) => projectFailureLog(output, input)
13802
15714
  }
13803
15715
  })
13804
15716
  ];
@@ -14260,14 +16172,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14260
16172
  description: "Worktrees are tenant/runtime planning data."
14261
16173
  },
14262
16174
  {
14263
- component: "identity",
16175
+ component: "control-plane",
14264
16176
  table: "agents",
14265
16177
  prepopulation: "runtime_bootstrap",
14266
16178
  copyMode: "none",
14267
16179
  description: "Service agents are provisioned per tenant or service, not copied."
14268
16180
  },
14269
16181
  {
14270
- component: "identity",
16182
+ component: "control-plane",
14271
16183
  table: "mcpWritePolicy",
14272
16184
  prepopulation: "required_template",
14273
16185
  copyMode: "template_global",
@@ -14276,14 +16188,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14276
16188
  description: "Global write policy defaults govern service and interactive MCP writes."
14277
16189
  },
14278
16190
  {
14279
- component: "identity",
16191
+ component: "control-plane",
14280
16192
  table: "modelCallLogs",
14281
16193
  prepopulation: "runtime_log",
14282
16194
  copyMode: "none",
14283
16195
  description: "Model call logs are runtime telemetry."
14284
16196
  },
14285
16197
  {
14286
- component: "identity",
16198
+ component: "control-plane",
14287
16199
  table: "modelFunctionSlots",
14288
16200
  prepopulation: "required_template",
14289
16201
  copyMode: "template_global",
@@ -14292,7 +16204,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14292
16204
  description: "Function-to-model slots are required by model runtime resolution."
14293
16205
  },
14294
16206
  {
14295
- component: "identity",
16207
+ component: "control-plane",
14296
16208
  table: "modelRegistry",
14297
16209
  prepopulation: "required_template",
14298
16210
  copyMode: "template_global",
@@ -14301,7 +16213,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14301
16213
  description: "Model catalog defaults are required by model runtime clients."
14302
16214
  },
14303
16215
  {
14304
- component: "identity",
16216
+ component: "control-plane",
14305
16217
  table: "modelSlotConfigs",
14306
16218
  prepopulation: "required_template",
14307
16219
  copyMode: "template_global",
@@ -14310,14 +16222,105 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14310
16222
  description: "Slot-level defaults are required before tenant overrides exist."
14311
16223
  },
14312
16224
  {
14313
- component: "identity",
16225
+ component: "control-plane",
16226
+ table: "permitAccessReviewItems",
16227
+ prepopulation: "runtime_data",
16228
+ copyMode: "none",
16229
+ description: "Permit access-review item rows are tenant review data projected from Permit."
16230
+ },
16231
+ {
16232
+ component: "control-plane",
16233
+ table: "permitAccessReviews",
16234
+ prepopulation: "runtime_data",
16235
+ copyMode: "none",
16236
+ description: "Permit access-review campaigns are tenant review data projected from Permit."
16237
+ },
16238
+ {
16239
+ component: "control-plane",
16240
+ table: "permitAttributeBindings",
16241
+ prepopulation: "runtime_data",
16242
+ copyMode: "none",
16243
+ description: "Permit ABAC attribute bindings are tenant policy projection rows."
16244
+ },
16245
+ {
16246
+ component: "control-plane",
16247
+ table: "permitGroups",
16248
+ prepopulation: "runtime_data",
16249
+ copyMode: "none",
16250
+ description: "Permit groups are tenant-defined policy subjects, not template data."
16251
+ },
16252
+ {
16253
+ component: "control-plane",
16254
+ table: "permitGroupMemberships",
16255
+ prepopulation: "runtime_data",
16256
+ copyMode: "none",
16257
+ description: "Permit group memberships are tenant-specific policy projection rows."
16258
+ },
16259
+ {
16260
+ component: "control-plane",
16261
+ table: "permitPolicyBundles",
16262
+ prepopulation: "runtime_derived",
16263
+ copyMode: "none",
16264
+ description: "Permit policy bundles are derived from the Permit control plane."
16265
+ },
16266
+ {
16267
+ component: "control-plane",
16268
+ table: "permitPolicyDecisionReceipts",
16269
+ prepopulation: "runtime_log",
16270
+ copyMode: "none",
16271
+ description: "Permit decision receipts are runtime authorization audit logs."
16272
+ },
16273
+ {
16274
+ component: "control-plane",
16275
+ table: "permitPrincipalAliases",
16276
+ prepopulation: "runtime_data",
16277
+ copyMode: "none",
16278
+ description: "Permit principal aliases are tenant-specific identity projection rows."
16279
+ },
16280
+ {
16281
+ component: "control-plane",
16282
+ table: "permitPrincipals",
16283
+ prepopulation: "runtime_data",
16284
+ copyMode: "none",
16285
+ description: "Permit principals are projected from Clerk, Permit, and tenant onboarding flows."
16286
+ },
16287
+ {
16288
+ component: "control-plane",
16289
+ table: "permitProjectionOutbox",
16290
+ prepopulation: "runtime_queue",
16291
+ copyMode: "none",
16292
+ description: "Permit projection outbox rows are runtime sync queue data."
16293
+ },
16294
+ {
16295
+ component: "control-plane",
16296
+ table: "permitRelationshipTuples",
16297
+ prepopulation: "runtime_data",
16298
+ copyMode: "none",
16299
+ description: "Permit ReBAC relationship tuples are tenant policy projection rows."
16300
+ },
16301
+ {
16302
+ component: "control-plane",
16303
+ table: "permitResourceInstances",
16304
+ prepopulation: "runtime_data",
16305
+ copyMode: "none",
16306
+ description: "Permit resource instances are tenant/workspace graph and deployment projection rows."
16307
+ },
16308
+ {
16309
+ component: "control-plane",
16310
+ table: "permitRoleAssignments",
16311
+ prepopulation: "runtime_data",
16312
+ copyMode: "none",
16313
+ description: "Permit role assignments are tenant-specific policy projection rows."
16314
+ },
16315
+ {
16316
+ component: "control-plane",
14314
16317
  table: "platformAudienceGrants",
14315
16318
  prepopulation: "runtime_data",
14316
16319
  copyMode: "none",
14317
16320
  description: "Audience grants are principal/group-specific access rows."
14318
16321
  },
14319
16322
  {
14320
- component: "identity",
16323
+ component: "control-plane",
14321
16324
  table: "platformAudiences",
14322
16325
  prepopulation: "required_template",
14323
16326
  copyMode: "template_tenant_rewrite",
@@ -14326,35 +16329,35 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14326
16329
  description: "Default tenant audience taxonomy rows are rewritten into each tenant."
14327
16330
  },
14328
16331
  {
14329
- component: "identity",
16332
+ component: "control-plane",
14330
16333
  table: "platformPolicyDecisionLogs",
14331
16334
  prepopulation: "runtime_log",
14332
16335
  copyMode: "none",
14333
16336
  description: "Policy decisions are runtime audit logs."
14334
16337
  },
14335
16338
  {
14336
- component: "identity",
16339
+ component: "control-plane",
14337
16340
  table: "projectGrants",
14338
16341
  prepopulation: "runtime_data",
14339
16342
  copyMode: "none",
14340
16343
  description: "Project/topic grants are principal or group-specific access rows."
14341
16344
  },
14342
16345
  {
14343
- component: "identity",
16346
+ component: "control-plane",
14344
16347
  table: "reasoningPermissions",
14345
16348
  prepopulation: "runtime_data",
14346
16349
  copyMode: "none",
14347
16350
  description: "Reasoning permissions are principal-specific policy rows."
14348
16351
  },
14349
16352
  {
14350
- component: "identity",
16353
+ component: "control-plane",
14351
16354
  table: "tenantApiKeys",
14352
16355
  prepopulation: "runtime_secret",
14353
16356
  copyMode: "none",
14354
16357
  description: "API keys are tenant credentials and must never be copied."
14355
16358
  },
14356
16359
  {
14357
- component: "identity",
16360
+ component: "control-plane",
14358
16361
  table: "tenantConfig",
14359
16362
  prepopulation: "required_template",
14360
16363
  copyMode: "template_tenant_rewrite",
@@ -14363,7 +16366,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14363
16366
  description: "Tenant-local config defaults are rewritten during bootstrap."
14364
16367
  },
14365
16368
  {
14366
- component: "identity",
16369
+ component: "control-plane",
14367
16370
  table: "tenantIntegrations",
14368
16371
  prepopulation: "required_template",
14369
16372
  copyMode: "template_tenant_rewrite",
@@ -14372,14 +16375,21 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14372
16375
  description: "Non-secret integration descriptors are rewritten into each tenant."
14373
16376
  },
14374
16377
  {
14375
- component: "identity",
16378
+ component: "control-plane",
14376
16379
  table: "tenantModelSlotBindings",
14377
16380
  prepopulation: "runtime_secret",
14378
16381
  copyMode: "none",
14379
16382
  description: "Tenant model slot bindings reference provider secrets and are runtime-only."
14380
16383
  },
14381
16384
  {
14382
- component: "identity",
16385
+ component: "control-plane",
16386
+ table: "tenantPermitSyncStates",
16387
+ prepopulation: "runtime_derived",
16388
+ copyMode: "none",
16389
+ description: "Tenant Permit sync state rows are runtime reconciliation state."
16390
+ },
16391
+ {
16392
+ component: "control-plane",
14383
16393
  table: "tenantPolicies",
14384
16394
  prepopulation: "required_template",
14385
16395
  copyMode: "template_tenant_rewrite",
@@ -14388,42 +16398,42 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14388
16398
  description: "Default tenant policy roles are rewritten during bootstrap."
14389
16399
  },
14390
16400
  {
14391
- component: "identity",
16401
+ component: "control-plane",
14392
16402
  table: "tenantProviderSecrets",
14393
16403
  prepopulation: "runtime_secret",
14394
16404
  copyMode: "none",
14395
16405
  description: "Provider secrets are credentials and must never be copied."
14396
16406
  },
14397
16407
  {
14398
- component: "identity",
16408
+ component: "control-plane",
14399
16409
  table: "tenantProxyGatewayUsage",
14400
16410
  prepopulation: "runtime_log",
14401
16411
  copyMode: "none",
14402
16412
  description: "Proxy gateway usage rows are runtime telemetry."
14403
16413
  },
14404
16414
  {
14405
- component: "identity",
16415
+ component: "control-plane",
14406
16416
  table: "tenantProxyTokenMints",
14407
16417
  prepopulation: "runtime_secret",
14408
16418
  copyMode: "none",
14409
16419
  description: "Proxy token mints are ephemeral secret-bearing runtime rows."
14410
16420
  },
14411
16421
  {
14412
- component: "identity",
16422
+ component: "control-plane",
14413
16423
  table: "tenantSandboxAuditEvents",
14414
16424
  prepopulation: "runtime_log",
14415
16425
  copyMode: "none",
14416
16426
  description: "Sandbox audit rows are runtime security logs."
14417
16427
  },
14418
16428
  {
14419
- component: "identity",
16429
+ component: "control-plane",
14420
16430
  table: "tenantSecrets",
14421
16431
  prepopulation: "runtime_secret",
14422
16432
  copyMode: "none",
14423
16433
  description: "Tenant secrets are credentials and must never be copied."
14424
16434
  },
14425
16435
  {
14426
- component: "identity",
16436
+ component: "control-plane",
14427
16437
  table: "toolAcls",
14428
16438
  prepopulation: "required_template",
14429
16439
  copyMode: "template_global",
@@ -14432,7 +16442,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14432
16442
  description: "Default role-to-tool grants are required for SDK/MCP tool access."
14433
16443
  },
14434
16444
  {
14435
- component: "identity",
16445
+ component: "control-plane",
14436
16446
  table: "toolRegistry",
14437
16447
  prepopulation: "required_template",
14438
16448
  copyMode: "template_global",
@@ -14441,7 +16451,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14441
16451
  description: "Core tool catalog rows are required before pack or tenant tools exist."
14442
16452
  },
14443
16453
  {
14444
- component: "identity",
16454
+ component: "control-plane",
14445
16455
  table: "users",
14446
16456
  prepopulation: "runtime_bootstrap",
14447
16457
  copyMode: "none",