@papi-ai/server 0.7.53 → 0.7.54
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/backfill-cycle-metrics.js +47 -22
- package/dist/index.js +351 -232
- package/package.json +2 -2
|
@@ -1180,21 +1180,27 @@ var init_proxy_adapter = __esm({
|
|
|
1180
1180
|
// getToolCallCount + updatePhaseStatus are ABSENT: they now have edge handlers and
|
|
1181
1181
|
// are served through the forwarder (getToolCallCount = SUP-2026-026 handler #1).
|
|
1182
1182
|
"createOwnerAction",
|
|
1183
|
-
"findPendingDocActionsForTask",
|
|
1184
1183
|
"getContributorRole",
|
|
1185
|
-
"getDecisionScorePatterns",
|
|
1186
|
-
"getModuleEstimationStats",
|
|
1187
|
-
"correctLatestBuildReportEffort",
|
|
1188
1184
|
"recordContributorReleasePr",
|
|
1189
1185
|
"setContributorReleasePrStatus",
|
|
1190
1186
|
"listContributorReleasePrs",
|
|
1191
|
-
"resolveLearningsForDoneTasks",
|
|
1192
|
-
"markCycleLearningResolved",
|
|
1193
|
-
"updateStageExitCriteria",
|
|
1194
|
-
"updateDocAction",
|
|
1195
1187
|
"claimReview",
|
|
1196
1188
|
"getSiblingAds",
|
|
1197
1189
|
"getSiblingRepoTasks"
|
|
1190
|
+
// task-2394 (C329) — Batch A wired: findPendingDocActionsForTask,
|
|
1191
|
+
// getModuleEstimationStats and getDecisionScorePatterns now have edge case handlers
|
|
1192
|
+
// (each backed by a SECURITY DEFINER RPC, migration 20260714140000) plus
|
|
1193
|
+
// ALLOWED_METHODS entries, so they forward. The two planner-context reads returned
|
|
1194
|
+
// EMPTY for every hosted user before this — the planner ran on worse context than
|
|
1195
|
+
// the owner's on the only install path external users have (AD-72).
|
|
1196
|
+
// task-2412 (C329) — listOwnerActionsForBlockerScan + linkOwnerActionToTask wired.
|
|
1197
|
+
// First USER-scoped ([C]) methods to forward: the edge binds both to the bearer's
|
|
1198
|
+
// user_id and discards the client-supplied one, so the typed-blocker scan (task-2343)
|
|
1199
|
+
// now works for hosted users without exposing one member's owner actions to another.
|
|
1200
|
+
// task-2393 (C329) — Batch B wired: markCycleLearningResolved (the P1 — hosted
|
|
1201
|
+
// discovered_issue_resolve hard-errored), correctLatestBuildReportEffort,
|
|
1202
|
+
// updateStageExitCriteria, updateDocAction, resolveLearningsForDoneTasks all have
|
|
1203
|
+
// edge case handlers + ALLOWED_METHODS/WRITE_METHODS entries now, so they forward.
|
|
1198
1204
|
// task-2489 (C320): recordProgressStep is now wired to the edge data-proxy
|
|
1199
1205
|
// (case handler + ALLOWED_METHODS/WRITE_METHODS entries), so it forwards for
|
|
1200
1206
|
// hosted callers and persists a project-scoped cycle_progress_steps row. Removed
|
|
@@ -4551,6 +4557,7 @@ Check PAPI_PROJECT_ID in your .mcp.json config. Find your project ID in the PAPI
|
|
|
4551
4557
|
}
|
|
4552
4558
|
|
|
4553
4559
|
// src/lib/formatters.ts
|
|
4560
|
+
var PLAN_FULL_NOTES_BUDGET_BYTES = Number(process.env.PAPI_PLAN_NOTES_BUDGET) || 6e4;
|
|
4554
4561
|
function effortWeight(size) {
|
|
4555
4562
|
switch ((size || "").toUpperCase()) {
|
|
4556
4563
|
case "XS":
|
|
@@ -4570,6 +4577,29 @@ function effortWeight(size) {
|
|
|
4570
4577
|
return 3;
|
|
4571
4578
|
}
|
|
4572
4579
|
}
|
|
4580
|
+
function computeCycleEffort(cycleTaskRows, cycleReports) {
|
|
4581
|
+
if (cycleTaskRows && cycleTaskRows.length > 0) {
|
|
4582
|
+
const done = cycleTaskRows.filter((t) => t.status === "Done");
|
|
4583
|
+
const reportByTask = /* @__PURE__ */ new Map();
|
|
4584
|
+
for (const r of cycleReports) if (r.taskId) reportByTask.set(r.taskId, r);
|
|
4585
|
+
return {
|
|
4586
|
+
completed: done.length,
|
|
4587
|
+
total: cycleTaskRows.length,
|
|
4588
|
+
plannedPoints: done.reduce((s, t) => s + effortWeight(t.complexity), 0),
|
|
4589
|
+
deliveredPoints: done.reduce((s, t) => {
|
|
4590
|
+
const actual = reportByTask.get(t.id)?.actualEffort;
|
|
4591
|
+
return s + effortWeight(actual || t.complexity);
|
|
4592
|
+
}, 0)
|
|
4593
|
+
};
|
|
4594
|
+
}
|
|
4595
|
+
const completed = cycleReports.filter((r) => r.completed === "Yes").length;
|
|
4596
|
+
return {
|
|
4597
|
+
completed,
|
|
4598
|
+
total: cycleReports.length,
|
|
4599
|
+
plannedPoints: cycleReports.reduce((s, r) => s + effortWeight(r.estimatedEffort || r.actualEffort), 0),
|
|
4600
|
+
deliveredPoints: cycleReports.reduce((s, r) => s + effortWeight(r.actualEffort || r.estimatedEffort), 0)
|
|
4601
|
+
};
|
|
4602
|
+
}
|
|
4573
4603
|
function computeSnapshotsFromBuildReports(reports, tasks) {
|
|
4574
4604
|
const reportsByCycle = /* @__PURE__ */ new Map();
|
|
4575
4605
|
for (const r of reports) {
|
|
@@ -4593,24 +4623,19 @@ function computeSnapshotsFromBuildReports(reports, tasks) {
|
|
|
4593
4623
|
const withEffort = cycleReports.filter((r) => r.estimatedEffort && r.actualEffort);
|
|
4594
4624
|
const accurate = withEffort.filter((r) => r.estimatedEffort === r.actualEffort).length;
|
|
4595
4625
|
const matchRate = withEffort.length > 0 ? Math.round(accurate / withEffort.length * 100) : 0;
|
|
4596
|
-
|
|
4597
|
-
let total;
|
|
4598
|
-
let effortPoints;
|
|
4599
|
-
if (cycleTaskRows && cycleTaskRows.length > 0) {
|
|
4600
|
-
const done = cycleTaskRows.filter((t) => t.status === "Done");
|
|
4601
|
-
completed = done.length;
|
|
4602
|
-
total = cycleTaskRows.length;
|
|
4603
|
-
effortPoints = done.reduce((s, t) => s + effortWeight(t.complexity), 0);
|
|
4604
|
-
} else {
|
|
4605
|
-
completed = cycleReports.filter((r) => r.completed === "Yes").length;
|
|
4606
|
-
total = cycleReports.length;
|
|
4607
|
-
effortPoints = cycleReports.reduce((s, r) => s + effortWeight(r.actualEffort), 0);
|
|
4608
|
-
}
|
|
4626
|
+
const { completed, total, plannedPoints, deliveredPoints } = computeCycleEffort(cycleTaskRows, cycleReports);
|
|
4609
4627
|
snapshots.push({
|
|
4610
4628
|
cycle: sn,
|
|
4611
4629
|
date: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4612
4630
|
accuracy: [{ cycle: sn, reports: cycleReports.length, matchRate, mae: 0, bias: 0 }],
|
|
4613
|
-
velocity: [{
|
|
4631
|
+
velocity: [{
|
|
4632
|
+
cycle: sn,
|
|
4633
|
+
completed,
|
|
4634
|
+
partial: 0,
|
|
4635
|
+
failed: Math.max(0, total - completed),
|
|
4636
|
+
effortPoints: plannedPoints,
|
|
4637
|
+
deliveredPoints
|
|
4638
|
+
}]
|
|
4614
4639
|
});
|
|
4615
4640
|
}
|
|
4616
4641
|
snapshots.sort((a, b) => a.cycle - b.cycle);
|