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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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,650 @@ 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
+ "attribute_binding",
4331
+ "policy_bundle"
4332
+ ]);
4333
+ var permitOutboxOperation = z.enum([
4334
+ "upsert",
4335
+ "delete",
4336
+ "sync",
4337
+ "resync",
4338
+ "delete_sync",
4339
+ "noop"
4340
+ ]);
4341
+ var permitPolicyBundleStatus = z.enum([
4342
+ "draft",
4343
+ "validated",
4344
+ "enforced",
4345
+ "archived"
4346
+ ]);
4347
+ var permitSyncStatus = z.enum([
4348
+ "pending",
4349
+ "synced",
4350
+ "error",
4351
+ "skipped"
4352
+ ]);
4353
+ var permitAccessReviewSubjectType = z.enum([
4354
+ "principal",
4355
+ "group",
4356
+ "role_assignment",
4357
+ "resource_instance"
4358
+ ]);
4359
+ var permitAttributeType = z.enum([
4360
+ "string",
4361
+ "number",
4362
+ "bool",
4363
+ "json",
4364
+ "time"
4365
+ ]);
4366
+ var permitAttributeOperator = z.enum([
4367
+ "eq",
4368
+ "neq",
4369
+ "in",
4370
+ "not_in",
4371
+ "gt",
4372
+ "gte",
4373
+ "lt",
4374
+ "lte",
4375
+ "contains",
4376
+ "not_contains",
4377
+ "matches"
4378
+ ]);
4379
+ var permitRoleBindingTarget = z.enum([
4380
+ "principal",
4381
+ "group"
4382
+ ]);
4383
+ defineTable({
4384
+ name: "permitPrincipals",
4385
+ component: "control-plane",
4386
+ category: "access-control",
4387
+ shape: z.object({
4388
+ principalId: z.string(),
4389
+ tenantId: z.string(),
4390
+ workspaceId: z.optional(z.string()),
4391
+ principalType: permitActorType,
4392
+ status: permitMembershipStatus,
4393
+ displayName: z.string().optional(),
4394
+ metadata: z.record(z.any()).optional(),
4395
+ createdBy: z.string(),
4396
+ createdAt: z.number(),
4397
+ updatedAt: z.number(),
4398
+ updatedBy: z.string().optional(),
4399
+ lastSeenAt: z.number().optional()
4400
+ }),
4401
+ indices: [
4402
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4403
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4404
+ { kind: "index", name: "by_tenant_principalId", columns: ["tenantId", "principalId"] },
4405
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4406
+ {
4407
+ kind: "index",
4408
+ name: "by_tenant_principalType_status",
4409
+ columns: ["tenantId", "principalType", "status"]
4410
+ }
4411
+ ]
4412
+ });
4413
+ defineTable({
4414
+ name: "permitPrincipalAliases",
4415
+ component: "control-plane",
4416
+ category: "access-control",
4417
+ shape: z.object({
4418
+ principalId: z.string(),
4419
+ tenantId: z.string(),
4420
+ workspaceId: z.optional(z.string()),
4421
+ provider: z.string(),
4422
+ providerSubjectId: z.string(),
4423
+ providerProjectId: z.string().optional(),
4424
+ alias: z.string(),
4425
+ aliasKind: z.string(),
4426
+ status: permitMembershipStatus,
4427
+ metadata: z.record(z.any()).optional(),
4428
+ createdBy: z.string(),
4429
+ createdAt: z.number(),
4430
+ updatedAt: z.number(),
4431
+ revokedBy: z.string().optional(),
4432
+ revokedAt: z.number().optional(),
4433
+ updatedBy: z.string().optional()
4434
+ }),
4435
+ indices: [
4436
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
4437
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "providerSubjectId"] },
4438
+ {
4439
+ kind: "index",
4440
+ name: "by_tenant_provider_alias",
4441
+ columns: ["tenantId", "provider", "alias"]
4442
+ },
4443
+ { kind: "index", name: "by_tenant_alias", columns: ["tenantId", "alias"] },
4444
+ {
4445
+ kind: "index",
4446
+ name: "by_tenant_provider_status",
4447
+ columns: ["tenantId", "provider", "status"]
4448
+ }
4449
+ ]
4450
+ });
4451
+ defineTable({
4452
+ name: "permitGroups",
4453
+ component: "control-plane",
4454
+ category: "access-control",
4455
+ shape: z.object({
4456
+ tenantId: z.string(),
4457
+ workspaceId: z.optional(z.string()),
4458
+ groupId: z.string(),
4459
+ groupKey: z.string(),
4460
+ groupName: z.string(),
4461
+ groupType: z.enum(["tenant", "workspace", "external", "system", "dynamic"]),
4462
+ status: permitMembershipStatus,
4463
+ description: z.string().optional(),
4464
+ metadata: z.record(z.any()).optional(),
4465
+ createdBy: z.string(),
4466
+ createdAt: z.number(),
4467
+ updatedAt: z.number(),
4468
+ updatedBy: z.string().optional()
4469
+ }),
4470
+ indices: [
4471
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4472
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4473
+ { kind: "index", name: "by_tenant_groupId", columns: ["tenantId", "groupId"] },
4474
+ { kind: "index", name: "by_tenant_groupKey", columns: ["tenantId", "groupKey"] },
4475
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4476
+ ]
4477
+ });
4478
+ defineTable({
4479
+ name: "permitGroupMemberships",
4480
+ component: "control-plane",
4481
+ category: "access-control",
4482
+ shape: z.object({
4483
+ tenantId: z.string(),
4484
+ workspaceId: z.optional(z.string()),
4485
+ groupId: z.string(),
4486
+ memberType: z.enum(["principal", "group"]),
4487
+ memberId: z.string(),
4488
+ principalId: z.string().optional(),
4489
+ childGroupId: z.string().optional(),
4490
+ status: permitMembershipStatus,
4491
+ addedBy: z.string().optional(),
4492
+ revokedBy: z.string().optional(),
4493
+ expiresAt: z.number().optional(),
4494
+ revocationReason: z.string().optional(),
4495
+ metadata: z.record(z.any()).optional(),
4496
+ createdAt: z.number(),
4497
+ updatedAt: z.number(),
4498
+ updatedBy: z.string().optional()
4499
+ }),
4500
+ indices: [
4501
+ { kind: "index", name: "by_tenant_principal", columns: ["tenantId", "principalId"] },
4502
+ { kind: "index", name: "by_tenant_member", columns: ["tenantId", "memberType", "memberId"] },
4503
+ {
4504
+ kind: "index",
4505
+ name: "by_tenant_member_group",
4506
+ columns: ["tenantId", "memberType", "memberId", "groupId"]
4507
+ },
4508
+ { kind: "index", name: "by_tenant_group", columns: ["tenantId", "groupId"] },
4509
+ { kind: "index", name: "by_member_group", columns: ["memberType", "memberId", "groupId"] },
4510
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4511
+ {
4512
+ kind: "index",
4513
+ name: "by_workspace_principal",
4514
+ columns: ["workspaceId", "principalId"]
4515
+ }
4516
+ ]
4517
+ });
4518
+ defineTable({
4519
+ name: "permitResourceInstances",
4520
+ component: "control-plane",
4521
+ category: "access-control",
4522
+ shape: z.object({
4523
+ tenantId: z.string(),
4524
+ workspaceId: z.optional(z.string()),
4525
+ resourceType: z.string(),
4526
+ resourceKey: z.string(),
4527
+ resourceId: z.string(),
4528
+ status: z.enum(["active", "deleted", "archived"]),
4529
+ attributes: z.record(z.any()).optional(),
4530
+ ownerPrincipalId: z.string().optional(),
4531
+ metadata: z.record(z.any()).optional(),
4532
+ createdBy: z.string(),
4533
+ updatedBy: z.string().optional(),
4534
+ createdAt: z.number(),
4535
+ updatedAt: z.number()
4536
+ }),
4537
+ indices: [
4538
+ {
4539
+ kind: "index",
4540
+ name: "by_tenant_resource_type",
4541
+ columns: ["tenantId", "resourceType"]
4542
+ },
4543
+ {
4544
+ kind: "index",
4545
+ name: "by_tenant_resource_key",
4546
+ columns: ["tenantId", "resourceType", "resourceKey"]
4547
+ },
4548
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4549
+ { kind: "index", name: "by_status", columns: ["status"] },
4550
+ {
4551
+ kind: "index",
4552
+ name: "by_tenant_status",
4553
+ columns: ["tenantId", "status"]
4554
+ },
4555
+ {
4556
+ kind: "index",
4557
+ name: "by_ownerPrincipalId",
4558
+ columns: ["ownerPrincipalId"]
4559
+ }
4560
+ ]
4561
+ });
4562
+ defineTable({
4563
+ name: "permitRoleAssignments",
4564
+ component: "control-plane",
4565
+ category: "access-control",
4566
+ shape: z.object({
4567
+ tenantId: z.string(),
4568
+ workspaceId: z.optional(z.string()),
4569
+ role: z.string(),
4570
+ targetType: permitRoleBindingTarget,
4571
+ targetId: z.string(),
4572
+ resourceType: z.string(),
4573
+ resourceKey: z.string(),
4574
+ resourceInstanceId: z.string().optional(),
4575
+ status: permitMembershipStatus,
4576
+ expiresAt: z.number().optional(),
4577
+ attributes: z.record(z.any()).optional(),
4578
+ grantedBy: z.string().optional(),
4579
+ updatedBy: z.string().optional(),
4580
+ revokedBy: z.string().optional(),
4581
+ createdAt: z.number(),
4582
+ updatedAt: z.number()
4583
+ }),
4584
+ indices: [
4585
+ {
4586
+ kind: "index",
4587
+ name: "by_tenant_target",
4588
+ columns: ["tenantId", "targetType", "targetId"]
4589
+ },
4590
+ {
4591
+ kind: "index",
4592
+ name: "by_tenant_resource",
4593
+ columns: ["tenantId", "resourceType", "resourceKey"]
4594
+ },
4595
+ {
4596
+ kind: "index",
4597
+ name: "by_tenant_role",
4598
+ columns: ["tenantId", "role", "status"]
4599
+ },
4600
+ { kind: "index", name: "by_status", columns: ["status"] },
4601
+ {
4602
+ kind: "index",
4603
+ name: "by_workspace_resource",
4604
+ columns: ["workspaceId", "resourceType", "resourceKey"]
4605
+ }
4606
+ ]
4607
+ });
4608
+ defineTable({
4609
+ name: "permitRelationshipTuples",
4610
+ component: "control-plane",
4611
+ category: "access-control",
4612
+ shape: z.object({
4613
+ tenantId: z.string(),
4614
+ workspaceId: z.optional(z.string()),
4615
+ relation: z.string(),
4616
+ subject: z.string(),
4617
+ object: z.string(),
4618
+ resourceType: z.string().optional(),
4619
+ resourceKey: z.string().optional(),
4620
+ status: permitRecordStatus,
4621
+ attributes: z.record(z.any()).optional(),
4622
+ createdBy: z.string(),
4623
+ createdAt: z.number(),
4624
+ updatedAt: z.number(),
4625
+ lastSeenAt: z.number().optional(),
4626
+ updatedBy: z.string().optional()
4627
+ }),
4628
+ indices: [
4629
+ { kind: "index", name: "by_tenant_subject", columns: ["tenantId", "subject"] },
4630
+ { kind: "index", name: "by_tenant_object", columns: ["tenantId", "object"] },
4631
+ { kind: "index", name: "by_tenant_relation", columns: ["tenantId", "relation"] },
4632
+ {
4633
+ kind: "index",
4634
+ name: "by_tenant_relation_subject",
4635
+ columns: ["tenantId", "relation", "subject"]
4636
+ },
4637
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4638
+ ]
4639
+ });
4640
+ defineTable({
4641
+ name: "permitAttributeBindings",
4642
+ component: "control-plane",
4643
+ category: "access-control",
4644
+ shape: z.object({
4645
+ tenantId: z.string(),
4646
+ workspaceId: z.optional(z.string()),
4647
+ targetType: permitRoleBindingTarget,
4648
+ targetId: z.string(),
4649
+ attributeName: z.string(),
4650
+ attributeType: permitAttributeType,
4651
+ attributeOperator: permitAttributeOperator,
4652
+ attributeValue: z.any(),
4653
+ status: permitRecordStatus,
4654
+ source: z.string().optional(),
4655
+ sourceRef: z.string().optional(),
4656
+ metadata: z.record(z.any()).optional(),
4657
+ createdAt: z.number(),
4658
+ updatedAt: z.number(),
4659
+ createdBy: z.string(),
4660
+ updatedBy: z.string().optional(),
4661
+ expiresAt: z.number().optional()
4662
+ }),
4663
+ indices: [
4664
+ {
4665
+ kind: "index",
4666
+ name: "by_tenant_target",
4667
+ columns: ["tenantId", "targetType", "targetId"]
4668
+ },
4669
+ {
4670
+ kind: "index",
4671
+ name: "by_tenant_target_attribute",
4672
+ columns: ["tenantId", "targetType", "targetId", "attributeName"]
4673
+ },
4674
+ {
4675
+ kind: "index",
4676
+ name: "by_tenant_name",
4677
+ columns: ["tenantId", "attributeName"]
4678
+ },
4679
+ {
4680
+ kind: "index",
4681
+ name: "by_tenant_status",
4682
+ columns: ["tenantId", "status"]
4683
+ }
4684
+ ]
4685
+ });
4686
+ defineTable({
4687
+ name: "permitPolicyBundles",
4688
+ component: "control-plane",
4689
+ category: "access-control",
4690
+ shape: z.object({
4691
+ tenantId: z.string(),
4692
+ workspaceId: z.optional(z.string()),
4693
+ bundleKey: z.string(),
4694
+ version: z.number(),
4695
+ status: permitPolicyBundleStatus,
4696
+ policyHash: z.string().optional(),
4697
+ policyPayload: z.record(z.any()),
4698
+ metadata: z.record(z.any()).optional(),
4699
+ createdBy: z.string(),
4700
+ reviewedBy: z.string().optional(),
4701
+ createdAt: z.number(),
4702
+ updatedAt: z.number(),
4703
+ retiredAt: z.number().optional()
4704
+ }),
4705
+ indices: [
4706
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4707
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4708
+ {
4709
+ kind: "index",
4710
+ name: "by_tenant_bundleKey",
4711
+ columns: ["tenantId", "bundleKey"]
4712
+ },
4713
+ {
4714
+ kind: "index",
4715
+ name: "by_tenant_bundle_version",
4716
+ columns: ["tenantId", "bundleKey", "version"]
4717
+ },
4718
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4719
+ ]
4720
+ });
4721
+ defineTable({
4722
+ name: "permitProjectionOutbox",
4723
+ component: "control-plane",
4724
+ category: "access-control",
4725
+ shape: z.object({
4726
+ syncKey: z.string(),
4727
+ objectType: permitObjectType,
4728
+ objectId: z.string(),
4729
+ operation: permitOutboxOperation,
4730
+ payload: z.record(z.any()),
4731
+ status: permitRecordStatus,
4732
+ attemptCount: z.number(),
4733
+ nextAttemptAt: z.number().optional(),
4734
+ lastError: z.string().optional(),
4735
+ tenantId: z.string().optional(),
4736
+ workspaceId: z.optional(z.string()),
4737
+ principalId: z.string().optional(),
4738
+ permitTenantKey: z.string().optional(),
4739
+ permitResourceType: z.string().optional(),
4740
+ permitResourceKey: z.string().optional(),
4741
+ createdAt: z.number(),
4742
+ updatedAt: z.number(),
4743
+ lastHandledAt: z.number().optional()
4744
+ }),
4745
+ indices: [
4746
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4747
+ { kind: "index", name: "by_status", columns: ["status"] },
4748
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4749
+ {
4750
+ kind: "index",
4751
+ name: "by_tenant_status",
4752
+ columns: ["tenantId", "status"]
4753
+ },
4754
+ {
4755
+ kind: "index",
4756
+ name: "by_objectType",
4757
+ columns: ["objectType", "status"]
4758
+ }
4759
+ ]
4760
+ });
4761
+ defineTable({
4762
+ name: "tenantPermitSyncStates",
4763
+ component: "control-plane",
4764
+ category: "access-control",
4765
+ shape: z.object({
4766
+ syncKey: z.string(),
4767
+ objectType: permitObjectType,
4768
+ objectId: z.string(),
4769
+ tenantId: z.string().optional(),
4770
+ workspaceId: z.string().optional(),
4771
+ principalId: z.string().optional(),
4772
+ permitTenantKey: z.string().optional(),
4773
+ permitResourceType: z.string().optional(),
4774
+ permitResourceKey: z.string().optional(),
4775
+ desiredPayload: z.record(z.any()),
4776
+ lastAppliedPayloadHash: z.string().optional(),
4777
+ status: permitSyncStatus,
4778
+ attemptCount: z.number(),
4779
+ lastError: z.string().optional(),
4780
+ nextAttemptAt: z.number().optional(),
4781
+ lastSyncedAt: z.number().optional(),
4782
+ createdBy: z.string(),
4783
+ updatedBy: z.string().optional(),
4784
+ createdAt: z.number(),
4785
+ updatedAt: z.number()
4786
+ }),
4787
+ indices: [
4788
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4789
+ { kind: "index", name: "by_status", columns: ["status"] },
4790
+ {
4791
+ kind: "index",
4792
+ name: "by_tenant_status",
4793
+ columns: ["tenantId", "status"]
4794
+ },
4795
+ {
4796
+ kind: "index",
4797
+ name: "by_workspace_status",
4798
+ columns: ["workspaceId", "status"]
4799
+ },
4800
+ {
4801
+ kind: "index",
4802
+ name: "by_principal_status",
4803
+ columns: ["principalId", "status"]
4804
+ }
4805
+ ]
4806
+ });
4807
+ defineTable({
4808
+ name: "permitPolicyDecisionReceipts",
4809
+ component: "control-plane",
4810
+ category: "access-control",
4811
+ shape: z.object({
4812
+ tenantId: z.string().optional(),
4813
+ workspaceId: z.string().optional(),
4814
+ principalId: z.string(),
4815
+ subjectType: permitAccessReviewSubjectType.optional(),
4816
+ subjectId: z.string().optional(),
4817
+ resourceType: z.string(),
4818
+ resourceId: z.string(),
4819
+ action: z.string(),
4820
+ decision: permitDecision,
4821
+ reasonCode: z.string(),
4822
+ policyBundleId: z.string().optional(),
4823
+ policyVersion: z.string(),
4824
+ traceId: z.string().optional(),
4825
+ requestId: z.string().optional(),
4826
+ audienceMode: z.string().optional(),
4827
+ audienceKey: z.string().optional(),
4828
+ audienceClass: z.enum(["internal", "restricted_external", "public"]).optional(),
4829
+ metadata: z.record(z.any()).optional(),
4830
+ createdAt: z.number(),
4831
+ expiresAt: z.number().optional(),
4832
+ createdBy: z.string().optional()
4833
+ }),
4834
+ indices: [
4835
+ { kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
4836
+ { kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
4837
+ { kind: "index", name: "by_resource", columns: ["resourceType", "resourceId"] },
4838
+ { kind: "index", name: "by_decision_createdAt", columns: ["decision", "createdAt"] },
4839
+ { kind: "index", name: "by_traceId", columns: ["traceId"] },
4840
+ { kind: "index", name: "by_action", columns: ["action"] }
4841
+ ]
4842
+ });
4843
+ defineTable({
4844
+ name: "permitAccessReviews",
4845
+ component: "control-plane",
4846
+ category: "access-control",
4847
+ shape: z.object({
4848
+ tenantId: z.string(),
4849
+ workspaceId: z.optional(z.string()),
4850
+ reviewKey: z.string(),
4851
+ scope: permitReviewScope,
4852
+ status: permitAccessReviewStatus,
4853
+ subjectType: permitAccessReviewSubjectType,
4854
+ subjectId: z.string(),
4855
+ resourceType: z.string().optional(),
4856
+ resourceKey: z.string().optional(),
4857
+ outcome: z.enum(["allow", "deny"]).optional(),
4858
+ requestedBy: z.string(),
4859
+ reviewedBy: z.string().optional(),
4860
+ requestedAt: z.number(),
4861
+ reviewedAt: z.number().optional(),
4862
+ dueAt: z.number().optional(),
4863
+ justification: z.string().optional(),
4864
+ rationale: z.string().optional(),
4865
+ policyBundleId: z.string().optional(),
4866
+ metadata: z.record(z.any()).optional(),
4867
+ createdAt: z.number(),
4868
+ updatedAt: z.number()
4869
+ }),
4870
+ indices: [
4871
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4872
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4873
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4874
+ {
4875
+ kind: "index",
4876
+ name: "by_tenant_subject",
4877
+ columns: ["tenantId", "subjectType", "subjectId"]
4878
+ },
4879
+ { kind: "index", name: "by_outcome", columns: ["outcome"] },
4880
+ {
4881
+ kind: "index",
4882
+ name: "by_workspace_status",
4883
+ columns: ["workspaceId", "status"]
4884
+ }
4885
+ ]
4886
+ });
4887
+ defineTable({
4888
+ name: "permitAccessReviewItems",
4889
+ component: "control-plane",
4890
+ category: "access-control",
4891
+ shape: z.object({
4892
+ reviewKey: z.string(),
4893
+ itemKey: z.string(),
4894
+ tenantId: z.string(),
4895
+ workspaceId: z.string().optional(),
4896
+ subjectType: permitAccessReviewSubjectType,
4897
+ subjectId: z.string(),
4898
+ resourceType: z.string().optional(),
4899
+ resourceKey: z.string().optional(),
4900
+ role: z.string().optional(),
4901
+ relation: z.string().optional(),
4902
+ status: z.enum(["open", "approved", "revoked", "changed", "deferred"]),
4903
+ reviewerId: z.string().optional(),
4904
+ decisionAt: z.number().optional(),
4905
+ rationale: z.string().optional(),
4906
+ metadata: z.record(z.any()).optional(),
4907
+ createdAt: z.number(),
4908
+ updatedAt: z.number()
4909
+ }),
4910
+ indices: [
4911
+ { kind: "index", name: "by_reviewKey", columns: ["reviewKey"] },
4912
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4913
+ { kind: "index", name: "by_tenant_itemKey", columns: ["tenantId", "itemKey"] },
4914
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4915
+ { kind: "index", name: "by_status", columns: ["status"] }
4916
+ ]
4917
+ });
4004
4918
  defineTable({
4005
4919
  name: "reasoningPermissions",
4006
- component: "identity",
4920
+ component: "control-plane",
4007
4921
  category: "epistemic",
4008
4922
  shape: z.object({
4009
4923
  "topicId": z.string().optional(),
@@ -4250,7 +5164,7 @@ defineTable({
4250
5164
  });
4251
5165
  defineTable({
4252
5166
  name: "users",
4253
- component: "identity",
5167
+ component: "control-plane",
4254
5168
  category: "user",
4255
5169
  shape: z.object({
4256
5170
  "clerkId": z.string(),
@@ -4364,7 +5278,6 @@ defineTable({
4364
5278
  "deployments": z.record(z.object({
4365
5279
  "url": z.string(),
4366
5280
  "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
4367
- "encryptedDeployKey": z.string().optional(),
4368
5281
  "credentialRef": z.string().optional()
4369
5282
  })).optional(),
4370
5283
  "metadata": z.record(z.any()).optional(),
@@ -4379,6 +5292,39 @@ defineTable({
4379
5292
  { kind: "index", name: "by_status", columns: ["status"] }
4380
5293
  ]
4381
5294
  });
5295
+ defineTable({
5296
+ name: "deploymentHosts",
5297
+ component: "mc",
5298
+ category: "workspace",
5299
+ shape: z.object({
5300
+ "host": z.string(),
5301
+ "tenantId": idOf("tenants"),
5302
+ "workspaceId": idOf("workspaces"),
5303
+ "environment": z.enum(["dev", "staging", "prod"]),
5304
+ "target": z.enum(["kernelDeployment", "appDeployment"]),
5305
+ "deploymentUrl": z.string().optional(),
5306
+ "deploymentName": z.string().optional(),
5307
+ "vercelProjectName": z.string().optional(),
5308
+ "vercelProjectId": z.string().optional(),
5309
+ "vercelEnvironment": z.enum(["development", "preview", "staging", "production"]).optional(),
5310
+ "source": z.enum(["vercel_preview", "vercel_production", "vercel_custom_environment", "custom_domain", "manual"]),
5311
+ "status": z.enum(["active", "revoked"]),
5312
+ "metadata": z.record(z.any()).optional(),
5313
+ "createdBy": z.string(),
5314
+ "createdAt": z.number(),
5315
+ "updatedAt": z.number(),
5316
+ "revokedAt": z.number().optional(),
5317
+ "revokedBy": z.string().optional()
5318
+ }),
5319
+ indices: [
5320
+ { kind: "index", name: "by_host", columns: ["host"] },
5321
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
5322
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
5323
+ { kind: "index", name: "by_tenant_workspace_environment", columns: ["tenantId", "workspaceId", "environment"] },
5324
+ { kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
5325
+ { kind: "index", name: "by_status", columns: ["status"] }
5326
+ ]
5327
+ });
4382
5328
  defineTable({
4383
5329
  name: "worktreeBeliefCluster",
4384
5330
  component: "kernel",
@@ -4686,8 +5632,8 @@ defineTable({
4686
5632
  });
4687
5633
  z.object({
4688
5634
  manifestVersion: z.string(),
4689
- componentName: z.enum(["kernel", "identity"]),
4690
- tier: z.enum(["K", "I"]),
5635
+ componentName: z.enum(["kernel", "control-plane"]),
5636
+ tier: z.enum(["K", "CP"]),
4691
5637
  packageVersion: z.string(),
4692
5638
  tables: z.array(
4693
5639
  z.object({
@@ -4813,129 +5759,994 @@ var edgePolicyManifest = {
4813
5759
  // ../contracts/src/tenant-client.contract.ts
4814
5760
  var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
4815
5761
  {
4816
- packageName: "@lucern/access-control",
4817
- role: "runtime_entrypoint",
4818
- directTenantImport: true
5762
+ packageName: "@lucern/access-control",
5763
+ role: "runtime_entrypoint",
5764
+ directTenantImport: true
5765
+ },
5766
+ {
5767
+ packageName: "@lucern/agent",
5768
+ role: "platform_runtime",
5769
+ directTenantImport: false
5770
+ },
5771
+ {
5772
+ packageName: "@lucern/auth",
5773
+ role: "sdk_dependency",
5774
+ directTenantImport: false
5775
+ },
5776
+ {
5777
+ packageName: "@lucern/cli",
5778
+ role: "developer_tool",
5779
+ directTenantImport: false
5780
+ },
5781
+ {
5782
+ packageName: "@lucern/client-core",
5783
+ role: "sdk_dependency",
5784
+ directTenantImport: false
5785
+ },
5786
+ {
5787
+ packageName: "@lucern/confidence",
5788
+ role: "sdk_dependency",
5789
+ directTenantImport: false
5790
+ },
5791
+ {
5792
+ packageName: "@lucern/config",
5793
+ role: "configuration",
5794
+ directTenantImport: false
5795
+ },
5796
+ {
5797
+ packageName: "@lucern/contracts",
5798
+ role: "contract_entrypoint",
5799
+ directTenantImport: true
5800
+ },
5801
+ {
5802
+ packageName: "@lucern/control-plane",
5803
+ role: "component_runtime",
5804
+ directTenantImport: false
5805
+ },
5806
+ {
5807
+ packageName: "@lucern/developer-kit",
5808
+ role: "developer_tool",
5809
+ directTenantImport: false
5810
+ },
5811
+ {
5812
+ packageName: "@lucern/events",
5813
+ role: "sdk_dependency",
5814
+ directTenantImport: false
5815
+ },
5816
+ {
5817
+ packageName: "@lucern/graph-primitives",
5818
+ role: "sdk_dependency",
5819
+ directTenantImport: false
5820
+ },
5821
+ {
5822
+ packageName: "@lucern/graph-sync",
5823
+ role: "host_addon_runtime",
5824
+ directTenantImport: true
5825
+ },
5826
+ {
5827
+ packageName: "@lucern/mcp",
5828
+ role: "runtime_entrypoint",
5829
+ directTenantImport: true
5830
+ },
5831
+ {
5832
+ packageName: "@lucern/pack-host",
5833
+ role: "platform_runtime",
5834
+ directTenantImport: false
5835
+ },
5836
+ {
5837
+ packageName: "@lucern/pack-installer",
5838
+ role: "developer_tool",
5839
+ directTenantImport: false
5840
+ },
5841
+ {
5842
+ packageName: "@lucern/proof-compiler",
5843
+ role: "developer_tool",
5844
+ directTenantImport: false
5845
+ },
5846
+ {
5847
+ packageName: "@lucern/react",
5848
+ role: "runtime_entrypoint",
5849
+ directTenantImport: true
5850
+ },
5851
+ {
5852
+ packageName: "@lucern/reasoning-kernel",
5853
+ role: "component_runtime",
5854
+ directTenantImport: false
5855
+ },
5856
+ {
5857
+ packageName: "@lucern/sdk",
5858
+ role: "runtime_entrypoint",
5859
+ directTenantImport: true
5860
+ },
5861
+ {
5862
+ packageName: "@lucern/secrets",
5863
+ role: "sdk_dependency",
5864
+ directTenantImport: false
5865
+ },
5866
+ {
5867
+ packageName: "@lucern/server-core",
5868
+ role: "platform_runtime",
5869
+ directTenantImport: false
5870
+ },
5871
+ {
5872
+ packageName: "@lucern/testing",
5873
+ role: "test_support",
5874
+ directTenantImport: false
5875
+ },
5876
+ {
5877
+ packageName: "@lucern/types",
5878
+ role: "contract_entrypoint",
5879
+ directTenantImport: true
5880
+ }
5881
+ ];
5882
+ TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
5883
+ (entry) => entry.packageName
5884
+ );
5885
+
5886
+ // ../contracts/src/infisical-runtime.contract.ts
5887
+ var INFISICAL_TENANT_SOFTWARE_SYSTEMS = [
5888
+ {
5889
+ id: "stack-frontend",
5890
+ tenantKey: "stack",
5891
+ workspaceKey: "frontend",
5892
+ vercelProjectName: "ai-chatbot-diao",
5893
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5894
+ vercelProjectId: "prj_PihFw8kohSSw14nZs9YQV3xVo517",
5895
+ repository: {
5896
+ owner: "stack-vc",
5897
+ name: "front-end"
5898
+ },
5899
+ sharedSourcePath: "/tenants/stack",
5900
+ sharedVariablePolicy: "tenant_shared_all_systems",
5901
+ convex: {
5902
+ urlEnv: "CONVEX_FRONTEND_URL",
5903
+ deployKeyEnv: "CONVEX_FRONTEND_DEPLOY_KEY",
5904
+ preprodDeployment: "rugged-lobster-664",
5905
+ prodDeployment: "wonderful-toucan-0"
5906
+ }
5907
+ },
5908
+ {
5909
+ id: "stackos",
5910
+ tenantKey: "stack",
5911
+ workspaceKey: "stackos",
5912
+ vercelProjectName: "stackos",
5913
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5914
+ vercelProjectId: "prj_rXLAL0Z6v9p1fasKbomby6GI7kau",
5915
+ repository: {
5916
+ owner: "stack-vc",
5917
+ name: "stackos"
5918
+ },
5919
+ sharedSourcePath: "/tenants/stack",
5920
+ sharedVariablePolicy: "tenant_shared_all_systems",
5921
+ convex: {
5922
+ urlEnv: "CONVEX_STACKOS_URL",
5923
+ deployKeyEnv: "CONVEX_STACKOS_DEPLOY_KEY",
5924
+ preprodDeployment: "giant-mandrill-761",
5925
+ prodDeployment: "good-snake-515"
5926
+ }
5927
+ },
5928
+ {
5929
+ id: "stack-eng",
5930
+ tenantKey: "stack",
5931
+ workspaceKey: "engineering",
5932
+ vercelProjectName: "stackos-engineering-graph",
5933
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5934
+ vercelProjectId: "prj_zAU0Zn9GkbHjHI63dxW4vLpmoqTJ",
5935
+ repository: {
5936
+ owner: "stack-vc",
5937
+ name: "stackos-engineering-graph"
5938
+ },
5939
+ sharedSourcePath: "/tenants/stack/engineering",
5940
+ sharedVariablePolicy: "tenant_shared_all_systems",
5941
+ convex: {
5942
+ urlEnv: "CONVEX_STACK_ENG_URL",
5943
+ deployKeyEnv: "CONVEX_STACK_ENG_DEPLOY_KEY",
5944
+ preprodDeployment: "small-oyster-270",
5945
+ prodDeployment: "bold-cuttlefish-804"
5946
+ }
5947
+ },
5948
+ {
5949
+ id: "lucern-graph",
5950
+ tenantKey: "lucern",
5951
+ workspaceKey: "lucern",
5952
+ vercelProjectName: "lucern-graph",
5953
+ vercelTeamId: "team_vTHxxs8GAoAFUe6RWMlYt7fY",
5954
+ vercelProjectId: "prj_KJ8EKV8vGM5xURpqmwTwmECEGPgQ",
5955
+ repository: {
5956
+ owner: "LucernAI",
5957
+ name: "lucern-graph"
5958
+ },
5959
+ sharedSourcePath: "/tenants/lucern/shared",
5960
+ sharedVariablePolicy: "tenant_shared_all_systems",
5961
+ convex: {
5962
+ urlEnv: "CONVEX_LUCERN_URL",
5963
+ deployKeyEnv: "CONVEX_LUCERN_DEPLOY_KEY",
5964
+ preprodDeployment: "good-blackbird-774",
5965
+ prodDeployment: "precious-dog-365"
5966
+ }
5967
+ }
5968
+ ];
5969
+ var TENANT_SHARED_SECRET_DEFINITION_TEMPLATES = [
5970
+ {
5971
+ idSuffix: "clerk.publishable",
5972
+ canonicalName: "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
5973
+ aliases: ["CLERK_PUBLISHABLE_KEY"],
5974
+ required: true,
5975
+ secret: false,
5976
+ public: true,
5977
+ 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."
5978
+ },
5979
+ {
5980
+ idSuffix: "clerk.secret",
5981
+ canonicalName: "CLERK_SECRET_KEY",
5982
+ required: true,
5983
+ secret: true,
5984
+ public: false,
5985
+ description: "Tenant-owned Clerk backend secret used only by that tenant's server runtimes."
5986
+ },
5987
+ {
5988
+ idSuffix: "clerk.project",
5989
+ canonicalName: "CLERK_PROJECT_ID",
5990
+ required: true,
5991
+ secret: false,
5992
+ public: false,
5993
+ description: "Tenant-owned Clerk project id used to resolve canonical Clerk aliases."
5994
+ },
5995
+ {
5996
+ idSuffix: "clerk.jwks",
5997
+ canonicalName: "CLERK_JWT_ISSUER_DOMAIN",
5998
+ aliases: ["CLERK_ISSUER_URL", "CLERK_JWKS_URL"],
5999
+ required: false,
6000
+ secret: false,
6001
+ public: false,
6002
+ description: "Tenant Clerk issuer/JWKS URL consumed by Convex auth.config.ts."
6003
+ },
6004
+ {
6005
+ idSuffix: "clerk.jwt-key",
6006
+ canonicalName: "CLERK_JWT_KEY",
6007
+ required: false,
6008
+ secret: true,
6009
+ public: false,
6010
+ description: "Tenant Clerk JWT public verification key used by bearer-token API routes."
6011
+ },
6012
+ {
6013
+ idSuffix: "clerk.authorized-parties",
6014
+ canonicalName: "CLERK_AUTHORIZED_PARTIES",
6015
+ aliases: ["CLERK_MOBILE_AUTHORIZED_PARTIES"],
6016
+ required: false,
6017
+ secret: false,
6018
+ public: false,
6019
+ description: "Comma-separated Clerk authorized parties for browser and mobile bearer-token validation."
6020
+ },
6021
+ {
6022
+ idSuffix: "clerk.sign-in-url",
6023
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
6024
+ required: false,
6025
+ secret: false,
6026
+ public: true,
6027
+ description: "Tenant Clerk sign-in route for custom app login surfaces."
6028
+ },
6029
+ {
6030
+ idSuffix: "clerk.sign-up-url",
6031
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
6032
+ required: false,
6033
+ secret: false,
6034
+ public: true,
6035
+ description: "Tenant Clerk sign-up route for custom app login surfaces."
6036
+ }
6037
+ ];
6038
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6039
+ (system) => TENANT_SHARED_SECRET_DEFINITION_TEMPLATES.map(
6040
+ (template) => ({
6041
+ id: `tenant.${system.id}.${template.idSuffix}`,
6042
+ canonicalName: template.canonicalName,
6043
+ aliases: "aliases" in template ? template.aliases : void 0,
6044
+ owner: "tenant",
6045
+ scope: "tenant",
6046
+ sourcePath: system.sharedSourcePath,
6047
+ environmentPolicy: "environment_specific",
6048
+ required: template.required,
6049
+ secret: template.secret,
6050
+ public: template.public,
6051
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6052
+ destinations: [
6053
+ {
6054
+ kind: "vercel",
6055
+ target: system.vercelProjectName,
6056
+ environmentPolicy: "preprod_staging_prod_prod"
6057
+ },
6058
+ {
6059
+ kind: "convex",
6060
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6061
+ environmentPolicy: "preprod_staging_prod_prod"
6062
+ }
6063
+ ],
6064
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6065
+ })
6066
+ )
6067
+ );
6068
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.map(
6069
+ (system) => ({
6070
+ id: `tenant.${system.id}.install-lucern-npm`,
6071
+ canonicalName: "INSTALL_LUCERN_NPM",
6072
+ owner: "provider",
6073
+ scope: "global",
6074
+ sourcePath: "/tenants/shared",
6075
+ environmentPolicy: "same_all_environments",
6076
+ required: true,
6077
+ secret: true,
6078
+ public: false,
6079
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6080
+ destinations: [
6081
+ {
6082
+ kind: "vercel",
6083
+ target: system.vercelProjectName,
6084
+ environmentPolicy: "same_all_environments"
6085
+ },
6086
+ {
6087
+ kind: "github_actions",
6088
+ target: `${system.repository.owner}/${system.repository.name}`,
6089
+ environmentPolicy: "same_all_environments"
6090
+ }
6091
+ ],
6092
+ description: `${system.tenantKey}/${system.workspaceKey}: read-only npm install token for published @lucern/* packages.`
6093
+ })
6094
+ );
6095
+ var TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS = ["stack-frontend", "stackos"];
6096
+ var TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES = [
6097
+ {
6098
+ idSuffix: "ai.openai-api-key",
6099
+ canonicalName: "OPENAI_API_KEY",
6100
+ required: false,
6101
+ secret: true,
6102
+ public: false,
6103
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6104
+ description: "Tenant-owned OpenAI key for product runtime LLM calls."
4819
6105
  },
4820
6106
  {
4821
- packageName: "@lucern/agent",
4822
- role: "platform_runtime",
4823
- directTenantImport: false
6107
+ idSuffix: "ai.anthropic-api-key",
6108
+ canonicalName: "ANTHROPIC_API_KEY",
6109
+ required: false,
6110
+ secret: true,
6111
+ public: false,
6112
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6113
+ description: "Tenant-owned Anthropic key for product runtime LLM calls."
4824
6114
  },
4825
6115
  {
4826
- packageName: "@lucern/auth",
4827
- role: "sdk_dependency",
4828
- directTenantImport: false
6116
+ idSuffix: "ai.gemini-api-key",
6117
+ canonicalName: "GEMINI_API_KEY",
6118
+ aliases: ["GOOGLE_AI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
6119
+ required: false,
6120
+ secret: true,
6121
+ public: false,
6122
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6123
+ description: "Tenant-owned Google/Gemini key for product runtime LLM calls."
4829
6124
  },
4830
6125
  {
4831
- packageName: "@lucern/cli",
4832
- role: "developer_tool",
4833
- directTenantImport: false
6126
+ idSuffix: "langfuse.secret-key",
6127
+ canonicalName: "LANGFUSE_SECRET_KEY",
6128
+ required: false,
6129
+ secret: true,
6130
+ public: false,
6131
+ consumers: [
6132
+ "tenant-vercel-app",
6133
+ "tenant-convex-deployment",
6134
+ "tenant-observability"
6135
+ ],
6136
+ description: "Tenant-owned Langfuse secret key for product AI tracing."
4834
6137
  },
4835
6138
  {
4836
- packageName: "@lucern/client-core",
4837
- role: "sdk_dependency",
4838
- directTenantImport: false
6139
+ idSuffix: "langfuse.public-key",
6140
+ canonicalName: "LANGFUSE_PUBLIC_KEY",
6141
+ required: false,
6142
+ secret: false,
6143
+ public: false,
6144
+ consumers: [
6145
+ "tenant-vercel-app",
6146
+ "tenant-convex-deployment",
6147
+ "tenant-observability"
6148
+ ],
6149
+ description: "Tenant-owned Langfuse public key for product AI tracing."
4839
6150
  },
4840
6151
  {
4841
- packageName: "@lucern/confidence",
4842
- role: "sdk_dependency",
4843
- directTenantImport: false
6152
+ idSuffix: "langfuse.base-url",
6153
+ canonicalName: "LANGFUSE_BASE_URL",
6154
+ aliases: ["LANGFUSE_BASEURL", "LANGFUSE_HOST"],
6155
+ required: false,
6156
+ secret: false,
6157
+ public: false,
6158
+ consumers: [
6159
+ "tenant-vercel-app",
6160
+ "tenant-convex-deployment",
6161
+ "tenant-observability"
6162
+ ],
6163
+ description: "Tenant-owned Langfuse API origin."
4844
6164
  },
4845
6165
  {
4846
- packageName: "@lucern/config",
4847
- role: "configuration",
4848
- directTenantImport: false
6166
+ idSuffix: "graph.neo4j-uri",
6167
+ canonicalName: "NEO4J_URI",
6168
+ required: false,
6169
+ secret: false,
6170
+ public: false,
6171
+ consumers: [
6172
+ "tenant-vercel-app",
6173
+ "tenant-convex-deployment",
6174
+ "tenant-graph-sync"
6175
+ ],
6176
+ description: "Tenant-owned Neo4j URI for product graph-sync."
4849
6177
  },
4850
6178
  {
4851
- packageName: "@lucern/contracts",
4852
- role: "contract_entrypoint",
4853
- directTenantImport: true
6179
+ idSuffix: "graph.neo4j-user",
6180
+ canonicalName: "NEO4J_USER",
6181
+ aliases: ["NEO4J_USERNAME"],
6182
+ required: false,
6183
+ secret: false,
6184
+ public: false,
6185
+ consumers: [
6186
+ "tenant-vercel-app",
6187
+ "tenant-convex-deployment",
6188
+ "tenant-graph-sync"
6189
+ ],
6190
+ description: "Tenant-owned Neo4j user for product graph-sync."
4854
6191
  },
4855
6192
  {
4856
- packageName: "@lucern/control-plane",
4857
- role: "platform_runtime",
4858
- directTenantImport: false
6193
+ idSuffix: "graph.neo4j-password",
6194
+ canonicalName: "NEO4J_PASSWORD",
6195
+ required: false,
6196
+ secret: true,
6197
+ public: false,
6198
+ consumers: [
6199
+ "tenant-vercel-app",
6200
+ "tenant-convex-deployment",
6201
+ "tenant-graph-sync"
6202
+ ],
6203
+ description: "Tenant-owned Neo4j password for product graph-sync."
4859
6204
  },
4860
6205
  {
4861
- packageName: "@lucern/developer-kit",
4862
- role: "developer_tool",
4863
- directTenantImport: false
6206
+ idSuffix: "graph.neo4j-sync-secret",
6207
+ canonicalName: "NEO4J_SYNC_SECRET",
6208
+ required: false,
6209
+ secret: true,
6210
+ public: false,
6211
+ consumers: [
6212
+ "tenant-vercel-app",
6213
+ "tenant-convex-deployment",
6214
+ "tenant-graph-sync"
6215
+ ],
6216
+ description: "Tenant-owned shared secret for product Convex-to-HTTP graph-sync calls."
4864
6217
  },
4865
6218
  {
4866
- packageName: "@lucern/events",
4867
- role: "sdk_dependency",
4868
- directTenantImport: false
6219
+ idSuffix: "graph.neo4j-database",
6220
+ canonicalName: "NEO4J_DATABASE",
6221
+ required: false,
6222
+ secret: false,
6223
+ public: false,
6224
+ consumers: [
6225
+ "tenant-vercel-app",
6226
+ "tenant-convex-deployment",
6227
+ "tenant-graph-sync"
6228
+ ],
6229
+ description: "Tenant-owned Neo4j database name for product graph-sync."
4869
6230
  },
4870
6231
  {
4871
- packageName: "@lucern/graph-primitives",
4872
- role: "sdk_dependency",
4873
- directTenantImport: false
6232
+ idSuffix: "vector.pinecone-api-key",
6233
+ canonicalName: "PINECONE_API_KEY",
6234
+ required: false,
6235
+ secret: true,
6236
+ public: false,
6237
+ consumers: [
6238
+ "tenant-vercel-app",
6239
+ "tenant-convex-deployment",
6240
+ "tenant-vector-store"
6241
+ ],
6242
+ description: "Tenant-owned Pinecone API key for product vector search."
4874
6243
  },
4875
6244
  {
4876
- packageName: "@lucern/graph-sync",
4877
- role: "host_addon_runtime",
4878
- directTenantImport: true
6245
+ idSuffix: "vector.pinecone-index-name",
6246
+ canonicalName: "PINECONE_INDEX_NAME",
6247
+ aliases: ["PINECONE_INDEX"],
6248
+ required: false,
6249
+ secret: false,
6250
+ public: false,
6251
+ consumers: [
6252
+ "tenant-vercel-app",
6253
+ "tenant-convex-deployment",
6254
+ "tenant-vector-store"
6255
+ ],
6256
+ description: "Tenant-owned Pinecone index name for product vector search."
4879
6257
  },
4880
6258
  {
4881
- packageName: "@lucern/identity",
4882
- role: "component_runtime",
4883
- directTenantImport: false
6259
+ idSuffix: "vector.pinecone-host",
6260
+ canonicalName: "PINECONE_HOST",
6261
+ aliases: ["PINECONE_INDEX_HOST"],
6262
+ required: false,
6263
+ secret: false,
6264
+ public: false,
6265
+ consumers: [
6266
+ "tenant-vercel-app",
6267
+ "tenant-convex-deployment",
6268
+ "tenant-vector-store"
6269
+ ],
6270
+ description: "Tenant-owned Pinecone host for product vector search."
4884
6271
  },
4885
6272
  {
4886
- packageName: "@lucern/mcp",
4887
- role: "runtime_entrypoint",
4888
- directTenantImport: true
6273
+ idSuffix: "vector.pinecone-namespace",
6274
+ canonicalName: "PINECONE_NAMESPACE",
6275
+ required: false,
6276
+ secret: false,
6277
+ public: false,
6278
+ consumers: [
6279
+ "tenant-vercel-app",
6280
+ "tenant-convex-deployment",
6281
+ "tenant-vector-store"
6282
+ ],
6283
+ description: "Tenant-owned Pinecone namespace for product vector search isolation."
4889
6284
  },
4890
6285
  {
4891
- packageName: "@lucern/pack-host",
4892
- role: "platform_runtime",
4893
- directTenantImport: false
6286
+ idSuffix: "storage.aws-access-key-id",
6287
+ canonicalName: "AWS_ACCESS_KEY_ID",
6288
+ required: false,
6289
+ secret: true,
6290
+ public: false,
6291
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6292
+ description: "Tenant-owned AWS access key id for document/file ingestion."
4894
6293
  },
4895
6294
  {
4896
- packageName: "@lucern/pack-installer",
4897
- role: "developer_tool",
4898
- directTenantImport: false
6295
+ idSuffix: "storage.aws-secret-access-key",
6296
+ canonicalName: "AWS_SECRET_ACCESS_KEY",
6297
+ required: false,
6298
+ secret: true,
6299
+ public: false,
6300
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6301
+ description: "Tenant-owned AWS secret access key for document/file ingestion."
4899
6302
  },
4900
6303
  {
4901
- packageName: "@lucern/proof-compiler",
4902
- role: "developer_tool",
4903
- directTenantImport: false
6304
+ idSuffix: "storage.aws-region",
6305
+ canonicalName: "AWS_REGION",
6306
+ required: false,
6307
+ secret: false,
6308
+ public: false,
6309
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6310
+ description: "Tenant-owned AWS region for document/file ingestion."
4904
6311
  },
4905
6312
  {
4906
- packageName: "@lucern/react",
4907
- role: "runtime_entrypoint",
4908
- directTenantImport: true
6313
+ idSuffix: "observability.sentry-dsn",
6314
+ canonicalName: "NEXT_PUBLIC_SENTRY_DSN",
6315
+ aliases: ["NEXT_PUBLIC_SENTRY_DSN_NEXTJS", "SENTRY_DSN"],
6316
+ required: false,
6317
+ secret: false,
6318
+ public: true,
6319
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6320
+ description: "Tenant-owned Sentry DSN for app telemetry."
4909
6321
  },
4910
6322
  {
4911
- packageName: "@lucern/reasoning-kernel",
4912
- role: "component_runtime",
4913
- directTenantImport: false
6323
+ idSuffix: "observability.sentry-auth-token",
6324
+ canonicalName: "SENTRY_AUTH_TOKEN",
6325
+ required: false,
6326
+ secret: true,
6327
+ public: false,
6328
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6329
+ description: "Tenant-owned Sentry release token for app deployments."
4914
6330
  },
4915
6331
  {
4916
- packageName: "@lucern/sdk",
4917
- role: "runtime_entrypoint",
4918
- directTenantImport: true
6332
+ idSuffix: "observability.sentry-org",
6333
+ canonicalName: "SENTRY_ORG",
6334
+ aliases: ["SENTRY_ORG_SLUG"],
6335
+ required: false,
6336
+ secret: false,
6337
+ public: false,
6338
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6339
+ description: "Tenant-owned Sentry org slug for release uploads."
4919
6340
  },
4920
6341
  {
4921
- packageName: "@lucern/server-core",
4922
- role: "platform_runtime",
4923
- directTenantImport: false
6342
+ idSuffix: "observability.sentry-project",
6343
+ canonicalName: "SENTRY_PROJECT",
6344
+ aliases: ["SENTRY_PROJECT_NEXTJS"],
6345
+ required: false,
6346
+ secret: false,
6347
+ public: false,
6348
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6349
+ description: "Tenant-owned Sentry project slug for release uploads."
4924
6350
  },
4925
6351
  {
4926
- packageName: "@lucern/testing",
4927
- role: "test_support",
4928
- directTenantImport: false
6352
+ idSuffix: "observability.sentry-environment",
6353
+ canonicalName: "NEXT_PUBLIC_SENTRY_ENVIRONMENT",
6354
+ aliases: ["SENTRY_ENVIRONMENT"],
6355
+ required: false,
6356
+ secret: false,
6357
+ public: true,
6358
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6359
+ description: "Tenant-owned Sentry environment label."
4929
6360
  },
4930
6361
  {
4931
- packageName: "@lucern/types",
4932
- role: "contract_entrypoint",
4933
- directTenantImport: true
6362
+ idSuffix: "observability.sentry-release",
6363
+ canonicalName: "NEXT_PUBLIC_SENTRY_RELEASE",
6364
+ aliases: ["SENTRY_RELEASE"],
6365
+ required: false,
6366
+ secret: false,
6367
+ public: true,
6368
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6369
+ description: "Tenant-owned Sentry release label."
6370
+ },
6371
+ {
6372
+ idSuffix: "observability.sentry-client-options",
6373
+ canonicalName: "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE",
6374
+ aliases: [
6375
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS",
6376
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS_NEXTJS",
6377
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS",
6378
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS_NEXTJS",
6379
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS",
6380
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS_NEXTJS",
6381
+ "NEXT_PUBLIC_SENTRY_ENABLE_LOGS",
6382
+ "NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE",
6383
+ "NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE",
6384
+ "NEXT_PUBLIC_SENTRY_SEND_DEFAULT_PII",
6385
+ "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE_NEXTJS"
6386
+ ],
6387
+ required: false,
6388
+ secret: false,
6389
+ public: true,
6390
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6391
+ description: "Tenant-owned public Sentry tuning values for Next.js client instrumentation."
6392
+ },
6393
+ {
6394
+ idSuffix: "observability.sentry-webhook-secret",
6395
+ canonicalName: "SENTRY_WEBHOOK_SECRET",
6396
+ required: false,
6397
+ secret: true,
6398
+ public: false,
6399
+ consumers: ["tenant-convex-deployment", "tenant-observability"],
6400
+ description: "Tenant-owned Sentry webhook verification secret."
6401
+ },
6402
+ {
6403
+ idSuffix: "lucern.gateway-api-key",
6404
+ canonicalName: "LUCERN_API_KEY",
6405
+ aliases: ["STACK_API_KEY"],
6406
+ required: false,
6407
+ secret: true,
6408
+ public: false,
6409
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6410
+ description: "Tenant-scoped Lucern/MC gateway API key for product front-door calls."
6411
+ },
6412
+ {
6413
+ idSuffix: "lucern.gateway-base-url",
6414
+ canonicalName: "LUCERN_BASE_URL",
6415
+ aliases: ["LUCERN_API_BASE_URL", "LUCERN_GATEWAY_BASE_URL"],
6416
+ required: false,
6417
+ secret: false,
6418
+ public: false,
6419
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6420
+ description: "Lucern/MC gateway base URL used by tenant product apps."
6421
+ },
6422
+ {
6423
+ idSuffix: "lucern.proxy-token-secret",
6424
+ canonicalName: "LUCERN_PROXY_TOKEN_SECRET",
6425
+ required: false,
6426
+ secret: true,
6427
+ public: false,
6428
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6429
+ description: "Tenant-owned secret for signing internal proxy/session tokens in product apps."
6430
+ },
6431
+ {
6432
+ idSuffix: "tenant.integrations.linear-api-key",
6433
+ canonicalName: "LINEAR_API_KEY",
6434
+ required: false,
6435
+ secret: true,
6436
+ public: false,
6437
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6438
+ description: "Tenant-owned Linear API key for support/slash-command flows."
6439
+ },
6440
+ {
6441
+ idSuffix: "tenant.vercel.bypass-token",
6442
+ canonicalName: "VERCEL_AUTOMATION_BYPASS_SECRET",
6443
+ aliases: ["NEXT_PUBLIC_VERCEL_BYPASS_TOKEN"],
6444
+ required: false,
6445
+ secret: true,
6446
+ public: false,
6447
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6448
+ description: "Tenant-owned Vercel automation bypass token. Public alias is legacy and should be removed from app code."
4934
6449
  }
4935
6450
  ];
4936
- TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
4937
- (entry) => entry.packageName
6451
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.filter(
6452
+ (system) => TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS.includes(system.id)
6453
+ ).flatMap(
6454
+ (system) => TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES.map(
6455
+ (template) => ({
6456
+ id: `tenant.${system.id}.${template.idSuffix}`,
6457
+ canonicalName: template.canonicalName,
6458
+ aliases: "aliases" in template ? template.aliases : void 0,
6459
+ owner: "tenant",
6460
+ scope: "tenant",
6461
+ sourcePath: system.sharedSourcePath,
6462
+ environmentPolicy: "environment_specific",
6463
+ required: template.required,
6464
+ secret: template.secret,
6465
+ public: template.public,
6466
+ consumers: template.consumers,
6467
+ destinations: [
6468
+ {
6469
+ kind: "vercel",
6470
+ target: system.vercelProjectName,
6471
+ environmentPolicy: "preprod_staging_prod_prod"
6472
+ },
6473
+ {
6474
+ kind: "convex",
6475
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6476
+ environmentPolicy: "preprod_staging_prod_prod"
6477
+ },
6478
+ {
6479
+ kind: "github_actions",
6480
+ target: `${system.repository.owner}/${system.repository.name}`,
6481
+ environmentPolicy: "preprod_staging_prod_prod"
6482
+ }
6483
+ ],
6484
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6485
+ })
6486
+ )
6487
+ );
6488
+ function tenantVercelConvexUrlWriteNames(system) {
6489
+ const names = [system.convex.urlEnv, "NEXT_PUBLIC_CONVEX_URL"];
6490
+ if (system.id === "stack-eng") {
6491
+ return [...names, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6492
+ }
6493
+ return names;
6494
+ }
6495
+ function tenantRepositoryConvexUrlWriteNames(system) {
6496
+ if (system.id === "stack-eng") {
6497
+ return [system.convex.urlEnv, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6498
+ }
6499
+ return [system.convex.urlEnv];
6500
+ }
6501
+ function tenantRepositoryConvexDeployKeyWriteNames(system) {
6502
+ if (system.id === "stack-eng") {
6503
+ return [system.convex.deployKeyEnv, "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6504
+ }
6505
+ return [system.convex.deployKeyEnv];
6506
+ }
6507
+ function tenantConvexUrlAliases(system) {
6508
+ if (system.id === "stack-frontend") {
6509
+ return [
6510
+ "CONVEX_PROD_URL",
6511
+ "CONVEX_STACK_V2_PROD_URL",
6512
+ "CONVEX_STACK_V2_STAGING_URL",
6513
+ "STACK_CONVEX_URL"
6514
+ ];
6515
+ }
6516
+ if (system.id === "stackos") {
6517
+ return [
6518
+ "CONVEX_CLOUD_URL",
6519
+ "CONVEX_STACK_URL",
6520
+ "CONVEX_URL",
6521
+ "CONVEX_URL_DEVELOPMENT",
6522
+ "CONVEX_URL_PRODUCTION",
6523
+ "STACK_CONVEX_URL"
6524
+ ];
6525
+ }
6526
+ if (system.id === "stack-eng") {
6527
+ return ["STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6528
+ }
6529
+ if (system.id === "lucern-graph") {
6530
+ return [
6531
+ "CONVEX_GRAPH_URL",
6532
+ "LUCERN_PROD_URL",
6533
+ "NEXT_PUBLIC_LUCERN_GRAPH_URL"
6534
+ ];
6535
+ }
6536
+ return void 0;
6537
+ }
6538
+ function tenantConvexDeployKeyAliases(system) {
6539
+ if (system.id === "stack-frontend") {
6540
+ return [
6541
+ "CONVEX_STACK_V2_PROD_DEPLOY_KEY",
6542
+ "CONVEX_STACK_V2_STAGING_DEPLOY_KEY",
6543
+ "STACK_DEPLOY_KEY"
6544
+ ];
6545
+ }
6546
+ if (system.id === "stackos") {
6547
+ return [
6548
+ "CONVEX_DEPLOY_KEY",
6549
+ "CONVEX_DEV_DEPLOY_KEY",
6550
+ "CONVEX_PROD_DEPLOY_KEY",
6551
+ "CONVEX_STACK_DEPLOY_KEY",
6552
+ "STACK_DEPLOY_KEY"
6553
+ ];
6554
+ }
6555
+ if (system.id === "stack-eng") {
6556
+ return ["CONVEX_DEPLOY_KEY", "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6557
+ }
6558
+ if (system.id === "lucern-graph") {
6559
+ return [
6560
+ "CONVEX_DEPLOY_KEY",
6561
+ "CONVEX_GRAPH_DEPLOY_KEY",
6562
+ "LUCERN_CONVEX_DEPLOY_KEY",
6563
+ "LUCERN_DEV_DEPLOY_KEY",
6564
+ "LUCERN_PROD_DEPLOY_KEY"
6565
+ ];
6566
+ }
6567
+ return void 0;
6568
+ }
6569
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6570
+ (system) => {
6571
+ if (system.id === "lucern-graph") {
6572
+ return [
6573
+ {
6574
+ id: "tenant.lucern-graph.public.tenant-id",
6575
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_ID",
6576
+ aliases: ["NEXT_PUBLIC_LUCERN_TENANT_ID"],
6577
+ owner: "tenant",
6578
+ scope: "workspace",
6579
+ sourcePath: system.sharedSourcePath,
6580
+ environmentPolicy: "environment_specific",
6581
+ required: false,
6582
+ secret: false,
6583
+ public: true,
6584
+ consumers: ["tenant-vercel-app"],
6585
+ destinations: [
6586
+ {
6587
+ kind: "vercel",
6588
+ target: system.vercelProjectName,
6589
+ environmentPolicy: "preprod_staging_prod_prod"
6590
+ }
6591
+ ],
6592
+ description: "Lucern graph public tenant id used by the standalone graph explorer."
6593
+ },
6594
+ {
6595
+ id: "tenant.lucern-graph.public.tenant-label",
6596
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_LABEL",
6597
+ owner: "tenant",
6598
+ scope: "workspace",
6599
+ sourcePath: system.sharedSourcePath,
6600
+ environmentPolicy: "environment_specific",
6601
+ required: false,
6602
+ secret: false,
6603
+ public: true,
6604
+ consumers: ["tenant-vercel-app"],
6605
+ destinations: [
6606
+ {
6607
+ kind: "vercel",
6608
+ target: system.vercelProjectName,
6609
+ environmentPolicy: "preprod_staging_prod_prod"
6610
+ }
6611
+ ],
6612
+ description: "Lucern graph public tenant label used by the standalone graph explorer."
6613
+ }
6614
+ ];
6615
+ }
6616
+ if (system.id === "stack-eng") {
6617
+ return [
6618
+ {
6619
+ id: "tenant.stack-eng.public.tenant-id",
6620
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_ID",
6621
+ owner: "tenant",
6622
+ scope: "workspace",
6623
+ sourcePath: system.sharedSourcePath,
6624
+ environmentPolicy: "environment_specific",
6625
+ required: false,
6626
+ secret: false,
6627
+ public: true,
6628
+ consumers: ["tenant-vercel-app"],
6629
+ destinations: [
6630
+ {
6631
+ kind: "vercel",
6632
+ target: system.vercelProjectName,
6633
+ environmentPolicy: "preprod_staging_prod_prod"
6634
+ }
6635
+ ],
6636
+ description: "Stack engineering graph public tenant id used by the graph explorer."
6637
+ },
6638
+ {
6639
+ id: "tenant.stack-eng.public.tenant-label",
6640
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_LABEL",
6641
+ owner: "tenant",
6642
+ scope: "workspace",
6643
+ sourcePath: system.sharedSourcePath,
6644
+ environmentPolicy: "environment_specific",
6645
+ required: false,
6646
+ secret: false,
6647
+ public: true,
6648
+ consumers: ["tenant-vercel-app"],
6649
+ destinations: [
6650
+ {
6651
+ kind: "vercel",
6652
+ target: system.vercelProjectName,
6653
+ environmentPolicy: "preprod_staging_prod_prod"
6654
+ }
6655
+ ],
6656
+ description: "Stack engineering graph public tenant label used by the graph explorer."
6657
+ },
6658
+ {
6659
+ id: "tenant.stack-eng.public.environment",
6660
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_ENV",
6661
+ owner: "tenant",
6662
+ scope: "workspace",
6663
+ sourcePath: system.sharedSourcePath,
6664
+ environmentPolicy: "environment_specific",
6665
+ required: false,
6666
+ secret: false,
6667
+ public: true,
6668
+ consumers: ["tenant-vercel-app"],
6669
+ destinations: [
6670
+ {
6671
+ kind: "vercel",
6672
+ target: system.vercelProjectName,
6673
+ environmentPolicy: "preprod_staging_prod_prod"
6674
+ }
6675
+ ],
6676
+ description: "Stack engineering graph public environment label used by the graph explorer."
6677
+ }
6678
+ ];
6679
+ }
6680
+ return [];
6681
+ }
4938
6682
  );
6683
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap((system) => [
6684
+ {
6685
+ id: `tenant.${system.id}.convex.url`,
6686
+ canonicalName: system.convex.urlEnv,
6687
+ aliases: tenantConvexUrlAliases(system),
6688
+ owner: "tenant",
6689
+ scope: "software_system",
6690
+ sourcePath: system.sharedSourcePath,
6691
+ environmentPolicy: "preprod_staging_prod_prod",
6692
+ required: true,
6693
+ secret: false,
6694
+ public: false,
6695
+ consumers: [
6696
+ "tenant-vercel-app",
6697
+ "tenant-agent-runtime",
6698
+ "mc-operator-tooling"
6699
+ ],
6700
+ destinations: [
6701
+ {
6702
+ kind: "vercel",
6703
+ target: system.vercelProjectName,
6704
+ environmentPolicy: "preprod_staging_prod_prod",
6705
+ writeNames: tenantVercelConvexUrlWriteNames(system)
6706
+ },
6707
+ {
6708
+ kind: "github_actions",
6709
+ target: `${system.repository.owner}/${system.repository.name}`,
6710
+ environmentPolicy: "preprod_staging_prod_prod",
6711
+ writeNames: tenantRepositoryConvexUrlWriteNames(system),
6712
+ notes: "Only if that repository deploy/test workflow owns this software system."
6713
+ }
6714
+ ],
6715
+ description: `${system.tenantKey}/${system.workspaceKey} Convex URL. Pre-prod resolves to ${system.convex.preprodDeployment}; prod resolves to ${system.convex.prodDeployment}.`
6716
+ },
6717
+ {
6718
+ id: `tenant.${system.id}.convex.deploy-key`,
6719
+ canonicalName: system.convex.deployKeyEnv,
6720
+ aliases: tenantConvexDeployKeyAliases(system),
6721
+ owner: "tenant",
6722
+ scope: "software_system",
6723
+ sourcePath: system.sharedSourcePath,
6724
+ environmentPolicy: "preprod_staging_prod_prod",
6725
+ required: true,
6726
+ secret: true,
6727
+ public: false,
6728
+ consumers: [
6729
+ "tenant-vercel-app",
6730
+ "tenant-agent-runtime",
6731
+ "mc-operator-tooling"
6732
+ ],
6733
+ destinations: [
6734
+ {
6735
+ kind: "vercel",
6736
+ target: system.vercelProjectName,
6737
+ environmentPolicy: "preprod_staging_prod_prod"
6738
+ },
6739
+ {
6740
+ kind: "github_actions",
6741
+ target: `${system.repository.owner}/${system.repository.name}`,
6742
+ environmentPolicy: "preprod_staging_prod_prod",
6743
+ writeNames: tenantRepositoryConvexDeployKeyWriteNames(system),
6744
+ notes: "Only if that repository deploy/test workflow owns this software system."
6745
+ }
6746
+ ],
6747
+ description: `${system.tenantKey}/${system.workspaceKey} Convex deploy/admin key. Never route to sibling workspaces.`
6748
+ }
6749
+ ]);
4939
6750
  z.object({
4940
6751
  manifestVersion: z.literal("1.0.0"),
4941
6752
  rules: z.array(
@@ -4976,7 +6787,7 @@ var createEvidenceInputSchemaBase = z.object({
4976
6787
  targetId: z.string().optional(),
4977
6788
  targetNodeId: z.string().optional(),
4978
6789
  linkedBeliefNodeId: z.string().optional(),
4979
- evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
6790
+ evidenceRelation: z.enum(["supports", "contradicts"]).optional(),
4980
6791
  confidence: z.number().optional(),
4981
6792
  weight: z.number().optional(),
4982
6793
  reasoning: z.string().optional(),
@@ -5061,8 +6872,7 @@ var createEvidenceProjection = defineProjection({
5061
6872
  evidenceRelation: v.optional(
5062
6873
  v.union(
5063
6874
  v.literal("supports"),
5064
- v.literal("contradicts"),
5065
- v.literal("neutral")
6875
+ v.literal("contradicts")
5066
6876
  )
5067
6877
  ),
5068
6878
  confidence: v.optional(v.number()),
@@ -5111,12 +6921,17 @@ var listBeliefsProjection = defineProjection({
5111
6921
  });
5112
6922
  var taskStatusSchema = z.enum(["todo", "in_progress", "blocked", "done"]).optional().describe("Filter by task status");
5113
6923
  var listTasksInputSchema = z.object({
5114
- topicId: z.string().describe("Topic scope"),
6924
+ topicId: z.string().optional().describe("Topic scope"),
5115
6925
  worktreeId: z.string().optional().describe("Alias for linkedWorktreeId"),
5116
6926
  linkedWorktreeId: z.string().optional().describe("Filter to tasks linked to this worktree"),
5117
6927
  status: taskStatusSchema,
5118
6928
  limit: z.number().optional().describe("Maximum results")
5119
- });
6929
+ }).refine(
6930
+ (input) => Boolean(input.topicId || input.worktreeId || input.linkedWorktreeId),
6931
+ {
6932
+ message: "topicId or worktreeId is required"
6933
+ }
6934
+ );
5120
6935
  function compactRecord3(input) {
5121
6936
  return Object.fromEntries(
5122
6937
  Object.entries(input).filter(([, value]) => value !== void 0)
@@ -5133,7 +6948,7 @@ var listTasksProjection = defineProjection({
5133
6948
  linkedWorktreeId: input.linkedWorktreeId ?? input.worktreeId
5134
6949
  }),
5135
6950
  convexArgsValidator: v.object({
5136
- topicId: v.string(),
6951
+ topicId: v.optional(v.string()),
5137
6952
  status: v.optional(
5138
6953
  v.union(
5139
6954
  v.literal("todo"),
@@ -6137,7 +7952,7 @@ var CREATE_EDGE = {
6137
7952
  reasoningMethod: {
6138
7953
  type: "string",
6139
7954
  description: "How this was determined",
6140
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
7955
+ enum: [...REASONING_METHODS]
6141
7956
  },
6142
7957
  metadata: {
6143
7958
  type: "object",
@@ -7864,6 +9679,10 @@ var CREATE_TASK = {
7864
9679
  tags: {
7865
9680
  type: "array",
7866
9681
  description: "Free-form string tags"
9682
+ },
9683
+ metadata: {
9684
+ type: "object",
9685
+ description: "Structured task metadata for handoff context and routing hints"
7867
9686
  }
7868
9687
  },
7869
9688
  required: ["title"],
@@ -7937,6 +9756,10 @@ var UPDATE_TASK = {
7937
9756
  type: "string",
7938
9757
  description: "Updated status",
7939
9758
  enum: ["todo", "in_progress", "blocked", "done"]
9759
+ },
9760
+ metadata: {
9761
+ type: "object",
9762
+ description: "Structured task metadata to replace or refine"
7940
9763
  }
7941
9764
  },
7942
9765
  required: ["taskId"],
@@ -9392,6 +11215,9 @@ var BEGIN_BUILD_SESSION = {
9392
11215
  sessionMode: "string \u2014 async | interactive",
9393
11216
  targetBeliefIds: "array \u2014 scoped belief IDs",
9394
11217
  targetQuestionIds: "array \u2014 scoped question IDs",
11218
+ taskIds: "array \u2014 assigned task IDs for this worktree",
11219
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
11220
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
9395
11221
  topBeliefs: "array \u2014 highest-confidence scoped beliefs",
9396
11222
  openQuestions: "array \u2014 open scoped questions",
9397
11223
  resolvedDecisions: "array \u2014 answered questions summarized for the session",
@@ -9992,12 +11818,20 @@ function unwrapMcpParameterSchema(schema) {
9992
11818
  current = current._def.schema;
9993
11819
  continue;
9994
11820
  default:
9995
- return { schema: current, required, description: description ?? current.description };
11821
+ return {
11822
+ schema: current,
11823
+ required,
11824
+ description: description ?? current.description
11825
+ };
9996
11826
  }
9997
11827
  }
9998
11828
  }
9999
11829
  function mcpParameterFromZod(fieldName, schema, contractName) {
10000
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
11830
+ const {
11831
+ schema: unwrapped,
11832
+ required,
11833
+ description: schemaDescription
11834
+ } = unwrapMcpParameterSchema(schema);
10001
11835
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
10002
11836
  switch (unwrapped._def.typeName) {
10003
11837
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -10042,10 +11876,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
10042
11876
  const entries2 = Object.entries(getObjectShape(args)).sort(
10043
11877
  ([left], [right]) => left.localeCompare(right)
10044
11878
  );
10045
- const converted = entries2.map(([fieldName, schema]) => [
10046
- fieldName,
10047
- mcpParameterFromZod(fieldName, schema, contractName)
10048
- ]);
11879
+ const converted = entries2.map(
11880
+ ([fieldName, schema]) => [
11881
+ fieldName,
11882
+ mcpParameterFromZod(fieldName, schema, contractName)
11883
+ ]
11884
+ );
10049
11885
  return {
10050
11886
  ...base,
10051
11887
  parameters: Object.fromEntries(
@@ -10157,6 +11993,7 @@ function surfaceContract(args) {
10157
11993
  allowedPrincipalTypes: ["user", "service", "agent"]
10158
11994
  },
10159
11995
  convex: args.convex,
11996
+ gateway: args.gateway,
10160
11997
  args: canonicalArgs,
10161
11998
  returns: canonicalReturns,
10162
11999
  input,
@@ -10643,7 +12480,7 @@ var beliefsContracts = [
10643
12480
  })
10644
12481
  ];
10645
12482
  var jsonRecordSchema4 = z.record(z.unknown());
10646
- var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
12483
+ var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
10647
12484
  var createEvidenceArgs = z.object({
10648
12485
  topicId: z.string().optional().describe("Topic scope for the evidence."),
10649
12486
  text: z.string().describe("Canonical evidence text."),
@@ -12566,7 +14403,8 @@ var createTaskArgs = z.object({
12566
14403
  linkedQuestionId: z.string().optional().describe("Question this task addresses."),
12567
14404
  assigneeId: z.string().optional().describe("Principal assigned to the task."),
12568
14405
  dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
12569
- tags: z.array(z.string()).optional().describe("Free-form tags.")
14406
+ tags: z.array(z.string()).optional().describe("Free-form tags."),
14407
+ metadata: z.record(z.unknown()).optional().describe("Structured task metadata for handoff context and routing hints.")
12570
14408
  });
12571
14409
  var createTaskInput = (input) => compactRecord4({
12572
14410
  title: input.title,
@@ -12580,7 +14418,8 @@ var createTaskInput = (input) => compactRecord4({
12580
14418
  linkedQuestionId: input.linkedQuestionId,
12581
14419
  assigneeId: input.assigneeId,
12582
14420
  dueDate: input.dueDate,
12583
- tags: input.tags
14421
+ tags: input.tags,
14422
+ metadata: input.metadata
12584
14423
  });
12585
14424
  var taskInput = (input) => compactRecord4({
12586
14425
  ...input,
@@ -12597,8 +14436,7 @@ var taskTopicInput = (input) => {
12597
14436
  };
12598
14437
  var completeTaskInput = (input) => compactRecord4({
12599
14438
  taskId: input.taskId ?? input.id,
12600
- outputSummary: input.outputSummary ?? input.summary,
12601
- userId: input.userId
14439
+ outputSummary: input.outputSummary ?? input.summary
12602
14440
  });
12603
14441
  var tasksContracts = [
12604
14442
  surfaceContract({
@@ -12616,6 +14454,7 @@ var tasksContracts = [
12616
14454
  kind: "mutation",
12617
14455
  inputProjection: createTaskInput
12618
14456
  },
14457
+ gateway: { handler: "tasks.create" },
12619
14458
  args: createTaskArgs
12620
14459
  }),
12621
14460
  surfaceContract({
@@ -12634,6 +14473,7 @@ var tasksContracts = [
12634
14473
  kind: "query",
12635
14474
  inputProjection: taskTopicInput
12636
14475
  },
14476
+ gateway: { handler: "tasks.list" },
12637
14477
  args: listTasksInputSchema
12638
14478
  }),
12639
14479
  surfaceContract({
@@ -12651,7 +14491,8 @@ var tasksContracts = [
12651
14491
  functionName: "update",
12652
14492
  kind: "mutation",
12653
14493
  inputProjection: taskInput
12654
- }
14494
+ },
14495
+ gateway: { handler: "tasks.update" }
12655
14496
  }),
12656
14497
  surfaceContract({
12657
14498
  name: "complete_task",
@@ -12667,12 +14508,14 @@ var tasksContracts = [
12667
14508
  functionName: "complete",
12668
14509
  kind: "mutation",
12669
14510
  inputProjection: completeTaskInput
12670
- }
14511
+ },
14512
+ gateway: { handler: "tasks.complete" }
12671
14513
  })
12672
14514
  ];
12673
14515
  var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
12674
14516
  (policy) => policy.edgeType
12675
14517
  );
14518
+ var REASONING_METHOD_TYPES = [...REASONING_METHODS];
12676
14519
  var createEdgeArgs = z.object({
12677
14520
  from: GraphRefSchema,
12678
14521
  to: GraphRefSchema,
@@ -12682,6 +14525,7 @@ var createEdgeArgs = z.object({
12682
14525
  confidence: z.number().optional(),
12683
14526
  context: z.string().optional(),
12684
14527
  reasoning: z.string().optional(),
14528
+ reasoningMethod: z.enum(REASONING_METHOD_TYPES).optional(),
12685
14529
  derivationType: z.string().optional(),
12686
14530
  metadata: z.record(z.unknown()).optional(),
12687
14531
  topicId: z.string().optional(),
@@ -12760,6 +14604,7 @@ var edgesContracts = [
12760
14604
  weight: parsed.weight,
12761
14605
  confidence: parsed.confidence,
12762
14606
  context: parsed.context ?? parsed.reasoning,
14607
+ reasoningMethod: parsed.reasoningMethod,
12763
14608
  derivationType: parsed.derivationType,
12764
14609
  metadata: parsed.metadata,
12765
14610
  skipLayerValidation: true,
@@ -12884,6 +14729,7 @@ var edgesContracts = [
12884
14729
  weight: edge.weight,
12885
14730
  confidence: edge.confidence,
12886
14731
  context: edge.context ?? edge.reasoning,
14732
+ reasoningMethod: edge.reasoningMethod,
12887
14733
  derivationType: edge.derivationType,
12888
14734
  metadata: edge.metadata,
12889
14735
  topicId: edge.topicId
@@ -13618,6 +15464,69 @@ var pipelineContracts = [
13618
15464
  }
13619
15465
  })
13620
15466
  ];
15467
+ function isRecord3(value) {
15468
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15469
+ }
15470
+ function stringValues(value) {
15471
+ if (typeof value === "string") {
15472
+ return [value];
15473
+ }
15474
+ if (Array.isArray(value)) {
15475
+ return value.flatMap((item) => stringValues(item));
15476
+ }
15477
+ return [];
15478
+ }
15479
+ function nestedEvidenceRows(value) {
15480
+ if (Array.isArray(value)) {
15481
+ return value.flatMap((item) => nestedEvidenceRows(item));
15482
+ }
15483
+ if (!isRecord3(value)) {
15484
+ return [];
15485
+ }
15486
+ const nestedKeys = ["evidence", "items", "nodes"];
15487
+ const nestedRows = nestedKeys.flatMap((key) => nestedEvidenceRows(value[key]));
15488
+ return nestedRows.length > 0 ? nestedRows : [value];
15489
+ }
15490
+ function isFailedAttemptRow(row) {
15491
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15492
+ return metadata?.failedApproach === true || metadata?.isFailedAttempt === true;
15493
+ }
15494
+ function failureLogSearchFields(row) {
15495
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15496
+ return [
15497
+ ...stringValues(row.id),
15498
+ ...stringValues(row._id),
15499
+ ...stringValues(row.title),
15500
+ ...stringValues(row.text),
15501
+ ...stringValues(row.canonicalText),
15502
+ ...stringValues(row.content),
15503
+ ...stringValues(metadata?.codeAnchor),
15504
+ ...stringValues(metadata?.codeAnchors),
15505
+ ...stringValues(metadata?.anchor),
15506
+ ...stringValues(metadata?.anchors),
15507
+ ...stringValues(metadata?.filePath),
15508
+ ...stringValues(metadata?.filePaths),
15509
+ ...stringValues(metadata?.path),
15510
+ ...stringValues(metadata?.paths),
15511
+ ...stringValues(metadata?.sourceRef),
15512
+ ...stringValues(metadata?.touchedPaths)
15513
+ ];
15514
+ }
15515
+ function projectFailureLog(output, input) {
15516
+ const rawQuery = typeof input.query === "string" && input.query.trim().length > 0 ? input.query.trim() : void 0;
15517
+ const searchKey = rawQuery?.toLowerCase();
15518
+ const failures = nestedEvidenceRows(output).filter((row) => isFailedAttemptRow(row)).filter(
15519
+ (row) => !searchKey ? true : failureLogSearchFields(row).some(
15520
+ (field) => field.toLowerCase().includes(searchKey)
15521
+ )
15522
+ );
15523
+ return {
15524
+ query: rawQuery,
15525
+ failures,
15526
+ totalFound: failures.length,
15527
+ showing: failures.length
15528
+ };
15529
+ }
13621
15530
  var recordScopeLearningArgs = z.object({
13622
15531
  topicId: z.string().optional().describe("Topic scope ID"),
13623
15532
  summary: z.string().describe("Atomic learning statement"),
@@ -13707,6 +15616,8 @@ var attemptInput = (input, context) => withUserId(
13707
15616
  tags: ["code_attempt"],
13708
15617
  metadata: compactRecord4({
13709
15618
  ...recordValue2(input.metadata),
15619
+ failedApproach: true,
15620
+ isFailedAttempt: true,
13710
15621
  filePaths: input.filePaths,
13711
15622
  filePath: input.filePath,
13712
15623
  errorMessage: input.errorMessage,
@@ -13837,7 +15748,8 @@ var codingContracts = [
13837
15748
  limit: input.limit,
13838
15749
  status: input.status,
13839
15750
  userId: input.userId
13840
- })
15751
+ }),
15752
+ outputProjection: (output, input) => projectFailureLog(output, input)
13841
15753
  }
13842
15754
  })
13843
15755
  ];
@@ -14299,14 +16211,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14299
16211
  description: "Worktrees are tenant/runtime planning data."
14300
16212
  },
14301
16213
  {
14302
- component: "identity",
16214
+ component: "control-plane",
14303
16215
  table: "agents",
14304
16216
  prepopulation: "runtime_bootstrap",
14305
16217
  copyMode: "none",
14306
16218
  description: "Service agents are provisioned per tenant or service, not copied."
14307
16219
  },
14308
16220
  {
14309
- component: "identity",
16221
+ component: "control-plane",
14310
16222
  table: "mcpWritePolicy",
14311
16223
  prepopulation: "required_template",
14312
16224
  copyMode: "template_global",
@@ -14315,14 +16227,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14315
16227
  description: "Global write policy defaults govern service and interactive MCP writes."
14316
16228
  },
14317
16229
  {
14318
- component: "identity",
16230
+ component: "control-plane",
14319
16231
  table: "modelCallLogs",
14320
16232
  prepopulation: "runtime_log",
14321
16233
  copyMode: "none",
14322
16234
  description: "Model call logs are runtime telemetry."
14323
16235
  },
14324
16236
  {
14325
- component: "identity",
16237
+ component: "control-plane",
14326
16238
  table: "modelFunctionSlots",
14327
16239
  prepopulation: "required_template",
14328
16240
  copyMode: "template_global",
@@ -14331,7 +16243,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14331
16243
  description: "Function-to-model slots are required by model runtime resolution."
14332
16244
  },
14333
16245
  {
14334
- component: "identity",
16246
+ component: "control-plane",
14335
16247
  table: "modelRegistry",
14336
16248
  prepopulation: "required_template",
14337
16249
  copyMode: "template_global",
@@ -14340,7 +16252,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14340
16252
  description: "Model catalog defaults are required by model runtime clients."
14341
16253
  },
14342
16254
  {
14343
- component: "identity",
16255
+ component: "control-plane",
14344
16256
  table: "modelSlotConfigs",
14345
16257
  prepopulation: "required_template",
14346
16258
  copyMode: "template_global",
@@ -14349,14 +16261,105 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14349
16261
  description: "Slot-level defaults are required before tenant overrides exist."
14350
16262
  },
14351
16263
  {
14352
- component: "identity",
16264
+ component: "control-plane",
16265
+ table: "permitAccessReviewItems",
16266
+ prepopulation: "runtime_data",
16267
+ copyMode: "none",
16268
+ description: "Permit access-review item rows are tenant review data projected from Permit."
16269
+ },
16270
+ {
16271
+ component: "control-plane",
16272
+ table: "permitAccessReviews",
16273
+ prepopulation: "runtime_data",
16274
+ copyMode: "none",
16275
+ description: "Permit access-review campaigns are tenant review data projected from Permit."
16276
+ },
16277
+ {
16278
+ component: "control-plane",
16279
+ table: "permitAttributeBindings",
16280
+ prepopulation: "runtime_data",
16281
+ copyMode: "none",
16282
+ description: "Permit ABAC attribute bindings are tenant policy projection rows."
16283
+ },
16284
+ {
16285
+ component: "control-plane",
16286
+ table: "permitGroups",
16287
+ prepopulation: "runtime_data",
16288
+ copyMode: "none",
16289
+ description: "Permit groups are tenant-defined policy subjects, not template data."
16290
+ },
16291
+ {
16292
+ component: "control-plane",
16293
+ table: "permitGroupMemberships",
16294
+ prepopulation: "runtime_data",
16295
+ copyMode: "none",
16296
+ description: "Permit group memberships are tenant-specific policy projection rows."
16297
+ },
16298
+ {
16299
+ component: "control-plane",
16300
+ table: "permitPolicyBundles",
16301
+ prepopulation: "runtime_derived",
16302
+ copyMode: "none",
16303
+ description: "Permit policy bundles are derived from the Permit control plane."
16304
+ },
16305
+ {
16306
+ component: "control-plane",
16307
+ table: "permitPolicyDecisionReceipts",
16308
+ prepopulation: "runtime_log",
16309
+ copyMode: "none",
16310
+ description: "Permit decision receipts are runtime authorization audit logs."
16311
+ },
16312
+ {
16313
+ component: "control-plane",
16314
+ table: "permitPrincipalAliases",
16315
+ prepopulation: "runtime_data",
16316
+ copyMode: "none",
16317
+ description: "Permit principal aliases are tenant-specific identity projection rows."
16318
+ },
16319
+ {
16320
+ component: "control-plane",
16321
+ table: "permitPrincipals",
16322
+ prepopulation: "runtime_data",
16323
+ copyMode: "none",
16324
+ description: "Permit principals are projected from Clerk, Permit, and tenant onboarding flows."
16325
+ },
16326
+ {
16327
+ component: "control-plane",
16328
+ table: "permitProjectionOutbox",
16329
+ prepopulation: "runtime_queue",
16330
+ copyMode: "none",
16331
+ description: "Permit projection outbox rows are runtime sync queue data."
16332
+ },
16333
+ {
16334
+ component: "control-plane",
16335
+ table: "permitRelationshipTuples",
16336
+ prepopulation: "runtime_data",
16337
+ copyMode: "none",
16338
+ description: "Permit ReBAC relationship tuples are tenant policy projection rows."
16339
+ },
16340
+ {
16341
+ component: "control-plane",
16342
+ table: "permitResourceInstances",
16343
+ prepopulation: "runtime_data",
16344
+ copyMode: "none",
16345
+ description: "Permit resource instances are tenant/workspace graph and deployment projection rows."
16346
+ },
16347
+ {
16348
+ component: "control-plane",
16349
+ table: "permitRoleAssignments",
16350
+ prepopulation: "runtime_data",
16351
+ copyMode: "none",
16352
+ description: "Permit role assignments are tenant-specific policy projection rows."
16353
+ },
16354
+ {
16355
+ component: "control-plane",
14353
16356
  table: "platformAudienceGrants",
14354
16357
  prepopulation: "runtime_data",
14355
16358
  copyMode: "none",
14356
16359
  description: "Audience grants are principal/group-specific access rows."
14357
16360
  },
14358
16361
  {
14359
- component: "identity",
16362
+ component: "control-plane",
14360
16363
  table: "platformAudiences",
14361
16364
  prepopulation: "required_template",
14362
16365
  copyMode: "template_tenant_rewrite",
@@ -14365,35 +16368,35 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14365
16368
  description: "Default tenant audience taxonomy rows are rewritten into each tenant."
14366
16369
  },
14367
16370
  {
14368
- component: "identity",
16371
+ component: "control-plane",
14369
16372
  table: "platformPolicyDecisionLogs",
14370
16373
  prepopulation: "runtime_log",
14371
16374
  copyMode: "none",
14372
16375
  description: "Policy decisions are runtime audit logs."
14373
16376
  },
14374
16377
  {
14375
- component: "identity",
16378
+ component: "control-plane",
14376
16379
  table: "projectGrants",
14377
16380
  prepopulation: "runtime_data",
14378
16381
  copyMode: "none",
14379
16382
  description: "Project/topic grants are principal or group-specific access rows."
14380
16383
  },
14381
16384
  {
14382
- component: "identity",
16385
+ component: "control-plane",
14383
16386
  table: "reasoningPermissions",
14384
16387
  prepopulation: "runtime_data",
14385
16388
  copyMode: "none",
14386
16389
  description: "Reasoning permissions are principal-specific policy rows."
14387
16390
  },
14388
16391
  {
14389
- component: "identity",
16392
+ component: "control-plane",
14390
16393
  table: "tenantApiKeys",
14391
16394
  prepopulation: "runtime_secret",
14392
16395
  copyMode: "none",
14393
16396
  description: "API keys are tenant credentials and must never be copied."
14394
16397
  },
14395
16398
  {
14396
- component: "identity",
16399
+ component: "control-plane",
14397
16400
  table: "tenantConfig",
14398
16401
  prepopulation: "required_template",
14399
16402
  copyMode: "template_tenant_rewrite",
@@ -14402,7 +16405,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14402
16405
  description: "Tenant-local config defaults are rewritten during bootstrap."
14403
16406
  },
14404
16407
  {
14405
- component: "identity",
16408
+ component: "control-plane",
14406
16409
  table: "tenantIntegrations",
14407
16410
  prepopulation: "required_template",
14408
16411
  copyMode: "template_tenant_rewrite",
@@ -14411,14 +16414,21 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14411
16414
  description: "Non-secret integration descriptors are rewritten into each tenant."
14412
16415
  },
14413
16416
  {
14414
- component: "identity",
16417
+ component: "control-plane",
14415
16418
  table: "tenantModelSlotBindings",
14416
16419
  prepopulation: "runtime_secret",
14417
16420
  copyMode: "none",
14418
16421
  description: "Tenant model slot bindings reference provider secrets and are runtime-only."
14419
16422
  },
14420
16423
  {
14421
- component: "identity",
16424
+ component: "control-plane",
16425
+ table: "tenantPermitSyncStates",
16426
+ prepopulation: "runtime_derived",
16427
+ copyMode: "none",
16428
+ description: "Tenant Permit sync state rows are runtime reconciliation state."
16429
+ },
16430
+ {
16431
+ component: "control-plane",
14422
16432
  table: "tenantPolicies",
14423
16433
  prepopulation: "required_template",
14424
16434
  copyMode: "template_tenant_rewrite",
@@ -14427,42 +16437,42 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14427
16437
  description: "Default tenant policy roles are rewritten during bootstrap."
14428
16438
  },
14429
16439
  {
14430
- component: "identity",
16440
+ component: "control-plane",
14431
16441
  table: "tenantProviderSecrets",
14432
16442
  prepopulation: "runtime_secret",
14433
16443
  copyMode: "none",
14434
16444
  description: "Provider secrets are credentials and must never be copied."
14435
16445
  },
14436
16446
  {
14437
- component: "identity",
16447
+ component: "control-plane",
14438
16448
  table: "tenantProxyGatewayUsage",
14439
16449
  prepopulation: "runtime_log",
14440
16450
  copyMode: "none",
14441
16451
  description: "Proxy gateway usage rows are runtime telemetry."
14442
16452
  },
14443
16453
  {
14444
- component: "identity",
16454
+ component: "control-plane",
14445
16455
  table: "tenantProxyTokenMints",
14446
16456
  prepopulation: "runtime_secret",
14447
16457
  copyMode: "none",
14448
16458
  description: "Proxy token mints are ephemeral secret-bearing runtime rows."
14449
16459
  },
14450
16460
  {
14451
- component: "identity",
16461
+ component: "control-plane",
14452
16462
  table: "tenantSandboxAuditEvents",
14453
16463
  prepopulation: "runtime_log",
14454
16464
  copyMode: "none",
14455
16465
  description: "Sandbox audit rows are runtime security logs."
14456
16466
  },
14457
16467
  {
14458
- component: "identity",
16468
+ component: "control-plane",
14459
16469
  table: "tenantSecrets",
14460
16470
  prepopulation: "runtime_secret",
14461
16471
  copyMode: "none",
14462
16472
  description: "Tenant secrets are credentials and must never be copied."
14463
16473
  },
14464
16474
  {
14465
- component: "identity",
16475
+ component: "control-plane",
14466
16476
  table: "toolAcls",
14467
16477
  prepopulation: "required_template",
14468
16478
  copyMode: "template_global",
@@ -14471,7 +16481,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14471
16481
  description: "Default role-to-tool grants are required for SDK/MCP tool access."
14472
16482
  },
14473
16483
  {
14474
- component: "identity",
16484
+ component: "control-plane",
14475
16485
  table: "toolRegistry",
14476
16486
  prepopulation: "required_template",
14477
16487
  copyMode: "template_global",
@@ -14480,7 +16490,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14480
16490
  description: "Core tool catalog rows are required before pack or tenant tools exist."
14481
16491
  },
14482
16492
  {
14483
- component: "identity",
16493
+ component: "control-plane",
14484
16494
  table: "users",
14485
16495
  prepopulation: "runtime_bootstrap",
14486
16496
  copyMode: "none",