@skrr-ai/cli 0.1.215 → 0.1.216
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/commands/agent/message/no-reply.d.ts +4 -0
- package/dist/commands/agent/message/no-reply.js +5 -1
- package/dist/commands/agents/always-on/recovery-review.d.ts +12 -0
- package/dist/commands/agents/always-on/recovery-review.js +52 -2
- package/dist/commands/agents/permissions/list.d.ts +12 -0
- package/dist/commands/agents/permissions/list.js +42 -0
- package/dist/commands/agents/permissions/remove.d.ts +15 -0
- package/dist/commands/agents/permissions/remove.js +68 -0
- package/dist/commands/dm/work.js +2 -0
- package/dist/commands/duties/action-proposal.js +7 -1
- package/dist/commands/duties/action-proposals.d.ts +9 -0
- package/dist/commands/duties/action-proposals.js +30 -12
- package/dist/commands/duties/pause.js +20 -2
- package/dist/commands/duties/trigger-status.js +6 -1
- package/dist/commands/duties/update.js +22 -7
- package/dist/commands/tasks/chat/index.d.ts +11 -0
- package/dist/commands/tasks/chat/index.js +27 -0
- package/dist/commands/tasks/input/answer.d.ts +12 -0
- package/dist/commands/tasks/input/answer.js +59 -5
- package/dist/commands/tasks/operations/show.js +5 -6
- package/dist/commands/tasks/result/show.js +2 -4
- package/dist/commands/tasks/retry-receipt.js +1 -3
- package/dist/generated/agent-guides.json +24 -24
- package/dist/lib/compasses.d.ts +5 -0
- package/dist/lib/compasses.js +6 -1
- package/dist/lib/duties.d.ts +27 -0
- package/dist/lib/duties.js +81 -14
- package/dist/lib/permission-rules.d.ts +18 -0
- package/dist/lib/permission-rules.js +62 -0
- package/dist/lib/task-extras.d.ts +19 -0
- package/dist/lib/task-extras.js +13 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +12676 -12061
- package/oclif.manifest.json +200 -3
- package/package.json +5 -2
|
@@ -4,6 +4,10 @@ import { BaseCommand } from '../../../base-command';
|
|
|
4
4
|
* acknowledged something, or the work speaks for itself. The server records it on the turn
|
|
5
5
|
* (`declared_silent`), and the turn's marker still shows that the turn happened.
|
|
6
6
|
*
|
|
7
|
+
* In a scheduled wake (an autonomous session: a heartbeat, check-in or watch) the same command
|
|
8
|
+
* declares that the wake needs no message. The server records it on the wake's Run, bound to the
|
|
9
|
+
* attempt it resolves from the session, and the scheduled executor reads it after the turn.
|
|
10
|
+
*
|
|
7
11
|
* Only inside a daemon session, for that session's own running turn: the server proves the
|
|
8
12
|
* turn from the session token, exactly as it does for a send.
|
|
9
13
|
*/
|
|
@@ -10,11 +10,15 @@ const message_intent_1 = require("../../../lib/message-intent");
|
|
|
10
10
|
* acknowledged something, or the work speaks for itself. The server records it on the turn
|
|
11
11
|
* (`declared_silent`), and the turn's marker still shows that the turn happened.
|
|
12
12
|
*
|
|
13
|
+
* In a scheduled wake (an autonomous session: a heartbeat, check-in or watch) the same command
|
|
14
|
+
* declares that the wake needs no message. The server records it on the wake's Run, bound to the
|
|
15
|
+
* attempt it resolves from the session, and the scheduled executor reads it after the turn.
|
|
16
|
+
*
|
|
13
17
|
* Only inside a daemon session, for that session's own running turn: the server proves the
|
|
14
18
|
* turn from the session token, exactly as it does for a send.
|
|
15
19
|
*/
|
|
16
20
|
class AgentMessageNoReply extends base_command_1.BaseCommand {
|
|
17
|
-
static description = 'Declare that this
|
|
21
|
+
static description = 'Declare that this turn needs no message: in an interactive turn, none in Main Chat (recorded on the turn; Main Chat does not act on it yet); in a scheduled wake (heartbeat, check-in, watch), that the wake stays silent (recorded on its run, replacing the HEARTBEAT_SILENT word). Only inside a daemon session, for its own running turn';
|
|
18
22
|
static examples = ['<%= config.bin %> agent message no-reply'];
|
|
19
23
|
static flags = {
|
|
20
24
|
json: core_1.Flags.boolean({
|
|
@@ -47,3 +47,15 @@ export declare function autoRecoveryLines(review: DutyRunRecoveryReview): string
|
|
|
47
47
|
* sent. Nothing for a Run with no record, or an older server.
|
|
48
48
|
*/
|
|
49
49
|
export declare function unprovenLine(review: DutyRunRecoveryReview): string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* The Run's stored status, and what it means while held (OSK-33272). A held Run's record stays `running` on purpose:
|
|
52
|
+
* nothing may finish it but its owner's close, and later Checks wait on it. `Status: running` beside
|
|
53
|
+
* `Executor: quiescent` read as a turn still working, so the line says it is held, and whether its turn has stopped.
|
|
54
|
+
*/
|
|
55
|
+
export declare function statusText(review: DutyRunRecoveryReview): string;
|
|
56
|
+
/**
|
|
57
|
+
* Why the result is held, as its hold writer recorded it (OSK-33272), and what to do next. A reason or cause this CLI
|
|
58
|
+
* has no words for is printed as the code, marked. A Run stopped at its effect boundary says why on its own line
|
|
59
|
+
* (`unprovenLine`), so nothing here. An older server names no reason: say so, never fall silent.
|
|
60
|
+
*/
|
|
61
|
+
export declare function heldBecauseLines(review: DutyRunRecoveryReview): string[];
|
|
@@ -5,6 +5,8 @@ exports.recoveryCode = recoveryCode;
|
|
|
5
5
|
exports.closeLines = closeLines;
|
|
6
6
|
exports.autoRecoveryLines = autoRecoveryLines;
|
|
7
7
|
exports.unprovenLine = unprovenLine;
|
|
8
|
+
exports.statusText = statusText;
|
|
9
|
+
exports.heldBecauseLines = heldBecauseLines;
|
|
8
10
|
const core_1 = require("@oclif/core");
|
|
9
11
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
10
12
|
const base_command_1 = require("../../../base-command");
|
|
@@ -98,8 +100,10 @@ class AgentsAlwaysOnRecoveryReview extends base_command_1.BaseCommand {
|
|
|
98
100
|
this.log(`Run: ${review.runId}`);
|
|
99
101
|
if (review.source === 'unverified')
|
|
100
102
|
this.log("Duty: not shown; this run's link to its Duty could not be verified");
|
|
101
|
-
this.log(`Status: ${review
|
|
103
|
+
this.log(`Status: ${statusText(review)}; generation: ${review.generation ?? 'unknown'}; attempt: ${review.attempt ?? 'unknown'}`);
|
|
102
104
|
this.log(`Recovery: ${recoveryCode(review.hold, exports.RECOVERY_HOLD_CODES)}; stored result: ${review.result}`);
|
|
105
|
+
for (const line of heldBecauseLines(review))
|
|
106
|
+
this.log(line);
|
|
103
107
|
this.log(`Executor: ${recoveryCode(review.executor, exports.RECOVERY_EXECUTOR_CODES)}; effects: ${review.effects}`);
|
|
104
108
|
const basis = stopBasisLine(review);
|
|
105
109
|
if (basis)
|
|
@@ -308,19 +312,65 @@ function unprovenLine(review) {
|
|
|
308
312
|
...workspace,
|
|
309
313
|
].join(' ');
|
|
310
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* The Run's stored status, and what it means while held (OSK-33272). A held Run's record stays `running` on purpose:
|
|
317
|
+
* nothing may finish it but its owner's close, and later Checks wait on it. `Status: running` beside
|
|
318
|
+
* `Executor: quiescent` read as a turn still working, so the line says it is held, and whether its turn has stopped.
|
|
319
|
+
*/
|
|
320
|
+
function statusText(review) {
|
|
321
|
+
if (review.hold !== 'review_required' || review.status !== 'running')
|
|
322
|
+
return review.status;
|
|
323
|
+
if (review.executor === 'quiescent')
|
|
324
|
+
return 'running (held for review; its turn has stopped)';
|
|
325
|
+
if (review.executor === 'stop_unconfirmed')
|
|
326
|
+
return 'running (held for review; its turn is not confirmed stopped)';
|
|
327
|
+
return 'running (held for review)';
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Why the result is held, as its hold writer recorded it (OSK-33272), and what to do next. A reason or cause this CLI
|
|
331
|
+
* has no words for is printed as the code, marked. A Run stopped at its effect boundary says why on its own line
|
|
332
|
+
* (`unprovenLine`), so nothing here. An older server names no reason: say so, never fall silent.
|
|
333
|
+
*/
|
|
334
|
+
function heldBecauseLines(review) {
|
|
335
|
+
if (review.hold !== 'review_required' || review.effectReceipts !== undefined)
|
|
336
|
+
return [];
|
|
337
|
+
const reason = isNonEmptyString(review.holdReason) ? review.holdReason : undefined;
|
|
338
|
+
if (!reason)
|
|
339
|
+
return ['Held because: not reported by this server.'];
|
|
340
|
+
const words = (0, data_provider_1.describeDutyResultHoldReason)(reason);
|
|
341
|
+
const lines = [
|
|
342
|
+
`Held because: ${words ? `${reason}. ${words}` : recoveryCode(reason, data_provider_1.DUTY_RESULT_HOLD_REASONS)}`,
|
|
343
|
+
];
|
|
344
|
+
const cause = isNonEmptyString(review.holdCause) ? review.holdCause : undefined;
|
|
345
|
+
const remedy = cause ? (0, data_provider_1.describeRunFailureRemedy)(cause) : null;
|
|
346
|
+
if (cause) {
|
|
347
|
+
const causeWords = Object.hasOwn(data_provider_1.DUTY_RESULT_HOLD_CAUSE_SENTENCES, cause)
|
|
348
|
+
? data_provider_1.DUTY_RESULT_HOLD_CAUSE_SENTENCES[cause]
|
|
349
|
+
: undefined;
|
|
350
|
+
lines.push(`Cause: ${causeWords ? `${cause}. ${causeWords}` : cause}`);
|
|
351
|
+
}
|
|
352
|
+
lines.push(`Next: ${remedy ? `${remedy.replace(/\.?$/, '.')} Then: ` : ''}${data_provider_1.DUTY_RESULT_HOLD_NEXT_STEP}`);
|
|
353
|
+
return lines;
|
|
354
|
+
}
|
|
311
355
|
/** One line per held result: what a person needs to choose which one to open. */
|
|
312
356
|
function reviewLine(review) {
|
|
313
357
|
const stored = review.resultCapture === 'unsealable'
|
|
314
358
|
? `${review.result} (could not be sealed)`
|
|
315
359
|
: review.result;
|
|
360
|
+
const reason = isNonEmptyString(review.holdReason)
|
|
361
|
+
? `held because: ${recoveryCode(review.holdReason, data_provider_1.DUTY_RESULT_HOLD_REASONS)}${isNonEmptyString(review.holdCause) ? ` (${review.holdCause})` : ''}`
|
|
362
|
+
: '';
|
|
316
363
|
return [
|
|
317
364
|
review.runId,
|
|
318
365
|
review.source === 'unverified' ? 'duty unverified' : `duty ${review.dutyId ?? 'unknown'}`,
|
|
319
366
|
`recovery: ${recoveryCode(review.hold, exports.RECOVERY_HOLD_CODES)}`,
|
|
367
|
+
reason,
|
|
320
368
|
`stored result: ${stored}`,
|
|
321
369
|
`run status: ${review.status}`,
|
|
322
370
|
`attempt: ${review.attempt ?? 'unknown'}`,
|
|
323
|
-
]
|
|
371
|
+
]
|
|
372
|
+
.filter(Boolean)
|
|
373
|
+
.join(' ');
|
|
324
374
|
}
|
|
325
375
|
const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
|
|
326
376
|
function parseReviewPage(value) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export default class AgentsPermissionsList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
agentId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const permission_rules_1 = require("../../../lib/permission-rules");
|
|
7
|
+
class AgentsPermissionsList extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'List the "Always allow" rules you granted this agent: what each covers, where it applies, where you granted it from, and how often it has run. Calls a rule covers run without asking you. Only your own rules are listed. Rules are granted on a permission card, never from the CLI.';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> agents permissions list <agent-id>',
|
|
11
|
+
'<%= config.bin %> agents permissions list <agent-id> --json',
|
|
12
|
+
];
|
|
13
|
+
static args = { agentId: core_1.Args.string({ required: true, ignoreStdin: true }) };
|
|
14
|
+
static flags = { json: core_1.Flags.boolean({ description: 'Output JSON' }) };
|
|
15
|
+
async run() {
|
|
16
|
+
this.requireAuth();
|
|
17
|
+
const { args, flags } = await this.parse(AgentsPermissionsList);
|
|
18
|
+
let result;
|
|
19
|
+
try {
|
|
20
|
+
result = await data_provider_1.dataService.listAgentPermissionRules(args.agentId);
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
this.handleApiError(err);
|
|
24
|
+
}
|
|
25
|
+
const rules = result.rules ?? [];
|
|
26
|
+
if (flags.json)
|
|
27
|
+
return this.log(this.agentJson(args.agentId, { rules }));
|
|
28
|
+
if (rules.length === 0) {
|
|
29
|
+
this.log(`Agent ${args.agentId}: no Always allow rules. It asks you before each call.`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.log(`Agent ${args.agentId}: ${rules.length === 1 ? '1 Always allow rule' : `${rules.length} Always allow rules`}`);
|
|
33
|
+
for (const rule of rules) {
|
|
34
|
+
this.log('');
|
|
35
|
+
for (const line of (0, permission_rules_1.ruleLines)(rule))
|
|
36
|
+
this.log(line);
|
|
37
|
+
}
|
|
38
|
+
this.log('');
|
|
39
|
+
this.log(`Remove one: ${this.config.bin} agents permissions remove ${args.agentId} <rule-id>`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = AgentsPermissionsList;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export default class AgentsPermissionsRemove extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
agentId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
ruleId: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const prompt_1 = require("../../../lib/prompt");
|
|
7
|
+
class AgentsPermissionsRemove extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'Remove one of your "Always allow" rules for this agent, or all of them with --all. The next call a removed rule covered asks you again. This only takes permission away: rules are granted on a permission card, never from the CLI.';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> agents permissions remove <agent-id> <rule-id>',
|
|
11
|
+
'<%= config.bin %> agents permissions remove <agent-id> --all',
|
|
12
|
+
'<%= config.bin %> agents permissions remove <agent-id> --all --yes',
|
|
13
|
+
];
|
|
14
|
+
static args = {
|
|
15
|
+
agentId: core_1.Args.string({ required: true, ignoreStdin: true }),
|
|
16
|
+
ruleId: core_1.Args.string({
|
|
17
|
+
required: false,
|
|
18
|
+
ignoreStdin: true,
|
|
19
|
+
description: 'The rule to remove (from `agents permissions list`)',
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
static flags = {
|
|
23
|
+
all: core_1.Flags.boolean({ description: 'Remove every rule you granted this agent: always ask' }),
|
|
24
|
+
yes: core_1.Flags.boolean({ char: 'y', description: 'Skip the confirmation for --all' }),
|
|
25
|
+
json: core_1.Flags.boolean({ description: 'Output JSON' }),
|
|
26
|
+
};
|
|
27
|
+
async run() {
|
|
28
|
+
this.requireAuth();
|
|
29
|
+
const { args, flags } = await this.parse(AgentsPermissionsRemove);
|
|
30
|
+
const all = Boolean(flags.all);
|
|
31
|
+
if (Boolean(args.ruleId) === all) {
|
|
32
|
+
this.error('Name one rule to remove, or pass --all to remove every rule.', { exit: 2 });
|
|
33
|
+
}
|
|
34
|
+
let result;
|
|
35
|
+
if (all) {
|
|
36
|
+
const ok = await (0, prompt_1.confirmDestructive)(`Remove every Always allow rule you granted agent ${args.agentId}? It will ask you before each call again.`, flags.yes);
|
|
37
|
+
if (!ok) {
|
|
38
|
+
this.log('Nothing removed.');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
result = await data_provider_1.dataService.revokeAllAgentPermissionRules(args.agentId);
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
this.handleApiError(err);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
try {
|
|
50
|
+
result = await data_provider_1.dataService.revokeAgentPermissionRule(args.agentId, args.ruleId);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
this.handleApiError(err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const revoked = result.revoked ?? 0;
|
|
57
|
+
if (flags.json)
|
|
58
|
+
return this.log(this.agentJson(args.agentId, { revoked }));
|
|
59
|
+
if (all) {
|
|
60
|
+
this.log(revoked === 0
|
|
61
|
+
? `Agent ${args.agentId}: you had no Always allow rules. It asks you before each call.`
|
|
62
|
+
: `Agent ${args.agentId}: removed ${revoked === 1 ? '1 rule' : `${revoked} rules`}. It asks you before each call again.`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.log(`Agent ${args.agentId}: rule ${args.ruleId} removed. The next call it covered asks you again.`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.default = AgentsPermissionsRemove;
|
package/dist/commands/dm/work.js
CHANGED
|
@@ -71,6 +71,8 @@ class DmWork extends base_command_1.BaseCommand {
|
|
|
71
71
|
const handling = (0, data_provider_1.readCoordinatorSignalReason)(task.lastReturn?.reason);
|
|
72
72
|
if (task.lastReturn && handling) {
|
|
73
73
|
this.log(` Last update (${task.lastReturn.kind.replaceAll('_', ' ')}): ${(0, data_provider_1.describeCoordinatorHandling)(handling)}`);
|
|
74
|
+
if (handling.outcome === 'held' && task.lastReturn.heldText)
|
|
75
|
+
this.log(` Held message: ${task.lastReturn.heldText}`);
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
this.log(`${page.items.length} shown; ${page.total} authorized Task(s)${page.hasMore ? `; next cursor ${page.nextCursor}` : ''}.`);
|
|
@@ -41,7 +41,13 @@ class DutiesActionProposal extends base_command_1.BaseCommand {
|
|
|
41
41
|
this.log(`Action Bundle: ${proposal?.status ? (0, action_proposals_1.proposalStatusLabel)(proposal) : 'unknown'}`);
|
|
42
42
|
this.log(`Operation: ${String(execution?.operationId || 'unavailable')}`);
|
|
43
43
|
const receipt = execution?.receipt;
|
|
44
|
-
|
|
44
|
+
// A void bundle's receipt still reads `accepted`, because its status is still held (OSK-33446). Say
|
|
45
|
+
// beside it that the plan will not run, and that its expiry and reminders no longer apply.
|
|
46
|
+
const isVoid = proposal ? (0, action_proposals_1.proposalVoidedBy)(proposal) !== undefined : false;
|
|
47
|
+
this.log(`Receipt: ${String(receipt?.state || 'unknown')}${isVoid ? ' (void: will not run)' : ''}`);
|
|
48
|
+
if (isVoid) {
|
|
49
|
+
this.log("Expiry and reminders: not applicable; the Duty's next check can propose the work again.");
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* Why a held bundle can never be approved or run, or `undefined` when it is not void. The server keeps
|
|
4
|
+
* `status` at `proposed` or `approved` and adds `voidedBy`, so this, not `status`, says whether a decision
|
|
5
|
+
* or a run is still possible (OSK-33415). Only a held bundle can be void: a finished one keeps its status.
|
|
6
|
+
*/
|
|
7
|
+
export declare function proposalVoidedBy(proposal: {
|
|
8
|
+
status?: unknown;
|
|
9
|
+
voidedBy?: unknown;
|
|
10
|
+
}): string | undefined;
|
|
2
11
|
/**
|
|
3
12
|
* An approved bundle waiting out the owner's quiet hours reads as held, with
|
|
4
13
|
* the instant it sends, never as a bare `approved` that looks stuck.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.proposalVoidedBy = proposalVoidedBy;
|
|
3
4
|
exports.proposalStatusLabel = proposalStatusLabel;
|
|
4
5
|
const core_1 = require("@oclif/core");
|
|
5
6
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
@@ -11,14 +12,26 @@ const VOIDED_BY_LABEL = {
|
|
|
11
12
|
duty_not_active: 'void: Duty not active',
|
|
12
13
|
duty_version_changed: 'void: Duty changed since',
|
|
13
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Why a held bundle can never be approved or run, or `undefined` when it is not void. The server keeps
|
|
17
|
+
* `status` at `proposed` or `approved` and adds `voidedBy`, so this, not `status`, says whether a decision
|
|
18
|
+
* or a run is still possible (OSK-33415). Only a held bundle can be void: a finished one keeps its status.
|
|
19
|
+
*/
|
|
20
|
+
function proposalVoidedBy(proposal) {
|
|
21
|
+
if (typeof proposal.voidedBy !== 'string' || !proposal.voidedBy)
|
|
22
|
+
return undefined;
|
|
23
|
+
return proposal.status === 'proposed' || proposal.status === 'approved'
|
|
24
|
+
? proposal.voidedBy
|
|
25
|
+
: undefined;
|
|
26
|
+
}
|
|
14
27
|
/**
|
|
15
28
|
* An approved bundle waiting out the owner's quiet hours reads as held, with
|
|
16
29
|
* the instant it sends, never as a bare `approved` that looks stuck.
|
|
17
30
|
*/
|
|
18
31
|
function proposalStatusLabel(proposal) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
const voidedBy = proposalVoidedBy(proposal);
|
|
33
|
+
if (voidedBy)
|
|
34
|
+
return VOIDED_BY_LABEL[voidedBy] || `void: ${voidedBy}`;
|
|
22
35
|
const hold = proposal.executionReceipt?.hold;
|
|
23
36
|
if (proposal.status === 'approved' && hold?.until) {
|
|
24
37
|
return `held until ${hold.untilLabel || hold.until}`;
|
|
@@ -66,15 +79,20 @@ class DutiesActionProposals extends base_command_1.BaseCommand {
|
|
|
66
79
|
for (const peer of proposal.overlaps || [])
|
|
67
80
|
this.log(`${proposal.id} overlaps ${peer.proposalId} (${peer.agentId}) ${peer.repoFullName}: ${peer.paths.join(', ')}`);
|
|
68
81
|
}
|
|
69
|
-
(0, format_1.renderTable)(response.data.map((proposal) =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
(0, format_1.renderTable)(response.data.map((proposal) => {
|
|
83
|
+
// A void bundle will never run, so its expiry and its approver reminders no longer apply
|
|
84
|
+
// (OSK-33446): showing them would read as a decision still waiting on someone.
|
|
85
|
+
const isVoid = proposalVoidedBy(proposal) !== undefined;
|
|
86
|
+
return {
|
|
87
|
+
id: proposal.id,
|
|
88
|
+
actions: String(proposal.actionSnapshots?.length || 1),
|
|
89
|
+
digest: proposal.snapshotDigest || 'legacy',
|
|
90
|
+
status: proposalStatusLabel(proposal),
|
|
91
|
+
attempt: `${proposal.attempt || 0}/${proposal.maxAttempts || 3}`,
|
|
92
|
+
expires: isVoid ? '—' : proposal.expiresAt || '—',
|
|
93
|
+
notices: isVoid ? '—' : (0, data_provider_1.describeProposalNotices)(proposal.notices),
|
|
94
|
+
};
|
|
95
|
+
}), [
|
|
78
96
|
{ key: 'id', header: 'PROPOSAL', verbatim: true },
|
|
79
97
|
{ key: 'actions', header: 'ACTIONS' },
|
|
80
98
|
{ key: 'digest', header: 'DIGEST', maxWidth: 64, verbatim: true },
|
|
@@ -29,8 +29,26 @@ class DutiesPause extends base_command_1.BaseCommand {
|
|
|
29
29
|
this.log(JSON.stringify((0, web_url_1.withDutyUrl)(this.cliConfig.baseURL, duty), null, 2));
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// A Duty that is already a full stop is not paused again (OSK-33447): the server writes nothing, so its
|
|
33
|
+
// version, and every proposal and approval pinned to it, stay as they were. Say that, rather than
|
|
34
|
+
// "Paused", which reads as a new stop. A Duty paused for new observation only is still written, since
|
|
35
|
+
// this pause also withdraws the work that pause let finish.
|
|
36
|
+
const outcome = duty;
|
|
37
|
+
const runningTurn = 'A turn already running may continue until it finishes or reaches its deadline.';
|
|
38
|
+
if (outcome.alreadyPaused !== true) {
|
|
39
|
+
this.log(`Paused duty ${args.id}.`);
|
|
40
|
+
this.log(`Stops new work. ${runningTurn}`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
let already = `Duty ${args.id} was already paused.`;
|
|
44
|
+
if (outcome.changed === false)
|
|
45
|
+
already += ' Nothing changed.';
|
|
46
|
+
else if (outcome.revokedExecution === true) {
|
|
47
|
+
already += ' This pause also revoked the authority of work accepted before it.';
|
|
48
|
+
}
|
|
49
|
+
this.log(already);
|
|
50
|
+
this.log(`New work stays stopped. ${runningTurn}`);
|
|
51
|
+
}
|
|
34
52
|
// The status write is the fence and it has landed. The teardown of the
|
|
35
53
|
// wake tree behind it is best-effort, and used to be silent — so a pause
|
|
36
54
|
// that left triggers live looked exactly like one that did not. Say which
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.safeTriggerStatus = safeTriggerStatus;
|
|
4
4
|
exports.formatTriggerStatus = formatTriggerStatus;
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
7
|
const base_command_1 = require("../../base-command");
|
|
7
8
|
const duties_1 = require("../../lib/duties");
|
|
8
9
|
const duty_event_wakes_1 = require("../../lib/duty-event-wakes");
|
|
@@ -143,7 +144,11 @@ function formatTriggerStatus(status) {
|
|
|
143
144
|
lines.push(`Recent fires (${fires.length}):`);
|
|
144
145
|
for (const fire of fires) {
|
|
145
146
|
lines.push(` ${fmtTime(fire.firedAt)} ${fire.outcome ?? '?'}` +
|
|
146
|
-
|
|
147
|
+
// A viewer who is not the Duty's owner is sent the marker in place of a prose reason
|
|
148
|
+
// (OSK-33457); say whose it is rather than print the marker.
|
|
149
|
+
(fire.reason
|
|
150
|
+
? ` — ${(0, data_provider_1.isDutyReasonWithheld)(fire.reason) ? '(owner only)' : fire.reason}`
|
|
151
|
+
: '') +
|
|
147
152
|
(fire.triggerId ? ` (${fire.triggerId})` : ''));
|
|
148
153
|
}
|
|
149
154
|
}
|
|
@@ -330,9 +330,13 @@ JSON
|
|
|
330
330
|
}
|
|
331
331
|
if (wantsCadence) {
|
|
332
332
|
if (flags['restore-saved-cadence']) {
|
|
333
|
-
if (flags.cadence !== undefined ||
|
|
334
|
-
flags
|
|
335
|
-
|
|
333
|
+
if (flags.cadence !== undefined ||
|
|
334
|
+
flags['cadence-mode'] !== undefined ||
|
|
335
|
+
flags.timezone !== undefined ||
|
|
336
|
+
payload.cadence !== undefined) {
|
|
337
|
+
this.error('--restore-saved-cadence cannot be combined with other cadence edits.', {
|
|
338
|
+
exit: 1,
|
|
339
|
+
});
|
|
336
340
|
}
|
|
337
341
|
if (current?.cadence?.mode !== 'manual' || !current?.savedCadence) {
|
|
338
342
|
this.error('There is no saved schedule to restore on this manual Duty. Run `skrr duties show` to inspect it.', { exit: 1 });
|
|
@@ -396,7 +400,8 @@ JSON
|
|
|
396
400
|
if (cadence.mode !== 'daily' && !Object.hasOwn(authoredCadence ?? {}, 'times')) {
|
|
397
401
|
delete cadence.times;
|
|
398
402
|
}
|
|
399
|
-
if (cadence.mode !== 'sampled' &&
|
|
403
|
+
if (cadence.mode !== 'sampled' &&
|
|
404
|
+
!Object.hasOwn(authoredCadence ?? {}, 'jitterRatio')) {
|
|
400
405
|
delete cadence.jitterRatio;
|
|
401
406
|
}
|
|
402
407
|
}
|
|
@@ -474,10 +479,16 @@ JSON
|
|
|
474
479
|
catch (err) {
|
|
475
480
|
this.handleApiError(err);
|
|
476
481
|
}
|
|
477
|
-
//
|
|
482
|
+
// An Agent's cadence change to a non-draft Duty is a request for the owner, not a write
|
|
483
|
+
// (OSK-33445): the answer says so, and its cadence is the one the Duty still has.
|
|
484
|
+
const cadenceRequest = (0, duties_1.readDutyCadenceRequest)(duty);
|
|
485
|
+
const pendingCadence = cadenceRequest?.status === 'awaiting_approval';
|
|
486
|
+
// A replacement edit is accepted as written; these say what it removed. A cadence still waiting
|
|
487
|
+
// for the owner removed nothing yet.
|
|
488
|
+
const { cadence: _pendingCadence, ...writtenPayload } = payload;
|
|
478
489
|
const warnings = (0, duties_1.dutyWriteWarnings)(duty, {
|
|
479
490
|
before: current,
|
|
480
|
-
payload,
|
|
491
|
+
payload: pendingCadence ? writtenPayload : payload,
|
|
481
492
|
});
|
|
482
493
|
if (flags.json) {
|
|
483
494
|
this.log(JSON.stringify((0, web_url_1.withDutyUrl)(this.cliConfig.baseURL, {
|
|
@@ -486,7 +497,11 @@ JSON
|
|
|
486
497
|
}), null, 2));
|
|
487
498
|
return;
|
|
488
499
|
}
|
|
489
|
-
|
|
500
|
+
if (cadenceRequest)
|
|
501
|
+
this.log((0, duties_1.describeDutyCadenceRequest)(cadenceRequest, duty?.id ?? args.id));
|
|
502
|
+
// A request alone changed nothing else, so "No change" would contradict the line above.
|
|
503
|
+
if (!pendingCadence || duty?.revision?.changed !== false)
|
|
504
|
+
this.log((0, duties_1.describeDutyRevision)(duty?.revision));
|
|
490
505
|
(0, duties_1.renderDutySummary)(duty, (line) => this.log(line));
|
|
491
506
|
(0, duties_1.renderDutyWriteWarnings)(warnings, (line) => this.warn(line));
|
|
492
507
|
}
|
|
@@ -11,6 +11,14 @@ import { BaseCommand } from '../../../base-command';
|
|
|
11
11
|
* projection across EVERY source that ever fed this task. `skrr tasks transcript`
|
|
12
12
|
* renders one run's conversation — what the agent said on an attempt; this is
|
|
13
13
|
* the whole relationship, including the parts a rotated epoch moved out of view.
|
|
14
|
+
*
|
|
15
|
+
* `--launch-input`, `--run-input <run-id>` and `--handled-output <run-id>` are
|
|
16
|
+
* what the Task page shows beside a run: the brief the launching Agent chat
|
|
17
|
+
* handed the Task, what one run was actually given (specification, brief,
|
|
18
|
+
* messages, files, and how much history), and the reply and Result one handled
|
|
19
|
+
* round produced. They are the same Task-chat VIEW reads the page makes, so a
|
|
20
|
+
* headless operator can answer "what did the Agent see, and what did it say"
|
|
21
|
+
* without opening a browser.
|
|
14
22
|
*/
|
|
15
23
|
export default class TasksChat extends BaseCommand {
|
|
16
24
|
static description: string;
|
|
@@ -25,6 +33,9 @@ export default class TasksChat extends BaseCommand {
|
|
|
25
33
|
runs: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
26
34
|
'transfer-preview': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
35
|
history: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
36
|
+
'launch-input': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
37
|
+
'run-input': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
'handled-output': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
39
|
limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
40
|
};
|
|
30
41
|
run(): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
4
5
|
const base_command_1 = require("../../../base-command");
|
|
5
6
|
const task_extras_1 = require("../../../lib/task-extras");
|
|
6
7
|
/**
|
|
@@ -15,6 +16,14 @@ const task_extras_1 = require("../../../lib/task-extras");
|
|
|
15
16
|
* projection across EVERY source that ever fed this task. `skrr tasks transcript`
|
|
16
17
|
* renders one run's conversation — what the agent said on an attempt; this is
|
|
17
18
|
* the whole relationship, including the parts a rotated epoch moved out of view.
|
|
19
|
+
*
|
|
20
|
+
* `--launch-input`, `--run-input <run-id>` and `--handled-output <run-id>` are
|
|
21
|
+
* what the Task page shows beside a run: the brief the launching Agent chat
|
|
22
|
+
* handed the Task, what one run was actually given (specification, brief,
|
|
23
|
+
* messages, files, and how much history), and the reply and Result one handled
|
|
24
|
+
* round produced. They are the same Task-chat VIEW reads the page makes, so a
|
|
25
|
+
* headless operator can answer "what did the Agent see, and what did it say"
|
|
26
|
+
* without opening a browser.
|
|
18
27
|
*/
|
|
19
28
|
class TasksChat extends base_command_1.BaseCommand {
|
|
20
29
|
static description = "Show a task's chat epoch, exchanges, sources or execution runs";
|
|
@@ -24,6 +33,9 @@ class TasksChat extends base_command_1.BaseCommand {
|
|
|
24
33
|
'<%= config.bin %> tasks chat task_abc123 --sources',
|
|
25
34
|
'<%= config.bin %> tasks chat task_abc123 --runs',
|
|
26
35
|
'<%= config.bin %> tasks chat task_abc123 --history',
|
|
36
|
+
'<%= config.bin %> tasks chat task_abc123 --launch-input',
|
|
37
|
+
'<%= config.bin %> tasks chat task_abc123 --run-input run_abc123',
|
|
38
|
+
'<%= config.bin %> tasks chat task_abc123 --handled-output run_abc123',
|
|
27
39
|
];
|
|
28
40
|
static args = {
|
|
29
41
|
id: core_1.Args.string({ ignoreStdin: true, description: 'Task ID', required: true }),
|
|
@@ -39,6 +51,15 @@ class TasksChat extends base_command_1.BaseCommand {
|
|
|
39
51
|
history: core_1.Flags.boolean({
|
|
40
52
|
description: "The full task-history projection across every source (not one run's transcript)",
|
|
41
53
|
}),
|
|
54
|
+
'launch-input': core_1.Flags.boolean({
|
|
55
|
+
description: 'The brief the launching Agent chat handed this task (null when none)',
|
|
56
|
+
}),
|
|
57
|
+
'run-input': core_1.Flags.string({
|
|
58
|
+
description: 'What the execution run with this id was given: specification, brief, messages, files and history',
|
|
59
|
+
}),
|
|
60
|
+
'handled-output': core_1.Flags.string({
|
|
61
|
+
description: 'The reply and Result id the handled Agent round with this run id produced',
|
|
62
|
+
}),
|
|
42
63
|
limit: core_1.Flags.integer({ description: 'Max rows', min: 1, max: 200 }),
|
|
43
64
|
};
|
|
44
65
|
async run() {
|
|
@@ -57,6 +78,12 @@ class TasksChat extends base_command_1.BaseCommand {
|
|
|
57
78
|
result = await task_extras_1.taskChatApi.transferPreview(taskId);
|
|
58
79
|
else if (flags.history)
|
|
59
80
|
result = await task_extras_1.taskChatApi.taskHistory(taskId, { limit: flags.limit });
|
|
81
|
+
else if (flags['launch-input'])
|
|
82
|
+
result = await data_provider_1.dataService.getTaskChatLaunchInput(taskId);
|
|
83
|
+
else if (flags['run-input'])
|
|
84
|
+
result = await data_provider_1.dataService.getTaskExecutionRunInput(taskId, flags['run-input']);
|
|
85
|
+
else if (flags['handled-output'])
|
|
86
|
+
result = await data_provider_1.dataService.getTaskExecutionRunHandledOutput(taskId, flags['handled-output']);
|
|
60
87
|
else
|
|
61
88
|
result = await task_extras_1.taskChatApi.chat(taskId);
|
|
62
89
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* `--select` picks option labels: `questionId=Label` (repeat to pick several), or a bare `Label`
|
|
4
|
+
* for a request with one question. An approval ("Allow once" / "Deny") is answered only this way:
|
|
5
|
+
* the server reads the decision from `selectedOptions`, never from text. An approval may also offer
|
|
6
|
+
* "Always allow …": choosing it here allows the call once and saves no rule, which is granted only on
|
|
7
|
+
* the card in the app (OSK-33440); the command prints what came of it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseSelections(values: string[] | undefined, onlyQuestionId: string | undefined): Array<{
|
|
10
|
+
questionId: string;
|
|
11
|
+
selectedOptions: string[];
|
|
12
|
+
}>;
|
|
2
13
|
export default class TasksInputAnswer extends BaseCommand {
|
|
3
14
|
static description: string;
|
|
4
15
|
static args: {
|
|
@@ -9,6 +20,7 @@ export default class TasksInputAnswer extends BaseCommand {
|
|
|
9
20
|
request: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
21
|
text: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
22
|
answer: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
select: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
24
|
'command-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
25
|
};
|
|
14
26
|
run(): Promise<void>;
|