@ash-ai/cli 0.0.1
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/LICENSE +21 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +91 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/agent.d.ts +3 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +48 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/deploy.d.ts +3 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +44 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/health.d.ts +3 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +17 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/logs.d.ts +3 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +16 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +127 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/start.d.ts +3 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +94 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +32 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/stop.d.ts +3 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +23 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/docker.d.ts +25 -0
- package/dist/docker.d.ts.map +1 -0
- package/dist/docker.js +133 -0
- package/dist/docker.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ash Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function deployAgent(name: string, path: string): Promise<unknown>;
|
|
2
|
+
export declare function listAgents(): Promise<unknown[]>;
|
|
3
|
+
export declare function getAgentInfo(name: string): Promise<unknown>;
|
|
4
|
+
export declare function createSession(agent: string): Promise<unknown>;
|
|
5
|
+
export declare function sendMessage(sessionId: string, content: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
6
|
+
export declare function listSessions(): Promise<unknown[]>;
|
|
7
|
+
export declare function pauseSession(sessionId: string): Promise<unknown>;
|
|
8
|
+
export declare function resumeSession(sessionId: string): Promise<unknown>;
|
|
9
|
+
export declare function endSession(sessionId: string): Promise<unknown>;
|
|
10
|
+
export declare function deleteAgent(name: string): Promise<boolean>;
|
|
11
|
+
export declare function getHealth(): Promise<unknown>;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAaA,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAO3D;AAED,wBAAsB,UAAU,uBAG/B;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,oBAO9C;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,oBAOhD;AAED,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAWhH;AAED,wBAAsB,YAAY,uBAGjC;AAED,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,oBAOnD;AAED,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,oBAOpD;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,oBAOjD;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,oBAO7C;AAED,wBAAsB,SAAS,qBAG9B"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { DEFAULT_PORT } from '@ash-ai/shared';
|
|
2
|
+
const serverUrl = process.env.ASH_SERVER_URL || `http://localhost:${DEFAULT_PORT}`;
|
|
3
|
+
async function request(method, path, body) {
|
|
4
|
+
const res = await fetch(`${serverUrl}${path}`, {
|
|
5
|
+
method,
|
|
6
|
+
headers: body ? { 'Content-Type': 'application/json' } : {},
|
|
7
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
8
|
+
});
|
|
9
|
+
return res;
|
|
10
|
+
}
|
|
11
|
+
export async function deployAgent(name, path) {
|
|
12
|
+
const res = await request('POST', '/api/agents', { name, path });
|
|
13
|
+
if (!res.ok) {
|
|
14
|
+
const err = await res.json();
|
|
15
|
+
throw new Error(err.error);
|
|
16
|
+
}
|
|
17
|
+
return (await res.json()).agent;
|
|
18
|
+
}
|
|
19
|
+
export async function listAgents() {
|
|
20
|
+
const res = await request('GET', '/api/agents');
|
|
21
|
+
return (await res.json()).agents;
|
|
22
|
+
}
|
|
23
|
+
export async function getAgentInfo(name) {
|
|
24
|
+
const res = await request('GET', `/api/agents/${name}`);
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
const err = await res.json();
|
|
27
|
+
throw new Error(err.error);
|
|
28
|
+
}
|
|
29
|
+
return (await res.json()).agent;
|
|
30
|
+
}
|
|
31
|
+
export async function createSession(agent) {
|
|
32
|
+
const res = await request('POST', '/api/sessions', { agent });
|
|
33
|
+
if (!res.ok) {
|
|
34
|
+
const err = await res.json();
|
|
35
|
+
throw new Error(err.error);
|
|
36
|
+
}
|
|
37
|
+
return (await res.json()).session;
|
|
38
|
+
}
|
|
39
|
+
export async function sendMessage(sessionId, content) {
|
|
40
|
+
const res = await fetch(`${serverUrl}/api/sessions/${sessionId}/messages`, {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
headers: { 'Content-Type': 'application/json' },
|
|
43
|
+
body: JSON.stringify({ content }),
|
|
44
|
+
});
|
|
45
|
+
if (!res.ok) {
|
|
46
|
+
const err = await res.json();
|
|
47
|
+
throw new Error(err.error);
|
|
48
|
+
}
|
|
49
|
+
return res.body;
|
|
50
|
+
}
|
|
51
|
+
export async function listSessions() {
|
|
52
|
+
const res = await request('GET', '/api/sessions');
|
|
53
|
+
return (await res.json()).sessions;
|
|
54
|
+
}
|
|
55
|
+
export async function pauseSession(sessionId) {
|
|
56
|
+
const res = await request('POST', `/api/sessions/${sessionId}/pause`);
|
|
57
|
+
if (!res.ok) {
|
|
58
|
+
const err = await res.json();
|
|
59
|
+
throw new Error(err.error);
|
|
60
|
+
}
|
|
61
|
+
return (await res.json()).session;
|
|
62
|
+
}
|
|
63
|
+
export async function resumeSession(sessionId) {
|
|
64
|
+
const res = await request('POST', `/api/sessions/${sessionId}/resume`);
|
|
65
|
+
if (!res.ok) {
|
|
66
|
+
const err = await res.json();
|
|
67
|
+
throw new Error(err.error);
|
|
68
|
+
}
|
|
69
|
+
return (await res.json()).session;
|
|
70
|
+
}
|
|
71
|
+
export async function endSession(sessionId) {
|
|
72
|
+
const res = await request('DELETE', `/api/sessions/${sessionId}`);
|
|
73
|
+
if (!res.ok) {
|
|
74
|
+
const err = await res.json();
|
|
75
|
+
throw new Error(err.error);
|
|
76
|
+
}
|
|
77
|
+
return (await res.json()).session;
|
|
78
|
+
}
|
|
79
|
+
export async function deleteAgent(name) {
|
|
80
|
+
const res = await request('DELETE', `/api/agents/${name}`);
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
const err = await res.json();
|
|
83
|
+
throw new Error(err.error);
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
export async function getHealth() {
|
|
88
|
+
const res = await request('GET', '/health');
|
|
89
|
+
return await res.json();
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,oBAAoB,YAAY,EAAE,CAAC;AAEnF,KAAK,UAAU,OAAO,CAAC,MAAc,EAAE,IAAY,EAAE,IAAc;IACjE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,EAAE;QAC7C,MAAM;QACN,OAAO,EAAE,IAAI,CAAC,C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,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,EAAuB,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC5C,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,YAAY,IAAI,OAAO,CA6CtC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { listAgents, getAgentInfo, deleteAgent } from '../client.js';
|
|
3
|
+
export function agentCommand() {
|
|
4
|
+
const cmd = new Command('agent').description('Manage agents');
|
|
5
|
+
cmd
|
|
6
|
+
.command('list')
|
|
7
|
+
.description('List deployed agents')
|
|
8
|
+
.action(async () => {
|
|
9
|
+
try {
|
|
10
|
+
const agents = await listAgents();
|
|
11
|
+
console.log(JSON.stringify(agents, null, 2));
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
cmd
|
|
19
|
+
.command('info')
|
|
20
|
+
.description('Get agent details')
|
|
21
|
+
.argument('<name>', 'Agent name')
|
|
22
|
+
.action(async (name) => {
|
|
23
|
+
try {
|
|
24
|
+
const agent = await getAgentInfo(name);
|
|
25
|
+
console.log(JSON.stringify(agent, null, 2));
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
cmd
|
|
33
|
+
.command('delete')
|
|
34
|
+
.description('Delete an agent')
|
|
35
|
+
.argument('<name>', 'Agent name')
|
|
36
|
+
.action(async (name) => {
|
|
37
|
+
try {
|
|
38
|
+
await deleteAgent(name);
|
|
39
|
+
console.log(`Deleted agent: ${name}`);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return cmd;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAE9D,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;Y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AC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,aAAa,IAAI,OAAO,CAqCvC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { resolve, join } from 'node:path';
|
|
3
|
+
import { existsSync, cpSync } from 'node:fs';
|
|
4
|
+
import { ASH_AGENTS_SUBDIR } from '@ash-ai/shared';
|
|
5
|
+
import { deployAgent } from '../client.js';
|
|
6
|
+
import { ashAgentsDir, ensureDataDir } from '../docker.js';
|
|
7
|
+
export function deployCommand() {
|
|
8
|
+
return new Command('deploy')
|
|
9
|
+
.description('Deploy an agent to the server')
|
|
10
|
+
.argument('<path>', 'Path to agent directory')
|
|
11
|
+
.option('-n, --name <name>', 'Agent name (defaults to directory name)')
|
|
12
|
+
.action(async (agentPath, opts) => {
|
|
13
|
+
const absPath = resolve(agentPath);
|
|
14
|
+
const name = opts.name || absPath.split('/').pop();
|
|
15
|
+
// If the path exists locally, copy to ~/.ash/agents/ and use relative path
|
|
16
|
+
// This enables Docker mode where ~/.ash is volume-mounted into the container
|
|
17
|
+
if (existsSync(join(absPath, 'CLAUDE.md'))) {
|
|
18
|
+
ensureDataDir();
|
|
19
|
+
const destDir = join(ashAgentsDir(), name);
|
|
20
|
+
cpSync(absPath, destDir, { recursive: true });
|
|
21
|
+
console.log(`Copied agent files to ${destDir}`);
|
|
22
|
+
const relativePath = `${ASH_AGENTS_SUBDIR}/${name}`;
|
|
23
|
+
try {
|
|
24
|
+
const agent = await deployAgent(name, relativePath);
|
|
25
|
+
console.log(`Deployed agent: ${JSON.stringify(agent, null, 2)}`);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
console.error(`Deploy failed: ${err instanceof Error ? err.message : err}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// Path doesn't exist locally — assume it's a server-side path (backward compatible)
|
|
34
|
+
try {
|
|
35
|
+
const agent = await deployAgent(name, absPath);
|
|
36
|
+
console.log(`Deployed agent: ${JSON.stringify(agent, null, 2)}`);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
console.error(`Deploy failed: ${err instanceof Error ? err.message : err}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,+BAA+B,CAAC;SAC5C,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;SAC7C,MAAM,CAAC,mBAAmB,EAAE,yCAAyC,CAAC;SACtE,MAAM,CAAC,KAAK,EAAE,SAAiB,EAAE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AS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,kBAAkB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/commands/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,aAAa,IAAI,OAAO,CAYvC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { getHealth } from '../client.js';
|
|
3
|
+
export function healthCommand() {
|
|
4
|
+
return new Command('health')
|
|
5
|
+
.description('Check server health')
|
|
6
|
+
.action(async () => {
|
|
7
|
+
try {
|
|
8
|
+
const health = await getHealth();
|
|
9
|
+
console.log(JSON.stringify(health, null, 2));
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/commands/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,qBAAqB,CAAC;SAClC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,WAAW,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,WAAW,IAAI,OAAO,CAcrC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { getContainerStatus, showLogs } from '../docker.js';
|
|
3
|
+
export function logsCommand() {
|
|
4
|
+
return new Command('logs')
|
|
5
|
+
.description('Show Ash server logs')
|
|
6
|
+
.option('-f, --follow', 'Follow log output')
|
|
7
|
+
.action(async (opts) => {
|
|
8
|
+
const status = getContainerStatus();
|
|
9
|
+
if (status.status === 'not-found') {
|
|
10
|
+
console.error('No Ash server container found. Start one with: ash start');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
showLogs(opts.follow || false);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,UAAU,WAAW;IACzB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;SACvB,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CAAC,cAAc,EAAE,mBAAmB,CAAC;SAC3C,MAAM,CAAC,KAAK,EAAE,IAA0B,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;QAEpC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,cAAc,IAAI,OAAO,CAyHxC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createSession, sendMessage, listSessions, endSession, pauseSession, resumeSession } from '../client.js';
|
|
3
|
+
export function sessionCommand() {
|
|
4
|
+
const cmd = new Command('session').description('Manage sessions');
|
|
5
|
+
cmd
|
|
6
|
+
.command('create')
|
|
7
|
+
.description('Create a new session')
|
|
8
|
+
.argument('<agent>', 'Agent name')
|
|
9
|
+
.action(async (agent) => {
|
|
10
|
+
try {
|
|
11
|
+
const session = await createSession(agent);
|
|
12
|
+
console.log(`Session created: ${JSON.stringify(session, null, 2)}`);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
cmd
|
|
20
|
+
.command('send')
|
|
21
|
+
.description('Send a message to a session')
|
|
22
|
+
.argument('<id>', 'Session ID')
|
|
23
|
+
.argument('<message>', 'Message content')
|
|
24
|
+
.action(async (id, message) => {
|
|
25
|
+
try {
|
|
26
|
+
const stream = await sendMessage(id, message);
|
|
27
|
+
if (!stream) {
|
|
28
|
+
console.log('No response');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const reader = stream.getReader();
|
|
32
|
+
const decoder = new TextDecoder();
|
|
33
|
+
let buffer = '';
|
|
34
|
+
while (true) {
|
|
35
|
+
const { done, value } = await reader.read();
|
|
36
|
+
if (done)
|
|
37
|
+
break;
|
|
38
|
+
buffer += decoder.decode(value, { stream: true });
|
|
39
|
+
const lines = buffer.split('\n');
|
|
40
|
+
buffer = lines.pop() || '';
|
|
41
|
+
for (const line of lines) {
|
|
42
|
+
if (line.startsWith('event: ')) {
|
|
43
|
+
const eventType = line.slice(7);
|
|
44
|
+
process.stdout.write(`[${eventType}] `);
|
|
45
|
+
}
|
|
46
|
+
else if (line.startsWith('data: ')) {
|
|
47
|
+
const data = line.slice(6);
|
|
48
|
+
try {
|
|
49
|
+
const parsed = JSON.parse(data);
|
|
50
|
+
// SDK messages have a type field — print it
|
|
51
|
+
if (parsed.type) {
|
|
52
|
+
console.log(`${parsed.type}: ${JSON.stringify(parsed).slice(0, 200)}`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.log(data);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
console.log(data);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
cmd
|
|
71
|
+
.command('list')
|
|
72
|
+
.description('List sessions')
|
|
73
|
+
.action(async () => {
|
|
74
|
+
try {
|
|
75
|
+
const sessions = await listSessions();
|
|
76
|
+
console.log(JSON.stringify(sessions, null, 2));
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
cmd
|
|
84
|
+
.command('pause')
|
|
85
|
+
.description('Pause a session (keeps sandbox alive for fast resume)')
|
|
86
|
+
.argument('<id>', 'Session ID')
|
|
87
|
+
.action(async (id) => {
|
|
88
|
+
try {
|
|
89
|
+
const session = await pauseSession(id);
|
|
90
|
+
console.log(`Session paused: ${JSON.stringify(session, null, 2)}`);
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
cmd
|
|
98
|
+
.command('resume')
|
|
99
|
+
.description('Resume a paused or errored session')
|
|
100
|
+
.argument('<id>', 'Session ID')
|
|
101
|
+
.action(async (id) => {
|
|
102
|
+
try {
|
|
103
|
+
const session = await resumeSession(id);
|
|
104
|
+
console.log(`Session resumed: ${JSON.stringify(session, null, 2)}`);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
cmd
|
|
112
|
+
.command('end')
|
|
113
|
+
.description('End a session')
|
|
114
|
+
.argument('<id>', 'Session ID')
|
|
115
|
+
.action(async (id) => {
|
|
116
|
+
try {
|
|
117
|
+
const session = await endSession(id);
|
|
118
|
+
console.log(`Session ended: ${JSON.stringify(session, null, 2)}`);
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return cmd;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEjH,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAElE,GAAG;SACA,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,sBAAsB,CAAC;SACnC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;SACjC,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;QAC9B,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,WAAW,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,GAAG;S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,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,GAAG;SACA,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,eAAe,CAAC;SAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;SAC9B,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,EAAE;QAC3B,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,EAAE,CAAC,CAAC;YACrC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,WAAW,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,wBAAgB,YAAY,IAAI,OAAO,CAgGtC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { DEFAULT_PORT } from '@ash-ai/shared';
|
|
3
|
+
import { isDockerInstalled, isDockerRunning, getContainerStatus, removeStoppedContainer, pullImage, startContainer, waitForHealthy, ensureDataDir, ashDataDir, } from '../docker.js';
|
|
4
|
+
function collectEnv(value, previous) {
|
|
5
|
+
return previous.concat([value]);
|
|
6
|
+
}
|
|
7
|
+
export function startCommand() {
|
|
8
|
+
return new Command('start')
|
|
9
|
+
.description('Start the Ash server in a Docker container')
|
|
10
|
+
.option('--port <port>', 'Host port to expose', String(DEFAULT_PORT))
|
|
11
|
+
.option('--tag <tag>', 'Docker image tag')
|
|
12
|
+
.option('--image <image>', 'Full Docker image name (overrides default + tag)')
|
|
13
|
+
.option('--no-pull', 'Skip pulling the image (use local build)')
|
|
14
|
+
.option('--database-url <url>', 'PostgreSQL/CockroachDB connection URL')
|
|
15
|
+
.option('-e, --env <KEY=VALUE>', 'Extra env vars to pass to the container', collectEnv, [])
|
|
16
|
+
.action(async (opts) => {
|
|
17
|
+
const port = parseInt(opts.port, 10);
|
|
18
|
+
// Check Docker is available
|
|
19
|
+
if (!isDockerInstalled()) {
|
|
20
|
+
console.error('Docker is not installed. Install it from https://docs.docker.com/get-docker/');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
if (!isDockerRunning()) {
|
|
24
|
+
console.error('Docker daemon is not running. Start Docker Desktop or the Docker service.');
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
// Check if already running
|
|
28
|
+
const status = getContainerStatus();
|
|
29
|
+
if (status.running) {
|
|
30
|
+
console.log(`Ash server is already running (container: ${status.containerId}, image: ${status.image})`);
|
|
31
|
+
console.log(` URL: http://localhost:${port}`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// Remove stale stopped container
|
|
35
|
+
if (status.status !== 'not-found') {
|
|
36
|
+
console.log('Removing stale container...');
|
|
37
|
+
removeStoppedContainer();
|
|
38
|
+
}
|
|
39
|
+
// Ensure data directory exists
|
|
40
|
+
ensureDataDir();
|
|
41
|
+
// Build envPassthrough list from --database-url and --env flags
|
|
42
|
+
const envPassthrough = [];
|
|
43
|
+
if (opts.databaseUrl) {
|
|
44
|
+
process.env.ASH_DATABASE_URL = opts.databaseUrl;
|
|
45
|
+
envPassthrough.push('ASH_DATABASE_URL');
|
|
46
|
+
}
|
|
47
|
+
for (const entry of opts.env) {
|
|
48
|
+
const eqIdx = entry.indexOf('=');
|
|
49
|
+
if (eqIdx === -1) {
|
|
50
|
+
console.error(`Invalid --env value "${entry}": must be KEY=VALUE`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
const key = entry.slice(0, eqIdx);
|
|
54
|
+
const val = entry.slice(eqIdx + 1);
|
|
55
|
+
process.env[key] = val;
|
|
56
|
+
envPassthrough.push(key);
|
|
57
|
+
}
|
|
58
|
+
// Pull image (skip if using a local image via --image or --no-pull)
|
|
59
|
+
if (opts.pull && !opts.image) {
|
|
60
|
+
try {
|
|
61
|
+
pullImage(opts.tag);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
console.error('Failed to pull image. Use --no-pull to use a local image.');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Start container
|
|
69
|
+
const imageToUse = opts.image;
|
|
70
|
+
console.log(`Starting Ash server${imageToUse ? ` (image: ${imageToUse})` : ''}...`);
|
|
71
|
+
try {
|
|
72
|
+
startContainer({ port, tag: opts.tag, image: imageToUse, envPassthrough });
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
console.error(`Failed to start container: ${err instanceof Error ? err.message : err}`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
// Wait for healthy
|
|
79
|
+
console.log('Waiting for server to be ready...');
|
|
80
|
+
const healthy = await waitForHealthy(port);
|
|
81
|
+
if (!healthy) {
|
|
82
|
+
console.error('Server failed to become healthy within 30 seconds.');
|
|
83
|
+
console.error('Check logs with: ash logs');
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
console.log(`Ash server is running.`);
|
|
87
|
+
console.log(` URL: http://localhost:${port}`);
|
|
88
|
+
if (opts.databaseUrl) {
|
|
89
|
+
console.log(` Database: ${opts.databaseUrl}`);
|
|
90
|
+
}
|
|
91
|
+
console.log(` Data dir: ${ashDataDir()}`);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,SAAS,EACT,cAAc,EACd,cAAc,EACd,aAAa,EACb,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,SAAS,UAAU,CAAC,KAAa,EAAE,QAAkB;IACnD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;SACxB,WAAW,CAAC,4CAA4C,CAAC;SACzD,MAAM,CAAC,eAAe,EAAE,qBAAqB,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;SACpE,MAAM,CAAC,aAAa,EAAE,kBAAkB,CAAC;SACzC,MAAM,CAAC,iBAAiB,EAAE,kDAAkD,CAAC;SAC7E,MAAM,CAAC,WAAW,EAAE,0CAA0C,CAAC;SAC/D,MAAM,CAAC,sBAAsB,EAAE,uCAAuC,CAAC;SACvE,MAAM,CAAC,uBAAuB,EAAE,yCAAyC,EAAE,UAAU,EAAE,EAAE,CAAC;SAC1F,MAAM,CAAC,KAAK,EAAE,IAAwG,EAAE,EAAE;QACzH,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAErC,4BAA4B;QAC5B,IAAI,CAAC,iBAAiB,EAAE,EAA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AG,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;YACpE,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,eAAe,UAAU,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,aAAa,IAAI,OAAO,CA2BvC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { DEFAULT_PORT } from '@ash-ai/shared';
|
|
3
|
+
import { getContainerStatus } from '../docker.js';
|
|
4
|
+
import { getHealth } from '../client.js';
|
|
5
|
+
export function statusCommand() {
|
|
6
|
+
return new Command('status')
|
|
7
|
+
.description('Show Ash server status')
|
|
8
|
+
.option('--port <port>', 'Server port to check health', String(DEFAULT_PORT))
|
|
9
|
+
.action(async (opts) => {
|
|
10
|
+
const status = getContainerStatus();
|
|
11
|
+
console.log(`Container: ${status.status}`);
|
|
12
|
+
if (status.containerId) {
|
|
13
|
+
console.log(` ID: ${status.containerId}`);
|
|
14
|
+
}
|
|
15
|
+
if (status.image) {
|
|
16
|
+
console.log(` Image: ${status.image}`);
|
|
17
|
+
}
|
|
18
|
+
if (status.running) {
|
|
19
|
+
try {
|
|
20
|
+
const health = await getHealth();
|
|
21
|
+
const h = health;
|
|
22
|
+
console.log(` Active sessions: ${h.activeSessions ?? 'unknown'}`);
|
|
23
|
+
console.log(` Active sandboxes: ${h.activeSandboxes ?? 'unknown'}`);
|
|
24
|
+
console.log(` Uptime: ${h.uptime ?? 'unknown'}s`);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
console.log(' Health check failed (server may still be starting)');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,eAAe,EAAE,6BAA6B,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;SAC5E,MAAM,CAAC,KAAK,EAAE,IAAsB,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;QAEpC,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3C,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;gBACjC,MAAM,CAAC,GAAG,MAAiC,CAAC;gBAC5C,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,cAAc,IAAI,SAAS,EAAE,CAAC,CAAC;gBACpE,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,eAAe,IAAI,SAAS,EAAE,CAAC,CAAC;gBACrE,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,MAAM,IAAI,SAAS,GAAG,CAAC,CAAC;YAC/D,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop.d.ts","sourceRoot":"","sources":["../../src/commands/stop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,WAAW,IAAI,OAAO,CAoBrC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { getContainerStatus, stopContainer } from '../docker.js';
|
|
3
|
+
export function stopCommand() {
|
|
4
|
+
return new Command('stop')
|
|
5
|
+
.description('Stop the Ash server container')
|
|
6
|
+
.action(async () => {
|
|
7
|
+
const status = getContainerStatus();
|
|
8
|
+
if (status.status === 'not-found') {
|
|
9
|
+
console.log('No Ash server container found.');
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
console.log('Stopping Ash server...');
|
|
13
|
+
try {
|
|
14
|
+
stopContainer();
|
|
15
|
+
console.log('Ash server stopped.');
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
console.error(`Failed to stop: ${err instanceof Error ? err.message : err}`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=stop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/commands/stop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,UAAU,WAAW;IACzB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;SACvB,WAAW,CAAC,+BAA+B,CAAC;SAC5C,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;QAEpC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;YAC9C,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACtC,IAAI,CAAC;YACH,aAAa,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,mBAAmB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YAC7E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/docker.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare function ashDataDir(): string;
|
|
2
|
+
export declare function ashAgentsDir(): string;
|
|
3
|
+
export declare function ensureDataDir(): void;
|
|
4
|
+
export declare function isDockerInstalled(): boolean;
|
|
5
|
+
export declare function isDockerRunning(): boolean;
|
|
6
|
+
export interface ContainerStatus {
|
|
7
|
+
running: boolean;
|
|
8
|
+
status: string;
|
|
9
|
+
containerId: string | null;
|
|
10
|
+
image: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function getContainerStatus(): ContainerStatus;
|
|
13
|
+
export declare function pullImage(tag?: string): void;
|
|
14
|
+
export interface StartContainerOptions {
|
|
15
|
+
port?: number;
|
|
16
|
+
tag?: string;
|
|
17
|
+
image?: string;
|
|
18
|
+
envPassthrough?: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function startContainer(opts?: StartContainerOptions): void;
|
|
21
|
+
export declare function removeStoppedContainer(): boolean;
|
|
22
|
+
export declare function stopContainer(): void;
|
|
23
|
+
export declare function showLogs(follow: boolean): void;
|
|
24
|
+
export declare function waitForHealthy(port: number, timeout?: number): Promise<boolean>;
|
|
25
|
+
//# sourceMappingURL=docker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../src/docker.ts"],"names":[],"mappings":"AAcA,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAO3C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAOzC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAmBpD;AAED,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAI5C;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,cAAc,CAAC,IAAI,GAAE,qBAA0B,GAAG,IAAI,CAgCrE;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAOhD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAGpC;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAgB9C;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcrF"}
|
package/dist/docker.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { execSync, execFileSync, spawn } from 'node:child_process';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { mkdirSync } from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { ASH_CONTAINER_NAME, ASH_DOCKER_IMAGE, ASH_DOCKER_TAG, ASH_AGENTS_SUBDIR, ASH_HEALTH_POLL_INTERVAL_MS, ASH_HEALTH_POLL_TIMEOUT_MS, DEFAULT_PORT, } from '@ash-ai/shared';
|
|
6
|
+
export function ashDataDir() {
|
|
7
|
+
return join(homedir(), '.ash');
|
|
8
|
+
}
|
|
9
|
+
export function ashAgentsDir() {
|
|
10
|
+
return join(ashDataDir(), ASH_AGENTS_SUBDIR);
|
|
11
|
+
}
|
|
12
|
+
export function ensureDataDir() {
|
|
13
|
+
mkdirSync(ashAgentsDir(), { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
export function isDockerInstalled() {
|
|
16
|
+
try {
|
|
17
|
+
execFileSync('docker', ['--version'], { stdio: 'pipe' });
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function isDockerRunning() {
|
|
25
|
+
try {
|
|
26
|
+
execFileSync('docker', ['info'], { stdio: 'pipe' });
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function getContainerStatus() {
|
|
34
|
+
try {
|
|
35
|
+
const out = execFileSync('docker', [
|
|
36
|
+
'inspect',
|
|
37
|
+
'--format',
|
|
38
|
+
'{{.Id}}\t{{.State.Status}}\t{{.Config.Image}}',
|
|
39
|
+
ASH_CONTAINER_NAME,
|
|
40
|
+
], { stdio: 'pipe', encoding: 'utf-8' }).trim();
|
|
41
|
+
const [containerId, status, image] = out.split('\t');
|
|
42
|
+
return {
|
|
43
|
+
running: status === 'running',
|
|
44
|
+
status,
|
|
45
|
+
containerId: containerId?.slice(0, 12) || null,
|
|
46
|
+
image: image || null,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return { running: false, status: 'not-found', containerId: null, image: null };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function pullImage(tag) {
|
|
54
|
+
const fullImage = `${ASH_DOCKER_IMAGE}:${tag || ASH_DOCKER_TAG}`;
|
|
55
|
+
console.log(`Pulling ${fullImage}...`);
|
|
56
|
+
execSync(`docker pull ${fullImage}`, { stdio: 'inherit' });
|
|
57
|
+
}
|
|
58
|
+
export function startContainer(opts = {}) {
|
|
59
|
+
const port = opts.port || DEFAULT_PORT;
|
|
60
|
+
const fullImage = opts.image || `${ASH_DOCKER_IMAGE}:${opts.tag || ASH_DOCKER_TAG}`;
|
|
61
|
+
const dataDir = ashDataDir();
|
|
62
|
+
const args = [
|
|
63
|
+
'run', '-d',
|
|
64
|
+
'--name', ASH_CONTAINER_NAME,
|
|
65
|
+
'--init',
|
|
66
|
+
'--cgroupns=host',
|
|
67
|
+
'-p', `${port}:4100`,
|
|
68
|
+
'-v', `${dataDir}:/data`,
|
|
69
|
+
];
|
|
70
|
+
// Pass through ANTHROPIC_API_KEY if set
|
|
71
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
72
|
+
args.push('-e', `ANTHROPIC_API_KEY=${process.env.ANTHROPIC_API_KEY}`);
|
|
73
|
+
}
|
|
74
|
+
// Pass through any additional env vars
|
|
75
|
+
if (opts.envPassthrough) {
|
|
76
|
+
for (const key of opts.envPassthrough) {
|
|
77
|
+
const val = process.env[key];
|
|
78
|
+
if (val) {
|
|
79
|
+
args.push('-e', `${key}=${val}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
args.push(fullImage);
|
|
84
|
+
execFileSync('docker', args, { stdio: 'pipe' });
|
|
85
|
+
}
|
|
86
|
+
export function removeStoppedContainer() {
|
|
87
|
+
try {
|
|
88
|
+
execFileSync('docker', ['rm', ASH_CONTAINER_NAME], { stdio: 'pipe' });
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function stopContainer() {
|
|
96
|
+
execFileSync('docker', ['stop', ASH_CONTAINER_NAME], { stdio: 'pipe' });
|
|
97
|
+
execFileSync('docker', ['rm', ASH_CONTAINER_NAME], { stdio: 'pipe' });
|
|
98
|
+
}
|
|
99
|
+
export function showLogs(follow) {
|
|
100
|
+
const args = ['logs'];
|
|
101
|
+
if (follow)
|
|
102
|
+
args.push('-f');
|
|
103
|
+
args.push(ASH_CONTAINER_NAME);
|
|
104
|
+
const child = spawn('docker', args, { stdio: 'inherit' });
|
|
105
|
+
child.on('error', (err) => {
|
|
106
|
+
console.error(`Failed to get logs: ${err.message}`);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
});
|
|
109
|
+
// For non-follow mode, wait for completion
|
|
110
|
+
if (!follow) {
|
|
111
|
+
child.on('exit', (code) => {
|
|
112
|
+
if (code !== 0)
|
|
113
|
+
process.exit(code || 1);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export async function waitForHealthy(port, timeout) {
|
|
118
|
+
const deadline = Date.now() + (timeout || ASH_HEALTH_POLL_TIMEOUT_MS);
|
|
119
|
+
const url = `http://localhost:${port}/health`;
|
|
120
|
+
while (Date.now() < deadline) {
|
|
121
|
+
try {
|
|
122
|
+
const res = await fetch(url);
|
|
123
|
+
if (res.ok)
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// Server not ready yet
|
|
128
|
+
}
|
|
129
|
+
await new Promise((r) => setTimeout(r, ASH_HEALTH_POLL_INTERVAL_MS));
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=docker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../src/docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,2BAA2B,EAC3B,0BAA0B,EAC1B,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,MAAM,UAAU,UAAU;IACxB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,iBAAiB,CA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ClB,CAAC,CAAC,CAAC;IACH,2CAA2C;IAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACxB,IAAI,IAAI,KAAK,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY,EAAE,OAAgB;IACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,IAAI,0BAA0B,CAAC,CAAC;IACtE,MAAM,GAAG,GAAG,oBAAoB,IAAI,SAAS,CAAC;IAE9C,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,GAAG,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,uBAAuB;QACzB,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { deployCommand } from './commands/deploy.js';
|
|
4
|
+
import { sessionCommand } from './commands/session.js';
|
|
5
|
+
import { agentCommand } from './commands/agent.js';
|
|
6
|
+
import { healthCommand } from './commands/health.js';
|
|
7
|
+
import { startCommand } from './commands/start.js';
|
|
8
|
+
import { stopCommand } from './commands/stop.js';
|
|
9
|
+
import { statusCommand } from './commands/status.js';
|
|
10
|
+
import { logsCommand } from './commands/logs.js';
|
|
11
|
+
const program = new Command()
|
|
12
|
+
.name('ash')
|
|
13
|
+
.description('Agent orchestration CLI')
|
|
14
|
+
.version('0.1.0');
|
|
15
|
+
program.addCommand(startCommand());
|
|
16
|
+
program.addCommand(stopCommand());
|
|
17
|
+
program.addCommand(statusCommand());
|
|
18
|
+
program.addCommand(logsCommand());
|
|
19
|
+
program.addCommand(deployCommand());
|
|
20
|
+
program.addCommand(sessionCommand());
|
|
21
|
+
program.addCommand(agentCommand());
|
|
22
|
+
program.addCommand(healthCommand());
|
|
23
|
+
program.parse();
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KAC1B,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,yBAAyB,CAAC;KACtC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;AACpC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;AACpC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;AACrC,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;AAEpC,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ash-ai/cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ash": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/ash-ai/ash.git",
|
|
19
|
+
"directory": "packages/cli"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"description": "CLI for deploying and managing Ash AI agents",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ash",
|
|
25
|
+
"ai",
|
|
26
|
+
"agent",
|
|
27
|
+
"cli",
|
|
28
|
+
"claude"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"commander": "^13.0.0",
|
|
32
|
+
"@ash-ai/shared": "0.0.1"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc",
|
|
36
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"start": "node dist/index.js",
|
|
39
|
+
"dev": "tsx src/index.ts",
|
|
40
|
+
"test": "vitest run --passWithNoTests"
|
|
41
|
+
}
|
|
42
|
+
}
|