@ycodium-ai/agent-pi 0.2.3935 → 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 +8 -42
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import * as NodeOS2 from "node:os";
|
|
3
3
|
import * as NodePath3 from "node:path";
|
|
4
4
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
5
|
+
|
|
6
|
+
// ../../packages/plugin-api/src/version.ts
|
|
7
|
+
var PLUGIN_API_VERSION = 76;
|
|
8
|
+
|
|
9
|
+
// src/index.ts
|
|
5
10
|
import {
|
|
6
11
|
EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
|
|
7
12
|
readExecutorEffectiveRequest
|
|
@@ -625,44 +630,9 @@ async function openConnection(input) {
|
|
|
625
630
|
|
|
626
631
|
// src/events.ts
|
|
627
632
|
import * as NodeCrypto3 from "node:crypto";
|
|
628
|
-
var EventQueue = class {
|
|
629
|
-
queue = [];
|
|
630
|
-
waiters = [];
|
|
631
|
-
closed = false;
|
|
632
|
-
push(event) {
|
|
633
|
-
if (this.closed) return;
|
|
634
|
-
const waiter = this.waiters.shift();
|
|
635
|
-
if (waiter) waiter.resolve({ done: false, value: event });
|
|
636
|
-
else this.queue.push(event);
|
|
637
|
-
}
|
|
638
|
-
close() {
|
|
639
|
-
this.closed = true;
|
|
640
|
-
for (const waiter of this.waiters.splice(0)) waiter.resolve({ done: true, value: void 0 });
|
|
641
|
-
}
|
|
642
|
-
[Symbol.asyncIterator]() {
|
|
643
|
-
const owner = {};
|
|
644
|
-
let returned = false;
|
|
645
|
-
return {
|
|
646
|
-
next: () => {
|
|
647
|
-
if (returned) return Promise.resolve({ done: true, value: void 0 });
|
|
648
|
-
const value = this.queue.shift();
|
|
649
|
-
if (value) return Promise.resolve({ done: false, value });
|
|
650
|
-
if (this.closed) return Promise.resolve({ done: true, value: void 0 });
|
|
651
|
-
return new Promise((resolve3) => this.waiters.push({ owner, resolve: resolve3 }));
|
|
652
|
-
},
|
|
653
|
-
return: () => {
|
|
654
|
-
returned = true;
|
|
655
|
-
const pending = this.waiters.filter((waiter) => waiter.owner === owner);
|
|
656
|
-
this.waiters = this.waiters.filter((waiter) => waiter.owner !== owner);
|
|
657
|
-
for (const waiter of pending) waiter.resolve({ done: true, value: void 0 });
|
|
658
|
-
return Promise.resolve({ done: true, value: void 0 });
|
|
659
|
-
}
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
633
|
function emitter(host, events, session) {
|
|
664
634
|
return (type, payload, refs = {}) => {
|
|
665
|
-
events.
|
|
635
|
+
events.emit({
|
|
666
636
|
eventId: NodeCrypto3.randomUUID(),
|
|
667
637
|
provider: "pi",
|
|
668
638
|
providerInstanceId: host.instanceId,
|
|
@@ -671,7 +641,6 @@ function emitter(host, events, session) {
|
|
|
671
641
|
type,
|
|
672
642
|
payload,
|
|
673
643
|
...refs,
|
|
674
|
-
...session.bindingGeneration === void 0 ? {} : { originBindingGeneration: session.bindingGeneration },
|
|
675
644
|
...session.resumeCursor === void 0 ? {} : { originResumeCursor: session.resumeCursor }
|
|
676
645
|
});
|
|
677
646
|
};
|
|
@@ -948,7 +917,6 @@ var PiTurn = class {
|
|
|
948
917
|
// src/instance.ts
|
|
949
918
|
function createPiInstance(value, host) {
|
|
950
919
|
const config = parseConfig(value, host.instanceId);
|
|
951
|
-
const events = new EventQueue();
|
|
952
920
|
const threads = /* @__PURE__ */ new Map();
|
|
953
921
|
const probes = /* @__PURE__ */ new Set();
|
|
954
922
|
const starts = /* @__PURE__ */ new Map();
|
|
@@ -1134,7 +1102,7 @@ function createPiInstance(value, host) {
|
|
|
1134
1102
|
};
|
|
1135
1103
|
const booked = {
|
|
1136
1104
|
session,
|
|
1137
|
-
emit: emitter(host, events, session),
|
|
1105
|
+
emit: emitter(host, input.events, session),
|
|
1138
1106
|
startup: new AbortController(),
|
|
1139
1107
|
questions: /* @__PURE__ */ new Map(),
|
|
1140
1108
|
exited: false,
|
|
@@ -1482,7 +1450,6 @@ function createPiInstance(value, host) {
|
|
|
1482
1450
|
]
|
|
1483
1451
|
};
|
|
1484
1452
|
},
|
|
1485
|
-
events,
|
|
1486
1453
|
listLiveProcesses: async () => [...threads.values()].filter((b) => b.connection && !b.exited).map((b) => ({
|
|
1487
1454
|
pid: b.connection.rpc.process.pid,
|
|
1488
1455
|
threadId: b.session.threadId,
|
|
@@ -1494,7 +1461,6 @@ function createPiInstance(value, host) {
|
|
|
1494
1461
|
const closing = [...threads.values()].map(close);
|
|
1495
1462
|
await Promise.allSettled([...probes, ...starts.values()]);
|
|
1496
1463
|
const results = await Promise.allSettled(closing);
|
|
1497
|
-
events.close();
|
|
1498
1464
|
const failure = results.find((result) => result.status === "rejected");
|
|
1499
1465
|
if (failure?.status === "rejected") throw new Error(redact(config, failure.reason));
|
|
1500
1466
|
},
|
|
@@ -1528,7 +1494,7 @@ function createPiInstance(value, host) {
|
|
|
1528
1494
|
// src/index.ts
|
|
1529
1495
|
var index_default = definePlugin({
|
|
1530
1496
|
id: "agent-pi",
|
|
1531
|
-
apiVersion:
|
|
1497
|
+
apiVersion: PLUGIN_API_VERSION,
|
|
1532
1498
|
executors: [
|
|
1533
1499
|
{
|
|
1534
1500
|
card: PI_CARD,
|
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.3982",
|
|
33
34
|
"@ycodium/contracts": "0.0.33",
|
|
34
|
-
"ycodium-executor-testing": "0.0.0"
|
|
35
|
-
"@ycodium-ai/plugin-api": "0.2.3935"
|
|
35
|
+
"ycodium-executor-testing": "0.0.0"
|
|
36
36
|
},
|
|
37
37
|
"ycodium": {
|
|
38
38
|
"plugin": "./dist/index.js",
|