@ktkid/kmh-codex-cli 0.1.1 → 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 +3 -2
- package/lib/browser-types/src/live-state.d.ts +2 -2
- package/lib/browser-types/src/quota-protocol.d.ts +6 -6
- package/lib/client.js +2229 -7432
- package/lib/src/adapter.js +6 -5
- package/lib/src/config.js +5 -2
- package/lib/src/cursor.d.ts +9 -2
- package/lib/src/cursor.js +23 -9
- package/lib/src/index.d.ts +8 -3
- package/lib/src/index.js +22 -5
- package/lib/src/session-history.d.ts +18 -0
- package/lib/src/session-history.js +113 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -4,8 +4,6 @@ description: 在 KMH 使用本机官方 Codex CLI 登录的模型:挂载配置
|
|
|
4
4
|
|
|
5
5
|
# @ktkid/kmh-codex-cli
|
|
6
6
|
|
|
7
|
-
本 npm 包使用 macOS arm64 的官方 Codex CLI 固定版依赖。插件沿用本机现有的 Codex 登录。
|
|
8
|
-
|
|
9
7
|
## 概述
|
|
10
8
|
|
|
11
9
|
在 KMH 里使用本机官方 Codex CLI 的模型对话:KMH 保留系统提示、工具权限与回合控制,Codex 承担模型推理与原生历史管理。工具以动态工具回调交回 KMH 执行;创建 KMH 会话时固定工具选择,后续回合恢复同一 Codex 会话和原工具,Codex 续用自己的历史。
|
|
@@ -130,6 +128,7 @@ token 用量:`turn/completed` 的 turn 不携带用量(0.162 wire 实测)
|
|
|
130
128
|
| --------------------------------------------------- | ------------------------------------------------ |
|
|
131
129
|
| `src/connection.ts` | 行协议连接:进程、握手、双向请求分发、回收 |
|
|
132
130
|
| `src/cursor.ts` | 差分游标:前缀对齐与增量切分 |
|
|
131
|
+
| `src/session-history.ts` | 从 DSH 会话事件核对系统提示替换和首步未投递输入 |
|
|
133
132
|
| `src/turn.ts` | 回合状态机:挂起回执、续推、interrupt、原生 fork |
|
|
134
133
|
| `src/isolation.ts` | 工具/技能/钩子隔离的参数生成与核对 |
|
|
135
134
|
| `src/adapter.ts` | LlmAdapter:模型映射、流投影、会话驱动 |
|
|
@@ -236,6 +235,8 @@ pnpm format:check
|
|
|
236
235
|
|
|
237
236
|
工具声明只在首次 `thread/start` 传入;后续 `thread/resume` 保持原编号、原工具及原生历史。详细原始执行事件受 CLI 恢复能力限制,界面按普通通知显示可提供的进度与结果。跨回合缓存命中由提供方决定。声明指纹包含来源、名称、完整参数、原生版本与所选控制。
|
|
238
237
|
|
|
238
|
+
客户端恢复会话时,DSH 可以替换宿主生成的系统提示。插件通过 DSH 会话投影校验同一条提示的替换记录,并继续核对聊天历史,保持原生绑定。DSH 的工具目录通知保留在会话日志中,原生请求继续沿用已保存的工具选择。首步因分叉位置校验失败且尚未投递的手工输入,随下次续聊按原顺序提交,原生接纳后推进游标。
|
|
239
|
+
|
|
239
240
|
---
|
|
240
241
|
|
|
241
242
|
<a id="known-limitations-and-deferred-work"></a>
|
|
@@ -3,8 +3,8 @@ import { z } from "zod";
|
|
|
3
3
|
/** CLI 连接状态;重试期间 streaming 保持 true。 */
|
|
4
4
|
export declare const SessionLiveState: z.ZodObject<{
|
|
5
5
|
color: z.ZodEnum<{
|
|
6
|
-
green: "green";
|
|
7
6
|
gray: "gray";
|
|
7
|
+
green: "green";
|
|
8
8
|
red: "red";
|
|
9
9
|
}>;
|
|
10
10
|
streaming: z.ZodBoolean;
|
|
@@ -18,8 +18,8 @@ export type SessionLiveState = z.infer<typeof SessionLiveState>;
|
|
|
18
18
|
export declare const LiveSnapshot: z.ZodObject<{
|
|
19
19
|
sessions: z.ZodArray<z.ZodObject<{
|
|
20
20
|
color: z.ZodEnum<{
|
|
21
|
-
green: "green";
|
|
22
21
|
gray: "gray";
|
|
22
|
+
green: "green";
|
|
23
23
|
red: "red";
|
|
24
24
|
}>;
|
|
25
25
|
streaming: z.ZodBoolean;
|
|
@@ -56,15 +56,15 @@ export type QuotaGroup = z.infer<typeof QuotaGroup>;
|
|
|
56
56
|
export declare const QuotaError: z.ZodObject<{
|
|
57
57
|
area: z.ZodEnum<{
|
|
58
58
|
windows: "windows";
|
|
59
|
-
account: "account";
|
|
60
59
|
credits: "credits";
|
|
61
60
|
spend: "spend";
|
|
62
61
|
resets: "resets";
|
|
62
|
+
account: "account";
|
|
63
63
|
}>;
|
|
64
64
|
code: z.ZodEnum<{
|
|
65
|
+
unsupported: "unsupported";
|
|
65
66
|
"read-failed": "read-failed";
|
|
66
67
|
"invalid-data": "invalid-data";
|
|
67
|
-
unsupported: "unsupported";
|
|
68
68
|
}>;
|
|
69
69
|
message: z.ZodString;
|
|
70
70
|
}, z.core.$strip>;
|
|
@@ -72,11 +72,11 @@ export type QuotaError = z.infer<typeof QuotaError>;
|
|
|
72
72
|
export declare const QuotaView: z.ZodObject<{
|
|
73
73
|
accountEpoch: z.ZodNumber;
|
|
74
74
|
state: z.ZodEnum<{
|
|
75
|
-
error: "error";
|
|
76
|
-
unsupported: "unsupported";
|
|
77
75
|
loading: "loading";
|
|
76
|
+
error: "error";
|
|
78
77
|
ready: "ready";
|
|
79
78
|
"signed-out": "signed-out";
|
|
79
|
+
unsupported: "unsupported";
|
|
80
80
|
}>;
|
|
81
81
|
fetchedAtMs: z.ZodNullable<z.ZodNumber>;
|
|
82
82
|
nextRefreshAtMs: z.ZodNumber;
|
|
@@ -117,15 +117,15 @@ export declare const QuotaView: z.ZodObject<{
|
|
|
117
117
|
errors: z.ZodArray<z.ZodObject<{
|
|
118
118
|
area: z.ZodEnum<{
|
|
119
119
|
windows: "windows";
|
|
120
|
-
account: "account";
|
|
121
120
|
credits: "credits";
|
|
122
121
|
spend: "spend";
|
|
123
122
|
resets: "resets";
|
|
123
|
+
account: "account";
|
|
124
124
|
}>;
|
|
125
125
|
code: z.ZodEnum<{
|
|
126
|
+
unsupported: "unsupported";
|
|
126
127
|
"read-failed": "read-failed";
|
|
127
128
|
"invalid-data": "invalid-data";
|
|
128
|
-
unsupported: "unsupported";
|
|
129
129
|
}>;
|
|
130
130
|
message: z.ZodString;
|
|
131
131
|
}, z.core.$strip>>;
|