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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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,650 @@ 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
+ "attribute_binding",
4383
+ "policy_bundle"
4384
+ ]);
4385
+ var permitOutboxOperation = z.enum([
4386
+ "upsert",
4387
+ "delete",
4388
+ "sync",
4389
+ "resync",
4390
+ "delete_sync",
4391
+ "noop"
4392
+ ]);
4393
+ var permitPolicyBundleStatus = z.enum([
4394
+ "draft",
4395
+ "validated",
4396
+ "enforced",
4397
+ "archived"
4398
+ ]);
4399
+ var permitSyncStatus = z.enum([
4400
+ "pending",
4401
+ "synced",
4402
+ "error",
4403
+ "skipped"
4404
+ ]);
4405
+ var permitAccessReviewSubjectType = z.enum([
4406
+ "principal",
4407
+ "group",
4408
+ "role_assignment",
4409
+ "resource_instance"
4410
+ ]);
4411
+ var permitAttributeType = z.enum([
4412
+ "string",
4413
+ "number",
4414
+ "bool",
4415
+ "json",
4416
+ "time"
4417
+ ]);
4418
+ var permitAttributeOperator = z.enum([
4419
+ "eq",
4420
+ "neq",
4421
+ "in",
4422
+ "not_in",
4423
+ "gt",
4424
+ "gte",
4425
+ "lt",
4426
+ "lte",
4427
+ "contains",
4428
+ "not_contains",
4429
+ "matches"
4430
+ ]);
4431
+ var permitRoleBindingTarget = z.enum([
4432
+ "principal",
4433
+ "group"
4434
+ ]);
4435
+ defineTable({
4436
+ name: "permitPrincipals",
4437
+ component: "control-plane",
4438
+ category: "access-control",
4439
+ shape: z.object({
4440
+ principalId: z.string(),
4441
+ tenantId: z.string(),
4442
+ workspaceId: z.optional(z.string()),
4443
+ principalType: permitActorType,
4444
+ status: permitMembershipStatus,
4445
+ displayName: z.string().optional(),
4446
+ metadata: z.record(z.any()).optional(),
4447
+ createdBy: z.string(),
4448
+ createdAt: z.number(),
4449
+ updatedAt: z.number(),
4450
+ updatedBy: z.string().optional(),
4451
+ lastSeenAt: z.number().optional()
4452
+ }),
4453
+ indices: [
4454
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4455
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4456
+ { kind: "index", name: "by_tenant_principalId", columns: ["tenantId", "principalId"] },
4457
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4458
+ {
4459
+ kind: "index",
4460
+ name: "by_tenant_principalType_status",
4461
+ columns: ["tenantId", "principalType", "status"]
4462
+ }
4463
+ ]
4464
+ });
4465
+ defineTable({
4466
+ name: "permitPrincipalAliases",
4467
+ component: "control-plane",
4468
+ category: "access-control",
4469
+ shape: z.object({
4470
+ principalId: z.string(),
4471
+ tenantId: z.string(),
4472
+ workspaceId: z.optional(z.string()),
4473
+ provider: z.string(),
4474
+ providerSubjectId: z.string(),
4475
+ providerProjectId: z.string().optional(),
4476
+ alias: z.string(),
4477
+ aliasKind: z.string(),
4478
+ status: permitMembershipStatus,
4479
+ metadata: z.record(z.any()).optional(),
4480
+ createdBy: z.string(),
4481
+ createdAt: z.number(),
4482
+ updatedAt: z.number(),
4483
+ revokedBy: z.string().optional(),
4484
+ revokedAt: z.number().optional(),
4485
+ updatedBy: z.string().optional()
4486
+ }),
4487
+ indices: [
4488
+ { kind: "index", name: "by_principalId", columns: ["principalId"] },
4489
+ { kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "providerSubjectId"] },
4490
+ {
4491
+ kind: "index",
4492
+ name: "by_tenant_provider_alias",
4493
+ columns: ["tenantId", "provider", "alias"]
4494
+ },
4495
+ { kind: "index", name: "by_tenant_alias", columns: ["tenantId", "alias"] },
4496
+ {
4497
+ kind: "index",
4498
+ name: "by_tenant_provider_status",
4499
+ columns: ["tenantId", "provider", "status"]
4500
+ }
4501
+ ]
4502
+ });
4503
+ defineTable({
4504
+ name: "permitGroups",
4505
+ component: "control-plane",
4506
+ category: "access-control",
4507
+ shape: z.object({
4508
+ tenantId: z.string(),
4509
+ workspaceId: z.optional(z.string()),
4510
+ groupId: z.string(),
4511
+ groupKey: z.string(),
4512
+ groupName: z.string(),
4513
+ groupType: z.enum(["tenant", "workspace", "external", "system", "dynamic"]),
4514
+ status: permitMembershipStatus,
4515
+ description: z.string().optional(),
4516
+ metadata: z.record(z.any()).optional(),
4517
+ createdBy: z.string(),
4518
+ createdAt: z.number(),
4519
+ updatedAt: z.number(),
4520
+ updatedBy: z.string().optional()
4521
+ }),
4522
+ indices: [
4523
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4524
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4525
+ { kind: "index", name: "by_tenant_groupId", columns: ["tenantId", "groupId"] },
4526
+ { kind: "index", name: "by_tenant_groupKey", columns: ["tenantId", "groupKey"] },
4527
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4528
+ ]
4529
+ });
4530
+ defineTable({
4531
+ name: "permitGroupMemberships",
4532
+ component: "control-plane",
4533
+ category: "access-control",
4534
+ shape: z.object({
4535
+ tenantId: z.string(),
4536
+ workspaceId: z.optional(z.string()),
4537
+ groupId: z.string(),
4538
+ memberType: z.enum(["principal", "group"]),
4539
+ memberId: z.string(),
4540
+ principalId: z.string().optional(),
4541
+ childGroupId: z.string().optional(),
4542
+ status: permitMembershipStatus,
4543
+ addedBy: z.string().optional(),
4544
+ revokedBy: z.string().optional(),
4545
+ expiresAt: z.number().optional(),
4546
+ revocationReason: z.string().optional(),
4547
+ metadata: z.record(z.any()).optional(),
4548
+ createdAt: z.number(),
4549
+ updatedAt: z.number(),
4550
+ updatedBy: z.string().optional()
4551
+ }),
4552
+ indices: [
4553
+ { kind: "index", name: "by_tenant_principal", columns: ["tenantId", "principalId"] },
4554
+ { kind: "index", name: "by_tenant_member", columns: ["tenantId", "memberType", "memberId"] },
4555
+ {
4556
+ kind: "index",
4557
+ name: "by_tenant_member_group",
4558
+ columns: ["tenantId", "memberType", "memberId", "groupId"]
4559
+ },
4560
+ { kind: "index", name: "by_tenant_group", columns: ["tenantId", "groupId"] },
4561
+ { kind: "index", name: "by_member_group", columns: ["memberType", "memberId", "groupId"] },
4562
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4563
+ {
4564
+ kind: "index",
4565
+ name: "by_workspace_principal",
4566
+ columns: ["workspaceId", "principalId"]
4567
+ }
4568
+ ]
4569
+ });
4570
+ defineTable({
4571
+ name: "permitResourceInstances",
4572
+ component: "control-plane",
4573
+ category: "access-control",
4574
+ shape: z.object({
4575
+ tenantId: z.string(),
4576
+ workspaceId: z.optional(z.string()),
4577
+ resourceType: z.string(),
4578
+ resourceKey: z.string(),
4579
+ resourceId: z.string(),
4580
+ status: z.enum(["active", "deleted", "archived"]),
4581
+ attributes: z.record(z.any()).optional(),
4582
+ ownerPrincipalId: z.string().optional(),
4583
+ metadata: z.record(z.any()).optional(),
4584
+ createdBy: z.string(),
4585
+ updatedBy: z.string().optional(),
4586
+ createdAt: z.number(),
4587
+ updatedAt: z.number()
4588
+ }),
4589
+ indices: [
4590
+ {
4591
+ kind: "index",
4592
+ name: "by_tenant_resource_type",
4593
+ columns: ["tenantId", "resourceType"]
4594
+ },
4595
+ {
4596
+ kind: "index",
4597
+ name: "by_tenant_resource_key",
4598
+ columns: ["tenantId", "resourceType", "resourceKey"]
4599
+ },
4600
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4601
+ { kind: "index", name: "by_status", columns: ["status"] },
4602
+ {
4603
+ kind: "index",
4604
+ name: "by_tenant_status",
4605
+ columns: ["tenantId", "status"]
4606
+ },
4607
+ {
4608
+ kind: "index",
4609
+ name: "by_ownerPrincipalId",
4610
+ columns: ["ownerPrincipalId"]
4611
+ }
4612
+ ]
4613
+ });
4614
+ defineTable({
4615
+ name: "permitRoleAssignments",
4616
+ component: "control-plane",
4617
+ category: "access-control",
4618
+ shape: z.object({
4619
+ tenantId: z.string(),
4620
+ workspaceId: z.optional(z.string()),
4621
+ role: z.string(),
4622
+ targetType: permitRoleBindingTarget,
4623
+ targetId: z.string(),
4624
+ resourceType: z.string(),
4625
+ resourceKey: z.string(),
4626
+ resourceInstanceId: z.string().optional(),
4627
+ status: permitMembershipStatus,
4628
+ expiresAt: z.number().optional(),
4629
+ attributes: z.record(z.any()).optional(),
4630
+ grantedBy: z.string().optional(),
4631
+ updatedBy: z.string().optional(),
4632
+ revokedBy: z.string().optional(),
4633
+ createdAt: z.number(),
4634
+ updatedAt: z.number()
4635
+ }),
4636
+ indices: [
4637
+ {
4638
+ kind: "index",
4639
+ name: "by_tenant_target",
4640
+ columns: ["tenantId", "targetType", "targetId"]
4641
+ },
4642
+ {
4643
+ kind: "index",
4644
+ name: "by_tenant_resource",
4645
+ columns: ["tenantId", "resourceType", "resourceKey"]
4646
+ },
4647
+ {
4648
+ kind: "index",
4649
+ name: "by_tenant_role",
4650
+ columns: ["tenantId", "role", "status"]
4651
+ },
4652
+ { kind: "index", name: "by_status", columns: ["status"] },
4653
+ {
4654
+ kind: "index",
4655
+ name: "by_workspace_resource",
4656
+ columns: ["workspaceId", "resourceType", "resourceKey"]
4657
+ }
4658
+ ]
4659
+ });
4660
+ defineTable({
4661
+ name: "permitRelationshipTuples",
4662
+ component: "control-plane",
4663
+ category: "access-control",
4664
+ shape: z.object({
4665
+ tenantId: z.string(),
4666
+ workspaceId: z.optional(z.string()),
4667
+ relation: z.string(),
4668
+ subject: z.string(),
4669
+ object: z.string(),
4670
+ resourceType: z.string().optional(),
4671
+ resourceKey: z.string().optional(),
4672
+ status: permitRecordStatus,
4673
+ attributes: z.record(z.any()).optional(),
4674
+ createdBy: z.string(),
4675
+ createdAt: z.number(),
4676
+ updatedAt: z.number(),
4677
+ lastSeenAt: z.number().optional(),
4678
+ updatedBy: z.string().optional()
4679
+ }),
4680
+ indices: [
4681
+ { kind: "index", name: "by_tenant_subject", columns: ["tenantId", "subject"] },
4682
+ { kind: "index", name: "by_tenant_object", columns: ["tenantId", "object"] },
4683
+ { kind: "index", name: "by_tenant_relation", columns: ["tenantId", "relation"] },
4684
+ {
4685
+ kind: "index",
4686
+ name: "by_tenant_relation_subject",
4687
+ columns: ["tenantId", "relation", "subject"]
4688
+ },
4689
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4690
+ ]
4691
+ });
4692
+ defineTable({
4693
+ name: "permitAttributeBindings",
4694
+ component: "control-plane",
4695
+ category: "access-control",
4696
+ shape: z.object({
4697
+ tenantId: z.string(),
4698
+ workspaceId: z.optional(z.string()),
4699
+ targetType: permitRoleBindingTarget,
4700
+ targetId: z.string(),
4701
+ attributeName: z.string(),
4702
+ attributeType: permitAttributeType,
4703
+ attributeOperator: permitAttributeOperator,
4704
+ attributeValue: z.any(),
4705
+ status: permitRecordStatus,
4706
+ source: z.string().optional(),
4707
+ sourceRef: z.string().optional(),
4708
+ metadata: z.record(z.any()).optional(),
4709
+ createdAt: z.number(),
4710
+ updatedAt: z.number(),
4711
+ createdBy: z.string(),
4712
+ updatedBy: z.string().optional(),
4713
+ expiresAt: z.number().optional()
4714
+ }),
4715
+ indices: [
4716
+ {
4717
+ kind: "index",
4718
+ name: "by_tenant_target",
4719
+ columns: ["tenantId", "targetType", "targetId"]
4720
+ },
4721
+ {
4722
+ kind: "index",
4723
+ name: "by_tenant_target_attribute",
4724
+ columns: ["tenantId", "targetType", "targetId", "attributeName"]
4725
+ },
4726
+ {
4727
+ kind: "index",
4728
+ name: "by_tenant_name",
4729
+ columns: ["tenantId", "attributeName"]
4730
+ },
4731
+ {
4732
+ kind: "index",
4733
+ name: "by_tenant_status",
4734
+ columns: ["tenantId", "status"]
4735
+ }
4736
+ ]
4737
+ });
4738
+ defineTable({
4739
+ name: "permitPolicyBundles",
4740
+ component: "control-plane",
4741
+ category: "access-control",
4742
+ shape: z.object({
4743
+ tenantId: z.string(),
4744
+ workspaceId: z.optional(z.string()),
4745
+ bundleKey: z.string(),
4746
+ version: z.number(),
4747
+ status: permitPolicyBundleStatus,
4748
+ policyHash: z.string().optional(),
4749
+ policyPayload: z.record(z.any()),
4750
+ metadata: z.record(z.any()).optional(),
4751
+ createdBy: z.string(),
4752
+ reviewedBy: z.string().optional(),
4753
+ createdAt: z.number(),
4754
+ updatedAt: z.number(),
4755
+ retiredAt: z.number().optional()
4756
+ }),
4757
+ indices: [
4758
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4759
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
4760
+ {
4761
+ kind: "index",
4762
+ name: "by_tenant_bundleKey",
4763
+ columns: ["tenantId", "bundleKey"]
4764
+ },
4765
+ {
4766
+ kind: "index",
4767
+ name: "by_tenant_bundle_version",
4768
+ columns: ["tenantId", "bundleKey", "version"]
4769
+ },
4770
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] }
4771
+ ]
4772
+ });
4773
+ defineTable({
4774
+ name: "permitProjectionOutbox",
4775
+ component: "control-plane",
4776
+ category: "access-control",
4777
+ shape: z.object({
4778
+ syncKey: z.string(),
4779
+ objectType: permitObjectType,
4780
+ objectId: z.string(),
4781
+ operation: permitOutboxOperation,
4782
+ payload: z.record(z.any()),
4783
+ status: permitRecordStatus,
4784
+ attemptCount: z.number(),
4785
+ nextAttemptAt: z.number().optional(),
4786
+ lastError: z.string().optional(),
4787
+ tenantId: z.string().optional(),
4788
+ workspaceId: z.optional(z.string()),
4789
+ principalId: z.string().optional(),
4790
+ permitTenantKey: z.string().optional(),
4791
+ permitResourceType: z.string().optional(),
4792
+ permitResourceKey: z.string().optional(),
4793
+ createdAt: z.number(),
4794
+ updatedAt: z.number(),
4795
+ lastHandledAt: z.number().optional()
4796
+ }),
4797
+ indices: [
4798
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4799
+ { kind: "index", name: "by_status", columns: ["status"] },
4800
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
4801
+ {
4802
+ kind: "index",
4803
+ name: "by_tenant_status",
4804
+ columns: ["tenantId", "status"]
4805
+ },
4806
+ {
4807
+ kind: "index",
4808
+ name: "by_objectType",
4809
+ columns: ["objectType", "status"]
4810
+ }
4811
+ ]
4812
+ });
4813
+ defineTable({
4814
+ name: "tenantPermitSyncStates",
4815
+ component: "control-plane",
4816
+ category: "access-control",
4817
+ shape: z.object({
4818
+ syncKey: z.string(),
4819
+ objectType: permitObjectType,
4820
+ objectId: z.string(),
4821
+ tenantId: z.string().optional(),
4822
+ workspaceId: z.string().optional(),
4823
+ principalId: z.string().optional(),
4824
+ permitTenantKey: z.string().optional(),
4825
+ permitResourceType: z.string().optional(),
4826
+ permitResourceKey: z.string().optional(),
4827
+ desiredPayload: z.record(z.any()),
4828
+ lastAppliedPayloadHash: z.string().optional(),
4829
+ status: permitSyncStatus,
4830
+ attemptCount: z.number(),
4831
+ lastError: z.string().optional(),
4832
+ nextAttemptAt: z.number().optional(),
4833
+ lastSyncedAt: z.number().optional(),
4834
+ createdBy: z.string(),
4835
+ updatedBy: z.string().optional(),
4836
+ createdAt: z.number(),
4837
+ updatedAt: z.number()
4838
+ }),
4839
+ indices: [
4840
+ { kind: "index", name: "by_syncKey", columns: ["syncKey"] },
4841
+ { kind: "index", name: "by_status", columns: ["status"] },
4842
+ {
4843
+ kind: "index",
4844
+ name: "by_tenant_status",
4845
+ columns: ["tenantId", "status"]
4846
+ },
4847
+ {
4848
+ kind: "index",
4849
+ name: "by_workspace_status",
4850
+ columns: ["workspaceId", "status"]
4851
+ },
4852
+ {
4853
+ kind: "index",
4854
+ name: "by_principal_status",
4855
+ columns: ["principalId", "status"]
4856
+ }
4857
+ ]
4858
+ });
4859
+ defineTable({
4860
+ name: "permitPolicyDecisionReceipts",
4861
+ component: "control-plane",
4862
+ category: "access-control",
4863
+ shape: z.object({
4864
+ tenantId: z.string().optional(),
4865
+ workspaceId: z.string().optional(),
4866
+ principalId: z.string(),
4867
+ subjectType: permitAccessReviewSubjectType.optional(),
4868
+ subjectId: z.string().optional(),
4869
+ resourceType: z.string(),
4870
+ resourceId: z.string(),
4871
+ action: z.string(),
4872
+ decision: permitDecision,
4873
+ reasonCode: z.string(),
4874
+ policyBundleId: z.string().optional(),
4875
+ policyVersion: z.string(),
4876
+ traceId: z.string().optional(),
4877
+ requestId: z.string().optional(),
4878
+ audienceMode: z.string().optional(),
4879
+ audienceKey: z.string().optional(),
4880
+ audienceClass: z.enum(["internal", "restricted_external", "public"]).optional(),
4881
+ metadata: z.record(z.any()).optional(),
4882
+ createdAt: z.number(),
4883
+ expiresAt: z.number().optional(),
4884
+ createdBy: z.string().optional()
4885
+ }),
4886
+ indices: [
4887
+ { kind: "index", name: "by_principal_createdAt", columns: ["principalId", "createdAt"] },
4888
+ { kind: "index", name: "by_tenant_createdAt", columns: ["tenantId", "createdAt"] },
4889
+ { kind: "index", name: "by_resource", columns: ["resourceType", "resourceId"] },
4890
+ { kind: "index", name: "by_decision_createdAt", columns: ["decision", "createdAt"] },
4891
+ { kind: "index", name: "by_traceId", columns: ["traceId"] },
4892
+ { kind: "index", name: "by_action", columns: ["action"] }
4893
+ ]
4894
+ });
4895
+ defineTable({
4896
+ name: "permitAccessReviews",
4897
+ component: "control-plane",
4898
+ category: "access-control",
4899
+ shape: z.object({
4900
+ tenantId: z.string(),
4901
+ workspaceId: z.optional(z.string()),
4902
+ reviewKey: z.string(),
4903
+ scope: permitReviewScope,
4904
+ status: permitAccessReviewStatus,
4905
+ subjectType: permitAccessReviewSubjectType,
4906
+ subjectId: z.string(),
4907
+ resourceType: z.string().optional(),
4908
+ resourceKey: z.string().optional(),
4909
+ outcome: z.enum(["allow", "deny"]).optional(),
4910
+ requestedBy: z.string(),
4911
+ reviewedBy: z.string().optional(),
4912
+ requestedAt: z.number(),
4913
+ reviewedAt: z.number().optional(),
4914
+ dueAt: z.number().optional(),
4915
+ justification: z.string().optional(),
4916
+ rationale: z.string().optional(),
4917
+ policyBundleId: z.string().optional(),
4918
+ metadata: z.record(z.any()).optional(),
4919
+ createdAt: z.number(),
4920
+ updatedAt: z.number()
4921
+ }),
4922
+ indices: [
4923
+ { kind: "index", name: "by_tenant_status", columns: ["tenantId", "status"] },
4924
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4925
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4926
+ {
4927
+ kind: "index",
4928
+ name: "by_tenant_subject",
4929
+ columns: ["tenantId", "subjectType", "subjectId"]
4930
+ },
4931
+ { kind: "index", name: "by_outcome", columns: ["outcome"] },
4932
+ {
4933
+ kind: "index",
4934
+ name: "by_workspace_status",
4935
+ columns: ["workspaceId", "status"]
4936
+ }
4937
+ ]
4938
+ });
4939
+ defineTable({
4940
+ name: "permitAccessReviewItems",
4941
+ component: "control-plane",
4942
+ category: "access-control",
4943
+ shape: z.object({
4944
+ reviewKey: z.string(),
4945
+ itemKey: z.string(),
4946
+ tenantId: z.string(),
4947
+ workspaceId: z.string().optional(),
4948
+ subjectType: permitAccessReviewSubjectType,
4949
+ subjectId: z.string(),
4950
+ resourceType: z.string().optional(),
4951
+ resourceKey: z.string().optional(),
4952
+ role: z.string().optional(),
4953
+ relation: z.string().optional(),
4954
+ status: z.enum(["open", "approved", "revoked", "changed", "deferred"]),
4955
+ reviewerId: z.string().optional(),
4956
+ decisionAt: z.number().optional(),
4957
+ rationale: z.string().optional(),
4958
+ metadata: z.record(z.any()).optional(),
4959
+ createdAt: z.number(),
4960
+ updatedAt: z.number()
4961
+ }),
4962
+ indices: [
4963
+ { kind: "index", name: "by_reviewKey", columns: ["reviewKey"] },
4964
+ { kind: "index", name: "by_tenant_reviewKey", columns: ["tenantId", "reviewKey"] },
4965
+ { kind: "index", name: "by_tenant_itemKey", columns: ["tenantId", "itemKey"] },
4966
+ { kind: "index", name: "by_subject", columns: ["subjectType", "subjectId"] },
4967
+ { kind: "index", name: "by_status", columns: ["status"] }
4968
+ ]
4969
+ });
4056
4970
  defineTable({
4057
4971
  name: "reasoningPermissions",
4058
- component: "identity",
4972
+ component: "control-plane",
4059
4973
  category: "epistemic",
4060
4974
  shape: z.object({
4061
4975
  "topicId": z.string().optional(),
@@ -4302,7 +5216,7 @@ defineTable({
4302
5216
  });
4303
5217
  defineTable({
4304
5218
  name: "users",
4305
- component: "identity",
5219
+ component: "control-plane",
4306
5220
  category: "user",
4307
5221
  shape: z.object({
4308
5222
  "clerkId": z.string(),
@@ -4416,7 +5330,6 @@ defineTable({
4416
5330
  "deployments": z.record(z.object({
4417
5331
  "url": z.string(),
4418
5332
  "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
4419
- "encryptedDeployKey": z.string().optional(),
4420
5333
  "credentialRef": z.string().optional()
4421
5334
  })).optional(),
4422
5335
  "metadata": z.record(z.any()).optional(),
@@ -4431,6 +5344,39 @@ defineTable({
4431
5344
  { kind: "index", name: "by_status", columns: ["status"] }
4432
5345
  ]
4433
5346
  });
5347
+ defineTable({
5348
+ name: "deploymentHosts",
5349
+ component: "mc",
5350
+ category: "workspace",
5351
+ shape: z.object({
5352
+ "host": z.string(),
5353
+ "tenantId": idOf("tenants"),
5354
+ "workspaceId": idOf("workspaces"),
5355
+ "environment": z.enum(["dev", "staging", "prod"]),
5356
+ "target": z.enum(["kernelDeployment", "appDeployment"]),
5357
+ "deploymentUrl": z.string().optional(),
5358
+ "deploymentName": z.string().optional(),
5359
+ "vercelProjectName": z.string().optional(),
5360
+ "vercelProjectId": z.string().optional(),
5361
+ "vercelEnvironment": z.enum(["development", "preview", "staging", "production"]).optional(),
5362
+ "source": z.enum(["vercel_preview", "vercel_production", "vercel_custom_environment", "custom_domain", "manual"]),
5363
+ "status": z.enum(["active", "revoked"]),
5364
+ "metadata": z.record(z.any()).optional(),
5365
+ "createdBy": z.string(),
5366
+ "createdAt": z.number(),
5367
+ "updatedAt": z.number(),
5368
+ "revokedAt": z.number().optional(),
5369
+ "revokedBy": z.string().optional()
5370
+ }),
5371
+ indices: [
5372
+ { kind: "index", name: "by_host", columns: ["host"] },
5373
+ { kind: "index", name: "by_tenantId", columns: ["tenantId"] },
5374
+ { kind: "index", name: "by_workspaceId", columns: ["workspaceId"] },
5375
+ { kind: "index", name: "by_tenant_workspace_environment", columns: ["tenantId", "workspaceId", "environment"] },
5376
+ { kind: "index", name: "by_workspace_status", columns: ["workspaceId", "status"] },
5377
+ { kind: "index", name: "by_status", columns: ["status"] }
5378
+ ]
5379
+ });
4434
5380
  defineTable({
4435
5381
  name: "worktreeBeliefCluster",
4436
5382
  component: "kernel",
@@ -4738,8 +5684,8 @@ defineTable({
4738
5684
  });
4739
5685
  z.object({
4740
5686
  manifestVersion: z.string(),
4741
- componentName: z.enum(["kernel", "identity"]),
4742
- tier: z.enum(["K", "I"]),
5687
+ componentName: z.enum(["kernel", "control-plane"]),
5688
+ tier: z.enum(["K", "CP"]),
4743
5689
  packageVersion: z.string(),
4744
5690
  tables: z.array(
4745
5691
  z.object({
@@ -4865,129 +5811,994 @@ var edgePolicyManifest = {
4865
5811
  // ../contracts/src/tenant-client.contract.ts
4866
5812
  var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
4867
5813
  {
4868
- packageName: "@lucern/access-control",
4869
- role: "runtime_entrypoint",
4870
- directTenantImport: true
5814
+ packageName: "@lucern/access-control",
5815
+ role: "runtime_entrypoint",
5816
+ directTenantImport: true
5817
+ },
5818
+ {
5819
+ packageName: "@lucern/agent",
5820
+ role: "platform_runtime",
5821
+ directTenantImport: false
5822
+ },
5823
+ {
5824
+ packageName: "@lucern/auth",
5825
+ role: "sdk_dependency",
5826
+ directTenantImport: false
5827
+ },
5828
+ {
5829
+ packageName: "@lucern/cli",
5830
+ role: "developer_tool",
5831
+ directTenantImport: false
5832
+ },
5833
+ {
5834
+ packageName: "@lucern/client-core",
5835
+ role: "sdk_dependency",
5836
+ directTenantImport: false
5837
+ },
5838
+ {
5839
+ packageName: "@lucern/confidence",
5840
+ role: "sdk_dependency",
5841
+ directTenantImport: false
5842
+ },
5843
+ {
5844
+ packageName: "@lucern/config",
5845
+ role: "configuration",
5846
+ directTenantImport: false
5847
+ },
5848
+ {
5849
+ packageName: "@lucern/contracts",
5850
+ role: "contract_entrypoint",
5851
+ directTenantImport: true
5852
+ },
5853
+ {
5854
+ packageName: "@lucern/control-plane",
5855
+ role: "component_runtime",
5856
+ directTenantImport: false
5857
+ },
5858
+ {
5859
+ packageName: "@lucern/developer-kit",
5860
+ role: "developer_tool",
5861
+ directTenantImport: false
5862
+ },
5863
+ {
5864
+ packageName: "@lucern/events",
5865
+ role: "sdk_dependency",
5866
+ directTenantImport: false
5867
+ },
5868
+ {
5869
+ packageName: "@lucern/graph-primitives",
5870
+ role: "sdk_dependency",
5871
+ directTenantImport: false
5872
+ },
5873
+ {
5874
+ packageName: "@lucern/graph-sync",
5875
+ role: "host_addon_runtime",
5876
+ directTenantImport: true
5877
+ },
5878
+ {
5879
+ packageName: "@lucern/mcp",
5880
+ role: "runtime_entrypoint",
5881
+ directTenantImport: true
5882
+ },
5883
+ {
5884
+ packageName: "@lucern/pack-host",
5885
+ role: "platform_runtime",
5886
+ directTenantImport: false
5887
+ },
5888
+ {
5889
+ packageName: "@lucern/pack-installer",
5890
+ role: "developer_tool",
5891
+ directTenantImport: false
5892
+ },
5893
+ {
5894
+ packageName: "@lucern/proof-compiler",
5895
+ role: "developer_tool",
5896
+ directTenantImport: false
5897
+ },
5898
+ {
5899
+ packageName: "@lucern/react",
5900
+ role: "runtime_entrypoint",
5901
+ directTenantImport: true
5902
+ },
5903
+ {
5904
+ packageName: "@lucern/reasoning-kernel",
5905
+ role: "component_runtime",
5906
+ directTenantImport: false
5907
+ },
5908
+ {
5909
+ packageName: "@lucern/sdk",
5910
+ role: "runtime_entrypoint",
5911
+ directTenantImport: true
5912
+ },
5913
+ {
5914
+ packageName: "@lucern/secrets",
5915
+ role: "sdk_dependency",
5916
+ directTenantImport: false
5917
+ },
5918
+ {
5919
+ packageName: "@lucern/server-core",
5920
+ role: "platform_runtime",
5921
+ directTenantImport: false
5922
+ },
5923
+ {
5924
+ packageName: "@lucern/testing",
5925
+ role: "test_support",
5926
+ directTenantImport: false
5927
+ },
5928
+ {
5929
+ packageName: "@lucern/types",
5930
+ role: "contract_entrypoint",
5931
+ directTenantImport: true
5932
+ }
5933
+ ];
5934
+ TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
5935
+ (entry) => entry.packageName
5936
+ );
5937
+
5938
+ // ../contracts/src/infisical-runtime.contract.ts
5939
+ var INFISICAL_TENANT_SOFTWARE_SYSTEMS = [
5940
+ {
5941
+ id: "stack-frontend",
5942
+ tenantKey: "stack",
5943
+ workspaceKey: "frontend",
5944
+ vercelProjectName: "ai-chatbot-diao",
5945
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5946
+ vercelProjectId: "prj_PihFw8kohSSw14nZs9YQV3xVo517",
5947
+ repository: {
5948
+ owner: "stack-vc",
5949
+ name: "front-end"
5950
+ },
5951
+ sharedSourcePath: "/tenants/stack",
5952
+ sharedVariablePolicy: "tenant_shared_all_systems",
5953
+ convex: {
5954
+ urlEnv: "CONVEX_FRONTEND_URL",
5955
+ deployKeyEnv: "CONVEX_FRONTEND_DEPLOY_KEY",
5956
+ preprodDeployment: "rugged-lobster-664",
5957
+ prodDeployment: "wonderful-toucan-0"
5958
+ }
5959
+ },
5960
+ {
5961
+ id: "stackos",
5962
+ tenantKey: "stack",
5963
+ workspaceKey: "stackos",
5964
+ vercelProjectName: "stackos",
5965
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5966
+ vercelProjectId: "prj_rXLAL0Z6v9p1fasKbomby6GI7kau",
5967
+ repository: {
5968
+ owner: "stack-vc",
5969
+ name: "stackos"
5970
+ },
5971
+ sharedSourcePath: "/tenants/stack",
5972
+ sharedVariablePolicy: "tenant_shared_all_systems",
5973
+ convex: {
5974
+ urlEnv: "CONVEX_STACKOS_URL",
5975
+ deployKeyEnv: "CONVEX_STACKOS_DEPLOY_KEY",
5976
+ preprodDeployment: "giant-mandrill-761",
5977
+ prodDeployment: "good-snake-515"
5978
+ }
5979
+ },
5980
+ {
5981
+ id: "stack-eng",
5982
+ tenantKey: "stack",
5983
+ workspaceKey: "engineering",
5984
+ vercelProjectName: "stackos-engineering-graph",
5985
+ vercelTeamId: "team_mZBKwvXSSu7qxrWdg2go29sK",
5986
+ vercelProjectId: "prj_zAU0Zn9GkbHjHI63dxW4vLpmoqTJ",
5987
+ repository: {
5988
+ owner: "stack-vc",
5989
+ name: "stackos-engineering-graph"
5990
+ },
5991
+ sharedSourcePath: "/tenants/stack/engineering",
5992
+ sharedVariablePolicy: "tenant_shared_all_systems",
5993
+ convex: {
5994
+ urlEnv: "CONVEX_STACK_ENG_URL",
5995
+ deployKeyEnv: "CONVEX_STACK_ENG_DEPLOY_KEY",
5996
+ preprodDeployment: "small-oyster-270",
5997
+ prodDeployment: "bold-cuttlefish-804"
5998
+ }
5999
+ },
6000
+ {
6001
+ id: "lucern-graph",
6002
+ tenantKey: "lucern",
6003
+ workspaceKey: "lucern",
6004
+ vercelProjectName: "lucern-graph",
6005
+ vercelTeamId: "team_vTHxxs8GAoAFUe6RWMlYt7fY",
6006
+ vercelProjectId: "prj_KJ8EKV8vGM5xURpqmwTwmECEGPgQ",
6007
+ repository: {
6008
+ owner: "LucernAI",
6009
+ name: "lucern-graph"
6010
+ },
6011
+ sharedSourcePath: "/tenants/lucern/shared",
6012
+ sharedVariablePolicy: "tenant_shared_all_systems",
6013
+ convex: {
6014
+ urlEnv: "CONVEX_LUCERN_URL",
6015
+ deployKeyEnv: "CONVEX_LUCERN_DEPLOY_KEY",
6016
+ preprodDeployment: "good-blackbird-774",
6017
+ prodDeployment: "precious-dog-365"
6018
+ }
6019
+ }
6020
+ ];
6021
+ var TENANT_SHARED_SECRET_DEFINITION_TEMPLATES = [
6022
+ {
6023
+ idSuffix: "clerk.publishable",
6024
+ canonicalName: "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
6025
+ aliases: ["CLERK_PUBLISHABLE_KEY"],
6026
+ required: true,
6027
+ secret: false,
6028
+ public: true,
6029
+ 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."
6030
+ },
6031
+ {
6032
+ idSuffix: "clerk.secret",
6033
+ canonicalName: "CLERK_SECRET_KEY",
6034
+ required: true,
6035
+ secret: true,
6036
+ public: false,
6037
+ description: "Tenant-owned Clerk backend secret used only by that tenant's server runtimes."
6038
+ },
6039
+ {
6040
+ idSuffix: "clerk.project",
6041
+ canonicalName: "CLERK_PROJECT_ID",
6042
+ required: true,
6043
+ secret: false,
6044
+ public: false,
6045
+ description: "Tenant-owned Clerk project id used to resolve canonical Clerk aliases."
6046
+ },
6047
+ {
6048
+ idSuffix: "clerk.jwks",
6049
+ canonicalName: "CLERK_JWT_ISSUER_DOMAIN",
6050
+ aliases: ["CLERK_ISSUER_URL", "CLERK_JWKS_URL"],
6051
+ required: false,
6052
+ secret: false,
6053
+ public: false,
6054
+ description: "Tenant Clerk issuer/JWKS URL consumed by Convex auth.config.ts."
6055
+ },
6056
+ {
6057
+ idSuffix: "clerk.jwt-key",
6058
+ canonicalName: "CLERK_JWT_KEY",
6059
+ required: false,
6060
+ secret: true,
6061
+ public: false,
6062
+ description: "Tenant Clerk JWT public verification key used by bearer-token API routes."
6063
+ },
6064
+ {
6065
+ idSuffix: "clerk.authorized-parties",
6066
+ canonicalName: "CLERK_AUTHORIZED_PARTIES",
6067
+ aliases: ["CLERK_MOBILE_AUTHORIZED_PARTIES"],
6068
+ required: false,
6069
+ secret: false,
6070
+ public: false,
6071
+ description: "Comma-separated Clerk authorized parties for browser and mobile bearer-token validation."
6072
+ },
6073
+ {
6074
+ idSuffix: "clerk.sign-in-url",
6075
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
6076
+ required: false,
6077
+ secret: false,
6078
+ public: true,
6079
+ description: "Tenant Clerk sign-in route for custom app login surfaces."
6080
+ },
6081
+ {
6082
+ idSuffix: "clerk.sign-up-url",
6083
+ canonicalName: "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
6084
+ required: false,
6085
+ secret: false,
6086
+ public: true,
6087
+ description: "Tenant Clerk sign-up route for custom app login surfaces."
6088
+ }
6089
+ ];
6090
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6091
+ (system) => TENANT_SHARED_SECRET_DEFINITION_TEMPLATES.map(
6092
+ (template) => ({
6093
+ id: `tenant.${system.id}.${template.idSuffix}`,
6094
+ canonicalName: template.canonicalName,
6095
+ aliases: "aliases" in template ? template.aliases : void 0,
6096
+ owner: "tenant",
6097
+ scope: "tenant",
6098
+ sourcePath: system.sharedSourcePath,
6099
+ environmentPolicy: "environment_specific",
6100
+ required: template.required,
6101
+ secret: template.secret,
6102
+ public: template.public,
6103
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6104
+ destinations: [
6105
+ {
6106
+ kind: "vercel",
6107
+ target: system.vercelProjectName,
6108
+ environmentPolicy: "preprod_staging_prod_prod"
6109
+ },
6110
+ {
6111
+ kind: "convex",
6112
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6113
+ environmentPolicy: "preprod_staging_prod_prod"
6114
+ }
6115
+ ],
6116
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6117
+ })
6118
+ )
6119
+ );
6120
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.map(
6121
+ (system) => ({
6122
+ id: `tenant.${system.id}.install-lucern-npm`,
6123
+ canonicalName: "INSTALL_LUCERN_NPM",
6124
+ owner: "provider",
6125
+ scope: "global",
6126
+ sourcePath: "/tenants/shared",
6127
+ environmentPolicy: "same_all_environments",
6128
+ required: true,
6129
+ secret: true,
6130
+ public: false,
6131
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6132
+ destinations: [
6133
+ {
6134
+ kind: "vercel",
6135
+ target: system.vercelProjectName,
6136
+ environmentPolicy: "same_all_environments"
6137
+ },
6138
+ {
6139
+ kind: "github_actions",
6140
+ target: `${system.repository.owner}/${system.repository.name}`,
6141
+ environmentPolicy: "same_all_environments"
6142
+ }
6143
+ ],
6144
+ description: `${system.tenantKey}/${system.workspaceKey}: read-only npm install token for published @lucern/* packages.`
6145
+ })
6146
+ );
6147
+ var TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS = ["stack-frontend", "stackos"];
6148
+ var TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES = [
6149
+ {
6150
+ idSuffix: "ai.openai-api-key",
6151
+ canonicalName: "OPENAI_API_KEY",
6152
+ required: false,
6153
+ secret: true,
6154
+ public: false,
6155
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6156
+ description: "Tenant-owned OpenAI key for product runtime LLM calls."
4871
6157
  },
4872
6158
  {
4873
- packageName: "@lucern/agent",
4874
- role: "platform_runtime",
4875
- directTenantImport: false
6159
+ idSuffix: "ai.anthropic-api-key",
6160
+ canonicalName: "ANTHROPIC_API_KEY",
6161
+ required: false,
6162
+ secret: true,
6163
+ public: false,
6164
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6165
+ description: "Tenant-owned Anthropic key for product runtime LLM calls."
4876
6166
  },
4877
6167
  {
4878
- packageName: "@lucern/auth",
4879
- role: "sdk_dependency",
4880
- directTenantImport: false
6168
+ idSuffix: "ai.gemini-api-key",
6169
+ canonicalName: "GEMINI_API_KEY",
6170
+ aliases: ["GOOGLE_AI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
6171
+ required: false,
6172
+ secret: true,
6173
+ public: false,
6174
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment", "tenant-ai-runtime"],
6175
+ description: "Tenant-owned Google/Gemini key for product runtime LLM calls."
4881
6176
  },
4882
6177
  {
4883
- packageName: "@lucern/cli",
4884
- role: "developer_tool",
4885
- directTenantImport: false
6178
+ idSuffix: "langfuse.secret-key",
6179
+ canonicalName: "LANGFUSE_SECRET_KEY",
6180
+ required: false,
6181
+ secret: true,
6182
+ public: false,
6183
+ consumers: [
6184
+ "tenant-vercel-app",
6185
+ "tenant-convex-deployment",
6186
+ "tenant-observability"
6187
+ ],
6188
+ description: "Tenant-owned Langfuse secret key for product AI tracing."
4886
6189
  },
4887
6190
  {
4888
- packageName: "@lucern/client-core",
4889
- role: "sdk_dependency",
4890
- directTenantImport: false
6191
+ idSuffix: "langfuse.public-key",
6192
+ canonicalName: "LANGFUSE_PUBLIC_KEY",
6193
+ required: false,
6194
+ secret: false,
6195
+ public: false,
6196
+ consumers: [
6197
+ "tenant-vercel-app",
6198
+ "tenant-convex-deployment",
6199
+ "tenant-observability"
6200
+ ],
6201
+ description: "Tenant-owned Langfuse public key for product AI tracing."
4891
6202
  },
4892
6203
  {
4893
- packageName: "@lucern/confidence",
4894
- role: "sdk_dependency",
4895
- directTenantImport: false
6204
+ idSuffix: "langfuse.base-url",
6205
+ canonicalName: "LANGFUSE_BASE_URL",
6206
+ aliases: ["LANGFUSE_BASEURL", "LANGFUSE_HOST"],
6207
+ required: false,
6208
+ secret: false,
6209
+ public: false,
6210
+ consumers: [
6211
+ "tenant-vercel-app",
6212
+ "tenant-convex-deployment",
6213
+ "tenant-observability"
6214
+ ],
6215
+ description: "Tenant-owned Langfuse API origin."
4896
6216
  },
4897
6217
  {
4898
- packageName: "@lucern/config",
4899
- role: "configuration",
4900
- directTenantImport: false
6218
+ idSuffix: "graph.neo4j-uri",
6219
+ canonicalName: "NEO4J_URI",
6220
+ required: false,
6221
+ secret: false,
6222
+ public: false,
6223
+ consumers: [
6224
+ "tenant-vercel-app",
6225
+ "tenant-convex-deployment",
6226
+ "tenant-graph-sync"
6227
+ ],
6228
+ description: "Tenant-owned Neo4j URI for product graph-sync."
4901
6229
  },
4902
6230
  {
4903
- packageName: "@lucern/contracts",
4904
- role: "contract_entrypoint",
4905
- directTenantImport: true
6231
+ idSuffix: "graph.neo4j-user",
6232
+ canonicalName: "NEO4J_USER",
6233
+ aliases: ["NEO4J_USERNAME"],
6234
+ required: false,
6235
+ secret: false,
6236
+ public: false,
6237
+ consumers: [
6238
+ "tenant-vercel-app",
6239
+ "tenant-convex-deployment",
6240
+ "tenant-graph-sync"
6241
+ ],
6242
+ description: "Tenant-owned Neo4j user for product graph-sync."
4906
6243
  },
4907
6244
  {
4908
- packageName: "@lucern/control-plane",
4909
- role: "platform_runtime",
4910
- directTenantImport: false
6245
+ idSuffix: "graph.neo4j-password",
6246
+ canonicalName: "NEO4J_PASSWORD",
6247
+ required: false,
6248
+ secret: true,
6249
+ public: false,
6250
+ consumers: [
6251
+ "tenant-vercel-app",
6252
+ "tenant-convex-deployment",
6253
+ "tenant-graph-sync"
6254
+ ],
6255
+ description: "Tenant-owned Neo4j password for product graph-sync."
4911
6256
  },
4912
6257
  {
4913
- packageName: "@lucern/developer-kit",
4914
- role: "developer_tool",
4915
- directTenantImport: false
6258
+ idSuffix: "graph.neo4j-sync-secret",
6259
+ canonicalName: "NEO4J_SYNC_SECRET",
6260
+ required: false,
6261
+ secret: true,
6262
+ public: false,
6263
+ consumers: [
6264
+ "tenant-vercel-app",
6265
+ "tenant-convex-deployment",
6266
+ "tenant-graph-sync"
6267
+ ],
6268
+ description: "Tenant-owned shared secret for product Convex-to-HTTP graph-sync calls."
4916
6269
  },
4917
6270
  {
4918
- packageName: "@lucern/events",
4919
- role: "sdk_dependency",
4920
- directTenantImport: false
6271
+ idSuffix: "graph.neo4j-database",
6272
+ canonicalName: "NEO4J_DATABASE",
6273
+ required: false,
6274
+ secret: false,
6275
+ public: false,
6276
+ consumers: [
6277
+ "tenant-vercel-app",
6278
+ "tenant-convex-deployment",
6279
+ "tenant-graph-sync"
6280
+ ],
6281
+ description: "Tenant-owned Neo4j database name for product graph-sync."
4921
6282
  },
4922
6283
  {
4923
- packageName: "@lucern/graph-primitives",
4924
- role: "sdk_dependency",
4925
- directTenantImport: false
6284
+ idSuffix: "vector.pinecone-api-key",
6285
+ canonicalName: "PINECONE_API_KEY",
6286
+ required: false,
6287
+ secret: true,
6288
+ public: false,
6289
+ consumers: [
6290
+ "tenant-vercel-app",
6291
+ "tenant-convex-deployment",
6292
+ "tenant-vector-store"
6293
+ ],
6294
+ description: "Tenant-owned Pinecone API key for product vector search."
4926
6295
  },
4927
6296
  {
4928
- packageName: "@lucern/graph-sync",
4929
- role: "host_addon_runtime",
4930
- directTenantImport: true
6297
+ idSuffix: "vector.pinecone-index-name",
6298
+ canonicalName: "PINECONE_INDEX_NAME",
6299
+ aliases: ["PINECONE_INDEX"],
6300
+ required: false,
6301
+ secret: false,
6302
+ public: false,
6303
+ consumers: [
6304
+ "tenant-vercel-app",
6305
+ "tenant-convex-deployment",
6306
+ "tenant-vector-store"
6307
+ ],
6308
+ description: "Tenant-owned Pinecone index name for product vector search."
4931
6309
  },
4932
6310
  {
4933
- packageName: "@lucern/identity",
4934
- role: "component_runtime",
4935
- directTenantImport: false
6311
+ idSuffix: "vector.pinecone-host",
6312
+ canonicalName: "PINECONE_HOST",
6313
+ aliases: ["PINECONE_INDEX_HOST"],
6314
+ required: false,
6315
+ secret: false,
6316
+ public: false,
6317
+ consumers: [
6318
+ "tenant-vercel-app",
6319
+ "tenant-convex-deployment",
6320
+ "tenant-vector-store"
6321
+ ],
6322
+ description: "Tenant-owned Pinecone host for product vector search."
4936
6323
  },
4937
6324
  {
4938
- packageName: "@lucern/mcp",
4939
- role: "runtime_entrypoint",
4940
- directTenantImport: true
6325
+ idSuffix: "vector.pinecone-namespace",
6326
+ canonicalName: "PINECONE_NAMESPACE",
6327
+ required: false,
6328
+ secret: false,
6329
+ public: false,
6330
+ consumers: [
6331
+ "tenant-vercel-app",
6332
+ "tenant-convex-deployment",
6333
+ "tenant-vector-store"
6334
+ ],
6335
+ description: "Tenant-owned Pinecone namespace for product vector search isolation."
4941
6336
  },
4942
6337
  {
4943
- packageName: "@lucern/pack-host",
4944
- role: "platform_runtime",
4945
- directTenantImport: false
6338
+ idSuffix: "storage.aws-access-key-id",
6339
+ canonicalName: "AWS_ACCESS_KEY_ID",
6340
+ required: false,
6341
+ secret: true,
6342
+ public: false,
6343
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6344
+ description: "Tenant-owned AWS access key id for document/file ingestion."
4946
6345
  },
4947
6346
  {
4948
- packageName: "@lucern/pack-installer",
4949
- role: "developer_tool",
4950
- directTenantImport: false
6347
+ idSuffix: "storage.aws-secret-access-key",
6348
+ canonicalName: "AWS_SECRET_ACCESS_KEY",
6349
+ required: false,
6350
+ secret: true,
6351
+ public: false,
6352
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6353
+ description: "Tenant-owned AWS secret access key for document/file ingestion."
4951
6354
  },
4952
6355
  {
4953
- packageName: "@lucern/proof-compiler",
4954
- role: "developer_tool",
4955
- directTenantImport: false
6356
+ idSuffix: "storage.aws-region",
6357
+ canonicalName: "AWS_REGION",
6358
+ required: false,
6359
+ secret: false,
6360
+ public: false,
6361
+ consumers: ["tenant-vercel-app", "tenant-convex-deployment"],
6362
+ description: "Tenant-owned AWS region for document/file ingestion."
4956
6363
  },
4957
6364
  {
4958
- packageName: "@lucern/react",
4959
- role: "runtime_entrypoint",
4960
- directTenantImport: true
6365
+ idSuffix: "observability.sentry-dsn",
6366
+ canonicalName: "NEXT_PUBLIC_SENTRY_DSN",
6367
+ aliases: ["NEXT_PUBLIC_SENTRY_DSN_NEXTJS", "SENTRY_DSN"],
6368
+ required: false,
6369
+ secret: false,
6370
+ public: true,
6371
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6372
+ description: "Tenant-owned Sentry DSN for app telemetry."
4961
6373
  },
4962
6374
  {
4963
- packageName: "@lucern/reasoning-kernel",
4964
- role: "component_runtime",
4965
- directTenantImport: false
6375
+ idSuffix: "observability.sentry-auth-token",
6376
+ canonicalName: "SENTRY_AUTH_TOKEN",
6377
+ required: false,
6378
+ secret: true,
6379
+ public: false,
6380
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6381
+ description: "Tenant-owned Sentry release token for app deployments."
4966
6382
  },
4967
6383
  {
4968
- packageName: "@lucern/sdk",
4969
- role: "runtime_entrypoint",
4970
- directTenantImport: true
6384
+ idSuffix: "observability.sentry-org",
6385
+ canonicalName: "SENTRY_ORG",
6386
+ aliases: ["SENTRY_ORG_SLUG"],
6387
+ required: false,
6388
+ secret: false,
6389
+ public: false,
6390
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6391
+ description: "Tenant-owned Sentry org slug for release uploads."
4971
6392
  },
4972
6393
  {
4973
- packageName: "@lucern/server-core",
4974
- role: "platform_runtime",
4975
- directTenantImport: false
6394
+ idSuffix: "observability.sentry-project",
6395
+ canonicalName: "SENTRY_PROJECT",
6396
+ aliases: ["SENTRY_PROJECT_NEXTJS"],
6397
+ required: false,
6398
+ secret: false,
6399
+ public: false,
6400
+ consumers: ["tenant-deploy-tooling", "tenant-observability"],
6401
+ description: "Tenant-owned Sentry project slug for release uploads."
4976
6402
  },
4977
6403
  {
4978
- packageName: "@lucern/testing",
4979
- role: "test_support",
4980
- directTenantImport: false
6404
+ idSuffix: "observability.sentry-environment",
6405
+ canonicalName: "NEXT_PUBLIC_SENTRY_ENVIRONMENT",
6406
+ aliases: ["SENTRY_ENVIRONMENT"],
6407
+ required: false,
6408
+ secret: false,
6409
+ public: true,
6410
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6411
+ description: "Tenant-owned Sentry environment label."
4981
6412
  },
4982
6413
  {
4983
- packageName: "@lucern/types",
4984
- role: "contract_entrypoint",
4985
- directTenantImport: true
6414
+ idSuffix: "observability.sentry-release",
6415
+ canonicalName: "NEXT_PUBLIC_SENTRY_RELEASE",
6416
+ aliases: ["SENTRY_RELEASE"],
6417
+ required: false,
6418
+ secret: false,
6419
+ public: true,
6420
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6421
+ description: "Tenant-owned Sentry release label."
6422
+ },
6423
+ {
6424
+ idSuffix: "observability.sentry-client-options",
6425
+ canonicalName: "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE",
6426
+ aliases: [
6427
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS",
6428
+ "NEXT_PUBLIC_SENTRY_CAPTURE_CONSOLE_LEVELS_NEXTJS",
6429
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS",
6430
+ "NEXT_PUBLIC_SENTRY_CONSOLE_BREADCRUMB_LEVELS_NEXTJS",
6431
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS",
6432
+ "NEXT_PUBLIC_SENTRY_CONSOLE_LOG_LEVELS_NEXTJS",
6433
+ "NEXT_PUBLIC_SENTRY_ENABLE_LOGS",
6434
+ "NEXT_PUBLIC_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE",
6435
+ "NEXT_PUBLIC_SENTRY_REPLAYS_SESSION_SAMPLE_RATE",
6436
+ "NEXT_PUBLIC_SENTRY_SEND_DEFAULT_PII",
6437
+ "NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE_NEXTJS"
6438
+ ],
6439
+ required: false,
6440
+ secret: false,
6441
+ public: true,
6442
+ consumers: ["tenant-vercel-app", "tenant-observability"],
6443
+ description: "Tenant-owned public Sentry tuning values for Next.js client instrumentation."
6444
+ },
6445
+ {
6446
+ idSuffix: "observability.sentry-webhook-secret",
6447
+ canonicalName: "SENTRY_WEBHOOK_SECRET",
6448
+ required: false,
6449
+ secret: true,
6450
+ public: false,
6451
+ consumers: ["tenant-convex-deployment", "tenant-observability"],
6452
+ description: "Tenant-owned Sentry webhook verification secret."
6453
+ },
6454
+ {
6455
+ idSuffix: "lucern.gateway-api-key",
6456
+ canonicalName: "LUCERN_API_KEY",
6457
+ aliases: ["STACK_API_KEY"],
6458
+ required: false,
6459
+ secret: true,
6460
+ public: false,
6461
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6462
+ description: "Tenant-scoped Lucern/MC gateway API key for product front-door calls."
6463
+ },
6464
+ {
6465
+ idSuffix: "lucern.gateway-base-url",
6466
+ canonicalName: "LUCERN_BASE_URL",
6467
+ aliases: ["LUCERN_API_BASE_URL", "LUCERN_GATEWAY_BASE_URL"],
6468
+ required: false,
6469
+ secret: false,
6470
+ public: false,
6471
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6472
+ description: "Lucern/MC gateway base URL used by tenant product apps."
6473
+ },
6474
+ {
6475
+ idSuffix: "lucern.proxy-token-secret",
6476
+ canonicalName: "LUCERN_PROXY_TOKEN_SECRET",
6477
+ required: false,
6478
+ secret: true,
6479
+ public: false,
6480
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6481
+ description: "Tenant-owned secret for signing internal proxy/session tokens in product apps."
6482
+ },
6483
+ {
6484
+ idSuffix: "tenant.integrations.linear-api-key",
6485
+ canonicalName: "LINEAR_API_KEY",
6486
+ required: false,
6487
+ secret: true,
6488
+ public: false,
6489
+ consumers: ["tenant-vercel-app", "tenant-agent-runtime"],
6490
+ description: "Tenant-owned Linear API key for support/slash-command flows."
6491
+ },
6492
+ {
6493
+ idSuffix: "tenant.vercel.bypass-token",
6494
+ canonicalName: "VERCEL_AUTOMATION_BYPASS_SECRET",
6495
+ aliases: ["NEXT_PUBLIC_VERCEL_BYPASS_TOKEN"],
6496
+ required: false,
6497
+ secret: true,
6498
+ public: false,
6499
+ consumers: ["tenant-vercel-app", "tenant-deploy-tooling"],
6500
+ description: "Tenant-owned Vercel automation bypass token. Public alias is legacy and should be removed from app code."
4986
6501
  }
4987
6502
  ];
4988
- TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
4989
- (entry) => entry.packageName
6503
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.filter(
6504
+ (system) => TENANT_PRODUCT_SOFTWARE_SYSTEM_IDS.includes(system.id)
6505
+ ).flatMap(
6506
+ (system) => TENANT_PRODUCT_RUNTIME_SECRET_DEFINITION_TEMPLATES.map(
6507
+ (template) => ({
6508
+ id: `tenant.${system.id}.${template.idSuffix}`,
6509
+ canonicalName: template.canonicalName,
6510
+ aliases: "aliases" in template ? template.aliases : void 0,
6511
+ owner: "tenant",
6512
+ scope: "tenant",
6513
+ sourcePath: system.sharedSourcePath,
6514
+ environmentPolicy: "environment_specific",
6515
+ required: template.required,
6516
+ secret: template.secret,
6517
+ public: template.public,
6518
+ consumers: template.consumers,
6519
+ destinations: [
6520
+ {
6521
+ kind: "vercel",
6522
+ target: system.vercelProjectName,
6523
+ environmentPolicy: "preprod_staging_prod_prod"
6524
+ },
6525
+ {
6526
+ kind: "convex",
6527
+ target: `${system.convex.preprodDeployment}|${system.convex.prodDeployment}`,
6528
+ environmentPolicy: "preprod_staging_prod_prod"
6529
+ },
6530
+ {
6531
+ kind: "github_actions",
6532
+ target: `${system.repository.owner}/${system.repository.name}`,
6533
+ environmentPolicy: "preprod_staging_prod_prod"
6534
+ }
6535
+ ],
6536
+ description: `${system.tenantKey}/${system.workspaceKey}: ${template.description}`
6537
+ })
6538
+ )
6539
+ );
6540
+ function tenantVercelConvexUrlWriteNames(system) {
6541
+ const names = [system.convex.urlEnv, "NEXT_PUBLIC_CONVEX_URL"];
6542
+ if (system.id === "stack-eng") {
6543
+ return [...names, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6544
+ }
6545
+ return names;
6546
+ }
6547
+ function tenantRepositoryConvexUrlWriteNames(system) {
6548
+ if (system.id === "stack-eng") {
6549
+ return [system.convex.urlEnv, "STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6550
+ }
6551
+ return [system.convex.urlEnv];
6552
+ }
6553
+ function tenantRepositoryConvexDeployKeyWriteNames(system) {
6554
+ if (system.id === "stack-eng") {
6555
+ return [system.convex.deployKeyEnv, "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6556
+ }
6557
+ return [system.convex.deployKeyEnv];
6558
+ }
6559
+ function tenantConvexUrlAliases(system) {
6560
+ if (system.id === "stack-frontend") {
6561
+ return [
6562
+ "CONVEX_PROD_URL",
6563
+ "CONVEX_STACK_V2_PROD_URL",
6564
+ "CONVEX_STACK_V2_STAGING_URL",
6565
+ "STACK_CONVEX_URL"
6566
+ ];
6567
+ }
6568
+ if (system.id === "stackos") {
6569
+ return [
6570
+ "CONVEX_CLOUD_URL",
6571
+ "CONVEX_STACK_URL",
6572
+ "CONVEX_URL",
6573
+ "CONVEX_URL_DEVELOPMENT",
6574
+ "CONVEX_URL_PRODUCTION",
6575
+ "STACK_CONVEX_URL"
6576
+ ];
6577
+ }
6578
+ if (system.id === "stack-eng") {
6579
+ return ["STACKOS_ENGINEERING_GRAPH_CONVEX_URL"];
6580
+ }
6581
+ if (system.id === "lucern-graph") {
6582
+ return [
6583
+ "CONVEX_GRAPH_URL",
6584
+ "LUCERN_PROD_URL",
6585
+ "NEXT_PUBLIC_LUCERN_GRAPH_URL"
6586
+ ];
6587
+ }
6588
+ return void 0;
6589
+ }
6590
+ function tenantConvexDeployKeyAliases(system) {
6591
+ if (system.id === "stack-frontend") {
6592
+ return [
6593
+ "CONVEX_STACK_V2_PROD_DEPLOY_KEY",
6594
+ "CONVEX_STACK_V2_STAGING_DEPLOY_KEY",
6595
+ "STACK_DEPLOY_KEY"
6596
+ ];
6597
+ }
6598
+ if (system.id === "stackos") {
6599
+ return [
6600
+ "CONVEX_DEPLOY_KEY",
6601
+ "CONVEX_DEV_DEPLOY_KEY",
6602
+ "CONVEX_PROD_DEPLOY_KEY",
6603
+ "CONVEX_STACK_DEPLOY_KEY",
6604
+ "STACK_DEPLOY_KEY"
6605
+ ];
6606
+ }
6607
+ if (system.id === "stack-eng") {
6608
+ return ["CONVEX_DEPLOY_KEY", "STACKOS_ENGINEERING_GRAPH_DEPLOY_KEY"];
6609
+ }
6610
+ if (system.id === "lucern-graph") {
6611
+ return [
6612
+ "CONVEX_DEPLOY_KEY",
6613
+ "CONVEX_GRAPH_DEPLOY_KEY",
6614
+ "LUCERN_CONVEX_DEPLOY_KEY",
6615
+ "LUCERN_DEV_DEPLOY_KEY",
6616
+ "LUCERN_PROD_DEPLOY_KEY"
6617
+ ];
6618
+ }
6619
+ return void 0;
6620
+ }
6621
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap(
6622
+ (system) => {
6623
+ if (system.id === "lucern-graph") {
6624
+ return [
6625
+ {
6626
+ id: "tenant.lucern-graph.public.tenant-id",
6627
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_ID",
6628
+ aliases: ["NEXT_PUBLIC_LUCERN_TENANT_ID"],
6629
+ owner: "tenant",
6630
+ scope: "workspace",
6631
+ sourcePath: system.sharedSourcePath,
6632
+ environmentPolicy: "environment_specific",
6633
+ required: false,
6634
+ secret: false,
6635
+ public: true,
6636
+ consumers: ["tenant-vercel-app"],
6637
+ destinations: [
6638
+ {
6639
+ kind: "vercel",
6640
+ target: system.vercelProjectName,
6641
+ environmentPolicy: "preprod_staging_prod_prod"
6642
+ }
6643
+ ],
6644
+ description: "Lucern graph public tenant id used by the standalone graph explorer."
6645
+ },
6646
+ {
6647
+ id: "tenant.lucern-graph.public.tenant-label",
6648
+ canonicalName: "NEXT_PUBLIC_LUCERN_GRAPH_TENANT_LABEL",
6649
+ owner: "tenant",
6650
+ scope: "workspace",
6651
+ sourcePath: system.sharedSourcePath,
6652
+ environmentPolicy: "environment_specific",
6653
+ required: false,
6654
+ secret: false,
6655
+ public: true,
6656
+ consumers: ["tenant-vercel-app"],
6657
+ destinations: [
6658
+ {
6659
+ kind: "vercel",
6660
+ target: system.vercelProjectName,
6661
+ environmentPolicy: "preprod_staging_prod_prod"
6662
+ }
6663
+ ],
6664
+ description: "Lucern graph public tenant label used by the standalone graph explorer."
6665
+ }
6666
+ ];
6667
+ }
6668
+ if (system.id === "stack-eng") {
6669
+ return [
6670
+ {
6671
+ id: "tenant.stack-eng.public.tenant-id",
6672
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_ID",
6673
+ owner: "tenant",
6674
+ scope: "workspace",
6675
+ sourcePath: system.sharedSourcePath,
6676
+ environmentPolicy: "environment_specific",
6677
+ required: false,
6678
+ secret: false,
6679
+ public: true,
6680
+ consumers: ["tenant-vercel-app"],
6681
+ destinations: [
6682
+ {
6683
+ kind: "vercel",
6684
+ target: system.vercelProjectName,
6685
+ environmentPolicy: "preprod_staging_prod_prod"
6686
+ }
6687
+ ],
6688
+ description: "Stack engineering graph public tenant id used by the graph explorer."
6689
+ },
6690
+ {
6691
+ id: "tenant.stack-eng.public.tenant-label",
6692
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_TENANT_LABEL",
6693
+ owner: "tenant",
6694
+ scope: "workspace",
6695
+ sourcePath: system.sharedSourcePath,
6696
+ environmentPolicy: "environment_specific",
6697
+ required: false,
6698
+ secret: false,
6699
+ public: true,
6700
+ consumers: ["tenant-vercel-app"],
6701
+ destinations: [
6702
+ {
6703
+ kind: "vercel",
6704
+ target: system.vercelProjectName,
6705
+ environmentPolicy: "preprod_staging_prod_prod"
6706
+ }
6707
+ ],
6708
+ description: "Stack engineering graph public tenant label used by the graph explorer."
6709
+ },
6710
+ {
6711
+ id: "tenant.stack-eng.public.environment",
6712
+ canonicalName: "NEXT_PUBLIC_STACKOS_ENGINEERING_GRAPH_ENV",
6713
+ owner: "tenant",
6714
+ scope: "workspace",
6715
+ sourcePath: system.sharedSourcePath,
6716
+ environmentPolicy: "environment_specific",
6717
+ required: false,
6718
+ secret: false,
6719
+ public: true,
6720
+ consumers: ["tenant-vercel-app"],
6721
+ destinations: [
6722
+ {
6723
+ kind: "vercel",
6724
+ target: system.vercelProjectName,
6725
+ environmentPolicy: "preprod_staging_prod_prod"
6726
+ }
6727
+ ],
6728
+ description: "Stack engineering graph public environment label used by the graph explorer."
6729
+ }
6730
+ ];
6731
+ }
6732
+ return [];
6733
+ }
4990
6734
  );
6735
+ INFISICAL_TENANT_SOFTWARE_SYSTEMS.flatMap((system) => [
6736
+ {
6737
+ id: `tenant.${system.id}.convex.url`,
6738
+ canonicalName: system.convex.urlEnv,
6739
+ aliases: tenantConvexUrlAliases(system),
6740
+ owner: "tenant",
6741
+ scope: "software_system",
6742
+ sourcePath: system.sharedSourcePath,
6743
+ environmentPolicy: "preprod_staging_prod_prod",
6744
+ required: true,
6745
+ secret: false,
6746
+ public: false,
6747
+ consumers: [
6748
+ "tenant-vercel-app",
6749
+ "tenant-agent-runtime",
6750
+ "mc-operator-tooling"
6751
+ ],
6752
+ destinations: [
6753
+ {
6754
+ kind: "vercel",
6755
+ target: system.vercelProjectName,
6756
+ environmentPolicy: "preprod_staging_prod_prod",
6757
+ writeNames: tenantVercelConvexUrlWriteNames(system)
6758
+ },
6759
+ {
6760
+ kind: "github_actions",
6761
+ target: `${system.repository.owner}/${system.repository.name}`,
6762
+ environmentPolicy: "preprod_staging_prod_prod",
6763
+ writeNames: tenantRepositoryConvexUrlWriteNames(system),
6764
+ notes: "Only if that repository deploy/test workflow owns this software system."
6765
+ }
6766
+ ],
6767
+ description: `${system.tenantKey}/${system.workspaceKey} Convex URL. Pre-prod resolves to ${system.convex.preprodDeployment}; prod resolves to ${system.convex.prodDeployment}.`
6768
+ },
6769
+ {
6770
+ id: `tenant.${system.id}.convex.deploy-key`,
6771
+ canonicalName: system.convex.deployKeyEnv,
6772
+ aliases: tenantConvexDeployKeyAliases(system),
6773
+ owner: "tenant",
6774
+ scope: "software_system",
6775
+ sourcePath: system.sharedSourcePath,
6776
+ environmentPolicy: "preprod_staging_prod_prod",
6777
+ required: true,
6778
+ secret: true,
6779
+ public: false,
6780
+ consumers: [
6781
+ "tenant-vercel-app",
6782
+ "tenant-agent-runtime",
6783
+ "mc-operator-tooling"
6784
+ ],
6785
+ destinations: [
6786
+ {
6787
+ kind: "vercel",
6788
+ target: system.vercelProjectName,
6789
+ environmentPolicy: "preprod_staging_prod_prod"
6790
+ },
6791
+ {
6792
+ kind: "github_actions",
6793
+ target: `${system.repository.owner}/${system.repository.name}`,
6794
+ environmentPolicy: "preprod_staging_prod_prod",
6795
+ writeNames: tenantRepositoryConvexDeployKeyWriteNames(system),
6796
+ notes: "Only if that repository deploy/test workflow owns this software system."
6797
+ }
6798
+ ],
6799
+ description: `${system.tenantKey}/${system.workspaceKey} Convex deploy/admin key. Never route to sibling workspaces.`
6800
+ }
6801
+ ]);
4991
6802
  z.object({
4992
6803
  manifestVersion: z.literal("1.0.0"),
4993
6804
  rules: z.array(
@@ -5028,7 +6839,7 @@ var createEvidenceInputSchemaBase = z.object({
5028
6839
  targetId: z.string().optional(),
5029
6840
  targetNodeId: z.string().optional(),
5030
6841
  linkedBeliefNodeId: z.string().optional(),
5031
- evidenceRelation: z.enum(["supports", "contradicts", "neutral"]).optional(),
6842
+ evidenceRelation: z.enum(["supports", "contradicts"]).optional(),
5032
6843
  confidence: z.number().optional(),
5033
6844
  weight: z.number().optional(),
5034
6845
  reasoning: z.string().optional(),
@@ -5113,8 +6924,7 @@ var createEvidenceProjection = defineProjection({
5113
6924
  evidenceRelation: v.optional(
5114
6925
  v.union(
5115
6926
  v.literal("supports"),
5116
- v.literal("contradicts"),
5117
- v.literal("neutral")
6927
+ v.literal("contradicts")
5118
6928
  )
5119
6929
  ),
5120
6930
  confidence: v.optional(v.number()),
@@ -5163,12 +6973,17 @@ var listBeliefsProjection = defineProjection({
5163
6973
  });
5164
6974
  var taskStatusSchema = z.enum(["todo", "in_progress", "blocked", "done"]).optional().describe("Filter by task status");
5165
6975
  var listTasksInputSchema = z.object({
5166
- topicId: z.string().describe("Topic scope"),
6976
+ topicId: z.string().optional().describe("Topic scope"),
5167
6977
  worktreeId: z.string().optional().describe("Alias for linkedWorktreeId"),
5168
6978
  linkedWorktreeId: z.string().optional().describe("Filter to tasks linked to this worktree"),
5169
6979
  status: taskStatusSchema,
5170
6980
  limit: z.number().optional().describe("Maximum results")
5171
- });
6981
+ }).refine(
6982
+ (input) => Boolean(input.topicId || input.worktreeId || input.linkedWorktreeId),
6983
+ {
6984
+ message: "topicId or worktreeId is required"
6985
+ }
6986
+ );
5172
6987
  function compactRecord3(input) {
5173
6988
  return Object.fromEntries(
5174
6989
  Object.entries(input).filter(([, value]) => value !== void 0)
@@ -5185,7 +7000,7 @@ var listTasksProjection = defineProjection({
5185
7000
  linkedWorktreeId: input.linkedWorktreeId ?? input.worktreeId
5186
7001
  }),
5187
7002
  convexArgsValidator: v.object({
5188
- topicId: v.string(),
7003
+ topicId: v.optional(v.string()),
5189
7004
  status: v.optional(
5190
7005
  v.union(
5191
7006
  v.literal("todo"),
@@ -6189,7 +8004,7 @@ var CREATE_EDGE = {
6189
8004
  reasoningMethod: {
6190
8005
  type: "string",
6191
8006
  description: "How this was determined",
6192
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
8007
+ enum: [...REASONING_METHODS]
6193
8008
  },
6194
8009
  metadata: {
6195
8010
  type: "object",
@@ -7916,6 +9731,10 @@ var CREATE_TASK = {
7916
9731
  tags: {
7917
9732
  type: "array",
7918
9733
  description: "Free-form string tags"
9734
+ },
9735
+ metadata: {
9736
+ type: "object",
9737
+ description: "Structured task metadata for handoff context and routing hints"
7919
9738
  }
7920
9739
  },
7921
9740
  required: ["title"],
@@ -7989,6 +9808,10 @@ var UPDATE_TASK = {
7989
9808
  type: "string",
7990
9809
  description: "Updated status",
7991
9810
  enum: ["todo", "in_progress", "blocked", "done"]
9811
+ },
9812
+ metadata: {
9813
+ type: "object",
9814
+ description: "Structured task metadata to replace or refine"
7992
9815
  }
7993
9816
  },
7994
9817
  required: ["taskId"],
@@ -9444,6 +11267,9 @@ var BEGIN_BUILD_SESSION = {
9444
11267
  sessionMode: "string \u2014 async | interactive",
9445
11268
  targetBeliefIds: "array \u2014 scoped belief IDs",
9446
11269
  targetQuestionIds: "array \u2014 scoped question IDs",
11270
+ taskIds: "array \u2014 assigned task IDs for this worktree",
11271
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
11272
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
9447
11273
  topBeliefs: "array \u2014 highest-confidence scoped beliefs",
9448
11274
  openQuestions: "array \u2014 open scoped questions",
9449
11275
  resolvedDecisions: "array \u2014 answered questions summarized for the session",
@@ -10044,12 +11870,20 @@ function unwrapMcpParameterSchema(schema) {
10044
11870
  current = current._def.schema;
10045
11871
  continue;
10046
11872
  default:
10047
- return { schema: current, required, description: description ?? current.description };
11873
+ return {
11874
+ schema: current,
11875
+ required,
11876
+ description: description ?? current.description
11877
+ };
10048
11878
  }
10049
11879
  }
10050
11880
  }
10051
11881
  function mcpParameterFromZod(fieldName, schema, contractName) {
10052
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
11882
+ const {
11883
+ schema: unwrapped,
11884
+ required,
11885
+ description: schemaDescription
11886
+ } = unwrapMcpParameterSchema(schema);
10053
11887
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
10054
11888
  switch (unwrapped._def.typeName) {
10055
11889
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -10094,10 +11928,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
10094
11928
  const entries2 = Object.entries(getObjectShape(args)).sort(
10095
11929
  ([left], [right]) => left.localeCompare(right)
10096
11930
  );
10097
- const converted = entries2.map(([fieldName, schema]) => [
10098
- fieldName,
10099
- mcpParameterFromZod(fieldName, schema, contractName)
10100
- ]);
11931
+ const converted = entries2.map(
11932
+ ([fieldName, schema]) => [
11933
+ fieldName,
11934
+ mcpParameterFromZod(fieldName, schema, contractName)
11935
+ ]
11936
+ );
10101
11937
  return {
10102
11938
  ...base,
10103
11939
  parameters: Object.fromEntries(
@@ -10209,6 +12045,7 @@ function surfaceContract(args) {
10209
12045
  allowedPrincipalTypes: ["user", "service", "agent"]
10210
12046
  },
10211
12047
  convex: args.convex,
12048
+ gateway: args.gateway,
10212
12049
  args: canonicalArgs,
10213
12050
  returns: canonicalReturns,
10214
12051
  input,
@@ -10695,7 +12532,7 @@ var beliefsContracts = [
10695
12532
  })
10696
12533
  ];
10697
12534
  var jsonRecordSchema4 = z.record(z.unknown());
10698
- var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
12535
+ var evidenceRelationSchema = z.enum(["supports", "contradicts"]);
10699
12536
  var createEvidenceArgs = z.object({
10700
12537
  topicId: z.string().optional().describe("Topic scope for the evidence."),
10701
12538
  text: z.string().describe("Canonical evidence text."),
@@ -12618,7 +14455,8 @@ var createTaskArgs = z.object({
12618
14455
  linkedQuestionId: z.string().optional().describe("Question this task addresses."),
12619
14456
  assigneeId: z.string().optional().describe("Principal assigned to the task."),
12620
14457
  dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
12621
- tags: z.array(z.string()).optional().describe("Free-form tags.")
14458
+ tags: z.array(z.string()).optional().describe("Free-form tags."),
14459
+ metadata: z.record(z.unknown()).optional().describe("Structured task metadata for handoff context and routing hints.")
12622
14460
  });
12623
14461
  var createTaskInput = (input) => compactRecord4({
12624
14462
  title: input.title,
@@ -12632,7 +14470,8 @@ var createTaskInput = (input) => compactRecord4({
12632
14470
  linkedQuestionId: input.linkedQuestionId,
12633
14471
  assigneeId: input.assigneeId,
12634
14472
  dueDate: input.dueDate,
12635
- tags: input.tags
14473
+ tags: input.tags,
14474
+ metadata: input.metadata
12636
14475
  });
12637
14476
  var taskInput = (input) => compactRecord4({
12638
14477
  ...input,
@@ -12649,8 +14488,7 @@ var taskTopicInput = (input) => {
12649
14488
  };
12650
14489
  var completeTaskInput = (input) => compactRecord4({
12651
14490
  taskId: input.taskId ?? input.id,
12652
- outputSummary: input.outputSummary ?? input.summary,
12653
- userId: input.userId
14491
+ outputSummary: input.outputSummary ?? input.summary
12654
14492
  });
12655
14493
  var tasksContracts = [
12656
14494
  surfaceContract({
@@ -12668,6 +14506,7 @@ var tasksContracts = [
12668
14506
  kind: "mutation",
12669
14507
  inputProjection: createTaskInput
12670
14508
  },
14509
+ gateway: { handler: "tasks.create" },
12671
14510
  args: createTaskArgs
12672
14511
  }),
12673
14512
  surfaceContract({
@@ -12686,6 +14525,7 @@ var tasksContracts = [
12686
14525
  kind: "query",
12687
14526
  inputProjection: taskTopicInput
12688
14527
  },
14528
+ gateway: { handler: "tasks.list" },
12689
14529
  args: listTasksInputSchema
12690
14530
  }),
12691
14531
  surfaceContract({
@@ -12703,7 +14543,8 @@ var tasksContracts = [
12703
14543
  functionName: "update",
12704
14544
  kind: "mutation",
12705
14545
  inputProjection: taskInput
12706
- }
14546
+ },
14547
+ gateway: { handler: "tasks.update" }
12707
14548
  }),
12708
14549
  surfaceContract({
12709
14550
  name: "complete_task",
@@ -12719,12 +14560,14 @@ var tasksContracts = [
12719
14560
  functionName: "complete",
12720
14561
  kind: "mutation",
12721
14562
  inputProjection: completeTaskInput
12722
- }
14563
+ },
14564
+ gateway: { handler: "tasks.complete" }
12723
14565
  })
12724
14566
  ];
12725
14567
  var CREATE_EDGE_TYPES = edgePolicyManifest.policies.map(
12726
14568
  (policy) => policy.edgeType
12727
14569
  );
14570
+ var REASONING_METHOD_TYPES = [...REASONING_METHODS];
12728
14571
  var createEdgeArgs = z.object({
12729
14572
  from: GraphRefSchema,
12730
14573
  to: GraphRefSchema,
@@ -12734,6 +14577,7 @@ var createEdgeArgs = z.object({
12734
14577
  confidence: z.number().optional(),
12735
14578
  context: z.string().optional(),
12736
14579
  reasoning: z.string().optional(),
14580
+ reasoningMethod: z.enum(REASONING_METHOD_TYPES).optional(),
12737
14581
  derivationType: z.string().optional(),
12738
14582
  metadata: z.record(z.unknown()).optional(),
12739
14583
  topicId: z.string().optional(),
@@ -12812,6 +14656,7 @@ var edgesContracts = [
12812
14656
  weight: parsed.weight,
12813
14657
  confidence: parsed.confidence,
12814
14658
  context: parsed.context ?? parsed.reasoning,
14659
+ reasoningMethod: parsed.reasoningMethod,
12815
14660
  derivationType: parsed.derivationType,
12816
14661
  metadata: parsed.metadata,
12817
14662
  skipLayerValidation: true,
@@ -12936,6 +14781,7 @@ var edgesContracts = [
12936
14781
  weight: edge.weight,
12937
14782
  confidence: edge.confidence,
12938
14783
  context: edge.context ?? edge.reasoning,
14784
+ reasoningMethod: edge.reasoningMethod,
12939
14785
  derivationType: edge.derivationType,
12940
14786
  metadata: edge.metadata,
12941
14787
  topicId: edge.topicId
@@ -13670,6 +15516,69 @@ var pipelineContracts = [
13670
15516
  }
13671
15517
  })
13672
15518
  ];
15519
+ function isRecord3(value) {
15520
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15521
+ }
15522
+ function stringValues(value) {
15523
+ if (typeof value === "string") {
15524
+ return [value];
15525
+ }
15526
+ if (Array.isArray(value)) {
15527
+ return value.flatMap((item) => stringValues(item));
15528
+ }
15529
+ return [];
15530
+ }
15531
+ function nestedEvidenceRows(value) {
15532
+ if (Array.isArray(value)) {
15533
+ return value.flatMap((item) => nestedEvidenceRows(item));
15534
+ }
15535
+ if (!isRecord3(value)) {
15536
+ return [];
15537
+ }
15538
+ const nestedKeys = ["evidence", "items", "nodes"];
15539
+ const nestedRows = nestedKeys.flatMap((key) => nestedEvidenceRows(value[key]));
15540
+ return nestedRows.length > 0 ? nestedRows : [value];
15541
+ }
15542
+ function isFailedAttemptRow(row) {
15543
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15544
+ return metadata?.failedApproach === true || metadata?.isFailedAttempt === true;
15545
+ }
15546
+ function failureLogSearchFields(row) {
15547
+ const metadata = isRecord3(row.metadata) ? row.metadata : null;
15548
+ return [
15549
+ ...stringValues(row.id),
15550
+ ...stringValues(row._id),
15551
+ ...stringValues(row.title),
15552
+ ...stringValues(row.text),
15553
+ ...stringValues(row.canonicalText),
15554
+ ...stringValues(row.content),
15555
+ ...stringValues(metadata?.codeAnchor),
15556
+ ...stringValues(metadata?.codeAnchors),
15557
+ ...stringValues(metadata?.anchor),
15558
+ ...stringValues(metadata?.anchors),
15559
+ ...stringValues(metadata?.filePath),
15560
+ ...stringValues(metadata?.filePaths),
15561
+ ...stringValues(metadata?.path),
15562
+ ...stringValues(metadata?.paths),
15563
+ ...stringValues(metadata?.sourceRef),
15564
+ ...stringValues(metadata?.touchedPaths)
15565
+ ];
15566
+ }
15567
+ function projectFailureLog(output, input) {
15568
+ const rawQuery = typeof input.query === "string" && input.query.trim().length > 0 ? input.query.trim() : void 0;
15569
+ const searchKey = rawQuery?.toLowerCase();
15570
+ const failures = nestedEvidenceRows(output).filter((row) => isFailedAttemptRow(row)).filter(
15571
+ (row) => !searchKey ? true : failureLogSearchFields(row).some(
15572
+ (field) => field.toLowerCase().includes(searchKey)
15573
+ )
15574
+ );
15575
+ return {
15576
+ query: rawQuery,
15577
+ failures,
15578
+ totalFound: failures.length,
15579
+ showing: failures.length
15580
+ };
15581
+ }
13673
15582
  var recordScopeLearningArgs = z.object({
13674
15583
  topicId: z.string().optional().describe("Topic scope ID"),
13675
15584
  summary: z.string().describe("Atomic learning statement"),
@@ -13759,6 +15668,8 @@ var attemptInput = (input, context) => withUserId(
13759
15668
  tags: ["code_attempt"],
13760
15669
  metadata: compactRecord4({
13761
15670
  ...recordValue2(input.metadata),
15671
+ failedApproach: true,
15672
+ isFailedAttempt: true,
13762
15673
  filePaths: input.filePaths,
13763
15674
  filePath: input.filePath,
13764
15675
  errorMessage: input.errorMessage,
@@ -13889,7 +15800,8 @@ var codingContracts = [
13889
15800
  limit: input.limit,
13890
15801
  status: input.status,
13891
15802
  userId: input.userId
13892
- })
15803
+ }),
15804
+ outputProjection: (output, input) => projectFailureLog(output, input)
13893
15805
  }
13894
15806
  })
13895
15807
  ];
@@ -14351,14 +16263,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14351
16263
  description: "Worktrees are tenant/runtime planning data."
14352
16264
  },
14353
16265
  {
14354
- component: "identity",
16266
+ component: "control-plane",
14355
16267
  table: "agents",
14356
16268
  prepopulation: "runtime_bootstrap",
14357
16269
  copyMode: "none",
14358
16270
  description: "Service agents are provisioned per tenant or service, not copied."
14359
16271
  },
14360
16272
  {
14361
- component: "identity",
16273
+ component: "control-plane",
14362
16274
  table: "mcpWritePolicy",
14363
16275
  prepopulation: "required_template",
14364
16276
  copyMode: "template_global",
@@ -14367,14 +16279,14 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14367
16279
  description: "Global write policy defaults govern service and interactive MCP writes."
14368
16280
  },
14369
16281
  {
14370
- component: "identity",
16282
+ component: "control-plane",
14371
16283
  table: "modelCallLogs",
14372
16284
  prepopulation: "runtime_log",
14373
16285
  copyMode: "none",
14374
16286
  description: "Model call logs are runtime telemetry."
14375
16287
  },
14376
16288
  {
14377
- component: "identity",
16289
+ component: "control-plane",
14378
16290
  table: "modelFunctionSlots",
14379
16291
  prepopulation: "required_template",
14380
16292
  copyMode: "template_global",
@@ -14383,7 +16295,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14383
16295
  description: "Function-to-model slots are required by model runtime resolution."
14384
16296
  },
14385
16297
  {
14386
- component: "identity",
16298
+ component: "control-plane",
14387
16299
  table: "modelRegistry",
14388
16300
  prepopulation: "required_template",
14389
16301
  copyMode: "template_global",
@@ -14392,7 +16304,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14392
16304
  description: "Model catalog defaults are required by model runtime clients."
14393
16305
  },
14394
16306
  {
14395
- component: "identity",
16307
+ component: "control-plane",
14396
16308
  table: "modelSlotConfigs",
14397
16309
  prepopulation: "required_template",
14398
16310
  copyMode: "template_global",
@@ -14401,14 +16313,105 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14401
16313
  description: "Slot-level defaults are required before tenant overrides exist."
14402
16314
  },
14403
16315
  {
14404
- component: "identity",
16316
+ component: "control-plane",
16317
+ table: "permitAccessReviewItems",
16318
+ prepopulation: "runtime_data",
16319
+ copyMode: "none",
16320
+ description: "Permit access-review item rows are tenant review data projected from Permit."
16321
+ },
16322
+ {
16323
+ component: "control-plane",
16324
+ table: "permitAccessReviews",
16325
+ prepopulation: "runtime_data",
16326
+ copyMode: "none",
16327
+ description: "Permit access-review campaigns are tenant review data projected from Permit."
16328
+ },
16329
+ {
16330
+ component: "control-plane",
16331
+ table: "permitAttributeBindings",
16332
+ prepopulation: "runtime_data",
16333
+ copyMode: "none",
16334
+ description: "Permit ABAC attribute bindings are tenant policy projection rows."
16335
+ },
16336
+ {
16337
+ component: "control-plane",
16338
+ table: "permitGroups",
16339
+ prepopulation: "runtime_data",
16340
+ copyMode: "none",
16341
+ description: "Permit groups are tenant-defined policy subjects, not template data."
16342
+ },
16343
+ {
16344
+ component: "control-plane",
16345
+ table: "permitGroupMemberships",
16346
+ prepopulation: "runtime_data",
16347
+ copyMode: "none",
16348
+ description: "Permit group memberships are tenant-specific policy projection rows."
16349
+ },
16350
+ {
16351
+ component: "control-plane",
16352
+ table: "permitPolicyBundles",
16353
+ prepopulation: "runtime_derived",
16354
+ copyMode: "none",
16355
+ description: "Permit policy bundles are derived from the Permit control plane."
16356
+ },
16357
+ {
16358
+ component: "control-plane",
16359
+ table: "permitPolicyDecisionReceipts",
16360
+ prepopulation: "runtime_log",
16361
+ copyMode: "none",
16362
+ description: "Permit decision receipts are runtime authorization audit logs."
16363
+ },
16364
+ {
16365
+ component: "control-plane",
16366
+ table: "permitPrincipalAliases",
16367
+ prepopulation: "runtime_data",
16368
+ copyMode: "none",
16369
+ description: "Permit principal aliases are tenant-specific identity projection rows."
16370
+ },
16371
+ {
16372
+ component: "control-plane",
16373
+ table: "permitPrincipals",
16374
+ prepopulation: "runtime_data",
16375
+ copyMode: "none",
16376
+ description: "Permit principals are projected from Clerk, Permit, and tenant onboarding flows."
16377
+ },
16378
+ {
16379
+ component: "control-plane",
16380
+ table: "permitProjectionOutbox",
16381
+ prepopulation: "runtime_queue",
16382
+ copyMode: "none",
16383
+ description: "Permit projection outbox rows are runtime sync queue data."
16384
+ },
16385
+ {
16386
+ component: "control-plane",
16387
+ table: "permitRelationshipTuples",
16388
+ prepopulation: "runtime_data",
16389
+ copyMode: "none",
16390
+ description: "Permit ReBAC relationship tuples are tenant policy projection rows."
16391
+ },
16392
+ {
16393
+ component: "control-plane",
16394
+ table: "permitResourceInstances",
16395
+ prepopulation: "runtime_data",
16396
+ copyMode: "none",
16397
+ description: "Permit resource instances are tenant/workspace graph and deployment projection rows."
16398
+ },
16399
+ {
16400
+ component: "control-plane",
16401
+ table: "permitRoleAssignments",
16402
+ prepopulation: "runtime_data",
16403
+ copyMode: "none",
16404
+ description: "Permit role assignments are tenant-specific policy projection rows."
16405
+ },
16406
+ {
16407
+ component: "control-plane",
14405
16408
  table: "platformAudienceGrants",
14406
16409
  prepopulation: "runtime_data",
14407
16410
  copyMode: "none",
14408
16411
  description: "Audience grants are principal/group-specific access rows."
14409
16412
  },
14410
16413
  {
14411
- component: "identity",
16414
+ component: "control-plane",
14412
16415
  table: "platformAudiences",
14413
16416
  prepopulation: "required_template",
14414
16417
  copyMode: "template_tenant_rewrite",
@@ -14417,35 +16420,35 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14417
16420
  description: "Default tenant audience taxonomy rows are rewritten into each tenant."
14418
16421
  },
14419
16422
  {
14420
- component: "identity",
16423
+ component: "control-plane",
14421
16424
  table: "platformPolicyDecisionLogs",
14422
16425
  prepopulation: "runtime_log",
14423
16426
  copyMode: "none",
14424
16427
  description: "Policy decisions are runtime audit logs."
14425
16428
  },
14426
16429
  {
14427
- component: "identity",
16430
+ component: "control-plane",
14428
16431
  table: "projectGrants",
14429
16432
  prepopulation: "runtime_data",
14430
16433
  copyMode: "none",
14431
16434
  description: "Project/topic grants are principal or group-specific access rows."
14432
16435
  },
14433
16436
  {
14434
- component: "identity",
16437
+ component: "control-plane",
14435
16438
  table: "reasoningPermissions",
14436
16439
  prepopulation: "runtime_data",
14437
16440
  copyMode: "none",
14438
16441
  description: "Reasoning permissions are principal-specific policy rows."
14439
16442
  },
14440
16443
  {
14441
- component: "identity",
16444
+ component: "control-plane",
14442
16445
  table: "tenantApiKeys",
14443
16446
  prepopulation: "runtime_secret",
14444
16447
  copyMode: "none",
14445
16448
  description: "API keys are tenant credentials and must never be copied."
14446
16449
  },
14447
16450
  {
14448
- component: "identity",
16451
+ component: "control-plane",
14449
16452
  table: "tenantConfig",
14450
16453
  prepopulation: "required_template",
14451
16454
  copyMode: "template_tenant_rewrite",
@@ -14454,7 +16457,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14454
16457
  description: "Tenant-local config defaults are rewritten during bootstrap."
14455
16458
  },
14456
16459
  {
14457
- component: "identity",
16460
+ component: "control-plane",
14458
16461
  table: "tenantIntegrations",
14459
16462
  prepopulation: "required_template",
14460
16463
  copyMode: "template_tenant_rewrite",
@@ -14463,14 +16466,21 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14463
16466
  description: "Non-secret integration descriptors are rewritten into each tenant."
14464
16467
  },
14465
16468
  {
14466
- component: "identity",
16469
+ component: "control-plane",
14467
16470
  table: "tenantModelSlotBindings",
14468
16471
  prepopulation: "runtime_secret",
14469
16472
  copyMode: "none",
14470
16473
  description: "Tenant model slot bindings reference provider secrets and are runtime-only."
14471
16474
  },
14472
16475
  {
14473
- component: "identity",
16476
+ component: "control-plane",
16477
+ table: "tenantPermitSyncStates",
16478
+ prepopulation: "runtime_derived",
16479
+ copyMode: "none",
16480
+ description: "Tenant Permit sync state rows are runtime reconciliation state."
16481
+ },
16482
+ {
16483
+ component: "control-plane",
14474
16484
  table: "tenantPolicies",
14475
16485
  prepopulation: "required_template",
14476
16486
  copyMode: "template_tenant_rewrite",
@@ -14479,42 +16489,42 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14479
16489
  description: "Default tenant policy roles are rewritten during bootstrap."
14480
16490
  },
14481
16491
  {
14482
- component: "identity",
16492
+ component: "control-plane",
14483
16493
  table: "tenantProviderSecrets",
14484
16494
  prepopulation: "runtime_secret",
14485
16495
  copyMode: "none",
14486
16496
  description: "Provider secrets are credentials and must never be copied."
14487
16497
  },
14488
16498
  {
14489
- component: "identity",
16499
+ component: "control-plane",
14490
16500
  table: "tenantProxyGatewayUsage",
14491
16501
  prepopulation: "runtime_log",
14492
16502
  copyMode: "none",
14493
16503
  description: "Proxy gateway usage rows are runtime telemetry."
14494
16504
  },
14495
16505
  {
14496
- component: "identity",
16506
+ component: "control-plane",
14497
16507
  table: "tenantProxyTokenMints",
14498
16508
  prepopulation: "runtime_secret",
14499
16509
  copyMode: "none",
14500
16510
  description: "Proxy token mints are ephemeral secret-bearing runtime rows."
14501
16511
  },
14502
16512
  {
14503
- component: "identity",
16513
+ component: "control-plane",
14504
16514
  table: "tenantSandboxAuditEvents",
14505
16515
  prepopulation: "runtime_log",
14506
16516
  copyMode: "none",
14507
16517
  description: "Sandbox audit rows are runtime security logs."
14508
16518
  },
14509
16519
  {
14510
- component: "identity",
16520
+ component: "control-plane",
14511
16521
  table: "tenantSecrets",
14512
16522
  prepopulation: "runtime_secret",
14513
16523
  copyMode: "none",
14514
16524
  description: "Tenant secrets are credentials and must never be copied."
14515
16525
  },
14516
16526
  {
14517
- component: "identity",
16527
+ component: "control-plane",
14518
16528
  table: "toolAcls",
14519
16529
  prepopulation: "required_template",
14520
16530
  copyMode: "template_global",
@@ -14523,7 +16533,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14523
16533
  description: "Default role-to-tool grants are required for SDK/MCP tool access."
14524
16534
  },
14525
16535
  {
14526
- component: "identity",
16536
+ component: "control-plane",
14527
16537
  table: "toolRegistry",
14528
16538
  prepopulation: "required_template",
14529
16539
  copyMode: "template_global",
@@ -14532,7 +16542,7 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
14532
16542
  description: "Core tool catalog rows are required before pack or tenant tools exist."
14533
16543
  },
14534
16544
  {
14535
- component: "identity",
16545
+ component: "control-plane",
14536
16546
  table: "users",
14537
16547
  prepopulation: "runtime_bootstrap",
14538
16548
  copyMode: "none",