@agentage/cli 0.51.0 → 0.52.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 +95 -127
- package/dist/commands/auth/setup.d.ts +2 -0
- package/dist/commands/auth/setup.js +4 -1
- package/dist/commands/daemon/daemon.d.ts +38 -0
- package/dist/commands/daemon/daemon.js +75 -0
- package/dist/commands/daemon/installer.d.ts +11 -0
- package/dist/commands/daemon/installer.js +87 -0
- package/dist/commands/daemon/move-plan.d.ts +17 -0
- package/dist/commands/daemon/move-plan.js +67 -0
- package/dist/commands/daemon/move-settings.d.ts +5 -0
- package/dist/commands/daemon/move-settings.js +50 -0
- package/dist/commands/daemon/move.d.ts +17 -0
- package/dist/commands/daemon/move.js +106 -0
- package/dist/commands/daemon/run.d.ts +6 -0
- package/dist/commands/daemon/run.js +36 -0
- package/dist/commands/extension/build.d.ts +13 -4
- package/dist/commands/extension/build.js +67 -25
- package/dist/commands/extension/configure.d.ts +26 -0
- package/dist/commands/extension/configure.js +100 -0
- package/dist/commands/extension/create-install.d.ts +26 -0
- package/dist/commands/extension/create-install.js +81 -0
- package/dist/commands/extension/create.d.ts +6 -1
- package/dist/commands/extension/create.js +58 -16
- package/dist/commands/extension/delegate.js +3 -1
- package/dist/commands/extension/doctor.d.ts +1 -1
- package/dist/commands/extension/doctor.js +8 -7
- package/dist/commands/extension/install-once.d.ts +17 -0
- package/dist/commands/extension/install-once.js +57 -0
- package/dist/commands/extension/kit-tool.d.ts +1 -1
- package/dist/commands/extension/lifecycle-commands.d.ts +19 -0
- package/dist/commands/extension/lifecycle-commands.js +80 -0
- package/dist/commands/extension/lifecycle-list.d.ts +26 -0
- package/dist/commands/extension/lifecycle-list.js +92 -0
- package/dist/commands/extension/lifecycle.d.ts +41 -0
- package/dist/commands/extension/lifecycle.js +142 -0
- package/dist/commands/extension/line.d.ts +1 -0
- package/dist/commands/extension/line.js +2 -0
- package/dist/commands/extension/list.d.ts +4 -14
- package/dist/commands/extension/list.js +11 -95
- package/dist/commands/extension/package-build.d.ts +15 -0
- package/dist/commands/extension/package-build.js +51 -0
- package/dist/commands/extension/plan.d.ts +4 -2
- package/dist/commands/extension/plan.js +37 -37
- package/dist/commands/extension/profile-plan.d.ts +16 -0
- package/dist/commands/extension/profile-plan.js +48 -0
- package/dist/commands/extension/release.d.ts +2 -1
- package/dist/commands/extension/release.js +10 -9
- package/dist/commands/extension/row-lines.d.ts +1 -2
- package/dist/commands/extension/row-lines.js +5 -6
- package/dist/commands/extension/rows.js +6 -4
- package/dist/commands/extension/setup-cloud.d.ts +2 -2
- package/dist/commands/extension/setup-cloud.js +6 -5
- package/dist/commands/extension/setup-install.d.ts +8 -0
- package/dist/commands/extension/setup-install.js +56 -0
- package/dist/commands/extension/setup.d.ts +4 -1
- package/dist/commands/extension/setup.js +56 -18
- package/dist/commands/extension/stack-owner.d.ts +4 -0
- package/dist/commands/extension/stack-owner.js +45 -0
- package/dist/commands/extension/sync.d.ts +6 -11
- package/dist/commands/extension/sync.js +8 -50
- package/dist/commands/extension/up-commands.d.ts +9 -0
- package/dist/commands/extension/up-commands.js +74 -0
- package/dist/commands/extension/up-local.d.ts +21 -0
- package/dist/commands/extension/up-local.js +94 -0
- package/dist/commands/extension/up-run.d.ts +23 -0
- package/dist/commands/extension/up-run.js +75 -0
- package/dist/commands/extension/up.d.ts +12 -11
- package/dist/commands/extension/up.js +65 -71
- package/dist/commands/update/update.d.ts +9 -1
- package/dist/commands/update/update.js +20 -6
- package/dist/core/installer/compare-lock.d.ts +0 -2
- package/dist/core/installer/compare-lock.js +0 -12
- package/dist/core/installer/compat.js +5 -3
- package/dist/core/installer/npm.d.ts +1 -0
- package/dist/core/installer/npm.js +6 -0
- package/dist/core/installer/old-tree.d.ts +3 -0
- package/dist/core/installer/old-tree.js +45 -0
- package/dist/core/installer/package-dir.d.ts +11 -0
- package/dist/core/installer/package-dir.js +53 -0
- package/dist/core/installer/resolve.js +1 -2
- package/dist/core/installer/tree.d.ts +0 -5
- package/dist/core/installer/tree.js +1 -25
- package/dist/core/kit-id.d.ts +1 -0
- package/dist/core/kit-id.js +20 -0
- package/dist/core/loader/discover.d.ts +7 -1
- package/dist/core/loader/discover.js +5 -4
- package/dist/core/loader/installed.d.ts +9 -0
- package/dist/core/loader/installed.js +51 -0
- package/dist/core/loader/manifest.d.ts +4 -0
- package/dist/core/loader/manifest.js +25 -3
- package/dist/core/loader/scan.d.ts +2 -1
- package/dist/core/loader/scan.js +17 -4
- package/dist/core/loader/secrets.d.ts +0 -7
- package/dist/core/loader/secrets.js +0 -11
- package/dist/core/loader/verbs.d.ts +0 -1
- package/dist/core/loader/verbs.js +1 -13
- package/dist/core/profile/machine.d.ts +0 -1
- package/dist/core/profile/machine.js +0 -5
- package/dist/lib/auth/introspect.js +1 -2
- package/dist/lib/auth/sign-in.js +3 -0
- package/dist/lib/child-env.d.ts +1 -0
- package/dist/lib/child-env.js +6 -0
- package/dist/lib/daemon/daemon-answer.d.ts +8 -0
- package/dist/lib/daemon/daemon-answer.js +38 -0
- package/dist/lib/daemon/daemon-client.d.ts +17 -0
- package/dist/lib/daemon/daemon-client.js +112 -0
- package/dist/lib/daemon/daemon-file.d.ts +16 -0
- package/dist/lib/daemon/daemon-file.js +30 -0
- package/dist/lib/daemon/daemon-health.d.ts +16 -0
- package/dist/lib/daemon/daemon-health.js +36 -0
- package/dist/lib/daemon/daemon-probe.d.ts +32 -0
- package/dist/lib/daemon/daemon-probe.js +41 -0
- package/dist/lib/daemon/daemon-stop.d.ts +13 -0
- package/dist/lib/daemon/daemon-stop.js +42 -0
- package/dist/lib/daemon/host-client.d.ts +40 -0
- package/dist/lib/daemon/host-client.js +45 -0
- package/dist/lib/exit-code.d.ts +2 -0
- package/dist/lib/exit-code.js +8 -0
- package/dist/lib/fs/json-file.d.ts +1 -0
- package/dist/lib/fs/json-file.js +1 -1
- package/dist/lib/json-output.d.ts +36 -0
- package/dist/lib/json-output.js +163 -0
- package/dist/lib/net/market-error.d.ts +12 -0
- package/dist/lib/net/market-error.js +28 -0
- package/dist/lib/net/market.d.ts +17 -2
- package/dist/lib/net/market.js +92 -18
- package/dist/lib/wait.d.ts +6 -0
- package/dist/lib/wait.js +17 -0
- package/dist/lib/with-action.d.ts +12 -0
- package/dist/lib/with-action.js +33 -0
- package/dist/program-deps.d.ts +2 -0
- package/dist/program-deps.js +95 -0
- package/dist/program.d.ts +29 -21
- package/dist/program.js +41 -75
- package/package.json +8 -6
- package/CHANGELOG.md +0 -68
- package/dist/commands/extension/install-load.d.ts +0 -7
- package/dist/commands/extension/install-load.js +0 -42
- package/dist/commands/extension/install.d.ts +0 -12
- package/dist/commands/extension/install.js +0 -49
- package/dist/commands/extension/latest.d.ts +0 -2
- package/dist/commands/extension/latest.js +0 -71
- package/dist/commands/extension/remove.d.ts +0 -15
- package/dist/commands/extension/remove.js +0 -86
- package/dist/commands/extension/secrets-prompt.d.ts +0 -6
- package/dist/commands/extension/secrets-prompt.js +0 -47
- package/dist/core/installer/installer.d.ts +0 -28
- package/dist/core/installer/installer.js +0 -87
- package/dist/core/installer/latest.d.ts +0 -27
- package/dist/core/installer/latest.js +0 -90
- package/dist/core/profile/edit.d.ts +0 -4
- package/dist/core/profile/edit.js +0 -27
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import { isRecord, readJson } from '../../lib/fs/json-file.js';
|
|
3
|
-
import { manifestInfo } from '../loader/manifest.js';
|
|
4
|
-
import { extensionsDir } from '../paths.js';
|
|
5
|
-
import { fits } from './compat.js';
|
|
6
|
-
import { lockEntries, lockedVersion, parseLock, rootDependencies } from './compare-lock.js';
|
|
7
|
-
import { planInstall, refuseDrift, runNpmInto, } from './installer.js';
|
|
8
|
-
import {} from './npm.js';
|
|
9
|
-
import { clearStaging, collectTrees, commitTree, discardTree, pointCurrent, promoteFiles, readText, stageTree, treePath, withInstallLock, } from './tree.js';
|
|
10
|
-
const diff = (names, before, after) => names
|
|
11
|
-
.map((name) => ({ name, from: lockedVersion(before, name), to: lockedVersion(after, name) }))
|
|
12
|
-
.filter((change) => change.from !== change.to);
|
|
13
|
-
// Every extension the profile names or the old lock installed, sorted.
|
|
14
|
-
const namesOf = (plan, before) => {
|
|
15
|
-
const installed = before === null ? [] : Object.keys(rootDependencies(before));
|
|
16
|
-
return [...new Set([...Object.keys(plan.install), ...installed])].sort();
|
|
17
|
-
};
|
|
18
|
-
const update = async (plan, npm, packages = []) => {
|
|
19
|
-
const staging = stageTree(plan.extensionsDir, plan);
|
|
20
|
-
try {
|
|
21
|
-
const { tree, lock } = await runNpmInto(staging, 'update', npm, packages);
|
|
22
|
-
return { staging, tree, lock: parseLock(lock), raw: lock };
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
discardTree(staging);
|
|
26
|
-
throw err;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const engineIn = (staging, name) => {
|
|
30
|
-
const info = manifestInfo(readJson(join(staging, 'node_modules', name, 'package.json'), isRecord) ?? {});
|
|
31
|
-
return { engine: info.engine, kit: info.kind === 'kit' };
|
|
32
|
-
};
|
|
33
|
-
// An extension whose new version needs another extension API stays where it was.
|
|
34
|
-
const heldIn = (built, changes) => changes.flatMap(({ name, from, to }) => {
|
|
35
|
-
if (from === null || to === null)
|
|
36
|
-
return [];
|
|
37
|
-
const range = engineIn(built.staging, name);
|
|
38
|
-
return fits(range) ? [] : [{ name, version: from, newer: to, ...range }];
|
|
39
|
-
});
|
|
40
|
-
const unchanged = (plan, changes) => Object.keys(plan.install).filter((name) => !changes.some((c) => c.name === name)).length;
|
|
41
|
-
// One update; when it moved an extension past the extension API, again without moving that one.
|
|
42
|
-
const settle = async (plan, npm, names, before) => {
|
|
43
|
-
const first = await update(plan, npm);
|
|
44
|
-
const changes = diff(names, before, first.lock);
|
|
45
|
-
const held = heldIn(first, changes);
|
|
46
|
-
if (held.length === 0)
|
|
47
|
-
return { built: first, held };
|
|
48
|
-
discardTree(first.staging);
|
|
49
|
-
const moving = changes.map((c) => c.name).filter((name) => !held.some((h) => h.name === name));
|
|
50
|
-
return { built: moving.length === 0 ? null : await update(plan, npm, moving), held };
|
|
51
|
-
};
|
|
52
|
-
const sameEntries = (a, b) => (a ? lockEntries(a).join('\n') : '') === (b ? lockEntries(b).join('\n') : '');
|
|
53
|
-
// A tree that failed its check goes, unless extensions/current already names it.
|
|
54
|
-
const dropUnlessCurrent = (dir, tree) => {
|
|
55
|
-
if (readText(join(dir, 'current'))?.trim() !== tree)
|
|
56
|
-
discardTree(treePath(dir, tree));
|
|
57
|
-
};
|
|
58
|
-
// The new tree becomes current only once it passed the check; then it is the only tree left.
|
|
59
|
-
const commit = async (plan, built, staged, check) => {
|
|
60
|
-
commitTree(plan.extensionsDir, built.staging, built.tree);
|
|
61
|
-
if (!(await check(staged))) {
|
|
62
|
-
dropUnlessCurrent(plan.extensionsDir, built.tree);
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
pointCurrent(plan.extensionsDir, built.tree);
|
|
66
|
-
promoteFiles(plan.extensionsDir, { manifest: plan.manifest, lock: built.raw });
|
|
67
|
-
collectTrees(plan.extensionsDir, built.tree);
|
|
68
|
-
return true;
|
|
69
|
-
};
|
|
70
|
-
const run = async (plan, prepare, check) => {
|
|
71
|
-
refuseDrift(plan.extensionsDir);
|
|
72
|
-
clearStaging(plan.extensionsDir);
|
|
73
|
-
const before = parseLock(plan.lock);
|
|
74
|
-
const names = namesOf(plan, before);
|
|
75
|
-
const none = { changes: [], held: [], unchanged: 0, tree: null, current: false };
|
|
76
|
-
if (names.length === 0)
|
|
77
|
-
return none;
|
|
78
|
-
const { built, held } = await settle(plan, await prepare(), names, before);
|
|
79
|
-
const changes = built === null ? [] : diff(names, before, built.lock);
|
|
80
|
-
const result = { ...none, changes, held, unchanged: unchanged(plan, changes) };
|
|
81
|
-
if (built === null || sameEntries(before, built.lock)) {
|
|
82
|
-
if (built !== null)
|
|
83
|
-
discardTree(built.staging);
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
const staged = { ...result, tree: built.tree, dir: treePath(plan.extensionsDir, built.tree) };
|
|
87
|
-
return { ...result, tree: built.tree, current: await commit(plan, built, staged, check) };
|
|
88
|
-
};
|
|
89
|
-
// `setup --latest`: npm update from the current lock, under the install lock for the whole run.
|
|
90
|
-
export const updateLatest = (set, prepare, check) => withInstallLock(extensionsDir(), () => run(planInstall(set), prepare, check));
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type Profile } from './schema.js';
|
|
2
|
-
export declare const addExtension: (profile: Profile, name: string, spec: string, machineId: string, off: boolean) => Profile;
|
|
3
|
-
export declare const dropExtension: (profile: Profile, name: string, machineId: string) => Profile;
|
|
4
|
-
export declare const changeProfile: (change: (profile: Profile) => Profile) => Promise<Profile>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { loadMachine, setProfileSource } from './machine.js';
|
|
2
|
-
import { editableProfile, mutateProfile } from './profile.js';
|
|
3
|
-
import {} from './schema.js';
|
|
4
|
-
const NO_ENTRY = { off: [], config: {}, extra: {} };
|
|
5
|
-
// This machine's off list with `name` in or out; an entry is only created to turn one off.
|
|
6
|
-
const withOff = (profile, machineId, name, off) => {
|
|
7
|
-
const self = profile.machines[machineId];
|
|
8
|
-
if (!self && !off)
|
|
9
|
-
return profile;
|
|
10
|
-
const rest = (self?.off ?? []).filter((pkg) => pkg !== name);
|
|
11
|
-
const entry = { ...NO_ENTRY, ...self, off: off ? [...rest, name] : rest };
|
|
12
|
-
return { ...profile, machines: { ...profile.machines, [machineId]: entry } };
|
|
13
|
-
};
|
|
14
|
-
// Installing a name again replaces its spec; without --off it loads on this machine again.
|
|
15
|
-
export const addExtension = (profile, name, spec, machineId, off) => withOff({ ...profile, extensions: { ...profile.extensions, [name]: spec } }, machineId, name, off);
|
|
16
|
-
// Other machines' off lists are theirs to keep.
|
|
17
|
-
export const dropExtension = (profile, name, machineId) => {
|
|
18
|
-
const extensions = Object.fromEntries(Object.entries(profile.extensions).filter(([pkg]) => pkg !== name));
|
|
19
|
-
return withOff({ ...profile, extensions }, machineId, name, false);
|
|
20
|
-
};
|
|
21
|
-
// A file source stays `file`; any other profile changed here is now this machine's own copy.
|
|
22
|
-
export const changeProfile = async (change) => {
|
|
23
|
-
const next = await mutateProfile(() => change(editableProfile()));
|
|
24
|
-
if ((await loadMachine()).profileSource !== 'file')
|
|
25
|
-
await setProfileSource('default');
|
|
26
|
-
return next;
|
|
27
|
-
};
|