@skrr-ai/cli 0.1.155 → 0.1.158
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 +64 -16
- package/dist/commands/activity/list.d.ts +13 -0
- package/dist/commands/activity/list.js +50 -0
- package/dist/commands/activity/scan-older.d.ts +23 -0
- package/dist/commands/activity/scan-older.js +74 -0
- package/dist/commands/activity/show.d.ts +27 -0
- package/dist/commands/activity/show.js +228 -0
- package/dist/commands/agent/message/send.js +64 -19
- package/dist/commands/agents/always-on/held-messages.js +24 -1
- package/dist/commands/agents/always-on/status.js +6 -1
- package/dist/commands/agents/mini-computer/app/reset.d.ts +13 -0
- package/dist/commands/agents/mini-computer/app/reset.js +35 -0
- package/dist/commands/agents/mini-computer/app/set.d.ts +16 -0
- package/dist/commands/agents/mini-computer/app/set.js +70 -0
- package/dist/commands/agents/mini-computer/layout/change.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/change.js +44 -0
- package/dist/commands/agents/mini-computer/layout/folder.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/folder.js +35 -0
- package/dist/commands/agents/mini-computer/layout/move.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/move.js +32 -0
- package/dist/commands/agents/mini-computer/layout/pin.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/pin.js +35 -0
- package/dist/commands/agents/mini-computer/layout/remove.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/remove.js +27 -0
- package/dist/commands/agents/mini-computer/layout/restore.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/restore.js +27 -0
- package/dist/commands/agents/mini-computer/layout/unfolder.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/unfolder.js +27 -0
- package/dist/commands/agents/mini-computer/layout/unpin.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/unpin.js +34 -0
- package/dist/commands/agents/mini-computer/show.d.ts +13 -0
- package/dist/commands/agents/mini-computer/show.js +60 -0
- package/dist/commands/agents/mini-computer/tasks-view.d.ts +29 -0
- package/dist/commands/agents/mini-computer/tasks-view.js +100 -0
- package/dist/commands/apps/auto-apply.d.ts +14 -0
- package/dist/commands/apps/auto-apply.js +53 -0
- package/dist/commands/apps/check.js +4 -1
- package/dist/commands/apps/create.js +11 -6
- package/dist/commands/apps/data/batch.d.ts +15 -0
- package/dist/commands/apps/data/batch.js +59 -0
- package/dist/commands/apps/data/collections.d.ts +12 -0
- package/dist/commands/apps/data/collections.js +44 -0
- package/dist/commands/apps/data/delete.d.ts +15 -0
- package/dist/commands/apps/data/delete.js +57 -0
- package/dist/commands/apps/data/patch.d.ts +17 -0
- package/dist/commands/apps/data/patch.js +70 -0
- package/dist/commands/apps/data/put.js +1 -1
- package/dist/commands/apps/data/query.js +1 -1
- package/dist/commands/apps/installations/diff.d.ts +14 -0
- package/dist/commands/apps/installations/diff.js +45 -0
- package/dist/commands/apps/installations/events.d.ts +23 -0
- package/dist/commands/apps/installations/events.js +104 -0
- package/dist/commands/apps/installations/snapshot.d.ts +18 -0
- package/dist/commands/apps/installations/snapshot.js +60 -0
- package/dist/commands/apps/installations/versions.d.ts +12 -0
- package/dist/commands/apps/installations/versions.js +38 -0
- package/dist/commands/apps/logs.js +3 -0
- package/dist/commands/apps/preview.js +4 -2
- package/dist/commands/apps/pull.js +10 -1
- package/dist/commands/apps/push.js +36 -12
- package/dist/commands/apps/reference.d.ts +26 -0
- package/dist/commands/apps/reference.js +56 -0
- package/dist/commands/apps/rollback.d.ts +13 -0
- package/dist/commands/apps/rollback.js +47 -0
- package/dist/commands/apps/version/create.js +5 -0
- package/dist/commands/duties/accounting.js +6 -0
- package/dist/commands/duties/analytics/detail.js +6 -0
- package/dist/commands/duties/analytics/index.js +14 -0
- package/dist/commands/duties/analytics/replay.js +6 -0
- package/dist/commands/duties/cost.js +6 -0
- package/dist/commands/duties/delete.js +22 -19
- package/dist/commands/duties/doctor.d.ts +2 -1
- package/dist/commands/duties/doctor.js +17 -3
- package/dist/commands/duties/goals/link.js +4 -0
- package/dist/commands/duties/goals/unlink.js +4 -0
- package/dist/commands/duties/lineage.js +6 -1
- package/dist/commands/duties/links/list.js +6 -0
- package/dist/commands/duties/metrics.js +10 -0
- package/dist/commands/duties/observations.js +12 -0
- package/dist/commands/duties/operating-review.d.ts +4 -30
- package/dist/commands/duties/operating-review.js +28 -141
- package/dist/commands/duties/receipt-metrics.js +7 -0
- package/dist/commands/duties/receipt.js +7 -0
- package/dist/commands/duties/roster.js +14 -8
- package/dist/commands/duties/show.js +27 -9
- package/dist/commands/duties/status.js +18 -9
- package/dist/commands/duties/trigger-status.d.ts +2 -0
- package/dist/commands/duties/trigger-status.js +19 -1
- package/dist/commands/duties/wake-capabilities.d.ts +2 -0
- package/dist/commands/duties/wake-capabilities.js +32 -2
- package/dist/commands/followups/act.js +3 -0
- package/dist/commands/followups/remind.js +12 -3
- package/dist/commands/followups/show.js +6 -0
- package/dist/commands/harnesses/quota.js +1 -1
- package/dist/commands/spaces/notebook.d.ts +3 -7
- package/dist/commands/spaces/notebook.js +32 -8
- package/dist/commands/tasks/create.d.ts +2 -2
- package/dist/commands/tasks/create.js +3 -3
- package/dist/commands/tasks/list.d.ts +3 -41
- package/dist/commands/tasks/list.js +5 -53
- package/dist/generated/agent-guides.json +424 -101
- package/dist/generated/managed-instruction-guides.json +1 -1
- package/dist/lib/agent-activity.d.ts +153 -0
- package/dist/lib/agent-activity.js +241 -0
- package/dist/lib/always-on-runtime.d.ts +9 -0
- package/dist/lib/always-on-runtime.js +20 -0
- package/dist/lib/api-fetch.d.ts +10 -0
- package/dist/lib/api-fetch.js +12 -2
- package/dist/lib/appData.d.ts +28 -1
- package/dist/lib/appData.js +111 -9
- package/dist/lib/appInstallations.d.ts +9 -1
- package/dist/lib/appInstallations.js +100 -0
- package/dist/lib/apps-command.d.ts +1 -0
- package/dist/lib/apps-command.js +11 -0
- package/dist/lib/apps.d.ts +12 -0
- package/dist/lib/apps.js +28 -1
- package/dist/lib/appsAssets.d.ts +17 -0
- package/dist/lib/appsAssets.js +15 -0
- package/dist/lib/appsCheck.d.ts +1 -0
- package/dist/lib/appsCheck.js +1 -0
- package/dist/lib/appsFs.d.ts +18 -1
- package/dist/lib/appsFs.js +76 -19
- package/dist/lib/compasses.js +6 -0
- package/dist/lib/duties.d.ts +25 -2
- package/dist/lib/duties.js +58 -3
- package/dist/lib/duty-analytics.d.ts +2 -0
- package/dist/lib/duty-analytics.js +26 -0
- package/dist/lib/duty-goal-propagation.d.ts +2 -0
- package/dist/lib/duty-goal-propagation.js +18 -0
- package/dist/lib/duty-history-source.d.ts +4 -0
- package/dist/lib/duty-history-source.js +12 -0
- package/dist/lib/duty-ledgers.d.ts +4 -0
- package/dist/lib/duty-ledgers.js +4 -0
- package/dist/lib/duty-receipt-source.d.ts +4 -0
- package/dist/lib/duty-receipt-source.js +19 -0
- package/dist/lib/followups.d.ts +20 -0
- package/dist/lib/followups.js +10 -0
- package/dist/lib/held-messages.d.ts +22 -0
- package/dist/lib/held-messages.js +55 -0
- package/dist/lib/list-workspace.d.ts +40 -0
- package/dist/lib/list-workspace.js +58 -0
- package/dist/lib/miniComputer.d.ts +59 -0
- package/dist/lib/miniComputer.js +224 -0
- package/dist/lib/miniComputerCommand.d.ts +13 -0
- package/dist/lib/miniComputerCommand.js +48 -0
- package/dist/lib/roles.d.ts +3 -3
- package/dist/lib/space-notebook.js +15 -4
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10465 -8383
- package/oclif.manifest.json +2849 -462
- package/package.json +14 -2
package/dist/lib/appsFs.js
CHANGED
|
@@ -34,7 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.APPS_FS_FLAGS = exports.APPS_FS_FILE_MAX_BYTES = exports.AppsFsError = void 0;
|
|
37
|
+
exports.isBinaryAssetPath = isBinaryAssetPath;
|
|
37
38
|
exports.readRegularTextFile = readRegularTextFile;
|
|
39
|
+
exports.readRegularBytes = readRegularBytes;
|
|
38
40
|
exports.readPackageDir = readPackageDir;
|
|
39
41
|
exports.remoteTreeProblems = remoteTreeProblems;
|
|
40
42
|
exports.writePackageDir = writePackageDir;
|
|
@@ -64,8 +66,10 @@ exports.readStdinText = readStdinText;
|
|
|
64
66
|
* hang forever or return forever).
|
|
65
67
|
* - Sizes are checked from the metadata BEFORE a byte is read, then again on what was read.
|
|
66
68
|
* - Bytes are decoded as strict UTF-8 and kept exactly (`ignoreBOM`), because a version's hash is over
|
|
67
|
-
* the bytes. A file that is not text is refused here
|
|
68
|
-
*
|
|
69
|
+
* the bytes. A file that is not text is refused here, EXCEPT an image or a font the platform serves
|
|
70
|
+
* (png, jpg, jpeg, webp, gif, woff2): those are read as bytes, under every rule above, at most 256 KiB, and
|
|
71
|
+
* kept as bytes with the digest the draft will name them by (a lossy decode would store something other than
|
|
72
|
+
* what the person has).
|
|
69
73
|
* - What the SERVER sends back (a pull) is as untrusted as a cloned repository: every path is judged
|
|
70
74
|
* by the contract's grammar again, the whole set is judged for collisions, and nothing is written
|
|
71
75
|
* until all of it is acceptable. Directories are made one component at a time, each looked at with
|
|
@@ -78,6 +82,7 @@ exports.readStdinText = readStdinText;
|
|
|
78
82
|
* concurrent attacker on one's own machine. On Windows `O_NOFOLLOW` does not exist, and the `lstat` checks
|
|
79
83
|
* are what is left.
|
|
80
84
|
*/
|
|
85
|
+
const node_crypto_1 = require("node:crypto");
|
|
81
86
|
const fs = __importStar(require("node:fs"));
|
|
82
87
|
const path = __importStar(require("node:path"));
|
|
83
88
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
@@ -99,6 +104,14 @@ const O_NOFOLLOW = fs.constants.O_NOFOLLOW ?? 0;
|
|
|
99
104
|
const O_DIRECTORY = fs.constants.O_DIRECTORY ?? 0;
|
|
100
105
|
/** Directories that are never part of a package and are walked past, not into. */
|
|
101
106
|
const SKIPPED_DIRECTORIES = new Set(['node_modules']);
|
|
107
|
+
/**
|
|
108
|
+
* Is `relative` an image or a font that is BYTES (a PNG, JPEG, WebP, GIF or WOFF2)? Those are read and written as bytes; an SVG
|
|
109
|
+
* is text and goes with the text files.
|
|
110
|
+
*/
|
|
111
|
+
function isBinaryAssetPath(relative) {
|
|
112
|
+
const type = (0, data_provider_1.appFrameFileTypeOf)(relative);
|
|
113
|
+
return (type !== null && type.kind !== 'module' && type.bytes !== undefined && type.bytes !== 'svg');
|
|
114
|
+
}
|
|
102
115
|
function describeLink(absolute) {
|
|
103
116
|
try {
|
|
104
117
|
return ` (it points at ${fs.readlinkSync(absolute)})`;
|
|
@@ -128,6 +141,23 @@ function errorText(error) {
|
|
|
128
141
|
* Returns its text. `label` is what the file is called in a message.
|
|
129
142
|
*/
|
|
130
143
|
function readRegularTextFile(absolute, label, hooks = {}) {
|
|
144
|
+
const buffer = readRegularBytes(absolute, label, hooks, {
|
|
145
|
+
maxBytes: exports.APPS_FS_FILE_MAX_BYTES,
|
|
146
|
+
tooLarge: (size) => `${label} is ${size} bytes; a text file of at most ${data_provider_1.APP_DRAFT_LIMITS.fileMaxChars} characters is at most ${exports.APPS_FS_FILE_MAX_BYTES}.`,
|
|
147
|
+
});
|
|
148
|
+
try {
|
|
149
|
+
// `ignoreBOM: true` keeps a leading BOM as a character, so the text encodes back to the same bytes.
|
|
150
|
+
return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(buffer);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
throw new AppsFsError('not_text', label, `${label} is not UTF-8 text: a draft holds text files, and this one would be stored as something other than what is on disk.`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Read ONE regular file's bytes under every rule of the file comment (no link followed, `O_NOFOLLOW`, the thing opened is the
|
|
158
|
+
* thing looked at, a size checked before a byte is read and again after). `options.tooLarge` words the refusal for the caller.
|
|
159
|
+
*/
|
|
160
|
+
function readRegularBytes(absolute, label, hooks, options) {
|
|
131
161
|
const before = lstatOrNull(absolute);
|
|
132
162
|
if (!before) {
|
|
133
163
|
throw new AppsFsError('unreadable', label, `${label} does not exist.`);
|
|
@@ -138,8 +168,8 @@ function readRegularTextFile(absolute, label, hooks = {}) {
|
|
|
138
168
|
if (!before.isFile()) {
|
|
139
169
|
throw new AppsFsError('not_regular', label, `${label} is not a regular file.`);
|
|
140
170
|
}
|
|
141
|
-
if (before.size >
|
|
142
|
-
throw new AppsFsError('too_large', label,
|
|
171
|
+
if (before.size > options.maxBytes) {
|
|
172
|
+
throw new AppsFsError('too_large', label, options.tooLarge(before.size));
|
|
143
173
|
}
|
|
144
174
|
hooks.betweenLookAndOpen?.();
|
|
145
175
|
let fd;
|
|
@@ -165,7 +195,7 @@ function readRegularTextFile(absolute, label, hooks = {}) {
|
|
|
165
195
|
(opened.ino !== before.ino || opened.dev !== before.dev)) {
|
|
166
196
|
throw new AppsFsError('symlink', label, `${label} was replaced while it was being read.`);
|
|
167
197
|
}
|
|
168
|
-
if (opened.size >
|
|
198
|
+
if (opened.size > options.maxBytes) {
|
|
169
199
|
throw new AppsFsError('too_large', label, `${label} is larger than a package file may be.`);
|
|
170
200
|
}
|
|
171
201
|
const buffer = Buffer.alloc(opened.size);
|
|
@@ -176,13 +206,7 @@ function readRegularTextFile(absolute, label, hooks = {}) {
|
|
|
176
206
|
break;
|
|
177
207
|
read += n;
|
|
178
208
|
}
|
|
179
|
-
|
|
180
|
-
// `ignoreBOM: true` keeps a leading BOM as a character, so the text encodes back to the same bytes.
|
|
181
|
-
return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(buffer.subarray(0, read));
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
throw new AppsFsError('not_text', label, `${label} is not UTF-8 text: a draft holds text files, and this one would be stored as something other than what is on disk.`);
|
|
185
|
-
}
|
|
209
|
+
return buffer.subarray(0, read);
|
|
186
210
|
}
|
|
187
211
|
finally {
|
|
188
212
|
fs.closeSync(fd);
|
|
@@ -214,6 +238,7 @@ function readPackageDir(rootInput) {
|
|
|
214
238
|
throw new AppsFsError('not_directory', rootInput, `${rootInput} is not a directory.`);
|
|
215
239
|
}
|
|
216
240
|
const files = [];
|
|
241
|
+
const assetBytes = Object.create(null);
|
|
217
242
|
const skipped = [];
|
|
218
243
|
const walk = (relative, depth) => {
|
|
219
244
|
const absolute = relative === '' ? root : path.join(root, ...relative.split('/'));
|
|
@@ -255,17 +280,34 @@ function readPackageDir(rootInput) {
|
|
|
255
280
|
if (files.length >= data_provider_1.APP_DRAFT_LIMITS.filesMax) {
|
|
256
281
|
throw new AppsFsError('too_many', childRelative, `A package holds at most ${data_provider_1.APP_DRAFT_LIMITS.filesMax} files; this directory has more. Leave out what is not part of the app.`);
|
|
257
282
|
}
|
|
258
|
-
|
|
283
|
+
// An image or a font that is bytes is read as bytes, under the same rules; everything else is text.
|
|
284
|
+
const asBytes = isBinaryAssetPath(childRelative);
|
|
285
|
+
const content = asBytes ? null : readRegularTextFile(childAbsolute, childRelative);
|
|
286
|
+
const bytes = asBytes
|
|
287
|
+
? readRegularBytes(childAbsolute, childRelative, {}, {
|
|
288
|
+
maxBytes: data_provider_1.APP_FRAME_FILE_LIMITS.assetBytesMax,
|
|
289
|
+
tooLarge: (size) => `${childRelative} is ${size} bytes; an image or a font is at most ${data_provider_1.APP_FRAME_FILE_LIMITS.assetBytesMax} (256 KiB).`,
|
|
290
|
+
})
|
|
291
|
+
: null;
|
|
259
292
|
// After the read: the real location of what was read is inside the root.
|
|
260
293
|
const real = fs.realpathSync(childAbsolute);
|
|
261
294
|
if (real !== path.join(root, ...childRelative.split('/'))) {
|
|
262
295
|
throw new AppsFsError('outside_root', childRelative, `${childRelative} is not where it appears to be (${real}).`);
|
|
263
296
|
}
|
|
264
|
-
|
|
297
|
+
if (bytes !== null) {
|
|
298
|
+
assetBytes[childRelative] = bytes;
|
|
299
|
+
files.push({
|
|
300
|
+
path: childRelative,
|
|
301
|
+
assetSha256: (0, node_crypto_1.createHash)('sha256').update(bytes).digest('hex'),
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
files.push({ path: childRelative, content: content });
|
|
306
|
+
}
|
|
265
307
|
}
|
|
266
308
|
};
|
|
267
309
|
walk('', 1);
|
|
268
|
-
return { root, files, skipped };
|
|
310
|
+
return { root, files, assetBytes, skipped };
|
|
269
311
|
}
|
|
270
312
|
/** The problems of a set of paths a server sent, judged as strangers' input. */
|
|
271
313
|
function remoteTreeProblems(files) {
|
|
@@ -276,14 +318,27 @@ function remoteTreeProblems(files) {
|
|
|
276
318
|
* acceptable; an existing file is replaced only with `force`, and a link is never written through or
|
|
277
319
|
* replaced.
|
|
278
320
|
*/
|
|
279
|
-
function writePackageDir(rootInput, files, { force = false } = {}) {
|
|
321
|
+
function writePackageDir(rootInput, files, { force = false, assetBytes = {}, } = {}) {
|
|
280
322
|
const problems = remoteTreeProblems(files);
|
|
281
323
|
if (problems.length > 0) {
|
|
282
324
|
throw new AppsFsError('bad_path', problems[0].path, `Refusing to write: ${problems[0].message}`);
|
|
283
325
|
}
|
|
284
326
|
for (const file of files) {
|
|
285
|
-
if (typeof file.content
|
|
286
|
-
|
|
327
|
+
if (typeof file.content === 'string') {
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
// A file the server holds as bytes is written only when its bytes came with it AND hash to the address the server named: the
|
|
331
|
+
// answer is a stranger's input like everything else it sends back.
|
|
332
|
+
const bytes = Object.prototype.hasOwnProperty.call(assetBytes, file.path)
|
|
333
|
+
? assetBytes[file.path]
|
|
334
|
+
: undefined;
|
|
335
|
+
if (typeof file.assetSha256 !== 'string' ||
|
|
336
|
+
bytes === undefined ||
|
|
337
|
+
!isBinaryAssetPath(file.path)) {
|
|
338
|
+
throw new AppsFsError('not_text', file.path, `${file.path} is not a text file; this command writes text files, and the images and fonts it was given the bytes of.`);
|
|
339
|
+
}
|
|
340
|
+
if ((0, node_crypto_1.createHash)('sha256').update(bytes).digest('hex') !== file.assetSha256) {
|
|
341
|
+
throw new AppsFsError('unreadable', file.path, `The bytes received for ${file.path} do not hash to the address the server gave, so nothing was written.`);
|
|
287
342
|
}
|
|
288
343
|
}
|
|
289
344
|
const typed = path.resolve(rootInput);
|
|
@@ -342,7 +397,9 @@ function writePackageDir(rootInput, files, { force = false } = {}) {
|
|
|
342
397
|
throw new AppsFsError('unreadable', file.path, `Could not create ${file.path}: ${errorText(error)}`);
|
|
343
398
|
}
|
|
344
399
|
try {
|
|
345
|
-
const bytes =
|
|
400
|
+
const bytes = typeof file.content === 'string'
|
|
401
|
+
? Buffer.from(file.content, 'utf8')
|
|
402
|
+
: Buffer.from(assetBytes[file.path]);
|
|
346
403
|
let offset = 0;
|
|
347
404
|
while (offset < bytes.length) {
|
|
348
405
|
offset += fs.writeSync(fd, bytes, offset);
|
package/dist/lib/compasses.js
CHANGED
|
@@ -309,6 +309,12 @@ function renderEffectivePolicy(policy, log) {
|
|
|
309
309
|
log(' nothing set');
|
|
310
310
|
for (const line of communication)
|
|
311
311
|
log(` ${line}`);
|
|
312
|
+
// These hours are read where the platform composes a message for the agent (Duty checks and
|
|
313
|
+
// wakes). A message the agent sends itself from a session never evaluates them (OSK-23468), and
|
|
314
|
+
// printing the window alone read as if it did.
|
|
315
|
+
if (record(record(policy.communication).quietHours).enabled === true) {
|
|
316
|
+
log(' Note: the communication quiet hours hold messages the platform composes for this agent (Duty checks and wakes). A message the agent sends itself with `skrr agent message send` is not held by them.');
|
|
317
|
+
}
|
|
312
318
|
log(`Authority: ${scalar(policy.authority ?? 'unknown')}`);
|
|
313
319
|
const bySource = new Map();
|
|
314
320
|
for (const [path, entry] of Object.entries(record(policy.fieldProvenance))) {
|
package/dist/lib/duties.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { DUTY_WATCHED_SOURCES, DUTY_TEMPLATE_IDS, DUTY_CADENCE_MODES, DUTY_CADEN
|
|
|
24
24
|
export type { DutyCheck, DutyChecksResponse, Duty, DutyActionProposal, DutyListResponse, DutyPlanResponse, DutyStatusResponse, DutyWorkLink, };
|
|
25
25
|
/** Derived from the installed compatibility vocabulary so the CLI remains
|
|
26
26
|
* safe even while data-provider and CLI packages roll out separately. */
|
|
27
|
-
export declare const DUTY_AUTHORABLE_CADENCE_MODES: ("manual" | "
|
|
27
|
+
export declare const DUTY_AUTHORABLE_CADENCE_MODES: ("manual" | "interval" | "daily" | "event_plus_interval")[];
|
|
28
28
|
/**
|
|
29
29
|
* Where a Duty's autonomous runs do their work. Re-exported for the same
|
|
30
30
|
* reason as the ladder above: the vocabulary is the server's, and a picker that
|
|
@@ -52,6 +52,10 @@ export type DutyListPage = {
|
|
|
52
52
|
data: unknown[];
|
|
53
53
|
has_more?: boolean;
|
|
54
54
|
next_cursor?: string | null;
|
|
55
|
+
coverage?: {
|
|
56
|
+
status?: string;
|
|
57
|
+
reason?: string;
|
|
58
|
+
};
|
|
55
59
|
};
|
|
56
60
|
export type DutyPreflightReport = {
|
|
57
61
|
verdict: 'ready' | 'needs_review' | 'blocked';
|
|
@@ -747,6 +751,14 @@ export type EventWakeCapabilities = {
|
|
|
747
751
|
};
|
|
748
752
|
/** Shape of `GET /:id/wake-capabilities`. */
|
|
749
753
|
export interface DutyWakeCapabilities {
|
|
754
|
+
sourcePolicy?: {
|
|
755
|
+
status?: string;
|
|
756
|
+
reason?: string;
|
|
757
|
+
};
|
|
758
|
+
standingEventWakesSourcePolicy?: {
|
|
759
|
+
status?: string;
|
|
760
|
+
reason?: string;
|
|
761
|
+
};
|
|
750
762
|
eligibleCapabilities: Array<{
|
|
751
763
|
id: string;
|
|
752
764
|
kind?: string;
|
|
@@ -768,6 +780,10 @@ export interface DutyWakeCapabilities {
|
|
|
768
780
|
* statement", never "nothing is bound".
|
|
769
781
|
*/
|
|
770
782
|
standingEventWakes?: {
|
|
783
|
+
sourcePolicy?: {
|
|
784
|
+
status?: string;
|
|
785
|
+
reason?: string;
|
|
786
|
+
};
|
|
771
787
|
dutyStatus: string;
|
|
772
788
|
cadenceMode?: string;
|
|
773
789
|
eventCapabilities: EventWakeCapabilities;
|
|
@@ -1020,7 +1036,7 @@ export declare function withLiveAssessment(duty: DutyView, operatingState?: {
|
|
|
1020
1036
|
assessment?: unknown;
|
|
1021
1037
|
executorBlocked?: unknown;
|
|
1022
1038
|
firstActionableBlocker?: unknown;
|
|
1023
|
-
} | null): DutyView;
|
|
1039
|
+
} | null, historyUnavailable?: boolean): DutyView;
|
|
1024
1040
|
/**
|
|
1025
1041
|
* The first line of `duties update` text output. An update that changed
|
|
1026
1042
|
* nothing says so and names the version it left alone (OSK-16199); a server
|
|
@@ -1187,6 +1203,13 @@ export declare function renderDutyObservations(response: ReadModelRecord, log: (
|
|
|
1187
1203
|
export declare function renderDutyHypotheses(response: ReadModelRecord, log: (line: string) => void, options?: {
|
|
1188
1204
|
emptyMessage?: string;
|
|
1189
1205
|
}): void;
|
|
1206
|
+
/** Old servers could associate work by logical ID without proving its source.
|
|
1207
|
+
* Never render or print those rows unless the server explicitly declares that
|
|
1208
|
+
* the source is supported. This also protects JSON output during mixed rollout.
|
|
1209
|
+
*/
|
|
1210
|
+
export declare function safeDutyLineage(lineage: ReadModelRecord, dutyId?: string): ReadModelRecord;
|
|
1211
|
+
/** Recognize the explicit server refusal across both CLI HTTP transports. */
|
|
1212
|
+
export declare function isDutyLineageUnavailable(error: unknown): boolean;
|
|
1190
1213
|
/** Human view for the duty → work lineage projection. */
|
|
1191
1214
|
export declare function renderDutyLineage(lineage: ReadModelRecord, log: (line: string) => void): void;
|
|
1192
1215
|
/** Human view for daily control-loop metrics. */
|
package/dist/lib/duties.js
CHANGED
|
@@ -54,6 +54,8 @@ exports.describeObservationArtifacts = describeObservationArtifacts;
|
|
|
54
54
|
exports.observationLegend = observationLegend;
|
|
55
55
|
exports.renderDutyObservations = renderDutyObservations;
|
|
56
56
|
exports.renderDutyHypotheses = renderDutyHypotheses;
|
|
57
|
+
exports.safeDutyLineage = safeDutyLineage;
|
|
58
|
+
exports.isDutyLineageUnavailable = isDutyLineageUnavailable;
|
|
57
59
|
exports.renderDutyLineage = renderDutyLineage;
|
|
58
60
|
exports.renderDutyMetrics = renderDutyMetrics;
|
|
59
61
|
exports.costRuleCell = costRuleCell;
|
|
@@ -225,7 +227,12 @@ exports.dutyApi = {
|
|
|
225
227
|
fork: (id, body) => data_provider_2.request.post(`${base(id)}/fork`, body),
|
|
226
228
|
// GET /:id returns `{ duty, latestCheck }` — NOT a bare contract.
|
|
227
229
|
// Unwrap before rendering, or every field reads as undefined.
|
|
228
|
-
|
|
230
|
+
// The CLI understands that a null latestCheck can mean history is
|
|
231
|
+
// unavailable, rather than that the Duty has never run. Older clients do
|
|
232
|
+
// not declare this capability and receive a non-success response instead.
|
|
233
|
+
get: (id) => data_provider_2.request.get(base(id), {
|
|
234
|
+
headers: { 'X-Duty-Source-Policy': 'unsupported-v1' },
|
|
235
|
+
}),
|
|
229
236
|
controlPreview: (id, query) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/control-preview`, query)),
|
|
230
237
|
applyControl: (id, body) => data_provider_2.request.post(`${base(id)}/control`, body),
|
|
231
238
|
controlReceipt: (id, controlId) => data_provider_2.request.get(`${base(id)}/control/${encodeURIComponent(controlId)}`),
|
|
@@ -289,7 +296,9 @@ exports.dutyApi = {
|
|
|
289
296
|
receiptQuarterlyMetrics: (id, year, quarter) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/receipt-metrics/quarterly`, { year, quarter })),
|
|
290
297
|
deliveryPatch: (id, taskId) => data_provider_2.request.get(`${base(id)}/delivery/${encodeURIComponent(taskId)}/patch`),
|
|
291
298
|
deliveryBundle: (id, taskId) => data_provider_2.request.get(`${base(id)}/delivery/${encodeURIComponent(taskId)}/bundle`),
|
|
292
|
-
operatingReview: (agentId) => data_provider_2.request.get(`/api/duties/agents/${encodeURIComponent(agentId)}/operating-review
|
|
299
|
+
operatingReview: (agentId) => data_provider_2.request.get(`/api/duties/agents/${encodeURIComponent(agentId)}/operating-review`, {
|
|
300
|
+
headers: { 'X-Operating-Review-Capabilities': 'nullable-system-duties-v1' },
|
|
301
|
+
}),
|
|
293
302
|
reflection: (id) => data_provider_2.request.get(`${base(id)}/reflection`),
|
|
294
303
|
decideReflectionProposal: (id, proposalKey, decision) => data_provider_2.request.post(`${base(id)}/reflection/proposals/${encodeURIComponent(proposalKey)}/decision`, {
|
|
295
304
|
decision,
|
|
@@ -1292,7 +1301,14 @@ function describeStoppedBy(duty) {
|
|
|
1292
1301
|
* `blocked`, and printing it above "Agent is working" made the header
|
|
1293
1302
|
* contradict the rest of the page. `doctor` already reads the live one first.
|
|
1294
1303
|
*/
|
|
1295
|
-
function withLiveAssessment(duty, operatingState) {
|
|
1304
|
+
function withLiveAssessment(duty, operatingState, historyUnavailable = false) {
|
|
1305
|
+
if (historyUnavailable || operatingState === null) {
|
|
1306
|
+
// These fields depend on history which the read could not attribute to the
|
|
1307
|
+
// current physical Duty. Keep the contract fields, but do not render old
|
|
1308
|
+
// assessment, check summary or executor evidence as the current state.
|
|
1309
|
+
const { assessment: _assessment, state: _state, executorBlocked: _executorBlocked, firstActionableBlocker: _firstActionableBlocker, ...contract } = duty;
|
|
1310
|
+
return contract;
|
|
1311
|
+
}
|
|
1296
1312
|
const live = operatingState?.assessment;
|
|
1297
1313
|
// The remediation for a blocked operation lives on the operating state's
|
|
1298
1314
|
// first actionable blocker; the header printed only the code (OSK-16212).
|
|
@@ -2459,8 +2475,47 @@ function renderLineageRows(label, value, log) {
|
|
|
2459
2475
|
{ key: 'summary', header: 'SUMMARY', maxWidth: 72 },
|
|
2460
2476
|
], `No ${label.toLowerCase()} recorded.`, log);
|
|
2461
2477
|
}
|
|
2478
|
+
/** Old servers could associate work by logical ID without proving its source.
|
|
2479
|
+
* Never render or print those rows unless the server explicitly declares that
|
|
2480
|
+
* the source is supported. This also protects JSON output during mixed rollout.
|
|
2481
|
+
*/
|
|
2482
|
+
function safeDutyLineage(lineage, dutyId) {
|
|
2483
|
+
const policy = record(lineage.sourcePolicy);
|
|
2484
|
+
if (policy?.status === 'supported' || policy?.status === 'partial')
|
|
2485
|
+
return lineage;
|
|
2486
|
+
return {
|
|
2487
|
+
object: 'duty_work_lineage',
|
|
2488
|
+
...(dutyId ? { dutyId } : {}),
|
|
2489
|
+
sourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' },
|
|
2490
|
+
};
|
|
2491
|
+
}
|
|
2492
|
+
/** Recognize the explicit server refusal across both CLI HTTP transports. */
|
|
2493
|
+
function isDutyLineageUnavailable(error) {
|
|
2494
|
+
const e = record(error);
|
|
2495
|
+
if (!e)
|
|
2496
|
+
return false;
|
|
2497
|
+
const expected = 'DUTY_WORK_LINEAGE_SOURCE_UNVERIFIED';
|
|
2498
|
+
const response = record(e.response);
|
|
2499
|
+
const data = record(response?.data);
|
|
2500
|
+
if (e.code === expected || data?.code === expected || data?.error === expected)
|
|
2501
|
+
return true;
|
|
2502
|
+
if (typeof e.body !== 'string')
|
|
2503
|
+
return false;
|
|
2504
|
+
try {
|
|
2505
|
+
const body = record(JSON.parse(e.body));
|
|
2506
|
+
return body?.code === expected || body?.error === expected;
|
|
2507
|
+
}
|
|
2508
|
+
catch {
|
|
2509
|
+
return false;
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2462
2512
|
/** Human view for the duty → work lineage projection. */
|
|
2463
2513
|
function renderDutyLineage(lineage, log) {
|
|
2514
|
+
lineage = safeDutyLineage(lineage);
|
|
2515
|
+
if (record(lineage.sourcePolicy)?.status === 'unsupported') {
|
|
2516
|
+
log('Work lineage is unavailable because historical source identity cannot be verified.');
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2464
2519
|
const duty = record(lineage.duty);
|
|
2465
2520
|
if (duty) {
|
|
2466
2521
|
log(`Duty: ${text(duty.title, text(duty.id))} (${text(duty.status)})`);
|
|
@@ -57,6 +57,8 @@ export declare const ANALYTICS_REPORTS: {
|
|
|
57
57
|
};
|
|
58
58
|
export type AnalyticsReport = keyof typeof ANALYTICS_REPORTS;
|
|
59
59
|
export declare const ANALYTICS_REPORT_NAMES: AnalyticsReport[];
|
|
60
|
+
export declare function reportRequiresVerifiedHistory(report: AnalyticsReport): boolean;
|
|
61
|
+
export declare function hasVerifiedDutyHistory(value: unknown): boolean;
|
|
60
62
|
export declare const dutyAnalyticsApi: {
|
|
61
63
|
prdReadout: (query?: Query) => Promise<Record<string, unknown>>;
|
|
62
64
|
operationsQueue: (query?: Query) => Promise<Record<string, unknown>>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dutyAnalyticsApi = exports.ANALYTICS_REPORT_NAMES = exports.ANALYTICS_REPORTS = void 0;
|
|
4
|
+
exports.reportRequiresVerifiedHistory = reportRequiresVerifiedHistory;
|
|
5
|
+
exports.hasVerifiedDutyHistory = hasVerifiedDutyHistory;
|
|
4
6
|
exports.renderReportCatalogue = renderReportCatalogue;
|
|
5
7
|
/**
|
|
6
8
|
* duty-analytics.ts — client for `/api/duty-analytics`.
|
|
@@ -75,6 +77,30 @@ exports.ANALYTICS_REPORTS = {
|
|
|
75
77
|
},
|
|
76
78
|
};
|
|
77
79
|
exports.ANALYTICS_REPORT_NAMES = Object.keys(exports.ANALYTICS_REPORTS);
|
|
80
|
+
// Legacy analytics responses can join retained records to a recreated Duty by
|
|
81
|
+
// logical ID alone. Do not print those responses without an explicit, current
|
|
82
|
+
// server assertion that the historical source was verified.
|
|
83
|
+
const VERIFIED_HISTORY_REPORTS = new Set([
|
|
84
|
+
'prd-readout',
|
|
85
|
+
'operations-queue',
|
|
86
|
+
'governance-exceptions',
|
|
87
|
+
'attention-budget',
|
|
88
|
+
'decision-inbox',
|
|
89
|
+
'recovery-metrics',
|
|
90
|
+
'recovery',
|
|
91
|
+
'dormant-records',
|
|
92
|
+
'held-surfaces',
|
|
93
|
+
]);
|
|
94
|
+
function reportRequiresVerifiedHistory(report) {
|
|
95
|
+
return VERIFIED_HISTORY_REPORTS.has(report);
|
|
96
|
+
}
|
|
97
|
+
function hasVerifiedDutyHistory(value) {
|
|
98
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
99
|
+
return false;
|
|
100
|
+
const policy = value.sourcePolicy;
|
|
101
|
+
return Boolean(policy && typeof policy === 'object' && !Array.isArray(policy) &&
|
|
102
|
+
policy.status === 'supported');
|
|
103
|
+
}
|
|
78
104
|
exports.dutyAnalyticsApi = {
|
|
79
105
|
prdReadout: (query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${MOUNT}/prd-readout`, query)),
|
|
80
106
|
operationsQueue: (query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${MOUNT}/operations/queue`, query)),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dutyGoalPropagationNotice = dutyGoalPropagationNotice;
|
|
4
|
+
/** Describe what the server could prove about existing Task updates. */
|
|
5
|
+
function dutyGoalPropagationNotice(result, operation) {
|
|
6
|
+
const propagation = result.taskPropagation;
|
|
7
|
+
const status = propagation && typeof propagation === 'object' && 'status' in propagation
|
|
8
|
+
? propagation.status
|
|
9
|
+
: undefined;
|
|
10
|
+
if (status === 'complete' || status === 'supported')
|
|
11
|
+
return null;
|
|
12
|
+
if (status === 'unsupported') {
|
|
13
|
+
return operation === 'unlink'
|
|
14
|
+
? 'Existing Tasks were not updated and may still refer to this Duty.'
|
|
15
|
+
: 'Existing Tasks were not updated and may not refer to this Duty.';
|
|
16
|
+
}
|
|
17
|
+
return 'Task synchronization could not be verified. Existing Tasks may not reflect this change.';
|
|
18
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Old history endpoints selected rows by logical Duty ID and could return
|
|
2
|
+
* another physical Duty's data after deletion and recreation. Never print an
|
|
3
|
+
* old 200 response unless the server explicitly describes source coverage. */
|
|
4
|
+
export declare function hasVerifiedDutyHistorySource(value: unknown): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasVerifiedDutyHistorySource = hasVerifiedDutyHistorySource;
|
|
4
|
+
/** Old history endpoints selected rows by logical Duty ID and could return
|
|
5
|
+
* another physical Duty's data after deletion and recreation. Never print an
|
|
6
|
+
* old 200 response unless the server explicitly describes source coverage. */
|
|
7
|
+
function hasVerifiedDutyHistorySource(value) {
|
|
8
|
+
if (!value || typeof value !== 'object')
|
|
9
|
+
return false;
|
|
10
|
+
const policy = value.sourcePolicy;
|
|
11
|
+
return policy?.status === 'supported' || policy?.status === 'partial';
|
|
12
|
+
}
|
|
@@ -2,6 +2,10 @@ export declare function renderActionHistory(page: {
|
|
|
2
2
|
data?: unknown[];
|
|
3
3
|
has_more?: boolean;
|
|
4
4
|
next_cursor?: string | null;
|
|
5
|
+
coverage?: {
|
|
6
|
+
status?: string;
|
|
7
|
+
reason?: string;
|
|
8
|
+
};
|
|
5
9
|
} | undefined, log: (line: string) => void): void;
|
|
6
10
|
export declare function renderReflection(review: Record<string, unknown> | undefined, log: (line: string) => void): void;
|
|
7
11
|
export declare function renderCadenceDecisions(list: {
|
package/dist/lib/duty-ledgers.js
CHANGED
|
@@ -34,6 +34,10 @@ function minutes(ms) {
|
|
|
34
34
|
return `${m}m`;
|
|
35
35
|
}
|
|
36
36
|
function renderActionHistory(page, log) {
|
|
37
|
+
if (page?.coverage?.status === 'unsupported') {
|
|
38
|
+
log('Action history is unavailable until its historical sources can be verified.');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
37
41
|
const rows = (Array.isArray(page?.data) ? page.data : []);
|
|
38
42
|
if (rows.length === 0) {
|
|
39
43
|
log('No actions recorded.');
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const RECEIPT_SOURCE_UNVERIFIED = "DUTY_RECEIPT_SOURCE_UNVERIFIED";
|
|
2
|
+
export declare const RECEIPT_UNAVAILABLE_MESSAGE = "Execution receipt history is unavailable because its source identity cannot be verified.";
|
|
3
|
+
export declare function hasVerifiedReceiptSource(value: unknown): boolean;
|
|
4
|
+
export declare function isReceiptSourceUnverified(error: unknown): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RECEIPT_UNAVAILABLE_MESSAGE = exports.RECEIPT_SOURCE_UNVERIFIED = void 0;
|
|
4
|
+
exports.hasVerifiedReceiptSource = hasVerifiedReceiptSource;
|
|
5
|
+
exports.isReceiptSourceUnverified = isReceiptSourceUnverified;
|
|
6
|
+
const duty_history_source_1 = require("./duty-history-source");
|
|
7
|
+
exports.RECEIPT_SOURCE_UNVERIFIED = 'DUTY_RECEIPT_SOURCE_UNVERIFIED';
|
|
8
|
+
exports.RECEIPT_UNAVAILABLE_MESSAGE = 'Execution receipt history is unavailable because its source identity cannot be verified.';
|
|
9
|
+
function hasVerifiedReceiptSource(value) {
|
|
10
|
+
return (0, duty_history_source_1.hasVerifiedDutyHistorySource)(value);
|
|
11
|
+
}
|
|
12
|
+
function isReceiptSourceUnverified(error) {
|
|
13
|
+
if (!error || typeof error !== 'object')
|
|
14
|
+
return false;
|
|
15
|
+
const candidate = error;
|
|
16
|
+
return (candidate.code === exports.RECEIPT_SOURCE_UNVERIFIED ||
|
|
17
|
+
candidate.response?.data?.code === exports.RECEIPT_SOURCE_UNVERIFIED ||
|
|
18
|
+
candidate.response?.data?.error === exports.RECEIPT_SOURCE_UNVERIFIED);
|
|
19
|
+
}
|
package/dist/lib/followups.d.ts
CHANGED
|
@@ -81,6 +81,12 @@ export interface FollowUpRow {
|
|
|
81
81
|
reason?: string | null;
|
|
82
82
|
note?: string | null;
|
|
83
83
|
} | null;
|
|
84
|
+
/** Set when the last fire was skipped by a gate (the agent's initiative mode, say) rather than moved or run. `note` is the owner's-words reason when the server knows the gate. */
|
|
85
|
+
skipped?: {
|
|
86
|
+
reason: string;
|
|
87
|
+
at?: string | null;
|
|
88
|
+
note?: string | null;
|
|
89
|
+
} | null;
|
|
84
90
|
capsule?: unknown;
|
|
85
91
|
nextRunAt?: string | null;
|
|
86
92
|
deadlineAt?: string | null;
|
|
@@ -105,7 +111,21 @@ export interface FollowUpCreateResponse {
|
|
|
105
111
|
recorded: string;
|
|
106
112
|
note: string;
|
|
107
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* Set when the agent's initiative mode will refuse this follow-up when it comes due (OSK-23479):
|
|
116
|
+
* what the mode does to it, how to change the mode, and for an agent-worded reminder the way to
|
|
117
|
+
* get the literal text delivered regardless.
|
|
118
|
+
*/
|
|
119
|
+
gateAdvisory?: {
|
|
120
|
+
reason: string;
|
|
121
|
+
headline: string;
|
|
122
|
+
text: string;
|
|
123
|
+
remedy: string;
|
|
124
|
+
alternative?: string;
|
|
125
|
+
};
|
|
108
126
|
}
|
|
127
|
+
/** A heads-up that the follow-up just made will be refused at its due time, with the way out. */
|
|
128
|
+
export declare function gateAdvisoryNotice(response: FollowUpCreateResponse): string | undefined;
|
|
109
129
|
/** One line telling a person the follow-up was recorded with weaker provenance than claimed. */
|
|
110
130
|
export declare function producerDowngradeNotice(response: FollowUpCreateResponse): string | undefined;
|
|
111
131
|
/**
|
package/dist/lib/followups.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.followupsApi = exports.FOLLOWUP_SUBJECT_FLAG_HELP = exports.FOLLOWUP_SUB
|
|
|
4
4
|
exports.whenFlagProblem = whenFlagProblem;
|
|
5
5
|
exports.settledLine = settledLine;
|
|
6
6
|
exports.recipeWatchBoundsRefusal = recipeWatchBoundsRefusal;
|
|
7
|
+
exports.gateAdvisoryNotice = gateAdvisoryNotice;
|
|
7
8
|
exports.producerDowngradeNotice = producerDowngradeNotice;
|
|
8
9
|
exports.reusedWithoutChangeMessage = reusedWithoutChangeMessage;
|
|
9
10
|
exports.resolveFollowUpAgent = resolveFollowUpAgent;
|
|
@@ -129,6 +130,15 @@ function recipeWatchBoundsRefusal(waitKind, passed) {
|
|
|
129
130
|
: 'A recipe watch ends through its --wait.',
|
|
130
131
|
].join(' ');
|
|
131
132
|
}
|
|
133
|
+
/** A heads-up that the follow-up just made will be refused at its due time, with the way out. */
|
|
134
|
+
function gateAdvisoryNotice(response) {
|
|
135
|
+
const advisory = response.gateAdvisory;
|
|
136
|
+
if (!advisory)
|
|
137
|
+
return undefined;
|
|
138
|
+
return ['Heads up:', advisory.text, advisory.alternative, advisory.remedy]
|
|
139
|
+
.filter(Boolean)
|
|
140
|
+
.join(' ');
|
|
141
|
+
}
|
|
132
142
|
/** One line telling a person the follow-up was recorded with weaker provenance than claimed. */
|
|
133
143
|
function producerDowngradeNotice(response) {
|
|
134
144
|
const downgraded = response.producerDowngraded;
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import type { HeldOwnerMessages } from '@skrr-ai/data-provider';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a thrown error is that refusal. The status alone is not enough: the same route also
|
|
4
|
+
* answers 400 `Invalid cursor`, which is a different problem with a different remedy.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isWorkspaceContextRequired(err: unknown): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* What to tell the caller when the server answered "Workspace context required". It depends on
|
|
9
|
+
* what the request actually carried, because the same refusal has two causes with different fixes:
|
|
10
|
+
*
|
|
11
|
+
* - NO workspace was sent (none selected, and the agent's own could not be read): pass one.
|
|
12
|
+
* - A workspace WAS sent, whether the caller's or the agent's own that the CLI defaulted to. The
|
|
13
|
+
* server sets `req.workspace` only for a workspace the caller belongs to and passes anything
|
|
14
|
+
* else through as null, so this means the caller is not a member of it (or it does not exist).
|
|
15
|
+
* Saying "none was selected" here would be false, and found live: an agent whose workspace the
|
|
16
|
+
* caller can see through a direct grant but does not belong to.
|
|
17
|
+
*
|
|
18
|
+
* `sentWorkspaceId` is the workspace the request carried (`withWorkspaceHeader`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function heldMessagesWorkspaceRefusal(sentWorkspaceId: string | null | undefined): {
|
|
21
|
+
message: string;
|
|
22
|
+
suggestion: string;
|
|
23
|
+
};
|
|
2
24
|
/** The sentence for a reason code, or an explicit "unrecognised" line carrying the code. */
|
|
3
25
|
export declare function heldReasonLabel(reason: string): string;
|
|
4
26
|
/**
|