@papi-ai/server 0.7.43 → 0.7.44

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 {
@@ -4346,7 +4398,7 @@ async function createAdapter(optionsOrType, maybePapiDir) {
4346
4398
  return adapter;
4347
4399
  }
4348
4400
  case "proxy": {
4349
- const { ProxyPapiAdapter: ProxyPapiAdapter2 } = await Promise.resolve().then(() => (init_proxy_adapter(), proxy_adapter_exports));
4401
+ const { ProxyPapiAdapter: ProxyPapiAdapter2, wrapWithForwarding: wrapWithForwarding2 } = await Promise.resolve().then(() => (init_proxy_adapter(), proxy_adapter_exports));
4350
4402
  const dashboardUrl = process.env["PAPI_DASHBOARD_URL"] || "https://getpapi.ai";
4351
4403
  const projectId = process.env["PAPI_PROJECT_ID"];
4352
4404
  const dataApiKey = process.env["PAPI_DATA_API_KEY"];
@@ -4449,7 +4501,7 @@ Check PAPI_PROJECT_ID in your .mcp.json config. Find your project ID in the PAPI
4449
4501
  console.error("[papi] Set PAPI_PROJECT_ID in .mcp.json to connect to an existing project.");
4450
4502
  }
4451
4503
  }
4452
- return adapter;
4504
+ return wrapWithForwarding2(adapter);
4453
4505
  }
4454
4506
  default: {
4455
4507
  const _exhaustive = adapterType;
package/dist/index.js CHANGED
@@ -1177,7 +1177,9 @@ var init_telemetry = __esm({
1177
1177
  // src/proxy-adapter.ts
1178
1178
  var proxy_adapter_exports = {};
1179
1179
  __export(proxy_adapter_exports, {
1180
- ProxyPapiAdapter: () => ProxyPapiAdapter
1180
+ ProxyPapiAdapter: () => ProxyPapiAdapter,
1181
+ createProxyAdapter: () => createProxyAdapter,
1182
+ wrapWithForwarding: () => wrapWithForwarding
1181
1183
  });
1182
1184
  function snakeToCamel(str) {
1183
1185
  return str.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
@@ -1216,7 +1218,22 @@ function fixDisplayIdEntities(data) {
1216
1218
  if (data && typeof data === "object") return fixDisplayIdEntity(data);
1217
1219
  return data;
1218
1220
  }
1219
- var JSONB_PASSTHROUGH_KEYS, DISPLAY_ID_METHODS, ProxyPapiAdapter;
1221
+ function wrapWithForwarding(instance) {
1222
+ return new Proxy(instance, {
1223
+ get(target, prop, receiver) {
1224
+ const existing = Reflect.get(target, prop, receiver);
1225
+ if (existing !== void 0) return existing;
1226
+ if (typeof prop !== "string" || prop === "then" || prop.startsWith("_") || NO_FORWARD.has(prop)) {
1227
+ return existing;
1228
+ }
1229
+ return (...args) => target.forward(prop, args);
1230
+ }
1231
+ });
1232
+ }
1233
+ function createProxyAdapter(config2) {
1234
+ return wrapWithForwarding(new ProxyPapiAdapter(config2));
1235
+ }
1236
+ var JSONB_PASSTHROUGH_KEYS, DISPLAY_ID_METHODS, NO_FORWARD, ProxyPapiAdapter;
1220
1237
  var init_proxy_adapter = __esm({
1221
1238
  "src/proxy-adapter.ts"() {
1222
1239
  "use strict";
@@ -1240,6 +1257,30 @@ var init_proxy_adapter = __esm({
1240
1257
  "getRecentReviews",
1241
1258
  "getActiveDecisions"
1242
1259
  ]);
1260
+ NO_FORWARD = /* @__PURE__ */ new Set([
1261
+ // (1) local-only
1262
+ "close",
1263
+ "initRls",
1264
+ // (2) not-yet-wired hosted gaps — shrink as data-proxy handlers land (task-2390).
1265
+ // getToolCallCount + updatePhaseStatus are ABSENT: they now have edge handlers and
1266
+ // are served through the forwarder (getToolCallCount = SUP-2026-026 handler #1).
1267
+ "createOwnerAction",
1268
+ "findPendingDocActionsForTask",
1269
+ "getContributorRole",
1270
+ "getDecisionScorePatterns",
1271
+ "getModuleEstimationStats",
1272
+ "correctLatestBuildReportEffort",
1273
+ "recordContributorReleasePr",
1274
+ "setContributorReleasePrStatus",
1275
+ "listContributorReleasePrs",
1276
+ "resolveLearningsForDoneTasks",
1277
+ "markCycleLearningResolved",
1278
+ "updateStageExitCriteria",
1279
+ "updateDocAction",
1280
+ "claimReview",
1281
+ "getSiblingAds",
1282
+ "getSiblingRepoTasks"
1283
+ ]);
1243
1284
  ProxyPapiAdapter = class _ProxyPapiAdapter {
1244
1285
  endpoint;
1245
1286
  apiKey;
@@ -1261,11 +1302,11 @@ var init_proxy_adapter = __esm({
1261
1302
  * data-proxy's validateProjectAccess re-checks server-side regardless.
1262
1303
  */
1263
1304
  withProject(projectId) {
1264
- return new _ProxyPapiAdapter({
1305
+ return wrapWithForwarding(new _ProxyPapiAdapter({
1265
1306
  endpoint: this.endpoint,
1266
1307
  apiKey: this.apiKey,
1267
1308
  projectId
1268
- });
1309
+ }));
1269
1310
  }
1270
1311
  /**
1271
1312
  * Ensure the authenticated user has a project. If none exists, auto-creates one.
@@ -1377,6 +1418,17 @@ Check PAPI_PROJECT_ID in your .mcp.json config. Find your project ID in the PAPI
1377
1418
  }
1378
1419
  return result;
1379
1420
  }
1421
+ /**
1422
+ * Generic forward for the allowlist-driven proxy trap (SUP-2026-026). Any
1423
+ * PapiAdapter method with no explicit wrapper here — and not in NO_FORWARD — is
1424
+ * served through this single path, so a NEW adapter method needs only a data-proxy
1425
+ * case handler, never a hand-written wrapper. Routes through invoke() so the
1426
+ * transformKeys / DISPLAY_ID fixups apply identically to wrapped methods. This is
1427
+ * the structural cure for the pg→proxy drift that caused SUP-2026-026.
1428
+ */
1429
+ forward(method, args) {
1430
+ return this.invoke(method, args);
1431
+ }
1380
1432
  /** Check if the proxy is reachable. */
1381
1433
  async probeConnection() {
1382
1434
  try {
@@ -7841,7 +7893,7 @@ async function createAdapter(optionsOrType, maybePapiDir) {
7841
7893
  return adapter2;
7842
7894
  }
7843
7895
  case "proxy": {
7844
- const { ProxyPapiAdapter: ProxyPapiAdapter2 } = await Promise.resolve().then(() => (init_proxy_adapter(), proxy_adapter_exports));
7896
+ const { ProxyPapiAdapter: ProxyPapiAdapter2, wrapWithForwarding: wrapWithForwarding2 } = await Promise.resolve().then(() => (init_proxy_adapter(), proxy_adapter_exports));
7845
7897
  const dashboardUrl = process.env["PAPI_DASHBOARD_URL"] || "https://getpapi.ai";
7846
7898
  const projectId = process.env["PAPI_PROJECT_ID"];
7847
7899
  const dataApiKey = process.env["PAPI_DATA_API_KEY"];
@@ -7944,7 +7996,7 @@ Check PAPI_PROJECT_ID in your .mcp.json config. Find your project ID in the PAPI
7944
7996
  console.error("[papi] Set PAPI_PROJECT_ID in .mcp.json to connect to an existing project.");
7945
7997
  }
7946
7998
  }
7947
- return adapter2;
7999
+ return wrapWithForwarding2(adapter2);
7948
8000
  }
7949
8001
  default: {
7950
8002
  const _exhaustive = adapterType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papi-ai/server",
3
- "version": "0.7.43",
3
+ "version": "0.7.44",
4
4
  "description": "PAPI MCP server — AI-powered sprint planning, build execution, and strategy review for software projects",
5
5
  "license": "Elastic-2.0",
6
6
  "mcpName": "io.github.cathalos92/papi",