codex-message 0.2.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
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# codex-message
|
|
2
|
+
|
|
3
|
+
`codex-message` is a separate Rust wrapper around `codex app-server` that uses
|
|
4
|
+
the `agent-message` binary as its transport layer and reuses the default
|
|
5
|
+
`agent-message` config/profile store.
|
|
6
|
+
|
|
7
|
+
Install:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g agent-message codex-message
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`codex-message` expects both `agent-message` and the `codex` CLI to already be
|
|
14
|
+
available on your `PATH`.
|
|
15
|
+
|
|
16
|
+
Behavior:
|
|
17
|
+
|
|
18
|
+
1. Starts a fresh `agent-{chatId}` account with a generated password.
|
|
19
|
+
2. Sends the `--to` user a startup message with the generated credentials.
|
|
20
|
+
3. Reuses one Codex app-server thread for the DM session.
|
|
21
|
+
4. Polls `agent-message read <user>` for new plain-text requests, adds a `👀` reaction to each accepted inbound DM, and relays it into `turn/start`.
|
|
22
|
+
5. For approval and input requests, sends readable `json_render` prompts back to Jay and waits for a text reply.
|
|
23
|
+
6. Sends final Codex results back as `json_render` reports and, after a successful turn completion, replaces the inbound `👀` reaction with `✅`.
|
|
24
|
+
|
|
25
|
+
Example:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
codex-message --to jay --model gpt-5.4
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Useful flags:
|
|
32
|
+
|
|
33
|
+
- `--to jay`
|
|
34
|
+
- `--cwd /path/to/worktree`
|
|
35
|
+
- `--approval-policy on-request`
|
|
36
|
+
- `--sandbox workspace-write`
|
|
37
|
+
- `--network-access`
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { accessSync, constants, existsSync } from 'node:fs'
|
|
4
|
+
import { delimiter, dirname, join, resolve } from 'node:path'
|
|
5
|
+
import process from 'node:process'
|
|
6
|
+
import { spawnSync } from 'node:child_process'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
|
|
9
|
+
const scriptDir = dirname(fileURLToPath(import.meta.url))
|
|
10
|
+
const packageRoot = resolve(scriptDir, '..', '..')
|
|
11
|
+
const runtimeBinDir = resolve(packageRoot, 'npm', 'runtime', 'bin')
|
|
12
|
+
|
|
13
|
+
function resolveBinaryPath() {
|
|
14
|
+
if (process.platform !== 'darwin') {
|
|
15
|
+
throw new Error(`unsupported platform: ${process.platform}. This package currently supports macOS only.`)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (process.arch === 'arm64') {
|
|
19
|
+
return join(runtimeBinDir, 'codex-message-darwin-arm64')
|
|
20
|
+
}
|
|
21
|
+
if (process.arch === 'x64') {
|
|
22
|
+
return join(runtimeBinDir, 'codex-message-darwin-amd64')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
throw new Error(`unsupported architecture: ${process.arch}. Expected arm64 or x64 on macOS.`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function findOnPath(command) {
|
|
29
|
+
const pathValue = process.env.PATH ?? ''
|
|
30
|
+
for (const entry of pathValue.split(delimiter)) {
|
|
31
|
+
if (!entry) {
|
|
32
|
+
continue
|
|
33
|
+
}
|
|
34
|
+
const candidate = join(entry, command)
|
|
35
|
+
try {
|
|
36
|
+
accessSync(candidate, constants.X_OK)
|
|
37
|
+
return candidate
|
|
38
|
+
} catch {}
|
|
39
|
+
}
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function requireCommand(command, installHint) {
|
|
44
|
+
if (findOnPath(command)) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
console.error(`${command} was not found on PATH. ${installHint}`)
|
|
48
|
+
process.exit(1)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const binaryPath = resolveBinaryPath()
|
|
52
|
+
if (!existsSync(binaryPath)) {
|
|
53
|
+
console.error(`packaged codex-message binary is missing at ${binaryPath}. Reinstall the package or rebuild the npm bundle.`)
|
|
54
|
+
process.exit(1)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
requireCommand('agent-message', 'Install it first with `npm install -g agent-message`.')
|
|
58
|
+
requireCommand('codex', 'Install the Codex CLI before running codex-message.')
|
|
59
|
+
|
|
60
|
+
const child = spawnSync(binaryPath, process.argv.slice(2), {
|
|
61
|
+
stdio: 'inherit',
|
|
62
|
+
cwd: process.cwd(),
|
|
63
|
+
env: process.env,
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
if (child.error) {
|
|
67
|
+
console.error(child.error.message)
|
|
68
|
+
process.exit(1)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
process.exit(child.status ?? 0)
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codex-message",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Codex wrapper for agent-message on macOS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"codex-message": "./npm/bin/codex-message.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"README.md",
|
|
11
|
+
"npm/bin",
|
|
12
|
+
"npm/runtime"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"prepare:npm-bundle": "node ./scripts/prepare-npm-bundle.mjs",
|
|
16
|
+
"prepack": "node ./scripts/prepare-npm-bundle.mjs",
|
|
17
|
+
"pack:dry-run": "npm pack --dry-run"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"os": [
|
|
23
|
+
"darwin"
|
|
24
|
+
],
|
|
25
|
+
"cpu": [
|
|
26
|
+
"arm64",
|
|
27
|
+
"x64"
|
|
28
|
+
],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/siisee11/agent-message.git",
|
|
32
|
+
"directory": "codex-message"
|
|
33
|
+
}
|
|
34
|
+
}
|