@skrr-ai/cli 0.1.207 → 0.1.209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/agent/message/no-reply.js +1 -1
- package/dist/commands/agent/message/react.d.ts +23 -0
- package/dist/commands/agent/message/react.js +125 -0
- package/dist/commands/agent/message/resolve.d.ts +31 -0
- package/dist/commands/agent/message/resolve.js +111 -0
- package/dist/commands/agent/message/retract.js +1 -1
- package/dist/commands/agent/message/send.d.ts +25 -6
- package/dist/commands/agent/message/send.js +135 -30
- package/dist/commands/agent/request/list.d.ts +15 -0
- package/dist/commands/agent/request/list.js +82 -0
- package/dist/commands/agent/request/send.d.ts +18 -0
- package/dist/commands/agent/request/send.js +56 -0
- package/dist/commands/agents/access/approve.d.ts +17 -0
- package/dist/commands/agents/access/approve.js +94 -0
- package/dist/commands/agents/access/deny.d.ts +10 -0
- package/dist/commands/agents/access/deny.js +36 -0
- package/dist/commands/agents/access/list.d.ts +10 -0
- package/dist/commands/agents/access/list.js +55 -0
- package/dist/commands/agents/access/reach.d.ts +13 -0
- package/dist/commands/agents/access/reach.js +53 -0
- package/dist/commands/agents/access/revoke.d.ts +13 -0
- package/dist/commands/agents/access/revoke.js +50 -0
- package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
- package/dist/commands/agents/always-on/recovery-review.js +16 -0
- package/dist/commands/agents/chat.d.ts +8 -0
- package/dist/commands/agents/chat.js +369 -90
- package/dist/commands/agents/import.d.ts +15 -1
- package/dist/commands/agents/import.js +212 -24
- package/dist/commands/agents/intuitions/accept.d.ts +0 -1
- package/dist/commands/agents/intuitions/accept.js +22 -7
- package/dist/commands/agents/intuitions/generate.d.ts +0 -1
- package/dist/commands/agents/intuitions/generate.js +4 -16
- package/dist/commands/agents/intuitions/list.js +9 -3
- package/dist/commands/agents/intuitions/resume.d.ts +11 -0
- package/dist/commands/agents/intuitions/resume.js +37 -0
- package/dist/commands/agents/manager/status.js +7 -6
- package/dist/commands/agents/not-for-task.d.ts +24 -0
- package/dist/commands/agents/not-for-task.js +60 -0
- package/dist/commands/agents/schedule-overview.d.ts +20 -0
- package/dist/commands/agents/schedule-overview.js +35 -2
- package/dist/commands/agents/shared-memory.d.ts +24 -0
- package/dist/commands/agents/shared-memory.js +67 -0
- package/dist/commands/agents/stop.d.ts +23 -0
- package/dist/commands/agents/stop.js +61 -0
- package/dist/commands/agents/update.d.ts +7 -0
- package/dist/commands/agents/update.js +45 -2
- package/dist/commands/agents/visibility.d.ts +1 -0
- package/dist/commands/agents/visibility.js +14 -0
- package/dist/commands/code/migrate.js +3 -1
- package/dist/commands/convos/messages.js +5 -0
- package/dist/commands/convos/transcript.js +2 -2
- package/dist/commands/daemon/logs.d.ts +3 -1
- package/dist/commands/daemon/logs.js +6 -2
- package/dist/commands/duties/advance-next.js +16 -7
- package/dist/commands/duties/preflight.js +17 -13
- package/dist/commands/followups/show.js +9 -0
- package/dist/commands/followups/watch-pr.d.ts +27 -0
- package/dist/commands/followups/watch-pr.js +124 -0
- package/dist/commands/harnesses/evaluations/evidence.js +2 -2
- package/dist/commands/harnesses/evaluations/grant.js +1 -1
- package/dist/commands/harnesses/evaluations/revoke.js +1 -1
- package/dist/commands/harnesses/evaluations/show.js +1 -1
- package/dist/commands/harnesses/rollouts/grant.js +1 -1
- package/dist/commands/harnesses/rollouts/revoke.js +1 -1
- package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
- package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
- package/dist/commands/memory/consolidation/index.d.ts +20 -0
- package/dist/commands/memory/consolidation/index.js +78 -0
- package/dist/commands/memory/consolidation/resume.d.ts +14 -0
- package/dist/commands/memory/consolidation/resume.js +46 -0
- package/dist/commands/memory/consolidation/undo.d.ts +18 -0
- package/dist/commands/memory/consolidation/undo.js +61 -0
- package/dist/commands/messages/list.js +9 -1
- package/dist/commands/slack/mutes.d.ts +10 -0
- package/dist/commands/slack/mutes.js +62 -0
- package/dist/commands/slack/unmute.d.ts +12 -0
- package/dist/commands/slack/unmute.js +44 -0
- package/dist/commands/tasks/actionability.js +10 -0
- package/dist/commands/tasks/ask.d.ts +50 -0
- package/dist/commands/tasks/ask.js +190 -0
- package/dist/commands/tasks/bulk-update.js +12 -0
- package/dist/commands/tasks/handover.js +14 -0
- package/dist/commands/tasks/input/answer.js +8 -2
- package/dist/commands/tasks/input/show.d.ts +26 -0
- package/dist/commands/tasks/input/show.js +185 -17
- package/dist/commands/tasks/list.d.ts +8 -0
- package/dist/commands/tasks/list.js +50 -9
- package/dist/commands/tasks/move.d.ts +3 -0
- package/dist/commands/tasks/move.js +71 -1
- package/dist/commands/tasks/result/show.js +19 -7
- package/dist/commands/tasks/result/submit.js +3 -0
- package/dist/commands/tasks/runs.d.ts +4 -1
- package/dist/commands/tasks/runs.js +22 -3
- package/dist/commands/tasks/show.d.ts +4 -3
- package/dist/commands/tasks/show.js +40 -7
- package/dist/commands/tasks/start.js +35 -16
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +55 -1
- package/dist/commands/tasks/updates/add.js +3 -0
- package/dist/commands/tasks/wait.d.ts +20 -0
- package/dist/commands/tasks/wait.js +103 -2
- package/dist/generated/agent-guides.json +892 -183
- package/dist/generated/managed-instruction-guides.json +1 -1
- package/dist/lib/agent-access-command.d.ts +19 -0
- package/dist/lib/agent-access-command.js +44 -0
- package/dist/lib/agent-access.d.ts +18 -0
- package/dist/lib/agent-access.js +48 -0
- package/dist/lib/agent-import/apply.d.ts +50 -0
- package/dist/lib/agent-import/apply.js +85 -0
- package/dist/lib/agent-import/plan.d.ts +132 -0
- package/dist/lib/agent-import/plan.js +504 -0
- package/dist/lib/agent-import/reader.d.ts +94 -0
- package/dist/lib/agent-import/reader.js +326 -0
- package/dist/lib/agent-import/schedule.d.ts +46 -0
- package/dist/lib/agent-import/schedule.js +220 -0
- package/dist/lib/agent-import/sources.d.ts +124 -0
- package/dist/lib/agent-import/sources.js +797 -0
- package/dist/lib/chat-stop.d.ts +17 -0
- package/dist/lib/chat-stop.js +70 -0
- package/dist/lib/cloud-reply.d.ts +21 -0
- package/dist/lib/cloud-reply.js +52 -0
- package/dist/lib/duties.js +24 -4
- package/dist/lib/duty-ledgers.js +19 -2
- package/dist/lib/file-mime.js +8 -0
- package/dist/lib/followups.d.ts +61 -0
- package/dist/lib/followups.js +39 -0
- package/dist/lib/handover-interview.d.ts +18 -0
- package/dist/lib/handover-interview.js +53 -0
- package/dist/lib/inbound-messages.d.ts +156 -0
- package/dist/lib/inbound-messages.js +375 -0
- package/dist/lib/input-queue.js +2 -1
- package/dist/lib/intuition-look.d.ts +10 -0
- package/dist/lib/intuition-look.js +64 -0
- package/dist/lib/message-intent.d.ts +18 -2
- package/dist/lib/message-intent.js +23 -1
- package/dist/lib/preflight-copy.d.ts +16 -1
- package/dist/lib/preflight-copy.js +33 -1
- package/dist/lib/record-output.d.ts +1 -1
- package/dist/lib/record-output.js +2 -0
- package/dist/lib/skill-import.d.ts +19 -0
- package/dist/lib/skill-import.js +34 -0
- package/dist/lib/slack-thread-mutes.d.ts +25 -0
- package/dist/lib/slack-thread-mutes.js +12 -0
- package/dist/lib/task-carriers.d.ts +18 -0
- package/dist/lib/task-carriers.js +43 -0
- package/dist/lib/task-extras.d.ts +5 -0
- package/dist/lib/task-extras.js +5 -0
- package/dist/lib/task-operations.d.ts +2 -0
- package/dist/lib/task-operations.js +28 -4
- package/dist/lib/task-preflight.js +1 -0
- package/dist/lib/task-recurrence-summary.d.ts +15 -0
- package/dist/lib/task-recurrence-summary.js +22 -0
- package/dist/lib/task-review-notice.d.ts +21 -0
- package/dist/lib/task-review-notice.js +46 -0
- package/dist/lib/task-version.d.ts +53 -0
- package/dist/lib/task-version.js +89 -0
- package/dist/lib/task-write-attribution.d.ts +7 -0
- package/dist/lib/task-write-attribution.js +14 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +13492 -12505
- package/oclif.manifest.json +2090 -132
- package/package.json +9 -2
|
@@ -0,0 +1,62 @@
|
|
|
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 format_1 = require("../../lib/format");
|
|
6
|
+
const agent_resolver_1 = require("../../lib/agent-resolver");
|
|
7
|
+
const slack_thread_mutes_1 = require("../../lib/slack-thread-mutes");
|
|
8
|
+
class SlackMutes extends base_command_1.BaseCommand {
|
|
9
|
+
static description = 'List the Slack threads an agent left, and who asked it to leave';
|
|
10
|
+
static examples = [
|
|
11
|
+
'<%= config.bin %> slack mutes --agent agent_123',
|
|
12
|
+
'<%= config.bin %> slack mutes --json',
|
|
13
|
+
];
|
|
14
|
+
static flags = {
|
|
15
|
+
agent: core_1.Flags.string({
|
|
16
|
+
description: 'Agent ID. Local daemon sessions prefer OVERSKY_SESSION_AGENT_ID and reject mismatches.',
|
|
17
|
+
}),
|
|
18
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
19
|
+
};
|
|
20
|
+
async run() {
|
|
21
|
+
this.requireAuth();
|
|
22
|
+
const { flags } = await this.parse(SlackMutes);
|
|
23
|
+
let agentId;
|
|
24
|
+
try {
|
|
25
|
+
agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
this.error(err.message, { exit: 2 });
|
|
29
|
+
}
|
|
30
|
+
let mutes;
|
|
31
|
+
try {
|
|
32
|
+
mutes = await (0, slack_thread_mutes_1.listSlackThreadMutes)(agentId);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
this.handleApiError(err);
|
|
36
|
+
}
|
|
37
|
+
if (flags.json) {
|
|
38
|
+
this.printJsonResult({ mutes: mutes });
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (mutes.length === 0) {
|
|
42
|
+
this.log('This agent has not left any Slack thread.');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
(0, format_1.renderTable)(mutes.map((mute) => ({
|
|
46
|
+
channel: mute.conversationName
|
|
47
|
+
? `#${mute.conversationName} (${mute.channelId})`
|
|
48
|
+
: mute.channelId,
|
|
49
|
+
thread: mute.threadId,
|
|
50
|
+
askedBy: `${mute.mutedBy.userName || mute.mutedBy.userId || 'unknown'}${mute.mutedBy.role === 'owner' ? ' (owner)' : ''}`,
|
|
51
|
+
since: mute.mutedAt || '',
|
|
52
|
+
})), [
|
|
53
|
+
{ key: 'channel', header: 'CHANNEL', maxWidth: 40 },
|
|
54
|
+
{ key: 'thread', header: 'THREAD TS' },
|
|
55
|
+
{ key: 'askedBy', header: 'ASKED BY', maxWidth: 30 },
|
|
56
|
+
{ key: 'since', header: 'SINCE' },
|
|
57
|
+
], (line) => this.log(line));
|
|
58
|
+
this.log('');
|
|
59
|
+
this.log('A person @mentioning the agent in a thread brings it back. To clear one yourself: skrr slack unmute --channel <id> --thread-ts <ts>');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.default = SlackMutes;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class SlackUnmute extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
channel: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'thread-ts': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 agent_resolver_1 = require("../../lib/agent-resolver");
|
|
6
|
+
const slack_thread_mutes_1 = require("../../lib/slack-thread-mutes");
|
|
7
|
+
class SlackUnmute extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'Let an agent follow a Slack thread it left again, without waiting for a mention';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> slack unmute --channel C123 --thread-ts 1710000000.000100',
|
|
11
|
+
];
|
|
12
|
+
static flags = {
|
|
13
|
+
agent: core_1.Flags.string({
|
|
14
|
+
description: 'Agent ID. Local daemon sessions prefer OVERSKY_SESSION_AGENT_ID and reject mismatches.',
|
|
15
|
+
}),
|
|
16
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
17
|
+
channel: core_1.Flags.string({ description: 'Slack channel ID of the thread', required: true }),
|
|
18
|
+
'thread-ts': core_1.Flags.string({ description: 'Slack parent thread timestamp', required: true }),
|
|
19
|
+
};
|
|
20
|
+
async run() {
|
|
21
|
+
this.requireAuth();
|
|
22
|
+
const { flags } = await this.parse(SlackUnmute);
|
|
23
|
+
let agentId;
|
|
24
|
+
try {
|
|
25
|
+
agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
this.error(err.message, { exit: 2 });
|
|
29
|
+
}
|
|
30
|
+
let result;
|
|
31
|
+
try {
|
|
32
|
+
result = await (0, slack_thread_mutes_1.clearSlackThreadMute)(agentId, flags.channel, flags['thread-ts']);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
this.handleApiError(err);
|
|
36
|
+
}
|
|
37
|
+
if (flags.json) {
|
|
38
|
+
this.printJsonResult(result);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.log(`The agent follows thread ${flags['thread-ts']} in ${flags.channel} again. Nothing was posted.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = SlackUnmute;
|
|
@@ -5,6 +5,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
5
5
|
const base_command_1 = require("../../base-command");
|
|
6
6
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
7
7
|
const task_operations_1 = require("../../lib/task-operations");
|
|
8
|
+
const task_carriers_1 = require("../../lib/task-carriers");
|
|
8
9
|
class TasksActionability extends base_command_1.BaseCommand {
|
|
9
10
|
static description = 'Show the canonical next actor and why this task can or cannot move';
|
|
10
11
|
static args = {
|
|
@@ -56,6 +57,14 @@ class TasksActionability extends base_command_1.BaseCommand {
|
|
|
56
57
|
if (a.actorRefs?.length) {
|
|
57
58
|
this.log(`Eligible: ${a.actorRefs.map((ref) => `${ref.kind}:${ref.id}`).join(', ')}`);
|
|
58
59
|
}
|
|
60
|
+
// Who is next is not the same as whether anything will act: an Agent can be next on a Task no
|
|
61
|
+
// Run, wake or person will ever move.
|
|
62
|
+
for (const line of (0, task_carriers_1.taskCarrierLines)(a, {
|
|
63
|
+
taskRef: response.identifier || response.taskId,
|
|
64
|
+
bin: this.config.bin,
|
|
65
|
+
})) {
|
|
66
|
+
this.log(line);
|
|
67
|
+
}
|
|
59
68
|
if (a.allowedActions.length) {
|
|
60
69
|
// These are SERVER action names, not commands, and printing them bare as
|
|
61
70
|
// `Actions: retry_task, resolve_task_hold` reads as a list of things to
|
|
@@ -72,6 +81,7 @@ class TasksActionability extends base_command_1.BaseCommand {
|
|
|
72
81
|
for (const { action, targetId } of a.allowedActions) {
|
|
73
82
|
const rows = (0, task_operations_1.taskActionRemedyRows)((0, task_operations_1.taskActionRemedies)(action, task, targetId, this.config.bin, {
|
|
74
83
|
allowedActions: a.allowedActions,
|
|
84
|
+
reasonCode: a.reasonCode,
|
|
75
85
|
}));
|
|
76
86
|
if (rows.length === 0)
|
|
77
87
|
this.log(` ${action.padEnd(width)}`);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type AskTaskHumanInputBody } from '@skrr-ai/data-provider';
|
|
2
|
+
import { BaseCommand } from '../../base-command';
|
|
3
|
+
/**
|
|
4
|
+
* `--expires`: an ISO date-time, or a length of time from now (`30m`, `4h`, `2d`).
|
|
5
|
+
* The server keeps the workspace's longest wait and refuses a later deadline
|
|
6
|
+
* with the limit in its words; this only turns the flag into a time.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseAskExpiry(value: string | undefined, now?: number): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* `--option-description <n>=<text>`: what choosing the `--option` at position
|
|
11
|
+
* `n` (counted from 1, as `--recommended` is) means. The position is explicit so
|
|
12
|
+
* a description can never land under another option, whatever the order of the
|
|
13
|
+
* flags; the text is everything after the first `=`. The result is aligned with
|
|
14
|
+
* the options, `''` where an option has none, or `undefined` when none was given.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseOptionDescriptions(values: string[] | undefined, optionCount: number): string[] | undefined;
|
|
17
|
+
/** The one question a `tasks ask` sends, with `--recommended` counted from 1 as it is shown. */
|
|
18
|
+
export declare function buildAskBody(flags: {
|
|
19
|
+
question: string;
|
|
20
|
+
context?: string;
|
|
21
|
+
option?: string[];
|
|
22
|
+
'option-description'?: string[];
|
|
23
|
+
recommended?: number;
|
|
24
|
+
multi?: boolean;
|
|
25
|
+
header?: string;
|
|
26
|
+
'no-free-text'?: boolean;
|
|
27
|
+
expires?: string;
|
|
28
|
+
key?: string;
|
|
29
|
+
}): AskTaskHumanInputBody;
|
|
30
|
+
export default class TasksAsk extends BaseCommand {
|
|
31
|
+
static description: string;
|
|
32
|
+
static examples: string[];
|
|
33
|
+
static args: {
|
|
34
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
35
|
+
};
|
|
36
|
+
static flags: {
|
|
37
|
+
question: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
context: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
39
|
+
option: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
40
|
+
'option-description': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
41
|
+
recommended: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
42
|
+
multi: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
43
|
+
header: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
44
|
+
'no-free-text': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
45
|
+
expires: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
46
|
+
key: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
47
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
48
|
+
};
|
|
49
|
+
run(): Promise<void>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseAskExpiry = parseAskExpiry;
|
|
4
|
+
exports.parseOptionDescriptions = parseOptionDescriptions;
|
|
5
|
+
exports.buildAskBody = buildAskBody;
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
8
|
+
const base_command_1 = require("../../base-command");
|
|
9
|
+
const show_1 = require("./input/show");
|
|
10
|
+
const RELATIVE_EXPIRY_RE = /^(\d+)\s*(m|h|d)$/i;
|
|
11
|
+
const UNIT_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 };
|
|
12
|
+
/**
|
|
13
|
+
* `--expires`: an ISO date-time, or a length of time from now (`30m`, `4h`, `2d`).
|
|
14
|
+
* The server keeps the workspace's longest wait and refuses a later deadline
|
|
15
|
+
* with the limit in its words; this only turns the flag into a time.
|
|
16
|
+
*/
|
|
17
|
+
function parseAskExpiry(value, now = Date.now()) {
|
|
18
|
+
if (value === undefined)
|
|
19
|
+
return undefined;
|
|
20
|
+
const trimmed = value.trim();
|
|
21
|
+
const relative = trimmed.match(RELATIVE_EXPIRY_RE);
|
|
22
|
+
if (relative) {
|
|
23
|
+
return new Date(now + Number(relative[1]) * UNIT_MS[relative[2].toLowerCase()]).toISOString();
|
|
24
|
+
}
|
|
25
|
+
const at = new Date(trimmed);
|
|
26
|
+
if (!/\d{4}-\d{2}-\d{2}/.test(trimmed) || !Number.isFinite(at.getTime())) {
|
|
27
|
+
throw new Error(`--expires takes an ISO date-time or a length such as 30m, 4h, 2d: ${value}`);
|
|
28
|
+
}
|
|
29
|
+
return at.toISOString();
|
|
30
|
+
}
|
|
31
|
+
const OPTION_DESCRIPTION_RE = /^\s*(\d+)\s*=([\s\S]*)$/;
|
|
32
|
+
/**
|
|
33
|
+
* `--option-description <n>=<text>`: what choosing the `--option` at position
|
|
34
|
+
* `n` (counted from 1, as `--recommended` is) means. The position is explicit so
|
|
35
|
+
* a description can never land under another option, whatever the order of the
|
|
36
|
+
* flags; the text is everything after the first `=`. The result is aligned with
|
|
37
|
+
* the options, `''` where an option has none, or `undefined` when none was given.
|
|
38
|
+
*/
|
|
39
|
+
function parseOptionDescriptions(values, optionCount) {
|
|
40
|
+
if (!values?.length)
|
|
41
|
+
return undefined;
|
|
42
|
+
if (!optionCount)
|
|
43
|
+
throw new Error('--option-description needs the --option it describes');
|
|
44
|
+
const descriptions = new Array(optionCount).fill('');
|
|
45
|
+
for (const value of values) {
|
|
46
|
+
const match = value.match(OPTION_DESCRIPTION_RE);
|
|
47
|
+
if (!match) {
|
|
48
|
+
throw new Error(`--option-description takes the option's position and what choosing it means, as 2="Billed every month, cancel any time": ${value}`);
|
|
49
|
+
}
|
|
50
|
+
const position = Number(match[1]);
|
|
51
|
+
if (position < 1 || position > optionCount) {
|
|
52
|
+
throw new Error(`--option-description names an --option by its position, from 1 to ${optionCount}: ${position}`);
|
|
53
|
+
}
|
|
54
|
+
if (descriptions[position - 1]) {
|
|
55
|
+
throw new Error(`--option-description describes option ${position} twice`);
|
|
56
|
+
}
|
|
57
|
+
const description = match[2].trim();
|
|
58
|
+
if (!description)
|
|
59
|
+
throw new Error(`--option-description ${position}= has no description`);
|
|
60
|
+
if (description.length > data_provider_1.TASK_HUMAN_INPUT_OPTION_DESCRIPTION_MAX) {
|
|
61
|
+
throw new Error(`--option-description takes at most ${data_provider_1.TASK_HUMAN_INPUT_OPTION_DESCRIPTION_MAX} characters (option ${position}'s is ${description.length}): say what choosing it means, and put the rest in --context`);
|
|
62
|
+
}
|
|
63
|
+
descriptions[position - 1] = description;
|
|
64
|
+
}
|
|
65
|
+
return descriptions;
|
|
66
|
+
}
|
|
67
|
+
/** The one question a `tasks ask` sends, with `--recommended` counted from 1 as it is shown. */
|
|
68
|
+
function buildAskBody(flags) {
|
|
69
|
+
const options = (flags.option || []).map((option) => option.trim()).filter(Boolean);
|
|
70
|
+
if (flags.recommended !== undefined) {
|
|
71
|
+
if (!options.length)
|
|
72
|
+
throw new Error('--recommended needs the --option it names');
|
|
73
|
+
if (flags.recommended < 1 || flags.recommended > options.length) {
|
|
74
|
+
throw new Error(`--recommended is the position of an --option, from 1 to ${options.length}: ${flags.recommended}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (flags.multi && options.length < 2)
|
|
78
|
+
throw new Error('--multi needs at least two --option');
|
|
79
|
+
if (flags['no-free-text'] && !options.length) {
|
|
80
|
+
throw new Error('--no-free-text needs --option: the person must be able to answer');
|
|
81
|
+
}
|
|
82
|
+
const context = flags.context?.trim();
|
|
83
|
+
if (context && context.length > data_provider_1.TASK_HUMAN_INPUT_CONTEXT_MAX) {
|
|
84
|
+
throw new Error(`--context takes at most ${data_provider_1.TASK_HUMAN_INPUT_CONTEXT_MAX} characters (this one is ${context.length}): keep the evidence and the trade-off, and leave the rest on the task`);
|
|
85
|
+
}
|
|
86
|
+
const optionDescriptions = parseOptionDescriptions(flags['option-description'], options.length);
|
|
87
|
+
const expiresAt = parseAskExpiry(flags.expires);
|
|
88
|
+
return {
|
|
89
|
+
questions: [
|
|
90
|
+
{
|
|
91
|
+
prompt: flags.question.trim(),
|
|
92
|
+
...(context ? { context } : {}),
|
|
93
|
+
...(flags.header ? { header: flags.header.trim() } : {}),
|
|
94
|
+
...(options.length ? { options } : {}),
|
|
95
|
+
...(optionDescriptions ? { optionDescriptions } : {}),
|
|
96
|
+
...(flags.recommended !== undefined ? { recommendedIndex: flags.recommended - 1 } : {}),
|
|
97
|
+
...(flags.multi ? { multiSelect: true } : {}),
|
|
98
|
+
...(flags['no-free-text'] ? { allowFreeText: false } : {}),
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
...(expiresAt ? { expiresAt } : {}),
|
|
102
|
+
...(flags.key ? { askKey: flags.key } : {}),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
class TasksAsk extends base_command_1.BaseCommand {
|
|
106
|
+
static description = 'Ask a person one question on a task, outside any run. The task keeps the question until it is answered, expires or is dismissed; the answer starts nothing and is read with `tasks input show --request <id> --wait`';
|
|
107
|
+
static examples = [
|
|
108
|
+
'<%= config.bin %> tasks ask OSK-42 --question "Lead the pricing page with annual or monthly prices?" --option Annual --option Monthly --recommended 1 --context "Annual-first lifted team-plan signups 11% in the last test; monthly-first tested better with solo users."',
|
|
109
|
+
'<%= config.bin %> tasks ask OSK-42 --question "Which plan should the trial default to?" --option Team --option Solo --option-description 1="Five seats, billed yearly" --option-description 2="One seat, billed monthly"',
|
|
110
|
+
'<%= config.bin %> tasks ask OSK-42 --question "Is staging safe to reset?" --expires 4h --key reset-staging',
|
|
111
|
+
];
|
|
112
|
+
static args = {
|
|
113
|
+
id: core_1.Args.string({ description: 'Task ID/ref', required: true, ignoreStdin: true }),
|
|
114
|
+
};
|
|
115
|
+
static flags = {
|
|
116
|
+
question: core_1.Flags.string({
|
|
117
|
+
description: 'The question, in one line of 140 characters or fewer. Put the background in --context',
|
|
118
|
+
required: true,
|
|
119
|
+
}),
|
|
120
|
+
context: core_1.Flags.string({
|
|
121
|
+
description: `What the person needs to know to answer: the evidence, the trade-off, why you recommend what you recommend (${data_provider_1.TASK_HUMAN_INPUT_CONTEXT_MAX} characters). Shown beneath the question; the choices go in --option`,
|
|
122
|
+
}),
|
|
123
|
+
option: core_1.Flags.string({ description: 'A choice (repeatable, in order)', multiple: true }),
|
|
124
|
+
'option-description': core_1.Flags.string({
|
|
125
|
+
description: `What choosing an --option means, as <position>=<text> counting from 1 (repeatable; ${data_provider_1.TASK_HUMAN_INPUT_OPTION_DESCRIPTION_MAX} characters each). Shown with that option`,
|
|
126
|
+
multiple: true,
|
|
127
|
+
}),
|
|
128
|
+
recommended: core_1.Flags.integer({
|
|
129
|
+
description: 'The --option you recommend, by its position counting from 1',
|
|
130
|
+
}),
|
|
131
|
+
multi: core_1.Flags.boolean({ description: 'More than one option may be chosen' }),
|
|
132
|
+
header: core_1.Flags.string({ description: 'A short label for the question (80 characters)' }),
|
|
133
|
+
'no-free-text': core_1.Flags.boolean({ description: 'Only the options may be chosen, not words' }),
|
|
134
|
+
expires: core_1.Flags.string({
|
|
135
|
+
description: "When it stops waiting: an ISO date-time or 30m, 4h, 2d (default and maximum: the workspace's policy)",
|
|
136
|
+
}),
|
|
137
|
+
key: core_1.Flags.string({
|
|
138
|
+
description: 'Your key for this question: the same key returns the same question, and names only one',
|
|
139
|
+
}),
|
|
140
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
141
|
+
};
|
|
142
|
+
async run() {
|
|
143
|
+
this.requireAuth();
|
|
144
|
+
const { args, flags } = await this.parse(TasksAsk);
|
|
145
|
+
let body;
|
|
146
|
+
try {
|
|
147
|
+
body = buildAskBody(flags);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
this.failWithCliError({
|
|
151
|
+
message: err.message,
|
|
152
|
+
code: 'TASK_HUMAN_INPUT_ASK_INVALID',
|
|
153
|
+
exit: 2,
|
|
154
|
+
retryable: false,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
const taskId = await this.resolveTaskReference(args.id);
|
|
158
|
+
let response;
|
|
159
|
+
try {
|
|
160
|
+
response = await data_provider_1.dataService.askTaskHumanInput(taskId, body);
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
this.handleApiError(err);
|
|
164
|
+
}
|
|
165
|
+
if (flags.json) {
|
|
166
|
+
this.printJsonResult(response);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const request = response.data;
|
|
170
|
+
const route = (request.replyRoute?.kind || 'poll');
|
|
171
|
+
this.log(`${response.created ? 'Asked' : 'Already asked (same key)'} on ${args.id}: request ${request.requestId}`);
|
|
172
|
+
for (const question of request.questions) {
|
|
173
|
+
this.log(` ${question.header ? `${question.header}: ` : ''}${question.prompt}`);
|
|
174
|
+
for (const line of (0, show_1.humanInputContextLines)(question, ' '))
|
|
175
|
+
this.log(line);
|
|
176
|
+
const options = (0, show_1.humanInputOptionsLine)(question);
|
|
177
|
+
if (options)
|
|
178
|
+
this.log(` Options: ${options}`);
|
|
179
|
+
for (const line of (0, show_1.humanInputOptionDescriptionLines)(question, ' '))
|
|
180
|
+
this.log(line);
|
|
181
|
+
}
|
|
182
|
+
if (request.expiresAt)
|
|
183
|
+
this.log(` Expires: ${new Date(request.expiresAt).toISOString()}`);
|
|
184
|
+
this.log(data_provider_1.TASK_HUMAN_INPUT_REPLY_ROUTE_LABELS[route]);
|
|
185
|
+
this.log(`Read the answer: ${this.config.bin} tasks input show ${args.id} --request ${request.requestId} --wait`);
|
|
186
|
+
if (response.advice?.tip)
|
|
187
|
+
this.log(`Tip for your next question: ${response.advice.tip}`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.default = TasksAsk;
|
|
@@ -9,6 +9,7 @@ const dry_run_plans_1 = require("../../lib/dry-run-plans");
|
|
|
9
9
|
const task_batch_1 = require("../../lib/task-batch");
|
|
10
10
|
const space_write_policy_1 = require("../../lib/space-write-policy");
|
|
11
11
|
const write_target_1 = require("../../lib/write-target");
|
|
12
|
+
const task_review_notice_1 = require("../../lib/task-review-notice");
|
|
12
13
|
const tasks_1 = require("../../lib/tasks");
|
|
13
14
|
class TasksBulkUpdate extends base_command_1.BaseCommand {
|
|
14
15
|
static description = 'Apply partial updates to many tasks from JSON';
|
|
@@ -113,6 +114,8 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
|
|
|
113
114
|
}
|
|
114
115
|
const usedBatch = batchByRow.size > 0;
|
|
115
116
|
let stopped = false;
|
|
117
|
+
// Rows whose status move landed them in review that nobody owes a Review (OSK-33194).
|
|
118
|
+
const parkedInReview = [];
|
|
116
119
|
for (const [index, row] of rows.entries()) {
|
|
117
120
|
try {
|
|
118
121
|
let task = null;
|
|
@@ -181,6 +184,9 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
|
|
|
181
184
|
});
|
|
182
185
|
continue;
|
|
183
186
|
}
|
|
187
|
+
if ((0, task_review_notice_1.waitsForUnowedReview)(task)) {
|
|
188
|
+
parkedInReview.push((0, tasks_1.taskRef)(task) || (0, tasks_1.taskId)(task) || row.id);
|
|
189
|
+
}
|
|
184
190
|
}
|
|
185
191
|
if (!task) {
|
|
186
192
|
task = await data_provider_1.dataService.getTask(row.id, { enrich: false });
|
|
@@ -212,7 +218,11 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
|
|
|
212
218
|
failed: errors.length,
|
|
213
219
|
results,
|
|
214
220
|
};
|
|
221
|
+
const reviewNotice = (0, task_review_notice_1.unowedReviewSummary)(parkedInReview, this.config.bin);
|
|
215
222
|
if (flags.json) {
|
|
223
|
+
// stderr, so the JSON on stdout stays one document (as `tasks move` does).
|
|
224
|
+
if (reviewNotice)
|
|
225
|
+
this.logToStderr(reviewNotice);
|
|
216
226
|
const base = this.cliConfig.baseURL;
|
|
217
227
|
const enriched = {
|
|
218
228
|
...summary,
|
|
@@ -243,6 +253,8 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
|
|
|
243
253
|
this.log(`- failed ${result.id}: ${result.error}`);
|
|
244
254
|
}
|
|
245
255
|
}
|
|
256
|
+
if (reviewNotice)
|
|
257
|
+
this.log(reviewNotice);
|
|
246
258
|
}
|
|
247
259
|
if (errors.length > 0) {
|
|
248
260
|
this.exit(1);
|
|
@@ -8,6 +8,7 @@ const code_handover_1 = require("../../lib/code-handover");
|
|
|
8
8
|
const task_extras_1 = require("../../lib/task-extras");
|
|
9
9
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
10
10
|
const format_1 = require("../../lib/format");
|
|
11
|
+
const handover_interview_1 = require("../../lib/handover-interview");
|
|
11
12
|
/**
|
|
12
13
|
* `skrr tasks handover` — continue a task's work under a different agent or a
|
|
13
14
|
* different execution target, from where a finished run left off.
|
|
@@ -25,6 +26,11 @@ const format_1 = require("../../lib/format");
|
|
|
25
26
|
* What does not move is declared, not implied: the response's `packet.notCarried`
|
|
26
27
|
* names what stayed behind (provider session, agent-private memory, local
|
|
27
28
|
* machine state) and is printed verbatim rather than paraphrased.
|
|
29
|
+
*
|
|
30
|
+
* Beside it, never in it: the previous owner's handover notes (§4.8). When another
|
|
31
|
+
* agent takes over, the server asks the previous one once, briefly, what the record
|
|
32
|
+
* does not say; the response carries where that stands (`interview`), and
|
|
33
|
+
* `skrr tasks runs` prints the notes once they arrive.
|
|
28
34
|
*/
|
|
29
35
|
/** The run statuses from which a handover can source a Resume Point. */
|
|
30
36
|
const HANDOVER_SOURCE_RUN_STATUSES = new Set([
|
|
@@ -201,6 +207,14 @@ class TasksHandover extends base_command_1.BaseCommand {
|
|
|
201
207
|
? r.packet.notCarried.map(String).filter(Boolean)
|
|
202
208
|
: [];
|
|
203
209
|
this.log(`Not carried: ${notCarried.length ? notCarried.join(', ') : '(nothing declared)'}`);
|
|
210
|
+
const interviewLines = (0, handover_interview_1.renderHandoverInterview)(r.interview ?? newRun.handoverInterview);
|
|
211
|
+
if (interviewLines.length) {
|
|
212
|
+
for (const line of interviewLines)
|
|
213
|
+
this.log(line);
|
|
214
|
+
if (r.interview?.state === 'pending') {
|
|
215
|
+
this.log(` Read them with \`${this.config.bin} tasks runs ${taskId}\` once they arrive.`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
204
218
|
}
|
|
205
219
|
}
|
|
206
220
|
exports.default = TasksHandover;
|
|
@@ -16,7 +16,7 @@ function parseAnswers(values) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
class TasksInputAnswer extends base_command_1.BaseCommand {
|
|
19
|
-
static description = 'Answer an open Human-input request
|
|
19
|
+
static description = 'Answer an open Human-input request. A Run-carried question starts the next exchange; a question asked outside a Run is answered in place';
|
|
20
20
|
static args = {
|
|
21
21
|
id: core_1.Args.string({ description: 'Task ID/ref', required: true, ignoreStdin: true }),
|
|
22
22
|
};
|
|
@@ -64,8 +64,14 @@ class TasksInputAnswer extends base_command_1.BaseCommand {
|
|
|
64
64
|
}
|
|
65
65
|
if (flags.json)
|
|
66
66
|
this.log(JSON.stringify(result, null, 2));
|
|
67
|
-
else
|
|
67
|
+
else if ('exchangeId' in result && result.exchangeId)
|
|
68
68
|
this.log(`Answered Human-input request ${requestId}; exchange ${result.exchangeId} started.`);
|
|
69
|
+
else
|
|
70
|
+
// A question asked outside a Run: answered in place, nothing starts.
|
|
71
|
+
this.log(`Answered Human-input request ${requestId}. ` +
|
|
72
|
+
(('replyRoute' in result &&
|
|
73
|
+
data_provider_1.TASK_HUMAN_INPUT_REPLY_ROUTE_LABELS[result.replyRoute]) ||
|
|
74
|
+
''));
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
77
|
exports.default = TasksInputAnswer;
|
|
@@ -1,11 +1,37 @@
|
|
|
1
|
+
import { type TaskHumanInputQuestion, type TaskHumanInputRequest } from '@skrr-ai/data-provider';
|
|
1
2
|
import { BaseCommand } from '../../../base-command';
|
|
3
|
+
/**
|
|
4
|
+
* A question's options as one line, the asker's recommendation marked. Marked,
|
|
5
|
+
* never chosen: the person (or the agent answering for them) still picks.
|
|
6
|
+
*/
|
|
7
|
+
export declare function humanInputOptionsLine(question: Pick<TaskHumanInputQuestion, 'options' | 'recommendedIndex'>): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* A question's background, under the question it explains: each of its lines
|
|
10
|
+
* indented by `indent`, so a context of several lines stays one block.
|
|
11
|
+
*/
|
|
12
|
+
export declare function humanInputContextLines(question: Pick<TaskHumanInputQuestion, 'context'>, indent: string): string[];
|
|
13
|
+
/**
|
|
14
|
+
* What each option means, one line per described option, under the options
|
|
15
|
+
* line and indented by `indent`: `Annual: billed once a year`. An option with
|
|
16
|
+
* no description gets no line.
|
|
17
|
+
*/
|
|
18
|
+
export declare function humanInputOptionDescriptionLines(question: Pick<TaskHumanInputQuestion, 'options' | 'optionDescriptions'>, indent: string): string[];
|
|
19
|
+
/** `--timeout` for `--wait`: 90s, 10m, 2h (a bare number is seconds). */
|
|
20
|
+
export declare function parseWaitTimeoutMs(value: string | undefined): number | null;
|
|
21
|
+
/** Each answer as the asker reads it, beside the question it answers. */
|
|
22
|
+
export declare function humanInputAnswerLines(request: TaskHumanInputRequest): string[];
|
|
2
23
|
export default class TasksInputShow extends BaseCommand {
|
|
3
24
|
static description: string;
|
|
25
|
+
static examples: string[];
|
|
4
26
|
static args: {
|
|
5
27
|
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
28
|
};
|
|
7
29
|
static flags: {
|
|
8
30
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
31
|
+
request: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
|
+
wait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
33
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
34
|
+
interval: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
35
|
};
|
|
10
36
|
run(): Promise<void>;
|
|
11
37
|
}
|