@skrr-ai/cli 0.1.46 → 0.1.48
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 +1 -1
- package/dist/base-command.d.ts +18 -0
- package/dist/base-command.js +61 -1
- package/dist/commands/agents/chat.d.ts +21 -0
- package/dist/commands/agents/chat.js +26 -9
- package/dist/commands/balance/usage/breakdown.d.ts +14 -0
- package/dist/commands/balance/usage/breakdown.js +68 -0
- package/dist/commands/balance/usage.js +24 -0
- package/dist/commands/code/handover.d.ts +2 -2
- package/dist/commands/code/handover.js +12 -13
- package/dist/commands/code/install.js +31 -0
- package/dist/commands/code/update.d.ts +46 -0
- package/dist/commands/code/update.js +242 -0
- package/dist/commands/commerce/entitlements/explain.d.ts +22 -0
- package/dist/commands/commerce/entitlements/explain.js +40 -0
- package/dist/commands/commerce/incidents/audit.d.ts +20 -0
- package/dist/commands/commerce/incidents/audit.js +37 -0
- package/dist/commands/commerce/incidents/list.d.ts +22 -0
- package/dist/commands/commerce/incidents/list.js +49 -0
- package/dist/commands/commerce/incidents/resolve.d.ts +23 -0
- package/dist/commands/commerce/incidents/resolve.js +45 -0
- package/dist/commands/commerce/incidents/retry.d.ts +22 -0
- package/dist/commands/commerce/incidents/retry.js +45 -0
- package/dist/commands/commerce/incidents/show.d.ts +13 -0
- package/dist/commands/commerce/incidents/show.js +30 -0
- package/dist/commands/commerce/offers/approve.d.ts +17 -0
- package/dist/commands/commerce/offers/approve.js +33 -0
- package/dist/commands/commerce/offers/create.d.ts +18 -0
- package/dist/commands/commerce/offers/create.js +34 -0
- package/dist/commands/commerce/offers/publish.d.ts +13 -0
- package/dist/commands/commerce/offers/publish.js +28 -0
- package/dist/commands/commerce/offers/retire.d.ts +17 -0
- package/dist/commands/commerce/offers/retire.js +32 -0
- package/dist/commands/commerce/offers/validate.d.ts +18 -0
- package/dist/commands/commerce/offers/validate.js +33 -0
- package/dist/commands/commerce/products/create.d.ts +10 -0
- package/dist/commands/commerce/products/create.js +25 -0
- package/dist/commands/commerce/promotions/redeem.d.ts +13 -0
- package/dist/commands/commerce/promotions/redeem.js +32 -0
- package/dist/commands/commerce/terms/accept.d.ts +18 -0
- package/dist/commands/commerce/terms/accept.js +39 -0
- package/dist/commands/commerce/terms/show.d.ts +10 -0
- package/dist/commands/commerce/terms/show.js +34 -0
- package/dist/commands/commerce/trials/conversion-preview.d.ts +18 -0
- package/dist/commands/commerce/trials/conversion-preview.js +39 -0
- package/dist/commands/commerce/trials/start.d.ts +23 -0
- package/dist/commands/commerce/trials/start.js +58 -0
- package/dist/commands/commitments/accounting.d.ts +39 -0
- package/dist/commands/commitments/accounting.js +116 -0
- package/dist/commands/commitments/action-history.d.ts +1 -0
- package/dist/commands/commitments/action-history.js +8 -1
- package/dist/commands/commitments/case.d.ts +1 -0
- package/dist/commands/commitments/case.js +19 -3
- package/dist/commands/commitments/cases.d.ts +1 -0
- package/dist/commands/commitments/cases.js +11 -1
- package/dist/commands/commitments/checks.d.ts +1 -0
- package/dist/commands/commitments/checks.js +5 -1
- package/dist/commands/commitments/cost.d.ts +62 -0
- package/dist/commands/commitments/cost.js +130 -0
- package/dist/commands/commitments/create.js +1 -1
- package/dist/commands/commitments/delete.d.ts +1 -0
- package/dist/commands/commitments/delete.js +56 -6
- package/dist/commands/commitments/feedback.js +9 -1
- package/dist/commands/commitments/handover.js +16 -0
- package/dist/commands/commitments/hypotheses.d.ts +1 -0
- package/dist/commands/commitments/hypotheses.js +17 -2
- package/dist/commands/commitments/links/list.js +4 -1
- package/dist/commands/commitments/liveness.d.ts +18 -0
- package/dist/commands/commitments/liveness.js +80 -0
- package/dist/commands/commitments/metrics.d.ts +1 -0
- package/dist/commands/commitments/metrics.js +8 -1
- package/dist/commands/commitments/next-tick.d.ts +39 -0
- package/dist/commands/commitments/next-tick.js +122 -0
- package/dist/commands/commitments/observations.d.ts +1 -0
- package/dist/commands/commitments/observations.js +19 -2
- package/dist/commands/commitments/pause.js +12 -0
- package/dist/commands/commitments/receipt.d.ts +2 -0
- package/dist/commands/commitments/receipt.js +16 -2
- package/dist/commands/commitments/remediation-proposal.js +6 -2
- package/dist/commands/commitments/remediation-proposals.js +5 -1
- package/dist/commands/commitments/restore.d.ts +25 -0
- package/dist/commands/commitments/restore.js +46 -0
- package/dist/commands/commitments/show.js +32 -0
- package/dist/commands/commitments/trigger-status.js +33 -0
- package/dist/commands/commitments/update.d.ts +1 -0
- package/dist/commands/commitments/update.js +31 -5
- package/dist/commands/commitments/wake-capabilities.d.ts +0 -1
- package/dist/commands/commitments/wake-capabilities.js +8 -4
- package/dist/commands/convos/handover.d.ts +1 -0
- package/dist/commands/convos/handover.js +4 -0
- package/dist/commands/daemon/index.js +2 -0
- package/dist/commands/daemon/update.d.ts +19 -0
- package/dist/commands/daemon/update.js +48 -0
- package/dist/commands/enterprise/budgets/create.d.ts +11 -0
- package/dist/commands/enterprise/budgets/create.js +27 -0
- package/dist/commands/enterprise/budgets/evaluate.d.ts +17 -0
- package/dist/commands/enterprise/budgets/evaluate.js +32 -0
- package/dist/commands/enterprise/budgets/publish.d.ts +14 -0
- package/dist/commands/enterprise/budgets/publish.js +30 -0
- package/dist/commands/enterprise/contracts/activate.d.ts +14 -0
- package/dist/commands/enterprise/contracts/activate.js +30 -0
- package/dist/commands/enterprise/contracts/create.d.ts +14 -0
- package/dist/commands/enterprise/contracts/create.js +32 -0
- package/dist/commands/enterprise/contracts/issue.d.ts +18 -0
- package/dist/commands/enterprise/contracts/issue.js +34 -0
- package/dist/commands/enterprise/domains/begin.d.ts +20 -0
- package/dist/commands/enterprise/domains/begin.js +39 -0
- package/dist/commands/enterprise/domains/verify.d.ts +14 -0
- package/dist/commands/enterprise/domains/verify.js +32 -0
- package/dist/commands/enterprise/external-config/activate.d.ts +22 -0
- package/dist/commands/enterprise/external-config/activate.js +49 -0
- package/dist/commands/enterprise/external-config/set.d.ts +25 -0
- package/dist/commands/enterprise/external-config/set.js +123 -0
- package/dist/commands/enterprise/external-config/show.d.ts +12 -0
- package/dist/commands/enterprise/external-config/show.js +39 -0
- package/dist/commands/enterprise/external-config/suspend.d.ts +13 -0
- package/dist/commands/enterprise/external-config/suspend.js +41 -0
- package/dist/commands/enterprise/finance/close-snapshot.d.ts +11 -0
- package/dist/commands/enterprise/finance/close-snapshot.js +28 -0
- package/dist/commands/enterprise/finance/record-document.d.ts +18 -0
- package/dist/commands/enterprise/finance/record-document.js +35 -0
- package/dist/commands/enterprise/profile.d.ts +20 -0
- package/dist/commands/enterprise/profile.js +38 -0
- package/dist/commands/login.d.ts +13 -0
- package/dist/commands/login.js +77 -0
- package/dist/commands/machines/dedicated/index.js +3 -0
- package/dist/commands/machines/dedicated/service/apply.d.ts +23 -0
- package/dist/commands/machines/dedicated/service/apply.js +99 -0
- package/dist/commands/machines/dedicated/service/approve.d.ts +23 -0
- package/dist/commands/machines/dedicated/service/approve.js +52 -0
- package/dist/commands/machines/dedicated/service/create.d.ts +55 -0
- package/dist/commands/machines/dedicated/service/create.js +222 -0
- package/dist/commands/machines/dedicated/service/edit.d.ts +30 -0
- package/dist/commands/machines/dedicated/service/edit.js +146 -0
- package/dist/commands/machines/dedicated/service/exec.d.ts +26 -0
- package/dist/commands/machines/dedicated/service/exec.js +92 -0
- package/dist/commands/machines/dedicated/service/export.d.ts +29 -0
- package/dist/commands/machines/dedicated/service/export.js +106 -0
- package/dist/commands/machines/dedicated/service/index.d.ts +14 -0
- package/dist/commands/machines/dedicated/service/index.js +49 -0
- package/dist/commands/machines/dedicated/service/logs.d.ts +33 -0
- package/dist/commands/machines/dedicated/service/logs.js +148 -0
- package/dist/commands/machines/dedicated/service/ls.d.ts +20 -0
- package/dist/commands/machines/dedicated/service/ls.js +80 -0
- package/dist/commands/machines/dedicated/service/restart.d.ts +14 -0
- package/dist/commands/machines/dedicated/service/restart.js +29 -0
- package/dist/commands/machines/dedicated/service/rm.d.ts +20 -0
- package/dist/commands/machines/dedicated/service/rm.js +33 -0
- package/dist/commands/machines/dedicated/service/secret/index.d.ts +14 -0
- package/dist/commands/machines/dedicated/service/secret/index.js +25 -0
- package/dist/commands/machines/dedicated/service/secret/rm.d.ts +22 -0
- package/dist/commands/machines/dedicated/service/secret/rm.js +54 -0
- package/dist/commands/machines/dedicated/service/secret/set.d.ts +22 -0
- package/dist/commands/machines/dedicated/service/secret/set.js +93 -0
- package/dist/commands/machines/dedicated/service/start.d.ts +14 -0
- package/dist/commands/machines/dedicated/service/start.js +29 -0
- package/dist/commands/machines/dedicated/service/status.d.ts +21 -0
- package/dist/commands/machines/dedicated/service/status.js +85 -0
- package/dist/commands/machines/dedicated/service/stop.d.ts +20 -0
- package/dist/commands/machines/dedicated/service/stop.js +35 -0
- package/dist/commands/machines/dedicated/service/top.d.ts +22 -0
- package/dist/commands/machines/dedicated/service/top.js +120 -0
- package/dist/commands/machines/dedicated/sign-in-status.d.ts +22 -0
- package/dist/commands/machines/dedicated/sign-in-status.js +79 -0
- package/dist/commands/machines/dedicated/ssh-config.d.ts +28 -0
- package/dist/commands/machines/dedicated/ssh-config.js +66 -0
- package/dist/commands/machines/dedicated/ssh-proxy.d.ts +22 -0
- package/dist/commands/machines/dedicated/ssh-proxy.js +62 -0
- package/dist/commands/machines/dedicated/ssh.d.ts +29 -0
- package/dist/commands/machines/dedicated/ssh.js +121 -0
- package/dist/commands/native/allow-all.d.ts +14 -0
- package/dist/commands/native/allow-all.js +25 -0
- package/dist/commands/native/allow.d.ts +24 -0
- package/dist/commands/native/allow.js +45 -0
- package/dist/commands/native/deny.d.ts +24 -0
- package/dist/commands/native/deny.js +43 -0
- package/dist/commands/native/disable.d.ts +17 -0
- package/dist/commands/native/disable.js +28 -0
- package/dist/commands/native/enable.d.ts +12 -0
- package/dist/commands/native/enable.js +29 -0
- package/dist/commands/native/list-apps.d.ts +19 -0
- package/dist/commands/native/list-apps.js +30 -0
- package/dist/commands/native/restrict-to.d.ts +22 -0
- package/dist/commands/native/restrict-to.js +41 -0
- package/dist/commands/native/status.d.ts +19 -0
- package/dist/commands/native/status.js +33 -0
- package/dist/commands/native.d.ts +39 -0
- package/dist/commands/native.js +76 -0
- package/dist/commands/service/index.d.ts +14 -0
- package/dist/commands/service/index.js +31 -0
- package/dist/commands/service/logs.d.ts +18 -0
- package/dist/commands/service/logs.js +53 -0
- package/dist/commands/service/ls.d.ts +13 -0
- package/dist/commands/service/ls.js +48 -0
- package/dist/commands/service/propose.d.ts +34 -0
- package/dist/commands/service/propose.js +113 -0
- package/dist/commands/service/status.d.ts +17 -0
- package/dist/commands/service/status.js +56 -0
- package/dist/commands/spaces/auto-executor/runs.d.ts +13 -0
- package/dist/commands/spaces/auto-executor/runs.js +56 -0
- package/dist/commands/spaces/briefs/get.js +8 -0
- package/dist/commands/spaces/briefs/list.js +2 -0
- package/dist/commands/spaces/briefs/set.d.ts +3 -0
- package/dist/commands/spaces/briefs/set.js +78 -13
- package/dist/commands/spaces/expertise-suggestions.d.ts +12 -0
- package/dist/commands/spaces/expertise-suggestions.js +71 -0
- package/dist/commands/spaces/members/add.d.ts +1 -0
- package/dist/commands/spaces/members/add.js +11 -3
- package/dist/commands/spaces/members/list.js +11 -0
- package/dist/commands/store/governance/artifacts.d.ts +25 -0
- package/dist/commands/store/governance/artifacts.js +55 -0
- package/dist/commands/store/governance/assign.d.ts +16 -0
- package/dist/commands/store/governance/assign.js +54 -0
- package/dist/commands/store/governance/create-license.d.ts +18 -0
- package/dist/commands/store/governance/create-license.js +35 -0
- package/dist/commands/store/governance/install-plan.d.ts +25 -0
- package/dist/commands/store/governance/install-plan.js +56 -0
- package/dist/commands/store/governance/license-policy.d.ts +30 -0
- package/dist/commands/store/governance/license-policy.js +69 -0
- package/dist/commands/store/governance/policy.d.ts +25 -0
- package/dist/commands/store/governance/policy.js +65 -0
- package/dist/commands/store/governance/publish-release.d.ts +17 -0
- package/dist/commands/store/governance/publish-release.js +34 -0
- package/dist/commands/tasks/assign.d.ts +9 -0
- package/dist/commands/tasks/assign.js +108 -1
- package/dist/commands/tasks/deliverable/add.d.ts +15 -0
- package/dist/commands/tasks/deliverable/add.js +174 -0
- package/dist/commands/tasks/deliverable/archive.d.ts +35 -0
- package/dist/commands/tasks/deliverable/archive.js +205 -0
- package/dist/commands/tasks/labels/detach.js +3 -0
- package/dist/commands/tasks/labels/suggest.d.ts +24 -0
- package/dist/commands/tasks/labels/suggest.js +69 -0
- package/dist/commands/tasks/list.d.ts +16 -2
- package/dist/commands/tasks/list.js +100 -24
- package/dist/commands/tasks/show.d.ts +23 -0
- package/dist/commands/tasks/show.js +51 -1
- package/dist/commands/wiki/rm.d.ts +22 -1
- package/dist/commands/wiki/rm.js +52 -3
- package/dist/lib/agentic-stream.js +10 -2
- package/dist/lib/assignee-resolver.d.ts +22 -0
- package/dist/lib/assignee-resolver.js +26 -0
- package/dist/lib/balance.d.ts +6 -1
- package/dist/lib/balance.js +15 -0
- package/dist/lib/code-handover.d.ts +0 -10
- package/dist/lib/code-handover.js +20 -5
- package/dist/lib/commerce-command.d.ts +48 -0
- package/dist/lib/commerce-command.js +70 -0
- package/dist/lib/commerce.d.ts +93 -0
- package/dist/lib/commerce.js +129 -0
- package/dist/lib/commitment-product.js +1 -1
- package/dist/lib/commitments.d.ts +202 -29
- package/dist/lib/commitments.js +300 -33
- package/dist/lib/dedicated-lease-command.js +10 -0
- package/dist/lib/dedicated-machines.d.ts +37 -0
- package/dist/lib/dedicated-machines.js +47 -0
- package/dist/lib/dedicated-service-command.d.ts +60 -0
- package/dist/lib/dedicated-service-command.js +182 -0
- package/dist/lib/dedicated-service.d.ts +342 -0
- package/dist/lib/dedicated-service.js +741 -0
- package/dist/lib/dedicated-ssh.d.ts +136 -0
- package/dist/lib/dedicated-ssh.js +387 -0
- package/dist/lib/delegated-cli.js +51 -13
- package/dist/lib/enterprise-commerce.d.ts +67 -0
- package/dist/lib/enterprise-commerce.js +112 -0
- package/dist/lib/enterprise-external-configuration.d.ts +60 -0
- package/dist/lib/enterprise-external-configuration.js +58 -0
- package/dist/lib/first-party-harness.js +17 -3
- package/dist/lib/governed-store.d.ts +110 -0
- package/dist/lib/governed-store.js +79 -0
- package/dist/lib/guest-service-command.d.ts +16 -0
- package/dist/lib/guest-service-command.js +32 -0
- package/dist/lib/guest-service.d.ts +67 -0
- package/dist/lib/guest-service.js +112 -0
- package/dist/lib/prompt.d.ts +1 -0
- package/dist/lib/prompt.js +1 -0
- package/dist/lib/task-asset-upload.d.ts +20 -0
- package/dist/lib/task-asset-upload.js +30 -8
- package/dist/lib/task-extras.d.ts +23 -0
- package/dist/lib/task-extras.js +6 -0
- package/dist/lib/update-check.d.ts +80 -7
- package/dist/lib/update-check.js +365 -33
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonScopes.d.ts +9 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonScopes.js +10 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.d.ts +9 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +6 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.d.ts +16 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.js +21 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +24 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonScopes.d.ts +9 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonScopes.js +10 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.d.ts +9 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.d.ts +16 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.js +20 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +24 -2
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +5067 -4821
- package/oclif.manifest.json +34877 -28659
- package/package.json +43 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatAccountingReadout = formatAccountingReadout;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_command_1 = require("../../base-command");
|
|
6
|
+
const commitments_1 = require("../../lib/commitments");
|
|
7
|
+
/**
|
|
8
|
+
* `skrr commitments accounting <id>` — the allowance-accounting SHADOW readout.
|
|
9
|
+
*
|
|
10
|
+
* Allowance accounting replaces "count the attempts" with "count what the
|
|
11
|
+
* attempts advanced", and it may only be activated once there is enough CLOSED
|
|
12
|
+
* evidence to derive the attempt multiplier. Until then the requested mode is
|
|
13
|
+
* held at `shadow` and nothing says so anywhere an operator can read — the
|
|
14
|
+
* workspace looks configured, and the behaviour is unchanged.
|
|
15
|
+
*
|
|
16
|
+
* This is that read: what the shadow window observed, what multiplier it
|
|
17
|
+
* derives, and — the field that matters — whether it can activate yet and what
|
|
18
|
+
* is blocking it.
|
|
19
|
+
*
|
|
20
|
+
* WORKSPACE-scoped despite taking a commitment id: the readout aggregates every
|
|
21
|
+
* closed daily metric in the commitment's workspace. `commitments cost` is the
|
|
22
|
+
* per-commitment spend question.
|
|
23
|
+
*/
|
|
24
|
+
class CommitmentsAccounting extends base_command_1.BaseCommand {
|
|
25
|
+
static description = "Show the workspace's allowance-accounting shadow readout and whether it can activate";
|
|
26
|
+
static examples = [
|
|
27
|
+
'<%= config.bin %> commitments accounting obj_abc123',
|
|
28
|
+
'<%= config.bin %> commitments accounting obj_abc123 --json',
|
|
29
|
+
];
|
|
30
|
+
static args = {
|
|
31
|
+
id: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
32
|
+
};
|
|
33
|
+
static flags = {
|
|
34
|
+
json: core_1.Flags.boolean({ description: 'Output the complete readout as JSON' }),
|
|
35
|
+
};
|
|
36
|
+
async run() {
|
|
37
|
+
this.requireAuth();
|
|
38
|
+
const { args, flags } = await this.parse(CommitmentsAccounting);
|
|
39
|
+
let readout;
|
|
40
|
+
try {
|
|
41
|
+
readout = await commitments_1.commitmentApi.accountingReadout(args.id);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
this.handleApiError(err);
|
|
45
|
+
}
|
|
46
|
+
if (flags.json) {
|
|
47
|
+
this.log(JSON.stringify(readout, null, 2));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
for (const line of formatAccountingReadout(readout))
|
|
51
|
+
this.log(line);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = CommitmentsAccounting;
|
|
55
|
+
/**
|
|
56
|
+
* Pure renderer for the accounting readout.
|
|
57
|
+
*
|
|
58
|
+
* `requestedMode` and `canActivate` are printed together because the gap
|
|
59
|
+
* between them IS the finding: a workspace that asked for `on` and reads
|
|
60
|
+
* `canActivate: false` is running on the old attempt accounting and has no
|
|
61
|
+
* other surface that says so.
|
|
62
|
+
*/
|
|
63
|
+
function formatAccountingReadout(readout) {
|
|
64
|
+
const requested = readout.requestedMode ?? 'off';
|
|
65
|
+
const canActivate = readout.canActivate === true;
|
|
66
|
+
const lines = [
|
|
67
|
+
'Allowance accounting (workspace shadow readout)',
|
|
68
|
+
'',
|
|
69
|
+
`Requested mode: ${requested}`,
|
|
70
|
+
`Can activate: ${canActivate ? 'yes' : 'no'}`,
|
|
71
|
+
];
|
|
72
|
+
if (!canActivate && readout.activationBlocker) {
|
|
73
|
+
lines.push(`Blocked by: ${readout.activationBlocker}`);
|
|
74
|
+
}
|
|
75
|
+
if (requested === 'on' && !canActivate) {
|
|
76
|
+
// Say the consequence, not just the state. "Held at shadow" is the fact an
|
|
77
|
+
// operator needs; "canActivate: false" is the fact the server reports.
|
|
78
|
+
lines.push('Effective mode: shadow — the requested mode is withheld until evidence closes.');
|
|
79
|
+
}
|
|
80
|
+
lines.push('');
|
|
81
|
+
lines.push(`Window: ${Number(readout.evidenceDays || 0)} of ${Number(readout.windowDays || 0)} closed day(s)`);
|
|
82
|
+
lines.push(`Source: ${readout.source ?? '-'}`);
|
|
83
|
+
lines.push('');
|
|
84
|
+
lines.push(`Attempts: ${Number(readout.attempts || 0)}`);
|
|
85
|
+
// These two count different units — `advancements` is advancing CHECKS while
|
|
86
|
+
// `netAdvancements` is advancement KIND ENTRIES (one check can mint several).
|
|
87
|
+
// Rendered as "4 vs 5" without the labels, they read as a contradiction.
|
|
88
|
+
lines.push(`Advancing checks: ${Number(readout.advancements || 0)}`);
|
|
89
|
+
lines.push(` advancement kinds, net of self-minted: ${Number(readout.netAdvancements || 0)}`);
|
|
90
|
+
lines.push(`Divergence: ${Number(readout.allowanceAttemptDivergence || 0)}`);
|
|
91
|
+
// Same attribution caveat as `commitments cost`: a bare dollar figure lets
|
|
92
|
+
// a priced window and an unpriced one read alike (OSK-10940).
|
|
93
|
+
const costStatus = readout.costStatus ?? 'not_applicable';
|
|
94
|
+
const costCaveat = {
|
|
95
|
+
reported: 'every run reported a cost',
|
|
96
|
+
partial: 'some runs reported no cost — the total is a FLOOR',
|
|
97
|
+
unavailable: 'no run reported a cost — the total is meaningless',
|
|
98
|
+
not_applicable: 'no closed runs in the window',
|
|
99
|
+
};
|
|
100
|
+
lines.push(`Window cost: $${(Number(readout.costUsdMicros || 0) / 1_000_000).toFixed(4)}` +
|
|
101
|
+
` — ${costStatus}: ${costCaveat[costStatus] ?? 'unrecognized cost status'}` +
|
|
102
|
+
` (${Number(readout.costReportedRunCount || 0)} of ${Number(readout.costRunCount || 0)} runs priced)`);
|
|
103
|
+
const multiplier = readout.recommendedAttemptMultiplier;
|
|
104
|
+
lines.push('');
|
|
105
|
+
lines.push(`Attempt multiplier: ${multiplier == null ? 'not derivable yet' : multiplier}` +
|
|
106
|
+
(readout.multiplierDerivation ? ` — ${readout.multiplierDerivation}` : ''));
|
|
107
|
+
const none = readout.noneByReason ?? {};
|
|
108
|
+
const reasons = Object.entries(none);
|
|
109
|
+
if (reasons.length > 0) {
|
|
110
|
+
lines.push('');
|
|
111
|
+
lines.push('Checks that advanced nothing, by reason:');
|
|
112
|
+
for (const [reason, count] of reasons)
|
|
113
|
+
lines.push(` ${reason}: ${Number(count || 0)}`);
|
|
114
|
+
}
|
|
115
|
+
return lines;
|
|
116
|
+
}
|
|
@@ -16,6 +16,7 @@ export default class CommitmentsActionHistory extends BaseCommand {
|
|
|
16
16
|
static flags: {
|
|
17
17
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
18
|
limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
cursor: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
20
|
};
|
|
20
21
|
run(): Promise<void>;
|
|
21
22
|
}
|
|
@@ -23,18 +23,25 @@ class CommitmentsActionHistory extends base_command_1.BaseCommand {
|
|
|
23
23
|
static flags = {
|
|
24
24
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
25
25
|
limit: core_1.Flags.integer({ description: 'Max rows', min: 1, max: 200 }),
|
|
26
|
+
cursor: core_1.Flags.string({
|
|
27
|
+
description: 'Continue from the next_cursor emitted by a previous page',
|
|
28
|
+
}),
|
|
26
29
|
};
|
|
27
30
|
async run() {
|
|
28
31
|
this.requireAuth();
|
|
29
32
|
const { args, flags } = await this.parse(CommitmentsActionHistory);
|
|
30
33
|
let response;
|
|
31
34
|
try {
|
|
32
|
-
response = await commitments_1.commitmentApi.actionHistory(args.commitmentId,
|
|
35
|
+
response = await commitments_1.commitmentApi.actionHistory(args.commitmentId, {
|
|
36
|
+
limit: flags.limit,
|
|
37
|
+
cursor: flags.cursor,
|
|
38
|
+
});
|
|
33
39
|
}
|
|
34
40
|
catch (err) {
|
|
35
41
|
this.handleApiError(err);
|
|
36
42
|
}
|
|
37
43
|
this.log(JSON.stringify(response, null, 2));
|
|
44
|
+
(0, commitments_1.renderListPageHint)(response, (line) => this.log(line));
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
exports.default = CommitmentsActionHistory;
|
|
@@ -7,6 +7,7 @@ export default class CommitmentsCase extends BaseCommand {
|
|
|
7
7
|
};
|
|
8
8
|
static flags: {
|
|
9
9
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
entries: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
11
|
};
|
|
11
12
|
run(): Promise<void>;
|
|
12
13
|
}
|
|
@@ -9,10 +9,17 @@ class CommitmentsCase extends base_command_1.BaseCommand {
|
|
|
9
9
|
commitmentId: core_1.Args.string({ ignoreStdin: true, description: 'Commitment ID', required: true }),
|
|
10
10
|
caseId: core_1.Args.string({ ignoreStdin: true, description: 'Case ID', required: true }),
|
|
11
11
|
};
|
|
12
|
-
static flags = {
|
|
12
|
+
static flags = {
|
|
13
|
+
json: core_1.Flags.boolean({ description: 'Output the full case document as JSON' }),
|
|
14
|
+
entries: core_1.Flags.integer({
|
|
15
|
+
description: 'Latest facts and receipts to show (the full document is --json)',
|
|
16
|
+
min: 1,
|
|
17
|
+
max: 100,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
13
20
|
async run() {
|
|
14
21
|
this.requireAuth();
|
|
15
|
-
const { args } = await this.parse(CommitmentsCase);
|
|
22
|
+
const { args, flags } = await this.parse(CommitmentsCase);
|
|
16
23
|
let result;
|
|
17
24
|
try {
|
|
18
25
|
result = await commitments_1.commitmentApi.caseDetail(args.commitmentId, args.caseId);
|
|
@@ -20,7 +27,16 @@ class CommitmentsCase extends base_command_1.BaseCommand {
|
|
|
20
27
|
catch (error) {
|
|
21
28
|
this.handleApiError(error);
|
|
22
29
|
}
|
|
23
|
-
|
|
30
|
+
if (flags.json) {
|
|
31
|
+
this.log(JSON.stringify(result, null, 2));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// A case document has no size bound — 93k lines was observed — so the
|
|
35
|
+
// human view is a digest with the most recent entries, and --json stays
|
|
36
|
+
// the opt-in for the full document (OSK-10952).
|
|
37
|
+
(0, commitments_1.renderCommitmentCaseDetail)(result, (line) => this.log(line), {
|
|
38
|
+
maxEntries: flags.entries ?? 10,
|
|
39
|
+
});
|
|
24
40
|
}
|
|
25
41
|
}
|
|
26
42
|
exports.default = CommitmentsCase;
|
|
@@ -8,6 +8,7 @@ export default class CommitmentsCases extends BaseCommand {
|
|
|
8
8
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
status: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
cursor: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<void>;
|
|
13
14
|
}
|
|
@@ -12,6 +12,9 @@ class CommitmentsCases extends base_command_1.BaseCommand {
|
|
|
12
12
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
13
13
|
limit: core_1.Flags.integer({ description: 'Cases to return (1..200)', min: 1, max: 200 }),
|
|
14
14
|
status: core_1.Flags.string({ description: 'Case lifecycle status to include' }),
|
|
15
|
+
cursor: core_1.Flags.string({
|
|
16
|
+
description: 'Continue from the next_cursor emitted by a previous page',
|
|
17
|
+
}),
|
|
15
18
|
};
|
|
16
19
|
async run() {
|
|
17
20
|
this.requireAuth();
|
|
@@ -21,12 +24,19 @@ class CommitmentsCases extends base_command_1.BaseCommand {
|
|
|
21
24
|
result = await commitments_1.commitmentApi.cases(args.commitmentId, {
|
|
22
25
|
limit: flags.limit,
|
|
23
26
|
status: flags.status,
|
|
27
|
+
cursor: flags.cursor,
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
catch (error) {
|
|
27
31
|
this.handleApiError(error);
|
|
28
32
|
}
|
|
29
|
-
|
|
33
|
+
if (flags.json) {
|
|
34
|
+
this.log(JSON.stringify(result, null, 2));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
(0, commitments_1.renderCommitmentCases)(result, (line) => this.log(line));
|
|
38
|
+
}
|
|
39
|
+
(0, commitments_1.renderListPageHint)(result, (line) => this.log(line));
|
|
30
40
|
}
|
|
31
41
|
}
|
|
32
42
|
exports.default = CommitmentsCases;
|
|
@@ -16,6 +16,7 @@ export default class CommitmentsChecks extends BaseCommand {
|
|
|
16
16
|
static flags: {
|
|
17
17
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
18
|
limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
cursor: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
20
|
};
|
|
20
21
|
run(): Promise<void>;
|
|
21
22
|
}
|
|
@@ -23,13 +23,16 @@ class CommitmentsChecks extends base_command_1.BaseCommand {
|
|
|
23
23
|
static flags = {
|
|
24
24
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
25
25
|
limit: core_1.Flags.integer({ description: 'Max checks to return (1..100)', min: 1, max: 100 }),
|
|
26
|
+
cursor: core_1.Flags.string({
|
|
27
|
+
description: 'Continue from the next_cursor emitted by a previous page',
|
|
28
|
+
}),
|
|
26
29
|
};
|
|
27
30
|
async run() {
|
|
28
31
|
this.requireAuth();
|
|
29
32
|
const { args, flags } = await this.parse(CommitmentsChecks);
|
|
30
33
|
let response;
|
|
31
34
|
try {
|
|
32
|
-
response = await commitments_1.commitmentApi.checks(args.id, flags.limit);
|
|
35
|
+
response = await commitments_1.commitmentApi.checks(args.id, { limit: flags.limit, cursor: flags.cursor });
|
|
33
36
|
}
|
|
34
37
|
catch (err) {
|
|
35
38
|
this.handleApiError(err);
|
|
@@ -39,6 +42,7 @@ class CommitmentsChecks extends base_command_1.BaseCommand {
|
|
|
39
42
|
return;
|
|
40
43
|
}
|
|
41
44
|
(0, commitments_1.renderCheckList)(response.data ?? [], (line) => this.log(line));
|
|
45
|
+
(0, commitments_1.renderListPageHint)(response, (line) => this.log(line));
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
exports.default = CommitmentsChecks;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
import { type CommitmentCostWindow } from '../../lib/commitments';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a cost window to UTC day boundaries.
|
|
5
|
+
*
|
|
6
|
+
* `CommitmentPeriodClose.readCostWindow` REFUSES a window that is not exactly
|
|
7
|
+
* on UTC day starts (`RangeError: cost windows must use UTC day boundaries`),
|
|
8
|
+
* because the closed daily metrics it sums are bucketed that way — a window
|
|
9
|
+
* that started mid-day would silently include or exclude a whole bucket. So the
|
|
10
|
+
* CLI snaps to the boundary itself rather than forwarding a wall-clock time and
|
|
11
|
+
* letting the operator meet a 500 they cannot act on.
|
|
12
|
+
*
|
|
13
|
+
* Snapping is a real change to what was asked for, so it is deliberately
|
|
14
|
+
* TRUNCATION in both directions — `--to 2026-09-19T18:00Z` reports through the
|
|
15
|
+
* start of the 19th, not the end of it. The command prints the window it
|
|
16
|
+
* actually used for that reason.
|
|
17
|
+
*
|
|
18
|
+
* The default window ends at TODAY's UTC day start, not now: today's metrics
|
|
19
|
+
* are not closed yet, so including the partial day would report a cost that
|
|
20
|
+
* changes when you re-run the same command.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveCostWindow(input?: {
|
|
23
|
+
from?: string;
|
|
24
|
+
to?: string;
|
|
25
|
+
}, now?: Date): {
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* `skrr commitments cost <id>` — closed-period spend for one commitment.
|
|
31
|
+
*
|
|
32
|
+
* Money on this path has no other bound the operator can read: a Commitment's
|
|
33
|
+
* agent turns are `AgentOutcome` rows carrying no cost fields, so
|
|
34
|
+
* `spendLimitDailyUsd` cannot see them and `maxRunsPerDay` IS the spend control
|
|
35
|
+
* (see `autonomyEnvelope.maxRunsPerDay` in the API's own schema note). This is
|
|
36
|
+
* the read that says what those runs actually cost.
|
|
37
|
+
*
|
|
38
|
+
* `metrics` shows the daily rows; this sums the closed ones over a window and,
|
|
39
|
+
* critically, reports how much of the window was ATTRIBUTABLE.
|
|
40
|
+
*/
|
|
41
|
+
export default class CommitmentsCost extends BaseCommand {
|
|
42
|
+
static description: string;
|
|
43
|
+
static examples: string[];
|
|
44
|
+
static args: {
|
|
45
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
46
|
+
};
|
|
47
|
+
static flags: {
|
|
48
|
+
from: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
49
|
+
to: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
50
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
51
|
+
};
|
|
52
|
+
run(): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Pure renderer for the cost window.
|
|
56
|
+
*
|
|
57
|
+
* `costStatus` is printed BEFORE the dollar figure, on purpose. `partial` and
|
|
58
|
+
* `unavailable` mean some runs reported no cost attribution at all, so the
|
|
59
|
+
* total understates the spend; a reader who sees the number first has already
|
|
60
|
+
* formed a belief by the time they reach the caveat.
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatCostWindow(data: CommitmentCostWindow): string[];
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveCostWindow = resolveCostWindow;
|
|
4
|
+
exports.formatCostWindow = formatCostWindow;
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const base_command_1 = require("../../base-command");
|
|
7
|
+
const commitments_1 = require("../../lib/commitments");
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
const DEFAULT_WINDOW_DAYS = 7;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a cost window to UTC day boundaries.
|
|
12
|
+
*
|
|
13
|
+
* `CommitmentPeriodClose.readCostWindow` REFUSES a window that is not exactly
|
|
14
|
+
* on UTC day starts (`RangeError: cost windows must use UTC day boundaries`),
|
|
15
|
+
* because the closed daily metrics it sums are bucketed that way — a window
|
|
16
|
+
* that started mid-day would silently include or exclude a whole bucket. So the
|
|
17
|
+
* CLI snaps to the boundary itself rather than forwarding a wall-clock time and
|
|
18
|
+
* letting the operator meet a 500 they cannot act on.
|
|
19
|
+
*
|
|
20
|
+
* Snapping is a real change to what was asked for, so it is deliberately
|
|
21
|
+
* TRUNCATION in both directions — `--to 2026-09-19T18:00Z` reports through the
|
|
22
|
+
* start of the 19th, not the end of it. The command prints the window it
|
|
23
|
+
* actually used for that reason.
|
|
24
|
+
*
|
|
25
|
+
* The default window ends at TODAY's UTC day start, not now: today's metrics
|
|
26
|
+
* are not closed yet, so including the partial day would report a cost that
|
|
27
|
+
* changes when you re-run the same command.
|
|
28
|
+
*/
|
|
29
|
+
function resolveCostWindow(input = {}, now = new Date()) {
|
|
30
|
+
const dayStart = (date) => new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
|
|
31
|
+
const parse = (value, flag) => {
|
|
32
|
+
const parsed = new Date(value);
|
|
33
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
34
|
+
throw new Error(`${flag} is not a date: ${value}`);
|
|
35
|
+
}
|
|
36
|
+
return parsed;
|
|
37
|
+
};
|
|
38
|
+
const to = input.to ? dayStart(parse(input.to, '--to')) : dayStart(now);
|
|
39
|
+
const from = input.from
|
|
40
|
+
? dayStart(parse(input.from, '--from'))
|
|
41
|
+
: new Date(to.getTime() - DEFAULT_WINDOW_DAYS * DAY_MS);
|
|
42
|
+
if (to.getTime() <= from.getTime()) {
|
|
43
|
+
throw new Error('--to must be a later UTC day than --from.');
|
|
44
|
+
}
|
|
45
|
+
return { from: from.toISOString(), to: to.toISOString() };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* `skrr commitments cost <id>` — closed-period spend for one commitment.
|
|
49
|
+
*
|
|
50
|
+
* Money on this path has no other bound the operator can read: a Commitment's
|
|
51
|
+
* agent turns are `AgentOutcome` rows carrying no cost fields, so
|
|
52
|
+
* `spendLimitDailyUsd` cannot see them and `maxRunsPerDay` IS the spend control
|
|
53
|
+
* (see `autonomyEnvelope.maxRunsPerDay` in the API's own schema note). This is
|
|
54
|
+
* the read that says what those runs actually cost.
|
|
55
|
+
*
|
|
56
|
+
* `metrics` shows the daily rows; this sums the closed ones over a window and,
|
|
57
|
+
* critically, reports how much of the window was ATTRIBUTABLE.
|
|
58
|
+
*/
|
|
59
|
+
class CommitmentsCost extends base_command_1.BaseCommand {
|
|
60
|
+
static description = "Sum a commitment's closed-period run cost over a UTC day window";
|
|
61
|
+
static examples = [
|
|
62
|
+
'<%= config.bin %> commitments cost obj_abc123',
|
|
63
|
+
'<%= config.bin %> commitments cost obj_abc123 --from 2026-09-01 --to 2026-09-15',
|
|
64
|
+
'<%= config.bin %> commitments cost obj_abc123 --json',
|
|
65
|
+
];
|
|
66
|
+
static args = {
|
|
67
|
+
id: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
68
|
+
};
|
|
69
|
+
static flags = {
|
|
70
|
+
from: core_1.Flags.string({
|
|
71
|
+
description: `Window start, truncated to its UTC day (default: ${DEFAULT_WINDOW_DAYS} days before --to)`,
|
|
72
|
+
}),
|
|
73
|
+
to: core_1.Flags.string({
|
|
74
|
+
description: "Window end, truncated to its UTC day (default: today's UTC day start)",
|
|
75
|
+
}),
|
|
76
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
77
|
+
};
|
|
78
|
+
async run() {
|
|
79
|
+
this.requireAuth();
|
|
80
|
+
const { args, flags } = await this.parse(CommitmentsCost);
|
|
81
|
+
let window;
|
|
82
|
+
try {
|
|
83
|
+
window = resolveCostWindow({ from: flags.from, to: flags.to });
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
this.error(err.message, { exit: 1 });
|
|
87
|
+
}
|
|
88
|
+
let data;
|
|
89
|
+
try {
|
|
90
|
+
data = await commitments_1.commitmentApi.cost(args.id, window);
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
this.handleApiError(err);
|
|
94
|
+
}
|
|
95
|
+
if (flags.json) {
|
|
96
|
+
this.log(JSON.stringify(data, null, 2));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
for (const line of formatCostWindow(data))
|
|
100
|
+
this.log(line);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.default = CommitmentsCost;
|
|
104
|
+
/**
|
|
105
|
+
* Pure renderer for the cost window.
|
|
106
|
+
*
|
|
107
|
+
* `costStatus` is printed BEFORE the dollar figure, on purpose. `partial` and
|
|
108
|
+
* `unavailable` mean some runs reported no cost attribution at all, so the
|
|
109
|
+
* total understates the spend; a reader who sees the number first has already
|
|
110
|
+
* formed a belief by the time they reach the caveat.
|
|
111
|
+
*/
|
|
112
|
+
function formatCostWindow(data) {
|
|
113
|
+
const micros = Number(data.costUsdMicros || 0);
|
|
114
|
+
const runs = Number(data.runCount || 0);
|
|
115
|
+
const unattributed = Number(data.unavailableRunCount || 0);
|
|
116
|
+
const status = data.costStatus ?? 'not_applicable';
|
|
117
|
+
const caveat = {
|
|
118
|
+
reported: 'every run in the window reported a cost',
|
|
119
|
+
partial: 'some runs reported no cost — the total below is a FLOOR',
|
|
120
|
+
unavailable: 'no run in the window reported a cost — the total below is meaningless',
|
|
121
|
+
not_applicable: 'no closed runs in the window',
|
|
122
|
+
};
|
|
123
|
+
return [
|
|
124
|
+
`Cost for ${data.commitmentId ?? '-'}`,
|
|
125
|
+
`Window: ${data.from ?? '-'} → ${data.to ?? '-'} (${Number(data.dayCount || 0)} closed day(s))`,
|
|
126
|
+
`Attribution: ${status} — ${caveat[status] ?? 'unrecognized cost status'}`,
|
|
127
|
+
`Cost: $${(micros / 1_000_000).toFixed(4)}`,
|
|
128
|
+
`Runs: ${runs} (${Number(data.reportedRunCount || 0)} with cost, ${unattributed} without)`,
|
|
129
|
+
];
|
|
130
|
+
}
|
|
@@ -197,7 +197,7 @@ class CommitmentsCreate extends base_command_1.BaseCommand {
|
|
|
197
197
|
agent: core_1.Flags.string({ description: 'Agent that owns and watches this commitment (required)' }),
|
|
198
198
|
kind: core_1.Flags.string({
|
|
199
199
|
description: 'Lifecycle kind: achieve is terminal-capable; maintain is perpetual',
|
|
200
|
-
options: [
|
|
200
|
+
options: [...commitments_1.COMMITMENT_KIND_VALUES],
|
|
201
201
|
}),
|
|
202
202
|
title: core_1.Flags.string({ description: 'Short commitment title (required)' }),
|
|
203
203
|
outcome: core_1.Flags.string({
|
|
@@ -22,6 +22,7 @@ export default class CommitmentsDelete extends BaseCommand {
|
|
|
22
22
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
23
23
|
reason: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
24
|
yes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
25
|
+
'stop-open-work': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
25
26
|
};
|
|
26
27
|
run(): Promise<void>;
|
|
27
28
|
}
|
|
@@ -30,16 +30,43 @@ class CommitmentsDelete extends base_command_1.BaseCommand {
|
|
|
30
30
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
31
31
|
reason: core_1.Flags.string({ description: 'Why it was deleted (recorded on the boundary ledger)' }),
|
|
32
32
|
yes: core_1.Flags.boolean({ char: 'y', description: 'Skip confirmation prompt' }),
|
|
33
|
+
'stop-open-work': core_1.Flags.boolean({
|
|
34
|
+
description: 'Cancel the open Tasks this Commitment produced. Without it they KEEP RUNNING — deleting the producer has never stopped the product.',
|
|
35
|
+
allowNo: true,
|
|
36
|
+
}),
|
|
33
37
|
};
|
|
34
38
|
async run() {
|
|
35
39
|
this.requireAuth();
|
|
36
40
|
const { args, flags } = await this.parse(CommitmentsDelete);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
let preview = null;
|
|
42
|
+
try {
|
|
43
|
+
preview = (await commitments_1.commitmentApi.deletionPreview(args.id));
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// An older server has no preview route. Proceed — the delete itself
|
|
47
|
+
// still refuses to guess when there is open work.
|
|
48
|
+
}
|
|
49
|
+
// The API refuses to delete an active Commitment, and rightly so. But a
|
|
50
|
+
// deliberate step is not the same as a dead end: the person has already
|
|
51
|
+
// said what they want, so the step becomes part of THIS gesture rather
|
|
52
|
+
// than a second command they have to go and find. Same rule the web
|
|
53
|
+
// dialog applies, so the two surfaces cannot drift.
|
|
54
|
+
const mustPauseFirst = preview?.requiresStopFirst === true;
|
|
55
|
+
const openTasks = Number(preview?.openTaskCount || 0);
|
|
56
|
+
if (openTasks > 0 && flags['stop-open-work'] === undefined) {
|
|
57
|
+
this.error(`${args.id} has ${openTasks} open task(s), and deleting it does NOT stop them.\n` +
|
|
58
|
+
` skrr commitments delete ${args.id} --stop-open-work # cancel them too\n` +
|
|
59
|
+
` skrr commitments delete ${args.id} --no-stop-open-work # leave them running`, { exit: 1 });
|
|
60
|
+
}
|
|
61
|
+
const fate = openTasks === 0
|
|
62
|
+
? 'Its checks, runs and cases stay readable.'
|
|
63
|
+
: flags['stop-open-work']
|
|
64
|
+
? `Its ${openTasks} open task(s) will be CANCELLED.`
|
|
65
|
+
: `Its ${openTasks} open task(s) will KEEP RUNNING.`;
|
|
66
|
+
const verb = mustPauseFirst ? 'Pause and delete' : 'Delete';
|
|
40
67
|
let confirmed;
|
|
41
68
|
try {
|
|
42
|
-
confirmed = await (0, prompt_1.confirmDestructive)(
|
|
69
|
+
confirmed = await (0, prompt_1.confirmDestructive)(`${verb} commitment ${args.id}? ${fate}`, flags.yes);
|
|
43
70
|
}
|
|
44
71
|
catch (err) {
|
|
45
72
|
if (err.exit === 7) {
|
|
@@ -51,9 +78,23 @@ class CommitmentsDelete extends base_command_1.BaseCommand {
|
|
|
51
78
|
this.log('Cancelled.');
|
|
52
79
|
return;
|
|
53
80
|
}
|
|
81
|
+
if (mustPauseFirst) {
|
|
82
|
+
try {
|
|
83
|
+
await commitments_1.commitmentApi.pause(args.id);
|
|
84
|
+
this.log(`Paused ${args.id}.`);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
// Report WHICH half failed. "Could not delete" would be wrong and
|
|
88
|
+
// would send the reader looking in the wrong place.
|
|
89
|
+
this.log(`Could not pause ${args.id} — it was not deleted.`);
|
|
90
|
+
this.handleApiError(err);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
54
93
|
let result;
|
|
55
94
|
try {
|
|
56
|
-
result = await commitments_1.commitmentApi.remove(args.id, flags.reason
|
|
95
|
+
result = await commitments_1.commitmentApi.remove(args.id, flags.reason, {
|
|
96
|
+
stopOpenWork: flags['stop-open-work'],
|
|
97
|
+
});
|
|
57
98
|
}
|
|
58
99
|
catch (err) {
|
|
59
100
|
this.handleApiError(err);
|
|
@@ -66,7 +107,16 @@ class CommitmentsDelete extends base_command_1.BaseCommand {
|
|
|
66
107
|
this.log(`Deleted ${String(commitment.id ?? args.id)}.`);
|
|
67
108
|
if (commitment.title)
|
|
68
109
|
this.log(` ${String(commitment.title)}`);
|
|
69
|
-
|
|
110
|
+
const work = (result.work ?? {});
|
|
111
|
+
// Lead with what still ACTS. What remains readable is reassurance; what
|
|
112
|
+
// remains running is the fact the reader needs.
|
|
113
|
+
if (work.openTasksStopped)
|
|
114
|
+
this.log(` ${work.openTasksStopped} open task(s) cancelled.`);
|
|
115
|
+
if (work.openTasksLeftRunning) {
|
|
116
|
+
this.log(` ${work.openTasksLeftRunning} open task(s) are STILL RUNNING.`);
|
|
117
|
+
}
|
|
118
|
+
this.log(' Its checks, runs and cases remain readable.');
|
|
119
|
+
this.log(` Restore it with: skrr commitments restore ${String(commitment.id ?? args.id)}`);
|
|
70
120
|
}
|
|
71
121
|
}
|
|
72
122
|
exports.default = CommitmentsDelete;
|
|
@@ -53,7 +53,15 @@ class CommitmentsFeedback extends base_command_1.BaseCommand {
|
|
|
53
53
|
this.log(JSON.stringify(result, null, 2));
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
// A contradictory click used to acknowledge identically to a fresh verdict
|
|
57
|
+
// (OSK-10955) — the server reports what already stands on the check, and
|
|
58
|
+
// this copy keeps it visible.
|
|
59
|
+
const prior = Array.isArray(result?.priorFeedbackKinds)
|
|
60
|
+
? result.priorFeedbackKinds.filter(Boolean)
|
|
61
|
+
: [];
|
|
62
|
+
const priorClause = prior.length ? ` Earlier feedback on this check: ${prior.join(', ')}.` : '';
|
|
63
|
+
const reaffirmClause = result?.reaffirmed ? ' (reaffirmed — same verdict as before)' : '';
|
|
64
|
+
this.log(`Recorded "${flags.kind}" on ${args.checkId}.${reaffirmClause} Reflection will weigh it next cycle.${priorClause}`);
|
|
57
65
|
}
|
|
58
66
|
}
|
|
59
67
|
exports.default = CommitmentsFeedback;
|
|
@@ -78,6 +78,22 @@ class CommitmentsHandover extends base_command_1.BaseCommand {
|
|
|
78
78
|
}
|
|
79
79
|
const agentLabel = target.name ? `${target.name} (${target.id})` : target.id;
|
|
80
80
|
this.log(`Handed commitment ${args.id} over to ${agentLabel}`);
|
|
81
|
+
// The transition summary — without it a mid-check/mid-run handover reads
|
|
82
|
+
// as a silent success and the operator cannot tell whether in-flight work
|
|
83
|
+
// kept the old executor or was fenced.
|
|
84
|
+
const inFlight = result?.inFlight;
|
|
85
|
+
if (inFlight) {
|
|
86
|
+
const claimed = Number(inFlight.claimedRuns) || 0;
|
|
87
|
+
const fencedRuns = Number(inFlight.fencedRuns) || 0;
|
|
88
|
+
const fencedChecks = Number(inFlight.fencedChecks) || 0;
|
|
89
|
+
if (claimed > 0) {
|
|
90
|
+
this.log(` ${claimed} claimed run(s) keep the old executor until they finish`);
|
|
91
|
+
}
|
|
92
|
+
if (fencedRuns > 0 || fencedChecks > 0) {
|
|
93
|
+
this.log(` fenced ${fencedRuns} unclaimed run(s) and ${fencedChecks} in-flight check(s) — cancelled before start`);
|
|
94
|
+
}
|
|
95
|
+
this.log(` the new executor takes over from the next wake`);
|
|
96
|
+
}
|
|
81
97
|
// The audit entry the server appended — echo it so "from whom" is answered
|
|
82
98
|
// without a second call. Absent on a server that predates the trail.
|
|
83
99
|
const commitment = result?.commitment ??
|
|
@@ -22,6 +22,7 @@ export default class CommitmentsHypotheses extends BaseCommand {
|
|
|
22
22
|
limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
23
|
status: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
24
|
'investigation-key': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
|
+
cursor: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
26
|
};
|
|
26
27
|
run(): Promise<void>;
|
|
27
28
|
}
|