@ktkid/kmh-codex-cli 0.1.2 → 0.1.3

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
@@ -2,7 +2,7 @@
2
2
  description: 在 KMH 使用本机官方 Codex CLI 登录的模型:挂载配置、隔离开关、原生工具审批与逐项选择、生图展示、token 用量与会话连接状态小球,以及差分续聊与故障排查入口。
3
3
  ---
4
4
 
5
- # @kmh/codex-cli
5
+ # @ktkid/kmh-codex-cli
6
6
 
7
7
  ## 概述
8
8
 
@@ -44,7 +44,7 @@ description: 在 KMH 使用本机官方 Codex CLI 登录的模型:挂载配置
44
44
 
45
45
  ```yaml
46
46
  - id: kmh-codex-cli
47
- name: "@kmh/codex-cli"
47
+ name: "@ktkid/kmh-codex-cli"
48
48
  config:
49
49
  # 默认使用插件自带启动器;显式 command 可指定其他经过验证的程序。
50
50
  cwd: !!js process.cwd()
@@ -122,7 +122,7 @@ token 用量:`turn/completed` 的 turn 不携带用量(0.162 wire 实测)
122
122
 
123
123
  图片生成结果的展示:Codex 原生 `image_gen.imagegen` 工具在默认隔离下即对模型可用(托管 API 调用,无本地执行与审批)。生成产物由 Codex 落盘到 `~/.codex/generated_images/<threadId>/`;桥在收到对应 `item/completed` 通知时读取落盘文件、经宿主附件服务(`ctx.attachments.saveImages`)落成 `ImageAttachmentRef`,并以 image 内容块送回 KMH,会话内直接展示该图片(2026-10-08 真机闭环:叙述块、image 块与尺寸附注并存渲染)。投影是展示增强:读取或入库失败时跳过并告警(落盘路径即恢复入口),生成与续推链路不受影响;同一生图项按 id 去重,一回合多张图片逐项展示。注意:image 块使用独立流块索引(`<id>:image`)——与叙述块共用 item id 的索引会让组装器按先关先赢丢弃 image 块。
124
124
 
125
- 独立服务通过公开子路径 `@kmh/codex-cli/imagegen` 导入 `Config`、`ImageRequest` 和 `generateImage`,复用本包的进程连接与隔离。执行器依赖调用方提供的 subprocess 服务,确认 ChatGPT 登录后创建一次性原生会话,返回 PNG 字节与实际尺寸,并在返回前等待进程回收。HTTP 服务、任务保存与中继配置由孔明主仓的图片生成服务维护。
125
+ 独立服务通过公开子路径 `@ktkid/kmh-codex-cli/imagegen` 导入 `Config`、`ImageRequest` 和 `generateImage`,复用本包的进程连接与隔离。执行器依赖调用方提供的 subprocess 服务,确认 ChatGPT 登录后创建一次性原生会话,返回 PNG 字节与实际尺寸,并在返回前等待进程回收。HTTP 服务、任务保存与中继配置由孔明主仓的图片生成服务维护。
126
126
 
127
127
  | 模块 | 职责 |
128
128
  | --------------------------------------------------- | ------------------------------------------------ |
@@ -172,7 +172,7 @@ pnpm test
172
172
 
173
173
  使用 Node.js 24.9+ 和 pnpm 11.7.0。独立仓使用 npm 发布的 DSH `0.2.2-rc.1` 开发依赖。GitHub CI 在 macOS arm64 执行完整回归,覆盖默认启动器和原生文件修改。测试默认使用[插件固定的官方 CLI](bin/README.md);`KMH_CODEX_BINARY` 可以指定经过版本验证的官方程序绝对路径。
174
174
 
175
- 独立仓提供 `cordis.patch.yml`。DSH profile 可以在 `dsh.profile.bundles` 中引用 `@kmh/codex-cli`,按需使用插件行 `kmh-codex-cli` 覆盖配置。
175
+ 独立仓提供 `cordis.patch.yml`。DSH profile 可以在 `dsh.profile.bundles` 中引用 `@ktkid/kmh-codex-cli`,按需使用插件行 `kmh-codex-cli` 覆盖配置。
176
176
 
177
177
  ```sh
178
178
  pnpm install --frozen-lockfile
package/lib/client.js CHANGED
@@ -16129,7 +16129,7 @@ function apply(ctx) {
16129
16129
  inject: (sessionId) => ({
16130
16130
  directory: scope.modelDirectories.directoryFor(sessionId),
16131
16131
  quota,
16132
- openSettings: () => scope.pluginNavigation.openBundle("@kmh/codex-cli")
16132
+ openSettings: () => scope.pluginNavigation.openBundle("@ktkid/kmh-codex-cli")
16133
16133
  })
16134
16134
  },
16135
16135
  ComposerQuota
@@ -16165,7 +16165,7 @@ function apply(ctx) {
16165
16165
  () => ctx.slots.register(
16166
16166
  {
16167
16167
  name: "plugins.bundle.config",
16168
- key: "@kmh/codex-cli",
16168
+ key: "@ktkid/kmh-codex-cli",
16169
16169
  locale: namespace
16170
16170
  },
16171
16171
  (props) => CodexCard({ ...props, view: "page", quota })
package/lib/src/config.js CHANGED
@@ -2,8 +2,11 @@
2
2
  import { ToolSelectionSchema } from "./tool-selection.js";
3
3
  import schema from "@deepseek-ai/schemastery";
4
4
  import { dirname, isAbsolute, join } from "node:path";
5
- import { createRequire } from "node:module";
6
- const bundledCommand = join(dirname(createRequire(import.meta.url).resolve("@kmh/codex-cli/package.json")), "bin", "codex");
5
+ import { findPackageJSON } from "node:module";
6
+ const packageJson = findPackageJSON(import.meta.url);
7
+ if (packageJson === undefined)
8
+ throw new Error("CODEX_PACKAGE_MANIFEST_MISSING");
9
+ const bundledCommand = join(dirname(packageJson), "bin", "codex");
7
10
  // 共享 schema 保持选择类型;联动检查可在配置 schema 传到客户端后独立执行。
8
11
  const codexToolSelection = schema.intersect([
9
12
  ToolSelectionSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktkid/kmh-codex-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "Official Codex CLI app-server transport and KMH account UI",
6
6
  "license": "MIT",
@@ -170,5 +170,5 @@
170
170
  "cpu": [
171
171
  "arm64"
172
172
  ],
173
- "gitHead": "0254b68eb370d6840c1714d9b937c6a6947df6d7"
173
+ "gitHead": "9d90441b0c8aa7b253d839c7f50607a653405a84"
174
174
  }