@skrr-ai/cli 0.1.222 → 0.1.223
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/agents/chat.js +5 -0
- package/dist/commands/duties/install-look-around.d.ts +10 -0
- package/dist/commands/duties/install-look-around.js +38 -0
- package/dist/commands/tasks/transcript.js +13 -1
- package/dist/lib/agentic-stream.d.ts +2 -0
- package/dist/lib/agentic-stream.js +34 -15
- package/dist/lib/duties.d.ts +8 -0
- package/dist/lib/duties.js +1 -0
- package/dist/lib/task-transcript.js +2 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +3113 -2762
- package/oclif.manifest.json +89 -9
- package/package.json +2 -2
|
@@ -925,6 +925,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
925
925
|
sessionId: next.sessionId,
|
|
926
926
|
conversationId,
|
|
927
927
|
responseMessageId: next.responseMessageId,
|
|
928
|
+
replayed: answer.idempotentReplay === true,
|
|
928
929
|
};
|
|
929
930
|
case 'delivered': {
|
|
930
931
|
const handling = answer.delivery?.handling;
|
|
@@ -1006,6 +1007,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1006
1007
|
conversationId,
|
|
1007
1008
|
responseMessageId: sent.responseMessageId,
|
|
1008
1009
|
...waited.turn,
|
|
1010
|
+
replayed: answer.idempotentReplay === true,
|
|
1009
1011
|
};
|
|
1010
1012
|
case 'held':
|
|
1011
1013
|
return this.failWithCliError({
|
|
@@ -1272,6 +1274,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1272
1274
|
const startKey = suppliedStartKey ?? (0, agent_chat_start_1.newStartKey)();
|
|
1273
1275
|
const turnText = contextParts ? `${contextParts}\n\n${prompt}` : prompt;
|
|
1274
1276
|
let started;
|
|
1277
|
+
let replayedInbound = false;
|
|
1275
1278
|
// Inbound messages: a message to an existing conversation goes to the ingress, which keeps it
|
|
1276
1279
|
// and decides how the agent sees it. `--when-busy fail` asks for the older refusal instead.
|
|
1277
1280
|
let viaIngress = false;
|
|
@@ -1306,6 +1309,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1306
1309
|
}
|
|
1307
1310
|
else {
|
|
1308
1311
|
started = sent;
|
|
1312
|
+
replayedInbound = sent.replayed === true;
|
|
1309
1313
|
viaIngress = true;
|
|
1310
1314
|
}
|
|
1311
1315
|
}
|
|
@@ -1494,6 +1498,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1494
1498
|
quiet,
|
|
1495
1499
|
approveTools: flags['approve-tools'],
|
|
1496
1500
|
reconcileTerminal,
|
|
1501
|
+
resumeRecordedResponseId: replayedInbound ? started.responseMessageId : undefined,
|
|
1497
1502
|
awaitHandover,
|
|
1498
1503
|
replayEnvelopes: (from) => (0, api_fetch_1.apiFetch)(`/api/agentic/sessions/${encodeURIComponent(started.sessionId)}/envelopes?from=${from}&limit=500`, { credential: this.resolvedCredential, signal: AbortSignal.timeout(5000) }),
|
|
1499
1504
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class DutiesInstallLookAround extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
scope: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 duties_1 = require("../../lib/duties");
|
|
6
|
+
const web_url_1 = require("../../lib/web-url");
|
|
7
|
+
class DutiesInstallLookAround extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'Install the platform’s Look Around exploration Duty as a draft';
|
|
9
|
+
static flags = {
|
|
10
|
+
agent: core_1.Flags.string({ required: true, description: 'Agent ID' }),
|
|
11
|
+
scope: core_1.Flags.string({ required: true, description: 'The already-authorized sources to explore' }),
|
|
12
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
this.requireAuth();
|
|
16
|
+
const { flags } = await this.parse(DutiesInstallLookAround);
|
|
17
|
+
let result;
|
|
18
|
+
try {
|
|
19
|
+
result = await duties_1.dutyApi.installLookAround(flags.agent, flags.scope);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
this.handleApiError(error);
|
|
23
|
+
}
|
|
24
|
+
if (flags.json) {
|
|
25
|
+
this.log(JSON.stringify(result, null, 2));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const { duty } = result;
|
|
29
|
+
this.log(`${duty.title} · ${duty.status} · ${duty.id}`);
|
|
30
|
+
const url = (0, web_url_1.dutyUrlFrom)(this.cliConfig.baseURL, { id: duty.id });
|
|
31
|
+
if (url)
|
|
32
|
+
this.log(url);
|
|
33
|
+
if (duty.status === 'draft') {
|
|
34
|
+
this.log(`Turn on with skrr duties resume ${duty.id}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = DutiesInstallLookAround;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
5
|
const base_command_1 = require("../../base-command");
|
|
6
|
+
const http_error_1 = require("../../lib/http-error");
|
|
6
7
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
7
8
|
const task_transcript_1 = require("../../lib/task-transcript");
|
|
8
9
|
class TasksTranscript extends base_command_1.BaseCommand {
|
|
@@ -63,7 +64,18 @@ class TasksTranscript extends base_command_1.BaseCommand {
|
|
|
63
64
|
catch (err) {
|
|
64
65
|
this.handleApiError(err);
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
let conversationId = task.conversationId ? String(task.conversationId) : null;
|
|
68
|
+
if (!conversationId) {
|
|
69
|
+
try {
|
|
70
|
+
const chat = await data_provider_1.dataService.getTaskChat(taskRef);
|
|
71
|
+
conversationId = chat.activeConversationId;
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
// Older servers may not expose the managed Task chat read.
|
|
75
|
+
if (!(0, http_error_1.isHttpNotFound)(err))
|
|
76
|
+
this.handleApiError(err);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
67
79
|
if (!conversationId) {
|
|
68
80
|
// A task with no execution conversation has simply never been run by an
|
|
69
81
|
// agent — a real state, not a lookup failure. Say which one it is.
|
|
@@ -221,6 +221,8 @@ export type AgenticStreamOptions = {
|
|
|
221
221
|
* the stream alone.
|
|
222
222
|
*/
|
|
223
223
|
reconcileTerminal?: () => Promise<ReconciledTerminal | null>;
|
|
224
|
+
/** Ingress returned this response for an idempotent retry. Its session may have expired. */
|
|
225
|
+
resumeRecordedResponseId?: string;
|
|
224
226
|
/** Owner-authorized canonical envelopes, including events emitted before room admission. */
|
|
225
227
|
replayEnvelopes?: (from: number) => Promise<EnvelopeReplayPage>;
|
|
226
228
|
/** Bounded live catch-up cadence while a run is active. Default 2s. */
|
|
@@ -945,6 +945,12 @@ class AgenticStreamClient {
|
|
|
945
945
|
this.resolve = resolve;
|
|
946
946
|
this.reject = reject;
|
|
947
947
|
});
|
|
948
|
+
if (this.options.resumeRecordedResponseId) {
|
|
949
|
+
this.responseMessageId = this.options.resumeRecordedResponseId;
|
|
950
|
+
const hasTerminal = await this.probeTerminal('inbound_replay');
|
|
951
|
+
if (hasTerminal || this.handover || this.closed)
|
|
952
|
+
return result;
|
|
953
|
+
}
|
|
948
954
|
const wsURL = toWebSocketOrigin(this.options.baseURL);
|
|
949
955
|
const extraHeaders = this.options.workspaceId
|
|
950
956
|
? { 'X-Workspace-Id': this.options.workspaceId }
|
|
@@ -1081,7 +1087,7 @@ class AgenticStreamClient {
|
|
|
1081
1087
|
// recorded reason is exactly what "the surface shows nothing at all" cost
|
|
1082
1088
|
// the reader (OSK-7595 — the CLI reported a transport error while the run's
|
|
1083
1089
|
// own recorded failure said something else entirely).
|
|
1084
|
-
|
|
1090
|
+
const event = {
|
|
1085
1091
|
type: 'run.reconciled',
|
|
1086
1092
|
sessionId: this.options.sessionId,
|
|
1087
1093
|
reconciledFrom: 'durable_record',
|
|
@@ -1089,7 +1095,11 @@ class AgenticStreamClient {
|
|
|
1089
1095
|
...(terminal.error ? { message: terminal.error, error: terminal.error } : {}),
|
|
1090
1096
|
...(typeof terminal.text === 'string' ? { result: terminal.text } : {}),
|
|
1091
1097
|
...(terminal.publicProjection ? { publicProjection: terminal.publicProjection } : {}),
|
|
1092
|
-
}
|
|
1098
|
+
};
|
|
1099
|
+
if (reason === 'inbound_replay')
|
|
1100
|
+
this.finishAfterReplay(terminal.status, event);
|
|
1101
|
+
else
|
|
1102
|
+
this.finish(terminal.status, event);
|
|
1093
1103
|
return true;
|
|
1094
1104
|
}
|
|
1095
1105
|
cancel(reason = 'Interrupted by user') {
|
|
@@ -2830,8 +2840,10 @@ class AgenticStreamClient {
|
|
|
2830
2840
|
endsWithIgnoringWhitespace(this.accumulated, finalText) ||
|
|
2831
2841
|
this.accumulated.startsWith(finalText) ||
|
|
2832
2842
|
startsWithIgnoringWhitespace(this.accumulated, finalText));
|
|
2833
|
-
|
|
2834
|
-
|
|
2843
|
+
const hasRecordedResult = event.reconciledFrom === 'durable_record' && typeof event.result === 'string';
|
|
2844
|
+
if (hasRecordedResult ||
|
|
2845
|
+
(event.publicProjection === 'lookback_answer_v1' && typeof event.result === 'string')) {
|
|
2846
|
+
this.accumulated = finalText;
|
|
2835
2847
|
}
|
|
2836
2848
|
else if (finalText && finalText !== this.accumulated && !accumulationIsSuperset) {
|
|
2837
2849
|
this.accumulated = finalText;
|
|
@@ -2841,7 +2853,8 @@ class AgenticStreamClient {
|
|
|
2841
2853
|
// other way round).
|
|
2842
2854
|
// (Compared as the reader sees it: the record holds a widget as its fallback sentence,
|
|
2843
2855
|
// which is shorter than the block the stream carried, and the raw length would never lose.)
|
|
2844
|
-
if (
|
|
2856
|
+
if (!hasRecordedResult &&
|
|
2857
|
+
recorded &&
|
|
2845
2858
|
(recorded.publicProjection === 'lookback_answer_v1' ||
|
|
2846
2859
|
recorded.text.length > (0, widgetTerminalText_1.widgetsAsText)(this.accumulated, { final: true }).length)) {
|
|
2847
2860
|
this.accumulated = recorded.text;
|
|
@@ -2849,15 +2862,17 @@ class AgenticStreamClient {
|
|
|
2849
2862
|
}
|
|
2850
2863
|
const confirmedReply = status === 'completed' &&
|
|
2851
2864
|
(event.chatTurnReplyVersion === data_provider_1.CHAT_TURN_REPLY_VERSION || Boolean(this.chatReply));
|
|
2852
|
-
if (status === 'completed' &&
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2865
|
+
if (status === 'completed' && !hasRecordedResult) {
|
|
2866
|
+
if (event.chatTurnReplyVersion === data_provider_1.CHAT_TURN_REPLY_VERSION) {
|
|
2867
|
+
this.accumulated = finalText;
|
|
2868
|
+
}
|
|
2869
|
+
else if (this.chatReply && !this.publicProjection) {
|
|
2870
|
+
const { start, text, originalLength } = this.chatReply;
|
|
2871
|
+
const full = originalLength === undefined
|
|
2872
|
+
? text
|
|
2873
|
+
: [finalText, this.accumulated].find((candidate) => candidate.length === originalLength && candidate.startsWith(text));
|
|
2874
|
+
this.accumulated = start === null ? '' : (full?.slice(start).trim() ?? '');
|
|
2875
|
+
}
|
|
2861
2876
|
}
|
|
2862
2877
|
// The finished answer, as every other surface shows it: the web applies
|
|
2863
2878
|
// this same sanitizer, so a scheduling JSON block or leaked function-call
|
|
@@ -2868,7 +2883,11 @@ class AgenticStreamClient {
|
|
|
2868
2883
|
this.accumulated = (0, data_provider_1.sanitizeFinalText)((0, widgetTerminalText_1.widgetsAsText)(this.accumulated, { final: true }), this.publicProjection);
|
|
2869
2884
|
if (!this.options.quiet && !this.options.jsonl && this.accumulated) {
|
|
2870
2885
|
const output = this.options.output ?? process.stdout;
|
|
2871
|
-
|
|
2886
|
+
// A confirmed formal reply may already be on screen after its streamed commentary.
|
|
2887
|
+
const shownText = confirmedReply && this.renderedText.trimEnd().endsWith(this.accumulated)
|
|
2888
|
+
? this.accumulated
|
|
2889
|
+
: this.renderedText;
|
|
2890
|
+
const { append, shown } = renderableDelta(shownText, this.accumulated);
|
|
2872
2891
|
this.renderedText = shown;
|
|
2873
2892
|
if (append)
|
|
2874
2893
|
output.write(append);
|
package/dist/lib/duties.d.ts
CHANGED
|
@@ -330,6 +330,14 @@ export type ObservationWindowQuery = {
|
|
|
330
330
|
limit?: number;
|
|
331
331
|
};
|
|
332
332
|
export declare const dutyApi: {
|
|
333
|
+
installLookAround: (agentId: string, scope: string) => Promise<{
|
|
334
|
+
duty: {
|
|
335
|
+
id: string;
|
|
336
|
+
title: string;
|
|
337
|
+
status: string;
|
|
338
|
+
};
|
|
339
|
+
installation: string;
|
|
340
|
+
}>;
|
|
333
341
|
/**
|
|
334
342
|
* The lib owns every URL in this domain, and the parity spec depends on that:
|
|
335
343
|
* a command that builds its own `/api/duties/...` string is invisible to
|
package/dist/lib/duties.js
CHANGED
|
@@ -217,6 +217,7 @@ exports.dutyPackApi = {
|
|
|
217
217
|
activate: (id) => data_provider_2.request.post(`${packBase(id)}/activate`, {}),
|
|
218
218
|
};
|
|
219
219
|
exports.dutyApi = {
|
|
220
|
+
installLookAround: (agentId, scope) => data_provider_2.request.post(`/api/duties/agents/${encodeURIComponent(agentId)}/look-around`, { scope }),
|
|
220
221
|
/**
|
|
221
222
|
* The lib owns every URL in this domain, and the parity spec depends on that:
|
|
222
223
|
* a command that builds its own `/api/duties/...` string is invisible to
|
|
@@ -90,7 +90,8 @@ function textFromMessage(message) {
|
|
|
90
90
|
return '';
|
|
91
91
|
}
|
|
92
92
|
function normalizeMessage(message) {
|
|
93
|
-
const
|
|
93
|
+
const metadata = message.metadata;
|
|
94
|
+
const isUser = Boolean(message.isCreatedByUser || metadata?.managedWorkCommandId);
|
|
94
95
|
return {
|
|
95
96
|
id: String(message.messageId ?? message._id ?? message.id ?? '-'),
|
|
96
97
|
role: isUser ? 'user' : 'assistant',
|