@ycodium-ai/agent-pi 0.2.4343 → 0.2.4368

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 +10 -5
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import * as NodePath3 from "node:path";
4
4
  import { definePlugin } from "@ycodium-ai/plugin-api";
5
5
 
6
6
  // ../../packages/plugin-api/src/version.ts
7
- var PLUGIN_API_VERSION = 109;
7
+ var PLUGIN_API_VERSION = 112;
8
8
 
9
9
  // src/index.ts
10
10
  import {
@@ -235,6 +235,9 @@ import {
235
235
  } from "@ycodium-ai/plugin-api/process-operation";
236
236
 
237
237
  // src/rpc.ts
238
+ var PiProcessExitedError = class extends Error {
239
+ name = "PiProcessExitedError";
240
+ };
238
241
  var PiResponseError = class extends Error {
239
242
  };
240
243
  var PiRpc = class {
@@ -286,7 +289,7 @@ var PiRpc = class {
286
289
  await consume(decoder.decode());
287
290
  if (fragments.join("").trim())
288
291
  throw new Error("Pi ended with an incomplete protocol record.");
289
- this.fail(new Error("Pi protocol stream ended."));
292
+ this.fail(new PiProcessExitedError("Pi protocol stream ended."));
290
293
  };
291
294
  const stderr = async () => {
292
295
  for await (const _ of process.stderr) {
@@ -316,7 +319,7 @@ var PiRpc = class {
316
319
  timer = setTimeout(resolve3, 1e3);
317
320
  })
318
321
  ]);
319
- this.fail(new Error(`Pi process exited (${String(code)}).`));
322
+ this.fail(new PiProcessExitedError(`Pi process exited (${String(code)}).`));
320
323
  } finally {
321
324
  if (timer !== void 0) clearTimeout(timer);
322
325
  }
@@ -729,7 +732,7 @@ var PiTurn = class {
729
732
  reportModel(model) {
730
733
  this.emit("thread.metadata.updated", { model, modelSource: "reported" }, { turnId: this.id });
731
734
  }
732
- finish(state, errorMessage) {
735
+ finish(state, errorMessage, failureCategory) {
733
736
  if (this.completed) return;
734
737
  this.completed = true;
735
738
  this.completeBlocks(state === "failed" ? "failed" : "completed");
@@ -740,6 +743,7 @@ var PiTurn = class {
740
743
  {
741
744
  state,
742
745
  ...errorMessage?.trim() ? { errorMessage } : {},
746
+ ...state === "failed" && failureCategory !== void 0 ? { failureCategory } : {},
743
747
  ...this.hasUsage ? {
744
748
  tokenUsage: {
745
749
  provider: "pi",
@@ -954,7 +958,8 @@ function createPiInstance(value, host) {
954
958
  if (booked.exited) return;
955
959
  booked.turn?.finish(
956
960
  cause ? "failed" : "interrupted",
957
- cause ? redact(config, cause) : void 0
961
+ cause ? redact(config, cause) : void 0,
962
+ cause instanceof PiProcessExitedError ? "process-exit" : void 0
958
963
  );
959
964
  endQuestions(booked);
960
965
  booked.exited = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-pi",
3
- "version": "0.2.4343",
3
+ "version": "0.2.4368",
4
4
  "description": "Pi executor over the native RPC protocol.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -31,8 +31,8 @@
31
31
  "typescript": "~6.0.3",
32
32
  "vite-plus": "0.2.2",
33
33
  "ycodium-executor-testing": "0.0.0",
34
- "@ycodium/contracts": "0.0.33",
35
- "@ycodium-ai/plugin-api": "0.2.4343"
34
+ "@ycodium-ai/plugin-api": "0.2.4368",
35
+ "@ycodium/contracts": "0.0.33"
36
36
  },
37
37
  "ycodium": {
38
38
  "plugin": "./dist/index.js",