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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.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: [
@@ -731,7 +745,7 @@ defineTable({
731
745
  });
732
746
  defineTable({
733
747
  name: "agents",
734
- component: "identity",
748
+ component: "control-plane",
735
749
  category: "agent",
736
750
  shape: z.object({
737
751
  "slug": z.string(),
@@ -762,6 +776,7 @@ defineTable({
762
776
  category: "tenant",
763
777
  shape: z.object({
764
778
  "tenantId": idOf("tenants"),
779
+ "workspaceId": idOf("workspaces").optional(),
765
780
  "keyPrefix": z.enum(["luc", "stk"]),
766
781
  "keyHash": z.string(),
767
782
  "keyHint": z.string(),
@@ -789,7 +804,7 @@ defineTable({
789
804
  shape: z.object({
790
805
  "tenantId": idOf("tenants").optional(),
791
806
  "apiKeyId": idOf("apiKeys").optional(),
792
- "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"]),
807
+ "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"]),
793
808
  "actorClerkId": z.string(),
794
809
  "details": z.any().optional(),
795
810
  "createdAt": z.number()
@@ -1668,29 +1683,37 @@ defineTable({
1668
1683
  component: "mc",
1669
1684
  category: "runtime",
1670
1685
  shape: z.object({
1671
- "shimId": z.string(),
1672
- "gateId": z.string(),
1673
- "removalDate": z.string(),
1674
- "removalPriority": z.enum(["P1", "P2", "P3"]),
1675
- "description": z.string(),
1676
- "owner": z.string(),
1677
- "createdAt": z.string(),
1678
- "status": z.enum(["active", "overdue", "removed"]),
1679
- "bridgeType": z.enum(["tool", "agent"]),
1680
- "bridgeTarget": z.object({
1681
- "type": z.enum(["tool", "agent"]),
1682
- "legacyPath": z.string(),
1683
- "harnessPath": z.string()
1686
+ shimId: z.string(),
1687
+ gateId: z.string(),
1688
+ removalDate: z.string(),
1689
+ removalPriority: z.enum(["P1", "P2", "P3"]),
1690
+ description: z.string(),
1691
+ owner: z.string(),
1692
+ createdAt: z.string(),
1693
+ status: z.enum(["active", "overdue", "removed"]),
1694
+ bridgeType: z.enum(["tool", "agent"]),
1695
+ bridgeTarget: z.object({
1696
+ type: z.enum(["tool", "agent"]),
1697
+ legacyPath: z.string(),
1698
+ harnessPath: z.string()
1684
1699
  }),
1685
- "shimBehavior": z.enum(["passthrough_with_logging", "adapter", "feature_flag_gate"]),
1686
- "producesLedgerEntries": z.boolean(),
1687
- "lastAuditedAt": z.number(),
1688
- "metadata": z.record(z.any()).optional()
1700
+ shimBehavior: z.enum([
1701
+ "passthrough_with_logging",
1702
+ "adapter",
1703
+ "feature_flag_gate"
1704
+ ]),
1705
+ producesLedgerEntries: z.boolean(),
1706
+ lastAuditedAt: z.number(),
1707
+ metadata: z.record(z.any()).optional()
1689
1708
  }),
1690
1709
  indices: [
1691
1710
  { kind: "index", name: "by_shimId", columns: ["shimId"] },
1692
1711
  { kind: "index", name: "by_status", columns: ["status"] },
1693
- { kind: "index", name: "by_bridgeType_status", columns: ["bridgeType", "status"] }
1712
+ {
1713
+ kind: "index",
1714
+ name: "by_bridgeType_status",
1715
+ columns: ["bridgeType", "status"]
1716
+ }
1694
1717
  ]
1695
1718
  });
1696
1719
  defineTable({
@@ -1698,12 +1721,23 @@ defineTable({
1698
1721
  component: "mc",
1699
1722
  category: "runtime",
1700
1723
  shape: z.object({
1701
- "domain": z.enum(["graph", "schema", "identity", "policy", "audit", "admin", "agent", "tool", "prompt", "intelligence"]),
1702
- "state": z.enum(["legacy", "cutover", "disabled"]),
1703
- "metadata": z.record(z.any()).optional(),
1704
- "updatedBy": z.string(),
1705
- "createdAt": z.number(),
1706
- "updatedAt": z.number()
1724
+ domain: z.enum([
1725
+ "graph",
1726
+ "schema",
1727
+ "identity",
1728
+ "policy",
1729
+ "audit",
1730
+ "admin",
1731
+ "agent",
1732
+ "tool",
1733
+ "prompt",
1734
+ "intelligence"
1735
+ ]),
1736
+ state: z.enum(["legacy", "cutover", "disabled"]),
1737
+ metadata: z.record(z.any()).optional(),
1738
+ updatedBy: z.string(),
1739
+ createdAt: z.number(),
1740
+ updatedAt: z.number()
1707
1741
  }),
1708
1742
  indices: [
1709
1743
  { kind: "index", name: "by_domain", columns: ["domain"] },
@@ -1715,57 +1749,193 @@ defineTable({
1715
1749
  component: "mc",
1716
1750
  category: "runtime",
1717
1751
  shape: z.object({
1718
- "credentialRef": z.string(),
1719
- "tenantId": idOf("tenants"),
1720
- "target": z.enum(["kernelDeployment", "appDeployment"]),
1721
- "environment": z.enum(["dev", "staging", "prod"]),
1722
- "encryptedDeployKey": z.string(),
1723
- "encryptionVersion": z.string(),
1724
- "keyFingerprint": z.string(),
1725
- "keyHint": z.string(),
1726
- "status": z.enum(["active", "revoked"]),
1727
- "rotatedFromCredentialRef": z.string().optional(),
1728
- "revokedAt": z.number().optional(),
1729
- "revokedBy": z.string().optional(),
1730
- "lastUsedAt": z.number().optional(),
1731
- "metadata": z.record(z.any()).optional(),
1732
- "createdBy": z.string(),
1733
- "createdAt": z.number(),
1734
- "updatedAt": z.number()
1752
+ credentialRef: z.string(),
1753
+ tenantId: idOf("tenants"),
1754
+ workspaceId: idOf("workspaces").optional(),
1755
+ target: z.enum(["kernelDeployment", "appDeployment"]),
1756
+ environment: z.enum(["dev", "staging", "prod"]),
1757
+ encryptedDeployKey: z.string(),
1758
+ encryptionVersion: z.string(),
1759
+ keyFingerprint: z.string(),
1760
+ keyHint: z.string(),
1761
+ status: z.enum(["active", "revoked"]),
1762
+ rotatedFromCredentialRef: z.string().optional(),
1763
+ revokedAt: z.number().optional(),
1764
+ revokedBy: z.string().optional(),
1765
+ lastUsedAt: z.number().optional(),
1766
+ metadata: z.record(z.any()).optional(),
1767
+ createdBy: z.string(),
1768
+ createdAt: z.number(),
1769
+ updatedAt: z.number()
1735
1770
  }),
1736
1771
  indices: [
1737
1772
  { kind: "index", name: "by_credentialRef", columns: ["credentialRef"] },
1738
1773
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1739
- { kind: "index", name: "by_tenant_target", columns: ["tenantId", "target"] },
1740
- { kind: "index", name: "by_tenant_target_environment", columns: ["tenantId", "target", "environment"] },
1741
- { kind: "index", name: "by_tenant_target_environment_status", columns: ["tenantId", "target", "environment", "status"] },
1774
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
1775
+ {
1776
+ kind: "index",
1777
+ name: "by_tenant_target",
1778
+ columns: ["tenantId", "target"]
1779
+ },
1780
+ {
1781
+ kind: "index",
1782
+ name: "by_tenant_target_environment",
1783
+ columns: ["tenantId", "target", "environment"]
1784
+ },
1785
+ {
1786
+ kind: "index",
1787
+ name: "by_tenant_target_environment_status",
1788
+ columns: ["tenantId", "target", "environment", "status"]
1789
+ },
1790
+ {
1791
+ kind: "index",
1792
+ name: "by_tenant_workspace_target_environment_status",
1793
+ columns: ["tenantId", "workspaceId", "target", "environment", "status"]
1794
+ },
1742
1795
  { kind: "index", name: "by_status", columns: ["status"] }
1743
1796
  ]
1744
1797
  });
1798
+ defineTable({
1799
+ name: "permitSyncStates",
1800
+ component: "mc",
1801
+ category: "runtime",
1802
+ shape: z.object({
1803
+ syncKey: z.string(),
1804
+ objectType: z.enum([
1805
+ "resource",
1806
+ "role",
1807
+ "resource_role",
1808
+ "resource_relation",
1809
+ "tenant",
1810
+ "workspace",
1811
+ "principal",
1812
+ "membership",
1813
+ "group",
1814
+ "resource_instance",
1815
+ "relationship_tuple",
1816
+ "role_assignment"
1817
+ ]),
1818
+ objectId: z.string(),
1819
+ tenantId: idOf("tenants").optional(),
1820
+ workspaceId: idOf("workspaces").optional(),
1821
+ principalId: z.string().optional(),
1822
+ permitTenantKey: z.string().optional(),
1823
+ permitResourceType: z.string().optional(),
1824
+ permitResourceKey: z.string().optional(),
1825
+ desiredPayload: z.record(z.any()),
1826
+ lastAppliedPayloadHash: z.string().optional(),
1827
+ status: z.enum(["pending", "synced", "error", "skipped"]),
1828
+ attemptCount: z.number(),
1829
+ lastError: z.string().optional(),
1830
+ nextAttemptAt: z.number().optional(),
1831
+ lastSyncedAt: z.number().optional(),
1832
+ createdBy: z.string(),
1833
+ updatedBy: z.string().optional(),
1834
+ createdAt: z.number(),
1835
+ updatedAt: z.number()
1836
+ }),
1837
+ indices: [
1838
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
1839
+ { kind: "index", name: "by_status", columns: ["status"] },
1840
+ {
1841
+ kind: "index",
1842
+ name: "by_tenant_status",
1843
+ columns: ["tenantId", "status"]
1844
+ },
1845
+ {
1846
+ kind: "index",
1847
+ name: "by_workspace_status",
1848
+ columns: ["workspaceId", "status"]
1849
+ },
1850
+ {
1851
+ kind: "index",
1852
+ name: "by_principal_status",
1853
+ columns: ["principalId", "status"]
1854
+ }
1855
+ ]
1856
+ });
1857
+ defineTable({
1858
+ name: "secretSyncDriftReports",
1859
+ component: "mc",
1860
+ category: "runtime",
1861
+ shape: z.object({
1862
+ reportId: z.string(),
1863
+ source: z.enum(["infisical_manifest", "manual", "ci"]),
1864
+ generatedAt: z.number(),
1865
+ recordedAt: z.number(),
1866
+ recordedBy: z.string(),
1867
+ status: z.enum([
1868
+ "in_sync",
1869
+ "drift",
1870
+ "exception",
1871
+ "blocked",
1872
+ "not_observed"
1873
+ ]),
1874
+ reportHash: z.string(),
1875
+ manifestHash: z.string().optional(),
1876
+ dryRunReceiptId: z.string().optional(),
1877
+ appliedReceiptId: z.string().optional(),
1878
+ summary: z.object({
1879
+ totalPipelines: z.number(),
1880
+ inSync: z.number(),
1881
+ drift: z.number(),
1882
+ exception: z.number(),
1883
+ blocked: z.number(),
1884
+ notObserved: z.number(),
1885
+ missingKeys: z.number(),
1886
+ valueDriftKeys: z.number(),
1887
+ extraKeys: z.number(),
1888
+ deniedConvexLeakage: z.number(),
1889
+ approvedExceptions: z.number()
1890
+ }),
1891
+ redactedReport: z.record(z.any()),
1892
+ metadata: z.record(z.any()).optional()
1893
+ }),
1894
+ indices: [
1895
+ { kind: "index", name: "by_reportId", columns: ["reportId"] },
1896
+ { kind: "index", name: "by_reportHash", columns: ["reportHash"] },
1897
+ { kind: "index", name: "by_generatedAt", columns: ["generatedAt"] },
1898
+ {
1899
+ kind: "index",
1900
+ name: "by_status_generatedAt",
1901
+ columns: ["status", "generatedAt"]
1902
+ }
1903
+ ]
1904
+ });
1745
1905
  defineTable({
1746
1906
  name: "controlPlaneTenantModelSlotBindings",
1747
1907
  component: "mc",
1748
1908
  category: "runtime",
1749
1909
  shape: z.object({
1750
- "bindingId": z.string(),
1751
- "tenantId": idOf("tenants"),
1752
- "providerId": z.string(),
1753
- "modelSlotId": z.string(),
1754
- "secretRef": z.string(),
1755
- "status": z.enum(["active", "revoked"]),
1756
- "passThroughOnly": z.boolean(),
1757
- "revokedAt": z.number().optional(),
1758
- "revokedBy": z.string().optional(),
1759
- "metadata": z.record(z.any()).optional(),
1760
- "createdBy": z.string(),
1761
- "createdAt": z.number(),
1762
- "updatedAt": z.number()
1910
+ bindingId: z.string(),
1911
+ tenantId: idOf("tenants"),
1912
+ workspaceId: idOf("workspaces").optional(),
1913
+ environment: z.enum(["dev", "staging", "prod"]).optional(),
1914
+ providerId: z.string(),
1915
+ modelSlotId: z.string(),
1916
+ secretRef: z.string(),
1917
+ status: z.enum(["active", "revoked"]),
1918
+ passThroughOnly: z.boolean(),
1919
+ revokedAt: z.number().optional(),
1920
+ revokedBy: z.string().optional(),
1921
+ metadata: z.record(z.any()).optional(),
1922
+ createdBy: z.string(),
1923
+ createdAt: z.number(),
1924
+ updatedAt: z.number()
1763
1925
  }),
1764
1926
  indices: [
1765
1927
  { kind: "index", name: "by_bindingId", columns: ["bindingId"] },
1766
1928
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1767
- { kind: "index", name: "by_tenant_slot", columns: ["tenantId", "modelSlotId"] },
1768
- { kind: "index", name: "by_tenant_provider_slot", columns: ["tenantId", "providerId", "modelSlotId"] },
1929
+ {
1930
+ kind: "index",
1931
+ name: "by_tenant_slot",
1932
+ columns: ["tenantId", "modelSlotId"]
1933
+ },
1934
+ {
1935
+ kind: "index",
1936
+ name: "by_tenant_provider_slot",
1937
+ columns: ["tenantId", "providerId", "modelSlotId"]
1938
+ },
1769
1939
  { kind: "index", name: "by_secretRef", columns: ["secretRef"] },
1770
1940
  { kind: "index", name: "by_status", columns: ["status"] }
1771
1941
  ]
@@ -1775,29 +1945,42 @@ defineTable({
1775
1945
  component: "mc",
1776
1946
  category: "runtime",
1777
1947
  shape: z.object({
1778
- "secretRef": z.string(),
1779
- "tenantId": idOf("tenants"),
1780
- "providerId": z.string(),
1781
- "label": z.string().optional(),
1782
- "encryptedSecret": z.string(),
1783
- "encryptionVersion": z.string(),
1784
- "secretFingerprint": z.string(),
1785
- "keyHint": z.string(),
1786
- "status": z.enum(["active", "revoked"]),
1787
- "rotatedFromSecretRef": z.string().optional(),
1788
- "revokedAt": z.number().optional(),
1789
- "revokedBy": z.string().optional(),
1790
- "lastUsedAt": z.number().optional(),
1791
- "metadata": z.record(z.any()).optional(),
1792
- "createdBy": z.string(),
1793
- "createdAt": z.number(),
1794
- "updatedAt": z.number()
1948
+ secretRef: z.string(),
1949
+ tenantId: idOf("tenants"),
1950
+ workspaceId: idOf("workspaces").optional(),
1951
+ environment: z.enum(["dev", "staging", "prod"]).optional(),
1952
+ providerId: z.string(),
1953
+ label: z.string().optional(),
1954
+ encryptedSecret: z.string().optional(),
1955
+ infisicalPath: z.string().optional(),
1956
+ infisicalSecretKey: z.string().optional(),
1957
+ infisicalProjectId: z.string().optional(),
1958
+ encryptionVersion: z.string(),
1959
+ secretFingerprint: z.string(),
1960
+ keyHint: z.string(),
1961
+ status: z.enum(["active", "revoked"]),
1962
+ rotatedFromSecretRef: z.string().optional(),
1963
+ revokedAt: z.number().optional(),
1964
+ revokedBy: z.string().optional(),
1965
+ lastUsedAt: z.number().optional(),
1966
+ metadata: z.record(z.any()).optional(),
1967
+ createdBy: z.string(),
1968
+ createdAt: z.number(),
1969
+ updatedAt: z.number()
1795
1970
  }),
1796
1971
  indices: [
1797
1972
  { kind: "index", name: "by_secretRef", columns: ["secretRef"] },
1798
1973
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1799
- { kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId"] },
1800
- { kind: "index", name: "by_tenant_provider_status", columns: ["tenantId", "providerId", "status"] },
1974
+ {
1975
+ kind: "index",
1976
+ name: "by_tenant_provider",
1977
+ columns: ["tenantId", "providerId"]
1978
+ },
1979
+ {
1980
+ kind: "index",
1981
+ name: "by_tenant_provider_status",
1982
+ columns: ["tenantId", "providerId", "status"]
1983
+ },
1801
1984
  { kind: "index", name: "by_status", columns: ["status"] }
1802
1985
  ]
1803
1986
  });
@@ -1806,35 +1989,93 @@ defineTable({
1806
1989
  component: "mc",
1807
1990
  category: "runtime",
1808
1991
  shape: z.object({
1809
- "usageId": z.string(),
1810
- "tenantId": idOf("tenants"),
1811
- "providerId": z.string(),
1812
- "modelSlotId": z.string(),
1813
- "secretRef": z.string(),
1814
- "proxyTokenId": z.string(),
1815
- "sessionId": z.string(),
1816
- "principalId": z.string(),
1817
- "workspaceId": z.string().optional(),
1818
- "modelId": z.string().optional(),
1819
- "requestPath": z.string(),
1820
- "status": z.enum(["success", "error"]),
1821
- "responseStatus": z.number().optional(),
1822
- "inputTokens": z.number().optional(),
1823
- "outputTokens": z.number().optional(),
1824
- "tokenCount": z.number().optional(),
1825
- "latencyMs": z.number(),
1826
- "estimatedCostUsd": z.number().optional(),
1827
- "failureCode": z.string().optional(),
1828
- "metadata": z.record(z.any()).optional(),
1829
- "createdAt": z.number(),
1830
- "updatedAt": z.number()
1992
+ usageId: z.string(),
1993
+ tenantId: idOf("tenants"),
1994
+ providerId: z.string(),
1995
+ modelSlotId: z.string(),
1996
+ secretRef: z.string(),
1997
+ proxyTokenId: z.string(),
1998
+ sessionId: z.string(),
1999
+ principalId: z.string(),
2000
+ workspaceId: z.string().optional(),
2001
+ modelId: z.string().optional(),
2002
+ requestPath: z.string(),
2003
+ status: z.enum(["success", "error"]),
2004
+ responseStatus: z.number().optional(),
2005
+ inputTokens: z.number().optional(),
2006
+ outputTokens: z.number().optional(),
2007
+ tokenCount: z.number().optional(),
2008
+ latencyMs: z.number(),
2009
+ estimatedCostUsd: z.number().optional(),
2010
+ failureCode: z.string().optional(),
2011
+ metadata: z.record(z.any()).optional(),
2012
+ createdAt: z.number(),
2013
+ updatedAt: z.number()
1831
2014
  }),
1832
2015
  indices: [
1833
2016
  { kind: "index", name: "by_usageId", columns: ["usageId"] },
1834
2017
  { kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
1835
- { kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId", "createdAt"] },
1836
- { kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId", "createdAt"] },
1837
- { kind: "index", name: "by_sessionId", columns: ["sessionId", "createdAt"] }
2018
+ {
2019
+ kind: "index",
2020
+ name: "by_tenant_provider",
2021
+ columns: ["tenantId", "providerId", "createdAt"]
2022
+ },
2023
+ {
2024
+ kind: "index",
2025
+ name: "by_proxyTokenId",
2026
+ columns: ["proxyTokenId", "createdAt"]
2027
+ },
2028
+ {
2029
+ kind: "index",
2030
+ name: "by_sessionId",
2031
+ columns: ["sessionId", "createdAt"]
2032
+ }
2033
+ ]
2034
+ });
2035
+ defineTable({
2036
+ name: "controlPlaneTenantProxyTokenLeases",
2037
+ component: "mc",
2038
+ category: "runtime",
2039
+ shape: z.object({
2040
+ leaseId: z.string(),
2041
+ proxyTokenId: z.string(),
2042
+ tenantId: idOf("tenants"),
2043
+ workspaceId: idOf("workspaces").optional(),
2044
+ environment: z.enum(["dev", "staging", "prod"]),
2045
+ providerId: z.string(),
2046
+ modelSlotId: z.string(),
2047
+ bindingId: z.string(),
2048
+ secretRef: z.string(),
2049
+ sessionId: z.string(),
2050
+ principalId: z.string(),
2051
+ agentSessionId: z.string().optional(),
2052
+ status: z.enum(["active", "revoked"]),
2053
+ expiresAt: z.number(),
2054
+ renewedAt: z.number().optional(),
2055
+ revokedAt: z.number().optional(),
2056
+ revokedBy: z.string().optional(),
2057
+ revokeReason: z.string().optional(),
2058
+ permitDecisionLogId: idOf("policyDecisionLogs").optional(),
2059
+ permitTraceId: z.string().optional(),
2060
+ metadata: z.record(z.any()).optional(),
2061
+ createdAt: z.number(),
2062
+ updatedAt: z.number()
2063
+ }),
2064
+ indices: [
2065
+ { kind: "index", name: "by_leaseId", columns: ["leaseId"] },
2066
+ { kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId"] },
2067
+ { kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
2068
+ { kind: "index", name: "by_sessionId", columns: ["sessionId", "createdAt"] },
2069
+ {
2070
+ kind: "index",
2071
+ name: "by_principalId",
2072
+ columns: ["principalId", "createdAt"]
2073
+ },
2074
+ {
2075
+ kind: "index",
2076
+ name: "by_status_expiresAt",
2077
+ columns: ["status", "expiresAt"]
2078
+ }
1838
2079
  ]
1839
2080
  });
1840
2081
  defineTable({
@@ -2167,6 +2408,7 @@ defineTable({
2167
2408
  "questionType": z.enum(["validation", "falsification", "assumption_probe", "prediction_test", "counterfactual", "discovery", "clarification", "comparison", "causal", "mechanism", "general"]).optional(),
2168
2409
  "questionPriority": z.enum(["critical", "high", "medium", "low"]).optional(),
2169
2410
  "answerQuality": z.enum(["definitive", "strong", "moderate", "weak", "speculative", "unanswered"]).optional(),
2411
+ "themeStatus": z.enum(["emerging", "active", "mature", "declining", "archived"]).optional(),
2170
2412
  "themeConviction": z.enum(["high", "medium", "low", "negative"]).optional(),
2171
2413
  "decisionType": z.enum(["invest", "pass", "follow_on", "exit", "deep_dive", "monitor", "deprioritize", "thesis_adopt", "thesis_revise", "thesis_abandon"]).optional(),
2172
2414
  "decisionOutcome": z.enum(["pending", "successful", "unsuccessful", "mixed", "unknown"]).optional(),
@@ -2317,6 +2559,7 @@ defineTable({
2317
2559
  indices: [
2318
2560
  { kind: "index", name: "by_principalId", columns: ["principalId"] },
2319
2561
  { kind: "index", name: "by_principal_tenant", columns: ["principalId", "tenantId"] },
2562
+ { kind: "index", name: "by_principal_tenant_workspace", columns: ["principalId", "tenantId", "workspaceId"] },
2320
2563
  { kind: "index", name: "by_workspace_principal", columns: ["workspaceId", "principalId"] },
2321
2564
  { kind: "index", name: "by_tenant_role", columns: ["tenantId", "role"] },
2322
2565
  { kind: "index", name: "by_status", columns: ["status"] }
@@ -2348,6 +2591,36 @@ defineTable({
2348
2591
  { kind: "index", name: "by_status", columns: ["status"] }
2349
2592
  ]
2350
2593
  });
2594
+ defineTable({
2595
+ name: "principalIdentityAliases",
2596
+ component: "mc",
2597
+ category: "identity",
2598
+ shape: z.object({
2599
+ "principalId": z.string(),
2600
+ "principalRefId": idOf("principals").optional(),
2601
+ "provider": z.string(),
2602
+ "providerProjectId": z.string().optional(),
2603
+ "externalSubjectId": z.string(),
2604
+ "tenantId": idOf("tenants").optional(),
2605
+ "workspaceId": idOf("workspaces").optional(),
2606
+ "email": z.string().optional(),
2607
+ "status": z.enum(["active", "revoked"]),
2608
+ "metadata": z.record(z.any()).optional(),
2609
+ "createdBy": z.string(),
2610
+ "revokedAt": z.number().optional(),
2611
+ "revokedBy": z.string().optional(),
2612
+ "createdAt": z.number(),
2613
+ "updatedAt": z.number()
2614
+ }),
2615
+ indices: [
2616
+ { kind: "index", name: "by_provider_subject", columns: ["provider", "externalSubjectId"] },
2617
+ { kind: "index", name: "by_provider_project_subject", columns: ["provider", "providerProjectId", "externalSubjectId"] },
2618
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
2619
+ { kind: "index", name: "by_principal_status", columns: ["principalId", "status"] },
2620
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "externalSubjectId"] },
2621
+ { kind: "index", name: "by_workspace_provider_subject", columns: ["workspaceId", "provider", "externalSubjectId"] }
2622
+ ]
2623
+ });
2351
2624
  defineTable({
2352
2625
  name: "rateLimitWindows",
2353
2626
  component: "mc",
@@ -2937,7 +3210,7 @@ defineTable({
2937
3210
  });
2938
3211
  defineTable({
2939
3212
  name: "mcpWritePolicy",
2940
- component: "identity",
3213
+ component: "control-plane",
2941
3214
  category: "platform",
2942
3215
  shape: z.object({
2943
3216
  "topicId": z.string().optional(),
@@ -2960,7 +3233,7 @@ defineTable({
2960
3233
  });
2961
3234
  defineTable({
2962
3235
  name: "platformAudienceGrants",
2963
- component: "identity",
3236
+ component: "control-plane",
2964
3237
  category: "platform",
2965
3238
  shape: z.object({
2966
3239
  "tenantId": z.string(),
@@ -2986,7 +3259,7 @@ defineTable({
2986
3259
  });
2987
3260
  defineTable({
2988
3261
  name: "platformAudiences",
2989
- component: "identity",
3262
+ component: "control-plane",
2990
3263
  category: "platform",
2991
3264
  shape: z.object({
2992
3265
  "tenantId": z.string(),
@@ -3011,7 +3284,7 @@ defineTable({
3011
3284
  });
3012
3285
  defineTable({
3013
3286
  name: "platformPolicyDecisionLogs",
3014
- component: "identity",
3287
+ component: "control-plane",
3015
3288
  category: "platform",
3016
3289
  shape: z.object({
3017
3290
  "principalId": z.string(),
@@ -3047,7 +3320,7 @@ defineTable({
3047
3320
  });
3048
3321
  defineTable({
3049
3322
  name: "tenantApiKeys",
3050
- component: "identity",
3323
+ component: "control-plane",
3051
3324
  category: "platform",
3052
3325
  shape: z.object({
3053
3326
  "tenantId": z.string(),
@@ -3074,7 +3347,7 @@ defineTable({
3074
3347
  });
3075
3348
  defineTable({
3076
3349
  name: "tenantConfig",
3077
- component: "identity",
3350
+ component: "control-plane",
3078
3351
  category: "platform",
3079
3352
  shape: z.object({
3080
3353
  "tenantId": z.string(),
@@ -3093,7 +3366,7 @@ defineTable({
3093
3366
  });
3094
3367
  defineTable({
3095
3368
  name: "tenantIntegrations",
3096
- component: "identity",
3369
+ component: "control-plane",
3097
3370
  category: "platform",
3098
3371
  shape: z.object({
3099
3372
  "tenantId": z.string(),
@@ -3148,7 +3421,7 @@ defineTable({
3148
3421
  });
3149
3422
  defineTable({
3150
3423
  name: "tenantModelSlotBindings",
3151
- component: "identity",
3424
+ component: "control-plane",
3152
3425
  category: "platform",
3153
3426
  shape: z.object({
3154
3427
  "bindingId": z.string(),
@@ -3176,7 +3449,7 @@ defineTable({
3176
3449
  });
3177
3450
  defineTable({
3178
3451
  name: "tenantPolicies",
3179
- component: "identity",
3452
+ component: "control-plane",
3180
3453
  category: "platform",
3181
3454
  shape: z.object({
3182
3455
  "tenantId": z.string(),
@@ -3201,7 +3474,7 @@ defineTable({
3201
3474
  });
3202
3475
  defineTable({
3203
3476
  name: "tenantProviderSecrets",
3204
- component: "identity",
3477
+ component: "control-plane",
3205
3478
  category: "platform",
3206
3479
  shape: z.object({
3207
3480
  "secretRef": z.string(),
@@ -3232,7 +3505,7 @@ defineTable({
3232
3505
  });
3233
3506
  defineTable({
3234
3507
  name: "tenantProxyGatewayUsage",
3235
- component: "identity",
3508
+ component: "control-plane",
3236
3509
  category: "platform",
3237
3510
  shape: z.object({
3238
3511
  "usageId": z.string(),
@@ -3267,7 +3540,7 @@ defineTable({
3267
3540
  });
3268
3541
  defineTable({
3269
3542
  name: "tenantProxyTokenMints",
3270
- component: "identity",
3543
+ component: "control-plane",
3271
3544
  category: "platform",
3272
3545
  shape: z.object({
3273
3546
  "proxyTokenId": z.string(),
@@ -3290,7 +3563,7 @@ defineTable({
3290
3563
  });
3291
3564
  defineTable({
3292
3565
  name: "tenantSandboxAuditEvents",
3293
- component: "identity",
3566
+ component: "control-plane",
3294
3567
  category: "platform",
3295
3568
  shape: z.object({
3296
3569
  "eventId": z.string(),
@@ -3324,7 +3597,7 @@ defineTable({
3324
3597
  });
3325
3598
  defineTable({
3326
3599
  name: "tenantSecrets",
3327
- component: "identity",
3600
+ component: "control-plane",
3328
3601
  category: "platform",
3329
3602
  shape: z.object({
3330
3603
  "tenantId": z.string(),
@@ -3346,7 +3619,7 @@ defineTable({
3346
3619
  });
3347
3620
  defineTable({
3348
3621
  name: "toolAcls",
3349
- component: "identity",
3622
+ component: "control-plane",
3350
3623
  category: "platform",
3351
3624
  shape: z.object({
3352
3625
  "role": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]),
@@ -3361,7 +3634,7 @@ defineTable({
3361
3634
  });
3362
3635
  defineTable({
3363
3636
  name: "toolRegistry",
3364
- component: "identity",
3637
+ component: "control-plane",
3365
3638
  category: "platform",
3366
3639
  shape: z.object({
3367
3640
  "toolName": z.string(),
@@ -3442,7 +3715,7 @@ defineTable({
3442
3715
  });
3443
3716
  defineTable({
3444
3717
  name: "modelCallLogs",
3445
- component: "identity",
3718
+ component: "control-plane",
3446
3719
  category: "model",
3447
3720
  shape: z.object({
3448
3721
  "slot": z.string(),
@@ -3468,7 +3741,7 @@ defineTable({
3468
3741
  });
3469
3742
  defineTable({
3470
3743
  name: "modelFunctionSlots",
3471
- component: "identity",
3744
+ component: "control-plane",
3472
3745
  category: "model",
3473
3746
  shape: z.object({
3474
3747
  "slot": z.string(),
@@ -3493,7 +3766,7 @@ defineTable({
3493
3766
  });
3494
3767
  defineTable({
3495
3768
  name: "modelRegistry",
3496
- component: "identity",
3769
+ component: "control-plane",
3497
3770
  category: "model",
3498
3771
  shape: z.object({
3499
3772
  "key": z.string(),
@@ -3520,7 +3793,7 @@ defineTable({
3520
3793
  });
3521
3794
  defineTable({
3522
3795
  name: "modelSlotConfigs",
3523
- component: "identity",
3796
+ component: "control-plane",
3524
3797
  category: "model",
3525
3798
  shape: z.object({
3526
3799
  "slot": z.string(),
@@ -3907,7 +4180,7 @@ defineTable({
3907
4180
  "workspaceId": idOf("workspaces").optional(),
3908
4181
  "resourceType": z.string(),
3909
4182
  "resourceId": z.string(),
3910
- "action": z.enum(["read", "summarize", "export", "mutate", "admin", "comment", "escalate", "resolve", "vote"]),
4183
+ "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"]),
3911
4184
  "decision": z.enum(["allow", "deny"]),
3912
4185
  "reasonCode": z.string(),
3913
4186
  "policyVersion": z.string(),
@@ -3969,7 +4242,7 @@ defineTable({
3969
4242
  });
3970
4243
  defineTable({
3971
4244
  name: "projectGrants",
3972
- component: "identity",
4245
+ component: "control-plane",
3973
4246
  category: "project",
3974
4247
  shape: z.object({
3975
4248
  "projectId": z.string().optional(),
@@ -4001,9 +4274,648 @@ defineTable({
4001
4274
  { kind: "index", name: "by_topic_cluster_status", columns: ["topicId", "beliefClusterId", "status"] }
4002
4275
  ]
4003
4276
  });
4277
+ var permitActorType = z.enum([
4278
+ "human",
4279
+ "agent",
4280
+ "service_principal",
4281
+ "external_stakeholder",
4282
+ "system"
4283
+ ]);
4284
+ var permitMembershipStatus = z.enum([
4285
+ "active",
4286
+ "invited",
4287
+ "revoked",
4288
+ "suspended",
4289
+ "disabled"
4290
+ ]);
4291
+ var permitDecision = z.enum(["allow", "deny"]);
4292
+ var permitAccessReviewStatus = z.enum([
4293
+ "open",
4294
+ "in_progress",
4295
+ "approved",
4296
+ "denied",
4297
+ "expired",
4298
+ "cancelled"
4299
+ ]);
4300
+ var permitReviewScope = z.enum([
4301
+ "tenant",
4302
+ "workspace",
4303
+ "resource_instance",
4304
+ "group",
4305
+ "principal",
4306
+ "api_key",
4307
+ "admin_action"
4308
+ ]);
4309
+ var permitRecordStatus = z.enum([
4310
+ "queued",
4311
+ "inflight",
4312
+ "completed",
4313
+ "failed",
4314
+ "skipped",
4315
+ "stale"
4316
+ ]);
4317
+ var permitObjectType = z.enum([
4318
+ "resource",
4319
+ "role",
4320
+ "resource_role",
4321
+ "resource_relation",
4322
+ "tenant",
4323
+ "workspace",
4324
+ "principal",
4325
+ "membership",
4326
+ "group",
4327
+ "resource_instance",
4328
+ "relationship_tuple",
4329
+ "role_assignment"
4330
+ ]);
4331
+ var permitOutboxOperation = z.enum([
4332
+ "upsert",
4333
+ "delete",
4334
+ "sync",
4335
+ "resync",
4336
+ "delete_sync",
4337
+ "noop"
4338
+ ]);
4339
+ var permitPolicyBundleStatus = z.enum([
4340
+ "draft",
4341
+ "validated",
4342
+ "enforced",
4343
+ "archived"
4344
+ ]);
4345
+ var permitSyncStatus = z.enum([
4346
+ "pending",
4347
+ "synced",
4348
+ "error",
4349
+ "skipped"
4350
+ ]);
4351
+ var permitAccessReviewSubjectType = z.enum([
4352
+ "principal",
4353
+ "group",
4354
+ "role_assignment",
4355
+ "resource_instance"
4356
+ ]);
4357
+ var permitAttributeType = z.enum([
4358
+ "string",
4359
+ "number",
4360
+ "bool",
4361
+ "json",
4362
+ "time"
4363
+ ]);
4364
+ var permitAttributeOperator = z.enum([
4365
+ "eq",
4366
+ "neq",
4367
+ "in",
4368
+ "not_in",
4369
+ "gt",
4370
+ "gte",
4371
+ "lt",
4372
+ "lte",
4373
+ "contains",
4374
+ "not_contains",
4375
+ "matches"
4376
+ ]);
4377
+ var permitRoleBindingTarget = z.enum([
4378
+ "principal",
4379
+ "group"
4380
+ ]);
4381
+ defineTable({
4382
+ name: "permitPrincipals",
4383
+ component: "control-plane",
4384
+ category: "access-control",
4385
+ shape: z.object({
4386
+ principalId: z.string(),
4387
+ tenantId: z.string(),
4388
+ workspaceId: z.optional(z.string()),
4389
+ principalType: permitActorType,
4390
+ status: permitMembershipStatus,
4391
+ displayName: z.string().optional(),
4392
+ metadata: z.record(z.any()).optional(),
4393
+ createdBy: z.string(),
4394
+ createdAt: z.number(),
4395
+ updatedAt: z.number(),
4396
+ updatedBy: z.string().optional(),
4397
+ lastSeenAt: z.number().optional()
4398
+ }),
4399
+ indices: [
4400
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4401
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4402
+ { kind: "index", name: "by_tenant_principalId", columns: ["tenantId", "principalId"] },
4403
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4404
+ {
4405
+ kind: "index",
4406
+ name: "by_tenant_principalType_status",
4407
+ columns: ["tenantId", "principalType", "status"]
4408
+ }
4409
+ ]
4410
+ });
4411
+ defineTable({
4412
+ name: "permitPrincipalAliases",
4413
+ component: "control-plane",
4414
+ category: "access-control",
4415
+ shape: z.object({
4416
+ principalId: z.string(),
4417
+ tenantId: z.string(),
4418
+ workspaceId: z.optional(z.string()),
4419
+ provider: z.string(),
4420
+ providerSubjectId: z.string(),
4421
+ providerProjectId: z.string().optional(),
4422
+ alias: z.string(),
4423
+ aliasKind: z.string(),
4424
+ status: permitMembershipStatus,
4425
+ metadata: z.record(z.any()).optional(),
4426
+ createdBy: z.string(),
4427
+ createdAt: z.number(),
4428
+ updatedAt: z.number(),
4429
+ revokedBy: z.string().optional(),
4430
+ revokedAt: z.number().optional(),
4431
+ updatedBy: z.string().optional()
4432
+ }),
4433
+ indices: [
4434
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
4435
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "providerSubjectId"] },
4436
+ {
4437
+ kind: "index",
4438
+ name: "by_tenant_provider_alias",
4439
+ columns: ["tenantId", "provider", "alias"]
4440
+ },
4441
+ { kind: "index", name: "by_tenant_alias", columns: ["tenantId", "alias"] },
4442
+ {
4443
+ kind: "index",
4444
+ name: "by_tenant_provider_status",
4445
+ columns: ["tenantId", "provider", "status"]
4446
+ }
4447
+ ]
4448
+ });
4449
+ defineTable({
4450
+ name: "permitGroups",
4451
+ component: "control-plane",
4452
+ category: "access-control",
4453
+ shape: z.object({
4454
+ tenantId: z.string(),
4455
+ workspaceId: z.optional(z.string()),
4456
+ groupId: z.string(),
4457
+ groupKey: z.string(),
4458
+ groupName: z.string(),
4459
+ groupType: z.enum(["tenant", "workspace", "external", "system", "dynamic"]),
4460
+ status: permitMembershipStatus,
4461
+ description: z.string().optional(),
4462
+ metadata: z.record(z.any()).optional(),
4463
+ createdBy: z.string(),
4464
+ createdAt: z.number(),
4465
+ updatedAt: z.number(),
4466
+ updatedBy: z.string().optional()
4467
+ }),
4468
+ indices: [
4469
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4470
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4471
+ { kind: "index", name: "by_tenant_groupId", columns: ["tenantId", "groupId"] },
4472
+ { kind: "index", name: "by_tenant_groupKey", columns: ["tenantId", "groupKey"] },
4473
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4474
+ ]
4475
+ });
4476
+ defineTable({
4477
+ name: "permitGroupMemberships",
4478
+ component: "control-plane",
4479
+ category: "access-control",
4480
+ shape: z.object({
4481
+ tenantId: z.string(),
4482
+ workspaceId: z.optional(z.string()),
4483
+ groupId: z.string(),
4484
+ memberType: z.enum(["principal", "group"]),
4485
+ memberId: z.string(),
4486
+ principalId: z.string().optional(),
4487
+ childGroupId: z.string().optional(),
4488
+ status: permitMembershipStatus,
4489
+ addedBy: z.string().optional(),
4490
+ revokedBy: z.string().optional(),
4491
+ expiresAt: z.number().optional(),
4492
+ revocationReason: z.string().optional(),
4493
+ metadata: z.record(z.any()).optional(),
4494
+ createdAt: z.number(),
4495
+ updatedAt: z.number(),
4496
+ updatedBy: z.string().optional()
4497
+ }),
4498
+ indices: [
4499
+ { kind: "index", name: "by_tenant_principal", columns: ["tenantId", "principalId"] },
4500
+ { kind: "index", name: "by_tenant_member", columns: ["tenantId", "memberType", "memberId"] },
4501
+ {
4502
+ kind: "index",
4503
+ name: "by_tenant_member_group",
4504
+ columns: ["tenantId", "memberType", "memberId", "groupId"]
4505
+ },
4506
+ { kind: "index", name: "by_tenant_group", columns: ["tenantId", "groupId"] },
4507
+ { kind: "index", name: "by_member_group", columns: ["memberType", "memberId", "groupId"] },
4508
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4509
+ {
4510
+ kind: "index",
4511
+ name: "by_workspace_principal",
4512
+ columns: ["workspaceId", "principalId"]
4513
+ }
4514
+ ]
4515
+ });
4516
+ defineTable({
4517
+ name: "permitResourceInstances",
4518
+ component: "control-plane",
4519
+ category: "access-control",
4520
+ shape: z.object({
4521
+ tenantId: z.string(),
4522
+ workspaceId: z.optional(z.string()),
4523
+ resourceType: z.string(),
4524
+ resourceKey: z.string(),
4525
+ resourceId: z.string(),
4526
+ status: z.enum(["active", "deleted", "archived"]),
4527
+ attributes: z.record(z.any()).optional(),
4528
+ ownerPrincipalId: z.string().optional(),
4529
+ metadata: z.record(z.any()).optional(),
4530
+ createdBy: z.string(),
4531
+ updatedBy: z.string().optional(),
4532
+ createdAt: z.number(),
4533
+ updatedAt: z.number()
4534
+ }),
4535
+ indices: [
4536
+ {
4537
+ kind: "index",
4538
+ name: "by_tenant_resource_type",
4539
+ columns: ["tenantId", "resourceType"]
4540
+ },
4541
+ {
4542
+ kind: "index",
4543
+ name: "by_tenant_resource_key",
4544
+ columns: ["tenantId", "resourceType", "resourceKey"]
4545
+ },
4546
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4547
+ { kind: "index", name: "by_status", columns: ["status"] },
4548
+ {
4549
+ kind: "index",
4550
+ name: "by_tenant_status",
4551
+ columns: ["tenantId", "status"]
4552
+ },
4553
+ {
4554
+ kind: "index",
4555
+ name: "by_ownerPrincipalId",
4556
+ columns: ["ownerPrincipalId"]
4557
+ }
4558
+ ]
4559
+ });
4560
+ defineTable({
4561
+ name: "permitRoleAssignments",
4562
+ component: "control-plane",
4563
+ category: "access-control",
4564
+ shape: z.object({
4565
+ tenantId: z.string(),
4566
+ workspaceId: z.optional(z.string()),
4567
+ role: z.string(),
4568
+ targetType: permitRoleBindingTarget,
4569
+ targetId: z.string(),
4570
+ resourceType: z.string(),
4571
+ resourceKey: z.string(),
4572
+ resourceInstanceId: z.string().optional(),
4573
+ status: permitMembershipStatus,
4574
+ expiresAt: z.number().optional(),
4575
+ attributes: z.record(z.any()).optional(),
4576
+ grantedBy: z.string().optional(),
4577
+ updatedBy: z.string().optional(),
4578
+ revokedBy: z.string().optional(),
4579
+ createdAt: z.number(),
4580
+ updatedAt: z.number()
4581
+ }),
4582
+ indices: [
4583
+ {
4584
+ kind: "index",
4585
+ name: "by_tenant_target",
4586
+ columns: ["tenantId", "targetType", "targetId"]
4587
+ },
4588
+ {
4589
+ kind: "index",
4590
+ name: "by_tenant_resource",
4591
+ columns: ["tenantId", "resourceType", "resourceKey"]
4592
+ },
4593
+ {
4594
+ kind: "index",
4595
+ name: "by_tenant_role",
4596
+ columns: ["tenantId", "role", "status"]
4597
+ },
4598
+ { kind: "index", name: "by_status", columns: ["status"] },
4599
+ {
4600
+ kind: "index",
4601
+ name: "by_workspace_resource",
4602
+ columns: ["workspaceId", "resourceType", "resourceKey"]
4603
+ }
4604
+ ]
4605
+ });
4606
+ defineTable({
4607
+ name: "permitRelationshipTuples",
4608
+ component: "control-plane",
4609
+ category: "access-control",
4610
+ shape: z.object({
4611
+ tenantId: z.string(),
4612
+ workspaceId: z.optional(z.string()),
4613
+ relation: z.string(),
4614
+ subject: z.string(),
4615
+ object: z.string(),
4616
+ resourceType: z.string().optional(),
4617
+ resourceKey: z.string().optional(),
4618
+ status: permitRecordStatus,
4619
+ attributes: z.record(z.any()).optional(),
4620
+ createdBy: z.string(),
4621
+ createdAt: z.number(),
4622
+ updatedAt: z.number(),
4623
+ lastSeenAt: z.number().optional(),
4624
+ updatedBy: z.string().optional()
4625
+ }),
4626
+ indices: [
4627
+ { kind: "index", name: "by_tenant_subject", columns: ["tenantId", "subject"] },
4628
+ { kind: "index", name: "by_tenant_object", columns: ["tenantId", "object"] },
4629
+ { kind: "index", name: "by_tenant_relation", columns: ["tenantId", "relation"] },
4630
+ {
4631
+ kind: "index",
4632
+ name: "by_tenant_relation_subject",
4633
+ columns: ["tenantId", "relation", "subject"]
4634
+ },
4635
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4636
+ ]
4637
+ });
4638
+ defineTable({
4639
+ name: "permitAttributeBindings",
4640
+ component: "control-plane",
4641
+ category: "access-control",
4642
+ shape: z.object({
4643
+ tenantId: z.string(),
4644
+ workspaceId: z.optional(z.string()),
4645
+ targetType: permitRoleBindingTarget,
4646
+ targetId: z.string(),
4647
+ attributeName: z.string(),
4648
+ attributeType: permitAttributeType,
4649
+ attributeOperator: permitAttributeOperator,
4650
+ attributeValue: z.any(),
4651
+ status: permitRecordStatus,
4652
+ source: z.string().optional(),
4653
+ sourceRef: z.string().optional(),
4654
+ metadata: z.record(z.any()).optional(),
4655
+ createdAt: z.number(),
4656
+ updatedAt: z.number(),
4657
+ createdBy: z.string(),
4658
+ updatedBy: z.string().optional(),
4659
+ expiresAt: z.number().optional()
4660
+ }),
4661
+ indices: [
4662
+ {
4663
+ kind: "index",
4664
+ name: "by_tenant_target",
4665
+ columns: ["tenantId", "targetType", "targetId"]
4666
+ },
4667
+ {
4668
+ kind: "index",
4669
+ name: "by_tenant_target_attribute",
4670
+ columns: ["tenantId", "targetType", "targetId", "attributeName"]
4671
+ },
4672
+ {
4673
+ kind: "index",
4674
+ name: "by_tenant_name",
4675
+ columns: ["tenantId", "attributeName"]
4676
+ },
4677
+ {
4678
+ kind: "index",
4679
+ name: "by_tenant_status",
4680
+ columns: ["tenantId", "status"]
4681
+ }
4682
+ ]
4683
+ });
4684
+ defineTable({
4685
+ name: "permitPolicyBundles",
4686
+ component: "control-plane",
4687
+ category: "access-control",
4688
+ shape: z.object({
4689
+ tenantId: z.string(),
4690
+ workspaceId: z.optional(z.string()),
4691
+ bundleKey: z.string(),
4692
+ version: z.number(),
4693
+ status: permitPolicyBundleStatus,
4694
+ policyHash: z.string().optional(),
4695
+ policyPayload: z.record(z.any()),
4696
+ metadata: z.record(z.any()).optional(),
4697
+ createdBy: z.string(),
4698
+ reviewedBy: z.string().optional(),
4699
+ createdAt: z.number(),
4700
+ updatedAt: z.number(),
4701
+ retiredAt: z.number().optional()
4702
+ }),
4703
+ indices: [
4704
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4705
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4706
+ {
4707
+ kind: "index",
4708
+ name: "by_tenant_bundleKey",
4709
+ columns: ["tenantId", "bundleKey"]
4710
+ },
4711
+ {
4712
+ kind: "index",
4713
+ name: "by_tenant_bundle_version",
4714
+ columns: ["tenantId", "bundleKey", "version"]
4715
+ },
4716
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4717
+ ]
4718
+ });
4719
+ defineTable({
4720
+ name: "permitProjectionOutbox",
4721
+ component: "control-plane",
4722
+ category: "access-control",
4723
+ shape: z.object({
4724
+ syncKey: z.string(),
4725
+ objectType: permitObjectType,
4726
+ objectId: z.string(),
4727
+ operation: permitOutboxOperation,
4728
+ payload: z.record(z.any()),
4729
+ status: permitRecordStatus,
4730
+ attemptCount: z.number(),
4731
+ nextAttemptAt: z.number().optional(),
4732
+ lastError: z.string().optional(),
4733
+ tenantId: z.string().optional(),
4734
+ workspaceId: z.optional(z.string()),
4735
+ principalId: z.string().optional(),
4736
+ permitTenantKey: z.string().optional(),
4737
+ permitResourceType: z.string().optional(),
4738
+ permitResourceKey: z.string().optional(),
4739
+ createdAt: z.number(),
4740
+ updatedAt: z.number(),
4741
+ lastHandledAt: z.number().optional()
4742
+ }),
4743
+ indices: [
4744
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4745
+ { kind: "index", name: "by_status", columns: ["status"] },
4746
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4747
+ {
4748
+ kind: "index",
4749
+ name: "by_tenant_status",
4750
+ columns: ["tenantId", "status"]
4751
+ },
4752
+ {
4753
+ kind: "index",
4754
+ name: "by_objectType",
4755
+ columns: ["objectType", "status"]
4756
+ }
4757
+ ]
4758
+ });
4759
+ defineTable({
4760
+ name: "tenantPermitSyncStates",
4761
+ component: "control-plane",
4762
+ category: "access-control",
4763
+ shape: z.object({
4764
+ syncKey: z.string(),
4765
+ objectType: permitObjectType,
4766
+ objectId: z.string(),
4767
+ tenantId: z.string().optional(),
4768
+ workspaceId: z.string().optional(),
4769
+ principalId: z.string().optional(),
4770
+ permitTenantKey: z.string().optional(),
4771
+ permitResourceType: z.string().optional(),
4772
+ permitResourceKey: z.string().optional(),
4773
+ desiredPayload: z.record(z.any()),
4774
+ lastAppliedPayloadHash: z.string().optional(),
4775
+ status: permitSyncStatus,
4776
+ attemptCount: z.number(),
4777
+ lastError: z.string().optional(),
4778
+ nextAttemptAt: z.number().optional(),
4779
+ lastSyncedAt: z.number().optional(),
4780
+ createdBy: z.string(),
4781
+ updatedBy: z.string().optional(),
4782
+ createdAt: z.number(),
4783
+ updatedAt: z.number()
4784
+ }),
4785
+ indices: [
4786
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4787
+ { kind: "index", name: "by_status", columns: ["status"] },
4788
+ {
4789
+ kind: "index",
4790
+ name: "by_tenant_status",
4791
+ columns: ["tenantId", "status"]
4792
+ },
4793
+ {
4794
+ kind: "index",
4795
+ name: "by_workspace_status",
4796
+ columns: ["workspaceId", "status"]
4797
+ },
4798
+ {
4799
+ kind: "index",
4800
+ name: "by_principal_status",
4801
+ columns: ["principalId", "status"]
4802
+ }
4803
+ ]
4804
+ });
4805
+ defineTable({
4806
+ name: "permitPolicyDecisionReceipts",
4807
+ component: "control-plane",
4808
+ category: "access-control",
4809
+ shape: z.object({
4810
+ tenantId: z.string().optional(),
4811
+ workspaceId: z.string().optional(),
4812
+ principalId: z.string(),
4813
+ subjectType: permitAccessReviewSubjectType.optional(),
4814
+ subjectId: z.string().optional(),
4815
+ resourceType: z.string(),
4816
+ resourceId: z.string(),
4817
+ action: z.string(),
4818
+ decision: permitDecision,
4819
+ reasonCode: z.string(),
4820
+ policyBundleId: z.string().optional(),
4821
+ policyVersion: z.string(),
4822
+ traceId: z.string().optional(),
4823
+ requestId: z.string().optional(),
4824
+ audienceMode: z.string().optional(),
4825
+ audienceKey: z.string().optional(),
4826
+ audienceClass: z.enum(["internal", "restricted_external", "public"]).optional(),
4827
+ metadata: z.record(z.any()).optional(),
4828
+ createdAt: z.number(),
4829
+ expiresAt: z.number().optional(),
4830
+ createdBy: z.string().optional()
4831
+ }),
4832
+ indices: [
4833
+ { kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
4834
+ { kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
4835
+ { kind: "index", name: "by_resource", columns: ["resourceType", "resourceId"] },
4836
+ { kind: "index", name: "by_decision_createdAt", columns: ["decision", "createdAt"] },
4837
+ { kind: "index", name: "by_traceId", columns: ["traceId"] },
4838
+ { kind: "index", name: "by_action", columns: ["action"] }
4839
+ ]
4840
+ });
4841
+ defineTable({
4842
+ name: "permitAccessReviews",
4843
+ component: "control-plane",
4844
+ category: "access-control",
4845
+ shape: z.object({
4846
+ tenantId: z.string(),
4847
+ workspaceId: z.optional(z.string()),
4848
+ reviewKey: z.string(),
4849
+ scope: permitReviewScope,
4850
+ status: permitAccessReviewStatus,
4851
+ subjectType: permitAccessReviewSubjectType,
4852
+ subjectId: z.string(),
4853
+ resourceType: z.string().optional(),
4854
+ resourceKey: z.string().optional(),
4855
+ outcome: z.enum(["allow", "deny"]).optional(),
4856
+ requestedBy: z.string(),
4857
+ reviewedBy: z.string().optional(),
4858
+ requestedAt: z.number(),
4859
+ reviewedAt: z.number().optional(),
4860
+ dueAt: z.number().optional(),
4861
+ justification: z.string().optional(),
4862
+ rationale: z.string().optional(),
4863
+ policyBundleId: z.string().optional(),
4864
+ metadata: z.record(z.any()).optional(),
4865
+ createdAt: z.number(),
4866
+ updatedAt: z.number()
4867
+ }),
4868
+ indices: [
4869
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4870
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4871
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4872
+ {
4873
+ kind: "index",
4874
+ name: "by_tenant_subject",
4875
+ columns: ["tenantId", "subjectType", "subjectId"]
4876
+ },
4877
+ { kind: "index", name: "by_outcome", columns: ["outcome"] },
4878
+ {
4879
+ kind: "index",
4880
+ name: "by_workspace_status",
4881
+ columns: ["workspaceId", "status"]
4882
+ }
4883
+ ]
4884
+ });
4885
+ defineTable({
4886
+ name: "permitAccessReviewItems",
4887
+ component: "control-plane",
4888
+ category: "access-control",
4889
+ shape: z.object({
4890
+ reviewKey: z.string(),
4891
+ itemKey: z.string(),
4892
+ tenantId: z.string(),
4893
+ workspaceId: z.string().optional(),
4894
+ subjectType: permitAccessReviewSubjectType,
4895
+ subjectId: z.string(),
4896
+ resourceType: z.string().optional(),
4897
+ resourceKey: z.string().optional(),
4898
+ role: z.string().optional(),
4899
+ relation: z.string().optional(),
4900
+ status: z.enum(["open", "approved", "revoked", "changed", "deferred"]),
4901
+ reviewerId: z.string().optional(),
4902
+ decisionAt: z.number().optional(),
4903
+ rationale: z.string().optional(),
4904
+ metadata: z.record(z.any()).optional(),
4905
+ createdAt: z.number(),
4906
+ updatedAt: z.number()
4907
+ }),
4908
+ indices: [
4909
+ { kind: "index", name: "by_reviewKey", columns: ["reviewKey"] },
4910
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4911
+ { kind: "index", name: "by_tenant_itemKey", columns: ["tenantId", "itemKey"] },
4912
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4913
+ { kind: "index", name: "by_status", columns: ["status"] }
4914
+ ]
4915
+ });
4004
4916
  defineTable({
4005
4917
  name: "reasoningPermissions",
4006
- component: "identity",
4918
+ component: "control-plane",
4007
4919
  category: "epistemic",
4008
4920
  shape: z.object({
4009
4921
  "topicId": z.string().optional(),
@@ -4250,7 +5162,7 @@ defineTable({
4250
5162
  });
4251
5163
  defineTable({
4252
5164
  name: "users",
4253
- component: "identity",
5165
+ component: "control-plane",
4254
5166
  category: "user",
4255
5167
  shape: z.object({
4256
5168
  "clerkId": z.string(),
@@ -4364,7 +5276,6 @@ defineTable({
4364
5276
  "deployments": z.record(z.object({
4365
5277
  "url": z.string(),
4366
5278
  "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
4367
- "encryptedDeployKey": z.string().optional(),
4368
5279
  "credentialRef": z.string().optional()
4369
5280
  })).optional(),
4370
5281
  "metadata": z.record(z.any()).optional(),
@@ -4379,6 +5290,39 @@ defineTable({
4379
5290
  { kind: "index", name: "by_status", columns: ["status"] }
4380
5291
  ]
4381
5292
  });
5293
+ defineTable({
5294
+ name: "deploymentHosts",
5295
+ component: "mc",
5296
+ category: "workspace",
5297
+ shape: z.object({
5298
+ "host": z.string(),
5299
+ "tenantId": idOf("tenants"),
5300
+ "workspaceId": idOf("workspaces"),
5301
+ "environment": z.enum(["dev", "staging", "prod"]),
5302
+ "target": z.enum(["kernelDeployment", "appDeployment"]),
5303
+ "deploymentUrl": z.string().optional(),
5304
+ "deploymentName": z.string().optional(),
5305
+ "vercelProjectName": z.string().optional(),
5306
+ "vercelProjectId": z.string().optional(),
5307
+ "vercelEnvironment": z.enum(["development", "preview", "staging", "production"]).optional(),
5308
+ "source": z.enum(["vercel_preview", "vercel_production", "vercel_custom_environment", "custom_domain", "manual"]),
5309
+ "status": z.enum(["active", "revoked"]),
5310
+ "metadata": z.record(z.any()).optional(),
5311
+ "createdBy": z.string(),
5312
+ "createdAt": z.number(),
5313
+ "updatedAt": z.number(),
5314
+ "revokedAt": z.number().optional(),
5315
+ "revokedBy": z.string().optional()
5316
+ }),
5317
+ indices: [
5318
+ { kind: "index", name: "by_host", columns: ["host"] },
5319
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
5320
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
5321
+ { kind: "index", name: "by_tenant_workspace_environment", columns: ["tenantId", "workspaceId", "environment"] },
5322
+ { kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
5323
+ { kind: "index", name: "by_status", columns: ["status"] }
5324
+ ]
5325
+ });
4382
5326
  defineTable({
4383
5327
  name: "worktreeBeliefCluster",
4384
5328
  component: "kernel",
@@ -4686,8 +5630,8 @@ defineTable({
4686
5630
  });
4687
5631
  z.object({
4688
5632
  manifestVersion: z.string(),
4689
- componentName: z.enum(["kernel", "identity"]),
4690
- tier: z.enum(["K", "I"]),
5633
+ componentName: z.enum(["kernel", "control-plane"]),
5634
+ tier: z.enum(["K", "CP"]),
4691
5635
  packageVersion: z.string(),
4692
5636
  tables: z.array(
4693
5637
  z.object({
@@ -4813,129 +5757,994 @@ var edgePolicyManifest = {
4813
5757
  // ../contracts/src/tenant-client.contract.ts
4814
5758
  var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
4815
5759
  {
4816
- packageName: "@lucern/access-control",
4817
- role: "runtime_entrypoint",
4818
- directTenantImport: true
5760
+ packageName: "@lucern/access-control",
5761
+ role: "runtime_entrypoint",
5762
+ directTenantImport: true
5763
+ },
5764
+ {
5765
+ packageName: "@lucern/agent",
5766
+ role: "platform_runtime",
5767
+ directTenantImport: false
5768
+ },
5769
+ {
5770
+ packageName: "@lucern/auth",
5771
+ role: "sdk_dependency",
5772
+ directTenantImport: false
5773
+ },
5774
+ {
5775
+ packageName: "@lucern/cli",
5776
+ role: "developer_tool",
5777
+ directTenantImport: false
5778
+ },
5779
+ {
5780
+ packageName: "@lucern/client-core",
5781
+ role: "sdk_dependency",
5782
+ directTenantImport: false
5783
+ },
5784
+ {
5785
+ packageName: "@lucern/confidence",
5786
+ role: "sdk_dependency",
5787
+ directTenantImport: false
5788
+ },
5789
+ {
5790
+ packageName: "@lucern/config",
5791
+ role: "configuration",
5792
+ directTenantImport: false
5793
+ },
5794
+ {
5795
+ packageName: "@lucern/contracts",
5796
+ role: "contract_entrypoint",
5797
+ directTenantImport: true
5798
+ },
5799
+ {
5800
+ packageName: "@lucern/control-plane",
5801
+ role: "component_runtime",
5802
+ directTenantImport: false
5803
+ },
5804
+ {
5805
+ packageName: "@lucern/developer-kit",
5806
+ role: "developer_tool",
5807
+ directTenantImport: false
5808
+ },
5809
+ {
5810
+ packageName: "@lucern/events",
5811
+ role: "sdk_dependency",
5812
+ directTenantImport: false
5813
+ },
5814
+ {
5815
+ packageName: "@lucern/graph-primitives",
5816
+ role: "sdk_dependency",
5817
+ directTenantImport: false
5818
+ },
5819
+ {
5820
+ packageName: "@lucern/graph-sync",
5821
+ role: "host_addon_runtime",
5822
+ directTenantImport: true
5823
+ },
5824
+ {
5825
+ packageName: "@lucern/mcp",
5826
+ role: "runtime_entrypoint",
5827
+ directTenantImport: true
5828
+ },
5829
+ {
5830
+ packageName: "@lucern/pack-host",
5831
+ role: "platform_runtime",
5832
+ directTenantImport: false
5833
+ },
5834
+ {
5835
+ packageName: "@lucern/pack-installer",
5836
+ role: "developer_tool",
5837
+ directTenantImport: false
5838
+ },
5839
+ {
5840
+ packageName: "@lucern/proof-compiler",
5841
+ role: "developer_tool",
5842
+ directTenantImport: false
5843
+ },
5844
+ {
5845
+ packageName: "@lucern/react",
5846
+ role: "runtime_entrypoint",
5847
+ directTenantImport: true
5848
+ },
5849
+ {
5850
+ packageName: "@lucern/reasoning-kernel",
5851
+ role: "component_runtime",
5852
+ directTenantImport: false
5853
+ },
5854
+ {
5855
+ packageName: "@lucern/sdk",
5856
+ role: "runtime_entrypoint",
5857
+ directTenantImport: true
5858
+ },
5859
+ {
5860
+ packageName: "@lucern/secrets",
5861
+ role: "sdk_dependency",
5862
+ directTenantImport: false
5863
+ },
5864
+ {
5865
+ packageName: "@lucern/server-core",
5866
+ role: "platform_runtime",
5867
+ directTenantImport: false
5868
+ },
5869
+ {
5870
+ packageName: "@lucern/testing",
5871
+ role: "test_support",
5872
+ directTenantImport: false
5873
+ },
5874
+ {
5875
+ packageName: "@lucern/types",
5876
+ role: "contract_entrypoint",
5877
+ directTenantImport: true
5878
+ }
5879
+ ];
5880
+ TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
5881
+ (entry) => entry.packageName
5882
+ );
5883
+
5884
+ // ../contracts/src/infisical-runtime.contract.ts
5885
+ var INFISICAL_TENANT_SOFTWARE_SYSTEMS = [
5886
+ {
5887
+ id: "stack-frontend",
5888
+ tenantKey: "stack",
5889
+ workspaceKey: "frontend",
5890
+ vercelProjectName: "ai-chatbot-diao",
5891
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5892
+ vercelProjectId: "prj_PihFw8kohSSw14nZs9YQV3xVo517",
5893
+ repository: {
5894
+ owner: "stack-vc",
5895
+ name: "front-end"
5896
+ },
5897
+ sharedSourcePath: "/tenants/stack",
5898
+ sharedVariablePolicy: "tenant_shared_all_systems",
5899
+ convex: {
5900
+ urlEnv: "CONVEX_FRONTEND_URL",
5901
+ deployKeyEnv: "CONVEX_FRONTEND_DEPLOY_KEY",
5902
+ preprodDeployment: "rugged-lobster-664",
5903
+ prodDeployment: "wonderful-toucan-0"
5904
+ }
5905
+ },
5906
+ {
5907
+ id: "stackos",
5908
+ tenantKey: "stack",
5909
+ workspaceKey: "stackos",
5910
+ vercelProjectName: "stackos",
5911
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5912
+ vercelProjectId: "prj_rXLAL0Z6v9p1fasKbomby6GI7kau",
5913
+ repository: {
5914
+ owner: "stack-vc",
5915
+ name: "stackos"
5916
+ },
5917
+ sharedSourcePath: "/tenants/stack",
5918
+ sharedVariablePolicy: "tenant_shared_all_systems",
5919
+ convex: {
5920
+ urlEnv: "CONVEX_STACKOS_URL",
5921
+ deployKeyEnv: "CONVEX_STACKOS_DEPLOY_KEY",
5922
+ preprodDeployment: "giant-mandrill-761",
5923
+ prodDeployment: "good-snake-515"
5924
+ }
5925
+ },
5926
+ {
5927
+ id: "stack-eng",
5928
+ tenantKey: "stack",
5929
+ workspaceKey: "engineering",
5930
+ vercelProjectName: "stackos-engineering-graph",
5931
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5932
+ vercelProjectId: "prj_zAU0Zn9GkbHjHI63dxW4vLpmoqTJ",
5933
+ repository: {
5934
+ owner: "stack-vc",
5935
+ name: "stackos-engineering-graph"
5936
+ },
5937
+ sharedSourcePath: "/tenants/stack/engineering",
5938
+ sharedVariablePolicy: "tenant_shared_all_systems",
5939
+ convex: {
5940
+ urlEnv: "CONVEX_STACK_ENG_URL",
5941
+ deployKeyEnv: "CONVEX_STACK_ENG_DEPLOY_KEY",
5942
+ preprodDeployment: "small-oyster-270",
5943
+ prodDeployment: "bold-cuttlefish-804"
5944
+ }
5945
+ },
5946
+ {
5947
+ id: "lucern-graph",
5948
+ tenantKey: "lucern",
5949
+ workspaceKey: "lucern",
5950
+ vercelProjectName: "lucern-graph",
5951
+ vercelTeamId: "team_vTHxxs8GAoAFUe6RWMlYt7fY",
5952
+ vercelProjectId: "prj_KJ8EKV8vGM5xURpqmwTwmECEGPgQ",
5953
+ repository: {
5954
+ owner: "LucernAI",
5955
+ name: "lucern-graph"
5956
+ },
5957
+ sharedSourcePath: "/tenants/lucern/shared",
5958
+ sharedVariablePolicy: "tenant_shared_all_systems",
5959
+ convex: {
5960
+ urlEnv: "CONVEX_LUCERN_URL",
5961
+ deployKeyEnv: "CONVEX_LUCERN_DEPLOY_KEY",
5962
+ preprodDeployment: "good-blackbird-774",
5963
+ prodDeployment: "precious-dog-365"
5964
+ }
5965
+ }
5966
+ ];
5967
+ var TENANT_SHARED_SECRET_DEFINITION_TEMPLATES = [
5968
+ {
5969
+ idSuffix: "clerk.publishable",
5970
+ canonicalName: "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
5971
+ aliases: ["CLERK_PUBLISHABLE_KEY"],
5972
+ required: true,
5973
+ secret: false,
5974
+ public: true,
5975
+ 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."
5976
+ },
5977
+ {
5978
+ idSuffix: "clerk.secret",
5979
+ canonicalName: "CLERK_SECRET_KEY",
5980
+ required: true,
5981
+ secret: true,
5982
+ public: false,
5983
+ description: "Tenant-owned Clerk backend secret used only by that tenant's server runtimes."
5984
+ },
5985
+ {
5986
+ idSuffix: "clerk.project",
5987
+ canonicalName: "CLERK_PROJECT_ID",
5988
+ required: true,
5989
+ secret: false,
5990
+ public: false,
5991
+ description: "Tenant-owned Clerk project id used to resolve canonical Clerk aliases."
5992
+ },
5993
+ {
5994
+ idSuffix: "clerk.jwks",
5995
+ canonicalName: "CLERK_JWT_ISSUER_DOMAIN",
5996
+ aliases: ["CLERK_ISSUER_URL", "CLERK_JWKS_URL"],
5997
+ required: false,
5998
+ secret: false,
5999
+ public: false,
6000
+ description: "Tenant Clerk issuer/JWKS URL consumed by Convex auth.config.ts."
6001
+ },
6002
+ {
6003
+ idSuffix: "clerk.jwt-key",
6004
+ canonicalName: "CLERK_JWT_KEY",
6005
+ required: false,
6006
+ secret: true,
6007
+ public: false,
6008
+ description: "Tenant Clerk JWT public verification key used by bearer-token API routes."
6009
+ },
6010
+ {
6011
+ idSuffix: "clerk.authorized-parties",
6012
+ canonicalName: "CLERK_AUTHORIZED_PARTIES",
6013
+ aliases: ["CLERK_MOBILE_AUTHORIZED_PARTIES"],
6014
+ required: false,
6015
+ secret: false,
6016
+ public: false,
6017
+ description: "Comma-separated Clerk authorized parties for browser and mobile bearer-token validation."
6018
+ },
6019
+ {
6020
+ idSuffix: "clerk.sign-in-url",
6021
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
6022
+ required: false,
6023
+ secret: false,
6024
+ public: true,
6025
+ description: "Tenant Clerk sign-in route for custom app login surfaces."
6026
+ },
6027
+ {
6028
+ idSuffix: "clerk.sign-up-url",
6029
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
6030
+ required: false,
6031
+ secret: false,
6032
+ public: true,
6033
+ description: "Tenant Clerk sign-up route for custom app login surfaces."
6034
+ }
6035
+ ];
6036
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6037
+ (system) => TENANT_SHARED_SECRET_DEFINITION_TEMPLATES.map(
6038
+ (template) => ({
6039
+ id: `tenant.${system.id}.${template.idSuffix}`,
6040
+ canonicalName: template.canonicalName,
6041
+ aliases: "aliases" in template ? template.aliases : void 0,
6042
+ owner: "tenant",
6043
+ scope: "tenant",
6044
+ sourcePath: system.sharedSourcePath,
6045
+ environmentPolicy: "environment_specific",
6046
+ required: template.required,
6047
+ secret: template.secret,
6048
+ public: template.public,
6049
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6050
+ destinations: [
6051
+ {
6052
+ kind: "vercel",
6053
+ target: system.vercelProjectName,
6054
+ environmentPolicy: "preprod_staging_prod_prod"
6055
+ },
6056
+ {
6057
+ kind: "convex",
6058
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6059
+ environmentPolicy: "preprod_staging_prod_prod"
6060
+ }
6061
+ ],
6062
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6063
+ })
6064
+ )
6065
+ );
6066
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.map(
6067
+ (system) => ({
6068
+ id: `tenant.${system.id}.install-lucern-npm`,
6069
+ canonicalName: "INSTALL_LUCERN_NPM",
6070
+ owner: "provider",
6071
+ scope: "global",
6072
+ sourcePath: "/tenants/shared",
6073
+ environmentPolicy: "same_all_environments",
6074
+ required: true,
6075
+ secret: true,
6076
+ public: false,
6077
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6078
+ destinations: [
6079
+ {
6080
+ kind: "vercel",
6081
+ target: system.vercelProjectName,
6082
+ environmentPolicy: "same_all_environments"
6083
+ },
6084
+ {
6085
+ kind: "github_actions",
6086
+ target: `${system.repository.owner}/${system.repository.name}`,
6087
+ environmentPolicy: "same_all_environments"
6088
+ }
6089
+ ],
6090
+ description: `${system.tenantKey}/${system.workspaceKey}: read-only npm install token for published @lucern/* packages.`
6091
+ })
6092
+ );
6093
+ var TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS = ["stack-frontend", "stackos"];
6094
+ var TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES = [
6095
+ {
6096
+ idSuffix: "ai.openai-api-key",
6097
+ canonicalName: "OPENAI_API_KEY",
6098
+ required: false,
6099
+ secret: true,
6100
+ public: false,
6101
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6102
+ description: "Tenant-owned OpenAI key for product runtime LLM calls."
4819
6103
  },
4820
6104
  {
4821
- packageName: "@lucern/agent",
4822
- role: "platform_runtime",
4823
- directTenantImport: false
6105
+ idSuffix: "ai.anthropic-api-key",
6106
+ canonicalName: "ANTHROPIC_API_KEY",
6107
+ required: false,
6108
+ secret: true,
6109
+ public: false,
6110
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6111
+ description: "Tenant-owned Anthropic key for product runtime LLM calls."
4824
6112
  },
4825
6113
  {
4826
- packageName: "@lucern/auth",
4827
- role: "sdk_dependency",
4828
- directTenantImport: false
6114
+ idSuffix: "ai.gemini-api-key",
6115
+ canonicalName: "GEMINI_API_KEY",
6116
+ aliases: ["GOOGLE_AI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
6117
+ required: false,
6118
+ secret: true,
6119
+ public: false,
6120
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6121
+ description: "Tenant-owned Google/Gemini key for product runtime LLM calls."
4829
6122
  },
4830
6123
  {
4831
- packageName: "@lucern/cli",
4832
- role: "developer_tool",
4833
- directTenantImport: false
6124
+ idSuffix: "langfuse.secret-key",
6125
+ canonicalName: "LANGFUSE_SECRET_KEY",
6126
+ required: false,
6127
+ secret: true,
6128
+ public: false,
6129
+ consumers: [
6130
+ "tenant-vercel-app",
6131
+ "tenant-convex-deployment",
6132
+ "tenant-observability"
6133
+ ],
6134
+ description: "Tenant-owned Langfuse secret key for product AI tracing."
4834
6135
  },
4835
6136
  {
4836
- packageName: "@lucern/client-core",
4837
- role: "sdk_dependency",
4838
- directTenantImport: false
6137
+ idSuffix: "langfuse.public-key",
6138
+ canonicalName: "LANGFUSE_PUBLIC_KEY",
6139
+ required: false,
6140
+ secret: false,
6141
+ public: false,
6142
+ consumers: [
6143
+ "tenant-vercel-app",
6144
+ "tenant-convex-deployment",
6145
+ "tenant-observability"
6146
+ ],
6147
+ description: "Tenant-owned Langfuse public key for product AI tracing."
4839
6148
  },
4840
6149
  {
4841
- packageName: "@lucern/confidence",
4842
- role: "sdk_dependency",
4843
- directTenantImport: false
6150
+ idSuffix: "langfuse.base-url",
6151
+ canonicalName: "LANGFUSE_BASE_URL",
6152
+ aliases: ["LANGFUSE_BASEURL", "LANGFUSE_HOST"],
6153
+ required: false,
6154
+ secret: false,
6155
+ public: false,
6156
+ consumers: [
6157
+ "tenant-vercel-app",
6158
+ "tenant-convex-deployment",
6159
+ "tenant-observability"
6160
+ ],
6161
+ description: "Tenant-owned Langfuse API origin."
4844
6162
  },
4845
6163
  {
4846
- packageName: "@lucern/config",
4847
- role: "configuration",
4848
- directTenantImport: false
6164
+ idSuffix: "graph.neo4j-uri",
6165
+ canonicalName: "NEO4J_URI",
6166
+ required: false,
6167
+ secret: false,
6168
+ public: false,
6169
+ consumers: [
6170
+ "tenant-vercel-app",
6171
+ "tenant-convex-deployment",
6172
+ "tenant-graph-sync"
6173
+ ],
6174
+ description: "Tenant-owned Neo4j URI for product graph-sync."
4849
6175
  },
4850
6176
  {
4851
- packageName: "@lucern/contracts",
4852
- role: "contract_entrypoint",
4853
- directTenantImport: true
6177
+ idSuffix: "graph.neo4j-user",
6178
+ canonicalName: "NEO4J_USER",
6179
+ aliases: ["NEO4J_USERNAME"],
6180
+ required: false,
6181
+ secret: false,
6182
+ public: false,
6183
+ consumers: [
6184
+ "tenant-vercel-app",
6185
+ "tenant-convex-deployment",
6186
+ "tenant-graph-sync"
6187
+ ],
6188
+ description: "Tenant-owned Neo4j user for product graph-sync."
4854
6189
  },
4855
6190
  {
4856
- packageName: "@lucern/control-plane",
4857
- role: "platform_runtime",
4858
- directTenantImport: false
6191
+ idSuffix: "graph.neo4j-password",
6192
+ canonicalName: "NEO4J_PASSWORD",
6193
+ required: false,
6194
+ secret: true,
6195
+ public: false,
6196
+ consumers: [
6197
+ "tenant-vercel-app",
6198
+ "tenant-convex-deployment",
6199
+ "tenant-graph-sync"
6200
+ ],
6201
+ description: "Tenant-owned Neo4j password for product graph-sync."
4859
6202
  },
4860
6203
  {
4861
- packageName: "@lucern/developer-kit",
4862
- role: "developer_tool",
4863
- directTenantImport: false
6204
+ idSuffix: "graph.neo4j-sync-secret",
6205
+ canonicalName: "NEO4J_SYNC_SECRET",
6206
+ required: false,
6207
+ secret: true,
6208
+ public: false,
6209
+ consumers: [
6210
+ "tenant-vercel-app",
6211
+ "tenant-convex-deployment",
6212
+ "tenant-graph-sync"
6213
+ ],
6214
+ description: "Tenant-owned shared secret for product Convex-to-HTTP graph-sync calls."
4864
6215
  },
4865
6216
  {
4866
- packageName: "@lucern/events",
4867
- role: "sdk_dependency",
4868
- directTenantImport: false
6217
+ idSuffix: "graph.neo4j-database",
6218
+ canonicalName: "NEO4J_DATABASE",
6219
+ required: false,
6220
+ secret: false,
6221
+ public: false,
6222
+ consumers: [
6223
+ "tenant-vercel-app",
6224
+ "tenant-convex-deployment",
6225
+ "tenant-graph-sync"
6226
+ ],
6227
+ description: "Tenant-owned Neo4j database name for product graph-sync."
4869
6228
  },
4870
6229
  {
4871
- packageName: "@lucern/graph-primitives",
4872
- role: "sdk_dependency",
4873
- directTenantImport: false
6230
+ idSuffix: "vector.pinecone-api-key",
6231
+ canonicalName: "PINECONE_API_KEY",
6232
+ required: false,
6233
+ secret: true,
6234
+ public: false,
6235
+ consumers: [
6236
+ "tenant-vercel-app",
6237
+ "tenant-convex-deployment",
6238
+ "tenant-vector-store"
6239
+ ],
6240
+ description: "Tenant-owned Pinecone API key for product vector search."
4874
6241
  },
4875
6242
  {
4876
- packageName: "@lucern/graph-sync",
4877
- role: "host_addon_runtime",
4878
- directTenantImport: true
6243
+ idSuffix: "vector.pinecone-index-name",
6244
+ canonicalName: "PINECONE_INDEX_NAME",
6245
+ aliases: ["PINECONE_INDEX"],
6246
+ required: false,
6247
+ secret: false,
6248
+ public: false,
6249
+ consumers: [
6250
+ "tenant-vercel-app",
6251
+ "tenant-convex-deployment",
6252
+ "tenant-vector-store"
6253
+ ],
6254
+ description: "Tenant-owned Pinecone index name for product vector search."
4879
6255
  },
4880
6256
  {
4881
- packageName: "@lucern/identity",
4882
- role: "component_runtime",
4883
- directTenantImport: false
6257
+ idSuffix: "vector.pinecone-host",
6258
+ canonicalName: "PINECONE_HOST",
6259
+ aliases: ["PINECONE_INDEX_HOST"],
6260
+ required: false,
6261
+ secret: false,
6262
+ public: false,
6263
+ consumers: [
6264
+ "tenant-vercel-app",
6265
+ "tenant-convex-deployment",
6266
+ "tenant-vector-store"
6267
+ ],
6268
+ description: "Tenant-owned Pinecone host for product vector search."
4884
6269
  },
4885
6270
  {
4886
- packageName: "@lucern/mcp",
4887
- role: "runtime_entrypoint",
4888
- directTenantImport: true
6271
+ idSuffix: "vector.pinecone-namespace",
6272
+ canonicalName: "PINECONE_NAMESPACE",
6273
+ required: false,
6274
+ secret: false,
6275
+ public: false,
6276
+ consumers: [
6277
+ "tenant-vercel-app",
6278
+ "tenant-convex-deployment",
6279
+ "tenant-vector-store"
6280
+ ],
6281
+ description: "Tenant-owned Pinecone namespace for product vector search isolation."
4889
6282
  },
4890
6283
  {
4891
- packageName: "@lucern/pack-host",
4892
- role: "platform_runtime",
4893
- directTenantImport: false
6284
+ idSuffix: "storage.aws-access-key-id",
6285
+ canonicalName: "AWS_ACCESS_KEY_ID",
6286
+ required: false,
6287
+ secret: true,
6288
+ public: false,
6289
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6290
+ description: "Tenant-owned AWS access key id for document/file ingestion."
4894
6291
  },
4895
6292
  {
4896
- packageName: "@lucern/pack-installer",
4897
- role: "developer_tool",
4898
- directTenantImport: false
6293
+ idSuffix: "storage.aws-secret-access-key",
6294
+ canonicalName: "AWS_SECRET_ACCESS_KEY",
6295
+ required: false,
6296
+ secret: true,
6297
+ public: false,
6298
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6299
+ description: "Tenant-owned AWS secret access key for document/file ingestion."
4899
6300
  },
4900
6301
  {
4901
- packageName: "@lucern/proof-compiler",
4902
- role: "developer_tool",
4903
- directTenantImport: false
6302
+ idSuffix: "storage.aws-region",
6303
+ canonicalName: "AWS_REGION",
6304
+ required: false,
6305
+ secret: false,
6306
+ public: false,
6307
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6308
+ description: "Tenant-owned AWS region for document/file ingestion."
4904
6309
  },
4905
6310
  {
4906
- packageName: "@lucern/react",
4907
- role: "runtime_entrypoint",
4908
- directTenantImport: true
6311
+ idSuffix: "observability.sentry-dsn",
6312
+ canonicalName: "NEXT_PUBLIC_SENTRY_DSN",
6313
+ aliases: ["NEXT_PUBLIC_SENTRY_DSN_NEXTJS", "SENTRY_DSN"],
6314
+ required: false,
6315
+ secret: false,
6316
+ public: true,
6317
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6318
+ description: "Tenant-owned Sentry DSN for app telemetry."
4909
6319
  },
4910
6320
  {
4911
- packageName: "@lucern/reasoning-kernel",
4912
- role: "component_runtime",
4913
- directTenantImport: false
6321
+ idSuffix: "observability.sentry-auth-token",
6322
+ canonicalName: "SENTRY_AUTH_TOKEN",
6323
+ required: false,
6324
+ secret: true,
6325
+ public: false,
6326
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6327
+ description: "Tenant-owned Sentry release token for app deployments."
4914
6328
  },
4915
6329
  {
4916
- packageName: "@lucern/sdk",
4917
- role: "runtime_entrypoint",
4918
- directTenantImport: true
6330
+ idSuffix: "observability.sentry-org",
6331
+ canonicalName: "SENTRY_ORG",
6332
+ aliases: ["SENTRY_ORG_SLUG"],
6333
+ required: false,
6334
+ secret: false,
6335
+ public: false,
6336
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6337
+ description: "Tenant-owned Sentry org slug for release uploads."
4919
6338
  },
4920
6339
  {
4921
- packageName: "@lucern/server-core",
4922
- role: "platform_runtime",
4923
- directTenantImport: false
6340
+ idSuffix: "observability.sentry-project",
6341
+ canonicalName: "SENTRY_PROJECT",
6342
+ aliases: ["SENTRY_PROJECT_NEXTJS"],
6343
+ required: false,
6344
+ secret: false,
6345
+ public: false,
6346
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6347
+ description: "Tenant-owned Sentry project slug for release uploads."
4924
6348
  },
4925
6349
  {
4926
- packageName: "@lucern/testing",
4927
- role: "test_support",
4928
- directTenantImport: false
6350
+ idSuffix: "observability.sentry-environment",
6351
+ canonicalName: "NEXT_PUBLIC_SENTRY_ENVIRONMENT",
6352
+ aliases: ["SENTRY_ENVIRONMENT"],
6353
+ required: false,
6354
+ secret: false,
6355
+ public: true,
6356
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6357
+ description: "Tenant-owned Sentry environment label."
4929
6358
  },
4930
6359
  {
4931
- packageName: "@lucern/types",
4932
- role: "contract_entrypoint",
4933
- directTenantImport: true
6360
+ idSuffix: "observability.sentry-release",
6361
+ canonicalName: "NEXT_PUBLIC_SENTRY_RELEASE",
6362
+ aliases: ["SENTRY_RELEASE"],
6363
+ required: false,
6364
+ secret: false,
6365
+ public: true,
6366
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6367
+ description: "Tenant-owned Sentry release label."
6368
+ },
6369
+ {
6370
+ idSuffix: "observability.sentry-client-options",
6371
+ canonicalName: "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE",
6372
+ aliases: [
6373
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS",
6374
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS_NEXTJS",
6375
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS",
6376
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS_NEXTJS",
6377
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS",
6378
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS_NEXTJS",
6379
+ "NEXT_PUBLIC_SENTRY_ENABLE_LOGS",
6380
+ "NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE",
6381
+ "NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE",
6382
+ "NEXT_PUBLIC_SENTRY_SEND_DEFAULT_PII",
6383
+ "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE_NEXTJS"
6384
+ ],
6385
+ required: false,
6386
+ secret: false,
6387
+ public: true,
6388
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6389
+ description: "Tenant-owned public Sentry tuning values for Next.js client instrumentation."
6390
+ },
6391
+ {
6392
+ idSuffix: "observability.sentry-webhook-secret",
6393
+ canonicalName: "SENTRY_WEBHOOK_SECRET",
6394
+ required: false,
6395
+ secret: true,
6396
+ public: false,
6397
+ consumers: ["tenant-convex-deployment", "tenant-observability"],
6398
+ description: "Tenant-owned Sentry webhook verification secret."
6399
+ },
6400
+ {
6401
+ idSuffix: "lucern.gateway-api-key",
6402
+ canonicalName: "LUCERN_API_KEY",
6403
+ aliases: ["STACK_API_KEY"],
6404
+ required: false,
6405
+ secret: true,
6406
+ public: false,
6407
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6408
+ description: "Tenant-scoped Lucern/MC gateway API key for product front-door calls."
6409
+ },
6410
+ {
6411
+ idSuffix: "lucern.gateway-base-url",
6412
+ canonicalName: "LUCERN_BASE_URL",
6413
+ aliases: ["LUCERN_API_BASE_URL", "LUCERN_GATEWAY_BASE_URL"],
6414
+ required: false,
6415
+ secret: false,
6416
+ public: false,
6417
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6418
+ description: "Lucern/MC gateway base URL used by tenant product apps."
6419
+ },
6420
+ {
6421
+ idSuffix: "lucern.proxy-token-secret",
6422
+ canonicalName: "LUCERN_PROXY_TOKEN_SECRET",
6423
+ required: false,
6424
+ secret: true,
6425
+ public: false,
6426
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6427
+ description: "Tenant-owned secret for signing internal proxy/session tokens in product apps."
6428
+ },
6429
+ {
6430
+ idSuffix: "tenant.integrations.linear-api-key",
6431
+ canonicalName: "LINEAR_API_KEY",
6432
+ required: false,
6433
+ secret: true,
6434
+ public: false,
6435
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6436
+ description: "Tenant-owned Linear API key for support/slash-command flows."
6437
+ },
6438
+ {
6439
+ idSuffix: "tenant.vercel.bypass-token",
6440
+ canonicalName: "VERCEL_AUTOMATION_BYPASS_SECRET",
6441
+ aliases: ["NEXT_PUBLIC_VERCEL_BYPASS_TOKEN"],
6442
+ required: false,
6443
+ secret: true,
6444
+ public: false,
6445
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6446
+ description: "Tenant-owned Vercel automation bypass token. Public alias is legacy and should be removed from app code."
4934
6447
  }
4935
6448
  ];
4936
- TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
4937
- (entry) => entry.packageName
6449
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.filter(
6450
+ (system) => TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS.includes(system.id)
6451
+ ).flatMap(
6452
+ (system) => TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES.map(
6453
+ (template) => ({
6454
+ id: `tenant.${system.id}.${template.idSuffix}`,
6455
+ canonicalName: template.canonicalName,
6456
+ aliases: "aliases" in template ? template.aliases : void 0,
6457
+ owner: "tenant",
6458
+ scope: "tenant",
6459
+ sourcePath: system.sharedSourcePath,
6460
+ environmentPolicy: "environment_specific",
6461
+ required: template.required,
6462
+ secret: template.secret,
6463
+ public: template.public,
6464
+ consumers: template.consumers,
6465
+ destinations: [
6466
+ {
6467
+ kind: "vercel",
6468
+ target: system.vercelProjectName,
6469
+ environmentPolicy: "preprod_staging_prod_prod"
6470
+ },
6471
+ {
6472
+ kind: "convex",
6473
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6474
+ environmentPolicy: "preprod_staging_prod_prod"
6475
+ },
6476
+ {
6477
+ kind: "github_actions",
6478
+ target: `${system.repository.owner}/${system.repository.name}`,
6479
+ environmentPolicy: "preprod_staging_prod_prod"
6480
+ }
6481
+ ],
6482
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6483
+ })
6484
+ )
6485
+ );
6486
+ function tenantVercelConvexUrlWriteNames(system) {
6487
+ const names = [system.convex.urlEnv, "NEXT_PUBLIC_CONVEX_URL"];
6488
+ if (system.id === "stack-eng") {
6489
+ return [...names, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6490
+ }
6491
+ return names;
6492
+ }
6493
+ function tenantRepositoryConvexUrlWriteNames(system) {
6494
+ if (system.id === "stack-eng") {
6495
+ return [system.convex.urlEnv, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6496
+ }
6497
+ return [system.convex.urlEnv];
6498
+ }
6499
+ function tenantRepositoryConvexDeployKeyWriteNames(system) {
6500
+ if (system.id === "stack-eng") {
6501
+ return [system.convex.deployKeyEnv, "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6502
+ }
6503
+ return [system.convex.deployKeyEnv];
6504
+ }
6505
+ function tenantConvexUrlAliases(system) {
6506
+ if (system.id === "stack-frontend") {
6507
+ return [
6508
+ "CONVEX_PROD_URL",
6509
+ "CONVEX_STACK_V2_PROD_URL",
6510
+ "CONVEX_STACK_V2_STAGING_URL",
6511
+ "STACK_CONVEX_URL"
6512
+ ];
6513
+ }
6514
+ if (system.id === "stackos") {
6515
+ return [
6516
+ "CONVEX_CLOUD_URL",
6517
+ "CONVEX_STACK_URL",
6518
+ "CONVEX_URL",
6519
+ "CONVEX_URL_DEVELOPMENT",
6520
+ "CONVEX_URL_PRODUCTION",
6521
+ "STACK_CONVEX_URL"
6522
+ ];
6523
+ }
6524
+ if (system.id === "stack-eng") {
6525
+ return ["STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6526
+ }
6527
+ if (system.id === "lucern-graph") {
6528
+ return [
6529
+ "CONVEX_GRAPH_URL",
6530
+ "LUCERN_PROD_URL",
6531
+ "NEXT_PUBLIC_LUCERN_GRAPH_URL"
6532
+ ];
6533
+ }
6534
+ return void 0;
6535
+ }
6536
+ function tenantConvexDeployKeyAliases(system) {
6537
+ if (system.id === "stack-frontend") {
6538
+ return [
6539
+ "CONVEX_STACK_V2_PROD_DEPLOY_KEY",
6540
+ "CONVEX_STACK_V2_STAGING_DEPLOY_KEY",
6541
+ "STACK_DEPLOY_KEY"
6542
+ ];
6543
+ }
6544
+ if (system.id === "stackos") {
6545
+ return [
6546
+ "CONVEX_DEPLOY_KEY",
6547
+ "CONVEX_DEV_DEPLOY_KEY",
6548
+ "CONVEX_PROD_DEPLOY_KEY",
6549
+ "CONVEX_STACK_DEPLOY_KEY",
6550
+ "STACK_DEPLOY_KEY"
6551
+ ];
6552
+ }
6553
+ if (system.id === "stack-eng") {
6554
+ return ["CONVEX_DEPLOY_KEY", "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6555
+ }
6556
+ if (system.id === "lucern-graph") {
6557
+ return [
6558
+ "CONVEX_DEPLOY_KEY",
6559
+ "CONVEX_GRAPH_DEPLOY_KEY",
6560
+ "LUCERN_CONVEX_DEPLOY_KEY",
6561
+ "LUCERN_DEV_DEPLOY_KEY",
6562
+ "LUCERN_PROD_DEPLOY_KEY"
6563
+ ];
6564
+ }
6565
+ return void 0;
6566
+ }
6567
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6568
+ (system) => {
6569
+ if (system.id === "lucern-graph") {
6570
+ return [
6571
+ {
6572
+ id: "tenant.lucern-graph.public.tenant-id",
6573
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_ID",
6574
+ aliases: ["NEXT_PUBLIC_LUCERN_TENANT_ID"],
6575
+ owner: "tenant",
6576
+ scope: "workspace",
6577
+ sourcePath: system.sharedSourcePath,
6578
+ environmentPolicy: "environment_specific",
6579
+ required: false,
6580
+ secret: false,
6581
+ public: true,
6582
+ consumers: ["tenant-vercel-app"],
6583
+ destinations: [
6584
+ {
6585
+ kind: "vercel",
6586
+ target: system.vercelProjectName,
6587
+ environmentPolicy: "preprod_staging_prod_prod"
6588
+ }
6589
+ ],
6590
+ description: "Lucern graph public tenant id used by the standalone graph explorer."
6591
+ },
6592
+ {
6593
+ id: "tenant.lucern-graph.public.tenant-label",
6594
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_LABEL",
6595
+ owner: "tenant",
6596
+ scope: "workspace",
6597
+ sourcePath: system.sharedSourcePath,
6598
+ environmentPolicy: "environment_specific",
6599
+ required: false,
6600
+ secret: false,
6601
+ public: true,
6602
+ consumers: ["tenant-vercel-app"],
6603
+ destinations: [
6604
+ {
6605
+ kind: "vercel",
6606
+ target: system.vercelProjectName,
6607
+ environmentPolicy: "preprod_staging_prod_prod"
6608
+ }
6609
+ ],
6610
+ description: "Lucern graph public tenant label used by the standalone graph explorer."
6611
+ }
6612
+ ];
6613
+ }
6614
+ if (system.id === "stack-eng") {
6615
+ return [
6616
+ {
6617
+ id: "tenant.stack-eng.public.tenant-id",
6618
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_ID",
6619
+ owner: "tenant",
6620
+ scope: "workspace",
6621
+ sourcePath: system.sharedSourcePath,
6622
+ environmentPolicy: "environment_specific",
6623
+ required: false,
6624
+ secret: false,
6625
+ public: true,
6626
+ consumers: ["tenant-vercel-app"],
6627
+ destinations: [
6628
+ {
6629
+ kind: "vercel",
6630
+ target: system.vercelProjectName,
6631
+ environmentPolicy: "preprod_staging_prod_prod"
6632
+ }
6633
+ ],
6634
+ description: "Stack engineering graph public tenant id used by the graph explorer."
6635
+ },
6636
+ {
6637
+ id: "tenant.stack-eng.public.tenant-label",
6638
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_LABEL",
6639
+ owner: "tenant",
6640
+ scope: "workspace",
6641
+ sourcePath: system.sharedSourcePath,
6642
+ environmentPolicy: "environment_specific",
6643
+ required: false,
6644
+ secret: false,
6645
+ public: true,
6646
+ consumers: ["tenant-vercel-app"],
6647
+ destinations: [
6648
+ {
6649
+ kind: "vercel",
6650
+ target: system.vercelProjectName,
6651
+ environmentPolicy: "preprod_staging_prod_prod"
6652
+ }
6653
+ ],
6654
+ description: "Stack engineering graph public tenant label used by the graph explorer."
6655
+ },
6656
+ {
6657
+ id: "tenant.stack-eng.public.environment",
6658
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_ENV",
6659
+ owner: "tenant",
6660
+ scope: "workspace",
6661
+ sourcePath: system.sharedSourcePath,
6662
+ environmentPolicy: "environment_specific",
6663
+ required: false,
6664
+ secret: false,
6665
+ public: true,
6666
+ consumers: ["tenant-vercel-app"],
6667
+ destinations: [
6668
+ {
6669
+ kind: "vercel",
6670
+ target: system.vercelProjectName,
6671
+ environmentPolicy: "preprod_staging_prod_prod"
6672
+ }
6673
+ ],
6674
+ description: "Stack engineering graph public environment label used by the graph explorer."
6675
+ }
6676
+ ];
6677
+ }
6678
+ return [];
6679
+ }
4938
6680
  );
6681
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap((system) => [
6682
+ {
6683
+ id: `tenant.${system.id}.convex.url`,
6684
+ canonicalName: system.convex.urlEnv,
6685
+ aliases: tenantConvexUrlAliases(system),
6686
+ owner: "tenant",
6687
+ scope: "software_system",
6688
+ sourcePath: system.sharedSourcePath,
6689
+ environmentPolicy: "preprod_staging_prod_prod",
6690
+ required: true,
6691
+ secret: false,
6692
+ public: false,
6693
+ consumers: [
6694
+ "tenant-vercel-app",
6695
+ "tenant-agent-runtime",
6696
+ "mc-operator-tooling"
6697
+ ],
6698
+ destinations: [
6699
+ {
6700
+ kind: "vercel",
6701
+ target: system.vercelProjectName,
6702
+ environmentPolicy: "preprod_staging_prod_prod",
6703
+ writeNames: tenantVercelConvexUrlWriteNames(system)
6704
+ },
6705
+ {
6706
+ kind: "github_actions",
6707
+ target: `${system.repository.owner}/${system.repository.name}`,
6708
+ environmentPolicy: "preprod_staging_prod_prod",
6709
+ writeNames: tenantRepositoryConvexUrlWriteNames(system),
6710
+ notes: "Only if that repository deploy/test workflow owns this software system."
6711
+ }
6712
+ ],
6713
+ description: `${system.tenantKey}/${system.workspaceKey} Convex URL. Pre-prod resolves to ${system.convex.preprodDeployment}; prod resolves to ${system.convex.prodDeployment}.`
6714
+ },
6715
+ {
6716
+ id: `tenant.${system.id}.convex.deploy-key`,
6717
+ canonicalName: system.convex.deployKeyEnv,
6718
+ aliases: tenantConvexDeployKeyAliases(system),
6719
+ owner: "tenant",
6720
+ scope: "software_system",
6721
+ sourcePath: system.sharedSourcePath,
6722
+ environmentPolicy: "preprod_staging_prod_prod",
6723
+ required: true,
6724
+ secret: true,
6725
+ public: false,
6726
+ consumers: [
6727
+ "tenant-vercel-app",
6728
+ "tenant-agent-runtime",
6729
+ "mc-operator-tooling"
6730
+ ],
6731
+ destinations: [
6732
+ {
6733
+ kind: "vercel",
6734
+ target: system.vercelProjectName,
6735
+ environmentPolicy: "preprod_staging_prod_prod"
6736
+ },
6737
+ {
6738
+ kind: "github_actions",
6739
+ target: `${system.repository.owner}/${system.repository.name}`,
6740
+ environmentPolicy: "preprod_staging_prod_prod",
6741
+ writeNames: tenantRepositoryConvexDeployKeyWriteNames(system),
6742
+ notes: "Only if that repository deploy/test workflow owns this software system."
6743
+ }
6744
+ ],
6745
+ description: `${system.tenantKey}/${system.workspaceKey} Convex deploy/admin key. Never route to sibling workspaces.`
6746
+ }
6747
+ ]);
4939
6748
  z.object({
4940
6749
  manifestVersion: z.literal("1.0.0"),
4941
6750
  rules: z.array(
@@ -4976,7 +6785,7 @@ var createEvidenceInputSchemaBase = z.object({
4976
6785
  targetId: z.string().optional(),
4977
6786
  targetNodeId: z.string().optional(),
4978
6787
  linkedBeliefNodeId: z.string().optional(),
4979
- evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
6788
+ evidenceRelation: z.enum(["supports", "contradicts"]).optional(),
4980
6789
  confidence: z.number().optional(),
4981
6790
  weight: z.number().optional(),
4982
6791
  reasoning: z.string().optional(),
@@ -5061,8 +6870,7 @@ var createEvidenceProjection = defineProjection({
5061
6870
  evidenceRelation: v.optional(
5062
6871
  v.union(
5063
6872
  v.literal("supports"),
5064
- v.literal("contradicts"),
5065
- v.literal("neutral")
6873
+ v.literal("contradicts")
5066
6874
  )
5067
6875
  ),
5068
6876
  confidence: v.optional(v.number()),
@@ -5111,12 +6919,17 @@ var listBeliefsProjection = defineProjection({
5111
6919
  });
5112
6920
  var taskStatusSchema = z.enum(["todo", "in_progress", "blocked", "done"]).optional().describe("Filter by task status");
5113
6921
  var listTasksInputSchema = z.object({
5114
- topicId: z.string().describe("Topic scope"),
6922
+ topicId: z.string().optional().describe("Topic scope"),
5115
6923
  worktreeId: z.string().optional().describe("Alias for linkedWorktreeId"),
5116
6924
  linkedWorktreeId: z.string().optional().describe("Filter to tasks linked to this worktree"),
5117
6925
  status: taskStatusSchema,
5118
6926
  limit: z.number().optional().describe("Maximum results")
5119
- });
6927
+ }).refine(
6928
+ (input) => Boolean(input.topicId || input.worktreeId || input.linkedWorktreeId),
6929
+ {
6930
+ message: "topicId or worktreeId is required"
6931
+ }
6932
+ );
5120
6933
  function compactRecord3(input) {
5121
6934
  return Object.fromEntries(
5122
6935
  Object.entries(input).filter(([, value]) => value !== void 0)
@@ -5133,7 +6946,7 @@ var listTasksProjection = defineProjection({
5133
6946
  linkedWorktreeId: input.linkedWorktreeId ?? input.worktreeId
5134
6947
  }),
5135
6948
  convexArgsValidator: v.object({
5136
- topicId: v.string(),
6949
+ topicId: v.optional(v.string()),
5137
6950
  status: v.optional(
5138
6951
  v.union(
5139
6952
  v.literal("todo"),
@@ -6137,7 +7950,7 @@ var CREATE_EDGE = {
6137
7950
  reasoningMethod: {
6138
7951
  type: "string",
6139
7952
  description: "How this was determined",
6140
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
7953
+ enum: [...REASONING_METHODS]
6141
7954
  },
6142
7955
  metadata: {
6143
7956
  type: "object",
@@ -7864,6 +9677,10 @@ var CREATE_TASK = {
7864
9677
  tags: {
7865
9678
  type: "array",
7866
9679
  description: "Free-form string tags"
9680
+ },
9681
+ metadata: {
9682
+ type: "object",
9683
+ description: "Structured task metadata for handoff context and routing hints"
7867
9684
  }
7868
9685
  },
7869
9686
  required: ["title"],
@@ -7937,6 +9754,10 @@ var UPDATE_TASK = {
7937
9754
  type: "string",
7938
9755
  description: "Updated status",
7939
9756
  enum: ["todo", "in_progress", "blocked", "done"]
9757
+ },
9758
+ metadata: {
9759
+ type: "object",
9760
+ description: "Structured task metadata to replace or refine"
7940
9761
  }
7941
9762
  },
7942
9763
  required: ["taskId"],
@@ -9392,6 +11213,9 @@ var BEGIN_BUILD_SESSION = {
9392
11213
  sessionMode: "string \u2014 async | interactive",
9393
11214
  targetBeliefIds: "array \u2014 scoped belief IDs",
9394
11215
  targetQuestionIds: "array \u2014 scoped question IDs",
11216
+ taskIds: "array \u2014 assigned task IDs for this worktree",
11217
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
11218
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
9395
11219
  topBeliefs: "array \u2014 highest-confidence scoped beliefs",
9396
11220
  openQuestions: "array \u2014 open scoped questions",
9397
11221
  resolvedDecisions: "array \u2014 answered questions summarized for the session",
@@ -9992,12 +11816,20 @@ function unwrapMcpParameterSchema(schema) {
9992
11816
  current = current._def.schema;
9993
11817
  continue;
9994
11818
  default:
9995
- return { schema: current, required, description: description ?? current.description };
11819
+ return {
11820
+ schema: current,
11821
+ required,
11822
+ description: description ?? current.description
11823
+ };
9996
11824
  }
9997
11825
  }
9998
11826
  }
9999
11827
  function mcpParameterFromZod(fieldName, schema, contractName) {
10000
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
11828
+ const {
11829
+ schema: unwrapped,
11830
+ required,
11831
+ description: schemaDescription
11832
+ } = unwrapMcpParameterSchema(schema);
10001
11833
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
10002
11834
  switch (unwrapped._def.typeName) {
10003
11835
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -10042,10 +11874,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
10042
11874
  const entries2 = Object.entries(getObjectShape(args)).sort(
10043
11875
  ([left], [right]) => left.localeCompare(right)
10044
11876
  );
10045
- const converted = entries2.map(([fieldName, schema]) => [
10046
- fieldName,
10047
- mcpParameterFromZod(fieldName, schema, contractName)
10048
- ]);
11877
+ const converted = entries2.map(
11878
+ ([fieldName, schema]) => [
11879
+ fieldName,
11880
+ mcpParameterFromZod(fieldName, schema, contractName)
11881
+ ]
11882
+ );
10049
11883
  return {
10050
11884
  ...base,
10051
11885
  parameters: Object.fromEntries(
@@ -10157,6 +11991,7 @@ function surfaceContract(args) {
10157
11991
  allowedPrincipalTypes: ["user", "service", "agent"]
10158
11992
  },
10159
11993
  convex: args.convex,
11994
+ gateway: args.gateway,
10160
11995
  args: canonicalArgs,
10161
11996
  returns: canonicalReturns,
10162
11997
  input,
@@ -10643,7 +12478,7 @@ var beliefsContracts = [
10643
12478
  })
10644
12479
  ];
10645
12480
  var jsonRecordSchema4 = z.record(z.unknown());
10646
- var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
12481
+ var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
10647
12482
  var createEvidenceArgs = z.object({
10648
12483
  topicId: z.string().optional().describe("Topic scope for the evidence."),
10649
12484
  text: z.string().describe("Canonical evidence text."),
@@ -12566,7 +14401,8 @@ var createTaskArgs = z.object({
12566
14401
  linkedQuestionId: z.string().optional().describe("Question this task addresses."),
12567
14402
  assigneeId: z.string().optional().describe("Principal assigned to the task."),
12568
14403
  dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
12569
- tags: z.array(z.string()).optional().describe("Free-form tags.")
14404
+ tags: z.array(z.string()).optional().describe("Free-form tags."),
14405
+ metadata: z.record(z.unknown()).optional().describe("Structured task metadata for handoff context and routing hints.")
12570
14406
  });
12571
14407
  var createTaskInput = (input) => compactRecord4({
12572
14408
  title: input.title,
@@ -12580,7 +14416,8 @@ var createTaskInput = (input) => compactRecord4({
12580
14416
  linkedQuestionId: input.linkedQuestionId,
12581
14417
  assigneeId: input.assigneeId,
12582
14418
  dueDate: input.dueDate,
12583
- tags: input.tags
14419
+ tags: input.tags,
14420
+ metadata: input.metadata
12584
14421
  });
12585
14422
  var taskInput = (input) => compactRecord4({
12586
14423
  ...input,
@@ -12597,8 +14434,7 @@ var taskTopicInput = (input) => {
12597
14434
  };
12598
14435
  var completeTaskInput = (input) => compactRecord4({
12599
14436
  taskId: input.taskId ?? input.id,
12600
- outputSummary: input.outputSummary ?? input.summary,
12601
- userId: input.userId
14437
+ outputSummary: input.outputSummary ?? input.summary
12602
14438
  });
12603
14439
  var tasksContracts = [
12604
14440
  surfaceContract({
@@ -12616,6 +14452,7 @@ var tasksContracts = [
12616
14452
  kind: "mutation",
12617
14453
  inputProjection: createTaskInput
12618
14454
  },
14455
+ gateway: { handler: "tasks.create" },
12619
14456
  args: createTaskArgs
12620
14457
  }),
12621
14458
  surfaceContract({
@@ -12634,6 +14471,7 @@ var tasksContracts = [
12634
14471
  kind: "query",
12635
14472
  inputProjection: taskTopicInput
12636
14473
  },
14474
+ gateway: { handler: "tasks.list" },
12637
14475
  args: listTasksInputSchema
12638
14476
  }),
12639
14477
  surfaceContract({
@@ -12651,7 +14489,8 @@ var tasksContracts = [
12651
14489
  functionName: "update",
12652
14490
  kind: "mutation",
12653
14491
  inputProjection: taskInput
12654
- }
14492
+ },
14493
+ gateway: { handler: "tasks.update" }
12655
14494
  }),
12656
14495
  surfaceContract({
12657
14496
  name: "complete_task",
@@ -12667,12 +14506,14 @@ var tasksContracts = [
12667
14506
  functionName: "complete",
12668
14507
  kind: "mutation",
12669
14508
  inputProjection: completeTaskInput
12670
- }
14509
+ },
14510
+ gateway: { handler: "tasks.complete" }
12671
14511
  })
12672
14512
  ];
12673
14513
  var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
12674
14514
  (policy) => policy.edgeType
12675
14515
  );
14516
+ var REASONING_METHOD_TYPES = [...REASONING_METHODS];
12676
14517
  var createEdgeArgs = z.object({
12677
14518
  from: GraphRefSchema,
12678
14519
  to: GraphRefSchema,
@@ -12682,6 +14523,7 @@ var createEdgeArgs = z.object({
12682
14523
  confidence: z.number().optional(),
12683
14524
  context: z.string().optional(),
12684
14525
  reasoning: z.string().optional(),
14526
+ reasoningMethod: z.enum(REASONING_METHOD_TYPES).optional(),
12685
14527
  derivationType: z.string().optional(),
12686
14528
  metadata: z.record(z.unknown()).optional(),
12687
14529
  topicId: z.string().optional(),
@@ -12760,6 +14602,7 @@ var edgesContracts = [
12760
14602
  weight: parsed.weight,
12761
14603
  confidence: parsed.confidence,
12762
14604
  context: parsed.context ?? parsed.reasoning,
14605
+ reasoningMethod: parsed.reasoningMethod,
12763
14606
  derivationType: parsed.derivationType,
12764
14607
  metadata: parsed.metadata,
12765
14608
  skipLayerValidation: true,
@@ -12884,6 +14727,7 @@ var edgesContracts = [
12884
14727
  weight: edge.weight,
12885
14728
  confidence: edge.confidence,
12886
14729
  context: edge.context ?? edge.reasoning,
14730
+ reasoningMethod: edge.reasoningMethod,
12887
14731
  derivationType: edge.derivationType,
12888
14732
  metadata: edge.metadata,
12889
14733
  topicId: edge.topicId
@@ -13618,6 +15462,69 @@ var pipelineContracts = [
13618
15462
  }
13619
15463
  })
13620
15464
  ];
15465
+ function isRecord3(value) {
15466
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15467
+ }
15468
+ function stringValues(value) {
15469
+ if (typeof value === "string") {
15470
+ return [value];
15471
+ }
15472
+ if (Array.isArray(value)) {
15473
+ return value.flatMap((item) => stringValues(item));
15474
+ }
15475
+ return [];
15476
+ }
15477
+ function nestedEvidenceRows(value) {
15478
+ if (Array.isArray(value)) {
15479
+ return value.flatMap((item) => nestedEvidenceRows(item));
15480
+ }
15481
+ if (!isRecord3(value)) {
15482
+ return [];
15483
+ }
15484
+ const nestedKeys = ["evidence", "items", "nodes"];
15485
+ const nestedRows = nestedKeys.flatMap((key) => nestedEvidenceRows(value[key]));
15486
+ return nestedRows.length > 0 ? nestedRows : [value];
15487
+ }
15488
+ function isFailedAttemptRow(row) {
15489
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15490
+ return metadata?.failedApproach === true || metadata?.isFailedAttempt === true;
15491
+ }
15492
+ function failureLogSearchFields(row) {
15493
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15494
+ return [
15495
+ ...stringValues(row.id),
15496
+ ...stringValues(row._id),
15497
+ ...stringValues(row.title),
15498
+ ...stringValues(row.text),
15499
+ ...stringValues(row.canonicalText),
15500
+ ...stringValues(row.content),
15501
+ ...stringValues(metadata?.codeAnchor),
15502
+ ...stringValues(metadata?.codeAnchors),
15503
+ ...stringValues(metadata?.anchor),
15504
+ ...stringValues(metadata?.anchors),
15505
+ ...stringValues(metadata?.filePath),
15506
+ ...stringValues(metadata?.filePaths),
15507
+ ...stringValues(metadata?.path),
15508
+ ...stringValues(metadata?.paths),
15509
+ ...stringValues(metadata?.sourceRef),
15510
+ ...stringValues(metadata?.touchedPaths)
15511
+ ];
15512
+ }
15513
+ function projectFailureLog(output, input) {
15514
+ const rawQuery = typeof input.query === "string" && input.query.trim().length > 0 ? input.query.trim() : void 0;
15515
+ const searchKey = rawQuery?.toLowerCase();
15516
+ const failures = nestedEvidenceRows(output).filter((row) => isFailedAttemptRow(row)).filter(
15517
+ (row) => !searchKey ? true : failureLogSearchFields(row).some(
15518
+ (field) => field.toLowerCase().includes(searchKey)
15519
+ )
15520
+ );
15521
+ return {
15522
+ query: rawQuery,
15523
+ failures,
15524
+ totalFound: failures.length,
15525
+ showing: failures.length
15526
+ };
15527
+ }
13621
15528
  var recordScopeLearningArgs = z.object({
13622
15529
  topicId: z.string().optional().describe("Topic scope ID"),
13623
15530
  summary: z.string().describe("Atomic learning statement"),
@@ -13707,6 +15614,8 @@ var attemptInput = (input, context) => withUserId(
13707
15614
  tags: ["code_attempt"],
13708
15615
  metadata: compactRecord4({
13709
15616
  ...recordValue2(input.metadata),
15617
+ failedApproach: true,
15618
+ isFailedAttempt: true,
13710
15619
  filePaths: input.filePaths,
13711
15620
  filePath: input.filePath,
13712
15621
  errorMessage: input.errorMessage,
@@ -13837,7 +15746,8 @@ var codingContracts = [
13837
15746
  limit: input.limit,
13838
15747
  status: input.status,
13839
15748
  userId: input.userId
13840
- })
15749
+ }),
15750
+ outputProjection: (output, input) => projectFailureLog(output, input)
13841
15751
  }
13842
15752
  })
13843
15753
  ];
@@ -14299,14 +16209,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14299
16209
  description: "Worktrees are tenant/runtime planning data."
14300
16210
  },
14301
16211
  {
14302
- component: "identity",
16212
+ component: "control-plane",
14303
16213
  table: "agents",
14304
16214
  prepopulation: "runtime_bootstrap",
14305
16215
  copyMode: "none",
14306
16216
  description: "Service agents are provisioned per tenant or service, not copied."
14307
16217
  },
14308
16218
  {
14309
- component: "identity",
16219
+ component: "control-plane",
14310
16220
  table: "mcpWritePolicy",
14311
16221
  prepopulation: "required_template",
14312
16222
  copyMode: "template_global",
@@ -14315,14 +16225,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14315
16225
  description: "Global write policy defaults govern service and interactive MCP writes."
14316
16226
  },
14317
16227
  {
14318
- component: "identity",
16228
+ component: "control-plane",
14319
16229
  table: "modelCallLogs",
14320
16230
  prepopulation: "runtime_log",
14321
16231
  copyMode: "none",
14322
16232
  description: "Model call logs are runtime telemetry."
14323
16233
  },
14324
16234
  {
14325
- component: "identity",
16235
+ component: "control-plane",
14326
16236
  table: "modelFunctionSlots",
14327
16237
  prepopulation: "required_template",
14328
16238
  copyMode: "template_global",
@@ -14331,7 +16241,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14331
16241
  description: "Function-to-model slots are required by model runtime resolution."
14332
16242
  },
14333
16243
  {
14334
- component: "identity",
16244
+ component: "control-plane",
14335
16245
  table: "modelRegistry",
14336
16246
  prepopulation: "required_template",
14337
16247
  copyMode: "template_global",
@@ -14340,7 +16250,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14340
16250
  description: "Model catalog defaults are required by model runtime clients."
14341
16251
  },
14342
16252
  {
14343
- component: "identity",
16253
+ component: "control-plane",
14344
16254
  table: "modelSlotConfigs",
14345
16255
  prepopulation: "required_template",
14346
16256
  copyMode: "template_global",
@@ -14349,14 +16259,105 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14349
16259
  description: "Slot-level defaults are required before tenant overrides exist."
14350
16260
  },
14351
16261
  {
14352
- component: "identity",
16262
+ component: "control-plane",
16263
+ table: "permitAccessReviewItems",
16264
+ prepopulation: "runtime_data",
16265
+ copyMode: "none",
16266
+ description: "Permit access-review item rows are tenant review data projected from Permit."
16267
+ },
16268
+ {
16269
+ component: "control-plane",
16270
+ table: "permitAccessReviews",
16271
+ prepopulation: "runtime_data",
16272
+ copyMode: "none",
16273
+ description: "Permit access-review campaigns are tenant review data projected from Permit."
16274
+ },
16275
+ {
16276
+ component: "control-plane",
16277
+ table: "permitAttributeBindings",
16278
+ prepopulation: "runtime_data",
16279
+ copyMode: "none",
16280
+ description: "Permit ABAC attribute bindings are tenant policy projection rows."
16281
+ },
16282
+ {
16283
+ component: "control-plane",
16284
+ table: "permitGroups",
16285
+ prepopulation: "runtime_data",
16286
+ copyMode: "none",
16287
+ description: "Permit groups are tenant-defined policy subjects, not template data."
16288
+ },
16289
+ {
16290
+ component: "control-plane",
16291
+ table: "permitGroupMemberships",
16292
+ prepopulation: "runtime_data",
16293
+ copyMode: "none",
16294
+ description: "Permit group memberships are tenant-specific policy projection rows."
16295
+ },
16296
+ {
16297
+ component: "control-plane",
16298
+ table: "permitPolicyBundles",
16299
+ prepopulation: "runtime_derived",
16300
+ copyMode: "none",
16301
+ description: "Permit policy bundles are derived from the Permit control plane."
16302
+ },
16303
+ {
16304
+ component: "control-plane",
16305
+ table: "permitPolicyDecisionReceipts",
16306
+ prepopulation: "runtime_log",
16307
+ copyMode: "none",
16308
+ description: "Permit decision receipts are runtime authorization audit logs."
16309
+ },
16310
+ {
16311
+ component: "control-plane",
16312
+ table: "permitPrincipalAliases",
16313
+ prepopulation: "runtime_data",
16314
+ copyMode: "none",
16315
+ description: "Permit principal aliases are tenant-specific identity projection rows."
16316
+ },
16317
+ {
16318
+ component: "control-plane",
16319
+ table: "permitPrincipals",
16320
+ prepopulation: "runtime_data",
16321
+ copyMode: "none",
16322
+ description: "Permit principals are projected from Clerk, Permit, and tenant onboarding flows."
16323
+ },
16324
+ {
16325
+ component: "control-plane",
16326
+ table: "permitProjectionOutbox",
16327
+ prepopulation: "runtime_queue",
16328
+ copyMode: "none",
16329
+ description: "Permit projection outbox rows are runtime sync queue data."
16330
+ },
16331
+ {
16332
+ component: "control-plane",
16333
+ table: "permitRelationshipTuples",
16334
+ prepopulation: "runtime_data",
16335
+ copyMode: "none",
16336
+ description: "Permit ReBAC relationship tuples are tenant policy projection rows."
16337
+ },
16338
+ {
16339
+ component: "control-plane",
16340
+ table: "permitResourceInstances",
16341
+ prepopulation: "runtime_data",
16342
+ copyMode: "none",
16343
+ description: "Permit resource instances are tenant/workspace graph and deployment projection rows."
16344
+ },
16345
+ {
16346
+ component: "control-plane",
16347
+ table: "permitRoleAssignments",
16348
+ prepopulation: "runtime_data",
16349
+ copyMode: "none",
16350
+ description: "Permit role assignments are tenant-specific policy projection rows."
16351
+ },
16352
+ {
16353
+ component: "control-plane",
14353
16354
  table: "platformAudienceGrants",
14354
16355
  prepopulation: "runtime_data",
14355
16356
  copyMode: "none",
14356
16357
  description: "Audience grants are principal/group-specific access rows."
14357
16358
  },
14358
16359
  {
14359
- component: "identity",
16360
+ component: "control-plane",
14360
16361
  table: "platformAudiences",
14361
16362
  prepopulation: "required_template",
14362
16363
  copyMode: "template_tenant_rewrite",
@@ -14365,35 +16366,35 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14365
16366
  description: "Default tenant audience taxonomy rows are rewritten into each tenant."
14366
16367
  },
14367
16368
  {
14368
- component: "identity",
16369
+ component: "control-plane",
14369
16370
  table: "platformPolicyDecisionLogs",
14370
16371
  prepopulation: "runtime_log",
14371
16372
  copyMode: "none",
14372
16373
  description: "Policy decisions are runtime audit logs."
14373
16374
  },
14374
16375
  {
14375
- component: "identity",
16376
+ component: "control-plane",
14376
16377
  table: "projectGrants",
14377
16378
  prepopulation: "runtime_data",
14378
16379
  copyMode: "none",
14379
16380
  description: "Project/topic grants are principal or group-specific access rows."
14380
16381
  },
14381
16382
  {
14382
- component: "identity",
16383
+ component: "control-plane",
14383
16384
  table: "reasoningPermissions",
14384
16385
  prepopulation: "runtime_data",
14385
16386
  copyMode: "none",
14386
16387
  description: "Reasoning permissions are principal-specific policy rows."
14387
16388
  },
14388
16389
  {
14389
- component: "identity",
16390
+ component: "control-plane",
14390
16391
  table: "tenantApiKeys",
14391
16392
  prepopulation: "runtime_secret",
14392
16393
  copyMode: "none",
14393
16394
  description: "API keys are tenant credentials and must never be copied."
14394
16395
  },
14395
16396
  {
14396
- component: "identity",
16397
+ component: "control-plane",
14397
16398
  table: "tenantConfig",
14398
16399
  prepopulation: "required_template",
14399
16400
  copyMode: "template_tenant_rewrite",
@@ -14402,7 +16403,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14402
16403
  description: "Tenant-local config defaults are rewritten during bootstrap."
14403
16404
  },
14404
16405
  {
14405
- component: "identity",
16406
+ component: "control-plane",
14406
16407
  table: "tenantIntegrations",
14407
16408
  prepopulation: "required_template",
14408
16409
  copyMode: "template_tenant_rewrite",
@@ -14411,14 +16412,21 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14411
16412
  description: "Non-secret integration descriptors are rewritten into each tenant."
14412
16413
  },
14413
16414
  {
14414
- component: "identity",
16415
+ component: "control-plane",
14415
16416
  table: "tenantModelSlotBindings",
14416
16417
  prepopulation: "runtime_secret",
14417
16418
  copyMode: "none",
14418
16419
  description: "Tenant model slot bindings reference provider secrets and are runtime-only."
14419
16420
  },
14420
16421
  {
14421
- component: "identity",
16422
+ component: "control-plane",
16423
+ table: "tenantPermitSyncStates",
16424
+ prepopulation: "runtime_derived",
16425
+ copyMode: "none",
16426
+ description: "Tenant Permit sync state rows are runtime reconciliation state."
16427
+ },
16428
+ {
16429
+ component: "control-plane",
14422
16430
  table: "tenantPolicies",
14423
16431
  prepopulation: "required_template",
14424
16432
  copyMode: "template_tenant_rewrite",
@@ -14427,42 +16435,42 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14427
16435
  description: "Default tenant policy roles are rewritten during bootstrap."
14428
16436
  },
14429
16437
  {
14430
- component: "identity",
16438
+ component: "control-plane",
14431
16439
  table: "tenantProviderSecrets",
14432
16440
  prepopulation: "runtime_secret",
14433
16441
  copyMode: "none",
14434
16442
  description: "Provider secrets are credentials and must never be copied."
14435
16443
  },
14436
16444
  {
14437
- component: "identity",
16445
+ component: "control-plane",
14438
16446
  table: "tenantProxyGatewayUsage",
14439
16447
  prepopulation: "runtime_log",
14440
16448
  copyMode: "none",
14441
16449
  description: "Proxy gateway usage rows are runtime telemetry."
14442
16450
  },
14443
16451
  {
14444
- component: "identity",
16452
+ component: "control-plane",
14445
16453
  table: "tenantProxyTokenMints",
14446
16454
  prepopulation: "runtime_secret",
14447
16455
  copyMode: "none",
14448
16456
  description: "Proxy token mints are ephemeral secret-bearing runtime rows."
14449
16457
  },
14450
16458
  {
14451
- component: "identity",
16459
+ component: "control-plane",
14452
16460
  table: "tenantSandboxAuditEvents",
14453
16461
  prepopulation: "runtime_log",
14454
16462
  copyMode: "none",
14455
16463
  description: "Sandbox audit rows are runtime security logs."
14456
16464
  },
14457
16465
  {
14458
- component: "identity",
16466
+ component: "control-plane",
14459
16467
  table: "tenantSecrets",
14460
16468
  prepopulation: "runtime_secret",
14461
16469
  copyMode: "none",
14462
16470
  description: "Tenant secrets are credentials and must never be copied."
14463
16471
  },
14464
16472
  {
14465
- component: "identity",
16473
+ component: "control-plane",
14466
16474
  table: "toolAcls",
14467
16475
  prepopulation: "required_template",
14468
16476
  copyMode: "template_global",
@@ -14471,7 +16479,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14471
16479
  description: "Default role-to-tool grants are required for SDK/MCP tool access."
14472
16480
  },
14473
16481
  {
14474
- component: "identity",
16482
+ component: "control-plane",
14475
16483
  table: "toolRegistry",
14476
16484
  prepopulation: "required_template",
14477
16485
  copyMode: "template_global",
@@ -14480,7 +16488,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14480
16488
  description: "Core tool catalog rows are required before pack or tenant tools exist."
14481
16489
  },
14482
16490
  {
14483
- component: "identity",
16491
+ component: "control-plane",
14484
16492
  table: "users",
14485
16493
  prepopulation: "runtime_bootstrap",
14486
16494
  copyMode: "none",