@feltdb/core 0.7.3 → 0.7.4

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.
Files changed (95) hide show
  1. package/dist/application-development.d.ts +76 -0
  2. package/dist/application-development.d.ts.map +1 -0
  3. package/dist/application-development.js +137 -0
  4. package/dist/application-manifest.d.ts +5 -1
  5. package/dist/application-manifest.d.ts.map +1 -1
  6. package/dist/application-manifest.js +10 -3
  7. package/dist/canonical-application.d.ts +26 -0
  8. package/dist/canonical-application.d.ts.map +1 -0
  9. package/dist/canonical-application.js +45 -0
  10. package/dist/cli/ai-model-config.js +97 -0
  11. package/dist/cli/commands.js +466 -105
  12. package/dist/cli/index.js +1 -1
  13. package/dist/cli/proposal-client.js +54 -0
  14. package/dist/cli/publish-engine.js +162 -0
  15. package/dist/cli/source-sync.js +139 -0
  16. package/dist/create/cli.js +1 -1
  17. package/dist/create/create.js +30 -6
  18. package/dist/create/managed-account.js +14 -7
  19. package/dist/create/package-versions.js +1 -1
  20. package/dist/create/server-source/crates/feltdb/src/application.rs +31 -1
  21. package/dist/create/server-source/crates/feltdb/src/authority_failover.rs +84 -6
  22. package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +126 -38
  23. package/dist/create/server-source/crates/feltdb/src/distributed_transactions.rs +72 -34
  24. package/dist/create/server-source/crates/feltdb-server/src/identity.rs +46 -3
  25. package/dist/create/server-source/crates/feltdb-server/src/main.rs +315 -16
  26. package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +20 -0
  27. package/dist/create/template/default-project/README.md +57 -0
  28. package/dist/create/template/default-project/agents/activity-assistant.ts +18 -0
  29. package/dist/create/template/default-project/agents/project-assistant.ts +19 -0
  30. package/dist/create/template/default-project/capabilities/activity-summary.ts +14 -0
  31. package/dist/create/template/default-project/capabilities/project-search.ts +16 -0
  32. package/dist/create/template/default-project/capabilities/project-summary.ts +15 -0
  33. package/dist/create/template/default-project/feltdb.flow +169 -0
  34. package/dist/create/template/default-project/src/App.tsx +20 -0
  35. package/dist/create/template/default-project/src/context/AuthContext.tsx +27 -0
  36. package/dist/create/template/default-project/src/feltdb.ts +87 -0
  37. package/dist/create/template/default-project/src/index.tsx +14 -0
  38. package/dist/create/template/default-project/src/pages/Activity.tsx +7 -0
  39. package/dist/create/template/default-project/src/pages/Agents.tsx +15 -0
  40. package/dist/create/template/default-project/src/pages/Dashboard.tsx +17 -0
  41. package/dist/create/template/default-project/src/pages/Invitations.tsx +11 -0
  42. package/dist/create/template/default-project/src/pages/Projects.tsx +11 -0
  43. package/dist/create/template/default-project/src/pages/SignIn.tsx +8 -0
  44. package/dist/create/template/default-project/src/pages/SignUp.tsx +8 -0
  45. package/dist/create/template/default-project/src/styles-application.css +21 -0
  46. package/dist/create/template/default-project/src/styles.css +1 -0
  47. package/dist/create/template/default-project/workflows/agent-assisted-summary.ts +1 -0
  48. package/dist/create/template/default-project/workflows/invitation.ts +30 -0
  49. package/dist/create/template/default-project/workflows/project-created.ts +2 -0
  50. package/dist/db.d.ts +49 -1
  51. package/dist/db.d.ts.map +1 -1
  52. package/dist/db.js +77 -0
  53. package/dist/error-codes.d.ts +20 -1
  54. package/dist/error-codes.d.ts.map +1 -1
  55. package/dist/error-codes.js +25 -0
  56. package/dist/flowspec.d.ts.map +1 -1
  57. package/dist/flowspec.js +27 -6
  58. package/dist/http-db.d.ts +15 -2
  59. package/dist/http-db.d.ts.map +1 -1
  60. package/dist/http-db.js +113 -5
  61. package/dist/index-core.d.ts +3 -0
  62. package/dist/index-core.d.ts.map +1 -1
  63. package/dist/index-core.js +3 -0
  64. package/dist/proposal.d.ts +85 -0
  65. package/dist/proposal.d.ts.map +1 -0
  66. package/dist/proposal.js +105 -0
  67. package/dist/studio/app.d.ts +3 -1
  68. package/dist/studio/app.d.ts.map +1 -1
  69. package/dist/studio/components/ApplicationDesigner.d.ts +2 -1
  70. package/dist/studio/components/ApplicationDesigner.d.ts.map +1 -1
  71. package/dist/studio/components/AskFeltDB.d.ts +20 -0
  72. package/dist/studio/components/AskFeltDB.d.ts.map +1 -0
  73. package/dist/studio/components/ProposalBrowser.d.ts +3 -0
  74. package/dist/studio/components/ProposalBrowser.d.ts.map +1 -0
  75. package/dist/studio/components/index.d.ts +2 -0
  76. package/dist/studio/components/index.d.ts.map +1 -1
  77. package/dist/studio/components/index.js +4 -4
  78. package/dist/studio/{components-Dxuhrv8_.js → components-Bm4sjhcX.js} +335 -5
  79. package/dist/studio/index.js +168 -157
  80. package/dist/studio/studio.css +1 -1
  81. package/dist/studio-app/assets/dist-DA1MYSzp.js +1 -0
  82. package/dist/studio-app/assets/{feltdb_wasm-DVKsw75S.js → feltdb_wasm-B-Ccgccb.js} +1 -1
  83. package/dist/studio-app/assets/feltdb_wasm_bg-wH3enJIA.wasm +0 -0
  84. package/dist/studio-app/assets/{index-C1GWyazR.css → index-BRrmvaKw.css} +1 -1
  85. package/dist/studio-app/assets/index-CEIqowCh.js +42 -0
  86. package/dist/studio-app/assets/lib-B2_7fcn7.js +69 -0
  87. package/dist/studio-app/assets/worker-CARZ5g7K.js +69 -0
  88. package/dist/studio-app/index.html +2 -2
  89. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  90. package/dist/workspace/local-development-authority.d.ts +3 -0
  91. package/dist/workspace/local-development-authority.d.ts.map +1 -1
  92. package/dist/workspace/local-development-authority.js +62 -1
  93. package/package.json +1 -1
  94. package/dist/studio-app/assets/feltdb_wasm_bg-DNyNf0yy.wasm +0 -0
  95. package/dist/studio-app/assets/index-B5tnmvSD.js +0 -28
@@ -1110,6 +1110,7 @@ function B({ db: e, namespace: t = "default", projectSpec: o, managedPublish: g,
1110
1110
  token: g?.token || "",
1111
1111
  environment: g?.environment,
1112
1112
  applicationId: g?.applicationId,
1113
+ publishEndpoint: g?.publishEndpoint,
1113
1114
  allowDestructive: !1
1114
1115
  })), W = i(null), G = D.length ? D[D.length - 1].source : f(d(C.app)), K = r(() => u(p(G), C), [G, C]), q = r(() => m(p(G), C), [G, C]);
1115
1116
  n(() => {
@@ -1236,6 +1237,37 @@ function B({ db: e, namespace: t = "default", projectSpec: o, managedPublish: g,
1236
1237
  A(`Local apply failed: ${e instanceof Error ? e.message : String(e)}`);
1237
1238
  }
1238
1239
  }, te = async () => {
1240
+ if (H.publishEndpoint) {
1241
+ U({
1242
+ ...H,
1243
+ publishing: !0,
1244
+ error: void 0
1245
+ });
1246
+ try {
1247
+ let e = await fetch(H.publishEndpoint, {
1248
+ method: "POST",
1249
+ headers: { "content-type": "application/json" },
1250
+ body: JSON.stringify({
1251
+ environment: H.environment,
1252
+ approveDestructive: H.allowDestructive
1253
+ })
1254
+ }), t = await e.json();
1255
+ if (!e.ok) throw Error(t.error || "Publish failed");
1256
+ U({
1257
+ ...H,
1258
+ publishing: !1,
1259
+ error: void 0
1260
+ }), V(!1), A(t.messages?.at(-1) || `Published immutable version ${t.version}`);
1261
+ return;
1262
+ } catch (e) {
1263
+ U({
1264
+ ...H,
1265
+ publishing: !1,
1266
+ error: e instanceof Error ? e.message : String(e)
1267
+ });
1268
+ return;
1269
+ }
1270
+ }
1239
1271
  if (!H.url.trim() || !H.token.trim()) return U({
1240
1272
  ...H,
1241
1273
  error: "Cloud URL and API key are required."
@@ -1364,8 +1396,8 @@ function B({ db: e, namespace: t = "default", projectSpec: o, managedPublish: g,
1364
1396
  className: "eyebrow",
1365
1397
  children: "Cloud release"
1366
1398
  }),
1367
- /* @__PURE__ */ s("h2", { children: "Publish this application model" }),
1368
- /* @__PURE__ */ s("p", { children: "FeltDB compares the cloud version, plans the migration, and publishes atomically." })
1399
+ /* @__PURE__ */ s("h2", { children: "Publish this application definition" }),
1400
+ /* @__PURE__ */ s("p", { children: "FeltDB validates an immutable revision and atomically promotes the environment." })
1369
1401
  ] }), /* @__PURE__ */ s("button", {
1370
1402
  type: "button",
1371
1403
  "aria-label": "Close cloud publisher",
@@ -1378,8 +1410,8 @@ function B({ db: e, namespace: t = "default", projectSpec: o, managedPublish: g,
1378
1410
  children: [
1379
1411
  /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "FeltDB Cloud URL" }), /* @__PURE__ */ s("input", {
1380
1412
  type: "url",
1381
- placeholder: "https://your-instance.feltdb.cloud",
1382
1413
  value: H.url,
1414
+ readOnly: !!H.publishEndpoint,
1383
1415
  onChange: (e) => U({
1384
1416
  ...H,
1385
1417
  url: e.target.value,
@@ -1390,6 +1422,7 @@ function B({ db: e, namespace: t = "default", projectSpec: o, managedPublish: g,
1390
1422
  })] }),
1391
1423
  /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Namespace" }), /* @__PURE__ */ s("input", {
1392
1424
  value: H.namespace,
1425
+ readOnly: !!H.publishEndpoint,
1393
1426
  onChange: (e) => U({
1394
1427
  ...H,
1395
1428
  namespace: e.target.value,
@@ -1398,7 +1431,7 @@ function B({ db: e, namespace: t = "default", projectSpec: o, managedPublish: g,
1398
1431
  allowDestructive: !1
1399
1432
  })
1400
1433
  })] }),
1401
- /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "API key" }), /* @__PURE__ */ s("input", {
1434
+ !H.publishEndpoint && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "API key" }), /* @__PURE__ */ s("input", {
1402
1435
  type: "password",
1403
1436
  autoComplete: "off",
1404
1437
  placeholder: "Loaded securely from this project",
@@ -1829,4 +1862,301 @@ function B({ db: e, namespace: t = "default", projectSpec: o, managedPublish: g,
1829
1862
  });
1830
1863
  }
1831
1864
  //#endregion
1832
- export { _, F as a, y as b, M as c, O as d, D as f, v as g, b as h, I as i, j as l, w as m, R as n, P as o, E as p, L as r, N as s, B as t, k as u, x as v, g as x, S as y };
1865
+ //#region src/components/AskFeltDB.tsx
1866
+ function V({ configuration: e, onApplied: t }) {
1867
+ let [n, r] = a(""), [i, l] = a(), [u, d] = a(), [f, m] = a(""), [h, g] = a(0), [_, v] = a(!1), [y, b] = a([]), x = typeof navigator < "u" && "gpu" in navigator, S = e?.aiModel?.provider === "openai-compatible", C = !!(e?.enabled && (S ? e.aiModel?.credentialConfigured : e.webllmEnabled && x)), w = async () => {
1868
+ if (!(!C || !e)) {
1869
+ m("Loading local model…"), d(void 0), l(void 0);
1870
+ try {
1871
+ let t = await fetch("/_feltdb/contract", { cache: "no-store" }), r = await t.json();
1872
+ if (!t.ok) throw Error(r.error || "Could not load contract");
1873
+ if (r.drift && !r.drift.synchronized) throw Error("Contract drift detected. Review feltdb status before generating.");
1874
+ let i;
1875
+ if (S) {
1876
+ m(`Asking ${e.aiModel?.model} through the local CLI…`);
1877
+ let t = await fetch("/_feltdb/ai/generate", {
1878
+ method: "POST",
1879
+ headers: {
1880
+ "content-type": "application/json",
1881
+ "x-feltdb-studio-token": e.token
1882
+ },
1883
+ body: JSON.stringify({ intent: n })
1884
+ }), r = await t.json();
1885
+ if (!t.ok) throw Error(r.error || "Configured model failed");
1886
+ i = r.proposal;
1887
+ } else {
1888
+ let { WebLLMProvider: t } = await import("@feltdb/webllm"), a = new t({
1889
+ model: e.aiModel?.model,
1890
+ contract: r.snapshot,
1891
+ onProgress: (e) => {
1892
+ g(e.progress), m(e.text);
1893
+ }
1894
+ });
1895
+ try {
1896
+ i = await a.generateFlow(n, { currentFlow: r.source });
1897
+ } finally {
1898
+ await a.shutdown();
1899
+ }
1900
+ }
1901
+ let a = await fetch("/_feltdb/proposals", {
1902
+ method: "POST",
1903
+ headers: {
1904
+ "content-type": "application/json",
1905
+ "x-feltdb-studio-token": e.token
1906
+ },
1907
+ body: JSON.stringify({ proposal: i })
1908
+ }), o = await a.json();
1909
+ if (!a.ok) throw Error(o.error || "Proposal validation failed");
1910
+ l(i), d(o), b(p(i.proposedFlow).collections.map((e) => ({
1911
+ name: e.name,
1912
+ fields: e.fields.map((e) => e.name)
1913
+ }))), m("Validated proposal ready for review");
1914
+ } catch (e) {
1915
+ m(e instanceof Error ? e.message : String(e));
1916
+ }
1917
+ }
1918
+ }, T = async (t) => {
1919
+ if (!(!u || !e)) {
1920
+ m(t === "approve" ? "Recording approval…" : "Rejecting preview…");
1921
+ try {
1922
+ let n = await fetch(`/_feltdb/proposals/${t}`, {
1923
+ method: "POST",
1924
+ headers: {
1925
+ "content-type": "application/json",
1926
+ "x-feltdb-studio-token": e.token
1927
+ },
1928
+ body: JSON.stringify({
1929
+ proposalId: u.proposalId,
1930
+ confirm: !0,
1931
+ approveAuthorization: _
1932
+ })
1933
+ }), r = await n.json();
1934
+ if (!n.ok) throw Error(r.error || "Proposal decision failed");
1935
+ t === "approve" ? m(`Approved. Run ${r.command} in your project to synchronize the repository.`) : (l(void 0), d(void 0), b([]), m("Preview rejected. The application and repository are unchanged."));
1936
+ } catch (e) {
1937
+ m(e instanceof Error ? e.message : String(e));
1938
+ }
1939
+ }
1940
+ };
1941
+ return /* @__PURE__ */ c("section", {
1942
+ className: "ask-feltdb",
1943
+ children: [
1944
+ /* @__PURE__ */ c("div", { children: [
1945
+ /* @__PURE__ */ s("span", {
1946
+ className: "eyebrow",
1947
+ children: "Contract-aware proposal engine"
1948
+ }),
1949
+ /* @__PURE__ */ s("h2", { children: "Ask FeltDB" }),
1950
+ /* @__PURE__ */ s("p", { children: "Describe a contract change. Your selected model proposes; FeltDB validates, and the CLI owns source synchronization." })
1951
+ ] }),
1952
+ /* @__PURE__ */ c("p", {
1953
+ className: "ai-model-choice",
1954
+ children: [
1955
+ "Model: ",
1956
+ /* @__PURE__ */ s("strong", { children: e?.aiModel?.model ?? "SmolLM2-360M-Instruct" }),
1957
+ " (",
1958
+ S ? "bring-your-own provider; credential held by CLI" : "private local WebLLM",
1959
+ "). Change it with ",
1960
+ /* @__PURE__ */ s("code", { children: "feltdb ai model set" }),
1961
+ "."
1962
+ ]
1963
+ }),
1964
+ S && !e?.aiModel?.credentialConfigured ? /* @__PURE__ */ c("p", {
1965
+ className: "ai-unavailable",
1966
+ children: [
1967
+ "The selected hosted model needs a credential. Pipe it securely with ",
1968
+ /* @__PURE__ */ s("code", { children: "printf %s \"$KEY\" | feltdb ai model set ... --api-key-stdin" }),
1969
+ "."
1970
+ ]
1971
+ }) : !S && !e?.webllmEnabled ? /* @__PURE__ */ c("p", {
1972
+ className: "ai-unavailable",
1973
+ children: [
1974
+ "Local AI is not enabled for this project. Install ",
1975
+ /* @__PURE__ */ s("code", { children: "@feltdb/webllm" }),
1976
+ " to opt in, or configure your own model with ",
1977
+ /* @__PURE__ */ s("code", { children: "feltdb ai model set" }),
1978
+ "."
1979
+ ]
1980
+ }) : !S && !x ? /* @__PURE__ */ s("p", {
1981
+ className: "ai-unavailable",
1982
+ children: "Local FeltDB AI is unavailable because WebGPU is not available. You can configure an OpenAI-compatible model instead."
1983
+ }) : /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("textarea", {
1984
+ "aria-label": "Ask FeltDB",
1985
+ value: n,
1986
+ onChange: (e) => r(e.target.value),
1987
+ placeholder: "Add invitations so organization owners can invite users."
1988
+ }), /* @__PURE__ */ s("button", {
1989
+ className: "btn btn-primary",
1990
+ disabled: !n.trim(),
1991
+ onClick: () => void w(),
1992
+ children: "Generate proposal"
1993
+ })] }),
1994
+ h > 0 && h < 1 && /* @__PURE__ */ s("progress", {
1995
+ value: h,
1996
+ max: 1
1997
+ }),
1998
+ " ",
1999
+ f && /* @__PURE__ */ s("p", {
2000
+ className: "ai-status",
2001
+ children: f
2002
+ }),
2003
+ i && u && /* @__PURE__ */ c("div", {
2004
+ className: "proposal-review",
2005
+ children: [
2006
+ /* @__PURE__ */ s("h3", { children: "Ephemeral application preview" }),
2007
+ /* @__PURE__ */ s("p", { children: i.summary }),
2008
+ /* @__PURE__ */ s("ul", { children: u.changes.map((e) => /* @__PURE__ */ s("li", { children: e }, e)) }),
2009
+ /* @__PURE__ */ c("div", {
2010
+ className: "proposal-app-preview",
2011
+ "aria-label": "Proposed application preview",
2012
+ children: [/* @__PURE__ */ s("nav", { children: y.map((e) => /* @__PURE__ */ s("span", { children: e.name }, e.name)) }), y.map((e) => /* @__PURE__ */ c("section", { children: [/* @__PURE__ */ s("strong", { children: e.name }), /* @__PURE__ */ s("small", { children: e.fields.join(" · ") || "No fields" })] }, e.name))]
2013
+ }),
2014
+ /* @__PURE__ */ c("p", { children: [
2015
+ /* @__PURE__ */ s("strong", { children: "Source impact" }),
2016
+ ": ",
2017
+ u.sourcePlan.join(", ")
2018
+ ] }),
2019
+ i.warnings.length > 0 && /* @__PURE__ */ s("div", {
2020
+ className: "proposal-warning",
2021
+ children: i.warnings.join(" · ")
2022
+ }),
2023
+ u.authorizationChanges.length > 0 && /* @__PURE__ */ c("div", { children: [u.authorizationChanges.map((e) => /* @__PURE__ */ c("div", {
2024
+ className: "proposal-warning",
2025
+ children: [
2026
+ /* @__PURE__ */ c("strong", { children: ["AUTHORIZATION CHANGE", e.widening ? " — POSSIBLE WIDENING" : ""] }),
2027
+ /* @__PURE__ */ s("br", {}),
2028
+ e.policy,
2029
+ /* @__PURE__ */ s("br", {}),
2030
+ /* @__PURE__ */ c("code", { children: [
2031
+ (e.before ?? ["<absent>"]).join(" | "),
2032
+ " → ",
2033
+ (e.after ?? ["<removed>"]).join(" | ")
2034
+ ] })
2035
+ ]
2036
+ }, e.policy)), /* @__PURE__ */ c("label", {
2037
+ className: "authorization-approval",
2038
+ children: [/* @__PURE__ */ s("input", {
2039
+ type: "checkbox",
2040
+ checked: _,
2041
+ onChange: (e) => v(e.target.checked)
2042
+ }), /* @__PURE__ */ s("span", { children: "I explicitly approve this authorization change." })]
2043
+ })] }),
2044
+ /* @__PURE__ */ c("details", { children: [/* @__PURE__ */ s("summary", { children: "Proposed feltdb.flow" }), /* @__PURE__ */ s("pre", { children: i.proposedFlow })] }),
2045
+ !e?.previewOnly && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("button", {
2046
+ className: "btn btn-primary",
2047
+ disabled: u.authorizationChanges.length > 0 && !_,
2048
+ onClick: () => void T("approve"),
2049
+ children: "Approve proposal"
2050
+ }), /* @__PURE__ */ s("button", {
2051
+ className: "btn",
2052
+ onClick: () => void T("reject"),
2053
+ children: "Reject preview"
2054
+ })] }),
2055
+ e?.previewOnly && /* @__PURE__ */ c("p", {
2056
+ className: "proposal-boundary",
2057
+ children: [/* @__PURE__ */ s("strong", { children: "Preview-only session:" }), " no proposal artifact or source file will be written."]
2058
+ }),
2059
+ /* @__PURE__ */ s("p", {
2060
+ className: "proposal-boundary",
2061
+ children: "This preview is ephemeral. Approval records a proposal artifact; Studio never writes application source, changes the running contract, or publishes."
2062
+ })
2063
+ ]
2064
+ })
2065
+ ]
2066
+ });
2067
+ }
2068
+ //#endregion
2069
+ //#region src/components/ProposalBrowser.tsx
2070
+ function H() {
2071
+ let [e, t] = a([]), [r, i] = a(), [l, u] = a(""), d = () => void fetch("/_feltdb/proposals/list", { cache: "no-store" }).then(async (e) => {
2072
+ let n = await e.json();
2073
+ if (!e.ok) throw Error(n.error || "Proposal service unavailable");
2074
+ t(n.proposals || []), u("");
2075
+ }).catch((e) => u(e instanceof Error ? e.message : String(e)));
2076
+ n(() => {
2077
+ d();
2078
+ let e = window.setInterval(d, 2e3);
2079
+ return () => window.clearInterval(e);
2080
+ }, []);
2081
+ let f = (e) => void fetch(`/_feltdb/proposals/${encodeURIComponent(e)}`, { cache: "no-store" }).then(async (e) => {
2082
+ let t = await e.json();
2083
+ if (!e.ok) throw Error(t.error);
2084
+ i(t);
2085
+ }).catch((e) => u(e instanceof Error ? e.message : String(e)));
2086
+ return /* @__PURE__ */ c("div", {
2087
+ className: "proposal-browser",
2088
+ children: [
2089
+ /* @__PURE__ */ c("header", { children: [
2090
+ /* @__PURE__ */ s("span", {
2091
+ className: "eyebrow",
2092
+ children: "Durable application state"
2093
+ }),
2094
+ /* @__PURE__ */ s("h1", { children: "Proposals" }),
2095
+ /* @__PURE__ */ c("p", { children: [
2096
+ "Contract-governed application changes stored in ",
2097
+ /* @__PURE__ */ s("code", { children: "_feltdb.Proposal" }),
2098
+ "."
2099
+ ] })
2100
+ ] }),
2101
+ l && /* @__PURE__ */ s("p", {
2102
+ className: "proposal-warning",
2103
+ children: l
2104
+ }),
2105
+ /* @__PURE__ */ c("div", {
2106
+ className: "proposal-browser-layout",
2107
+ children: [/* @__PURE__ */ c("section", {
2108
+ className: "studio-card",
2109
+ children: [
2110
+ /* @__PURE__ */ s("h2", { children: "History" }),
2111
+ !e.length && /* @__PURE__ */ s("p", { children: "No proposals yet." }),
2112
+ e.map((e) => /* @__PURE__ */ c("button", {
2113
+ className: "proposal-list-row",
2114
+ onClick: () => f(e.id),
2115
+ children: [/* @__PURE__ */ c("span", { children: [/* @__PURE__ */ s("strong", { children: e.summary }), /* @__PURE__ */ c("small", { children: [
2116
+ e.id,
2117
+ " · ",
2118
+ String(e.created_at)
2119
+ ] })] }), /* @__PURE__ */ s("b", { children: e.status })]
2120
+ }, e.id))
2121
+ ]
2122
+ }), /* @__PURE__ */ s("section", {
2123
+ className: "studio-card proposal-detail",
2124
+ children: r ? /* @__PURE__ */ c(o, { children: [
2125
+ /* @__PURE__ */ s("h2", { children: r.proposal.summary }),
2126
+ /* @__PURE__ */ c("p", { children: [
2127
+ /* @__PURE__ */ s("b", { children: r.proposal.status }),
2128
+ " · contract v",
2129
+ r.proposal.base_contract_version,
2130
+ /* @__PURE__ */ s("br", {}),
2131
+ /* @__PURE__ */ s("code", { children: r.proposal.base_contract_hash })
2132
+ ] }),
2133
+ /* @__PURE__ */ s("h3", { children: "Contract diff" }),
2134
+ /* @__PURE__ */ s("pre", { children: r.proposal.contract_diff.join("\n") || "Not validated" }),
2135
+ /* @__PURE__ */ s("h3", { children: "Source plan" }),
2136
+ /* @__PURE__ */ s("pre", { children: JSON.stringify(r.proposal.source_plan, null, 2) }),
2137
+ /* @__PURE__ */ s("h3", { children: "Warnings" }),
2138
+ /* @__PURE__ */ s("p", { children: r.proposal.warnings.join(" · ") || "None" }),
2139
+ /* @__PURE__ */ c("details", { children: [/* @__PURE__ */ s("summary", { children: "Proposed flow" }), /* @__PURE__ */ s("pre", { children: r.proposal.proposed_flow })] }),
2140
+ /* @__PURE__ */ s("h3", { children: "Status history" }),
2141
+ /* @__PURE__ */ s("ol", { children: r.history.map((e) => /* @__PURE__ */ c("li", { children: [
2142
+ String(e.created_at),
2143
+ " — ",
2144
+ e.from_status ? `${e.from_status} → ` : "",
2145
+ e.to_status
2146
+ ] }, e.id)) }),
2147
+ r.proposal.status === "approved" && /* @__PURE__ */ c("p", {
2148
+ className: "proposal-boundary",
2149
+ children: [
2150
+ "Approved. Run ",
2151
+ /* @__PURE__ */ c("code", { children: ["feltdb ai apply ", r.proposal.id] }),
2152
+ " in the project."
2153
+ ]
2154
+ })
2155
+ ] }) : /* @__PURE__ */ s("p", { children: "Select a proposal to inspect its flow, diff, source plan, warnings, and audit history." })
2156
+ })]
2157
+ })
2158
+ ]
2159
+ });
2160
+ }
2161
+ //#endregion
2162
+ export { g as C, y as S, b as _, L as a, x as b, P as c, j as d, k as f, w as g, E as h, R as i, N as l, D as m, V as n, I as o, O as p, B as r, F as s, H as t, M as u, v, S as x, _ as y };