thoth-agents 0.2.1 → 0.2.2

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.
@@ -546,7 +546,8 @@ function spawn(command, options = {}) {
546
546
  options.stdin ?? "pipe",
547
547
  options.stdout ?? "pipe",
548
548
  options.stderr ?? "pipe"
549
- ]
549
+ ],
550
+ shell: options.shell
550
551
  });
551
552
  const managed = {
552
553
  stdin: child.stdin ?? fallbackStdin(),
@@ -577,7 +578,8 @@ function spawnSync(command, options = {}) {
577
578
  options.stdin ?? "ignore",
578
579
  options.stdout ?? "pipe",
579
580
  options.stderr ?? "pipe"
580
- ]
581
+ ],
582
+ shell: options.shell
581
583
  });
582
584
  return { exitCode: result.status };
583
585
  }
@@ -585,6 +587,25 @@ function spawnSync(command, options = {}) {
585
587
  // src/cli/system.ts
586
588
  import { statSync } from "fs";
587
589
  var cachedOpenCodePath = null;
590
+ function quoteWindowsShellCommand(command) {
591
+ if (!/[\s&()^<>"|]/.test(command)) {
592
+ return command;
593
+ }
594
+ return `"${command.replace(/"/g, '\\"')}"`;
595
+ }
596
+ function getOpenCodeVersionInvocation(opencodePath, platform = process.platform) {
597
+ const options = {
598
+ stdout: "pipe",
599
+ stderr: "pipe"
600
+ };
601
+ if (platform === "win32") {
602
+ return {
603
+ command: [`${quoteWindowsShellCommand(opencodePath)} --version`],
604
+ options: { ...options, shell: true }
605
+ };
606
+ }
607
+ return { command: [opencodePath, "--version"], options };
608
+ }
588
609
  function getOpenCodePaths() {
589
610
  const home = process.env.HOME || process.env.USERPROFILE || "";
590
611
  return [
@@ -651,10 +672,8 @@ async function isOpenCodeInstalled() {
651
672
  const paths = getOpenCodePaths();
652
673
  for (const opencodePath of paths) {
653
674
  try {
654
- const proc = spawn([opencodePath, "--version"], {
655
- stdout: "pipe",
656
- stderr: "pipe"
657
- });
675
+ const invocation = getOpenCodeVersionInvocation(opencodePath);
676
+ const proc = spawn(invocation.command, invocation.options);
658
677
  await proc.exited;
659
678
  if (proc.exitCode === 0) {
660
679
  cachedOpenCodePath = opencodePath;
@@ -668,10 +687,8 @@ async function isOpenCodeInstalled() {
668
687
  async function getOpenCodeVersion() {
669
688
  const opencodePath = resolveOpenCodePath();
670
689
  try {
671
- const proc = spawn([opencodePath, "--version"], {
672
- stdout: "pipe",
673
- stderr: "pipe"
674
- });
690
+ const invocation = getOpenCodeVersionInvocation(opencodePath);
691
+ const proc = spawn(invocation.command, invocation.options);
675
692
  const output = await new Response(proc.stdout).text();
676
693
  await proc.exited;
677
694
  if (proc.exitCode === 0) {
package/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  getOpenCodeVersion,
5
5
  isOpenCodeInstalled,
6
6
  opencodeAdapter
7
- } from "../chunk-4WYCZ5Z7.js";
7
+ } from "../chunk-3SQ4ZQ57.js";
8
8
  import {
9
9
  CODEX_ROLE_NAMES,
10
10
  RECOMMENDED_SKILLS,
@@ -1,6 +1,16 @@
1
+ type OpenCodeVersionInvocation = {
2
+ command: string[];
3
+ options: {
4
+ stdout: 'pipe';
5
+ stderr: 'pipe';
6
+ shell?: boolean;
7
+ };
8
+ };
9
+ export declare function getOpenCodeVersionInvocation(opencodePath: string, platform?: typeof process.platform): OpenCodeVersionInvocation;
1
10
  export declare function resolveOpenCodePath(): string;
2
11
  export declare function isOpenCodeInstalled(): Promise<boolean>;
3
12
  export declare function isTmuxInstalled(): Promise<boolean>;
4
13
  export declare function getOpenCodeVersion(): Promise<string | null>;
5
14
  export declare function getOpenCodePath(): string | null;
6
15
  export declare function fetchLatestVersion(packageName: string): Promise<string | null>;
16
+ export {};
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  renderOpenCodeAgentConfigs,
4
4
  spawn,
5
5
  spawnSync
6
- } from "./chunk-4WYCZ5Z7.js";
6
+ } from "./chunk-3SQ4ZQ57.js";
7
7
  import {
8
8
  DEFAULT_THOTH_COMMAND,
9
9
  POLL_INTERVAL_BACKGROUND_MS,
@@ -4,6 +4,7 @@ type SpawnOptions = {
4
4
  stdin?: 'pipe' | 'ignore';
5
5
  stdout?: 'pipe' | 'ignore';
6
6
  stderr?: 'pipe' | 'ignore';
7
+ shell?: boolean | string;
7
8
  };
8
9
  export type ManagedSubprocess = {
9
10
  stdin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thoth-agents",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Delegate-first OpenCode plugin with seven agents, thoth-mem persistence, and bundled SDD skills.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",