@papi-ai/server 0.7.72 → 0.7.73

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.
Files changed (2) hide show
  1. package/dist/index.js +51 -40
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11214,6 +11214,55 @@ function formatBlockerWaiting(blocker) {
11214
11214
  }
11215
11215
  }
11216
11216
 
11217
+ // src/lib/tool-telemetry.ts
11218
+ var INSTRUMENTED_TOOLS = /* @__PURE__ */ new Set([
11219
+ "plan",
11220
+ "orient",
11221
+ "build_execute",
11222
+ "review_submit",
11223
+ "release",
11224
+ "strategy_review"
11225
+ ]);
11226
+ var WRAPPER_INSTRUMENTED_TOOLS = new Set(
11227
+ [...INSTRUMENTED_TOOLS].filter((t) => t !== "plan")
11228
+ );
11229
+ var PLAN_PREPARE_TOOL_NAME = "plan:prepare";
11230
+ function measureResultBytes(content) {
11231
+ let total = 0;
11232
+ for (const part of content) {
11233
+ if (typeof part.text === "string") total += Buffer.byteLength(part.text, "utf-8");
11234
+ }
11235
+ return total;
11236
+ }
11237
+ function recordToolRun(adapter2, sample) {
11238
+ if (sample.toolName !== PLAN_PREPARE_TOOL_NAME && !WRAPPER_INSTRUMENTED_TOOLS.has(sample.toolName)) return;
11239
+ if (typeof adapter2.insertToolRun !== "function") return;
11240
+ try {
11241
+ const promise = adapter2.insertToolRun({
11242
+ toolName: sample.toolName,
11243
+ contextBytes: sample.contextBytes,
11244
+ durationMs: sample.durationMs,
11245
+ cycleNumber: sample.cycleNumber ?? null,
11246
+ source: "mcp-server"
11247
+ });
11248
+ if (promise && typeof promise.catch === "function") {
11249
+ promise.catch((err) => {
11250
+ console.error(`[telemetry] insertToolRun failed (non-blocking): ${err instanceof Error ? err.message : String(err)}`);
11251
+ });
11252
+ }
11253
+ } catch (err) {
11254
+ console.error(`[telemetry] insertToolRun threw (non-blocking): ${err instanceof Error ? err.message : String(err)}`);
11255
+ }
11256
+ }
11257
+ function recordPlanPrepareRun(adapter2, sample) {
11258
+ recordToolRun(adapter2, {
11259
+ toolName: PLAN_PREPARE_TOOL_NAME,
11260
+ contextBytes: sample.contextBytes,
11261
+ durationMs: sample.durationMs,
11262
+ cycleNumber: sample.cycleNumber ?? null
11263
+ });
11264
+ }
11265
+
11217
11266
  // src/lib/visibility-inheritance.ts
11218
11267
  var TIER_RANK = {
11219
11268
  public: 0,
@@ -13007,6 +13056,7 @@ async function preparePlan(adapter2, config2, filters, focus, force, handoffsOnl
13007
13056
  console.error(`[plan-perf] contextBytes=${contextBytes2} (handoffs-only)`);
13008
13057
  const planSystemPrompt2 = await getPrompt("plan-system");
13009
13058
  await recordPlanGenerationActive(tracker, incomingCycle);
13059
+ recordPlanPrepareRun(adapter2, { contextBytes: contextBytes2, durationMs: totalMs2, cycleNumber: incomingCycle });
13010
13060
  return {
13011
13061
  mode: "full",
13012
13062
  // apply phase treats it the same
@@ -13068,6 +13118,7 @@ async function preparePlan(adapter2, config2, filters, focus, force, handoffsOnl
13068
13118
  }
13069
13119
  const planSystemPrompt = await getPrompt("plan-system");
13070
13120
  await recordPlanGenerationActive(tracker, incomingCycle);
13121
+ recordPlanPrepareRun(adapter2, { contextBytes, durationMs: totalMs, cycleNumber: incomingCycle });
13071
13122
  return {
13072
13123
  mode,
13073
13124
  cycleNumber,
@@ -30062,46 +30113,6 @@ ${d.body}`;
30062
30113
  ${formatted}`, meta));
30063
30114
  }
30064
30115
 
30065
- // src/lib/tool-telemetry.ts
30066
- var INSTRUMENTED_TOOLS = /* @__PURE__ */ new Set([
30067
- "plan",
30068
- "orient",
30069
- "build_execute",
30070
- "review_submit",
30071
- "release",
30072
- "strategy_review"
30073
- ]);
30074
- var WRAPPER_INSTRUMENTED_TOOLS = new Set(
30075
- [...INSTRUMENTED_TOOLS].filter((t) => t !== "plan")
30076
- );
30077
- function measureResultBytes(content) {
30078
- let total = 0;
30079
- for (const part of content) {
30080
- if (typeof part.text === "string") total += Buffer.byteLength(part.text, "utf-8");
30081
- }
30082
- return total;
30083
- }
30084
- function recordToolRun(adapter2, sample) {
30085
- if (!WRAPPER_INSTRUMENTED_TOOLS.has(sample.toolName)) return;
30086
- if (typeof adapter2.insertToolRun !== "function") return;
30087
- try {
30088
- const promise = adapter2.insertToolRun({
30089
- toolName: sample.toolName,
30090
- contextBytes: sample.contextBytes,
30091
- durationMs: sample.durationMs,
30092
- cycleNumber: sample.cycleNumber ?? null,
30093
- source: "mcp-server"
30094
- });
30095
- if (promise && typeof promise.catch === "function") {
30096
- promise.catch((err) => {
30097
- console.error(`[telemetry] insertToolRun failed (non-blocking): ${err instanceof Error ? err.message : String(err)}`);
30098
- });
30099
- }
30100
- } catch (err) {
30101
- console.error(`[telemetry] insertToolRun threw (non-blocking): ${err instanceof Error ? err.message : String(err)}`);
30102
- }
30103
- }
30104
-
30105
30116
  // src/tools/learning-action.ts
30106
30117
  var learningActionTool = {
30107
30118
  name: "learning_action",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papi-ai/server",
3
- "version": "0.7.72",
3
+ "version": "0.7.73",
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.getpapi/papi",