oh-my-knowledge 0.51.2 → 0.52.0
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 +27 -6
- package/README.zh.md +27 -6
- package/dist/assets/agent-skills/omk/SKILL.md +8 -8
- package/dist/observability/codex-conversation-index.d.ts +88 -0
- package/dist/observability/codex-conversation-index.js +566 -0
- package/dist/observability/codex-protocol.d.ts +12 -0
- package/dist/observability/codex-protocol.js +78 -0
- package/dist/observability/codex-tool-status.d.ts +16 -0
- package/dist/observability/codex-tool-status.js +114 -0
- package/dist/observability/codex-trace-adapter.js +342 -119
- package/dist/observability/conversation-catalog.d.ts +38 -0
- package/dist/observability/conversation-catalog.js +573 -0
- package/dist/observability/conversation-index-process.d.ts +1 -0
- package/dist/observability/conversation-index-process.js +31 -0
- package/dist/observability/conversation-view-model.d.ts +5 -0
- package/dist/observability/conversation-view-model.js +100 -0
- package/dist/observability/experience.d.ts +3 -1
- package/dist/observability/experience.js +248 -7
- package/dist/observability/inbox.js +40 -2
- package/dist/observability/knowledge-debugger.d.ts +4 -0
- package/dist/observability/knowledge-debugger.js +364 -0
- package/dist/observability/polling-subscription-hub.d.ts +27 -0
- package/dist/observability/polling-subscription-hub.js +149 -0
- package/dist/observability/source-record-archive.d.ts +13 -0
- package/dist/observability/source-record-archive.js +324 -0
- package/dist/observability/task-window.d.ts +8 -0
- package/dist/observability/task-window.js +36 -0
- package/dist/observability/trace-ir.d.ts +66 -1
- package/dist/observability/trace-source.d.ts +1 -0
- package/dist/observability/trace-source.js +12 -5
- package/dist/observability/turn-index.d.ts +3 -0
- package/dist/observability/turn-index.js +251 -0
- package/dist/renderer/conversation-renderer.d.ts +9 -0
- package/dist/renderer/conversation-renderer.js +410 -0
- package/dist/renderer/icons.js +1 -0
- package/dist/renderer/inline-markdown.d.ts +6 -0
- package/dist/renderer/inline-markdown.js +158 -0
- package/dist/renderer/knowledge-debugger-renderer.d.ts +9 -0
- package/dist/renderer/knowledge-debugger-renderer.js +2280 -0
- package/dist/renderer/observation-inbox-renderer.js +9 -0
- package/dist/renderer/skill-list-renderer.js +2 -1
- package/dist/renderer/trajectory-live.d.ts +42 -0
- package/dist/renderer/trajectory-live.js +258 -0
- package/dist/renderer/trajectory-routing.d.ts +60 -0
- package/dist/renderer/trajectory-routing.js +351 -0
- package/dist/server/report-server.d.ts +4 -1
- package/dist/server/report-server.js +274 -6
- package/dist/types/observability.d.ts +225 -1
- package/package.json +8 -5
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { isToolResultFailureText } from './text-signals.js';
|
|
2
|
+
/** Normalize Codex status values before source adapters project Trace IR. */
|
|
3
|
+
export function codexToolStatusFromValue(value) {
|
|
4
|
+
const status = stringValue(value)?.toLowerCase();
|
|
5
|
+
if (status === 'failed' || status === 'error')
|
|
6
|
+
return 'failure';
|
|
7
|
+
if (status === 'cancelled' || status === 'canceled')
|
|
8
|
+
return 'cancelled';
|
|
9
|
+
if (status === 'success' || status === 'succeeded' || status === 'completed' || status === 'complete') {
|
|
10
|
+
return 'success';
|
|
11
|
+
}
|
|
12
|
+
return 'unknown';
|
|
13
|
+
}
|
|
14
|
+
/** Runtime end records are authoritative even when they only expose an Ok/Err envelope. */
|
|
15
|
+
export function codexRuntimeToolOutcome(end) {
|
|
16
|
+
if (!end)
|
|
17
|
+
return { status: 'unknown', present: false };
|
|
18
|
+
if (end.status !== undefined) {
|
|
19
|
+
const status = codexToolStatusFromValue(end.status);
|
|
20
|
+
if (status === 'cancelled')
|
|
21
|
+
return { status, present: true };
|
|
22
|
+
if (status === 'failure' || end.isError === true) {
|
|
23
|
+
return { status: 'failure', present: true };
|
|
24
|
+
}
|
|
25
|
+
if (status === 'success')
|
|
26
|
+
return { status, present: true };
|
|
27
|
+
return { status: 'unknown', present: true };
|
|
28
|
+
}
|
|
29
|
+
if (end.isError === true)
|
|
30
|
+
return { status: 'failure', present: true };
|
|
31
|
+
if (end.isError === false)
|
|
32
|
+
return { status: 'success', present: true };
|
|
33
|
+
return { status: 'unknown', present: false };
|
|
34
|
+
}
|
|
35
|
+
/** Extract the same authoritative outcome from a raw Codex runtime-end payload. */
|
|
36
|
+
export function codexRuntimeToolOutcomeFromPayload(payloadType, payload) {
|
|
37
|
+
if (payloadType === 'patch_apply_end') {
|
|
38
|
+
const success = booleanValue(payload.success);
|
|
39
|
+
return codexRuntimeToolOutcome({
|
|
40
|
+
status: payload.status,
|
|
41
|
+
isError: success === undefined ? undefined : !success,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (payloadType !== 'mcp_tool_call_end')
|
|
45
|
+
return { status: 'unknown', present: false };
|
|
46
|
+
const result = objectValue(payload.result) ?? {};
|
|
47
|
+
const hasOk = Object.prototype.hasOwnProperty.call(result, 'Ok');
|
|
48
|
+
const ok = objectValue(result.Ok);
|
|
49
|
+
const hasErr = Object.prototype.hasOwnProperty.call(result, 'Err');
|
|
50
|
+
const isError = booleanValue(payload.isError)
|
|
51
|
+
?? booleanValue(payload.is_error)
|
|
52
|
+
?? booleanValue(result.isError)
|
|
53
|
+
?? booleanValue(result.is_error)
|
|
54
|
+
?? booleanValue(ok?.isError)
|
|
55
|
+
?? booleanValue(ok?.is_error)
|
|
56
|
+
?? (hasErr ? true : hasOk ? false : undefined);
|
|
57
|
+
return codexRuntimeToolOutcome({
|
|
58
|
+
status: payload.status ?? result.status ?? ok?.status,
|
|
59
|
+
isError,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/** Infer bridge output status only when Codex did not record an explicit status. */
|
|
63
|
+
export function codexToolOutputOutcome(output, explicitStatus) {
|
|
64
|
+
if (explicitStatus !== undefined) {
|
|
65
|
+
return { status: codexToolStatusFromValue(explicitStatus), present: true };
|
|
66
|
+
}
|
|
67
|
+
const text = toolOutputText(output);
|
|
68
|
+
if (codexToolOutputFailed(text)) {
|
|
69
|
+
return { status: 'failure', present: true };
|
|
70
|
+
}
|
|
71
|
+
if (codexToolOutputSucceeded(text))
|
|
72
|
+
return { status: 'success', present: true };
|
|
73
|
+
if (isToolResultFailureText(output))
|
|
74
|
+
return { status: 'failure', present: true };
|
|
75
|
+
return { status: 'unknown', present: false };
|
|
76
|
+
}
|
|
77
|
+
function codexToolOutputFailed(output) {
|
|
78
|
+
return /\b(?:process|script)\s+(?:exited|failed)\s+with\s+(?:exit\s+)?code\s+[1-9]\d*\b/i.test(output)
|
|
79
|
+
|| /\bexit[_\s-]?code\s*[:=]\s*[1-9]\d*\b/i.test(output)
|
|
80
|
+
|| /\bapply_patch verification failed\b/i.test(output);
|
|
81
|
+
}
|
|
82
|
+
function codexToolOutputSucceeded(output) {
|
|
83
|
+
const trimmed = output.trim();
|
|
84
|
+
return /\bprocess exited with code 0\b/i.test(trimmed)
|
|
85
|
+
|| /\bexit code:\s*0\b/i.test(trimmed)
|
|
86
|
+
|| /^script completed\b/i.test(trimmed)
|
|
87
|
+
|| /^success\.\s+(?:updated|added|deleted|moved)\b/i.test(trimmed)
|
|
88
|
+
|| /^plan updated\b/i.test(trimmed)
|
|
89
|
+
|| /^workspace dependencies are available\b/i.test(trimmed)
|
|
90
|
+
|| /^\[image\]$/i.test(trimmed);
|
|
91
|
+
}
|
|
92
|
+
function toolOutputText(value) {
|
|
93
|
+
if (typeof value === 'string')
|
|
94
|
+
return value;
|
|
95
|
+
if (value === undefined || value === null)
|
|
96
|
+
return '';
|
|
97
|
+
try {
|
|
98
|
+
return JSON.stringify(value);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return String(value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function objectValue(value) {
|
|
105
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
106
|
+
? value
|
|
107
|
+
: undefined;
|
|
108
|
+
}
|
|
109
|
+
function stringValue(value) {
|
|
110
|
+
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
111
|
+
}
|
|
112
|
+
function booleanValue(value) {
|
|
113
|
+
return typeof value === 'boolean' ? value : undefined;
|
|
114
|
+
}
|