@skrr-ai/cli 0.1.208 → 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.js +1 -1
- package/dist/commands/agent/message/retract.js +1 -1
- package/dist/commands/agent/message/send.d.ts +8 -1
- package/dist/commands/agent/message/send.js +58 -4
- package/dist/commands/agents/access/approve.js +1 -1
- package/dist/commands/agents/access/deny.js +1 -1
- package/dist/commands/agents/access/list.js +3 -1
- package/dist/commands/agents/access/reach.js +1 -1
- package/dist/commands/agents/access/revoke.js +1 -1
- 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.js +3 -3
- 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.js +1 -1
- 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/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 +1 -1
- package/dist/commands/duties/preflight.js +17 -13
- package/dist/commands/followups/watch-pr.js +2 -1
- 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/undo.js +1 -0
- package/dist/commands/messages/list.js +9 -1
- package/dist/commands/slack/mutes.js +1 -1
- package/dist/commands/slack/unmute.js +1 -1
- package/dist/commands/tasks/actionability.js +1 -0
- package/dist/commands/tasks/ask.js +1 -1
- package/dist/commands/tasks/bulk-update.js +12 -0
- package/dist/commands/tasks/input/show.js +2 -2
- package/dist/commands/tasks/list.d.ts +8 -0
- package/dist/commands/tasks/list.js +50 -9
- package/dist/commands/tasks/move.d.ts +2 -10
- package/dist/commands/tasks/move.js +7 -18
- package/dist/commands/tasks/result/show.js +19 -7
- package/dist/commands/tasks/show.d.ts +4 -3
- package/dist/commands/tasks/show.js +20 -8
- package/dist/commands/tasks/start.js +35 -16
- package/dist/commands/tasks/update.js +3 -0
- package/dist/commands/tasks/wait.js +2 -2
- package/dist/generated/agent-guides.json +433 -133
- 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/inbound-messages.d.ts +156 -0
- package/dist/lib/inbound-messages.js +375 -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/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-review-notice.d.ts +21 -0
- package/dist/lib/task-review-notice.js +46 -0
- package/dist/lib/task-version.d.ts +9 -0
- package/dist/lib/task-version.js +16 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +11969 -11728
- package/oclif.manifest.json +290 -12
- package/package.json +6 -2
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GLANCE_WAIT_MS = exports.RETURN_REFUSAL_COPY = exports.RETURN_OUTCOME_COPY = exports.REACTION_NAMES = exports.AGENT_REPLY_REFUSAL_COPY = exports.FALLBACK_COPY = exports.GLANCE_COPY = exports.ROUTE_COPY = exports.FAILED_COPY = exports.HELD_COPY = void 0;
|
|
4
|
+
exports.normalizeReplyTo = normalizeReplyTo;
|
|
5
|
+
exports.agentReplyRefusalOf = agentReplyRefusalOf;
|
|
6
|
+
exports.reactionFromInput = reactionFromInput;
|
|
7
|
+
exports.deliverySentence = deliverySentence;
|
|
8
|
+
exports.returnedSentence = returnedSentence;
|
|
9
|
+
exports.handlingSentence = handlingSentence;
|
|
10
|
+
exports.inboundMessageIdFor = inboundMessageIdFor;
|
|
11
|
+
exports.ingressMissing = ingressMissing;
|
|
12
|
+
exports.sendInboundMessage = sendInboundMessage;
|
|
13
|
+
exports.returnInboundMessage = returnInboundMessage;
|
|
14
|
+
exports.notForTaskHint = notForTaskHint;
|
|
15
|
+
exports.returnRefusalOf = returnRefusalOf;
|
|
16
|
+
exports.nextAfterSend = nextAfterSend;
|
|
17
|
+
exports.waitForGlance = waitForGlance;
|
|
18
|
+
exports.readMessageDelivery = readMessageDelivery;
|
|
19
|
+
/**
|
|
20
|
+
* A person's message to their agent, from the CLI (inbound messages, design record
|
|
21
|
+
* docs/architecture/agent-chat-inbound-messages-2026-11-26.zh-CN.md).
|
|
22
|
+
*
|
|
23
|
+
* The message is kept the moment it is sent (`202`), and the server decides how the agent sees
|
|
24
|
+
* it: it starts a turn, joins one that is starting, reaches the work in progress, is read by a
|
|
25
|
+
* short side turn of the agent (a glance), or waits with a reason. A busy agent is never a refusal.
|
|
26
|
+
*
|
|
27
|
+
* Every call goes through `dataService` (the CLI ↔ API parity rule). The sentences match the web's
|
|
28
|
+
* (`client/src/components/Chat/Messages/Delivery/deliveryCopy.ts`), and each table is a `Record`
|
|
29
|
+
* over the contract's closed list, so a new reason does not compile without a sentence here.
|
|
30
|
+
*/
|
|
31
|
+
const node_crypto_1 = require("node:crypto");
|
|
32
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
33
|
+
const agent_chat_start_1 = require("./agent-chat-start");
|
|
34
|
+
const cloud_reply_1 = require("./cloud-reply");
|
|
35
|
+
const http_error_1 = require("./http-error");
|
|
36
|
+
/* ── Words ─────────────────────────────────────────────────────────────── */
|
|
37
|
+
exports.HELD_COPY = {
|
|
38
|
+
machine_offline: (d) => d?.machineName
|
|
39
|
+
? `${d.machineName} is offline. Your agent will see this when it's back.`
|
|
40
|
+
: "Your agent's machine is offline. It will see this when the machine is back.",
|
|
41
|
+
machine_starting: (d) => d?.machineName
|
|
42
|
+
? `Your agent is starting ${d.machineName}. It will see this in a moment.`
|
|
43
|
+
: 'Your agent is starting its machine. It will see this in a moment.',
|
|
44
|
+
session_busy: (d) => d?.workTitle
|
|
45
|
+
? `Your agent is working on ${d.workTitle} and will see this after the current step.`
|
|
46
|
+
: 'Your agent will see this after the current step.',
|
|
47
|
+
deferred_by_user: (d) => d?.workTitle
|
|
48
|
+
? `Sends when your agent finishes ${d.workTitle}.`
|
|
49
|
+
: "Sends when your agent finishes what it's doing.",
|
|
50
|
+
long_step: (d) => d?.toolName
|
|
51
|
+
? `Your agent is waiting for ${d.toolName} to finish. It will see this then.`
|
|
52
|
+
: 'Your agent is in a long step. It will see this when the step ends.',
|
|
53
|
+
glance_unavailable: () => 'Your agent will see this at its next step.',
|
|
54
|
+
queue_paused: () => 'Paused. This sends when you resume.',
|
|
55
|
+
};
|
|
56
|
+
exports.FAILED_COPY = {
|
|
57
|
+
agent_unavailable: 'Not delivered: this agent is no longer available.',
|
|
58
|
+
permission_denied: 'Not delivered: you can no longer use this agent.',
|
|
59
|
+
usage_limit: "Not delivered yet: you're out of usage. Top up, then resume to send it.",
|
|
60
|
+
moderation_refused: "Not delivered: this message didn't pass content checks.",
|
|
61
|
+
conversation_unavailable: 'Not delivered: this conversation is no longer available.',
|
|
62
|
+
refused: 'Not delivered.',
|
|
63
|
+
};
|
|
64
|
+
/** What the route says the moment the message is kept, before anything read it. */
|
|
65
|
+
exports.ROUTE_COPY = {
|
|
66
|
+
command: "Sent. The command runs once your agent finishes what it's doing.",
|
|
67
|
+
addressed: 'Sent to what you addressed.',
|
|
68
|
+
answer: "Sent as the answer to your agent's question.",
|
|
69
|
+
merged: 'Sent. Your agent reads it with the message before it.',
|
|
70
|
+
new_turn: 'Sent. Your agent is starting on it.',
|
|
71
|
+
steer: 'Your agent took this into the work in progress.',
|
|
72
|
+
glance: 'Your agent is reading this while it works.',
|
|
73
|
+
hold: 'Sent. Your agent will see it soon.',
|
|
74
|
+
};
|
|
75
|
+
/** A glance's decision. `null` where the agent's own words are the whole answer. */
|
|
76
|
+
exports.GLANCE_COPY = {
|
|
77
|
+
replied: 'Your agent answered this while it worked.',
|
|
78
|
+
forwarded: 'Your agent took this into the work in progress.',
|
|
79
|
+
deferred: "Your agent will take this up when it finishes what it's doing.",
|
|
80
|
+
interrupted: 'Your agent stopped to take this first.',
|
|
81
|
+
no_reply: 'Seen.',
|
|
82
|
+
continued_work: null,
|
|
83
|
+
};
|
|
84
|
+
exports.FALLBACK_COPY = {
|
|
85
|
+
not_started: "Your agent couldn't look at this while it worked. It will see it when it finishes what it's doing.",
|
|
86
|
+
timed_out: "Your agent didn't get to this in time. It will see it when it finishes what it's doing.",
|
|
87
|
+
failed: "Something went wrong while your agent looked at this. It will see it when it finishes what it's doing.",
|
|
88
|
+
unreadable: "Your agent's decision about this couldn't be read. It will see it when it finishes what it's doing.",
|
|
89
|
+
undecided: "Your agent didn't decide what to do with this. It will see it when it finishes what it's doing.",
|
|
90
|
+
not_carried_out: "What your agent decided about this couldn't be done. It will see it when it finishes what it's doing.",
|
|
91
|
+
};
|
|
92
|
+
/** A reply or reaction the server refused, in the CLI's words. */
|
|
93
|
+
exports.AGENT_REPLY_REFUSAL_COPY = {
|
|
94
|
+
reply_to_invalid: '--reply-to takes 1-10 message ids.',
|
|
95
|
+
reply_to_not_found: "A message named with --reply-to is not one of the owner's messages in the chat this one lands in.",
|
|
96
|
+
reply_to_destination_unsupported: "--reply-to answers the owner's own messages, so it works only for a message to the owner's chat with the agent.",
|
|
97
|
+
reply_to_offline_unsupported: "This session sends through the daemon's offline queue, which cannot say which message it answers. Send it without --reply-to.",
|
|
98
|
+
reaction_invalid: 'An agent reacts with one of 👍 👀 ✅ ❤️ 🙏 😂 🎉 🤔, or their names: thumbs-up, eyes, done, ' +
|
|
99
|
+
'heart, thanks, laugh, tada, thinking.',
|
|
100
|
+
reaction_message_not_found: "That message is not one of the owner's messages in a chat with this agent.",
|
|
101
|
+
reaction_needs_interactive_session: 'Only an interactive session reacts to a message; an unattended run sends a message instead.',
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* `--reply-to` (or a payload's `replyTo`): absent is `null`; otherwise 1-10 message ids, trimmed
|
|
105
|
+
* and without repeats. The server proves each one; this only refuses a list it could never accept.
|
|
106
|
+
*/
|
|
107
|
+
function normalizeReplyTo(value) {
|
|
108
|
+
if (value === undefined || value === null)
|
|
109
|
+
return null;
|
|
110
|
+
const list = Array.isArray(value) ? value : [value];
|
|
111
|
+
const ids = [];
|
|
112
|
+
for (const entry of list) {
|
|
113
|
+
if (typeof entry !== 'string')
|
|
114
|
+
return 'invalid';
|
|
115
|
+
const id = entry.trim();
|
|
116
|
+
if (!id || id.length > 160 || /[\s]/.test(id))
|
|
117
|
+
return 'invalid';
|
|
118
|
+
if (!ids.includes(id))
|
|
119
|
+
ids.push(id);
|
|
120
|
+
}
|
|
121
|
+
if (ids.length === 0 || ids.length > data_provider_1.INBOUND_LIMITS.maxBatch)
|
|
122
|
+
return 'invalid';
|
|
123
|
+
return ids;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A reply or reaction the server refused, when it named a refusal this CLI knows: the code, and
|
|
127
|
+
* the ids a reply could not prove. The DM route names it `errorType`, the session gateway `reason`.
|
|
128
|
+
*/
|
|
129
|
+
function agentReplyRefusalOf(err) {
|
|
130
|
+
const response = err?.response?.data;
|
|
131
|
+
const bodies = [(0, agent_chat_start_1.bodyOf)(err), response].filter((body) => !!body && typeof body === 'object');
|
|
132
|
+
for (const body of bodies) {
|
|
133
|
+
for (const value of [body.errorType, body.reason, body.code]) {
|
|
134
|
+
if (typeof value === 'string' && value in exports.AGENT_REPLY_REFUSAL_COPY) {
|
|
135
|
+
const missing = Array.isArray(body.missing)
|
|
136
|
+
? body.missing.filter((id) => typeof id === 'string')
|
|
137
|
+
: undefined;
|
|
138
|
+
return { code: value, ...(missing ? { missing } : {}) };
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
/** A plain name for each reaction, so a terminal never has to type an emoji. */
|
|
145
|
+
exports.REACTION_NAMES = {
|
|
146
|
+
'👍': 'thumbs-up',
|
|
147
|
+
'👀': 'eyes',
|
|
148
|
+
'✅': 'done',
|
|
149
|
+
'❤️': 'heart',
|
|
150
|
+
'🙏': 'thanks',
|
|
151
|
+
'😂': 'laugh',
|
|
152
|
+
'🎉': 'tada',
|
|
153
|
+
'🤔': 'thinking',
|
|
154
|
+
};
|
|
155
|
+
/** An emoji, or its plain name, as one of the contract's reactions; null when it is neither. */
|
|
156
|
+
function reactionFromInput(input) {
|
|
157
|
+
const value = input.trim();
|
|
158
|
+
// A heart typed without its variation selector is still the heart.
|
|
159
|
+
const glyph = value === '\u2764' ? '\u2764\uFE0F' : value;
|
|
160
|
+
if (data_provider_1.MESSAGE_REACTION_EMOJI.includes(glyph)) {
|
|
161
|
+
return glyph;
|
|
162
|
+
}
|
|
163
|
+
const named = Object.keys(exports.REACTION_NAMES).find((emoji) => exports.REACTION_NAMES[emoji] === value.toLowerCase());
|
|
164
|
+
return named ?? null;
|
|
165
|
+
}
|
|
166
|
+
/** The one sentence for a message's delivery, as a surface draws it. */
|
|
167
|
+
function deliverySentence(delivery) {
|
|
168
|
+
if (!delivery)
|
|
169
|
+
return null;
|
|
170
|
+
if (delivery.state === 'failed') {
|
|
171
|
+
const reason = delivery.failed?.reason;
|
|
172
|
+
const words = (reason && exports.FAILED_COPY[reason]) || exports.FAILED_COPY.refused;
|
|
173
|
+
return delivery.failed?.detail && reason === 'refused'
|
|
174
|
+
? `${words} ${delivery.failed.detail}`
|
|
175
|
+
: words;
|
|
176
|
+
}
|
|
177
|
+
if (delivery.state === 'held' && delivery.held?.reason && delivery.held.reason in exports.HELD_COPY) {
|
|
178
|
+
return exports.HELD_COPY[delivery.held.reason](delivery.held.detail);
|
|
179
|
+
}
|
|
180
|
+
const handled = handlingSentence(delivery.handling?.[delivery.handling.length - 1]);
|
|
181
|
+
if (handled)
|
|
182
|
+
return handled;
|
|
183
|
+
if (delivery.route)
|
|
184
|
+
return exports.ROUTE_COPY[delivery.route] ?? null;
|
|
185
|
+
return delivery.state === 'seen' ? 'Seen.' : 'Sent.';
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* "Not for this Task" (Q6): the message is back in this conversation, and what became of the Task
|
|
189
|
+
* it had gone to. The web's words (`deliveryCopy.ts`, `RETURN_COPY`), with and without the title.
|
|
190
|
+
*/
|
|
191
|
+
exports.RETURN_OUTCOME_COPY = {
|
|
192
|
+
withdrawn: (title) => `Back in this chat. ${title ?? 'The Task'} stopped working on it.`,
|
|
193
|
+
noted: (title) => `Back in this chat. ${title ?? 'The Task'} was told it wasn't for it.`,
|
|
194
|
+
untouched: (title) => `Back in this chat. It's still in ${title ?? 'the Task'} too.`,
|
|
195
|
+
};
|
|
196
|
+
/** Why "Not for this Task" was refused (`INBOUND_RETURN_REFUSALS`). */
|
|
197
|
+
exports.RETURN_REFUSAL_COPY = {
|
|
198
|
+
INBOUND_MESSAGE_NOT_FOUND: 'This message is no longer here.',
|
|
199
|
+
INBOUND_MESSAGE_NOT_FORWARDED: "This message isn't with a Task any more.",
|
|
200
|
+
INBOUND_MESSAGE_CHANGED: 'This message just changed. Try again.',
|
|
201
|
+
};
|
|
202
|
+
/** The sentence for a message brought back from a Task: a `returned` handling, or the answer's. */
|
|
203
|
+
function returnedSentence(returned) {
|
|
204
|
+
const copy = returned.taskOutcome ? exports.RETURN_OUTCOME_COPY[returned.taskOutcome] : undefined;
|
|
205
|
+
return copy ? copy(returned.from?.title) : 'Back in this chat.';
|
|
206
|
+
}
|
|
207
|
+
/** What a recorded handling says, or null when it adds nothing to the agent's own words. */
|
|
208
|
+
function handlingSentence(handling) {
|
|
209
|
+
if (!handling)
|
|
210
|
+
return null;
|
|
211
|
+
if (handling.kind === 'returned')
|
|
212
|
+
return returnedSentence(handling);
|
|
213
|
+
// Read from the cloud while the machine could not answer: what it left waits for the machine.
|
|
214
|
+
const cloud = (0, data_provider_1.messageCloudReply)({ communication: { cloudReply: handling.cloudReply } });
|
|
215
|
+
if (handling.kind === 'fallback') {
|
|
216
|
+
if (handling.target?.kind === 'session')
|
|
217
|
+
return exports.GLANCE_COPY.forwarded;
|
|
218
|
+
if (cloud && handling.reason === 'not_carried_out') {
|
|
219
|
+
return (0, cloud_reply_1.cloudHandlingSentence)(cloud, 'not_carried_out');
|
|
220
|
+
}
|
|
221
|
+
return (handling.reason && exports.FALLBACK_COPY[handling.reason]) || exports.FALLBACK_COPY.undecided;
|
|
222
|
+
}
|
|
223
|
+
if (handling.target?.kind === 'task') {
|
|
224
|
+
return handling.target.title ? `Sent to ${handling.target.title}.` : 'Sent to a Task.';
|
|
225
|
+
}
|
|
226
|
+
if (cloud && handling.by?.kind === 'glance' && handling.kind === 'deferred') {
|
|
227
|
+
return (0, cloud_reply_1.cloudHandlingSentence)(cloud, 'deferred');
|
|
228
|
+
}
|
|
229
|
+
if (handling.by?.kind === 'glance' && handling.kind in exports.GLANCE_COPY) {
|
|
230
|
+
return exports.GLANCE_COPY[handling.kind];
|
|
231
|
+
}
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
/* ── Sending ───────────────────────────────────────────────────────────── */
|
|
235
|
+
const MESSAGE_ID = /^[A-Za-z0-9_-]{8,200}$/;
|
|
236
|
+
/**
|
|
237
|
+
* The message id for one invocation's start key. The ingress takes letters, digits, `_` and `-`;
|
|
238
|
+
* a key outside that becomes a hash of itself, so a replay of the same invocation names the same
|
|
239
|
+
* message and two different keys never share one.
|
|
240
|
+
*/
|
|
241
|
+
function inboundMessageIdFor(startKey) {
|
|
242
|
+
if (MESSAGE_ID.test(startKey))
|
|
243
|
+
return startKey;
|
|
244
|
+
return `cli-${(0, node_crypto_1.createHash)('sha256').update(startKey).digest('hex').slice(0, 40)}`;
|
|
245
|
+
}
|
|
246
|
+
/** Whether a failed send came from a server that has no ingress (a 404 with no code of its own). */
|
|
247
|
+
function ingressMissing(err) {
|
|
248
|
+
if ((0, http_error_1.httpStatusOf)(err) !== 404)
|
|
249
|
+
return false;
|
|
250
|
+
const body = (0, agent_chat_start_1.bodyOf)(err);
|
|
251
|
+
const response = err?.response?.data;
|
|
252
|
+
return typeof body?.code !== 'string' && typeof response?.code !== 'string';
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Send the message `startAgenticChat(params)` would have started a turn with. The submission is
|
|
256
|
+
* the same body, frozen at send; the turn it starts (now or later) uses the ids chosen here.
|
|
257
|
+
*/
|
|
258
|
+
async function sendInboundMessage(params, { messageId, intent, deps = {}, }) {
|
|
259
|
+
const sessionId = (0, node_crypto_1.randomUUID)();
|
|
260
|
+
const responseMessageId = (0, node_crypto_1.randomUUID)();
|
|
261
|
+
const { clientRequestId: _key, ...body } = data_provider_1.dataService.buildAgenticChatBody(params);
|
|
262
|
+
void _key;
|
|
263
|
+
const send = deps.send ?? data_provider_1.dataService.sendConversationMessage;
|
|
264
|
+
const answer = await send(params.conversationId, {
|
|
265
|
+
capability: data_provider_1.INBOUND_MESSAGES_CAPABILITY,
|
|
266
|
+
clientMessageId: messageId,
|
|
267
|
+
text: params.text,
|
|
268
|
+
submission: { ...body, source: 'cli', sessionId, responseMessageId },
|
|
269
|
+
intent,
|
|
270
|
+
});
|
|
271
|
+
return { answer, messageId, sessionId, responseMessageId };
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* "Not for this Task": bring back a message the platform or a glance passed to a Task, and have it
|
|
275
|
+
* delivered in this conversation again. The Task is told, and its response stopped when it was
|
|
276
|
+
* for this message alone. A retry, or a second call, answers with the message as it is.
|
|
277
|
+
*/
|
|
278
|
+
async function returnInboundMessage(conversationId, messageId, deps = {}) {
|
|
279
|
+
const send = deps.send ?? data_provider_1.dataService.returnConversationMessage;
|
|
280
|
+
return send(conversationId, messageId, {
|
|
281
|
+
capability: data_provider_1.INBOUND_MESSAGES_CAPABILITY,
|
|
282
|
+
submission: { source: 'cli' },
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* The next step a person may take when their message went to a Task, or null when it did not (or
|
|
287
|
+
* already came back): bring it back to the conversation.
|
|
288
|
+
*/
|
|
289
|
+
function notForTaskHint(bin, conversationId, messageId, handling) {
|
|
290
|
+
if (!handling || handling.kind === 'returned' || handling.target?.kind !== 'task')
|
|
291
|
+
return null;
|
|
292
|
+
return (`Not for that Task? \`${bin} agents not-for-task ${messageId} --conversation ` +
|
|
293
|
+
`${conversationId}\` brings it back here.`);
|
|
294
|
+
}
|
|
295
|
+
/** The words for a refusal of "Not for this Task", or null when it is not one of its codes. */
|
|
296
|
+
function returnRefusalOf(err) {
|
|
297
|
+
const code = (0, agent_chat_start_1.bodyOf)(err)?.code ??
|
|
298
|
+
err?.response?.data?.code;
|
|
299
|
+
return typeof code === 'string' && code in exports.RETURN_REFUSAL_COPY
|
|
300
|
+
? exports.RETURN_REFUSAL_COPY[code]
|
|
301
|
+
: null;
|
|
302
|
+
}
|
|
303
|
+
function nextAfterSend(answer) {
|
|
304
|
+
if (!answer.route || answer.delivery?.state === 'failed')
|
|
305
|
+
return { kind: 'failed' };
|
|
306
|
+
const turn = answer.turn;
|
|
307
|
+
switch (answer.route) {
|
|
308
|
+
case 'new_turn':
|
|
309
|
+
case 'merged':
|
|
310
|
+
if (turn?.sessionId && turn.responseMessageId) {
|
|
311
|
+
return {
|
|
312
|
+
kind: 'turn',
|
|
313
|
+
sessionId: turn.sessionId,
|
|
314
|
+
responseMessageId: turn.responseMessageId,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
// A merge whose reply row is not known yet is answered by that turn; a new turn that did
|
|
318
|
+
// not start at once waits for its card.
|
|
319
|
+
return answer.route === 'merged' ? { kind: 'delivered' } : { kind: 'wait' };
|
|
320
|
+
case 'glance':
|
|
321
|
+
return { kind: 'glance' };
|
|
322
|
+
case 'command':
|
|
323
|
+
case 'hold':
|
|
324
|
+
return { kind: 'wait' };
|
|
325
|
+
default:
|
|
326
|
+
return { kind: 'delivered' };
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/** How long a glance can take to settle: its wall clock, its lease, and a margin. */
|
|
330
|
+
exports.GLANCE_WAIT_MS = data_provider_1.INBOUND_LIMITS.glanceWallClockMs + 15_000 + 10_000;
|
|
331
|
+
/**
|
|
332
|
+
* Wait for what a glance decided about one message: read the conversation until the message
|
|
333
|
+
* carries a glance's handling (or the platform's fallback), and pick up the reply that names it.
|
|
334
|
+
*/
|
|
335
|
+
async function waitForGlance(conversationId, messageId, { timeoutMs = exports.GLANCE_WAIT_MS, deps = {}, } = {}) {
|
|
336
|
+
const read = deps.messages ??
|
|
337
|
+
((id) => data_provider_1.dataService.getMessagesByConvoId(id));
|
|
338
|
+
const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
339
|
+
const now = deps.now ?? Date.now;
|
|
340
|
+
const deadline = now() + timeoutMs;
|
|
341
|
+
for (;;) {
|
|
342
|
+
const rows = (await read(conversationId)) ?? [];
|
|
343
|
+
const mine = rows.find((row) => row.messageId === messageId && row.isCreatedByUser);
|
|
344
|
+
const handlings = (mine?.delivery?.handling ?? []).filter((entry) => entry?.by?.kind === 'glance' || entry?.kind === 'fallback');
|
|
345
|
+
const handling = handlings.length > 0 ? handlings[handlings.length - 1] : null;
|
|
346
|
+
const replyRow = rows.find((row) => {
|
|
347
|
+
const replyTo = row.metadata?.communication?.replyTo;
|
|
348
|
+
return !row.isCreatedByUser && Array.isArray(replyTo) && replyTo.includes(messageId);
|
|
349
|
+
});
|
|
350
|
+
const cloudReply = replyRow ? (0, data_provider_1.messageCloudReply)(replyRow.metadata) : null;
|
|
351
|
+
const reply = replyRow?.messageId
|
|
352
|
+
? {
|
|
353
|
+
messageId: replyRow.messageId,
|
|
354
|
+
text: String(replyRow.text ?? ''),
|
|
355
|
+
...(cloudReply ? { cloudReply } : {}),
|
|
356
|
+
}
|
|
357
|
+
: null;
|
|
358
|
+
// A reply is sent before the rest of the decisions are carried out, so wait for the handling.
|
|
359
|
+
if (handling || now() >= deadline)
|
|
360
|
+
return { handling, reply };
|
|
361
|
+
await sleep(2_000);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* A message's delivery now, read from the conversation, or `null` when the message is gone (it was
|
|
366
|
+
* taken back from another screen). Used when its card leaves the queue without a turn of its own:
|
|
367
|
+
* it may have been read with another message.
|
|
368
|
+
*/
|
|
369
|
+
async function readMessageDelivery(conversationId, messageId, deps = {}) {
|
|
370
|
+
const read = deps.messages ??
|
|
371
|
+
((id) => data_provider_1.dataService.getMessagesByConvoId(id));
|
|
372
|
+
const rows = (await read(conversationId)) ?? [];
|
|
373
|
+
const row = rows.find((m) => m.messageId === messageId && m.isCreatedByUser);
|
|
374
|
+
return row ? { delivery: row.delivery ?? null } : null;
|
|
375
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ResolvedCredential } from '@skrr-ai/auth-core';
|
|
2
|
-
import type { AgentMessageSequence, EntityEmbed, MessageOperation } from '@skrr-ai/data-provider';
|
|
2
|
+
import type { AgentMessageReactionAnswer, AgentMessageSequence, EntityEmbed, MessageOperation, MessageReactionEmoji } from '@skrr-ai/data-provider';
|
|
3
3
|
export declare const CANONICAL_DESTINATION_KINDS: readonly ["app_owner_dm", "slack_owner_dm", "slack_channel", "agent_email"];
|
|
4
4
|
export type CanonicalDestinationKind = (typeof CANONICAL_DESTINATION_KINDS)[number];
|
|
5
5
|
export type CanonicalMessageDestination = {
|
|
@@ -67,6 +67,11 @@ export type CanonicalMessageIntentRequest = {
|
|
|
67
67
|
notificationPolicy?: 'normal' | 'silent';
|
|
68
68
|
/** Root main-message id for an Agent Chat Thread (app_owner_dm only). */
|
|
69
69
|
threadRootMessageId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The owner's messages this one answers (app_owner_dm only, 1-10 ids). The server proves each
|
|
72
|
+
* is the owner's own message in the conversation the reply lands in, or refuses the send.
|
|
73
|
+
*/
|
|
74
|
+
replyTo?: string[];
|
|
70
75
|
sequence?: AgentMessageSequence;
|
|
71
76
|
/** Optional work entities to render with an app-owner DM. */
|
|
72
77
|
context?: {
|
|
@@ -184,7 +189,17 @@ export declare function submitSessionMessageIntent({ context, request, env, boot
|
|
|
184
189
|
timeoutMs?: number;
|
|
185
190
|
fetchImpl?: typeof fetch;
|
|
186
191
|
}): Promise<CanonicalMessageIntentResponse>;
|
|
187
|
-
|
|
192
|
+
/**
|
|
193
|
+
* The Agent's emoji reaction to one of its owner's messages, from its own interactive session.
|
|
194
|
+
* Unlike a send, it never goes through the daemon's offline queue: a reaction that cannot reach
|
|
195
|
+
* the server now has nothing to keep, so it fails and the Agent can send a message instead.
|
|
196
|
+
*/
|
|
197
|
+
export declare function reactAsSession({ context, messageId, emoji, }: {
|
|
198
|
+
context: AgentSessionMessageContext;
|
|
199
|
+
messageId: string;
|
|
200
|
+
emoji: MessageReactionEmoji;
|
|
201
|
+
}): Promise<AgentMessageReactionAnswer>;
|
|
202
|
+
export declare function canonicalAppOwnerDmRequest({ agentId, embeds, text, idempotencyKey, taskId, spaceId, goalId, presentation, notificationPolicy, threadRootMessageId, replyTo, operation, }: {
|
|
188
203
|
agentId: string;
|
|
189
204
|
text: string;
|
|
190
205
|
idempotencyKey: string;
|
|
@@ -194,6 +209,7 @@ export declare function canonicalAppOwnerDmRequest({ agentId, embeds, text, idem
|
|
|
194
209
|
presentation?: CommunicationPresentation;
|
|
195
210
|
notificationPolicy?: 'normal' | 'silent';
|
|
196
211
|
threadRootMessageId?: string;
|
|
212
|
+
replyTo?: string[];
|
|
197
213
|
embeds?: EntityEmbed[];
|
|
198
214
|
operation?: MessageOperation;
|
|
199
215
|
}): CanonicalMessageIntentRequest;
|
|
@@ -6,6 +6,7 @@ exports.readAgentSessionMessageContext = readAgentSessionMessageContext;
|
|
|
6
6
|
exports.resolveMessageCommandSessionContext = resolveMessageCommandSessionContext;
|
|
7
7
|
exports.sessionCredential = sessionCredential;
|
|
8
8
|
exports.submitSessionMessageIntent = submitSessionMessageIntent;
|
|
9
|
+
exports.reactAsSession = reactAsSession;
|
|
9
10
|
exports.canonicalAppOwnerDmRequest = canonicalAppOwnerDmRequest;
|
|
10
11
|
exports.canonicalSlackChannelRequest = canonicalSlackChannelRequest;
|
|
11
12
|
exports.canonicalSlackOwnerDmRequest = canonicalSlackOwnerDmRequest;
|
|
@@ -14,6 +15,7 @@ const auth_core_1 = require("@skrr-ai/auth-core");
|
|
|
14
15
|
const loopback_http_1 = require("@skrr-ai/auth-core/loopback-http");
|
|
15
16
|
const api_fetch_1 = require("./api-fetch");
|
|
16
17
|
const daemonBroker_1 = require("./daemonBroker");
|
|
18
|
+
const inbound_messages_1 = require("./inbound-messages");
|
|
17
19
|
const runtime_context_1 = require("./runtime-context");
|
|
18
20
|
const DAEMON_MESSAGE_INTENT_TIMEOUT_MS = 10_000;
|
|
19
21
|
exports.CANONICAL_DESTINATION_KINDS = [
|
|
@@ -219,6 +221,10 @@ async function submitSessionMessageIntent({ context, request, env = process.env,
|
|
|
219
221
|
if (request.operation) {
|
|
220
222
|
throw new MessageIntentCliError('MESSAGE_OPERATION_UNAVAILABLE', 'This session sends through the daemon’s offline queue, which cannot correct, keep a status of, or withdraw an earlier message. Send a new message that says what changed.');
|
|
221
223
|
}
|
|
224
|
+
// Nor which message it answers: a quote of a message the server never proved is refused.
|
|
225
|
+
if (request.replyTo && request.replyTo.length > 0) {
|
|
226
|
+
throw new MessageIntentCliError('reply_to_offline_unsupported', inbound_messages_1.AGENT_REPLY_REFUSAL_COPY.reply_to_offline_unsupported);
|
|
227
|
+
}
|
|
222
228
|
return submitDaemonLoopbackMessageIntent({
|
|
223
229
|
context,
|
|
224
230
|
request,
|
|
@@ -236,7 +242,22 @@ async function submitSessionMessageIntent({ context, request, env = process.env,
|
|
|
236
242
|
credential: sessionCredential(context.token),
|
|
237
243
|
});
|
|
238
244
|
}
|
|
239
|
-
|
|
245
|
+
/**
|
|
246
|
+
* The Agent's emoji reaction to one of its owner's messages, from its own interactive session.
|
|
247
|
+
* Unlike a send, it never goes through the daemon's offline queue: a reaction that cannot reach
|
|
248
|
+
* the server now has nothing to keep, so it fails and the Agent can send a message instead.
|
|
249
|
+
*/
|
|
250
|
+
async function reactAsSession({ context, messageId, emoji, }) {
|
|
251
|
+
if (!context.sessionId) {
|
|
252
|
+
throw new MessageIntentCliError('SESSION_CONTEXT_MISSING', 'An Agent session reaction requires OVERSKY_SESSION_ID alongside OVERSKY_SESSION_TOKEN.');
|
|
253
|
+
}
|
|
254
|
+
return (0, api_fetch_1.apiFetch)(`/api/agentic/sessions/${encodeURIComponent(context.sessionId)}/message-reactions`, {
|
|
255
|
+
method: 'POST',
|
|
256
|
+
body: { messageId, emoji },
|
|
257
|
+
credential: sessionCredential(context.token),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function canonicalAppOwnerDmRequest({ agentId, embeds, text, idempotencyKey, taskId, spaceId, goalId, presentation, notificationPolicy, threadRootMessageId, replyTo, operation, }) {
|
|
240
261
|
return {
|
|
241
262
|
protocolVersion: 1,
|
|
242
263
|
agentId,
|
|
@@ -248,6 +269,7 @@ function canonicalAppOwnerDmRequest({ agentId, embeds, text, idempotencyKey, tas
|
|
|
248
269
|
...(presentation ? { presentation } : {}),
|
|
249
270
|
...(notificationPolicy ? { notificationPolicy } : {}),
|
|
250
271
|
...(threadRootMessageId ? { threadRootMessageId } : {}),
|
|
272
|
+
...(replyTo && replyTo.length > 0 ? { replyTo } : {}),
|
|
251
273
|
...(embeds && embeds.length > 0 ? { embeds } : {}),
|
|
252
274
|
...(taskId || spaceId || goalId
|
|
253
275
|
? {
|
|
@@ -23,12 +23,27 @@ export declare function gateExplanationLines(gate: GateLike): string[];
|
|
|
23
23
|
* one that never could. Nothing is printed for a single primary — the gate's note says that.
|
|
24
24
|
*/
|
|
25
25
|
export declare function placementTargetLines(gate: GateLike): string[];
|
|
26
|
+
type CapabilityRow = {
|
|
27
|
+
source?: string;
|
|
28
|
+
provider?: string;
|
|
29
|
+
capability?: string;
|
|
30
|
+
scope?: string;
|
|
31
|
+
status?: string;
|
|
32
|
+
attestation?: string;
|
|
33
|
+
reason?: string;
|
|
34
|
+
testedAt?: string;
|
|
35
|
+
expiresAt?: string | null;
|
|
36
|
+
};
|
|
26
37
|
/**
|
|
27
38
|
* The status word for a capability. A credential whose expiry has passed is `expired`, not the
|
|
28
|
-
* storage word `stale`, which gave no sign that time had run out.
|
|
39
|
+
* storage word `stale`, which gave no sign that time had run out. Access probed in another working
|
|
40
|
+
* directory is `unverified`, so it does not read as either refused or available.
|
|
29
41
|
*/
|
|
30
42
|
export declare function capabilityStatusLabel(capability: {
|
|
31
43
|
status?: string;
|
|
32
44
|
expiresAt?: string | null;
|
|
45
|
+
reason?: string | null;
|
|
33
46
|
}, now?: Date): string;
|
|
47
|
+
/** The lines for one row of "Where access comes from:". */
|
|
48
|
+
export declare function capabilityLines(capability: CapabilityRow, now?: Date): string[];
|
|
34
49
|
export {};
|
|
@@ -12,6 +12,7 @@ exports.sourceRefusalWords = sourceRefusalWords;
|
|
|
12
12
|
exports.gateExplanationLines = gateExplanationLines;
|
|
13
13
|
exports.placementTargetLines = placementTargetLines;
|
|
14
14
|
exports.capabilityStatusLabel = capabilityStatusLabel;
|
|
15
|
+
exports.capabilityLines = capabilityLines;
|
|
15
16
|
/** What a refused event-source code means, in words. An unknown code is printed as it is. */
|
|
16
17
|
const SOURCE_REFUSAL_WORDS = {
|
|
17
18
|
source_authorization_descriptor_invalid: 'authorization record incomplete (it names no id to check access against)',
|
|
@@ -149,9 +150,16 @@ function placementTargetLines(gate) {
|
|
|
149
150
|
return targets.map((target) => `#${target.index ?? '?'} ${target.role ?? 'target'} ${target.product ?? 'unknown'}` +
|
|
150
151
|
`${target.selector ? ` (${target.selector})` : ''}: ${placementTargetWords(target)}`);
|
|
151
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* The runtime probed this access from its own working directory, and the Agent works in another
|
|
155
|
+
* (OSK-20264). The server reports it `unknown`; it used to say `unavailable`, which read as refused
|
|
156
|
+
* access when nothing had been checked where the Agent works.
|
|
157
|
+
*/
|
|
158
|
+
const UNVERIFIED_DIRECTORY_REASON = 'runtime_working_directory_unprobed';
|
|
152
159
|
/**
|
|
153
160
|
* The status word for a capability. A credential whose expiry has passed is `expired`, not the
|
|
154
|
-
* storage word `stale`, which gave no sign that time had run out.
|
|
161
|
+
* storage word `stale`, which gave no sign that time had run out. Access probed in another working
|
|
162
|
+
* directory is `unverified`, so it does not read as either refused or available.
|
|
155
163
|
*/
|
|
156
164
|
function capabilityStatusLabel(capability, now = new Date()) {
|
|
157
165
|
const status = capability.status ?? 'unknown';
|
|
@@ -160,5 +168,29 @@ function capabilityStatusLabel(capability, now = new Date()) {
|
|
|
160
168
|
if (!Number.isNaN(expires) && expires <= now.getTime())
|
|
161
169
|
return 'expired';
|
|
162
170
|
}
|
|
171
|
+
if (status === 'unknown' && capability.reason === UNVERIFIED_DIRECTORY_REASON) {
|
|
172
|
+
return 'unverified';
|
|
173
|
+
}
|
|
163
174
|
return status;
|
|
164
175
|
}
|
|
176
|
+
const CAPABILITY_SOURCE_LABELS = {
|
|
177
|
+
event_payload: 'Event facts',
|
|
178
|
+
platform_grant: 'Platform-attested access',
|
|
179
|
+
local_harness: 'This machine’s tooling',
|
|
180
|
+
cloud_runtime: 'Runtime-scoped access',
|
|
181
|
+
};
|
|
182
|
+
/** The lines for one row of "Where access comes from:". */
|
|
183
|
+
function capabilityLines(capability, now = new Date()) {
|
|
184
|
+
const source = CAPABILITY_SOURCE_LABELS[capability.source ?? ''] ?? capability.source ?? 'unknown';
|
|
185
|
+
const lines = [
|
|
186
|
+
` ${source} · ${capability.provider} · ${capability.capability}${capability.scope ? ` · ${capability.scope}` : ''}: ${capabilityStatusLabel(capability, now)}`,
|
|
187
|
+
];
|
|
188
|
+
if (capability.status === 'unknown' && capability.reason === UNVERIFIED_DIRECTORY_REASON) {
|
|
189
|
+
lines.push(' The runtime checked this from its own working directory, not this Agent’s, so it is unverified in this directory: not known to be available or refused. Nothing that needs verified access will use it.', ' To verify it, set the runtime’s working directory to the Agent’s working directory.');
|
|
190
|
+
}
|
|
191
|
+
if (capability.testedAt)
|
|
192
|
+
lines.push(` Tested: ${capability.testedAt}${capability.expiresAt ? ` · expires ${capability.expiresAt}` : ''}`);
|
|
193
|
+
if (capability.attestation === 'machine')
|
|
194
|
+
lines.push(' Machine-attested; not platform-attested.');
|
|
195
|
+
return lines;
|
|
196
|
+
}
|
|
@@ -15,6 +15,8 @@ type TaskActionContext = {
|
|
|
15
15
|
}>;
|
|
16
16
|
/** The Task itself, when the caller has it. Without it, `assign_task` lists every way to assign. */
|
|
17
17
|
task?: TaskAssignmentState;
|
|
18
|
+
/** The server's reason code, which decides what `assign_task` is for. */
|
|
19
|
+
reasonCode?: unknown;
|
|
18
20
|
};
|
|
19
21
|
/**
|
|
20
22
|
* Documentation and display paths only. The server still owns allowedActions.
|
|
@@ -20,7 +20,10 @@ function taskActionRemedies(action, taskId, targetId, bin = 'skrr', context = {}
|
|
|
20
20
|
const task = (0, shell_quote_1.shellQuoteArg)(taskId);
|
|
21
21
|
const target = targetId ? (0, shell_quote_1.shellQuoteArg)(targetId) : '<id>';
|
|
22
22
|
if (action === 'assign_task') {
|
|
23
|
-
|
|
23
|
+
const remedies = context.reasonCode === 'started_without_assignee'
|
|
24
|
+
? startedTaskAssignRemedies(task, context.task)
|
|
25
|
+
: assignTaskRemedies(task, context.task);
|
|
26
|
+
return remedies.map((remedy) => ({
|
|
24
27
|
...remedy,
|
|
25
28
|
command: `${bin} ${remedy.command}`,
|
|
26
29
|
}));
|
|
@@ -61,9 +64,10 @@ function taskActionCommand(action, taskId, targetId, bin = 'skrr', context = {})
|
|
|
61
64
|
/**
|
|
62
65
|
* The commands that answer `assign_task`.
|
|
63
66
|
*
|
|
64
|
-
* The server says "Choose an executor and assignee" (or, for a started Task
|
|
65
|
-
*
|
|
66
|
-
* so the reader learned what was missing
|
|
67
|
+
* The server says "Choose an executor and assignee" (or, for a started Task
|
|
68
|
+
* nobody is assigned to, `started_without_assignee`, OSK-20258) and this used
|
|
69
|
+
* to point at `tasks assign --help`, so the reader learned what was missing
|
|
70
|
+
* and not how to supply it (OSK-24355).
|
|
67
71
|
*
|
|
68
72
|
* Assigning settles both halves: when no executor was declared, the server
|
|
69
73
|
* records the assignee's kind as the executor. `tasks update --execution-mode`
|
|
@@ -108,6 +112,26 @@ function assignTaskRemedies(task, state) {
|
|
|
108
112
|
},
|
|
109
113
|
];
|
|
110
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* The command that answers `assign_task` on a started Task nobody is assigned to (OSK-20258).
|
|
117
|
+
*
|
|
118
|
+
* Somebody took it up, so the assignment names the person working it. The Agent path is not
|
|
119
|
+
* offered: an Agent assignee makes the Task Agent-ready work to start while that person may still
|
|
120
|
+
* be at it. A declared Agent executor also needs the switch to human execution. Assigning a person
|
|
121
|
+
* alone is refused there, so the one command carries both. Without the Task's state the caller
|
|
122
|
+
* cannot tell, and the flag is right for every executor.
|
|
123
|
+
*/
|
|
124
|
+
function startedTaskAssignRemedies(task, state) {
|
|
125
|
+
const declaredAgent = !state || state.executionMode === 'agent';
|
|
126
|
+
return [
|
|
127
|
+
declaredAgent
|
|
128
|
+
? {
|
|
129
|
+
command: `tasks assign ${task} <person> --execution-mode human`,
|
|
130
|
+
what: 'the person working it does it',
|
|
131
|
+
}
|
|
132
|
+
: { command: `tasks assign ${task} <person>`, what: 'the person working it does it' },
|
|
133
|
+
];
|
|
134
|
+
}
|
|
111
135
|
function hasIds(values) {
|
|
112
136
|
return Array.isArray(values) && values.some(Boolean);
|
|
113
137
|
}
|
|
@@ -138,6 +138,7 @@ function taskPreflightLines(report, bin = 'skrr') {
|
|
|
138
138
|
for (const action of a.allowedActions) {
|
|
139
139
|
const rows = (0, task_operations_1.taskActionRemedyRows)((0, task_operations_1.taskActionRemedies)(action.action, report.taskId, action.targetId, bin, {
|
|
140
140
|
allowedActions: a.allowedActions,
|
|
141
|
+
reasonCode: a.reasonCode,
|
|
141
142
|
}));
|
|
142
143
|
if (rows.length === 0)
|
|
143
144
|
lines.push(` ${action.action} (no single CLI remedy is mapped)`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a move into review means when no Review is owed.
|
|
3
|
+
*
|
|
4
|
+
* Review is where a Review the Task's own `reviewPolicy` requires is waited for. Under `none`
|
|
5
|
+
* (the default) nobody owes one, so a Task parked there waits on a person who was never asked:
|
|
6
|
+
* thousands sat in review that way (OSK-33196). The move still lands; this says what it means,
|
|
7
|
+
* at the moment an agent made it.
|
|
8
|
+
*
|
|
9
|
+
* Every CLI door that moves a Task reads it from here. It used to live in `tasks move` alone,
|
|
10
|
+
* and `tasks bulk-update` moved 181 finished Tasks into review in one session without a word
|
|
11
|
+
* (OSK-33194).
|
|
12
|
+
*/
|
|
13
|
+
/** True when the moved Task now waits in review for a Review nobody owes it. */
|
|
14
|
+
export declare function waitsForUnowedReview(task: unknown): boolean;
|
|
15
|
+
/** The notice for one Task, or null when it is not waiting for an unowed Review. */
|
|
16
|
+
export declare function unowedReviewNotice(task: unknown, bin: string): string | null;
|
|
17
|
+
/**
|
|
18
|
+
* One notice for several moved Tasks, naming them, or null when none waits for an unowed Review.
|
|
19
|
+
* A bulk move says it once rather than once per row.
|
|
20
|
+
*/
|
|
21
|
+
export declare function unowedReviewSummary(labels: string[], bin: string): string | null;
|