@skrr-ai/cli 0.1.163 → 0.1.164
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 +24 -12
- package/dist/commands/agents/mini-computer/show.js +7 -1
- package/dist/commands/agents/supervision.d.ts +25 -0
- package/dist/commands/agents/supervision.js +129 -0
- package/dist/commands/duties/action-proposal.js +19 -11
- package/dist/commands/duties/cadence-decisions.js +7 -0
- package/dist/commands/duties/trigger-status.js +2 -2
- package/dist/commands/duties/wake-capabilities.js +12 -6
- package/dist/lib/appInstallations.js +21 -0
- package/dist/lib/appsCheck.js +15 -4
- package/dist/lib/chat-supervision.d.ts +21 -0
- package/dist/lib/chat-supervision.js +37 -0
- package/dist/lib/duties.d.ts +4 -0
- package/dist/lib/miniComputer.d.ts +1 -0
- package/dist/lib/miniComputer.js +7 -2
- package/dist/lib/miniComputerCommand.js +4 -1
- package/dist/lib/roles.d.ts +1 -1
- package/dist/lib/widgetCheck.js +30 -4
- package/dist/lib/widgetStaticScan.d.ts +14 -5
- package/dist/lib/widgetStaticScan.js +167 -60
- package/dist/node_modules/@skrr-ai/data-provider/APP_HTML_PARSER_LICENSES.txt +36 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +14243 -9729
- package/oclif.manifest.json +198 -4
- package/package.json +3 -2
package/dist/base-command.js
CHANGED
|
@@ -82,6 +82,10 @@ const task_resource_references_1 = require("./lib/task-resource-references");
|
|
|
82
82
|
const tasks_1 = require("./lib/tasks");
|
|
83
83
|
const RESOLVE_TASK_RESOURCE_REFERENCES_RE = /^[\da-f-]{36}$/i;
|
|
84
84
|
const RESOLVE_TASK_RESOURCE_REFERENCES_RE_2 = /^[\da-f]{24}$/i;
|
|
85
|
+
/** Control, combining and invisible characters, escaped in the unsaved-recovery text so it prints inertly. */
|
|
86
|
+
/* eslint-disable no-misleading-character-class -- the point of the pattern is to match combining and invisible characters */
|
|
87
|
+
const RECOVERY_INVISIBLE_CHARS = /[\u007f-\u009f\u00ad\u034f\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180e\u200b-\u200f\u2028-\u202e\u2060-\u206f\u2800\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff9-\ufffb\u{1d173}-\u{1d17a}\u{e0000}-\u{e03ff}]/gu;
|
|
88
|
+
/* eslint-enable no-misleading-character-class */
|
|
85
89
|
const HANDLE_API_ERROR_RE = /\s*Run `[^`]+` to sign in again\.$/;
|
|
86
90
|
const HAS_REMEDY_LINE_RE = /^\s*→/m;
|
|
87
91
|
const UNSUPPORTED_FLAG_REMEDY_FOR_MESSAGE_RE = /Nonexistent flag[s]?:?\s*(-{1,2}[\w-]+)/i;
|
|
@@ -2175,18 +2179,23 @@ class BaseCommand extends core_1.Command {
|
|
|
2175
2179
|
if (!url.username && !url.password && !url.search && !url.hash)
|
|
2176
2180
|
server = url.toString();
|
|
2177
2181
|
}
|
|
2178
|
-
catch {
|
|
2182
|
+
catch {
|
|
2183
|
+
/* A malformed server is not a reliable recovery target. */
|
|
2184
|
+
}
|
|
2179
2185
|
const recovery = {
|
|
2180
2186
|
configuredServer: server,
|
|
2181
2187
|
currentWorkspaceId: (0, workspace_header_1.withWorkspaceHeader)({})['X-Workspace-Id'] ?? null,
|
|
2182
|
-
actualTarget: 'unknown',
|
|
2183
|
-
|
|
2188
|
+
actualTarget: 'unknown',
|
|
2189
|
+
actor: 'unverified',
|
|
2190
|
+
command: write.command,
|
|
2191
|
+
method: write.method,
|
|
2184
2192
|
path: write.url.startsWith('/') && !write.url.startsWith('//') && !/[?#]/.test(write.url)
|
|
2185
|
-
? write.url
|
|
2186
|
-
|
|
2193
|
+
? write.url
|
|
2194
|
+
: null,
|
|
2195
|
+
idempotencyKey: write.idempotencyKey,
|
|
2196
|
+
body: write.body,
|
|
2187
2197
|
};
|
|
2188
|
-
const recoveryText = (JSON.stringify(recovery, null, 2) ?? 'null')
|
|
2189
|
-
.replace(/[\u007f-\u009f\u00ad\u034f\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180e\u200b-\u200f\u2028-\u202e\u2060-\u206f\u2800\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff9-\ufffb\u{1d173}-\u{1d17a}\u{e0000}-\u{e03ff}]/gu, (char) => {
|
|
2198
|
+
const recoveryText = (JSON.stringify(recovery, null, 2) ?? 'null').replace(RECOVERY_INVISIBLE_CHARS, (char) => {
|
|
2190
2199
|
const code = char.codePointAt(0) ?? 0;
|
|
2191
2200
|
if (code <= 0xffff)
|
|
2192
2201
|
return `\\u${code.toString(16).padStart(4, '0')}`;
|
|
@@ -2200,13 +2209,15 @@ class BaseCommand extends core_1.Command {
|
|
|
2200
2209
|
await (0, drain_stdio_1.drainStdio)();
|
|
2201
2210
|
}
|
|
2202
2211
|
this.failWithCliError({
|
|
2203
|
-
message: (full
|
|
2204
|
-
`The local outbox
|
|
2212
|
+
message: (full
|
|
2213
|
+
? `The local outbox is full; this write was not saved in the queue. `
|
|
2214
|
+
: `The local outbox could not confirm that this write was saved. `) +
|
|
2205
2215
|
`The server may already have applied it. Reconcile the original request before trying again. ` +
|
|
2206
2216
|
`The actual target and actor are not verified. ` +
|
|
2207
2217
|
`Inspect existing entries with \`${this.config.bin} outbox list\`. ` +
|
|
2208
|
-
(this.wantsJsonOutput()
|
|
2209
|
-
'Keep the unsaved recovery details
|
|
2218
|
+
(this.wantsJsonOutput()
|
|
2219
|
+
? 'Keep the unsaved recovery details in this response; they may contain private data.'
|
|
2220
|
+
: 'Keep the unsaved recovery details printed above.'),
|
|
2210
2221
|
code: full ? 'OUTBOX_FULL' : 'OUTBOX_UNAVAILABLE',
|
|
2211
2222
|
status: e.status,
|
|
2212
2223
|
exit: 5,
|
|
@@ -2237,7 +2248,8 @@ class BaseCommand extends core_1.Command {
|
|
|
2237
2248
|
// OSK-12474 — the daemon was asked for a hand-off and refused; say why.
|
|
2238
2249
|
(brokerRefusal ? ` ${brokerRefusal.headline}` : '');
|
|
2239
2250
|
this.failWithCliError({
|
|
2240
|
-
message: `Authentication failed${statusSuffix}. ${why}
|
|
2251
|
+
message: `Authentication failed${statusSuffix}. ${why} Sign in again with \`${this.config.bin} login\`. ` +
|
|
2252
|
+
`Your ${write.summary} was saved locally as ${queuedId}; ` +
|
|
2241
2253
|
`the original outcome and context need reconciliation. Automatic replay is paused. Inspect \`${this.config.bin} outbox list --json\` before taking further action.`,
|
|
2242
2254
|
code: refusal?.code || 'AUTHENTICATION_FAILED',
|
|
2243
2255
|
status: e.status,
|
|
@@ -42,7 +42,13 @@ class AgentsMiniComputerShow extends miniComputerCommand_1.MiniComputerCommand {
|
|
|
42
42
|
if (flags.json) {
|
|
43
43
|
const read = (0, data_provider_1.parseMiniComputerLayoutRead)(layout);
|
|
44
44
|
const layoutSummary = read ? (0, data_provider_1.describeMiniComputerLayout)(read.layout) : null;
|
|
45
|
-
this.log(this.agentJson(args.agentId, {
|
|
45
|
+
this.log(this.agentJson(args.agentId, {
|
|
46
|
+
apps: apps.apps, layout, layoutSummary,
|
|
47
|
+
...(read && read.proposals.length > 0 ? {
|
|
48
|
+
review: { surface: 'agent_mini_computer_home', interactiveSessionRequired: true,
|
|
49
|
+
actions: ['apply', 'dismiss'], instructions: miniComputer_1.MINI_COMPUTER_REVIEW_GUIDANCE },
|
|
50
|
+
} : {}),
|
|
51
|
+
}));
|
|
46
52
|
return;
|
|
47
53
|
}
|
|
48
54
|
if (apps.apps.length === 0)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class AgentSupervision extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
action: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
watch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'request-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
revision: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
mode: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'plan-revision': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'source-revision': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
root: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
at: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
condition: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
reason: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'recheck-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
run(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../base-command");
|
|
5
|
+
const api_fetch_1 = require("../../lib/api-fetch");
|
|
6
|
+
const chat_supervision_1 = require("../../lib/chat-supervision");
|
|
7
|
+
class AgentSupervision extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'Manage this Agent’s chat follow-through, inspect current state, or schedule a condition check.';
|
|
9
|
+
static args = {
|
|
10
|
+
id: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
|
|
11
|
+
action: core_1.Args.string({
|
|
12
|
+
options: [
|
|
13
|
+
'status',
|
|
14
|
+
'preflight',
|
|
15
|
+
'enable',
|
|
16
|
+
'disable',
|
|
17
|
+
'chats',
|
|
18
|
+
'explain',
|
|
19
|
+
'include',
|
|
20
|
+
'exclude',
|
|
21
|
+
'check-now',
|
|
22
|
+
'inspect',
|
|
23
|
+
'recheck',
|
|
24
|
+
'cancel',
|
|
25
|
+
],
|
|
26
|
+
default: 'status',
|
|
27
|
+
ignoreStdin: true,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
static examples = [
|
|
31
|
+
'<%= config.bin %> agents supervision <agent-id> preflight --json',
|
|
32
|
+
'<%= config.bin %> agents supervision <agent-id> enable --revision 0 --request-id <stable-key> --json',
|
|
33
|
+
'<%= config.bin %> agents supervision <agent-id> disable --revision 1 --request-id <new-stable-key> --json',
|
|
34
|
+
'<%= config.bin %> agents supervision <agent-id> exclude --watch <watch-id> --plan-revision 2 --json',
|
|
35
|
+
'<%= config.bin %> agents supervision <agent-id> explain --watch <watch-id> --json',
|
|
36
|
+
'<%= config.bin %> agents supervision <agent-id> check-now --json',
|
|
37
|
+
'<%= config.bin %> agents supervision <agent-id> chats --json',
|
|
38
|
+
'<%= config.bin %> agents supervision <agent-id> inspect --watch <watch-id> --json',
|
|
39
|
+
'<%= config.bin %> agents supervision <agent-id> recheck --watch <watch-id> --request-id <stable-key> --plan-revision 2 --source-revision <revision> --root <work-root> --at <ISO-instant> --condition progress_observed --reason "Confirm the work advanced" --json',
|
|
40
|
+
'<%= config.bin %> agents supervision <agent-id> cancel --watch <watch-id> --plan-revision 3 --recheck-id <check-id> --json',
|
|
41
|
+
];
|
|
42
|
+
static flags = {
|
|
43
|
+
json: core_1.Flags.boolean({ description: 'Output the exact server receipt as JSON' }),
|
|
44
|
+
watch: core_1.Flags.string({ description: 'Exact Watch ID from chats' }),
|
|
45
|
+
cursor: core_1.Flags.string({ description: 'Opaque nextCursor from the previous chats page' }),
|
|
46
|
+
'request-id': core_1.Flags.string({
|
|
47
|
+
description: 'Stable control/proposal key; reuse only to replay the same request',
|
|
48
|
+
}),
|
|
49
|
+
revision: core_1.Flags.integer({
|
|
50
|
+
min: 0,
|
|
51
|
+
description: 'Current configuration.revision from status/preflight for enable/disable',
|
|
52
|
+
}),
|
|
53
|
+
mode: core_1.Flags.string({
|
|
54
|
+
options: ['recover', 'shadow'],
|
|
55
|
+
description: 'Policy for enable/disable: recover (default) or observation-only shadow',
|
|
56
|
+
}),
|
|
57
|
+
'plan-revision': core_1.Flags.integer({ min: 1, description: 'Current planRevision from inspect' }),
|
|
58
|
+
'source-revision': core_1.Flags.string({ description: 'Current sourceRevision from inspect' }),
|
|
59
|
+
root: core_1.Flags.string({ description: 'Current workAnchorId from inspect' }),
|
|
60
|
+
at: core_1.Flags.string({ description: 'Future ISO instant with explicit timezone offset' }),
|
|
61
|
+
condition: core_1.Flags.string({
|
|
62
|
+
options: [...chat_supervision_1.CHAT_RECHECK_CONDITIONS],
|
|
63
|
+
description: 'Typed evidence to check',
|
|
64
|
+
}),
|
|
65
|
+
reason: core_1.Flags.string({ description: 'Why this chat needs this condition check' }),
|
|
66
|
+
'recheck-id': core_1.Flags.string({ description: 'Exact current recheck.id to cancel' }),
|
|
67
|
+
};
|
|
68
|
+
async run() {
|
|
69
|
+
this.requireAuth();
|
|
70
|
+
const { args, flags } = await this.parse(AgentSupervision);
|
|
71
|
+
const required = (name) => {
|
|
72
|
+
const value = flags[name];
|
|
73
|
+
if (value == null || value === '')
|
|
74
|
+
this.error(`--${name} is required for ${args.action}. Read status/preflight or inspect for the relevant revision first.`);
|
|
75
|
+
return value;
|
|
76
|
+
};
|
|
77
|
+
try {
|
|
78
|
+
let receipt;
|
|
79
|
+
if (args.action === 'status')
|
|
80
|
+
receipt = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatSupervisionPath)(args.id));
|
|
81
|
+
else if (args.action === 'preflight')
|
|
82
|
+
receipt = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatSupervisionPath)(args.id, '/preflight'));
|
|
83
|
+
else if (['enable', 'disable'].includes(args.action))
|
|
84
|
+
receipt = await (0, chat_supervision_1.setChatSupervision)(args.id, {
|
|
85
|
+
enabled: args.action === 'enable',
|
|
86
|
+
expectedRevision: required('revision'),
|
|
87
|
+
controlId: required('request-id'),
|
|
88
|
+
mode: (flags.mode || 'recover'),
|
|
89
|
+
});
|
|
90
|
+
else if (args.action === 'check-now')
|
|
91
|
+
receipt = await (0, chat_supervision_1.requestChatInspection)(args.id);
|
|
92
|
+
else if (args.action === 'chats')
|
|
93
|
+
receipt = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatSupervisionPath)(args.id, `/chats${flags.cursor ? `?cursor=${encodeURIComponent(flags.cursor)}` : ''}`));
|
|
94
|
+
else {
|
|
95
|
+
const watch = required('watch');
|
|
96
|
+
if (args.action === 'explain')
|
|
97
|
+
receipt = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatSupervisionPath)(args.id, `/chats/${encodeURIComponent(watch)}`));
|
|
98
|
+
else if (['include', 'exclude'].includes(args.action))
|
|
99
|
+
receipt = await (0, chat_supervision_1.setChatSupervisionEnrollment)(args.id, watch, {
|
|
100
|
+
enrollment: args.action === 'include' ? 'active' : 'excluded',
|
|
101
|
+
expectedPlanRevision: required('plan-revision'),
|
|
102
|
+
});
|
|
103
|
+
else if (args.action === 'inspect')
|
|
104
|
+
receipt = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatRecheckPath)(args.id, watch));
|
|
105
|
+
else if (args.action === 'cancel')
|
|
106
|
+
receipt = await (0, chat_supervision_1.cancelChatRecheck)(args.id, watch, {
|
|
107
|
+
expectedPlanRevision: required('plan-revision'),
|
|
108
|
+
expectedRecheckId: required('recheck-id'),
|
|
109
|
+
});
|
|
110
|
+
else
|
|
111
|
+
receipt = await (0, chat_supervision_1.requestChatRecheck)(args.id, watch, {
|
|
112
|
+
controlId: required('request-id'),
|
|
113
|
+
expectedPlanRevision: required('plan-revision'),
|
|
114
|
+
expectedSourceRevision: required('source-revision'),
|
|
115
|
+
workAnchorId: required('root'),
|
|
116
|
+
dueAt: required('at'),
|
|
117
|
+
expectedCondition: required('condition'),
|
|
118
|
+
reason: required('reason'),
|
|
119
|
+
cancelWhen: 'superseded_or_stopped_or_resolved',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
this.printJsonResult(receipt);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
this.handleApiError(error);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.default = AgentSupervision;
|
|
@@ -3,6 +3,8 @@ 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");
|
|
7
|
+
const ACTION_PROPOSAL_UNAVAILABLE = 'Action proposals are unavailable because their source cannot be verified.';
|
|
6
8
|
/** Read the exact Action Bundle execution receipt before any retry. */
|
|
7
9
|
class DutiesActionProposal extends base_command_1.BaseCommand {
|
|
8
10
|
static description = 'Show one frozen Action Bundle and its execution receipt';
|
|
@@ -18,22 +20,28 @@ class DutiesActionProposal extends base_command_1.BaseCommand {
|
|
|
18
20
|
async run() {
|
|
19
21
|
this.requireAuth();
|
|
20
22
|
const { args, flags } = await this.parse(DutiesActionProposal);
|
|
23
|
+
let result;
|
|
21
24
|
try {
|
|
22
|
-
|
|
23
|
-
if (flags.json)
|
|
24
|
-
this.printJsonResult(result);
|
|
25
|
-
else {
|
|
26
|
-
const proposal = result.proposal;
|
|
27
|
-
const execution = result.execution;
|
|
28
|
-
this.log(`Action Bundle: ${String(proposal?.status || 'unknown')}`);
|
|
29
|
-
this.log(`Operation: ${String(execution?.operationId || 'unavailable')}`);
|
|
30
|
-
const receipt = execution?.receipt;
|
|
31
|
-
this.log(`Receipt: ${String(receipt?.state || 'unknown')}`);
|
|
32
|
-
}
|
|
25
|
+
result = await duties_1.dutyApi.actionProposal(args.dutyId, args.proposalId);
|
|
33
26
|
}
|
|
34
27
|
catch (error) {
|
|
35
28
|
this.handleApiError(error);
|
|
36
29
|
}
|
|
30
|
+
// A server that answered 200 from the logical Duty id alone said nothing about its sources.
|
|
31
|
+
// Print a response only when the server declares its coverage, in JSON too.
|
|
32
|
+
if (!(0, duty_history_source_1.hasVerifiedDutyHistorySource)(result)) {
|
|
33
|
+
this.error(ACTION_PROPOSAL_UNAVAILABLE, { code: 'DUTY_ACTION_PROPOSAL_SOURCE_UNVERIFIED' });
|
|
34
|
+
}
|
|
35
|
+
if (flags.json)
|
|
36
|
+
this.printJsonResult(result);
|
|
37
|
+
else {
|
|
38
|
+
const proposal = result.proposal;
|
|
39
|
+
const execution = result.execution;
|
|
40
|
+
this.log(`Action Bundle: ${String(proposal?.status || 'unknown')}`);
|
|
41
|
+
this.log(`Operation: ${String(execution?.operationId || 'unavailable')}`);
|
|
42
|
+
const receipt = execution?.receipt;
|
|
43
|
+
this.log(`Receipt: ${String(receipt?.state || 'unknown')}`);
|
|
44
|
+
}
|
|
37
45
|
}
|
|
38
46
|
}
|
|
39
47
|
exports.default = DutiesActionProposal;
|
|
@@ -3,7 +3,9 @@ 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
|
const duty_ledgers_1 = require("../../lib/duty-ledgers");
|
|
8
|
+
const CADENCE_UNAVAILABLE = 'Cadence history is unavailable because its Duty source cannot be verified.';
|
|
7
9
|
/**
|
|
8
10
|
* `skrr duties cadence-decisions <id>` — the adaptive controller's
|
|
9
11
|
* append-only decision ledger, including shadow recommendations.
|
|
@@ -31,6 +33,11 @@ class DutiesCadenceDecisions extends base_command_1.BaseCommand {
|
|
|
31
33
|
catch (error) {
|
|
32
34
|
this.handleApiError(error);
|
|
33
35
|
}
|
|
36
|
+
// A server that answered 200 from the logical Duty id alone said nothing about its sources.
|
|
37
|
+
// Print a response only when the server declares its coverage, in JSON too.
|
|
38
|
+
if (!(0, duty_history_source_1.hasVerifiedDutyHistorySource)(response)) {
|
|
39
|
+
this.error(CADENCE_UNAVAILABLE, { code: 'DUTY_CADENCE_SOURCE_UNVERIFIED' });
|
|
40
|
+
}
|
|
34
41
|
if (flags.json) {
|
|
35
42
|
this.log(JSON.stringify(response, null, 2));
|
|
36
43
|
return;
|
|
@@ -53,7 +53,7 @@ exports.default = DutiesTriggerStatus;
|
|
|
53
53
|
/** Hide unverified legacy fields in JSON as well as human output. */
|
|
54
54
|
function safeTriggerStatus(status) {
|
|
55
55
|
const policy = status.sourcePolicy;
|
|
56
|
-
if (['complete', 'partial'].includes(String(policy?.status)))
|
|
56
|
+
if (['complete', 'partial', 'supported'].includes(String(policy?.status)))
|
|
57
57
|
return status;
|
|
58
58
|
return {
|
|
59
59
|
dutyId: status.dutyId,
|
|
@@ -75,7 +75,7 @@ function formatTriggerStatus(status) {
|
|
|
75
75
|
const lines = [];
|
|
76
76
|
const dutyId = String(status.dutyId ?? '-');
|
|
77
77
|
const sourcePolicy = status.sourcePolicy;
|
|
78
|
-
if (!['complete', 'partial'].includes(String(sourcePolicy?.status))) {
|
|
78
|
+
if (!['complete', 'partial', 'supported'].includes(String(sourcePolicy?.status))) {
|
|
79
79
|
return [
|
|
80
80
|
`Trigger status for ${dutyId}: unavailable.`,
|
|
81
81
|
'The historical sources cannot be verified for this Duty. This does not mean no triggers or fires exist.',
|
|
@@ -21,14 +21,20 @@ function wakePolicyHeadline(_result) {
|
|
|
21
21
|
/** Do not pass legacy standing rows through --json without source proof. */
|
|
22
22
|
function safeWakeCapabilities(result) {
|
|
23
23
|
if (result.sourcePolicy?.status === 'unsupported') {
|
|
24
|
-
return {
|
|
25
|
-
|
|
24
|
+
return {
|
|
25
|
+
eligibleCapabilities: [],
|
|
26
|
+
visibleCapabilities: [],
|
|
27
|
+
sourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' },
|
|
28
|
+
};
|
|
26
29
|
}
|
|
27
|
-
if (['complete', 'partial'].includes(String(result.standingEventWakesSourcePolicy?.status)) &&
|
|
30
|
+
if (['complete', 'partial', 'supported'].includes(String(result.standingEventWakesSourcePolicy?.status)) &&
|
|
28
31
|
result.standingEventWakes?.sourcePolicy?.status !== 'unsupported')
|
|
29
32
|
return result;
|
|
30
|
-
return {
|
|
31
|
-
|
|
33
|
+
return {
|
|
34
|
+
...result,
|
|
35
|
+
standingEventWakes: null,
|
|
36
|
+
standingEventWakesSourcePolicy: { status: 'unsupported', reason: 'unverified_duty_lineage' },
|
|
37
|
+
};
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* The lines above the table. The table is what the Agent may PICK; what is bound is the server's
|
|
@@ -45,7 +51,7 @@ function wakePolicyLines(result) {
|
|
|
45
51
|
'This does not mean no wake capabilities or triggers exist.',
|
|
46
52
|
];
|
|
47
53
|
}
|
|
48
|
-
if (!['complete', 'partial'].includes(String(result?.standingEventWakesSourcePolicy?.status)) ||
|
|
54
|
+
if (!['complete', 'partial', 'supported'].includes(String(result?.standingEventWakesSourcePolicy?.status)) ||
|
|
49
55
|
wakes?.sourcePolicy?.status === 'unsupported') {
|
|
50
56
|
return [
|
|
51
57
|
wakePolicyHeadline(),
|
|
@@ -783,6 +783,12 @@ const CHECK_OUTCOME_WORDS = {
|
|
|
783
783
|
findings: 'found things to look at',
|
|
784
784
|
nothing_found: 'found nothing it looks for',
|
|
785
785
|
};
|
|
786
|
+
/**
|
|
787
|
+
* The check's rule for a call the app's window has and the platform has nothing to run (`unansweredIssue` in
|
|
788
|
+
* data-provider's `appCheck.ts`; its title and `why` are in `appCheckRules.ts`). The rule id is the contract's, spelled
|
|
789
|
+
* here because the summary names a rule by it; `apps-installation-commands.spec.ts` fails if the contract stops having it.
|
|
790
|
+
*/
|
|
791
|
+
const UNANSWERED_CALL_RULE = 'capability/unanswered';
|
|
786
792
|
const REVIEW_LIMIT_REMINDER = 'This automatic check does not include a human review and cannot tell whether anyone else has reviewed the app.';
|
|
787
793
|
const KNOWN_SAFETY_HEADLINE = 'This is an automatic check of the files in the package. It can find obvious problems; it cannot show that an app is safe.';
|
|
788
794
|
/**
|
|
@@ -816,10 +822,25 @@ function describeDisclosureCheck(check) {
|
|
|
816
822
|
if (counts.block + counts.warn + counts.info + counts.unanalyzable > 0) {
|
|
817
823
|
lines.push(` ${counts.block} would keep it out of the store, ${counts.warn} to read, ${counts.info} low-key, ${counts.unanalyzable} could not be read`);
|
|
818
824
|
}
|
|
825
|
+
let unansweredWhySaid = false;
|
|
819
826
|
for (const found of summary.findings.slice(0, 5)) {
|
|
820
827
|
const title = summary.rules[found.rule]?.title ?? found.rule;
|
|
821
828
|
const place = found.path ? ` (${found.line ? `${found.path}:${found.line}` : found.path})` : '';
|
|
822
829
|
lines.push(` - ${(0, data_provider_1.plainAppLabel)(title, 160)}${place}`);
|
|
830
|
+
if (found.rule === UNANSWERED_CALL_RULE) {
|
|
831
|
+
// The title alone ("A call the platform cannot answer yet") does not say WHICH call, or that it fails every time.
|
|
832
|
+
// The finding's own message does, and the rule's `why` says what that means for the app. Both are the server's
|
|
833
|
+
// words, so the web screen says the same; both are drawn as plain one-line text.
|
|
834
|
+
const message = (0, data_provider_1.plainAppLabel)(found.message, 400);
|
|
835
|
+
if (message) {
|
|
836
|
+
lines.push(` ${message}`);
|
|
837
|
+
}
|
|
838
|
+
const why = (0, data_provider_1.plainAppLabel)(summary.rules[found.rule]?.why, 600);
|
|
839
|
+
if (why && !unansweredWhySaid) {
|
|
840
|
+
lines.push(` ${why}`);
|
|
841
|
+
unansweredWhySaid = true;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
823
844
|
}
|
|
824
845
|
const more = summary.findings.length - 5 + summary.omitted;
|
|
825
846
|
if (more > 0) {
|
package/dist/lib/appsCheck.js
CHANGED
|
@@ -83,6 +83,8 @@ function scanSandbox(sections, options) {
|
|
|
83
83
|
...(found.fix ? { fix: found.fix } : {}),
|
|
84
84
|
})),
|
|
85
85
|
inlineScripts: scan.inlineScripts,
|
|
86
|
+
inlineModules: scan.inlineModules,
|
|
87
|
+
inlineCoverageComplete: scan.inlineCoverageComplete,
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
90
|
/** Check a package that is already in memory. */
|
|
@@ -91,6 +93,7 @@ function checkLocalFiles(files, options = {}) {
|
|
|
91
93
|
...(options.expectedId === undefined ? {} : { expectedId: options.expectedId }),
|
|
92
94
|
...(options.assetBytes === undefined ? {} : { assetBytes: options.assetBytes }),
|
|
93
95
|
checkScriptSyntax: compileScript,
|
|
96
|
+
checkModuleSyntax: widgetStaticScan_1.checkModuleSyntax,
|
|
94
97
|
scanSandbox,
|
|
95
98
|
});
|
|
96
99
|
}
|
|
@@ -124,8 +127,16 @@ function placeOf(issue) {
|
|
|
124
127
|
// in the full JSON report; errors are always shown individually.
|
|
125
128
|
function warningDisplayKey(issue) {
|
|
126
129
|
return JSON.stringify([
|
|
127
|
-
issue.source,
|
|
128
|
-
issue.
|
|
130
|
+
issue.source,
|
|
131
|
+
issue.code,
|
|
132
|
+
issue.path,
|
|
133
|
+
issue.at,
|
|
134
|
+
issue.message,
|
|
135
|
+
issue.fix,
|
|
136
|
+
issue.heuristic,
|
|
137
|
+
issue.tier,
|
|
138
|
+
issue.unanalyzable,
|
|
139
|
+
issue.evidence,
|
|
129
140
|
]);
|
|
130
141
|
}
|
|
131
142
|
/** The report as lines for a terminal: the verdict, then each finding with where it is and what to do. */
|
|
@@ -168,8 +179,8 @@ function formatAppCheckReport(report) {
|
|
|
168
179
|
}
|
|
169
180
|
for (const issue of report.issues) {
|
|
170
181
|
const key = issue.severity === 'warn' ? warningDisplayKey(issue) : undefined;
|
|
171
|
-
const count = key === undefined ? 0 : warningCounts.get(key) ?? 0;
|
|
172
|
-
const shown = key === undefined ? 0 : warningsShown.get(key) ?? 0;
|
|
182
|
+
const count = key === undefined ? 0 : (warningCounts.get(key) ?? 0);
|
|
183
|
+
const shown = key === undefined ? 0 : (warningsShown.get(key) ?? 0);
|
|
173
184
|
if (count > 5 && shown >= 3)
|
|
174
185
|
continue;
|
|
175
186
|
if (key !== undefined)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CHAT_RECHECK_CONDITIONS } from '@skrr-ai/data-provider';
|
|
2
|
+
import type { ChatRecheckCondition, ChatRecheckProposal, ChatSupervisionControl } from '@skrr-ai/data-provider';
|
|
3
|
+
export declare const chatSupervisionPath: (agentId: string, suffix?: string) => string;
|
|
4
|
+
export declare const chatRecheckPath: (agentId: string, watchId: string) => string;
|
|
5
|
+
/** All authority and current revisions are checked server-side. No CLI cache,
|
|
6
|
+
* ambient workspace, runtime header or response text is an execution grant. */
|
|
7
|
+
export declare function requestChatRecheck(agentId: string, watchId: string, input: ChatRecheckProposal): Promise<unknown>;
|
|
8
|
+
export declare function cancelChatRecheck(agentId: string, watchId: string, input: {
|
|
9
|
+
expectedPlanRevision: number;
|
|
10
|
+
expectedRecheckId: string;
|
|
11
|
+
}): Promise<unknown>;
|
|
12
|
+
export { CHAT_RECHECK_CONDITIONS };
|
|
13
|
+
export type { ChatRecheckCondition };
|
|
14
|
+
/** These are owner controls. Authenticated runtime actors remain subject to
|
|
15
|
+
* the API's owner provenance gate; this transport supplies no impersonation. */
|
|
16
|
+
export declare function setChatSupervision(agentId: string, input: ChatSupervisionControl): Promise<unknown>;
|
|
17
|
+
export declare function setChatSupervisionEnrollment(agentId: string, watchId: string, input: {
|
|
18
|
+
enrollment: 'active' | 'excluded';
|
|
19
|
+
expectedPlanRevision: number;
|
|
20
|
+
}): Promise<unknown>;
|
|
21
|
+
export declare function requestChatInspection(agentId: string): Promise<unknown>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHAT_RECHECK_CONDITIONS = exports.chatRecheckPath = exports.chatSupervisionPath = void 0;
|
|
4
|
+
exports.requestChatRecheck = requestChatRecheck;
|
|
5
|
+
exports.cancelChatRecheck = cancelChatRecheck;
|
|
6
|
+
exports.setChatSupervision = setChatSupervision;
|
|
7
|
+
exports.setChatSupervisionEnrollment = setChatSupervisionEnrollment;
|
|
8
|
+
exports.requestChatInspection = requestChatInspection;
|
|
9
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
10
|
+
Object.defineProperty(exports, "CHAT_RECHECK_CONDITIONS", { enumerable: true, get: function () { return data_provider_1.CHAT_RECHECK_CONDITIONS; } });
|
|
11
|
+
const api_fetch_1 = require("./api-fetch");
|
|
12
|
+
const chatSupervisionPath = (agentId, suffix = '') => `/api/agents/${encodeURIComponent(agentId)}/dm/supervision${suffix}`;
|
|
13
|
+
exports.chatSupervisionPath = chatSupervisionPath;
|
|
14
|
+
const chatRecheckPath = (agentId, watchId) => (0, exports.chatSupervisionPath)(agentId, `/chats/${encodeURIComponent(watchId)}/recheck`);
|
|
15
|
+
exports.chatRecheckPath = chatRecheckPath;
|
|
16
|
+
/** All authority and current revisions are checked server-side. No CLI cache,
|
|
17
|
+
* ambient workspace, runtime header or response text is an execution grant. */
|
|
18
|
+
function requestChatRecheck(agentId, watchId, input) {
|
|
19
|
+
return (0, api_fetch_1.apiFetch)((0, exports.chatRecheckPath)(agentId, watchId), { method: 'POST', body: input });
|
|
20
|
+
}
|
|
21
|
+
function cancelChatRecheck(agentId, watchId, input) {
|
|
22
|
+
return (0, api_fetch_1.apiFetch)((0, exports.chatRecheckPath)(agentId, watchId), { method: 'DELETE', body: input });
|
|
23
|
+
}
|
|
24
|
+
/** These are owner controls. Authenticated runtime actors remain subject to
|
|
25
|
+
* the API's owner provenance gate; this transport supplies no impersonation. */
|
|
26
|
+
function setChatSupervision(agentId, input) {
|
|
27
|
+
return (0, api_fetch_1.apiFetch)((0, exports.chatSupervisionPath)(agentId), { method: 'PUT', body: input });
|
|
28
|
+
}
|
|
29
|
+
function setChatSupervisionEnrollment(agentId, watchId, input) {
|
|
30
|
+
return (0, api_fetch_1.apiFetch)((0, exports.chatSupervisionPath)(agentId, `/chats/${encodeURIComponent(watchId)}`), {
|
|
31
|
+
method: 'PUT',
|
|
32
|
+
body: input,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function requestChatInspection(agentId) {
|
|
36
|
+
return (0, api_fetch_1.apiFetch)((0, exports.chatSupervisionPath)(agentId, '/inspect'), { method: 'POST', body: {} });
|
|
37
|
+
}
|
package/dist/lib/duties.d.ts
CHANGED
|
@@ -520,6 +520,10 @@ export declare const dutyApi: {
|
|
|
520
520
|
}) => Promise<DutyListPage>;
|
|
521
521
|
cadenceDecisions: (id: string, limit?: number) => Promise<{
|
|
522
522
|
data: unknown[];
|
|
523
|
+
sourcePolicy?: {
|
|
524
|
+
status?: string;
|
|
525
|
+
reason?: string;
|
|
526
|
+
};
|
|
523
527
|
}>;
|
|
524
528
|
/**
|
|
525
529
|
* What the NEXT check would decide, computed without taking it.
|
|
@@ -51,6 +51,7 @@ export declare const TASKS_VIEW_DATE_FIELDS: readonly import("@skrr-ai/data-prov
|
|
|
51
51
|
export declare const TASKS_VIEW_DATE_PRESETS: readonly import("@skrr-ai/data-provider").DateFilterPreset[];
|
|
52
52
|
/** One app's slot, in lines. */
|
|
53
53
|
export declare function formatMiniAppConfig(raw: unknown): string[];
|
|
54
|
+
export declare const MINI_COMPUTER_REVIEW_GUIDANCE = "Review: sign in as the same person in a first-party app, open the Agent page with edit access, and go to Mini Computer Home. Suggestions appear one at a time; CLI credentials cannot decide them. Choose Apply or Dismiss on the suggestion.";
|
|
54
55
|
/** The layout a person sees, in lines: the dock, the home grid, the folders, what is hidden, and what waits. */
|
|
55
56
|
export declare function formatMiniComputerLayout(raw: unknown): string[];
|
|
56
57
|
/** What a change answered, in lines for the Agent that asked. */
|
package/dist/lib/miniComputer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TASKS_VIEW_DATE_PRESETS = exports.TASKS_VIEW_DATE_FIELDS = exports.MINI_COMPUTER_REFUSAL_CODES = void 0;
|
|
3
|
+
exports.MINI_COMPUTER_REVIEW_GUIDANCE = exports.TASKS_VIEW_DATE_PRESETS = exports.TASKS_VIEW_DATE_FIELDS = exports.MINI_COMPUTER_REFUSAL_CODES = void 0;
|
|
4
4
|
exports.readMiniComputerRefusal = readMiniComputerRefusal;
|
|
5
5
|
exports.describeMiniComputerRefusal = describeMiniComputerRefusal;
|
|
6
6
|
exports.tasksConfigFromFlags = tasksConfigFromFlags;
|
|
@@ -184,6 +184,9 @@ function formatMiniAppConfig(raw) {
|
|
|
184
184
|
lines.push(` ${JSON.stringify(entry.config)}`);
|
|
185
185
|
return lines;
|
|
186
186
|
}
|
|
187
|
+
/** Review requires the person's first-party session, never a CLI approval. */
|
|
188
|
+
const MINI_COMPUTER_REVIEW_LOCATION = 'Review: sign in as the same person in a first-party app, open the Agent page with edit access, and go to Mini Computer Home. Suggestions appear one at a time; CLI credentials cannot decide them.';
|
|
189
|
+
exports.MINI_COMPUTER_REVIEW_GUIDANCE = `${MINI_COMPUTER_REVIEW_LOCATION} Choose Apply or Dismiss on the suggestion.`;
|
|
187
190
|
/** The layout a person sees, in lines: the dock, the home grid, the folders, what is hidden, and what waits. */
|
|
188
191
|
function formatMiniComputerLayout(raw) {
|
|
189
192
|
const read = (0, data_provider_1.parseMiniComputerLayoutRead)(raw);
|
|
@@ -208,6 +211,8 @@ function formatMiniComputerLayout(raw) {
|
|
|
208
211
|
for (const proposal of read.proposals) {
|
|
209
212
|
lines.push(`Waiting for the person: ${proposal.summary.join('; ')}`);
|
|
210
213
|
}
|
|
214
|
+
if (read.proposals.length > 0)
|
|
215
|
+
lines.push(exports.MINI_COMPUTER_REVIEW_GUIDANCE);
|
|
211
216
|
const latest = read.changes[0];
|
|
212
217
|
if (latest)
|
|
213
218
|
lines.push(`Latest change: ${latest.summary.join('; ')}${latest.undoable ? ' (can be undone)' : ''}`);
|
|
@@ -219,7 +224,7 @@ function formatLayoutChangeResult(result) {
|
|
|
219
224
|
? result.summary.map((line) => ` ${line}`)
|
|
220
225
|
: [' (no change: it already looks like that)'];
|
|
221
226
|
const heading = { applied: 'Applied', proposed: 'Proposed', noop: 'Unchanged' }[result.outcome];
|
|
222
|
-
return [`${heading}:`, ...lines, result.note];
|
|
227
|
+
return [`${heading}:`, ...lines, result.note, ...(result.outcome === 'proposed' ? [MINI_COMPUTER_REVIEW_LOCATION] : [])];
|
|
223
228
|
}
|
|
224
229
|
/** Operations from `--ops` or `--file` JSON text. Returns the raw array for the server to validate. */
|
|
225
230
|
function parseOpsText(text) {
|
|
@@ -33,7 +33,10 @@ class MiniComputerCommand extends base_command_1.BaseCommand {
|
|
|
33
33
|
try {
|
|
34
34
|
const result = await data_provider_1.dataService.changeMiniComputerLayout(agentId, { ops });
|
|
35
35
|
if (json) {
|
|
36
|
-
this.log(this.agentJson(agentId, result
|
|
36
|
+
this.log(this.agentJson(agentId, result.outcome === 'proposed'
|
|
37
|
+
? { ...result, review: { surface: 'agent_mini_computer_home', interactiveSessionRequired: true,
|
|
38
|
+
actions: ['apply', 'dismiss'], instructions: miniComputer_1.MINI_COMPUTER_REVIEW_GUIDANCE } }
|
|
39
|
+
: result));
|
|
37
40
|
return;
|
|
38
41
|
}
|
|
39
42
|
for (const line of (0, miniComputer_1.formatLayoutChangeResult)(result))
|
package/dist/lib/roles.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare const roleApi: {
|
|
|
53
53
|
config?: Record<string, unknown> | undefined;
|
|
54
54
|
}[];
|
|
55
55
|
sources: {
|
|
56
|
-
source: "space" | "docs" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "metrics" | "monitor" | "github" | "conversations" | "agent_initiatives" | "messages" | "documents" | "slack" | "calendar" | "product_metrics" | "business_metrics" | "state_monitor" | "agent_run";
|
|
56
|
+
source: "space" | "docs" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "metrics" | "monitor" | "github" | "conversations" | "agent_initiatives" | "messages" | "documents" | "slack" | "calendar" | "product_metrics" | "business_metrics" | "state_monitor" | "agent_run" | "chat_execution";
|
|
57
57
|
enabled: boolean;
|
|
58
58
|
config?: Record<string, unknown> | undefined;
|
|
59
59
|
}[];
|