@skrr-ai/cli 0.1.209 → 0.1.211
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/dist/base-command.js +2 -1
- package/dist/commands/agent/message/react.js +7 -4
- package/dist/commands/agent/message/send.d.ts +2 -12
- package/dist/commands/agent/message/send.js +5 -24
- package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
- package/dist/commands/agents/always-on/recovery-review.js +30 -1
- package/dist/commands/agents/chat.d.ts +14 -0
- package/dist/commands/agents/chat.js +32 -1
- package/dist/commands/agents/not-for-task.js +5 -1
- package/dist/commands/dm/work.js +38 -9
- package/dist/commands/duties/pause.js +12 -2
- package/dist/commands/duties/show.js +5 -0
- package/dist/commands/tasks/ask.d.ts +2 -0
- package/dist/commands/tasks/ask.js +6 -0
- package/dist/commands/tasks/deliverable/add.d.ts +2 -0
- package/dist/commands/tasks/deliverable/add.js +25 -6
- package/dist/commands/tasks/input/show.d.ts +2 -0
- package/dist/commands/tasks/input/show.js +16 -1
- package/dist/commands/tasks/resource/add.d.ts +2 -0
- package/dist/commands/tasks/resource/add.js +11 -1
- package/dist/commands/update.js +1 -0
- package/dist/generated/agent-guides.json +71 -71
- package/dist/lib/agent-proactive-baseline.js +4 -1
- package/dist/lib/cli-installation-diagnostics.d.ts +54 -0
- package/dist/lib/cli-installation-diagnostics.js +185 -20
- package/dist/lib/duties.d.ts +10 -0
- package/dist/lib/duties.js +87 -3
- package/dist/lib/platform-update-local.d.ts +10 -1
- package/dist/lib/platform-update-local.js +32 -4
- package/dist/lib/platform-update.d.ts +4 -0
- package/dist/lib/platform-update.js +4 -0
- package/dist/lib/space-resolver.d.ts +9 -0
- package/dist/lib/space-resolver.js +13 -0
- package/dist/lib/task-work.js +5 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/managedWorkRuntime.d.ts +5 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/managedWorkRuntime.js +21 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/managedWorkRuntime.d.ts +5 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/managedWorkRuntime.js +31 -5
- package/dist/node_modules/@skrr-ai/data-provider/index.js +12027 -11799
- package/oclif.manifest.json +11 -5
- package/package.json +2 -2
|
@@ -22,9 +22,12 @@ function proactiveBaselineLines(b) {
|
|
|
22
22
|
(b.systemLoops.blocked?.length
|
|
23
23
|
? ` (cannot run: ${b.systemLoops.blocked.map((loop) => `${loop.role} - ${loop.reason}`).join(', ')})`
|
|
24
24
|
: '');
|
|
25
|
+
// `enabled` is each watcher's own switch. The task/goal and memory scans also wait for
|
|
26
|
+
// Always-On, the way the Duty checks do (OSK-33262); the other watchers do not.
|
|
25
27
|
const watchers = b.watchers.status === 'unknown'
|
|
26
28
|
? 'unknown'
|
|
27
|
-
: `${b.watchers.total} (${b.watchers.enabled} enabled;
|
|
29
|
+
: `${b.watchers.total} (${b.watchers.enabled} enabled; ` +
|
|
30
|
+
'task/goal and memory scans run only while Always-On is on)';
|
|
28
31
|
// `unknown` also means "present, but who wrote it is not recorded" (a Compass applied from a
|
|
29
32
|
// spec, say); only an unreadable one is listed under `unknown[]`. Printing "Compass unknown"
|
|
30
33
|
// beside an empty `unknown` list read like a failed read (OSK-22348).
|
|
@@ -49,4 +49,58 @@ export type CliInstallationDiagnosticsOptions = {
|
|
|
49
49
|
* unrecognised rather than trusted.
|
|
50
50
|
*/
|
|
51
51
|
export declare function inspectCliInstallations(options?: CliInstallationDiagnosticsOptions): CliInstallationDiagnostics;
|
|
52
|
+
/** A directory in a login shell's search order, and the file that listed it. */
|
|
53
|
+
export type LoginShellDirectory = {
|
|
54
|
+
dir: string;
|
|
55
|
+
/** `/etc/paths`, a file in `/etc/paths.d`, or `PATH` when it was inherited. */
|
|
56
|
+
listedBy: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The order a macOS login shell searches, given the PATH it inherited (OSK-23562).
|
|
60
|
+
*
|
|
61
|
+
* `/etc/profile` and `/etc/zprofile` run `path_helper -s`, which rebuilds PATH as
|
|
62
|
+
* the lines of `/etc/paths`, then each file in `/etc/paths.d` in name order, then
|
|
63
|
+
* the inherited entries it has not already listed. So `/opt/homebrew/bin` (from
|
|
64
|
+
* `/etc/paths.d/homebrew`) outranks `~/.local/bin` in every login shell, whatever
|
|
65
|
+
* order the PATH had. The daemon reads the same rule for `skrrd status`
|
|
66
|
+
* (`daemon/src/session-sky.ts`); a user's own profile is not modelled, because
|
|
67
|
+
* reading it means running it.
|
|
68
|
+
*/
|
|
69
|
+
export declare function macosLoginShellSearchPath(inheritedPath: string | undefined, etcDir?: string): LoginShellDirectory[];
|
|
70
|
+
export type CliShadow = {
|
|
71
|
+
/** `path`: the caller's own PATH. `login_shell`: a macOS login shell started from it. */
|
|
72
|
+
kind: 'path' | 'login_shell';
|
|
73
|
+
path: string;
|
|
74
|
+
version: string;
|
|
75
|
+
packageRoot: string;
|
|
76
|
+
/** For `login_shell`, the file that put this copy's directory first. */
|
|
77
|
+
listedBy: string | null;
|
|
78
|
+
message: string;
|
|
79
|
+
};
|
|
80
|
+
export type CliShadowOptions = {
|
|
81
|
+
/** The package root of the CLI this command runs from, which `skrr update` updates. */
|
|
82
|
+
activeRoot: string;
|
|
83
|
+
activeEntry?: string;
|
|
84
|
+
env?: NodeJS.ProcessEnv;
|
|
85
|
+
platform?: NodeJS.Platform;
|
|
86
|
+
/** Where `paths` and `paths.d` live; `/etc` outside tests. */
|
|
87
|
+
etcDir?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The version this update leaves in place, when the package on disk is not it
|
|
90
|
+
* yet: `performCliUpdate` hands the install to a worker, so `activeRoot` still
|
|
91
|
+
* holds the old version when it returns. Defaults to the version on disk.
|
|
92
|
+
*/
|
|
93
|
+
targetVersion?: string | null;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Other `skrr` installations that run instead of this one (OSK-23562).
|
|
97
|
+
*
|
|
98
|
+
* `skrr update --component cli` replaces the CLI it runs from. A second copy
|
|
99
|
+
* earlier on PATH keeps answering `skrr`, and on macOS a login shell can choose
|
|
100
|
+
* yet another: an agent harness that ran each command in `zsh -lc` got an
|
|
101
|
+
* npm-global 0.1.127 under Homebrew's node while this updater had just installed
|
|
102
|
+
* 0.1.209 in `~/.local`. Read-only, like `inspectCliInstallations`: no candidate is
|
|
103
|
+
* executed and no PATH is changed.
|
|
104
|
+
*/
|
|
105
|
+
export declare function inspectCliShadows(options: CliShadowOptions): CliShadow[];
|
|
52
106
|
export {};
|
|
@@ -34,8 +34,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.inspectCliInstallations = inspectCliInstallations;
|
|
37
|
+
exports.macosLoginShellSearchPath = macosLoginShellSearchPath;
|
|
38
|
+
exports.inspectCliShadows = inspectCliShadows;
|
|
37
39
|
const fs = __importStar(require("node:fs"));
|
|
38
40
|
const path = __importStar(require("node:path"));
|
|
41
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
39
42
|
const update_check_1 = require("./update-check");
|
|
40
43
|
const CLI_PACKAGE_NAME = '@skrr-ai/cli';
|
|
41
44
|
/**
|
|
@@ -103,10 +106,13 @@ function inspectCliInstallations(options = {}) {
|
|
|
103
106
|
}))
|
|
104
107
|
.sort(compareCandidates);
|
|
105
108
|
const active = rows.find((candidate) => candidate.active) ?? null;
|
|
106
|
-
const pathVersions = [
|
|
109
|
+
const pathVersions = [
|
|
110
|
+
...new Set(rows
|
|
107
111
|
.filter((candidate) => candidate.pathPrecedence !== null)
|
|
108
|
-
.sort((a, b) => (a.pathPrecedence ?? Number.MAX_SAFE_INTEGER) -
|
|
109
|
-
.
|
|
112
|
+
.sort((a, b) => (a.pathPrecedence ?? Number.MAX_SAFE_INTEGER) -
|
|
113
|
+
(b.pathPrecedence ?? Number.MAX_SAFE_INTEGER))
|
|
114
|
+
.map((candidate) => candidate.version)),
|
|
115
|
+
];
|
|
110
116
|
const hasVersionDrift = pathVersions.length > 1;
|
|
111
117
|
return {
|
|
112
118
|
active,
|
|
@@ -123,19 +129,20 @@ function addCandidate(candidates, packageInfo, location, env) {
|
|
|
123
129
|
const install = existing
|
|
124
130
|
? null
|
|
125
131
|
: (0, update_check_1.classifyCliInstall)(env, [process.execPath, location.path], null, false);
|
|
126
|
-
const candidate = existing ??
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
const candidate = existing ??
|
|
133
|
+
{
|
|
134
|
+
paths: new Set(),
|
|
135
|
+
realPath: location.realPath,
|
|
136
|
+
packageRoot: packageInfo.packageRoot,
|
|
137
|
+
version: packageInfo.version,
|
|
138
|
+
// Read-only classification: doctor never creates a write-probe just to
|
|
139
|
+
// identify an installation.
|
|
140
|
+
owner: install.kind,
|
|
141
|
+
updateCommand: (0, update_check_1.cliUpdateCommand)(install.kind, install.npmPrefix),
|
|
142
|
+
sources: new Set(),
|
|
143
|
+
pathPrecedence: location.pathPrecedence,
|
|
144
|
+
active: false,
|
|
145
|
+
};
|
|
139
146
|
if (!existing)
|
|
140
147
|
candidates.set(key, candidate);
|
|
141
148
|
candidate.paths.add(location.path);
|
|
@@ -152,7 +159,12 @@ function executableLocations(options) {
|
|
|
152
159
|
const names = options.platform === 'win32' ? ['skrr.exe', 'skrr.cmd'] : ['skrr'];
|
|
153
160
|
const locations = [];
|
|
154
161
|
if (options.activeEntry) {
|
|
155
|
-
locations.push({
|
|
162
|
+
locations.push({
|
|
163
|
+
path: options.activeEntry,
|
|
164
|
+
realPath: realPath(options.activeEntry),
|
|
165
|
+
source: 'active',
|
|
166
|
+
pathPrecedence: null,
|
|
167
|
+
});
|
|
156
168
|
}
|
|
157
169
|
const seenPath = new Set();
|
|
158
170
|
for (const [index, directory] of options.pathValue.split(path.delimiter).entries()) {
|
|
@@ -163,7 +175,12 @@ function executableLocations(options) {
|
|
|
163
175
|
if (!isExecutable(candidate, options.platform) || seenPath.has(candidate))
|
|
164
176
|
continue;
|
|
165
177
|
seenPath.add(candidate);
|
|
166
|
-
locations.push({
|
|
178
|
+
locations.push({
|
|
179
|
+
path: candidate,
|
|
180
|
+
realPath: realPath(candidate),
|
|
181
|
+
source: 'path',
|
|
182
|
+
pathPrecedence: index,
|
|
183
|
+
});
|
|
167
184
|
}
|
|
168
185
|
}
|
|
169
186
|
for (const candidate of options.wellKnownPaths) {
|
|
@@ -171,7 +188,12 @@ function executableLocations(options) {
|
|
|
171
188
|
if (!isExecutable(resolved, options.platform) || seenPath.has(resolved))
|
|
172
189
|
continue;
|
|
173
190
|
seenPath.add(resolved);
|
|
174
|
-
locations.push({
|
|
191
|
+
locations.push({
|
|
192
|
+
path: resolved,
|
|
193
|
+
realPath: realPath(resolved),
|
|
194
|
+
source: 'well_known',
|
|
195
|
+
pathPrecedence: null,
|
|
196
|
+
});
|
|
175
197
|
}
|
|
176
198
|
return locations;
|
|
177
199
|
}
|
|
@@ -244,7 +266,8 @@ function compareCandidates(a, b) {
|
|
|
244
266
|
function versionDriftRemedy(candidates, active) {
|
|
245
267
|
const pathCandidates = candidates
|
|
246
268
|
.filter((candidate) => candidate.pathPrecedence !== null)
|
|
247
|
-
.sort((a, b) => (a.pathPrecedence ?? Number.MAX_SAFE_INTEGER) -
|
|
269
|
+
.sort((a, b) => (a.pathPrecedence ?? Number.MAX_SAFE_INTEGER) -
|
|
270
|
+
(b.pathPrecedence ?? Number.MAX_SAFE_INTEGER));
|
|
248
271
|
const selected = pathCandidates[0] ?? active;
|
|
249
272
|
if (!selected)
|
|
250
273
|
return 'Inspect the skrr entries on PATH, update the intended installation, then re-run `skrr doctor`.';
|
|
@@ -252,3 +275,145 @@ function versionDriftRemedy(candidates, active) {
|
|
|
252
275
|
`\`${selected.updateCommand}\`, then remove or reorder the other skrr entries using their owning package manager. ` +
|
|
253
276
|
'No PATH changes were made. Verify with `skrr update --component cli --check` and `skrr doctor`.');
|
|
254
277
|
}
|
|
278
|
+
function listedDirectories(file) {
|
|
279
|
+
try {
|
|
280
|
+
return fs
|
|
281
|
+
.readFileSync(file, 'utf8')
|
|
282
|
+
.split('\n')
|
|
283
|
+
.map((line) => line.trim())
|
|
284
|
+
.filter(Boolean);
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
return [];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The order a macOS login shell searches, given the PATH it inherited (OSK-23562).
|
|
292
|
+
*
|
|
293
|
+
* `/etc/profile` and `/etc/zprofile` run `path_helper -s`, which rebuilds PATH as
|
|
294
|
+
* the lines of `/etc/paths`, then each file in `/etc/paths.d` in name order, then
|
|
295
|
+
* the inherited entries it has not already listed. So `/opt/homebrew/bin` (from
|
|
296
|
+
* `/etc/paths.d/homebrew`) outranks `~/.local/bin` in every login shell, whatever
|
|
297
|
+
* order the PATH had. The daemon reads the same rule for `skrrd status`
|
|
298
|
+
* (`daemon/src/session-sky.ts`); a user's own profile is not modelled, because
|
|
299
|
+
* reading it means running it.
|
|
300
|
+
*/
|
|
301
|
+
function macosLoginShellSearchPath(inheritedPath, etcDir = '/etc') {
|
|
302
|
+
const sources = [path.join(etcDir, 'paths')];
|
|
303
|
+
try {
|
|
304
|
+
const dropIns = path.join(etcDir, 'paths.d');
|
|
305
|
+
for (const name of fs.readdirSync(dropIns).sort())
|
|
306
|
+
sources.push(path.join(dropIns, name));
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
/* no drop-ins */
|
|
310
|
+
}
|
|
311
|
+
const out = [];
|
|
312
|
+
const seen = new Set();
|
|
313
|
+
const add = (dir, listedBy) => {
|
|
314
|
+
if (!dir || seen.has(dir))
|
|
315
|
+
return;
|
|
316
|
+
seen.add(dir);
|
|
317
|
+
out.push({ dir, listedBy });
|
|
318
|
+
};
|
|
319
|
+
for (const listedBy of sources) {
|
|
320
|
+
for (const dir of listedDirectories(listedBy))
|
|
321
|
+
add(dir, listedBy);
|
|
322
|
+
}
|
|
323
|
+
for (const dir of String(inheritedPath ?? '').split(':'))
|
|
324
|
+
add(dir, 'PATH');
|
|
325
|
+
return out;
|
|
326
|
+
}
|
|
327
|
+
function firstOnPath(diagnostics) {
|
|
328
|
+
return (diagnostics.candidates
|
|
329
|
+
.filter((candidate) => candidate.pathPrecedence !== null)
|
|
330
|
+
.sort((a, b) => (a.pathPrecedence ?? 0) - (b.pathPrecedence ?? 0))[0] ?? null);
|
|
331
|
+
}
|
|
332
|
+
const NPM_PREFIX_TAIL = path.join('lib', 'node_modules', '@skrr-ai', 'cli');
|
|
333
|
+
/**
|
|
334
|
+
* How to retire a shadowing copy. Retire, not pin: a second npm prefix updated to
|
|
335
|
+
* today's version is stale again at the next release, and removing it from its own
|
|
336
|
+
* prefix is what fixed the machine this was found on. Other owners keep their own
|
|
337
|
+
* update command, which never names an old version.
|
|
338
|
+
*/
|
|
339
|
+
function retireCommand(shadow) {
|
|
340
|
+
if (shadow.packageRoot.endsWith(`${path.sep}${NPM_PREFIX_TAIL}`)) {
|
|
341
|
+
const prefix = shadow.packageRoot.slice(0, -NPM_PREFIX_TAIL.length - 1);
|
|
342
|
+
const quoted = `'${prefix.replace(/'/g, "'\\''")}'`;
|
|
343
|
+
return `Remove it with \`npm uninstall --global --prefix ${quoted} ${CLI_PACKAGE_NAME}\`.`;
|
|
344
|
+
}
|
|
345
|
+
return `Remove it, or update it with \`${shadow.updateCommand}\`.`;
|
|
346
|
+
}
|
|
347
|
+
/** Only a copy known to be OLDER than the target is a problem; a newer one is not. */
|
|
348
|
+
function isOlder(version, target) {
|
|
349
|
+
return (0, auth_core_1.compareReleaseVersions)(version, target) === -1;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Other `skrr` installations that run instead of this one (OSK-23562).
|
|
353
|
+
*
|
|
354
|
+
* `skrr update --component cli` replaces the CLI it runs from. A second copy
|
|
355
|
+
* earlier on PATH keeps answering `skrr`, and on macOS a login shell can choose
|
|
356
|
+
* yet another: an agent harness that ran each command in `zsh -lc` got an
|
|
357
|
+
* npm-global 0.1.127 under Homebrew's node while this updater had just installed
|
|
358
|
+
* 0.1.209 in `~/.local`. Read-only, like `inspectCliInstallations`: no candidate is
|
|
359
|
+
* executed and no PATH is changed.
|
|
360
|
+
*/
|
|
361
|
+
function inspectCliShadows(options) {
|
|
362
|
+
const env = options.env ?? process.env;
|
|
363
|
+
const platform = options.platform ?? process.platform;
|
|
364
|
+
const base = {
|
|
365
|
+
activeRoot: options.activeRoot,
|
|
366
|
+
activeEntry: options.activeEntry,
|
|
367
|
+
platform,
|
|
368
|
+
wellKnownPaths: [],
|
|
369
|
+
};
|
|
370
|
+
const onPath = inspectCliInstallations({ ...base, env });
|
|
371
|
+
const active = onPath.active;
|
|
372
|
+
if (!active)
|
|
373
|
+
return [];
|
|
374
|
+
const target = options.targetVersion || active.version;
|
|
375
|
+
const activeLabel = `${active.paths[0] ?? active.packageRoot}, v${target}`;
|
|
376
|
+
const shadows = [];
|
|
377
|
+
const first = firstOnPath(onPath);
|
|
378
|
+
if (first && !first.active && isOlder(first.version, target)) {
|
|
379
|
+
shadows.push({
|
|
380
|
+
kind: 'path',
|
|
381
|
+
path: first.paths[0],
|
|
382
|
+
version: first.version,
|
|
383
|
+
packageRoot: first.packageRoot,
|
|
384
|
+
listedBy: null,
|
|
385
|
+
message: `${first.paths[0]} (v${first.version}) comes first on your PATH, so \`skrr\` runs it, not the ` +
|
|
386
|
+
`CLI this command updates (${activeLabel}). ${retireCommand(first)}`,
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
if (platform === 'darwin') {
|
|
390
|
+
const order = macosLoginShellSearchPath(env.PATH, options.etcDir);
|
|
391
|
+
const login = inspectCliInstallations({
|
|
392
|
+
...base,
|
|
393
|
+
env: { ...env, PATH: order.map((entry) => entry.dir).join(path.delimiter) },
|
|
394
|
+
});
|
|
395
|
+
const winner = firstOnPath(login);
|
|
396
|
+
if (winner &&
|
|
397
|
+
!winner.active &&
|
|
398
|
+
winner.packageRoot !== first?.packageRoot &&
|
|
399
|
+
isOlder(winner.version, target)) {
|
|
400
|
+
const listing = order[winner.pathPrecedence ?? -1];
|
|
401
|
+
const listedBy = listing && listing.listedBy !== 'PATH' ? listing.listedBy : null;
|
|
402
|
+
shadows.push({
|
|
403
|
+
kind: 'login_shell',
|
|
404
|
+
path: winner.paths[0],
|
|
405
|
+
version: winner.version,
|
|
406
|
+
packageRoot: winner.packageRoot,
|
|
407
|
+
listedBy,
|
|
408
|
+
message: `Login shells run ${winner.paths[0]} (v${winner.version}), not the CLI this command updates ` +
|
|
409
|
+
`(${activeLabel})` +
|
|
410
|
+
(listedBy
|
|
411
|
+
? `: macOS path_helper puts ${listing.dir} (listed in ${listedBy}) ahead of your PATH`
|
|
412
|
+
: '') +
|
|
413
|
+
'. Agent harnesses that run commands in a login shell (Codex runs `zsh -lc`) get that copy. ' +
|
|
414
|
+
retireCommand(winner),
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return shadows;
|
|
419
|
+
}
|
package/dist/lib/duties.d.ts
CHANGED
|
@@ -1150,6 +1150,16 @@ export declare function renderCheckList(checks: DutyCheckView[], log: (line: str
|
|
|
1150
1150
|
type ReadModelRecord = Record<string, unknown>;
|
|
1151
1151
|
/** Human view for `duties ledger`; JSON remains the automation surface. */
|
|
1152
1152
|
export declare function renderDutyLedger(ledger: ReadModelRecord, log: (line: string) => void): void;
|
|
1153
|
+
/**
|
|
1154
|
+
* Why a Run was started, on one line, from the server's `startedBecause` (OSK-20265): its text, then
|
|
1155
|
+
* whether it was derived, cut, or a retry. `null` when the server sent none (a server older than the
|
|
1156
|
+
* record): nothing is invented, and the Run's `reason`, its LATEST transition, is not a substitute.
|
|
1157
|
+
* Read defensively, because the ledger carries it untyped. `retryOfRunId` is derived on the server
|
|
1158
|
+
* without a lookup, so it is printed as a claim, `(not checked)`.
|
|
1159
|
+
*/
|
|
1160
|
+
export declare function describeRunStart(start: unknown): string | null;
|
|
1161
|
+
/** `run <id> started because: …` for every surface that lists Runs; `null` when the server did not say. */
|
|
1162
|
+
export declare function runStartLine(runId: unknown, start: unknown, noun?: 'run' | 'Run'): string | null;
|
|
1153
1163
|
export declare function renderDutyTrace(trace: ReadModelRecord, log: (line: string) => void): void;
|
|
1154
1164
|
export declare function renderProactivenessScorecard(scorecard: ReadModelRecord, log: (line: string) => void): void;
|
|
1155
1165
|
/** A run the server marks as held for its owner's result recovery review (OSK-24685). */
|
package/dist/lib/duties.js
CHANGED
|
@@ -43,6 +43,8 @@ exports.renderDutySummary = renderDutySummary;
|
|
|
43
43
|
exports.describeWakeDecision = describeWakeDecision;
|
|
44
44
|
exports.renderCheckList = renderCheckList;
|
|
45
45
|
exports.renderDutyLedger = renderDutyLedger;
|
|
46
|
+
exports.describeRunStart = describeRunStart;
|
|
47
|
+
exports.runStartLine = runStartLine;
|
|
46
48
|
exports.renderDutyTrace = renderDutyTrace;
|
|
47
49
|
exports.renderProactivenessScorecard = renderProactivenessScorecard;
|
|
48
50
|
exports.isHeldCycleRun = isHeldCycleRun;
|
|
@@ -1861,10 +1863,15 @@ function renderDutyLedger(ledger, log) {
|
|
|
1861
1863
|
{ key: 'attempt', header: 'ATTEMPT' },
|
|
1862
1864
|
{ key: 'turns', header: 'TURNS' },
|
|
1863
1865
|
{ key: 'tools', header: 'TOOLS' },
|
|
1864
|
-
|
|
1866
|
+
// A Run's `reason` is its LATEST transition (`daemon_session_response` once it has
|
|
1867
|
+
// finished), not why it started; that is the `started because` line below (OSK-20265).
|
|
1868
|
+
{ key: 'reason', header: 'LAST REASON', maxWidth: 36 },
|
|
1865
1869
|
{ key: 'finished', header: 'LAST UPDATED', maxWidth: 24 },
|
|
1866
1870
|
], 'No runs recorded.', log);
|
|
1867
1871
|
for (const run of runs) {
|
|
1872
|
+
const started = runStartLine(run.id, run.startedBecause, 'Run');
|
|
1873
|
+
if (started)
|
|
1874
|
+
log(started);
|
|
1868
1875
|
renderDutyResultContext(run.outcome, run.id, log);
|
|
1869
1876
|
}
|
|
1870
1877
|
}
|
|
@@ -1926,6 +1933,60 @@ function renderRunWait(waiting, runId, log) {
|
|
|
1926
1933
|
if (fix)
|
|
1927
1934
|
log(` Fix: ${fix}`);
|
|
1928
1935
|
}
|
|
1936
|
+
/**
|
|
1937
|
+
* What a reader is told about where a `startedBecause` answer came from (OSK-20265). Every basis the
|
|
1938
|
+
* server knows says so in its own text (`Derived from …`, `Not recorded: …`, `No start reason was
|
|
1939
|
+
* given …`, `… was removed when …`), so none adds a suffix, which would only repeat it. Typed by the
|
|
1940
|
+
* data-provider vocabulary, so a basis added there fails to compile here until it is decided.
|
|
1941
|
+
*/
|
|
1942
|
+
const RUN_START_BASIS_SUFFIX = {
|
|
1943
|
+
recorded: '',
|
|
1944
|
+
erased: '',
|
|
1945
|
+
not_given: '',
|
|
1946
|
+
derived_from_check: '',
|
|
1947
|
+
derived_from_run: '',
|
|
1948
|
+
};
|
|
1949
|
+
/** A basis this CLI does not know yet is named by its code rather than passed off as recorded. */
|
|
1950
|
+
function runStartBasisSuffix(basis) {
|
|
1951
|
+
if (data_provider_2.DUTY_RUN_START_BASES.includes(basis)) {
|
|
1952
|
+
return RUN_START_BASIS_SUFFIX[basis];
|
|
1953
|
+
}
|
|
1954
|
+
return typeof basis === 'string' && basis ? ` (basis: ${basis})` : '';
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Why a Run was started, on one line, from the server's `startedBecause` (OSK-20265): its text, then
|
|
1958
|
+
* whether it was derived, cut, or a retry. `null` when the server sent none (a server older than the
|
|
1959
|
+
* record): nothing is invented, and the Run's `reason`, its LATEST transition, is not a substitute.
|
|
1960
|
+
* Read defensively, because the ledger carries it untyped. `retryOfRunId` is derived on the server
|
|
1961
|
+
* without a lookup, so it is printed as a claim, `(not checked)`.
|
|
1962
|
+
*/
|
|
1963
|
+
function describeRunStart(start) {
|
|
1964
|
+
const value = record(start);
|
|
1965
|
+
if (!value || typeof value.text !== 'string')
|
|
1966
|
+
return null;
|
|
1967
|
+
const why = (0, format_1.collapseWhitespace)(value.text);
|
|
1968
|
+
if (!why)
|
|
1969
|
+
return null;
|
|
1970
|
+
const basisSuffix = runStartBasisSuffix(value.basis);
|
|
1971
|
+
// A cut record is stored at its bound (1,000), so its own length says what was kept without a
|
|
1972
|
+
// second copy of the limit here.
|
|
1973
|
+
const original = value.originalLength;
|
|
1974
|
+
const of = typeof original === 'number' && Number.isSafeInteger(original) && original > 0
|
|
1975
|
+
? ` of ${original.toLocaleString('en-US')}`
|
|
1976
|
+
: '';
|
|
1977
|
+
const cut = value.truncated === true
|
|
1978
|
+
? ` [cut to ${value.text.length.toLocaleString('en-US')}${of} characters]`
|
|
1979
|
+
: '';
|
|
1980
|
+
const retryOf = typeof value.retryOfRunId === 'string' && value.retryOfRunId.trim()
|
|
1981
|
+
? ` — retry of run ${value.retryOfRunId.trim()} (not checked)`
|
|
1982
|
+
: '';
|
|
1983
|
+
return `${why}${basisSuffix}${cut}${retryOf}`;
|
|
1984
|
+
}
|
|
1985
|
+
/** `run <id> started because: …` for every surface that lists Runs; `null` when the server did not say. */
|
|
1986
|
+
function runStartLine(runId, start, noun = 'run') {
|
|
1987
|
+
const why = describeRunStart(start);
|
|
1988
|
+
return why ? `${noun} ${text(runId)} started because: ${why}` : null;
|
|
1989
|
+
}
|
|
1929
1990
|
function renderDutyTrace(trace, log) {
|
|
1930
1991
|
const events = records(trace.events);
|
|
1931
1992
|
renderRows(events.map((item) => ({
|
|
@@ -2063,6 +2124,9 @@ const CYCLE_GLYPH = {
|
|
|
2063
2124
|
// An applied result whose agent said work is warranted and left nothing the platform can see
|
|
2064
2125
|
// (OSK-21608): not a tick, because the work is still owed, and not a stop, because it applied.
|
|
2065
2126
|
owed: '◐',
|
|
2127
|
+
// An applied result whose workspace result never arrived (OSK-20281): not a tick either, because
|
|
2128
|
+
// nobody saw what the Run did to the files.
|
|
2129
|
+
workspaceUnknown: '◇',
|
|
2066
2130
|
};
|
|
2067
2131
|
/** The scheduler instant in UTC; `-` when the time is unknown. */
|
|
2068
2132
|
function cycleTime(value) {
|
|
@@ -2101,6 +2165,11 @@ function cycleSummary(cycle) {
|
|
|
2101
2165
|
? `${cycle.advancementKinds.join(', ')} — ${data_provider_2.DUTY_CYCLE_OWED_SENTENCE}`
|
|
2102
2166
|
: data_provider_2.DUTY_CYCLE_OWED_SENTENCE;
|
|
2103
2167
|
}
|
|
2168
|
+
if (cycle.workspaceUnknown) {
|
|
2169
|
+
return cycle.advancementKinds?.length
|
|
2170
|
+
? `${cycle.advancementKinds.join(', ')} — ${data_provider_2.DUTY_CYCLE_WORKSPACE_UNKNOWN_SENTENCE}`
|
|
2171
|
+
: data_provider_2.DUTY_CYCLE_WORKSPACE_UNKNOWN_SENTENCE;
|
|
2172
|
+
}
|
|
2104
2173
|
return cycle.advancementKinds?.length
|
|
2105
2174
|
? cycle.advancementKinds.join(', ')
|
|
2106
2175
|
: 'applied an agent result';
|
|
@@ -2193,14 +2262,23 @@ function formatDutyCycles(page) {
|
|
|
2193
2262
|
// `✓ advanced` above a stopped Run reads as if the work had moved (OSK-21240).
|
|
2194
2263
|
const echo = (0, data_provider_2.isRecordOnlyEchoCycle)(cycle);
|
|
2195
2264
|
const owed = !echo && cycle.outcome === 'advanced' && cycle.owed === true;
|
|
2265
|
+
const workspaceUnknown = !echo && !owed && cycle.outcome === 'advanced' && cycle.workspaceUnknown === true;
|
|
2196
2266
|
const glyph = echo
|
|
2197
2267
|
? CYCLE_GLYPH.quiet
|
|
2198
2268
|
: owed
|
|
2199
2269
|
? CYCLE_GLYPH.owed
|
|
2200
|
-
:
|
|
2270
|
+
: workspaceUnknown
|
|
2271
|
+
? CYCLE_GLYPH.workspaceUnknown
|
|
2272
|
+
: CYCLE_GLYPH[cycle.outcome] || '?';
|
|
2201
2273
|
const wakeSaved = isRecordedDutyWake(cycle);
|
|
2202
2274
|
const outcomeWord = cycle.confirmedDelivery ? 'delivered' : String(cycle.outcome);
|
|
2203
|
-
const word = echo || wakeSaved
|
|
2275
|
+
const word = echo || wakeSaved
|
|
2276
|
+
? 'recorded'
|
|
2277
|
+
: owed
|
|
2278
|
+
? 'owed'
|
|
2279
|
+
: workspaceUnknown && !cycle.confirmedDelivery
|
|
2280
|
+
? 'unknown'
|
|
2281
|
+
: outcomeWord;
|
|
2204
2282
|
lines.push(`${cycleTime(cycle.startedAt)} ${glyph} ${word.padEnd(9)} ${cycleWake(cycle).padEnd(18)} ${echo ? recordOnlyEchoSummary(cycle) : cycleSummary(cycle)}`);
|
|
2205
2283
|
if (cycle.confirmedDelivery?.verification) {
|
|
2206
2284
|
lines.push(` ${cycle.confirmedDelivery.verification}`);
|
|
@@ -2225,6 +2303,9 @@ function formatDutyCycles(page) {
|
|
|
2225
2303
|
lines.push(` task ${task.identifier || task.id} ${task.status || '-'} — ${label}`);
|
|
2226
2304
|
}
|
|
2227
2305
|
for (const run of cycle.runs || []) {
|
|
2306
|
+
const started = runStartLine(run.id, run.startedBecause);
|
|
2307
|
+
if (started)
|
|
2308
|
+
lines.push(` ${started}`);
|
|
2228
2309
|
if (run.decision) {
|
|
2229
2310
|
const label = run.decision === 'action_warranted' ? 'Action warranted' : 'No action warranted';
|
|
2230
2311
|
lines.push(` run ${run.id} ${label}${run.decisionSummary ? ` — ${run.decisionSummary}` : ''}`);
|
|
@@ -2346,6 +2427,9 @@ function formatDutyExplanation(explanation) {
|
|
|
2346
2427
|
if (cycle) {
|
|
2347
2428
|
lines.push(...platformFetchLines(cycle));
|
|
2348
2429
|
for (const run of cycle.runs || []) {
|
|
2430
|
+
const started = runStartLine(run.id, run.startedBecause);
|
|
2431
|
+
if (started)
|
|
2432
|
+
lines.push(` ${started}`);
|
|
2349
2433
|
if (run.reportPayload)
|
|
2350
2434
|
lines.push(` run ${run.id} report: ${run.reportPayload.status === 'rejected' ? 'structured report rejected; plain summary used' : 'structured report validated (delivery tracked separately)'}`);
|
|
2351
2435
|
for (const line of hypothesisRefusalLines(run))
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import type { PlatformUpdateDependencies } from './platform-update';
|
|
1
|
+
import type { PlatformUpdateDependencies, PlatformUpdateOptions } from './platform-update';
|
|
2
|
+
/**
|
|
3
|
+
* The `skrr` copies that run instead of the one a CLI update replaces (OSK-23562).
|
|
4
|
+
* A diagnostic, so it never fails the update it rides on.
|
|
5
|
+
*/
|
|
6
|
+
export declare function cliShadowWarnings(options: PlatformUpdateOptions, status: {
|
|
7
|
+
state?: string;
|
|
8
|
+
installedVersion?: string | null;
|
|
9
|
+
offeredVersion?: string | null;
|
|
10
|
+
}): string[];
|
|
2
11
|
export declare const localPlatformUpdateDependencies: PlatformUpdateDependencies;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.localPlatformUpdateDependencies = void 0;
|
|
4
|
+
exports.cliShadowWarnings = cliShadowWarnings;
|
|
4
5
|
const update_check_1 = require("./update-check");
|
|
5
6
|
const first_party_harness_update_1 = require("./first-party-harness-update");
|
|
6
7
|
const exec_runtime_binary_1 = require("./exec-runtime-binary");
|
|
8
|
+
const cli_installation_diagnostics_1 = require("./cli-installation-diagnostics");
|
|
7
9
|
const DAEMON_STATUS_RE = /^v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)$/;
|
|
8
10
|
function parseDaemonStatus(stdout) {
|
|
9
11
|
let parsed;
|
|
@@ -85,6 +87,28 @@ async function updateDaemon(mode, options) {
|
|
|
85
87
|
},
|
|
86
88
|
};
|
|
87
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The `skrr` copies that run instead of the one a CLI update replaces (OSK-23562).
|
|
92
|
+
* A diagnostic, so it never fails the update it rides on.
|
|
93
|
+
*/
|
|
94
|
+
function cliShadowWarnings(options, status) {
|
|
95
|
+
if (!options.cliRoot)
|
|
96
|
+
return [];
|
|
97
|
+
// An apply that handed the install to a worker returns before the package on
|
|
98
|
+
// disk changes, so the version to compare a shadow with is the one on its way.
|
|
99
|
+
const installing = options.mode === 'apply' && (status.state === 'pending' || status.state === 'restart-pending');
|
|
100
|
+
const targetVersion = (installing ? status.offeredVersion : null) ?? status.installedVersion;
|
|
101
|
+
try {
|
|
102
|
+
return (0, cli_installation_diagnostics_1.inspectCliShadows)({
|
|
103
|
+
activeRoot: options.cliRoot,
|
|
104
|
+
env: options.env,
|
|
105
|
+
targetVersion,
|
|
106
|
+
}).map((shadow) => shadow.message);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
88
112
|
exports.localPlatformUpdateDependencies = {
|
|
89
113
|
async cli(mode, options) {
|
|
90
114
|
const args = {
|
|
@@ -92,11 +116,15 @@ exports.localPlatformUpdateDependencies = {
|
|
|
92
116
|
baseURL: options.baseURL,
|
|
93
117
|
env: options.env,
|
|
94
118
|
};
|
|
119
|
+
let status;
|
|
95
120
|
if (mode === 'status')
|
|
96
|
-
|
|
97
|
-
if (mode === 'check')
|
|
98
|
-
|
|
99
|
-
|
|
121
|
+
status = (0, update_check_1.readCliUpdateStatus)(args);
|
|
122
|
+
else if (mode === 'check')
|
|
123
|
+
status = await (0, update_check_1.checkCliUpdate)({ ...args, force: true });
|
|
124
|
+
else
|
|
125
|
+
status = await (0, update_check_1.performCliUpdate)(args);
|
|
126
|
+
const warnings = cliShadowWarnings({ ...options, mode }, status);
|
|
127
|
+
return warnings.length > 0 ? { ...status, warnings } : status;
|
|
100
128
|
},
|
|
101
129
|
async code(mode, options) {
|
|
102
130
|
if (mode === 'status')
|
|
@@ -13,6 +13,8 @@ export interface ComponentUpdateStatus {
|
|
|
13
13
|
autoUpdateEnabled: boolean | null;
|
|
14
14
|
lastAttempt: unknown | null;
|
|
15
15
|
detail: string | null;
|
|
16
|
+
/** Facts the person should act on that do not change `state`, such as a shadowing `skrr`. */
|
|
17
|
+
warnings: string[];
|
|
16
18
|
/** The component's full status is retained for machine-readable diagnostics. */
|
|
17
19
|
status: Record<string, unknown>;
|
|
18
20
|
}
|
|
@@ -23,6 +25,8 @@ export interface PlatformUpdateOptions {
|
|
|
23
25
|
baseURL: string;
|
|
24
26
|
restart?: boolean;
|
|
25
27
|
env?: NodeJS.ProcessEnv;
|
|
28
|
+
/** The package root of the running CLI (oclif's `config.root`), which a CLI update replaces. */
|
|
29
|
+
cliRoot?: string;
|
|
26
30
|
}
|
|
27
31
|
export interface PlatformUpdateDependencies {
|
|
28
32
|
cli(mode: UpdateMode, options: PlatformUpdateOptions): Promise<unknown>;
|
|
@@ -32,6 +32,9 @@ function normalizeComponentUpdateStatus(component, value) {
|
|
|
32
32
|
: null,
|
|
33
33
|
lastAttempt: raw.lastAttempt ?? raw.transaction ?? null,
|
|
34
34
|
detail: optionalString(raw.detail) ?? optionalString(raw.message),
|
|
35
|
+
warnings: Array.isArray(raw.warnings)
|
|
36
|
+
? raw.warnings.filter((item) => typeof item === 'string' && item.length > 0)
|
|
37
|
+
: [],
|
|
35
38
|
status: raw,
|
|
36
39
|
};
|
|
37
40
|
}
|
|
@@ -79,6 +82,7 @@ function describeComponentUpdate(status) {
|
|
|
79
82
|
`${status.component}: ${status.state} (${status.owner})`,
|
|
80
83
|
` ${versions}`,
|
|
81
84
|
...(status.detail ? [` ${status.detail}`] : []),
|
|
85
|
+
...status.warnings.map((warning) => ` Warning: ${warning}`),
|
|
82
86
|
...status.commands.map((command) => ` ${command}`),
|
|
83
87
|
].join('\n');
|
|
84
88
|
}
|
|
@@ -42,6 +42,15 @@ export declare function looksLikeSpaceId(value: string): boolean;
|
|
|
42
42
|
* their canonical id first.
|
|
43
43
|
*/
|
|
44
44
|
export declare function looksLikeCanonicalSpaceId(value: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The spelling to send for a value already recognised as a Space UUID: trimmed and lowercased.
|
|
47
|
+
*
|
|
48
|
+
* Every Space id is minted in lowercase, and the server judges a `spaceId` exactly as sent, refusing
|
|
49
|
+
* one in capitals with `SPACE_ID_INVALID` (OSK-33347). A UUID copied from a tool that prints capitals
|
|
50
|
+
* is still that Space's id, so the CLI sends the one spelling that can name it, as it already sends
|
|
51
|
+
* the id trimmed. Anything that is not UUID-shaped is returned trimmed and otherwise untouched.
|
|
52
|
+
*/
|
|
53
|
+
export declare function canonicalSpaceIdSpelling(value: string): string;
|
|
45
54
|
/** Normalize a space ref to the casing the server matches (`osk-s-3` → `OSK-S-3`). */
|
|
46
55
|
export declare function normalizeSpaceRef(value: string): string;
|
|
47
56
|
/** Map a raw space document from the API onto the shape we match against. */
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SPACE_CLI_ERROR_CODE = void 0;
|
|
4
4
|
exports.looksLikeSpaceId = looksLikeSpaceId;
|
|
5
5
|
exports.looksLikeCanonicalSpaceId = looksLikeCanonicalSpaceId;
|
|
6
|
+
exports.canonicalSpaceIdSpelling = canonicalSpaceIdSpelling;
|
|
6
7
|
exports.normalizeSpaceRef = normalizeSpaceRef;
|
|
7
8
|
exports.spaceRefFrom = spaceRefFrom;
|
|
8
9
|
exports.resolveSpaceRef = resolveSpaceRef;
|
|
@@ -65,6 +66,18 @@ function looksLikeCanonicalSpaceId(value) {
|
|
|
65
66
|
const v = value.trim();
|
|
66
67
|
return UUID_RE.test(v) || OBJECT_ID_RE.test(v);
|
|
67
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* The spelling to send for a value already recognised as a Space UUID: trimmed and lowercased.
|
|
71
|
+
*
|
|
72
|
+
* Every Space id is minted in lowercase, and the server judges a `spaceId` exactly as sent, refusing
|
|
73
|
+
* one in capitals with `SPACE_ID_INVALID` (OSK-33347). A UUID copied from a tool that prints capitals
|
|
74
|
+
* is still that Space's id, so the CLI sends the one spelling that can name it, as it already sends
|
|
75
|
+
* the id trimmed. Anything that is not UUID-shaped is returned trimmed and otherwise untouched.
|
|
76
|
+
*/
|
|
77
|
+
function canonicalSpaceIdSpelling(value) {
|
|
78
|
+
const v = value.trim();
|
|
79
|
+
return UUID_RE.test(v) ? v.toLowerCase() : v;
|
|
80
|
+
}
|
|
68
81
|
/** Normalize a space ref to the casing the server matches (`osk-s-3` → `OSK-S-3`). */
|
|
69
82
|
function normalizeSpaceRef(value) {
|
|
70
83
|
const v = value.trim();
|