@ycodium-ai/agent-pi 0.2.3976 → 0.2.3982
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/index.js +3 -42
- package/package.json +4 -4
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 =
|
|
7
|
+
var PLUGIN_API_VERSION = 76;
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
import {
|
|
@@ -630,44 +630,9 @@ async function openConnection(input) {
|
|
|
630
630
|
|
|
631
631
|
// src/events.ts
|
|
632
632
|
import * as NodeCrypto3 from "node:crypto";
|
|
633
|
-
var EventQueue = class {
|
|
634
|
-
queue = [];
|
|
635
|
-
waiters = [];
|
|
636
|
-
closed = false;
|
|
637
|
-
push(event) {
|
|
638
|
-
if (this.closed) return;
|
|
639
|
-
const waiter = this.waiters.shift();
|
|
640
|
-
if (waiter) waiter.resolve({ done: false, value: event });
|
|
641
|
-
else this.queue.push(event);
|
|
642
|
-
}
|
|
643
|
-
close() {
|
|
644
|
-
this.closed = true;
|
|
645
|
-
for (const waiter of this.waiters.splice(0)) waiter.resolve({ done: true, value: void 0 });
|
|
646
|
-
}
|
|
647
|
-
[Symbol.asyncIterator]() {
|
|
648
|
-
const owner = {};
|
|
649
|
-
let returned = false;
|
|
650
|
-
return {
|
|
651
|
-
next: () => {
|
|
652
|
-
if (returned) return Promise.resolve({ done: true, value: void 0 });
|
|
653
|
-
const value = this.queue.shift();
|
|
654
|
-
if (value) return Promise.resolve({ done: false, value });
|
|
655
|
-
if (this.closed) return Promise.resolve({ done: true, value: void 0 });
|
|
656
|
-
return new Promise((resolve3) => this.waiters.push({ owner, resolve: resolve3 }));
|
|
657
|
-
},
|
|
658
|
-
return: () => {
|
|
659
|
-
returned = true;
|
|
660
|
-
const pending = this.waiters.filter((waiter) => waiter.owner === owner);
|
|
661
|
-
this.waiters = this.waiters.filter((waiter) => waiter.owner !== owner);
|
|
662
|
-
for (const waiter of pending) waiter.resolve({ done: true, value: void 0 });
|
|
663
|
-
return Promise.resolve({ done: true, value: void 0 });
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
};
|
|
668
633
|
function emitter(host, events, session) {
|
|
669
634
|
return (type, payload, refs = {}) => {
|
|
670
|
-
events.
|
|
635
|
+
events.emit({
|
|
671
636
|
eventId: NodeCrypto3.randomUUID(),
|
|
672
637
|
provider: "pi",
|
|
673
638
|
providerInstanceId: host.instanceId,
|
|
@@ -676,7 +641,6 @@ function emitter(host, events, session) {
|
|
|
676
641
|
type,
|
|
677
642
|
payload,
|
|
678
643
|
...refs,
|
|
679
|
-
...session.bindingGeneration === void 0 ? {} : { originBindingGeneration: session.bindingGeneration },
|
|
680
644
|
...session.resumeCursor === void 0 ? {} : { originResumeCursor: session.resumeCursor }
|
|
681
645
|
});
|
|
682
646
|
};
|
|
@@ -953,7 +917,6 @@ var PiTurn = class {
|
|
|
953
917
|
// src/instance.ts
|
|
954
918
|
function createPiInstance(value, host) {
|
|
955
919
|
const config = parseConfig(value, host.instanceId);
|
|
956
|
-
const events = new EventQueue();
|
|
957
920
|
const threads = /* @__PURE__ */ new Map();
|
|
958
921
|
const probes = /* @__PURE__ */ new Set();
|
|
959
922
|
const starts = /* @__PURE__ */ new Map();
|
|
@@ -1139,7 +1102,7 @@ function createPiInstance(value, host) {
|
|
|
1139
1102
|
};
|
|
1140
1103
|
const booked = {
|
|
1141
1104
|
session,
|
|
1142
|
-
emit: emitter(host, events, session),
|
|
1105
|
+
emit: emitter(host, input.events, session),
|
|
1143
1106
|
startup: new AbortController(),
|
|
1144
1107
|
questions: /* @__PURE__ */ new Map(),
|
|
1145
1108
|
exited: false,
|
|
@@ -1487,7 +1450,6 @@ function createPiInstance(value, host) {
|
|
|
1487
1450
|
]
|
|
1488
1451
|
};
|
|
1489
1452
|
},
|
|
1490
|
-
events,
|
|
1491
1453
|
listLiveProcesses: async () => [...threads.values()].filter((b) => b.connection && !b.exited).map((b) => ({
|
|
1492
1454
|
pid: b.connection.rpc.process.pid,
|
|
1493
1455
|
threadId: b.session.threadId,
|
|
@@ -1499,7 +1461,6 @@ function createPiInstance(value, host) {
|
|
|
1499
1461
|
const closing = [...threads.values()].map(close);
|
|
1500
1462
|
await Promise.allSettled([...probes, ...starts.values()]);
|
|
1501
1463
|
const results = await Promise.allSettled(closing);
|
|
1502
|
-
events.close();
|
|
1503
1464
|
const failure = results.find((result) => result.status === "rejected");
|
|
1504
1465
|
if (failure?.status === "rejected") throw new Error(redact(config, failure.reason));
|
|
1505
1466
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-pi",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3982",
|
|
4
4
|
"description": "Pi executor over the native RPC protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"tailwindcss": "^4.0.0",
|
|
31
31
|
"typescript": "~6.0.3",
|
|
32
32
|
"vite-plus": "0.2.2",
|
|
33
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
34
|
-
"ycodium
|
|
35
|
-
"
|
|
33
|
+
"@ycodium-ai/plugin-api": "0.2.3982",
|
|
34
|
+
"@ycodium/contracts": "0.0.33",
|
|
35
|
+
"ycodium-executor-testing": "0.0.0"
|
|
36
36
|
},
|
|
37
37
|
"ycodium": {
|
|
38
38
|
"plugin": "./dist/index.js",
|