@hazeljs/cli 2.0.3 → 2.0.5
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/cli-manifest.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Machine-readable manifest of all CLI commands and options for LLM agent tool-use",
|
|
5
5
|
"cli": {
|
|
6
6
|
"name": "hazel",
|
|
7
|
-
"version": "2.0.
|
|
7
|
+
"version": "2.0.5",
|
|
8
8
|
"description": "CLI for generating HazelJS components and applications"
|
|
9
9
|
},
|
|
10
10
|
"commands": [
|
|
@@ -197,7 +197,6 @@ Use lookupOrder for facts. Call processRefund only after lookup. Be concise.`,
|
|
|
197
197
|
},
|
|
198
198
|
dependencies: {
|
|
199
199
|
'@hazeljs/agent': '^1.0.6',
|
|
200
|
-
'reflect-metadata': '^0.2.2',
|
|
201
200
|
},
|
|
202
201
|
devDependencies: {
|
|
203
202
|
'@types/node': '^20.19.39',
|
|
@@ -232,8 +231,7 @@ export function getOrder(id: string): Order | undefined {
|
|
|
232
231
|
return ORDERS[id.toUpperCase()];
|
|
233
232
|
}
|
|
234
233
|
`,
|
|
235
|
-
'src/support.agent.ts': `import '
|
|
236
|
-
import { Agent, Tool } from '@hazeljs/agent';
|
|
234
|
+
'src/support.agent.ts': `import { Agent, Tool } from '@hazeljs/agent';
|
|
237
235
|
import { getOrder } from './orders';
|
|
238
236
|
|
|
239
237
|
@Agent({
|
|
@@ -274,7 +272,6 @@ export class SupportAgent {
|
|
|
274
272
|
* Mini Agent OS app — real tools (not DNA stubs).
|
|
275
273
|
* DNA in dna/ can be hot-reloaded / store-installed for prompt+policy overlays.
|
|
276
274
|
*/
|
|
277
|
-
import 'reflect-metadata';
|
|
278
275
|
import {
|
|
279
276
|
AgentRuntime,
|
|
280
277
|
AgentEventType,
|
package/dist/commands/agent.js
CHANGED
|
@@ -51,6 +51,64 @@ const DEFAULT_PLATFORM_STORE = path.join('.hazel', 'platform', 'resources.json')
|
|
|
51
51
|
* `hazel agent runs list|inspect|cancel|resume|approve` — durable store ops.
|
|
52
52
|
*/
|
|
53
53
|
function registerAgentCommand(program) {
|
|
54
|
+
program
|
|
55
|
+
.command('agents')
|
|
56
|
+
.description('List deployed Agent OS agents (name, status, current task)')
|
|
57
|
+
.option('--store <path>', 'Platform resource store path', DEFAULT_PLATFORM_STORE)
|
|
58
|
+
.option('--dir <path>', 'Durable store directory', DEFAULT_DURABLE_DIR)
|
|
59
|
+
.option('--project <path>', 'Project root', '.')
|
|
60
|
+
.option('--json', 'Print JSON')
|
|
61
|
+
.action(async (opts) => {
|
|
62
|
+
try {
|
|
63
|
+
const { AgentOS } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent')));
|
|
64
|
+
const projectRoot = path.resolve(opts.project);
|
|
65
|
+
const osPlane = new AgentOS({
|
|
66
|
+
projectRoot,
|
|
67
|
+
storePath: path.resolve(opts.store),
|
|
68
|
+
durableDir: path.resolve(opts.dir),
|
|
69
|
+
});
|
|
70
|
+
try {
|
|
71
|
+
await osPlane.recover();
|
|
72
|
+
const agents = await osPlane.list();
|
|
73
|
+
if (opts.json) {
|
|
74
|
+
// eslint-disable-next-line no-console
|
|
75
|
+
console.log(JSON.stringify({ agents }, null, 2));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const rows = agents.map((a) => ({
|
|
79
|
+
NAME: a.name,
|
|
80
|
+
STATUS: a.status,
|
|
81
|
+
CURRENT: a.occupancy.currentTask ??
|
|
82
|
+
(a.status === 'sleeping' ? (a.occupancy.nextWakeAt ?? '-') : '-'),
|
|
83
|
+
}));
|
|
84
|
+
if (!rows.length) {
|
|
85
|
+
// eslint-disable-next-line no-console
|
|
86
|
+
console.log('No agents deployed. Use Agent Office or `hazel agent apply`.');
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const widths = {
|
|
90
|
+
NAME: Math.max(4, ...rows.map((r) => r.NAME.length)),
|
|
91
|
+
STATUS: Math.max(6, ...rows.map((r) => r.STATUS.length)),
|
|
92
|
+
CURRENT: Math.max(7, ...rows.map((r) => r.CURRENT.length)),
|
|
93
|
+
};
|
|
94
|
+
const line = (r) => `${r.NAME.padEnd(widths.NAME)} ${r.STATUS.padEnd(widths.STATUS)} ${r.CURRENT}`;
|
|
95
|
+
// eslint-disable-next-line no-console
|
|
96
|
+
console.log(line({ NAME: 'NAME', STATUS: 'STATUS', CURRENT: 'CURRENT' }));
|
|
97
|
+
for (const r of rows) {
|
|
98
|
+
// eslint-disable-next-line no-console
|
|
99
|
+
console.log(line(r));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
await osPlane.dispose();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
// eslint-disable-next-line no-console
|
|
108
|
+
console.error(e instanceof Error ? e.message : e);
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
54
112
|
const agent = program
|
|
55
113
|
.command('agent')
|
|
56
114
|
.description('Agent OS DNA / runtime / marketplace / platform helpers');
|
|
@@ -61,6 +61,7 @@ describe('registerAgentCommand (AOS-011 + templates)', () => {
|
|
|
61
61
|
'delete',
|
|
62
62
|
'events',
|
|
63
63
|
]));
|
|
64
|
+
expect(program.commands.map((c) => c.name())).toEqual(expect.arrayContaining(['agents', 'agent']));
|
|
64
65
|
});
|
|
65
66
|
});
|
|
66
67
|
describe('agent templates scaffold', () => {
|
|
@@ -88,6 +89,12 @@ describe('agent templates scaffold', () => {
|
|
|
88
89
|
expect(fs.existsSync(path.join(dest, 'src/support.agent.ts'))).toBe(true);
|
|
89
90
|
expect(fs.existsSync(path.join(dest, 'src/main.ts'))).toBe(true);
|
|
90
91
|
expect(fs.existsSync(path.join(dest, 'dna/agent.marketplace.json'))).toBe(true);
|
|
92
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(dest, 'package.json'), 'utf8'));
|
|
93
|
+
expect(pkg.dependencies['reflect-metadata']).toBeUndefined();
|
|
94
|
+
const main = fs.readFileSync(path.join(dest, 'src/main.ts'), 'utf8');
|
|
95
|
+
const agent = fs.readFileSync(path.join(dest, 'src/support.agent.ts'), 'utf8');
|
|
96
|
+
expect(main).not.toMatch(/reflect-metadata/);
|
|
97
|
+
expect(agent).not.toMatch(/reflect-metadata/);
|
|
91
98
|
});
|
|
92
99
|
it('scaffolds skillgate with openapi sample', () => {
|
|
93
100
|
const dest = path.join(tmp, 'sg-demo');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hazeljs/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Command-line interface for scaffolding and generating HazelJS applications and components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"mustache": "^4.2.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@hazeljs/eval": "^2.0.
|
|
35
|
-
"@hazeljs/benchmark": "^2.0.
|
|
36
|
-
"@hazeljs/agent": "^2.0.
|
|
37
|
-
"@hazeljs/skillgate": "^2.0.
|
|
38
|
-
"@hazeljs/agent-gatekeeper": "^2.0.
|
|
34
|
+
"@hazeljs/eval": "^2.0.5",
|
|
35
|
+
"@hazeljs/benchmark": "^2.0.5",
|
|
36
|
+
"@hazeljs/agent": "^2.0.5",
|
|
37
|
+
"@hazeljs/skillgate": "^2.0.5",
|
|
38
|
+
"@hazeljs/agent-gatekeeper": "^2.0.5"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@hazeljs/eval": {
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@hazeljs/eval": "^2.0.
|
|
59
|
-
"@hazeljs/benchmark": "^2.0.
|
|
60
|
-
"@hazeljs/agent": "^2.0.
|
|
61
|
-
"@hazeljs/skillgate": "^2.0.
|
|
62
|
-
"@hazeljs/agent-gatekeeper": "^2.0.
|
|
58
|
+
"@hazeljs/eval": "^2.0.5",
|
|
59
|
+
"@hazeljs/benchmark": "^2.0.5",
|
|
60
|
+
"@hazeljs/agent": "^2.0.5",
|
|
61
|
+
"@hazeljs/skillgate": "^2.0.5",
|
|
62
|
+
"@hazeljs/agent-gatekeeper": "^2.0.5",
|
|
63
63
|
"@types/inquirer": "^8.2.10",
|
|
64
64
|
"@types/mustache": "^4.2.5",
|
|
65
|
-
"typescript": "^
|
|
65
|
+
"typescript": "^6.0.3"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=14.0.0"
|