@skrr-ai/cli 0.1.166 → 0.1.168
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 +0 -1
- package/dist/commands/activity/scan-older.d.ts +1 -1
- package/dist/commands/activity/scan-older.js +5 -4
- package/dist/commands/agent/message/approve.d.ts +1 -0
- package/dist/commands/agent/message/approve.js +6 -2
- package/dist/commands/agent/message/decline.d.ts +1 -0
- package/dist/commands/agent/message/decline.js +6 -2
- package/dist/commands/agent/message/pending.js +5 -2
- package/dist/commands/agent/message/review.d.ts +13 -0
- package/dist/commands/agent/message/review.js +68 -0
- package/dist/commands/agents/always-on/recovery-close.d.ts +28 -0
- package/dist/commands/agents/always-on/recovery-close.js +60 -0
- package/dist/commands/agents/always-on/recovery-review.d.ts +22 -0
- package/dist/commands/agents/always-on/recovery-review.js +190 -0
- package/dist/commands/apps/installations/compatibility.js +1 -1
- package/dist/commands/apps/installations/list.js +3 -0
- package/dist/commands/apps/installations/show.js +3 -0
- package/dist/commands/duties/show.js +10 -0
- package/dist/commands/goals/key-results/assess.d.ts +2 -3
- package/dist/commands/goals/key-results/assess.js +5 -12
- package/dist/commands/harnesses/removal-references.d.ts +16 -0
- package/dist/commands/harnesses/removal-references.js +61 -0
- package/dist/commands/tasks/actionability.js +8 -3
- package/dist/commands/tasks/complete.js +35 -17
- package/dist/commands/tasks/expectations/assess.d.ts +1 -0
- package/dist/commands/tasks/expectations/assess.js +50 -21
- package/dist/commands/tasks/expectations.js +5 -2
- package/dist/commands/tasks/judge.d.ts +1 -0
- package/dist/commands/tasks/judge.js +17 -2
- package/dist/commands/tasks/result/submit.js +26 -17
- package/dist/commands/tasks/review-queue.js +2 -1
- package/dist/commands/tasks/review.d.ts +1 -0
- package/dist/commands/tasks/review.js +24 -3
- package/dist/commands/tasks/show.d.ts +13 -0
- package/dist/commands/tasks/show.js +41 -3
- package/dist/commands/tasks/updates/add.d.ts +1 -0
- package/dist/commands/tasks/updates/add.js +71 -21
- package/dist/commands/tasks/updates/list.d.ts +4 -0
- package/dist/commands/tasks/updates/list.js +3 -1
- package/dist/commands/tasks/waive.d.ts +1 -0
- package/dist/commands/tasks/waive.js +17 -2
- package/dist/generated/agent-guides.json +20 -20
- package/dist/lib/agent-activity.d.ts +3 -1
- package/dist/lib/agent-activity.js +50 -11
- package/dist/lib/appInstallations.js +1 -1
- package/dist/lib/harnesses.d.ts +24 -0
- package/dist/lib/harnesses.js +4 -0
- package/dist/lib/reference-syntax.d.ts +28 -0
- package/dist/lib/reference-syntax.js +91 -0
- package/dist/lib/runtime-context.js +6 -0
- package/dist/lib/task-closure.d.ts +1 -1
- package/dist/lib/task-closure.js +1 -1
- package/dist/lib/task-operations.d.ts +28 -6
- package/dist/lib/task-operations.js +77 -4
- package/dist/lib/task-preflight.js +8 -3
- package/dist/lib/task-write-attribution.d.ts +183 -19
- package/dist/lib/task-write-attribution.js +270 -39
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +71 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +11416 -11290
- package/oclif.manifest.json +395 -16
- package/package.json +2 -2
|
@@ -17,17 +17,31 @@ const api_fetch_1 = require("./api-fetch");
|
|
|
17
17
|
const format_1 = require("./format");
|
|
18
18
|
const search_display_1 = require("./search-display");
|
|
19
19
|
exports.ACTIVITY_SOURCES = [
|
|
20
|
-
'trigger_fire',
|
|
21
|
-
'
|
|
20
|
+
'trigger_fire',
|
|
21
|
+
'duty_check',
|
|
22
|
+
'task_execution',
|
|
23
|
+
'direct_chat',
|
|
24
|
+
'group_chat',
|
|
25
|
+
'goal_planner_tick',
|
|
26
|
+
'autonomous_run',
|
|
22
27
|
];
|
|
23
28
|
exports.ACTIVITY_RUNTIMES = [
|
|
24
|
-
'selected',
|
|
25
|
-
'
|
|
29
|
+
'selected',
|
|
30
|
+
'bound',
|
|
31
|
+
'not_bound',
|
|
32
|
+
'unknown',
|
|
33
|
+
'byo-machine',
|
|
34
|
+
'hosted-machine',
|
|
35
|
+
'hosted-job-machine',
|
|
36
|
+
'dedicated-machine',
|
|
37
|
+
'space-machine',
|
|
38
|
+
'oversky-worker',
|
|
26
39
|
];
|
|
27
40
|
exports.ACTIVITY_INITIATORS = ['person', 'automation', 'agent', 'system', 'unknown'];
|
|
28
41
|
/** Activity values can contain source-authored text. Never emit terminal control or bidi characters. */
|
|
29
42
|
function activityCell(value, placeholder = '-') {
|
|
30
|
-
return (0, search_display_1.searchDisplayText)((0, format_1.formatCell)(value, placeholder)).replace(/[\u061c\u200e\u200f]/g, '') ||
|
|
43
|
+
return ((0, search_display_1.searchDisplayText)((0, format_1.formatCell)(value, placeholder)).replace(/[\u061c\u200e\u200f]/g, '') ||
|
|
44
|
+
placeholder);
|
|
31
45
|
}
|
|
32
46
|
function isPrintableActivityToken(value) {
|
|
33
47
|
return (0, search_display_1.isPrintableSearchCursor)(value) && !/[\u061c\u200e\u200f]/.test(value);
|
|
@@ -96,11 +110,18 @@ function renderActivityItems(items, log) {
|
|
|
96
110
|
(0, format_1.renderTable)(items.map((item) => ({
|
|
97
111
|
when: activityCell((0, format_1.localTime)(item.timestamp)),
|
|
98
112
|
source: activityCell(item.sourceKind),
|
|
99
|
-
status: activityCell(item.status
|
|
113
|
+
status: activityCell(item.sourceStatus && item.sourceStatus !== item.status
|
|
114
|
+
? `${item.status} (${item.sourceStatus})`
|
|
115
|
+
: item.status, 'unknown'),
|
|
100
116
|
title: activityCell(item.title),
|
|
101
117
|
reference: sourceLabel(item.sourceRef),
|
|
102
118
|
runtime: runtimeCell(item),
|
|
103
119
|
content: activityCell(item.content?.state, 'unknown'),
|
|
120
|
+
wakes: item.sourceKind === 'duty_check' &&
|
|
121
|
+
Number.isSafeInteger(item.otherWakes) &&
|
|
122
|
+
(item.otherWakes ?? 0) > 0
|
|
123
|
+
? `at least ${item.otherWakes}`
|
|
124
|
+
: '-',
|
|
104
125
|
})), [
|
|
105
126
|
{ key: 'when', header: 'WHEN' },
|
|
106
127
|
{ key: 'source', header: 'SOURCE' },
|
|
@@ -109,6 +130,7 @@ function renderActivityItems(items, log) {
|
|
|
109
130
|
{ key: 'reference', header: 'SOURCE REFERENCE', verbatim: true },
|
|
110
131
|
{ key: 'runtime', header: 'RUNTIME' },
|
|
111
132
|
{ key: 'content', header: 'CONTENT' },
|
|
133
|
+
{ key: 'wakes', header: 'WAKE RECORDS' },
|
|
112
134
|
], log);
|
|
113
135
|
}
|
|
114
136
|
function renderAgentActivity(response, log) {
|
|
@@ -130,7 +152,7 @@ function renderAgentActivity(response, log) {
|
|
|
130
152
|
log('Current chat: messages show <conversationId> <messageId> (independently authorized; Activity identity unverified).');
|
|
131
153
|
log('Group reply: activity show --group-chat <groupChatId> --message <messageId>.');
|
|
132
154
|
}
|
|
133
|
-
log('Scan your older activity: activity scan-older chat|group-chat|task.');
|
|
155
|
+
log('Scan your older activity: activity scan-older chat|group-chat|task|trigger.');
|
|
134
156
|
log('');
|
|
135
157
|
const coverage = Array.isArray(response.coverage) ? response.coverage : [];
|
|
136
158
|
if (!coverage.length)
|
|
@@ -150,7 +172,8 @@ function renderAgentActivity(response, log) {
|
|
|
150
172
|
if (!response.nextCursor) {
|
|
151
173
|
log('More activity may be available, but the server did not return a cursor.');
|
|
152
174
|
}
|
|
153
|
-
else if (typeof response.nextCursor !== 'string' ||
|
|
175
|
+
else if (typeof response.nextCursor !== 'string' ||
|
|
176
|
+
!isPrintableActivityToken(response.nextCursor)) {
|
|
154
177
|
log('The next cursor cannot be printed safely.');
|
|
155
178
|
}
|
|
156
179
|
else {
|
|
@@ -173,6 +196,7 @@ const SCAN_OBJECT = {
|
|
|
173
196
|
chat: 'personal_chat_activity_scan',
|
|
174
197
|
'group-chat': 'group_chat_activity_scan',
|
|
175
198
|
task: 'personal_task_activity_scan',
|
|
199
|
+
trigger: 'trigger_fire_activity_scan',
|
|
176
200
|
};
|
|
177
201
|
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
178
202
|
/**
|
|
@@ -201,6 +225,11 @@ function scanOlderActivity(options, credential) {
|
|
|
201
225
|
credential,
|
|
202
226
|
});
|
|
203
227
|
}
|
|
228
|
+
if (options.source === 'trigger') {
|
|
229
|
+
return (0, api_fetch_1.apiFetch)(`/api/agent-activity/trigger/scan-older?${query.toString()}`, {
|
|
230
|
+
credential,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
204
233
|
return (0, api_fetch_1.apiFetch)(`/api/agent-activity/group-chat/scan-older?${query.toString()}`, {
|
|
205
234
|
credential,
|
|
206
235
|
});
|
|
@@ -224,7 +253,13 @@ function parseActivityScan(source, value) {
|
|
|
224
253
|
return value;
|
|
225
254
|
}
|
|
226
255
|
function renderActivityScan(source, response, log) {
|
|
227
|
-
const label = source === 'chat'
|
|
256
|
+
const label = source === 'chat'
|
|
257
|
+
? 'chat'
|
|
258
|
+
: source === 'task'
|
|
259
|
+
? 'Task'
|
|
260
|
+
: source === 'trigger'
|
|
261
|
+
? 'trigger'
|
|
262
|
+
: 'group';
|
|
228
263
|
log(`Earlier ${label} activity`);
|
|
229
264
|
if (response.items.length) {
|
|
230
265
|
renderActivityItems(response.items, log);
|
|
@@ -233,7 +268,9 @@ function renderActivityScan(source, response, log) {
|
|
|
233
268
|
? 'Current chat: messages show <conversationId> <messageId> (independently authorized; Activity identity unverified).'
|
|
234
269
|
: source === 'task'
|
|
235
270
|
? 'Open the Task for its independently authorized history.'
|
|
236
|
-
:
|
|
271
|
+
: source === 'trigger'
|
|
272
|
+
? 'Trigger records are listed only within the currently authorized account and workspace.'
|
|
273
|
+
: 'Group reply: activity show --group-chat <groupChatId> --message <messageId>.');
|
|
237
274
|
}
|
|
238
275
|
else {
|
|
239
276
|
log(`No additional visible ${label} activity was found in this scan.`);
|
|
@@ -244,7 +281,9 @@ function renderActivityScan(source, response, log) {
|
|
|
244
281
|
? 'A scan is a separate, bounded read of older chat replies. Its cursor is not a global time order or a has-more signal, and some history may be unavailable.'
|
|
245
282
|
: source === 'task'
|
|
246
283
|
? 'Personal Tasks are scanned separately, not in global time order. Some history may be unavailable.'
|
|
247
|
-
:
|
|
284
|
+
: source === 'trigger'
|
|
285
|
+
? 'Trigger fires are scanned separately. An empty scan does not establish complete history.'
|
|
286
|
+
: 'Groups are scanned separately, not in global time order. Some history may be unavailable.');
|
|
248
287
|
const coverage = response.coverage;
|
|
249
288
|
log(`Coverage: ${activityCell(coverage.source, label)}: ${activityCell(coverage.state, 'unknown')}${coverage.reason ? ` (${activityCell(coverage.reason)})` : ''}`);
|
|
250
289
|
log('');
|
|
@@ -1107,7 +1107,7 @@ const CONFLICT_WORDS = {
|
|
|
1107
1107
|
changed: () => 'The installation changed while this was running. Read its current state before deciding what to do next.',
|
|
1108
1108
|
not_auto_updatable: () => 'That installation does not update on its own.',
|
|
1109
1109
|
data_deletion_not_confirmed: (refusal) => `Removing this app also deletes its data (${refusal.docCount ?? 'some'} document${refusal.docCount === 1 ? '' : 's'}), which is yours to confirm. Nothing was removed. Say it, with --delete-data, if you mean it.`,
|
|
1110
|
-
installation_incomplete: () => 'This installation
|
|
1110
|
+
installation_incomplete: () => 'This installation is incomplete or its version cannot be read, so it cannot run. Check your installations again later; if it remains unavailable, contact support with the installation ID. Its data may still be present.',
|
|
1111
1111
|
principal_scope_unserved: (refusal, _bin, context) => `This app asks for ${describeScopeIssues(refusal.unserved)}, which cannot work for the place it would be installed (an app installed on a person reaches that person's own data, never an agent's or a space's, and has no agent to run it yet).${needsOperator(refusal.unserved)
|
|
1112
1112
|
? ' An app that needs an agent to run it can, for now, only be installed on one of your agents.'
|
|
1113
1113
|
: ''} ${nothingWas(context)}`,
|
package/dist/lib/harnesses.d.ts
CHANGED
|
@@ -184,6 +184,30 @@ export declare function getHarness(id: string): Promise<{
|
|
|
184
184
|
harness?: Harness;
|
|
185
185
|
}>;
|
|
186
186
|
export declare function getHarnessModels(id: string): Promise<unknown>;
|
|
187
|
+
/**
|
|
188
|
+
* `GET /api/harnesses/:id/removal-references`: what still points at this
|
|
189
|
+
* machine. Partial, read-only evidence; the server never says removal is safe
|
|
190
|
+
* (`removalAuthorized` is always false).
|
|
191
|
+
*/
|
|
192
|
+
export interface HarnessRemovalReferences {
|
|
193
|
+
harnessId: string;
|
|
194
|
+
observedAt: string;
|
|
195
|
+
coverage: 'partial';
|
|
196
|
+
removalAuthorized: false;
|
|
197
|
+
agents: {
|
|
198
|
+
total: number;
|
|
199
|
+
owned: number;
|
|
200
|
+
other: number;
|
|
201
|
+
ownedListed: Array<{
|
|
202
|
+
id: string | null;
|
|
203
|
+
name: string | null;
|
|
204
|
+
}>;
|
|
205
|
+
ownedTruncated: boolean;
|
|
206
|
+
};
|
|
207
|
+
/** `null` when the owner's inference policy could not be read. */
|
|
208
|
+
ownInferencePolicyReferencesMachine: boolean | null;
|
|
209
|
+
}
|
|
210
|
+
export declare function getHarnessRemovalReferences(id: string): Promise<HarnessRemovalReferences>;
|
|
187
211
|
export declare function listHarnessProducts(): Promise<unknown>;
|
|
188
212
|
export declare function getHarnessUsage(id: string): Promise<unknown>;
|
|
189
213
|
/** The rollup across every harness. The web calls this key `fleetUsage`. */
|
package/dist/lib/harnesses.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.describeHealthReasonSentences = describeHealthReasonSentences;
|
|
|
5
5
|
exports.listHarnesses = listHarnesses;
|
|
6
6
|
exports.getHarness = getHarness;
|
|
7
7
|
exports.getHarnessModels = getHarnessModels;
|
|
8
|
+
exports.getHarnessRemovalReferences = getHarnessRemovalReferences;
|
|
8
9
|
exports.listHarnessProducts = listHarnessProducts;
|
|
9
10
|
exports.getHarnessUsage = getHarnessUsage;
|
|
10
11
|
exports.getAllHarnessUsage = getAllHarnessUsage;
|
|
@@ -97,6 +98,9 @@ async function getHarness(id) {
|
|
|
97
98
|
async function getHarnessModels(id) {
|
|
98
99
|
return (0, api_fetch_1.apiFetch)(`/api/harnesses/${encodeURIComponent(id)}/models`);
|
|
99
100
|
}
|
|
101
|
+
async function getHarnessRemovalReferences(id) {
|
|
102
|
+
return (0, api_fetch_1.apiFetch)(`/api/harnesses/${encodeURIComponent(id)}/removal-references`);
|
|
103
|
+
}
|
|
100
104
|
async function listHarnessProducts() {
|
|
101
105
|
return (0, api_fetch_1.apiFetch)('/api/machines/products');
|
|
102
106
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TaskReference } from '@skrr-ai/data-provider';
|
|
2
|
+
/** The accepted spellings, as error messages and help name them. */
|
|
3
|
+
export declare const REFERENCE_SYNTAX_EXAMPLES = "such as task:OSK-42, pr:https://github.com/acme/app/pull/482 or https://ci.example.com/runs/77";
|
|
4
|
+
export declare class ReferenceSyntaxError extends Error {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Read one `<kind>:<id-or-uri>`, or a bare URL, into a reference. Throws a
|
|
9
|
+
* {@link ReferenceSyntaxError} naming `flag` when there is no kind or nothing after the colon.
|
|
10
|
+
*
|
|
11
|
+
* https://x/pr/1 → { kind: 'url', uri: 'https://x/pr/1' }
|
|
12
|
+
* pr:https://x/pr/1 → { kind: 'pr', uri: 'https://x/pr/1' }
|
|
13
|
+
* file:/tmp/report.txt → { kind: 'file', uri: '/tmp/report.txt' }
|
|
14
|
+
* task:OSK-42 → { kind: 'task', id: 'OSK-42' }
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseReference(raw: string, flag: string): TaskReference;
|
|
17
|
+
/** {@link parseReference} for every value of a repeatable flag; an absent flag is `[]`. */
|
|
18
|
+
export declare function parseReferences(raws: readonly string[] | undefined, flag: string): TaskReference[];
|
|
19
|
+
/**
|
|
20
|
+
* The entries of an `evidenceRefs` array written by hand in JSON, with each STRING entry turned
|
|
21
|
+
* into the object the server takes: a URL, or `<kind>:<id-or-uri>`. Anything that is not a string
|
|
22
|
+
* passes through untouched, because the server is the validator of the object form.
|
|
23
|
+
*
|
|
24
|
+
* A string that is neither is refused here, naming its index, so the first attempt does not
|
|
25
|
+
* travel to the server to learn the shape (`data.evidenceRefs.0: expected object, received
|
|
26
|
+
* string`).
|
|
27
|
+
*/
|
|
28
|
+
export declare function liftReferenceEntries(entries: readonly unknown[], field: string): unknown[];
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReferenceSyntaxError = exports.REFERENCE_SYNTAX_EXAMPLES = void 0;
|
|
4
|
+
exports.parseReference = parseReference;
|
|
5
|
+
exports.parseReferences = parseReferences;
|
|
6
|
+
exports.liftReferenceEntries = liftReferenceEntries;
|
|
7
|
+
/**
|
|
8
|
+
* `<kind>:<id-or-uri>`: the one way a reference is written on the command line.
|
|
9
|
+
*
|
|
10
|
+
* Five commands take one as a flag value (`tasks complete --evidence`, `tasks result submit
|
|
11
|
+
* --evidence`, `tasks expectations assess --evidence`, `tasks updates add --reference` and
|
|
12
|
+
* `--evidence`, `goals key-results assess --evidence`), and each used to split it itself. They
|
|
13
|
+
* disagreed: `complete` and `key-results assess` refused `task:` with nothing after the colon, and
|
|
14
|
+
* the others sent it on for the server to refuse; `complete` read a value starting with `/` as a
|
|
15
|
+
* uri, and the others read it as an id. All of them split a bare URL at its own scheme, so
|
|
16
|
+
* `https://example.com/x` became kind `https` with id `//example.com/x`.
|
|
17
|
+
*
|
|
18
|
+
* The server's shape is `{ kind, id?, uri?, label?, version?, digest? }`, with `kind` and one of
|
|
19
|
+
* `id`/`uri` required (`taskReferenceSchema`, api/server/services/TaskUpdates/updateDataContract.js).
|
|
20
|
+
* This module only spells it; the server stays the validator.
|
|
21
|
+
*/
|
|
22
|
+
/** A value with a scheme and an authority (`https://…`, `file:///…`, `s3://…`) is a whole URL. */
|
|
23
|
+
const BARE_URL_RE = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
24
|
+
/** After the kind, a value is a location rather than an id when it is one of these. */
|
|
25
|
+
const URI_SCHEME_RE = /^(?:https?|file):/i;
|
|
26
|
+
/** The accepted spellings, as error messages and help name them. */
|
|
27
|
+
exports.REFERENCE_SYNTAX_EXAMPLES = 'such as task:OSK-42, pr:https://github.com/acme/app/pull/482 or https://ci.example.com/runs/77';
|
|
28
|
+
class ReferenceSyntaxError extends Error {
|
|
29
|
+
constructor(message) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = 'ReferenceSyntaxError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ReferenceSyntaxError = ReferenceSyntaxError;
|
|
35
|
+
function isUriValue(value) {
|
|
36
|
+
return BARE_URL_RE.test(value) || URI_SCHEME_RE.test(value) || value.startsWith('/');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Read one `<kind>:<id-or-uri>`, or a bare URL, into a reference. Throws a
|
|
40
|
+
* {@link ReferenceSyntaxError} naming `flag` when there is no kind or nothing after the colon.
|
|
41
|
+
*
|
|
42
|
+
* https://x/pr/1 → { kind: 'url', uri: 'https://x/pr/1' }
|
|
43
|
+
* pr:https://x/pr/1 → { kind: 'pr', uri: 'https://x/pr/1' }
|
|
44
|
+
* file:/tmp/report.txt → { kind: 'file', uri: '/tmp/report.txt' }
|
|
45
|
+
* task:OSK-42 → { kind: 'task', id: 'OSK-42' }
|
|
46
|
+
*/
|
|
47
|
+
function parseReference(raw, flag) {
|
|
48
|
+
const text = raw.trim();
|
|
49
|
+
if (BARE_URL_RE.test(text))
|
|
50
|
+
return { kind: 'url', uri: text };
|
|
51
|
+
const split = text.indexOf(':');
|
|
52
|
+
const kind = split > 0 ? text.slice(0, split).trim() : '';
|
|
53
|
+
const value = split > 0 ? text.slice(split + 1).trim() : '';
|
|
54
|
+
if (!kind || !value) {
|
|
55
|
+
let why = 'nothing follows the colon';
|
|
56
|
+
if (split < 0)
|
|
57
|
+
why = 'there is no kind';
|
|
58
|
+
else if (!kind)
|
|
59
|
+
why = 'the kind before the colon is empty';
|
|
60
|
+
throw new ReferenceSyntaxError(`${flag} must be <kind>:<id-or-uri> or a URL, ${exports.REFERENCE_SYNTAX_EXAMPLES} ` +
|
|
61
|
+
`(got "${raw}": ${why}).`);
|
|
62
|
+
}
|
|
63
|
+
return isUriValue(value) ? { kind, uri: value } : { kind, id: value };
|
|
64
|
+
}
|
|
65
|
+
/** {@link parseReference} for every value of a repeatable flag; an absent flag is `[]`. */
|
|
66
|
+
function parseReferences(raws, flag) {
|
|
67
|
+
return (raws ?? []).map((raw) => parseReference(raw, flag));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The entries of an `evidenceRefs` array written by hand in JSON, with each STRING entry turned
|
|
71
|
+
* into the object the server takes: a URL, or `<kind>:<id-or-uri>`. Anything that is not a string
|
|
72
|
+
* passes through untouched, because the server is the validator of the object form.
|
|
73
|
+
*
|
|
74
|
+
* A string that is neither is refused here, naming its index, so the first attempt does not
|
|
75
|
+
* travel to the server to learn the shape (`data.evidenceRefs.0: expected object, received
|
|
76
|
+
* string`).
|
|
77
|
+
*/
|
|
78
|
+
function liftReferenceEntries(entries, field) {
|
|
79
|
+
return entries.map((entry, index) => {
|
|
80
|
+
if (typeof entry !== 'string')
|
|
81
|
+
return entry;
|
|
82
|
+
try {
|
|
83
|
+
return parseReference(entry, `${field}[${index}]`);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
throw new ReferenceSyntaxError(`${field}[${index}] is "${entry}", which is not a reference. An entry is an object ` +
|
|
87
|
+
'{"kind":"…","id":"…"} or {"kind":"…","uri":"…"} (label optional), a URL, or a ' +
|
|
88
|
+
`"<kind>:<id-or-uri>" string, ${exports.REFERENCE_SYNTAX_EXAMPLES}.`);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
@@ -139,6 +139,12 @@ function detectExternalTool(env = process.env) {
|
|
|
139
139
|
if (claudeCode && claudeCode !== '0' && claudeCode !== 'false') {
|
|
140
140
|
return 'claude-code';
|
|
141
141
|
}
|
|
142
|
+
// Codex marks the commands it runs in its sandbox (`CODEX_SANDBOX=seatbelt` on macOS,
|
|
143
|
+
// `CODEX_SANDBOX_NETWORK_DISABLED=1` when the network is off). A full-access Codex sets
|
|
144
|
+
// neither, so this finds some Codex shells, not all: a hint, and its absence proves nothing.
|
|
145
|
+
if (envValue(env, 'CODEX_SANDBOX') || envValue(env, 'CODEX_SANDBOX_NETWORK_DISABLED')) {
|
|
146
|
+
return 'codex';
|
|
147
|
+
}
|
|
142
148
|
return null;
|
|
143
149
|
}
|
|
144
150
|
function envFirst(env, names) {
|
|
@@ -58,6 +58,6 @@ export declare function reopenRequiredLines({ bin, task, command, }: {
|
|
|
58
58
|
task: string;
|
|
59
59
|
command: 'result submit' | 'complete';
|
|
60
60
|
}): string[];
|
|
61
|
-
/** `met (agent)
|
|
61
|
+
/** `met (agent)`, `met (person via CLI credential)` — shared with the web through data-provider. */
|
|
62
62
|
export { describeAssessorKind as describeAssessor } from '@skrr-ai/data-provider';
|
|
63
63
|
export { describeClosure as closureSnapshotLines, type TaskClosureSnapshot as ClosureSnapshot, } from '@skrr-ai/data-provider';
|
package/dist/lib/task-closure.js
CHANGED
|
@@ -130,7 +130,7 @@ function reopenRequiredLines({ bin, task, command, }) {
|
|
|
130
130
|
: `→ Then submit again, or submit and close in one step: ${bin} tasks complete ${task} --summary "…"`,
|
|
131
131
|
];
|
|
132
132
|
}
|
|
133
|
-
/** `met (agent)
|
|
133
|
+
/** `met (agent)`, `met (person via CLI credential)` — shared with the web through data-provider. */
|
|
134
134
|
var data_provider_2 = require("@skrr-ai/data-provider");
|
|
135
135
|
Object.defineProperty(exports, "describeAssessor", { enumerable: true, get: function () { return data_provider_2.describeAssessorKind; } });
|
|
136
136
|
function truncate(value, max) {
|
|
@@ -1,13 +1,35 @@
|
|
|
1
|
+
/** The fields of a Task that decide which assignment command fixes it. */
|
|
2
|
+
export type TaskAssignmentState = {
|
|
3
|
+
executionMode?: unknown;
|
|
4
|
+
assigneeAgentIds?: unknown;
|
|
5
|
+
assigneeUserIds?: unknown;
|
|
6
|
+
};
|
|
7
|
+
/** One command that carries out a server-declared action, and what it does when there is a choice. */
|
|
8
|
+
export type TaskActionRemedy = {
|
|
9
|
+
command: string;
|
|
10
|
+
what?: string;
|
|
11
|
+
};
|
|
12
|
+
type TaskActionContext = {
|
|
13
|
+
allowedActions?: ReadonlyArray<{
|
|
14
|
+
action: string;
|
|
15
|
+
}>;
|
|
16
|
+
/** The Task itself, when the caller has it. Without it, `assign_task` lists every way to assign. */
|
|
17
|
+
task?: TaskAssignmentState;
|
|
18
|
+
};
|
|
1
19
|
/**
|
|
2
20
|
* Documentation and display paths only. The server still owns allowedActions.
|
|
3
21
|
*
|
|
4
22
|
* `skrr tasks guide`'s command map retired into the tasks guide's `commands`
|
|
5
23
|
* section (`skrr guide tasks commands`), the one copy every surface reads;
|
|
6
|
-
* what remains here is the action→command remedies preflight and
|
|
24
|
+
* what remains here is the action→command remedies `tasks show`, preflight and
|
|
7
25
|
* actionability render into server-declared allowedActions.
|
|
26
|
+
*
|
|
27
|
+
* Most actions have one command. `assign_task` can have several (see
|
|
28
|
+
* `assignTaskRemedies`), so a renderer lists every entry, not only the first.
|
|
8
29
|
*/
|
|
9
|
-
export declare function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
30
|
+
export declare function taskActionRemedies(action: string, taskId: string, targetId: string | undefined, bin?: string, context?: TaskActionContext): TaskActionRemedy[];
|
|
31
|
+
/** One row per remedy: the command, then what it does, with the notes lined up. */
|
|
32
|
+
export declare function taskActionRemedyRows(remedies: readonly TaskActionRemedy[]): string[];
|
|
33
|
+
/** The first command for an action. A renderer should list `taskActionRemedies` instead. */
|
|
34
|
+
export declare function taskActionCommand(action: string, taskId: string, targetId: string | undefined, bin?: string, context?: TaskActionContext): string | undefined;
|
|
35
|
+
export {};
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taskActionRemedies = taskActionRemedies;
|
|
4
|
+
exports.taskActionRemedyRows = taskActionRemedyRows;
|
|
3
5
|
exports.taskActionCommand = taskActionCommand;
|
|
6
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
4
7
|
const shell_quote_1 = require("./shell-quote");
|
|
5
8
|
/**
|
|
6
9
|
* Documentation and display paths only. The server still owns allowedActions.
|
|
7
10
|
*
|
|
8
11
|
* `skrr tasks guide`'s command map retired into the tasks guide's `commands`
|
|
9
12
|
* section (`skrr guide tasks commands`), the one copy every surface reads;
|
|
10
|
-
* what remains here is the action→command remedies preflight and
|
|
13
|
+
* what remains here is the action→command remedies `tasks show`, preflight and
|
|
11
14
|
* actionability render into server-declared allowedActions.
|
|
15
|
+
*
|
|
16
|
+
* Most actions have one command. `assign_task` can have several (see
|
|
17
|
+
* `assignTaskRemedies`), so a renderer lists every entry, not only the first.
|
|
12
18
|
*/
|
|
13
|
-
function
|
|
19
|
+
function taskActionRemedies(action, taskId, targetId, bin = 'skrr', context = {}) {
|
|
14
20
|
const task = (0, shell_quote_1.shellQuoteArg)(taskId);
|
|
15
21
|
const target = targetId ? (0, shell_quote_1.shellQuoteArg)(targetId) : '<id>';
|
|
22
|
+
if (action === 'assign_task') {
|
|
23
|
+
return assignTaskRemedies(task, context.task).map((remedy) => ({
|
|
24
|
+
...remedy,
|
|
25
|
+
command: `${bin} ${remedy.command}`,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
16
28
|
const commands = {
|
|
17
29
|
answer_human_input: `tasks input answer ${task} --request ${target} --text <answer>`,
|
|
18
|
-
assign_task: `tasks assign ${task} --help`,
|
|
19
30
|
// Managed work already has a current Result. Its server-declared
|
|
20
31
|
// continuation surface distinguishes closing from submitting a new Result.
|
|
21
32
|
complete_task: context.allowedActions?.some((item) => item.action === 'continue_task')
|
|
@@ -36,5 +47,67 @@ function taskActionCommand(action, taskId, targetId, bin = 'skrr', context = {})
|
|
|
36
47
|
triage_task: `tasks triage ${task}`,
|
|
37
48
|
unschedule_task: `tasks unschedule ${task}`,
|
|
38
49
|
};
|
|
39
|
-
return commands[action] ? `${bin} ${commands[action]}` :
|
|
50
|
+
return commands[action] ? [{ command: `${bin} ${commands[action]}` }] : [];
|
|
51
|
+
}
|
|
52
|
+
/** One row per remedy: the command, then what it does, with the notes lined up. */
|
|
53
|
+
function taskActionRemedyRows(remedies) {
|
|
54
|
+
const width = Math.max(0, ...remedies.filter((r) => r.what).map((r) => r.command.length));
|
|
55
|
+
return remedies.map(({ command, what }) => what ? `${command.padEnd(width)} ${what}` : command);
|
|
56
|
+
}
|
|
57
|
+
/** The first command for an action. A renderer should list `taskActionRemedies` instead. */
|
|
58
|
+
function taskActionCommand(action, taskId, targetId, bin = 'skrr', context = {}) {
|
|
59
|
+
return taskActionRemedies(action, taskId, targetId, bin, context)[0]?.command;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The commands that answer `assign_task`.
|
|
63
|
+
*
|
|
64
|
+
* The server says "Choose an executor and assignee" (or, for a started Task,
|
|
65
|
+
* "has no assigned executor") and this used to point at `tasks assign --help`,
|
|
66
|
+
* so the reader learned what was missing and not how to supply it (OSK-24355).
|
|
67
|
+
*
|
|
68
|
+
* Assigning settles both halves: when no executor was declared, the server
|
|
69
|
+
* records the assignee's kind as the executor. `tasks update --execution-mode`
|
|
70
|
+
* sets the executor without assigning anyone. When an executor WAS declared,
|
|
71
|
+
* only an assignee of that kind is needed, or the executor can be switched to
|
|
72
|
+
* the kind already assigned.
|
|
73
|
+
*/
|
|
74
|
+
function assignTaskRemedies(task, state) {
|
|
75
|
+
const agent = { command: `tasks assign ${task} --agent <agent>`, what: 'an Agent does it' };
|
|
76
|
+
const person = { command: `tasks assign ${task} <person>`, what: 'a person does it' };
|
|
77
|
+
const executor = state ? (0, data_provider_1.resolveTaskExecutor)(state) : null;
|
|
78
|
+
if (executor?.source === 'declared') {
|
|
79
|
+
const hasUsers = hasIds(state?.assigneeUserIds);
|
|
80
|
+
const hasAgents = hasIds(state?.assigneeAgentIds);
|
|
81
|
+
if (executor.mode === 'agent') {
|
|
82
|
+
return hasUsers
|
|
83
|
+
? [
|
|
84
|
+
agent,
|
|
85
|
+
{
|
|
86
|
+
command: `tasks update ${task} --execution-mode human`,
|
|
87
|
+
what: 'the assigned person does it',
|
|
88
|
+
},
|
|
89
|
+
]
|
|
90
|
+
: [agent];
|
|
91
|
+
}
|
|
92
|
+
return hasAgents
|
|
93
|
+
? [
|
|
94
|
+
person,
|
|
95
|
+
{
|
|
96
|
+
command: `tasks update ${task} --execution-mode agent`,
|
|
97
|
+
what: 'the assigned Agent does it',
|
|
98
|
+
},
|
|
99
|
+
]
|
|
100
|
+
: [person];
|
|
101
|
+
}
|
|
102
|
+
return [
|
|
103
|
+
agent,
|
|
104
|
+
person,
|
|
105
|
+
{
|
|
106
|
+
command: `tasks update ${task} --execution-mode <agent|human>`,
|
|
107
|
+
what: 'choose the executor only',
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
function hasIds(values) {
|
|
112
|
+
return Array.isArray(values) && values.some(Boolean);
|
|
40
113
|
}
|
|
@@ -135,10 +135,15 @@ function taskPreflightLines(report, bin = 'skrr') {
|
|
|
135
135
|
if (a.actorRefs?.length)
|
|
136
136
|
lines.push(`Eligible actors: ${a.actorRefs.map((ref) => `${ref.kind}:${ref.id}`).join(', ')}`);
|
|
137
137
|
for (const action of a.allowedActions) {
|
|
138
|
-
const
|
|
138
|
+
const rows = (0, task_operations_1.taskActionRemedyRows)((0, task_operations_1.taskActionRemedies)(action.action, report.taskId, action.targetId, bin, {
|
|
139
139
|
allowedActions: a.allowedActions,
|
|
140
|
-
});
|
|
141
|
-
|
|
140
|
+
}));
|
|
141
|
+
if (rows.length === 0)
|
|
142
|
+
lines.push(` ${action.action} (no single CLI remedy is mapped)`);
|
|
143
|
+
// An action with more than one command (assign_task) lists each under the first.
|
|
144
|
+
rows.forEach((row, index) => lines.push(index === 0
|
|
145
|
+
? ` ${action.action} → ${row}`
|
|
146
|
+
: ` ${' '.repeat(action.action.length)} ${row}`));
|
|
142
147
|
}
|
|
143
148
|
lines.push('Allowed actions describe the workflow; the caller must still have permission to perform them.');
|
|
144
149
|
}
|