gipity 1.1.30 → 1.1.31
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/commands/deploy.js +1 -2
- package/dist/commands/email.js +2 -0
- package/dist/commands/page-eval.js +25 -0
- package/dist/commands/page-test.js +24 -10
- package/dist/commands/sandbox.js +9 -0
- package/dist/index.js +46 -11
- package/package.json +1 -1
package/dist/commands/deploy.js
CHANGED
|
@@ -53,8 +53,7 @@ export const deployCommand = new Command('deploy')
|
|
|
53
53
|
.option('--only <phases>', 'Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding')
|
|
54
54
|
.option('--force', 'Re-run all phases (ignore checksums) and bypass the sync bulk-deletion guard')
|
|
55
55
|
.option('--no-sync', 'Skip sync-up before deploy')
|
|
56
|
-
.option('--optimize', '
|
|
57
|
-
.option('--no-optimize', 'Skip build optimization and upload files as-is - the escape hatch for plain-HTML apps whose <script src> tags are not type="module"')
|
|
56
|
+
.option('--optimize', 'Bundle and minify the JS/CSS with Vite (off by default: files upload as-is, so prod serves what you verified). Only bundles <script type="module"> references, and page eval import() of an app module then loads a separate copy')
|
|
58
57
|
.option('--json', 'Output as JSON')
|
|
59
58
|
.option('--inspect [path]', 'After a successful deploy, run `page inspect` on the deployed URL (or URL + path) in the same command - one build-loop step instead of two. With --json, emits two JSON lines: deploy, then inspect.')
|
|
60
59
|
// The settle knobs `page inspect` already has. An app whose first paint is behind
|
package/dist/commands/email.js
CHANGED
|
@@ -71,6 +71,8 @@ emailCommand
|
|
|
71
71
|
const subj = r.detail?.subject ? ` · ${r.detail.subject}` : '';
|
|
72
72
|
const status = r.detail?.status ? ` [skipped: ${r.detail.status}]` : '';
|
|
73
73
|
console.log(` ${muted(when)} ${to}${status ? warning(status) : ''}${muted(subj)}`);
|
|
74
|
+
if (r.detail?.reason)
|
|
75
|
+
console.log(` ${muted(r.detail.reason)}`);
|
|
74
76
|
}
|
|
75
77
|
}));
|
|
76
78
|
//# sourceMappingURL=email.js.map
|
|
@@ -325,6 +325,22 @@ export function slowRenderMessage(fps, o) {
|
|
|
325
325
|
+ `Step the app's own loop deterministically instead (3D templates: ${bold('core.advance(seconds)')}; `
|
|
326
326
|
+ `2D/Phaser template: ${bold("(await import('./js/config.js')).advance(seconds)")}).`;
|
|
327
327
|
}
|
|
328
|
+
/** A slow eval should say which leg was slow, instead of leaving the caller to
|
|
329
|
+
* guess a longer --wait. Silent under SLOW_EVAL_MS. Exported for tests. */
|
|
330
|
+
const SLOW_EVAL_MS = 20_000;
|
|
331
|
+
export function evalTimingLine(t) {
|
|
332
|
+
const total = t.hostMs + t.submitMs + t.pollMs;
|
|
333
|
+
if (total < SLOW_EVAL_MS)
|
|
334
|
+
return null;
|
|
335
|
+
const s = (ms) => `${(ms / 1000).toFixed(1)}s`;
|
|
336
|
+
const parts = [
|
|
337
|
+
t.hostMs >= 500 ? `hosting files ${s(t.hostMs)}` : null,
|
|
338
|
+
t.submitMs >= 500 ? `camera/feed setup ${s(t.submitMs)}` : null,
|
|
339
|
+
t.browserMs !== undefined ? `browser ${s(t.browserMs)} (launch, page load, waits, script)` : `browser ${s(t.pollMs)}`,
|
|
340
|
+
t.browserMs !== undefined && t.pollMs - t.browserMs >= 2000 ? `queue + cleanup ${s(t.pollMs - t.browserMs)}` : null,
|
|
341
|
+
].filter(Boolean);
|
|
342
|
+
return `timing: ${s(total)} = ${parts.join(' + ')}`;
|
|
343
|
+
}
|
|
328
344
|
/** Poll the async eval job until it finishes. Eval runs server-side as a
|
|
329
345
|
* short-lived job (so a long --wait can't trip the gateway idle timeout);
|
|
330
346
|
* we submit, then poll the result out of the job store. `expectedWorkMs` is
|
|
@@ -600,6 +616,7 @@ export const pageEvalCommand = new Command('eval')
|
|
|
600
616
|
const { config } = await resolveProjectContext({});
|
|
601
617
|
projectGuid = config.projectGuid;
|
|
602
618
|
}
|
|
619
|
+
const hostStart = Date.now();
|
|
603
620
|
if (opts.camera) {
|
|
604
621
|
console.log(muted(`Hosting camera feed ${opts.camera}...`));
|
|
605
622
|
camera = await uploadCameraFeed(projectGuid, opts.camera);
|
|
@@ -621,6 +638,7 @@ export const pageEvalCommand = new Command('eval')
|
|
|
621
638
|
if (settleAfterGateMs > 0) {
|
|
622
639
|
sentExpr = withPrelude(sentExpr, `await new Promise((r) => setTimeout(r, ${settleAfterGateMs}));`);
|
|
623
640
|
}
|
|
641
|
+
const submitStart = Date.now();
|
|
624
642
|
const kickoff = await post('/tools/browser/eval', {
|
|
625
643
|
url, expr: sentExpr, waitMs: sentWaitMs,
|
|
626
644
|
steps: sentSteps.length ? sentSteps : undefined,
|
|
@@ -634,6 +652,7 @@ export const pageEvalCommand = new Command('eval')
|
|
|
634
652
|
fakeMedia: opts.fakeMedia || !!camera || undefined,
|
|
635
653
|
cameraUrl: camera?.url,
|
|
636
654
|
});
|
|
655
|
+
const pollStart = Date.now();
|
|
637
656
|
let d;
|
|
638
657
|
try {
|
|
639
658
|
d = await pollEvalResult(kickoff.data.evalJobId, evalWorkBudgetMs({
|
|
@@ -658,6 +677,12 @@ export const pageEvalCommand = new Command('eval')
|
|
|
658
677
|
throw err;
|
|
659
678
|
throw new Error(`${msg}\n${hint}`);
|
|
660
679
|
}
|
|
680
|
+
const timing = evalTimingLine({
|
|
681
|
+
hostMs: submitStart - hostStart, submitMs: pollStart - submitStart,
|
|
682
|
+
pollMs: Date.now() - pollStart, browserMs: d.browserMs,
|
|
683
|
+
});
|
|
684
|
+
if (timing)
|
|
685
|
+
console.error(muted(timing));
|
|
661
686
|
const { result, noValue } = normalizeEvalResult(d.result);
|
|
662
687
|
const reload = d.reloadResult !== undefined ? normalizeEvalResult(d.reloadResult) : undefined;
|
|
663
688
|
const execTimeout = evalExecTimeoutMessage(d.result, scriptBudgetMs);
|
|
@@ -18,6 +18,12 @@ async function inspectClient(url, waitMs, i) {
|
|
|
18
18
|
}
|
|
19
19
|
const MAX_HOLD_MS = 15_000; // keep each in-page await under the ~20s browser action timeout
|
|
20
20
|
const MIN_HOLD_MS = 1_000;
|
|
21
|
+
// Clients start on separate browser containers, and a cold one can take longer
|
|
22
|
+
// to load than a whole --hold, so "each client holds from its own load" left a
|
|
23
|
+
// late client sampling after the early one had closed its page (a false
|
|
24
|
+
// "did NOT overlap" even with --stagger 0). Every client instead waits, page
|
|
25
|
+
// open, until a shared start time this far after its launch, then holds.
|
|
26
|
+
export const JOIN_ALLOWANCE_MS = 12_000;
|
|
21
27
|
// ── lifecycle actions (--at) ───────────────────────────────────────────────
|
|
22
28
|
// Freeze, hide, or take one client offline partway through the hold window, so
|
|
23
29
|
// an app can test what its peers do when a phone locks (host handoff) instead
|
|
@@ -146,13 +152,15 @@ function warnUnknownTokens(unknown) {
|
|
|
146
152
|
/** Build the statement-body script one client runs: do the one-time action,
|
|
147
153
|
* then sample `observe` `samples` times across `holdMs`, stamping in-page
|
|
148
154
|
* start/end so the caller can confirm the clients overlapped. */
|
|
149
|
-
export function buildHarness(action, observe, label, holdMs, samples) {
|
|
155
|
+
export function buildHarness(action, observe, label, holdMs, samples, startAt) {
|
|
150
156
|
const n = Math.max(2, samples);
|
|
151
157
|
const interval = Math.max(0, Math.floor(holdMs / (n - 1)));
|
|
152
|
-
const lines = [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
const lines = [`const __label=${JSON.stringify(label)};`];
|
|
159
|
+
// Shared start (see JOIN_ALLOWANCE_MS). Capped so a skewed clock can't eat the budget.
|
|
160
|
+
if (startAt !== undefined) {
|
|
161
|
+
lines.push(`{ const __bw=Math.min(${startAt}-Date.now(),${JOIN_ALLOWANCE_MS}); if(__bw>0) await new Promise(function(r){setTimeout(r,__bw);}); }`);
|
|
162
|
+
}
|
|
163
|
+
lines.push(`const __t0=Date.now();`);
|
|
156
164
|
if (action && action.trim()) {
|
|
157
165
|
lines.push(`try{ ${action} }catch(__e){ return {label:__label,startedAt:__t0,endedAt:Date.now(),samples:[],actionError:String((__e&&__e.message)||__e)}; }`);
|
|
158
166
|
}
|
|
@@ -166,7 +174,7 @@ export function buildHarness(action, observe, label, holdMs, samples) {
|
|
|
166
174
|
return lines.join('\n');
|
|
167
175
|
}
|
|
168
176
|
/** Kick off and poll one client's eval job, then parse the harness payload. */
|
|
169
|
-
async function observeClient(url, expr, i, label, settleMs, holdMs, waitForSelector, lifecycle) {
|
|
177
|
+
async function observeClient(url, expr, i, label, settleMs, holdMs, waitForSelector, lifecycle, barrier = false) {
|
|
170
178
|
const base = { i, label, samples: [], startedAt: 0, endedAt: 0 };
|
|
171
179
|
try {
|
|
172
180
|
const kickoff = await post('/tools/browser/eval', {
|
|
@@ -175,12 +183,14 @@ async function observeClient(url, expr, i, label, settleMs, holdMs, waitForSelec
|
|
|
175
183
|
waitMs: settleMs,
|
|
176
184
|
waitForSelector: waitForSelector || undefined,
|
|
177
185
|
waitForTimeoutMs: waitForSelector ? 5000 : undefined,
|
|
186
|
+
// The shared-start wait runs inside the script, so the script needs room for it.
|
|
187
|
+
timeoutMs: barrier ? JOIN_ALLOWANCE_MS + holdMs + 10_000 : undefined,
|
|
178
188
|
// Timed from the start of the observe window; the server restores
|
|
179
189
|
// anything still applied at the end of the hold so the harness finishes.
|
|
180
190
|
lifecycle: lifecycle?.length ? { steps: lifecycle, untilMs: holdMs } : undefined,
|
|
181
191
|
});
|
|
182
192
|
// Server work ≈ nav + settle + the in-page hold; pollEvalResult adds 60s headroom.
|
|
183
|
-
const d = await pollEvalResult(kickoff.data.evalJobId, settleMs + holdMs);
|
|
193
|
+
const d = await pollEvalResult(kickoff.data.evalJobId, settleMs + holdMs + (barrier ? JOIN_ALLOWANCE_MS : 0));
|
|
184
194
|
const raw = d.result?.trim() ?? '';
|
|
185
195
|
if (raw.startsWith('EvalError:') || raw.startsWith('ObserveError:')) {
|
|
186
196
|
return { ...base, error: raw };
|
|
@@ -287,6 +297,10 @@ async function runInteractive(url, observe, opts) {
|
|
|
287
297
|
if (atSpecs.length)
|
|
288
298
|
console.log(muted(`lifecycle (ms into each client's hold): ${atSpecs.map((s) => s.trim()).join(', ')}`));
|
|
289
299
|
}
|
|
300
|
+
// Shared start for multi-client runs. Not with --at: its steps are timed from
|
|
301
|
+
// the script's start on the server, and a variable wait would shift them.
|
|
302
|
+
const barrier = clients > 1 && atSpecs.length === 0;
|
|
303
|
+
const t0 = Date.now();
|
|
290
304
|
const runs = [];
|
|
291
305
|
for (let i = 0; i < clients; i++) {
|
|
292
306
|
runs.push((async () => {
|
|
@@ -297,8 +311,8 @@ async function runInteractive(url, observe, opts) {
|
|
|
297
311
|
// asymmetric roles concurrently (e.g. ?role={{label}} with --labels host,join)
|
|
298
312
|
// and the overlap check still confirms they coexisted.
|
|
299
313
|
const clientUrl = subst(url, labelFor(i), i);
|
|
300
|
-
const expr = buildHarness(opts.action ? subst(opts.action, labelFor(i), i) : undefined, subst(observe, labelFor(i), i), labelFor(i), hold, samples);
|
|
301
|
-
return observeClient(clientUrl, expr, i, labelFor(i), settle, hold, opts.waitFor, lifecycle[i]);
|
|
314
|
+
const expr = buildHarness(opts.action ? subst(opts.action, labelFor(i), i) : undefined, subst(observe, labelFor(i), i), labelFor(i), hold, samples, barrier ? t0 + i * stagger * 1000 + JOIN_ALLOWANCE_MS : undefined);
|
|
315
|
+
return observeClient(clientUrl, expr, i, labelFor(i), settle, hold, opts.waitFor, lifecycle[i], barrier);
|
|
302
316
|
})());
|
|
303
317
|
}
|
|
304
318
|
const results = (await Promise.all(runs)).sort((a, b) => a.i - b.i);
|
|
@@ -340,7 +354,7 @@ async function runInteractive(url, observe, opts) {
|
|
|
340
354
|
}
|
|
341
355
|
else {
|
|
342
356
|
console.log(clrError('⚠ clients did NOT overlap in time: each ran in isolation, so any shared-state reading here is a FALSE NEGATIVE, not proof the app is broken.'));
|
|
343
|
-
console.log(muted(
|
|
357
|
+
console.log(muted(` Each client waits up to ${JOIN_ALLOWANCE_MS / 1000}s after launch for the others to load, then holds. Likely causes: --stagger ≥ --hold, or a client queued for a browser (more --clients than free slots). Lower --stagger / raise --hold / fewer --clients and retry.`));
|
|
344
358
|
}
|
|
345
359
|
if (errored.length > 0 || (clients > 1 && !overlapped))
|
|
346
360
|
process.exitCode = 1;
|
package/dist/commands/sandbox.js
CHANGED
|
@@ -383,6 +383,15 @@ GCC/Rust).
|
|
|
383
383
|
process.exit(1);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
+
// Empty code is never what the caller meant: usually `"$(cat missing.py)"`
|
|
387
|
+
// expanded to nothing, or an empty file. Say so here, before the server
|
|
388
|
+
// rejects it with a bare schema message.
|
|
389
|
+
if (!source?.trim()) {
|
|
390
|
+
console.error(clrError(filePath
|
|
391
|
+
? `${filePath} is empty: nothing to run.`
|
|
392
|
+
: 'The inline code is empty: nothing to run. If it came from "$(cat <file>)", that file is missing or empty; pass --file <path> instead.'));
|
|
393
|
+
process.exit(1);
|
|
394
|
+
}
|
|
386
395
|
// Language precedence: interpreter token > --language > file extension >
|
|
387
396
|
// unambiguous-command-line heuristic (bash). resolveLanguage() exits when
|
|
388
397
|
// nothing pins one and the input isn't command-shaped, rather than guessing.
|
package/dist/index.js
CHANGED
|
@@ -38185,6 +38185,19 @@ function slowRenderMessage(fps, o) {
|
|
|
38185
38185
|
}
|
|
38186
38186
|
return `${warning("\u26A0 Slow render:")} page painted at ${fps} fps. Waiting on real time (setTimeout) advances animation/physics time far slower than it looks: assertions after a wall-clock wait can report a false negative. Step the app's own loop deterministically instead (3D templates: ${bold("core.advance(seconds)")}; 2D/Phaser template: ${bold("(await import('./js/config.js')).advance(seconds)")}).`;
|
|
38187
38187
|
}
|
|
38188
|
+
var SLOW_EVAL_MS = 2e4;
|
|
38189
|
+
function evalTimingLine(t) {
|
|
38190
|
+
const total = t.hostMs + t.submitMs + t.pollMs;
|
|
38191
|
+
if (total < SLOW_EVAL_MS) return null;
|
|
38192
|
+
const s = (ms2) => `${(ms2 / 1e3).toFixed(1)}s`;
|
|
38193
|
+
const parts = [
|
|
38194
|
+
t.hostMs >= 500 ? `hosting files ${s(t.hostMs)}` : null,
|
|
38195
|
+
t.submitMs >= 500 ? `camera/feed setup ${s(t.submitMs)}` : null,
|
|
38196
|
+
t.browserMs !== void 0 ? `browser ${s(t.browserMs)} (launch, page load, waits, script)` : `browser ${s(t.pollMs)}`,
|
|
38197
|
+
t.browserMs !== void 0 && t.pollMs - t.browserMs >= 2e3 ? `queue + cleanup ${s(t.pollMs - t.browserMs)}` : null
|
|
38198
|
+
].filter(Boolean);
|
|
38199
|
+
return `timing: ${s(total)} = ${parts.join(" + ")}`;
|
|
38200
|
+
}
|
|
38188
38201
|
async function pollEvalResult(evalJobId, expectedWorkMs) {
|
|
38189
38202
|
const deadline = Date.now() + expectedWorkMs + 6e4;
|
|
38190
38203
|
let missCount = 0;
|
|
@@ -38346,6 +38359,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38346
38359
|
const { config } = await resolveProjectContext({});
|
|
38347
38360
|
projectGuid2 = config.projectGuid;
|
|
38348
38361
|
}
|
|
38362
|
+
const hostStart = Date.now();
|
|
38349
38363
|
if (opts.camera) {
|
|
38350
38364
|
console.log(muted(`Hosting camera feed ${opts.camera}...`));
|
|
38351
38365
|
camera = await uploadCameraFeed(projectGuid2, opts.camera);
|
|
@@ -38364,6 +38378,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38364
38378
|
if (settleAfterGateMs > 0) {
|
|
38365
38379
|
sentExpr = withPrelude(sentExpr, `await new Promise((r) => setTimeout(r, ${settleAfterGateMs}));`);
|
|
38366
38380
|
}
|
|
38381
|
+
const submitStart = Date.now();
|
|
38367
38382
|
const kickoff = await post("/tools/browser/eval", {
|
|
38368
38383
|
url,
|
|
38369
38384
|
expr: sentExpr,
|
|
@@ -38379,6 +38394,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38379
38394
|
fakeMedia: opts.fakeMedia || !!camera || void 0,
|
|
38380
38395
|
cameraUrl: camera?.url
|
|
38381
38396
|
});
|
|
38397
|
+
const pollStart = Date.now();
|
|
38382
38398
|
let d;
|
|
38383
38399
|
try {
|
|
38384
38400
|
d = await pollEvalResult(kickoff.data.evalJobId, evalWorkBudgetMs({
|
|
@@ -38396,6 +38412,13 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
|
|
|
38396
38412
|
throw new Error(`${msg}
|
|
38397
38413
|
${hint}`);
|
|
38398
38414
|
}
|
|
38415
|
+
const timing = evalTimingLine({
|
|
38416
|
+
hostMs: submitStart - hostStart,
|
|
38417
|
+
submitMs: pollStart - submitStart,
|
|
38418
|
+
pollMs: Date.now() - pollStart,
|
|
38419
|
+
browserMs: d.browserMs
|
|
38420
|
+
});
|
|
38421
|
+
if (timing) console.error(muted(timing));
|
|
38399
38422
|
const { result, noValue } = normalizeEvalResult(d.result);
|
|
38400
38423
|
const reload = d.reloadResult !== void 0 ? normalizeEvalResult(d.reloadResult) : void 0;
|
|
38401
38424
|
const execTimeout = evalExecTimeoutMessage(d.result, scriptBudgetMs);
|
|
@@ -39202,7 +39225,7 @@ async function printPlan(appGuid2, env, json) {
|
|
|
39202
39225
|
console.log(warning("A prod deploy stops on the destructive statements above until you pass --yes-destructive."));
|
|
39203
39226
|
}
|
|
39204
39227
|
}
|
|
39205
|
-
var deployCommand = new Command("deploy").description("Deploy the app to prod, or to an environment (created on first deploy)").argument("[env]", "prod, or an environment name (dev, staging, ...). Omitted: prod while the app has no environments; once it has any, name one").option("--yes-destructive", "Allow pending prod migrations that destroy data (DROP TABLE/COLUMN, TRUNCATE, DELETE without WHERE, column type changes)").option("--plan", "Show the pending migrations this deploy would run (and where each already ran), without deploying").option("--source-dir <dir>", "Source directory to deploy from").option("--only <phases>", "Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding").option("--force", "Re-run all phases (ignore checksums) and bypass the sync bulk-deletion guard").option("--no-sync", "Skip sync-up before deploy").option("--optimize",
|
|
39228
|
+
var deployCommand = new Command("deploy").description("Deploy the app to prod, or to an environment (created on first deploy)").argument("[env]", "prod, or an environment name (dev, staging, ...). Omitted: prod while the app has no environments; once it has any, name one").option("--yes-destructive", "Allow pending prod migrations that destroy data (DROP TABLE/COLUMN, TRUNCATE, DELETE without WHERE, column type changes)").option("--plan", "Show the pending migrations this deploy would run (and where each already ran), without deploying").option("--source-dir <dir>", "Source directory to deploy from").option("--only <phases>", "Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding").option("--force", "Re-run all phases (ignore checksums) and bypass the sync bulk-deletion guard").option("--no-sync", "Skip sync-up before deploy").option("--optimize", 'Bundle and minify the JS/CSS with Vite (off by default: files upload as-is, so prod serves what you verified). Only bundles <script type="module"> references, and page eval import() of an app module then loads a separate copy').option("--json", "Output as JSON").option("--inspect [path]", "After a successful deploy, run `page inspect` on the deployed URL (or URL + path) in the same command - one build-loop step instead of two. With --json, emits two JSON lines: deploy, then inspect.").option("--wait <ms>", "With --inspect: sleep this many ms before capturing (max 30000)").option("--wait-for <selector>", "With --inspect: wait until this CSS selector appears before capturing (deterministic; the app's own ready signal)").option("--wait-timeout <ms>", "With --inspect: max ms to wait for --wait-for before giving up", "5000").action((envArg, opts) => run("Deploy", async () => {
|
|
39206
39229
|
const env = envArg ?? getEnvOption();
|
|
39207
39230
|
if (opts.plan) {
|
|
39208
39231
|
await printPlan(requireConfig2().projectGuid, env ?? "prod", !!opts.json);
|
|
@@ -39919,6 +39942,10 @@ GCC/Rust).
|
|
|
39919
39942
|
process.exit(1);
|
|
39920
39943
|
}
|
|
39921
39944
|
}
|
|
39945
|
+
if (!source?.trim()) {
|
|
39946
|
+
console.error(error(filePath ? `${filePath} is empty: nothing to run.` : 'The inline code is empty: nothing to run. If it came from "$(cat <file>)", that file is missing or empty; pass --file <path> instead.'));
|
|
39947
|
+
process.exit(1);
|
|
39948
|
+
}
|
|
39922
39949
|
const language = resolveLanguage({ langFromInterp, langOpt: opts.language, filePath, inlineCode });
|
|
39923
39950
|
const discardOutput = opts.discardOutput ?? [];
|
|
39924
39951
|
if (discardOutput.some((g) => !g.trim())) {
|
|
@@ -43358,6 +43385,7 @@ async function inspectClient(url, waitMs, i) {
|
|
|
43358
43385
|
}
|
|
43359
43386
|
var MAX_HOLD_MS = 15e3;
|
|
43360
43387
|
var MIN_HOLD_MS = 1e3;
|
|
43388
|
+
var JOIN_ALLOWANCE_MS = 12e3;
|
|
43361
43389
|
var LIFECYCLE_ACTIONS = ["freeze", "wake", "hide", "show", "offline", "online"];
|
|
43362
43390
|
var PAUSED_SAMPLE = "(paused)";
|
|
43363
43391
|
var PAUSE_SLACK_MS = 1500;
|
|
@@ -43442,13 +43470,14 @@ function warnUnknownTokens(unknown) {
|
|
|
43442
43470
|
`\u26A0 Unrecognized placeholder ${unknown.join(", ")} left as-is: only {{i}} (0-based client index) and {{label}} are substituted per client. Set per-client values with --labels and reference them as {{label}}.`
|
|
43443
43471
|
));
|
|
43444
43472
|
}
|
|
43445
|
-
function buildHarness(action, observe, label2, holdMs, samples) {
|
|
43473
|
+
function buildHarness(action, observe, label2, holdMs, samples, startAt) {
|
|
43446
43474
|
const n = Math.max(2, samples);
|
|
43447
43475
|
const interval = Math.max(0, Math.floor(holdMs / (n - 1)));
|
|
43448
|
-
const lines = [
|
|
43449
|
-
|
|
43450
|
-
`const
|
|
43451
|
-
|
|
43476
|
+
const lines = [`const __label=${JSON.stringify(label2)};`];
|
|
43477
|
+
if (startAt !== void 0) {
|
|
43478
|
+
lines.push(`{ const __bw=Math.min(${startAt}-Date.now(),${JOIN_ALLOWANCE_MS}); if(__bw>0) await new Promise(function(r){setTimeout(r,__bw);}); }`);
|
|
43479
|
+
}
|
|
43480
|
+
lines.push(`const __t0=Date.now();`);
|
|
43452
43481
|
if (action && action.trim()) {
|
|
43453
43482
|
lines.push(
|
|
43454
43483
|
`try{ ${action} }catch(__e){ return {label:__label,startedAt:__t0,endedAt:Date.now(),samples:[],actionError:String((__e&&__e.message)||__e)}; }`
|
|
@@ -43467,7 +43496,7 @@ function buildHarness(action, observe, label2, holdMs, samples) {
|
|
|
43467
43496
|
);
|
|
43468
43497
|
return lines.join("\n");
|
|
43469
43498
|
}
|
|
43470
|
-
async function observeClient(url, expr, i, label2, settleMs, holdMs, waitForSelector, lifecycle) {
|
|
43499
|
+
async function observeClient(url, expr, i, label2, settleMs, holdMs, waitForSelector, lifecycle, barrier = false) {
|
|
43471
43500
|
const base = { i, label: label2, samples: [], startedAt: 0, endedAt: 0 };
|
|
43472
43501
|
try {
|
|
43473
43502
|
const kickoff = await post("/tools/browser/eval", {
|
|
@@ -43476,11 +43505,13 @@ async function observeClient(url, expr, i, label2, settleMs, holdMs, waitForSele
|
|
|
43476
43505
|
waitMs: settleMs,
|
|
43477
43506
|
waitForSelector: waitForSelector || void 0,
|
|
43478
43507
|
waitForTimeoutMs: waitForSelector ? 5e3 : void 0,
|
|
43508
|
+
// The shared-start wait runs inside the script, so the script needs room for it.
|
|
43509
|
+
timeoutMs: barrier ? JOIN_ALLOWANCE_MS + holdMs + 1e4 : void 0,
|
|
43479
43510
|
// Timed from the start of the observe window; the server restores
|
|
43480
43511
|
// anything still applied at the end of the hold so the harness finishes.
|
|
43481
43512
|
lifecycle: lifecycle?.length ? { steps: lifecycle, untilMs: holdMs } : void 0
|
|
43482
43513
|
});
|
|
43483
|
-
const d = await pollEvalResult(kickoff.data.evalJobId, settleMs + holdMs);
|
|
43514
|
+
const d = await pollEvalResult(kickoff.data.evalJobId, settleMs + holdMs + (barrier ? JOIN_ALLOWANCE_MS : 0));
|
|
43484
43515
|
const raw = d.result?.trim() ?? "";
|
|
43485
43516
|
if (raw.startsWith("EvalError:") || raw.startsWith("ObserveError:")) {
|
|
43486
43517
|
return { ...base, error: raw };
|
|
@@ -43560,6 +43591,8 @@ async function runInteractive(url, observe, opts) {
|
|
|
43560
43591
|
console.log(muted(`${clients} client(s), stagger ${stagger}s, hold ${hold}ms, ${samples} samples each`));
|
|
43561
43592
|
if (atSpecs.length) console.log(muted(`lifecycle (ms into each client's hold): ${atSpecs.map((s) => s.trim()).join(", ")}`));
|
|
43562
43593
|
}
|
|
43594
|
+
const barrier = clients > 1 && atSpecs.length === 0;
|
|
43595
|
+
const t0 = Date.now();
|
|
43563
43596
|
const runs = [];
|
|
43564
43597
|
for (let i = 0; i < clients; i++) {
|
|
43565
43598
|
runs.push((async () => {
|
|
@@ -43571,9 +43604,10 @@ async function runInteractive(url, observe, opts) {
|
|
|
43571
43604
|
subst(observe, labelFor2(i), i),
|
|
43572
43605
|
labelFor2(i),
|
|
43573
43606
|
hold,
|
|
43574
|
-
samples
|
|
43607
|
+
samples,
|
|
43608
|
+
barrier ? t0 + i * stagger * 1e3 + JOIN_ALLOWANCE_MS : void 0
|
|
43575
43609
|
);
|
|
43576
|
-
return observeClient(clientUrl, expr, i, labelFor2(i), settle, hold, opts.waitFor, lifecycle[i]);
|
|
43610
|
+
return observeClient(clientUrl, expr, i, labelFor2(i), settle, hold, opts.waitFor, lifecycle[i], barrier);
|
|
43577
43611
|
})());
|
|
43578
43612
|
}
|
|
43579
43613
|
const results = (await Promise.all(runs)).sort((a, b7) => a.i - b7.i);
|
|
@@ -43622,7 +43656,7 @@ ${warning(observeHint)}`);
|
|
|
43622
43656
|
"\u26A0 clients did NOT overlap in time: each ran in isolation, so any shared-state reading here is a FALSE NEGATIVE, not proof the app is broken."
|
|
43623
43657
|
));
|
|
43624
43658
|
console.log(muted(
|
|
43625
|
-
|
|
43659
|
+
` Each client waits up to ${JOIN_ALLOWANCE_MS / 1e3}s after launch for the others to load, then holds. Likely causes: --stagger \u2265 --hold, or a client queued for a browser (more --clients than free slots). Lower --stagger / raise --hold / fewer --clients and retry.`
|
|
43626
43660
|
));
|
|
43627
43661
|
}
|
|
43628
43662
|
if (errored.length > 0 || clients > 1 && !overlapped) process.exitCode = 1;
|
|
@@ -44890,6 +44924,7 @@ emailCommand.command("log").description("Recent email() sends and skipped attemp
|
|
|
44890
44924
|
const subj = r.detail?.subject ? ` \xB7 ${r.detail.subject}` : "";
|
|
44891
44925
|
const status = r.detail?.status ? ` [skipped: ${r.detail.status}]` : "";
|
|
44892
44926
|
console.log(` ${muted(when)} ${to2}${status ? warning(status) : ""}${muted(subj)}`);
|
|
44927
|
+
if (r.detail?.reason) console.log(` ${muted(r.detail.reason)}`);
|
|
44893
44928
|
}
|
|
44894
44929
|
}));
|
|
44895
44930
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.31",
|
|
4
4
|
"description": "The full-stack platform tuned for AI agents. Database, storage, auth, functions, deploy, and drop-in kits - all agent-tuned. Pair with Claude Code or use standalone.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gipity": "dist/updater/shim.js",
|