@skrr-ai/cli 0.1.192 → 0.1.194
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 +18 -0
- package/dist/commands/agents/always-on/recovery-review.js +2 -1
- package/dist/commands/duties/action-proposals/decide.js +29 -5
- package/dist/commands/duties/endpoints/health.d.ts +1 -7
- package/dist/commands/duties/endpoints/health.js +13 -21
- package/dist/commands/duties/pack/bind.d.ts +2 -1
- package/dist/commands/duties/pack/bind.js +36 -12
- package/dist/commands/duties/pack/plan.d.ts +2 -1
- package/dist/commands/duties/pack/plan.js +35 -14
- package/dist/commands/duties/pack/preflight.js +4 -4
- package/dist/commands/duties/preflight.d.ts +1 -1
- package/dist/commands/duties/preflight.js +3 -0
- package/dist/commands/duties/reports.d.ts +1 -0
- package/dist/commands/duties/reports.js +52 -15
- package/dist/commands/harnesses/evaluations/fixed-tool.js +5 -2
- package/dist/commands/machines/hosted/list.js +13 -1
- package/dist/commands/machines/hosted/status.js +3 -0
- package/dist/commands/tasks/start.js +3 -2
- package/dist/lib/duties.d.ts +9 -0
- package/dist/lib/duties.js +19 -4
- package/dist/lib/duty-endpoints.d.ts +1 -1
- package/dist/lib/duty-endpoints.js +1 -1
- package/dist/lib/duty-event-wakes.js +3 -2
- package/dist/lib/duty-loop-status.js +2 -2
- package/dist/lib/hosted-machines.d.ts +21 -0
- package/dist/lib/hosted-machines.js +112 -1
- package/dist/lib/task-admission.d.ts +1 -0
- package/dist/lib/task-admission.js +16 -1
- package/dist/lib/task-preflight.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessPermissionControls.d.ts +1 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessPermissionControls.js +7 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessPermissionControls.d.ts +1 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessPermissionControls.js +9 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10029 -9990
- package/oclif.manifest.json +59 -20
- package/package.json +2 -2
package/dist/base-command.js
CHANGED
|
@@ -1695,6 +1695,24 @@ class BaseCommand extends core_1.Command {
|
|
|
1695
1695
|
details: envelopeDetails(body),
|
|
1696
1696
|
});
|
|
1697
1697
|
}
|
|
1698
|
+
else if (bodyCode === 'DUTY_OBSERVATION_SOURCE_UNVERIFIED' ||
|
|
1699
|
+
bodyCode === 'DUTY_CASE_SOURCE_UNVERIFIED' ||
|
|
1700
|
+
bodyCode === 'DUTY_HYPOTHESIS_SOURCE_UNVERIFIED') {
|
|
1701
|
+
const kind = {
|
|
1702
|
+
DUTY_OBSERVATION_SOURCE_UNVERIFIED: 'observation',
|
|
1703
|
+
DUTY_CASE_SOURCE_UNVERIFIED: 'case',
|
|
1704
|
+
DUTY_HYPOTHESIS_SOURCE_UNVERIFIED: 'hypothesis',
|
|
1705
|
+
}[bodyCode];
|
|
1706
|
+
this.failWithCliError({
|
|
1707
|
+
message: say(`Duty ${kind} history is unavailable because its original source cannot be verified. ` +
|
|
1708
|
+
`For the current Duty and its control status, run \`${this.config.bin} duties show\` with the Duty ID.`),
|
|
1709
|
+
code: bodyCode,
|
|
1710
|
+
status: e.status,
|
|
1711
|
+
exit: 1,
|
|
1712
|
+
retryable: false,
|
|
1713
|
+
details: envelopeDetails(body),
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1698
1716
|
else if (bodyCode === 'DUTY_REFLECTION_SOURCE_UNVERIFIED') {
|
|
1699
1717
|
this.failWithCliError({
|
|
1700
1718
|
message: say('Reflection history and decisions are unavailable because the original Duty source cannot be verified.'),
|
|
@@ -187,9 +187,10 @@ function closeLines(agentId, review) {
|
|
|
187
187
|
`→ skrr agents always-on recovery-close ${agentId} ${review.runId} --hold ${review.holdRef}`,
|
|
188
188
|
];
|
|
189
189
|
}
|
|
190
|
+
// OSK-24471: every stop nothing recovery reads can prove, not only a machine's, so it promises no proof from the cloud.
|
|
190
191
|
if (review.close === 'executor_stop_unconfirmed') {
|
|
191
192
|
return [
|
|
192
|
-
'Close: not yet.
|
|
193
|
+
'Close: not yet. Nothing has proven that this turn stopped. If a machine ran the turn itself, bring that machine online and read this again. If the turn ran in the cloud, recovery has no proof it can wait for, so the Run stays held. Deleting its Agent ends it.',
|
|
193
194
|
];
|
|
194
195
|
}
|
|
195
196
|
// OSK-24681: a turn the cloud worker ran with a machine's tools. Only an unanswered call sends the owner to the machine.
|
|
@@ -4,6 +4,12 @@ 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
|
const duties_1 = require("../../../lib/duties");
|
|
7
|
+
const EXECUTION_MESSAGES = {
|
|
8
|
+
approved: 'Execution is pending.',
|
|
9
|
+
executing: 'Execution is in progress.',
|
|
10
|
+
succeeded: 'Execution succeeded.',
|
|
11
|
+
failed: 'Execution failed.',
|
|
12
|
+
};
|
|
7
13
|
class DutiesActionProposalsDecide extends base_command_1.BaseCommand {
|
|
8
14
|
static description = 'Approve & run, or reject, one frozen Action Bundle';
|
|
9
15
|
static args = {
|
|
@@ -63,14 +69,32 @@ class DutiesActionProposalsDecide extends base_command_1.BaseCommand {
|
|
|
63
69
|
}
|
|
64
70
|
catch (error) {
|
|
65
71
|
this.handleApiError(error);
|
|
72
|
+
return;
|
|
66
73
|
}
|
|
67
|
-
if (flags.json)
|
|
74
|
+
if (flags.json) {
|
|
68
75
|
this.log(JSON.stringify(result, null, 2));
|
|
69
|
-
|
|
70
|
-
this.log('Action Bundle approved and handed to the durable executor.');
|
|
76
|
+
return;
|
|
71
77
|
}
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
this.log(`Action Bundle is ${String(result.decision.status ?? 'recorded')}.`);
|
|
79
|
+
const execution = result.execution;
|
|
80
|
+
if (!execution)
|
|
81
|
+
return;
|
|
82
|
+
const metadata = execution.execution;
|
|
83
|
+
const status = String(execution.status ?? 'pending');
|
|
84
|
+
this.log(metadata?.receipt?.state === 'unknown'
|
|
85
|
+
? 'Execution is unconfirmed.'
|
|
86
|
+
: EXECUTION_MESSAGES[status] || `Execution is ${status}.`);
|
|
87
|
+
const proposal = execution.proposal;
|
|
88
|
+
const lastAttempt = proposal?.attemptReceipts?.at(-1);
|
|
89
|
+
if (lastAttempt?.status === 'failed') {
|
|
90
|
+
const code = typeof lastAttempt.errorCode === 'string' ? ` (${lastAttempt.errorCode})` : '';
|
|
91
|
+
this.log(`The last execution attempt failed${code}.`);
|
|
92
|
+
}
|
|
93
|
+
if (status !== 'succeeded' &&
|
|
94
|
+
metadata?.recovery?.action === 'inspect_before_retry' &&
|
|
95
|
+
metadata.inspection?.command) {
|
|
96
|
+
const when = metadata.receipt?.terminal ? '' : ' before retrying';
|
|
97
|
+
this.log(`Inspect the execution${when} with ${metadata.inspection.command}`);
|
|
74
98
|
}
|
|
75
99
|
}
|
|
76
100
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
|
-
/**
|
|
3
|
-
* `skrr duties endpoints health <id>` — probe or assert readiness.
|
|
4
|
-
*
|
|
5
|
-
* For a provider-backed endpoint the server PROBES the provider and ignores what
|
|
6
|
-
* you claim. For a manually-confirmed one, `--healthy` / `--unhealthy` is how you
|
|
7
|
-
* assert it yourself — which is the whole reason a generic endpoint exists.
|
|
8
|
-
*/
|
|
2
|
+
/** Probe the registered transport and record its observed readiness. */
|
|
9
3
|
export default class DutiesEndpointsHealth extends BaseCommand {
|
|
10
4
|
static description: string;
|
|
11
5
|
static examples: string[];
|
|
@@ -3,42 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const base_command_1 = require("../../../base-command");
|
|
5
5
|
const duty_endpoints_1 = require("../../../lib/duty-endpoints");
|
|
6
|
-
/**
|
|
7
|
-
* `skrr duties endpoints health <id>` — probe or assert readiness.
|
|
8
|
-
*
|
|
9
|
-
* For a provider-backed endpoint the server PROBES the provider and ignores what
|
|
10
|
-
* you claim. For a manually-confirmed one, `--healthy` / `--unhealthy` is how you
|
|
11
|
-
* assert it yourself — which is the whole reason a generic endpoint exists.
|
|
12
|
-
*/
|
|
6
|
+
/** Probe the registered transport and record its observed readiness. */
|
|
13
7
|
class DutiesEndpointsHealth extends base_command_1.BaseCommand {
|
|
14
|
-
static description = '
|
|
8
|
+
static description = 'Probe a Duty endpoint’s current readiness';
|
|
15
9
|
static examples = [
|
|
16
10
|
'<%= config.bin %> duties endpoints health ep_abc123',
|
|
17
|
-
'<%= config.bin %> duties endpoints health ep_abc123 --healthy',
|
|
18
|
-
'<%= config.bin %> duties endpoints health ep_abc123 --unhealthy --detail "webhook 410"',
|
|
19
11
|
];
|
|
20
12
|
static args = {
|
|
21
13
|
endpointId: core_1.Args.string({ ignoreStdin: true, description: 'Endpoint ID', required: true }),
|
|
22
14
|
};
|
|
23
15
|
static flags = {
|
|
24
16
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
25
|
-
healthy: core_1.Flags.boolean({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}),
|
|
29
|
-
unhealthy: core_1.Flags.boolean({ description: 'Assert unhealthy', exclusive: ['healthy'] }),
|
|
30
|
-
detail: core_1.Flags.string({ description: 'Why — recorded with the health result' }),
|
|
17
|
+
healthy: core_1.Flags.boolean({ hidden: true }),
|
|
18
|
+
unhealthy: core_1.Flags.boolean({ hidden: true }),
|
|
19
|
+
detail: core_1.Flags.string({ hidden: true }),
|
|
31
20
|
};
|
|
32
21
|
async run() {
|
|
33
22
|
this.requireAuth();
|
|
34
23
|
const { args, flags } = await this.parse(DutiesEndpointsHealth);
|
|
24
|
+
if (flags.healthy || flags.unhealthy || flags.detail !== undefined) {
|
|
25
|
+
this.error('Endpoint health comes from a transport probe. Omit --healthy, --unhealthy and --detail to check readiness.', { exit: 2 });
|
|
26
|
+
}
|
|
35
27
|
let result;
|
|
36
28
|
try {
|
|
37
|
-
result = await duty_endpoints_1.dutyEndpointApi.health(args.endpointId
|
|
38
|
-
...(flags.healthy ? { healthy: true } : {}),
|
|
39
|
-
...(flags.unhealthy ? { healthy: false } : {}),
|
|
40
|
-
...(flags.detail ? { detail: flags.detail } : {}),
|
|
41
|
-
});
|
|
29
|
+
result = await duty_endpoints_1.dutyEndpointApi.health(args.endpointId);
|
|
42
30
|
}
|
|
43
31
|
catch (err) {
|
|
44
32
|
this.handleApiError(err);
|
|
@@ -49,6 +37,10 @@ class DutiesEndpointsHealth extends base_command_1.BaseCommand {
|
|
|
49
37
|
}
|
|
50
38
|
const endpoint = (result.endpoint ?? result);
|
|
51
39
|
this.log(`${args.endpointId} → status ${String(endpoint.status ?? '—')}, usable ${endpoint.available ? 'yes' : 'no'}`);
|
|
40
|
+
const connection = endpoint.connection;
|
|
41
|
+
const detail = connection?.healthDetail || connection?.healthReason;
|
|
42
|
+
if (typeof detail === 'string' && detail.trim())
|
|
43
|
+
this.log(detail);
|
|
52
44
|
}
|
|
53
45
|
}
|
|
54
46
|
exports.default = DutiesEndpointsHealth;
|
|
@@ -16,7 +16,8 @@ export default class DutiesPackBind extends BaseCommand {
|
|
|
16
16
|
static examples: string[];
|
|
17
17
|
static flags: {
|
|
18
18
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
-
|
|
19
|
+
'from-json': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
pack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
21
|
'pack-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
22
|
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
23
|
space: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.describeKnowledgeDefault = describeKnowledgeDefault;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const prompt_1 = require("../../../lib/prompt");
|
|
6
7
|
const duties_1 = require("../../../lib/duties");
|
|
7
8
|
const web_url_1 = require("../../../lib/web-url");
|
|
8
9
|
/**
|
|
@@ -20,15 +21,30 @@ const web_url_1 = require("../../../lib/web-url");
|
|
|
20
21
|
class DutiesPackBind extends base_command_1.BaseCommand {
|
|
21
22
|
static description = 'Create the Duty a Pack describes (idempotent)';
|
|
22
23
|
static examples = [
|
|
24
|
+
'<%= config.bin %> duties pack bind --from-json ./pack.json --plan-digest <digest>',
|
|
23
25
|
'<%= config.bin %> duties pack bind --pack pr_ci_guardian --agent <agent-id> --repository owner/repo --required-check "Pipeline Summary" --installation-id 155117997',
|
|
24
26
|
'<%= config.bin %> duties pack bind --pack <pack-id> --space <space-id>',
|
|
25
27
|
'<%= config.bin %> duties pack bind --pack goal_advance --space <space-id> --goal <goal-id> --interval-minutes 1440',
|
|
26
28
|
];
|
|
27
29
|
static flags = {
|
|
28
30
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
31
|
+
'from-json': core_1.Flags.string({
|
|
32
|
+
description: 'Pack request from a JSON file or - for stdin. Include packId, agentId or spaceId, and fields from pack list.',
|
|
33
|
+
exclusive: [
|
|
34
|
+
'pack',
|
|
35
|
+
'pack-version',
|
|
36
|
+
'agent',
|
|
37
|
+
'space',
|
|
38
|
+
'goal',
|
|
39
|
+
'interval-minutes',
|
|
40
|
+
'repository',
|
|
41
|
+
'required-check',
|
|
42
|
+
'installation-id',
|
|
43
|
+
'grant',
|
|
44
|
+
],
|
|
45
|
+
}),
|
|
29
46
|
pack: core_1.Flags.string({
|
|
30
47
|
description: 'Pack id (see `skrr duties pack list`)',
|
|
31
|
-
required: true,
|
|
32
48
|
}),
|
|
33
49
|
'pack-version': core_1.Flags.string({
|
|
34
50
|
description: 'Pack version (defaults to the latest installed)',
|
|
@@ -68,7 +84,10 @@ class DutiesPackBind extends base_command_1.BaseCommand {
|
|
|
68
84
|
const { flags } = await this.parse(DutiesPackBind);
|
|
69
85
|
const requiredChecks = (flags['required-check'] ?? []).map((c) => c.trim()).filter(Boolean);
|
|
70
86
|
const grants = (flags.grant ?? []).map((g) => g.trim()).filter(Boolean);
|
|
71
|
-
if (!flags
|
|
87
|
+
if (!flags['from-json'] && !flags.pack) {
|
|
88
|
+
this.error('Pass --pack or --from-json.', { exit: 1 });
|
|
89
|
+
}
|
|
90
|
+
if (!flags['from-json'] && !flags.agent && !flags.space) {
|
|
72
91
|
this.error('Pass --agent (the Agent that holds it) or --space (bind it into a Space).', {
|
|
73
92
|
exit: 1,
|
|
74
93
|
});
|
|
@@ -82,17 +101,22 @@ class DutiesPackBind extends base_command_1.BaseCommand {
|
|
|
82
101
|
}
|
|
83
102
|
let result;
|
|
84
103
|
try {
|
|
104
|
+
const body = flags['from-json']
|
|
105
|
+
? await (0, prompt_1.readJsonBody)(flags['from-json'])
|
|
106
|
+
: {
|
|
107
|
+
packId: flags.pack,
|
|
108
|
+
...(flags['pack-version'] ? { version: flags['pack-version'] } : {}),
|
|
109
|
+
...(flags.agent ? { agentId: flags.agent } : {}),
|
|
110
|
+
...(flags.space ? { spaceId: flags.space } : {}),
|
|
111
|
+
...(flags.goal ? { goalId: flags.goal } : {}),
|
|
112
|
+
...(flags['interval-minutes'] ? { intervalMs: flags['interval-minutes'] * 60_000 } : {}),
|
|
113
|
+
...(flags.repository ? { repository: flags.repository } : {}),
|
|
114
|
+
...(requiredChecks.length ? { requiredChecks } : {}),
|
|
115
|
+
...(flags['installation-id'] ? { installationId: flags['installation-id'] } : {}),
|
|
116
|
+
...(grants.length ? { grants: grants.map((grantId) => ({ grantId })) } : {}),
|
|
117
|
+
};
|
|
85
118
|
result = await duties_1.dutyPackApi.bind({
|
|
86
|
-
|
|
87
|
-
...(flags['pack-version'] ? { version: flags['pack-version'] } : {}),
|
|
88
|
-
...(flags.agent ? { agentId: flags.agent } : {}),
|
|
89
|
-
...(flags.space ? { spaceId: flags.space } : {}),
|
|
90
|
-
...(flags.goal ? { goalId: flags.goal } : {}),
|
|
91
|
-
...(flags['interval-minutes'] ? { intervalMs: flags['interval-minutes'] * 60_000 } : {}),
|
|
92
|
-
...(flags.repository ? { repository: flags.repository } : {}),
|
|
93
|
-
...(requiredChecks.length ? { requiredChecks } : {}),
|
|
94
|
-
...(flags['installation-id'] ? { installationId: flags['installation-id'] } : {}),
|
|
95
|
-
...(grants.length ? { grants: grants.map((grantId) => ({ grantId })) } : {}),
|
|
119
|
+
...body,
|
|
96
120
|
...(flags['plan-digest'] ? { planDigest: flags['plan-digest'] } : {}),
|
|
97
121
|
});
|
|
98
122
|
}
|
|
@@ -17,7 +17,8 @@ export default class DutiesPackPlan extends BaseCommand {
|
|
|
17
17
|
static examples: string[];
|
|
18
18
|
static flags: {
|
|
19
19
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
-
|
|
20
|
+
'from-json': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
pack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
22
|
'pack-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
23
|
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
24
|
space: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.formatReadiness = formatReadiness;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const prompt_1 = require("../../../lib/prompt");
|
|
6
7
|
const duties_1 = require("../../../lib/duties");
|
|
7
8
|
/**
|
|
8
9
|
* Lines for what the plan says will stop the loop from ever being activated. `bind` would still
|
|
@@ -30,15 +31,29 @@ function formatReadiness(readiness) {
|
|
|
30
31
|
class DutiesPackPlan extends base_command_1.BaseCommand {
|
|
31
32
|
static description = 'Draft the Duty a Pack would create, without creating it (read-only)';
|
|
32
33
|
static examples = [
|
|
34
|
+
'<%= config.bin %> duties pack plan --from-json ./pack.json',
|
|
33
35
|
'<%= config.bin %> duties pack plan --pack pr_ci_guardian --agent <agent-id> --repository owner/repo --required-check "Pipeline Summary"',
|
|
34
36
|
'<%= config.bin %> duties pack plan --pack <pack-id> --space <space-id>',
|
|
35
37
|
'<%= config.bin %> duties pack plan --pack goal_advance --space <space-id> --goal <goal-id>',
|
|
36
38
|
];
|
|
37
39
|
static flags = {
|
|
38
40
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
41
|
+
'from-json': core_1.Flags.string({
|
|
42
|
+
description: 'Pack request from a JSON file or - for stdin. Include packId, agentId or spaceId, and fields from pack list.',
|
|
43
|
+
exclusive: [
|
|
44
|
+
'pack',
|
|
45
|
+
'pack-version',
|
|
46
|
+
'agent',
|
|
47
|
+
'space',
|
|
48
|
+
'goal',
|
|
49
|
+
'interval-minutes',
|
|
50
|
+
'repository',
|
|
51
|
+
'required-check',
|
|
52
|
+
'installation-id',
|
|
53
|
+
],
|
|
54
|
+
}),
|
|
39
55
|
pack: core_1.Flags.string({
|
|
40
56
|
description: 'Pack id (see `skrr duties pack list`)',
|
|
41
|
-
required: true,
|
|
42
57
|
}),
|
|
43
58
|
'pack-version': core_1.Flags.string({
|
|
44
59
|
description: 'Pack version (defaults to the latest installed)',
|
|
@@ -70,24 +85,30 @@ class DutiesPackPlan extends base_command_1.BaseCommand {
|
|
|
70
85
|
// Check NAMES are free text and legitimately contain commas, so they are
|
|
71
86
|
// never comma-split the way an id list would be.
|
|
72
87
|
const requiredChecks = (flags['required-check'] ?? []).map((c) => c.trim()).filter(Boolean);
|
|
73
|
-
if (!flags
|
|
88
|
+
if (!flags['from-json'] && !flags.pack) {
|
|
89
|
+
this.error('Pass --pack or --from-json.', { exit: 1 });
|
|
90
|
+
}
|
|
91
|
+
if (!flags['from-json'] && !flags.agent && !flags.space) {
|
|
74
92
|
this.error('Pass --agent (the Agent that holds it) or --space (bind it into a Space).', {
|
|
75
93
|
exit: 1,
|
|
76
94
|
});
|
|
77
95
|
}
|
|
78
96
|
let result;
|
|
79
97
|
try {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
const body = flags['from-json']
|
|
99
|
+
? await (0, prompt_1.readJsonBody)(flags['from-json'])
|
|
100
|
+
: {
|
|
101
|
+
packId: flags.pack,
|
|
102
|
+
...(flags['pack-version'] ? { version: flags['pack-version'] } : {}),
|
|
103
|
+
...(flags.agent ? { agentId: flags.agent } : {}),
|
|
104
|
+
...(flags.space ? { spaceId: flags.space } : {}),
|
|
105
|
+
...(flags.goal ? { goalId: flags.goal } : {}),
|
|
106
|
+
...(flags['interval-minutes'] ? { intervalMs: flags['interval-minutes'] * 60_000 } : {}),
|
|
107
|
+
...(flags.repository ? { repository: flags.repository } : {}),
|
|
108
|
+
...(requiredChecks.length ? { requiredChecks } : {}),
|
|
109
|
+
...(flags['installation-id'] ? { installationId: flags['installation-id'] } : {}),
|
|
110
|
+
};
|
|
111
|
+
result = await duties_1.dutyPackApi.plan(body);
|
|
91
112
|
}
|
|
92
113
|
catch (err) {
|
|
93
114
|
this.handleApiError(err);
|
|
@@ -106,7 +127,7 @@ class DutiesPackPlan extends base_command_1.BaseCommand {
|
|
|
106
127
|
}
|
|
107
128
|
for (const line of formatReadiness(result.readiness))
|
|
108
129
|
this.log(line);
|
|
109
|
-
this.log('\
|
|
130
|
+
this.log('\nTo bind the Duty, pass the same Pack inputs to `skrr duties pack bind` with `--plan-digest`.');
|
|
110
131
|
}
|
|
111
132
|
}
|
|
112
133
|
exports.default = DutiesPackPlan;
|
|
@@ -21,7 +21,7 @@ const RUN_RE = /_/g;
|
|
|
21
21
|
* the probe. Until now only the web app could.
|
|
22
22
|
*/
|
|
23
23
|
class DutiesPackPreflight extends base_command_1.BaseCommand {
|
|
24
|
-
static description = "Re-run a bound Pack's adapter readiness probe and refresh its stored preflight verdict";
|
|
24
|
+
static description = "Re-run a bound Pack's adapter readiness probe and refresh its stored preflight verdict. A blocked verdict exits 1 in both formats.";
|
|
25
25
|
static examples = [
|
|
26
26
|
'<%= config.bin %> duties pack preflight <duty-id>',
|
|
27
27
|
'<%= config.bin %> duties pack preflight <duty-id> --json',
|
|
@@ -47,11 +47,13 @@ class DutiesPackPreflight extends base_command_1.BaseCommand {
|
|
|
47
47
|
this.handleApiError(err);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
+
const receipt = result.preflight;
|
|
51
|
+
if (receipt?.verdict === 'blocked')
|
|
52
|
+
process.exitCode = 1;
|
|
50
53
|
if (flags.json) {
|
|
51
54
|
this.log(JSON.stringify(result, null, 2));
|
|
52
55
|
return;
|
|
53
56
|
}
|
|
54
|
-
const receipt = result.preflight;
|
|
55
57
|
this.log(`Pack: ${result.pack?.id}@${result.pack?.version}`);
|
|
56
58
|
this.log(`Preflight: ${String(receipt?.verdict).replace(RUN_RE, ' ')}`);
|
|
57
59
|
this.log(`Recorded: ${receipt?.at}`);
|
|
@@ -79,8 +81,6 @@ class DutiesPackPreflight extends base_command_1.BaseCommand {
|
|
|
79
81
|
this.log(line);
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
|
-
if (receipt?.verdict === 'blocked')
|
|
83
|
-
process.exitCode = 1;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
exports.default = DutiesPackPreflight;
|
|
@@ -42,7 +42,7 @@ 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'>, persisted: boolean): string;
|
|
45
|
+
export declare function preflightHeadline(report: Pick<DutyPreflightReport, 'verdict' | 'gates' | 'activation' | 'sourcePolicy'>, persisted: boolean): string;
|
|
46
46
|
export declare function preflightGateLines(gate: PreflightGate, verbose?: boolean, refusesActivation?: boolean): string[];
|
|
47
47
|
/**
|
|
48
48
|
* The `Attention:` footer, and under it the settings behind the verdict (OSK-21120).
|
|
@@ -53,6 +53,9 @@ function nextRunsLines(report) {
|
|
|
53
53
|
*/
|
|
54
54
|
function preflightHeadline(report, persisted) {
|
|
55
55
|
const label = persisted ? 'Preflight' : 'Pre-create preview (nothing persisted)';
|
|
56
|
+
if (report.sourcePolicy?.reason === 'current_contract_only') {
|
|
57
|
+
return `${label}: Current contract checked. Historical evidence and activation readiness are unavailable.`;
|
|
58
|
+
}
|
|
56
59
|
if (report.verdict === 'blocked') {
|
|
57
60
|
if (report.activation?.canActivate === true) {
|
|
58
61
|
const status = report.gates?.find((gate) => gate.id === 'status')?.reason;
|
|
@@ -19,6 +19,7 @@ export default class DutiesReports extends BaseCommand {
|
|
|
19
19
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
20
|
add: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
21
|
target: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
endpoint: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
23
|
review: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
24
|
on: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
25
|
format: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -4,11 +4,8 @@ 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
|
const duties_1 = require("../../lib/duties");
|
|
7
|
+
const duty_endpoints_1 = require("../../lib/duty-endpoints");
|
|
7
8
|
const duty_terms_1 = require("../../lib/duty-terms");
|
|
8
|
-
/** Destinations that address one specific place and therefore need a target. */
|
|
9
|
-
const DESTINATIONS_NEEDING_TARGET = new Set(Object.values(data_provider_1.DUTY_DESTINATION_REGISTRY)
|
|
10
|
-
.filter((destination) => destination.requiresTarget)
|
|
11
|
-
.map((destination) => destination.key));
|
|
12
9
|
/**
|
|
13
10
|
* Keep the CLI safe across a rolling data-provider build. Older installed
|
|
14
11
|
* packages expose the compatibility destination list but not the narrowed
|
|
@@ -41,7 +38,7 @@ class DutiesReports extends base_command_1.BaseCommand {
|
|
|
41
38
|
static description = "Manage a duty's report targets";
|
|
42
39
|
static examples = [
|
|
43
40
|
'<%= config.bin %> duties reports <duty-id>',
|
|
44
|
-
'<%= config.bin %> duties reports <duty-id> --add slack_channel --
|
|
41
|
+
'<%= config.bin %> duties reports <duty-id> --add slack_channel --endpoint <endpoint-id> --on material_change',
|
|
45
42
|
'<%= config.bin %> duties reports <duty-id> --add main --on completion',
|
|
46
43
|
'<%= config.bin %> duties reports <duty-id> --add user_notify --target <user-id> --review owner',
|
|
47
44
|
'<%= config.bin %> duties reports <duty-id> --remove slack_channel:C0123456',
|
|
@@ -52,11 +49,15 @@ class DutiesReports extends base_command_1.BaseCommand {
|
|
|
52
49
|
static flags = {
|
|
53
50
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
54
51
|
add: core_1.Flags.string({
|
|
55
|
-
description: 'Destination to add',
|
|
52
|
+
description: 'Destination to add. In-app routine progress appears in Work Feed.',
|
|
56
53
|
options: [...AUTHORABLE_REPORT_DESTINATIONS],
|
|
57
54
|
}),
|
|
58
55
|
target: core_1.Flags.string({
|
|
59
|
-
description: '
|
|
56
|
+
description: 'User ID for user_notify. A registered channel supplies its own target.',
|
|
57
|
+
}),
|
|
58
|
+
endpoint: core_1.Flags.string({
|
|
59
|
+
description: 'Registered delivery endpoint ID. Find it with duties endpoints list --agent <agent-id>.',
|
|
60
|
+
dependsOn: ['add'],
|
|
60
61
|
}),
|
|
61
62
|
review: core_1.Flags.string({
|
|
62
63
|
description: 'Hold the exact text for approver approval before it is sent to this target (owner)',
|
|
@@ -99,6 +100,7 @@ class DutiesReports extends base_command_1.BaseCommand {
|
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
let payload;
|
|
103
|
+
let repairedBinding = false;
|
|
102
104
|
try {
|
|
103
105
|
const current = await (0, duty_terms_1.loadDuty)(args.id);
|
|
104
106
|
const reports = current.reports ?? [];
|
|
@@ -107,23 +109,58 @@ class DutiesReports extends base_command_1.BaseCommand {
|
|
|
107
109
|
}
|
|
108
110
|
if (flags.add) {
|
|
109
111
|
const destination = flags.add;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
const definition = data_provider_1.DUTY_DESTINATION_REGISTRY[destination];
|
|
113
|
+
if (definition.requiresBinding && !flags.endpoint) {
|
|
114
|
+
throw new Error(`--endpoint is required for ${destination}. Run \`skrr duties endpoints list --agent ${current.agentId}\` to find the endpoint ID.`);
|
|
115
|
+
}
|
|
116
|
+
if (flags.endpoint && !definition.registrable) {
|
|
117
|
+
throw new Error(`${destination} does not take an --endpoint.`);
|
|
112
118
|
}
|
|
113
|
-
if (!
|
|
114
|
-
// Storing a target on a destination that ignores it would read as
|
|
115
|
-
// configured and deliver nowhere.
|
|
119
|
+
if (!definition.requiresTarget && flags.target) {
|
|
116
120
|
throw new Error(`${destination} does not take a --target.`);
|
|
117
121
|
}
|
|
122
|
+
let target = flags.target;
|
|
123
|
+
if (flags.endpoint) {
|
|
124
|
+
const { endpoints } = await duty_endpoints_1.dutyEndpointApi.list({ agentId: current.agentId });
|
|
125
|
+
const registered = endpoints.find((endpoint) => endpoint.id === flags.endpoint);
|
|
126
|
+
if (!registered || registered.destination !== destination) {
|
|
127
|
+
throw new Error(`No ${destination} endpoint with ID ${flags.endpoint} is registered for this Agent.`);
|
|
128
|
+
}
|
|
129
|
+
if (target && target !== registered.target) {
|
|
130
|
+
throw new Error('--target must match the registered endpoint. Omit it to use the registered target.');
|
|
131
|
+
}
|
|
132
|
+
target = definition.requiresTarget ? registered.target : undefined;
|
|
133
|
+
}
|
|
134
|
+
if (definition.requiresTarget && !target) {
|
|
135
|
+
throw new Error(flags.endpoint
|
|
136
|
+
? `The registered ${destination} endpoint has no target.`
|
|
137
|
+
: `--target is required for ${destination}.`);
|
|
138
|
+
}
|
|
118
139
|
const next = {
|
|
119
140
|
destination,
|
|
120
|
-
...(
|
|
141
|
+
...(target ? { destinationTarget: target } : {}),
|
|
142
|
+
...(flags.endpoint ? { endpoint: { id: flags.endpoint } } : {}),
|
|
121
143
|
...(flags.review ? { review: flags.review } : {}),
|
|
122
144
|
on: flags.on ?? 'material_change',
|
|
123
145
|
enabled: true,
|
|
124
146
|
...(flags.format ? { format: flags.format } : {}),
|
|
125
147
|
};
|
|
126
|
-
|
|
148
|
+
const matches = reports.filter((report) => reportKey(report) === reportKey(next));
|
|
149
|
+
if (next.endpoint && matches.length === 1 && !matches[0].endpoint?.id) {
|
|
150
|
+
const existing = matches[0];
|
|
151
|
+
payload = { reports: reports.map((report) => report === existing
|
|
152
|
+
? {
|
|
153
|
+
...report,
|
|
154
|
+
endpoint: next.endpoint,
|
|
155
|
+
...(next.review ? { review: next.review } : {}),
|
|
156
|
+
...(next.format ? { format: next.format } : {}),
|
|
157
|
+
}
|
|
158
|
+
: report) };
|
|
159
|
+
repairedBinding = true;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
payload = { reports: (0, duty_terms_1.appendUnique)(reports, next, reportKey, 'Report target') };
|
|
163
|
+
}
|
|
127
164
|
}
|
|
128
165
|
else {
|
|
129
166
|
const base = String(flags.remove);
|
|
@@ -157,7 +194,7 @@ class DutiesReports extends base_command_1.BaseCommand {
|
|
|
157
194
|
this.log(JSON.stringify(duty, null, 2));
|
|
158
195
|
return;
|
|
159
196
|
}
|
|
160
|
-
this.log(flags.add ? 'Report target added.' : 'Report target removed.');
|
|
197
|
+
this.log(repairedBinding ? 'Report endpoint attached.' : flags.add ? 'Report target added.' : 'Report target removed.');
|
|
161
198
|
(0, duties_1.renderDutySummary)(duty, (line) => this.log(line));
|
|
162
199
|
(0, duty_terms_1.renderDutyTerms)(duty, (line) => this.log(line));
|
|
163
200
|
}
|
|
@@ -76,8 +76,11 @@ class HarnessesEvaluationsFixedTool extends base_command_1.BaseCommand {
|
|
|
76
76
|
return;
|
|
77
77
|
for (const envelope of Array.isArray(event.envelopes) ? event.envelopes : []) {
|
|
78
78
|
const ev = envelope?.ev;
|
|
79
|
-
if (
|
|
80
|
-
|
|
79
|
+
if (
|
|
80
|
+
// A tool call from the admitted Copilot session proves the runtime ran.
|
|
81
|
+
ev?.t === 'tool-call-start' ||
|
|
82
|
+
(ev?.t === 'service' &&
|
|
83
|
+
/^Copilot SDK runtime ready \(pid: [1-9][0-9]*\)$/.test(ev.text ?? '')))
|
|
81
84
|
runtimeStartObserved = true;
|
|
82
85
|
}
|
|
83
86
|
},
|
|
@@ -53,7 +53,8 @@ class HostedMachinesList extends base_command_1.BaseCommand {
|
|
|
53
53
|
}
|
|
54
54
|
const rows = sessions.map((session) => ({
|
|
55
55
|
id: (0, hosted_machines_1.hostedMachineId)(session),
|
|
56
|
-
|
|
56
|
+
// The cap pauses a box and keeps its files; the table says which pause it was.
|
|
57
|
+
status: (0, hosted_machines_1.isSpendCapPaused)(session) ? 'paused (monthly cap)' : (0, hosted_machines_1.hostedMachineStatus)(session),
|
|
57
58
|
name: (0, hosted_machines_1.hostedMachineDisplayName)(session),
|
|
58
59
|
agent: session.agentId ? String(session.agentId) : '-',
|
|
59
60
|
lease: session.machineLeaseId ? String(session.machineLeaseId) : '-',
|
|
@@ -69,6 +70,17 @@ class HostedMachinesList extends base_command_1.BaseCommand {
|
|
|
69
70
|
{ key: 'repos', header: 'REPOS', maxWidth: 36 },
|
|
70
71
|
{ key: 'preview', header: 'PREVIEW', maxWidth: 48 },
|
|
71
72
|
], (line) => this.log(line));
|
|
73
|
+
// A machine the platform ended, or the monthly cap paused, says why under
|
|
74
|
+
// the table, so neither reads as an owner's own (OSK-24471).
|
|
75
|
+
const explained = sessions.filter((session) => ((0, hosted_machines_1.hostedMachineStatus)(session) === 'terminated' && session.terminationReason) ||
|
|
76
|
+
(0, hosted_machines_1.isSpendCapPaused)(session));
|
|
77
|
+
for (const session of explained) {
|
|
78
|
+
const why = (0, hosted_machines_1.hostedMachineLifecycleLines)(session, { bin: this.config.bin }).find((line) => line.startsWith('Why: '));
|
|
79
|
+
if (why) {
|
|
80
|
+
this.log('');
|
|
81
|
+
this.log(`${(0, hosted_machines_1.hostedMachineId)(session)}: ${why.slice('Why: '.length)}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
72
84
|
// How to find the same box in the other list. `machines list` identifies a
|
|
73
85
|
// hosted machine by `lease:<leaseId>` — a different random string from the
|
|
74
86
|
// `sbs_` id in the ID column above — so side by side the two commands read
|
|
@@ -71,6 +71,9 @@ class HostedMachinesStatus extends base_command_1.BaseCommand {
|
|
|
71
71
|
printStatus(session) {
|
|
72
72
|
this.log(`ID: ${(0, hosted_machines_1.hostedMachineId)(session)}`);
|
|
73
73
|
this.log(`Status: ${(0, hosted_machines_1.hostedMachineStatus)(session)}`);
|
|
74
|
+
for (const line of (0, hosted_machines_1.hostedMachineLifecycleLines)(session, { bin: this.config.bin })) {
|
|
75
|
+
this.log(line);
|
|
76
|
+
}
|
|
74
77
|
this.log(`Name: ${(0, hosted_machines_1.hostedMachineDisplayName)(session)}`);
|
|
75
78
|
this.log(`Agent: ${session.agentId || '-'}`);
|
|
76
79
|
this.log(`Conversation: ${session.conversationId || '-'}`);
|
|
@@ -98,15 +98,16 @@ class TasksStart extends base_command_1.BaseCommand {
|
|
|
98
98
|
code: 'TASK_START_PREVIEW_UNSUPPORTED', exit: 2, retryable: false,
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
+
const blocked = (0, task_admission_1.isAdmissionBlocked)(preview.executionAdmission);
|
|
101
102
|
if (flags.json)
|
|
102
|
-
this.printJsonResult(preview, { ok:
|
|
103
|
+
this.printJsonResult(preview, { ok: !blocked });
|
|
103
104
|
else {
|
|
104
105
|
this.log(`Execution preview for ${preview.taskId}:`);
|
|
105
106
|
for (const line of (0, task_admission_1.admissionLines)(preview.executionAdmission))
|
|
106
107
|
this.log(line);
|
|
107
108
|
this.log('No Run was created. Starting later rechecks current prerequisites.');
|
|
108
109
|
}
|
|
109
|
-
if (
|
|
110
|
+
if (blocked)
|
|
110
111
|
this.exit(1);
|
|
111
112
|
return;
|
|
112
113
|
}
|