@cortices/agent 0.2.15 → 0.3.7

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.
@@ -11,7 +11,7 @@ const bundled = resolve(__dirname, '..', 'dist', 'claude-daemon.mjs') // esbui
11
11
  const source = resolve(__dirname, '..', 'claude-daemon.ts') // dev source
12
12
 
13
13
  try {
14
- if (existsSync(bytecode) && existsSync(bytecode.replace('.cjs', '.jsc'))) {
14
+ if (existsSync(bytecode)) {
15
15
  execFileSync('node', [bytecode, ...process.argv.slice(2)], {
16
16
  stdio: 'inherit', env: process.env,
17
17
  })
@@ -11,7 +11,7 @@ const bundled = resolve(__dirname, '..', 'dist', 'codex-daemon.mjs') // esbuil
11
11
  const source = resolve(__dirname, '..', 'codex-daemon.ts') // dev source
12
12
 
13
13
  try {
14
- if (existsSync(bytecode) && existsSync(bytecode.replace('.cjs', '.jsc'))) {
14
+ if (existsSync(bytecode)) {
15
15
  execFileSync('node', [bytecode, ...process.argv.slice(2)], {
16
16
  stdio: 'inherit', env: process.env,
17
17
  })
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { dirname, resolve } from 'path'
4
+ import { fileURLToPath } from 'url'
5
+ import { existsSync } from 'fs'
6
+ import { execFileSync } from 'child_process'
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url))
9
+ const bytecode = resolve(__dirname, '..', 'dist', 'cortices-daemon.cjs')
10
+ const bundled = resolve(__dirname, '..', 'dist', 'cortices-daemon.mjs')
11
+ const source = resolve(__dirname, '..', 'cortices-daemon.ts')
12
+
13
+ try {
14
+ if (existsSync(bytecode)) {
15
+ execFileSync('node', [bytecode, ...process.argv.slice(2)], {
16
+ stdio: 'inherit', env: process.env,
17
+ })
18
+ } else if (existsSync(bundled)) {
19
+ execFileSync('node', [bundled, ...process.argv.slice(2)], {
20
+ stdio: 'inherit', env: process.env,
21
+ })
22
+ } else {
23
+ execFileSync('npx', ['tsx', source, ...process.argv.slice(2)], {
24
+ stdio: 'inherit', env: process.env,
25
+ })
26
+ }
27
+ } catch (e) {
28
+ process.exit(e.status || 1)
29
+ }
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { dirname, resolve } from 'path'
4
+ import { fileURLToPath } from 'url'
5
+ import { existsSync } from 'fs'
6
+ import { execFileSync } from 'child_process'
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url))
9
+ const bytecode = resolve(__dirname, '..', 'dist', 'opencode-daemon.cjs') // bytecode loader
10
+ const bundled = resolve(__dirname, '..', 'dist', 'opencode-daemon.mjs') // esbuild ESM
11
+ const source = resolve(__dirname, '..', 'opencode-daemon.ts') // dev source
12
+
13
+ try {
14
+ if (existsSync(bytecode)) {
15
+ execFileSync('node', [bytecode, ...process.argv.slice(2)], {
16
+ stdio: 'inherit', env: process.env,
17
+ })
18
+ } else if (existsSync(bundled)) {
19
+ execFileSync('node', [bundled, ...process.argv.slice(2)], {
20
+ stdio: 'inherit', env: process.env,
21
+ })
22
+ } else {
23
+ execFileSync('npx', ['tsx', source, ...process.argv.slice(2)], {
24
+ stdio: 'inherit', env: process.env,
25
+ })
26
+ }
27
+ } catch (e) {
28
+ process.exit(e.status || 1)
29
+ }
package/bin/cortices.mjs CHANGED
@@ -16,17 +16,20 @@ if (agentIdx !== -1 && args[agentIdx + 1]) {
16
16
  args.splice(agentIdx, 2) // remove --agent and its value from args
17
17
  }
18
18
 
19
- if (agentType !== 'claude' && agentType !== 'codex') {
20
- console.error(`Unknown agent type: ${agentType}. Use "claude" or "codex".`)
19
+ const VALID_TYPES = ['claude', 'codex', 'opencode', 'native']
20
+ if (!VALID_TYPES.includes(agentType)) {
21
+ console.error(`Unknown agent type: ${agentType}. Use: ${VALID_TYPES.join(', ')}`)
21
22
  process.exit(1)
22
23
  }
23
24
 
24
- const bytecode = resolve(__dirname, '..', 'dist', `${agentType}-daemon.cjs`)
25
- const bundled = resolve(__dirname, '..', 'dist', `${agentType}-daemon.mjs`)
26
- const source = resolve(__dirname, '..', `${agentType}-daemon.ts`)
25
+ // 'native' type uses cortices-daemon.ts, others use <type>-daemon.ts
26
+ const daemonName = agentType === 'native' ? 'cortices-daemon' : `${agentType}-daemon`
27
+ const bytecode = resolve(__dirname, '..', 'dist', `${daemonName}.cjs`)
28
+ const bundled = resolve(__dirname, '..', 'dist', `${daemonName}.mjs`)
29
+ const source = resolve(__dirname, '..', `${daemonName}.ts`)
27
30
 
28
31
  try {
29
- if (existsSync(bytecode) && existsSync(bytecode.replace('.cjs', '.jsc'))) {
32
+ if (existsSync(bytecode)) {
30
33
  execFileSync('node', [bytecode, ...args], {
31
34
  stdio: 'inherit', env: process.env,
32
35
  })