@skrr-ai/cli 0.1.15 → 0.1.18
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/README.md +10 -4
- package/dist/commands/commitments/action-proposals/decide.d.ts +13 -0
- package/dist/commands/commitments/action-proposals/decide.js +41 -0
- package/dist/commands/commitments/action-proposals/execute.d.ts +12 -0
- package/dist/commands/commitments/action-proposals/execute.js +29 -0
- package/dist/commands/commitments/action-proposals.d.ts +13 -0
- package/dist/commands/commitments/action-proposals.js +56 -0
- package/dist/commands/commitments/autonomy.d.ts +7 -11
- package/dist/commands/commitments/autonomy.js +16 -17
- package/dist/commands/commitments/bundle.d.ts +14 -0
- package/dist/commands/commitments/bundle.js +49 -0
- package/dist/commands/commitments/create.d.ts +33 -5
- package/dist/commands/commitments/create.js +234 -27
- package/dist/commands/commitments/delivery.d.ts +16 -0
- package/dist/commands/commitments/delivery.js +71 -0
- package/dist/commands/commitments/doctor.d.ts +20 -0
- package/dist/commands/commitments/doctor.js +88 -0
- package/dist/commands/commitments/effective-policy.d.ts +2 -0
- package/dist/commands/commitments/effective-policy.js +50 -5
- package/dist/commands/commitments/endpoints/connect.d.ts +3 -10
- package/dist/commands/commitments/endpoints/connect.js +6 -37
- package/dist/commands/commitments/endpoints/create.d.ts +2 -9
- package/dist/commands/commitments/endpoints/create.js +10 -23
- package/dist/commands/commitments/mode.d.ts +15 -0
- package/dist/commands/commitments/mode.js +57 -0
- package/dist/commands/commitments/pack/promote.d.ts +1 -1
- package/dist/commands/commitments/pack/promote.js +7 -3
- package/dist/commands/commitments/pack/shadow.d.ts +3 -2
- package/dist/commands/commitments/pack/shadow.js +6 -4
- package/dist/commands/commitments/patch.d.ts +14 -0
- package/dist/commands/commitments/patch.js +51 -0
- package/dist/commands/commitments/preflight.d.ts +5 -2
- package/dist/commands/commitments/preflight.js +47 -6
- package/dist/commands/commitments/receipt.d.ts +15 -0
- package/dist/commands/commitments/receipt.js +34 -0
- package/dist/commands/commitments/remediate.d.ts +0 -1
- package/dist/commands/commitments/remediate.js +5 -3
- package/dist/commands/commitments/reports.js +27 -5
- package/dist/commands/commitments/show.d.ts +1 -0
- package/dist/commands/commitments/show.js +22 -1
- package/dist/commands/commitments/update.d.ts +9 -2
- package/dist/commands/commitments/update.js +40 -4
- package/dist/commands/commitments/wake-capabilities.d.ts +5 -0
- package/dist/commands/commitments/wake-capabilities.js +23 -7
- package/dist/commands/spaces/bootstrap.js +1 -1
- package/dist/commands/tasks/complete.js +57 -0
- package/dist/commands/tasks/create.js +2 -1
- package/dist/commands/tasks/deliverable/confirm.d.ts +35 -0
- package/dist/commands/tasks/deliverable/confirm.js +77 -0
- package/dist/commands/tasks/expectations.js +20 -1
- package/dist/commands/tasks/report.js +24 -0
- package/dist/commands/tasks/trust.d.ts +35 -0
- package/dist/commands/tasks/trust.js +75 -0
- package/dist/commands/tasks/waive.js +1 -1
- package/dist/lib/commitment-endpoints.d.ts +3 -2
- package/dist/lib/commitment-endpoints.js +12 -9
- package/dist/lib/commitment-product.d.ts +14 -0
- package/dist/lib/commitment-product.js +78 -0
- package/dist/lib/commitments.d.ts +67 -20
- package/dist/lib/commitments.js +89 -39
- package/dist/lib/tasks.js +27 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +3733 -3570
- package/oclif.manifest.json +9291 -8306
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ const api_fetch_1 = require("../../lib/api-fetch");
|
|
|
7
7
|
const outbox_1 = require("../../lib/outbox");
|
|
8
8
|
const task_report_1 = require("../../lib/task-report");
|
|
9
9
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
10
|
+
const tasks_1 = require("../../lib/tasks");
|
|
10
11
|
const session_task_endpoints_1 = require("../../lib/session-task-endpoints");
|
|
11
12
|
const web_url_1 = require("../../lib/web-url");
|
|
12
13
|
/**
|
|
@@ -94,6 +95,29 @@ class TasksReport extends base_command_1.BaseCommand {
|
|
|
94
95
|
...(0, task_report_1.taskReportEventFields)(report),
|
|
95
96
|
artifacts: flags.deliverable?.map((ref) => ({ label: 'deliverable', ref })),
|
|
96
97
|
};
|
|
98
|
+
// THE SAME BRIDGE `tasks complete` CARRIES, for the same reason.
|
|
99
|
+
//
|
|
100
|
+
// `--deliverable` here is prose for a work event's `artifacts` list, and
|
|
101
|
+
// the ledger the completion gate reads is written by `tasks deliverable
|
|
102
|
+
// add`. Three commands in this CLI answer to the word and only one of them
|
|
103
|
+
// writes the ledger — and the project's own operating instructions teach
|
|
104
|
+
// this spelling. So a value that is unambiguously a coordinate is forwarded
|
|
105
|
+
// to the ledger too; prose is left exactly as it was, because guessing a
|
|
106
|
+
// coordinate out of prose fills the ledger with rows nobody can look up.
|
|
107
|
+
for (const ref of flags.deliverable ?? []) {
|
|
108
|
+
const parsed = (0, tasks_1.parseDeliverableCoordinate)(ref);
|
|
109
|
+
if (!parsed.ok) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
await data_provider_1.dataService.addTaskDeliverable(task.id, parsed.value);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Best-effort: a report must still be posted when the ledger write
|
|
117
|
+
// fails, and the completion gate's refusal names the command that
|
|
118
|
+
// writes it.
|
|
119
|
+
}
|
|
120
|
+
}
|
|
97
121
|
const sessionPath = await (0, session_task_endpoints_1.sessionScopedTaskPath)('event');
|
|
98
122
|
let result;
|
|
99
123
|
try {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* `skrr tasks trust <task> <expectation-id> --level <authority> --reason "<why>"`
|
|
4
|
+
*
|
|
5
|
+
* Move how much evidence one expectation demands.
|
|
6
|
+
*
|
|
7
|
+
* A DECISION, not an edit — which is why it is its own command rather than a
|
|
8
|
+
* field on `tasks update`. It is the one control that turns a refusal into a
|
|
9
|
+
* pass with no new work done, so a reader later has to be able to see that it
|
|
10
|
+
* happened and why. Buried in a list patch it would record neither.
|
|
11
|
+
*
|
|
12
|
+
* Lowering is the common direction and it is legitimate: a contract that cannot
|
|
13
|
+
* express "an agent's word is enough for this one" pushes its authors back to
|
|
14
|
+
* declaring nothing at all, which is the failure the whole feature exists to
|
|
15
|
+
* end. Raising takes the same reason and costs nothing to allow.
|
|
16
|
+
*
|
|
17
|
+
* The three levels, weakest first:
|
|
18
|
+
* self_reported whoever did the work says it is done
|
|
19
|
+
* human_confirmed someone else looked and said so
|
|
20
|
+
* observation_backed the platform saw it itself (a merge webhook, an upload)
|
|
21
|
+
*/
|
|
22
|
+
export default class TasksTrust extends BaseCommand {
|
|
23
|
+
static description: string;
|
|
24
|
+
static examples: string[];
|
|
25
|
+
static args: {
|
|
26
|
+
task: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
27
|
+
expectation: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
28
|
+
};
|
|
29
|
+
static flags: {
|
|
30
|
+
level: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
31
|
+
reason: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
32
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
33
|
+
};
|
|
34
|
+
run(): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* `skrr tasks trust <task> <expectation-id> --level <authority> --reason "<why>"`
|
|
8
|
+
*
|
|
9
|
+
* Move how much evidence one expectation demands.
|
|
10
|
+
*
|
|
11
|
+
* A DECISION, not an edit — which is why it is its own command rather than a
|
|
12
|
+
* field on `tasks update`. It is the one control that turns a refusal into a
|
|
13
|
+
* pass with no new work done, so a reader later has to be able to see that it
|
|
14
|
+
* happened and why. Buried in a list patch it would record neither.
|
|
15
|
+
*
|
|
16
|
+
* Lowering is the common direction and it is legitimate: a contract that cannot
|
|
17
|
+
* express "an agent's word is enough for this one" pushes its authors back to
|
|
18
|
+
* declaring nothing at all, which is the failure the whole feature exists to
|
|
19
|
+
* end. Raising takes the same reason and costs nothing to allow.
|
|
20
|
+
*
|
|
21
|
+
* The three levels, weakest first:
|
|
22
|
+
* self_reported whoever did the work says it is done
|
|
23
|
+
* human_confirmed someone else looked and said so
|
|
24
|
+
* observation_backed the platform saw it itself (a merge webhook, an upload)
|
|
25
|
+
*/
|
|
26
|
+
class TasksTrust extends base_command_1.BaseCommand {
|
|
27
|
+
static description = 'Set how much evidence one expectation demands, with a stated reason';
|
|
28
|
+
static examples = [
|
|
29
|
+
'<%= config.bin %> tasks trust <task-id> e1 --level self_reported --reason "Internal draft; nobody else needs to check it."',
|
|
30
|
+
'<%= config.bin %> tasks trust <task-id> e2 --level observation_backed --reason "Customer-facing; I want the platform to see it land."',
|
|
31
|
+
];
|
|
32
|
+
static args = {
|
|
33
|
+
task: core_1.Args.string({ description: 'Task id or ref', required: true, ignoreStdin: true }),
|
|
34
|
+
expectation: core_1.Args.string({
|
|
35
|
+
description: 'Expectation id (see `tasks expectations`)',
|
|
36
|
+
required: true,
|
|
37
|
+
ignoreStdin: true,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
static flags = {
|
|
41
|
+
level: core_1.Flags.string({
|
|
42
|
+
options: [...data_provider_1.DELIVERABLE_AUTHORITIES],
|
|
43
|
+
required: true,
|
|
44
|
+
description: 'How well evidenced the answer must be: self_reported (the doer says so), ' +
|
|
45
|
+
'human_confirmed (someone else looked), observation_backed (the platform saw it).',
|
|
46
|
+
}),
|
|
47
|
+
reason: core_1.Flags.string({
|
|
48
|
+
required: true,
|
|
49
|
+
description: 'Why this bar. Required — it is the record.',
|
|
50
|
+
}),
|
|
51
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
52
|
+
};
|
|
53
|
+
async run() {
|
|
54
|
+
this.requireAuth();
|
|
55
|
+
const { args, flags } = await this.parse(TasksTrust);
|
|
56
|
+
let result;
|
|
57
|
+
try {
|
|
58
|
+
result = await data_provider_1.dataService.setTaskExpectationTrust(args.task, {
|
|
59
|
+
expectationId: args.expectation,
|
|
60
|
+
level: flags.level,
|
|
61
|
+
reason: flags.reason,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
this.handleApiError(err);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (flags.json) {
|
|
69
|
+
this.log(JSON.stringify(result, null, 2));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.log(`${args.expectation} now needs ${flags.level}: ${flags.reason}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.default = TasksTrust;
|
|
@@ -22,7 +22,7 @@ class TasksWaive extends base_command_1.BaseCommand {
|
|
|
22
22
|
static args = {
|
|
23
23
|
task: core_1.Args.string({ description: 'Task id or ref', required: true, ignoreStdin: true }),
|
|
24
24
|
expectation: core_1.Args.string({
|
|
25
|
-
description: 'Expectation id (see `tasks
|
|
25
|
+
description: 'Expectation id (see `tasks expectations`)',
|
|
26
26
|
required: true,
|
|
27
27
|
ignoreStdin: true,
|
|
28
28
|
}),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { withQuery } from './triggers';
|
|
2
2
|
export declare const ENDPOINT_CAPABILITIES: readonly ["push", "reply", "structuredAsk"];
|
|
3
|
+
export declare const COMMITMENT_ENDPOINT_DESTINATIONS: readonly ["slack_channel", "slack_owner_dm", "app_owner_dm"];
|
|
3
4
|
export type EndpointCapability = (typeof ENDPOINT_CAPABILITIES)[number];
|
|
4
5
|
export interface CommitmentEndpoint {
|
|
5
6
|
id: string;
|
|
@@ -21,9 +22,9 @@ export declare const commitmentEndpointApi: {
|
|
|
21
22
|
endpoints: CommitmentEndpoint[];
|
|
22
23
|
}>;
|
|
23
24
|
create: (body: Record<string, unknown>) => Promise<CommitmentEndpoint>;
|
|
24
|
-
/**
|
|
25
|
+
/** Probes the native App/Slack transport and records current health. */
|
|
25
26
|
connect: (id: string, body?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
26
|
-
/**
|
|
27
|
+
/** Legacy compatibility call; new native endpoints do not use OAuth. */
|
|
27
28
|
finalizeConnect: (id: string, body?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
28
29
|
reconnect: (id: string, body?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
29
30
|
health: (id: string, body?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.commitmentEndpointApi = exports.ENDPOINT_CAPABILITIES = void 0;
|
|
3
|
+
exports.commitmentEndpointApi = exports.COMMITMENT_ENDPOINT_DESTINATIONS = exports.ENDPOINT_CAPABILITIES = void 0;
|
|
4
4
|
exports.renderEndpointList = renderEndpointList;
|
|
5
5
|
/**
|
|
6
6
|
* commitment-endpoints.ts — client for `/api/commitment-endpoints`.
|
|
7
7
|
*
|
|
8
8
|
* A **commitment endpoint** is a channel-neutral DELIVERY TARGET: "this agent
|
|
9
|
-
* can reach me on Slack DM / this channel /
|
|
9
|
+
* can reach me on Slack DM / this channel / App DM", expressed as a connection
|
|
10
10
|
* record with a readiness state. Commitments then declare report targets against
|
|
11
11
|
* these, so a commitment never names a raw Slack channel id or a token.
|
|
12
12
|
*
|
|
13
13
|
* The lifecycle is the interesting part, and it is why this needs a CLI at all:
|
|
14
14
|
*
|
|
15
|
-
* create → connect →
|
|
15
|
+
* create → connect/probe → connected → [health] → reconnect / revoke
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* step that used to require a browser — which meant a headless operator could
|
|
20
|
-
* not set up a commitment's reporting at all.
|
|
17
|
+
* OAuth connector metadata is deliberately absent: the delivery router uses
|
|
18
|
+
* the native Agent Slack installation or built-in App transport.
|
|
21
19
|
*/
|
|
22
20
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
23
21
|
const format_1 = require("./format");
|
|
24
22
|
const triggers_1 = require("./triggers");
|
|
25
23
|
exports.ENDPOINT_CAPABILITIES = ['push', 'reply', 'structuredAsk'];
|
|
24
|
+
exports.COMMITMENT_ENDPOINT_DESTINATIONS = [
|
|
25
|
+
'slack_channel',
|
|
26
|
+
'slack_owner_dm',
|
|
27
|
+
'app_owner_dm',
|
|
28
|
+
];
|
|
26
29
|
const MOUNT = '/api/commitment-endpoints';
|
|
27
30
|
const base = (id) => `${MOUNT}/${encodeURIComponent(id)}`;
|
|
28
31
|
exports.commitmentEndpointApi = {
|
|
29
32
|
list: (query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(MOUNT, query)),
|
|
30
33
|
create: (body) => data_provider_1.request.post(MOUNT, body),
|
|
31
|
-
/**
|
|
34
|
+
/** Probes the native App/Slack transport and records current health. */
|
|
32
35
|
connect: (id, body = {}) => data_provider_1.request.post(`${base(id)}/connect`, body),
|
|
33
|
-
/**
|
|
36
|
+
/** Legacy compatibility call; new native endpoints do not use OAuth. */
|
|
34
37
|
finalizeConnect: (id, body = {}) => data_provider_1.request.post(`${base(id)}/connect/finalize`, body),
|
|
35
38
|
reconnect: (id, body = {}) => data_provider_1.request.post(`${base(id)}/reconnect`, body),
|
|
36
39
|
health: (id, body = {}) => data_provider_1.request.post(`${base(id)}/health`, body),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CommitmentDeliveryIntent, CommitmentExecutionReceipt } from '@skrr-ai/data-provider';
|
|
2
|
+
export declare const COMMITMENT_PRODUCT_MODES: readonly ["monitor", "prepare", "execute"];
|
|
3
|
+
export declare const COMMITMENT_DELIVERY_CHOICES: readonly ["report-only", "local-patch", "draft-pr", "push-branch", "direct-branch"];
|
|
4
|
+
/** Compatibility is accepted at the input boundary; everyday output uses the product contract. */
|
|
5
|
+
export declare function productMode(value?: string): 'monitor' | 'prepare' | 'execute';
|
|
6
|
+
export declare function productModeLabel(value?: string): string;
|
|
7
|
+
export declare function deliveryLabel(mode?: string): string;
|
|
8
|
+
export declare function deliveryInput(mode: string, options?: {
|
|
9
|
+
repo?: string;
|
|
10
|
+
base?: string;
|
|
11
|
+
}): CommitmentDeliveryIntent;
|
|
12
|
+
/** Monitor is observation-only; retain report expectations, never repo coordinates. */
|
|
13
|
+
export declare function deliveryForProductMode(mode: string | undefined, delivery?: CommitmentDeliveryIntent): CommitmentDeliveryIntent | undefined;
|
|
14
|
+
export declare function renderExecutionReceipt(receipt: CommitmentExecutionReceipt, log: (line: string) => void, verbose?: boolean): void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMMITMENT_DELIVERY_CHOICES = exports.COMMITMENT_PRODUCT_MODES = void 0;
|
|
4
|
+
exports.productMode = productMode;
|
|
5
|
+
exports.productModeLabel = productModeLabel;
|
|
6
|
+
exports.deliveryLabel = deliveryLabel;
|
|
7
|
+
exports.deliveryInput = deliveryInput;
|
|
8
|
+
exports.deliveryForProductMode = deliveryForProductMode;
|
|
9
|
+
exports.renderExecutionReceipt = renderExecutionReceipt;
|
|
10
|
+
exports.COMMITMENT_PRODUCT_MODES = ['monitor', 'prepare', 'execute'];
|
|
11
|
+
exports.COMMITMENT_DELIVERY_CHOICES = [
|
|
12
|
+
'report-only',
|
|
13
|
+
'local-patch',
|
|
14
|
+
'draft-pr',
|
|
15
|
+
'push-branch',
|
|
16
|
+
'direct-branch',
|
|
17
|
+
];
|
|
18
|
+
/** Compatibility is accepted at the input boundary; everyday output uses the product contract. */
|
|
19
|
+
function productMode(value) {
|
|
20
|
+
if (value === 'prepare' || value === 'ask_first')
|
|
21
|
+
return 'prepare';
|
|
22
|
+
if (['execute', 'auto_run', 'auto_run_limited'].includes(value || ''))
|
|
23
|
+
return 'execute';
|
|
24
|
+
return 'monitor';
|
|
25
|
+
}
|
|
26
|
+
function productModeLabel(value) {
|
|
27
|
+
if (value === 'off')
|
|
28
|
+
return 'Not running';
|
|
29
|
+
const mode = productMode(value);
|
|
30
|
+
return mode[0].toUpperCase() + mode.slice(1);
|
|
31
|
+
}
|
|
32
|
+
function deliveryLabel(mode) {
|
|
33
|
+
return ({
|
|
34
|
+
report_only: 'Report only',
|
|
35
|
+
local_patch: 'Local patch',
|
|
36
|
+
draft_pr: 'Draft PR',
|
|
37
|
+
push_branch: 'Push branch',
|
|
38
|
+
direct_branch: 'Direct branch',
|
|
39
|
+
}[mode || ''] || 'Not declared');
|
|
40
|
+
}
|
|
41
|
+
function deliveryInput(mode, options = {}) {
|
|
42
|
+
const normalized = mode.replace(/-/g, '_');
|
|
43
|
+
if (!exports.COMMITMENT_DELIVERY_CHOICES.some((choice) => choice.replace(/-/g, '_') === normalized)) {
|
|
44
|
+
throw new Error(`Unknown delivery. Choose ${exports.COMMITMENT_DELIVERY_CHOICES.join(', ')}.`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
version: 1,
|
|
48
|
+
mode: normalized,
|
|
49
|
+
...(options.repo ? { repo: options.repo } : {}),
|
|
50
|
+
...(options.base ? { baseBranch: options.base } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Monitor is observation-only; retain report expectations, never repo coordinates. */
|
|
54
|
+
function deliveryForProductMode(mode, delivery) {
|
|
55
|
+
if (productMode(mode) !== 'monitor')
|
|
56
|
+
return delivery;
|
|
57
|
+
return {
|
|
58
|
+
version: 1,
|
|
59
|
+
mode: 'report_only',
|
|
60
|
+
...(delivery?.expectations ? { expectations: delivery.expectations } : {}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function renderExecutionReceipt(receipt, log, verbose = false) {
|
|
64
|
+
log(receipt.summary);
|
|
65
|
+
log(`Mode: ${productModeLabel(receipt.mode)}`);
|
|
66
|
+
for (const phase of receipt.phases) {
|
|
67
|
+
const mark = { done: '✓', working: '→', waiting: '…', failed: '×', skipped: '–' }[phase.status];
|
|
68
|
+
log(` ${mark} ${phase.phase[0].toUpperCase() + phase.phase.slice(1)}: ${phase.summary}${phase.at ? ` · ${phase.at}` : ''}`);
|
|
69
|
+
for (const evidence of phase.evidence) {
|
|
70
|
+
if (evidence.url)
|
|
71
|
+
log(` ${evidence.label}: ${evidence.url}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (receipt.nextActor)
|
|
75
|
+
log(`Next: ${receipt.nextActor.label || receipt.nextActor.kind}${receipt.nextActor.reason ? ` — ${receipt.nextActor.reason}` : ''}`);
|
|
76
|
+
if (verbose)
|
|
77
|
+
log(`Diagnostics:\n${JSON.stringify({ id: receipt.id, revision: receipt.revision, evidence: receipt.evidence, diagnostics: receipt.diagnostics }, null, 2)}`);
|
|
78
|
+
}
|
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
* Two `kind`s: `achieve` (bounded, deadline-bearing) and `maintain` (perpetual
|
|
17
17
|
* "hold this state", derived from a Compass invariant — not authored here).
|
|
18
18
|
*/
|
|
19
|
-
import { COMMITMENT_WATCHED_SOURCES, COMMITMENT_TEMPLATE_IDS, COMMITMENT_CADENCE_MODES, COMMITMENT_CADENCE_TIME_PATTERN, COMMITMENT_CADENCE_MAX_TIMES } from '@skrr-ai/data-provider';
|
|
20
|
-
import type { CommitmentCheck, CommitmentChecksResponse, Commitment, CommitmentListResponse, CommitmentPlanResponse, CommitmentStatusResponse, CommitmentWorkLink } from '@skrr-ai/data-provider';
|
|
19
|
+
import { COMMITMENT_WATCHED_SOURCES, COMMITMENT_TEMPLATE_IDS, COMMITMENT_CADENCE_MODES, COMMITMENT_CADENCE_TIME_PATTERN, COMMITMENT_CADENCE_MAX_TIMES, COMMITMENT_AUTONOMY_MODES, COMMITMENT_EXECUTION_ISOLATION_MODES } from '@skrr-ai/data-provider';
|
|
20
|
+
import type { CommitmentCheck, CommitmentChecksResponse, Commitment, CommitmentActionProposal, CommitmentListResponse, CommitmentPlanResponse, CommitmentStatusResponse, CommitmentWorkLink, CommitmentExecutionReceiptListResponse, CommitmentCapabilitySource, CommitmentDeliveryPatchResponse, CommitmentDeliveryBundleResponse } from '@skrr-ai/data-provider';
|
|
21
21
|
import { withQuery } from './triggers';
|
|
22
22
|
export { COMMITMENT_WATCHED_SOURCES, COMMITMENT_TEMPLATE_IDS, COMMITMENT_CADENCE_MODES, COMMITMENT_CADENCE_TIME_PATTERN, COMMITMENT_CADENCE_MAX_TIMES, };
|
|
23
|
-
export type { CommitmentCheck, CommitmentChecksResponse, Commitment, CommitmentListResponse, CommitmentPlanResponse, CommitmentStatusResponse, CommitmentWorkLink, };
|
|
23
|
+
export type { CommitmentCheck, CommitmentChecksResponse, Commitment, CommitmentActionProposal, CommitmentListResponse, CommitmentPlanResponse, CommitmentStatusResponse, CommitmentWorkLink, };
|
|
24
|
+
/** Derived from the installed compatibility vocabulary so the CLI remains
|
|
25
|
+
* safe even while data-provider and CLI packages roll out separately. */
|
|
26
|
+
export declare const COMMITMENT_AUTHORABLE_CADENCE_MODES: ("manual" | "daily" | "interval" | "event_plus_interval")[];
|
|
24
27
|
/**
|
|
25
28
|
* oclif's `options:` needs runtime arrays, but data-provider models these two as
|
|
26
29
|
* union TYPES only. The values live here — and both directions of drift are a
|
|
@@ -28,16 +31,31 @@ export type { CommitmentCheck, CommitmentChecksResponse, Commitment, CommitmentL
|
|
|
28
31
|
* `_Exhaustive*` guards fail to resolve if a canonical value is missing.
|
|
29
32
|
*/
|
|
30
33
|
export declare const COMMITMENT_STATUSES: readonly ["draft", "active", "paused", "completed", "cancelled", "archived"];
|
|
31
|
-
/**
|
|
32
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Autonomy ladder — how much the commitment may act without asking.
|
|
36
|
+
*
|
|
37
|
+
* Re-exported, not restated: `@skrr-ai/data-provider` owns the vocabulary, and
|
|
38
|
+
* a second literal here is how the CLI would silently drift from the server
|
|
39
|
+
* that rejects its values.
|
|
40
|
+
*/
|
|
41
|
+
export { COMMITMENT_AUTONOMY_MODES };
|
|
42
|
+
export declare const COMMITMENT_AUTHORABLE_AUTONOMY_MODES: readonly ["monitor", "prepare", "execute"];
|
|
43
|
+
export type CommitmentAuthorableAutonomyMode = (typeof COMMITMENT_AUTHORABLE_AUTONOMY_MODES)[number];
|
|
44
|
+
export declare function storedAutonomyModeForAuthoring(mode: CommitmentAuthorableAutonomyMode | string): 'suggestions_only' | 'ask_first' | 'auto_run';
|
|
45
|
+
export declare function authoringAutonomyModeForStored(mode?: string | null): CommitmentAuthorableAutonomyMode;
|
|
46
|
+
export declare function commitmentAutonomyLabel(mode?: string | null): string;
|
|
47
|
+
/**
|
|
48
|
+
* Where a Commitment's autonomous runs do their work. Re-exported for the same
|
|
49
|
+
* reason as the ladder above: the vocabulary is the server's, and a picker that
|
|
50
|
+
* offers a value the API rejects is a silent drift.
|
|
51
|
+
*/
|
|
52
|
+
export { COMMITMENT_EXECUTION_ISOLATION_MODES };
|
|
33
53
|
/**
|
|
34
54
|
* Interval bounds for `cadence.intervalMs`.
|
|
35
55
|
*
|
|
36
|
-
* The
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* over 24h yields a commitment whose control loop NEVER fires while every surface
|
|
40
|
-
* reports success. Cap at 24h so that state is unreachable from the CLI.
|
|
56
|
+
* The Trigger schedule and Commitment contract now share the same one-year
|
|
57
|
+
* upper bound. Keep the CLI aligned so a valid long-interval contract does not
|
|
58
|
+
* get rejected only at this surface.
|
|
41
59
|
*/
|
|
42
60
|
export declare const MIN_COMMITMENT_INTERVAL_MS = 60000;
|
|
43
61
|
export declare const MAX_COMMITMENT_INTERVAL_MS: number;
|
|
@@ -50,6 +68,7 @@ export type CommitmentView = Partial<Commitment>;
|
|
|
50
68
|
export type CommitmentCheckView = Partial<CommitmentCheck>;
|
|
51
69
|
export type CommitmentPreflightReport = {
|
|
52
70
|
verdict: 'ready' | 'needs_review' | 'blocked';
|
|
71
|
+
capabilities?: CommitmentCapabilitySource[];
|
|
53
72
|
gates: Array<{
|
|
54
73
|
id: string;
|
|
55
74
|
label: string;
|
|
@@ -159,6 +178,7 @@ export type CommitmentPackLifecycleResponse = {
|
|
|
159
178
|
title?: string;
|
|
160
179
|
status?: string;
|
|
161
180
|
policy?: Record<string, unknown>;
|
|
181
|
+
delivery?: Commitment['delivery'];
|
|
162
182
|
};
|
|
163
183
|
pack: {
|
|
164
184
|
id: string;
|
|
@@ -210,6 +230,7 @@ export declare const commitmentApi: {
|
|
|
210
230
|
get: (id: string) => Promise<CommitmentStatusResponse>;
|
|
211
231
|
create: (body: Record<string, unknown>) => Promise<Commitment>;
|
|
212
232
|
update: (id: string, body: Record<string, unknown>) => Promise<Commitment>;
|
|
233
|
+
draftPreflight: (body: Record<string, unknown>) => Promise<CommitmentPreflightReport>;
|
|
213
234
|
workLinks: (id: string, includeInactive?: boolean) => Promise<{
|
|
214
235
|
object: "commitment_work_link_list";
|
|
215
236
|
data: CommitmentWorkLink[];
|
|
@@ -232,12 +253,26 @@ export declare const commitmentApi: {
|
|
|
232
253
|
actionHistory: (id: string, limit?: number) => Promise<{
|
|
233
254
|
data: unknown[];
|
|
234
255
|
}>;
|
|
256
|
+
actionProposals: (id: string, query?: {
|
|
257
|
+
status?: string;
|
|
258
|
+
limit?: number;
|
|
259
|
+
}) => Promise<{
|
|
260
|
+
object: "commitment_action_proposal_list";
|
|
261
|
+
data: CommitmentActionProposal[];
|
|
262
|
+
}>;
|
|
263
|
+
decideActionProposal: (id: string, proposalId: string, decision: "approve" | "reject") => Promise<Record<string, unknown>>;
|
|
264
|
+
executeActionProposal: (id: string, proposalId: string) => Promise<Record<string, unknown>>;
|
|
235
265
|
preflight: (id: string, nextRunCount?: number) => Promise<CommitmentPreflightReport>;
|
|
236
266
|
effectivePolicy: (id: string) => Promise<Record<string, unknown>>;
|
|
237
267
|
pause: (id: string) => Promise<Commitment>;
|
|
238
268
|
resume: (id: string) => Promise<Commitment>;
|
|
239
269
|
complete: (id: string) => Promise<Commitment>;
|
|
240
270
|
autonomy: (id: string, body: Record<string, unknown>) => Promise<Commitment>;
|
|
271
|
+
mode: (id: string, body: Record<string, unknown>) => Promise<Commitment>;
|
|
272
|
+
delivery: (id: string, body: Record<string, unknown>) => Promise<Commitment>;
|
|
273
|
+
receipts: (id: string, limit?: number) => Promise<CommitmentExecutionReceiptListResponse>;
|
|
274
|
+
deliveryPatch: (id: string, taskId: string) => Promise<CommitmentDeliveryPatchResponse>;
|
|
275
|
+
deliveryBundle: (id: string, taskId: string) => Promise<CommitmentDeliveryBundleResponse>;
|
|
241
276
|
operatingReview: (agentId: string) => Promise<Record<string, unknown>>;
|
|
242
277
|
reflection: (id: string) => Promise<Record<string, unknown>>;
|
|
243
278
|
decideReflectionProposal: (id: string, proposalKey: string, decision: "approve" | "reject") => Promise<Record<string, unknown>>;
|
|
@@ -324,6 +359,7 @@ export declare const commitmentApi: {
|
|
|
324
359
|
};
|
|
325
360
|
/** Shape of `GET /:id/wake-capabilities`. */
|
|
326
361
|
export interface CommitmentWakeCapabilities {
|
|
362
|
+
workPromotionModel?: 'monitor_prepare_execute_v1';
|
|
327
363
|
mode: string;
|
|
328
364
|
selectedCapabilityIds?: string[];
|
|
329
365
|
eligibleCapabilities: Array<{
|
|
@@ -346,7 +382,19 @@ export declare const COMMITMENT_FEEDBACK_KINDS: readonly ["useful", "noisy", "wr
|
|
|
346
382
|
*/
|
|
347
383
|
export declare const COMMITMENT_REMEDIATION_ACTIONS: readonly ["pause_commitment", "mute_user_nudges", "reduce_nudge_frequency", "tighten_policy", "mark_noop"];
|
|
348
384
|
/** The only keys `createBodySchema` (a `z.strictObject`) accepts. */
|
|
349
|
-
export declare const COMMITMENT_CREATE_KEYS: readonly ["agentId", "kind", "compassId", "compassOrigin", "goalId", "title", "description", "agentDirective", "status", "target", "watchedSources", "policy", "cadence", "subject", "sensors", "grants", "reports", "createdVia"];
|
|
385
|
+
export declare const COMMITMENT_CREATE_KEYS: readonly ["mode", "agentId", "kind", "compassId", "compassOrigin", "goalId", "title", "description", "agentDirective", "status", "target", "watchedSources", "policy", "delivery", "cadence", "subject", "sensors", "grants", "reports", "createdVia"];
|
|
386
|
+
/**
|
|
387
|
+
* Read the per-Commitment domain policy from an inline flag or a text file.
|
|
388
|
+
*
|
|
389
|
+
* This deliberately uses a separate pair of names from Agent-level instruction
|
|
390
|
+
* commands: the result configures one Commitment run, not the Agent's global
|
|
391
|
+
* prompt. The explicit error also keeps shell users from accidentally masking
|
|
392
|
+
* a reviewed file with a short inline experiment.
|
|
393
|
+
*/
|
|
394
|
+
export declare function readCommitmentAgentDirective({ directive, file, }: {
|
|
395
|
+
directive?: string;
|
|
396
|
+
file?: string;
|
|
397
|
+
}): Promise<string | undefined>;
|
|
350
398
|
/**
|
|
351
399
|
* Normalize a `--from-json` body into something the create endpoint accepts.
|
|
352
400
|
*
|
|
@@ -357,8 +405,9 @@ export declare const COMMITMENT_CREATE_KEYS: readonly ["agentId", "kind", "compa
|
|
|
357
405
|
* contract dumped from `list --json` carries id/version/state/ownerUserId/…
|
|
358
406
|
* — drop everything the schema does not declare.
|
|
359
407
|
*
|
|
360
|
-
* `status` is additionally narrowed: create only permits `draft
|
|
361
|
-
* dumped contract may carry
|
|
408
|
+
* `status` is additionally narrowed: create only permits `draft`; activation
|
|
409
|
+
* is the separate resume + preflight boundary. A dumped contract may carry an
|
|
410
|
+
* active or terminal state, but importing it must still create a draft.
|
|
362
411
|
*/
|
|
363
412
|
export declare function normalizeCreateBody(input: Record<string, unknown>): Record<string, unknown>;
|
|
364
413
|
export declare function parseIntervalToMs(input: string): number;
|
|
@@ -437,13 +486,11 @@ export declare function renderCommitmentList(commitments: CommitmentView[], log:
|
|
|
437
486
|
* The autonomy mode a check ACTUALLY ran at, read from its policy trace
|
|
438
487
|
* (OSK-4881).
|
|
439
488
|
*
|
|
440
|
-
* A
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
* `
|
|
444
|
-
*
|
|
445
|
-
* `effectiveAutonomyMode`. Either answers "what governed this run". Returns the
|
|
446
|
-
* effective mode when the trace carries one, else undefined.
|
|
489
|
+
* A check records the Mode it actually used in `decision.policyTrace`. For the
|
|
490
|
+
* v2 product contract, only an explicit Workspace-admin constraint may lower
|
|
491
|
+
* the declared Mode; legacy checks may still carry older effective-mode traces.
|
|
492
|
+
* Either `autonomyMode` or `effectiveAutonomyMode` answers what governed that
|
|
493
|
+
* particular run. Returns undefined when the trace carries neither.
|
|
447
494
|
*
|
|
448
495
|
* Exported for tests.
|
|
449
496
|
*/
|