wizards 0.2.16 → 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.
- package/apps/runtime/dist/credits/estimate.js +14 -8
- package/apps/runtime/dist/db/migrations/tenant/0008_run_event_note.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0008_snapshot.json +2019 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +2 -0
- package/apps/runtime/dist/engine/events.js +14 -2
- package/apps/runtime/dist/engine/prepare.js +5 -2
- package/apps/runtime/dist/engine/requirements.js +108 -0
- package/apps/runtime/dist/engine/runner.js +2 -2
- package/apps/runtime/dist/engine/steps.js +18 -10
- package/apps/runtime/dist/engine/template.js +13 -10
- package/apps/runtime/dist/routes/studio.js +2 -2
- package/apps/runtime/dist/services/marketplace.js +2 -2
- package/apps/runtime/dist/tools/browser.js +12 -6
- package/apps/runtime/dist/tools/index.js +12 -6
- package/apps/runtime/dist/tools/mail.js +5 -2
- package/apps/runtime/dist/tools/pages.js +1 -1
- package/apps/runtime/dist/tools/project.js +5 -2
- package/apps/runtime/dist/tools/store.js +4 -4
- package/apps/runtime/dist/widgets/step.js +10 -4
- package/apps/web/dist/assets/{Account-BE_W101C.js → Account-LVXhagaS.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-DjKQJAos.js → ChangelogDialog-DM0KAoy6.js} +1 -1
- package/apps/web/dist/assets/ChatPanel-CxOQmtv-.js +1 -0
- package/apps/web/dist/assets/CreditsDialog-DkW3YT44.js +1 -0
- package/apps/web/dist/assets/EditorPage-hbisE1Wf.js +2 -0
- package/apps/web/dist/assets/{FlowPreview-DK4RZqTW.js → FlowPreview-v7or29ku.js} +1 -1
- package/apps/web/dist/assets/{Harness-DcI94f1U.js → Harness-RZF-bBmb.js} +2 -2
- package/apps/web/dist/assets/{HomePage-BBNFgryu.js → HomePage-mxG-a_KU.js} +1 -1
- package/apps/web/dist/assets/{ImportWizard-BoYqovdl.js → ImportWizard-CiPyUt3E.js} +1 -1
- package/apps/web/dist/assets/LocalRuntime-Dqp9wkN3.js +1 -0
- package/apps/web/dist/assets/{NewWizardPage-tKV2S4eK.js → NewWizardPage-DHwRsi0_.js} +2 -2
- package/apps/web/dist/assets/ProjectPage-Bb7jN_6n.js +4 -0
- package/apps/web/dist/assets/PublicRunner-TGkOwbAP.js +1 -0
- package/apps/web/dist/assets/RunnerView-DzHGshZj.js +70 -0
- package/apps/web/dist/assets/SettingsPage-CG3Xtfej.js +1 -0
- package/apps/web/dist/assets/{SetupPage-qxHvlf87.js → SetupPage-O1GfPlqX.js} +1 -1
- package/apps/web/dist/assets/SharePage-CCNUhtry.js +1 -0
- package/apps/web/dist/assets/{api-t9_w1XNe.js → api-DB22_B7G.js} +2 -2
- package/apps/web/dist/assets/changelog-BkIJdZ7M.js +1 -0
- package/apps/web/dist/assets/{esm-D0YVMTdo.js → esm-3TT9i_rv.js} +1 -1
- package/apps/web/dist/assets/index-CLe9Wrpu.js +10 -0
- package/apps/web/dist/assets/{meta-BJHYbMh7.js → meta-CEsBCPfA.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-BqqUAvIY.js → settings-menu-pOcjznGJ.js} +1 -1
- package/apps/web/dist/assets/ui-I7QYMX0F.js +1 -0
- package/apps/web/dist/index.html +3 -3
- package/apps/web/dist/mcp/flow.html +53 -53
- package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +10 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.js +25 -0
- package/node_modules/@engenty-wizards/shared/dist/run.d.ts +141 -0
- package/node_modules/@engenty-wizards/shared/dist/run.js +72 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/ChatPanel-BWrcDs4s.js +0 -1
- package/apps/web/dist/assets/CreditsDialog-DUjR5xkl.js +0 -1
- package/apps/web/dist/assets/EditorPage-CrOqikP2.js +0 -2
- package/apps/web/dist/assets/LocalRuntime-BD8zGN8w.js +0 -1
- package/apps/web/dist/assets/ProjectPage-voR0hvzy.js +0 -4
- package/apps/web/dist/assets/PublicRunner-CYZE_hSi.js +0 -1
- package/apps/web/dist/assets/RunnerView-D_C7hn81.js +0 -70
- package/apps/web/dist/assets/SettingsPage-DguoPF_3.js +0 -1
- package/apps/web/dist/assets/SharePage-Cf3i7KB-.js +0 -1
- package/apps/web/dist/assets/changelog-kz0DmHY4.js +0 -1
- package/apps/web/dist/assets/index-D5w3fW1p.js +0 -10
- package/apps/web/dist/assets/ui-BHXO_e0e.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
|
-
/**
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
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;
|