@a5c-ai/agent-mux-cli 5.0.1-staging.f6da8cd208d2 → 5.0.1-staging.f888f721bccb
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/bootstrap.d.ts +1 -1
- package/dist/commands/adapters.d.ts +2 -6
- package/dist/commands/adapters.d.ts.map +1 -1
- package/dist/commands/adapters.js +2 -129
- package/dist/commands/adapters.js.map +1 -1
- package/dist/commands/agent.d.ts +1 -1
- package/dist/commands/auth.d.ts +2 -6
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +2 -134
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/config.d.ts +2 -6
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +2 -218
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/detect-host.d.ts +2 -5
- package/dist/commands/detect-host.d.ts.map +1 -1
- package/dist/commands/detect-host.js +2 -30
- package/dist/commands/detect-host.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/gateway/index.d.ts +1 -1
- package/dist/commands/hooks.d.ts +1 -1
- package/dist/commands/hooks.js +1 -1
- package/dist/commands/install-helpers.d.ts +3 -22
- package/dist/commands/install-helpers.d.ts.map +1 -1
- package/dist/commands/install-helpers.js +2 -55
- package/dist/commands/install-helpers.js.map +1 -1
- package/dist/commands/install.d.ts +2 -22
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +2 -445
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/launch-bridge-hooks.d.ts +5 -56
- package/dist/commands/launch-bridge-hooks.d.ts.map +1 -1
- package/dist/commands/launch-bridge-hooks.js +4 -218
- package/dist/commands/launch-bridge-hooks.js.map +1 -1
- package/dist/commands/launch-completion-engine.d.ts +4 -4
- package/dist/commands/launch-completion-engine.d.ts.map +1 -1
- package/dist/commands/launch-completion-engine.js +4 -4
- package/dist/commands/launch-completion-engine.js.map +1 -1
- package/dist/commands/launch.d.ts +5 -54
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +4 -1588
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/mcp.d.ts +1 -1
- package/dist/commands/models.d.ts +1 -1
- package/dist/commands/models.js +1 -1
- package/dist/commands/plugin.d.ts +1 -1
- package/dist/commands/profiles.d.ts +1 -1
- package/dist/commands/profiles.js +1 -1
- package/dist/commands/remote.d.ts +1 -1
- package/dist/commands/remote.js +1 -1
- package/dist/commands/run.d.ts +1 -1
- package/dist/commands/run.js +1 -1
- package/dist/commands/sessions.d.ts +1 -1
- package/dist/commands/sessions.js +1 -1
- package/dist/commands/skill.d.ts +1 -1
- package/dist/commands/tui.d.ts +1 -1
- package/dist/commands/workspaces.d.ts +1 -1
- package/dist/commands/workspaces.js +1 -1
- package/dist/exit-codes.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +16 -6
package/dist/bootstrap.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* registered. This module centralises that wiring so the CLI (and any
|
|
6
6
|
* consumer) gets all built-in adapters with a single call.
|
|
7
7
|
*/
|
|
8
|
-
import type { AgentMuxClient } from '@a5c-ai/agent-mux
|
|
8
|
+
import type { AgentMuxClient } from '@a5c-ai/agent-comm-mux';
|
|
9
9
|
/**
|
|
10
10
|
* Registers every built-in adapter on the given client's adapter registry.
|
|
11
11
|
* Safe to call multiple times — `register()` replaces existing entries.
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @see docs/10-cli-reference.md Section 8
|
|
2
|
+
* Re-export shim — adapters logic now lives in @a5c-ai/agent-config-mux.
|
|
5
3
|
*/
|
|
6
|
-
|
|
7
|
-
import type { ParsedArgs } from '../parse-args.js';
|
|
8
|
-
export declare function adaptersCommand(client: AgentMuxClient, args: ParsedArgs): Promise<number>;
|
|
4
|
+
export { adaptersCommand } from '@a5c-ai/agent-config-mux';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/commands/adapters.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/commands/adapters.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,132 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @see docs/10-cli-reference.md Section 8
|
|
2
|
+
* Re-export shim — adapters logic now lives in @a5c-ai/agent-config-mux.
|
|
5
3
|
*/
|
|
6
|
-
|
|
7
|
-
import { flagBool, flagStr } from '../parse-args.js';
|
|
8
|
-
import { ExitCode, errorCodeToExitCode } from '../exit-codes.js';
|
|
9
|
-
import { printTable, printKeyValue, printJsonOk, printJsonError, printError, } from '../output.js';
|
|
10
|
-
export async function adaptersCommand(client, args) {
|
|
11
|
-
const sub = args.subcommand;
|
|
12
|
-
const jsonMode = flagBool(args.flags, 'json') === true;
|
|
13
|
-
if (!sub || sub === 'list') {
|
|
14
|
-
return adaptersList(client, jsonMode);
|
|
15
|
-
}
|
|
16
|
-
if (sub === 'detect') {
|
|
17
|
-
const agent = args.positionals[0] ?? flagStr(args.flags, 'agent');
|
|
18
|
-
if (!agent) {
|
|
19
|
-
if (jsonMode) {
|
|
20
|
-
printJsonError('VALIDATION_ERROR', 'Missing required argument: <agent>');
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
printError('Missing required argument: <agent>');
|
|
24
|
-
}
|
|
25
|
-
return ExitCode.USAGE_ERROR;
|
|
26
|
-
}
|
|
27
|
-
return adaptersDetect(client, agent, jsonMode);
|
|
28
|
-
}
|
|
29
|
-
if (sub === 'info') {
|
|
30
|
-
const agent = args.positionals[0] ?? flagStr(args.flags, 'agent');
|
|
31
|
-
if (!agent) {
|
|
32
|
-
if (jsonMode) {
|
|
33
|
-
printJsonError('VALIDATION_ERROR', 'Missing required argument: <agent>');
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
printError('Missing required argument: <agent>');
|
|
37
|
-
}
|
|
38
|
-
return ExitCode.USAGE_ERROR;
|
|
39
|
-
}
|
|
40
|
-
return adaptersInfo(client, agent, jsonMode);
|
|
41
|
-
}
|
|
42
|
-
if (jsonMode) {
|
|
43
|
-
printJsonError('VALIDATION_ERROR', `Unknown subcommand: adapters ${sub}`);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
printError(`Unknown subcommand: adapters ${sub}`);
|
|
47
|
-
}
|
|
48
|
-
return ExitCode.USAGE_ERROR;
|
|
49
|
-
}
|
|
50
|
-
async function adaptersList(client, jsonMode) {
|
|
51
|
-
try {
|
|
52
|
-
const adapters = client.adapters.list();
|
|
53
|
-
if (jsonMode) {
|
|
54
|
-
printJsonOk(adapters);
|
|
55
|
-
return ExitCode.SUCCESS;
|
|
56
|
-
}
|
|
57
|
-
const rows = adapters.map((a) => [
|
|
58
|
-
a.agent,
|
|
59
|
-
a.displayName ?? a.agent,
|
|
60
|
-
a.source ?? 'built-in',
|
|
61
|
-
]);
|
|
62
|
-
printTable(['Agent', 'Display Name', 'Source'], rows);
|
|
63
|
-
return ExitCode.SUCCESS;
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
return handleError(err, jsonMode);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function adaptersDetect(client, agent, jsonMode) {
|
|
70
|
-
try {
|
|
71
|
-
const info = await client.adapters.detect(agent);
|
|
72
|
-
if (jsonMode) {
|
|
73
|
-
printJsonOk(info);
|
|
74
|
-
return ExitCode.SUCCESS;
|
|
75
|
-
}
|
|
76
|
-
if (!info) {
|
|
77
|
-
printKeyValue([
|
|
78
|
-
['Agent:', agent],
|
|
79
|
-
['Installed:', 'no'],
|
|
80
|
-
]);
|
|
81
|
-
return ExitCode.SUCCESS;
|
|
82
|
-
}
|
|
83
|
-
printKeyValue([
|
|
84
|
-
['Agent:', info.agent],
|
|
85
|
-
['Installed:', info.installed ? 'yes' : 'no'],
|
|
86
|
-
['Path:', info.cliPath ?? '--'],
|
|
87
|
-
['Version:', info.version ?? '--'],
|
|
88
|
-
]);
|
|
89
|
-
return ExitCode.SUCCESS;
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
return handleError(err, jsonMode);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async function adaptersInfo(client, agent, jsonMode) {
|
|
96
|
-
try {
|
|
97
|
-
const caps = client.adapters.capabilities(agent);
|
|
98
|
-
if (jsonMode) {
|
|
99
|
-
printJsonOk(caps);
|
|
100
|
-
return ExitCode.SUCCESS;
|
|
101
|
-
}
|
|
102
|
-
const entries = [];
|
|
103
|
-
for (const [key, value] of Object.entries(caps)) {
|
|
104
|
-
entries.push([`${key}:`, String(value)]);
|
|
105
|
-
}
|
|
106
|
-
printKeyValue(entries);
|
|
107
|
-
return ExitCode.SUCCESS;
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
return handleError(err, jsonMode);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function handleError(err, jsonMode) {
|
|
114
|
-
if (err instanceof AgentMuxError) {
|
|
115
|
-
if (jsonMode) {
|
|
116
|
-
printJsonError(err.code, err.message, err.recoverable);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
printError(err.message);
|
|
120
|
-
}
|
|
121
|
-
return errorCodeToExitCode(err.code);
|
|
122
|
-
}
|
|
123
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
124
|
-
if (jsonMode) {
|
|
125
|
-
printJsonError('INTERNAL', message);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
printError(message);
|
|
129
|
-
}
|
|
130
|
-
return ExitCode.GENERAL_ERROR;
|
|
131
|
-
}
|
|
4
|
+
export { adaptersCommand } from '@a5c-ai/agent-config-mux';
|
|
132
5
|
//# sourceMappingURL=adapters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/commands/adapters.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/commands/adapters.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/commands/agent.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* — no underlying harness command. We copy/remove agent definition files
|
|
6
6
|
* (typically markdown) into per-agent locations.
|
|
7
7
|
*/
|
|
8
|
-
import type { AgentMuxClient } from '@a5c-ai/agent-mux
|
|
8
|
+
import type { AgentMuxClient } from '@a5c-ai/agent-comm-mux';
|
|
9
9
|
import type { ParsedArgs, FlagDef } from '../parse-args.js';
|
|
10
10
|
export declare const AGENT_FLAGS: Record<string, FlagDef>;
|
|
11
11
|
export declare function agentCommand(_client: AgentMuxClient, args: ParsedArgs): Promise<number>;
|
package/dist/commands/auth.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @see docs/10-cli-reference.md Section 18
|
|
2
|
+
* Re-export shim — auth logic now lives in @a5c-ai/agent-config-mux.
|
|
5
3
|
*/
|
|
6
|
-
|
|
7
|
-
import type { ParsedArgs } from '../parse-args.js';
|
|
8
|
-
export declare function authCommand(client: AgentMuxClient, args: ParsedArgs): Promise<number>;
|
|
4
|
+
export { authCommand } from '@a5c-ai/agent-config-mux';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -1,137 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @see docs/10-cli-reference.md Section 18
|
|
2
|
+
* Re-export shim — auth logic now lives in @a5c-ai/agent-config-mux.
|
|
5
3
|
*/
|
|
6
|
-
|
|
7
|
-
import { flagBool, flagStr } from '../parse-args.js';
|
|
8
|
-
import { ExitCode, errorCodeToExitCode } from '../exit-codes.js';
|
|
9
|
-
import { printTable, printKeyValue, printJsonOk, printJsonError, printError, toPlain, } from '../output.js';
|
|
10
|
-
export async function authCommand(client, args) {
|
|
11
|
-
const sub = args.subcommand;
|
|
12
|
-
const jsonMode = flagBool(args.flags, 'json') === true;
|
|
13
|
-
if (sub === 'check') {
|
|
14
|
-
const agent = args.positionals[0] ?? flagStr(args.flags, 'agent');
|
|
15
|
-
return authCheck(client, agent, jsonMode);
|
|
16
|
-
}
|
|
17
|
-
if (sub === 'setup') {
|
|
18
|
-
const agent = args.positionals[0] ?? flagStr(args.flags, 'agent');
|
|
19
|
-
if (!agent) {
|
|
20
|
-
if (jsonMode) {
|
|
21
|
-
printJsonError('VALIDATION_ERROR', 'Missing required argument: <agent>');
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
printError('Missing required argument: <agent>');
|
|
25
|
-
}
|
|
26
|
-
return ExitCode.USAGE_ERROR;
|
|
27
|
-
}
|
|
28
|
-
return authSetup(client, agent, jsonMode);
|
|
29
|
-
}
|
|
30
|
-
if (!sub) {
|
|
31
|
-
if (jsonMode) {
|
|
32
|
-
printJsonError('VALIDATION_ERROR', 'Missing subcommand. Available: check, setup');
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
printError('Missing subcommand. Available: check, setup');
|
|
36
|
-
}
|
|
37
|
-
return ExitCode.USAGE_ERROR;
|
|
38
|
-
}
|
|
39
|
-
if (jsonMode) {
|
|
40
|
-
printJsonError('VALIDATION_ERROR', `Unknown subcommand: auth ${sub}`);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
printError(`Unknown subcommand: auth ${sub}`);
|
|
44
|
-
}
|
|
45
|
-
return ExitCode.USAGE_ERROR;
|
|
46
|
-
}
|
|
47
|
-
async function authCheck(client, agent, jsonMode) {
|
|
48
|
-
try {
|
|
49
|
-
if (agent) {
|
|
50
|
-
const state = await client.auth.check(agent);
|
|
51
|
-
if (jsonMode) {
|
|
52
|
-
printJsonOk(state);
|
|
53
|
-
return ExitCode.SUCCESS;
|
|
54
|
-
}
|
|
55
|
-
const s = toPlain(state);
|
|
56
|
-
printKeyValue([
|
|
57
|
-
['Agent:', agent],
|
|
58
|
-
['Status:', String(s['status'] ?? '--')],
|
|
59
|
-
['Method:', String(s['method'] ?? '--')],
|
|
60
|
-
['Identity:', String(s['identity'] ?? '--')],
|
|
61
|
-
]);
|
|
62
|
-
return ExitCode.SUCCESS;
|
|
63
|
-
}
|
|
64
|
-
// Check all agents
|
|
65
|
-
const allStates = await client.auth.checkAll();
|
|
66
|
-
if (jsonMode) {
|
|
67
|
-
printJsonOk(allStates);
|
|
68
|
-
return ExitCode.SUCCESS;
|
|
69
|
-
}
|
|
70
|
-
const entries = Object.entries(allStates);
|
|
71
|
-
const rows = entries.map(([name, state]) => {
|
|
72
|
-
const s = toPlain(state);
|
|
73
|
-
return [
|
|
74
|
-
name,
|
|
75
|
-
String(s['status'] ?? '--'),
|
|
76
|
-
String(s['method'] ?? '--'),
|
|
77
|
-
String(s['identity'] ?? '--'),
|
|
78
|
-
];
|
|
79
|
-
});
|
|
80
|
-
printTable(['Agent', 'Status', 'Method', 'Identity'], rows);
|
|
81
|
-
return ExitCode.SUCCESS;
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
84
|
-
return handleError(err, jsonMode);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async function authSetup(client, agent, jsonMode) {
|
|
88
|
-
try {
|
|
89
|
-
const guidance = await client.auth.getSetupGuidance(agent);
|
|
90
|
-
if (jsonMode) {
|
|
91
|
-
printJsonOk(guidance);
|
|
92
|
-
return ExitCode.SUCCESS;
|
|
93
|
-
}
|
|
94
|
-
const g = toPlain(guidance);
|
|
95
|
-
process.stdout.write(`Authentication setup for ${agent}\n\n`);
|
|
96
|
-
if (g['steps'] && Array.isArray(g['steps'])) {
|
|
97
|
-
const steps = g['steps'];
|
|
98
|
-
for (let i = 0; i < steps.length; i++) {
|
|
99
|
-
const step = steps[i];
|
|
100
|
-
process.stdout.write(`${i + 1}. ${step['description'] ?? step['instruction'] ?? String(step)}\n`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (g['envVars'] && Array.isArray(g['envVars'])) {
|
|
104
|
-
process.stdout.write('\nEnvironment variables:\n');
|
|
105
|
-
for (const v of g['envVars']) {
|
|
106
|
-
process.stdout.write(` ${v}\n`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if (g['docsUrl']) {
|
|
110
|
-
process.stdout.write(`\nDocumentation: ${g['docsUrl']}\n`);
|
|
111
|
-
}
|
|
112
|
-
return ExitCode.SUCCESS;
|
|
113
|
-
}
|
|
114
|
-
catch (err) {
|
|
115
|
-
return handleError(err, jsonMode);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
function handleError(err, jsonMode) {
|
|
119
|
-
if (err instanceof AgentMuxError) {
|
|
120
|
-
if (jsonMode) {
|
|
121
|
-
printJsonError(err.code, err.message, err.recoverable);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
printError(err.message);
|
|
125
|
-
}
|
|
126
|
-
return errorCodeToExitCode(err.code);
|
|
127
|
-
}
|
|
128
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
129
|
-
if (jsonMode) {
|
|
130
|
-
printJsonError('INTERNAL', message);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
printError(message);
|
|
134
|
-
}
|
|
135
|
-
return ExitCode.GENERAL_ERROR;
|
|
136
|
-
}
|
|
4
|
+
export { authCommand } from '@a5c-ai/agent-config-mux';
|
|
137
5
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @see docs/10-cli-reference.md Section 16
|
|
2
|
+
* Re-export shim — config logic now lives in @a5c-ai/agent-config-mux.
|
|
5
3
|
*/
|
|
6
|
-
|
|
7
|
-
import type { ParsedArgs } from '../parse-args.js';
|
|
8
|
-
export declare function configCommand(client: AgentMuxClient, args: ParsedArgs): Promise<number>;
|
|
4
|
+
export { configCommand } from '@a5c-ai/agent-config-mux';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/commands/config.js
CHANGED
|
@@ -1,221 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @see docs/10-cli-reference.md Section 16
|
|
2
|
+
* Re-export shim — config logic now lives in @a5c-ai/agent-config-mux.
|
|
5
3
|
*/
|
|
6
|
-
|
|
7
|
-
import { flagBool, flagStr } from '../parse-args.js';
|
|
8
|
-
import { ExitCode, errorCodeToExitCode } from '../exit-codes.js';
|
|
9
|
-
import { printJson, printJsonOk, printJsonError, printError, toPlain, } from '../output.js';
|
|
10
|
-
export async function configCommand(client, args) {
|
|
11
|
-
const sub = args.subcommand;
|
|
12
|
-
const jsonMode = flagBool(args.flags, 'json') === true;
|
|
13
|
-
if (sub === 'get') {
|
|
14
|
-
const agent = args.positionals[0] ?? flagStr(args.flags, 'agent');
|
|
15
|
-
if (!agent) {
|
|
16
|
-
if (jsonMode) {
|
|
17
|
-
printJsonError('VALIDATION_ERROR', 'Missing required argument: <agent>');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
printError('Missing required argument: <agent>');
|
|
21
|
-
}
|
|
22
|
-
return ExitCode.USAGE_ERROR;
|
|
23
|
-
}
|
|
24
|
-
const field = args.positionals[1];
|
|
25
|
-
return configGet(client, agent, field, jsonMode);
|
|
26
|
-
}
|
|
27
|
-
if (sub === 'set') {
|
|
28
|
-
const agent = args.positionals[0];
|
|
29
|
-
const field = args.positionals[1];
|
|
30
|
-
const value = args.positionals[2];
|
|
31
|
-
if (!agent || !field || value === undefined) {
|
|
32
|
-
if (jsonMode) {
|
|
33
|
-
printJsonError('VALIDATION_ERROR', 'Usage: amux config set <agent> <field> <value>');
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
printError('Usage: amux config set <agent> <field> <value>');
|
|
37
|
-
}
|
|
38
|
-
return ExitCode.USAGE_ERROR;
|
|
39
|
-
}
|
|
40
|
-
return configSet(client, agent, field, value, jsonMode);
|
|
41
|
-
}
|
|
42
|
-
if (sub === 'schema') {
|
|
43
|
-
const agent = args.positionals[0] ?? flagStr(args.flags, 'agent');
|
|
44
|
-
if (!agent) {
|
|
45
|
-
if (jsonMode) {
|
|
46
|
-
printJsonError('VALIDATION_ERROR', 'Missing required argument: <agent>');
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
printError('Missing required argument: <agent>');
|
|
50
|
-
}
|
|
51
|
-
return ExitCode.USAGE_ERROR;
|
|
52
|
-
}
|
|
53
|
-
return configSchema(client, agent, jsonMode);
|
|
54
|
-
}
|
|
55
|
-
if (sub === 'validate') {
|
|
56
|
-
const agent = args.positionals[0] ?? flagStr(args.flags, 'agent');
|
|
57
|
-
if (!agent) {
|
|
58
|
-
if (jsonMode) {
|
|
59
|
-
printJsonError('VALIDATION_ERROR', 'Missing required argument: <agent>');
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
printError('Missing required argument: <agent>');
|
|
63
|
-
}
|
|
64
|
-
return ExitCode.USAGE_ERROR;
|
|
65
|
-
}
|
|
66
|
-
return configValidate(client, agent, jsonMode);
|
|
67
|
-
}
|
|
68
|
-
if (sub === 'reload') {
|
|
69
|
-
const agent = args.positionals[0] ?? flagStr(args.flags, 'agent');
|
|
70
|
-
return configReload(client, agent, jsonMode);
|
|
71
|
-
}
|
|
72
|
-
if (!sub) {
|
|
73
|
-
if (jsonMode) {
|
|
74
|
-
printJsonError('VALIDATION_ERROR', 'Missing subcommand. Available: get, set, schema, validate, reload');
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
printError('Missing subcommand. Available: get, set, schema, validate, reload');
|
|
78
|
-
}
|
|
79
|
-
return ExitCode.USAGE_ERROR;
|
|
80
|
-
}
|
|
81
|
-
if (jsonMode) {
|
|
82
|
-
printJsonError('VALIDATION_ERROR', `Unknown subcommand: config ${sub}`);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
printError(`Unknown subcommand: config ${sub}`);
|
|
86
|
-
}
|
|
87
|
-
return ExitCode.USAGE_ERROR;
|
|
88
|
-
}
|
|
89
|
-
async function configGet(client, agent, field, jsonMode) {
|
|
90
|
-
try {
|
|
91
|
-
let result;
|
|
92
|
-
if (field) {
|
|
93
|
-
result = await client.config.getField(agent, field);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
result = await client.config.get(agent);
|
|
97
|
-
}
|
|
98
|
-
if (jsonMode) {
|
|
99
|
-
// Ensure `data` key is present even when the field is missing, so
|
|
100
|
-
// consumers can rely on a consistent { ok, data } shape.
|
|
101
|
-
printJsonOk(result === undefined ? null : result);
|
|
102
|
-
}
|
|
103
|
-
else if (typeof result === 'object' && result !== null) {
|
|
104
|
-
printJson(result);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
process.stdout.write(String(result) + '\n');
|
|
108
|
-
}
|
|
109
|
-
return ExitCode.SUCCESS;
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
return handleError(err, jsonMode);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
async function configSet(client, agent, field, rawValue, jsonMode) {
|
|
116
|
-
try {
|
|
117
|
-
// Parse value: JSON if it starts with {, [, ", or is a number/boolean
|
|
118
|
-
let value = rawValue;
|
|
119
|
-
if (rawValue.startsWith('{') || rawValue.startsWith('[') || rawValue.startsWith('"') ||
|
|
120
|
-
rawValue === 'true' || rawValue === 'false' || rawValue === 'null' ||
|
|
121
|
-
!Number.isNaN(Number(rawValue))) {
|
|
122
|
-
try {
|
|
123
|
-
value = JSON.parse(rawValue);
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
// Keep as string
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
await client.config.setField(agent, field, value);
|
|
130
|
-
if (jsonMode) {
|
|
131
|
-
printJsonOk({ agent, field, value });
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
process.stdout.write(`Set ${agent}.${field} = ${JSON.stringify(value)}\n`);
|
|
135
|
-
}
|
|
136
|
-
return ExitCode.SUCCESS;
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
return handleError(err, jsonMode);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
async function configSchema(client, agent, jsonMode) {
|
|
143
|
-
try {
|
|
144
|
-
const schema = await client.config.schema(agent);
|
|
145
|
-
if (jsonMode) {
|
|
146
|
-
printJsonOk(schema);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
printJson(schema);
|
|
150
|
-
}
|
|
151
|
-
return ExitCode.SUCCESS;
|
|
152
|
-
}
|
|
153
|
-
catch (err) {
|
|
154
|
-
return handleError(err, jsonMode);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
async function configValidate(client, agent, jsonMode) {
|
|
158
|
-
try {
|
|
159
|
-
const config = await client.config.get(agent);
|
|
160
|
-
const result = await client.config.validate(agent, config);
|
|
161
|
-
if (jsonMode) {
|
|
162
|
-
printJsonOk(result);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
const r = toPlain(result);
|
|
166
|
-
if (r['valid']) {
|
|
167
|
-
process.stdout.write('Configuration is valid.\n');
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
const errors = (r['errors'] ?? []);
|
|
171
|
-
for (const e of errors) {
|
|
172
|
-
process.stderr.write(` ${e['field']}: ${e['message']}\n`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return ExitCode.SUCCESS;
|
|
177
|
-
}
|
|
178
|
-
catch (err) {
|
|
179
|
-
return handleError(err, jsonMode);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
async function configReload(client, agent, jsonMode) {
|
|
183
|
-
try {
|
|
184
|
-
if (agent) {
|
|
185
|
-
await client.config.reload(agent);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
await client.config.reload();
|
|
189
|
-
}
|
|
190
|
-
if (jsonMode) {
|
|
191
|
-
printJsonOk({ reloaded: agent ?? 'all' });
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
process.stdout.write(`Configuration reloaded${agent ? ` for ${agent}` : ''}.\n`);
|
|
195
|
-
}
|
|
196
|
-
return ExitCode.SUCCESS;
|
|
197
|
-
}
|
|
198
|
-
catch (err) {
|
|
199
|
-
return handleError(err, jsonMode);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function handleError(err, jsonMode) {
|
|
203
|
-
if (err instanceof AgentMuxError) {
|
|
204
|
-
if (jsonMode) {
|
|
205
|
-
printJsonError(err.code, err.message, err.recoverable);
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
printError(err.message);
|
|
209
|
-
}
|
|
210
|
-
return errorCodeToExitCode(err.code);
|
|
211
|
-
}
|
|
212
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
213
|
-
if (jsonMode) {
|
|
214
|
-
printJsonError('INTERNAL', message);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
printError(message);
|
|
218
|
-
}
|
|
219
|
-
return ExitCode.GENERAL_ERROR;
|
|
220
|
-
}
|
|
4
|
+
export { configCommand } from '@a5c-ai/agent-config-mux';
|
|
221
5
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* under a supported agent harness.
|
|
2
|
+
* Re-export shim — detect-host logic now lives in @a5c-ai/agent-config-mux.
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
import type { ParsedArgs } from '../parse-args.js';
|
|
7
|
-
export declare function detectHostCommand(client: AgentMuxClient, args: ParsedArgs): Promise<number>;
|
|
4
|
+
export { detectHostCommand } from '@a5c-ai/agent-config-mux';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-host.d.ts","sourceRoot":"","sources":["../../src/commands/detect-host.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"detect-host.d.ts","sourceRoot":"","sources":["../../src/commands/detect-host.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* under a supported agent harness.
|
|
2
|
+
* Re-export shim — detect-host logic now lives in @a5c-ai/agent-config-mux.
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
import { ExitCode } from '../exit-codes.js';
|
|
7
|
-
import { printJsonOk, printKeyValue } from '../output.js';
|
|
8
|
-
export async function detectHostCommand(client, args) {
|
|
9
|
-
const jsonMode = flagBool(args.flags, 'json') === true;
|
|
10
|
-
const info = client.detectHost();
|
|
11
|
-
if (jsonMode) {
|
|
12
|
-
printJsonOk({
|
|
13
|
-
detected: info !== null,
|
|
14
|
-
agent: info?.agent ?? null,
|
|
15
|
-
confidence: info?.confidence ?? null,
|
|
16
|
-
source: info?.source ?? null,
|
|
17
|
-
matchedSignals: info?.matchedSignals ?? [],
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
else if (info === null) {
|
|
21
|
-
process.stdout.write('No host harness detected. This process appears to be running from a shell.\n');
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
printKeyValue([
|
|
25
|
-
['Host agent:', info.agent],
|
|
26
|
-
['Confidence:', info.confidence],
|
|
27
|
-
['Source:', info.source],
|
|
28
|
-
['Signals:', info.matchedSignals.join(', ') || '--'],
|
|
29
|
-
]);
|
|
30
|
-
}
|
|
31
|
-
return ExitCode.SUCCESS;
|
|
32
|
-
}
|
|
4
|
+
export { detectHostCommand } from '@a5c-ai/agent-config-mux';
|
|
33
5
|
//# sourceMappingURL=detect-host.js.map
|