@staff0rd/assist 0.1217.2 → 0.1217.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.
- package/dist/.build-files +147 -146
- package/dist/{add-EZJUAHEI.js → add-FF5Q6BQI.js} +6 -6
- package/dist/{add-7ASBBLTR.js → add-IWYK3W5M.js} +3 -3
- package/dist/{add-5Y4ZGXJI.js → add-JSTBSXZ3.js} +7 -7
- package/dist/{addActivity-DWF2SIEY.js → addActivity-AM732YRL.js} +6 -6
- package/dist/{addPhase-NPHALYYK.js → addPhase-VPFUHCL5.js} +7 -7
- package/dist/{askCheck-4T7YCGZA.js → askCheck-PMVXCO27.js} +5 -5
- package/dist/{associateGithub-T5H2W22C.js → associateGithub-7S3P6YHE.js} +6 -6
- package/dist/{associateJira-Y7RC5FPM.js → associateJira-ID2CN5LN.js} +6 -6
- package/dist/{backup-HXA2R6GI.js → backup-DTJ5SWLS.js} +4 -4
- package/dist/{branch-CWOKUDME.js → branch-WKOEBJAP.js} +6 -6
- package/dist/built-version +1 -1
- package/dist/{chunk-ZLCCVR27.js → chunk-2EPZWHHJ.js} +1 -1
- package/dist/{chunk-SETDVHOS.js → chunk-2FF24W23.js} +1 -1
- package/dist/{chunk-GINJQIVR.js → chunk-2MZYTQLA.js} +2 -2
- package/dist/{chunk-VCK2QJYZ.js → chunk-3LNSR6EC.js} +2 -2
- package/dist/{chunk-EMZD2PQN.js → chunk-4MPKR3NH.js} +2 -2
- package/dist/{chunk-DJAV6URQ.js → chunk-4W47FGN7.js} +2 -2
- package/dist/{chunk-IB7NXLHT.js → chunk-5AQT32G3.js} +1 -1
- package/dist/{chunk-E4SMVLJ3.js → chunk-5SZCYNLP.js} +2 -2
- package/dist/{chunk-APM22DBI.js → chunk-7FANAVGR.js} +2 -2
- package/dist/{chunk-WL2LCXRE.js → chunk-AWJND3GR.js} +1 -1
- package/dist/{chunk-QFSTYYD5.js → chunk-AXYRT6ML.js} +1 -1
- package/dist/{chunk-TYDUIDUU.js → chunk-BBE5K7OG.js} +1 -1
- package/dist/{chunk-Q53H77EM.js → chunk-BNPRVYGA.js} +23 -23
- package/dist/{chunk-JMWY47DZ.js → chunk-CS7HC5ZN.js} +1 -1
- package/dist/{chunk-2R4VODAU.js → chunk-CVMH6FBE.js} +31 -10
- package/dist/{chunk-7SAG7CZU.js → chunk-DM6BIOGS.js} +2 -2
- package/dist/{chunk-GWWFNY3Q.js → chunk-DOVFHJNY.js} +2 -2
- package/dist/{chunk-SRM24H2H.js → chunk-DYD5UR25.js} +1 -1
- package/dist/{chunk-J6ULAU7G.js → chunk-EKKGNYON.js} +1 -1
- package/dist/{chunk-NPX2RC46.js → chunk-FMGU4HY6.js} +1 -1
- package/dist/{chunk-VP5IDAYV.js → chunk-HOBSS6DQ.js} +1 -1
- package/dist/{chunk-3KJYVBHR.js → chunk-IUZKITBG.js} +2 -2
- package/dist/{chunk-UKER3EBG.js → chunk-JA2OX46V.js} +1 -1
- package/dist/{chunk-PQPK7WO2.js → chunk-JNU3QO2L.js} +2 -2
- package/dist/{chunk-ILJBR4Z5.js → chunk-KQE6OV74.js} +1 -1
- package/dist/{chunk-LQMXLKPW.js → chunk-MF7O7S5J.js} +1 -1
- package/dist/{chunk-5PQE2NIS.js → chunk-MKJE7N63.js} +2 -2
- package/dist/{chunk-GNGJN74L.js → chunk-NGOIVQ7G.js} +4 -4
- package/dist/{chunk-BKBM4BK4.js → chunk-NQJZHXHO.js} +4 -4
- package/dist/{chunk-DCQVGAEU.js → chunk-O2S3GTAV.js} +1 -1
- package/dist/{chunk-3MMYXKEQ.js → chunk-ORVF4YMU.js} +1 -1
- package/dist/{chunk-MYH4MQX2.js → chunk-OTSOBFW2.js} +70 -1
- package/dist/{chunk-RPVG4LT2.js → chunk-PQX57SJI.js} +1 -1
- package/dist/{chunk-WASQ7WKP.js → chunk-PXP35WEE.js} +1 -1
- package/dist/{chunk-Y7BMVFWM.js → chunk-S2GJNVPT.js} +1 -1
- package/dist/chunk-S5PTNGA6.js +36 -0
- package/dist/{chunk-SRALWEUN.js → chunk-SF2RHLX2.js} +2 -2
- package/dist/{chunk-VTLUY7XC.js → chunk-T5CZSBHN.js} +1 -1
- package/dist/{chunk-AA4LR7TZ.js → chunk-T73ASAIR.js} +1 -1
- package/dist/{chunk-NDQSDS4F.js → chunk-UIPXBXOZ.js} +2 -2
- package/dist/{chunk-ZSTBHQV2.js → chunk-UL77JFUV.js} +1 -1
- package/dist/{chunk-7BFZHD4I.js → chunk-UTZE4ATH.js} +1 -1
- package/dist/{chunk-4VKT4I4L.js → chunk-UX47UP2J.js} +8 -8
- package/dist/{chunk-SE7AGKET.js → chunk-VJULCOYT.js} +1 -1
- package/dist/{chunk-THDA52VL.js → chunk-VN4XGDT3.js} +1 -1
- package/dist/{chunk-E7HQDBOP.js → chunk-VPJ265PL.js} +1 -1
- package/dist/{chunk-RMGHIMUY.js → chunk-VSAPOSGT.js} +2 -2
- package/dist/{chunk-MQNYXTPX.js → chunk-W4AXRI6K.js} +1 -1
- package/dist/{chunk-C3PMHXR5.js → chunk-WSCL7Z3D.js} +1 -1
- package/dist/{chunk-W3Z265RR.js → chunk-WYKZNCOJ.js} +5 -5
- package/dist/{chunk-SJPSNC5F.js → chunk-X3WNIE7X.js} +1 -1
- package/dist/{chunk-DMUJXQMN.js → chunk-XZH5ZX4E.js} +3 -3
- package/dist/{chunk-CIDPTAUE.js → chunk-Y7VRIUV2.js} +2 -2
- package/dist/{chunk-PF6E5TS6.js → chunk-YC6BVWED.js} +3 -3
- package/dist/{chunk-BN7NHR6E.js → chunk-YHV4UETG.js} +1 -1
- package/dist/{chunk-GKVZXR25.js → chunk-YQRLH4YY.js} +6 -6
- package/dist/{chunk-VI2VYWBR.js → chunk-YUYMJUUS.js} +3 -3
- package/dist/{chunk-TUAXUEF3.js → chunk-Z7TJT7AA.js} +2 -2
- package/dist/{chunk-UACYM7W6.js → chunk-ZB2FO6CM.js} +3 -3
- package/dist/{cliHook-UNXC3G7X.js → cliHook-7PQM2WTM.js} +6 -6
- package/dist/{codexHook-SMS3R2QO.js → codexHook-OJLZXVU5.js} +6 -6
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/{comment-QFR4BS4Q.js → comment-MSV2E635.js} +6 -6
- package/dist/{comments-PJZGOEPS.js → comments-FCCBRXJE.js} +5 -5
- package/dist/{commit-4S5KIN3K.js → commit-ZQJTHHFX.js} +7 -7
- package/dist/{configGet-5L6N7VKH.js → configGet-564MKBJM.js} +5 -5
- package/dist/{configImportRepos-DS6VOZ24.js → configImportRepos-6KAAV3PO.js} +5 -5
- package/dist/{configImportUser-W7D2TEUE.js → configImportUser-M3SHYURA.js} +5 -5
- package/dist/{configList-F5YD5RCL.js → configList-DF22GHUK.js} +5 -5
- package/dist/{configSet-DW44W5GI.js → configSet-MJILD7YZ.js} +10 -10
- package/dist/{configUnset-W6GYH4N6.js → configUnset-QEK3UPIN.js} +9 -9
- package/dist/{del-AFCM3JXA.js → del-ZKJEE4M5.js} +5 -5
- package/dist/{deleteCommentCmd-WI4QTOEV.js → deleteCommentCmd-IFGWRGJK.js} +6 -6
- package/dist/{docsConfirm-5JSC4BVS.js → docsConfirm-7BB72JTA.js} +7 -7
- package/dist/{docsScreenshots-3L3QEB5C.js → docsScreenshots-JDCKHHDG.js} +5 -5
- package/dist/{docsUnlock-Y7YBDC7H.js → docsUnlock-5LTKHHCE.js} +5 -5
- package/dist/{doctorNodes-I7NHNC66.js → doctorNodes-5HZQ6IPJ.js} +3 -3
- package/dist/{done-SVTTLXCC.js → done-OERWZMJP.js} +6 -6
- package/dist/{editHook-7DXRZEQ6.js → editHook-4CUMAXR3.js} +6 -6
- package/dist/{exportBacklog-RLCMLOEJ.js → exportBacklog-P3OZGQRO.js} +4 -4
- package/dist/{harnessFollowUps-W7N2ORIC.js → harnessFollowUps-XKDIX2WZ.js} +5 -5
- package/dist/{importBacklog-3BULWU65.js → importBacklog-HOTLJWSZ.js} +3 -3
- package/dist/index.js +104 -98
- package/dist/{launchMode-EVPPY774.js → launchMode-AIHMC7VO.js} +17 -17
- package/dist/{link-QB7RHGDR.js → link-FQDXJJXS.js} +5 -5
- package/dist/{list-IGAUA6BG.js → list-56AQEY5E.js} +3 -3
- package/dist/{list-6YSPFX7W.js → list-JK44SVFR.js} +4 -4
- package/dist/{list-7STB4E63.js → list-U7BT5653.js} +5 -5
- package/dist/{migrate-F2FLMITB.js → migrate-GCUCBKXC.js} +6 -6
- package/dist/{migrations-TCGVSYHP.js → migrations-IRD7J2BD.js} +1 -1
- package/dist/{movePhase-5NKBMC2B.js → movePhase-MAP42ZMQ.js} +6 -6
- package/dist/{moveRepo-TADXTU36.js → moveRepo-DN75IR33.js} +5 -5
- package/dist/{next-3SULCPS5.js → next-AEISXUUF.js} +15 -15
- package/dist/{phaseDone-VAMUOJ4N.js → phaseDone-DSBVKOZC.js} +8 -8
- package/dist/{piHook-BN6JWTIZ.js → piHook-BURLNM5A.js} +6 -6
- package/dist/{plan-3ZGB5UAC.js → plan-NAR7TL6V.js} +5 -5
- package/dist/{propose-XUYQOBXX.js → propose-KNABVYU4.js} +9 -9
- package/dist/{raise-5423O734.js → raise-Y3FDHE7R.js} +5 -5
- package/dist/{recordSlack-MX24A6RU.js → recordSlack-HNDOADKD.js} +5 -5
- package/dist/{refine-HEV7SIJ5.js → refine-VBWUCMR3.js} +19 -19
- package/dist/{refreshDocs-JMGN4YGG.js → refreshDocs-5WDVIT22.js} +6 -6
- package/dist/{releasesConfigure-3D2E6ITE.js → releasesConfigure-BOUN2FX4.js} +7 -7
- package/dist/{remove-6GSBLXCV.js → remove-EASMC2JW.js} +7 -7
- package/dist/{remove-QWE6S2M7.js → remove-NCTMQR7P.js} +3 -3
- package/dist/{removePhase-S6ENVZVC.js → removePhase-7SAHZSDJ.js} +7 -7
- package/dist/{restartNode-2NKDSMU7.js → restartNode-3MTDY3UY.js} +5 -5
- package/dist/{review-NSDKV5BP.js → review-6ZV6272L.js} +7 -7
- package/dist/{rewindPhase-VO2EVERJ.js → rewindPhase-HXENH4NQ.js} +8 -8
- package/dist/{rulesAdd-APEZLBDK.js → rulesAdd-VIY2XT3H.js} +9 -9
- package/dist/{run-I7637X7J.js → run-3F43QON5.js} +14 -14
- package/dist/{run-UYLLMSJO.js → run-UJTFXZUG.js} +14 -14
- package/dist/{runDaemon-BKWYOHBL.js → runDaemon-KBN2FOBR.js} +22 -13
- package/dist/{runExtract-AFVY3P6A.js → runExtract-Q6OMVRSJ.js} +7 -7
- package/dist/{runParallelPhase-TV7AOZ7D.js → runParallelPhase-QECCEFMQ.js} +10 -10
- package/dist/{runRefine-NRWBRWJ4.js → runRefine-TGDYSBIQ.js} +19 -19
- package/dist/{scan-SPMNXQOV.js → scan-F2FXXVOF.js} +5 -5
- package/dist/{schemaConfirm-XXI5FNKM.js → schemaConfirm-YQWR5EOE.js} +7 -7
- package/dist/{schemaLock-4VR6CWUR.js → schemaLock-L5LTZVSJ.js} +5 -5
- package/dist/{schemaUnlock-FN63XVSC.js → schemaUnlock-LKT2GJMZ.js} +5 -5
- package/dist/{search-L3YYRFY3.js → search-EDYBLIOS.js} +5 -5
- package/dist/{setStatusCommand-COGB6OYD.js → setStatusCommand-IGSZKAF3.js} +5 -5
- package/dist/{show-YMFFZAGJ.js → show-SAD23YAK.js} +7 -7
- package/dist/{signExtension-AM57SFSM.js → signExtension-5Q2OQCZV.js} +1 -1
- package/dist/{skip-XAOPATAT.js → skip-TSCPOI7Q.js} +7 -7
- package/dist/{star-PVGXNDZC.js → star-AH6XA4XY.js} +7 -7
- package/dist/{start-2HDY27JY.js → start-E3DHKNWV.js} +5 -5
- package/dist/{status-JXHX6AUI.js → status-EVEAG6M7.js} +2 -2
- package/dist/{stop-SGD6CRY4.js → stop-Q2MOYRUU.js} +5 -5
- package/dist/{unlink-NRCRI35K.js → unlink-URWN5N5Q.js} +5 -5
- package/dist/{unstar-TTWHIOYO.js → unstar-3NROQLQD.js} +7 -7
- package/dist/{update-5G42A5LW.js → update-RGQAZWZO.js} +5 -5
- package/dist/{update-KD2UWY63.js → update-TZ7H4C2Z.js} +5 -0
- package/dist/{updateNode-LC55GQPX.js → updateNode-XLNH2SHX.js} +5 -5
- package/dist/{updatePhase-FN4ZV2ER.js → updatePhase-3YMRLEB4.js} +6 -6
- package/dist/{updatePlan-GCFHXWXF.js → updatePlan-VG5CYX7Z.js} +8 -8
- package/dist/{watchWait-YYMDQTOI.js → watchWait-3ROYFVMY.js} +5 -0
- package/dist/{web-PNOCYLSQ.js → web-IIYRREHL.js} +32 -32
- package/dist/{web-FI5YBEGD.js → web-R5V7RYR3.js} +32 -32
- package/dist/{wontdo-BVSLYH3M.js → wontdo-I4M7APVY.js} +6 -6
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getMigrationStatus
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EKKGNYON.js";
|
|
4
4
|
import {
|
|
5
5
|
createPool,
|
|
6
6
|
pgExecutor
|
|
@@ -379,10 +379,10 @@ async function seedNewsFeeds(db) {
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
// src/shared/db/cleanupFalseResetSegments.ts
|
|
382
|
-
import { and as
|
|
382
|
+
import { and as and3, eq as eq3 } from "drizzle-orm";
|
|
383
383
|
|
|
384
384
|
// src/shared/db/recordWindowPeak.ts
|
|
385
|
-
import { sql } from "drizzle-orm";
|
|
385
|
+
import { sql as sql2 } from "drizzle-orm";
|
|
386
386
|
|
|
387
387
|
// src/shared/db/applyReading.ts
|
|
388
388
|
import { and, eq, gt } from "drizzle-orm";
|
|
@@ -424,16 +424,36 @@ async function openReset(c, active, usedPercentage) {
|
|
|
424
424
|
await insertSegment(c, active.segment + 1, usedPercentage);
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
// src/shared/db/resolveCycleResetsAt.ts
|
|
428
|
+
import { and as and2, between, eq as eq2, sql } from "drizzle-orm";
|
|
429
|
+
var CYCLE_RESET_TOLERANCE_SECONDS = 600;
|
|
430
|
+
async function resolveCycleResetsAt(db, window, resetsAt) {
|
|
431
|
+
const [nearest] = await db.select({ resetsAt: usagePeaks.resetsAt }).from(usagePeaks).where(
|
|
432
|
+
and2(
|
|
433
|
+
eq2(usagePeaks.window, window),
|
|
434
|
+
between(
|
|
435
|
+
usagePeaks.resetsAt,
|
|
436
|
+
resetsAt - CYCLE_RESET_TOLERANCE_SECONDS,
|
|
437
|
+
resetsAt + CYCLE_RESET_TOLERANCE_SECONDS
|
|
438
|
+
)
|
|
439
|
+
)
|
|
440
|
+
).orderBy(
|
|
441
|
+
sql`abs(${usagePeaks.resetsAt} - ${resetsAt})`,
|
|
442
|
+
usagePeaks.resetsAt
|
|
443
|
+
).limit(1);
|
|
444
|
+
return nearest?.resetsAt ?? resetsAt;
|
|
445
|
+
}
|
|
446
|
+
|
|
427
447
|
// src/shared/db/recordWindowPeak.ts
|
|
428
|
-
var lock = (
|
|
429
|
-
|
|
448
|
+
var lock = (tx, window) => tx.execute(
|
|
449
|
+
sql2`SELECT pg_advisory_xact_lock(hashtextextended(${`usage-peak:${window}`}, 0))`
|
|
430
450
|
);
|
|
431
451
|
async function recordWindowPeak(db, window, resetsAt, usedPercentage, now = Math.floor(Date.now() / 1e3)) {
|
|
432
452
|
if (now >= resetsAt) return;
|
|
433
453
|
await db.transaction(async (tx) => {
|
|
434
|
-
|
|
435
|
-
await
|
|
436
|
-
await applyReading(
|
|
454
|
+
await lock(tx, window);
|
|
455
|
+
const cycleResetsAt = await resolveCycleResetsAt(tx, window, resetsAt);
|
|
456
|
+
await applyReading({ tx, window, resetsAt: cycleResetsAt }, usedPercentage);
|
|
437
457
|
});
|
|
438
458
|
}
|
|
439
459
|
|
|
@@ -463,7 +483,7 @@ var groupByCycle = (rows) => rows.reduce((cycles, r) => {
|
|
|
463
483
|
var earliest = (rows) => rows.reduce((a, r) => r.createdAt < a ? r.createdAt : a, rows[0].createdAt);
|
|
464
484
|
async function overwrite(tx, { window, resetsAt }, createdAt, collapsed) {
|
|
465
485
|
await tx.delete(usagePeaks).where(
|
|
466
|
-
|
|
486
|
+
and3(eq3(usagePeaks.window, window), eq3(usagePeaks.resetsAt, resetsAt))
|
|
467
487
|
);
|
|
468
488
|
await tx.insert(usagePeaks).values(collapsed.map((c) => ({ window, resetsAt, createdAt, ...c })));
|
|
469
489
|
}
|
|
@@ -475,7 +495,7 @@ async function rewriteCycle(tx, rows) {
|
|
|
475
495
|
var loadAll = (tx) => tx.select().from(usagePeaks).orderBy(usagePeaks.window, usagePeaks.resetsAt, usagePeaks.segment);
|
|
476
496
|
var markRun = (tx) => tx.insert(metadata).values({ key: MIGRATION_KEY, value: "done" }).onConflictDoNothing();
|
|
477
497
|
async function alreadyRun(tx) {
|
|
478
|
-
const done = await tx.select().from(metadata).where(
|
|
498
|
+
const done = await tx.select().from(metadata).where(eq3(metadata.key, MIGRATION_KEY));
|
|
479
499
|
return done.length > 0;
|
|
480
500
|
}
|
|
481
501
|
async function cleanupFalseResetSegments(db) {
|
|
@@ -599,6 +619,7 @@ export {
|
|
|
599
619
|
feeds,
|
|
600
620
|
addFeed,
|
|
601
621
|
listFeeds,
|
|
622
|
+
resolveCycleResetsAt,
|
|
602
623
|
recordWindowPeak,
|
|
603
624
|
getDb,
|
|
604
625
|
withDbClient,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-HB2TXZX4.js";
|
|
4
4
|
import {
|
|
5
5
|
run
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UX47UP2J.js";
|
|
7
7
|
import {
|
|
8
8
|
isLockedByOther
|
|
9
9
|
} from "./chunk-BXGPF3TG.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-EBXL5VMN.js";
|
|
14
14
|
import {
|
|
15
15
|
loadBacklog
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2MZYTQLA.js";
|
|
17
17
|
import {
|
|
18
18
|
formatItemId
|
|
19
19
|
} from "./chunk-N65VOEFI.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hasOpenPhaseUnlock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T5CZSBHN.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveSessionItemId
|
|
6
6
|
} from "./chunk-FPWL4VRC.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
closeDb,
|
|
12
12
|
getDb,
|
|
13
13
|
links
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CVMH6FBE.js";
|
|
15
15
|
import {
|
|
16
16
|
getProjectRoot
|
|
17
17
|
} from "./chunk-TH42OUCW.js";
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
isDocsPath,
|
|
9
9
|
isSchemaPath,
|
|
10
10
|
mentionsDocsPath
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-DOVFHJNY.js";
|
|
12
12
|
import {
|
|
13
13
|
isSchemaLocked
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-T5CZSBHN.js";
|
|
15
15
|
import {
|
|
16
16
|
findBuiltinDenyRaw,
|
|
17
17
|
findDeny,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadItemSummaries
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O2S3GTAV.js";
|
|
4
4
|
import {
|
|
5
5
|
getOrigin,
|
|
6
6
|
getReady,
|
|
7
7
|
searchItemIds
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2MZYTQLA.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/backlog/loadBacklogSummaries.ts
|
|
11
11
|
async function loadBacklogSummaries(allRepos = false) {
|
|
@@ -8,23 +8,23 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
resolveSharedRepoBlock,
|
|
10
10
|
saveSharedRepoBlock
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5SZCYNLP.js";
|
|
12
12
|
import {
|
|
13
13
|
unsetNestedValue
|
|
14
14
|
} from "./chunk-JVTCXR7C.js";
|
|
15
15
|
import {
|
|
16
16
|
updateUserConfig,
|
|
17
17
|
userDbKeyError
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-AWJND3GR.js";
|
|
19
19
|
import {
|
|
20
20
|
validateConfig
|
|
21
21
|
} from "./chunk-SBSJWLH4.js";
|
|
22
22
|
import {
|
|
23
23
|
refreshRepoConfigCache
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-FMGU4HY6.js";
|
|
25
25
|
import {
|
|
26
26
|
getDb
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-CVMH6FBE.js";
|
|
28
28
|
import {
|
|
29
29
|
loadGlobalConfigRaw,
|
|
30
30
|
loadProjectConfig,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
launchMode
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YQRLH4YY.js";
|
|
4
4
|
import {
|
|
5
5
|
typeLabel
|
|
6
6
|
} from "./chunk-EBXL5VMN.js";
|
|
7
7
|
import {
|
|
8
8
|
loadBacklogSummaries
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MKJE7N63.js";
|
|
10
10
|
import {
|
|
11
11
|
getReady
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2MZYTQLA.js";
|
|
13
13
|
import {
|
|
14
14
|
loadItem
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5AQT32G3.js";
|
|
16
16
|
import {
|
|
17
17
|
formatItemId,
|
|
18
18
|
parseItemId
|
|
@@ -358,6 +358,74 @@ var migration0013PhaseRunState = {
|
|
|
358
358
|
sql: sql13
|
|
359
359
|
};
|
|
360
360
|
|
|
361
|
+
// src/shared/db/migrations/migration0014MergeJitteredCycles.ts
|
|
362
|
+
var sql14 = `
|
|
363
|
+
CREATE TEMP TABLE cycle_canon ON COMMIT DROP AS
|
|
364
|
+
WITH cycles AS (
|
|
365
|
+
SELECT "window", resets_at FROM usage_peaks
|
|
366
|
+
UNION
|
|
367
|
+
SELECT "window", resets_at FROM phase_cycle_context
|
|
368
|
+
),
|
|
369
|
+
breaks AS (
|
|
370
|
+
SELECT "window", resets_at,
|
|
371
|
+
CASE WHEN resets_at - lag(resets_at) OVER (PARTITION BY "window" ORDER BY resets_at) <= 600
|
|
372
|
+
THEN 0 ELSE 1 END AS starts_group
|
|
373
|
+
FROM cycles
|
|
374
|
+
),
|
|
375
|
+
grouped AS (
|
|
376
|
+
SELECT "window", resets_at,
|
|
377
|
+
sum(starts_group) OVER (PARTITION BY "window" ORDER BY resets_at) AS grp
|
|
378
|
+
FROM breaks
|
|
379
|
+
)
|
|
380
|
+
SELECT "window", resets_at, min(resets_at) OVER (PARTITION BY "window", grp) AS canon
|
|
381
|
+
FROM grouped;
|
|
382
|
+
|
|
383
|
+
DELETE FROM cycle_canon c
|
|
384
|
+
WHERE NOT EXISTS (
|
|
385
|
+
SELECT 1 FROM cycle_canon o
|
|
386
|
+
WHERE o."window" = c."window" AND o.canon = c.canon AND o.resets_at <> c.resets_at
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
CREATE TEMP TABLE merged_peaks ON COMMIT DROP AS
|
|
390
|
+
SELECT p."window", c.canon AS resets_at, p.segment,
|
|
391
|
+
max(p.used_percentage) AS used_percentage,
|
|
392
|
+
bool_or(p.reset_detected) AS reset_detected,
|
|
393
|
+
sum(p.tokens_up) AS tokens_up,
|
|
394
|
+
sum(p.tokens_down) AS tokens_down,
|
|
395
|
+
min(p.created_at) AS created_at
|
|
396
|
+
FROM usage_peaks p
|
|
397
|
+
JOIN cycle_canon c ON c."window" = p."window" AND c.resets_at = p.resets_at
|
|
398
|
+
GROUP BY p."window", c.canon, p.segment;
|
|
399
|
+
|
|
400
|
+
DELETE FROM usage_peaks p
|
|
401
|
+
USING cycle_canon c
|
|
402
|
+
WHERE c."window" = p."window" AND c.resets_at = p.resets_at;
|
|
403
|
+
|
|
404
|
+
INSERT INTO usage_peaks ("window", resets_at, segment, used_percentage, reset_detected, tokens_up, tokens_down, created_at)
|
|
405
|
+
SELECT "window", resets_at, segment, used_percentage, reset_detected, tokens_up, tokens_down, created_at
|
|
406
|
+
FROM merged_peaks;
|
|
407
|
+
|
|
408
|
+
CREATE TEMP TABLE merged_phase_context ON COMMIT DROP AS
|
|
409
|
+
SELECT x.item_id, x.phase_idx, x."window", c.canon AS resets_at,
|
|
410
|
+
max(x.peak_context_pct) AS peak_context_pct
|
|
411
|
+
FROM phase_cycle_context x
|
|
412
|
+
JOIN cycle_canon c ON c."window" = x."window" AND c.resets_at = x.resets_at
|
|
413
|
+
GROUP BY x.item_id, x.phase_idx, x."window", c.canon;
|
|
414
|
+
|
|
415
|
+
DELETE FROM phase_cycle_context x
|
|
416
|
+
USING cycle_canon c
|
|
417
|
+
WHERE c."window" = x."window" AND c.resets_at = x.resets_at;
|
|
418
|
+
|
|
419
|
+
INSERT INTO phase_cycle_context (item_id, phase_idx, "window", resets_at, peak_context_pct)
|
|
420
|
+
SELECT item_id, phase_idx, "window", resets_at, peak_context_pct
|
|
421
|
+
FROM merged_phase_context;
|
|
422
|
+
`;
|
|
423
|
+
var migration0014MergeJitteredCycles = {
|
|
424
|
+
id: 14,
|
|
425
|
+
name: "merge-jittered-cycles",
|
|
426
|
+
sql: sql14
|
|
427
|
+
};
|
|
428
|
+
|
|
361
429
|
// src/shared/db/migrations.ts
|
|
362
430
|
var migrations = [
|
|
363
431
|
migration0001Baseline,
|
|
@@ -372,7 +440,8 @@ var migrations = [
|
|
|
372
440
|
migration0010UserConfig,
|
|
373
441
|
migration0011JobRuns,
|
|
374
442
|
migration0012PhaseDependsOn,
|
|
375
|
-
migration0013PhaseRunState
|
|
443
|
+
migration0013PhaseRunState,
|
|
444
|
+
migration0014MergeJitteredCycles
|
|
376
445
|
];
|
|
377
446
|
var latestMigrationId = migrations.reduce(
|
|
378
447
|
(max, m) => Math.max(max, m.id),
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadConfig
|
|
3
|
+
} from "./chunk-TH42OUCW.js";
|
|
4
|
+
|
|
5
|
+
// src/commands/migrateAfterUpdate.ts
|
|
6
|
+
import { execFileSync } from "child_process";
|
|
7
|
+
|
|
8
|
+
// src/commands/db/isDatabaseConfigured.ts
|
|
9
|
+
function isDatabaseConfigured() {
|
|
10
|
+
return Boolean(process.env.ASSIST_DATABASE_URL ?? loadConfig().database.url);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/commands/migrateAfterUpdate.ts
|
|
14
|
+
function migrateAfterUpdate() {
|
|
15
|
+
if (!isDatabaseConfigured()) {
|
|
16
|
+
console.log("No database configured; skipping migrations.");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
console.log("Applying released migrations...");
|
|
20
|
+
try {
|
|
21
|
+
execFileSync(
|
|
22
|
+
process.execPath,
|
|
23
|
+
[process.argv[1], "db", "migrate", "--after-update"],
|
|
24
|
+
{ stdio: "inherit" }
|
|
25
|
+
);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(
|
|
28
|
+
`Failed to apply migrations: ${error instanceof Error ? error.message : String(error)}`
|
|
29
|
+
);
|
|
30
|
+
console.error("Run `assist db migrate` to apply them.");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
migrateAfterUpdate
|
|
36
|
+
};
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
resolveSharedRepoBlock,
|
|
6
6
|
saveSharedRepoBlock
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5SZCYNLP.js";
|
|
8
8
|
import {
|
|
9
9
|
validateConfig
|
|
10
10
|
} from "./chunk-SBSJWLH4.js";
|
|
11
11
|
import {
|
|
12
12
|
getDb
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CVMH6FBE.js";
|
|
14
14
|
import {
|
|
15
15
|
repoConfigSchema
|
|
16
16
|
} from "./chunk-ER3BDSIW.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
resolveSharedRepoBlock,
|
|
6
6
|
saveSharedRepoBlock
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5SZCYNLP.js";
|
|
8
8
|
import {
|
|
9
9
|
validateConfig
|
|
10
10
|
} from "./chunk-SBSJWLH4.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-B5ZOANOD.js";
|
|
14
14
|
import {
|
|
15
15
|
getDb
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CVMH6FBE.js";
|
|
17
17
|
import {
|
|
18
18
|
repoConfigSchema
|
|
19
19
|
} from "./chunk-ER3BDSIW.js";
|
|
@@ -15,16 +15,16 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
createBranch,
|
|
17
17
|
generateBranchSlug
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-W4AXRI6K.js";
|
|
19
19
|
import {
|
|
20
20
|
inWebSession
|
|
21
21
|
} from "./chunk-HKGCLAZ7.js";
|
|
22
22
|
import {
|
|
23
23
|
executePhase
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WYKZNCOJ.js";
|
|
25
25
|
import {
|
|
26
26
|
backlogPhaseActivity
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-VN4XGDT3.js";
|
|
28
28
|
import {
|
|
29
29
|
awaitHarness
|
|
30
30
|
} from "./chunk-ZYK7V4PG.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
import {
|
|
38
38
|
loadPhaseProgress,
|
|
39
39
|
markPhaseDone
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-YC6BVWED.js";
|
|
41
41
|
import {
|
|
42
42
|
phaseGit
|
|
43
43
|
} from "./chunk-VVUYBY6D.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./chunk-UFMLNNPI.js";
|
|
47
47
|
import {
|
|
48
48
|
updateCurrentPhase
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-UTZE4ATH.js";
|
|
50
50
|
import {
|
|
51
51
|
appendDaemonLog
|
|
52
52
|
} from "./chunk-5H7EHZ3J.js";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
} from "./chunk-F4XCHVD7.js";
|
|
56
56
|
import {
|
|
57
57
|
appendComment
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-MF7O7S5J.js";
|
|
59
59
|
import {
|
|
60
60
|
buildReviewPhase,
|
|
61
61
|
resolveReviewPhase
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
schedulePhases,
|
|
72
72
|
setPhaseRunState,
|
|
73
73
|
setStatus
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-2MZYTQLA.js";
|
|
75
75
|
import {
|
|
76
76
|
parallelPhasesEnabled
|
|
77
77
|
} from "./chunk-JXSVTYHL.js";
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
import {
|
|
83
83
|
phaseUsage,
|
|
84
84
|
planPhases
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-CVMH6FBE.js";
|
|
86
86
|
import {
|
|
87
87
|
harnessAdapter,
|
|
88
88
|
withoutResumeSession
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
inboxConnectorRun,
|
|
10
10
|
inboxScanSchema,
|
|
11
11
|
readInboxLastScan
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UL77JFUV.js";
|
|
13
13
|
import {
|
|
14
14
|
inboxMessages,
|
|
15
15
|
jobRuns,
|
|
16
16
|
metadata
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CVMH6FBE.js";
|
|
18
18
|
import {
|
|
19
19
|
emptyScanUsage,
|
|
20
20
|
harnessAdapter,
|