oh-my-knowledge 0.51.1 → 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 +10 -8
- package/dist/assets/agent-skills/omk/references/commands.md +2 -2
- package/dist/authoring/generator.d.ts +15 -5
- package/dist/authoring/generator.js +181 -18
- package/dist/authoring/sample-fixer.d.ts +2 -0
- package/dist/authoring/sample-fixer.js +19 -5
- package/dist/cli/commands/sample.js +11 -4
- package/dist/eval-core/evaluation-execution.js +11 -2
- package/dist/eval-core/fact-checker.d.ts +15 -2
- package/dist/eval-core/fact-checker.js +75 -20
- package/dist/eval-core/mock-hook.cjs +40 -1
- package/dist/eval-core/mocks-runtime.js +39 -2
- package/dist/eval-core/task-planner.d.ts +2 -2
- package/dist/eval-core/task-planner.js +7 -7
- package/dist/eval-workflows/evaluation-pipeline.js +2 -0
- package/dist/eval-workflows/run-evaluation.js +2 -1
- package/dist/executors/capabilities.d.ts +15 -0
- package/dist/executors/capabilities.js +64 -0
- package/dist/executors/index.d.ts +1 -0
- package/dist/executors/index.js +4 -1
- 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/server/skill-insights.js +1 -1
- package/dist/shared/sample-contract.d.ts +1 -0
- package/dist/shared/sample-contract.js +35 -0
- package/dist/shared/tool-identity.d.ts +8 -0
- package/dist/shared/tool-identity.js +13 -0
- package/dist/types/eval.d.ts +7 -6
- package/dist/types/executor.d.ts +3 -2
- package/dist/types/observability.d.ts +225 -1
- package/package.json +10 -7
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Stable inventory of Codex rollout record shapes understood by OMK. */
|
|
2
|
+
const RESPONSE_ITEM_TYPES = new Set([
|
|
3
|
+
'message',
|
|
4
|
+
'reasoning',
|
|
5
|
+
'tool_search_call',
|
|
6
|
+
'tool_search_output',
|
|
7
|
+
'web_search_call',
|
|
8
|
+
'image_generation_call',
|
|
9
|
+
'function_call',
|
|
10
|
+
'custom_tool_call',
|
|
11
|
+
'function_call_output',
|
|
12
|
+
'custom_tool_call_output',
|
|
13
|
+
'agent_message',
|
|
14
|
+
]);
|
|
15
|
+
const EVENT_MESSAGE_TYPES = new Set([
|
|
16
|
+
'token_count',
|
|
17
|
+
'task_started',
|
|
18
|
+
'task_complete',
|
|
19
|
+
'turn_aborted',
|
|
20
|
+
'turn_interrupted',
|
|
21
|
+
'user_message',
|
|
22
|
+
'agent_message',
|
|
23
|
+
'mcp_tool_call_end',
|
|
24
|
+
'patch_apply_end',
|
|
25
|
+
'agent_reasoning',
|
|
26
|
+
'thread_settings_applied',
|
|
27
|
+
'web_search_end',
|
|
28
|
+
'context_compacted',
|
|
29
|
+
'image_generation_end',
|
|
30
|
+
'thread_goal_updated',
|
|
31
|
+
'sub_agent_activity',
|
|
32
|
+
]);
|
|
33
|
+
const IN_APP_BROWSER_CONTEXT_RE = /<in-app-browser-context\b[^>]*>[\s\S]*?<\/in-app-browser-context>/gi;
|
|
34
|
+
const CODEX_RUNTIME_MESSAGE_RE = /^# AGENTS\.md instructions\b|^<(?:app-context|environment_context|permissions instructions|collaboration_mode|apps_instructions|plugins_instructions|skills_instructions|recommended_plugins)>/i;
|
|
35
|
+
export function isCodexResponseItemType(value) {
|
|
36
|
+
return value !== undefined && RESPONSE_ITEM_TYPES.has(value);
|
|
37
|
+
}
|
|
38
|
+
export function isCodexEventMessageType(value) {
|
|
39
|
+
return value !== undefined && EVENT_MESSAGE_TYPES.has(value);
|
|
40
|
+
}
|
|
41
|
+
/** Preserve source text separately while removing Codex UI transport envelopes from semantic display. */
|
|
42
|
+
export function codexUserDisplayText(text) {
|
|
43
|
+
const requestHeading = /^## My request for Codex:\s*$/im;
|
|
44
|
+
const requestMatch = requestHeading.exec(text);
|
|
45
|
+
const request = requestMatch
|
|
46
|
+
? text.slice(requestMatch.index + requestMatch[0].length)
|
|
47
|
+
: text;
|
|
48
|
+
const visible = request
|
|
49
|
+
.replace(IN_APP_BROWSER_CONTEXT_RE, ' ')
|
|
50
|
+
.replace(/<image\b[^>]*>[\s\S]*?<\/image>/gi, ' ')
|
|
51
|
+
.replace(/\[Image\s+#\d+\]/gi, ' ')
|
|
52
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
53
|
+
.trim();
|
|
54
|
+
return visible || undefined;
|
|
55
|
+
}
|
|
56
|
+
export function codexUserMessageOrigin(text) {
|
|
57
|
+
const trimmed = text.trimStart();
|
|
58
|
+
if (CODEX_RUNTIME_MESSAGE_RE.test(trimmed))
|
|
59
|
+
return 'runtime';
|
|
60
|
+
if (/^<in-app-browser-context\b/i.test(trimmed) && !codexUserDisplayText(text))
|
|
61
|
+
return 'runtime';
|
|
62
|
+
return 'human';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Records consumed by correlation or retained only as source provenance do not
|
|
66
|
+
* emit a standalone Trace IR event. Keeping this inventory explicit preserves
|
|
67
|
+
* `unknown` as a forward-compatibility warning.
|
|
68
|
+
*/
|
|
69
|
+
export function isCodexRecordConsumedWithoutDirectEvent(recordType, payloadType) {
|
|
70
|
+
if (recordType === 'world_state')
|
|
71
|
+
return true;
|
|
72
|
+
if (recordType === 'inter_agent_communication_metadata')
|
|
73
|
+
return true;
|
|
74
|
+
if (recordType !== 'event_msg')
|
|
75
|
+
return false;
|
|
76
|
+
return payloadType === 'web_search_end'
|
|
77
|
+
|| payloadType === 'image_generation_end';
|
|
78
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TraceToolStatus } from './trace-ir.js';
|
|
2
|
+
export interface CodexToolOutcome {
|
|
3
|
+
status: TraceToolStatus;
|
|
4
|
+
present: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** Normalize Codex status values before source adapters project Trace IR. */
|
|
7
|
+
export declare function codexToolStatusFromValue(value: unknown): TraceToolStatus;
|
|
8
|
+
/** Runtime end records are authoritative even when they only expose an Ok/Err envelope. */
|
|
9
|
+
export declare function codexRuntimeToolOutcome(end: {
|
|
10
|
+
status?: unknown;
|
|
11
|
+
isError?: boolean;
|
|
12
|
+
} | undefined): CodexToolOutcome;
|
|
13
|
+
/** Extract the same authoritative outcome from a raw Codex runtime-end payload. */
|
|
14
|
+
export declare function codexRuntimeToolOutcomeFromPayload(payloadType: string | undefined, payload: Record<string, unknown>): CodexToolOutcome;
|
|
15
|
+
/** Infer bridge output status only when Codex did not record an explicit status. */
|
|
16
|
+
export declare function codexToolOutputOutcome(output: unknown, explicitStatus?: unknown): CodexToolOutcome;
|
|
@@ -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
|
+
}
|