@skrr-ai/cli 0.1.155 → 0.1.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +64 -16
- package/dist/commands/activity/list.d.ts +13 -0
- package/dist/commands/activity/list.js +50 -0
- package/dist/commands/activity/scan-older.d.ts +23 -0
- package/dist/commands/activity/scan-older.js +74 -0
- package/dist/commands/activity/show.d.ts +27 -0
- package/dist/commands/activity/show.js +228 -0
- package/dist/commands/agent/message/send.js +64 -19
- package/dist/commands/agents/always-on/held-messages.js +24 -1
- package/dist/commands/agents/always-on/status.js +6 -1
- package/dist/commands/agents/mini-computer/app/reset.d.ts +13 -0
- package/dist/commands/agents/mini-computer/app/reset.js +35 -0
- package/dist/commands/agents/mini-computer/app/set.d.ts +16 -0
- package/dist/commands/agents/mini-computer/app/set.js +70 -0
- package/dist/commands/agents/mini-computer/layout/change.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/change.js +44 -0
- package/dist/commands/agents/mini-computer/layout/folder.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/folder.js +35 -0
- package/dist/commands/agents/mini-computer/layout/move.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/move.js +32 -0
- package/dist/commands/agents/mini-computer/layout/pin.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/pin.js +35 -0
- package/dist/commands/agents/mini-computer/layout/remove.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/remove.js +27 -0
- package/dist/commands/agents/mini-computer/layout/restore.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/restore.js +27 -0
- package/dist/commands/agents/mini-computer/layout/unfolder.d.ts +13 -0
- package/dist/commands/agents/mini-computer/layout/unfolder.js +27 -0
- package/dist/commands/agents/mini-computer/layout/unpin.d.ts +14 -0
- package/dist/commands/agents/mini-computer/layout/unpin.js +34 -0
- package/dist/commands/agents/mini-computer/show.d.ts +13 -0
- package/dist/commands/agents/mini-computer/show.js +60 -0
- package/dist/commands/agents/mini-computer/tasks-view.d.ts +29 -0
- package/dist/commands/agents/mini-computer/tasks-view.js +100 -0
- package/dist/commands/apps/auto-apply.d.ts +14 -0
- package/dist/commands/apps/auto-apply.js +53 -0
- package/dist/commands/apps/check.js +4 -1
- package/dist/commands/apps/create.js +11 -6
- package/dist/commands/apps/data/batch.d.ts +15 -0
- package/dist/commands/apps/data/batch.js +59 -0
- package/dist/commands/apps/data/collections.d.ts +12 -0
- package/dist/commands/apps/data/collections.js +44 -0
- package/dist/commands/apps/data/delete.d.ts +15 -0
- package/dist/commands/apps/data/delete.js +57 -0
- package/dist/commands/apps/data/patch.d.ts +17 -0
- package/dist/commands/apps/data/patch.js +70 -0
- package/dist/commands/apps/data/put.js +1 -1
- package/dist/commands/apps/data/query.js +1 -1
- package/dist/commands/apps/installations/diff.d.ts +14 -0
- package/dist/commands/apps/installations/diff.js +45 -0
- package/dist/commands/apps/installations/events.d.ts +23 -0
- package/dist/commands/apps/installations/events.js +104 -0
- package/dist/commands/apps/installations/snapshot.d.ts +18 -0
- package/dist/commands/apps/installations/snapshot.js +60 -0
- package/dist/commands/apps/installations/versions.d.ts +12 -0
- package/dist/commands/apps/installations/versions.js +38 -0
- package/dist/commands/apps/logs.js +3 -0
- package/dist/commands/apps/preview.js +4 -2
- package/dist/commands/apps/pull.js +10 -1
- package/dist/commands/apps/push.js +36 -12
- package/dist/commands/apps/reference.d.ts +26 -0
- package/dist/commands/apps/reference.js +56 -0
- package/dist/commands/apps/rollback.d.ts +13 -0
- package/dist/commands/apps/rollback.js +47 -0
- package/dist/commands/apps/version/create.js +5 -0
- package/dist/commands/duties/accounting.js +6 -0
- package/dist/commands/duties/analytics/detail.js +6 -0
- package/dist/commands/duties/analytics/index.js +14 -0
- package/dist/commands/duties/analytics/replay.js +6 -0
- package/dist/commands/duties/cost.js +6 -0
- package/dist/commands/duties/delete.js +22 -19
- package/dist/commands/duties/doctor.d.ts +2 -1
- package/dist/commands/duties/doctor.js +17 -3
- package/dist/commands/duties/goals/link.js +4 -0
- package/dist/commands/duties/goals/unlink.js +4 -0
- package/dist/commands/duties/lineage.js +6 -1
- package/dist/commands/duties/links/list.js +6 -0
- package/dist/commands/duties/metrics.js +10 -0
- package/dist/commands/duties/observations.js +12 -0
- package/dist/commands/duties/operating-review.d.ts +4 -30
- package/dist/commands/duties/operating-review.js +28 -141
- package/dist/commands/duties/receipt-metrics.js +7 -0
- package/dist/commands/duties/receipt.js +7 -0
- package/dist/commands/duties/roster.js +14 -8
- package/dist/commands/duties/show.js +27 -9
- package/dist/commands/duties/status.js +18 -9
- package/dist/commands/duties/trigger-status.d.ts +2 -0
- package/dist/commands/duties/trigger-status.js +19 -1
- package/dist/commands/duties/wake-capabilities.d.ts +2 -0
- package/dist/commands/duties/wake-capabilities.js +32 -2
- package/dist/commands/followups/act.js +3 -0
- package/dist/commands/followups/remind.js +12 -3
- package/dist/commands/followups/show.js +6 -0
- package/dist/commands/harnesses/quota.js +1 -1
- package/dist/commands/spaces/notebook.d.ts +3 -7
- package/dist/commands/spaces/notebook.js +32 -8
- package/dist/commands/tasks/create.d.ts +2 -2
- package/dist/commands/tasks/create.js +3 -3
- package/dist/commands/tasks/list.d.ts +3 -41
- package/dist/commands/tasks/list.js +5 -53
- package/dist/generated/agent-guides.json +424 -101
- package/dist/generated/managed-instruction-guides.json +1 -1
- package/dist/lib/agent-activity.d.ts +153 -0
- package/dist/lib/agent-activity.js +241 -0
- package/dist/lib/always-on-runtime.d.ts +9 -0
- package/dist/lib/always-on-runtime.js +20 -0
- package/dist/lib/api-fetch.d.ts +10 -0
- package/dist/lib/api-fetch.js +12 -2
- package/dist/lib/appData.d.ts +28 -1
- package/dist/lib/appData.js +111 -9
- package/dist/lib/appInstallations.d.ts +9 -1
- package/dist/lib/appInstallations.js +100 -0
- package/dist/lib/apps-command.d.ts +1 -0
- package/dist/lib/apps-command.js +11 -0
- package/dist/lib/apps.d.ts +12 -0
- package/dist/lib/apps.js +28 -1
- package/dist/lib/appsAssets.d.ts +17 -0
- package/dist/lib/appsAssets.js +15 -0
- package/dist/lib/appsCheck.d.ts +1 -0
- package/dist/lib/appsCheck.js +1 -0
- package/dist/lib/appsFs.d.ts +18 -1
- package/dist/lib/appsFs.js +76 -19
- package/dist/lib/compasses.js +6 -0
- package/dist/lib/duties.d.ts +25 -2
- package/dist/lib/duties.js +58 -3
- package/dist/lib/duty-analytics.d.ts +2 -0
- package/dist/lib/duty-analytics.js +26 -0
- package/dist/lib/duty-goal-propagation.d.ts +2 -0
- package/dist/lib/duty-goal-propagation.js +18 -0
- package/dist/lib/duty-history-source.d.ts +4 -0
- package/dist/lib/duty-history-source.js +12 -0
- package/dist/lib/duty-ledgers.d.ts +4 -0
- package/dist/lib/duty-ledgers.js +4 -0
- package/dist/lib/duty-receipt-source.d.ts +4 -0
- package/dist/lib/duty-receipt-source.js +19 -0
- package/dist/lib/followups.d.ts +20 -0
- package/dist/lib/followups.js +10 -0
- package/dist/lib/held-messages.d.ts +22 -0
- package/dist/lib/held-messages.js +55 -0
- package/dist/lib/list-workspace.d.ts +40 -0
- package/dist/lib/list-workspace.js +58 -0
- package/dist/lib/miniComputer.d.ts +59 -0
- package/dist/lib/miniComputer.js +224 -0
- package/dist/lib/miniComputerCommand.d.ts +13 -0
- package/dist/lib/miniComputerCommand.js +48 -0
- package/dist/lib/roles.d.ts +3 -3
- package/dist/lib/space-notebook.js +15 -4
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10465 -8383
- package/oclif.manifest.json +2849 -462
- package/package.json +14 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* `skrr apps reference [topic]`: the reference for writing an App, the same text the Apps MCP's `app_reference` tool
|
|
4
|
+
* answers, for a harness that has the CLI and no MCP server.
|
|
5
|
+
*
|
|
6
|
+
* It extends `Command`, not `BaseCommand`, for the reason `apps check` does: it prints text built from the contract
|
|
7
|
+
* (`appReferenceText`, `@skrr-ai/data-provider`), so it needs no sign-in and no network, and it reaches no API. The text
|
|
8
|
+
* is generated from the manifest schema, the frame runtime, the pinned library table and the theme tokens, so what a
|
|
9
|
+
* harness reads here is what `apps check` will hold its package to.
|
|
10
|
+
*/
|
|
11
|
+
export default class AppsReference extends Command {
|
|
12
|
+
static description: string;
|
|
13
|
+
static examples: string[];
|
|
14
|
+
static args: {
|
|
15
|
+
topic: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
16
|
+
};
|
|
17
|
+
static flags: {
|
|
18
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* `--json` output. Like `apps check`, this command extends `Command` and not `BaseCommand` (it is offline), so it cannot
|
|
22
|
+
* call `printJsonResult`; it says `ok` the same way (`withOk`).
|
|
23
|
+
*/
|
|
24
|
+
private printJson;
|
|
25
|
+
run(): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 json_output_1 = require("../../lib/json-output");
|
|
6
|
+
/**
|
|
7
|
+
* `skrr apps reference [topic]`: the reference for writing an App, the same text the Apps MCP's `app_reference` tool
|
|
8
|
+
* answers, for a harness that has the CLI and no MCP server.
|
|
9
|
+
*
|
|
10
|
+
* It extends `Command`, not `BaseCommand`, for the reason `apps check` does: it prints text built from the contract
|
|
11
|
+
* (`appReferenceText`, `@skrr-ai/data-provider`), so it needs no sign-in and no network, and it reaches no API. The text
|
|
12
|
+
* is generated from the manifest schema, the frame runtime, the pinned library table and the theme tokens, so what a
|
|
13
|
+
* harness reads here is what `apps check` will hold its package to.
|
|
14
|
+
*/
|
|
15
|
+
class AppsReference extends core_1.Command {
|
|
16
|
+
static description = "Print the reference for writing an App, generated from the platform contract: app.json keys, the window API (window.skrr.app), scheduled jobs, app data, and the window's page (ES modules, the libraries it may import with their versions, the --skrr-* theme tokens, the first-party UI kit). With no topic you get a one-page index. Needs no sign-in.";
|
|
17
|
+
static examples = [
|
|
18
|
+
'<%= config.bin %> apps reference',
|
|
19
|
+
'<%= config.bin %> apps reference frame',
|
|
20
|
+
'<%= config.bin %> apps reference sdk --json',
|
|
21
|
+
];
|
|
22
|
+
static args = {
|
|
23
|
+
topic: core_1.Args.string({
|
|
24
|
+
description: `One of: ${data_provider_1.APP_REFERENCE_TOPICS.join(', ')} (default: index)`,
|
|
25
|
+
required: false,
|
|
26
|
+
ignoreStdin: true,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
static flags = {
|
|
30
|
+
json: core_1.Flags.boolean({ description: 'Output the topic as JSON' }),
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* `--json` output. Like `apps check`, this command extends `Command` and not `BaseCommand` (it is offline), so it cannot
|
|
34
|
+
* call `printJsonResult`; it says `ok` the same way (`withOk`).
|
|
35
|
+
*/
|
|
36
|
+
printJson(value) {
|
|
37
|
+
const text = JSON.stringify((0, json_output_1.withOk)(value), null, 2);
|
|
38
|
+
this.log(text);
|
|
39
|
+
}
|
|
40
|
+
async run() {
|
|
41
|
+
const { args, flags } = await this.parse(AppsReference);
|
|
42
|
+
const topic = args.topic ?? 'index';
|
|
43
|
+
if (!(0, data_provider_1.isAppReferenceTopic)(topic)) {
|
|
44
|
+
this.error(`Unknown topic "${topic}". Topics: ${data_provider_1.APP_REFERENCE_TOPICS.join(', ')}.`, {
|
|
45
|
+
exit: 2,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const answer = (0, data_provider_1.appReferenceText)(topic);
|
|
49
|
+
if (flags.json) {
|
|
50
|
+
this.printJson({ topic: answer.topic, text: answer.text });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.log(answer.text);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = AppsReference;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppsCommand } from '../../lib/apps-command';
|
|
2
|
+
export default class AppsRollback extends AppsCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
installation: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
'expected-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 apps_command_1 = require("../../lib/apps-command");
|
|
6
|
+
const appInstallations_1 = require("../../lib/appInstallations");
|
|
7
|
+
class AppsRollback extends apps_command_1.AppsCommand {
|
|
8
|
+
static description = 'Put an installation back on the version it ran before the current one, in one call. It works for you and for your agent, and it never widens what you approved: if the earlier version needs an approval you have since changed, the installation says it needs your approval again. Repeating it goes back one more step.';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> apps rollback appi_abc',
|
|
11
|
+
'<%= config.bin %> apps rollback appi_abc --expected-version appv_current',
|
|
12
|
+
];
|
|
13
|
+
static args = {
|
|
14
|
+
installation: core_1.Args.string({
|
|
15
|
+
description: 'The installation id (appi_...)',
|
|
16
|
+
required: true,
|
|
17
|
+
ignoreStdin: true,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
static flags = {
|
|
21
|
+
'expected-version': core_1.Flags.string({
|
|
22
|
+
description: 'Go back only if it still runs this version (appv_...); otherwise nothing changes',
|
|
23
|
+
}),
|
|
24
|
+
json: core_1.Flags.boolean({ description: 'Output the installation as JSON' }),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
this.requireAuth();
|
|
28
|
+
const { args, flags } = await this.parse(AppsRollback);
|
|
29
|
+
try {
|
|
30
|
+
const result = await data_provider_1.dataService.rollbackAppInstallation(args.installation, {
|
|
31
|
+
...(flags['expected-version'] ? { expectedVersionId: flags['expected-version'] } : {}),
|
|
32
|
+
});
|
|
33
|
+
if (flags.json) {
|
|
34
|
+
this.printJsonResult(result);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.log(`${result.installation.id} runs v${result.version.version} (${result.version.id}) again (${(0, appInstallations_1.describeAvailability)(result.installation.availability)})`);
|
|
38
|
+
if (result.installation.availability === 'needs_reconsent') {
|
|
39
|
+
this.log(`That version asks for something you approved differently since, so it does not run until you approve it: \`${this.config.bin} apps disclosure ${result.version.id} --installation ${result.installation.id}\`, then \`${this.config.bin} apps reconsent ${result.installation.id} --yes\`.`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
this.failInstallation(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = AppsRollback;
|
|
@@ -44,6 +44,11 @@ class AppsVersionCreate extends apps_command_1.AppsCommand {
|
|
|
44
44
|
if (result.check.issues.length > 0)
|
|
45
45
|
for (const line of (0, appsCheck_1.formatAppCheckReport)(result.check))
|
|
46
46
|
this.log(line);
|
|
47
|
+
// what the installers' opt-in did with it (counts only): the cut is not "live" until a person or the opt-in moves it
|
|
48
|
+
if (result.autoApply && result.autoApply.considered > 0) {
|
|
49
|
+
const { applied, awaitingConsent, held, considered } = result.autoApply;
|
|
50
|
+
this.log(`of ${considered} installation${considered === 1 ? '' : 's'} with automatic updates on: ${applied} took it, ${awaitingConsent} wait for approval because it asks for more, ${held} were left as they are. \`${this.config.bin} apps installations versions <installation>\` shows which.`);
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
53
|
catch (error) {
|
|
49
54
|
this.failApps(error);
|
|
@@ -5,6 +5,7 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const base_command_1 = require("../../base-command");
|
|
6
6
|
const duties_1 = require("../../lib/duties");
|
|
7
7
|
const cost_1 = require("./cost");
|
|
8
|
+
const duty_history_source_1 = require("../../lib/duty-history-source");
|
|
8
9
|
/**
|
|
9
10
|
* `skrr duties accounting <id>` — the allowance-accounting SHADOW readout.
|
|
10
11
|
*
|
|
@@ -44,6 +45,11 @@ class DutiesAccounting extends base_command_1.BaseCommand {
|
|
|
44
45
|
catch (err) {
|
|
45
46
|
this.handleApiError(err);
|
|
46
47
|
}
|
|
48
|
+
if (!(0, duty_history_source_1.hasVerifiedDutyHistorySource)(readout)) {
|
|
49
|
+
this.error('Duty accounting history is unavailable because its source identity cannot be verified.', {
|
|
50
|
+
exit: 1,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
47
53
|
if (flags.json) {
|
|
48
54
|
this.log(JSON.stringify(readout, null, 2));
|
|
49
55
|
return;
|
|
@@ -44,6 +44,12 @@ class DutiesAnalyticsDetail extends base_command_1.BaseCommand {
|
|
|
44
44
|
catch (err) {
|
|
45
45
|
this.handleApiError(err);
|
|
46
46
|
}
|
|
47
|
+
if (!(0, duty_analytics_1.hasVerifiedDutyHistory)(result)) {
|
|
48
|
+
this.failWithCliError({
|
|
49
|
+
message: 'Duty history is unavailable because its original source cannot be verified.',
|
|
50
|
+
code: 'DUTY_HISTORY_UNAVAILABLE', exit: 1, retryable: false,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
47
53
|
this.log(JSON.stringify(result, null, 2));
|
|
48
54
|
}
|
|
49
55
|
}
|
|
@@ -103,6 +103,20 @@ class DutiesAnalytics extends base_command_1.BaseCommand {
|
|
|
103
103
|
catch (err) {
|
|
104
104
|
this.handleApiError(err);
|
|
105
105
|
}
|
|
106
|
+
// A requested workspace is not itself proof of an aggregate: non-admins
|
|
107
|
+
// can supply the flag but older servers respond with their owner scope.
|
|
108
|
+
// Keep the server-authorized aggregate only when both request and response
|
|
109
|
+
// identify it as workspace-wide.
|
|
110
|
+
const isExplicitWorkspaceDistribution = args.report === 'distribution' &&
|
|
111
|
+
Boolean(flags.workspace) && result.scope === 'workspace';
|
|
112
|
+
const requiresVerifiedSource = (0, duty_analytics_1.reportRequiresVerifiedHistory)(args.report) ||
|
|
113
|
+
(args.report === 'distribution' && !isExplicitWorkspaceDistribution);
|
|
114
|
+
if (requiresVerifiedSource && !(0, duty_analytics_1.hasVerifiedDutyHistory)(result)) {
|
|
115
|
+
this.failWithCliError({
|
|
116
|
+
message: 'Duty history is unavailable because its original source cannot be verified.',
|
|
117
|
+
code: 'DUTY_HISTORY_UNAVAILABLE', exit: 1, retryable: false,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
106
120
|
this.log(JSON.stringify(result, null, 2));
|
|
107
121
|
}
|
|
108
122
|
}
|
|
@@ -39,6 +39,12 @@ class DutiesAnalyticsReplay extends base_command_1.BaseCommand {
|
|
|
39
39
|
catch (err) {
|
|
40
40
|
this.handleApiError(err);
|
|
41
41
|
}
|
|
42
|
+
if (!(0, duty_analytics_1.hasVerifiedDutyHistory)(result)) {
|
|
43
|
+
this.failWithCliError({
|
|
44
|
+
message: 'Duty history is unavailable because its original source cannot be verified.',
|
|
45
|
+
code: 'DUTY_HISTORY_UNAVAILABLE', exit: 1, retryable: false,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
42
48
|
this.log(JSON.stringify(result, null, 2));
|
|
43
49
|
}
|
|
44
50
|
}
|
|
@@ -7,6 +7,7 @@ exports.noSpendInferenceNote = noSpendInferenceNote;
|
|
|
7
7
|
const core_1 = require("@oclif/core");
|
|
8
8
|
const base_command_1 = require("../../base-command");
|
|
9
9
|
const duties_1 = require("../../lib/duties");
|
|
10
|
+
const duty_history_source_1 = require("../../lib/duty-history-source");
|
|
10
11
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
11
12
|
const DEFAULT_WINDOW_DAYS = 7;
|
|
12
13
|
/**
|
|
@@ -94,6 +95,11 @@ class DutiesCost extends base_command_1.BaseCommand {
|
|
|
94
95
|
catch (err) {
|
|
95
96
|
this.handleApiError(err);
|
|
96
97
|
}
|
|
98
|
+
if (!(0, duty_history_source_1.hasVerifiedDutyHistorySource)(data)) {
|
|
99
|
+
this.error('Duty cost history is unavailable because its source identity cannot be verified.', {
|
|
100
|
+
exit: 1,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
97
103
|
if (flags.json) {
|
|
98
104
|
this.log(JSON.stringify(data, null, 2));
|
|
99
105
|
return;
|
|
@@ -18,7 +18,7 @@ const prompt_1 = require("../../lib/prompt");
|
|
|
18
18
|
* Refused for system-managed loops, which the platform re-creates anyway.
|
|
19
19
|
*/
|
|
20
20
|
class DutiesDelete extends base_command_1.BaseCommand {
|
|
21
|
-
static description = 'Delete a duty (soft —
|
|
21
|
+
static description = 'Delete a duty (soft — pause or archive an active one first)';
|
|
22
22
|
static examples = [
|
|
23
23
|
'<%= config.bin %> duties delete <duty-id>',
|
|
24
24
|
'<%= config.bin %> duties delete <duty-id> --reason "scratch probe"',
|
|
@@ -31,20 +31,31 @@ class DutiesDelete extends base_command_1.BaseCommand {
|
|
|
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
33
|
'stop-open-work': core_1.Flags.boolean({
|
|
34
|
-
description: '
|
|
34
|
+
description: 'Automatic task cancellation is unavailable',
|
|
35
35
|
allowNo: true,
|
|
36
|
+
hidden: true,
|
|
36
37
|
}),
|
|
37
38
|
};
|
|
38
39
|
async run() {
|
|
39
40
|
this.requireAuth();
|
|
40
41
|
const { args, flags } = await this.parse(DutiesDelete);
|
|
42
|
+
if (flags['stop-open-work'] === true) {
|
|
43
|
+
this.error('Automatic task cancellation is unavailable. Stop tasks individually before deleting the Duty.', { exit: 1 });
|
|
44
|
+
}
|
|
41
45
|
let preview = null;
|
|
42
46
|
try {
|
|
43
47
|
preview = (await duties_1.dutyApi.deletionPreview(args.id));
|
|
44
48
|
}
|
|
45
49
|
catch {
|
|
46
|
-
//
|
|
47
|
-
//
|
|
50
|
+
// Without a verified preview contract, older servers may also perform
|
|
51
|
+
// unscoped deletion. Never make that destructive request blindly.
|
|
52
|
+
}
|
|
53
|
+
const previewIsScoped = preview?.sourcePolicy?.status === 'partial' &&
|
|
54
|
+
preview.sourcePolicy.reason === 'actor_scope_only' &&
|
|
55
|
+
Number.isSafeInteger(preview.openTaskCount) &&
|
|
56
|
+
preview.openTaskCount >= 0;
|
|
57
|
+
if (!previewIsScoped) {
|
|
58
|
+
this.error('Cannot verify the Duty deletion scope. Retry when the preview is available or upgrade the server before deleting.', { exit: 1 });
|
|
48
59
|
}
|
|
49
60
|
// The API refuses to delete an active Duty, and rightly so. But a
|
|
50
61
|
// deliberate step is not the same as a dead end: the person has already
|
|
@@ -52,17 +63,9 @@ class DutiesDelete extends base_command_1.BaseCommand {
|
|
|
52
63
|
// than a second command they have to go and find. Same rule the web
|
|
53
64
|
// dialog applies, so the two surfaces cannot drift.
|
|
54
65
|
const mustPauseFirst = preview?.requiresStopFirst === true;
|
|
55
|
-
const openTasks =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
` skrr duties delete ${args.id} --stop-open-work # cancel them too\n` +
|
|
59
|
-
` skrr duties 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 openTasks = preview.openTaskCount;
|
|
67
|
+
const fate = `The preview found ${openTasks} open task(s) in your account and this Duty's workspace. ` +
|
|
68
|
+
'Other related work is not covered. Deleting the Duty will not automatically stop tasks.';
|
|
66
69
|
const verb = mustPauseFirst ? 'Pause and delete' : 'Delete';
|
|
67
70
|
let confirmed;
|
|
68
71
|
try {
|
|
@@ -93,7 +96,7 @@ class DutiesDelete extends base_command_1.BaseCommand {
|
|
|
93
96
|
let result;
|
|
94
97
|
try {
|
|
95
98
|
result = await duties_1.dutyApi.remove(args.id, flags.reason, {
|
|
96
|
-
stopOpenWork:
|
|
99
|
+
stopOpenWork: false,
|
|
97
100
|
});
|
|
98
101
|
}
|
|
99
102
|
catch (err) {
|
|
@@ -111,11 +114,11 @@ class DutiesDelete extends base_command_1.BaseCommand {
|
|
|
111
114
|
// Lead with what still ACTS. What remains readable is reassurance; what
|
|
112
115
|
// remains running is the fact the reader needs.
|
|
113
116
|
if (work.openTasksStopped)
|
|
114
|
-
this.log(` ${work.openTasksStopped} open task(s) cancelled.`);
|
|
117
|
+
this.log(` ${work.openTasksStopped} open task(s) in your scope cancelled.`);
|
|
115
118
|
if (work.openTasksLeftRunning) {
|
|
116
|
-
this.log(` ${work.openTasksLeftRunning} open task(s)
|
|
119
|
+
this.log(` ${work.openTasksLeftRunning} open task(s) in your scope were not cancelled.`);
|
|
117
120
|
}
|
|
118
|
-
this.log('
|
|
121
|
+
this.log(' The work preview covered only your account and this Duty’s workspace; other related work may remain.');
|
|
119
122
|
this.log(` Restore it with: skrr duties restore ${String(duty.id ?? args.id)}`);
|
|
120
123
|
}
|
|
121
124
|
}
|
|
@@ -2,7 +2,8 @@ import { BaseCommand } from '../../base-command';
|
|
|
2
2
|
export declare function doctorVerdict(input: {
|
|
3
3
|
duty?: Record<string, unknown>;
|
|
4
4
|
preflight?: Record<string, unknown>;
|
|
5
|
-
operatingState?: Record<string, unknown
|
|
5
|
+
operatingState?: Record<string, unknown> | null;
|
|
6
|
+
historyUnavailable?: boolean;
|
|
6
7
|
}): {
|
|
7
8
|
verdict: string;
|
|
8
9
|
next: string;
|
|
@@ -10,6 +10,14 @@ const DOCTOR_VERDICT_RE = /^status_([a-z_]+)$/;
|
|
|
10
10
|
function doctorVerdict(input) {
|
|
11
11
|
const duty = input.duty || {};
|
|
12
12
|
const preflight = input.preflight || {};
|
|
13
|
+
// An unavailable history cannot substantiate the stored Duty assessment.
|
|
14
|
+
// Do not let a previously healthy assessment masquerade as current evidence.
|
|
15
|
+
if (input.historyUnavailable === true || input.operatingState === null) {
|
|
16
|
+
return {
|
|
17
|
+
verdict: 'unknown',
|
|
18
|
+
next: 'Duty history cannot be attributed to this Duty, so its operating health is unavailable',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
13
21
|
const operatingState = input.operatingState || {};
|
|
14
22
|
const blocker = operatingState.firstActionableBlocker;
|
|
15
23
|
if (blocker?.code) {
|
|
@@ -115,13 +123,19 @@ class DutiesDoctor extends base_command_1.BaseCommand {
|
|
|
115
123
|
this.handleApiError(error);
|
|
116
124
|
return;
|
|
117
125
|
}
|
|
118
|
-
const
|
|
119
|
-
const
|
|
126
|
+
const sourceOperatingState = shown.operatingState;
|
|
127
|
+
const operatingState = sourceOperatingState || {};
|
|
128
|
+
const diagnosis = doctorVerdict({
|
|
129
|
+
duty,
|
|
130
|
+
operatingState: sourceOperatingState,
|
|
131
|
+
historyUnavailable: shown.historyUnavailable === true,
|
|
132
|
+
});
|
|
120
133
|
const report = {
|
|
121
134
|
...diagnosis,
|
|
122
135
|
duty,
|
|
123
136
|
abilities: shown.abilities,
|
|
124
|
-
operatingState,
|
|
137
|
+
operatingState: sourceOperatingState,
|
|
138
|
+
historyUnavailable: shown.historyUnavailable,
|
|
125
139
|
observedAt: new Date().toISOString(),
|
|
126
140
|
};
|
|
127
141
|
if (!flags.json && operatingState.knowledge) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const base_command_1 = require("../../../base-command");
|
|
5
5
|
const duties_1 = require("../../../lib/duties");
|
|
6
|
+
const duty_goal_propagation_1 = require("../../../lib/duty-goal-propagation");
|
|
6
7
|
/**
|
|
7
8
|
* `skrr duties goals link <duty-id> <goal-id>`
|
|
8
9
|
*
|
|
@@ -36,6 +37,9 @@ class DutiesGoalsLink extends base_command_1.BaseCommand {
|
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
39
|
this.log(`Linked goal ${args.goalId} → duty ${args.dutyId}.`);
|
|
40
|
+
const notice = (0, duty_goal_propagation_1.dutyGoalPropagationNotice)(result, 'link');
|
|
41
|
+
if (notice)
|
|
42
|
+
this.log(notice);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
exports.default = DutiesGoalsLink;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const base_command_1 = require("../../../base-command");
|
|
5
5
|
const duties_1 = require("../../../lib/duties");
|
|
6
|
+
const duty_goal_propagation_1 = require("../../../lib/duty-goal-propagation");
|
|
6
7
|
/**
|
|
7
8
|
* `skrr duties goals unlink <duty-id> <goal-id>`
|
|
8
9
|
*
|
|
@@ -32,6 +33,9 @@ class DutiesGoalsUnlink extends base_command_1.BaseCommand {
|
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
35
|
this.log(`Unlinked goal ${args.goalId} from duty ${args.dutyId}.`);
|
|
36
|
+
const notice = (0, duty_goal_propagation_1.dutyGoalPropagationNotice)(result, 'unlink');
|
|
37
|
+
if (notice)
|
|
38
|
+
this.log(notice);
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
exports.default = DutiesGoalsUnlink;
|
|
@@ -28,9 +28,14 @@ class DutiesLineage extends base_command_1.BaseCommand {
|
|
|
28
28
|
const { args, flags } = await this.parse(DutiesLineage);
|
|
29
29
|
let lineage;
|
|
30
30
|
try {
|
|
31
|
-
lineage = await duties_1.dutyApi.workLineage(args.dutyId, flags.limit);
|
|
31
|
+
lineage = (0, duties_1.safeDutyLineage)(await duties_1.dutyApi.workLineage(args.dutyId, flags.limit), args.dutyId);
|
|
32
32
|
}
|
|
33
33
|
catch (err) {
|
|
34
|
+
if ((0, duties_1.isDutyLineageUnavailable)(err)) {
|
|
35
|
+
this.error('Work lineage is unavailable because historical source identity cannot be verified.', {
|
|
36
|
+
code: 'DUTY_WORK_LINEAGE_SOURCE_UNVERIFIED',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
34
39
|
this.handleApiError(err);
|
|
35
40
|
}
|
|
36
41
|
if (flags.json) {
|
|
@@ -25,6 +25,12 @@ class DutiesLinksList extends base_command_1.BaseCommand {
|
|
|
25
25
|
catch (error) {
|
|
26
26
|
this.handleApiError(error);
|
|
27
27
|
}
|
|
28
|
+
const sourcePolicy = result?.sourcePolicy;
|
|
29
|
+
if (sourcePolicy?.status !== 'supported') {
|
|
30
|
+
this.error('Linked work is unavailable while source access cannot be verified.', {
|
|
31
|
+
code: 'DUTY_WORK_LINK_SOURCE_UNVERIFIED',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
28
34
|
if (flags.json) {
|
|
29
35
|
this.printJsonResult((0, list_output_1.listResult)(result));
|
|
30
36
|
return;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const base_command_1 = require("../../base-command");
|
|
5
5
|
const duties_1 = require("../../lib/duties");
|
|
6
|
+
const duty_history_source_1 = require("../../lib/duty-history-source");
|
|
6
7
|
/**
|
|
7
8
|
* `skrr duties metrics <id>` — per-day rollups of the control loop.
|
|
8
9
|
*
|
|
@@ -39,6 +40,15 @@ class DutiesMetrics extends base_command_1.BaseCommand {
|
|
|
39
40
|
catch (err) {
|
|
40
41
|
this.handleApiError(err);
|
|
41
42
|
}
|
|
43
|
+
// Older servers can return rows selected by the logical Duty ID alone.
|
|
44
|
+
// Those rows cannot be attributed to the currently authorized physical
|
|
45
|
+
// Duty after a same-ID recreation. Require an explicit source policy even
|
|
46
|
+
// during a mixed-version rollout, before rendering either text or JSON.
|
|
47
|
+
if (!(0, duty_history_source_1.hasVerifiedDutyHistorySource)(response)) {
|
|
48
|
+
this.error('Duty metric history is unavailable because its source identity cannot be verified.', {
|
|
49
|
+
exit: 1,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
42
52
|
if (flags.json) {
|
|
43
53
|
this.log(JSON.stringify(response, null, 2));
|
|
44
54
|
return;
|
|
@@ -7,6 +7,14 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
7
7
|
const base_command_1 = require("../../base-command");
|
|
8
8
|
const duties_1 = require("../../lib/duties");
|
|
9
9
|
const TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
10
|
+
/** Legacy responses cannot prove that historical observations belong to this
|
|
11
|
+
* physical Duty. Never print rows or aggregate values without a source policy. */
|
|
12
|
+
function hasVerifiedSource(value) {
|
|
13
|
+
if (!value || typeof value !== 'object')
|
|
14
|
+
return false;
|
|
15
|
+
const policy = value.sourcePolicy;
|
|
16
|
+
return policy?.status === 'supported' || policy?.status === 'partial';
|
|
17
|
+
}
|
|
10
18
|
/** Explicit ISO FROM/TO intervals avoid local-time or rolling-window ambiguity. */
|
|
11
19
|
function parseObservationWindow(value) {
|
|
12
20
|
const parts = value.split('/');
|
|
@@ -130,6 +138,8 @@ class DutiesObservations extends base_command_1.BaseCommand {
|
|
|
130
138
|
catch (err) {
|
|
131
139
|
this.handleApiError(err);
|
|
132
140
|
}
|
|
141
|
+
if (!hasVerifiedSource(response))
|
|
142
|
+
this.error('Duty observation history is unavailable because its source cannot be verified.');
|
|
133
143
|
if (flags.json)
|
|
134
144
|
this.printJsonResult(response);
|
|
135
145
|
else
|
|
@@ -151,6 +161,8 @@ class DutiesObservations extends base_command_1.BaseCommand {
|
|
|
151
161
|
catch (err) {
|
|
152
162
|
this.handleApiError(err);
|
|
153
163
|
}
|
|
164
|
+
if (!hasVerifiedSource(response))
|
|
165
|
+
this.error('Duty observation history is unavailable because its source cannot be verified.');
|
|
154
166
|
if (flags.json) {
|
|
155
167
|
// One JSON document and nothing else: has_more / next_cursor are in it
|
|
156
168
|
// (OSK-21118).
|
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
import type { DutyLoopStatus } from '@skrr-ai/data-provider';
|
|
2
1
|
import { BaseCommand } from '../../base-command';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
lastCheckedAt?: string;
|
|
8
|
-
lastMaterialChangeAt?: string;
|
|
9
|
-
lastUserNudgedAt?: string;
|
|
10
|
-
maxUserNudgesPerDay?: number;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* What "no open questions" means, said only as far as it is true. "It has not told you anything is
|
|
14
|
-
* missing" read as reassurance under an Always-On-OFF header and loops that had never checked
|
|
15
|
-
* (OSK-15438): an Agent that cannot run cannot have asked.
|
|
16
|
-
*/
|
|
17
|
-
export declare function noQuestionsSentence(alwaysOn: boolean, roles: SystemDutyRow[]): string;
|
|
18
|
-
/**
|
|
19
|
-
* What the roster said about this Agent's loops, or why it could not be read. The review's own rows
|
|
20
|
-
* carry only the stored lifecycle status; whether a loop is armed, when it next wakes, why it last
|
|
21
|
-
* stopped and whether it can read its sources come from the roster (OSK-15438, OSK-15412).
|
|
22
|
-
*/
|
|
23
|
-
export type OperatingReviewLoops = {
|
|
24
|
-
rows: Map<string, DutyLoopStatus>;
|
|
25
|
-
truncated: boolean;
|
|
26
|
-
} | {
|
|
27
|
-
error: string;
|
|
28
|
-
};
|
|
29
|
-
/** The review as text. Pure, so the whole output can be pinned. */
|
|
30
|
-
export declare function formatOperatingReview(review: Record<string, unknown>, loops: OperatingReviewLoops): string[];
|
|
2
|
+
/** Old servers cannot prove historical Duties belong to this physical Agent. */
|
|
3
|
+
export declare function sanitizeOperatingReview(review: Record<string, unknown>): Record<string, unknown>;
|
|
4
|
+
/** Report unavailable rather than implying that there were no Duties or questions. */
|
|
5
|
+
export declare function formatOperatingReview(review: Record<string, unknown>): string[];
|
|
31
6
|
export default class DutiesOperatingReview extends BaseCommand {
|
|
32
7
|
static description: string;
|
|
33
8
|
static args: {
|
|
@@ -38,4 +13,3 @@ export default class DutiesOperatingReview extends BaseCommand {
|
|
|
38
13
|
};
|
|
39
14
|
run(): Promise<void>;
|
|
40
15
|
}
|
|
41
|
-
export {};
|