wizards 0.2.15 → 0.2.17

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 (66) hide show
  1. package/apps/runtime/dist/credits/estimate.js +14 -8
  2. package/apps/runtime/dist/db/migrations/tenant/0008_run_event_note.sql +1 -0
  3. package/apps/runtime/dist/db/migrations/tenant/meta/0008_snapshot.json +2019 -0
  4. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
  5. package/apps/runtime/dist/db/schema.js +2 -0
  6. package/apps/runtime/dist/engine/events.js +14 -2
  7. package/apps/runtime/dist/engine/prepare.js +5 -2
  8. package/apps/runtime/dist/engine/requirements.js +248 -12
  9. package/apps/runtime/dist/engine/runner.js +28 -5
  10. package/apps/runtime/dist/engine/steps.js +18 -10
  11. package/apps/runtime/dist/engine/template.js +13 -10
  12. package/apps/runtime/dist/routes/studio.js +2 -2
  13. package/apps/runtime/dist/services/marketplace.js +34 -7
  14. package/apps/runtime/dist/tools/browser.js +12 -6
  15. package/apps/runtime/dist/tools/index.js +12 -6
  16. package/apps/runtime/dist/tools/mail.js +5 -2
  17. package/apps/runtime/dist/tools/pages.js +1 -1
  18. package/apps/runtime/dist/tools/project.js +5 -2
  19. package/apps/runtime/dist/tools/store.js +4 -4
  20. package/apps/runtime/dist/widgets/step.js +10 -4
  21. package/apps/web/dist/assets/{Account-B_FCuidz.js → Account-LVXhagaS.js} +1 -1
  22. package/apps/web/dist/assets/{ChangelogDialog-BKvNJIrA.js → ChangelogDialog-DM0KAoy6.js} +1 -1
  23. package/apps/web/dist/assets/ChatPanel-CxOQmtv-.js +1 -0
  24. package/apps/web/dist/assets/CreditsDialog-DkW3YT44.js +1 -0
  25. package/apps/web/dist/assets/EditorPage-hbisE1Wf.js +2 -0
  26. package/apps/web/dist/assets/{FlowPreview-De3ZyIer.js → FlowPreview-v7or29ku.js} +1 -1
  27. package/apps/web/dist/assets/{Harness-3kuJaJoj.js → Harness-RZF-bBmb.js} +2 -2
  28. package/apps/web/dist/assets/{HomePage-DWDT64vg.js → HomePage-mxG-a_KU.js} +1 -1
  29. package/apps/web/dist/assets/{ImportWizard-CTGmBDI8.js → ImportWizard-CiPyUt3E.js} +1 -1
  30. package/apps/web/dist/assets/LocalRuntime-Dqp9wkN3.js +1 -0
  31. package/apps/web/dist/assets/NewWizardPage-DHwRsi0_.js +2 -0
  32. package/apps/web/dist/assets/ProjectPage-Bb7jN_6n.js +4 -0
  33. package/apps/web/dist/assets/PublicRunner-TGkOwbAP.js +1 -0
  34. package/apps/web/dist/assets/RunnerView-DzHGshZj.js +70 -0
  35. package/apps/web/dist/assets/SettingsPage-CG3Xtfej.js +1 -0
  36. package/apps/web/dist/assets/{SetupPage-DHQYO7zB.js → SetupPage-O1GfPlqX.js} +1 -1
  37. package/apps/web/dist/assets/SharePage-CCNUhtry.js +1 -0
  38. package/apps/web/dist/assets/{api-RJbFM_oc.js → api-DB22_B7G.js} +2 -2
  39. package/apps/web/dist/assets/changelog-BkIJdZ7M.js +1 -0
  40. package/apps/web/dist/assets/{esm-CgnVZhIQ.js → esm-3TT9i_rv.js} +1 -1
  41. package/apps/web/dist/assets/{index-9maLuK9R.css → index-BPpKz65x.css} +1 -1
  42. package/apps/web/dist/assets/index-CLe9Wrpu.js +10 -0
  43. package/apps/web/dist/assets/{meta-CchZXdWH.js → meta-CEsBCPfA.js} +1 -1
  44. package/apps/web/dist/assets/{settings-menu-CrRWSrNL.js → settings-menu-pOcjznGJ.js} +1 -1
  45. package/apps/web/dist/assets/ui-I7QYMX0F.js +1 -0
  46. package/apps/web/dist/index.html +4 -4
  47. package/apps/web/dist/mcp/flow.html +54 -54
  48. package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +11 -0
  49. package/node_modules/@engenty-wizards/shared/dist/definition.js +27 -2
  50. package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +2 -0
  51. package/node_modules/@engenty-wizards/shared/dist/run.d.ts +150 -0
  52. package/node_modules/@engenty-wizards/shared/dist/run.js +72 -1
  53. package/package.json +1 -1
  54. package/apps/web/dist/assets/ChatPanel-CPgh0skF.js +0 -1
  55. package/apps/web/dist/assets/CreditsDialog-CbFq_7-m.js +0 -1
  56. package/apps/web/dist/assets/EditorPage-8liZwYCK.js +0 -2
  57. package/apps/web/dist/assets/LocalRuntime-CVdU8RtD.js +0 -1
  58. package/apps/web/dist/assets/NewWizardPage-CqFlo0b-.js +0 -2
  59. package/apps/web/dist/assets/ProjectPage-CDw2Jcxx.js +0 -4
  60. package/apps/web/dist/assets/PublicRunner-BYnX2OmB.js +0 -1
  61. package/apps/web/dist/assets/RunnerView-Civq59Tk.js +0 -70
  62. package/apps/web/dist/assets/SettingsPage-Bj0TxbiM.js +0 -1
  63. package/apps/web/dist/assets/SharePage-CY6bwfTI.js +0 -1
  64. package/apps/web/dist/assets/changelog-BWtvjeKs.js +0 -1
  65. package/apps/web/dist/assets/index-LmRYEd-y.js +0 -10
  66. package/apps/web/dist/assets/ui-HV_XbHjw.js +0 -1
@@ -1,6 +1,7 @@
1
1
  import { isDecisionStep, } from "@engenty-wizards/shared/definition";
2
2
  import { and, desc, eq, inArray, isNull } from "drizzle-orm";
3
3
  import { db, schema } from "../db/client.js";
4
+ import { mostAlongOnePath } from "../engine/requirements.js";
4
5
  import { classCatalog } from "../models.js";
5
6
  import { MICROS_PER_CREDIT } from "./credits.js";
6
7
  /**
@@ -64,9 +65,12 @@ function formula(step, catalog) {
64
65
  }
65
66
  return 0;
66
67
  }
67
- /** What a run of a definition costs by the formula alone — before anyone has run it. */
68
- export function formulaEstimate(definition, catalog) {
69
- const credits = definition.steps.reduce((sum, step) => sum + formula(step, catalog), 0);
68
+ /**
69
+ * What a run of a definition costs by the formula alone — before anyone has run it — along its
70
+ * most expensive way that avoids the steps in `closed`.
71
+ */
72
+ export function formulaEstimate(definition, catalog, closed) {
73
+ const credits = mostAlongOnePath(definition, (step) => formula(step, catalog), closed);
70
74
  return { credits: round(credits), high: Math.ceil(credits * 2) };
71
75
  }
72
76
  function percentile(sorted, p) {
@@ -96,7 +100,11 @@ async function measurements(wizardId, version) {
96
100
  return out;
97
101
  }
98
102
  const round = (credits) => Math.round(credits * 10) / 10;
99
- export async function estimateRun(wizardId, version, definition) {
103
+ /**
104
+ * What a run will cost and how much to hold, along its most expensive way: steps on branches
105
+ * that exclude each other are not added up. `closed`: steps the run cannot take here.
106
+ */
107
+ export async function estimateRun(wizardId, version, definition, closed) {
100
108
  const catalog = await classCatalog();
101
109
  if (!catalog) {
102
110
  // A runtime that resolves models itself has no credits to estimate in.
@@ -104,8 +112,6 @@ export async function estimateRun(wizardId, version, definition) {
104
112
  }
105
113
  const measured = await measurements(wizardId, version);
106
114
  const steps = {};
107
- let credits = 0;
108
- let reserve = 0;
109
115
  for (const step of definition.steps) {
110
116
  const samples = (measured.get(step.id) ?? []).sort((a, b) => a - b);
111
117
  let estimate;
@@ -125,8 +131,8 @@ export async function estimateRun(wizardId, version, definition) {
125
131
  estimate = { credits: round(value), high: round(value * 2), measured: false };
126
132
  }
127
133
  steps[step.id] = estimate;
128
- credits += estimate.credits;
129
- reserve += estimate.high;
130
134
  }
135
+ const credits = mostAlongOnePath(definition, (s) => steps[s.id]?.credits ?? 0, closed);
136
+ const reserve = mostAlongOnePath(definition, (s) => steps[s.id]?.high ?? 0, closed);
131
137
  return { available: true, credits: round(credits), reserve: Math.ceil(reserve), steps };
132
138
  }
@@ -0,0 +1 @@
1
+ ALTER TABLE `run_event` ADD `note` text;