echo-cli-agent 0.1.7 → 0.1.9
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 +11 -2
- package/dist/src/dispatch/dispatcher.d.ts +19 -3
- package/dist/src/dispatch/dispatcher.js +98 -4
- package/dist/src/dispatch/dispatcher.js.map +1 -1
- package/dist/src/health/server.d.ts +5 -1
- package/dist/src/health/server.js +8 -1
- package/dist/src/health/server.js.map +1 -1
- package/dist/src/index.js +8 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/providers/codex.js +25 -0
- package/dist/src/providers/codex.js.map +1 -1
- package/dist/src/providers/detection.d.ts +11 -0
- package/dist/src/providers/detection.js +96 -0
- package/dist/src/providers/detection.js.map +1 -0
- package/dist/src/providers/registry.d.ts +23 -0
- package/dist/src/providers/registry.js +59 -29
- package/dist/src/providers/registry.js.map +1 -1
- package/dist/src/runtime/agent-runtime.js +22 -10
- package/dist/src/runtime/agent-runtime.js.map +1 -1
- package/dist/src/session/session-manager.d.ts +41 -2
- package/dist/src/session/session-manager.js +178 -34
- package/dist/src/session/session-manager.js.map +1 -1
- package/dist/src/session/terminal-line-sanitizer.d.ts +7 -0
- package/dist/src/session/terminal-line-sanitizer.js +21 -0
- package/dist/src/session/terminal-line-sanitizer.js.map +1 -0
- package/dist/src/session/terminal-tail-buffer.d.ts +70 -0
- package/dist/src/session/terminal-tail-buffer.js +149 -0
- package/dist/src/session/terminal-tail-buffer.js.map +1 -0
- package/dist/src/shared/cli-detection-types.d.ts +19 -0
- package/dist/src/shared/cli-detection-types.js +2 -0
- package/dist/src/shared/cli-detection-types.js.map +1 -0
- package/dist/src/shared/node-cli-command-resolution.d.ts +8 -0
- package/dist/src/shared/node-cli-command-resolution.js +11 -1
- package/dist/src/shared/node-cli-command-resolution.js.map +1 -1
- package/dist/src/transport/taskmcp-client.d.ts +3 -1
- package/dist/src/transport/taskmcp-client.js +4 -0
- package/dist/src/transport/taskmcp-client.js.map +1 -1
- package/dist/src/types/protocol.d.ts +53 -1
- package/dist/src/types/protocol.js +33 -1
- package/dist/src/types/protocol.js.map +1 -1
- package/dist/tests/cli-detection.test.d.ts +1 -0
- package/dist/tests/cli-detection.test.js +62 -0
- package/dist/tests/cli-detection.test.js.map +1 -0
- package/dist/tests/providers.test.js +1 -0
- package/dist/tests/providers.test.js.map +1 -1
- package/dist/tests/session-manager.test.d.ts +1 -0
- package/dist/tests/session-manager.test.js +115 -0
- package/dist/tests/session-manager.test.js.map +1 -0
- package/dist/tests/terminal-tail-buffer.test.d.ts +1 -0
- package/dist/tests/terminal-tail-buffer.test.js +68 -0
- package/dist/tests/terminal-tail-buffer.test.js.map +1 -0
- package/package.json +1 -1
- package/scripts/service.mjs +25 -0
package/scripts/service.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { spawnSync } from 'node:child_process'
|
|
|
8
8
|
|
|
9
9
|
const SERVICE_NAME = 'echo-cli-agent'
|
|
10
10
|
const LAUNCHD_LABEL = 'top.stormapex.echo-cli-agent'
|
|
11
|
+
const LEGACY_LAUNCHD_LABEL = 'top.stormapex.api-ocra-agent'
|
|
11
12
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
12
13
|
const agentEntry = join(root, 'dist', 'src', 'index.js')
|
|
13
14
|
const action = process.argv[2]
|
|
@@ -39,15 +40,19 @@ function defaultConfigPath() {
|
|
|
39
40
|
|
|
40
41
|
async function manageLaunchd(mode) {
|
|
41
42
|
const target = join(homedir(), 'Library', 'LaunchAgents', `${LAUNCHD_LABEL}.plist`)
|
|
43
|
+
const legacyTarget = join(homedir(), 'Library', 'LaunchAgents', `${LEGACY_LAUNCHD_LABEL}.plist`)
|
|
42
44
|
const domain = `gui/${process.getuid()}`
|
|
43
45
|
if (mode === 'uninstall') {
|
|
44
46
|
command('launchctl', ['bootout', domain, target], true)
|
|
47
|
+
command('launchctl', ['bootout', domain, `${domain}/${LEGACY_LAUNCHD_LABEL}`], true)
|
|
45
48
|
await unlink(target).catch(ignoreMissing)
|
|
49
|
+
await unlink(legacyTarget).catch(ignoreMissing)
|
|
46
50
|
process.stdout.write(`Removed ${target}\n`)
|
|
47
51
|
return
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
const logDir = join(defaultDataDir(), 'logs')
|
|
55
|
+
const path = servicePath()
|
|
51
56
|
await mkdir(dirname(target), { recursive: true })
|
|
52
57
|
await mkdir(logDir, { recursive: true, mode: 0o700 })
|
|
53
58
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -59,12 +64,20 @@ async function manageLaunchd(mode) {
|
|
|
59
64
|
</array>
|
|
60
65
|
<key>EnvironmentVariables</key><dict>
|
|
61
66
|
<key>ECHO_AGENT_CONFIG</key><string>${xml(configPath)}</string>
|
|
67
|
+
<key>HOME</key><string>${xml(homedir())}</string>
|
|
68
|
+
<key>SHELL</key><string>${xml(process.env.SHELL ?? '/bin/zsh')}</string>
|
|
69
|
+
<key>PATH</key><string>${xml(path)}</string>
|
|
62
70
|
</dict>
|
|
63
71
|
<key>RunAtLoad</key><true/><key>KeepAlive</key><true/>
|
|
64
72
|
<key>StandardOutPath</key><string>${xml(join(logDir, 'service.stdout.log'))}</string>
|
|
65
73
|
<key>StandardErrorPath</key><string>${xml(join(logDir, 'service.stderr.log'))}</string>
|
|
66
74
|
</dict></plist>
|
|
67
75
|
`
|
|
76
|
+
// api_ocra was renamed to echo-cli-agent. Remove the old launchd job before
|
|
77
|
+
// bootstrapping the replacement, otherwise both jobs compete for port 17329.
|
|
78
|
+
command('launchctl', ['bootout', domain, legacyTarget], true)
|
|
79
|
+
command('launchctl', ['bootout', domain, `${domain}/${LEGACY_LAUNCHD_LABEL}`], true)
|
|
80
|
+
await unlink(legacyTarget).catch(ignoreMissing)
|
|
68
81
|
await writeFile(target, plist, { mode: 0o600 })
|
|
69
82
|
command('launchctl', ['bootout', domain, target], true)
|
|
70
83
|
command('launchctl', ['bootstrap', domain, target])
|
|
@@ -92,6 +105,7 @@ Wants=network-online.target
|
|
|
92
105
|
[Service]
|
|
93
106
|
Type=simple
|
|
94
107
|
Environment=ECHO_AGENT_CONFIG=${systemdQuote(configPath)}
|
|
108
|
+
Environment=PATH=${systemdQuote(servicePath())}
|
|
95
109
|
ExecStart=${systemdQuote(process.execPath)} ${systemdQuote(agentEntry)} run
|
|
96
110
|
Restart=always
|
|
97
111
|
RestartSec=3
|
|
@@ -135,6 +149,17 @@ function xml(value) {
|
|
|
135
149
|
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"')
|
|
136
150
|
}
|
|
137
151
|
|
|
152
|
+
function servicePath() {
|
|
153
|
+
const entries = [
|
|
154
|
+
dirname(process.execPath),
|
|
155
|
+
join(homedir(), '.local', 'bin'),
|
|
156
|
+
'/opt/homebrew/bin',
|
|
157
|
+
'/usr/local/bin',
|
|
158
|
+
process.env.PATH ?? ''
|
|
159
|
+
]
|
|
160
|
+
return [...new Set(entries.flatMap((entry) => entry.split(':')).filter(Boolean))].join(':')
|
|
161
|
+
}
|
|
162
|
+
|
|
138
163
|
function systemdQuote(value) {
|
|
139
164
|
return `"${value.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('%', '%%')}"`
|
|
140
165
|
}
|