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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/outbox.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: [
@@ -783,7 +797,7 @@ defineTable({
783
797
  });
784
798
  defineTable({
785
799
  name: "agents",
786
- component: "identity",
800
+ component: "control-plane",
787
801
  category: "agent",
788
802
  shape: z.object({
789
803
  "slug": z.string(),
@@ -814,6 +828,7 @@ defineTable({
814
828
  category: "tenant",
815
829
  shape: z.object({
816
830
  "tenantId": idOf("tenants"),
831
+ "workspaceId": idOf("workspaces").optional(),
817
832
  "keyPrefix": z.enum(["luc", "stk"]),
818
833
  "keyHash": z.string(),
819
834
  "keyHint": z.string(),
@@ -841,7 +856,7 @@ defineTable({
841
856
  shape: z.object({
842
857
  "tenantId": idOf("tenants").optional(),
843
858
  "apiKeyId": idOf("apiKeys").optional(),
844
- "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"]),
859
+ "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"]),
845
860
  "actorClerkId": z.string(),
846
861
  "details": z.any().optional(),
847
862
  "createdAt": z.number()
@@ -1720,29 +1735,37 @@ defineTable({
1720
1735
  component: "mc",
1721
1736
  category: "runtime",
1722
1737
  shape: z.object({
1723
- "shimId": z.string(),
1724
- "gateId": z.string(),
1725
- "removalDate": z.string(),
1726
- "removalPriority": z.enum(["P1", "P2", "P3"]),
1727
- "description": z.string(),
1728
- "owner": z.string(),
1729
- "createdAt": z.string(),
1730
- "status": z.enum(["active", "overdue", "removed"]),
1731
- "bridgeType": z.enum(["tool", "agent"]),
1732
- "bridgeTarget": z.object({
1733
- "type": z.enum(["tool", "agent"]),
1734
- "legacyPath": z.string(),
1735
- "harnessPath": z.string()
1738
+ shimId: z.string(),
1739
+ gateId: z.string(),
1740
+ removalDate: z.string(),
1741
+ removalPriority: z.enum(["P1", "P2", "P3"]),
1742
+ description: z.string(),
1743
+ owner: z.string(),
1744
+ createdAt: z.string(),
1745
+ status: z.enum(["active", "overdue", "removed"]),
1746
+ bridgeType: z.enum(["tool", "agent"]),
1747
+ bridgeTarget: z.object({
1748
+ type: z.enum(["tool", "agent"]),
1749
+ legacyPath: z.string(),
1750
+ harnessPath: z.string()
1736
1751
  }),
1737
- "shimBehavior": z.enum(["passthrough_with_logging", "adapter", "feature_flag_gate"]),
1738
- "producesLedgerEntries": z.boolean(),
1739
- "lastAuditedAt": z.number(),
1740
- "metadata": z.record(z.any()).optional()
1752
+ shimBehavior: z.enum([
1753
+ "passthrough_with_logging",
1754
+ "adapter",
1755
+ "feature_flag_gate"
1756
+ ]),
1757
+ producesLedgerEntries: z.boolean(),
1758
+ lastAuditedAt: z.number(),
1759
+ metadata: z.record(z.any()).optional()
1741
1760
  }),
1742
1761
  indices: [
1743
1762
  { kind: "index", name: "by_shimId", columns: ["shimId"] },
1744
1763
  { kind: "index", name: "by_status", columns: ["status"] },
1745
- { kind: "index", name: "by_bridgeType_status", columns: ["bridgeType", "status"] }
1764
+ {
1765
+ kind: "index",
1766
+ name: "by_bridgeType_status",
1767
+ columns: ["bridgeType", "status"]
1768
+ }
1746
1769
  ]
1747
1770
  });
1748
1771
  defineTable({
@@ -1750,12 +1773,23 @@ defineTable({
1750
1773
  component: "mc",
1751
1774
  category: "runtime",
1752
1775
  shape: z.object({
1753
- "domain": z.enum(["graph", "schema", "identity", "policy", "audit", "admin", "agent", "tool", "prompt", "intelligence"]),
1754
- "state": z.enum(["legacy", "cutover", "disabled"]),
1755
- "metadata": z.record(z.any()).optional(),
1756
- "updatedBy": z.string(),
1757
- "createdAt": z.number(),
1758
- "updatedAt": z.number()
1776
+ domain: z.enum([
1777
+ "graph",
1778
+ "schema",
1779
+ "identity",
1780
+ "policy",
1781
+ "audit",
1782
+ "admin",
1783
+ "agent",
1784
+ "tool",
1785
+ "prompt",
1786
+ "intelligence"
1787
+ ]),
1788
+ state: z.enum(["legacy", "cutover", "disabled"]),
1789
+ metadata: z.record(z.any()).optional(),
1790
+ updatedBy: z.string(),
1791
+ createdAt: z.number(),
1792
+ updatedAt: z.number()
1759
1793
  }),
1760
1794
  indices: [
1761
1795
  { kind: "index", name: "by_domain", columns: ["domain"] },
@@ -1767,57 +1801,193 @@ defineTable({
1767
1801
  component: "mc",
1768
1802
  category: "runtime",
1769
1803
  shape: z.object({
1770
- "credentialRef": z.string(),
1771
- "tenantId": idOf("tenants"),
1772
- "target": z.enum(["kernelDeployment", "appDeployment"]),
1773
- "environment": z.enum(["dev", "staging", "prod"]),
1774
- "encryptedDeployKey": z.string(),
1775
- "encryptionVersion": z.string(),
1776
- "keyFingerprint": z.string(),
1777
- "keyHint": z.string(),
1778
- "status": z.enum(["active", "revoked"]),
1779
- "rotatedFromCredentialRef": z.string().optional(),
1780
- "revokedAt": z.number().optional(),
1781
- "revokedBy": z.string().optional(),
1782
- "lastUsedAt": z.number().optional(),
1783
- "metadata": z.record(z.any()).optional(),
1784
- "createdBy": z.string(),
1785
- "createdAt": z.number(),
1786
- "updatedAt": z.number()
1804
+ credentialRef: z.string(),
1805
+ tenantId: idOf("tenants"),
1806
+ workspaceId: idOf("workspaces").optional(),
1807
+ target: z.enum(["kernelDeployment", "appDeployment"]),
1808
+ environment: z.enum(["dev", "staging", "prod"]),
1809
+ encryptedDeployKey: z.string(),
1810
+ encryptionVersion: z.string(),
1811
+ keyFingerprint: z.string(),
1812
+ keyHint: z.string(),
1813
+ status: z.enum(["active", "revoked"]),
1814
+ rotatedFromCredentialRef: z.string().optional(),
1815
+ revokedAt: z.number().optional(),
1816
+ revokedBy: z.string().optional(),
1817
+ lastUsedAt: z.number().optional(),
1818
+ metadata: z.record(z.any()).optional(),
1819
+ createdBy: z.string(),
1820
+ createdAt: z.number(),
1821
+ updatedAt: z.number()
1787
1822
  }),
1788
1823
  indices: [
1789
1824
  { kind: "index", name: "by_credentialRef", columns: ["credentialRef"] },
1790
1825
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1791
- { kind: "index", name: "by_tenant_target", columns: ["tenantId", "target"] },
1792
- { kind: "index", name: "by_tenant_target_environment", columns: ["tenantId", "target", "environment"] },
1793
- { kind: "index", name: "by_tenant_target_environment_status", columns: ["tenantId", "target", "environment", "status"] },
1826
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
1827
+ {
1828
+ kind: "index",
1829
+ name: "by_tenant_target",
1830
+ columns: ["tenantId", "target"]
1831
+ },
1832
+ {
1833
+ kind: "index",
1834
+ name: "by_tenant_target_environment",
1835
+ columns: ["tenantId", "target", "environment"]
1836
+ },
1837
+ {
1838
+ kind: "index",
1839
+ name: "by_tenant_target_environment_status",
1840
+ columns: ["tenantId", "target", "environment", "status"]
1841
+ },
1842
+ {
1843
+ kind: "index",
1844
+ name: "by_tenant_workspace_target_environment_status",
1845
+ columns: ["tenantId", "workspaceId", "target", "environment", "status"]
1846
+ },
1794
1847
  { kind: "index", name: "by_status", columns: ["status"] }
1795
1848
  ]
1796
1849
  });
1850
+ defineTable({
1851
+ name: "permitSyncStates",
1852
+ component: "mc",
1853
+ category: "runtime",
1854
+ shape: z.object({
1855
+ syncKey: z.string(),
1856
+ objectType: z.enum([
1857
+ "resource",
1858
+ "role",
1859
+ "resource_role",
1860
+ "resource_relation",
1861
+ "tenant",
1862
+ "workspace",
1863
+ "principal",
1864
+ "membership",
1865
+ "group",
1866
+ "resource_instance",
1867
+ "relationship_tuple",
1868
+ "role_assignment"
1869
+ ]),
1870
+ objectId: z.string(),
1871
+ tenantId: idOf("tenants").optional(),
1872
+ workspaceId: idOf("workspaces").optional(),
1873
+ principalId: z.string().optional(),
1874
+ permitTenantKey: z.string().optional(),
1875
+ permitResourceType: z.string().optional(),
1876
+ permitResourceKey: z.string().optional(),
1877
+ desiredPayload: z.record(z.any()),
1878
+ lastAppliedPayloadHash: z.string().optional(),
1879
+ status: z.enum(["pending", "synced", "error", "skipped"]),
1880
+ attemptCount: z.number(),
1881
+ lastError: z.string().optional(),
1882
+ nextAttemptAt: z.number().optional(),
1883
+ lastSyncedAt: z.number().optional(),
1884
+ createdBy: z.string(),
1885
+ updatedBy: z.string().optional(),
1886
+ createdAt: z.number(),
1887
+ updatedAt: z.number()
1888
+ }),
1889
+ indices: [
1890
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
1891
+ { kind: "index", name: "by_status", columns: ["status"] },
1892
+ {
1893
+ kind: "index",
1894
+ name: "by_tenant_status",
1895
+ columns: ["tenantId", "status"]
1896
+ },
1897
+ {
1898
+ kind: "index",
1899
+ name: "by_workspace_status",
1900
+ columns: ["workspaceId", "status"]
1901
+ },
1902
+ {
1903
+ kind: "index",
1904
+ name: "by_principal_status",
1905
+ columns: ["principalId", "status"]
1906
+ }
1907
+ ]
1908
+ });
1909
+ defineTable({
1910
+ name: "secretSyncDriftReports",
1911
+ component: "mc",
1912
+ category: "runtime",
1913
+ shape: z.object({
1914
+ reportId: z.string(),
1915
+ source: z.enum(["infisical_manifest", "manual", "ci"]),
1916
+ generatedAt: z.number(),
1917
+ recordedAt: z.number(),
1918
+ recordedBy: z.string(),
1919
+ status: z.enum([
1920
+ "in_sync",
1921
+ "drift",
1922
+ "exception",
1923
+ "blocked",
1924
+ "not_observed"
1925
+ ]),
1926
+ reportHash: z.string(),
1927
+ manifestHash: z.string().optional(),
1928
+ dryRunReceiptId: z.string().optional(),
1929
+ appliedReceiptId: z.string().optional(),
1930
+ summary: z.object({
1931
+ totalPipelines: z.number(),
1932
+ inSync: z.number(),
1933
+ drift: z.number(),
1934
+ exception: z.number(),
1935
+ blocked: z.number(),
1936
+ notObserved: z.number(),
1937
+ missingKeys: z.number(),
1938
+ valueDriftKeys: z.number(),
1939
+ extraKeys: z.number(),
1940
+ deniedConvexLeakage: z.number(),
1941
+ approvedExceptions: z.number()
1942
+ }),
1943
+ redactedReport: z.record(z.any()),
1944
+ metadata: z.record(z.any()).optional()
1945
+ }),
1946
+ indices: [
1947
+ { kind: "index", name: "by_reportId", columns: ["reportId"] },
1948
+ { kind: "index", name: "by_reportHash", columns: ["reportHash"] },
1949
+ { kind: "index", name: "by_generatedAt", columns: ["generatedAt"] },
1950
+ {
1951
+ kind: "index",
1952
+ name: "by_status_generatedAt",
1953
+ columns: ["status", "generatedAt"]
1954
+ }
1955
+ ]
1956
+ });
1797
1957
  defineTable({
1798
1958
  name: "controlPlaneTenantModelSlotBindings",
1799
1959
  component: "mc",
1800
1960
  category: "runtime",
1801
1961
  shape: z.object({
1802
- "bindingId": z.string(),
1803
- "tenantId": idOf("tenants"),
1804
- "providerId": z.string(),
1805
- "modelSlotId": z.string(),
1806
- "secretRef": z.string(),
1807
- "status": z.enum(["active", "revoked"]),
1808
- "passThroughOnly": z.boolean(),
1809
- "revokedAt": z.number().optional(),
1810
- "revokedBy": z.string().optional(),
1811
- "metadata": z.record(z.any()).optional(),
1812
- "createdBy": z.string(),
1813
- "createdAt": z.number(),
1814
- "updatedAt": z.number()
1962
+ bindingId: z.string(),
1963
+ tenantId: idOf("tenants"),
1964
+ workspaceId: idOf("workspaces").optional(),
1965
+ environment: z.enum(["dev", "staging", "prod"]).optional(),
1966
+ providerId: z.string(),
1967
+ modelSlotId: z.string(),
1968
+ secretRef: z.string(),
1969
+ status: z.enum(["active", "revoked"]),
1970
+ passThroughOnly: z.boolean(),
1971
+ revokedAt: z.number().optional(),
1972
+ revokedBy: z.string().optional(),
1973
+ metadata: z.record(z.any()).optional(),
1974
+ createdBy: z.string(),
1975
+ createdAt: z.number(),
1976
+ updatedAt: z.number()
1815
1977
  }),
1816
1978
  indices: [
1817
1979
  { kind: "index", name: "by_bindingId", columns: ["bindingId"] },
1818
1980
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1819
- { kind: "index", name: "by_tenant_slot", columns: ["tenantId", "modelSlotId"] },
1820
- { kind: "index", name: "by_tenant_provider_slot", columns: ["tenantId", "providerId", "modelSlotId"] },
1981
+ {
1982
+ kind: "index",
1983
+ name: "by_tenant_slot",
1984
+ columns: ["tenantId", "modelSlotId"]
1985
+ },
1986
+ {
1987
+ kind: "index",
1988
+ name: "by_tenant_provider_slot",
1989
+ columns: ["tenantId", "providerId", "modelSlotId"]
1990
+ },
1821
1991
  { kind: "index", name: "by_secretRef", columns: ["secretRef"] },
1822
1992
  { kind: "index", name: "by_status", columns: ["status"] }
1823
1993
  ]
@@ -1827,29 +1997,42 @@ defineTable({
1827
1997
  component: "mc",
1828
1998
  category: "runtime",
1829
1999
  shape: z.object({
1830
- "secretRef": z.string(),
1831
- "tenantId": idOf("tenants"),
1832
- "providerId": z.string(),
1833
- "label": z.string().optional(),
1834
- "encryptedSecret": z.string(),
1835
- "encryptionVersion": z.string(),
1836
- "secretFingerprint": z.string(),
1837
- "keyHint": z.string(),
1838
- "status": z.enum(["active", "revoked"]),
1839
- "rotatedFromSecretRef": z.string().optional(),
1840
- "revokedAt": z.number().optional(),
1841
- "revokedBy": z.string().optional(),
1842
- "lastUsedAt": z.number().optional(),
1843
- "metadata": z.record(z.any()).optional(),
1844
- "createdBy": z.string(),
1845
- "createdAt": z.number(),
1846
- "updatedAt": z.number()
2000
+ secretRef: z.string(),
2001
+ tenantId: idOf("tenants"),
2002
+ workspaceId: idOf("workspaces").optional(),
2003
+ environment: z.enum(["dev", "staging", "prod"]).optional(),
2004
+ providerId: z.string(),
2005
+ label: z.string().optional(),
2006
+ encryptedSecret: z.string().optional(),
2007
+ infisicalPath: z.string().optional(),
2008
+ infisicalSecretKey: z.string().optional(),
2009
+ infisicalProjectId: z.string().optional(),
2010
+ encryptionVersion: z.string(),
2011
+ secretFingerprint: z.string(),
2012
+ keyHint: z.string(),
2013
+ status: z.enum(["active", "revoked"]),
2014
+ rotatedFromSecretRef: z.string().optional(),
2015
+ revokedAt: z.number().optional(),
2016
+ revokedBy: z.string().optional(),
2017
+ lastUsedAt: z.number().optional(),
2018
+ metadata: z.record(z.any()).optional(),
2019
+ createdBy: z.string(),
2020
+ createdAt: z.number(),
2021
+ updatedAt: z.number()
1847
2022
  }),
1848
2023
  indices: [
1849
2024
  { kind: "index", name: "by_secretRef", columns: ["secretRef"] },
1850
2025
  { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
1851
- { kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId"] },
1852
- { kind: "index", name: "by_tenant_provider_status", columns: ["tenantId", "providerId", "status"] },
2026
+ {
2027
+ kind: "index",
2028
+ name: "by_tenant_provider",
2029
+ columns: ["tenantId", "providerId"]
2030
+ },
2031
+ {
2032
+ kind: "index",
2033
+ name: "by_tenant_provider_status",
2034
+ columns: ["tenantId", "providerId", "status"]
2035
+ },
1853
2036
  { kind: "index", name: "by_status", columns: ["status"] }
1854
2037
  ]
1855
2038
  });
@@ -1858,35 +2041,93 @@ defineTable({
1858
2041
  component: "mc",
1859
2042
  category: "runtime",
1860
2043
  shape: z.object({
1861
- "usageId": z.string(),
1862
- "tenantId": idOf("tenants"),
1863
- "providerId": z.string(),
1864
- "modelSlotId": z.string(),
1865
- "secretRef": z.string(),
1866
- "proxyTokenId": z.string(),
1867
- "sessionId": z.string(),
1868
- "principalId": z.string(),
1869
- "workspaceId": z.string().optional(),
1870
- "modelId": z.string().optional(),
1871
- "requestPath": z.string(),
1872
- "status": z.enum(["success", "error"]),
1873
- "responseStatus": z.number().optional(),
1874
- "inputTokens": z.number().optional(),
1875
- "outputTokens": z.number().optional(),
1876
- "tokenCount": z.number().optional(),
1877
- "latencyMs": z.number(),
1878
- "estimatedCostUsd": z.number().optional(),
1879
- "failureCode": z.string().optional(),
1880
- "metadata": z.record(z.any()).optional(),
1881
- "createdAt": z.number(),
1882
- "updatedAt": z.number()
2044
+ usageId: z.string(),
2045
+ tenantId: idOf("tenants"),
2046
+ providerId: z.string(),
2047
+ modelSlotId: z.string(),
2048
+ secretRef: z.string(),
2049
+ proxyTokenId: z.string(),
2050
+ sessionId: z.string(),
2051
+ principalId: z.string(),
2052
+ workspaceId: z.string().optional(),
2053
+ modelId: z.string().optional(),
2054
+ requestPath: z.string(),
2055
+ status: z.enum(["success", "error"]),
2056
+ responseStatus: z.number().optional(),
2057
+ inputTokens: z.number().optional(),
2058
+ outputTokens: z.number().optional(),
2059
+ tokenCount: z.number().optional(),
2060
+ latencyMs: z.number(),
2061
+ estimatedCostUsd: z.number().optional(),
2062
+ failureCode: z.string().optional(),
2063
+ metadata: z.record(z.any()).optional(),
2064
+ createdAt: z.number(),
2065
+ updatedAt: z.number()
1883
2066
  }),
1884
2067
  indices: [
1885
2068
  { kind: "index", name: "by_usageId", columns: ["usageId"] },
1886
2069
  { kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
1887
- { kind: "index", name: "by_tenant_provider", columns: ["tenantId", "providerId", "createdAt"] },
1888
- { kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId", "createdAt"] },
1889
- { kind: "index", name: "by_sessionId", columns: ["sessionId", "createdAt"] }
2070
+ {
2071
+ kind: "index",
2072
+ name: "by_tenant_provider",
2073
+ columns: ["tenantId", "providerId", "createdAt"]
2074
+ },
2075
+ {
2076
+ kind: "index",
2077
+ name: "by_proxyTokenId",
2078
+ columns: ["proxyTokenId", "createdAt"]
2079
+ },
2080
+ {
2081
+ kind: "index",
2082
+ name: "by_sessionId",
2083
+ columns: ["sessionId", "createdAt"]
2084
+ }
2085
+ ]
2086
+ });
2087
+ defineTable({
2088
+ name: "controlPlaneTenantProxyTokenLeases",
2089
+ component: "mc",
2090
+ category: "runtime",
2091
+ shape: z.object({
2092
+ leaseId: z.string(),
2093
+ proxyTokenId: z.string(),
2094
+ tenantId: idOf("tenants"),
2095
+ workspaceId: idOf("workspaces").optional(),
2096
+ environment: z.enum(["dev", "staging", "prod"]),
2097
+ providerId: z.string(),
2098
+ modelSlotId: z.string(),
2099
+ bindingId: z.string(),
2100
+ secretRef: z.string(),
2101
+ sessionId: z.string(),
2102
+ principalId: z.string(),
2103
+ agentSessionId: z.string().optional(),
2104
+ status: z.enum(["active", "revoked"]),
2105
+ expiresAt: z.number(),
2106
+ renewedAt: z.number().optional(),
2107
+ revokedAt: z.number().optional(),
2108
+ revokedBy: z.string().optional(),
2109
+ revokeReason: z.string().optional(),
2110
+ permitDecisionLogId: idOf("policyDecisionLogs").optional(),
2111
+ permitTraceId: z.string().optional(),
2112
+ metadata: z.record(z.any()).optional(),
2113
+ createdAt: z.number(),
2114
+ updatedAt: z.number()
2115
+ }),
2116
+ indices: [
2117
+ { kind: "index", name: "by_leaseId", columns: ["leaseId"] },
2118
+ { kind: "index", name: "by_proxyTokenId", columns: ["proxyTokenId"] },
2119
+ { kind: "index", name: "by_tenantId", columns: ["tenantId", "createdAt"] },
2120
+ { kind: "index", name: "by_sessionId", columns: ["sessionId", "createdAt"] },
2121
+ {
2122
+ kind: "index",
2123
+ name: "by_principalId",
2124
+ columns: ["principalId", "createdAt"]
2125
+ },
2126
+ {
2127
+ kind: "index",
2128
+ name: "by_status_expiresAt",
2129
+ columns: ["status", "expiresAt"]
2130
+ }
1890
2131
  ]
1891
2132
  });
1892
2133
  defineTable({
@@ -2219,6 +2460,7 @@ defineTable({
2219
2460
  "questionType": z.enum(["validation", "falsification", "assumption_probe", "prediction_test", "counterfactual", "discovery", "clarification", "comparison", "causal", "mechanism", "general"]).optional(),
2220
2461
  "questionPriority": z.enum(["critical", "high", "medium", "low"]).optional(),
2221
2462
  "answerQuality": z.enum(["definitive", "strong", "moderate", "weak", "speculative", "unanswered"]).optional(),
2463
+ "themeStatus": z.enum(["emerging", "active", "mature", "declining", "archived"]).optional(),
2222
2464
  "themeConviction": z.enum(["high", "medium", "low", "negative"]).optional(),
2223
2465
  "decisionType": z.enum(["invest", "pass", "follow_on", "exit", "deep_dive", "monitor", "deprioritize", "thesis_adopt", "thesis_revise", "thesis_abandon"]).optional(),
2224
2466
  "decisionOutcome": z.enum(["pending", "successful", "unsuccessful", "mixed", "unknown"]).optional(),
@@ -2369,6 +2611,7 @@ defineTable({
2369
2611
  indices: [
2370
2612
  { kind: "index", name: "by_principalId", columns: ["principalId"] },
2371
2613
  { kind: "index", name: "by_principal_tenant", columns: ["principalId", "tenantId"] },
2614
+ { kind: "index", name: "by_principal_tenant_workspace", columns: ["principalId", "tenantId", "workspaceId"] },
2372
2615
  { kind: "index", name: "by_workspace_principal", columns: ["workspaceId", "principalId"] },
2373
2616
  { kind: "index", name: "by_tenant_role", columns: ["tenantId", "role"] },
2374
2617
  { kind: "index", name: "by_status", columns: ["status"] }
@@ -2400,6 +2643,36 @@ defineTable({
2400
2643
  { kind: "index", name: "by_status", columns: ["status"] }
2401
2644
  ]
2402
2645
  });
2646
+ defineTable({
2647
+ name: "principalIdentityAliases",
2648
+ component: "mc",
2649
+ category: "identity",
2650
+ shape: z.object({
2651
+ "principalId": z.string(),
2652
+ "principalRefId": idOf("principals").optional(),
2653
+ "provider": z.string(),
2654
+ "providerProjectId": z.string().optional(),
2655
+ "externalSubjectId": z.string(),
2656
+ "tenantId": idOf("tenants").optional(),
2657
+ "workspaceId": idOf("workspaces").optional(),
2658
+ "email": z.string().optional(),
2659
+ "status": z.enum(["active", "revoked"]),
2660
+ "metadata": z.record(z.any()).optional(),
2661
+ "createdBy": z.string(),
2662
+ "revokedAt": z.number().optional(),
2663
+ "revokedBy": z.string().optional(),
2664
+ "createdAt": z.number(),
2665
+ "updatedAt": z.number()
2666
+ }),
2667
+ indices: [
2668
+ { kind: "index", name: "by_provider_subject", columns: ["provider", "externalSubjectId"] },
2669
+ { kind: "index", name: "by_provider_project_subject", columns: ["provider", "providerProjectId", "externalSubjectId"] },
2670
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
2671
+ { kind: "index", name: "by_principal_status", columns: ["principalId", "status"] },
2672
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "externalSubjectId"] },
2673
+ { kind: "index", name: "by_workspace_provider_subject", columns: ["workspaceId", "provider", "externalSubjectId"] }
2674
+ ]
2675
+ });
2403
2676
  defineTable({
2404
2677
  name: "rateLimitWindows",
2405
2678
  component: "mc",
@@ -2989,7 +3262,7 @@ defineTable({
2989
3262
  });
2990
3263
  defineTable({
2991
3264
  name: "mcpWritePolicy",
2992
- component: "identity",
3265
+ component: "control-plane",
2993
3266
  category: "platform",
2994
3267
  shape: z.object({
2995
3268
  "topicId": z.string().optional(),
@@ -3012,7 +3285,7 @@ defineTable({
3012
3285
  });
3013
3286
  defineTable({
3014
3287
  name: "platformAudienceGrants",
3015
- component: "identity",
3288
+ component: "control-plane",
3016
3289
  category: "platform",
3017
3290
  shape: z.object({
3018
3291
  "tenantId": z.string(),
@@ -3038,7 +3311,7 @@ defineTable({
3038
3311
  });
3039
3312
  defineTable({
3040
3313
  name: "platformAudiences",
3041
- component: "identity",
3314
+ component: "control-plane",
3042
3315
  category: "platform",
3043
3316
  shape: z.object({
3044
3317
  "tenantId": z.string(),
@@ -3063,7 +3336,7 @@ defineTable({
3063
3336
  });
3064
3337
  defineTable({
3065
3338
  name: "platformPolicyDecisionLogs",
3066
- component: "identity",
3339
+ component: "control-plane",
3067
3340
  category: "platform",
3068
3341
  shape: z.object({
3069
3342
  "principalId": z.string(),
@@ -3099,7 +3372,7 @@ defineTable({
3099
3372
  });
3100
3373
  defineTable({
3101
3374
  name: "tenantApiKeys",
3102
- component: "identity",
3375
+ component: "control-plane",
3103
3376
  category: "platform",
3104
3377
  shape: z.object({
3105
3378
  "tenantId": z.string(),
@@ -3126,7 +3399,7 @@ defineTable({
3126
3399
  });
3127
3400
  defineTable({
3128
3401
  name: "tenantConfig",
3129
- component: "identity",
3402
+ component: "control-plane",
3130
3403
  category: "platform",
3131
3404
  shape: z.object({
3132
3405
  "tenantId": z.string(),
@@ -3145,7 +3418,7 @@ defineTable({
3145
3418
  });
3146
3419
  defineTable({
3147
3420
  name: "tenantIntegrations",
3148
- component: "identity",
3421
+ component: "control-plane",
3149
3422
  category: "platform",
3150
3423
  shape: z.object({
3151
3424
  "tenantId": z.string(),
@@ -3200,7 +3473,7 @@ defineTable({
3200
3473
  });
3201
3474
  defineTable({
3202
3475
  name: "tenantModelSlotBindings",
3203
- component: "identity",
3476
+ component: "control-plane",
3204
3477
  category: "platform",
3205
3478
  shape: z.object({
3206
3479
  "bindingId": z.string(),
@@ -3228,7 +3501,7 @@ defineTable({
3228
3501
  });
3229
3502
  defineTable({
3230
3503
  name: "tenantPolicies",
3231
- component: "identity",
3504
+ component: "control-plane",
3232
3505
  category: "platform",
3233
3506
  shape: z.object({
3234
3507
  "tenantId": z.string(),
@@ -3253,7 +3526,7 @@ defineTable({
3253
3526
  });
3254
3527
  defineTable({
3255
3528
  name: "tenantProviderSecrets",
3256
- component: "identity",
3529
+ component: "control-plane",
3257
3530
  category: "platform",
3258
3531
  shape: z.object({
3259
3532
  "secretRef": z.string(),
@@ -3284,7 +3557,7 @@ defineTable({
3284
3557
  });
3285
3558
  defineTable({
3286
3559
  name: "tenantProxyGatewayUsage",
3287
- component: "identity",
3560
+ component: "control-plane",
3288
3561
  category: "platform",
3289
3562
  shape: z.object({
3290
3563
  "usageId": z.string(),
@@ -3319,7 +3592,7 @@ defineTable({
3319
3592
  });
3320
3593
  defineTable({
3321
3594
  name: "tenantProxyTokenMints",
3322
- component: "identity",
3595
+ component: "control-plane",
3323
3596
  category: "platform",
3324
3597
  shape: z.object({
3325
3598
  "proxyTokenId": z.string(),
@@ -3342,7 +3615,7 @@ defineTable({
3342
3615
  });
3343
3616
  defineTable({
3344
3617
  name: "tenantSandboxAuditEvents",
3345
- component: "identity",
3618
+ component: "control-plane",
3346
3619
  category: "platform",
3347
3620
  shape: z.object({
3348
3621
  "eventId": z.string(),
@@ -3376,7 +3649,7 @@ defineTable({
3376
3649
  });
3377
3650
  defineTable({
3378
3651
  name: "tenantSecrets",
3379
- component: "identity",
3652
+ component: "control-plane",
3380
3653
  category: "platform",
3381
3654
  shape: z.object({
3382
3655
  "tenantId": z.string(),
@@ -3398,7 +3671,7 @@ defineTable({
3398
3671
  });
3399
3672
  defineTable({
3400
3673
  name: "toolAcls",
3401
- component: "identity",
3674
+ component: "control-plane",
3402
3675
  category: "platform",
3403
3676
  shape: z.object({
3404
3677
  "role": z.enum(["platform_admin", "tenant_admin", "workspace_admin", "editor", "viewer", "auditor", "service_agent"]),
@@ -3413,7 +3686,7 @@ defineTable({
3413
3686
  });
3414
3687
  defineTable({
3415
3688
  name: "toolRegistry",
3416
- component: "identity",
3689
+ component: "control-plane",
3417
3690
  category: "platform",
3418
3691
  shape: z.object({
3419
3692
  "toolName": z.string(),
@@ -3494,7 +3767,7 @@ defineTable({
3494
3767
  });
3495
3768
  defineTable({
3496
3769
  name: "modelCallLogs",
3497
- component: "identity",
3770
+ component: "control-plane",
3498
3771
  category: "model",
3499
3772
  shape: z.object({
3500
3773
  "slot": z.string(),
@@ -3520,7 +3793,7 @@ defineTable({
3520
3793
  });
3521
3794
  defineTable({
3522
3795
  name: "modelFunctionSlots",
3523
- component: "identity",
3796
+ component: "control-plane",
3524
3797
  category: "model",
3525
3798
  shape: z.object({
3526
3799
  "slot": z.string(),
@@ -3545,7 +3818,7 @@ defineTable({
3545
3818
  });
3546
3819
  defineTable({
3547
3820
  name: "modelRegistry",
3548
- component: "identity",
3821
+ component: "control-plane",
3549
3822
  category: "model",
3550
3823
  shape: z.object({
3551
3824
  "key": z.string(),
@@ -3572,7 +3845,7 @@ defineTable({
3572
3845
  });
3573
3846
  defineTable({
3574
3847
  name: "modelSlotConfigs",
3575
- component: "identity",
3848
+ component: "control-plane",
3576
3849
  category: "model",
3577
3850
  shape: z.object({
3578
3851
  "slot": z.string(),
@@ -3959,7 +4232,7 @@ defineTable({
3959
4232
  "workspaceId": idOf("workspaces").optional(),
3960
4233
  "resourceType": z.string(),
3961
4234
  "resourceId": z.string(),
3962
- "action": z.enum(["read", "summarize", "export", "mutate", "admin", "comment", "escalate", "resolve", "vote"]),
4235
+ "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"]),
3963
4236
  "decision": z.enum(["allow", "deny"]),
3964
4237
  "reasonCode": z.string(),
3965
4238
  "policyVersion": z.string(),
@@ -4021,7 +4294,7 @@ defineTable({
4021
4294
  });
4022
4295
  defineTable({
4023
4296
  name: "projectGrants",
4024
- component: "identity",
4297
+ component: "control-plane",
4025
4298
  category: "project",
4026
4299
  shape: z.object({
4027
4300
  "projectId": z.string().optional(),
@@ -4053,9 +4326,648 @@ defineTable({
4053
4326
  { kind: "index", name: "by_topic_cluster_status", columns: ["topicId", "beliefClusterId", "status"] }
4054
4327
  ]
4055
4328
  });
4329
+ var permitActorType = z.enum([
4330
+ "human",
4331
+ "agent",
4332
+ "service_principal",
4333
+ "external_stakeholder",
4334
+ "system"
4335
+ ]);
4336
+ var permitMembershipStatus = z.enum([
4337
+ "active",
4338
+ "invited",
4339
+ "revoked",
4340
+ "suspended",
4341
+ "disabled"
4342
+ ]);
4343
+ var permitDecision = z.enum(["allow", "deny"]);
4344
+ var permitAccessReviewStatus = z.enum([
4345
+ "open",
4346
+ "in_progress",
4347
+ "approved",
4348
+ "denied",
4349
+ "expired",
4350
+ "cancelled"
4351
+ ]);
4352
+ var permitReviewScope = z.enum([
4353
+ "tenant",
4354
+ "workspace",
4355
+ "resource_instance",
4356
+ "group",
4357
+ "principal",
4358
+ "api_key",
4359
+ "admin_action"
4360
+ ]);
4361
+ var permitRecordStatus = z.enum([
4362
+ "queued",
4363
+ "inflight",
4364
+ "completed",
4365
+ "failed",
4366
+ "skipped",
4367
+ "stale"
4368
+ ]);
4369
+ var permitObjectType = z.enum([
4370
+ "resource",
4371
+ "role",
4372
+ "resource_role",
4373
+ "resource_relation",
4374
+ "tenant",
4375
+ "workspace",
4376
+ "principal",
4377
+ "membership",
4378
+ "group",
4379
+ "resource_instance",
4380
+ "relationship_tuple",
4381
+ "role_assignment"
4382
+ ]);
4383
+ var permitOutboxOperation = z.enum([
4384
+ "upsert",
4385
+ "delete",
4386
+ "sync",
4387
+ "resync",
4388
+ "delete_sync",
4389
+ "noop"
4390
+ ]);
4391
+ var permitPolicyBundleStatus = z.enum([
4392
+ "draft",
4393
+ "validated",
4394
+ "enforced",
4395
+ "archived"
4396
+ ]);
4397
+ var permitSyncStatus = z.enum([
4398
+ "pending",
4399
+ "synced",
4400
+ "error",
4401
+ "skipped"
4402
+ ]);
4403
+ var permitAccessReviewSubjectType = z.enum([
4404
+ "principal",
4405
+ "group",
4406
+ "role_assignment",
4407
+ "resource_instance"
4408
+ ]);
4409
+ var permitAttributeType = z.enum([
4410
+ "string",
4411
+ "number",
4412
+ "bool",
4413
+ "json",
4414
+ "time"
4415
+ ]);
4416
+ var permitAttributeOperator = z.enum([
4417
+ "eq",
4418
+ "neq",
4419
+ "in",
4420
+ "not_in",
4421
+ "gt",
4422
+ "gte",
4423
+ "lt",
4424
+ "lte",
4425
+ "contains",
4426
+ "not_contains",
4427
+ "matches"
4428
+ ]);
4429
+ var permitRoleBindingTarget = z.enum([
4430
+ "principal",
4431
+ "group"
4432
+ ]);
4433
+ defineTable({
4434
+ name: "permitPrincipals",
4435
+ component: "control-plane",
4436
+ category: "access-control",
4437
+ shape: z.object({
4438
+ principalId: z.string(),
4439
+ tenantId: z.string(),
4440
+ workspaceId: z.optional(z.string()),
4441
+ principalType: permitActorType,
4442
+ status: permitMembershipStatus,
4443
+ displayName: z.string().optional(),
4444
+ metadata: z.record(z.any()).optional(),
4445
+ createdBy: z.string(),
4446
+ createdAt: z.number(),
4447
+ updatedAt: z.number(),
4448
+ updatedBy: z.string().optional(),
4449
+ lastSeenAt: z.number().optional()
4450
+ }),
4451
+ indices: [
4452
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4453
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4454
+ { kind: "index", name: "by_tenant_principalId", columns: ["tenantId", "principalId"] },
4455
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4456
+ {
4457
+ kind: "index",
4458
+ name: "by_tenant_principalType_status",
4459
+ columns: ["tenantId", "principalType", "status"]
4460
+ }
4461
+ ]
4462
+ });
4463
+ defineTable({
4464
+ name: "permitPrincipalAliases",
4465
+ component: "control-plane",
4466
+ category: "access-control",
4467
+ shape: z.object({
4468
+ principalId: z.string(),
4469
+ tenantId: z.string(),
4470
+ workspaceId: z.optional(z.string()),
4471
+ provider: z.string(),
4472
+ providerSubjectId: z.string(),
4473
+ providerProjectId: z.string().optional(),
4474
+ alias: z.string(),
4475
+ aliasKind: z.string(),
4476
+ status: permitMembershipStatus,
4477
+ metadata: z.record(z.any()).optional(),
4478
+ createdBy: z.string(),
4479
+ createdAt: z.number(),
4480
+ updatedAt: z.number(),
4481
+ revokedBy: z.string().optional(),
4482
+ revokedAt: z.number().optional(),
4483
+ updatedBy: z.string().optional()
4484
+ }),
4485
+ indices: [
4486
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
4487
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "providerSubjectId"] },
4488
+ {
4489
+ kind: "index",
4490
+ name: "by_tenant_provider_alias",
4491
+ columns: ["tenantId", "provider", "alias"]
4492
+ },
4493
+ { kind: "index", name: "by_tenant_alias", columns: ["tenantId", "alias"] },
4494
+ {
4495
+ kind: "index",
4496
+ name: "by_tenant_provider_status",
4497
+ columns: ["tenantId", "provider", "status"]
4498
+ }
4499
+ ]
4500
+ });
4501
+ defineTable({
4502
+ name: "permitGroups",
4503
+ component: "control-plane",
4504
+ category: "access-control",
4505
+ shape: z.object({
4506
+ tenantId: z.string(),
4507
+ workspaceId: z.optional(z.string()),
4508
+ groupId: z.string(),
4509
+ groupKey: z.string(),
4510
+ groupName: z.string(),
4511
+ groupType: z.enum(["tenant", "workspace", "external", "system", "dynamic"]),
4512
+ status: permitMembershipStatus,
4513
+ description: z.string().optional(),
4514
+ metadata: z.record(z.any()).optional(),
4515
+ createdBy: z.string(),
4516
+ createdAt: z.number(),
4517
+ updatedAt: z.number(),
4518
+ updatedBy: z.string().optional()
4519
+ }),
4520
+ indices: [
4521
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4522
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4523
+ { kind: "index", name: "by_tenant_groupId", columns: ["tenantId", "groupId"] },
4524
+ { kind: "index", name: "by_tenant_groupKey", columns: ["tenantId", "groupKey"] },
4525
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4526
+ ]
4527
+ });
4528
+ defineTable({
4529
+ name: "permitGroupMemberships",
4530
+ component: "control-plane",
4531
+ category: "access-control",
4532
+ shape: z.object({
4533
+ tenantId: z.string(),
4534
+ workspaceId: z.optional(z.string()),
4535
+ groupId: z.string(),
4536
+ memberType: z.enum(["principal", "group"]),
4537
+ memberId: z.string(),
4538
+ principalId: z.string().optional(),
4539
+ childGroupId: z.string().optional(),
4540
+ status: permitMembershipStatus,
4541
+ addedBy: z.string().optional(),
4542
+ revokedBy: z.string().optional(),
4543
+ expiresAt: z.number().optional(),
4544
+ revocationReason: z.string().optional(),
4545
+ metadata: z.record(z.any()).optional(),
4546
+ createdAt: z.number(),
4547
+ updatedAt: z.number(),
4548
+ updatedBy: z.string().optional()
4549
+ }),
4550
+ indices: [
4551
+ { kind: "index", name: "by_tenant_principal", columns: ["tenantId", "principalId"] },
4552
+ { kind: "index", name: "by_tenant_member", columns: ["tenantId", "memberType", "memberId"] },
4553
+ {
4554
+ kind: "index",
4555
+ name: "by_tenant_member_group",
4556
+ columns: ["tenantId", "memberType", "memberId", "groupId"]
4557
+ },
4558
+ { kind: "index", name: "by_tenant_group", columns: ["tenantId", "groupId"] },
4559
+ { kind: "index", name: "by_member_group", columns: ["memberType", "memberId", "groupId"] },
4560
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4561
+ {
4562
+ kind: "index",
4563
+ name: "by_workspace_principal",
4564
+ columns: ["workspaceId", "principalId"]
4565
+ }
4566
+ ]
4567
+ });
4568
+ defineTable({
4569
+ name: "permitResourceInstances",
4570
+ component: "control-plane",
4571
+ category: "access-control",
4572
+ shape: z.object({
4573
+ tenantId: z.string(),
4574
+ workspaceId: z.optional(z.string()),
4575
+ resourceType: z.string(),
4576
+ resourceKey: z.string(),
4577
+ resourceId: z.string(),
4578
+ status: z.enum(["active", "deleted", "archived"]),
4579
+ attributes: z.record(z.any()).optional(),
4580
+ ownerPrincipalId: z.string().optional(),
4581
+ metadata: z.record(z.any()).optional(),
4582
+ createdBy: z.string(),
4583
+ updatedBy: z.string().optional(),
4584
+ createdAt: z.number(),
4585
+ updatedAt: z.number()
4586
+ }),
4587
+ indices: [
4588
+ {
4589
+ kind: "index",
4590
+ name: "by_tenant_resource_type",
4591
+ columns: ["tenantId", "resourceType"]
4592
+ },
4593
+ {
4594
+ kind: "index",
4595
+ name: "by_tenant_resource_key",
4596
+ columns: ["tenantId", "resourceType", "resourceKey"]
4597
+ },
4598
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4599
+ { kind: "index", name: "by_status", columns: ["status"] },
4600
+ {
4601
+ kind: "index",
4602
+ name: "by_tenant_status",
4603
+ columns: ["tenantId", "status"]
4604
+ },
4605
+ {
4606
+ kind: "index",
4607
+ name: "by_ownerPrincipalId",
4608
+ columns: ["ownerPrincipalId"]
4609
+ }
4610
+ ]
4611
+ });
4612
+ defineTable({
4613
+ name: "permitRoleAssignments",
4614
+ component: "control-plane",
4615
+ category: "access-control",
4616
+ shape: z.object({
4617
+ tenantId: z.string(),
4618
+ workspaceId: z.optional(z.string()),
4619
+ role: z.string(),
4620
+ targetType: permitRoleBindingTarget,
4621
+ targetId: z.string(),
4622
+ resourceType: z.string(),
4623
+ resourceKey: z.string(),
4624
+ resourceInstanceId: z.string().optional(),
4625
+ status: permitMembershipStatus,
4626
+ expiresAt: z.number().optional(),
4627
+ attributes: z.record(z.any()).optional(),
4628
+ grantedBy: z.string().optional(),
4629
+ updatedBy: z.string().optional(),
4630
+ revokedBy: z.string().optional(),
4631
+ createdAt: z.number(),
4632
+ updatedAt: z.number()
4633
+ }),
4634
+ indices: [
4635
+ {
4636
+ kind: "index",
4637
+ name: "by_tenant_target",
4638
+ columns: ["tenantId", "targetType", "targetId"]
4639
+ },
4640
+ {
4641
+ kind: "index",
4642
+ name: "by_tenant_resource",
4643
+ columns: ["tenantId", "resourceType", "resourceKey"]
4644
+ },
4645
+ {
4646
+ kind: "index",
4647
+ name: "by_tenant_role",
4648
+ columns: ["tenantId", "role", "status"]
4649
+ },
4650
+ { kind: "index", name: "by_status", columns: ["status"] },
4651
+ {
4652
+ kind: "index",
4653
+ name: "by_workspace_resource",
4654
+ columns: ["workspaceId", "resourceType", "resourceKey"]
4655
+ }
4656
+ ]
4657
+ });
4658
+ defineTable({
4659
+ name: "permitRelationshipTuples",
4660
+ component: "control-plane",
4661
+ category: "access-control",
4662
+ shape: z.object({
4663
+ tenantId: z.string(),
4664
+ workspaceId: z.optional(z.string()),
4665
+ relation: z.string(),
4666
+ subject: z.string(),
4667
+ object: z.string(),
4668
+ resourceType: z.string().optional(),
4669
+ resourceKey: z.string().optional(),
4670
+ status: permitRecordStatus,
4671
+ attributes: z.record(z.any()).optional(),
4672
+ createdBy: z.string(),
4673
+ createdAt: z.number(),
4674
+ updatedAt: z.number(),
4675
+ lastSeenAt: z.number().optional(),
4676
+ updatedBy: z.string().optional()
4677
+ }),
4678
+ indices: [
4679
+ { kind: "index", name: "by_tenant_subject", columns: ["tenantId", "subject"] },
4680
+ { kind: "index", name: "by_tenant_object", columns: ["tenantId", "object"] },
4681
+ { kind: "index", name: "by_tenant_relation", columns: ["tenantId", "relation"] },
4682
+ {
4683
+ kind: "index",
4684
+ name: "by_tenant_relation_subject",
4685
+ columns: ["tenantId", "relation", "subject"]
4686
+ },
4687
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4688
+ ]
4689
+ });
4690
+ defineTable({
4691
+ name: "permitAttributeBindings",
4692
+ component: "control-plane",
4693
+ category: "access-control",
4694
+ shape: z.object({
4695
+ tenantId: z.string(),
4696
+ workspaceId: z.optional(z.string()),
4697
+ targetType: permitRoleBindingTarget,
4698
+ targetId: z.string(),
4699
+ attributeName: z.string(),
4700
+ attributeType: permitAttributeType,
4701
+ attributeOperator: permitAttributeOperator,
4702
+ attributeValue: z.any(),
4703
+ status: permitRecordStatus,
4704
+ source: z.string().optional(),
4705
+ sourceRef: z.string().optional(),
4706
+ metadata: z.record(z.any()).optional(),
4707
+ createdAt: z.number(),
4708
+ updatedAt: z.number(),
4709
+ createdBy: z.string(),
4710
+ updatedBy: z.string().optional(),
4711
+ expiresAt: z.number().optional()
4712
+ }),
4713
+ indices: [
4714
+ {
4715
+ kind: "index",
4716
+ name: "by_tenant_target",
4717
+ columns: ["tenantId", "targetType", "targetId"]
4718
+ },
4719
+ {
4720
+ kind: "index",
4721
+ name: "by_tenant_target_attribute",
4722
+ columns: ["tenantId", "targetType", "targetId", "attributeName"]
4723
+ },
4724
+ {
4725
+ kind: "index",
4726
+ name: "by_tenant_name",
4727
+ columns: ["tenantId", "attributeName"]
4728
+ },
4729
+ {
4730
+ kind: "index",
4731
+ name: "by_tenant_status",
4732
+ columns: ["tenantId", "status"]
4733
+ }
4734
+ ]
4735
+ });
4736
+ defineTable({
4737
+ name: "permitPolicyBundles",
4738
+ component: "control-plane",
4739
+ category: "access-control",
4740
+ shape: z.object({
4741
+ tenantId: z.string(),
4742
+ workspaceId: z.optional(z.string()),
4743
+ bundleKey: z.string(),
4744
+ version: z.number(),
4745
+ status: permitPolicyBundleStatus,
4746
+ policyHash: z.string().optional(),
4747
+ policyPayload: z.record(z.any()),
4748
+ metadata: z.record(z.any()).optional(),
4749
+ createdBy: z.string(),
4750
+ reviewedBy: z.string().optional(),
4751
+ createdAt: z.number(),
4752
+ updatedAt: z.number(),
4753
+ retiredAt: z.number().optional()
4754
+ }),
4755
+ indices: [
4756
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4757
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4758
+ {
4759
+ kind: "index",
4760
+ name: "by_tenant_bundleKey",
4761
+ columns: ["tenantId", "bundleKey"]
4762
+ },
4763
+ {
4764
+ kind: "index",
4765
+ name: "by_tenant_bundle_version",
4766
+ columns: ["tenantId", "bundleKey", "version"]
4767
+ },
4768
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4769
+ ]
4770
+ });
4771
+ defineTable({
4772
+ name: "permitProjectionOutbox",
4773
+ component: "control-plane",
4774
+ category: "access-control",
4775
+ shape: z.object({
4776
+ syncKey: z.string(),
4777
+ objectType: permitObjectType,
4778
+ objectId: z.string(),
4779
+ operation: permitOutboxOperation,
4780
+ payload: z.record(z.any()),
4781
+ status: permitRecordStatus,
4782
+ attemptCount: z.number(),
4783
+ nextAttemptAt: z.number().optional(),
4784
+ lastError: z.string().optional(),
4785
+ tenantId: z.string().optional(),
4786
+ workspaceId: z.optional(z.string()),
4787
+ principalId: z.string().optional(),
4788
+ permitTenantKey: z.string().optional(),
4789
+ permitResourceType: z.string().optional(),
4790
+ permitResourceKey: z.string().optional(),
4791
+ createdAt: z.number(),
4792
+ updatedAt: z.number(),
4793
+ lastHandledAt: z.number().optional()
4794
+ }),
4795
+ indices: [
4796
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4797
+ { kind: "index", name: "by_status", columns: ["status"] },
4798
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4799
+ {
4800
+ kind: "index",
4801
+ name: "by_tenant_status",
4802
+ columns: ["tenantId", "status"]
4803
+ },
4804
+ {
4805
+ kind: "index",
4806
+ name: "by_objectType",
4807
+ columns: ["objectType", "status"]
4808
+ }
4809
+ ]
4810
+ });
4811
+ defineTable({
4812
+ name: "tenantPermitSyncStates",
4813
+ component: "control-plane",
4814
+ category: "access-control",
4815
+ shape: z.object({
4816
+ syncKey: z.string(),
4817
+ objectType: permitObjectType,
4818
+ objectId: z.string(),
4819
+ tenantId: z.string().optional(),
4820
+ workspaceId: z.string().optional(),
4821
+ principalId: z.string().optional(),
4822
+ permitTenantKey: z.string().optional(),
4823
+ permitResourceType: z.string().optional(),
4824
+ permitResourceKey: z.string().optional(),
4825
+ desiredPayload: z.record(z.any()),
4826
+ lastAppliedPayloadHash: z.string().optional(),
4827
+ status: permitSyncStatus,
4828
+ attemptCount: z.number(),
4829
+ lastError: z.string().optional(),
4830
+ nextAttemptAt: z.number().optional(),
4831
+ lastSyncedAt: z.number().optional(),
4832
+ createdBy: z.string(),
4833
+ updatedBy: z.string().optional(),
4834
+ createdAt: z.number(),
4835
+ updatedAt: z.number()
4836
+ }),
4837
+ indices: [
4838
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4839
+ { kind: "index", name: "by_status", columns: ["status"] },
4840
+ {
4841
+ kind: "index",
4842
+ name: "by_tenant_status",
4843
+ columns: ["tenantId", "status"]
4844
+ },
4845
+ {
4846
+ kind: "index",
4847
+ name: "by_workspace_status",
4848
+ columns: ["workspaceId", "status"]
4849
+ },
4850
+ {
4851
+ kind: "index",
4852
+ name: "by_principal_status",
4853
+ columns: ["principalId", "status"]
4854
+ }
4855
+ ]
4856
+ });
4857
+ defineTable({
4858
+ name: "permitPolicyDecisionReceipts",
4859
+ component: "control-plane",
4860
+ category: "access-control",
4861
+ shape: z.object({
4862
+ tenantId: z.string().optional(),
4863
+ workspaceId: z.string().optional(),
4864
+ principalId: z.string(),
4865
+ subjectType: permitAccessReviewSubjectType.optional(),
4866
+ subjectId: z.string().optional(),
4867
+ resourceType: z.string(),
4868
+ resourceId: z.string(),
4869
+ action: z.string(),
4870
+ decision: permitDecision,
4871
+ reasonCode: z.string(),
4872
+ policyBundleId: z.string().optional(),
4873
+ policyVersion: z.string(),
4874
+ traceId: z.string().optional(),
4875
+ requestId: z.string().optional(),
4876
+ audienceMode: z.string().optional(),
4877
+ audienceKey: z.string().optional(),
4878
+ audienceClass: z.enum(["internal", "restricted_external", "public"]).optional(),
4879
+ metadata: z.record(z.any()).optional(),
4880
+ createdAt: z.number(),
4881
+ expiresAt: z.number().optional(),
4882
+ createdBy: z.string().optional()
4883
+ }),
4884
+ indices: [
4885
+ { kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
4886
+ { kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
4887
+ { kind: "index", name: "by_resource", columns: ["resourceType", "resourceId"] },
4888
+ { kind: "index", name: "by_decision_createdAt", columns: ["decision", "createdAt"] },
4889
+ { kind: "index", name: "by_traceId", columns: ["traceId"] },
4890
+ { kind: "index", name: "by_action", columns: ["action"] }
4891
+ ]
4892
+ });
4893
+ defineTable({
4894
+ name: "permitAccessReviews",
4895
+ component: "control-plane",
4896
+ category: "access-control",
4897
+ shape: z.object({
4898
+ tenantId: z.string(),
4899
+ workspaceId: z.optional(z.string()),
4900
+ reviewKey: z.string(),
4901
+ scope: permitReviewScope,
4902
+ status: permitAccessReviewStatus,
4903
+ subjectType: permitAccessReviewSubjectType,
4904
+ subjectId: z.string(),
4905
+ resourceType: z.string().optional(),
4906
+ resourceKey: z.string().optional(),
4907
+ outcome: z.enum(["allow", "deny"]).optional(),
4908
+ requestedBy: z.string(),
4909
+ reviewedBy: z.string().optional(),
4910
+ requestedAt: z.number(),
4911
+ reviewedAt: z.number().optional(),
4912
+ dueAt: z.number().optional(),
4913
+ justification: z.string().optional(),
4914
+ rationale: z.string().optional(),
4915
+ policyBundleId: z.string().optional(),
4916
+ metadata: z.record(z.any()).optional(),
4917
+ createdAt: z.number(),
4918
+ updatedAt: z.number()
4919
+ }),
4920
+ indices: [
4921
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4922
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4923
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4924
+ {
4925
+ kind: "index",
4926
+ name: "by_tenant_subject",
4927
+ columns: ["tenantId", "subjectType", "subjectId"]
4928
+ },
4929
+ { kind: "index", name: "by_outcome", columns: ["outcome"] },
4930
+ {
4931
+ kind: "index",
4932
+ name: "by_workspace_status",
4933
+ columns: ["workspaceId", "status"]
4934
+ }
4935
+ ]
4936
+ });
4937
+ defineTable({
4938
+ name: "permitAccessReviewItems",
4939
+ component: "control-plane",
4940
+ category: "access-control",
4941
+ shape: z.object({
4942
+ reviewKey: z.string(),
4943
+ itemKey: z.string(),
4944
+ tenantId: z.string(),
4945
+ workspaceId: z.string().optional(),
4946
+ subjectType: permitAccessReviewSubjectType,
4947
+ subjectId: z.string(),
4948
+ resourceType: z.string().optional(),
4949
+ resourceKey: z.string().optional(),
4950
+ role: z.string().optional(),
4951
+ relation: z.string().optional(),
4952
+ status: z.enum(["open", "approved", "revoked", "changed", "deferred"]),
4953
+ reviewerId: z.string().optional(),
4954
+ decisionAt: z.number().optional(),
4955
+ rationale: z.string().optional(),
4956
+ metadata: z.record(z.any()).optional(),
4957
+ createdAt: z.number(),
4958
+ updatedAt: z.number()
4959
+ }),
4960
+ indices: [
4961
+ { kind: "index", name: "by_reviewKey", columns: ["reviewKey"] },
4962
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4963
+ { kind: "index", name: "by_tenant_itemKey", columns: ["tenantId", "itemKey"] },
4964
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4965
+ { kind: "index", name: "by_status", columns: ["status"] }
4966
+ ]
4967
+ });
4056
4968
  defineTable({
4057
4969
  name: "reasoningPermissions",
4058
- component: "identity",
4970
+ component: "control-plane",
4059
4971
  category: "epistemic",
4060
4972
  shape: z.object({
4061
4973
  "topicId": z.string().optional(),
@@ -4302,7 +5214,7 @@ defineTable({
4302
5214
  });
4303
5215
  defineTable({
4304
5216
  name: "users",
4305
- component: "identity",
5217
+ component: "control-plane",
4306
5218
  category: "user",
4307
5219
  shape: z.object({
4308
5220
  "clerkId": z.string(),
@@ -4416,7 +5328,6 @@ defineTable({
4416
5328
  "deployments": z.record(z.object({
4417
5329
  "url": z.string(),
4418
5330
  "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
4419
- "encryptedDeployKey": z.string().optional(),
4420
5331
  "credentialRef": z.string().optional()
4421
5332
  })).optional(),
4422
5333
  "metadata": z.record(z.any()).optional(),
@@ -4431,6 +5342,39 @@ defineTable({
4431
5342
  { kind: "index", name: "by_status", columns: ["status"] }
4432
5343
  ]
4433
5344
  });
5345
+ defineTable({
5346
+ name: "deploymentHosts",
5347
+ component: "mc",
5348
+ category: "workspace",
5349
+ shape: z.object({
5350
+ "host": z.string(),
5351
+ "tenantId": idOf("tenants"),
5352
+ "workspaceId": idOf("workspaces"),
5353
+ "environment": z.enum(["dev", "staging", "prod"]),
5354
+ "target": z.enum(["kernelDeployment", "appDeployment"]),
5355
+ "deploymentUrl": z.string().optional(),
5356
+ "deploymentName": z.string().optional(),
5357
+ "vercelProjectName": z.string().optional(),
5358
+ "vercelProjectId": z.string().optional(),
5359
+ "vercelEnvironment": z.enum(["development", "preview", "staging", "production"]).optional(),
5360
+ "source": z.enum(["vercel_preview", "vercel_production", "vercel_custom_environment", "custom_domain", "manual"]),
5361
+ "status": z.enum(["active", "revoked"]),
5362
+ "metadata": z.record(z.any()).optional(),
5363
+ "createdBy": z.string(),
5364
+ "createdAt": z.number(),
5365
+ "updatedAt": z.number(),
5366
+ "revokedAt": z.number().optional(),
5367
+ "revokedBy": z.string().optional()
5368
+ }),
5369
+ indices: [
5370
+ { kind: "index", name: "by_host", columns: ["host"] },
5371
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
5372
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
5373
+ { kind: "index", name: "by_tenant_workspace_environment", columns: ["tenantId", "workspaceId", "environment"] },
5374
+ { kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
5375
+ { kind: "index", name: "by_status", columns: ["status"] }
5376
+ ]
5377
+ });
4434
5378
  defineTable({
4435
5379
  name: "worktreeBeliefCluster",
4436
5380
  component: "kernel",
@@ -4738,8 +5682,8 @@ defineTable({
4738
5682
  });
4739
5683
  z.object({
4740
5684
  manifestVersion: z.string(),
4741
- componentName: z.enum(["kernel", "identity"]),
4742
- tier: z.enum(["K", "I"]),
5685
+ componentName: z.enum(["kernel", "control-plane"]),
5686
+ tier: z.enum(["K", "CP"]),
4743
5687
  packageVersion: z.string(),
4744
5688
  tables: z.array(
4745
5689
  z.object({
@@ -4865,129 +5809,994 @@ var edgePolicyManifest = {
4865
5809
  // ../contracts/src/tenant-client.contract.ts
4866
5810
  var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
4867
5811
  {
4868
- packageName: "@lucern/access-control",
4869
- role: "runtime_entrypoint",
4870
- directTenantImport: true
5812
+ packageName: "@lucern/access-control",
5813
+ role: "runtime_entrypoint",
5814
+ directTenantImport: true
5815
+ },
5816
+ {
5817
+ packageName: "@lucern/agent",
5818
+ role: "platform_runtime",
5819
+ directTenantImport: false
5820
+ },
5821
+ {
5822
+ packageName: "@lucern/auth",
5823
+ role: "sdk_dependency",
5824
+ directTenantImport: false
5825
+ },
5826
+ {
5827
+ packageName: "@lucern/cli",
5828
+ role: "developer_tool",
5829
+ directTenantImport: false
5830
+ },
5831
+ {
5832
+ packageName: "@lucern/client-core",
5833
+ role: "sdk_dependency",
5834
+ directTenantImport: false
5835
+ },
5836
+ {
5837
+ packageName: "@lucern/confidence",
5838
+ role: "sdk_dependency",
5839
+ directTenantImport: false
5840
+ },
5841
+ {
5842
+ packageName: "@lucern/config",
5843
+ role: "configuration",
5844
+ directTenantImport: false
5845
+ },
5846
+ {
5847
+ packageName: "@lucern/contracts",
5848
+ role: "contract_entrypoint",
5849
+ directTenantImport: true
5850
+ },
5851
+ {
5852
+ packageName: "@lucern/control-plane",
5853
+ role: "component_runtime",
5854
+ directTenantImport: false
5855
+ },
5856
+ {
5857
+ packageName: "@lucern/developer-kit",
5858
+ role: "developer_tool",
5859
+ directTenantImport: false
5860
+ },
5861
+ {
5862
+ packageName: "@lucern/events",
5863
+ role: "sdk_dependency",
5864
+ directTenantImport: false
5865
+ },
5866
+ {
5867
+ packageName: "@lucern/graph-primitives",
5868
+ role: "sdk_dependency",
5869
+ directTenantImport: false
5870
+ },
5871
+ {
5872
+ packageName: "@lucern/graph-sync",
5873
+ role: "host_addon_runtime",
5874
+ directTenantImport: true
5875
+ },
5876
+ {
5877
+ packageName: "@lucern/mcp",
5878
+ role: "runtime_entrypoint",
5879
+ directTenantImport: true
5880
+ },
5881
+ {
5882
+ packageName: "@lucern/pack-host",
5883
+ role: "platform_runtime",
5884
+ directTenantImport: false
5885
+ },
5886
+ {
5887
+ packageName: "@lucern/pack-installer",
5888
+ role: "developer_tool",
5889
+ directTenantImport: false
5890
+ },
5891
+ {
5892
+ packageName: "@lucern/proof-compiler",
5893
+ role: "developer_tool",
5894
+ directTenantImport: false
5895
+ },
5896
+ {
5897
+ packageName: "@lucern/react",
5898
+ role: "runtime_entrypoint",
5899
+ directTenantImport: true
5900
+ },
5901
+ {
5902
+ packageName: "@lucern/reasoning-kernel",
5903
+ role: "component_runtime",
5904
+ directTenantImport: false
5905
+ },
5906
+ {
5907
+ packageName: "@lucern/sdk",
5908
+ role: "runtime_entrypoint",
5909
+ directTenantImport: true
5910
+ },
5911
+ {
5912
+ packageName: "@lucern/secrets",
5913
+ role: "sdk_dependency",
5914
+ directTenantImport: false
5915
+ },
5916
+ {
5917
+ packageName: "@lucern/server-core",
5918
+ role: "platform_runtime",
5919
+ directTenantImport: false
5920
+ },
5921
+ {
5922
+ packageName: "@lucern/testing",
5923
+ role: "test_support",
5924
+ directTenantImport: false
5925
+ },
5926
+ {
5927
+ packageName: "@lucern/types",
5928
+ role: "contract_entrypoint",
5929
+ directTenantImport: true
5930
+ }
5931
+ ];
5932
+ TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
5933
+ (entry) => entry.packageName
5934
+ );
5935
+
5936
+ // ../contracts/src/infisical-runtime.contract.ts
5937
+ var INFISICAL_TENANT_SOFTWARE_SYSTEMS = [
5938
+ {
5939
+ id: "stack-frontend",
5940
+ tenantKey: "stack",
5941
+ workspaceKey: "frontend",
5942
+ vercelProjectName: "ai-chatbot-diao",
5943
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5944
+ vercelProjectId: "prj_PihFw8kohSSw14nZs9YQV3xVo517",
5945
+ repository: {
5946
+ owner: "stack-vc",
5947
+ name: "front-end"
5948
+ },
5949
+ sharedSourcePath: "/tenants/stack",
5950
+ sharedVariablePolicy: "tenant_shared_all_systems",
5951
+ convex: {
5952
+ urlEnv: "CONVEX_FRONTEND_URL",
5953
+ deployKeyEnv: "CONVEX_FRONTEND_DEPLOY_KEY",
5954
+ preprodDeployment: "rugged-lobster-664",
5955
+ prodDeployment: "wonderful-toucan-0"
5956
+ }
5957
+ },
5958
+ {
5959
+ id: "stackos",
5960
+ tenantKey: "stack",
5961
+ workspaceKey: "stackos",
5962
+ vercelProjectName: "stackos",
5963
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5964
+ vercelProjectId: "prj_rXLAL0Z6v9p1fasKbomby6GI7kau",
5965
+ repository: {
5966
+ owner: "stack-vc",
5967
+ name: "stackos"
5968
+ },
5969
+ sharedSourcePath: "/tenants/stack",
5970
+ sharedVariablePolicy: "tenant_shared_all_systems",
5971
+ convex: {
5972
+ urlEnv: "CONVEX_STACKOS_URL",
5973
+ deployKeyEnv: "CONVEX_STACKOS_DEPLOY_KEY",
5974
+ preprodDeployment: "giant-mandrill-761",
5975
+ prodDeployment: "good-snake-515"
5976
+ }
5977
+ },
5978
+ {
5979
+ id: "stack-eng",
5980
+ tenantKey: "stack",
5981
+ workspaceKey: "engineering",
5982
+ vercelProjectName: "stackos-engineering-graph",
5983
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5984
+ vercelProjectId: "prj_zAU0Zn9GkbHjHI63dxW4vLpmoqTJ",
5985
+ repository: {
5986
+ owner: "stack-vc",
5987
+ name: "stackos-engineering-graph"
5988
+ },
5989
+ sharedSourcePath: "/tenants/stack/engineering",
5990
+ sharedVariablePolicy: "tenant_shared_all_systems",
5991
+ convex: {
5992
+ urlEnv: "CONVEX_STACK_ENG_URL",
5993
+ deployKeyEnv: "CONVEX_STACK_ENG_DEPLOY_KEY",
5994
+ preprodDeployment: "small-oyster-270",
5995
+ prodDeployment: "bold-cuttlefish-804"
5996
+ }
5997
+ },
5998
+ {
5999
+ id: "lucern-graph",
6000
+ tenantKey: "lucern",
6001
+ workspaceKey: "lucern",
6002
+ vercelProjectName: "lucern-graph",
6003
+ vercelTeamId: "team_vTHxxs8GAoAFUe6RWMlYt7fY",
6004
+ vercelProjectId: "prj_KJ8EKV8vGM5xURpqmwTwmECEGPgQ",
6005
+ repository: {
6006
+ owner: "LucernAI",
6007
+ name: "lucern-graph"
6008
+ },
6009
+ sharedSourcePath: "/tenants/lucern/shared",
6010
+ sharedVariablePolicy: "tenant_shared_all_systems",
6011
+ convex: {
6012
+ urlEnv: "CONVEX_LUCERN_URL",
6013
+ deployKeyEnv: "CONVEX_LUCERN_DEPLOY_KEY",
6014
+ preprodDeployment: "good-blackbird-774",
6015
+ prodDeployment: "precious-dog-365"
6016
+ }
6017
+ }
6018
+ ];
6019
+ var TENANT_SHARED_SECRET_DEFINITION_TEMPLATES = [
6020
+ {
6021
+ idSuffix: "clerk.publishable",
6022
+ canonicalName: "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
6023
+ aliases: ["CLERK_PUBLISHABLE_KEY"],
6024
+ required: true,
6025
+ secret: false,
6026
+ public: true,
6027
+ 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."
6028
+ },
6029
+ {
6030
+ idSuffix: "clerk.secret",
6031
+ canonicalName: "CLERK_SECRET_KEY",
6032
+ required: true,
6033
+ secret: true,
6034
+ public: false,
6035
+ description: "Tenant-owned Clerk backend secret used only by that tenant's server runtimes."
6036
+ },
6037
+ {
6038
+ idSuffix: "clerk.project",
6039
+ canonicalName: "CLERK_PROJECT_ID",
6040
+ required: true,
6041
+ secret: false,
6042
+ public: false,
6043
+ description: "Tenant-owned Clerk project id used to resolve canonical Clerk aliases."
6044
+ },
6045
+ {
6046
+ idSuffix: "clerk.jwks",
6047
+ canonicalName: "CLERK_JWT_ISSUER_DOMAIN",
6048
+ aliases: ["CLERK_ISSUER_URL", "CLERK_JWKS_URL"],
6049
+ required: false,
6050
+ secret: false,
6051
+ public: false,
6052
+ description: "Tenant Clerk issuer/JWKS URL consumed by Convex auth.config.ts."
6053
+ },
6054
+ {
6055
+ idSuffix: "clerk.jwt-key",
6056
+ canonicalName: "CLERK_JWT_KEY",
6057
+ required: false,
6058
+ secret: true,
6059
+ public: false,
6060
+ description: "Tenant Clerk JWT public verification key used by bearer-token API routes."
6061
+ },
6062
+ {
6063
+ idSuffix: "clerk.authorized-parties",
6064
+ canonicalName: "CLERK_AUTHORIZED_PARTIES",
6065
+ aliases: ["CLERK_MOBILE_AUTHORIZED_PARTIES"],
6066
+ required: false,
6067
+ secret: false,
6068
+ public: false,
6069
+ description: "Comma-separated Clerk authorized parties for browser and mobile bearer-token validation."
6070
+ },
6071
+ {
6072
+ idSuffix: "clerk.sign-in-url",
6073
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
6074
+ required: false,
6075
+ secret: false,
6076
+ public: true,
6077
+ description: "Tenant Clerk sign-in route for custom app login surfaces."
6078
+ },
6079
+ {
6080
+ idSuffix: "clerk.sign-up-url",
6081
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
6082
+ required: false,
6083
+ secret: false,
6084
+ public: true,
6085
+ description: "Tenant Clerk sign-up route for custom app login surfaces."
6086
+ }
6087
+ ];
6088
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6089
+ (system) => TENANT_SHARED_SECRET_DEFINITION_TEMPLATES.map(
6090
+ (template) => ({
6091
+ id: `tenant.${system.id}.${template.idSuffix}`,
6092
+ canonicalName: template.canonicalName,
6093
+ aliases: "aliases" in template ? template.aliases : void 0,
6094
+ owner: "tenant",
6095
+ scope: "tenant",
6096
+ sourcePath: system.sharedSourcePath,
6097
+ environmentPolicy: "environment_specific",
6098
+ required: template.required,
6099
+ secret: template.secret,
6100
+ public: template.public,
6101
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6102
+ destinations: [
6103
+ {
6104
+ kind: "vercel",
6105
+ target: system.vercelProjectName,
6106
+ environmentPolicy: "preprod_staging_prod_prod"
6107
+ },
6108
+ {
6109
+ kind: "convex",
6110
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6111
+ environmentPolicy: "preprod_staging_prod_prod"
6112
+ }
6113
+ ],
6114
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6115
+ })
6116
+ )
6117
+ );
6118
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.map(
6119
+ (system) => ({
6120
+ id: `tenant.${system.id}.install-lucern-npm`,
6121
+ canonicalName: "INSTALL_LUCERN_NPM",
6122
+ owner: "provider",
6123
+ scope: "global",
6124
+ sourcePath: "/tenants/shared",
6125
+ environmentPolicy: "same_all_environments",
6126
+ required: true,
6127
+ secret: true,
6128
+ public: false,
6129
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6130
+ destinations: [
6131
+ {
6132
+ kind: "vercel",
6133
+ target: system.vercelProjectName,
6134
+ environmentPolicy: "same_all_environments"
6135
+ },
6136
+ {
6137
+ kind: "github_actions",
6138
+ target: `${system.repository.owner}/${system.repository.name}`,
6139
+ environmentPolicy: "same_all_environments"
6140
+ }
6141
+ ],
6142
+ description: `${system.tenantKey}/${system.workspaceKey}: read-only npm install token for published @lucern/* packages.`
6143
+ })
6144
+ );
6145
+ var TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS = ["stack-frontend", "stackos"];
6146
+ var TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES = [
6147
+ {
6148
+ idSuffix: "ai.openai-api-key",
6149
+ canonicalName: "OPENAI_API_KEY",
6150
+ required: false,
6151
+ secret: true,
6152
+ public: false,
6153
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6154
+ description: "Tenant-owned OpenAI key for product runtime LLM calls."
4871
6155
  },
4872
6156
  {
4873
- packageName: "@lucern/agent",
4874
- role: "platform_runtime",
4875
- directTenantImport: false
6157
+ idSuffix: "ai.anthropic-api-key",
6158
+ canonicalName: "ANTHROPIC_API_KEY",
6159
+ required: false,
6160
+ secret: true,
6161
+ public: false,
6162
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6163
+ description: "Tenant-owned Anthropic key for product runtime LLM calls."
4876
6164
  },
4877
6165
  {
4878
- packageName: "@lucern/auth",
4879
- role: "sdk_dependency",
4880
- directTenantImport: false
6166
+ idSuffix: "ai.gemini-api-key",
6167
+ canonicalName: "GEMINI_API_KEY",
6168
+ aliases: ["GOOGLE_AI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
6169
+ required: false,
6170
+ secret: true,
6171
+ public: false,
6172
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6173
+ description: "Tenant-owned Google/Gemini key for product runtime LLM calls."
4881
6174
  },
4882
6175
  {
4883
- packageName: "@lucern/cli",
4884
- role: "developer_tool",
4885
- directTenantImport: false
6176
+ idSuffix: "langfuse.secret-key",
6177
+ canonicalName: "LANGFUSE_SECRET_KEY",
6178
+ required: false,
6179
+ secret: true,
6180
+ public: false,
6181
+ consumers: [
6182
+ "tenant-vercel-app",
6183
+ "tenant-convex-deployment",
6184
+ "tenant-observability"
6185
+ ],
6186
+ description: "Tenant-owned Langfuse secret key for product AI tracing."
4886
6187
  },
4887
6188
  {
4888
- packageName: "@lucern/client-core",
4889
- role: "sdk_dependency",
4890
- directTenantImport: false
6189
+ idSuffix: "langfuse.public-key",
6190
+ canonicalName: "LANGFUSE_PUBLIC_KEY",
6191
+ required: false,
6192
+ secret: false,
6193
+ public: false,
6194
+ consumers: [
6195
+ "tenant-vercel-app",
6196
+ "tenant-convex-deployment",
6197
+ "tenant-observability"
6198
+ ],
6199
+ description: "Tenant-owned Langfuse public key for product AI tracing."
4891
6200
  },
4892
6201
  {
4893
- packageName: "@lucern/confidence",
4894
- role: "sdk_dependency",
4895
- directTenantImport: false
6202
+ idSuffix: "langfuse.base-url",
6203
+ canonicalName: "LANGFUSE_BASE_URL",
6204
+ aliases: ["LANGFUSE_BASEURL", "LANGFUSE_HOST"],
6205
+ required: false,
6206
+ secret: false,
6207
+ public: false,
6208
+ consumers: [
6209
+ "tenant-vercel-app",
6210
+ "tenant-convex-deployment",
6211
+ "tenant-observability"
6212
+ ],
6213
+ description: "Tenant-owned Langfuse API origin."
4896
6214
  },
4897
6215
  {
4898
- packageName: "@lucern/config",
4899
- role: "configuration",
4900
- directTenantImport: false
6216
+ idSuffix: "graph.neo4j-uri",
6217
+ canonicalName: "NEO4J_URI",
6218
+ required: false,
6219
+ secret: false,
6220
+ public: false,
6221
+ consumers: [
6222
+ "tenant-vercel-app",
6223
+ "tenant-convex-deployment",
6224
+ "tenant-graph-sync"
6225
+ ],
6226
+ description: "Tenant-owned Neo4j URI for product graph-sync."
4901
6227
  },
4902
6228
  {
4903
- packageName: "@lucern/contracts",
4904
- role: "contract_entrypoint",
4905
- directTenantImport: true
6229
+ idSuffix: "graph.neo4j-user",
6230
+ canonicalName: "NEO4J_USER",
6231
+ aliases: ["NEO4J_USERNAME"],
6232
+ required: false,
6233
+ secret: false,
6234
+ public: false,
6235
+ consumers: [
6236
+ "tenant-vercel-app",
6237
+ "tenant-convex-deployment",
6238
+ "tenant-graph-sync"
6239
+ ],
6240
+ description: "Tenant-owned Neo4j user for product graph-sync."
4906
6241
  },
4907
6242
  {
4908
- packageName: "@lucern/control-plane",
4909
- role: "platform_runtime",
4910
- directTenantImport: false
6243
+ idSuffix: "graph.neo4j-password",
6244
+ canonicalName: "NEO4J_PASSWORD",
6245
+ required: false,
6246
+ secret: true,
6247
+ public: false,
6248
+ consumers: [
6249
+ "tenant-vercel-app",
6250
+ "tenant-convex-deployment",
6251
+ "tenant-graph-sync"
6252
+ ],
6253
+ description: "Tenant-owned Neo4j password for product graph-sync."
4911
6254
  },
4912
6255
  {
4913
- packageName: "@lucern/developer-kit",
4914
- role: "developer_tool",
4915
- directTenantImport: false
6256
+ idSuffix: "graph.neo4j-sync-secret",
6257
+ canonicalName: "NEO4J_SYNC_SECRET",
6258
+ required: false,
6259
+ secret: true,
6260
+ public: false,
6261
+ consumers: [
6262
+ "tenant-vercel-app",
6263
+ "tenant-convex-deployment",
6264
+ "tenant-graph-sync"
6265
+ ],
6266
+ description: "Tenant-owned shared secret for product Convex-to-HTTP graph-sync calls."
4916
6267
  },
4917
6268
  {
4918
- packageName: "@lucern/events",
4919
- role: "sdk_dependency",
4920
- directTenantImport: false
6269
+ idSuffix: "graph.neo4j-database",
6270
+ canonicalName: "NEO4J_DATABASE",
6271
+ required: false,
6272
+ secret: false,
6273
+ public: false,
6274
+ consumers: [
6275
+ "tenant-vercel-app",
6276
+ "tenant-convex-deployment",
6277
+ "tenant-graph-sync"
6278
+ ],
6279
+ description: "Tenant-owned Neo4j database name for product graph-sync."
4921
6280
  },
4922
6281
  {
4923
- packageName: "@lucern/graph-primitives",
4924
- role: "sdk_dependency",
4925
- directTenantImport: false
6282
+ idSuffix: "vector.pinecone-api-key",
6283
+ canonicalName: "PINECONE_API_KEY",
6284
+ required: false,
6285
+ secret: true,
6286
+ public: false,
6287
+ consumers: [
6288
+ "tenant-vercel-app",
6289
+ "tenant-convex-deployment",
6290
+ "tenant-vector-store"
6291
+ ],
6292
+ description: "Tenant-owned Pinecone API key for product vector search."
4926
6293
  },
4927
6294
  {
4928
- packageName: "@lucern/graph-sync",
4929
- role: "host_addon_runtime",
4930
- directTenantImport: true
6295
+ idSuffix: "vector.pinecone-index-name",
6296
+ canonicalName: "PINECONE_INDEX_NAME",
6297
+ aliases: ["PINECONE_INDEX"],
6298
+ required: false,
6299
+ secret: false,
6300
+ public: false,
6301
+ consumers: [
6302
+ "tenant-vercel-app",
6303
+ "tenant-convex-deployment",
6304
+ "tenant-vector-store"
6305
+ ],
6306
+ description: "Tenant-owned Pinecone index name for product vector search."
4931
6307
  },
4932
6308
  {
4933
- packageName: "@lucern/identity",
4934
- role: "component_runtime",
4935
- directTenantImport: false
6309
+ idSuffix: "vector.pinecone-host",
6310
+ canonicalName: "PINECONE_HOST",
6311
+ aliases: ["PINECONE_INDEX_HOST"],
6312
+ required: false,
6313
+ secret: false,
6314
+ public: false,
6315
+ consumers: [
6316
+ "tenant-vercel-app",
6317
+ "tenant-convex-deployment",
6318
+ "tenant-vector-store"
6319
+ ],
6320
+ description: "Tenant-owned Pinecone host for product vector search."
4936
6321
  },
4937
6322
  {
4938
- packageName: "@lucern/mcp",
4939
- role: "runtime_entrypoint",
4940
- directTenantImport: true
6323
+ idSuffix: "vector.pinecone-namespace",
6324
+ canonicalName: "PINECONE_NAMESPACE",
6325
+ required: false,
6326
+ secret: false,
6327
+ public: false,
6328
+ consumers: [
6329
+ "tenant-vercel-app",
6330
+ "tenant-convex-deployment",
6331
+ "tenant-vector-store"
6332
+ ],
6333
+ description: "Tenant-owned Pinecone namespace for product vector search isolation."
4941
6334
  },
4942
6335
  {
4943
- packageName: "@lucern/pack-host",
4944
- role: "platform_runtime",
4945
- directTenantImport: false
6336
+ idSuffix: "storage.aws-access-key-id",
6337
+ canonicalName: "AWS_ACCESS_KEY_ID",
6338
+ required: false,
6339
+ secret: true,
6340
+ public: false,
6341
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6342
+ description: "Tenant-owned AWS access key id for document/file ingestion."
4946
6343
  },
4947
6344
  {
4948
- packageName: "@lucern/pack-installer",
4949
- role: "developer_tool",
4950
- directTenantImport: false
6345
+ idSuffix: "storage.aws-secret-access-key",
6346
+ canonicalName: "AWS_SECRET_ACCESS_KEY",
6347
+ required: false,
6348
+ secret: true,
6349
+ public: false,
6350
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6351
+ description: "Tenant-owned AWS secret access key for document/file ingestion."
4951
6352
  },
4952
6353
  {
4953
- packageName: "@lucern/proof-compiler",
4954
- role: "developer_tool",
4955
- directTenantImport: false
6354
+ idSuffix: "storage.aws-region",
6355
+ canonicalName: "AWS_REGION",
6356
+ required: false,
6357
+ secret: false,
6358
+ public: false,
6359
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6360
+ description: "Tenant-owned AWS region for document/file ingestion."
4956
6361
  },
4957
6362
  {
4958
- packageName: "@lucern/react",
4959
- role: "runtime_entrypoint",
4960
- directTenantImport: true
6363
+ idSuffix: "observability.sentry-dsn",
6364
+ canonicalName: "NEXT_PUBLIC_SENTRY_DSN",
6365
+ aliases: ["NEXT_PUBLIC_SENTRY_DSN_NEXTJS", "SENTRY_DSN"],
6366
+ required: false,
6367
+ secret: false,
6368
+ public: true,
6369
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6370
+ description: "Tenant-owned Sentry DSN for app telemetry."
4961
6371
  },
4962
6372
  {
4963
- packageName: "@lucern/reasoning-kernel",
4964
- role: "component_runtime",
4965
- directTenantImport: false
6373
+ idSuffix: "observability.sentry-auth-token",
6374
+ canonicalName: "SENTRY_AUTH_TOKEN",
6375
+ required: false,
6376
+ secret: true,
6377
+ public: false,
6378
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6379
+ description: "Tenant-owned Sentry release token for app deployments."
4966
6380
  },
4967
6381
  {
4968
- packageName: "@lucern/sdk",
4969
- role: "runtime_entrypoint",
4970
- directTenantImport: true
6382
+ idSuffix: "observability.sentry-org",
6383
+ canonicalName: "SENTRY_ORG",
6384
+ aliases: ["SENTRY_ORG_SLUG"],
6385
+ required: false,
6386
+ secret: false,
6387
+ public: false,
6388
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6389
+ description: "Tenant-owned Sentry org slug for release uploads."
4971
6390
  },
4972
6391
  {
4973
- packageName: "@lucern/server-core",
4974
- role: "platform_runtime",
4975
- directTenantImport: false
6392
+ idSuffix: "observability.sentry-project",
6393
+ canonicalName: "SENTRY_PROJECT",
6394
+ aliases: ["SENTRY_PROJECT_NEXTJS"],
6395
+ required: false,
6396
+ secret: false,
6397
+ public: false,
6398
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6399
+ description: "Tenant-owned Sentry project slug for release uploads."
4976
6400
  },
4977
6401
  {
4978
- packageName: "@lucern/testing",
4979
- role: "test_support",
4980
- directTenantImport: false
6402
+ idSuffix: "observability.sentry-environment",
6403
+ canonicalName: "NEXT_PUBLIC_SENTRY_ENVIRONMENT",
6404
+ aliases: ["SENTRY_ENVIRONMENT"],
6405
+ required: false,
6406
+ secret: false,
6407
+ public: true,
6408
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6409
+ description: "Tenant-owned Sentry environment label."
4981
6410
  },
4982
6411
  {
4983
- packageName: "@lucern/types",
4984
- role: "contract_entrypoint",
4985
- directTenantImport: true
6412
+ idSuffix: "observability.sentry-release",
6413
+ canonicalName: "NEXT_PUBLIC_SENTRY_RELEASE",
6414
+ aliases: ["SENTRY_RELEASE"],
6415
+ required: false,
6416
+ secret: false,
6417
+ public: true,
6418
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6419
+ description: "Tenant-owned Sentry release label."
6420
+ },
6421
+ {
6422
+ idSuffix: "observability.sentry-client-options",
6423
+ canonicalName: "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE",
6424
+ aliases: [
6425
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS",
6426
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS_NEXTJS",
6427
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS",
6428
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS_NEXTJS",
6429
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS",
6430
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS_NEXTJS",
6431
+ "NEXT_PUBLIC_SENTRY_ENABLE_LOGS",
6432
+ "NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE",
6433
+ "NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE",
6434
+ "NEXT_PUBLIC_SENTRY_SEND_DEFAULT_PII",
6435
+ "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE_NEXTJS"
6436
+ ],
6437
+ required: false,
6438
+ secret: false,
6439
+ public: true,
6440
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6441
+ description: "Tenant-owned public Sentry tuning values for Next.js client instrumentation."
6442
+ },
6443
+ {
6444
+ idSuffix: "observability.sentry-webhook-secret",
6445
+ canonicalName: "SENTRY_WEBHOOK_SECRET",
6446
+ required: false,
6447
+ secret: true,
6448
+ public: false,
6449
+ consumers: ["tenant-convex-deployment", "tenant-observability"],
6450
+ description: "Tenant-owned Sentry webhook verification secret."
6451
+ },
6452
+ {
6453
+ idSuffix: "lucern.gateway-api-key",
6454
+ canonicalName: "LUCERN_API_KEY",
6455
+ aliases: ["STACK_API_KEY"],
6456
+ required: false,
6457
+ secret: true,
6458
+ public: false,
6459
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6460
+ description: "Tenant-scoped Lucern/MC gateway API key for product front-door calls."
6461
+ },
6462
+ {
6463
+ idSuffix: "lucern.gateway-base-url",
6464
+ canonicalName: "LUCERN_BASE_URL",
6465
+ aliases: ["LUCERN_API_BASE_URL", "LUCERN_GATEWAY_BASE_URL"],
6466
+ required: false,
6467
+ secret: false,
6468
+ public: false,
6469
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6470
+ description: "Lucern/MC gateway base URL used by tenant product apps."
6471
+ },
6472
+ {
6473
+ idSuffix: "lucern.proxy-token-secret",
6474
+ canonicalName: "LUCERN_PROXY_TOKEN_SECRET",
6475
+ required: false,
6476
+ secret: true,
6477
+ public: false,
6478
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6479
+ description: "Tenant-owned secret for signing internal proxy/session tokens in product apps."
6480
+ },
6481
+ {
6482
+ idSuffix: "tenant.integrations.linear-api-key",
6483
+ canonicalName: "LINEAR_API_KEY",
6484
+ required: false,
6485
+ secret: true,
6486
+ public: false,
6487
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6488
+ description: "Tenant-owned Linear API key for support/slash-command flows."
6489
+ },
6490
+ {
6491
+ idSuffix: "tenant.vercel.bypass-token",
6492
+ canonicalName: "VERCEL_AUTOMATION_BYPASS_SECRET",
6493
+ aliases: ["NEXT_PUBLIC_VERCEL_BYPASS_TOKEN"],
6494
+ required: false,
6495
+ secret: true,
6496
+ public: false,
6497
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6498
+ description: "Tenant-owned Vercel automation bypass token. Public alias is legacy and should be removed from app code."
4986
6499
  }
4987
6500
  ];
4988
- TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
4989
- (entry) => entry.packageName
6501
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.filter(
6502
+ (system) => TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS.includes(system.id)
6503
+ ).flatMap(
6504
+ (system) => TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES.map(
6505
+ (template) => ({
6506
+ id: `tenant.${system.id}.${template.idSuffix}`,
6507
+ canonicalName: template.canonicalName,
6508
+ aliases: "aliases" in template ? template.aliases : void 0,
6509
+ owner: "tenant",
6510
+ scope: "tenant",
6511
+ sourcePath: system.sharedSourcePath,
6512
+ environmentPolicy: "environment_specific",
6513
+ required: template.required,
6514
+ secret: template.secret,
6515
+ public: template.public,
6516
+ consumers: template.consumers,
6517
+ destinations: [
6518
+ {
6519
+ kind: "vercel",
6520
+ target: system.vercelProjectName,
6521
+ environmentPolicy: "preprod_staging_prod_prod"
6522
+ },
6523
+ {
6524
+ kind: "convex",
6525
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6526
+ environmentPolicy: "preprod_staging_prod_prod"
6527
+ },
6528
+ {
6529
+ kind: "github_actions",
6530
+ target: `${system.repository.owner}/${system.repository.name}`,
6531
+ environmentPolicy: "preprod_staging_prod_prod"
6532
+ }
6533
+ ],
6534
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6535
+ })
6536
+ )
6537
+ );
6538
+ function tenantVercelConvexUrlWriteNames(system) {
6539
+ const names = [system.convex.urlEnv, "NEXT_PUBLIC_CONVEX_URL"];
6540
+ if (system.id === "stack-eng") {
6541
+ return [...names, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6542
+ }
6543
+ return names;
6544
+ }
6545
+ function tenantRepositoryConvexUrlWriteNames(system) {
6546
+ if (system.id === "stack-eng") {
6547
+ return [system.convex.urlEnv, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6548
+ }
6549
+ return [system.convex.urlEnv];
6550
+ }
6551
+ function tenantRepositoryConvexDeployKeyWriteNames(system) {
6552
+ if (system.id === "stack-eng") {
6553
+ return [system.convex.deployKeyEnv, "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6554
+ }
6555
+ return [system.convex.deployKeyEnv];
6556
+ }
6557
+ function tenantConvexUrlAliases(system) {
6558
+ if (system.id === "stack-frontend") {
6559
+ return [
6560
+ "CONVEX_PROD_URL",
6561
+ "CONVEX_STACK_V2_PROD_URL",
6562
+ "CONVEX_STACK_V2_STAGING_URL",
6563
+ "STACK_CONVEX_URL"
6564
+ ];
6565
+ }
6566
+ if (system.id === "stackos") {
6567
+ return [
6568
+ "CONVEX_CLOUD_URL",
6569
+ "CONVEX_STACK_URL",
6570
+ "CONVEX_URL",
6571
+ "CONVEX_URL_DEVELOPMENT",
6572
+ "CONVEX_URL_PRODUCTION",
6573
+ "STACK_CONVEX_URL"
6574
+ ];
6575
+ }
6576
+ if (system.id === "stack-eng") {
6577
+ return ["STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6578
+ }
6579
+ if (system.id === "lucern-graph") {
6580
+ return [
6581
+ "CONVEX_GRAPH_URL",
6582
+ "LUCERN_PROD_URL",
6583
+ "NEXT_PUBLIC_LUCERN_GRAPH_URL"
6584
+ ];
6585
+ }
6586
+ return void 0;
6587
+ }
6588
+ function tenantConvexDeployKeyAliases(system) {
6589
+ if (system.id === "stack-frontend") {
6590
+ return [
6591
+ "CONVEX_STACK_V2_PROD_DEPLOY_KEY",
6592
+ "CONVEX_STACK_V2_STAGING_DEPLOY_KEY",
6593
+ "STACK_DEPLOY_KEY"
6594
+ ];
6595
+ }
6596
+ if (system.id === "stackos") {
6597
+ return [
6598
+ "CONVEX_DEPLOY_KEY",
6599
+ "CONVEX_DEV_DEPLOY_KEY",
6600
+ "CONVEX_PROD_DEPLOY_KEY",
6601
+ "CONVEX_STACK_DEPLOY_KEY",
6602
+ "STACK_DEPLOY_KEY"
6603
+ ];
6604
+ }
6605
+ if (system.id === "stack-eng") {
6606
+ return ["CONVEX_DEPLOY_KEY", "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6607
+ }
6608
+ if (system.id === "lucern-graph") {
6609
+ return [
6610
+ "CONVEX_DEPLOY_KEY",
6611
+ "CONVEX_GRAPH_DEPLOY_KEY",
6612
+ "LUCERN_CONVEX_DEPLOY_KEY",
6613
+ "LUCERN_DEV_DEPLOY_KEY",
6614
+ "LUCERN_PROD_DEPLOY_KEY"
6615
+ ];
6616
+ }
6617
+ return void 0;
6618
+ }
6619
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6620
+ (system) => {
6621
+ if (system.id === "lucern-graph") {
6622
+ return [
6623
+ {
6624
+ id: "tenant.lucern-graph.public.tenant-id",
6625
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_ID",
6626
+ aliases: ["NEXT_PUBLIC_LUCERN_TENANT_ID"],
6627
+ owner: "tenant",
6628
+ scope: "workspace",
6629
+ sourcePath: system.sharedSourcePath,
6630
+ environmentPolicy: "environment_specific",
6631
+ required: false,
6632
+ secret: false,
6633
+ public: true,
6634
+ consumers: ["tenant-vercel-app"],
6635
+ destinations: [
6636
+ {
6637
+ kind: "vercel",
6638
+ target: system.vercelProjectName,
6639
+ environmentPolicy: "preprod_staging_prod_prod"
6640
+ }
6641
+ ],
6642
+ description: "Lucern graph public tenant id used by the standalone graph explorer."
6643
+ },
6644
+ {
6645
+ id: "tenant.lucern-graph.public.tenant-label",
6646
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_LABEL",
6647
+ owner: "tenant",
6648
+ scope: "workspace",
6649
+ sourcePath: system.sharedSourcePath,
6650
+ environmentPolicy: "environment_specific",
6651
+ required: false,
6652
+ secret: false,
6653
+ public: true,
6654
+ consumers: ["tenant-vercel-app"],
6655
+ destinations: [
6656
+ {
6657
+ kind: "vercel",
6658
+ target: system.vercelProjectName,
6659
+ environmentPolicy: "preprod_staging_prod_prod"
6660
+ }
6661
+ ],
6662
+ description: "Lucern graph public tenant label used by the standalone graph explorer."
6663
+ }
6664
+ ];
6665
+ }
6666
+ if (system.id === "stack-eng") {
6667
+ return [
6668
+ {
6669
+ id: "tenant.stack-eng.public.tenant-id",
6670
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_ID",
6671
+ owner: "tenant",
6672
+ scope: "workspace",
6673
+ sourcePath: system.sharedSourcePath,
6674
+ environmentPolicy: "environment_specific",
6675
+ required: false,
6676
+ secret: false,
6677
+ public: true,
6678
+ consumers: ["tenant-vercel-app"],
6679
+ destinations: [
6680
+ {
6681
+ kind: "vercel",
6682
+ target: system.vercelProjectName,
6683
+ environmentPolicy: "preprod_staging_prod_prod"
6684
+ }
6685
+ ],
6686
+ description: "Stack engineering graph public tenant id used by the graph explorer."
6687
+ },
6688
+ {
6689
+ id: "tenant.stack-eng.public.tenant-label",
6690
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_LABEL",
6691
+ owner: "tenant",
6692
+ scope: "workspace",
6693
+ sourcePath: system.sharedSourcePath,
6694
+ environmentPolicy: "environment_specific",
6695
+ required: false,
6696
+ secret: false,
6697
+ public: true,
6698
+ consumers: ["tenant-vercel-app"],
6699
+ destinations: [
6700
+ {
6701
+ kind: "vercel",
6702
+ target: system.vercelProjectName,
6703
+ environmentPolicy: "preprod_staging_prod_prod"
6704
+ }
6705
+ ],
6706
+ description: "Stack engineering graph public tenant label used by the graph explorer."
6707
+ },
6708
+ {
6709
+ id: "tenant.stack-eng.public.environment",
6710
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_ENV",
6711
+ owner: "tenant",
6712
+ scope: "workspace",
6713
+ sourcePath: system.sharedSourcePath,
6714
+ environmentPolicy: "environment_specific",
6715
+ required: false,
6716
+ secret: false,
6717
+ public: true,
6718
+ consumers: ["tenant-vercel-app"],
6719
+ destinations: [
6720
+ {
6721
+ kind: "vercel",
6722
+ target: system.vercelProjectName,
6723
+ environmentPolicy: "preprod_staging_prod_prod"
6724
+ }
6725
+ ],
6726
+ description: "Stack engineering graph public environment label used by the graph explorer."
6727
+ }
6728
+ ];
6729
+ }
6730
+ return [];
6731
+ }
4990
6732
  );
6733
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap((system) => [
6734
+ {
6735
+ id: `tenant.${system.id}.convex.url`,
6736
+ canonicalName: system.convex.urlEnv,
6737
+ aliases: tenantConvexUrlAliases(system),
6738
+ owner: "tenant",
6739
+ scope: "software_system",
6740
+ sourcePath: system.sharedSourcePath,
6741
+ environmentPolicy: "preprod_staging_prod_prod",
6742
+ required: true,
6743
+ secret: false,
6744
+ public: false,
6745
+ consumers: [
6746
+ "tenant-vercel-app",
6747
+ "tenant-agent-runtime",
6748
+ "mc-operator-tooling"
6749
+ ],
6750
+ destinations: [
6751
+ {
6752
+ kind: "vercel",
6753
+ target: system.vercelProjectName,
6754
+ environmentPolicy: "preprod_staging_prod_prod",
6755
+ writeNames: tenantVercelConvexUrlWriteNames(system)
6756
+ },
6757
+ {
6758
+ kind: "github_actions",
6759
+ target: `${system.repository.owner}/${system.repository.name}`,
6760
+ environmentPolicy: "preprod_staging_prod_prod",
6761
+ writeNames: tenantRepositoryConvexUrlWriteNames(system),
6762
+ notes: "Only if that repository deploy/test workflow owns this software system."
6763
+ }
6764
+ ],
6765
+ description: `${system.tenantKey}/${system.workspaceKey} Convex URL. Pre-prod resolves to ${system.convex.preprodDeployment}; prod resolves to ${system.convex.prodDeployment}.`
6766
+ },
6767
+ {
6768
+ id: `tenant.${system.id}.convex.deploy-key`,
6769
+ canonicalName: system.convex.deployKeyEnv,
6770
+ aliases: tenantConvexDeployKeyAliases(system),
6771
+ owner: "tenant",
6772
+ scope: "software_system",
6773
+ sourcePath: system.sharedSourcePath,
6774
+ environmentPolicy: "preprod_staging_prod_prod",
6775
+ required: true,
6776
+ secret: true,
6777
+ public: false,
6778
+ consumers: [
6779
+ "tenant-vercel-app",
6780
+ "tenant-agent-runtime",
6781
+ "mc-operator-tooling"
6782
+ ],
6783
+ destinations: [
6784
+ {
6785
+ kind: "vercel",
6786
+ target: system.vercelProjectName,
6787
+ environmentPolicy: "preprod_staging_prod_prod"
6788
+ },
6789
+ {
6790
+ kind: "github_actions",
6791
+ target: `${system.repository.owner}/${system.repository.name}`,
6792
+ environmentPolicy: "preprod_staging_prod_prod",
6793
+ writeNames: tenantRepositoryConvexDeployKeyWriteNames(system),
6794
+ notes: "Only if that repository deploy/test workflow owns this software system."
6795
+ }
6796
+ ],
6797
+ description: `${system.tenantKey}/${system.workspaceKey} Convex deploy/admin key. Never route to sibling workspaces.`
6798
+ }
6799
+ ]);
4991
6800
  z.object({
4992
6801
  manifestVersion: z.literal("1.0.0"),
4993
6802
  rules: z.array(
@@ -5028,7 +6837,7 @@ var createEvidenceInputSchemaBase = z.object({
5028
6837
  targetId: z.string().optional(),
5029
6838
  targetNodeId: z.string().optional(),
5030
6839
  linkedBeliefNodeId: z.string().optional(),
5031
- evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
6840
+ evidenceRelation: z.enum(["supports", "contradicts"]).optional(),
5032
6841
  confidence: z.number().optional(),
5033
6842
  weight: z.number().optional(),
5034
6843
  reasoning: z.string().optional(),
@@ -5113,8 +6922,7 @@ var createEvidenceProjection = defineProjection({
5113
6922
  evidenceRelation: v.optional(
5114
6923
  v.union(
5115
6924
  v.literal("supports"),
5116
- v.literal("contradicts"),
5117
- v.literal("neutral")
6925
+ v.literal("contradicts")
5118
6926
  )
5119
6927
  ),
5120
6928
  confidence: v.optional(v.number()),
@@ -5163,12 +6971,17 @@ var listBeliefsProjection = defineProjection({
5163
6971
  });
5164
6972
  var taskStatusSchema = z.enum(["todo", "in_progress", "blocked", "done"]).optional().describe("Filter by task status");
5165
6973
  var listTasksInputSchema = z.object({
5166
- topicId: z.string().describe("Topic scope"),
6974
+ topicId: z.string().optional().describe("Topic scope"),
5167
6975
  worktreeId: z.string().optional().describe("Alias for linkedWorktreeId"),
5168
6976
  linkedWorktreeId: z.string().optional().describe("Filter to tasks linked to this worktree"),
5169
6977
  status: taskStatusSchema,
5170
6978
  limit: z.number().optional().describe("Maximum results")
5171
- });
6979
+ }).refine(
6980
+ (input) => Boolean(input.topicId || input.worktreeId || input.linkedWorktreeId),
6981
+ {
6982
+ message: "topicId or worktreeId is required"
6983
+ }
6984
+ );
5172
6985
  function compactRecord3(input) {
5173
6986
  return Object.fromEntries(
5174
6987
  Object.entries(input).filter(([, value]) => value !== void 0)
@@ -5185,7 +6998,7 @@ var listTasksProjection = defineProjection({
5185
6998
  linkedWorktreeId: input.linkedWorktreeId ?? input.worktreeId
5186
6999
  }),
5187
7000
  convexArgsValidator: v.object({
5188
- topicId: v.string(),
7001
+ topicId: v.optional(v.string()),
5189
7002
  status: v.optional(
5190
7003
  v.union(
5191
7004
  v.literal("todo"),
@@ -6189,7 +8002,7 @@ var CREATE_EDGE = {
6189
8002
  reasoningMethod: {
6190
8003
  type: "string",
6191
8004
  description: "How this was determined",
6192
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
8005
+ enum: [...REASONING_METHODS]
6193
8006
  },
6194
8007
  metadata: {
6195
8008
  type: "object",
@@ -7916,6 +9729,10 @@ var CREATE_TASK = {
7916
9729
  tags: {
7917
9730
  type: "array",
7918
9731
  description: "Free-form string tags"
9732
+ },
9733
+ metadata: {
9734
+ type: "object",
9735
+ description: "Structured task metadata for handoff context and routing hints"
7919
9736
  }
7920
9737
  },
7921
9738
  required: ["title"],
@@ -7989,6 +9806,10 @@ var UPDATE_TASK = {
7989
9806
  type: "string",
7990
9807
  description: "Updated status",
7991
9808
  enum: ["todo", "in_progress", "blocked", "done"]
9809
+ },
9810
+ metadata: {
9811
+ type: "object",
9812
+ description: "Structured task metadata to replace or refine"
7992
9813
  }
7993
9814
  },
7994
9815
  required: ["taskId"],
@@ -9444,6 +11265,9 @@ var BEGIN_BUILD_SESSION = {
9444
11265
  sessionMode: "string \u2014 async | interactive",
9445
11266
  targetBeliefIds: "array \u2014 scoped belief IDs",
9446
11267
  targetQuestionIds: "array \u2014 scoped question IDs",
11268
+ taskIds: "array \u2014 assigned task IDs for this worktree",
11269
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
11270
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
9447
11271
  topBeliefs: "array \u2014 highest-confidence scoped beliefs",
9448
11272
  openQuestions: "array \u2014 open scoped questions",
9449
11273
  resolvedDecisions: "array \u2014 answered questions summarized for the session",
@@ -10044,12 +11868,20 @@ function unwrapMcpParameterSchema(schema) {
10044
11868
  current = current._def.schema;
10045
11869
  continue;
10046
11870
  default:
10047
- return { schema: current, required, description: description ?? current.description };
11871
+ return {
11872
+ schema: current,
11873
+ required,
11874
+ description: description ?? current.description
11875
+ };
10048
11876
  }
10049
11877
  }
10050
11878
  }
10051
11879
  function mcpParameterFromZod(fieldName, schema, contractName) {
10052
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
11880
+ const {
11881
+ schema: unwrapped,
11882
+ required,
11883
+ description: schemaDescription
11884
+ } = unwrapMcpParameterSchema(schema);
10053
11885
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
10054
11886
  switch (unwrapped._def.typeName) {
10055
11887
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -10094,10 +11926,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
10094
11926
  const entries2 = Object.entries(getObjectShape(args)).sort(
10095
11927
  ([left], [right]) => left.localeCompare(right)
10096
11928
  );
10097
- const converted = entries2.map(([fieldName, schema]) => [
10098
- fieldName,
10099
- mcpParameterFromZod(fieldName, schema, contractName)
10100
- ]);
11929
+ const converted = entries2.map(
11930
+ ([fieldName, schema]) => [
11931
+ fieldName,
11932
+ mcpParameterFromZod(fieldName, schema, contractName)
11933
+ ]
11934
+ );
10101
11935
  return {
10102
11936
  ...base,
10103
11937
  parameters: Object.fromEntries(
@@ -10209,6 +12043,7 @@ function surfaceContract(args) {
10209
12043
  allowedPrincipalTypes: ["user", "service", "agent"]
10210
12044
  },
10211
12045
  convex: args.convex,
12046
+ gateway: args.gateway,
10212
12047
  args: canonicalArgs,
10213
12048
  returns: canonicalReturns,
10214
12049
  input,
@@ -10695,7 +12530,7 @@ var beliefsContracts = [
10695
12530
  })
10696
12531
  ];
10697
12532
  var jsonRecordSchema4 = z.record(z.unknown());
10698
- var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
12533
+ var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
10699
12534
  var createEvidenceArgs = z.object({
10700
12535
  topicId: z.string().optional().describe("Topic scope for the evidence."),
10701
12536
  text: z.string().describe("Canonical evidence text."),
@@ -12618,7 +14453,8 @@ var createTaskArgs = z.object({
12618
14453
  linkedQuestionId: z.string().optional().describe("Question this task addresses."),
12619
14454
  assigneeId: z.string().optional().describe("Principal assigned to the task."),
12620
14455
  dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
12621
- tags: z.array(z.string()).optional().describe("Free-form tags.")
14456
+ tags: z.array(z.string()).optional().describe("Free-form tags."),
14457
+ metadata: z.record(z.unknown()).optional().describe("Structured task metadata for handoff context and routing hints.")
12622
14458
  });
12623
14459
  var createTaskInput = (input) => compactRecord4({
12624
14460
  title: input.title,
@@ -12632,7 +14468,8 @@ var createTaskInput = (input) => compactRecord4({
12632
14468
  linkedQuestionId: input.linkedQuestionId,
12633
14469
  assigneeId: input.assigneeId,
12634
14470
  dueDate: input.dueDate,
12635
- tags: input.tags
14471
+ tags: input.tags,
14472
+ metadata: input.metadata
12636
14473
  });
12637
14474
  var taskInput = (input) => compactRecord4({
12638
14475
  ...input,
@@ -12649,8 +14486,7 @@ var taskTopicInput = (input) => {
12649
14486
  };
12650
14487
  var completeTaskInput = (input) => compactRecord4({
12651
14488
  taskId: input.taskId ?? input.id,
12652
- outputSummary: input.outputSummary ?? input.summary,
12653
- userId: input.userId
14489
+ outputSummary: input.outputSummary ?? input.summary
12654
14490
  });
12655
14491
  var tasksContracts = [
12656
14492
  surfaceContract({
@@ -12668,6 +14504,7 @@ var tasksContracts = [
12668
14504
  kind: "mutation",
12669
14505
  inputProjection: createTaskInput
12670
14506
  },
14507
+ gateway: { handler: "tasks.create" },
12671
14508
  args: createTaskArgs
12672
14509
  }),
12673
14510
  surfaceContract({
@@ -12686,6 +14523,7 @@ var tasksContracts = [
12686
14523
  kind: "query",
12687
14524
  inputProjection: taskTopicInput
12688
14525
  },
14526
+ gateway: { handler: "tasks.list" },
12689
14527
  args: listTasksInputSchema
12690
14528
  }),
12691
14529
  surfaceContract({
@@ -12703,7 +14541,8 @@ var tasksContracts = [
12703
14541
  functionName: "update",
12704
14542
  kind: "mutation",
12705
14543
  inputProjection: taskInput
12706
- }
14544
+ },
14545
+ gateway: { handler: "tasks.update" }
12707
14546
  }),
12708
14547
  surfaceContract({
12709
14548
  name: "complete_task",
@@ -12719,12 +14558,14 @@ var tasksContracts = [
12719
14558
  functionName: "complete",
12720
14559
  kind: "mutation",
12721
14560
  inputProjection: completeTaskInput
12722
- }
14561
+ },
14562
+ gateway: { handler: "tasks.complete" }
12723
14563
  })
12724
14564
  ];
12725
14565
  var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
12726
14566
  (policy) => policy.edgeType
12727
14567
  );
14568
+ var REASONING_METHOD_TYPES = [...REASONING_METHODS];
12728
14569
  var createEdgeArgs = z.object({
12729
14570
  from: GraphRefSchema,
12730
14571
  to: GraphRefSchema,
@@ -12734,6 +14575,7 @@ var createEdgeArgs = z.object({
12734
14575
  confidence: z.number().optional(),
12735
14576
  context: z.string().optional(),
12736
14577
  reasoning: z.string().optional(),
14578
+ reasoningMethod: z.enum(REASONING_METHOD_TYPES).optional(),
12737
14579
  derivationType: z.string().optional(),
12738
14580
  metadata: z.record(z.unknown()).optional(),
12739
14581
  topicId: z.string().optional(),
@@ -12812,6 +14654,7 @@ var edgesContracts = [
12812
14654
  weight: parsed.weight,
12813
14655
  confidence: parsed.confidence,
12814
14656
  context: parsed.context ?? parsed.reasoning,
14657
+ reasoningMethod: parsed.reasoningMethod,
12815
14658
  derivationType: parsed.derivationType,
12816
14659
  metadata: parsed.metadata,
12817
14660
  skipLayerValidation: true,
@@ -12936,6 +14779,7 @@ var edgesContracts = [
12936
14779
  weight: edge.weight,
12937
14780
  confidence: edge.confidence,
12938
14781
  context: edge.context ?? edge.reasoning,
14782
+ reasoningMethod: edge.reasoningMethod,
12939
14783
  derivationType: edge.derivationType,
12940
14784
  metadata: edge.metadata,
12941
14785
  topicId: edge.topicId
@@ -13670,6 +15514,69 @@ var pipelineContracts = [
13670
15514
  }
13671
15515
  })
13672
15516
  ];
15517
+ function isRecord3(value) {
15518
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15519
+ }
15520
+ function stringValues(value) {
15521
+ if (typeof value === "string") {
15522
+ return [value];
15523
+ }
15524
+ if (Array.isArray(value)) {
15525
+ return value.flatMap((item) => stringValues(item));
15526
+ }
15527
+ return [];
15528
+ }
15529
+ function nestedEvidenceRows(value) {
15530
+ if (Array.isArray(value)) {
15531
+ return value.flatMap((item) => nestedEvidenceRows(item));
15532
+ }
15533
+ if (!isRecord3(value)) {
15534
+ return [];
15535
+ }
15536
+ const nestedKeys = ["evidence", "items", "nodes"];
15537
+ const nestedRows = nestedKeys.flatMap((key) => nestedEvidenceRows(value[key]));
15538
+ return nestedRows.length > 0 ? nestedRows : [value];
15539
+ }
15540
+ function isFailedAttemptRow(row) {
15541
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15542
+ return metadata?.failedApproach === true || metadata?.isFailedAttempt === true;
15543
+ }
15544
+ function failureLogSearchFields(row) {
15545
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15546
+ return [
15547
+ ...stringValues(row.id),
15548
+ ...stringValues(row._id),
15549
+ ...stringValues(row.title),
15550
+ ...stringValues(row.text),
15551
+ ...stringValues(row.canonicalText),
15552
+ ...stringValues(row.content),
15553
+ ...stringValues(metadata?.codeAnchor),
15554
+ ...stringValues(metadata?.codeAnchors),
15555
+ ...stringValues(metadata?.anchor),
15556
+ ...stringValues(metadata?.anchors),
15557
+ ...stringValues(metadata?.filePath),
15558
+ ...stringValues(metadata?.filePaths),
15559
+ ...stringValues(metadata?.path),
15560
+ ...stringValues(metadata?.paths),
15561
+ ...stringValues(metadata?.sourceRef),
15562
+ ...stringValues(metadata?.touchedPaths)
15563
+ ];
15564
+ }
15565
+ function projectFailureLog(output, input) {
15566
+ const rawQuery = typeof input.query === "string" && input.query.trim().length > 0 ? input.query.trim() : void 0;
15567
+ const searchKey = rawQuery?.toLowerCase();
15568
+ const failures = nestedEvidenceRows(output).filter((row) => isFailedAttemptRow(row)).filter(
15569
+ (row) => !searchKey ? true : failureLogSearchFields(row).some(
15570
+ (field) => field.toLowerCase().includes(searchKey)
15571
+ )
15572
+ );
15573
+ return {
15574
+ query: rawQuery,
15575
+ failures,
15576
+ totalFound: failures.length,
15577
+ showing: failures.length
15578
+ };
15579
+ }
13673
15580
  var recordScopeLearningArgs = z.object({
13674
15581
  topicId: z.string().optional().describe("Topic scope ID"),
13675
15582
  summary: z.string().describe("Atomic learning statement"),
@@ -13759,6 +15666,8 @@ var attemptInput = (input, context) => withUserId(
13759
15666
  tags: ["code_attempt"],
13760
15667
  metadata: compactRecord4({
13761
15668
  ...recordValue2(input.metadata),
15669
+ failedApproach: true,
15670
+ isFailedAttempt: true,
13762
15671
  filePaths: input.filePaths,
13763
15672
  filePath: input.filePath,
13764
15673
  errorMessage: input.errorMessage,
@@ -13889,7 +15798,8 @@ var codingContracts = [
13889
15798
  limit: input.limit,
13890
15799
  status: input.status,
13891
15800
  userId: input.userId
13892
- })
15801
+ }),
15802
+ outputProjection: (output, input) => projectFailureLog(output, input)
13893
15803
  }
13894
15804
  })
13895
15805
  ];
@@ -14351,14 +16261,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14351
16261
  description: "Worktrees are tenant/runtime planning data."
14352
16262
  },
14353
16263
  {
14354
- component: "identity",
16264
+ component: "control-plane",
14355
16265
  table: "agents",
14356
16266
  prepopulation: "runtime_bootstrap",
14357
16267
  copyMode: "none",
14358
16268
  description: "Service agents are provisioned per tenant or service, not copied."
14359
16269
  },
14360
16270
  {
14361
- component: "identity",
16271
+ component: "control-plane",
14362
16272
  table: "mcpWritePolicy",
14363
16273
  prepopulation: "required_template",
14364
16274
  copyMode: "template_global",
@@ -14367,14 +16277,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14367
16277
  description: "Global write policy defaults govern service and interactive MCP writes."
14368
16278
  },
14369
16279
  {
14370
- component: "identity",
16280
+ component: "control-plane",
14371
16281
  table: "modelCallLogs",
14372
16282
  prepopulation: "runtime_log",
14373
16283
  copyMode: "none",
14374
16284
  description: "Model call logs are runtime telemetry."
14375
16285
  },
14376
16286
  {
14377
- component: "identity",
16287
+ component: "control-plane",
14378
16288
  table: "modelFunctionSlots",
14379
16289
  prepopulation: "required_template",
14380
16290
  copyMode: "template_global",
@@ -14383,7 +16293,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14383
16293
  description: "Function-to-model slots are required by model runtime resolution."
14384
16294
  },
14385
16295
  {
14386
- component: "identity",
16296
+ component: "control-plane",
14387
16297
  table: "modelRegistry",
14388
16298
  prepopulation: "required_template",
14389
16299
  copyMode: "template_global",
@@ -14392,7 +16302,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14392
16302
  description: "Model catalog defaults are required by model runtime clients."
14393
16303
  },
14394
16304
  {
14395
- component: "identity",
16305
+ component: "control-plane",
14396
16306
  table: "modelSlotConfigs",
14397
16307
  prepopulation: "required_template",
14398
16308
  copyMode: "template_global",
@@ -14401,14 +16311,105 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14401
16311
  description: "Slot-level defaults are required before tenant overrides exist."
14402
16312
  },
14403
16313
  {
14404
- component: "identity",
16314
+ component: "control-plane",
16315
+ table: "permitAccessReviewItems",
16316
+ prepopulation: "runtime_data",
16317
+ copyMode: "none",
16318
+ description: "Permit access-review item rows are tenant review data projected from Permit."
16319
+ },
16320
+ {
16321
+ component: "control-plane",
16322
+ table: "permitAccessReviews",
16323
+ prepopulation: "runtime_data",
16324
+ copyMode: "none",
16325
+ description: "Permit access-review campaigns are tenant review data projected from Permit."
16326
+ },
16327
+ {
16328
+ component: "control-plane",
16329
+ table: "permitAttributeBindings",
16330
+ prepopulation: "runtime_data",
16331
+ copyMode: "none",
16332
+ description: "Permit ABAC attribute bindings are tenant policy projection rows."
16333
+ },
16334
+ {
16335
+ component: "control-plane",
16336
+ table: "permitGroups",
16337
+ prepopulation: "runtime_data",
16338
+ copyMode: "none",
16339
+ description: "Permit groups are tenant-defined policy subjects, not template data."
16340
+ },
16341
+ {
16342
+ component: "control-plane",
16343
+ table: "permitGroupMemberships",
16344
+ prepopulation: "runtime_data",
16345
+ copyMode: "none",
16346
+ description: "Permit group memberships are tenant-specific policy projection rows."
16347
+ },
16348
+ {
16349
+ component: "control-plane",
16350
+ table: "permitPolicyBundles",
16351
+ prepopulation: "runtime_derived",
16352
+ copyMode: "none",
16353
+ description: "Permit policy bundles are derived from the Permit control plane."
16354
+ },
16355
+ {
16356
+ component: "control-plane",
16357
+ table: "permitPolicyDecisionReceipts",
16358
+ prepopulation: "runtime_log",
16359
+ copyMode: "none",
16360
+ description: "Permit decision receipts are runtime authorization audit logs."
16361
+ },
16362
+ {
16363
+ component: "control-plane",
16364
+ table: "permitPrincipalAliases",
16365
+ prepopulation: "runtime_data",
16366
+ copyMode: "none",
16367
+ description: "Permit principal aliases are tenant-specific identity projection rows."
16368
+ },
16369
+ {
16370
+ component: "control-plane",
16371
+ table: "permitPrincipals",
16372
+ prepopulation: "runtime_data",
16373
+ copyMode: "none",
16374
+ description: "Permit principals are projected from Clerk, Permit, and tenant onboarding flows."
16375
+ },
16376
+ {
16377
+ component: "control-plane",
16378
+ table: "permitProjectionOutbox",
16379
+ prepopulation: "runtime_queue",
16380
+ copyMode: "none",
16381
+ description: "Permit projection outbox rows are runtime sync queue data."
16382
+ },
16383
+ {
16384
+ component: "control-plane",
16385
+ table: "permitRelationshipTuples",
16386
+ prepopulation: "runtime_data",
16387
+ copyMode: "none",
16388
+ description: "Permit ReBAC relationship tuples are tenant policy projection rows."
16389
+ },
16390
+ {
16391
+ component: "control-plane",
16392
+ table: "permitResourceInstances",
16393
+ prepopulation: "runtime_data",
16394
+ copyMode: "none",
16395
+ description: "Permit resource instances are tenant/workspace graph and deployment projection rows."
16396
+ },
16397
+ {
16398
+ component: "control-plane",
16399
+ table: "permitRoleAssignments",
16400
+ prepopulation: "runtime_data",
16401
+ copyMode: "none",
16402
+ description: "Permit role assignments are tenant-specific policy projection rows."
16403
+ },
16404
+ {
16405
+ component: "control-plane",
14405
16406
  table: "platformAudienceGrants",
14406
16407
  prepopulation: "runtime_data",
14407
16408
  copyMode: "none",
14408
16409
  description: "Audience grants are principal/group-specific access rows."
14409
16410
  },
14410
16411
  {
14411
- component: "identity",
16412
+ component: "control-plane",
14412
16413
  table: "platformAudiences",
14413
16414
  prepopulation: "required_template",
14414
16415
  copyMode: "template_tenant_rewrite",
@@ -14417,35 +16418,35 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14417
16418
  description: "Default tenant audience taxonomy rows are rewritten into each tenant."
14418
16419
  },
14419
16420
  {
14420
- component: "identity",
16421
+ component: "control-plane",
14421
16422
  table: "platformPolicyDecisionLogs",
14422
16423
  prepopulation: "runtime_log",
14423
16424
  copyMode: "none",
14424
16425
  description: "Policy decisions are runtime audit logs."
14425
16426
  },
14426
16427
  {
14427
- component: "identity",
16428
+ component: "control-plane",
14428
16429
  table: "projectGrants",
14429
16430
  prepopulation: "runtime_data",
14430
16431
  copyMode: "none",
14431
16432
  description: "Project/topic grants are principal or group-specific access rows."
14432
16433
  },
14433
16434
  {
14434
- component: "identity",
16435
+ component: "control-plane",
14435
16436
  table: "reasoningPermissions",
14436
16437
  prepopulation: "runtime_data",
14437
16438
  copyMode: "none",
14438
16439
  description: "Reasoning permissions are principal-specific policy rows."
14439
16440
  },
14440
16441
  {
14441
- component: "identity",
16442
+ component: "control-plane",
14442
16443
  table: "tenantApiKeys",
14443
16444
  prepopulation: "runtime_secret",
14444
16445
  copyMode: "none",
14445
16446
  description: "API keys are tenant credentials and must never be copied."
14446
16447
  },
14447
16448
  {
14448
- component: "identity",
16449
+ component: "control-plane",
14449
16450
  table: "tenantConfig",
14450
16451
  prepopulation: "required_template",
14451
16452
  copyMode: "template_tenant_rewrite",
@@ -14454,7 +16455,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14454
16455
  description: "Tenant-local config defaults are rewritten during bootstrap."
14455
16456
  },
14456
16457
  {
14457
- component: "identity",
16458
+ component: "control-plane",
14458
16459
  table: "tenantIntegrations",
14459
16460
  prepopulation: "required_template",
14460
16461
  copyMode: "template_tenant_rewrite",
@@ -14463,14 +16464,21 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14463
16464
  description: "Non-secret integration descriptors are rewritten into each tenant."
14464
16465
  },
14465
16466
  {
14466
- component: "identity",
16467
+ component: "control-plane",
14467
16468
  table: "tenantModelSlotBindings",
14468
16469
  prepopulation: "runtime_secret",
14469
16470
  copyMode: "none",
14470
16471
  description: "Tenant model slot bindings reference provider secrets and are runtime-only."
14471
16472
  },
14472
16473
  {
14473
- component: "identity",
16474
+ component: "control-plane",
16475
+ table: "tenantPermitSyncStates",
16476
+ prepopulation: "runtime_derived",
16477
+ copyMode: "none",
16478
+ description: "Tenant Permit sync state rows are runtime reconciliation state."
16479
+ },
16480
+ {
16481
+ component: "control-plane",
14474
16482
  table: "tenantPolicies",
14475
16483
  prepopulation: "required_template",
14476
16484
  copyMode: "template_tenant_rewrite",
@@ -14479,42 +16487,42 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14479
16487
  description: "Default tenant policy roles are rewritten during bootstrap."
14480
16488
  },
14481
16489
  {
14482
- component: "identity",
16490
+ component: "control-plane",
14483
16491
  table: "tenantProviderSecrets",
14484
16492
  prepopulation: "runtime_secret",
14485
16493
  copyMode: "none",
14486
16494
  description: "Provider secrets are credentials and must never be copied."
14487
16495
  },
14488
16496
  {
14489
- component: "identity",
16497
+ component: "control-plane",
14490
16498
  table: "tenantProxyGatewayUsage",
14491
16499
  prepopulation: "runtime_log",
14492
16500
  copyMode: "none",
14493
16501
  description: "Proxy gateway usage rows are runtime telemetry."
14494
16502
  },
14495
16503
  {
14496
- component: "identity",
16504
+ component: "control-plane",
14497
16505
  table: "tenantProxyTokenMints",
14498
16506
  prepopulation: "runtime_secret",
14499
16507
  copyMode: "none",
14500
16508
  description: "Proxy token mints are ephemeral secret-bearing runtime rows."
14501
16509
  },
14502
16510
  {
14503
- component: "identity",
16511
+ component: "control-plane",
14504
16512
  table: "tenantSandboxAuditEvents",
14505
16513
  prepopulation: "runtime_log",
14506
16514
  copyMode: "none",
14507
16515
  description: "Sandbox audit rows are runtime security logs."
14508
16516
  },
14509
16517
  {
14510
- component: "identity",
16518
+ component: "control-plane",
14511
16519
  table: "tenantSecrets",
14512
16520
  prepopulation: "runtime_secret",
14513
16521
  copyMode: "none",
14514
16522
  description: "Tenant secrets are credentials and must never be copied."
14515
16523
  },
14516
16524
  {
14517
- component: "identity",
16525
+ component: "control-plane",
14518
16526
  table: "toolAcls",
14519
16527
  prepopulation: "required_template",
14520
16528
  copyMode: "template_global",
@@ -14523,7 +16531,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14523
16531
  description: "Default role-to-tool grants are required for SDK/MCP tool access."
14524
16532
  },
14525
16533
  {
14526
- component: "identity",
16534
+ component: "control-plane",
14527
16535
  table: "toolRegistry",
14528
16536
  prepopulation: "required_template",
14529
16537
  copyMode: "template_global",
@@ -14532,7 +16540,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14532
16540
  description: "Core tool catalog rows are required before pack or tenant tools exist."
14533
16541
  },
14534
16542
  {
14535
- component: "identity",
16543
+ component: "control-plane",
14536
16544
  table: "users",
14537
16545
  prepopulation: "runtime_bootstrap",
14538
16546
  copyMode: "none",