@skrr-ai/cli 0.1.20 → 0.1.21
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/commitments/action-proposals/decide.js +22 -5
- package/dist/commands/commitments/action-proposals/execute.js +7 -3
- package/dist/commands/commitments/action-proposals.js +6 -4
- package/dist/lib/commitment-product.js +9 -0
- package/dist/lib/commitments.d.ts +4 -1
- package/dist/lib/commitments.js +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refreshClassification.js +9 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refreshClassification.js +9 -2
- package/dist/node_modules/@skrr-ai/data-provider/index.js +13 -5
- package/oclif.manifest.json +19411 -19411
- package/package.json +1 -1
|
@@ -4,10 +4,14 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../../base-command");
|
|
5
5
|
const commitments_1 = require("../../../lib/commitments");
|
|
6
6
|
class CommitmentsActionProposalsDecide extends base_command_1.BaseCommand {
|
|
7
|
-
static description = 'Approve & run, or reject, one frozen
|
|
7
|
+
static description = 'Approve & run, or reject, one frozen Action Bundle';
|
|
8
8
|
static args = {
|
|
9
9
|
commitmentId: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
10
|
-
proposalId: core_1.Args.string({
|
|
10
|
+
proposalId: core_1.Args.string({
|
|
11
|
+
description: 'Action Proposal ID',
|
|
12
|
+
required: true,
|
|
13
|
+
ignoreStdin: true,
|
|
14
|
+
}),
|
|
11
15
|
};
|
|
12
16
|
static flags = {
|
|
13
17
|
json: core_1.Flags.boolean({ description: 'Output the decision and execution receipts as JSON' }),
|
|
@@ -19,7 +23,20 @@ class CommitmentsActionProposalsDecide extends base_command_1.BaseCommand {
|
|
|
19
23
|
const decision = flags.decision;
|
|
20
24
|
let result;
|
|
21
25
|
try {
|
|
22
|
-
const
|
|
26
|
+
const listed = await commitments_1.commitmentApi.actionProposals(args.commitmentId, { limit: 200 });
|
|
27
|
+
const proposal = listed.data.find((item) => item.id === args.proposalId);
|
|
28
|
+
if (!proposal)
|
|
29
|
+
this.error('Action Bundle not found.');
|
|
30
|
+
if (Number(proposal.bundleVersion) >= 2 && !proposal.snapshotDigest) {
|
|
31
|
+
this.error('Action Bundle has no review digest and cannot be decided safely.');
|
|
32
|
+
}
|
|
33
|
+
if (!flags.json && proposal.snapshotDigest) {
|
|
34
|
+
this.log(`Action Bundle digest: ${proposal.snapshotDigest}`);
|
|
35
|
+
}
|
|
36
|
+
const decided = await commitments_1.commitmentApi.decideActionProposal(args.commitmentId, args.proposalId, decision, {
|
|
37
|
+
snapshotDigest: proposal.snapshotDigest,
|
|
38
|
+
bundleVersion: proposal.bundleVersion,
|
|
39
|
+
});
|
|
23
40
|
const execution = decision === 'approve' && decided.status === 'approved'
|
|
24
41
|
? await commitments_1.commitmentApi.executeActionProposal(args.commitmentId, args.proposalId)
|
|
25
42
|
: undefined;
|
|
@@ -31,10 +48,10 @@ class CommitmentsActionProposalsDecide extends base_command_1.BaseCommand {
|
|
|
31
48
|
if (flags.json)
|
|
32
49
|
this.log(JSON.stringify(result, null, 2));
|
|
33
50
|
else if (decision === 'approve') {
|
|
34
|
-
this.log('
|
|
51
|
+
this.log('Action Bundle approved and handed to the durable executor.');
|
|
35
52
|
}
|
|
36
53
|
else {
|
|
37
|
-
this.log('
|
|
54
|
+
this.log('Action Bundle rejected.');
|
|
38
55
|
}
|
|
39
56
|
}
|
|
40
57
|
}
|
|
@@ -4,10 +4,14 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../../base-command");
|
|
5
5
|
const commitments_1 = require("../../../lib/commitments");
|
|
6
6
|
class CommitmentsActionProposalsExecute extends base_command_1.BaseCommand {
|
|
7
|
-
static description = 'Nudge an approved
|
|
7
|
+
static description = 'Nudge an approved Action Bundle now (recovery continues automatically)';
|
|
8
8
|
static args = {
|
|
9
9
|
commitmentId: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
10
|
-
proposalId: core_1.Args.string({
|
|
10
|
+
proposalId: core_1.Args.string({
|
|
11
|
+
description: 'Action Proposal ID',
|
|
12
|
+
required: true,
|
|
13
|
+
ignoreStdin: true,
|
|
14
|
+
}),
|
|
11
15
|
};
|
|
12
16
|
static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
|
|
13
17
|
async run() {
|
|
@@ -23,7 +27,7 @@ class CommitmentsActionProposalsExecute extends base_command_1.BaseCommand {
|
|
|
23
27
|
if (flags.json)
|
|
24
28
|
this.log(JSON.stringify(result, null, 2));
|
|
25
29
|
else
|
|
26
|
-
this.log(`
|
|
30
|
+
this.log(`Action Bundle is ${String(result.status || 'queued')}.`);
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
exports.default = CommitmentsActionProposalsExecute;
|
|
@@ -5,7 +5,7 @@ const base_command_1 = require("../../base-command");
|
|
|
5
5
|
const commitments_1 = require("../../lib/commitments");
|
|
6
6
|
const format_1 = require("../../lib/format");
|
|
7
7
|
class CommitmentsActionProposals extends base_command_1.BaseCommand {
|
|
8
|
-
static description = 'List frozen
|
|
8
|
+
static description = 'List frozen Action Bundles and their recovery state';
|
|
9
9
|
static args = {
|
|
10
10
|
id: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
11
11
|
};
|
|
@@ -35,18 +35,20 @@ class CommitmentsActionProposals extends base_command_1.BaseCommand {
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
if (!response.data.length) {
|
|
38
|
-
this.log('No prepared
|
|
38
|
+
this.log('No prepared Action Bundles.');
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
(0, format_1.renderTable)(response.data.map((proposal) => ({
|
|
42
42
|
id: proposal.id,
|
|
43
|
-
|
|
43
|
+
actions: String(proposal.actionSnapshots?.length || 1),
|
|
44
|
+
digest: proposal.snapshotDigest || 'legacy',
|
|
44
45
|
status: proposal.status,
|
|
45
46
|
attempt: `${proposal.attempt || 0}/${proposal.maxAttempts || 3}`,
|
|
46
47
|
expires: proposal.expiresAt || '—',
|
|
47
48
|
})), [
|
|
48
49
|
{ key: 'id', header: 'PROPOSAL', verbatim: true },
|
|
49
|
-
{ key: '
|
|
50
|
+
{ key: 'actions', header: 'ACTIONS' },
|
|
51
|
+
{ key: 'digest', header: 'DIGEST', maxWidth: 64, verbatim: true },
|
|
50
52
|
{ key: 'status', header: 'STATUS' },
|
|
51
53
|
{ key: 'attempt', header: 'ATTEMPT' },
|
|
52
54
|
{ key: 'expires', header: 'EXPIRES', maxWidth: 28 },
|
|
@@ -63,6 +63,10 @@ function deliveryForProductMode(mode, delivery) {
|
|
|
63
63
|
function renderExecutionReceipt(receipt, log, verbose = false) {
|
|
64
64
|
log(receipt.summary);
|
|
65
65
|
log(`Mode: ${productModeLabel(receipt.mode)}`);
|
|
66
|
+
if (receipt.runtime) {
|
|
67
|
+
const identity = receipt.runtime.name || receipt.runtime.id || 'the selected runtime';
|
|
68
|
+
log(`Runtime: ${identity}${receipt.runtime.kind ? ` · ${receipt.runtime.kind}` : ''}${receipt.runtime.provider ? ` · ${receipt.runtime.provider}` : ''}`);
|
|
69
|
+
}
|
|
66
70
|
for (const phase of receipt.phases) {
|
|
67
71
|
const mark = { done: '✓', working: '→', waiting: '…', failed: '×', skipped: '–' }[phase.status];
|
|
68
72
|
log(` ${mark} ${phase.phase[0].toUpperCase() + phase.phase.slice(1)}: ${phase.summary}${phase.at ? ` · ${phase.at}` : ''}`);
|
|
@@ -73,6 +77,11 @@ function renderExecutionReceipt(receipt, log, verbose = false) {
|
|
|
73
77
|
}
|
|
74
78
|
if (receipt.nextActor)
|
|
75
79
|
log(`Next: ${receipt.nextActor.label || receipt.nextActor.kind}${receipt.nextActor.reason ? ` — ${receipt.nextActor.reason}` : ''}`);
|
|
80
|
+
if (receipt.blocker) {
|
|
81
|
+
log(`Blocker: ${receipt.blocker.code}`);
|
|
82
|
+
for (const evidenceRef of receipt.blocker.evidenceRefs || [])
|
|
83
|
+
log(` Evidence: ${evidenceRef}`);
|
|
84
|
+
}
|
|
76
85
|
if (verbose)
|
|
77
86
|
log(`Diagnostics:\n${JSON.stringify({ id: receipt.id, revision: receipt.revision, evidence: receipt.evidence, diagnostics: receipt.diagnostics }, null, 2)}`);
|
|
78
87
|
}
|
|
@@ -270,7 +270,10 @@ export declare const commitmentApi: {
|
|
|
270
270
|
* commitment and knows what should be done had no way to say so.
|
|
271
271
|
*/
|
|
272
272
|
proposeActionProposal: (id: string, body: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
273
|
-
decideActionProposal: (id: string, proposalId: string, decision: "approve" | "reject"
|
|
273
|
+
decideActionProposal: (id: string, proposalId: string, decision: "approve" | "reject", snapshot?: {
|
|
274
|
+
snapshotDigest?: string;
|
|
275
|
+
bundleVersion?: number;
|
|
276
|
+
}) => Promise<Record<string, unknown>>;
|
|
274
277
|
executeActionProposal: (id: string, proposalId: string) => Promise<Record<string, unknown>>;
|
|
275
278
|
preflight: (id: string, nextRunCount?: number) => Promise<CommitmentPreflightReport>;
|
|
276
279
|
effectivePolicy: (id: string) => Promise<Record<string, unknown>>;
|
package/dist/lib/commitments.js
CHANGED
|
@@ -166,8 +166,10 @@ exports.commitmentApi = {
|
|
|
166
166
|
* commitment and knows what should be done had no way to say so.
|
|
167
167
|
*/
|
|
168
168
|
proposeActionProposal: (id, body) => data_provider_1.request.post(`${base(id)}/action-proposals`, body),
|
|
169
|
-
decideActionProposal: (id, proposalId, decision) => data_provider_1.request.post(`${base(id)}/action-proposals/${encodeURIComponent(proposalId)}/decision`, {
|
|
169
|
+
decideActionProposal: (id, proposalId, decision, snapshot) => data_provider_1.request.post(`${base(id)}/action-proposals/${encodeURIComponent(proposalId)}/decision`, {
|
|
170
170
|
decision,
|
|
171
|
+
...(snapshot?.snapshotDigest ? { snapshotDigest: snapshot.snapshotDigest } : {}),
|
|
172
|
+
...(snapshot?.bundleVersion ? { bundleVersion: snapshot.bundleVersion } : {}),
|
|
171
173
|
}),
|
|
172
174
|
executeActionProposal: (id, proposalId) => data_provider_1.request.post(`${base(id)}/action-proposals/${encodeURIComponent(proposalId)}/execute`, {}),
|
|
173
175
|
preflight: (id, nextRunCount) => data_provider_1.request.post(`${base(id)}/preflight`, {
|
|
@@ -22,8 +22,9 @@ Object.defineProperty(exports, "PermanentAuthFailure", { enumerable: true, get:
|
|
|
22
22
|
Object.defineProperty(exports, "TransientAuthFailure", { enumerable: true, get: function () { return types_js_1.TransientAuthFailure; } });
|
|
23
23
|
/**
|
|
24
24
|
* Maps server-supplied error codes to the canonical PermanentAuthReason values
|
|
25
|
-
* exported from types.ts.
|
|
26
|
-
*
|
|
25
|
+
* exported from types.ts. `REFRESH_MISSING` is a server protocol code rather
|
|
26
|
+
* than a user-facing reason; it maps to `REFRESH_INVALID` because an identical
|
|
27
|
+
* retry cannot gain the credential the server says was absent.
|
|
27
28
|
*/
|
|
28
29
|
const PERMANENT_CODE_SET = new Set([
|
|
29
30
|
'REFRESH_INVALID',
|
|
@@ -63,6 +64,12 @@ function classifyRefreshResponse(status, body) {
|
|
|
63
64
|
}
|
|
64
65
|
// 401 — auth failure; check for known permanent code
|
|
65
66
|
if (status === 401) {
|
|
67
|
+
if (body?.code === 'REFRESH_MISSING') {
|
|
68
|
+
return {
|
|
69
|
+
kind: 'failure',
|
|
70
|
+
failure: new types_js_1.PermanentAuthFailure('REFRESH_INVALID', body.message ?? 'Refresh token missing'),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
66
73
|
const code = body?.code;
|
|
67
74
|
if (code && PERMANENT_CODE_SET.has(code)) {
|
|
68
75
|
return {
|
|
@@ -23,8 +23,9 @@ import { PermanentAuthFailure, TransientAuthFailure } from './types.js';
|
|
|
23
23
|
export { PermanentAuthFailure, TransientAuthFailure };
|
|
24
24
|
/**
|
|
25
25
|
* Maps server-supplied error codes to the canonical PermanentAuthReason values
|
|
26
|
-
* exported from types.ts.
|
|
27
|
-
*
|
|
26
|
+
* exported from types.ts. `REFRESH_MISSING` is a server protocol code rather
|
|
27
|
+
* than a user-facing reason; it maps to `REFRESH_INVALID` because an identical
|
|
28
|
+
* retry cannot gain the credential the server says was absent.
|
|
28
29
|
*/
|
|
29
30
|
const PERMANENT_CODE_SET = new Set([
|
|
30
31
|
'REFRESH_INVALID',
|
|
@@ -64,6 +65,12 @@ export function classifyRefreshResponse(status, body) {
|
|
|
64
65
|
}
|
|
65
66
|
// 401 — auth failure; check for known permanent code
|
|
66
67
|
if (status === 401) {
|
|
68
|
+
if (body?.code === 'REFRESH_MISSING') {
|
|
69
|
+
return {
|
|
70
|
+
kind: 'failure',
|
|
71
|
+
failure: new PermanentAuthFailure('REFRESH_INVALID', body.message ?? 'Refresh token missing'),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
67
74
|
const code = body?.code;
|
|
68
75
|
if (code && PERMANENT_CODE_SET.has(code)) {
|
|
69
76
|
return {
|
|
@@ -41007,6 +41007,7 @@ function vk() {
|
|
|
41007
41007
|
mk(null);
|
|
41008
41008
|
}
|
|
41009
41009
|
function hk(e2, t2) {
|
|
41010
|
+
if (401 === e2 && "REFRESH_MISSING" === (null == t2 ? void 0 : t2.code)) return "permanent";
|
|
41010
41011
|
var n2 = o.classifyRefreshResponse(e2, t2);
|
|
41011
41012
|
if ("success" === n2.kind) return "transient";
|
|
41012
41013
|
if (n2.failure instanceof o.PermanentAuthFailure) {
|
|
@@ -41816,10 +41817,10 @@ var Nk = Object.freeze({ __proto__: null, acceptAgentIntuition: function(e2, t2,
|
|
|
41816
41817
|
return "".concat(_o(e3), "/").concat(encodeURIComponent(t3), "/").concat(n3);
|
|
41817
41818
|
})(e2, t2, n2), o2);
|
|
41818
41819
|
}, decideCommitmentActionProposal: function(e2) {
|
|
41819
|
-
var t2 = e2.commitmentId, n2 = e2.proposalId, o2 = e2.decision;
|
|
41820
|
+
var t2 = e2.commitmentId, n2 = e2.proposalId, o2 = e2.decision, r2 = e2.snapshotDigest, a2 = e2.bundleVersion;
|
|
41820
41821
|
return Sk.post((function(e3, t3) {
|
|
41821
41822
|
return "".concat(Zr(e3), "/").concat(encodeURIComponent(t3), "/decision");
|
|
41822
|
-
})(t2, n2), { decision: o2 });
|
|
41823
|
+
})(t2, n2), f(f({ decision: o2 }, r2 ? { snapshotDigest: r2 } : {}), a2 ? { bundleVersion: a2 } : {}));
|
|
41823
41824
|
}, decideCommitmentAutonomyRequest: function(e2) {
|
|
41824
41825
|
var t2 = e2.commitmentId, n2 = e2.requestId, o2 = e2.data;
|
|
41825
41826
|
return Sk.post((function(e3, t3) {
|
|
@@ -42476,6 +42477,10 @@ var Nk = Object.freeze({ __proto__: null, acceptAgentIntuition: function(e2, t2,
|
|
|
42476
42477
|
var t2 = "".concat(ta(), "/distribution");
|
|
42477
42478
|
return e3 ? "".concat(t2).concat(en(e3)) : t2;
|
|
42478
42479
|
})(e2));
|
|
42480
|
+
}, getCommitmentExecutionReceiptQuarterlyMetrics: function(e2, t2, n2) {
|
|
42481
|
+
return Sk.get((function(e3, t3, n3) {
|
|
42482
|
+
return "".concat(Kr(e3), "/receipt-metrics/quarterly").concat(en({ year: t3, quarter: n3 }));
|
|
42483
|
+
})(e2, t2, n2));
|
|
42479
42484
|
}, getCommitmentHeldSurfaces: function(e2) {
|
|
42480
42485
|
return Sk.get((function(e3) {
|
|
42481
42486
|
return "".concat(ta(), "/held-surfaces").concat(e3 ? "?commitmentId=".concat(e3) : "");
|
|
@@ -46620,6 +46625,9 @@ exports.ACCEPTED_AGENT_TRIGGER_FIRE_OUTCOMES = ["succeeded", "in_progress", "awa
|
|
|
46620
46625
|
}).map(function(e3) {
|
|
46621
46626
|
return { band: e3, projects: n2.get(e3) };
|
|
46622
46627
|
});
|
|
46628
|
+
}, exports.hasAuthTokenHeader = function() {
|
|
46629
|
+
var e2 = n.defaults.headers.common.Authorization;
|
|
46630
|
+
return "string" == typeof e2 && e2.length > 0;
|
|
46623
46631
|
}, exports.hasCycle = _d, exports.hasMessageEmbeds = function(e2) {
|
|
46624
46632
|
return mf(e2).length > 0;
|
|
46625
46633
|
}, exports.hasPermissions = function(e2, t2) {
|
|
@@ -47646,7 +47654,8 @@ exports.ACCEPTED_AGENT_TRIGGER_FIRE_OUTCOMES = ["succeeded", "in_progress", "awa
|
|
|
47646
47654
|
return n2 && "object" == typeof n2 && (("preset" !== n2.type || wy(n2.id)) && ("preset" === n2.type || "asset" === n2.type || "image" === n2.type)) ? { mode: "fixed", ref: n2 } : Ny;
|
|
47647
47655
|
}
|
|
47648
47656
|
return "random" === t2.mode ? "all" === t2.scope || "mine" === t2.scope ? { mode: "random", scope: t2.scope } : "category" === t2.scope && _y(t2.category) ? { mode: "random", scope: "category", category: t2.category } : Ny : Ny;
|
|
47649
|
-
}
|
|
47657
|
+
};
|
|
47658
|
+
exports.resolveAgentAvatarRef = function(e2) {
|
|
47650
47659
|
if (null == e2) return Py;
|
|
47651
47660
|
if ("string" == typeof e2) return e2.trim() ? { type: "image", filepath: e2, source: "" } : Py;
|
|
47652
47661
|
if ("object" != typeof e2) return Py;
|
|
@@ -47662,8 +47671,7 @@ exports.ACCEPTED_AGENT_TRIGGER_FIRE_OUTCOMES = ["succeeded", "in_progress", "awa
|
|
|
47662
47671
|
return "string" == typeof t2.filepath && t2.filepath.trim() ? { type: "image", filepath: t2.filepath, source: "string" == typeof t2.source ? t2.source : "" } : Py;
|
|
47663
47672
|
}
|
|
47664
47673
|
return "string" == typeof t2.filepath && t2.filepath.trim() ? { type: "image", filepath: t2.filepath, source: "string" == typeof t2.source ? t2.source : "" } : Py;
|
|
47665
|
-
}
|
|
47666
|
-
exports.resolveAgentSceneBackgroundPreset = Ty, exports.resolveAgentToneMode = function(e2) {
|
|
47674
|
+
}, exports.resolveAgentSceneBackgroundPreset = Ty, exports.resolveAgentToneMode = function(e2) {
|
|
47667
47675
|
var t2 = null == e2 ? void 0 : e2.toneMode;
|
|
47668
47676
|
return "inherit" === t2 || "none" === t2 || "explicit" === t2 ? t2 : (null == e2 ? void 0 : e2.toneId) ? "explicit" : "inherit";
|
|
47669
47677
|
}, exports.resolveAutonomyCeiling = function(e2) {
|