codiedev 0.9.41 → 0.9.43

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/dist/codie.js CHANGED
@@ -169,6 +169,66 @@ function installBrandWordmarkUnsafe(runtime) {
169
169
  (0, child_process_1.spawnSync)("codesign", ["--force", "--sign", "-", runtime], { stdio: "ignore" });
170
170
  }
171
171
  }
172
+ async function runNonInteractive(runtime, runtimeArgs, env) {
173
+ const child = (0, child_process_1.spawn)(runtime, runtimeArgs, {
174
+ stdio: ["inherit", "pipe", "pipe"],
175
+ env,
176
+ });
177
+ return await new Promise((resolve, reject) => {
178
+ let blockReason;
179
+ let pendingStdout = [];
180
+ let flushTimer;
181
+ // OpenCode reports a plugin rejection through two different pipes: the
182
+ // adapter's private reason on stderr, then its generic UnknownError on
183
+ // stdout. Hold stdout very briefly so the reason can win that race. Normal
184
+ // run output remains streaming with only an imperceptible delay.
185
+ const flushStdout = () => {
186
+ flushTimer = undefined;
187
+ if (!blockReason) {
188
+ for (const chunk of pendingStdout)
189
+ process.stdout.write(chunk);
190
+ }
191
+ pendingStdout = [];
192
+ };
193
+ const scheduleStdoutFlush = () => {
194
+ if (!flushTimer)
195
+ flushTimer = setTimeout(flushStdout, 75);
196
+ };
197
+ child.stdout?.on("data", (chunk) => {
198
+ if (blockReason)
199
+ return;
200
+ pendingStdout.push(Buffer.from(chunk));
201
+ scheduleStdoutFlush();
202
+ });
203
+ child.stderr?.on("data", (chunk) => {
204
+ const text = chunk.toString();
205
+ const reason = (0, codieLauncher_1.extractCodieSecurityBlock)(text);
206
+ if (reason) {
207
+ blockReason = reason;
208
+ pendingStdout = [];
209
+ if (flushTimer)
210
+ clearTimeout(flushTimer);
211
+ flushTimer = undefined;
212
+ return;
213
+ }
214
+ if (!blockReason)
215
+ process.stderr.write(chunk);
216
+ });
217
+ child.once("error", reject);
218
+ child.once("close", (status) => {
219
+ if (flushTimer)
220
+ clearTimeout(flushTimer);
221
+ if (blockReason) {
222
+ pendingStdout = [];
223
+ console.error(`Codie Security blocked this action:\n${blockReason}`);
224
+ }
225
+ else {
226
+ flushStdout();
227
+ }
228
+ resolve(status);
229
+ });
230
+ });
231
+ }
172
232
  async function main() {
173
233
  (0, codieRuntime_1.assertCodieNodeVersion)(process.versions.node);
174
234
  const connected = connectedCodiedevConfig();
@@ -235,23 +295,13 @@ async function main() {
235
295
  const nonInteractiveRun = runtimeArgs[0] === "run";
236
296
  if (nonInteractiveRun)
237
297
  env.CODIEDEV_SECURITY_BLOCK_OUTPUT = "marker";
238
- const result = (0, child_process_1.spawnSync)(runtime, runtimeArgs, {
239
- stdio: nonInteractiveRun ? ["inherit", "inherit", "pipe"] : "inherit",
240
- encoding: nonInteractiveRun ? "utf8" : undefined,
241
- env,
242
- });
243
- if (result.error)
244
- throw result.error;
245
298
  if (nonInteractiveRun) {
246
- const stderr = typeof result.stderr === "string" ? result.stderr : result.stderr?.toString() ?? "";
247
- const blockReason = (0, codieLauncher_1.extractCodieSecurityBlock)(stderr);
248
- if (blockReason) {
249
- console.error(`Codie Security blocked this action:\n${blockReason}`);
250
- }
251
- else if (stderr) {
252
- process.stderr.write(stderr);
253
- }
299
+ process.exitCode = (await runNonInteractive(runtime, runtimeArgs, env)) ?? 1;
300
+ return;
254
301
  }
302
+ const result = (0, child_process_1.spawnSync)(runtime, runtimeArgs, { stdio: "inherit", env });
303
+ if (result.error)
304
+ throw result.error;
255
305
  process.exitCode = result.status === null ? 1 : result.status;
256
306
  }
257
307
  main().catch((error) => {
package/dist/utils.js CHANGED
@@ -1110,6 +1110,7 @@ function installOpenCodeCapturePlugin(agentSecurityEnabled = true) {
1110
1110
  ` try { await client.tui.showToast({ title: "Codie Security", message: reason, variant: "error", duration: 10000 }); } catch {}\n` +
1111
1111
  ` if (process.env.CODIEDEV_SECURITY_BLOCK_OUTPUT === "marker") {\n` +
1112
1112
  ` process.stderr.write("__CODIEDEV_SECURITY_BLOCK__" + JSON.stringify({ reason }) + "\\n");\n` +
1113
+ ` process.exit(1);\n` +
1113
1114
  ` } else {\n` +
1114
1115
  ` process.stderr.write("\\nCodie Security blocked this action:\\n" + reason + "\\n");\n` +
1115
1116
  ` }\n` +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codiedev",
3
- "version": "0.9.41",
3
+ "version": "0.9.43",
4
4
  "description": "Connect Claude Code, Codex, Cursor, OpenCode, or VS Code Copilot to Codiedev for team session capture and artifact collaboration — and run the governed Codie harness",
5
5
  "bin": {
6
6
  "codiedev": "dist/cli.js",