@papi-ai/server 0.7.43 → 0.7.45

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.
@@ -1060,7 +1060,9 @@ var init_telemetry = __esm({
1060
1060
  // src/proxy-adapter.ts
1061
1061
  var proxy_adapter_exports = {};
1062
1062
  __export(proxy_adapter_exports, {
1063
- ProxyPapiAdapter: () => ProxyPapiAdapter
1063
+ ProxyPapiAdapter: () => ProxyPapiAdapter,
1064
+ createProxyAdapter: () => createProxyAdapter,
1065
+ wrapWithForwarding: () => wrapWithForwarding
1064
1066
  });
1065
1067
  function snakeToCamel(str) {
1066
1068
  return str.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
@@ -1099,7 +1101,22 @@ function fixDisplayIdEntities(data) {
1099
1101
  if (data && typeof data === "object") return fixDisplayIdEntity(data);
1100
1102
  return data;
1101
1103
  }
1102
- var JSONB_PASSTHROUGH_KEYS, DISPLAY_ID_METHODS, ProxyPapiAdapter;
1104
+ function wrapWithForwarding(instance) {
1105
+ return new Proxy(instance, {
1106
+ get(target, prop, receiver) {
1107
+ const existing = Reflect.get(target, prop, receiver);
1108
+ if (existing !== void 0) return existing;
1109
+ if (typeof prop !== "string" || prop === "then" || prop.startsWith("_") || NO_FORWARD.has(prop)) {
1110
+ return existing;
1111
+ }
1112
+ return (...args) => target.forward(prop, args);
1113
+ }
1114
+ });
1115
+ }
1116
+ function createProxyAdapter(config) {
1117
+ return wrapWithForwarding(new ProxyPapiAdapter(config));
1118
+ }
1119
+ var JSONB_PASSTHROUGH_KEYS, DISPLAY_ID_METHODS, NO_FORWARD, ProxyPapiAdapter;
1103
1120
  var init_proxy_adapter = __esm({
1104
1121
  "src/proxy-adapter.ts"() {
1105
1122
  "use strict";
@@ -1123,6 +1140,30 @@ var init_proxy_adapter = __esm({
1123
1140
  "getRecentReviews",
1124
1141
  "getActiveDecisions"
1125
1142
  ]);
1143
+ NO_FORWARD = /* @__PURE__ */ new Set([
1144
+ // (1) local-only
1145
+ "close",
1146
+ "initRls",
1147
+ // (2) not-yet-wired hosted gaps — shrink as data-proxy handlers land (task-2390).
1148
+ // getToolCallCount + updatePhaseStatus are ABSENT: they now have edge handlers and
1149
+ // are served through the forwarder (getToolCallCount = SUP-2026-026 handler #1).
1150
+ "createOwnerAction",
1151
+ "findPendingDocActionsForTask",
1152
+ "getContributorRole",
1153
+ "getDecisionScorePatterns",
1154
+ "getModuleEstimationStats",
1155
+ "correctLatestBuildReportEffort",
1156
+ "recordContributorReleasePr",
1157
+ "setContributorReleasePrStatus",
1158
+ "listContributorReleasePrs",
1159
+ "resolveLearningsForDoneTasks",
1160
+ "markCycleLearningResolved",
1161
+ "updateStageExitCriteria",
1162
+ "updateDocAction",
1163
+ "claimReview",
1164
+ "getSiblingAds",
1165
+ "getSiblingRepoTasks"
1166
+ ]);
1126
1167
  ProxyPapiAdapter = class _ProxyPapiAdapter {
1127
1168
  endpoint;
1128
1169
  apiKey;
@@ -1144,11 +1185,11 @@ var init_proxy_adapter = __esm({
1144
1185
  * data-proxy's validateProjectAccess re-checks server-side regardless.
1145
1186
  */
1146
1187
  withProject(projectId) {
1147
- return new _ProxyPapiAdapter({
1188
+ return wrapWithForwarding(new _ProxyPapiAdapter({
1148
1189
  endpoint: this.endpoint,
1149
1190
  apiKey: this.apiKey,
1150
1191
  projectId
1151
- });
1192
+ }));
1152
1193
  }
1153
1194
  /**
1154
1195
  * Ensure the authenticated user has a project. If none exists, auto-creates one.
@@ -1260,6 +1301,17 @@ Check PAPI_PROJECT_ID in your .mcp.json config. Find your project ID in the PAPI
1260
1301
  }
1261
1302
  return result;
1262
1303
  }
1304
+ /**
1305
+ * Generic forward for the allowlist-driven proxy trap (SUP-2026-026). Any
1306
+ * PapiAdapter method with no explicit wrapper here — and not in NO_FORWARD — is
1307
+ * served through this single path, so a NEW adapter method needs only a data-proxy
1308
+ * case handler, never a hand-written wrapper. Routes through invoke() so the
1309
+ * transformKeys / DISPLAY_ID fixups apply identically to wrapped methods. This is
1310
+ * the structural cure for the pg→proxy drift that caused SUP-2026-026.
1311
+ */
1312
+ forward(method, args) {
1313
+ return this.invoke(method, args);
1314
+ }
1263
1315
  /** Check if the proxy is reachable. */
1264
1316
  async probeConnection() {
1265
1317
  try {
@@ -1827,12 +1879,12 @@ import { pathToFileURL } from "url";
1827
1879
  import path2 from "path";
1828
1880
  import { execSync } from "child_process";
1829
1881
 
1830
- // ../../../../../packages/adapter-md/dist/index.js
1882
+ // ../adapter-md/dist/index.js
1831
1883
  import { readFile, writeFile, access } from "fs/promises";
1832
1884
  import { randomUUID as randomUUID6 } from "crypto";
1833
1885
  import { join } from "path";
1834
1886
 
1835
- // ../../../../../packages/shared/dist/index.js
1887
+ // ../shared/dist/index.js
1836
1888
  var VALID_TRANSITIONS = {
1837
1889
  "Backlog": ["In Cycle", "Ready", "In Progress", "Blocked", "Cancelled", "Deferred", "Done"],
1838
1890
  "In Cycle": ["In Progress", "Backlog", "Blocked", "Cancelled"],
@@ -1851,7 +1903,7 @@ function isLiveDecision(d) {
1851
1903
  return true;
1852
1904
  }
1853
1905
 
1854
- // ../../../../../packages/adapter-md/dist/index.js
1906
+ // ../adapter-md/dist/index.js
1855
1907
  import { randomUUID } from "crypto";
1856
1908
  import { randomUUID as randomUUID3 } from "crypto";
1857
1909
  import yaml from "js-yaml";
@@ -3246,14 +3298,27 @@ var MdFileAdapter = class {
3246
3298
  notes: review.notes
3247
3299
  });
3248
3300
  }
3249
- /** Get the cycle number of the last strategy review. */
3250
- async getLastStrategyReviewCycle() {
3301
+ /**
3302
+ * Get the cycle number of the last strategy review.
3303
+ * task-2416 (C315): `excludeZoomOut` is accepted for interface parity with the pg
3304
+ * adapter. The md adapter already matches strategy-review titles only (zoom-out logs
3305
+ * carry a "Zoom-Out" title, not a strategy-review one), so the flag is a no-op here —
3306
+ * legacy/best-effort path.
3307
+ */
3308
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3309
+ async getLastStrategyReviewCycle(_opts) {
3251
3310
  const log = await this.getCycleLog();
3252
3311
  const entry = log.find(
3253
3312
  (e) => /strategy.*review|strategic.*shift/i.test(e.title)
3254
3313
  );
3255
3314
  return entry?.cycleNumber ?? 0;
3256
3315
  }
3316
+ /** task-2416 (C315): cycle of the last zoom-out retrospective. md best-effort — matches the log title. */
3317
+ async getLastZoomOutCycle() {
3318
+ const log = await this.getCycleLog();
3319
+ const entry = log.find((e) => /zoom[-\s]?out/i.test(e.title));
3320
+ return entry?.cycleNumber ?? 0;
3321
+ }
3257
3322
  /** Get strategy reviews — md adapter returns empty (reviews live in cycle log). */
3258
3323
  async getStrategyReviews(_limit, _includeFullAnalysis) {
3259
3324
  return [];
@@ -4346,7 +4411,7 @@ async function createAdapter(optionsOrType, maybePapiDir) {
4346
4411
  return adapter;
4347
4412
  }
4348
4413
  case "proxy": {
4349
- const { ProxyPapiAdapter: ProxyPapiAdapter2 } = await Promise.resolve().then(() => (init_proxy_adapter(), proxy_adapter_exports));
4414
+ const { ProxyPapiAdapter: ProxyPapiAdapter2, wrapWithForwarding: wrapWithForwarding2 } = await Promise.resolve().then(() => (init_proxy_adapter(), proxy_adapter_exports));
4350
4415
  const dashboardUrl = process.env["PAPI_DASHBOARD_URL"] || "https://getpapi.ai";
4351
4416
  const projectId = process.env["PAPI_PROJECT_ID"];
4352
4417
  const dataApiKey = process.env["PAPI_DATA_API_KEY"];
@@ -4449,7 +4514,7 @@ Check PAPI_PROJECT_ID in your .mcp.json config. Find your project ID in the PAPI
4449
4514
  console.error("[papi] Set PAPI_PROJECT_ID in .mcp.json to connect to an existing project.");
4450
4515
  }
4451
4516
  }
4452
- return adapter;
4517
+ return wrapWithForwarding2(adapter);
4453
4518
  }
4454
4519
  default: {
4455
4520
  const _exhaustive = adapterType;