@traceai/codex-sdk 0.0.0-stage → 0.1.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 +164 -2
- package/dist/esm/attributes.d.ts +101 -0
- package/dist/esm/attributes.d.ts.map +1 -0
- package/dist/esm/attributes.js +104 -0
- package/dist/esm/attributes.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/instrumentation.d.ts +81 -0
- package/dist/esm/instrumentation.d.ts.map +1 -0
- package/dist/esm/instrumentation.js +186 -0
- package/dist/esm/instrumentation.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/spans.d.ts +152 -0
- package/dist/esm/spans.d.ts.map +1 -0
- package/dist/esm/spans.js +678 -0
- package/dist/esm/spans.js.map +1 -0
- package/dist/esm/threadWrapper.d.ts +35 -0
- package/dist/esm/threadWrapper.d.ts.map +1 -0
- package/dist/esm/threadWrapper.js +186 -0
- package/dist/esm/threadWrapper.js.map +1 -0
- package/dist/esm/types.d.ts +123 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +10 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/esnext/attributes.d.ts +101 -0
- package/dist/esnext/attributes.d.ts.map +1 -0
- package/dist/esnext/attributes.js +104 -0
- package/dist/esnext/attributes.js.map +1 -0
- package/dist/esnext/index.d.ts +8 -0
- package/dist/esnext/index.d.ts.map +1 -0
- package/dist/esnext/index.js +5 -0
- package/dist/esnext/index.js.map +1 -0
- package/dist/esnext/instrumentation.d.ts +81 -0
- package/dist/esnext/instrumentation.d.ts.map +1 -0
- package/dist/esnext/instrumentation.js +191 -0
- package/dist/esnext/instrumentation.js.map +1 -0
- package/dist/esnext/spans.d.ts +152 -0
- package/dist/esnext/spans.d.ts.map +1 -0
- package/dist/esnext/spans.js +688 -0
- package/dist/esnext/spans.js.map +1 -0
- package/dist/esnext/threadWrapper.d.ts +35 -0
- package/dist/esnext/threadWrapper.d.ts.map +1 -0
- package/dist/esnext/threadWrapper.js +183 -0
- package/dist/esnext/threadWrapper.js.map +1 -0
- package/dist/esnext/types.d.ts +123 -0
- package/dist/esnext/types.d.ts.map +1 -0
- package/dist/esnext/types.js +10 -0
- package/dist/esnext/types.js.map +1 -0
- package/dist/esnext/version.d.ts +2 -0
- package/dist/esnext/version.d.ts.map +1 -0
- package/dist/esnext/version.js +2 -0
- package/dist/esnext/version.js.map +1 -0
- package/dist/src/attributes.d.ts +101 -0
- package/dist/src/attributes.d.ts.map +1 -0
- package/dist/src/attributes.js +107 -0
- package/dist/src/attributes.js.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +21 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/instrumentation.d.ts +81 -0
- package/dist/src/instrumentation.d.ts.map +1 -0
- package/dist/src/instrumentation.js +213 -0
- package/dist/src/instrumentation.js.map +1 -0
- package/dist/src/spans.d.ts +152 -0
- package/dist/src/spans.d.ts.map +1 -0
- package/dist/src/spans.js +698 -0
- package/dist/src/spans.js.map +1 -0
- package/dist/src/threadWrapper.d.ts +35 -0
- package/dist/src/threadWrapper.d.ts.map +1 -0
- package/dist/src/threadWrapper.js +206 -0
- package/dist/src/threadWrapper.js.map +1 -0
- package/dist/src/types.d.ts +123 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +11 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.d.ts.map +1 -0
- package/dist/src/version.js +5 -0
- package/dist/src/version.js.map +1 -0
- package/package.json +75 -3
- package/src/attributes.ts +113 -0
- package/src/index.ts +27 -0
- package/src/instrumentation.ts +215 -0
- package/src/spans.ts +729 -0
- package/src/threadWrapper.ts +200 -0
- package/src/types.ts +113 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PROVIDER_NAME = exports.AGENT_NAME = exports.StandardAttributes = exports.CodexAttributes = exports.UNKNOWN_ITEM_SPAN = exports.ITEM_SPANS = exports.SpanNames = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Span names and attribute keys for Codex SDK spans.
|
|
6
|
+
*
|
|
7
|
+
* Standard keys (`fi.span.kind`, `session.id`, `input.value`, token counts...)
|
|
8
|
+
* come from `@traceai/fi-semantic-conventions` so the Future AGI collector
|
|
9
|
+
* promotes them. `codex.*` keys carry the SDK's own structural fields.
|
|
10
|
+
*/
|
|
11
|
+
const fi_semantic_conventions_1 = require("@traceai/fi-semantic-conventions");
|
|
12
|
+
exports.SpanNames = {
|
|
13
|
+
TURN: "codex.turn",
|
|
14
|
+
AGENT_MESSAGE: "codex.agent_message",
|
|
15
|
+
REASONING: "codex.reasoning",
|
|
16
|
+
COMMAND_EXECUTION: "codex.command_execution",
|
|
17
|
+
FILE_CHANGE: "codex.file_change",
|
|
18
|
+
MCP_TOOL_CALL: "codex.mcp_tool_call",
|
|
19
|
+
WEB_SEARCH: "codex.web_search",
|
|
20
|
+
TODO_LIST: "codex.todo_list",
|
|
21
|
+
ERROR: "codex.error",
|
|
22
|
+
};
|
|
23
|
+
/** SDK item type -> span name and Future AGI span kind. */
|
|
24
|
+
exports.ITEM_SPANS = {
|
|
25
|
+
agent_message: { name: exports.SpanNames.AGENT_MESSAGE, kind: fi_semantic_conventions_1.FISpanKind.LLM, tool: false },
|
|
26
|
+
reasoning: { name: exports.SpanNames.REASONING, kind: fi_semantic_conventions_1.FISpanKind.CHAIN, tool: false },
|
|
27
|
+
command_execution: { name: exports.SpanNames.COMMAND_EXECUTION, kind: fi_semantic_conventions_1.FISpanKind.TOOL, tool: true },
|
|
28
|
+
file_change: { name: exports.SpanNames.FILE_CHANGE, kind: fi_semantic_conventions_1.FISpanKind.TOOL, tool: true },
|
|
29
|
+
mcp_tool_call: { name: exports.SpanNames.MCP_TOOL_CALL, kind: fi_semantic_conventions_1.FISpanKind.TOOL, tool: true },
|
|
30
|
+
web_search: { name: exports.SpanNames.WEB_SEARCH, kind: fi_semantic_conventions_1.FISpanKind.TOOL, tool: true },
|
|
31
|
+
todo_list: { name: exports.SpanNames.TODO_LIST, kind: fi_semantic_conventions_1.FISpanKind.CHAIN, tool: false },
|
|
32
|
+
// Non-fatal: status UNSET with codex.warning=true.
|
|
33
|
+
error: { name: exports.SpanNames.ERROR, kind: fi_semantic_conventions_1.FISpanKind.CHAIN, tool: false },
|
|
34
|
+
};
|
|
35
|
+
/** Fallback for an item type a newer SDK adds. */
|
|
36
|
+
exports.UNKNOWN_ITEM_SPAN = { kind: fi_semantic_conventions_1.FISpanKind.CHAIN, tool: false };
|
|
37
|
+
exports.CodexAttributes = {
|
|
38
|
+
THREAD_ID: "codex.thread.id",
|
|
39
|
+
THREAD_RESUMED: "codex.thread.resumed",
|
|
40
|
+
SANDBOX_MODE: "codex.sandbox_mode",
|
|
41
|
+
APPROVAL_POLICY: "codex.approval_policy",
|
|
42
|
+
REASONING_EFFORT: "codex.model_reasoning_effort",
|
|
43
|
+
WEB_SEARCH_MODE: "codex.web_search_mode",
|
|
44
|
+
INPUT_IMAGE_COUNT: "codex.input.image_count",
|
|
45
|
+
INPUT_LENGTH: "codex.input.length",
|
|
46
|
+
ITEM_ID: "codex.item.id",
|
|
47
|
+
ITEM_TYPE: "codex.item.type",
|
|
48
|
+
ITEM_STATUS: "codex.item.status",
|
|
49
|
+
/** false when the SDK sent only `item.completed`; the span then starts at the previous event. */
|
|
50
|
+
ITEM_STARTED_EVENT: "codex.item.started_event",
|
|
51
|
+
ITEM_INCOMPLETE: "codex.item.incomplete",
|
|
52
|
+
COMMAND_EXIT_CODE: "codex.command.exit_code",
|
|
53
|
+
COMMAND_OUTPUT_LENGTH: "codex.command.output_length",
|
|
54
|
+
FILE_CHANGE_COUNT: "codex.file_change.count",
|
|
55
|
+
FILE_CHANGE_KINDS: "codex.file_change.kinds",
|
|
56
|
+
MCP_SERVER: "codex.mcp.server",
|
|
57
|
+
MCP_TOOL: "codex.mcp.tool",
|
|
58
|
+
TODO_COUNT: "codex.todo.count",
|
|
59
|
+
TODO_COMPLETED: "codex.todo.completed",
|
|
60
|
+
TEXT_LENGTH: "codex.text.length",
|
|
61
|
+
USAGE_CACHED_INPUT_TOKENS: "codex.usage.cached_input_tokens",
|
|
62
|
+
USAGE_CACHE_WRITE_INPUT_TOKENS: "codex.usage.cache_write_input_tokens",
|
|
63
|
+
USAGE_REASONING_OUTPUT_TOKENS: "codex.usage.reasoning_output_tokens",
|
|
64
|
+
/** A resumed thread's first turn in this process: no earlier total, so nothing promoted. */
|
|
65
|
+
USAGE_BASELINE_UNKNOWN: "codex.usage.baseline_unknown",
|
|
66
|
+
/** The running total went down; the reported value was promoted as is. */
|
|
67
|
+
USAGE_NON_MONOTONIC: "codex.usage.non_monotonic",
|
|
68
|
+
/** Prefix for the thread's running totals, e.g. `codex.cumulative.input_tokens`. */
|
|
69
|
+
CUMULATIVE_PREFIX: "codex.cumulative.",
|
|
70
|
+
/** Fixed summary unless outputs are visible; see README "Privacy". */
|
|
71
|
+
ERROR_MESSAGE: "codex.error.message",
|
|
72
|
+
/** Error class name of a thrown error, e.g. `Error`, `TypeError`. */
|
|
73
|
+
ERROR_TYPE: "codex.error.type",
|
|
74
|
+
/** `error` events in the turn. Codex sends them for errors it retries; the turn can still complete. */
|
|
75
|
+
STREAM_ERROR_COUNT: "codex.stream_error.count",
|
|
76
|
+
/** On `codex.error` spans: a non-fatal error item (warning, deprecation, model reroute). */
|
|
77
|
+
WARNING: "codex.warning",
|
|
78
|
+
CANCELLED: "codex.cancelled",
|
|
79
|
+
};
|
|
80
|
+
/** Standard keys used by this package, resolved from fi-semantic-conventions. */
|
|
81
|
+
exports.StandardAttributes = {
|
|
82
|
+
FI_SPAN_KIND: fi_semantic_conventions_1.SemanticConventions.FI_SPAN_KIND,
|
|
83
|
+
/** Same value as `fi.span.kind`; the Python fi_instrumentation key the collector also reads. */
|
|
84
|
+
GEN_AI_SPAN_KIND: "gen_ai.span.kind",
|
|
85
|
+
SESSION_ID: fi_semantic_conventions_1.SemanticConventions.SESSION_ID,
|
|
86
|
+
CONVERSATION_ID: fi_semantic_conventions_1.SemanticConventions.GEN_AI_CONVERSATION_ID,
|
|
87
|
+
INPUT_VALUE: fi_semantic_conventions_1.SemanticConventions.INPUT_VALUE,
|
|
88
|
+
INPUT_MIME_TYPE: fi_semantic_conventions_1.SemanticConventions.INPUT_MIME_TYPE,
|
|
89
|
+
OUTPUT_VALUE: fi_semantic_conventions_1.SemanticConventions.OUTPUT_VALUE,
|
|
90
|
+
OUTPUT_MIME_TYPE: fi_semantic_conventions_1.SemanticConventions.OUTPUT_MIME_TYPE,
|
|
91
|
+
MODEL_NAME: fi_semantic_conventions_1.SemanticConventions.LLM_MODEL_NAME,
|
|
92
|
+
PROVIDER: fi_semantic_conventions_1.SemanticConventions.LLM_PROVIDER,
|
|
93
|
+
TOOL_NAME: fi_semantic_conventions_1.SemanticConventions.TOOL_NAME,
|
|
94
|
+
GEN_AI_TOOL_NAME: "gen_ai.tool.name",
|
|
95
|
+
TOOL_CALL_ID: "gen_ai.tool.call.id",
|
|
96
|
+
AGENT_NAME: "gen_ai.agent.name",
|
|
97
|
+
INPUT_TOKENS: fi_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_PROMPT,
|
|
98
|
+
OUTPUT_TOKENS: fi_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_COMPLETION,
|
|
99
|
+
TOTAL_TOKENS: fi_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_TOTAL,
|
|
100
|
+
CACHE_READ_TOKENS: fi_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_READ,
|
|
101
|
+
CACHE_WRITE_TOKENS: fi_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_WRITE,
|
|
102
|
+
REASONING_TOKENS: fi_semantic_conventions_1.SemanticConventions.LLM_TOKEN_COUNT_COMPLETION_DETAILS_REASONING,
|
|
103
|
+
};
|
|
104
|
+
exports.AGENT_NAME = "codex";
|
|
105
|
+
/** Codex talks to the OpenAI Responses API (or an OpenAI-compatible proxy). */
|
|
106
|
+
exports.PROVIDER_NAME = "openai";
|
|
107
|
+
//# sourceMappingURL=attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../src/attributes.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,8EAAmF;AAEtE,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,YAAY;IAClB,aAAa,EAAE,qBAAqB;IACpC,SAAS,EAAE,iBAAiB;IAC5B,iBAAiB,EAAE,yBAAyB;IAC5C,WAAW,EAAE,mBAAmB;IAChC,aAAa,EAAE,qBAAqB;IACpC,UAAU,EAAE,kBAAkB;IAC9B,SAAS,EAAE,iBAAiB;IAC5B,KAAK,EAAE,aAAa;CACZ,CAAC;AAEX,2DAA2D;AAC9C,QAAA,UAAU,GAAsE;IAC3F,aAAa,EAAE,EAAE,IAAI,EAAE,iBAAS,CAAC,aAAa,EAAE,IAAI,EAAE,oCAAU,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE;IACnF,SAAS,EAAE,EAAE,IAAI,EAAE,iBAAS,CAAC,SAAS,EAAE,IAAI,EAAE,oCAAU,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE;IAC7E,iBAAiB,EAAE,EAAE,IAAI,EAAE,iBAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,oCAAU,CAAC,IAAI,EAAE,IAAI,EAA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ACxD,aAAa,EAAE,6CAAmB,CAAC,0BAA0B;IAC7D,YAAY,EAAE,6CAAmB,CAAC,qBAAqB;IACvD,iBAAiB,EAAE,6CAAmB,CAAC,yCAAyC;IAChF,kBAAkB,EAAE,6CAAmB,CAAC,0CAA0C;IAClF,gBAAgB,EAAE,6CAAmB,CAAC,4CAA4C;CAC1E,CAAC;AAEE,QAAA,UAAU,GAAG,OAAO,CAAC;AAClC,+EAA+E;AAClE,QAAA,aAAa,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { CodexSDKInstrumentation, INSTRUMENTATION_NAME, instrumentCodexSDK, resolveContentPolicy, shutdown, } from "./instrumentation";
|
|
2
|
+
export type { CodexSDKInstrumentationConfig } from "./instrumentation";
|
|
3
|
+
export { isPatched } from "./threadWrapper";
|
|
4
|
+
export type { ContentPolicy } from "./spans";
|
|
5
|
+
export { AGENT_NAME, CodexAttributes, ITEM_SPANS, PROVIDER_NAME, SpanNames, StandardAttributes, } from "./attributes";
|
|
6
|
+
export type { CodexModuleLike, ThreadEventLike, ThreadItemLike, ThreadLike, ThreadOptionsLike, UsageLike, } from "./types";
|
|
7
|
+
export { VERSION } from "./version";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,eAAe,EACf,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VERSION = exports.StandardAttributes = exports.SpanNames = exports.PROVIDER_NAME = exports.ITEM_SPANS = exports.CodexAttributes = exports.AGENT_NAME = exports.isPatched = exports.shutdown = exports.resolveContentPolicy = exports.instrumentCodexSDK = exports.INSTRUMENTATION_NAME = exports.CodexSDKInstrumentation = void 0;
|
|
4
|
+
var instrumentation_1 = require("./instrumentation");
|
|
5
|
+
Object.defineProperty(exports, "CodexSDKInstrumentation", { enumerable: true, get: function () { return instrumentation_1.CodexSDKInstrumentation; } });
|
|
6
|
+
Object.defineProperty(exports, "INSTRUMENTATION_NAME", { enumerable: true, get: function () { return instrumentation_1.INSTRUMENTATION_NAME; } });
|
|
7
|
+
Object.defineProperty(exports, "instrumentCodexSDK", { enumerable: true, get: function () { return instrumentation_1.instrumentCodexSDK; } });
|
|
8
|
+
Object.defineProperty(exports, "resolveContentPolicy", { enumerable: true, get: function () { return instrumentation_1.resolveContentPolicy; } });
|
|
9
|
+
Object.defineProperty(exports, "shutdown", { enumerable: true, get: function () { return instrumentation_1.shutdown; } });
|
|
10
|
+
var threadWrapper_1 = require("./threadWrapper");
|
|
11
|
+
Object.defineProperty(exports, "isPatched", { enumerable: true, get: function () { return threadWrapper_1.isPatched; } });
|
|
12
|
+
var attributes_1 = require("./attributes");
|
|
13
|
+
Object.defineProperty(exports, "AGENT_NAME", { enumerable: true, get: function () { return attributes_1.AGENT_NAME; } });
|
|
14
|
+
Object.defineProperty(exports, "CodexAttributes", { enumerable: true, get: function () { return attributes_1.CodexAttributes; } });
|
|
15
|
+
Object.defineProperty(exports, "ITEM_SPANS", { enumerable: true, get: function () { return attributes_1.ITEM_SPANS; } });
|
|
16
|
+
Object.defineProperty(exports, "PROVIDER_NAME", { enumerable: true, get: function () { return attributes_1.PROVIDER_NAME; } });
|
|
17
|
+
Object.defineProperty(exports, "SpanNames", { enumerable: true, get: function () { return attributes_1.SpanNames; } });
|
|
18
|
+
Object.defineProperty(exports, "StandardAttributes", { enumerable: true, get: function () { return attributes_1.StandardAttributes; } });
|
|
19
|
+
var version_1 = require("./version");
|
|
20
|
+
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAM2B;AALzB,0HAAA,uBAAuB,OAAA;AACvB,uHAAA,oBAAoB,OAAA;AACpB,qHAAA,kBAAkB,OAAA;AAClB,uHAAA,oBAAoB,OAAA;AACpB,2GAAA,QAAQ,OAAA;AAGV,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAElB,2CAOsB;AANpB,wGAAA,UAAU,OAAA;AACV,6GAAA,eAAe,OAAA;AACf,wGAAA,UAAU,OAAA;AACV,2GAAA,aAAa,OAAA;AACb,uGAAA,SAAS,OAAA;AACT,gHAAA,kBAAkB,OAAA;AAUpB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry points: an instrumentation object that patches the SDK's
|
|
3
|
+
* `Thread` class (or single `Codex` / `Thread` instances), and a `shutdown()`
|
|
4
|
+
* that flushes the tracer provider before a short script exits.
|
|
5
|
+
*/
|
|
6
|
+
import { TracerProvider } from "@opentelemetry/api";
|
|
7
|
+
import { TraceConfigOptions } from "@traceai/fi-core";
|
|
8
|
+
import { ContentPolicy } from "./spans";
|
|
9
|
+
import { CodexModuleLike } from "./types";
|
|
10
|
+
export declare const INSTRUMENTATION_NAME = "@traceai/codex-sdk";
|
|
11
|
+
export interface CodexSDKInstrumentationConfig {
|
|
12
|
+
/** Provider to create spans with. Defaults to the global provider at call time. */
|
|
13
|
+
tracerProvider?: TracerProvider;
|
|
14
|
+
/**
|
|
15
|
+
* fi-core trace config. Unlike fi-core, `hideInputs` and `hideOutputs`
|
|
16
|
+
* default to `true` here: prompts, shell commands, command output, file
|
|
17
|
+
* paths and MCP arguments can contain source code or secrets. Opt in with
|
|
18
|
+
* `false`, or with `FI_HIDE_INPUTS=false` / `FI_HIDE_OUTPUTS=false`.
|
|
19
|
+
*/
|
|
20
|
+
traceConfig?: TraceConfigOptions;
|
|
21
|
+
}
|
|
22
|
+
/** Precedence: explicit option > fi-core env var > this package's default (hidden). */
|
|
23
|
+
export declare function resolveContentPolicy(traceConfig?: TraceConfigOptions): ContentPolicy;
|
|
24
|
+
/**
|
|
25
|
+
* Traces `@openai/codex-sdk` turns.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* import * as CodexSDK from "@openai/codex-sdk";
|
|
29
|
+
* const instrumentation = new CodexSDKInstrumentation({ tracerProvider });
|
|
30
|
+
* instrumentation.manuallyInstrument(CodexSDK);
|
|
31
|
+
* const thread = new CodexSDK.Codex().startThread();
|
|
32
|
+
* await thread.run("..."); // one codex.turn trace
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* The SDK is ESM-only, so its module namespace cannot be patched; its `Thread`
|
|
36
|
+
* class prototype can. `wrapCodex()` / `wrapThread()` patch single instances
|
|
37
|
+
* instead, for apps that prefer not to touch the shared class.
|
|
38
|
+
*
|
|
39
|
+
* This is not an OpenTelemetry `InstrumentationBase`: there is no module to
|
|
40
|
+
* hook on `require`/`import`, so it cannot be passed to
|
|
41
|
+
* `registerInstrumentations()`. Call `manuallyInstrument()` or the wrap methods.
|
|
42
|
+
*/
|
|
43
|
+
export declare class CodexSDKInstrumentation {
|
|
44
|
+
private tracerProvider?;
|
|
45
|
+
private readonly traceConfig?;
|
|
46
|
+
/** Undo functions for the class patch and wrapCodex() factories (never one per thread). */
|
|
47
|
+
private readonly undo;
|
|
48
|
+
/** False after unpatch(): instance patches stay in place but pass events through untraced. */
|
|
49
|
+
private enabled;
|
|
50
|
+
constructor(config?: CodexSDKInstrumentationConfig);
|
|
51
|
+
setTracerProvider(tracerProvider: TracerProvider): void;
|
|
52
|
+
/** The content policy this instrumentation applies. */
|
|
53
|
+
get contentPolicy(): ContentPolicy;
|
|
54
|
+
/**
|
|
55
|
+
* Patch `module.Thread.prototype`. Pass the SDK module namespace
|
|
56
|
+
* (`import * as CodexSDK from "@openai/codex-sdk"`) or `{ Thread }`.
|
|
57
|
+
* Returns `true` when the class was patched by this call.
|
|
58
|
+
*/
|
|
59
|
+
manuallyInstrument(module: CodexModuleLike): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Patch one Thread instance. Returns the same instance. No reference to the
|
|
62
|
+
* thread is kept: after `unpatch()` the patched method passes events through
|
|
63
|
+
* untraced instead of being removed.
|
|
64
|
+
*/
|
|
65
|
+
wrapThread<T extends object>(thread: T): T;
|
|
66
|
+
/** Patch one Codex instance so every thread it starts or resumes is traced. Returns the same instance. */
|
|
67
|
+
wrapCodex<T extends object>(codex: T): T;
|
|
68
|
+
/** Remove every patch this instrumentation applied. */
|
|
69
|
+
unpatch(): void;
|
|
70
|
+
/** Flush the provider's span processors. Does not shut the provider down. */
|
|
71
|
+
forceFlush(): Promise<void>;
|
|
72
|
+
private tracingContext;
|
|
73
|
+
}
|
|
74
|
+
/** Python-style convenience constructor. */
|
|
75
|
+
export declare function instrumentCodexSDK(module: CodexModuleLike, config?: CodexSDKInstrumentationConfig): CodexSDKInstrumentation;
|
|
76
|
+
/**
|
|
77
|
+
* Flush spans before a short script exits. Export errors are logged, never
|
|
78
|
+
* thrown: export failure does not fail the agent.
|
|
79
|
+
*/
|
|
80
|
+
export declare function shutdown(tracerProvider?: TracerProvider): Promise<void>;
|
|
81
|
+
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAY,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,eAAe,EAAc,MAAM,SAAS,CAAC;AAGtD,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAUzD,MAAM,WAAW,6BAA6B;IAC5C,mFAAmF;IACnF,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAQD,uFAAuF;AACvF,wBAAgB,oBAAoB,CAAC,WAAW,CAAC,EAAE,kBAAkB,GAAG,aAAa,CAMpF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,cAAc,CAAC,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAqB;IAClD,2FAA2F;IAC3F,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyB;IAC9C,8FAA8F;IAC9F,OAAO,CAAC,OAAO,CAAQ;gBAEX,MAAM,GAAE,6BAAkC;IAKtD,iBAAiB,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IAIvD,uDAAuD;IACvD,IAAI,aAAa,IAAI,aAAa,CAEjC;IAED;;;;OAIG;IACH,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO;IAYpD;;;;OAIG;IACH,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC;IAM1C,0GAA0G;IAC1G,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC;IA4BxC,uDAAuD;IACvD,OAAO,IAAI,IAAI;IAYf,6EAA6E;IACvE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,OAAO,CAAC,cAAc;CAUvB;AAED,4CAA4C;AAC5C,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,eAAe,EACvB,MAAM,GAAE,6BAAkC,GACzC,uBAAuB,CAIzB;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7E"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CodexSDKInstrumentation = exports.INSTRUMENTATION_NAME = void 0;
|
|
13
|
+
exports.resolveContentPolicy = resolveContentPolicy;
|
|
14
|
+
exports.instrumentCodexSDK = instrumentCodexSDK;
|
|
15
|
+
exports.shutdown = shutdown;
|
|
16
|
+
/**
|
|
17
|
+
* Public entry points: an instrumentation object that patches the SDK's
|
|
18
|
+
* `Thread` class (or single `Codex` / `Thread` instances), and a `shutdown()`
|
|
19
|
+
* that flushes the tracer provider before a short script exits.
|
|
20
|
+
*/
|
|
21
|
+
const api_1 = require("@opentelemetry/api");
|
|
22
|
+
const fi_core_1 = require("@traceai/fi-core");
|
|
23
|
+
const threadWrapper_1 = require("./threadWrapper");
|
|
24
|
+
const version_1 = require("./version");
|
|
25
|
+
exports.INSTRUMENTATION_NAME = "@traceai/codex-sdk";
|
|
26
|
+
/**
|
|
27
|
+
* fi-core env keys. Read fail-closed, unlike fi-core (`value.toLowerCase() ===
|
|
28
|
+
* "true"`): only an explicit `false` (trimmed, any case) opts in to content.
|
|
29
|
+
*/
|
|
30
|
+
const FI_HIDE_INPUTS = "FI_HIDE_INPUTS";
|
|
31
|
+
const FI_HIDE_OUTPUTS = "FI_HIDE_OUTPUTS";
|
|
32
|
+
const FI_HIDE_ERROR_DETAILS = "FI_HIDE_ERROR_DETAILS";
|
|
33
|
+
/** `false` only for an explicit `false`; any other value (or none) keeps content hidden. */
|
|
34
|
+
function envHide(key) {
|
|
35
|
+
var _a;
|
|
36
|
+
const value = typeof process !== "undefined" ? (_a = process.env) === null || _a === void 0 ? void 0 : _a[key] : undefined;
|
|
37
|
+
return !(typeof value === "string" && value.trim().toLowerCase() === "false");
|
|
38
|
+
}
|
|
39
|
+
/** Precedence: explicit option > fi-core env var > this package's default (hidden). */
|
|
40
|
+
function resolveContentPolicy(traceConfig) {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
return {
|
|
43
|
+
hideInputs: (_a = traceConfig === null || traceConfig === void 0 ? void 0 : traceConfig.hideInputs) !== null && _a !== void 0 ? _a : envHide(FI_HIDE_INPUTS),
|
|
44
|
+
hideOutputs: (_b = traceConfig === null || traceConfig === void 0 ? void 0 : traceConfig.hideOutputs) !== null && _b !== void 0 ? _b : envHide(FI_HIDE_OUTPUTS),
|
|
45
|
+
hideErrorDetails: (_c = traceConfig === null || traceConfig === void 0 ? void 0 : traceConfig.hideErrorDetails) !== null && _c !== void 0 ? _c : envHide(FI_HIDE_ERROR_DETAILS),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Traces `@openai/codex-sdk` turns.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* import * as CodexSDK from "@openai/codex-sdk";
|
|
53
|
+
* const instrumentation = new CodexSDKInstrumentation({ tracerProvider });
|
|
54
|
+
* instrumentation.manuallyInstrument(CodexSDK);
|
|
55
|
+
* const thread = new CodexSDK.Codex().startThread();
|
|
56
|
+
* await thread.run("..."); // one codex.turn trace
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* The SDK is ESM-only, so its module namespace cannot be patched; its `Thread`
|
|
60
|
+
* class prototype can. `wrapCodex()` / `wrapThread()` patch single instances
|
|
61
|
+
* instead, for apps that prefer not to touch the shared class.
|
|
62
|
+
*
|
|
63
|
+
* This is not an OpenTelemetry `InstrumentationBase`: there is no module to
|
|
64
|
+
* hook on `require`/`import`, so it cannot be passed to
|
|
65
|
+
* `registerInstrumentations()`. Call `manuallyInstrument()` or the wrap methods.
|
|
66
|
+
*/
|
|
67
|
+
class CodexSDKInstrumentation {
|
|
68
|
+
constructor(config = {}) {
|
|
69
|
+
/** Undo functions for the class patch and wrapCodex() factories (never one per thread). */
|
|
70
|
+
this.undo = [];
|
|
71
|
+
/** False after unpatch(): instance patches stay in place but pass events through untraced. */
|
|
72
|
+
this.enabled = true;
|
|
73
|
+
this.traceConfig = config.traceConfig;
|
|
74
|
+
this.tracerProvider = config.tracerProvider;
|
|
75
|
+
}
|
|
76
|
+
setTracerProvider(tracerProvider) {
|
|
77
|
+
this.tracerProvider = tracerProvider;
|
|
78
|
+
}
|
|
79
|
+
/** The content policy this instrumentation applies. */
|
|
80
|
+
get contentPolicy() {
|
|
81
|
+
return resolveContentPolicy(this.traceConfig);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Patch `module.Thread.prototype`. Pass the SDK module namespace
|
|
85
|
+
* (`import * as CodexSDK from "@openai/codex-sdk"`) or `{ Thread }`.
|
|
86
|
+
* Returns `true` when the class was patched by this call.
|
|
87
|
+
*/
|
|
88
|
+
manuallyInstrument(module) {
|
|
89
|
+
var _a;
|
|
90
|
+
const proto = (_a = module === null || module === void 0 ? void 0 : module.Thread) === null || _a === void 0 ? void 0 : _a.prototype;
|
|
91
|
+
if (!proto) {
|
|
92
|
+
api_1.diag.warn(`${exports.INSTRUMENTATION_NAME}: manuallyInstrument() expects the @openai/codex-sdk module (no Thread export found)`);
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
this.enabled = true;
|
|
96
|
+
const undo = (0, threadWrapper_1.patchThread)(proto, () => this.tracingContext());
|
|
97
|
+
if (undo)
|
|
98
|
+
this.undo.push(undo);
|
|
99
|
+
return !!undo;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Patch one Thread instance. Returns the same instance. No reference to the
|
|
103
|
+
* thread is kept: after `unpatch()` the patched method passes events through
|
|
104
|
+
* untraced instead of being removed.
|
|
105
|
+
*/
|
|
106
|
+
wrapThread(thread) {
|
|
107
|
+
this.enabled = true;
|
|
108
|
+
(0, threadWrapper_1.patchThread)(thread, () => this.tracingContext());
|
|
109
|
+
return thread;
|
|
110
|
+
}
|
|
111
|
+
/** Patch one Codex instance so every thread it starts or resumes is traced. Returns the same instance. */
|
|
112
|
+
wrapCodex(codex) {
|
|
113
|
+
if (!codex || typeof codex !== "object")
|
|
114
|
+
return codex;
|
|
115
|
+
this.enabled = true;
|
|
116
|
+
const target = codex;
|
|
117
|
+
// Held weakly: a wrapped client the app drops can be collected before unpatch().
|
|
118
|
+
const ref = new WeakRef(target);
|
|
119
|
+
for (const method of ["startThread", "resumeThread"]) {
|
|
120
|
+
const original = target[method];
|
|
121
|
+
if (typeof original !== "function")
|
|
122
|
+
continue;
|
|
123
|
+
const hadOwn = Object.prototype.hasOwnProperty.call(codex, method);
|
|
124
|
+
const self = this;
|
|
125
|
+
Object.defineProperty(codex, method, {
|
|
126
|
+
value: function tracedThreadFactory(...args) {
|
|
127
|
+
return self.wrapThread(original.apply(this, args));
|
|
128
|
+
},
|
|
129
|
+
writable: true,
|
|
130
|
+
configurable: true,
|
|
131
|
+
});
|
|
132
|
+
this.undo.push(() => {
|
|
133
|
+
const live = ref.deref();
|
|
134
|
+
if (!live)
|
|
135
|
+
return;
|
|
136
|
+
if (hadOwn)
|
|
137
|
+
Object.defineProperty(live, method, { value: original, writable: true, configurable: true });
|
|
138
|
+
else
|
|
139
|
+
delete live[method];
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return codex;
|
|
143
|
+
}
|
|
144
|
+
/** Remove every patch this instrumentation applied. */
|
|
145
|
+
unpatch() {
|
|
146
|
+
this.enabled = false;
|
|
147
|
+
while (this.undo.length) {
|
|
148
|
+
const fn = this.undo.pop();
|
|
149
|
+
try {
|
|
150
|
+
fn === null || fn === void 0 ? void 0 : fn();
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
api_1.diag.debug(`${exports.INSTRUMENTATION_NAME}: unpatch failed: ${error}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** Flush the provider's span processors. Does not shut the provider down. */
|
|
158
|
+
forceFlush() {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
var _a;
|
|
161
|
+
yield flushProvider((_a = this.tracerProvider) !== null && _a !== void 0 ? _a : api_1.trace.getTracerProvider());
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
tracingContext() {
|
|
165
|
+
var _a;
|
|
166
|
+
if (!this.enabled)
|
|
167
|
+
return undefined;
|
|
168
|
+
const policy = this.contentPolicy;
|
|
169
|
+
const provider = (_a = this.tracerProvider) !== null && _a !== void 0 ? _a : api_1.trace.getTracerProvider();
|
|
170
|
+
const tracer = new fi_core_1.FITracer({
|
|
171
|
+
tracer: provider.getTracer(exports.INSTRUMENTATION_NAME, version_1.VERSION),
|
|
172
|
+
traceConfig: Object.assign(Object.assign({}, this.traceConfig), { hideInputs: policy.hideInputs, hideOutputs: policy.hideOutputs, hideErrorDetails: policy.hideErrorDetails }),
|
|
173
|
+
});
|
|
174
|
+
return { tracer, policy };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.CodexSDKInstrumentation = CodexSDKInstrumentation;
|
|
178
|
+
/** Python-style convenience constructor. */
|
|
179
|
+
function instrumentCodexSDK(module, config = {}) {
|
|
180
|
+
const instrumentation = new CodexSDKInstrumentation(config);
|
|
181
|
+
instrumentation.manuallyInstrument(module);
|
|
182
|
+
return instrumentation;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Flush spans before a short script exits. Export errors are logged, never
|
|
186
|
+
* thrown: export failure does not fail the agent.
|
|
187
|
+
*/
|
|
188
|
+
function shutdown(tracerProvider) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
yield flushProvider(tracerProvider !== null && tracerProvider !== void 0 ? tracerProvider : api_1.trace.getTracerProvider());
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function resolveDelegate(provider) {
|
|
194
|
+
const maybeProxy = provider;
|
|
195
|
+
if (typeof maybeProxy.forceFlush !== "function" && typeof maybeProxy.getDelegate === "function") {
|
|
196
|
+
return maybeProxy.getDelegate();
|
|
197
|
+
}
|
|
198
|
+
return provider;
|
|
199
|
+
}
|
|
200
|
+
function flushProvider(provider) {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
const target = resolveDelegate(provider);
|
|
203
|
+
if (typeof target.forceFlush !== "function")
|
|
204
|
+
return;
|
|
205
|
+
try {
|
|
206
|
+
yield target.forceFlush();
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
api_1.diag.warn(`${exports.INSTRUMENTATION_NAME}: forceFlush failed: ${error}`);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrument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AAED;;;GAGG;AACH,SAAsB,QAAQ,CAAC,cAA+B;;QAC5D,MAAM,aAAa,CAAC,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,WAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACnE,CAAC;CAAA;AAED,SAAS,eAAe,CAAC,QAAwB;IAC/C,MAAM,UAAU,GAAG,QAGlB,CAAC;IACF,IAAI,OAAO,UAAU,CAAC,UAAU,KAAK,UAAU,IAAI,OAAO,UAAU,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QAChG,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAe,aAAa,CAAC,QAAwB;;QACnD,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAA0D,CAAC;QAClG,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO;QACpD,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,UAAI,CAAC,IAAI,CAAC,GAAG,4BAAoB,wBAAwB,KAAK,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Span model for one Codex turn (one `Thread.run()` or `Thread.runStreamed()`).
|
|
3
|
+
*
|
|
4
|
+
* The SDK yields `ThreadEvent`s, not spans. `TurnTracer` turns them into:
|
|
5
|
+
*
|
|
6
|
+
* codex.turn (AGENT) session.id = thread id, usage
|
|
7
|
+
* ├─ codex.reasoning (CHAIN)
|
|
8
|
+
* ├─ codex.command_execution (TOOL)
|
|
9
|
+
* ├─ codex.file_change (TOOL)
|
|
10
|
+
* ├─ codex.mcp_tool_call (TOOL)
|
|
11
|
+
* ├─ codex.web_search (TOOL)
|
|
12
|
+
* ├─ codex.todo_list (CHAIN)
|
|
13
|
+
* ├─ codex.agent_message (LLM)
|
|
14
|
+
* └─ codex.error (CHAIN, codex.warning=true) non-fatal error item
|
|
15
|
+
*
|
|
16
|
+
* Every public method swallows its own errors: tracing never fails the agent.
|
|
17
|
+
*/
|
|
18
|
+
import { Context, HrTime, Tracer } from "@opentelemetry/api";
|
|
19
|
+
import { InputLike, ThreadOptionsLike, TurnOptionsLike } from "./types";
|
|
20
|
+
/** Which content the wrapper may copy onto spans. Both default to hidden. */
|
|
21
|
+
export interface ContentPolicy {
|
|
22
|
+
hideInputs: boolean;
|
|
23
|
+
hideOutputs: boolean;
|
|
24
|
+
/** Error details remain hidden even when ordinary outputs are visible. */
|
|
25
|
+
hideErrorDetails: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** How the wrapped event stream stopped. */
|
|
28
|
+
export type FinishOutcome = {
|
|
29
|
+
kind: "completed";
|
|
30
|
+
} | {
|
|
31
|
+
kind: "returned";
|
|
32
|
+
} | {
|
|
33
|
+
kind: "error";
|
|
34
|
+
error: unknown;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* One clock for every start and end time the wrapper sets. OTel falls back to
|
|
38
|
+
* millisecond `Date.now()` for the end of a span whose start time was given,
|
|
39
|
+
* so mixing explicit and implicit times can order a child after its parent.
|
|
40
|
+
*/
|
|
41
|
+
export declare function clockMs(): number;
|
|
42
|
+
export declare function toHrTime(ms: number): HrTime;
|
|
43
|
+
export declare function truncate(value: string, max: number): string;
|
|
44
|
+
export declare function safeJson(value: unknown, max?: number): string;
|
|
45
|
+
/** Same normalization as the SDK's `normalizeInput`: text parts joined by a blank line. */
|
|
46
|
+
export declare function normalizeInput(input: InputLike | undefined): {
|
|
47
|
+
prompt: string;
|
|
48
|
+
images: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The SDK builds its thrown messages from raw data: `Codex Exec exited with
|
|
52
|
+
* code 1: <the binary's stderr>` and `Failed to parse item: <the raw line>`
|
|
53
|
+
* (dist/index.js of 0.162.1). Stderr can hold config lines, local paths and
|
|
54
|
+
* the user name; the raw line can hold the prompt or command output. With
|
|
55
|
+
* outputs hidden only this fixed summary is exported.
|
|
56
|
+
*/
|
|
57
|
+
export declare function errorSummary(error: unknown): string;
|
|
58
|
+
type UsageTotals = {
|
|
59
|
+
input_tokens?: number;
|
|
60
|
+
cached_input_tokens?: number;
|
|
61
|
+
cache_write_input_tokens?: number;
|
|
62
|
+
output_tokens?: number;
|
|
63
|
+
reasoning_output_tokens?: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Last running total seen per thread id in this process (LRU, 1000 threads).
|
|
67
|
+
* Exact while a thread's turns run in one process; see the README.
|
|
68
|
+
*/
|
|
69
|
+
declare class UsageBaselines {
|
|
70
|
+
private readonly totals;
|
|
71
|
+
get(threadId: string): UsageTotals | undefined;
|
|
72
|
+
set(threadId: string, totals: UsageTotals): void;
|
|
73
|
+
clear(): void;
|
|
74
|
+
get size(): number;
|
|
75
|
+
}
|
|
76
|
+
export declare const usageBaselines: UsageBaselines;
|
|
77
|
+
export declare class TurnTracer {
|
|
78
|
+
private readonly tracer;
|
|
79
|
+
private readonly policy;
|
|
80
|
+
private readonly parentContext;
|
|
81
|
+
private readonly startTimeMs;
|
|
82
|
+
private readonly input;
|
|
83
|
+
private readonly turnOptions;
|
|
84
|
+
private readonly threadOptions;
|
|
85
|
+
private readonly contextAttributes;
|
|
86
|
+
private readonly appSetSession;
|
|
87
|
+
private readonly resumed;
|
|
88
|
+
private turn?;
|
|
89
|
+
private turnContext?;
|
|
90
|
+
private finished;
|
|
91
|
+
private threadId?;
|
|
92
|
+
private lastEventMs;
|
|
93
|
+
private finalResponse?;
|
|
94
|
+
private completed;
|
|
95
|
+
/** `turn.failed` text; the turn failed. */
|
|
96
|
+
private failedMessage?;
|
|
97
|
+
/** Last `error` event text. Fatal only if the turn ends without `turn.completed`. */
|
|
98
|
+
private streamErrorMessage?;
|
|
99
|
+
private streamErrorCount;
|
|
100
|
+
private readonly items;
|
|
101
|
+
private anonymousItems;
|
|
102
|
+
constructor(args: {
|
|
103
|
+
tracer: Tracer;
|
|
104
|
+
policy: ContentPolicy;
|
|
105
|
+
parentContext: Context;
|
|
106
|
+
input: InputLike | undefined;
|
|
107
|
+
turnOptions?: TurnOptionsLike;
|
|
108
|
+
threadOptions?: ThreadOptionsLike;
|
|
109
|
+
threadId?: string | null;
|
|
110
|
+
startTimeMs?: number;
|
|
111
|
+
});
|
|
112
|
+
private get hideErrorText();
|
|
113
|
+
get isFinished(): boolean;
|
|
114
|
+
/** Open the turn span. Called on the first `next()`; idempotent. */
|
|
115
|
+
start(): void;
|
|
116
|
+
/** Record one SDK event. Never throws and never mutates the event. */
|
|
117
|
+
onEvent(event: unknown): void;
|
|
118
|
+
/**
|
|
119
|
+
* End every open span for this turn, the turn span last. Idempotent.
|
|
120
|
+
* The spans always end, even if recording their attributes throws: item
|
|
121
|
+
* spans that already ended were exported with the turn as their parent.
|
|
122
|
+
*/
|
|
123
|
+
finish(outcome: FinishOutcome): void;
|
|
124
|
+
/** Statuses and attributes for `finish()`; closes open item spans. */
|
|
125
|
+
private recordFinish;
|
|
126
|
+
private turnStartAttributes;
|
|
127
|
+
private sessionAttributes;
|
|
128
|
+
private setThreadId;
|
|
129
|
+
/**
|
|
130
|
+
* `turn.completed.usage` is the thread's running total, not the turn's own
|
|
131
|
+
* spend (measured on 0.162.1: each resumed turn reports the previous total
|
|
132
|
+
* plus its own requests, also across processes). The promoted
|
|
133
|
+
* `gen_ai.usage.*` keys carry only this turn's new spend: the total minus
|
|
134
|
+
* the last total this process saw for the thread. A new thread starts at
|
|
135
|
+
* zero. A resumed thread with no total seen in this process promotes nothing
|
|
136
|
+
* (`codex.usage.baseline_unknown`); later turns promote their delta.
|
|
137
|
+
* A failed or cancelled turn reports no usage, so its spend lands on the
|
|
138
|
+
* thread's next completed turn. Running totals are always on
|
|
139
|
+
* `codex.cumulative.*`.
|
|
140
|
+
*/
|
|
141
|
+
private setUsage;
|
|
142
|
+
private itemKey;
|
|
143
|
+
private onItemStarted;
|
|
144
|
+
private onItemUpdated;
|
|
145
|
+
private onItemCompleted;
|
|
146
|
+
private startItemSpan;
|
|
147
|
+
/** Structural fields always; content only when the policy allows it. */
|
|
148
|
+
private applyItemAttributes;
|
|
149
|
+
private applyItemStatus;
|
|
150
|
+
}
|
|
151
|
+
export {};
|
|
152
|
+
//# sourceMappingURL=spans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spans.d.ts","sourceRoot":"","sources":["../../src/spans.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAGL,OAAO,EACP,MAAM,EAIN,MAAM,EAGP,MAAM,oBAAoB,CAAC;AAY5B,OAAO,EAAE,SAAS,EAAmC,iBAAiB,EAAE,eAAe,EAAa,MAAM,SAAS,CAAC;AAEpH,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAMtC;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAMhC;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAI3C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,SAAc,GAAG,MAAM,CAOlE;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,K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