@agentage/cli 0.78.2 → 0.79.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 +2 -0
- package/dist/commands/config/config-get.d.ts +11 -0
- package/dist/commands/config/config-get.js +17 -0
- package/dist/commands/config/config-keys.d.ts +13 -0
- package/dist/commands/config/config-keys.js +18 -0
- package/dist/commands/config/config-list.d.ts +8 -0
- package/dist/commands/config/config-list.js +45 -0
- package/dist/commands/config/config-set.d.ts +12 -0
- package/dist/commands/config/config-set.js +71 -0
- package/dist/commands/config/config.d.ts +13 -0
- package/dist/commands/config/config.js +46 -0
- package/dist/commands/extension/configure.d.ts +1 -0
- package/dist/commands/extension/configure.js +1 -1
- package/dist/commands/extension/kit-commands.js +12 -3
- package/dist/commands/extension/kit-tool.d.ts +1 -1
- package/dist/commands/extension/kit-values.d.ts +7 -0
- package/dist/commands/extension/kit-values.js +60 -0
- package/dist/commands/extension/list.d.ts +2 -0
- package/dist/commands/extension/list.js +2 -0
- package/dist/commands/extension/types.d.ts +14 -0
- package/dist/commands/extension/types.js +51 -0
- package/dist/core/loader/manifest.js +12 -2
- package/dist/lib/daemon/host-client.d.ts +3 -0
- package/dist/lib/daemon/host-client.js +3 -0
- package/dist/lib/daemon/values.types.d.ts +30 -0
- package/dist/lib/daemon/values.types.js +1 -0
- package/dist/lib/json-output.d.ts +3 -2
- package/dist/lib/json-output.js +7 -2
- package/dist/program-deps.js +12 -0
- package/dist/program.d.ts +11 -0
- package/dist/program.js +12 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ Each command has `--help`. The full reference is [docs/reference.md](docs/refere
|
|
|
23
23
|
| `agentage status` | Show the cli, account, endpoint, machine, profile and extension status |
|
|
24
24
|
| `agentage update` | Update `@agentage/cli` to the latest published version |
|
|
25
25
|
| `agentage daemon` | Start, show, stop or restart the local daemon that runs extensions |
|
|
26
|
+
| `agentage config` | List, get, set or unset the settings and secrets of extensions |
|
|
26
27
|
| `extension install <name>` | Install an extension (`<id>`, `<id>@<version>` or a folder) and run it |
|
|
27
28
|
| `extension list` | Show each installed extension: id, version, source, state |
|
|
28
29
|
| `extension update [id]` | Move each market extension, or one, to its newest version |
|
|
@@ -33,6 +34,7 @@ Each command has `--help`. The full reference is [docs/reference.md](docs/refere
|
|
|
33
34
|
| `extension doctor` | Load every extension once and refresh its state: ok or failed |
|
|
34
35
|
| `extension create <id>` | Create `./extension-<id>` from the extension template |
|
|
35
36
|
| `extension check [dir]` | Check that an extension package conforms, as every build does first |
|
|
37
|
+
| `extension types` | Write `src/agentage-env.d.ts`, the typed keys; `--check` only compares |
|
|
36
38
|
| `extension build` | Build the extension package; `--container` builds one image of all parts |
|
|
37
39
|
| `extension release` | Release an extension in CI; `--changed` releases each changed extension |
|
|
38
40
|
| `extension up` | Run the working copy on the daemon and reload each change |
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ConfigDeps } from './config-keys.js';
|
|
2
|
+
export interface ConfigGetOptions {
|
|
3
|
+
key: string;
|
|
4
|
+
json?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const runConfigGet: (opts: ConfigGetOptions, deps: ConfigDeps) => Promise<{
|
|
7
|
+
key: string;
|
|
8
|
+
type: string;
|
|
9
|
+
value: unknown;
|
|
10
|
+
source: "default" | "set";
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CliError, isJsonRun } from '../../lib/json-output.js';
|
|
2
|
+
import { LIST_HINT, ownerOf, secretRefused } from './config-keys.js';
|
|
3
|
+
import { shown } from './config-list.js';
|
|
4
|
+
// One value; a secret is refused by name and never printed.
|
|
5
|
+
export const runConfigGet = async (opts, deps) => {
|
|
6
|
+
const owner = ownerOf(opts.key);
|
|
7
|
+
const rows = await (await deps.host()).values(owner);
|
|
8
|
+
const all = rows.flatMap((row) => row.settings);
|
|
9
|
+
if (rows.some((row) => row.secrets.some((s) => s.key === opts.key)))
|
|
10
|
+
throw secretRefused(opts.key, 'config get never prints one; config list shows if it is set');
|
|
11
|
+
const found = all.find((s) => s.key === opts.key);
|
|
12
|
+
if (!found)
|
|
13
|
+
throw new CliError('invalid_argument', `${opts.key}: ${owner} declares no such key; ${LIST_HINT}`);
|
|
14
|
+
if (!isJsonRun())
|
|
15
|
+
console.log(shown(found.value));
|
|
16
|
+
return { key: found.key, type: found.type, value: found.value, source: found.source };
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type HostClient } from '../../lib/daemon/host-client.js';
|
|
2
|
+
import { type ValueRow } from '../../lib/daemon/values.types.js';
|
|
3
|
+
import { CliError } from '../../lib/json-output.js';
|
|
4
|
+
import { type SecretInput } from '../extension/configure.js';
|
|
5
|
+
export interface ConfigDeps {
|
|
6
|
+
host: () => Promise<HostClient>;
|
|
7
|
+
input: SecretInput;
|
|
8
|
+
}
|
|
9
|
+
export type KeyKind = 'setting' | 'secret';
|
|
10
|
+
export declare const ownerOf: (qualified: string) => string;
|
|
11
|
+
export declare const kindsOf: (rows: ValueRow[]) => Map<string, KeyKind>;
|
|
12
|
+
export declare const LIST_HINT = "agentage config list shows the keys";
|
|
13
|
+
export declare const secretRefused: (key: string, why: string) => CliError;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {} from '../../lib/daemon/host-client.js';
|
|
2
|
+
import {} from '../../lib/daemon/values.types.js';
|
|
3
|
+
import { CliError } from '../../lib/json-output.js';
|
|
4
|
+
import {} from '../extension/configure.js';
|
|
5
|
+
// An extension id has no dot, so the first dot ends the owner (D125.2).
|
|
6
|
+
export const ownerOf = (qualified) => {
|
|
7
|
+
const dot = qualified.indexOf('.');
|
|
8
|
+
if (dot <= 0 || dot === qualified.length - 1)
|
|
9
|
+
throw new CliError('invalid_argument', `${qualified}: expected <owner>.<key>, the owner an extension id or shared`);
|
|
10
|
+
return qualified.slice(0, dot);
|
|
11
|
+
};
|
|
12
|
+
// Every key the daemon knows, by qualified key: only the list tells a secret from a setting.
|
|
13
|
+
export const kindsOf = (rows) => new Map([
|
|
14
|
+
...rows.flatMap((row) => row.settings.map((s) => [s.key, 'setting'])),
|
|
15
|
+
...rows.flatMap((row) => row.secrets.map((s) => [s.key, 'secret'])),
|
|
16
|
+
]);
|
|
17
|
+
export const LIST_HINT = 'agentage config list shows the keys';
|
|
18
|
+
export const secretRefused = (key, why) => new CliError('secret_refused', `${key} is a secret: ${why}`);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ValueRow } from '../../lib/daemon/values.types.js';
|
|
2
|
+
import { type ConfigDeps } from './config-keys.js';
|
|
3
|
+
export interface ConfigListOptions {
|
|
4
|
+
owner?: string;
|
|
5
|
+
json?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const shown: (value: unknown) => string;
|
|
8
|
+
export declare const runConfigList: (opts: ConfigListOptions, deps: ConfigDeps) => Promise<ValueRow[]>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {} from '../../lib/daemon/values.types.js';
|
|
2
|
+
import { isJsonRun } from '../../lib/json-output.js';
|
|
3
|
+
import {} from './config-keys.js';
|
|
4
|
+
// Text as typed; anything else as JSON.
|
|
5
|
+
export const shown = (value) => value === undefined ? '(none)' : typeof value === 'string' ? value : JSON.stringify(value);
|
|
6
|
+
// One last cell: the share mode, and for a shared.<key> who declares it.
|
|
7
|
+
const note = (row) => [row.share && `share ${row.share}`, row.declaredBy && `declared by ${row.declaredBy.join(', ')}`]
|
|
8
|
+
.filter(Boolean)
|
|
9
|
+
.join('; ');
|
|
10
|
+
const settingCells = (s) => [
|
|
11
|
+
s.key,
|
|
12
|
+
s.type,
|
|
13
|
+
shown(s.value),
|
|
14
|
+
s.source,
|
|
15
|
+
note(s),
|
|
16
|
+
];
|
|
17
|
+
// A secret is its name and whether it is set, never a value.
|
|
18
|
+
const secretCells = (s) => [
|
|
19
|
+
s.key,
|
|
20
|
+
'secret',
|
|
21
|
+
s.set ? '***' : '(not set)',
|
|
22
|
+
s.set ? 'set' : '',
|
|
23
|
+
note(s),
|
|
24
|
+
];
|
|
25
|
+
const lines = (rows) => {
|
|
26
|
+
const widths = rows[0]?.map((_, i) => Math.max(...rows.map((r) => (r[i] ?? '').length))) ?? [];
|
|
27
|
+
return rows.map((r) => r
|
|
28
|
+
.map((cell, i) => cell.padEnd(widths[i] ?? 0))
|
|
29
|
+
.join(' ')
|
|
30
|
+
.trimEnd());
|
|
31
|
+
};
|
|
32
|
+
const conflicts = (rows) => rows.flatMap((row) => row.settings.flatMap((s) => (s.conflict ? [`conflict: ${s.conflict}`] : [])));
|
|
33
|
+
export const runConfigList = async (opts, deps) => {
|
|
34
|
+
const rows = await (await deps.host()).values(opts.owner);
|
|
35
|
+
const cells = rows.flatMap((row) => [
|
|
36
|
+
...row.settings.map(settingCells),
|
|
37
|
+
...row.secrets.map(secretCells),
|
|
38
|
+
]);
|
|
39
|
+
const text = cells.length ? lines(cells) : ['no settings'];
|
|
40
|
+
// With --json the rows are the answer: no table on stderr.
|
|
41
|
+
if (!isJsonRun())
|
|
42
|
+
for (const line of [...text, ...conflicts(rows)])
|
|
43
|
+
console.log(line);
|
|
44
|
+
return rows;
|
|
45
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ValuesDone } from '../../lib/daemon/values.types.js';
|
|
2
|
+
import { type ConfigDeps } from './config-keys.js';
|
|
3
|
+
export interface ConfigSetOptions {
|
|
4
|
+
pairs: string[];
|
|
5
|
+
json?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ConfigUnsetOptions {
|
|
8
|
+
keys: string[];
|
|
9
|
+
json?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const runConfigSet: (opts: ConfigSetOptions, deps: ConfigDeps) => Promise<ValuesDone>;
|
|
12
|
+
export declare const runConfigUnset: (opts: ConfigUnsetOptions, deps: ConfigDeps) => Promise<ValuesDone>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {} from '../../lib/daemon/values.types.js';
|
|
2
|
+
import { CliError } from '../../lib/json-output.js';
|
|
3
|
+
import { secretValue } from '../extension/configure.js';
|
|
4
|
+
import { kindsOf, LIST_HINT, ownerOf, secretRefused, } from './config-keys.js';
|
|
5
|
+
const HISTORY = 'a value on the command line stays in the shell history';
|
|
6
|
+
const bareKey = (key, kinds) => {
|
|
7
|
+
if (kinds.get(key) === 'secret')
|
|
8
|
+
return key;
|
|
9
|
+
throw new CliError('invalid_argument', `${key}: expected ${key}=<value>; only a declared secret reads its value from stdin or a prompt`);
|
|
10
|
+
};
|
|
11
|
+
// `<owner>.<key>=<value>` pairs are settings; one bare key of a declared secret is read, never typed.
|
|
12
|
+
const split = (pairs, kinds) => {
|
|
13
|
+
const settings = {};
|
|
14
|
+
const bare = [];
|
|
15
|
+
for (const pair of pairs) {
|
|
16
|
+
const at = pair.indexOf('=');
|
|
17
|
+
const key = at < 0 ? pair : pair.slice(0, at);
|
|
18
|
+
ownerOf(key);
|
|
19
|
+
if (at < 0)
|
|
20
|
+
bare.push(bareKey(key, kinds));
|
|
21
|
+
else if (kinds.get(key) === 'secret')
|
|
22
|
+
throw secretRefused(key, `${HISTORY}; run agentage config set ${key} and type it, or pipe it`);
|
|
23
|
+
else
|
|
24
|
+
settings[key] = pair.slice(at + 1);
|
|
25
|
+
}
|
|
26
|
+
return { settings, bare };
|
|
27
|
+
};
|
|
28
|
+
const secretsOf = async (bare, deps) => {
|
|
29
|
+
if (bare.length > 1)
|
|
30
|
+
throw new CliError('invalid_argument', `one secret at a time: ${bare.join(', ')}`);
|
|
31
|
+
const [key] = bare;
|
|
32
|
+
if (key === undefined)
|
|
33
|
+
return {};
|
|
34
|
+
const value = await secretValue(key, deps.input);
|
|
35
|
+
if (!value)
|
|
36
|
+
throw new CliError('invalid_argument', `${key}: empty value; agentage config unset ${key}`);
|
|
37
|
+
return { [key]: value };
|
|
38
|
+
};
|
|
39
|
+
// The keys and each restarted extension; a restart that failed exits 1 with its reason.
|
|
40
|
+
const report = (verb, done) => {
|
|
41
|
+
console.log(`${verb}: ${done.changed.join(', ')}`);
|
|
42
|
+
for (const r of done.restarted)
|
|
43
|
+
console.log(['restarted:', r.id, r.version, r.state].filter(Boolean).join(' '));
|
|
44
|
+
const failed = done.restarted.filter((r) => r.state === 'failed');
|
|
45
|
+
if (failed.length)
|
|
46
|
+
throw new CliError('extension_failed', failed.map((r) => `${r.id} failed: ${r.error ?? 'no reason given'}`).join('; '), { changed: done.changed });
|
|
47
|
+
return done;
|
|
48
|
+
};
|
|
49
|
+
const patched = async (deps, verb, build) => {
|
|
50
|
+
const host = await deps.host();
|
|
51
|
+
const patch = await build(kindsOf(await host.values()));
|
|
52
|
+
return report(verb, await host.patchValues(patch));
|
|
53
|
+
};
|
|
54
|
+
export const runConfigSet = (opts, deps) => patched(deps, 'set', async (kinds) => {
|
|
55
|
+
const { settings, bare } = split(opts.pairs, kinds);
|
|
56
|
+
const secrets = await secretsOf(bare, deps);
|
|
57
|
+
return { ...(Object.keys(settings).length && { settings }), ...(bare.length && { secrets }) };
|
|
58
|
+
});
|
|
59
|
+
const unsetKind = (key, kinds) => {
|
|
60
|
+
ownerOf(key);
|
|
61
|
+
const kind = kinds.get(key);
|
|
62
|
+
if (!kind)
|
|
63
|
+
throw new CliError('invalid_argument', `${key}: not declared by an installed extension; ${LIST_HINT}`);
|
|
64
|
+
return kind;
|
|
65
|
+
};
|
|
66
|
+
export const runConfigUnset = (opts, deps) => patched(deps, 'unset', async (kinds) => {
|
|
67
|
+
const patch = { settings: {}, secrets: {} };
|
|
68
|
+
for (const key of opts.keys)
|
|
69
|
+
patch[`${unsetKind(key, kinds)}s`][key] = null;
|
|
70
|
+
return patch;
|
|
71
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Command } from 'commander';
|
|
2
|
+
import { type ConfigGetOptions } from './config-get.js';
|
|
3
|
+
import { type ConfigListOptions } from './config-list.js';
|
|
4
|
+
import { type ConfigSetOptions, type ConfigUnsetOptions } from './config-set.js';
|
|
5
|
+
type Action<T> = (opts: T) => Promise<void>;
|
|
6
|
+
export interface ConfigActions {
|
|
7
|
+
list: Action<ConfigListOptions>;
|
|
8
|
+
get: Action<ConfigGetOptions>;
|
|
9
|
+
set: Action<ConfigSetOptions>;
|
|
10
|
+
unset: Action<ConfigUnsetOptions>;
|
|
11
|
+
}
|
|
12
|
+
export declare const registerConfig: (program: Command, actions: ConfigActions) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {} from 'commander';
|
|
2
|
+
import { addJson } from '../../lib/json-output.js';
|
|
3
|
+
import { helpOrUnknown } from '../extension/list.js';
|
|
4
|
+
import {} from './config-get.js';
|
|
5
|
+
import {} from './config-list.js';
|
|
6
|
+
import {} from './config-set.js';
|
|
7
|
+
const CONFIG_HELP = `
|
|
8
|
+
A key is <owner>.<key>: the owner is an extension id, or shared for a value every extension that
|
|
9
|
+
declares shared.<key> reads (agentage config set shared.userNickName=ann). The daemon checks each
|
|
10
|
+
value against the manifests, stores it, and restarts the extensions that read it; it starts when
|
|
11
|
+
none runs. A secret is never printed: config set <owner>.<name> with no =value reads it from stdin,
|
|
12
|
+
or asks for it on a terminal; a secret given as <key>=<value> is refused.`;
|
|
13
|
+
const addList = (group, list) => {
|
|
14
|
+
addJson(group
|
|
15
|
+
.command('list')
|
|
16
|
+
.description('Each key with its type, value and source (default or set)')
|
|
17
|
+
.argument('[owner]', 'only this extension id, or shared')).action((owner, opts) => list({ ...opts, owner }));
|
|
18
|
+
};
|
|
19
|
+
const addGet = (group, get) => {
|
|
20
|
+
addJson(group
|
|
21
|
+
.command('get')
|
|
22
|
+
.description('Print one value; never a secret')
|
|
23
|
+
.argument('<key>', '<owner>.<key>')).action((key, opts) => get({ ...opts, key }));
|
|
24
|
+
};
|
|
25
|
+
const addSet = (group, { set, unset }) => {
|
|
26
|
+
addJson(group
|
|
27
|
+
.command('set')
|
|
28
|
+
.description('Set values: <owner>.<key>=<value>, or <owner>.<secret> alone to type it')
|
|
29
|
+
.argument('<pairs...>', '<owner>.<key>=<value>, one or more')).action((pairs, opts) => set({ ...opts, pairs }));
|
|
30
|
+
addJson(group
|
|
31
|
+
.command('unset')
|
|
32
|
+
.description('Remove stored values: the declared default applies again')
|
|
33
|
+
.argument('<keys...>', '<owner>.<key>, one or more')).action((keys, opts) => unset({ ...opts, keys }));
|
|
34
|
+
};
|
|
35
|
+
// Bare `config` prints its help, an unknown subcommand is usage.
|
|
36
|
+
export const registerConfig = (program, actions) => {
|
|
37
|
+
const group = program
|
|
38
|
+
.command('config')
|
|
39
|
+
.description('Settings and secrets of the extensions on this machine')
|
|
40
|
+
.addHelpText('after', CONFIG_HELP)
|
|
41
|
+
.allowExcessArguments()
|
|
42
|
+
.action(helpOrUnknown);
|
|
43
|
+
addList(group, actions.list);
|
|
44
|
+
addGet(group, actions.get);
|
|
45
|
+
addSet(group, actions);
|
|
46
|
+
};
|
|
@@ -14,6 +14,7 @@ export declare const readHidden: (question: string, { stdin, stderr }?: {
|
|
|
14
14
|
stderr: Pick<NodeJS.WriteStream, "write">;
|
|
15
15
|
}) => Promise<string>;
|
|
16
16
|
export declare const stdinInput: (prompt: SecretInput["prompt"]) => SecretInput;
|
|
17
|
+
export declare const secretValue: (key: string, input: SecretInput) => Promise<string>;
|
|
17
18
|
export declare const runConfigure: (opts: ConfigureOptions, deps: LifecycleDeps & {
|
|
18
19
|
input: SecretInput;
|
|
19
20
|
}) => Promise<{
|
|
@@ -44,7 +44,7 @@ export const stdinInput = (prompt) => ({
|
|
|
44
44
|
readStdin: readAll,
|
|
45
45
|
prompt,
|
|
46
46
|
});
|
|
47
|
-
const secretValue = async (key, input) => {
|
|
47
|
+
export const secretValue = async (key, input) => {
|
|
48
48
|
if (!input.isTTY)
|
|
49
49
|
return (await input.readStdin()).replace(/\r?\n$/, '');
|
|
50
50
|
if (isJsonRun())
|
|
@@ -4,14 +4,23 @@ import { getConfigDir } from '../../lib/fs/config.js';
|
|
|
4
4
|
import {} from '../../core/loader/discover.js';
|
|
5
5
|
import {} from '../../core/loader/verbs.js';
|
|
6
6
|
import {} from './kit-tool.js';
|
|
7
|
+
import { kitValues } from './kit-values.js';
|
|
7
8
|
import { helpOrUnknown } from './list.js';
|
|
8
9
|
// A kit command's own exit code: the program returns it as the CLI's.
|
|
9
10
|
export const KIT_EXIT = 'agentage.kitExit';
|
|
11
|
+
const HELP = ['--help', '-h'];
|
|
12
|
+
const dashes = (argv) => {
|
|
13
|
+
const at = argv.indexOf('--');
|
|
14
|
+
return at < 0 ? argv.length : at;
|
|
15
|
+
};
|
|
10
16
|
// The kit parses args and owns --json and --help; the token never reaches extension code.
|
|
11
|
-
const runKit = async (
|
|
12
|
-
const
|
|
17
|
+
const runKit = async (load, dir, command, argv) => {
|
|
18
|
+
const tool = await load();
|
|
13
19
|
delete process.env['AGENTAGE_TOKEN'];
|
|
14
|
-
const
|
|
20
|
+
const help = argv.slice(0, dashes(argv)).some((arg) => HELP.includes(arg));
|
|
21
|
+
const values = help ? {} : await kitValues(tool, dir, command);
|
|
22
|
+
const dataDir = join(getConfigDir(), 'data');
|
|
23
|
+
const code = await tool.runCommand({ dir, command, argv, dataDir, ...values });
|
|
15
24
|
if (code !== 0)
|
|
16
25
|
throw new CommanderError(code, KIT_EXIT, `${command} exited ${code}`);
|
|
17
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Kit from '@agentage/extension/tool';
|
|
2
2
|
import { type KitCheck } from '../../core/loader/load.js';
|
|
3
|
-
export type KitTool = Pick<typeof Kit, 'check' | 'checkLines' | 'build' | 'buildLines' | 'runCommand' | 'checkCli' | 'up' | 'down' | 'token' | 'readManifest' | 'writeContracts' | 'appBuilder' | 'buildApp'>;
|
|
3
|
+
export type KitTool = Pick<typeof Kit, 'check' | 'checkLines' | 'build' | 'buildLines' | 'runCommand' | 'checkCli' | 'up' | 'down' | 'token' | 'readManifest' | 'resolveShared' | 'types' | 'writeContracts' | 'appBuilder' | 'buildApp'>;
|
|
4
4
|
export type LoadKitTool = () => Promise<KitTool>;
|
|
5
5
|
export declare const loadKitTool: LoadKitTool;
|
|
6
6
|
export declare const kitCheck: (tool?: LoadKitTool) => KitCheck;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResolvedShared } from '@agentage/extension/tool';
|
|
2
|
+
import { type KitTool } from './kit-tool.js';
|
|
3
|
+
export interface KitValues {
|
|
4
|
+
shared: ResolvedShared;
|
|
5
|
+
owners: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export declare const kitValues: (tool: KitTool, dir: string, command: string) => Promise<KitValues>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { installationRows } from '../../core/loader/installed.js';
|
|
4
|
+
import { getConfigDir } from '../../lib/fs/config.js';
|
|
5
|
+
import { isRecord } from '../../lib/fs/json-file.js';
|
|
6
|
+
import { CliError, messageOf } from '../../lib/json-output.js';
|
|
7
|
+
import {} from './kit-tool.js';
|
|
8
|
+
// The daemon writes these files by rename, so a plain read sees one whole version, as its own reads do.
|
|
9
|
+
const rowsOf = (kind) => {
|
|
10
|
+
let text;
|
|
11
|
+
try {
|
|
12
|
+
text = readFileSync(join(getConfigDir(), `${kind}.json`), 'utf-8');
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
if (err.code === 'ENOENT')
|
|
16
|
+
return {};
|
|
17
|
+
throw err;
|
|
18
|
+
}
|
|
19
|
+
let all;
|
|
20
|
+
try {
|
|
21
|
+
all = JSON.parse(text);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new Error(`${kind}.json is not valid JSON`);
|
|
25
|
+
}
|
|
26
|
+
if (!isRecord(all) || !Object.values(all).every(isRecord))
|
|
27
|
+
throw new Error(`${kind}.json is not an object of rows by id`);
|
|
28
|
+
return all;
|
|
29
|
+
};
|
|
30
|
+
// Every installed folder with a readable manifest, the daemon's set of owners; disabled rows too.
|
|
31
|
+
const installedOwners = async (tool, own) => {
|
|
32
|
+
const manifests = new Map();
|
|
33
|
+
const dirs = {};
|
|
34
|
+
for (const { id, dir } of installationRows()) {
|
|
35
|
+
if (id === own || dir === null)
|
|
36
|
+
continue;
|
|
37
|
+
const pkg = await tool.readManifest(dir).catch(() => undefined);
|
|
38
|
+
if (pkg)
|
|
39
|
+
(manifests.set(id, pkg.agentage), (dirs[id] = dir));
|
|
40
|
+
}
|
|
41
|
+
return { manifests, dirs };
|
|
42
|
+
};
|
|
43
|
+
const resolve = async (tool, dir) => {
|
|
44
|
+
const { agentage } = await tool.readManifest(dir);
|
|
45
|
+
const { manifests, dirs } = await installedOwners(tool, agentage.id);
|
|
46
|
+
const buckets = {
|
|
47
|
+
settings: rowsOf('settings'),
|
|
48
|
+
secrets: rowsOf('secrets'),
|
|
49
|
+
};
|
|
50
|
+
return { shared: tool.resolveShared(agentage, manifests, buckets, process.env), owners: dirs };
|
|
51
|
+
};
|
|
52
|
+
const codeOf = (err) => {
|
|
53
|
+
const code = err.code;
|
|
54
|
+
return typeof code === 'string' ? ` (${code})` : '';
|
|
55
|
+
};
|
|
56
|
+
// What ctx.settings, ctx.secrets, setting(), secret() and db() read, as the daemon resolves them.
|
|
57
|
+
export const kitValues = (tool, dir, command) => resolve(tool, dir).catch((err) => {
|
|
58
|
+
const why = `${messageOf(err)}${codeOf(err)}`;
|
|
59
|
+
throw new CliError('extension_failed', `${command}: cannot resolve its values: ${why}`);
|
|
60
|
+
});
|
|
@@ -5,6 +5,7 @@ import { type ExtensionCreateOptions } from './create.js';
|
|
|
5
5
|
import { type ExtensionDoctorOptions } from './doctor.js';
|
|
6
6
|
import { type LifecycleActions } from './lifecycle-commands.js';
|
|
7
7
|
import { type ExtensionsGather } from './rows.js';
|
|
8
|
+
import { type ExtensionTypesOptions } from './types.js';
|
|
8
9
|
import { type KitActions } from './up-commands.js';
|
|
9
10
|
export declare const printReport: ({ status, warnings }: ExtensionsGather, json?: boolean) => void;
|
|
10
11
|
export declare const helpOrUnknown: (_opts: unknown, group: Command) => void;
|
|
@@ -12,5 +13,6 @@ export interface ExtensionActions extends KitActions, BuildActions, LifecycleAct
|
|
|
12
13
|
doctor: (opts: ExtensionDoctorOptions) => Promise<void>;
|
|
13
14
|
create: (opts: ExtensionCreateOptions) => Promise<void>;
|
|
14
15
|
release: (opts: ExtensionReleaseOptions) => Promise<void>;
|
|
16
|
+
types: (opts: ExtensionTypesOptions) => Promise<void>;
|
|
15
17
|
}
|
|
16
18
|
export declare const registerExtension: (program: Command, actions: ExtensionActions) => void;
|
|
@@ -6,6 +6,7 @@ import {} from './doctor.js';
|
|
|
6
6
|
import { addLifecycle } from './lifecycle-commands.js';
|
|
7
7
|
import { printWarnings, rowLines } from './row-lines.js';
|
|
8
8
|
import {} from './rows.js';
|
|
9
|
+
import { addTypes } from './types.js';
|
|
9
10
|
import { addKitTools } from './up-commands.js';
|
|
10
11
|
// The rows, or the whole report as JSON, on stdout; warnings on stderr (extension doctor).
|
|
11
12
|
export const printReport = ({ status, warnings }, json) => {
|
|
@@ -52,4 +53,5 @@ export const registerExtension = (program, actions) => {
|
|
|
52
53
|
addBuild(group, actions);
|
|
53
54
|
addRelease(group, actions.release);
|
|
54
55
|
addKitTools(group, actions);
|
|
56
|
+
addTypes(group, actions.types);
|
|
55
57
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Command } from 'commander';
|
|
2
|
+
import { type LoadKitTool } from './kit-tool.js';
|
|
3
|
+
export interface ExtensionTypesOptions {
|
|
4
|
+
dir?: string;
|
|
5
|
+
check?: boolean;
|
|
6
|
+
owner?: string[];
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const runExtensionTypes: ({ dir, check, owner }?: ExtensionTypesOptions, tool?: LoadKitTool) => Promise<{
|
|
10
|
+
owners: string[];
|
|
11
|
+
file: string;
|
|
12
|
+
changed: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const addTypes: (group: Command, types: (opts: ExtensionTypesOptions) => Promise<void>) => Command;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {} from 'commander';
|
|
2
|
+
import { installationRows } from '../../core/loader/installed.js';
|
|
3
|
+
import { addJson, CliError } from '../../lib/json-output.js';
|
|
4
|
+
import { loadKitTool } from './kit-tool.js';
|
|
5
|
+
// `<owner>.<key>` and `<owner>.<name>:write` name their owner before the first dot.
|
|
6
|
+
const ownerIds = (uses = {}) => new Set(Object.values(uses)
|
|
7
|
+
.flat()
|
|
8
|
+
.flatMap((entry) => (entry?.includes('.') ? [entry.slice(0, entry.indexOf('.'))] : [])));
|
|
9
|
+
// The folders of the used owners this machine has installed; the kit looks in node_modules after.
|
|
10
|
+
const installedOwners = async (tool, dir) => {
|
|
11
|
+
const wanted = ownerIds((await (await tool()).readManifest(dir)).agentage.uses);
|
|
12
|
+
return installationRows().flatMap((row) => (row.dir && wanted.has(row.id) ? [row.dir] : []));
|
|
13
|
+
};
|
|
14
|
+
const OUT_OF_DATE = /out of date/;
|
|
15
|
+
// The kit names why a use fails (KEY_NOT_FOUND, NOT_SHARED); an owner not installed is not_installed.
|
|
16
|
+
const named = (err) => {
|
|
17
|
+
const { name, message = '', code } = err;
|
|
18
|
+
if (OUT_OF_DATE.test(message))
|
|
19
|
+
return new CliError('not_conforming', message);
|
|
20
|
+
if (name !== 'UsesError' || typeof code !== 'string')
|
|
21
|
+
return err;
|
|
22
|
+
const cli = code === 'OWNER_NOT_FOUND' ? 'not_installed' : 'not_conforming';
|
|
23
|
+
return new CliError(cli, `${message} (${code})`);
|
|
24
|
+
};
|
|
25
|
+
// Writes src/agentage-env.d.ts from the manifest and its owners; --check only compares.
|
|
26
|
+
export const runExtensionTypes = async ({ dir = '.', check, owner } = {}, tool = loadKitTool) => {
|
|
27
|
+
const owners = owner?.length ? owner : await installedOwners(tool, dir);
|
|
28
|
+
const result = await (await tool())
|
|
29
|
+
.types({ dir, check: check === true, owners })
|
|
30
|
+
.catch((err) => {
|
|
31
|
+
throw named(err);
|
|
32
|
+
});
|
|
33
|
+
console.log(result.changed ? `wrote ${result.file}` : `${result.file} is up to date`);
|
|
34
|
+
return { ...result, owners };
|
|
35
|
+
};
|
|
36
|
+
const TYPES_HELP = `
|
|
37
|
+
Writes src/agentage-env.d.ts from the manifest: the own settings, secrets and databases, and those
|
|
38
|
+
of each owner named in agentage.uses, so ctx.setting(), ctx.secret() and ctx.db() are typed. No
|
|
39
|
+
code of another extension runs. The owners come from each --owner folder, else from the
|
|
40
|
+
extensions installed on this machine, then from node_modules. --check writes nothing and exits 1
|
|
41
|
+
(not_conforming) when the file differs, or when a used key is gone or no longer shared (its kit
|
|
42
|
+
code in brackets); a used owner found nowhere is not_installed.`;
|
|
43
|
+
const collect = (value, all = []) => [...all, value];
|
|
44
|
+
export const addTypes = (group, types) => addJson(group
|
|
45
|
+
.command('types')
|
|
46
|
+
.description('Write src/agentage-env.d.ts, the typed keys; --check only compares')
|
|
47
|
+
.option('--dir <path>', 'the extension package folder (default: the current folder)')
|
|
48
|
+
.option('--check', 'write nothing; exit 1 when the file differs')
|
|
49
|
+
.option('--owner <dir>', 'the package folder of a used owner (repeatable)', collect))
|
|
50
|
+
.addHelpText('after', TYPES_HELP)
|
|
51
|
+
.action(types);
|
|
@@ -5,9 +5,19 @@ import { isRange, satisfies } from '../semver-range.js';
|
|
|
5
5
|
import { cliEntryOf, isKitShaped, kitCommandsOf, kitShapeProblem, } from './kit-manifest.js';
|
|
6
6
|
export const ID_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
7
7
|
const DEFAULT_ENGINE = '^1';
|
|
8
|
-
export const CORE_COMMANDS = [
|
|
8
|
+
export const CORE_COMMANDS = [
|
|
9
|
+
'setup',
|
|
10
|
+
'status',
|
|
11
|
+
'update',
|
|
12
|
+
'extension',
|
|
13
|
+
'config',
|
|
14
|
+
'add',
|
|
15
|
+
'remove',
|
|
16
|
+
'help',
|
|
17
|
+
];
|
|
9
18
|
const DEVICE_NAMES = ['con', 'prn', 'aux', 'nul'].concat(...Array.from({ length: 10 }, (_, n) => [`com${n}`, `lpt${n}`]));
|
|
10
|
-
|
|
19
|
+
// `shared` owns the shared.<key> values (D125.2): no verb, but never an id.
|
|
20
|
+
const RESERVED_IDS = new Set([...CORE_COMMANDS, 'shared', ...DEVICE_NAMES]);
|
|
11
21
|
const SUBCOMMAND = /^[a-z0-9][a-z0-9-]*$/;
|
|
12
22
|
const str = (value) => (typeof value === 'string' ? value : null);
|
|
13
23
|
const record = (value) => (isRecord(value) ? value : {});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ValueRow, type ValuesDone, type ValuesPatch } from './values.types.js';
|
|
1
2
|
export interface HostRow {
|
|
2
3
|
id: string;
|
|
3
4
|
version: string;
|
|
@@ -34,6 +35,8 @@ export interface HostClient {
|
|
|
34
35
|
id: string;
|
|
35
36
|
}>;
|
|
36
37
|
reload: (id: string, part?: 'app') => Promise<HostReload>;
|
|
38
|
+
values: (owner?: string) => Promise<ValueRow[]>;
|
|
39
|
+
patchValues: (patch: ValuesPatch) => Promise<ValuesDone>;
|
|
37
40
|
}
|
|
38
41
|
export interface HostReload {
|
|
39
42
|
id: string;
|
|
@@ -3,6 +3,7 @@ import { CliError, DaemonError, messageOf } from '../json-output.js';
|
|
|
3
3
|
import { daemonFailure } from './daemon-answer.js';
|
|
4
4
|
import { daemonFilePath, readHostToken } from './daemon-file.js';
|
|
5
5
|
import { provenPort } from './daemon-probe.js';
|
|
6
|
+
import {} from './values.types.js';
|
|
6
7
|
// An install runs npm (the daemon waits up to 660 s), then starts the child: past that it is stuck.
|
|
7
8
|
// A reload: drain 10 s, start and health 60 s each, and the same again to restore: past 5 min stuck.
|
|
8
9
|
const WAITS = { read: 10_000, change: 12 * 60_000, reload: 5 * 60_000 };
|
|
@@ -71,5 +72,7 @@ export const hostClient = (port, waits = WAITS, token = readHostToken, same = sa
|
|
|
71
72
|
change: (id, patch) => send('PATCH', at(id), patch),
|
|
72
73
|
remove: (id, purge) => send('DELETE', `${at(id)}${purge ? '?purge=true' : ''}`),
|
|
73
74
|
reload: (id, part) => send('POST', `${at(id)}/reload`, part ? { part } : {}, 'RELOAD'),
|
|
75
|
+
values: (owner) => send('GET', `/host/values${owner ? `?owner=${encodeURIComponent(owner)}` : ''}`),
|
|
76
|
+
patchValues: (patch) => send('PATCH', '/host/values', patch),
|
|
74
77
|
};
|
|
75
78
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type HostSummary } from './host-client.js';
|
|
2
|
+
export interface SettingRow {
|
|
3
|
+
key: string;
|
|
4
|
+
type: string;
|
|
5
|
+
enum?: unknown[];
|
|
6
|
+
value: unknown;
|
|
7
|
+
source: 'default' | 'set';
|
|
8
|
+
share?: string;
|
|
9
|
+
declaredBy?: string[];
|
|
10
|
+
conflict?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SecretRow {
|
|
13
|
+
key: string;
|
|
14
|
+
set: boolean;
|
|
15
|
+
share?: string;
|
|
16
|
+
declaredBy?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface ValueRow {
|
|
19
|
+
owner: string;
|
|
20
|
+
settings: SettingRow[];
|
|
21
|
+
secrets: SecretRow[];
|
|
22
|
+
}
|
|
23
|
+
export interface ValuesPatch {
|
|
24
|
+
settings?: Record<string, unknown>;
|
|
25
|
+
secrets?: Record<string, string | null>;
|
|
26
|
+
}
|
|
27
|
+
export interface ValuesDone {
|
|
28
|
+
changed: string[];
|
|
29
|
+
restarted: HostSummary[];
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {} from './host-client.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type Command } from 'commander';
|
|
2
|
-
export declare const CODES: readonly ["already_installed", "already_running", "auth_required", "auth_unavailable", "build_failed", "cancelled", "confirmation_required", "daemon_disabled", "daemon_unavailable", "daemon_unresponsive", "disk_full", "error", "extension_failed", "integrity_drift", "invalid_argument", "market_failed", "market_timeout", "market_unreachable", "needed_by_dependents", "network_unavailable", "no_discovery", "no_market", "not_conforming", "not_installed", "not_pushed", "permission_denied", "port_in_use", "profile_invalid", "release_refused", "stop_failed", "timeout", "token_request_failed", "uncommitted_changes", "usage"];
|
|
2
|
+
export declare const CODES: readonly ["already_installed", "already_running", "auth_required", "auth_unavailable", "build_failed", "cancelled", "confirmation_required", "daemon_disabled", "daemon_unavailable", "daemon_unresponsive", "disk_full", "error", "extension_failed", "integrity_drift", "invalid_argument", "market_failed", "market_timeout", "market_unreachable", "needed_by_dependents", "network_unavailable", "no_discovery", "no_market", "not_conforming", "not_installed", "not_pushed", "permission_denied", "port_in_use", "profile_invalid", "release_refused", "secret_refused", "stop_failed", "timeout", "token_request_failed", "uncommitted_changes", "usage"];
|
|
3
3
|
export type Code = (typeof CODES)[number];
|
|
4
4
|
export declare class CliError extends Error {
|
|
5
5
|
readonly code: Code;
|
|
6
|
-
|
|
6
|
+
readonly details: Record<string, unknown>;
|
|
7
|
+
constructor(code: Code, message: string, details?: Record<string, unknown>);
|
|
7
8
|
}
|
|
8
9
|
export declare class DaemonError extends Error {
|
|
9
10
|
readonly code: string;
|
package/dist/lib/json-output.js
CHANGED
|
@@ -33,6 +33,7 @@ export const CODES = [
|
|
|
33
33
|
'port_in_use',
|
|
34
34
|
'profile_invalid',
|
|
35
35
|
'release_refused',
|
|
36
|
+
'secret_refused',
|
|
36
37
|
'stop_failed',
|
|
37
38
|
'timeout',
|
|
38
39
|
'token_request_failed',
|
|
@@ -42,9 +43,11 @@ export const CODES = [
|
|
|
42
43
|
// An error with a stable snake_case code for `--json`; any other error is `error`.
|
|
43
44
|
export class CliError extends Error {
|
|
44
45
|
code;
|
|
45
|
-
|
|
46
|
+
details;
|
|
47
|
+
constructor(code, message, details = {}) {
|
|
46
48
|
super(message);
|
|
47
49
|
this.code = code;
|
|
50
|
+
this.details = details;
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
// The daemon's own code (NOT_FOUND, INVALID_SETTING) and details (START_FAILED), as it gives them.
|
|
@@ -111,7 +114,9 @@ export const messageOf = (err) => {
|
|
|
111
114
|
return `${err.message}${why}`;
|
|
112
115
|
};
|
|
113
116
|
export const writeError = (io, err, code = codeOf(err)) => {
|
|
114
|
-
const details = err instanceof DaemonError
|
|
117
|
+
const details = (err instanceof DaemonError || err instanceof CliError) &&
|
|
118
|
+
Object.keys(err.details).length &&
|
|
119
|
+
err.details;
|
|
115
120
|
const error = { code, message: messageOf(err), ...(details && { details }) };
|
|
116
121
|
io.writeOut(`${JSON.stringify({ success: false, error })}\n`);
|
|
117
122
|
};
|
package/dist/program-deps.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { runAuthToken } from './commands/auth/token.js';
|
|
2
2
|
import {} from './commands/auth/setup.js';
|
|
3
3
|
import { runDaemonRestart, runDaemonStatus, runDaemonStop } from './commands/daemon/daemon.js';
|
|
4
|
+
import { runConfigGet } from './commands/config/config-get.js';
|
|
5
|
+
import { runConfigList } from './commands/config/config-list.js';
|
|
6
|
+
import { runConfigSet, runConfigUnset } from './commands/config/config-set.js';
|
|
4
7
|
import { runDaemonStart } from './commands/daemon/start.js';
|
|
5
8
|
import { cliInstaller, npmNewest } from './commands/daemon/installer.js';
|
|
6
9
|
import { moveBeforeStart } from './commands/daemon/move.js';
|
|
@@ -14,6 +17,7 @@ import { runEnabled, runInstall, runRemove, terminalIo } from './commands/extens
|
|
|
14
17
|
import { runList, runUpdate as runExtensionUpdate } from './commands/extension/lifecycle-list.js';
|
|
15
18
|
import { loadKitTool } from './commands/extension/kit-tool.js';
|
|
16
19
|
import { runRelease } from './commands/extension/release.js';
|
|
20
|
+
import { runExtensionTypes } from './commands/extension/types.js';
|
|
17
21
|
import { runExtensionSetup } from './commands/extension/setup.js';
|
|
18
22
|
import { runExtensionDown, runExtensionToken, runExtensionUp } from './commands/extension/up.js';
|
|
19
23
|
import { runStatus, statusDeps } from './commands/status/status.js';
|
|
@@ -43,6 +47,7 @@ const installer = () => cliInstaller({
|
|
|
43
47
|
});
|
|
44
48
|
// The daemon is started on request by every lifecycle command.
|
|
45
49
|
const lifecycle = { host: async () => hostClient(await ensureDaemon()) };
|
|
50
|
+
const configDeps = () => ({ ...lifecycle, input: stdinInput(readHidden) });
|
|
46
51
|
const listDeps = {
|
|
47
52
|
...lifecycle,
|
|
48
53
|
available: () => listMarket(),
|
|
@@ -86,6 +91,7 @@ export const defaultDeps = {
|
|
|
86
91
|
extensionUp: (opts) => runExtensionUp(opts),
|
|
87
92
|
extensionDown: (opts) => runExtensionDown(opts),
|
|
88
93
|
extensionToken: (opts) => runExtensionToken(opts),
|
|
94
|
+
extensionTypes: (opts) => runExtensionTypes(opts),
|
|
89
95
|
daemon: {
|
|
90
96
|
start: () => runDaemonStart(),
|
|
91
97
|
status: () => runDaemonStatus(),
|
|
@@ -93,6 +99,12 @@ export const defaultDeps = {
|
|
|
93
99
|
restart: () => runDaemonRestart(),
|
|
94
100
|
run: () => runDaemon({ installer, before: () => moveBeforeStart() }),
|
|
95
101
|
},
|
|
102
|
+
config: {
|
|
103
|
+
list: (opts) => runConfigList(opts, configDeps()),
|
|
104
|
+
get: (opts) => runConfigGet(opts, configDeps()),
|
|
105
|
+
set: (opts) => runConfigSet(opts, configDeps()),
|
|
106
|
+
unset: (opts) => runConfigUnset(opts, configDeps()),
|
|
107
|
+
},
|
|
96
108
|
kitTool: loadKitTool,
|
|
97
109
|
updateHint,
|
|
98
110
|
refreshUpdateCache: () => refreshUpdateCache(),
|
package/dist/program.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { type SetupOptions } from './commands/auth/setup.js';
|
|
3
3
|
import { type AuthTokenOptions } from './commands/auth/token.js';
|
|
4
|
+
import { type ConfigGetOptions } from './commands/config/config-get.js';
|
|
5
|
+
import { type ConfigListOptions } from './commands/config/config-list.js';
|
|
6
|
+
import { type ConfigSetOptions, type ConfigUnsetOptions } from './commands/config/config-set.js';
|
|
4
7
|
import { type DaemonOptions } from './commands/daemon/daemon.js';
|
|
5
8
|
import { type ExtensionBuildOptions, type ExtensionCheckOptions } from './commands/extension/build.js';
|
|
6
9
|
import { type ExtensionCreateOptions } from './commands/extension/create.js';
|
|
@@ -10,6 +13,7 @@ import { type InstallOptions, type RemoveOptions } from './commands/extension/li
|
|
|
10
13
|
import { type ExtensionUpdateOptions, type ListOptions } from './commands/extension/lifecycle-list.js';
|
|
11
14
|
import { type LoadKitTool } from './commands/extension/kit-tool.js';
|
|
12
15
|
import { type ExtensionReleaseOptions } from './commands/extension/release.js';
|
|
16
|
+
import { type ExtensionTypesOptions } from './commands/extension/types.js';
|
|
13
17
|
import { type ExtensionDownOptions, type ExtensionTokenOptions, type ExtensionUpFlags } from './commands/extension/up.js';
|
|
14
18
|
import { type StatusOptions } from './commands/status/status.js';
|
|
15
19
|
import { type UpdateOptions } from './commands/update/update.js';
|
|
@@ -37,7 +41,14 @@ export interface ProgramDeps {
|
|
|
37
41
|
extensionUp: Run<ExtensionUpFlags>;
|
|
38
42
|
extensionDown: Run<ExtensionDownOptions>;
|
|
39
43
|
extensionToken: Run<ExtensionTokenOptions>;
|
|
44
|
+
extensionTypes: Run<ExtensionTypesOptions>;
|
|
40
45
|
daemon: Record<'start' | 'status' | 'stop' | 'restart' | 'run', Run<DaemonOptions>>;
|
|
46
|
+
config: {
|
|
47
|
+
list: Run<ConfigListOptions>;
|
|
48
|
+
get: Run<ConfigGetOptions>;
|
|
49
|
+
set: Run<ConfigSetOptions>;
|
|
50
|
+
unset: Run<ConfigUnsetOptions>;
|
|
51
|
+
};
|
|
41
52
|
kitTool: LoadKitTool;
|
|
42
53
|
updateHint: () => string | null;
|
|
43
54
|
refreshUpdateCache: () => Promise<void>;
|
package/dist/program.js
CHANGED
|
@@ -2,6 +2,10 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { Command, CommanderError } from 'commander';
|
|
3
3
|
import { registerSetup } from './commands/auth/setup.js';
|
|
4
4
|
import { registerAuth } from './commands/auth/token.js';
|
|
5
|
+
import { registerConfig } from './commands/config/config.js';
|
|
6
|
+
import {} from './commands/config/config-get.js';
|
|
7
|
+
import {} from './commands/config/config-list.js';
|
|
8
|
+
import {} from './commands/config/config-set.js';
|
|
5
9
|
import { registerDaemon } from './commands/daemon/daemon.js';
|
|
6
10
|
import {} from './commands/extension/build.js';
|
|
7
11
|
import {} from './commands/extension/create.js';
|
|
@@ -14,6 +18,7 @@ import { registerExtension } from './commands/extension/list.js';
|
|
|
14
18
|
import { KIT_EXIT } from './commands/extension/kit-commands.js';
|
|
15
19
|
import {} from './commands/extension/kit-tool.js';
|
|
16
20
|
import {} from './commands/extension/release.js';
|
|
21
|
+
import {} from './commands/extension/types.js';
|
|
17
22
|
import {} from './commands/extension/up.js';
|
|
18
23
|
import { registerStatus } from './commands/status/status.js';
|
|
19
24
|
import { registerUpdate } from './commands/update/update.js';
|
|
@@ -48,6 +53,7 @@ const addExtensions = (program, deps, argv) => {
|
|
|
48
53
|
up: withAction(deps, deps.extensionUp),
|
|
49
54
|
down: withAction(deps, deps.extensionDown),
|
|
50
55
|
token: withAction(deps, deps.extensionToken),
|
|
56
|
+
types: withAction(deps, deps.extensionTypes),
|
|
51
57
|
});
|
|
52
58
|
try {
|
|
53
59
|
registerDelegates(program, argv, (fn) => withAction(deps, fn), deps.kitTool);
|
|
@@ -78,6 +84,12 @@ export const createProgram = (deps = defaultDeps, argv = process.argv) => {
|
|
|
78
84
|
restart: daemon(deps.daemon.restart),
|
|
79
85
|
run: daemon(deps.daemon.run),
|
|
80
86
|
});
|
|
87
|
+
registerConfig(program, {
|
|
88
|
+
list: withAction(deps, deps.config.list),
|
|
89
|
+
get: withAction(deps, deps.config.get),
|
|
90
|
+
set: withAction(deps, deps.config.set),
|
|
91
|
+
unset: withAction(deps, deps.config.unset),
|
|
92
|
+
});
|
|
81
93
|
addExtensions(program, deps, argv);
|
|
82
94
|
return program;
|
|
83
95
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentage/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.0",
|
|
4
4
|
"description": "The agentage CLI - connect this machine to agentage from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"prepublishOnly": "npm run verify"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@agentage/apphost": "0.8.
|
|
58
|
-
"@agentage/extension": "0.25.
|
|
57
|
+
"@agentage/apphost": "0.8.5",
|
|
58
|
+
"@agentage/extension": "0.25.7",
|
|
59
59
|
"@electric-sql/pglite": "^0.6.0",
|
|
60
60
|
"@tailwindcss/postcss": "^4.3.5",
|
|
61
61
|
"chalk": "^6.0.0",
|