@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,17 @@
|
|
|
1
|
+
import { type ChatStopPreview, type ChatStopReceipt, type StopScope, type ChatStopTaskOutcome } from '@skrr-ai/data-provider';
|
|
2
|
+
/**
|
|
3
|
+
* Stop in an Agent's chat from a terminal (inbound messages, decision D9): what Stop all would
|
|
4
|
+
* stop, the stop itself, and the CLI's words for its receipt. A plain Stop stops the
|
|
5
|
+
* conversation's own work and never a Task; `--all` also stops the Tasks it launched.
|
|
6
|
+
*/
|
|
7
|
+
/** What became of a Task Stop all looked at, after its name. One entry per outcome. */
|
|
8
|
+
export declare const STOP_TASK_OUTCOME_WORDS: Record<ChatStopTaskOutcome, string>;
|
|
9
|
+
export declare function readStopPreview(conversationId: string): Promise<ChatStopPreview>;
|
|
10
|
+
export declare function requestStop(conversationId: string, scope: StopScope, stopId: string): Promise<ChatStopReceipt>;
|
|
11
|
+
/** The receipt as lines: what stopped, what keeps running, and that nothing is undone. */
|
|
12
|
+
export declare function describeStopReceipt(receipt: ChatStopReceipt, hint: {
|
|
13
|
+
bin: string;
|
|
14
|
+
conversationId: string;
|
|
15
|
+
}): string[];
|
|
16
|
+
/** The preview as lines, for `--dry-run`. */
|
|
17
|
+
export declare function describeStopPreview(preview: ChatStopPreview): string[];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STOP_TASK_OUTCOME_WORDS = void 0;
|
|
4
|
+
exports.readStopPreview = readStopPreview;
|
|
5
|
+
exports.requestStop = requestStop;
|
|
6
|
+
exports.describeStopReceipt = describeStopReceipt;
|
|
7
|
+
exports.describeStopPreview = describeStopPreview;
|
|
8
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
9
|
+
/**
|
|
10
|
+
* Stop in an Agent's chat from a terminal (inbound messages, decision D9): what Stop all would
|
|
11
|
+
* stop, the stop itself, and the CLI's words for its receipt. A plain Stop stops the
|
|
12
|
+
* conversation's own work and never a Task; `--all` also stops the Tasks it launched.
|
|
13
|
+
*/
|
|
14
|
+
/** What became of a Task Stop all looked at, after its name. One entry per outcome. */
|
|
15
|
+
exports.STOP_TASK_OUTCOME_WORDS = {
|
|
16
|
+
stopped: 'stopped',
|
|
17
|
+
not_running: 'had already finished',
|
|
18
|
+
not_allowed: 'not stopped: you can no longer change it',
|
|
19
|
+
unconfirmed: 'may still be running; stop it from its own card',
|
|
20
|
+
};
|
|
21
|
+
function readStopPreview(conversationId) {
|
|
22
|
+
return data_provider_1.dataService.getConversationStopPreview(conversationId);
|
|
23
|
+
}
|
|
24
|
+
function requestStop(conversationId, scope, stopId) {
|
|
25
|
+
return data_provider_1.dataService.stopConversationWork(conversationId, { scope, stopId });
|
|
26
|
+
}
|
|
27
|
+
function names(tasks) {
|
|
28
|
+
return tasks.map(data_provider_1.chatStopTaskName).join(', ');
|
|
29
|
+
}
|
|
30
|
+
const tasksWord = (count) => (count === 1 ? 'Task' : 'Tasks');
|
|
31
|
+
/** The receipt as lines: what stopped, what keeps running, and that nothing is undone. */
|
|
32
|
+
function describeStopReceipt(receipt, hint) {
|
|
33
|
+
const lines = [];
|
|
34
|
+
const stopped = receipt.tasks.filter((task) => task.outcome === 'stopped');
|
|
35
|
+
if (receipt.workStopped)
|
|
36
|
+
lines.push('Stopped what your agent was doing in this conversation.');
|
|
37
|
+
else
|
|
38
|
+
lines.push('Your agent was not working in this conversation.');
|
|
39
|
+
for (const task of receipt.tasks) {
|
|
40
|
+
lines.push(` ${(0, data_provider_1.chatStopTaskName)(task)}: ${exports.STOP_TASK_OUTCOME_WORDS[task.outcome]}`);
|
|
41
|
+
}
|
|
42
|
+
const still = receipt.stillRunning;
|
|
43
|
+
if (still && still.length > 0) {
|
|
44
|
+
const count = still.length;
|
|
45
|
+
lines.push(receipt.scope === 'all'
|
|
46
|
+
? `${count} ${tasksWord(count)} it started may still be running: ${names(still)}.`
|
|
47
|
+
: `${count} ${tasksWord(count)} it started from here ${count === 1 ? 'keeps' : 'keep'} running: ${names(still)}. ` +
|
|
48
|
+
`Stop them too with \`${hint.bin} agents stop --conversation ${hint.conversationId} --all\`.`);
|
|
49
|
+
}
|
|
50
|
+
if (receipt.workStopped || stopped.length > 0) {
|
|
51
|
+
lines.push('What was already done is not undone.');
|
|
52
|
+
}
|
|
53
|
+
return lines;
|
|
54
|
+
}
|
|
55
|
+
/** The preview as lines, for `--dry-run`. */
|
|
56
|
+
function describeStopPreview(preview) {
|
|
57
|
+
const lines = [
|
|
58
|
+
preview.workRunning
|
|
59
|
+
? 'Your agent is working in this conversation; Stop stops that.'
|
|
60
|
+
: 'Your agent is not working in this conversation.',
|
|
61
|
+
];
|
|
62
|
+
if (preview.tasks.length === 0) {
|
|
63
|
+
lines.push('No Task it started from here is running.');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const count = preview.tasks.length;
|
|
67
|
+
lines.push(`--all also stops ${count} ${tasksWord(count)} it started from here: ${names(preview.tasks)}.`);
|
|
68
|
+
}
|
|
69
|
+
return lines;
|
|
70
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An agent that answered from the cloud while its machine could not (inbound messages, decision
|
|
3
|
+
* D4). The sentences match the web's (`client/src/components/Chat/Messages/Delivery/
|
|
4
|
+
* cloudReplyCopy.ts`), and each table is a `Record` over the contract's closed list, so a new
|
|
5
|
+
* reason does not compile without words here.
|
|
6
|
+
*/
|
|
7
|
+
import { type CloudReplyReason, type CloudReplySettingRefusal, type MessageCloudReply } from '@skrr-ai/data-provider';
|
|
8
|
+
type Named = (machine?: string) => string;
|
|
9
|
+
/** The label on the agent message, and what became of the person's message. */
|
|
10
|
+
export declare const CLOUD_REPLY_COPY: Record<CloudReplyReason, {
|
|
11
|
+
label: Named;
|
|
12
|
+
deferred: Named;
|
|
13
|
+
notCarriedOut: Named;
|
|
14
|
+
}>;
|
|
15
|
+
/** The label for an agent message's metadata, or null when it was not written from the cloud. */
|
|
16
|
+
export declare function cloudReplyLine(metadata: unknown): string | null;
|
|
17
|
+
/** What a handling written from the cloud says, for the decisions whose words differ. */
|
|
18
|
+
export declare function cloudHandlingSentence(cloud: MessageCloudReply, kind: 'deferred' | 'not_carried_out'): string;
|
|
19
|
+
/** Why the setting could not be turned on. */
|
|
20
|
+
export declare const CLOUD_REPLY_SETTING_REFUSAL_COPY: Record<CloudReplySettingRefusal, string>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLOUD_REPLY_SETTING_REFUSAL_COPY = exports.CLOUD_REPLY_COPY = void 0;
|
|
4
|
+
exports.cloudReplyLine = cloudReplyLine;
|
|
5
|
+
exports.cloudHandlingSentence = cloudHandlingSentence;
|
|
6
|
+
/**
|
|
7
|
+
* An agent that answered from the cloud while its machine could not (inbound messages, decision
|
|
8
|
+
* D4). The sentences match the web's (`client/src/components/Chat/Messages/Delivery/
|
|
9
|
+
* cloudReplyCopy.ts`), and each table is a `Record` over the contract's closed list, so a new
|
|
10
|
+
* reason does not compile without words here.
|
|
11
|
+
*/
|
|
12
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
13
|
+
const UNTIL_WORK_ENDS = "It will take it up when it finishes what it's doing.";
|
|
14
|
+
/** The label on the agent message, and what became of the person's message. */
|
|
15
|
+
exports.CLOUD_REPLY_COPY = {
|
|
16
|
+
machine_offline: {
|
|
17
|
+
label: (m) => m
|
|
18
|
+
? `From the cloud: ${m} was offline, so your agent couldn't see its files.`
|
|
19
|
+
: "From the cloud: your agent's machine was offline, so it couldn't see its files.",
|
|
20
|
+
deferred: (m) => m
|
|
21
|
+
? `Your agent will take this up on ${m} when it's back.`
|
|
22
|
+
: 'Your agent will take this up when its machine is back.',
|
|
23
|
+
notCarriedOut: (m) => m
|
|
24
|
+
? `Your agent couldn't do this from the cloud. It will take it up on ${m} when it's back.`
|
|
25
|
+
: "Your agent couldn't do this from the cloud. It will take it up when its machine is back.",
|
|
26
|
+
},
|
|
27
|
+
machine_busy: {
|
|
28
|
+
label: (m) => m
|
|
29
|
+
? `From the cloud: ${m} was busy, so your agent couldn't see its files.`
|
|
30
|
+
: "From the cloud: your agent's machine was busy, so it couldn't see its files.",
|
|
31
|
+
// A busy machine still runs the work: what waits there waits for that work.
|
|
32
|
+
deferred: () => "Your agent will take this up when it finishes what it's doing.",
|
|
33
|
+
notCarriedOut: () => `Your agent couldn't do this from the cloud. ${UNTIL_WORK_ENDS}`,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
/** The label for an agent message's metadata, or null when it was not written from the cloud. */
|
|
37
|
+
function cloudReplyLine(metadata) {
|
|
38
|
+
const cloud = (0, data_provider_1.messageCloudReply)(metadata);
|
|
39
|
+
return cloud ? exports.CLOUD_REPLY_COPY[cloud.reason].label(cloud.machineName) : null;
|
|
40
|
+
}
|
|
41
|
+
/** What a handling written from the cloud says, for the decisions whose words differ. */
|
|
42
|
+
function cloudHandlingSentence(cloud, kind) {
|
|
43
|
+
const copy = exports.CLOUD_REPLY_COPY[cloud.reason];
|
|
44
|
+
return kind === 'deferred'
|
|
45
|
+
? copy.deferred(cloud.machineName)
|
|
46
|
+
: copy.notCarriedOut(cloud.machineName);
|
|
47
|
+
}
|
|
48
|
+
/** Why the setting could not be turned on. */
|
|
49
|
+
exports.CLOUD_REPLY_SETTING_REFUSAL_COPY = {
|
|
50
|
+
cloud_reply_needs_cloud_target: "Answering from the cloud needs a cloud runtime in this agent's runtime order. Add an Agent " +
|
|
51
|
+
'Worker or a Hosted Machine to it, then turn this on.',
|
|
52
|
+
};
|
package/dist/lib/duties.js
CHANGED
|
@@ -225,7 +225,8 @@ exports.dutyApi = {
|
|
|
225
225
|
livenessSweep: () => data_provider_2.request.get('/api/duties/liveness/sweep'),
|
|
226
226
|
/** One agent's Duties, system roles included, each with its loop status. */
|
|
227
227
|
roster: (agentId) => data_provider_2.request.get((0, triggers_1.withQuery)('/api/duties/roster', {
|
|
228
|
-
agentId,
|
|
228
|
+
agentId,
|
|
229
|
+
coverage: 'current-agent',
|
|
229
230
|
})),
|
|
230
231
|
/** Is this Duty's loop installed and working. */
|
|
231
232
|
loopStatus: (id, currentContractFallback = false) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/loop-status`, {
|
|
@@ -1277,9 +1278,17 @@ function describeOperationFix(duty, operation) {
|
|
|
1277
1278
|
// its remedy are facts about that Run and stay true. Dropping them was
|
|
1278
1279
|
// exactly the case being fixed: paused after a refusal, contract edited since.
|
|
1279
1280
|
// The label says which Run the sentence is about instead.
|
|
1281
|
+
//
|
|
1282
|
+
// That holds only for a remedy of a failure code. A fix without a code
|
|
1283
|
+
// describes a condition the sweep saw (a run held for review, an owner
|
|
1284
|
+
// blocker), and a superseded verdict means the read no longer sees it:
|
|
1285
|
+
// printing "review and close it" for a hold already closed sent the owner
|
|
1286
|
+
// to a review that no longer existed (OSK-33237).
|
|
1280
1287
|
const liveness = duty.state?.liveness;
|
|
1281
1288
|
const lastRunFix = liveness && typeof liveness.diagnosisFix === 'string' ? liveness.diagnosisFix.trim() : '';
|
|
1282
|
-
|
|
1289
|
+
const conditionGone = liveness?.current === false &&
|
|
1290
|
+
!(typeof liveness.diagnosisCode === 'string' && liveness.diagnosisCode);
|
|
1291
|
+
if (lastRunFix && lastRunFix !== remediation && !conditionGone) {
|
|
1283
1292
|
lines.push({ label: lastRunLabel(liveness, lines.length > 0), text: lastRunFix });
|
|
1284
1293
|
}
|
|
1285
1294
|
return lines;
|
|
@@ -1838,7 +1847,14 @@ function renderDutyLedger(ledger, log) {
|
|
|
1838
1847
|
turns: describeRunCount(record(item.usage), 'turns'),
|
|
1839
1848
|
tools: describeRunCount(record(item.usage), 'toolCallCount'),
|
|
1840
1849
|
reason: text(firstValue(item, ['reason', 'error']), ''),
|
|
1841
|
-
finished: text(firstValue(item, [
|
|
1850
|
+
finished: text(firstValue(item, [
|
|
1851
|
+
'completedAt',
|
|
1852
|
+
'updatedAt',
|
|
1853
|
+
'claimedAt',
|
|
1854
|
+
'queuedAt',
|
|
1855
|
+
'reservedAt',
|
|
1856
|
+
'startedAt',
|
|
1857
|
+
])),
|
|
1842
1858
|
})), [
|
|
1843
1859
|
{ key: 'id', header: 'RUN ID', verbatim: true },
|
|
1844
1860
|
{ key: 'status', header: 'STATUS', maxWidth: 12 },
|
|
@@ -2294,7 +2310,11 @@ function wakeOutcomeLines(run) {
|
|
|
2294
2310
|
function formatDutyExplanation(explanation) {
|
|
2295
2311
|
const cycle = explanation.cycle;
|
|
2296
2312
|
const wakeSaved = isRecordedDutyWake(cycle);
|
|
2297
|
-
const outcomeWord = wakeSaved
|
|
2313
|
+
const outcomeWord = wakeSaved
|
|
2314
|
+
? 'wake saved'
|
|
2315
|
+
: cycle?.confirmedDelivery
|
|
2316
|
+
? 'delivered'
|
|
2317
|
+
: cycle?.outcome;
|
|
2298
2318
|
const lines = [
|
|
2299
2319
|
cycle
|
|
2300
2320
|
? `Latest cycle: ${cycleTime(cycle.startedAt)} ${outcomeWord} (${cycle.id})`
|
package/dist/lib/duty-ledgers.js
CHANGED
|
@@ -106,20 +106,35 @@ function renderReflection(review, log) {
|
|
|
106
106
|
{ key: 'check', header: 'CHECK' },
|
|
107
107
|
], log);
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* What a row says about a refuted step (OSK-33241): how many times it was refuted, and when it may
|
|
111
|
+
* be tried again, or, on a re-apply after the wait, when that wait ended. Empty for any other row.
|
|
112
|
+
*/
|
|
113
|
+
function refutation(row) {
|
|
114
|
+
const count = typeof row.refutedCount === 'number' ? `${row.refutedCount}×` : '';
|
|
115
|
+
const until = text(row.retryAfter, '');
|
|
116
|
+
const decided = Date.parse(text(row.decidedAt, ''));
|
|
117
|
+
const waitEnded = Boolean(until) && Number.isFinite(decided) && Date.parse(until) <= decided;
|
|
118
|
+
const wait = until ? `${waitEnded ? 'wait ended' : 'retry after'} ${until}` : '';
|
|
119
|
+
return [count, wait].filter(Boolean).join(' · ');
|
|
120
|
+
}
|
|
109
121
|
function renderCadenceDecisions(list, log) {
|
|
110
122
|
const rows = (Array.isArray(list?.data) ? list.data : []);
|
|
111
123
|
if (rows.length === 0) {
|
|
112
124
|
log('No cadence decisions recorded.');
|
|
113
125
|
return;
|
|
114
126
|
}
|
|
115
|
-
|
|
127
|
+
const refuted = rows.map(refutation);
|
|
128
|
+
(0, format_1.renderTable)(rows.map((row, index) => ({
|
|
116
129
|
when: text(row.decidedAt),
|
|
117
130
|
mode: text(row.mode),
|
|
118
131
|
disposition: text(row.disposition),
|
|
119
132
|
direction: text(row.direction),
|
|
120
133
|
interval: `${minutes(row.currentIntervalMs)} → ${minutes(row.candidateIntervalMs)}`,
|
|
121
134
|
confidence: typeof row.confidence === 'number' ? row.confidence.toFixed(2) : '-',
|
|
122
|
-
|
|
135
|
+
// A `recently_refuted` hold names the signal it set aside.
|
|
136
|
+
reason: brief(row.signalReason ? `${text(row.reason)} (${text(row.signalReason)})` : row.reason, 70),
|
|
137
|
+
refuted: refuted[index] || '-',
|
|
123
138
|
})), [
|
|
124
139
|
{ key: 'when', header: 'DECIDED' },
|
|
125
140
|
{ key: 'mode', header: 'MODE' },
|
|
@@ -128,5 +143,7 @@ function renderCadenceDecisions(list, log) {
|
|
|
128
143
|
{ key: 'interval', header: 'INTERVAL' },
|
|
129
144
|
{ key: 'confidence', header: 'CONFIDENCE' },
|
|
130
145
|
{ key: 'reason', header: 'REASON', maxWidth: 70 },
|
|
146
|
+
// Only when a row has something to say, so a ledger with no refutation reads as before.
|
|
147
|
+
...(refuted.some(Boolean) ? [{ key: 'refuted', header: 'REFUTED' }] : []),
|
|
131
148
|
], log);
|
|
132
149
|
}
|
package/dist/lib/file-mime.js
CHANGED
|
@@ -35,6 +35,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.mimeTypeForFilename = mimeTypeForFilename;
|
|
37
37
|
const path = __importStar(require("node:path"));
|
|
38
|
+
// JavaScript and TypeScript source keeps the labels the generic file endpoint
|
|
39
|
+
// accepts (`text/javascript`, `application/typescript`). A Task stores it as
|
|
40
|
+
// plain text under its own name and only ever serves it as a download
|
|
41
|
+
// (OSK-20289), so the label is a declaration, not how the file is served.
|
|
38
42
|
const MIME_TYPES = {
|
|
39
43
|
'.3gp': 'video/3gp',
|
|
40
44
|
'.aac': 'audio/aac',
|
|
@@ -43,6 +47,7 @@ const MIME_TYPES = {
|
|
|
43
47
|
'.cjs': 'text/javascript',
|
|
44
48
|
'.cpp': 'text/x-c++',
|
|
45
49
|
'.cs': 'text/x-csharp',
|
|
50
|
+
'.cts': 'application/typescript',
|
|
46
51
|
'.css': 'text/css',
|
|
47
52
|
'.csv': 'text/csv',
|
|
48
53
|
'.cxx': 'text/x-c++',
|
|
@@ -63,6 +68,7 @@ const MIME_TYPES = {
|
|
|
63
68
|
'.jpg': 'image/jpeg',
|
|
64
69
|
'.js': 'text/javascript',
|
|
65
70
|
'.json': 'application/json',
|
|
71
|
+
'.jsx': 'text/javascript',
|
|
66
72
|
// A stream of JSON values is text evidence, not one JSON document.
|
|
67
73
|
// Preserve the original bytes and filename rather than forcing an array.
|
|
68
74
|
'.jsonl': 'text/plain',
|
|
@@ -74,6 +80,7 @@ const MIME_TYPES = {
|
|
|
74
80
|
'.mjs': 'text/javascript',
|
|
75
81
|
'.mkv': 'video/mkv',
|
|
76
82
|
'.mov': 'video/quicktime',
|
|
83
|
+
'.mts': 'application/typescript',
|
|
77
84
|
'.mp3': 'audio/mpeg',
|
|
78
85
|
'.mp4': 'video/mp4',
|
|
79
86
|
'.ogv': 'video/ogv',
|
|
@@ -92,6 +99,7 @@ const MIME_TYPES = {
|
|
|
92
99
|
'.tex': 'text/x-tex',
|
|
93
100
|
'.txt': 'text/plain',
|
|
94
101
|
'.ts': 'application/typescript',
|
|
102
|
+
'.tsx': 'application/typescript',
|
|
95
103
|
'.tsv': 'text/tab-separated-values',
|
|
96
104
|
'.vtt': 'text/vtt',
|
|
97
105
|
'.wav': 'audio/wav',
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { dataService, type AgentReplyRefusal, type GlanceDecisionKind, type GlanceFallbackReason, type InboundMessageAccepted, type InboundMessageReturned, type InboundReturnRefusal, type InboundReturnTaskOutcome, type InboundRoute, type InboundSendIntent, type MessageDelivery, type MessageDeliveryHandling, type MessageDeliveryHeld, type MessageFailedReason, type MessageHeldReason, type MessageReactionEmoji, type MessageCloudReply } from '@skrr-ai/data-provider';
|
|
2
|
+
type AgenticChatParams = Parameters<typeof dataService.startAgenticChat>[0];
|
|
3
|
+
type HeldDetail = MessageDeliveryHeld['detail'];
|
|
4
|
+
export declare const HELD_COPY: Record<MessageHeldReason, (detail?: HeldDetail) => string>;
|
|
5
|
+
export declare const FAILED_COPY: Record<MessageFailedReason, string>;
|
|
6
|
+
/** What the route says the moment the message is kept, before anything read it. */
|
|
7
|
+
export declare const ROUTE_COPY: Record<InboundRoute, string>;
|
|
8
|
+
/** A glance's decision. `null` where the agent's own words are the whole answer. */
|
|
9
|
+
export declare const GLANCE_COPY: Record<GlanceDecisionKind, string | null>;
|
|
10
|
+
export declare const FALLBACK_COPY: Record<GlanceFallbackReason, string>;
|
|
11
|
+
/** A reply or reaction the server refused, in the CLI's words. */
|
|
12
|
+
export declare const AGENT_REPLY_REFUSAL_COPY: Record<AgentReplyRefusal, string>;
|
|
13
|
+
/**
|
|
14
|
+
* `--reply-to` (or a payload's `replyTo`): absent is `null`; otherwise 1-10 message ids, trimmed
|
|
15
|
+
* and without repeats. The server proves each one; this only refuses a list it could never accept.
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeReplyTo(value: unknown): string[] | null | 'invalid';
|
|
18
|
+
/**
|
|
19
|
+
* A reply or reaction the server refused, when it named a refusal this CLI knows: the code, and
|
|
20
|
+
* the ids a reply could not prove. The DM route names it `errorType`, the session gateway `reason`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function agentReplyRefusalOf(err: unknown): {
|
|
23
|
+
code: AgentReplyRefusal;
|
|
24
|
+
missing?: string[];
|
|
25
|
+
} | null;
|
|
26
|
+
/** A plain name for each reaction, so a terminal never has to type an emoji. */
|
|
27
|
+
export declare const REACTION_NAMES: Record<MessageReactionEmoji, string>;
|
|
28
|
+
/** An emoji, or its plain name, as one of the contract's reactions; null when it is neither. */
|
|
29
|
+
export declare function reactionFromInput(input: string): MessageReactionEmoji | null;
|
|
30
|
+
/** The one sentence for a message's delivery, as a surface draws it. */
|
|
31
|
+
export declare function deliverySentence(delivery: MessageDelivery | null | undefined): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* "Not for this Task" (Q6): the message is back in this conversation, and what became of the Task
|
|
34
|
+
* it had gone to. The web's words (`deliveryCopy.ts`, `RETURN_COPY`), with and without the title.
|
|
35
|
+
*/
|
|
36
|
+
export declare const RETURN_OUTCOME_COPY: Record<InboundReturnTaskOutcome, (title?: string) => string>;
|
|
37
|
+
/** Why "Not for this Task" was refused (`INBOUND_RETURN_REFUSALS`). */
|
|
38
|
+
export declare const RETURN_REFUSAL_COPY: Record<InboundReturnRefusal, string>;
|
|
39
|
+
/** The sentence for a message brought back from a Task: a `returned` handling, or the answer's. */
|
|
40
|
+
export declare function returnedSentence(returned: Pick<MessageDeliveryHandling, 'from'> & {
|
|
41
|
+
taskOutcome?: InboundReturnTaskOutcome | null;
|
|
42
|
+
}): string;
|
|
43
|
+
/** What a recorded handling says, or null when it adds nothing to the agent's own words. */
|
|
44
|
+
export declare function handlingSentence(handling: MessageDeliveryHandling | undefined): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* The message id for one invocation's start key. The ingress takes letters, digits, `_` and `-`;
|
|
47
|
+
* a key outside that becomes a hash of itself, so a replay of the same invocation names the same
|
|
48
|
+
* message and two different keys never share one.
|
|
49
|
+
*/
|
|
50
|
+
export declare function inboundMessageIdFor(startKey: string): string;
|
|
51
|
+
/** Whether a failed send came from a server that has no ingress (a 404 with no code of its own). */
|
|
52
|
+
export declare function ingressMissing(err: unknown): boolean;
|
|
53
|
+
export interface InboundSend {
|
|
54
|
+
answer: InboundMessageAccepted;
|
|
55
|
+
messageId: string;
|
|
56
|
+
/** The turn the message starts when it waits first: the CLI chooses its ids, so it can follow. */
|
|
57
|
+
sessionId: string;
|
|
58
|
+
responseMessageId: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Send the message `startAgenticChat(params)` would have started a turn with. The submission is
|
|
62
|
+
* the same body, frozen at send; the turn it starts (now or later) uses the ids chosen here.
|
|
63
|
+
*/
|
|
64
|
+
export declare function sendInboundMessage(params: AgenticChatParams & {
|
|
65
|
+
conversationId: string;
|
|
66
|
+
}, { messageId, intent, deps, }: {
|
|
67
|
+
messageId: string;
|
|
68
|
+
intent: InboundSendIntent;
|
|
69
|
+
deps?: {
|
|
70
|
+
send?: typeof dataService.sendConversationMessage;
|
|
71
|
+
};
|
|
72
|
+
}): Promise<InboundSend>;
|
|
73
|
+
/**
|
|
74
|
+
* "Not for this Task": bring back a message the platform or a glance passed to a Task, and have it
|
|
75
|
+
* delivered in this conversation again. The Task is told, and its response stopped when it was
|
|
76
|
+
* for this message alone. A retry, or a second call, answers with the message as it is.
|
|
77
|
+
*/
|
|
78
|
+
export declare function returnInboundMessage(conversationId: string, messageId: string, deps?: {
|
|
79
|
+
send?: typeof dataService.returnConversationMessage;
|
|
80
|
+
}): Promise<InboundMessageReturned>;
|
|
81
|
+
/**
|
|
82
|
+
* The next step a person may take when their message went to a Task, or null when it did not (or
|
|
83
|
+
* already came back): bring it back to the conversation.
|
|
84
|
+
*/
|
|
85
|
+
export declare function notForTaskHint(bin: string, conversationId: string, messageId: string, handling: MessageDeliveryHandling | null | undefined): string | null;
|
|
86
|
+
/** The words for a refusal of "Not for this Task", or null when it is not one of its codes. */
|
|
87
|
+
export declare function returnRefusalOf(err: unknown): string | null;
|
|
88
|
+
/**
|
|
89
|
+
* What the CLI does next with an accepted message.
|
|
90
|
+
* - `turn`: it started (or joined) a turn whose reply the CLI can stream.
|
|
91
|
+
* - `wait`: it waits for a turn of its own; follow its queue card, then stream that turn.
|
|
92
|
+
* - `glance`: the agent is reading it while it works; wait for what it decided.
|
|
93
|
+
* - `delivered`: it reached the agent and there is no reply of its own to stream.
|
|
94
|
+
* - `failed`: it will not be read as it is.
|
|
95
|
+
*/
|
|
96
|
+
export type InboundNext = {
|
|
97
|
+
kind: 'turn';
|
|
98
|
+
sessionId: string;
|
|
99
|
+
responseMessageId: string;
|
|
100
|
+
} | {
|
|
101
|
+
kind: 'wait';
|
|
102
|
+
} | {
|
|
103
|
+
kind: 'glance';
|
|
104
|
+
} | {
|
|
105
|
+
kind: 'delivered';
|
|
106
|
+
} | {
|
|
107
|
+
kind: 'failed';
|
|
108
|
+
};
|
|
109
|
+
export declare function nextAfterSend(answer: InboundMessageAccepted): InboundNext;
|
|
110
|
+
export interface GlanceOutcome {
|
|
111
|
+
/** The last handling a glance or its fallback recorded, or null when the wait ran out. */
|
|
112
|
+
handling: MessageDeliveryHandling | null;
|
|
113
|
+
/** The agent's reply to the message, when it wrote one; `cloudReply` when from the cloud. */
|
|
114
|
+
reply: {
|
|
115
|
+
messageId: string;
|
|
116
|
+
text: string;
|
|
117
|
+
cloudReply?: MessageCloudReply;
|
|
118
|
+
} | null;
|
|
119
|
+
}
|
|
120
|
+
type MessageRow = {
|
|
121
|
+
messageId?: string;
|
|
122
|
+
text?: string;
|
|
123
|
+
isCreatedByUser?: boolean;
|
|
124
|
+
delivery?: MessageDelivery | null;
|
|
125
|
+
metadata?: {
|
|
126
|
+
communication?: {
|
|
127
|
+
replyTo?: unknown;
|
|
128
|
+
cloudReply?: unknown;
|
|
129
|
+
};
|
|
130
|
+
} | null;
|
|
131
|
+
};
|
|
132
|
+
/** How long a glance can take to settle: its wall clock, its lease, and a margin. */
|
|
133
|
+
export declare const GLANCE_WAIT_MS: number;
|
|
134
|
+
/**
|
|
135
|
+
* Wait for what a glance decided about one message: read the conversation until the message
|
|
136
|
+
* carries a glance's handling (or the platform's fallback), and pick up the reply that names it.
|
|
137
|
+
*/
|
|
138
|
+
export declare function waitForGlance(conversationId: string, messageId: string, { timeoutMs, deps, }?: {
|
|
139
|
+
timeoutMs?: number;
|
|
140
|
+
deps?: {
|
|
141
|
+
messages?: (conversationId: string) => Promise<MessageRow[] | undefined>;
|
|
142
|
+
sleep?: (ms: number) => Promise<void>;
|
|
143
|
+
now?: () => number;
|
|
144
|
+
};
|
|
145
|
+
}): Promise<GlanceOutcome>;
|
|
146
|
+
/**
|
|
147
|
+
* A message's delivery now, read from the conversation, or `null` when the message is gone (it was
|
|
148
|
+
* taken back from another screen). Used when its card leaves the queue without a turn of its own:
|
|
149
|
+
* it may have been read with another message.
|
|
150
|
+
*/
|
|
151
|
+
export declare function readMessageDelivery(conversationId: string, messageId: string, deps?: {
|
|
152
|
+
messages?: (conversationId: string) => Promise<MessageRow[] | undefined>;
|
|
153
|
+
}): Promise<{
|
|
154
|
+
delivery: MessageDelivery | null;
|
|
155
|
+
} | null>;
|
|
156
|
+
export {};
|