@skrr-ai/cli 0.1.199 → 0.1.201
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/agents/always-on/recovery-close.d.ts +3 -4
- package/dist/commands/agents/always-on/recovery-close.js +5 -5
- package/dist/commands/agents/always-on/recovery-review.d.ts +1 -1
- package/dist/commands/agents/always-on/recovery-review.js +4 -3
- package/dist/commands/agents/create.d.ts +4 -2
- package/dist/commands/agents/create.js +29 -4
- package/dist/commands/duties/check-now.d.ts +1 -0
- package/dist/commands/duties/check-now.js +17 -1
- package/dist/commands/duties/create.js +74 -7
- package/dist/commands/duties/observations.d.ts +1 -0
- package/dist/commands/duties/observations.js +12 -3
- package/dist/commands/duties/operating-review.js +34 -2
- package/dist/commands/duties/pack/plan.d.ts +1 -0
- package/dist/commands/duties/pack/plan.js +30 -0
- package/dist/commands/duties/plan.d.ts +1 -0
- package/dist/commands/duties/plan.js +24 -0
- package/dist/commands/duties/preflight.d.ts +3 -3
- package/dist/commands/duties/preflight.js +36 -12
- package/dist/commands/duties/receipt.d.ts +1 -0
- package/dist/commands/duties/receipt.js +35 -11
- package/dist/commands/duties/roster.js +29 -6
- package/dist/commands/duties/status.js +19 -11
- package/dist/commands/duties/update.js +1 -1
- package/dist/commands/goals/create.js +1 -1
- package/dist/commands/goals/key-results/create.js +1 -1
- package/dist/commands/machines/computer-adoption.js +1 -1
- package/dist/commands/machines/dedicated/audit.js +1 -1
- package/dist/commands/machines/dedicated/catalog.js +1 -1
- package/dist/commands/machines/dedicated/current.js +1 -1
- package/dist/commands/machines/dedicated/git-status.js +1 -1
- package/dist/commands/machines/dedicated/health-check.js +1 -1
- package/dist/commands/machines/dedicated/logs.js +1 -1
- package/dist/commands/machines/dedicated/price-book.js +1 -1
- package/dist/commands/machines/dedicated/sign-in-status.js +1 -1
- package/dist/commands/machines/dedicated/stat.js +1 -1
- package/dist/commands/machines/services/ls.js +1 -1
- package/dist/commands/machines/shared.js +1 -1
- package/dist/commands/machines/shares.js +1 -1
- package/dist/commands/triggers/fire-detail.js +7 -0
- package/dist/generated/agent-guides.json +36 -36
- package/dist/lib/daemon-setup.js +1 -1
- package/dist/lib/duties.d.ts +7 -5
- package/dist/lib/duties.js +32 -19
- package/dist/lib/duty-loop-status.d.ts +2 -0
- package/dist/lib/duty-loop-status.js +26 -1
- package/dist/lib/duty-product.js +52 -3
- package/dist/lib/tasks.js +11 -3
- package/dist/lib/usage-discovery.js +2 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.d.ts +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.js +6 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.d.ts +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.js +6 -4
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10384 -10375
- package/oclif.manifest.json +40 -7
- package/package.json +5 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
/**
|
|
3
|
-
* `skrr agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>` —
|
|
3
|
+
* `skrr agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>` — closes one held Duty
|
|
4
4
|
* result, via `POST /api/agents/:id/always-on/runs/:runId/result-recovery/close` (OSK-23548).
|
|
5
5
|
*
|
|
6
6
|
* A Duty result whose custody is uncertain is held for review, and the held Run stops its Duty's later Checks until a
|
|
@@ -13,9 +13,8 @@ import { BaseCommand } from '../../../base-command';
|
|
|
13
13
|
* ref then names the boundary, and the close records which effect classes its receipts had settled.
|
|
14
14
|
*
|
|
15
15
|
* `--hold` is the ref `recovery-review <agent-id> <run-id>` prints. It binds the close to the hold you read: if the Run
|
|
16
|
-
* was held again since, the server refuses.
|
|
17
|
-
*
|
|
18
|
-
* that ran the turn confirmed it stopped. Nothing about who you are is taken from the command line.
|
|
16
|
+
* was held again since, the server refuses. Use `skrr login` as the Agent owner or as a workspace member with edit
|
|
17
|
+
* access to the Agent for a verified shared Duty result. The close also requires proof that the executor stopped.
|
|
19
18
|
*/
|
|
20
19
|
export default class AgentsAlwaysOnRecoveryClose extends BaseCommand {
|
|
21
20
|
static description: string;
|
|
@@ -4,7 +4,7 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
6
|
/**
|
|
7
|
-
* `skrr agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>` —
|
|
7
|
+
* `skrr agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>` — closes one held Duty
|
|
8
8
|
* result, via `POST /api/agents/:id/always-on/runs/:runId/result-recovery/close` (OSK-23548).
|
|
9
9
|
*
|
|
10
10
|
* A Duty result whose custody is uncertain is held for review, and the held Run stops its Duty's later Checks until a
|
|
@@ -17,12 +17,12 @@ const base_command_1 = require("../../../base-command");
|
|
|
17
17
|
* ref then names the boundary, and the close records which effect classes its receipts had settled.
|
|
18
18
|
*
|
|
19
19
|
* `--hold` is the ref `recovery-review <agent-id> <run-id>` prints. It binds the close to the hold you read: if the Run
|
|
20
|
-
* was held again since, the server refuses.
|
|
21
|
-
*
|
|
22
|
-
* that ran the turn confirmed it stopped. Nothing about who you are is taken from the command line.
|
|
20
|
+
* was held again since, the server refuses. Use `skrr login` as the Agent owner or as a workspace member with edit
|
|
21
|
+
* access to the Agent for a verified shared Duty result. The close also requires proof that the executor stopped.
|
|
23
22
|
*/
|
|
24
23
|
class AgentsAlwaysOnRecoveryClose extends base_command_1.BaseCommand {
|
|
25
|
-
static description = 'Close one held Duty result
|
|
24
|
+
static description = 'Close one held Duty result. The Run ends cancelled and no further result effects are applied. The Duty re-decides at its next Check. Effects without a receipt stay unknown.\n\n' +
|
|
25
|
+
'Use skrr login. Workspace members with edit access to the Agent can close verified results for shared Duties. The Agent owner handles personal and unverified results. The executor must be confirmed stopped.';
|
|
26
26
|
static examples = [
|
|
27
27
|
'<%= config.bin %> agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>',
|
|
28
28
|
'<%= config.bin %> agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref> --json',
|
|
@@ -12,7 +12,7 @@ export declare const UNKNOWN_CODE_HINT = "this CLI does not know it; update the
|
|
|
12
12
|
/** A code as this CLI prints it: verbatim, and marked when it is not one of `known`. */
|
|
13
13
|
export declare function recoveryCode(value: unknown, known: readonly string[]): string;
|
|
14
14
|
/**
|
|
15
|
-
* Read-only. The server independently verifies
|
|
15
|
+
* Read-only. The server independently verifies review access and source authorization.
|
|
16
16
|
*
|
|
17
17
|
* With a run id it reads ONE review (`GET .../runs/:runId/result-recovery`). Without one it lists the Agent's held
|
|
18
18
|
* results (`GET .../result-recoveries`), which is the only way to find a run id to open. The list is one positional
|
|
@@ -39,14 +39,15 @@ function recoveryCode(value, known) {
|
|
|
39
39
|
return known.includes(value) ? value : `${value} (${exports.UNKNOWN_CODE_HINT})`;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Read-only. The server independently verifies
|
|
42
|
+
* Read-only. The server independently verifies review access and source authorization.
|
|
43
43
|
*
|
|
44
44
|
* With a run id it reads ONE review (`GET .../runs/:runId/result-recovery`). Without one it lists the Agent's held
|
|
45
45
|
* results (`GET .../result-recoveries`), which is the only way to find a run id to open. The list is one positional
|
|
46
46
|
* away from the read rather than a sibling command because it answers the same question for every Run instead of one.
|
|
47
47
|
*/
|
|
48
48
|
class AgentsAlwaysOnRecoveryReview extends base_command_1.BaseCommand {
|
|
49
|
-
static description = "Read Duty Run recovery evidence
|
|
49
|
+
static description = "Read Duty Run recovery evidence. Without a run id, list the Agent's held results you can access.\n\n" +
|
|
50
|
+
'Workspace members with edit access to the Agent can review verified results for shared Duties. The Agent owner handles personal and unverified results.';
|
|
50
51
|
static examples = [
|
|
51
52
|
'<%= config.bin %> agents always-on recovery-review <agent-id>',
|
|
52
53
|
'<%= config.bin %> agents always-on recovery-review <agent-id> --cursor <nextCursor>',
|
|
@@ -119,7 +120,7 @@ class AgentsAlwaysOnRecoveryReview extends base_command_1.BaseCommand {
|
|
|
119
120
|
(0, http_error_1.httpBodyOf)(error)?.code === 'invalid_cursor') {
|
|
120
121
|
this.failWithCliError({
|
|
121
122
|
message: 'The server did not accept that cursor. A cursor expires after 15 minutes and works only for the Agent ' +
|
|
122
|
-
'and
|
|
123
|
+
'and account it was issued to.\n' +
|
|
123
124
|
`→ Start the list again: skrr agents always-on recovery-review ${agentId}`,
|
|
124
125
|
code: 'RECOVERY_REVIEW_CURSOR_INVALID',
|
|
125
126
|
status: 400,
|
|
@@ -71,8 +71,9 @@ export declare function unappliedPayloadKeys(sent: Record<string, unknown>, crea
|
|
|
71
71
|
* to claim a platform role that they had misspelled something.
|
|
72
72
|
*/
|
|
73
73
|
export declare function unappliedPayloadKeysWarning(keys: readonly string[]): string;
|
|
74
|
-
|
|
75
|
-
export declare function
|
|
74
|
+
type InitialAutonomyReceipt = boolean | 'pending' | 'inactive' | 'activation_unconfirmed' | 'unconfirmed';
|
|
75
|
+
export declare function initialAutonomyReceipt(created: unknown, requested: unknown): InitialAutonomyReceipt;
|
|
76
|
+
export declare function backgroundLoopLines(agentId: string, relationshipLoopsSkipped: boolean, initialAlwaysOn?: InitialAutonomyReceipt): string[];
|
|
76
77
|
/**
|
|
77
78
|
* The flags `--from-spec` may be combined with: placement and identity for the
|
|
78
79
|
* NEW row, which a spec document deliberately cannot carry (where an agent runs
|
|
@@ -148,3 +149,4 @@ export default class AgentsCreate extends BaseCommand {
|
|
|
148
149
|
*/
|
|
149
150
|
private createFromSpec;
|
|
150
151
|
}
|
|
152
|
+
export {};
|
|
@@ -126,10 +126,19 @@ function unappliedPayloadKeysWarning(keys) {
|
|
|
126
126
|
`or only the server sets ${one ? 'it' : 'them'}. \`skrr agents show <id> --json\` shows what the agent stores.`);
|
|
127
127
|
}
|
|
128
128
|
function initialAutonomyReceipt(created, requested) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
const agent = created && typeof created === 'object' ? created : null;
|
|
130
|
+
const provisioning = agent?.proactiveProvisioning;
|
|
131
|
+
if (requested !== false) {
|
|
132
|
+
if (agent?.isAlwaysOn === true)
|
|
133
|
+
return true;
|
|
134
|
+
const status = provisioning && typeof provisioning === 'object'
|
|
135
|
+
? provisioning.status : undefined;
|
|
136
|
+
if (status === 'pending')
|
|
137
|
+
return 'pending';
|
|
138
|
+
if (status === 'failed' || agent?.isAlwaysOn === false)
|
|
139
|
+
return 'inactive';
|
|
140
|
+
return 'activation_unconfirmed';
|
|
141
|
+
}
|
|
133
142
|
return provisioning && typeof provisioning === 'object' &&
|
|
134
143
|
provisioning.initialAlwaysOn === false ? false : 'unconfirmed';
|
|
135
144
|
}
|
|
@@ -139,6 +148,22 @@ function backgroundLoopLines(agentId, relationshipLoopsSkipped, initialAlwaysOn
|
|
|
139
148
|
'Passive creation was requested, but the server did not acknowledge it. Autonomous state is unconfirmed.',
|
|
140
149
|
` skrr agents show ${agentId} --json # inspect actual runtime state`,
|
|
141
150
|
];
|
|
151
|
+
if (initialAlwaysOn === 'pending')
|
|
152
|
+
return [
|
|
153
|
+
'Always-On setup is pending. Autonomous work starts after activation.',
|
|
154
|
+
` skrr agents always-on status ${agentId} # check activation`,
|
|
155
|
+
` skrr agents always-on disable ${agentId} # stop activation`,
|
|
156
|
+
];
|
|
157
|
+
if (initialAlwaysOn === 'inactive')
|
|
158
|
+
return [
|
|
159
|
+
'Always-On is off. Setup has not activated autonomous work.',
|
|
160
|
+
` skrr agents always-on status ${agentId} # check activation`,
|
|
161
|
+
];
|
|
162
|
+
if (initialAlwaysOn === 'activation_unconfirmed')
|
|
163
|
+
return [
|
|
164
|
+
'Always-On activation is unconfirmed.',
|
|
165
|
+
` skrr agents always-on status ${agentId} # check activation`,
|
|
166
|
+
];
|
|
142
167
|
if (!initialAlwaysOn)
|
|
143
168
|
return [
|
|
144
169
|
// Plain words for what exists: a policy, a Compass and the daily self-reflection
|
|
@@ -25,6 +25,7 @@ export default class DutiesCheckNow extends BaseCommand {
|
|
|
25
25
|
};
|
|
26
26
|
static flags: {
|
|
27
27
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
'verify-version': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
29
|
};
|
|
29
30
|
run(): Promise<void>;
|
|
30
31
|
}
|
|
@@ -48,8 +48,13 @@ function describeNotQueuedReason(reason, id, bin = 'skrr') {
|
|
|
48
48
|
return sentence(`Nothing was queued: this Duty is ${reason.slice('duty_'.length)}, so it no longer runs.`);
|
|
49
49
|
case 'duty_deleted':
|
|
50
50
|
return sentence('Nothing was queued: this Duty was deleted.');
|
|
51
|
+
case 'duty_version_changed':
|
|
52
|
+
return sentence(`The Duty changed before the request was queued. Read its current version with \`${bin} duties show ${id}\`.`);
|
|
53
|
+
case 'duty_verification_not_reserved':
|
|
54
|
+
return sentence('Another Check took this turn. Request verification again after it finishes.');
|
|
51
55
|
case 'duty_check_not_reserved':
|
|
52
56
|
return sentence('Nothing was queued: the platform did not reserve a new check for it just now. Try again shortly.');
|
|
57
|
+
case 'active_check':
|
|
53
58
|
case 'reservation_exists':
|
|
54
59
|
// Two requests at once: one reserves the check, the other meets that reservation.
|
|
55
60
|
return sentence(`Nothing new was queued: a check for this Duty is already queued or running. See it with \`${bin} duties checks ${id}\`.`);
|
|
@@ -72,19 +77,24 @@ class DutiesCheckNow extends base_command_1.BaseCommand {
|
|
|
72
77
|
static examples = [
|
|
73
78
|
'<%= config.bin %> duties check-now <duty-id>',
|
|
74
79
|
'<%= config.bin %> duties check-now <duty-id> --json',
|
|
80
|
+
'<%= config.bin %> duties check-now <duty-id> --verify-version 3',
|
|
75
81
|
];
|
|
76
82
|
static args = {
|
|
77
83
|
id: core_1.Args.string({ description: 'Duty ID', required: true, ignoreStdin: true }),
|
|
78
84
|
};
|
|
79
85
|
static flags = {
|
|
80
86
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
87
|
+
'verify-version': core_1.Flags.integer({
|
|
88
|
+
min: 1,
|
|
89
|
+
description: 'Request fresh declared observations for this exact Duty version using its existing execution limits',
|
|
90
|
+
}),
|
|
81
91
|
};
|
|
82
92
|
async run() {
|
|
83
93
|
this.requireAuth();
|
|
84
94
|
const { args, flags } = await this.parse(DutiesCheckNow);
|
|
85
95
|
let result;
|
|
86
96
|
try {
|
|
87
|
-
result = await duties_1.dutyApi.checkNow(args.id);
|
|
97
|
+
result = await duties_1.dutyApi.checkNow(args.id, flags['verify-version']);
|
|
88
98
|
}
|
|
89
99
|
catch (err) {
|
|
90
100
|
this.handleApiError(err);
|
|
@@ -96,6 +106,12 @@ class DutiesCheckNow extends base_command_1.BaseCommand {
|
|
|
96
106
|
const status = String(result.status ?? 'unknown');
|
|
97
107
|
const checkId = result.checkId ? String(result.checkId) : null;
|
|
98
108
|
this.log(`Check ${status}${checkId ? ` — ${checkId}` : ''}`);
|
|
109
|
+
const verifyVersion = flags['verify-version'];
|
|
110
|
+
if (status === 'queued' && verifyVersion !== undefined) {
|
|
111
|
+
this.log(result.verifyVersion === verifyVersion
|
|
112
|
+
? `Observation verification queued for Duty version ${verifyVersion}.`
|
|
113
|
+
: 'The server queued a regular Check. Version verification was not confirmed.');
|
|
114
|
+
}
|
|
99
115
|
if (status !== 'queued') {
|
|
100
116
|
const sentence = describeNotQueuedReason(result.reason, args.id, this.config.bin);
|
|
101
117
|
if (sentence)
|
|
@@ -220,6 +220,34 @@ function activationBlockers(body) {
|
|
|
220
220
|
}
|
|
221
221
|
return blockers;
|
|
222
222
|
}
|
|
223
|
+
async function activateCreatedDuty(id, version) {
|
|
224
|
+
const reconcileRetryDelays = [1000, 2000, 3000, 4000];
|
|
225
|
+
for (let attempt = 0;; attempt++) {
|
|
226
|
+
try {
|
|
227
|
+
return attempt === 0 ? await duties_1.dutyApi.resume(id) : await duties_1.dutyApi.resume(id, version);
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
const delay = reconcileRetryDelays[attempt];
|
|
231
|
+
const { code, body } = (0, base_command_1.apiRefusal)(error);
|
|
232
|
+
const rawBlockers = record(body?.diagnostic)?.blockers;
|
|
233
|
+
const blockers = activationBlockers(body);
|
|
234
|
+
if (delay === undefined ||
|
|
235
|
+
(code ?? body?.error) !== 'DUTY_ACTIVATION_BLOCKED' ||
|
|
236
|
+
!Array.isArray(rawBlockers) ||
|
|
237
|
+
!blockers.length ||
|
|
238
|
+
blockers.length !== rawBlockers.length ||
|
|
239
|
+
blockers.some(({ gate, reason }) => gate !== 'always_on' || reason !== 'reconcile_pending') ||
|
|
240
|
+
typeof version !== 'number' ||
|
|
241
|
+
!Number.isSafeInteger(version) ||
|
|
242
|
+
version < 1) {
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
// Creation can start an Always-On reconciliation. Retry only that
|
|
246
|
+
// refusal, against the same draft, so an owner edit or stop wins.
|
|
247
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
223
251
|
function dutyActivationRefusal(err, { id, bin }) {
|
|
224
252
|
const refusal = (0, base_command_1.apiRefusal)(err);
|
|
225
253
|
// `resume` answers with every blocking gate, but only the first is in the message. Fixing it
|
|
@@ -579,23 +607,58 @@ JSON
|
|
|
579
607
|
exit: 1,
|
|
580
608
|
});
|
|
581
609
|
}
|
|
582
|
-
// Creation is authoring only. Activation is a separate resume boundary
|
|
583
|
-
// that runs the current preflight; JSON imports cannot bypass it.
|
|
584
610
|
payload.status = 'draft';
|
|
611
|
+
delete payload.activate;
|
|
585
612
|
let duty;
|
|
586
613
|
try {
|
|
587
|
-
duty = await duties_1.dutyApi.create(payload);
|
|
614
|
+
duty = await duties_1.dutyApi.create(flags.activate ? { ...payload, activate: true } : payload);
|
|
588
615
|
}
|
|
589
616
|
catch (err) {
|
|
590
|
-
|
|
617
|
+
const { body } = (0, base_command_1.apiRefusal)(err);
|
|
618
|
+
const details = body?.details;
|
|
619
|
+
const olderServer = flags.activate &&
|
|
620
|
+
Array.isArray(details) &&
|
|
621
|
+
details.some((issue) => issue?.code === 'unrecognized_keys' &&
|
|
622
|
+
Array.isArray(issue.keys) &&
|
|
623
|
+
issue.keys.includes('activate'));
|
|
624
|
+
if (!olderServer)
|
|
625
|
+
this.handleApiError(err);
|
|
626
|
+
try {
|
|
627
|
+
duty = await duties_1.dutyApi.create(payload);
|
|
628
|
+
}
|
|
629
|
+
catch (fallbackError) {
|
|
630
|
+
this.handleApiError(fallbackError);
|
|
631
|
+
}
|
|
591
632
|
}
|
|
592
633
|
// `--activate` is the same resume + Preflight boundary `duties
|
|
593
634
|
// resume` runs, composed onto the create so the caller gets one answer.
|
|
594
635
|
// A refusal is reported on the result — never thrown over the draft's id.
|
|
595
636
|
let activation = null;
|
|
596
|
-
|
|
637
|
+
const start = duty?.directStart;
|
|
638
|
+
if (flags.activate && start) {
|
|
639
|
+
activation =
|
|
640
|
+
duty?.status === 'active'
|
|
641
|
+
? { activated: true }
|
|
642
|
+
: {
|
|
643
|
+
activated: false,
|
|
644
|
+
refusal: start.state === 'not_started'
|
|
645
|
+
? {
|
|
646
|
+
code: start.code,
|
|
647
|
+
reason: start.reason,
|
|
648
|
+
fix: (0, data_provider_1.describeDutyActivationFix)(start.code, {
|
|
649
|
+
turnOn: `run \`${this.config.bin} duties resume ${duty?.id}\``,
|
|
650
|
+
}),
|
|
651
|
+
}
|
|
652
|
+
: {
|
|
653
|
+
code: 'DUTY_ALREADY_EXISTS',
|
|
654
|
+
reason: `Existing Duty is ${duty?.status}.`,
|
|
655
|
+
fix: `Review it with \`${this.config.bin} duties show ${duty?.id}\`.`,
|
|
656
|
+
},
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
else if (flags.activate) {
|
|
597
660
|
try {
|
|
598
|
-
duty = await
|
|
661
|
+
duty = await activateCreatedDuty(String(duty.id), duty.version);
|
|
599
662
|
activation = { activated: true };
|
|
600
663
|
}
|
|
601
664
|
catch (err) {
|
|
@@ -632,7 +695,11 @@ JSON
|
|
|
632
695
|
}), null, 2));
|
|
633
696
|
return;
|
|
634
697
|
}
|
|
635
|
-
this.log(
|
|
698
|
+
this.log(start?.state === 'existing'
|
|
699
|
+
? 'Existing duty:'
|
|
700
|
+
: activation?.activated
|
|
701
|
+
? 'Created and activated duty:'
|
|
702
|
+
: 'Created duty:');
|
|
636
703
|
(0, duties_1.renderDutySummary)(duty, (line) => this.log(line));
|
|
637
704
|
(0, duties_1.renderDutyWriteWarnings)(warnings, (line) => this.warn(line));
|
|
638
705
|
if (activation && !activation.activated) {
|
|
@@ -32,6 +32,7 @@ export default class DutiesObservations extends BaseCommand {
|
|
|
32
32
|
};
|
|
33
33
|
static flags: {
|
|
34
34
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
35
|
+
check: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
35
36
|
latest: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
36
37
|
key: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
38
|
window: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -81,6 +81,7 @@ class DutiesObservations extends base_command_1.BaseCommand {
|
|
|
81
81
|
'cap on how much an Agent-reported reading is worth, not a measurement.';
|
|
82
82
|
static examples = [
|
|
83
83
|
'<%= config.bin %> duties observations obj_abc123',
|
|
84
|
+
'<%= config.bin %> duties observations obj_abc123 --check objchk_abc123 --json',
|
|
84
85
|
'<%= config.bin %> duties observations obj_abc123 --declared-only --changed-only',
|
|
85
86
|
'<%= config.bin %> duties observations obj_abc123 --since 2026-08-01 --limit 100 --json',
|
|
86
87
|
];
|
|
@@ -89,6 +90,7 @@ class DutiesObservations extends base_command_1.BaseCommand {
|
|
|
89
90
|
};
|
|
90
91
|
static flags = {
|
|
91
92
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
93
|
+
check: core_1.Flags.string({ description: 'Only readings recorded by this Duty Check' }),
|
|
92
94
|
latest: core_1.Flags.boolean({
|
|
93
95
|
description: 'Latest recorded attempt per current declared key (not history)',
|
|
94
96
|
}),
|
|
@@ -118,12 +120,17 @@ class DutiesObservations extends base_command_1.BaseCommand {
|
|
|
118
120
|
async run() {
|
|
119
121
|
this.requireAuth();
|
|
120
122
|
const { args, flags } = await this.parse(DutiesObservations);
|
|
121
|
-
if (flags.latest &&
|
|
122
|
-
|
|
123
|
+
if (flags.latest &&
|
|
124
|
+
(flags.check || flags.window || flags.cursor || flags['changed-only'] || flags.since))
|
|
125
|
+
this.error('--latest cannot be combined with --check, --window, --cursor, --changed-only, or --since');
|
|
123
126
|
let response;
|
|
124
127
|
if (flags.window) {
|
|
125
128
|
try {
|
|
126
|
-
if (flags
|
|
129
|
+
if (flags.check ||
|
|
130
|
+
flags['declared-only'] ||
|
|
131
|
+
flags['changed-only'] ||
|
|
132
|
+
flags.since ||
|
|
133
|
+
flags.cursor)
|
|
127
134
|
this.error('--window cannot be combined with list filters');
|
|
128
135
|
const query = {
|
|
129
136
|
key: flags.key,
|
|
@@ -154,6 +161,7 @@ class DutiesObservations extends base_command_1.BaseCommand {
|
|
|
154
161
|
this.error('--key requires --window');
|
|
155
162
|
try {
|
|
156
163
|
response = await duties_1.dutyApi.observations(args.dutyId, {
|
|
164
|
+
...(flags.check ? { checkId: flags.check } : {}),
|
|
157
165
|
limit: flags.limit,
|
|
158
166
|
latest: flags.latest || undefined,
|
|
159
167
|
declaredOnly: flags['declared-only'] || undefined,
|
|
@@ -177,6 +185,7 @@ class DutiesObservations extends base_command_1.BaseCommand {
|
|
|
177
185
|
// facts; a filter that empties the list must not claim the first
|
|
178
186
|
// (OSK-10953).
|
|
179
187
|
const filters = [
|
|
188
|
+
flags.check ? `--check ${flags.check}` : null,
|
|
180
189
|
flags.latest ? '--latest' : null,
|
|
181
190
|
flags['declared-only'] ? '--declared-only' : null,
|
|
182
191
|
flags['changed-only'] ? '--changed-only' : null,
|
|
@@ -6,10 +6,18 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const base_command_1 = require("../../base-command");
|
|
7
7
|
const duties_1 = require("../../lib/duties");
|
|
8
8
|
const DUTY_RE = /^obj_/;
|
|
9
|
+
function verifiedPortfolio(review) {
|
|
10
|
+
const portfolio = review.currentPortfolio;
|
|
11
|
+
return portfolio?.sourcePolicy?.status === 'partial' &&
|
|
12
|
+
portfolio.sourcePolicy.reason === 'physical_agent_current_contracts_only' &&
|
|
13
|
+
Array.isArray(portfolio.duties) && Array.isArray(portfolio.recentRuns)
|
|
14
|
+
? portfolio : undefined;
|
|
15
|
+
}
|
|
9
16
|
/** Old servers cannot prove historical Duties belong to this physical Agent. */
|
|
10
17
|
function sanitizeOperatingReview(review) {
|
|
11
18
|
return {
|
|
12
19
|
...review,
|
|
20
|
+
currentPortfolio: verifiedPortfolio(review),
|
|
13
21
|
reflectionDuty: null,
|
|
14
22
|
systemDuties: null,
|
|
15
23
|
portfolio: null,
|
|
@@ -22,11 +30,35 @@ function sanitizeOperatingReview(review) {
|
|
|
22
30
|
}
|
|
23
31
|
/** Report unavailable rather than implying that there were no Duties or questions. */
|
|
24
32
|
function formatOperatingReview(review) {
|
|
25
|
-
|
|
33
|
+
const lines = [
|
|
26
34
|
`Agent ${review.agentId}`,
|
|
27
35
|
`Always-On is ${review.alwaysOn === true ? 'ON' : review.alwaysOn === false ? 'OFF' : 'unknown'}.`,
|
|
28
|
-
'Duty portfolio, loop details, proposals and open questions are unavailable because their sources cannot be verified.',
|
|
29
36
|
];
|
|
37
|
+
const portfolio = verifiedPortfolio(review);
|
|
38
|
+
if (!portfolio) {
|
|
39
|
+
return [...lines, 'Duty portfolio, loop details, proposals and open questions are unavailable because their sources cannot be verified.'];
|
|
40
|
+
}
|
|
41
|
+
lines.push('Verified current Duties');
|
|
42
|
+
if (!portfolio.duties.length)
|
|
43
|
+
lines.push('No current Duty contracts could be verified.');
|
|
44
|
+
for (const duty of portfolio.duties) {
|
|
45
|
+
lines.push(`- ${duty.title} (${duty.id}) · ${duty.status} · version ${duty.version}`);
|
|
46
|
+
}
|
|
47
|
+
if (portfolio.truncated)
|
|
48
|
+
lines.push('More verified current Duties are outside this review.');
|
|
49
|
+
for (const check of portfolio.recentReflectionChecks ?? []) {
|
|
50
|
+
lines.push(`- Reflection Check · ${check.status} · ${check.path}`);
|
|
51
|
+
}
|
|
52
|
+
lines.push('Recent verified Runs');
|
|
53
|
+
if (!portfolio.recentRuns.length)
|
|
54
|
+
lines.push('No recent Runs could be verified. A new Check can record fresh evidence.');
|
|
55
|
+
const titleById = new Map(portfolio.duties.map(({ id, title }) => [id, title]));
|
|
56
|
+
for (const run of portfolio.recentRuns) {
|
|
57
|
+
const status = (run.peerVerificationStatus || run.status).replaceAll('_', ' ');
|
|
58
|
+
lines.push(`- ${titleById.get(run.dutyId) || run.dutyId} · ${status} · ${run.path}`);
|
|
59
|
+
}
|
|
60
|
+
lines.push('Proposal and open-question history is unavailable.');
|
|
61
|
+
return lines;
|
|
30
62
|
}
|
|
31
63
|
class DutiesOperatingReview extends base_command_1.BaseCommand {
|
|
32
64
|
static description = 'Read an agent’s system-managed duty operating review';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
import { type DutyPackPlanResponse } from '../../../lib/duties';
|
|
3
|
+
export declare function formatPlanPreview(duty: DutyPackPlanResponse['duty']): string[];
|
|
3
4
|
/**
|
|
4
5
|
* Lines for what the plan says will stop the loop from ever being activated. `bind` would still
|
|
5
6
|
* write a draft, so a reader who sees only "Nothing was created" must also see this.
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatPlanPreview = formatPlanPreview;
|
|
3
4
|
exports.formatReadiness = formatReadiness;
|
|
4
5
|
const core_1 = require("@oclif/core");
|
|
6
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
7
|
const base_command_1 = require("../../../base-command");
|
|
6
8
|
const prompt_1 = require("../../../lib/prompt");
|
|
7
9
|
const duties_1 = require("../../../lib/duties");
|
|
10
|
+
function formatPlanPreview(duty) {
|
|
11
|
+
if (!duty)
|
|
12
|
+
return [];
|
|
13
|
+
const lines = [];
|
|
14
|
+
if (duty.title)
|
|
15
|
+
lines.push(`Duty ${duty.title}`);
|
|
16
|
+
if (duty.subject?.id)
|
|
17
|
+
lines.push(`Scope ${duty.subject.type} ${duty.subject.id}`);
|
|
18
|
+
if (duty.target?.outcome)
|
|
19
|
+
lines.push(`Outcome ${duty.target.outcome}`);
|
|
20
|
+
if (duty.cadence?.mode)
|
|
21
|
+
lines.push(`Checks ${(0, duties_1.cadenceLabel)(duty)}`);
|
|
22
|
+
if (duty.delivery?.mode) {
|
|
23
|
+
const mode = duty.delivery.mode.replaceAll('_', ' ');
|
|
24
|
+
const destinations = [...new Set((duty.reports || [])
|
|
25
|
+
.filter((report) => report.enabled !== false && report.destination)
|
|
26
|
+
.map((report) => data_provider_1.DUTY_DESTINATION_REGISTRY[report.destination]?.label ?? report.destination))];
|
|
27
|
+
lines.push(`Delivery ${mode}${destinations.length ? ` to ${destinations.join(', ')}` : ''}`);
|
|
28
|
+
}
|
|
29
|
+
return lines;
|
|
30
|
+
}
|
|
8
31
|
/**
|
|
9
32
|
* Lines for what the plan says will stop the loop from ever being activated. `bind` would still
|
|
10
33
|
* write a draft, so a reader who sees only "Nothing was created" must also see this.
|
|
@@ -125,8 +148,15 @@ class DutiesPackPlan extends base_command_1.BaseCommand {
|
|
|
125
148
|
const holder = placement.holder === 'space_lead' ? ' (the Space lead)' : '';
|
|
126
149
|
this.log(`Space loop: ${placement.spaceId}, held by ${placement.agentId}${holder}`);
|
|
127
150
|
}
|
|
151
|
+
else if (result.duty?.agentId) {
|
|
152
|
+
this.log(`Holder ${result.duty.agentId}`);
|
|
153
|
+
}
|
|
154
|
+
for (const line of formatPlanPreview(result.duty))
|
|
155
|
+
this.log(line);
|
|
128
156
|
for (const line of formatReadiness(result.readiness))
|
|
129
157
|
this.log(line);
|
|
158
|
+
if (result.duty)
|
|
159
|
+
this.log('\nUse --json to read the full plan, including its instructions.');
|
|
130
160
|
this.log('\nTo bind the Duty, pass the same Pack inputs to `skrr duties pack bind` with `--plan-digest`.');
|
|
131
161
|
}
|
|
132
162
|
}
|
|
@@ -44,6 +44,7 @@ export default class DutiesPlan extends BaseCommand {
|
|
|
44
44
|
role: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
45
45
|
'work-context': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
46
46
|
timezone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
47
|
+
'personal-inference': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
47
48
|
};
|
|
48
49
|
run(): Promise<void>;
|
|
49
50
|
}
|
|
@@ -5,6 +5,13 @@ exports.planTimezoneLines = planTimezoneLines;
|
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
const base_command_1 = require("../../base-command");
|
|
7
7
|
const duties_1 = require("../../lib/duties");
|
|
8
|
+
const DRAFT_PLACEMENT_REFUSALS = new Set([
|
|
9
|
+
'DUTY_PLANNER_RUNTIME_UNSUPPORTED',
|
|
10
|
+
'DUTY_PLANNER_CAPABILITY_UNVERIFIED',
|
|
11
|
+
'DUTY_PLANNER_TARGET_OFFLINE',
|
|
12
|
+
'DUTY_PLANNER_TARGET_CONSENT_REQUIRED',
|
|
13
|
+
'DUTY_PLANNER_TARGET_UNAVAILABLE',
|
|
14
|
+
]);
|
|
8
15
|
/**
|
|
9
16
|
* `skrr duties plan` — draft a duty contract from one sentence.
|
|
10
17
|
*
|
|
@@ -71,6 +78,7 @@ class DutiesPlan extends base_command_1.BaseCommand {
|
|
|
71
78
|
static examples = [
|
|
72
79
|
'<%= config.bin %> duties plan --agent <agent-id> --sentence "Make sure every candidate hears back within 48 hours"',
|
|
73
80
|
'<%= config.bin %> duties plan --agent <agent-id> --sentence "Keep the hiring loop tight" --template hiring_follow_through',
|
|
81
|
+
'<%= config.bin %> duties plan --agent <agent-id> --sentence "Watch the support queue" --personal-inference',
|
|
74
82
|
'<%= config.bin %> duties plan --agent <agent-id> --sentence "..." --json > proposal.json',
|
|
75
83
|
];
|
|
76
84
|
static flags = {
|
|
@@ -88,6 +96,9 @@ class DutiesPlan extends base_command_1.BaseCommand {
|
|
|
88
96
|
role: core_1.Flags.string({ description: 'Your role, to bias the draft' }),
|
|
89
97
|
'work-context': core_1.Flags.string({ description: 'Extra context about the work' }),
|
|
90
98
|
timezone: core_1.Flags.string({ description: 'IANA timezone for cadence/deadline reasoning' }),
|
|
99
|
+
'personal-inference': core_1.Flags.boolean({
|
|
100
|
+
description: 'Draft using your saved inference settings. Hosted targets may use managed allowance.',
|
|
101
|
+
}),
|
|
91
102
|
};
|
|
92
103
|
async run() {
|
|
93
104
|
this.requireAuth();
|
|
@@ -102,9 +113,16 @@ class DutiesPlan extends base_command_1.BaseCommand {
|
|
|
102
113
|
...(flags.role ? { role: flags.role } : {}),
|
|
103
114
|
...(flags['work-context'] ? { workContext: flags['work-context'] } : {}),
|
|
104
115
|
...(flags.timezone ? { timezone: flags.timezone } : {}),
|
|
116
|
+
...(flags['personal-inference'] ? { inferencePlacement: 'personal' } : {}),
|
|
105
117
|
});
|
|
106
118
|
}
|
|
107
119
|
catch (err) {
|
|
120
|
+
if (!flags.json && !flags['personal-inference']) {
|
|
121
|
+
const { code } = (0, base_command_1.apiRefusal)(err);
|
|
122
|
+
if (DRAFT_PLACEMENT_REFUSALS.has(code ?? '')) {
|
|
123
|
+
this.warn('Add --personal-inference to draft with your saved inference settings. The selected Agent still runs the Duty.');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
108
126
|
this.handleApiError(err);
|
|
109
127
|
}
|
|
110
128
|
if (flags.json) {
|
|
@@ -147,6 +165,12 @@ class DutiesPlan extends base_command_1.BaseCommand {
|
|
|
147
165
|
}
|
|
148
166
|
for (const line of planTimezoneLines(response.proposal, flags.timezone))
|
|
149
167
|
this.log(line);
|
|
168
|
+
if (response.notificationPreview) {
|
|
169
|
+
this.log('');
|
|
170
|
+
this.log('Example outcomes');
|
|
171
|
+
this.log(` Notify ${response.notificationPreview.notify}`);
|
|
172
|
+
this.log(` Quiet ${response.notificationPreview.quiet}`);
|
|
173
|
+
}
|
|
150
174
|
this.log('');
|
|
151
175
|
this.log('Proposed contract:');
|
|
152
176
|
this.log(JSON.stringify(response.proposal, null, 2));
|
|
@@ -34,7 +34,7 @@ type PreflightGate = DutyPreflightReport['gates'][number];
|
|
|
34
34
|
export declare function nextRunsLines(report: {
|
|
35
35
|
verdict?: string;
|
|
36
36
|
nextRuns?: string[];
|
|
37
|
-
}): string[];
|
|
37
|
+
}, projectedActivation?: boolean): string[];
|
|
38
38
|
/**
|
|
39
39
|
* The first line of a preflight. `Ready to run` is a statement about activation (no blocking gate),
|
|
40
40
|
* and it sat directly above a spend-gate warning that the daily Run budget is 0, i.e. that no agent
|
|
@@ -42,8 +42,8 @@ export declare function nextRunsLines(report: {
|
|
|
42
42
|
* not stop the sensing lane, so refusing activation would be wrong for a Duty that only
|
|
43
43
|
* observes. The headline carries the caveat instead of contradicting the gate below it.
|
|
44
44
|
*/
|
|
45
|
-
export declare function preflightHeadline(report: Pick<DutyPreflightReport, 'verdict' | 'gates' | 'activation' | 'sourcePolicy'>, persisted: boolean): string;
|
|
46
|
-
export declare function preflightGateLines(gate: PreflightGate, verbose?: boolean, refusesActivation?: boolean): string[];
|
|
45
|
+
export declare function preflightHeadline(report: Pick<DutyPreflightReport, 'verdict' | 'gates' | 'activation' | 'sourcePolicy' | 'permissions'>, persisted: boolean): string;
|
|
46
|
+
export declare function preflightGateLines(gate: PreflightGate, verbose?: boolean, refusesActivation?: boolean, unsavedDraft?: boolean): string[];
|
|
47
47
|
/**
|
|
48
48
|
* The `Attention:` footer, and under it the settings behind the verdict (OSK-21120).
|
|
49
49
|
*
|