@skylandnpm/octopus-proxy 0.1.43 → 0.1.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.
- package/dist/{chunk-HB3ETNMW.js → chunk-HDXWS2VW.js} +40 -9
- package/dist/cli.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
|
@@ -14897,7 +14897,7 @@ var OpenCodeAdapter = class {
|
|
|
14897
14897
|
this.subscribe(project);
|
|
14898
14898
|
const op = command.operation, p = command.payload, id = command.sessionId;
|
|
14899
14899
|
if (op.startsWith("auth.")) return this.authentication(project, op, p);
|
|
14900
|
-
const needsSession = op.startsWith("sessions.") && !["sessions.list", "sessions.create"
|
|
14900
|
+
const needsSession = op.startsWith("sessions.") && !["sessions.list", "sessions.create"].includes(op);
|
|
14901
14901
|
if (needsSession) {
|
|
14902
14902
|
if (!id) throw new Error("Session required");
|
|
14903
14903
|
await this.session(project, id);
|
|
@@ -14949,7 +14949,10 @@ var OpenCodeAdapter = class {
|
|
|
14949
14949
|
if (!route) throw new Error(`Unsupported OpenCode operation: ${op}`);
|
|
14950
14950
|
const result = await this.data(project, route[0], route[1], route[2]);
|
|
14951
14951
|
if (op === "sessions.list") return (Array.isArray(result) ? result : []).map(normalizeSession);
|
|
14952
|
-
if (op === "sessions.status")
|
|
14952
|
+
if (op === "sessions.status") {
|
|
14953
|
+
const value = result?.[id];
|
|
14954
|
+
return { [id]: { type: value?.type === "running" ? "busy" : value?.type ?? "idle" } };
|
|
14955
|
+
}
|
|
14953
14956
|
if (op === "sessions.messages") return this.media.messages(project, id, (Array.isArray(result) ? result : []).map(normalizeMessage));
|
|
14954
14957
|
if (["configuration.get", "configuration.providers"].includes(op)) return redact(result);
|
|
14955
14958
|
if (op.startsWith("sessions.")) return this.media.normalize(project, normalizeSession(result));
|
|
@@ -16148,6 +16151,34 @@ var CodexAdapter = class {
|
|
|
16148
16151
|
}
|
|
16149
16152
|
return [...turns.values()];
|
|
16150
16153
|
}
|
|
16154
|
+
async threadWithTurns(rpc, threadId) {
|
|
16155
|
+
const { thread } = await rpc.request("thread/read", { threadId });
|
|
16156
|
+
const turns = [];
|
|
16157
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
16158
|
+
let cursor = null;
|
|
16159
|
+
try {
|
|
16160
|
+
do {
|
|
16161
|
+
const page = await rpc.request("thread/turns/list", {
|
|
16162
|
+
threadId,
|
|
16163
|
+
limit: 100,
|
|
16164
|
+
sortDirection: "asc",
|
|
16165
|
+
itemsView: "full",
|
|
16166
|
+
...cursor ? { cursor } : {}
|
|
16167
|
+
});
|
|
16168
|
+
turns.push(...page.data);
|
|
16169
|
+
cursor = page.nextCursor ?? null;
|
|
16170
|
+
if (cursor && seenCursors.has(cursor)) break;
|
|
16171
|
+
if (cursor) seenCursors.add(cursor);
|
|
16172
|
+
} while (cursor);
|
|
16173
|
+
return { ...thread, turns };
|
|
16174
|
+
} catch (error) {
|
|
16175
|
+
const message = error instanceof Error ? error.message.toLowerCase() : String(error).toLowerCase();
|
|
16176
|
+
if (message.includes("not materialized")) return { ...thread, turns: [] };
|
|
16177
|
+
const unsupported = message.includes("method not found") || message.includes("unknown method") || message.includes("unsupported") && message.includes("thread/turns/list");
|
|
16178
|
+
if (!unsupported) throw error;
|
|
16179
|
+
return (await rpc.request("thread/read", { threadId, includeTurns: true })).thread;
|
|
16180
|
+
}
|
|
16181
|
+
}
|
|
16151
16182
|
itemToPart(item) {
|
|
16152
16183
|
const base = { id: item.id };
|
|
16153
16184
|
const status = item.status === "completed" ? "completed" : ["failed", "declined"].includes(item.status ?? "") ? "failed" : "running";
|
|
@@ -16316,10 +16347,10 @@ var CodexAdapter = class {
|
|
|
16316
16347
|
}
|
|
16317
16348
|
if (op === "sessions.status") {
|
|
16318
16349
|
if (!id) throw new Error("Session required");
|
|
16319
|
-
const thread = await
|
|
16350
|
+
const thread = await this.threadWithTurns(rpc, id);
|
|
16320
16351
|
const expected = await this.workspace.root(project);
|
|
16321
|
-
if (thread.
|
|
16322
|
-
const turns = this.mergedTurns(project, id, thread.
|
|
16352
|
+
if (thread.cwd !== expected && !await this.index(project).then((index) => index.threadIds.includes(id))) throw new Error("Session belongs to another project");
|
|
16353
|
+
const turns = this.mergedTurns(project, id, thread.turns ?? []);
|
|
16323
16354
|
const status = turns.at(-1)?.status;
|
|
16324
16355
|
const busy = typeof status === "string" && !["completed", "failed", "interrupted", "cancelled", "canceled"].includes(status.toLowerCase());
|
|
16325
16356
|
const last = turns.at(-1);
|
|
@@ -16327,10 +16358,10 @@ var CodexAdapter = class {
|
|
|
16327
16358
|
}
|
|
16328
16359
|
if (op === "sessions.messages") {
|
|
16329
16360
|
if (!id) throw new Error("Session required");
|
|
16330
|
-
const thread = await
|
|
16361
|
+
const thread = await this.threadWithTurns(rpc, id);
|
|
16331
16362
|
const expected = await this.workspace.root(project);
|
|
16332
|
-
if (thread.
|
|
16333
|
-
return this.media.messages(project, id, this.turnsToMessages(this.mergedTurns(project, id, thread.
|
|
16363
|
+
if (thread.cwd !== expected && !await this.index(project).then((index) => index.threadIds.includes(id))) throw new Error("Session belongs to another project");
|
|
16364
|
+
return this.media.messages(project, id, this.turnsToMessages(this.mergedTurns(project, id, thread.turns ?? [])));
|
|
16334
16365
|
}
|
|
16335
16366
|
if (op === "sessions.prompt") {
|
|
16336
16367
|
if (!id) throw new Error("Session required");
|
|
@@ -16357,7 +16388,7 @@ var CodexAdapter = class {
|
|
|
16357
16388
|
await this.session(project, id);
|
|
16358
16389
|
let turnId = this.activeTurns.get(id);
|
|
16359
16390
|
if (!turnId) {
|
|
16360
|
-
const
|
|
16391
|
+
const thread = await this.threadWithTurns(rpc, id);
|
|
16361
16392
|
turnId = thread.turns?.slice().reverse().find((turn) => turn.status === "inProgress")?.id;
|
|
16362
16393
|
}
|
|
16363
16394
|
if (!turnId) return {};
|
package/dist/cli.js
CHANGED
package/dist/main.js
CHANGED