@skrr-ai/cli 0.1.17 → 0.1.19
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 +7 -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 -25
- package/dist/commands/commitments/bundle.d.ts +14 -0
- package/dist/commands/commitments/bundle.js +49 -0
- package/dist/commands/commitments/create.d.ts +25 -0
- package/dist/commands/commitments/create.js +200 -23
- package/dist/commands/commitments/delivery.d.ts +16 -0
- package/dist/commands/commitments/delivery.js +72 -0
- package/dist/commands/commitments/doctor.d.ts +1 -0
- package/dist/commands/commitments/doctor.js +33 -17
- 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 +58 -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 +2 -1
- package/dist/commands/commitments/preflight.js +23 -4
- 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 +12 -3
- package/dist/commands/commitments/show.d.ts +1 -0
- package/dist/commands/commitments/show.js +22 -1
- package/dist/commands/commitments/update.js +4 -2
- 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/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 +39 -17
- package/dist/lib/commitments.js +70 -29
- package/dist/node_modules/@skrr-ai/data-provider/index.js +3551 -3461
- package/oclif.manifest.json +10132 -9461
- package/package.json +1 -1
package/dist/lib/commitments.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COMMITMENT_CLI_EVALUATORS = exports.COMMITMENT_CREATE_KEYS = exports.COMMITMENT_REMEDIATION_ACTIONS = exports.COMMITMENT_FEEDBACK_KINDS = exports.commitmentApi = exports.commitmentPackApi = exports.MAX_COMMITMENT_INTERVAL_MS = exports.MIN_COMMITMENT_INTERVAL_MS = exports.COMMITMENT_EXECUTION_ISOLATION_MODES = exports.COMMITMENT_AUTONOMY_MODES = exports.COMMITMENT_STATUSES = exports.COMMITMENT_CADENCE_MAX_TIMES = exports.COMMITMENT_CADENCE_TIME_PATTERN = exports.COMMITMENT_CADENCE_MODES = exports.COMMITMENT_TEMPLATE_IDS = exports.COMMITMENT_WATCHED_SOURCES = void 0;
|
|
3
|
+
exports.COMMITMENT_CLI_EVALUATORS = exports.COMMITMENT_CREATE_KEYS = exports.COMMITMENT_REMEDIATION_ACTIONS = exports.COMMITMENT_FEEDBACK_KINDS = exports.commitmentApi = exports.commitmentPackApi = exports.MAX_COMMITMENT_INTERVAL_MS = exports.MIN_COMMITMENT_INTERVAL_MS = exports.COMMITMENT_EXECUTION_ISOLATION_MODES = exports.COMMITMENT_AUTHORABLE_AUTONOMY_MODES = exports.COMMITMENT_AUTONOMY_MODES = exports.COMMITMENT_STATUSES = exports.COMMITMENT_AUTHORABLE_CADENCE_MODES = exports.COMMITMENT_CADENCE_MAX_TIMES = exports.COMMITMENT_CADENCE_TIME_PATTERN = exports.COMMITMENT_CADENCE_MODES = exports.COMMITMENT_TEMPLATE_IDS = exports.COMMITMENT_WATCHED_SOURCES = void 0;
|
|
4
|
+
exports.storedAutonomyModeForAuthoring = storedAutonomyModeForAuthoring;
|
|
5
|
+
exports.authoringAutonomyModeForStored = authoringAutonomyModeForStored;
|
|
6
|
+
exports.commitmentAutonomyLabel = commitmentAutonomyLabel;
|
|
4
7
|
exports.readCommitmentAgentDirective = readCommitmentAgentDirective;
|
|
5
8
|
exports.normalizeCreateBody = normalizeCreateBody;
|
|
6
9
|
exports.parseIntervalToMs = parseIntervalToMs;
|
|
@@ -48,9 +51,13 @@ Object.defineProperty(exports, "COMMITMENT_CADENCE_TIME_PATTERN", { enumerable:
|
|
|
48
51
|
Object.defineProperty(exports, "COMMITMENT_CADENCE_MAX_TIMES", { enumerable: true, get: function () { return data_provider_1.COMMITMENT_CADENCE_MAX_TIMES; } });
|
|
49
52
|
Object.defineProperty(exports, "COMMITMENT_AUTONOMY_MODES", { enumerable: true, get: function () { return data_provider_1.COMMITMENT_AUTONOMY_MODES; } });
|
|
50
53
|
Object.defineProperty(exports, "COMMITMENT_EXECUTION_ISOLATION_MODES", { enumerable: true, get: function () { return data_provider_1.COMMITMENT_EXECUTION_ISOLATION_MODES; } });
|
|
54
|
+
const commitment_product_1 = require("./commitment-product");
|
|
51
55
|
const instruction_input_1 = require("./instruction-input");
|
|
52
56
|
const format_1 = require("./format");
|
|
53
57
|
const triggers_1 = require("./triggers");
|
|
58
|
+
/** Derived from the installed compatibility vocabulary so the CLI remains
|
|
59
|
+
* safe even while data-provider and CLI packages roll out separately. */
|
|
60
|
+
exports.COMMITMENT_AUTHORABLE_CADENCE_MODES = data_provider_1.COMMITMENT_CADENCE_MODES.filter((mode) => mode !== 'sampled');
|
|
54
61
|
/**
|
|
55
62
|
* oclif's `options:` needs runtime arrays, but data-provider models these two as
|
|
56
63
|
* union TYPES only. The values live here — and both directions of drift are a
|
|
@@ -67,17 +74,43 @@ exports.COMMITMENT_STATUSES = [
|
|
|
67
74
|
];
|
|
68
75
|
const _statusDriftGuard = true;
|
|
69
76
|
void _statusDriftGuard;
|
|
77
|
+
exports.COMMITMENT_AUTHORABLE_AUTONOMY_MODES = ['monitor', 'prepare', 'execute'];
|
|
78
|
+
function storedAutonomyModeForAuthoring(mode) {
|
|
79
|
+
if (mode === 'monitor')
|
|
80
|
+
return 'suggestions_only';
|
|
81
|
+
if (mode === 'prepare')
|
|
82
|
+
return 'ask_first';
|
|
83
|
+
if (mode === 'execute')
|
|
84
|
+
return 'auto_run';
|
|
85
|
+
throw new Error(`Unsupported autonomy mode: ${mode}. Use monitor, prepare, or execute.`);
|
|
86
|
+
}
|
|
87
|
+
function authoringAutonomyModeForStored(mode) {
|
|
88
|
+
if (mode === 'ask_first')
|
|
89
|
+
return 'prepare';
|
|
90
|
+
if (mode === 'auto_run' || mode === 'auto_run_limited')
|
|
91
|
+
return 'execute';
|
|
92
|
+
return 'monitor';
|
|
93
|
+
}
|
|
94
|
+
function commitmentAutonomyLabel(mode) {
|
|
95
|
+
if (mode === 'suggestions_only')
|
|
96
|
+
return 'Monitor';
|
|
97
|
+
if (mode === 'ask_first')
|
|
98
|
+
return 'Prepare';
|
|
99
|
+
if (mode === 'auto_run' || mode === 'auto_run_limited')
|
|
100
|
+
return 'Execute';
|
|
101
|
+
if (mode === 'off')
|
|
102
|
+
return 'Legacy off (pause the Commitment)';
|
|
103
|
+
return mode || '-';
|
|
104
|
+
}
|
|
70
105
|
/**
|
|
71
106
|
* Interval bounds for `cadence.intervalMs`.
|
|
72
107
|
*
|
|
73
|
-
* The
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* over 24h yields a commitment whose control loop NEVER fires while every surface
|
|
77
|
-
* reports success. Cap at 24h so that state is unreachable from the CLI.
|
|
108
|
+
* The Trigger schedule and Commitment contract now share the same one-year
|
|
109
|
+
* upper bound. Keep the CLI aligned so a valid long-interval contract does not
|
|
110
|
+
* get rejected only at this surface.
|
|
78
111
|
*/
|
|
79
112
|
exports.MIN_COMMITMENT_INTERVAL_MS = 60_000;
|
|
80
|
-
exports.MAX_COMMITMENT_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
113
|
+
exports.MAX_COMMITMENT_INTERVAL_MS = 365 * 24 * 60 * 60 * 1000;
|
|
81
114
|
function base(id) {
|
|
82
115
|
return `/api/commitments/${encodeURIComponent(id)}`;
|
|
83
116
|
}
|
|
@@ -119,6 +152,11 @@ exports.commitmentApi = {
|
|
|
119
152
|
checkNow: (id) => data_provider_1.request.post(`${base(id)}/check-now`, {}),
|
|
120
153
|
checks: (id, limit) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/checks`, { limit })),
|
|
121
154
|
actionHistory: (id, limit) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/action-history`, { limit })),
|
|
155
|
+
actionProposals: (id, query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/action-proposals`, query)),
|
|
156
|
+
decideActionProposal: (id, proposalId, decision) => data_provider_1.request.post(`${base(id)}/action-proposals/${encodeURIComponent(proposalId)}/decision`, {
|
|
157
|
+
decision,
|
|
158
|
+
}),
|
|
159
|
+
executeActionProposal: (id, proposalId) => data_provider_1.request.post(`${base(id)}/action-proposals/${encodeURIComponent(proposalId)}/execute`, {}),
|
|
122
160
|
preflight: (id, nextRunCount) => data_provider_1.request.post(`${base(id)}/preflight`, {
|
|
123
161
|
...(typeof nextRunCount === 'number' ? { nextRunCount } : {}),
|
|
124
162
|
}),
|
|
@@ -127,6 +165,11 @@ exports.commitmentApi = {
|
|
|
127
165
|
resume: (id) => data_provider_1.request.post(`${base(id)}/resume`, {}),
|
|
128
166
|
complete: (id) => data_provider_1.request.post(`${base(id)}/complete`, {}),
|
|
129
167
|
autonomy: (id, body) => data_provider_1.request.post(`${base(id)}/autonomy`, body),
|
|
168
|
+
mode: (id, body) => data_provider_1.request.post(`${base(id)}/mode`, body),
|
|
169
|
+
delivery: (id, body) => data_provider_1.request.post(`${base(id)}/delivery`, body),
|
|
170
|
+
receipts: (id, limit = 1) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/receipts`, { limit })),
|
|
171
|
+
deliveryPatch: (id, taskId) => data_provider_1.request.get(`${base(id)}/delivery/${encodeURIComponent(taskId)}/patch`),
|
|
172
|
+
deliveryBundle: (id, taskId) => data_provider_1.request.get(`${base(id)}/delivery/${encodeURIComponent(taskId)}/bundle`),
|
|
130
173
|
operatingReview: (agentId) => data_provider_1.request.get(`/api/commitments/agents/${encodeURIComponent(agentId)}/operating-review`),
|
|
131
174
|
reflection: (id) => data_provider_1.request.get(`${base(id)}/reflection`),
|
|
132
175
|
decideReflectionProposal: (id, proposalKey, decision) => data_provider_1.request.post(`${base(id)}/reflection/proposals/${encodeURIComponent(proposalKey)}/decision`, {
|
|
@@ -214,6 +257,7 @@ exports.COMMITMENT_REMEDIATION_ACTIONS = [
|
|
|
214
257
|
];
|
|
215
258
|
/** The only keys `createBodySchema` (a `z.strictObject`) accepts. */
|
|
216
259
|
exports.COMMITMENT_CREATE_KEYS = [
|
|
260
|
+
'mode',
|
|
217
261
|
'agentId',
|
|
218
262
|
'kind',
|
|
219
263
|
'compassId',
|
|
@@ -226,6 +270,7 @@ exports.COMMITMENT_CREATE_KEYS = [
|
|
|
226
270
|
'target',
|
|
227
271
|
'watchedSources',
|
|
228
272
|
'policy',
|
|
273
|
+
'delivery',
|
|
229
274
|
'cadence',
|
|
230
275
|
'subject',
|
|
231
276
|
'sensors',
|
|
@@ -257,8 +302,9 @@ async function readCommitmentAgentDirective({ directive, file, }) {
|
|
|
257
302
|
* contract dumped from `list --json` carries id/version/state/ownerUserId/…
|
|
258
303
|
* — drop everything the schema does not declare.
|
|
259
304
|
*
|
|
260
|
-
* `status` is additionally narrowed: create only permits `draft
|
|
261
|
-
* dumped contract may carry
|
|
305
|
+
* `status` is additionally narrowed: create only permits `draft`; activation
|
|
306
|
+
* is the separate resume + preflight boundary. A dumped contract may carry an
|
|
307
|
+
* active or terminal state, but importing it must still create a draft.
|
|
262
308
|
*/
|
|
263
309
|
function normalizeCreateBody(input) {
|
|
264
310
|
const envelope = input;
|
|
@@ -270,7 +316,7 @@ function normalizeCreateBody(input) {
|
|
|
270
316
|
if (src[key] !== undefined)
|
|
271
317
|
out[key] = src[key];
|
|
272
318
|
}
|
|
273
|
-
if (out.status !== 'draft'
|
|
319
|
+
if (out.status !== 'draft') {
|
|
274
320
|
delete out.status;
|
|
275
321
|
}
|
|
276
322
|
return out;
|
|
@@ -323,7 +369,7 @@ function parseIntervalToMs(input) {
|
|
|
323
369
|
// Throw rather than clamp: silently turning a requested 90d cadence into 30d
|
|
324
370
|
// (or 0 into 1m) hides a real misconfiguration on a live control loop.
|
|
325
371
|
if (ms < exports.MIN_COMMITMENT_INTERVAL_MS || ms > exports.MAX_COMMITMENT_INTERVAL_MS) {
|
|
326
|
-
throw new Error(`Interval "${input}" is out of range — must be between 1m and
|
|
372
|
+
throw new Error(`Interval "${input}" is out of range — must be between 1m and 365d (got ${describeIntervalMs(ms)}).`);
|
|
327
373
|
}
|
|
328
374
|
return ms;
|
|
329
375
|
}
|
|
@@ -508,14 +554,14 @@ function renderCommitmentList(commitments, log) {
|
|
|
508
554
|
status: o.status ?? '-',
|
|
509
555
|
health: o.state?.health ?? '-',
|
|
510
556
|
cadence: cadenceLabel(o),
|
|
511
|
-
autonomy: o.policy?.autonomyMode
|
|
557
|
+
autonomy: (0, commitment_product_1.productModeLabel)(o.policy?.autonomyMode),
|
|
512
558
|
agent: o.agentId ?? '-',
|
|
513
559
|
})), [
|
|
514
560
|
{ key: 'title', header: 'TITLE', maxWidth: 34 },
|
|
515
561
|
{ key: 'status', header: 'STATUS', maxWidth: 10 },
|
|
516
562
|
{ key: 'health', header: 'HEALTH', maxWidth: 16 },
|
|
517
563
|
{ key: 'cadence', header: 'CADENCE', maxWidth: 10 },
|
|
518
|
-
{ key: 'autonomy', header: '
|
|
564
|
+
{ key: 'autonomy', header: 'MODE', maxWidth: 18 },
|
|
519
565
|
{ key: 'agent', header: 'AGENT', verbatim: true },
|
|
520
566
|
// Commitment ids are routinely pasted into `check-now`, so this column
|
|
521
567
|
// is never clipped. Widening the guess (28 → 44) fixed today's
|
|
@@ -527,13 +573,11 @@ function renderCommitmentList(commitments, log) {
|
|
|
527
573
|
* The autonomy mode a check ACTUALLY ran at, read from its policy trace
|
|
528
574
|
* (OSK-4881).
|
|
529
575
|
*
|
|
530
|
-
* A
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
* `
|
|
534
|
-
*
|
|
535
|
-
* `effectiveAutonomyMode`. Either answers "what governed this run". Returns the
|
|
536
|
-
* effective mode when the trace carries one, else undefined.
|
|
576
|
+
* A check records the Mode it actually used in `decision.policyTrace`. For the
|
|
577
|
+
* v2 product contract, only an explicit Workspace-admin constraint may lower
|
|
578
|
+
* the declared Mode; legacy checks may still carry older effective-mode traces.
|
|
579
|
+
* Either `autonomyMode` or `effectiveAutonomyMode` answers what governed that
|
|
580
|
+
* particular run. Returns undefined when the trace carries neither.
|
|
537
581
|
*
|
|
538
582
|
* Exported for tests.
|
|
539
583
|
*/
|
|
@@ -598,14 +642,10 @@ function extractStandstillFromCheck(check) {
|
|
|
598
642
|
function describeAutonomyLine(commitment, latestCheck) {
|
|
599
643
|
const stated = commitment.policy?.autonomyMode ?? '-';
|
|
600
644
|
const effective = effectiveAutonomyMode(latestCheck);
|
|
601
|
-
const envelopeEnabled = commitment.policy?.autonomyEnvelope?.enabled;
|
|
602
|
-
const envelope = typeof envelopeEnabled === 'boolean'
|
|
603
|
-
? ` [envelope: ${envelopeEnabled ? 'enabled' : 'disabled'}]`
|
|
604
|
-
: '';
|
|
605
645
|
if (effective && effective !== stated) {
|
|
606
|
-
return `${stated} (effective: ${effective} —
|
|
646
|
+
return `${(0, commitment_product_1.productModeLabel)(stated)} (effective: ${(0, commitment_product_1.productModeLabel)(effective)} — constrained by configured policy)`;
|
|
607
647
|
}
|
|
608
|
-
return
|
|
648
|
+
return (0, commitment_product_1.productModeLabel)(stated);
|
|
609
649
|
}
|
|
610
650
|
function renderCommitmentSummary(commitment, log,
|
|
611
651
|
/**
|
|
@@ -630,7 +670,8 @@ latestCheck) {
|
|
|
630
670
|
log(`Cadence: ${cadenceLabel(commitment)}`);
|
|
631
671
|
if (commitment.cadence?.nextCheckAt)
|
|
632
672
|
log(`Next check:${` ${commitment.cadence.nextCheckAt}`}`);
|
|
633
|
-
log(`
|
|
673
|
+
log(`Mode: ${describeAutonomyLine(commitment, latestCheck)}`);
|
|
674
|
+
log(`Delivery: ${(0, commitment_product_1.deliveryLabel)(commitment.delivery?.mode)}${commitment.delivery?.repo ? ` · ${commitment.delivery.repo}` : ''}${commitment.delivery?.baseBranch ? ` → ${commitment.delivery.baseBranch}` : ''}`);
|
|
634
675
|
const criteria = commitment.target?.successCriteria || [];
|
|
635
676
|
const evidenceHealth = latestCheck?.inputs?.evidenceHealth;
|
|
636
677
|
const evidenceLine = describeEvidenceHealth(evidenceHealth, criteria.length);
|
|
@@ -654,7 +695,7 @@ latestCheck) {
|
|
|
654
695
|
if (standstill) {
|
|
655
696
|
const streak = commitment.state?.consecutiveUnresolvedChecks;
|
|
656
697
|
const streakClause = typeof streak === 'number' && streak >= 2 ? `${streak} checks in a row: ` : '';
|
|
657
|
-
log(`Standstill:${` ${streakClause}${standstill.reason}`}`);
|
|
698
|
+
log(`Standstill:${` ${streakClause}${(0, data_provider_1.describeStandstill)(standstill.reason).title}`}`);
|
|
658
699
|
if (standstill.fix)
|
|
659
700
|
log(` Fix: ${standstill.fix}`);
|
|
660
701
|
if (standstill.alsoConstrained?.length) {
|
|
@@ -667,7 +708,7 @@ latestCheck) {
|
|
|
667
708
|
})
|
|
668
709
|
.filter((r) => Boolean(r));
|
|
669
710
|
if (also.length)
|
|
670
|
-
log(` Also constrained: ${also.join(', ')}`);
|
|
711
|
+
log(` Also constrained: ${also.map((reason) => (0, data_provider_1.describeStandstill)(reason).title).join(', ')}`);
|
|
671
712
|
}
|
|
672
713
|
}
|
|
673
714
|
const sources = (commitment.watchedSources || [])
|