@meetopenbot/codex 1.2.2 → 1.2.3

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.
Files changed (2) hide show
  1. package/dist/index.js +58 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -96,7 +96,64 @@ import {
96
96
  createTextReplyBuffer,
97
97
  textReply
98
98
  } from "@meetopenbot/plugin-sdk";
99
+ var TOOL_ITEM_TYPES = /* @__PURE__ */ new Set([
100
+ "command_execution",
101
+ "mcp_tool_call",
102
+ "web_search",
103
+ "file_change"
104
+ ]);
105
+ var codexToolHint = (item, done) => {
106
+ if (!TOOL_ITEM_TYPES.has(item.type)) return void 0;
107
+ if (item.type === "command_execution") {
108
+ const hint = {
109
+ id: item.id,
110
+ name: "bash",
111
+ input: { command: item.command }
112
+ };
113
+ if (!done) return { type: "tool_call", ...hint };
114
+ return {
115
+ type: "tool_result",
116
+ ...hint,
117
+ output: item.aggregated_output,
118
+ error: item.status === "failed" || item.exit_code != null && item.exit_code !== 0
119
+ };
120
+ }
121
+ if (item.type === "mcp_tool_call") {
122
+ const hint = {
123
+ id: item.id,
124
+ name: item.server ? `${item.server}: ${item.tool}` : item.tool,
125
+ input: item.arguments
126
+ };
127
+ if (!done) return { type: "tool_call", ...hint };
128
+ return {
129
+ type: "tool_result",
130
+ ...hint,
131
+ output: item.error?.message ?? item.result,
132
+ error: item.status === "failed"
133
+ };
134
+ }
135
+ if (item.type === "web_search") {
136
+ const hint = { id: item.id, name: "web_search", input: { query: item.query } };
137
+ if (!done) return { type: "tool_call", ...hint };
138
+ return { type: "tool_result", ...hint, output: item.query };
139
+ }
140
+ if (item.type === "file_change") {
141
+ const hint = { id: item.id, name: "file_change", input: { changes: item.changes } };
142
+ if (!done) return { type: "tool_call", ...hint };
143
+ return {
144
+ type: "tool_result",
145
+ ...hint,
146
+ output: item.changes,
147
+ error: item.status === "failed"
148
+ };
149
+ }
150
+ return void 0;
151
+ };
99
152
  var classifyCodexEvent = (chunk) => {
153
+ if (chunk.type === "item.started" || chunk.type === "item.completed") {
154
+ const tool = codexToolHint(chunk.item, chunk.type === "item.completed");
155
+ if (tool) return tool;
156
+ }
100
157
  if (chunk.type === "item.completed" && chunk.item.type === "agent_message" && chunk.item.text.trim()) {
101
158
  return { type: "text", text: chunk.item.text };
102
159
  }
@@ -105,7 +162,7 @@ var classifyCodexEvent = (chunk) => {
105
162
  };
106
163
  async function* runCodexStream(args) {
107
164
  const { events, state, storage } = args;
108
- const replies = createTextReplyBuffer();
165
+ const replies = createTextReplyBuffer({ groupId: "codex:tools" });
109
166
  for await (const chunk of events) {
110
167
  if (chunk.type === "thread.started") {
111
168
  await codexSession.write(state, storage, chunk.thread_id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetopenbot/codex",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "description": "OpenAI Codex agent plugin for OpenBot",
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "@openai/codex-sdk": "0.148.0",
22
- "@meetopenbot/plugin-sdk": "^0.4.0"
22
+ "@meetopenbot/plugin-sdk": "^0.5.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^25.6.0",