@ycodium-ai/agent-codex 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 +41 -45
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
3
|
+
|
|
4
|
+
// ../../packages/plugin-api/src/version.ts
|
|
5
|
+
var PLUGIN_API_VERSION = 76;
|
|
6
|
+
|
|
7
|
+
// src/index.ts
|
|
3
8
|
import {
|
|
4
9
|
EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
|
|
5
10
|
executorHomeEffectiveValue,
|
|
@@ -3253,7 +3258,12 @@ function mapCollabAgentEvent(input) {
|
|
|
3253
3258
|
baseEvent({
|
|
3254
3259
|
type: "task.updated",
|
|
3255
3260
|
threadId,
|
|
3256
|
-
payload: {
|
|
3261
|
+
payload: {
|
|
3262
|
+
taskId: agentThreadId,
|
|
3263
|
+
status,
|
|
3264
|
+
...input.params["outcomeUnknown"] === true ? { outcomeUnknown: true } : {},
|
|
3265
|
+
...linkage
|
|
3266
|
+
},
|
|
3257
3267
|
method,
|
|
3258
3268
|
providerInstanceId: input.providerInstanceId
|
|
3259
3269
|
})
|
|
@@ -4697,14 +4707,24 @@ var CodexBackgroundCommands = class {
|
|
|
4697
4707
|
}
|
|
4698
4708
|
return events;
|
|
4699
4709
|
}
|
|
4710
|
+
/** 进程异常退出不能确认后台命令已结束,只收口本代观察。 */
|
|
4711
|
+
settleSessionEnded(outcomeUnknown, method) {
|
|
4712
|
+
const closed = [...this.#commands].filter(([, command]) => command.background);
|
|
4713
|
+
this.#commands.clear();
|
|
4714
|
+
return closed.map(
|
|
4715
|
+
([id, command]) => outcomeUnknown ? baseEvent({
|
|
4716
|
+
type: "task.updated",
|
|
4717
|
+
threadId: this.#threadId,
|
|
4718
|
+
turnId: command.turnId,
|
|
4719
|
+
providerInstanceId: this.#providerInstanceId,
|
|
4720
|
+
payload: { taskId: id, status: "idle", outcomeUnknown: true }
|
|
4721
|
+
}) : this.#completed(id, command.turnId, "stopped", method)
|
|
4722
|
+
);
|
|
4723
|
+
}
|
|
4700
4724
|
/** 跟着通知走,返回要补发的 task 事件;放在该通知本身的事件之后发。 */
|
|
4701
4725
|
observe(method, params) {
|
|
4702
4726
|
if (method === "turn/completed") return this.#settleTurn(method, params);
|
|
4703
|
-
if (method === "thread/closed")
|
|
4704
|
-
const closed = [...this.#commands].filter(([, command2]) => command2.background);
|
|
4705
|
-
this.#commands.clear();
|
|
4706
|
-
return closed.map(([id2, command2]) => this.#completed(id2, command2.turnId, "stopped", method));
|
|
4707
|
-
}
|
|
4727
|
+
if (method === "thread/closed") return this.settleSessionEnded(false, method);
|
|
4708
4728
|
if (!isRecord2(params) || !isRecord2(params["item"])) return [];
|
|
4709
4729
|
const item = params["item"];
|
|
4710
4730
|
const id = item["id"];
|
|
@@ -4930,6 +4950,16 @@ var CodexSessionCollab = class {
|
|
|
4930
4950
|
constructor(runtime) {
|
|
4931
4951
|
this.runtime = runtime;
|
|
4932
4952
|
}
|
|
4953
|
+
/** 父进程结束只收口本代观察;没有子线程终态时不能断言外部任务已结束。 */
|
|
4954
|
+
settleSessionEnded() {
|
|
4955
|
+
for (const child of this.runtime.collabChildren.values()) {
|
|
4956
|
+
this.metaOf(child.agentThreadId).closed = true;
|
|
4957
|
+
if (child.status !== "running") continue;
|
|
4958
|
+
child.status = "idle";
|
|
4959
|
+
this.emitCollab("collabAgent/statusChanged", child, { status: "idle", outcomeUnknown: true });
|
|
4960
|
+
}
|
|
4961
|
+
this.runtime.liveForeignTurns.clear();
|
|
4962
|
+
}
|
|
4933
4963
|
interceptCollab(method, params, conversationId) {
|
|
4934
4964
|
const thread = isRecord2(params) && isRecord2(params["thread"]) ? params["thread"] : void 0;
|
|
4935
4965
|
const source = thread === void 0 ? void 0 : thread["source"];
|
|
@@ -5867,44 +5897,13 @@ var CodexSessionRuntime = class {
|
|
|
5867
5897
|
this.host.log.warn("codex output drain timed out", { threadId: this.threadId });
|
|
5868
5898
|
}
|
|
5869
5899
|
});
|
|
5900
|
+
for (const event of this.#background.settleSessionEnded(reason === "process"))
|
|
5901
|
+
this.emit(event);
|
|
5902
|
+
this.#collab.settleSessionEnded();
|
|
5870
5903
|
});
|
|
5871
5904
|
}
|
|
5872
5905
|
};
|
|
5873
5906
|
|
|
5874
|
-
// src/eventBus.ts
|
|
5875
|
-
var EventBus = class {
|
|
5876
|
-
#queued = [];
|
|
5877
|
-
#waiters = [];
|
|
5878
|
-
#closed = false;
|
|
5879
|
-
push(event) {
|
|
5880
|
-
const waiter = this.#waiters.shift();
|
|
5881
|
-
if (waiter) {
|
|
5882
|
-
waiter({ done: false, value: event });
|
|
5883
|
-
return;
|
|
5884
|
-
}
|
|
5885
|
-
this.#queued.push(event);
|
|
5886
|
-
}
|
|
5887
|
-
close() {
|
|
5888
|
-
if (this.#closed) return;
|
|
5889
|
-
this.#closed = true;
|
|
5890
|
-
while (this.#waiters.length > 0) {
|
|
5891
|
-
this.#waiters.shift()?.({ done: true, value: void 0 });
|
|
5892
|
-
}
|
|
5893
|
-
}
|
|
5894
|
-
[Symbol.asyncIterator]() {
|
|
5895
|
-
return {
|
|
5896
|
-
next: () => {
|
|
5897
|
-
const queued = this.#queued.shift();
|
|
5898
|
-
if (queued !== void 0) return Promise.resolve({ done: false, value: queued });
|
|
5899
|
-
if (this.#closed) return Promise.resolve({ done: true, value: void 0 });
|
|
5900
|
-
return new Promise((resolve4) => {
|
|
5901
|
-
this.#waiters.push(resolve4);
|
|
5902
|
-
});
|
|
5903
|
-
}
|
|
5904
|
-
};
|
|
5905
|
-
}
|
|
5906
|
-
};
|
|
5907
|
-
|
|
5908
5907
|
// src/mcpOAuth.ts
|
|
5909
5908
|
function codexMcpOAuthLaunchConfig(name, transport) {
|
|
5910
5909
|
const key = `mcp_servers.${name}`;
|
|
@@ -7531,7 +7530,6 @@ function layoutFor(recipe) {
|
|
|
7531
7530
|
}
|
|
7532
7531
|
var createCodexInstance = (config, host, attachments, cache) => {
|
|
7533
7532
|
const recipe = parseCodexInstanceConfig(config);
|
|
7534
|
-
const events = new EventBus();
|
|
7535
7533
|
const threads = /* @__PURE__ */ new Map();
|
|
7536
7534
|
const signInOperations = /* @__PURE__ */ new Map();
|
|
7537
7535
|
const live = /* @__PURE__ */ new Map();
|
|
@@ -7762,7 +7760,7 @@ var createCodexInstance = (config, host, attachments, cache) => {
|
|
|
7762
7760
|
runtime = new CodexSessionRuntime(
|
|
7763
7761
|
host,
|
|
7764
7762
|
rpc,
|
|
7765
|
-
|
|
7763
|
+
input.events.emit,
|
|
7766
7764
|
input,
|
|
7767
7765
|
cwd,
|
|
7768
7766
|
args,
|
|
@@ -7840,7 +7838,6 @@ var createCodexInstance = (config, host, attachments, cache) => {
|
|
|
7840
7838
|
const booked = requireThread(threadId);
|
|
7841
7839
|
return await booked.runtime.readThread();
|
|
7842
7840
|
},
|
|
7843
|
-
events,
|
|
7844
7841
|
dispose: () => {
|
|
7845
7842
|
if (disposeTask) return disposeTask;
|
|
7846
7843
|
disposed = true;
|
|
@@ -7855,7 +7852,6 @@ var createCodexInstance = (config, host, attachments, cache) => {
|
|
|
7855
7852
|
for (const result of await closing) {
|
|
7856
7853
|
if (result.status === "rejected") throw result.reason;
|
|
7857
7854
|
}
|
|
7858
|
-
events.close();
|
|
7859
7855
|
})();
|
|
7860
7856
|
return disposeTask;
|
|
7861
7857
|
},
|
|
@@ -8024,7 +8020,7 @@ var executors = [
|
|
|
8024
8020
|
];
|
|
8025
8021
|
var index_default = definePlugin({
|
|
8026
8022
|
id: "agent-codex",
|
|
8027
|
-
apiVersion:
|
|
8023
|
+
apiVersion: PLUGIN_API_VERSION,
|
|
8028
8024
|
executors,
|
|
8029
8025
|
activate(ctx) {
|
|
8030
8026
|
ctx.command({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-codex",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3982",
|
|
4
4
|
"description": "Codex executor: Codex CLI over the app-server JSON-RPC protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"tailwindcss": "^4.0.0",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
31
|
"vite-plus": "0.2.2",
|
|
32
|
-
"ycodium-
|
|
33
|
-
"
|
|
34
|
-
"ycodium-
|
|
32
|
+
"@ycodium-ai/plugin-api": "0.2.3982",
|
|
33
|
+
"ycodium-jsonl-stream": "0.0.0",
|
|
34
|
+
"ycodium-executor-testing": "0.0.0"
|
|
35
35
|
},
|
|
36
36
|
"ycodium": {
|
|
37
37
|
"plugin": "./dist/index.js",
|