@ekairos/openai-reactor 1.22.3 → 1.22.4-beta.development.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 +44 -40
- package/dist/codex.reactor.d.ts +101 -0
- package/dist/codex.reactor.d.ts.map +1 -0
- package/dist/codex.reactor.js +557 -0
- package/dist/codex.reactor.js.map +1 -0
- package/dist/index.d.ts +1 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -148
- package/dist/index.js.map +1 -1
- package/dist/shared.d.ts +24 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +336 -0
- package/dist/shared.js.map +1 -0
- package/package.json +13 -6
package/dist/index.js
CHANGED
|
@@ -1,149 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function asString(value) {
|
|
3
|
-
if (typeof value === "string")
|
|
4
|
-
return value;
|
|
5
|
-
if (value === null || value === undefined)
|
|
6
|
-
return "";
|
|
7
|
-
return String(value);
|
|
8
|
-
}
|
|
9
|
-
function asRecord(value) {
|
|
10
|
-
if (!value || typeof value !== "object")
|
|
11
|
-
return {};
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
function textFromParts(parts) {
|
|
15
|
-
if (!Array.isArray(parts))
|
|
16
|
-
return "";
|
|
17
|
-
const out = [];
|
|
18
|
-
for (const part of parts) {
|
|
19
|
-
const record = asRecord(part);
|
|
20
|
-
const partType = asString(record.type);
|
|
21
|
-
if (partType === "text") {
|
|
22
|
-
const value = asString(record.text).trim();
|
|
23
|
-
if (value)
|
|
24
|
-
out.push(value);
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
if (partType === "input_text") {
|
|
28
|
-
const value = asString(record.input_text).trim();
|
|
29
|
-
if (value)
|
|
30
|
-
out.push(value);
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
const inline = asString(record.text).trim();
|
|
34
|
-
if (inline)
|
|
35
|
-
out.push(inline);
|
|
36
|
-
}
|
|
37
|
-
return out.join("\n").trim();
|
|
38
|
-
}
|
|
39
|
-
function defaultInstructionFromTrigger(event) {
|
|
40
|
-
const content = asRecord(event.content);
|
|
41
|
-
const message = textFromParts(content.parts);
|
|
42
|
-
return message || "Continue with the current task.";
|
|
43
|
-
}
|
|
44
|
-
function buildCodexParts(params) {
|
|
45
|
-
const parts = [];
|
|
46
|
-
const assistantText = asString(params.result.assistantText).trim();
|
|
47
|
-
const reasoningText = asString(params.result.reasoningText).trim();
|
|
48
|
-
if (assistantText) {
|
|
49
|
-
parts.push({ type: "text", text: assistantText });
|
|
50
|
-
}
|
|
51
|
-
if (params.includeReasoningPart && reasoningText) {
|
|
52
|
-
parts.push({ type: "reasoning", text: reasoningText });
|
|
53
|
-
}
|
|
54
|
-
const metadata = {
|
|
55
|
-
threadId: params.result.threadId,
|
|
56
|
-
turnId: params.result.turnId,
|
|
57
|
-
diff: params.result.diff ?? "",
|
|
58
|
-
toolParts: params.result.toolParts ?? [],
|
|
59
|
-
...(params.result.metadata ?? {}),
|
|
60
|
-
};
|
|
61
|
-
parts.push({
|
|
62
|
-
type: `tool-${params.toolName}`,
|
|
63
|
-
toolCallId: params.result.turnId || params.result.threadId,
|
|
64
|
-
state: "output-available",
|
|
65
|
-
input: { instruction: params.instruction },
|
|
66
|
-
output: metadata,
|
|
67
|
-
metadata,
|
|
68
|
-
});
|
|
69
|
-
return parts;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Default AI SDK reactor exported by package for convenience.
|
|
73
|
-
*/
|
|
74
|
-
export function createOpenAIReactor(options) {
|
|
75
|
-
return createAiSdkReactor(options);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Codex App Server reactor for @ekairos/thread.
|
|
79
|
-
*
|
|
80
|
-
* This maps one Thread loop iteration to one Codex turn and returns a persisted
|
|
81
|
-
* assistant event compatible with the Thread engine.
|
|
82
|
-
*
|
|
83
|
-
* Workflow compatibility:
|
|
84
|
-
* - `resolveConfig` and `executeTurn` should be implemented with `"use step"`
|
|
85
|
-
* wrappers when they perform I/O.
|
|
86
|
-
*/
|
|
87
|
-
export function createCodexReactor(options) {
|
|
88
|
-
const toolName = asString(options.toolName).trim() || "codex";
|
|
89
|
-
const includeReasoningPart = Boolean(options.includeReasoningPart);
|
|
90
|
-
return async (params) => {
|
|
91
|
-
const context = asRecord(params.context.content);
|
|
92
|
-
const instruction = (options.buildInstruction
|
|
93
|
-
? await options.buildInstruction({
|
|
94
|
-
env: params.env,
|
|
95
|
-
context,
|
|
96
|
-
triggerEvent: params.triggerEvent,
|
|
97
|
-
})
|
|
98
|
-
: defaultInstructionFromTrigger(params.triggerEvent)).trim();
|
|
99
|
-
const config = await options.resolveConfig({
|
|
100
|
-
env: params.env,
|
|
101
|
-
context,
|
|
102
|
-
triggerEvent: params.triggerEvent,
|
|
103
|
-
contextId: params.contextId,
|
|
104
|
-
eventId: params.eventId,
|
|
105
|
-
executionId: params.executionId,
|
|
106
|
-
stepId: params.stepId,
|
|
107
|
-
iteration: params.iteration,
|
|
108
|
-
});
|
|
109
|
-
const turn = await options.executeTurn({
|
|
110
|
-
env: params.env,
|
|
111
|
-
context,
|
|
112
|
-
triggerEvent: params.triggerEvent,
|
|
113
|
-
contextId: params.contextId,
|
|
114
|
-
eventId: params.eventId,
|
|
115
|
-
executionId: params.executionId,
|
|
116
|
-
stepId: params.stepId,
|
|
117
|
-
iteration: params.iteration,
|
|
118
|
-
instruction,
|
|
119
|
-
config,
|
|
120
|
-
writable: params.writable,
|
|
121
|
-
silent: params.silent,
|
|
122
|
-
});
|
|
123
|
-
const assistantEvent = {
|
|
124
|
-
id: params.eventId,
|
|
125
|
-
type: OUTPUT_TEXT_ITEM_TYPE,
|
|
126
|
-
channel: "web",
|
|
127
|
-
createdAt: new Date().toISOString(),
|
|
128
|
-
status: "completed",
|
|
129
|
-
content: {
|
|
130
|
-
parts: buildCodexParts({
|
|
131
|
-
toolName,
|
|
132
|
-
includeReasoningPart,
|
|
133
|
-
result: turn,
|
|
134
|
-
instruction,
|
|
135
|
-
}),
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
return {
|
|
139
|
-
assistantEvent,
|
|
140
|
-
toolCalls: [],
|
|
141
|
-
messagesForModel: [],
|
|
142
|
-
llm: {
|
|
143
|
-
provider: "openai",
|
|
144
|
-
model: asString(config.model || "codex"),
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
}
|
|
1
|
+
export { createCodexReactor, defaultMapCodexChunk, mapCodexAppServerNotification, mapCodexChunkType, } from "./codex.reactor.js";
|
|
149
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,GAQlB,MAAM,oBAAoB,CAAA"}
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ContextItem } from "@ekairos/events";
|
|
2
|
+
export type AnyRecord = Record<string, unknown>;
|
|
3
|
+
export declare function asString(value: unknown): string;
|
|
4
|
+
export declare function asRecord(value: unknown): AnyRecord;
|
|
5
|
+
export declare function defaultInstructionFromTrigger(event: ContextItem): string;
|
|
6
|
+
export declare function buildCodexParts(params: {
|
|
7
|
+
toolName: string;
|
|
8
|
+
includeReasoningPart: boolean;
|
|
9
|
+
completedOnly?: boolean;
|
|
10
|
+
semanticChunks?: unknown[];
|
|
11
|
+
rawChunks?: unknown[];
|
|
12
|
+
result: {
|
|
13
|
+
providerContextId: string;
|
|
14
|
+
turnId: string;
|
|
15
|
+
assistantText: string;
|
|
16
|
+
reasoningText?: string;
|
|
17
|
+
diff?: string;
|
|
18
|
+
toolParts?: unknown[];
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
instruction: string;
|
|
22
|
+
streamTrace?: unknown;
|
|
23
|
+
}): AnyRecord[];
|
|
24
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE/C,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI/C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAGlD;AA4BD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAIxE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,EAAE,CAAA;IAC1B,SAAS,CAAC,EAAE,OAAO,EAAE,CAAA;IACrB,MAAM,EAAE;QACN,iBAAiB,EAAE,MAAM,CAAA;QACzB,MAAM,EAAE,MAAM,CAAA;QACd,aAAa,EAAE,MAAM,CAAA;QACrB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,SAAS,CAAC,EAAE,OAAO,EAAE,CAAA;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KACnC,CAAA;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,eA6TA"}
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
export function asString(value) {
|
|
2
|
+
if (typeof value === "string")
|
|
3
|
+
return value;
|
|
4
|
+
if (value === null || value === undefined)
|
|
5
|
+
return "";
|
|
6
|
+
return String(value);
|
|
7
|
+
}
|
|
8
|
+
export function asRecord(value) {
|
|
9
|
+
if (!value || typeof value !== "object")
|
|
10
|
+
return {};
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function asArray(value) {
|
|
14
|
+
return Array.isArray(value) ? value : [];
|
|
15
|
+
}
|
|
16
|
+
function textFromParts(parts) {
|
|
17
|
+
if (!Array.isArray(parts))
|
|
18
|
+
return "";
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const part of parts) {
|
|
21
|
+
const record = asRecord(part);
|
|
22
|
+
const partType = asString(record.type);
|
|
23
|
+
if (partType === "text") {
|
|
24
|
+
const value = asString(record.text).trim();
|
|
25
|
+
if (value)
|
|
26
|
+
out.push(value);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (partType === "input_text") {
|
|
30
|
+
const value = asString(record.input_text || record.text).trim();
|
|
31
|
+
if (value)
|
|
32
|
+
out.push(value);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const inline = asString(record.text).trim();
|
|
36
|
+
if (inline)
|
|
37
|
+
out.push(inline);
|
|
38
|
+
}
|
|
39
|
+
return out.join("\n").trim();
|
|
40
|
+
}
|
|
41
|
+
export function defaultInstructionFromTrigger(event) {
|
|
42
|
+
const content = asRecord(event.content);
|
|
43
|
+
const message = textFromParts(content.parts);
|
|
44
|
+
return message || "Continue with the current task.";
|
|
45
|
+
}
|
|
46
|
+
export function buildCodexParts(params) {
|
|
47
|
+
const parts = [];
|
|
48
|
+
const streamTrace = asRecord(params.streamTrace);
|
|
49
|
+
const capturedChunks = asArray(params.rawChunks).length > 0
|
|
50
|
+
? asArray(params.rawChunks)
|
|
51
|
+
: asArray(params.semanticChunks).length > 0
|
|
52
|
+
? asArray(params.semanticChunks)
|
|
53
|
+
: asArray(streamTrace.chunks);
|
|
54
|
+
const semanticChunks = asArray(params.semanticChunks).length > 0
|
|
55
|
+
? asArray(params.semanticChunks)
|
|
56
|
+
: asArray(streamTrace.chunks);
|
|
57
|
+
const lastChunkSequence = capturedChunks.reduce((max, chunk) => {
|
|
58
|
+
const sequence = typeof chunk.sequence === "number" ? chunk.sequence : 0;
|
|
59
|
+
return Math.max(max, sequence);
|
|
60
|
+
}, 0);
|
|
61
|
+
function findLastChunk(predicate) {
|
|
62
|
+
for (let index = capturedChunks.length - 1; index >= 0; index -= 1) {
|
|
63
|
+
const chunk = capturedChunks[index];
|
|
64
|
+
if (!predicate(chunk))
|
|
65
|
+
continue;
|
|
66
|
+
return {
|
|
67
|
+
sequence: typeof chunk.sequence === "number" ? chunk.sequence : 0,
|
|
68
|
+
at: asString(chunk.at),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const turnCompletedChunk = findLastChunk((chunk) => {
|
|
74
|
+
const data = asRecord(chunk.data);
|
|
75
|
+
const method = asString(data.method);
|
|
76
|
+
return method === "turn/completed";
|
|
77
|
+
});
|
|
78
|
+
const completedAgentMessages = semanticChunks
|
|
79
|
+
.map((chunk) => {
|
|
80
|
+
const data = asRecord(chunk.data);
|
|
81
|
+
const method = asString(data.method);
|
|
82
|
+
const paramsRecord = asRecord(data.params);
|
|
83
|
+
const item = asRecord(paramsRecord.item);
|
|
84
|
+
if (method !== "item/completed" || asString(item.type) !== "agentMessage")
|
|
85
|
+
return null;
|
|
86
|
+
const text = asString(item.text).trim();
|
|
87
|
+
if (!text)
|
|
88
|
+
return null;
|
|
89
|
+
return {
|
|
90
|
+
sequence: typeof chunk.sequence === "number" ? chunk.sequence : 0,
|
|
91
|
+
at: asString(chunk.at),
|
|
92
|
+
itemId: asString(item.id),
|
|
93
|
+
text,
|
|
94
|
+
};
|
|
95
|
+
})
|
|
96
|
+
.filter(Boolean);
|
|
97
|
+
const reasoningFromStream = capturedChunks
|
|
98
|
+
.filter((chunk) => {
|
|
99
|
+
const data = asRecord(chunk.data);
|
|
100
|
+
const method = asString(data.method);
|
|
101
|
+
return method === "item/reasoning/summaryTextDelta" || method === "item/reasoning/textDelta";
|
|
102
|
+
})
|
|
103
|
+
.map((chunk) => asString(asRecord(asRecord(chunk.data).params).delta))
|
|
104
|
+
.join("")
|
|
105
|
+
.trim();
|
|
106
|
+
const completedReasoningItems = semanticChunks
|
|
107
|
+
.map((chunk) => {
|
|
108
|
+
const data = asRecord(chunk.data);
|
|
109
|
+
const method = asString(data.method);
|
|
110
|
+
const paramsRecord = asRecord(data.params);
|
|
111
|
+
const item = asRecord(paramsRecord.item);
|
|
112
|
+
if (method !== "item/completed" || asString(item.type) !== "reasoning")
|
|
113
|
+
return null;
|
|
114
|
+
const text = asString(item.summary || item.text).trim();
|
|
115
|
+
if (!text)
|
|
116
|
+
return null;
|
|
117
|
+
return {
|
|
118
|
+
sequence: typeof chunk.sequence === "number" ? chunk.sequence : 0,
|
|
119
|
+
at: asString(chunk.at),
|
|
120
|
+
itemId: asString(item.id),
|
|
121
|
+
text,
|
|
122
|
+
};
|
|
123
|
+
})
|
|
124
|
+
.filter(Boolean);
|
|
125
|
+
for (const message of completedAgentMessages) {
|
|
126
|
+
if (params.completedOnly === true || params.completedOnly === false || params.completedOnly === undefined) {
|
|
127
|
+
parts.push({
|
|
128
|
+
sequence: message.sequence,
|
|
129
|
+
part: {
|
|
130
|
+
type: "text",
|
|
131
|
+
text: message.text,
|
|
132
|
+
metadata: {
|
|
133
|
+
source: "codex.timeline",
|
|
134
|
+
sequence: message.sequence,
|
|
135
|
+
at: message.at,
|
|
136
|
+
itemId: message.itemId,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (params.includeReasoningPart && reasoningFromStream) {
|
|
143
|
+
const lastReasoningChunk = findLastChunk((chunk) => {
|
|
144
|
+
const data = asRecord(chunk.data);
|
|
145
|
+
const method = asString(data.method);
|
|
146
|
+
return method === "item/reasoning/summaryTextDelta" || method === "item/reasoning/textDelta";
|
|
147
|
+
});
|
|
148
|
+
parts.push({
|
|
149
|
+
sequence: lastReasoningChunk?.sequence ?? lastChunkSequence + 1,
|
|
150
|
+
part: {
|
|
151
|
+
type: "reasoning",
|
|
152
|
+
text: reasoningFromStream,
|
|
153
|
+
metadata: {
|
|
154
|
+
source: "codex.timeline.full",
|
|
155
|
+
sequence: lastReasoningChunk?.sequence ?? lastChunkSequence + 1,
|
|
156
|
+
at: lastReasoningChunk?.at ?? "",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
else if (params.includeReasoningPart) {
|
|
162
|
+
for (const reasoningItem of completedReasoningItems) {
|
|
163
|
+
parts.push({
|
|
164
|
+
sequence: reasoningItem.sequence,
|
|
165
|
+
part: {
|
|
166
|
+
type: "reasoning",
|
|
167
|
+
text: reasoningItem.text,
|
|
168
|
+
metadata: {
|
|
169
|
+
source: "codex.timeline",
|
|
170
|
+
sequence: reasoningItem.sequence,
|
|
171
|
+
at: reasoningItem.at,
|
|
172
|
+
itemId: reasoningItem.itemId,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const commands = new Map();
|
|
179
|
+
for (const chunk of capturedChunks) {
|
|
180
|
+
const data = asRecord(chunk.data);
|
|
181
|
+
const method = asString(data.method);
|
|
182
|
+
const paramsRecord = asRecord(data.params);
|
|
183
|
+
if (method === "item/started") {
|
|
184
|
+
const item = asRecord(paramsRecord.item);
|
|
185
|
+
if (asString(item.type) === "commandExecution") {
|
|
186
|
+
commands.set(asString(item.id), {
|
|
187
|
+
...(commands.get(asString(item.id)) ?? {}),
|
|
188
|
+
input: item,
|
|
189
|
+
sequence: typeof chunk.sequence === "number" ? chunk.sequence : undefined,
|
|
190
|
+
at: asString(chunk.at),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (method === "item/commandExecution/outputDelta") {
|
|
196
|
+
const itemId = asString(paramsRecord.itemId);
|
|
197
|
+
if (!itemId)
|
|
198
|
+
continue;
|
|
199
|
+
const current = commands.get(itemId) ?? {};
|
|
200
|
+
current.outputText = `${current.outputText ?? ""}${asString(paramsRecord.delta)}`;
|
|
201
|
+
current.sequence =
|
|
202
|
+
typeof chunk.sequence === "number"
|
|
203
|
+
? Math.max(current.sequence ?? 0, chunk.sequence)
|
|
204
|
+
: current.sequence;
|
|
205
|
+
current.at = asString(chunk.at) || current.at;
|
|
206
|
+
commands.set(itemId, current);
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (method === "item/completed") {
|
|
210
|
+
const item = asRecord(paramsRecord.item);
|
|
211
|
+
if (asString(item.type) === "commandExecution") {
|
|
212
|
+
const itemId = asString(item.id);
|
|
213
|
+
const current = commands.get(itemId) ?? {};
|
|
214
|
+
current.completed = item;
|
|
215
|
+
current.sequence =
|
|
216
|
+
typeof chunk.sequence === "number"
|
|
217
|
+
? Math.max(current.sequence ?? 0, chunk.sequence)
|
|
218
|
+
: current.sequence;
|
|
219
|
+
current.at = asString(chunk.at) || current.at;
|
|
220
|
+
commands.set(itemId, current);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (completedAgentMessages.length === 0) {
|
|
225
|
+
const assistantText = asString(params.result.assistantText).trim();
|
|
226
|
+
if (assistantText && !params.completedOnly) {
|
|
227
|
+
parts.push({
|
|
228
|
+
sequence: lastChunkSequence + 1,
|
|
229
|
+
part: {
|
|
230
|
+
type: "text",
|
|
231
|
+
text: assistantText,
|
|
232
|
+
metadata: {
|
|
233
|
+
source: "codex.timeline.fallback",
|
|
234
|
+
sequence: lastChunkSequence + 1,
|
|
235
|
+
at: "",
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (params.includeReasoningPart &&
|
|
242
|
+
!reasoningFromStream &&
|
|
243
|
+
completedReasoningItems.length === 0) {
|
|
244
|
+
const reasoningText = asString(params.result.reasoningText || reasoningFromStream).trim();
|
|
245
|
+
if (reasoningText && !params.completedOnly) {
|
|
246
|
+
parts.push({
|
|
247
|
+
sequence: lastChunkSequence + 1,
|
|
248
|
+
part: {
|
|
249
|
+
type: "reasoning",
|
|
250
|
+
text: reasoningText,
|
|
251
|
+
metadata: {
|
|
252
|
+
source: "codex.timeline.fallback",
|
|
253
|
+
sequence: lastChunkSequence + 1,
|
|
254
|
+
at: "",
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
for (const [toolCallId, command] of commands.entries()) {
|
|
261
|
+
const input = asRecord(command.input);
|
|
262
|
+
const completed = asRecord(command.completed);
|
|
263
|
+
const outputText = asString(completed.aggregatedOutput || command.outputText).trim();
|
|
264
|
+
const status = asString(completed.status || input.status || "completed").trim();
|
|
265
|
+
const exitCode = typeof completed.exitCode === "number" ? completed.exitCode : undefined;
|
|
266
|
+
parts.push({
|
|
267
|
+
sequence: command.sequence ?? 0,
|
|
268
|
+
part: {
|
|
269
|
+
type: "tool-commandExecution",
|
|
270
|
+
toolName: "commandExecution",
|
|
271
|
+
toolCallId,
|
|
272
|
+
state: status === "failed" || (typeof exitCode === "number" && exitCode !== 0)
|
|
273
|
+
? "output-error"
|
|
274
|
+
: "output-available",
|
|
275
|
+
input: {
|
|
276
|
+
command: asString(input.command),
|
|
277
|
+
cwd: asString(input.cwd),
|
|
278
|
+
commandActions: asArray(input.commandActions),
|
|
279
|
+
},
|
|
280
|
+
output: {
|
|
281
|
+
text: outputText,
|
|
282
|
+
exitCode,
|
|
283
|
+
durationMs: typeof completed.durationMs === "number" ? completed.durationMs : undefined,
|
|
284
|
+
status,
|
|
285
|
+
},
|
|
286
|
+
errorText: status === "failed"
|
|
287
|
+
? asString(completed.error || completed.message || "command_execution_failed")
|
|
288
|
+
: undefined,
|
|
289
|
+
metadata: {
|
|
290
|
+
source: "codex.timeline",
|
|
291
|
+
sequence: command.sequence ?? 0,
|
|
292
|
+
at: command.at ?? "",
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
const tokenUsageChunk = [...semanticChunks]
|
|
298
|
+
.reverse()
|
|
299
|
+
.find((chunk) => {
|
|
300
|
+
const data = asRecord(chunk.data);
|
|
301
|
+
const method = asString(data.method);
|
|
302
|
+
return method === "thread/tokenUsage/updated" || method === "context/tokenUsage/updated";
|
|
303
|
+
});
|
|
304
|
+
const tokenUsage = tokenUsageChunk
|
|
305
|
+
? asRecord(asRecord(asRecord(tokenUsageChunk.data).params).tokenUsage)
|
|
306
|
+
: {};
|
|
307
|
+
if (!params.completedOnly || turnCompletedChunk) {
|
|
308
|
+
parts.push({
|
|
309
|
+
sequence: turnCompletedChunk?.sequence ?? lastChunkSequence + 1,
|
|
310
|
+
part: {
|
|
311
|
+
type: "tool-turnMetadata",
|
|
312
|
+
toolName: "turnMetadata",
|
|
313
|
+
toolCallId: params.result.turnId || params.result.providerContextId,
|
|
314
|
+
state: "output-available",
|
|
315
|
+
input: { instruction: params.instruction },
|
|
316
|
+
output: {
|
|
317
|
+
providerContextId: params.result.providerContextId,
|
|
318
|
+
turnId: params.result.turnId,
|
|
319
|
+
diff: params.result.diff ?? "",
|
|
320
|
+
tokenUsage,
|
|
321
|
+
streamTrace: params.streamTrace,
|
|
322
|
+
...(params.result.metadata ?? {}),
|
|
323
|
+
},
|
|
324
|
+
metadata: {
|
|
325
|
+
source: "codex.timeline",
|
|
326
|
+
sequence: turnCompletedChunk?.sequence ?? lastChunkSequence + 1,
|
|
327
|
+
at: turnCompletedChunk?.at ?? "",
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
return parts
|
|
333
|
+
.sort((a, b) => a.sequence - b.sequence)
|
|
334
|
+
.map((entry) => entry.part);
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IACpD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAA;IAClD,OAAO,KAAkB,CAAA;AAC3B,CAAC;AAED,SAAS,OAAO,CAAc,KAAc;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAa,CAAC,CAAC,CAAC,EAAE,CAAA;AACnD,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACpC,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;QAC7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;YAC1C,IAAI,KAAK;gBAAE,GAAG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
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekairos/openai-reactor",
|
|
3
|
-
"version": "1.22.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.22.4-beta.development.0",
|
|
4
|
+
"description": "Codex-only reactor for @ekairos/events",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -19,16 +19,23 @@
|
|
|
19
19
|
"build": "tsc -p tsconfig.json",
|
|
20
20
|
"dev": "tsc -p tsconfig.json --watch",
|
|
21
21
|
"clean": "node -e \"require('fs').rmSync('dist', {recursive:true, force:true})\"",
|
|
22
|
-
"typecheck": "tsc --noEmit"
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:reactor": "vitest run src/tests/codex.reactor.test.ts --reporter=verbose",
|
|
25
|
+
"test:reactor:instant": "vitest run src/tests/codex.reactor.instant.test.ts --reporter=verbose"
|
|
23
26
|
},
|
|
24
27
|
"peerDependencies": {
|
|
25
|
-
"@ekairos/
|
|
28
|
+
"@ekairos/events": "workspace:*"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"@ekairos/
|
|
31
|
+
"@ekairos/domain": "workspace:*",
|
|
32
|
+
"@ekairos/events": "workspace:*",
|
|
33
|
+
"@instantdb/admin": "0.22.158",
|
|
29
34
|
"@ekairos/tsconfig": "workspace:*",
|
|
30
35
|
"@types/node": "^24.5.0",
|
|
31
|
-
"
|
|
36
|
+
"dotenv": "^17.2.3",
|
|
37
|
+
"typescript": "^5.9.2",
|
|
38
|
+
"vitest": "^4.0.8"
|
|
32
39
|
},
|
|
33
40
|
"repository": {
|
|
34
41
|
"type": "git",
|