@ycodium-ai/agent-codex 0.2.3681 → 0.2.3766

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  // src/index.ts
2
2
  import { definePlugin } from "@ycodium-ai/plugin-api";
3
+ import {
4
+ EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
5
+ executorHomeEffectiveValue,
6
+ readExecutorEffectiveRequest
7
+ } from "@ycodium-ai/plugin-api/executor";
3
8
 
4
9
  // src/card.ts
5
10
  var CODEX_DRIVER_KIND = "codex";
@@ -11,6 +16,8 @@ var CODEX_CARD = {
11
16
  commandName: "codex",
12
17
  launchArgs: CODEX_DEFAULT_LAUNCH_ARGS,
13
18
  homeEnvVar: "CODEX_HOME",
19
+ // 设置表单里留空的格子此刻会用什么,见 index.ts 的同名命令。
20
+ effectiveCommand: "effectiveConfig",
14
21
  // 影子目录只分开凭据,会话文件仍写在共用 home 下(`resolveCodexHomeLayout`
15
22
  // 的 authOverlay:auth.json 是真文件,sessions 是指回共用 home 的软链)。
16
23
  homeLayout: {
@@ -99,7 +106,8 @@ var CODEX_CARD = {
99
106
  type: "string",
100
107
  "x-ycodium-form": {
101
108
  titleKey: "form.launchArgs.title",
102
- descriptionKey: "form.launchArgs.description"
109
+ descriptionKey: "form.launchArgs.description",
110
+ placeholderKey: "form.launchArgs.placeholder"
103
111
  }
104
112
  },
105
113
  customModels: { type: "array" },
@@ -3730,7 +3738,7 @@ var isUsageLimitExceeded = (error) => asRecord2(error)?.["codexErrorInfo"] === "
3730
3738
 
3731
3739
  // src/events.ts
3732
3740
  function mapNotificationToEvents(input) {
3733
- const { method, params, threadId, providerInstanceId, rateLimits } = input;
3741
+ const { method, params, threadId, providerInstanceId, rateLimits, settingsModel } = input;
3734
3742
  if (method.startsWith("collabAgent/")) {
3735
3743
  return mapCollabAgentEvent({ method, params, rootThreadId: threadId, providerInstanceId });
3736
3744
  }
@@ -3907,7 +3915,7 @@ function mapNotificationToEvents(input) {
3907
3915
  type: "turn.started",
3908
3916
  threadId,
3909
3917
  turnId,
3910
- payload: {},
3918
+ payload: settingsModel === void 0 ? {} : { model: settingsModel, modelSource: "reported" },
3911
3919
  method,
3912
3920
  providerInstanceId
3913
3921
  })
@@ -5272,6 +5280,8 @@ var CodexSessionRuntime = class {
5272
5280
  memoryThreadIds = /* @__PURE__ */ new Set();
5273
5281
  /** 这个会话见过的主额度快照(按字段合并),额度用尽停轮时点名窗口用。 */
5274
5282
  rateLimits;
5283
+ /** 根线程最近一次 `thread/settings/updated` 读回的型号;只有 CLI 读回的才放这里,不含请求值回声。 */
5284
+ settingsModel;
5275
5285
  appServerArgs;
5276
5286
  /** 会话除 cwd 外的文件夹,每轮随 `sandboxPolicy` 发;变了由 `setAdditionalDirectories` 换上,进程不重启。 */
5277
5287
  #additionalDirectories;
@@ -5449,12 +5459,22 @@ var CodexSessionRuntime = class {
5449
5459
  if (method === "account/rateLimits/updated" && isRecord2(params)) {
5450
5460
  this.rateLimits = mergeCodexRateLimits(this.rateLimits, params["rateLimits"]);
5451
5461
  }
5462
+ if (method === "thread/settings/updated" && isRecord2(params)) {
5463
+ const settings = params["threadSettings"];
5464
+ const settingsModel = isRecord2(settings) ? asString(settings["model"]) : null;
5465
+ if (settingsModel) {
5466
+ this.settingsModel = settingsModel;
5467
+ this.model = settingsModel;
5468
+ this.session = { ...this.session, model: settingsModel, modelSource: "reported" };
5469
+ }
5470
+ }
5452
5471
  for (const event of mapNotificationToEvents({
5453
5472
  method,
5454
5473
  params,
5455
5474
  threadId: this.threadId,
5456
5475
  providerInstanceId: this.host.instanceId,
5457
- rateLimits: this.rateLimits
5476
+ rateLimits: this.rateLimits,
5477
+ settingsModel: this.settingsModel
5458
5478
  })) {
5459
5479
  this.emit(event);
5460
5480
  }
@@ -7870,14 +7890,39 @@ var executors = [
7870
7890
  host.log.info("createInstance");
7871
7891
  return createCodexInstance(config, host, capturedAttachments, capturedCache);
7872
7892
  },
7873
- probeAccount: async ({ accountPath }) => probeCodexAccount(accountPath)
7893
+ probeAccount: async ({ accountPath }) => probeCodexAccount(accountPath),
7894
+ // 经 npm 装,能卸也能重装;登录走 `codex login --device-auth` 的设备码。
7895
+ lifecycle: [
7896
+ { kind: "install", reversible: true },
7897
+ { kind: "detect", reversible: true },
7898
+ { kind: "sign-in", reversible: false },
7899
+ { kind: "update", reversible: false },
7900
+ { kind: "uninstall", reversible: true }
7901
+ ]
7874
7902
  }
7875
7903
  ];
7876
7904
  var index_default = definePlugin({
7877
7905
  id: "agent-codex",
7878
- apiVersion: 52,
7906
+ apiVersion: 56,
7879
7907
  executors,
7880
7908
  activate(ctx) {
7909
+ ctx.command({
7910
+ name: "effectiveConfig",
7911
+ description: "Settings form: the CODEX_HOME an empty path resolves to on this machine.",
7912
+ scope: "read",
7913
+ payloadSchema: EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
7914
+ handle: async (payload) => {
7915
+ const request = readExecutorEffectiveRequest(payload);
7916
+ return {
7917
+ homePath: executorHomeEffectiveValue(
7918
+ "CODEX_HOME",
7919
+ request,
7920
+ process.env,
7921
+ resolveCodexHomeDirectory
7922
+ )
7923
+ };
7924
+ }
7925
+ });
7881
7926
  capturedAttachments = ctx.attachments;
7882
7927
  capturedCache = ctx.cache;
7883
7928
  ctx.log.info("codex executor ready");
package/locales/en.json CHANGED
@@ -1,4 +1,8 @@
1
1
  {
2
+ "presentation": {
3
+ "name": "Codex",
4
+ "description": "Use Codex in Ycodium and pick up earlier sessions where they left off."
5
+ },
2
6
  "form": {
3
7
  "binaryPath": {
4
8
  "title": "Program path",
@@ -12,11 +16,17 @@
12
16
  "shadowHomePath": {
13
17
  "title": "Shadow home path",
14
18
  "description": "Account-specific Codex home. Keeps auth.json separate while sharing state from CODEX_HOME.",
15
- "placeholder": "~/.codex-personal"
19
+ "placeholder": "None: sign-in stays in CODEX_HOME"
16
20
  },
17
21
  "launchArgs": {
18
22
  "title": "Launch arguments",
19
- "description": "Additional CLI arguments passed to codex app-server on session start."
23
+ "description": "Additional CLI arguments passed to codex app-server on session start.",
24
+ "placeholder": "app-server"
25
+ },
26
+ "effective": {
27
+ "provider": "{{name}} in this provider",
28
+ "machine": "{{name}} on this machine",
29
+ "default": "default"
20
30
  }
21
31
  },
22
32
  "account": {
@@ -1,4 +1,8 @@
1
1
  {
2
+ "presentation": {
3
+ "name": "Codex",
4
+ "description": "在 Ycodium 里使用 Codex,之前的会话可以接着做。"
5
+ },
2
6
  "form": {
3
7
  "binaryPath": {
4
8
  "title": "程序路径",
@@ -12,11 +16,17 @@
12
16
  "shadowHomePath": {
13
17
  "title": "影子目录路径",
14
18
  "description": "账号专用的 Codex 目录。auth.json 单独保存,其余状态仍与 CODEX_HOME 共用。",
15
- "placeholder": "~/.codex-personal"
19
+ "placeholder": "无:登录信息放在 CODEX_HOME 里"
16
20
  },
17
21
  "launchArgs": {
18
22
  "title": "启动参数",
19
- "description": "会话启动时传给 codex app-server 的额外命令行参数。"
23
+ "description": "会话启动时传给 codex app-server 的额外命令行参数。",
24
+ "placeholder": "app-server"
25
+ },
26
+ "effective": {
27
+ "provider": "本 provider 的 {{name}}",
28
+ "machine": "本机的 {{name}}",
29
+ "default": "默认"
20
30
  }
21
31
  },
22
32
  "account": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-codex",
3
- "version": "0.2.3681",
3
+ "version": "0.2.3766",
4
4
  "description": "Codex executor: Codex CLI over the app-server JSON-RPC protocol.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -29,14 +29,16 @@
29
29
  "tailwindcss": "^4.0.0",
30
30
  "typescript": "~6.0.3",
31
31
  "vite-plus": "0.2.2",
32
- "@ycodium-ai/plugin-api": "0.2.3681",
33
32
  "ycodium-executor-testing": "0.0.0",
33
+ "@ycodium-ai/plugin-api": "0.2.3766",
34
34
  "ycodium-jsonl-stream": "0.0.0"
35
35
  },
36
36
  "ycodium": {
37
37
  "plugin": "./dist/index.js",
38
38
  "displayName": "Codex",
39
- "description": "Run Codex (codex app-server) with native session resume, approvals, device-code sign-in, and isolated home overlay.",
39
+ "displayNameKey": "presentation.name",
40
+ "description": "Use Codex in Ycodium and pick up earlier sessions where they left off.",
41
+ "descriptionKey": "presentation.description",
40
42
  "icon": "./assets/icon.svg",
41
43
  "permissions": [
42
44
  {