shennian 0.2.88 → 0.2.90
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/assets/wechat-channel/macos/manifest.json +22 -0
- package/dist/assets/wechat-channel/macos/shennian-wechat-channel-helper +0 -0
- package/dist/bin/shennian.js +1 -1
- package/dist/publish-build-manifest.json +548 -0
- package/dist/scripts/wechat-rpa-confirmation.mjs +5 -97
- package/dist/src/agent-env.js +4 -105
- package/dist/src/agents/adapter.d.ts +6 -0
- package/dist/src/agents/adapter.js +1 -19
- package/dist/src/agents/claude.js +8 -305
- package/dist/src/agents/codex-control.d.ts +35 -0
- package/dist/src/agents/codex-control.js +2 -0
- package/dist/src/agents/codex-utils.js +7 -200
- package/dist/src/agents/codex.d.ts +8 -0
- package/dist/src/agents/codex.js +15 -863
- package/dist/src/agents/command-spec.js +2 -413
- package/dist/src/agents/config-status.js +1 -226
- package/dist/src/agents/cursor.js +1 -249
- package/dist/src/agents/custom.js +4 -271
- package/dist/src/agents/detect.js +1 -56
- package/dist/src/agents/external-channel-instructions.js +10 -94
- package/dist/src/agents/gemini.js +1 -173
- package/dist/src/agents/manager.js +13 -157
- package/dist/src/agents/model-registry/cache.js +1 -37
- package/dist/src/agents/model-registry/discovery.js +2 -187
- package/dist/src/agents/model-registry/parsers.js +4 -447
- package/dist/src/agents/model-registry/runner.js +1 -30
- package/dist/src/agents/model-registry/service.js +1 -78
- package/dist/src/agents/model-registry/types.js +1 -8
- package/dist/src/agents/model-registry.js +1 -18
- package/dist/src/agents/openclaw.js +2 -275
- package/dist/src/agents/opencode.js +1 -231
- package/dist/src/agents/pi-context.js +12 -217
- package/dist/src/agents/pi.js +14 -723
- package/dist/src/agents/platform-instructions.js +9 -54
- package/dist/src/channels/base.d.ts +4 -1
- package/dist/src/channels/base.js +1 -3
- package/dist/src/channels/registry.js +1 -30
- package/dist/src/channels/reply-split.js +10 -89
- package/dist/src/channels/runtime.d.ts +1 -0
- package/dist/src/channels/runtime.js +5 -533
- package/dist/src/channels/secret-registry.d.ts +1 -0
- package/dist/src/channels/secret-registry.js +1 -46
- package/dist/src/channels/websocket.js +8 -378
- package/dist/src/channels/wechat-channel/anchor.d.ts +10 -0
- package/dist/src/channels/wechat-channel/anchor.js +1 -0
- package/dist/src/channels/wechat-channel/client.d.ts +74 -0
- package/dist/src/channels/wechat-channel/client.js +1 -0
- package/dist/src/channels/wechat-channel/cooldown.d.ts +15 -0
- package/dist/src/channels/wechat-channel/cooldown.js +1 -0
- package/dist/src/channels/wechat-channel/fingerprint.d.ts +28 -0
- package/dist/src/channels/wechat-channel/fingerprint.js +1 -0
- package/dist/src/channels/wechat-channel/helper-assets.d.ts +37 -0
- package/dist/src/channels/wechat-channel/helper-assets.js +1 -0
- package/dist/src/channels/wechat-channel/helper-client.d.ts +25 -0
- package/dist/src/channels/wechat-channel/helper-client.js +3 -0
- package/dist/src/channels/wechat-channel/helper-protocol.d.ts +84 -0
- package/dist/src/channels/wechat-channel/helper-protocol.js +1 -0
- package/dist/src/channels/wechat-channel/index.d.ts +17 -0
- package/dist/src/channels/wechat-channel/index.js +1 -0
- package/dist/src/channels/wechat-channel/ledger.d.ts +33 -0
- package/dist/src/channels/wechat-channel/ledger.js +1 -0
- package/dist/src/channels/wechat-channel/media-resolver.d.ts +32 -0
- package/dist/src/channels/wechat-channel/media-resolver.js +1 -0
- package/dist/src/channels/wechat-channel/message-key.d.ts +19 -0
- package/dist/src/channels/wechat-channel/message-key.js +1 -0
- package/dist/src/channels/wechat-channel/observer.d.ts +64 -0
- package/dist/src/channels/wechat-channel/observer.js +1 -0
- package/dist/src/channels/wechat-channel/outbound-ledger.d.ts +69 -0
- package/dist/src/channels/wechat-channel/outbound-ledger.js +2 -0
- package/dist/src/channels/wechat-channel/outbound-sender.d.ts +26 -0
- package/dist/src/channels/wechat-channel/outbound-sender.js +1 -0
- package/dist/src/channels/wechat-channel/preflight.d.ts +37 -0
- package/dist/src/channels/wechat-channel/preflight.js +1 -0
- package/dist/src/channels/wechat-channel/runner.d.ts +34 -0
- package/dist/src/channels/wechat-channel/runner.js +1 -0
- package/dist/src/channels/wechat-channel/runtime.d.ts +45 -0
- package/dist/src/channels/wechat-channel/runtime.js +1 -0
- package/dist/src/channels/wechat-channel/scheduler.d.ts +35 -0
- package/dist/src/channels/wechat-channel/scheduler.js +1 -0
- package/dist/src/channels/wechat-rpa/macos-flow.js +1 -96
- package/dist/src/channels/wechat-rpa/macos.js +6 -48
- package/dist/src/channels/wechat-rpa/normalizer.js +7 -127
- package/dist/src/channels/wechat-rpa.d.ts +21 -0
- package/dist/src/channels/wechat-rpa.js +6 -1022
- package/dist/src/channels/wecom.js +4 -357
- package/dist/src/commands/agent.js +6 -131
- package/dist/src/commands/daemon-windows.js +8 -48
- package/dist/src/commands/daemon.js +19 -1013
- package/dist/src/commands/external-attachments.js +1 -51
- package/dist/src/commands/external.js +1 -137
- package/dist/src/commands/manager.js +2 -389
- package/dist/src/commands/pair-qr.js +1 -6
- package/dist/src/commands/pair.js +9 -287
- package/dist/src/commands/tools.js +1 -34
- package/dist/src/commands/upgrade.js +1 -198
- package/dist/src/config/index.js +1 -35
- package/dist/src/daemon-log.js +6 -58
- package/dist/src/env-path.js +1 -64
- package/dist/src/fs/boundary.js +1 -126
- package/dist/src/fs/handler.js +1 -130
- package/dist/src/fs/security.js +1 -32
- package/dist/src/fs/text-decoder.d.ts +10 -0
- package/dist/src/fs/text-decoder.js +1 -0
- package/dist/src/index.js +2 -404
- package/dist/src/log-reporter.js +1 -16
- package/dist/src/manager/prompt.js +29 -34
- package/dist/src/manager/registry.js +2 -269
- package/dist/src/manager/runtime.js +19 -1003
- package/dist/src/native-fusion/config.js +1 -5
- package/dist/src/native-fusion/opencode-parser.js +3 -123
- package/dist/src/native-fusion/parser-common.js +8 -264
- package/dist/src/native-fusion/parsers.js +8 -729
- package/dist/src/native-fusion/service.d.ts +10 -0
- package/dist/src/native-fusion/service.js +2 -198
- package/dist/src/native-fusion/state.js +1 -22
- package/dist/src/native-fusion/types.js +1 -1
- package/dist/src/region.js +1 -88
- package/dist/src/relay/client.js +1 -343
- package/dist/src/session/archive-zip.js +1 -220
- package/dist/src/session/handlers/agent-config.js +1 -150
- package/dist/src/session/handlers/agents.js +1 -55
- package/dist/src/session/handlers/chat.js +2 -733
- package/dist/src/session/handlers/control.js +1 -55
- package/dist/src/session/handlers/fs.js +1 -747
- package/dist/src/session/handlers/session-refresh.js +1 -35
- package/dist/src/session/handlers/skills.js +1 -121
- package/dist/src/session/handlers/title.js +1 -60
- package/dist/src/session/handlers/tool-detail.d.ts +3 -0
- package/dist/src/session/handlers/tool-detail.js +1 -0
- package/dist/src/session/manager.d.ts +3 -0
- package/dist/src/session/manager.js +1 -261
- package/dist/src/session/projection.js +1 -54
- package/dist/src/session/queue.js +4 -317
- package/dist/src/session/remote-attachments.js +1 -72
- package/dist/src/session/store.js +3 -109
- package/dist/src/session/types.d.ts +4 -0
- package/dist/src/session/types.js +1 -4
- package/dist/src/skills/registry.js +15 -148
- package/dist/src/skills/setup.js +1 -101
- package/dist/src/tools/markdown-to-pdf.js +10 -346
- package/dist/src/upgrade/engine.js +3 -347
- package/package.json +3 -2
- package/dist/scripts/wechat-rpa-download-candidates.mjs +0 -105
|
@@ -1,200 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export const CODEX_APP_SERVER_CLIENT_INFO = {
|
|
9
|
-
name: 'codex-tui',
|
|
10
|
-
title: 'Codex TUI',
|
|
11
|
-
version: '0.0.0',
|
|
12
|
-
};
|
|
13
|
-
const CODEX_COLLAB_AGENT_TOOL_NAMES = new Set([
|
|
14
|
-
'spawnAgent',
|
|
15
|
-
'sendInput',
|
|
16
|
-
'resumeAgent',
|
|
17
|
-
'wait',
|
|
18
|
-
'closeAgent',
|
|
19
|
-
'waitAgent',
|
|
20
|
-
]);
|
|
21
|
-
export function isCodexCollabAgentToolName(name) {
|
|
22
|
-
return CODEX_COLLAB_AGENT_TOOL_NAMES.has(name);
|
|
23
|
-
}
|
|
24
|
-
export function isCodexCollabAgentItem(item) {
|
|
25
|
-
if (item.type === 'collabAgentToolCall')
|
|
26
|
-
return true;
|
|
27
|
-
if (item.type === 'collabAgentMonitor')
|
|
28
|
-
return true;
|
|
29
|
-
const tool = typeof item.tool === 'string' ? item.tool : '';
|
|
30
|
-
if (tool && isCodexCollabAgentToolName(tool))
|
|
31
|
-
return true;
|
|
32
|
-
return typeof item.senderThreadId === 'string' && Array.isArray(item.receiverThreadIds);
|
|
33
|
-
}
|
|
34
|
-
export function isCodexLegacyCollabAgentItem(item) {
|
|
35
|
-
if (item.type === 'collab_agent_tool_call' || item.type === 'collabAgentToolCall')
|
|
36
|
-
return true;
|
|
37
|
-
if (item.type === 'collab_agent_monitor' || item.type === 'collabAgentMonitor')
|
|
38
|
-
return true;
|
|
39
|
-
return !!item.tool && isCodexCollabAgentToolName(item.tool);
|
|
40
|
-
}
|
|
41
|
-
export function normalizeTitleText(text) {
|
|
42
|
-
return text
|
|
43
|
-
.replace(/!\[[^\]]*]\([^)]+\)/g, '')
|
|
44
|
-
.replace(/\s+/g, ' ')
|
|
45
|
-
.trim();
|
|
46
|
-
}
|
|
47
|
-
export function normalizeCodexModelId(modelId) {
|
|
48
|
-
const trimmed = modelId?.trim();
|
|
49
|
-
if (!trimmed)
|
|
50
|
-
return undefined;
|
|
51
|
-
return trimmed.toLowerCase() === 'openai' ? undefined : trimmed;
|
|
52
|
-
}
|
|
53
|
-
export function normalizeCodexReasoningEffort(reasoningEffort) {
|
|
54
|
-
const trimmed = reasoningEffort?.trim();
|
|
55
|
-
return trimmed || undefined;
|
|
56
|
-
}
|
|
57
|
-
export function isMissingCodexRolloutError(error) {
|
|
58
|
-
const message = error instanceof Error ? error.message : String(error ?? '');
|
|
59
|
-
return /\bno rollout found for thread id\b/i.test(message);
|
|
60
|
-
}
|
|
61
|
-
export function isCodexUnsupportedEffortError(error) {
|
|
62
|
-
const message = error instanceof Error ? error.message : String(error ?? '');
|
|
63
|
-
return (/\bunknown field\b.*\beffort\b/i.test(message) ||
|
|
64
|
-
/\binvalid.*\beffort\b/i.test(message) ||
|
|
65
|
-
/\bunsupported.*\beffort\b/i.test(message) ||
|
|
66
|
-
/\breasoning effort\b/i.test(message));
|
|
67
|
-
}
|
|
68
|
-
export function extractAppServerErrorMessage(params) {
|
|
69
|
-
if (typeof params.message === 'string' && params.message.trim())
|
|
70
|
-
return params.message.trim();
|
|
71
|
-
const error = params.error;
|
|
72
|
-
if (typeof error === 'string' && error.trim())
|
|
73
|
-
return error.trim();
|
|
74
|
-
if (typeof error === 'object' && error !== null) {
|
|
75
|
-
const message = error.message;
|
|
76
|
-
if (typeof message === 'string' && message.trim())
|
|
77
|
-
return message.trim();
|
|
78
|
-
}
|
|
79
|
-
return 'codex app-server error';
|
|
80
|
-
}
|
|
81
|
-
export function isTransientCodexErrorMessage(message) {
|
|
82
|
-
return /\bReconnecting\.\.\.\s*\d+\/\d+/i.test(message);
|
|
83
|
-
}
|
|
84
|
-
export function formatTransientCodexStatus(message) {
|
|
85
|
-
const match = message.match(/\bReconnecting\.\.\.\s*(\d+\/\d+)/i);
|
|
86
|
-
if (!match)
|
|
87
|
-
return '';
|
|
88
|
-
return `Codex API 暂时不可用,正在重试 ${match[1]}...`;
|
|
89
|
-
}
|
|
90
|
-
export function formatCodexErrorMessage(message) {
|
|
91
|
-
const statusMatch = message.match(/unexpected status\s+(\d+)\s+([^:,]+)(?::\s*([^,]+))?(?:,\s*url:\s*([^,\s]+))?(?:,\s*request id:\s*([^\s,]+))?/i);
|
|
92
|
-
if (!statusMatch)
|
|
93
|
-
return message;
|
|
94
|
-
const [, status, statusText, detail, url, requestId] = statusMatch;
|
|
95
|
-
const parts = [
|
|
96
|
-
`Codex API 返回 ${status} ${statusText.trim()}`,
|
|
97
|
-
detail?.trim() ? `:${detail.trim()}` : '',
|
|
98
|
-
url ? `\n上游地址:${url}` : '',
|
|
99
|
-
requestId ? `\nrequest id:${requestId}` : '',
|
|
100
|
-
];
|
|
101
|
-
return parts.join('');
|
|
102
|
-
}
|
|
103
|
-
const GIT_DIRECTIVE_LINE_RE = /^\s*::git-[a-z-]+\{[^\n]*\}\s*$/gm;
|
|
104
|
-
export function stripGitDirectiveArtifacts(text) {
|
|
105
|
-
if (!text)
|
|
106
|
-
return '';
|
|
107
|
-
const normalized = text.replace(/\r\n/g, '\n');
|
|
108
|
-
const hadDirective = /(^|\n)\s*::git-[a-z-]+\{[^\n]*\}\s*(?=\n|$)/.test(normalized);
|
|
109
|
-
if (!hadDirective)
|
|
110
|
-
return normalized;
|
|
111
|
-
const stripped = normalized.replace(GIT_DIRECTIVE_LINE_RE, '');
|
|
112
|
-
if (!stripped.trim())
|
|
113
|
-
return '';
|
|
114
|
-
return stripped.replace(/[ \t]+\n/g, '\n').replace(/\n+$/g, '');
|
|
115
|
-
}
|
|
116
|
-
export function safeStringify(value) {
|
|
117
|
-
if (value == null)
|
|
118
|
-
return '';
|
|
119
|
-
if (typeof value === 'string')
|
|
120
|
-
return value;
|
|
121
|
-
try {
|
|
122
|
-
return JSON.stringify(value);
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
return String(value);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
export function normalizeCodexStderr(stderr) {
|
|
129
|
-
const normalized = stderr
|
|
130
|
-
.split(/\r?\n/)
|
|
131
|
-
.map((line) => line.trim())
|
|
132
|
-
.filter(Boolean)
|
|
133
|
-
.filter((line) => !isIgnorableCodexStderrLine(line))
|
|
134
|
-
.join('\n');
|
|
135
|
-
if (looksLikeMissingNodeOnWindows(normalized)) {
|
|
136
|
-
return 'Codex 启动失败:系统找不到 node。请重新安装 Node.js,或把 Node.js 安装目录(通常是 C:\\Program Files\\nodejs)加入 Windows PATH 后重启神念。';
|
|
137
|
-
}
|
|
138
|
-
return normalized;
|
|
139
|
-
}
|
|
140
|
-
export function looksLikeMissingNodeOnWindows(text) {
|
|
141
|
-
if (!text)
|
|
142
|
-
return false;
|
|
143
|
-
return (/["']?node["']?/i.test(text) &&
|
|
144
|
-
(/not recognized as an internal or external command/i.test(text) ||
|
|
145
|
-
text.includes('不是内部或外部命令') ||
|
|
146
|
-
text.includes('不是可运行的程序') ||
|
|
147
|
-
text.includes('��������') ||
|
|
148
|
-
text.includes('����')));
|
|
149
|
-
}
|
|
150
|
-
export function normalizeTerminalText(text) {
|
|
151
|
-
const escape = String.fromCharCode(27);
|
|
152
|
-
const bell = String.fromCharCode(7);
|
|
153
|
-
const csiPattern = new RegExp(`${escape}\\[[0-?]*[ -/]*[@-~]`, 'g');
|
|
154
|
-
const oscPattern = new RegExp(`${escape}\\][^${bell}]*(?:${bell}|${escape}\\\\)`, 'g');
|
|
155
|
-
return text
|
|
156
|
-
.replace(csiPattern, ' ')
|
|
157
|
-
.replace(oscPattern, ' ')
|
|
158
|
-
.split('')
|
|
159
|
-
.map((char) => {
|
|
160
|
-
const code = char.charCodeAt(0);
|
|
161
|
-
return (code <= 8 || code === 11 || code === 12 || (code >= 14 && code <= 31) || code === 127) ? ' ' : char;
|
|
162
|
-
})
|
|
163
|
-
.join('')
|
|
164
|
-
.replace(/\s+/g, ' ')
|
|
165
|
-
.trim();
|
|
166
|
-
}
|
|
167
|
-
export function looksLikeCodexInteractiveAuthPrompt(text) {
|
|
168
|
-
if (!text)
|
|
169
|
-
return false;
|
|
170
|
-
const normalized = text.toLowerCase();
|
|
171
|
-
return (normalized.includes('welcome to codex') ||
|
|
172
|
-
normalized.includes('sign in with chatgpt') ||
|
|
173
|
-
normalized.includes('provide your own api key') ||
|
|
174
|
-
normalized.includes('press enter to continue'));
|
|
175
|
-
}
|
|
176
|
-
export function isIgnorableCodexStderrLine(line) {
|
|
177
|
-
return [
|
|
178
|
-
/WARNING: proceeding, even though we could not update PATH:/i,
|
|
179
|
-
/Reading additional input from stdin\.\.\./i,
|
|
180
|
-
/failed to record rollout items: failed to queue rollout items: channel closed/i,
|
|
181
|
-
].some((pattern) => pattern.test(line));
|
|
182
|
-
}
|
|
183
|
-
export function looksLikeFatalCodexStderr(stderr) {
|
|
184
|
-
if (!stderr)
|
|
185
|
-
return false;
|
|
186
|
-
return [
|
|
187
|
-
/\bunauthorized\b/i,
|
|
188
|
-
/\bforbidden\b/i,
|
|
189
|
-
/\bpermission denied\b/i,
|
|
190
|
-
/\brate limit\b/i,
|
|
191
|
-
/\binsufficient quota\b/i,
|
|
192
|
-
/\bapi key\b/i,
|
|
193
|
-
/\bauth/i,
|
|
194
|
-
/\bnetwork\b/i,
|
|
195
|
-
/\btimeout\b/i,
|
|
196
|
-
/\bnot found\b/i,
|
|
197
|
-
/\berror\b/i,
|
|
198
|
-
/\bfailed\b/i,
|
|
199
|
-
].some((pattern) => pattern.test(stderr));
|
|
200
|
-
}
|
|
1
|
+
function g(e){return(c(e).split(`
|
|
2
|
+
`).find(o=>o.trim())??"Shennian").trim().slice(0,80)||"Shennian"}const m={name:"codex-tui",title:"Codex TUI",version:"0.0.0"},u=new Set(["spawnAgent","sendInput","resumeAgent","wait","closeAgent","waitAgent"]);function a(e){return u.has(e)}function b(e){if(e.type==="collabAgentToolCall"||e.type==="collabAgentMonitor")return!0;const t=typeof e.tool=="string"?e.tool:"";return t&&a(t)?!0:typeof e.senderThreadId=="string"&&Array.isArray(e.receiverThreadIds)}function x(e){return e.type==="collab_agent_tool_call"||e.type==="collabAgentToolCall"||e.type==="collab_agent_monitor"||e.type==="collabAgentMonitor"?!0:!!e.tool&&a(e.tool)}function c(e){return e.replace(/!\[[^\]]*]\([^)]+\)/g,"").replace(/\s+/g," ").trim()}function C(e){const t=e?.trim();if(t)return t.toLowerCase()==="openai"?void 0:t}function A(e){return e?.trim()||void 0}function h(e){const t=e instanceof Error?e.message:String(e??"");return/\bno rollout found for thread id\b/i.test(t)}function y(e){const t=e instanceof Error?e.message:String(e??"");return/\bunknown field\b.*\beffort\b/i.test(t)||/\binvalid.*\beffort\b/i.test(t)||/\bunsupported.*\beffort\b/i.test(t)||/\breasoning effort\b/i.test(t)}function E(e){if(typeof e.message=="string"&&e.message.trim())return e.message.trim();const t=e.error;if(typeof t=="string"&&t.trim())return t.trim();if(typeof t=="object"&&t!==null){const r=t.message;if(typeof r=="string"&&r.trim())return r.trim()}return"codex app-server error"}function T(e){return/\bReconnecting\.\.\.\s*\d+\/\d+/i.test(e)}function I(e){const t=e.match(/\bReconnecting\.\.\.\s*(\d+\/\d+)/i);return t?`Codex API \u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u91CD\u8BD5 ${t[1]}...`:""}function S(e){const t=e.match(/unexpected status\s+(\d+)\s+([^:,]+)(?::\s*([^,]+))?(?:,\s*url:\s*([^,\s]+))?(?:,\s*request id:\s*([^\s,]+))?/i);if(!t)return e;const[,r,o,s,i,n]=t;return[`Codex API \u8FD4\u56DE ${r} ${o.trim()}`,s?.trim()?`\uFF1A${s.trim()}`:"",i?`
|
|
3
|
+
\u4E0A\u6E38\u5730\u5740\uFF1A${i}`:"",n?`
|
|
4
|
+
request id\uFF1A${n}`:""].join("")}const l=/^\s*::git-[a-z-]+\{[^\n]*\}\s*$/gm;function w(e){if(!e)return"";const t=e.replace(/\r\n/g,`
|
|
5
|
+
`);if(!/(^|\n)\s*::git-[a-z-]+\{[^\n]*\}\s*(?=\n|$)/.test(t))return t;const o=t.replace(l,"");return o.trim()?o.replace(/[ \t]+\n/g,`
|
|
6
|
+
`).replace(/\n+$/g,""):""}function _(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function L(e){const t=e.split(/\r?\n/).map(r=>r.trim()).filter(Boolean).filter(r=>!f(r)).join(`
|
|
7
|
+
`);return d(t)?"Codex \u542F\u52A8\u5931\u8D25\uFF1A\u7CFB\u7EDF\u627E\u4E0D\u5230 node\u3002\u8BF7\u91CD\u65B0\u5B89\u88C5 Node.js\uFF0C\u6216\u628A Node.js \u5B89\u88C5\u76EE\u5F55\uFF08\u901A\u5E38\u662F C:\\Program Files\\nodejs\uFF09\u52A0\u5165 Windows PATH \u540E\u91CD\u542F\u795E\u5FF5\u3002":t}function d(e){return e?/["']?node["']?/i.test(e)&&(/not recognized as an internal or external command/i.test(e)||e.includes("\u4E0D\u662F\u5185\u90E8\u6216\u5916\u90E8\u547D\u4EE4")||e.includes("\u4E0D\u662F\u53EF\u8FD0\u884C\u7684\u7A0B\u5E8F")||e.includes("\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD")||e.includes("\uFFFD\uFFFD\uFFFD\uFFFD")):!1}function $(e){const o=new RegExp("\x1B\\[[0-?]*[ -/]*[@-~]","g"),s=new RegExp("\x1B\\][^\x07]*(?:\x07|\x1B\\\\)","g");return e.replace(o," ").replace(s," ").split("").map(i=>{const n=i.charCodeAt(0);return n<=8||n===11||n===12||n>=14&&n<=31||n===127?" ":i}).join("").replace(/\s+/g," ").trim()}function z(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("welcome to codex")||t.includes("sign in with chatgpt")||t.includes("provide your own api key")||t.includes("press enter to continue")}function f(e){return[/WARNING: proceeding, even though we could not update PATH:/i,/Reading additional input from stdin\.\.\./i,/failed to record rollout items: failed to queue rollout items: channel closed/i].some(t=>t.test(e))}function N(e){return e?[/\bunauthorized\b/i,/\bforbidden\b/i,/\bpermission denied\b/i,/\brate limit\b/i,/\binsufficient quota\b/i,/\bapi key\b/i,/\bauth/i,/\bnetwork\b/i,/\btimeout\b/i,/\bnot found\b/i,/\berror\b/i,/\bfailed\b/i].some(t=>t.test(e)):!1}export{m as CODEX_APP_SERVER_CLIENT_INFO,E as extractAppServerErrorMessage,S as formatCodexErrorMessage,I as formatTransientCodexStatus,b as isCodexCollabAgentItem,a as isCodexCollabAgentToolName,x as isCodexLegacyCollabAgentItem,y as isCodexUnsupportedEffortError,f as isIgnorableCodexStderrLine,h as isMissingCodexRolloutError,T as isTransientCodexErrorMessage,z as looksLikeCodexInteractiveAuthPrompt,N as looksLikeFatalCodexStderr,d as looksLikeMissingNodeOnWindows,g as makeThreadTitle,C as normalizeCodexModelId,A as normalizeCodexReasoningEffort,L as normalizeCodexStderr,$ as normalizeTerminalText,c as normalizeTitleText,_ as safeStringify,w as stripGitDirectiveArtifacts};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AgentAdapter } from './adapter.js';
|
|
2
2
|
import type { ChatAttachmentMeta, ExternalChannelSessionStatus } from '@shennian/wire';
|
|
3
|
+
import type { SessionRunPhase } from '@shennian/wire';
|
|
3
4
|
export { isCodexUnsupportedEffortError, isMissingCodexRolloutError, normalizeCodexModelId, normalizeCodexReasoningEffort, } from './codex-utils.js';
|
|
4
5
|
export declare class CodexAdapter extends AgentAdapter {
|
|
5
6
|
private readonly options;
|
|
@@ -40,6 +41,12 @@ export declare class CodexAdapter extends AgentAdapter {
|
|
|
40
41
|
resume(agentSessionId: string): Promise<void>;
|
|
41
42
|
setTitle(agentSessionId: string, title: string, workDir?: string): Promise<void>;
|
|
42
43
|
stop(): Promise<void>;
|
|
44
|
+
getStatus(): Promise<{
|
|
45
|
+
active: boolean;
|
|
46
|
+
runId?: string | null;
|
|
47
|
+
runPhase?: SessionRunPhase | null;
|
|
48
|
+
canStop?: boolean;
|
|
49
|
+
}>;
|
|
43
50
|
private spawnCodex;
|
|
44
51
|
private spawnAppServer;
|
|
45
52
|
private ensureAppServer;
|
|
@@ -49,6 +56,7 @@ export declare class CodexAdapter extends AgentAdapter {
|
|
|
49
56
|
private interruptActiveTurn;
|
|
50
57
|
private sendRpc;
|
|
51
58
|
private handleAppServerMessage;
|
|
59
|
+
private mapThreadStatusToRunPhase;
|
|
52
60
|
private handleAppServerNonJsonStdout;
|
|
53
61
|
private failAppServerStartup;
|
|
54
62
|
private handleAppServerCompletedItem;
|