@aiti-ai/aiti-codex-agent 0.1.11 → 0.1.13

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/README.md CHANGED
@@ -6,10 +6,9 @@ English · [简体中文](./README.zh-CN.md)
6
6
 
7
7
  ## About aiti
8
8
 
9
- This package is part of the **aiti** ecosystem — a personal AI development workbench powered by [pi](https://pi.dev): **aiti-agent** (a self-hosted web workbench built on the open-source [pi-web](https://github.com/aiti-ai/pi-web)) plus debug injection into mainstream dev tools (aiti-devtools) and a rich extension system.
9
+ This package is part of the **aiti** ecosystem — a personal AI development workbench powered by [pi](https://pi.dev): **aiti-agent** (a self-hosted web workbench built on the open-source [pi-web](https://github.com/aiti-ai/aiti-ai)) plus debug injection into mainstream dev tools (aiti-devtools) and a rich extension system.
10
10
 
11
- - Workbench (aiti-agent, built on pi-web): <https://github.com/aiti-ai/pi-web>
12
- - Ecosystem monorepo: <https://github.com/aiti-ai/aiti-ai>
11
+ - Workbench & monorepo: <https://github.com/aiti-ai/aiti-ai>
13
12
  - Site: <https://aiti.pw>
14
13
 
15
14
  Category: Multi-agent backends · Tags: `codex` · `openai` · `cli` · `session` · `multi-agent`
package/README.zh-CN.md CHANGED
@@ -6,10 +6,9 @@
6
6
 
7
7
  ## 关于 aiti
8
8
 
9
- 本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/pi-web) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
9
+ 本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/aiti-ai) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
10
10
 
11
- - 工作台(aiti-agent,基于 pi-web): <https://github.com/aiti-ai/pi-web>
12
- - 生态仓库: <https://github.com/aiti-ai/aiti-ai>
11
+ - 工作台 / 生态仓库(aiti-agent,基于 pi-web): <https://github.com/aiti-ai/aiti-ai>
13
12
  - 官网: <https://aiti.pw>
14
13
 
15
14
  分类: 多 agent 后端 · tags: `codex` · `openai` · `cli` · `session` · `multi-agent`
@@ -404,3 +404,28 @@ test("codexContextWindow: gpt-4 族 128K / gpt-5 族与未知 272K", async () =>
404
404
  assert.equal(codexContextWindow("gpt-4.1"), 128_000);
405
405
  assert.equal(codexContextWindow(undefined), 272_000);
406
406
  });
407
+
408
+ // ============================================================================
409
+ // Image mirroring: the host compares its optimistic bubble with the loaded copy
410
+ // via userMessageKey, which hashes image blocks.
411
+ // ============================================================================
412
+
413
+ test("镜像带图: prompt(images) → liveHistory 落宿主同形 base64 块(无图仍是字符串)", async () => {
414
+ const stubDir = join(ROOT, "img-stubs");
415
+ mkdirSync(stubDir, { recursive: true });
416
+ const registered = await setup(writeStub(stubDir, "img.cjs", 5));
417
+ const handle = await registered.createSession({ cwd: ROOT });
418
+ const users = async () => (await handle.getMessages()).filter((m) => m.role === "user");
419
+
420
+ const p = handle.prompt("这张图怎么回事", { images: [{ data: "QUJD", mimeType: "image/png" }] });
421
+ assert.deepEqual((await users()).at(-1).content, [
422
+ { type: "text", text: "这张图怎么回事" },
423
+ { type: "image", source: { type: "base64", media_type: "image/png", data: "QUJD" } },
424
+ ], "镜像与宿主乐观气泡同形(否则纯文本版顶替,图消失)");
425
+ await p;
426
+
427
+ const p2 = handle.prompt("纯文字");
428
+ assert.equal((await users()).at(-1).content, "纯文字", "无图保持老形状(字符串 content)");
429
+ await p2;
430
+ await handle.dispose();
431
+ });
package/index.ts CHANGED
@@ -48,7 +48,7 @@ function resolveCodexBin(): string {
48
48
  }
49
49
  import { homedir, tmpdir } from "node:os";
50
50
  import { governanceEnv } from "./external-governance.ts";
51
- import { agentSpawnEnv, spawnEnvFeature, spawnDisplayEnvFeature, spawnCommandFeature, spawnArgsPrefixFeature, spawnEnvList, spawnCommand, spawnArgsPrefix, parseArgsLines, resolveCliLaunch, captureSpawnEnvFeatures } from "@aiti-ai/ext-shared/agent-spawn-env";
51
+ import { agentSpawnEnv, spawnEnvFeature, spawnDisplayEnvFeature, spawnCommandFeature, spawnArgsPrefixFeature, spawnEnvList, spawnCommand, spawnArgsPrefix, parseArgsLines, resolveCliLaunch, captureSpawnEnvFeatures, spawnFeatureI18nEn } from "@aiti-ai/ext-shared/agent-spawn-env";
52
52
  import type { LaunchOverride } from "@aiti-ai/ext-shared/agent-spawn-env";
53
53
  // 队列共享实现层(权威源 pi-web-ext/_shared/backend-queue.ts,副本随扩展部署——改动须双向同步)
54
54
  import { createBackendQueueSupport, createQueueFilePersistence, migrateQueueSidecar } from "@aiti-ai/ext-shared/backend-queue";
@@ -148,6 +148,26 @@ function codexToolResultText(item: Record<string, unknown>, isError: boolean): s
148
148
  return text.trim().slice(0, TOOL_RESULT_TEXT_CAP) || (isError ? EMPTY_TOOL_ERROR : EMPTY_TOOL_OUTPUT);
149
149
  }
150
150
 
151
+ /**
152
+ * pi-native user content for the live mirror (host `UserMessage` shape: text block +
153
+ * base64 image blocks). The host compares its optimistic bubble with the loaded copy
154
+ * through `userMessageKey()`, which hashes every image block — a text-only mirror fails
155
+ * that comparison, so the bubble (with its pictures) is replaced by a picture-less one.
156
+ * Cold replay has nothing to recover from: codex rollouts record the prompt text only
157
+ * (the `-i` attachments are files outside the transcript).
158
+ */
159
+ function userHistoryContent(
160
+ text: string,
161
+ images?: Array<{ data: string; mimeType: string }>,
162
+ ): string | Array<Record<string, unknown>> {
163
+ if (!images?.length) return text;
164
+ const content: Array<Record<string, unknown>> = text ? [{ type: "text", text }] : [];
165
+ for (const img of images) {
166
+ content.push({ type: "image", source: { type: "base64", media_type: img.mimeType, data: img.data } });
167
+ }
168
+ return content;
169
+ }
170
+
151
171
  /**
152
172
  * codex 模型族上下文窗口(getContextUsage 换算用):GPT-5 系(gpt-5/gpt-5-codex/
153
173
  * gpt-5.1…,codex 默认族)272K;GPT-4 系 128K;未知回 272K(当前缺省族,宁近似
@@ -527,7 +547,7 @@ class CodexHandle {
527
547
  return;
528
548
  }
529
549
  this.running = true;
530
- this.liveHistory.push({ role: "user", content: text });
550
+ this.liveHistory.push({ role: "user", content: userHistoryContent(text, options?.images) });
531
551
  // 受理即发:前端 spinner「等待模型」立刻出现(CLI 冷启动可能数秒)。
532
552
  // wire 层丢弃 turn_started,前端流式态只认 agent_start/agent_end 对。
533
553
  this.emit({ type: "agent_start" });
@@ -827,12 +847,15 @@ function quotaRoute(req: Request, ctx: { path: string[]; method: string; searchP
827
847
  export default {
828
848
  id: "aiti-codex-agent",
829
849
  name: "Codex CLI",
830
- icon: "🌀",
850
+ icon: "icons/terminal.svg",
831
851
  // 受控登录统一弹窗(零构建原生 h() client;client/ 下两文件随 deploy 拷贝)
832
852
  // 静态插入点声明(与 client registerItems 的 id 一一对应)
833
853
  // 登录 UI 已统一到 aiti-agent-manager(受控登录弹窗退役,2026-09-13):不再声明
834
854
  // client/ui —— 服务端 /login/* 与 .agent 描述符保留(manager 代理消费)。
835
855
 
856
+ // English overrides for the shared spawn.* feature declarations (labels + descriptions).
857
+ ui: { i18n: { en: { ...spawnFeatureI18nEn() } } },
858
+
836
859
  features: [spawnEnvFeature("Codex"), spawnDisplayEnvFeature("Codex"), spawnCommandFeature("Codex"), spawnArgsPrefixFeature("Codex")],
837
860
 
838
861
  server: {
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@aiti-ai/aiti-codex-agent",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "OpenAI Codex CLI driver — exec --json + resume integrated into All Sessions; dual-track auth (auth.json OAuth / openrouter env), live streaming and cold replay render identically-shaped native tool cards",
5
+ "displayNameI18n": {
6
+ "en": "Codex Session Backend"
7
+ },
8
+ "descriptionI18n": {
9
+ "zh-CN": "OpenAI Codex CLI driver —— exec --json + resume 接入 All Sessions;认证双轨(auth.json OAuth / openrouter env),直播与冷回放同形原生工具卡"
10
+ },
5
11
  "soul": "Codex 在哪儿跑,面板就在哪儿看。",
12
+ "soulI18n": {
13
+ "en": "Wherever Codex runs, the panel watches."
14
+ },
6
15
  "scripts": {
7
16
  "build:client": "node -e \"const fs=require('fs');fs.mkdirSync('dist',{recursive:true});for(const f of fs.readdirSync('client/src'))if(f.endsWith('.mjs'))fs.copyFileSync('client/src/'+f,'dist/'+f)\""
8
17
  },
@@ -17,7 +26,7 @@
17
26
  "@aiti-ai/ext-shared": "^0.1.12"
18
27
  },
19
28
  "license": "MIT",
20
- "contentHash": "39122ea131ec1314",
29
+ "contentHash": "dff30a2e64fba7a6",
21
30
  "repository": {
22
31
  "type": "git",
23
32
  "url": "git+https://github.com/aiti-ai/aiti-ai.git",