@wacry/codeks-bridge 0.0.16 → 0.0.18
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/NOTICE +3 -2
- package/README.md +1 -1
- package/catalog/README.md +11 -6
- package/catalog/codex-auto-review.json +4 -2
- package/catalog/gpt-5.5.json +3 -2
- package/catalog/gpt-5.6-luna.json +4 -2
- package/catalog/gpt-5.6-sol.json +4 -2
- package/catalog/gpt-5.6-terra.json +4 -2
- package/catalog/gpt-6-astra.json +4 -2
- package/catalog/gpt-6-luna.json +4 -2
- package/catalog/gpt-6-sol.json +4 -2
- package/catalog/gpt-6.1-sol.json +4 -2
- package/catalog/gpt-6.1-terra.json +143 -0
- package/catalog/gpt-daybreak-blue-latest.json +4 -2
- package/catalog/gpt-daybreak-red-latest.json +4 -2
- package/catalog/gpt-reserve.json +3 -2
- package/dist/inspect/view.d.ts +21 -0
- package/dist/inspect/view.js +90 -1
- package/dist/model-catalog.d.ts +1 -1
- package/dist/model-catalog.js +1 -1
- package/dist/tool-calls.d.ts +5 -0
- package/dist/tool-calls.js +8 -0
- package/docs/config.md +1 -1
- package/docs/design.md +1 -1
- package/docs/inspect.md +20 -2
- package/package.json +1 -1
- package/ui/app.css +1 -0
- package/ui/detail.js +45 -25
- package/ui/events.js +1 -1
- package/ui/labels.js +13 -2
- package/ui/list.js +11 -13
- package/ui/status.js +49 -0
package/ui/list.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
// Exchange list: filtering, flat or thread-grouped rows, keyed row reuse and keyboard moves.
|
|
2
2
|
import { h, fmtTime, fmtDur, fmtTok, fmtBytes, oneLine, shortId, hashHue, put } from './dom.js';
|
|
3
3
|
import { KIND_LABEL, OUTCOME_LABEL, callLabel } from './labels.js';
|
|
4
|
+
import { exchangeClass, needsAttention, responseClass, upstreamCalls } from './status.js';
|
|
4
5
|
|
|
5
6
|
// Same-conversation key. Falls back to the window id prefix ("<thread>:<n>") for captures without thread headers.
|
|
6
7
|
export const threadKey = (s) => s.thread?.thread_id ?? s.thread?.session_id ?? (s.thread?.window_id ? String(s.thread.window_id).split(':')[0] : null);
|
|
7
|
-
export const OUTCOME_CLASS = { active: 'info', completed: 'ok', incomplete: 'warn', failed: 'bad', error: 'bad', aborted: 'bad' };
|
|
8
8
|
|
|
9
9
|
// Imported Detail objects may lack the Summary-only fields (older or hand-made exports); derive them.
|
|
10
|
-
const callsOf = (s) => s.upstream_calls ?? s.upstream?.map((c) => ({ label: c.label, status: c.response?.status ?? null, end: c.response?.end ?? (c.error ? 'error' : null) })) ?? [];
|
|
11
10
|
const requestBytes = (s) => s.bytes?.request ?? s.client?.request?.body?.bytes ?? null;
|
|
12
11
|
|
|
13
|
-
export const isErrorish =
|
|
14
|
-
callsOf(s).some((c) => (c.status ?? 0) >= 400 || c.end === 'error' || c.end === 'cancelled');
|
|
12
|
+
export const isErrorish = needsAttention;
|
|
15
13
|
|
|
16
14
|
export const byNewest = (a, b) => (b.started_at ?? 0) - (a.started_at ?? 0) || (b.seq ?? 0) - (a.seq ?? 0);
|
|
17
15
|
|
|
18
16
|
export const FILTER_CHIPS = [
|
|
19
|
-
['errors', '
|
|
17
|
+
['errors', '需关注', '失败、客户端断开、未完成,或本次输出含无效工具调用;不包含仅在历史输入中的工具诊断'],
|
|
20
18
|
['compaction', '仅压缩', 'kind = compaction'],
|
|
21
19
|
['active', '进行中', '仍在传输'],
|
|
22
20
|
['hideInvalid', '隐藏无效', '隐藏 kind = invalid(无法解析或路由失败)'],
|
|
@@ -28,8 +26,8 @@ function searchText(s) {
|
|
|
28
26
|
if (t === undefined) {
|
|
29
27
|
const th = s.thread ?? {};
|
|
30
28
|
t = [s.id, s.model, s.adapter, s.api, typeof s.upstream === 'string' ? s.upstream : s.route?.upstream, s.upstream_model, s.kind, KIND_LABEL[s.kind], s.outcome, OUTCOME_LABEL[s.outcome],
|
|
31
|
-
s.status, s.error, s.preview, th.session_id, th.thread_id, th.parent_thread_id, th.subagent, th.window_id,
|
|
32
|
-
...
|
|
29
|
+
s.status, s.error, s.preview, s.tool_error_count > 0 ? '无效工具调用' : null, th.session_id, th.thread_id, th.parent_thread_id, th.subagent, th.window_id,
|
|
30
|
+
...upstreamCalls(s).flatMap((c) => [c.label, callLabel(c.label), c.status, c.end])]
|
|
33
31
|
.filter((x) => x != null).join(' ').toLowerCase();
|
|
34
32
|
searchCache.set(s, t);
|
|
35
33
|
}
|
|
@@ -57,14 +55,12 @@ function usageLine(u) {
|
|
|
57
55
|
return parts.length ? h('span', { class: 'x-usage', title: JSON.stringify(u, null, 1) }, parts.join(' · ')) : null;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
const callClass = (c) => ((c.status ?? 0) >= 400 || c.end === 'error' ? 'bad' : c.end === 'active' ? 'info' : c.end === 'cancelled' ? 'warn' : c.status ? 'ok' : 'dim');
|
|
61
|
-
|
|
62
58
|
function rowEl(s, flat, onSelect) {
|
|
63
59
|
const th = s.thread ?? {};
|
|
64
60
|
const el = h('div', { class: `xrow o-${s.outcome}${s.active ? ' active' : ''}`, dataset: { id: s.id }, title: `${s.id} · ${s.kind}` });
|
|
65
61
|
const key = threadKey(s);
|
|
66
62
|
if (key) { el.classList.add('hued'); el.style.setProperty('--thue', hashHue(key)); }
|
|
67
|
-
const
|
|
63
|
+
const severity = exchangeClass(s);
|
|
68
64
|
put(el,
|
|
69
65
|
h('div', { class: 'x1' },
|
|
70
66
|
h('span', { class: 'x-time' }, fmtTime(s.started_at)),
|
|
@@ -72,15 +68,17 @@ function rowEl(s, flat, onSelect) {
|
|
|
72
68
|
h('span', { class: 'x-model', title: s.upstream_model ? `上游模型 ${s.upstream_model}` : '' },
|
|
73
69
|
s.model ?? '(无模型)', s.adapter ? h('span', { class: 'dim' }, ` → ${s.adapter}`) : null),
|
|
74
70
|
h('span', { class: 'grow' }),
|
|
75
|
-
h('span', { class: `chip ${
|
|
71
|
+
h('span', { class: `chip ${severity}`, title: s.error ?? '' }, OUTCOME_LABEL[s.outcome] ?? s.outcome),
|
|
72
|
+
s.status != null ? h('span', { class: 'chip dim', title: 'HTTP 状态码不代表流式响应已完成' }, `HTTP ${s.status}`) : null,
|
|
73
|
+
s.tool_error_count > 0 ? h('span', { class: 'chip bad', title: '本次交付的无效工具调用;响应完成与工具调用有效性分别记录' }, `无效工具调用 ${s.tool_error_count}`) : null,
|
|
76
74
|
h('span', { class: 'x-dur' }, s.active ? '…' : fmtDur(s.duration_ms))),
|
|
77
75
|
h('div', { class: 'x2' },
|
|
78
|
-
|
|
76
|
+
upstreamCalls(s).map((c) => h('span', { class: `chip sm ${responseClass(c)}`, title: c.failure?.message ?? `end: ${c.end ?? '–'}` }, `${callLabel(c.label)}${c.status != null ? ` HTTP ${c.status}` : ' …'}`)),
|
|
79
77
|
flat && th.subagent ? h('span', { class: 'chip sm sub', title: '子代理(x-openai-subagent)' }, `子代理 ${th.subagent}`) : null,
|
|
80
78
|
flat && th.parent_thread_id ? h('span', { class: 'chip sm dim', title: `父线程 ${th.parent_thread_id}` }, `父 ${shortId(th.parent_thread_id)}`) : null,
|
|
81
79
|
usageLine(s.usage),
|
|
82
80
|
requestBytes(s) != null ? h('span', { class: 'x-size dim', title: '客户端请求大小' }, fmtBytes(requestBytes(s))) : null),
|
|
83
|
-
s.error ? h('div', { class:
|
|
81
|
+
s.error ? h('div', { class: `x3 ${severity === 'warn' ? 'warning-text' : 'err'}`, title: s.error }, severity === 'warn' && s.outcome === 'aborted' ? '客户端连接已断开,原因未确定。' : oneLine(s.error, 160)) : null,
|
|
84
82
|
s.preview ? h('div', { class: 'x3' }, oneLine(s.preview, 200)) : null);
|
|
85
83
|
el.addEventListener('click', (e) => onSelect(s.id, e));
|
|
86
84
|
return el;
|
package/ui/status.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Display transport outcomes independently from diagnostics about model output.
|
|
2
|
+
import { parseEvents } from './events.js';
|
|
3
|
+
import { tryJson } from './dom.js';
|
|
4
|
+
|
|
5
|
+
export const OUTCOME_CLASS = { active: 'info', completed: 'ok', incomplete: 'warn', failed: 'bad', error: 'bad', aborted: 'warn' };
|
|
6
|
+
|
|
7
|
+
export function responseFailure(resp, error) {
|
|
8
|
+
if (resp?.failure) return resp.failure;
|
|
9
|
+
if ((resp?.status ?? 0) >= 400) return { kind: 'http', message: resp.error ?? `HTTP ${resp.status}` };
|
|
10
|
+
// Older exports lack classified failures. Preserve their explicit protocol and
|
|
11
|
+
// transport errors instead of interpreting a cancelled socket as success.
|
|
12
|
+
if (resp && !Object.hasOwn(resp, 'failure')) {
|
|
13
|
+
const events = parseEvents(resp);
|
|
14
|
+
const json = events ? events.map(e => e.json) : [tryJson(resp.body?.text).value];
|
|
15
|
+
const failed = json.find(j => j && (j.type === 'error' || j.type === 'response.failed' || j.status === 'failed' || j.error));
|
|
16
|
+
if (failed) return { kind: 'protocol', message: failed.error?.message ?? failed.response?.error?.message ?? failed.message ?? '上游报告失败' };
|
|
17
|
+
}
|
|
18
|
+
if (resp?.end === 'error' || error) return { kind: 'transport', message: error ?? resp.error };
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function responseClass(resp, error) {
|
|
23
|
+
if (responseFailure(resp, error)) return 'bad';
|
|
24
|
+
if (!resp) return 'dim';
|
|
25
|
+
if (resp.end === 'active') return 'info';
|
|
26
|
+
if (resp.end === 'cancelled') return 'warn';
|
|
27
|
+
return resp.status ? 'ok' : 'dim';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function exchangeClass(exchange) {
|
|
31
|
+
if ((exchange.status ?? 0) >= 400 || responseFailure(exchange.client?.response)) return 'bad';
|
|
32
|
+
return OUTCOME_CLASS[exchange.outcome] ?? 'dim';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Full captures contain protocol evidence that older call summaries omit. */
|
|
36
|
+
export function upstreamCalls(exchange) {
|
|
37
|
+
if (!Array.isArray(exchange.upstream)) return exchange.upstream_calls ?? [];
|
|
38
|
+
return exchange.upstream.map(call => ({
|
|
39
|
+
...call.response, label: call.label,
|
|
40
|
+
error: call.error ?? call.response?.error,
|
|
41
|
+
end: call.response?.end ?? (call.error ? 'error' : null),
|
|
42
|
+
failure: responseFailure(call.response, call.error),
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function needsAttention(exchange) {
|
|
47
|
+
if (['failed', 'error', 'aborted', 'incomplete'].includes(exchange.outcome) || exchangeClass(exchange) === 'bad' || exchange.tool_error_count > 0) return true;
|
|
48
|
+
return upstreamCalls(exchange).some(c => responseClass(c) === 'bad' || c.end === 'cancelled');
|
|
49
|
+
}
|