agentic-workflow-manager 9.4.0 → 9.4.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.
|
@@ -10,7 +10,7 @@ const config_1 = require("../../utils/config");
|
|
|
10
10
|
const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
11
11
|
const TIMEOUT_MS = 2_000;
|
|
12
12
|
const MAX_OUTPUT_BYTES = 64 * 1024;
|
|
13
|
-
const NPM_SOURCE = `https://registry.npmjs.org/${cli_version_1.CLI_PACKAGE_NAME}`;
|
|
13
|
+
const NPM_SOURCE = `https://registry.npmjs.org/${cli_version_1.CLI_PACKAGE_NAME}/latest`;
|
|
14
14
|
const STRICT_SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
15
15
|
function deadline(operation, timeoutMs = TIMEOUT_MS) {
|
|
16
16
|
let timer;
|
|
@@ -106,8 +106,7 @@ async function latestCli(fetchImpl) {
|
|
|
106
106
|
const body = JSON.parse(text);
|
|
107
107
|
if (!body || typeof body !== 'object')
|
|
108
108
|
return null;
|
|
109
|
-
const
|
|
110
|
-
const latest = tags && typeof tags === 'object' ? tags.latest : undefined;
|
|
109
|
+
const latest = body.version;
|
|
111
110
|
return typeof latest === 'string' && parseVersion(latest) ? latest : null;
|
|
112
111
|
}
|
|
113
112
|
catch {
|
|
@@ -199,8 +198,8 @@ async function checkCurrentness(cwd, deps = {}) {
|
|
|
199
198
|
const cli = !parseVersion(installedCli) || !latest || compareStrict(installedCli, latest) === null
|
|
200
199
|
? unavailable('cli', NPM_SOURCE, checkedAt, parseVersion(installedCli) ? installedCli : null)
|
|
201
200
|
: compareStrict(installedCli, latest) === 0
|
|
202
|
-
? { component: 'cli', installed: installedCli, latest, channel: 'stable', source: NPM_SOURCE, checkedAt, status: 'current', detail: 'Installed version equals npm
|
|
203
|
-
: { component: 'cli', installed: installedCli, latest, channel: 'stable', source: NPM_SOURCE, checkedAt, status: 'stale', detail: 'Installed version is behind npm
|
|
201
|
+
? { component: 'cli', installed: installedCli, latest, channel: 'stable', source: NPM_SOURCE, checkedAt, status: 'current', detail: 'Installed version equals the npm latest release.', remedy: 'No action required.' }
|
|
202
|
+
: { component: 'cli', installed: installedCli, latest, channel: 'stable', source: NPM_SOURCE, checkedAt, status: 'stale', detail: 'Installed version is behind the npm latest release.', remedy: `npm i -g ${cli_version_1.CLI_PACKAGE_NAME}@latest && rerun in a fresh process` };
|
|
204
203
|
const components = [cli];
|
|
205
204
|
let registries;
|
|
206
205
|
try {
|
|
@@ -22,7 +22,7 @@ describe('checkCurrentness', () => {
|
|
|
22
22
|
now: () => 1_700_000_000_000,
|
|
23
23
|
fetch: jest.fn().mockResolvedValue({
|
|
24
24
|
ok: true,
|
|
25
|
-
text: async () => JSON.stringify({
|
|
25
|
+
text: async () => JSON.stringify({ version: '1.2.3' }),
|
|
26
26
|
}),
|
|
27
27
|
readPreferences: () => ({ pins: {} }),
|
|
28
28
|
listRegistries: () => [{ name: 'baseline', remote: 'https://example.test/team/repo.git', contentRoot: '/registry' }],
|
|
@@ -50,6 +50,16 @@ describe('checkCurrentness', () => {
|
|
|
50
50
|
expect(JSON.stringify(result)).not.toContain('secret');
|
|
51
51
|
expect(result.components[1].source).toBe('https://example.test/team/repo.git');
|
|
52
52
|
});
|
|
53
|
+
it('reads npm currentness from the bounded latest metadata endpoint', async () => {
|
|
54
|
+
const fetch = jest.fn().mockResolvedValue({
|
|
55
|
+
ok: true,
|
|
56
|
+
text: async () => JSON.stringify({ version: '1.2.3' }),
|
|
57
|
+
});
|
|
58
|
+
const { checkCurrentness } = require('../../../src/core/currentness/check');
|
|
59
|
+
const result = await checkCurrentness(root, deps({ fetch }));
|
|
60
|
+
expect(fetch).toHaveBeenCalledWith('https://registry.npmjs.org/agentic-workflow-manager/latest', expect.objectContaining({ signal: expect.any(AbortSignal) }));
|
|
61
|
+
expect(result.components[0]).toEqual(expect.objectContaining({ status: 'current', latest: '1.2.3' }));
|
|
62
|
+
});
|
|
53
63
|
it('marks an older pinned registry as pinned-behind with the unpin remedy', async () => {
|
|
54
64
|
const { checkCurrentness } = require('../../../src/core/currentness/check');
|
|
55
65
|
const result = await checkCurrentness(root, deps({
|
|
@@ -78,7 +88,7 @@ describe('checkCurrentness', () => {
|
|
|
78
88
|
cliVersion: () => '1.9007199254740992.0',
|
|
79
89
|
fetch: jest.fn().mockResolvedValue({
|
|
80
90
|
ok: true,
|
|
81
|
-
text: async () => JSON.stringify({
|
|
91
|
+
text: async () => JSON.stringify({ version: '1.9007199254740993.0' }),
|
|
82
92
|
}),
|
|
83
93
|
}));
|
|
84
94
|
expect(result.components[0]).toEqual(expect.objectContaining({
|
|
@@ -151,7 +161,7 @@ describe('checkCurrentness', () => {
|
|
|
151
161
|
])('fails closed for %s', async (name, git) => {
|
|
152
162
|
const { checkCurrentness } = require('../../../src/core/currentness/check');
|
|
153
163
|
const result = await checkCurrentness(root, deps(name === 'malformed npm semver'
|
|
154
|
-
? { fetch: jest.fn().mockResolvedValue({ ok: true, text: async () => JSON.stringify({
|
|
164
|
+
? { fetch: jest.fn().mockResolvedValue({ ok: true, text: async () => JSON.stringify({ version: 'latest' }) }) }
|
|
155
165
|
: { git }));
|
|
156
166
|
expect(result.components.some((c) => c.status === 'unverifiable')).toBe(true);
|
|
157
167
|
});
|