@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
|
@@ -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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const COMPACT_RECORD_FIELDS: {
|
|
2
|
-
readonly task: readonly ["id", "identifier", "ref", "title", "status", "statusType", "priority", "parentId", "spaceId", "projectId", "goalId", "assigneeAgentIds", "assigneeUserIds", "dri", "executionMode", "actionability", "execution", "completion", "currentResultId", "createdAt", "updatedAt", "completedAt", "url"];
|
|
2
|
+
readonly task: readonly ["id", "identifier", "ref", "title", "status", "statusType", "version", "priority", "parentId", "spaceId", "projectId", "goalId", "assigneeAgentIds", "assigneeUserIds", "dri", "executionMode", "actionability", "execution", "completion", "currentResultId", "createdAt", "updatedAt", "completedAt", "url"];
|
|
3
3
|
};
|
|
4
4
|
export type RecordResource = keyof typeof COMPACT_RECORD_FIELDS;
|
|
5
5
|
/** JSON-only projection flags for detail reads. */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bringing a SKILL.md in as a skill: the one write both importers make.
|
|
3
|
+
*
|
|
4
|
+
* `skrr agents import <SKILL.md>` and `skrr agents import <bot folder>` convert the file with
|
|
5
|
+
* `skillFromSkillMarkdown` (data-provider) and then create and attach it here, so a skill imported
|
|
6
|
+
* from another app's bot is the same skill, with the same refusals, as one imported by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { dataService, type SkillMarkdownImport } from '@skrr-ai/data-provider';
|
|
9
|
+
export type ImportedSkill = SkillMarkdownImport['skill'];
|
|
10
|
+
/** The name the server stores (`POST /api/skills`): trimmed, lower case, spaces as `-`. */
|
|
11
|
+
export declare function storedSkillName(name: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Create the skill in the caller's library and attach it to `agentId` when given. Returns the new
|
|
14
|
+
* skill's id when the server sent one. Errors are the server's, unchanged, for the caller to report.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createImportedSkill(skill: ImportedSkill, agentId: string | null): Promise<{
|
|
17
|
+
created: Awaited<ReturnType<typeof dataService.createSkill>>;
|
|
18
|
+
skillId?: string;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storedSkillName = storedSkillName;
|
|
4
|
+
exports.createImportedSkill = createImportedSkill;
|
|
5
|
+
/**
|
|
6
|
+
* Bringing a SKILL.md in as a skill: the one write both importers make.
|
|
7
|
+
*
|
|
8
|
+
* `skrr agents import <SKILL.md>` and `skrr agents import <bot folder>` convert the file with
|
|
9
|
+
* `skillFromSkillMarkdown` (data-provider) and then create and attach it here, so a skill imported
|
|
10
|
+
* from another app's bot is the same skill, with the same refusals, as one imported by hand.
|
|
11
|
+
*/
|
|
12
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
13
|
+
/** The name the server stores (`POST /api/skills`): trimmed, lower case, spaces as `-`. */
|
|
14
|
+
function storedSkillName(name) {
|
|
15
|
+
return name.trim().toLowerCase().replace(/\s+/g, '-');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create the skill in the caller's library and attach it to `agentId` when given. Returns the new
|
|
19
|
+
* skill's id when the server sent one. Errors are the server's, unchanged, for the caller to report.
|
|
20
|
+
*/
|
|
21
|
+
async function createImportedSkill(skill, agentId) {
|
|
22
|
+
const created = await data_provider_1.dataService.createSkill({
|
|
23
|
+
agentId,
|
|
24
|
+
name: skill.name,
|
|
25
|
+
description: skill.description,
|
|
26
|
+
content: skill.content,
|
|
27
|
+
frontmatter: skill.frontmatter,
|
|
28
|
+
});
|
|
29
|
+
const skillId = created.id;
|
|
30
|
+
if (agentId && skillId) {
|
|
31
|
+
await data_provider_1.dataService.addAgentSkill({ agentId, skillId });
|
|
32
|
+
}
|
|
33
|
+
return { created, skillId };
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threads an agent left with `leave_thread`, as its owner sees them
|
|
3
|
+
* (`/api/slack/agents/:agentId/thread-mutes`). A mute lasts until a person
|
|
4
|
+
* @mentions the agent in the thread, or the owner clears it here.
|
|
5
|
+
*
|
|
6
|
+
* Each route is written out at its call site: the CLI ↔ API parity spec and the
|
|
7
|
+
* personal-access-token allow-list read them from there.
|
|
8
|
+
*/
|
|
9
|
+
export type SlackThreadMute = {
|
|
10
|
+
channel: string;
|
|
11
|
+
channelId: string;
|
|
12
|
+
threadId: string;
|
|
13
|
+
conversationName: string | null;
|
|
14
|
+
mutedBy: {
|
|
15
|
+
userId: string | null;
|
|
16
|
+
userName: string | null;
|
|
17
|
+
/** `owner` when the agent's verified owner asked, `member` for another person in the thread. */
|
|
18
|
+
role: string | null;
|
|
19
|
+
};
|
|
20
|
+
mutedAt: string | null;
|
|
21
|
+
};
|
|
22
|
+
export declare function listSlackThreadMutes(agentId: string): Promise<SlackThreadMute[]>;
|
|
23
|
+
export declare function clearSlackThreadMute(agentId: string, channelId: string, threadTs: string): Promise<{
|
|
24
|
+
cleared: boolean;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listSlackThreadMutes = listSlackThreadMutes;
|
|
4
|
+
exports.clearSlackThreadMute = clearSlackThreadMute;
|
|
5
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
|
+
async function listSlackThreadMutes(agentId) {
|
|
7
|
+
const result = (await data_provider_1.request.get(`/api/slack/agents/${encodeURIComponent(agentId)}/thread-mutes`));
|
|
8
|
+
return Array.isArray(result?.mutes) ? result.mutes : [];
|
|
9
|
+
}
|
|
10
|
+
async function clearSlackThreadMute(agentId, channelId, threadTs) {
|
|
11
|
+
return data_provider_1.request.delete(`/api/slack/agents/${encodeURIComponent(agentId)}/thread-mutes/${encodeURIComponent(channelId)}/${encodeURIComponent(threadTs)}`);
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type TaskCarrierSummary, type TaskWaitingReason } from '@skrr-ai/data-provider';
|
|
2
|
+
/**
|
|
3
|
+
* What will move a Task, as `tasks show` and `tasks actionability` print it. The server derives
|
|
4
|
+
* the facts (`actionability.carrier`, `actionability.waiting`); the words are data-provider's, so
|
|
5
|
+
* the CLI, the web and an Agent's manager context say the same thing.
|
|
6
|
+
*
|
|
7
|
+
* A `none` verdict prints the commands that would carry the Task, because "nothing will move it"
|
|
8
|
+
* without the way out is a dead end. `unknown` claims nothing either way.
|
|
9
|
+
*/
|
|
10
|
+
export declare function taskCarrierLines(actionability: {
|
|
11
|
+
carrier?: TaskCarrierSummary;
|
|
12
|
+
waiting?: TaskWaitingReason;
|
|
13
|
+
state?: unknown;
|
|
14
|
+
} | undefined, { taskRef, bin, width }: {
|
|
15
|
+
taskRef: string;
|
|
16
|
+
bin: string;
|
|
17
|
+
width?: number;
|
|
18
|
+
}): string[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taskCarrierLines = taskCarrierLines;
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
/**
|
|
6
|
+
* What will move a Task, as `tasks show` and `tasks actionability` print it. The server derives
|
|
7
|
+
* the facts (`actionability.carrier`, `actionability.waiting`); the words are data-provider's, so
|
|
8
|
+
* the CLI, the web and an Agent's manager context say the same thing.
|
|
9
|
+
*
|
|
10
|
+
* A `none` verdict prints the commands that would carry the Task, because "nothing will move it"
|
|
11
|
+
* without the way out is a dead end. `unknown` claims nothing either way.
|
|
12
|
+
*/
|
|
13
|
+
function taskCarrierLines(actionability, { taskRef, bin, width = 14 }) {
|
|
14
|
+
if (!actionability || actionability.state === 'terminal')
|
|
15
|
+
return [];
|
|
16
|
+
const label = (text) => text.padEnd(width);
|
|
17
|
+
const lines = [];
|
|
18
|
+
const waiting = actionability.waiting;
|
|
19
|
+
if (waiting?.kind === 'provider_quota') {
|
|
20
|
+
lines.push(`${label('Waiting:')}${(0, data_provider_1.describeTaskWaiting)(waiting, {
|
|
21
|
+
providerLabel: (0, data_provider_1.localHarnessProviderBySlug)(waiting.provider)?.label,
|
|
22
|
+
formatTime: (iso) => new Date(iso).toLocaleString(),
|
|
23
|
+
})}`);
|
|
24
|
+
}
|
|
25
|
+
const summary = actionability.carrier;
|
|
26
|
+
if (!summary)
|
|
27
|
+
return lines;
|
|
28
|
+
if (summary.verdict === 'carried') {
|
|
29
|
+
lines.push(`${label('Moved by:')}${summary.carriers.map(data_provider_1.describeTaskCarrier).join('; ')}`);
|
|
30
|
+
}
|
|
31
|
+
else if (summary.verdict === 'unknown') {
|
|
32
|
+
lines.push(`${label('Moved by:')}could not be confirmed: a source of wakes could not be read`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
lines.push(`${label('Moved by:')}nothing. No Run, wake, open question, person or open blocker carries ` +
|
|
36
|
+
'it, and nothing wakes an Agent by itself.');
|
|
37
|
+
(0, data_provider_1.taskCarrierCommands)(taskRef, bin).forEach((command, index) => lines.push(`${label(index === 0 ? 'Arm one:' : '')}${command}`));
|
|
38
|
+
}
|
|
39
|
+
for (const entry of summary.inert || []) {
|
|
40
|
+
lines.push(`${label('Not counted:')}${(0, data_provider_1.describeTaskInertCarrier)(entry)}`);
|
|
41
|
+
}
|
|
42
|
+
return lines;
|
|
43
|
+
}
|
|
@@ -22,6 +22,11 @@ export declare const taskLookupApi: {
|
|
|
22
22
|
* flags, the lib owns URLs.
|
|
23
23
|
*/
|
|
24
24
|
followUp: (id: string, body: Json) => Promise<Json>;
|
|
25
|
+
/**
|
|
26
|
+
* Arm a one-shot wait on a pull request or events AND block the task on it,
|
|
27
|
+
* in one call (`skrr tasks wait <task> --on …`).
|
|
28
|
+
*/
|
|
29
|
+
waitOn: (id: string, body: Json) => Promise<Json>;
|
|
25
30
|
cancelFollowUp: (id: string) => Promise<Json>;
|
|
26
31
|
/** Result-first closeout: submit one immutable Result, then project status. */
|
|
27
32
|
complete: (id: string, body: Json) => Promise<Json>;
|
package/dist/lib/task-extras.js
CHANGED
|
@@ -49,6 +49,11 @@ exports.taskLookupApi = {
|
|
|
49
49
|
* flags, the lib owns URLs.
|
|
50
50
|
*/
|
|
51
51
|
followUp: (id, body) => data_provider_1.request.post(`${base(id)}/follow-up`, body),
|
|
52
|
+
/**
|
|
53
|
+
* Arm a one-shot wait on a pull request or events AND block the task on it,
|
|
54
|
+
* in one call (`skrr tasks wait <task> --on …`).
|
|
55
|
+
*/
|
|
56
|
+
waitOn: (id, body) => data_provider_1.request.post(`${base(id)}/wait`, body),
|
|
52
57
|
cancelFollowUp: (id) => data_provider_1.request.post(`${base(id)}/follow-up/cancel`, {}),
|
|
53
58
|
/** Result-first closeout: submit one immutable Result, then project status. */
|
|
54
59
|
complete: (id, body) => data_provider_1.request.post(`${base(id)}/complete`, body),
|
|
@@ -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)`);
|
|
@@ -8,6 +8,21 @@ export type CronReading = {
|
|
|
8
8
|
* Plain language for a five-field cron pattern, or `null` when this reader cannot say it faithfully.
|
|
9
9
|
*/
|
|
10
10
|
export declare function describeCronPattern(pattern: string): CronReading | null;
|
|
11
|
+
/** A five-field cron pattern's fields, each as the values it names; `'*'` where a field is unrestricted. */
|
|
12
|
+
export type CronFields = {
|
|
13
|
+
minutes: number[];
|
|
14
|
+
hours: number[];
|
|
15
|
+
daysOfMonth: number[] | '*';
|
|
16
|
+
months: number[] | '*';
|
|
17
|
+
/** 0 = Sunday, as cron counts (7 is read as 0). */
|
|
18
|
+
daysOfWeek: number[] | '*';
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The values each field of a five-field cron pattern names, or `null` when this reader cannot read
|
|
22
|
+
* it (the same modest grammar `describeCronPattern` reads). For callers that turn a pattern into
|
|
23
|
+
* another schedule shape and must refuse what they cannot carry exactly.
|
|
24
|
+
*/
|
|
25
|
+
export declare function readCronFields(pattern: string): CronFields | null;
|
|
11
26
|
/**
|
|
12
27
|
* The block `tasks show` prints for a recurring Task: the rule, its zone, a plain reading, when it
|
|
13
28
|
* next fires, how many runs it has used, and when it ends. Empty for a Task that does not recur.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.describeCronPattern = describeCronPattern;
|
|
4
|
+
exports.readCronFields = readCronFields;
|
|
4
5
|
exports.recurrenceSummaryLines = recurrenceSummaryLines;
|
|
5
6
|
/**
|
|
6
7
|
* What `skrr tasks show` says about a Task that recurs (OSK-21531).
|
|
@@ -184,6 +185,27 @@ function describeCronPattern(pattern) {
|
|
|
184
185
|
dayOfMonthOrWeekday: monthDays.length > 0 && weekdays.length > 0,
|
|
185
186
|
};
|
|
186
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* The values each field of a five-field cron pattern names, or `null` when this reader cannot read
|
|
190
|
+
* it (the same modest grammar `describeCronPattern` reads). For callers that turn a pattern into
|
|
191
|
+
* another schedule shape and must refuse what they cannot carry exactly.
|
|
192
|
+
*/
|
|
193
|
+
function readCronFields(pattern) {
|
|
194
|
+
const fields = String(pattern ?? '')
|
|
195
|
+
.trim()
|
|
196
|
+
.split(DESCRIBE_CRON_PATTERN_RE);
|
|
197
|
+
if (fields.length !== 5)
|
|
198
|
+
return null;
|
|
199
|
+
const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;
|
|
200
|
+
const minutes = expandField(minute, MINUTE);
|
|
201
|
+
const hours = expandField(hour, HOUR);
|
|
202
|
+
const daysOfMonth = dayOfMonth === '*' ? '*' : expandField(dayOfMonth, DAY_OF_MONTH);
|
|
203
|
+
const months = month === '*' ? '*' : expandField(month, MONTH);
|
|
204
|
+
const daysOfWeek = dayOfWeek === '*' ? '*' : expandField(dayOfWeek, DAY_OF_WEEK);
|
|
205
|
+
if (!minutes || !hours || !daysOfMonth || !months || !daysOfWeek)
|
|
206
|
+
return null;
|
|
207
|
+
return { minutes, hours, daysOfMonth, months, daysOfWeek };
|
|
208
|
+
}
|
|
187
209
|
function instantText(value) {
|
|
188
210
|
if (typeof value !== 'string' && !(value instanceof Date))
|
|
189
211
|
return null;
|
|
@@ -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;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What a move into review means when no Review is owed.
|
|
4
|
+
*
|
|
5
|
+
* Review is where a Review the Task's own `reviewPolicy` requires is waited for. Under `none`
|
|
6
|
+
* (the default) nobody owes one, so a Task parked there waits on a person who was never asked:
|
|
7
|
+
* thousands sat in review that way (OSK-33196). The move still lands; this says what it means,
|
|
8
|
+
* at the moment an agent made it.
|
|
9
|
+
*
|
|
10
|
+
* Every CLI door that moves a Task reads it from here. It used to live in `tasks move` alone,
|
|
11
|
+
* and `tasks bulk-update` moved 181 finished Tasks into review in one session without a word
|
|
12
|
+
* (OSK-33194).
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.waitsForUnowedReview = waitsForUnowedReview;
|
|
16
|
+
exports.unowedReviewNotice = unowedReviewNotice;
|
|
17
|
+
exports.unowedReviewSummary = unowedReviewSummary;
|
|
18
|
+
/** True when the moved Task now waits in review for a Review nobody owes it. */
|
|
19
|
+
function waitsForUnowedReview(task) {
|
|
20
|
+
const t = (task ?? {});
|
|
21
|
+
return t.statusType === 'review' && t.reviewPolicy !== 'required';
|
|
22
|
+
}
|
|
23
|
+
/** The notice for one Task, or null when it is not waiting for an unowed Review. */
|
|
24
|
+
function unowedReviewNotice(task, bin) {
|
|
25
|
+
if (!waitsForUnowedReview(task))
|
|
26
|
+
return null;
|
|
27
|
+
return ('Nobody owes this Task a Review: its reviewPolicy is not `required`, so it waits in review ' +
|
|
28
|
+
`for a person who was never asked. Close finished work with \`${bin} tasks complete\`.`);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* One notice for several moved Tasks, naming them, or null when none waits for an unowed Review.
|
|
32
|
+
* A bulk move says it once rather than once per row.
|
|
33
|
+
*/
|
|
34
|
+
function unowedReviewSummary(labels, bin) {
|
|
35
|
+
if (labels.length === 0)
|
|
36
|
+
return null;
|
|
37
|
+
if (labels.length === 1) {
|
|
38
|
+
return (`Nobody owes ${labels[0]} a Review: its reviewPolicy is not \`required\`, so it waits in ` +
|
|
39
|
+
`review for a person who was never asked. Close finished work with \`${bin} tasks complete\`.`);
|
|
40
|
+
}
|
|
41
|
+
const shown = labels.slice(0, 10).join(', ');
|
|
42
|
+
const more = labels.length > 10 ? ` and ${labels.length - 10} more` : '';
|
|
43
|
+
return (`Nobody owes these ${labels.length} Tasks a Review (${shown}${more}): their reviewPolicy is ` +
|
|
44
|
+
'not `required`, so they wait in review for a person who was never asked. Close finished ' +
|
|
45
|
+
`work with \`${bin} tasks complete\`.`);
|
|
46
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI half of a version-fenced Task write (`--expected-version`).
|
|
3
|
+
*
|
|
4
|
+
* The server's half is the CAS on `Task.version` (`PATCH /api/tasks/:id` and
|
|
5
|
+
* `PATCH /api/tasks/:id/move`), which refuses with `TASK_VERSION_CONFLICT`
|
|
6
|
+
* when the Task moved on. That refusal is only useful if it says what to do
|
|
7
|
+
* next, and the next step is never "retry": the caller decided from a Task
|
|
8
|
+
* that no longer exists, so it reads the Task again and decides again.
|
|
9
|
+
*
|
|
10
|
+
* The idempotency rule needs nothing here: a body that carries a numeric
|
|
11
|
+
* `expectedVersion` takes the request-derived key (`idempotency.ts` rule 3),
|
|
12
|
+
* so a retry after a lost response replays the first answer instead of
|
|
13
|
+
* conflicting with its own write.
|
|
14
|
+
*/
|
|
15
|
+
import { TASK_VERSION_CONFLICT_CODE } from '@skrr-ai/data-provider';
|
|
16
|
+
export { TASK_VERSION_CONFLICT_CODE };
|
|
17
|
+
/** The CLI's refusal for a change the version fence cannot carry. */
|
|
18
|
+
export declare const TASK_VERSION_FENCE_UNSUPPORTED = "TASK_VERSION_FENCE_UNSUPPORTED";
|
|
19
|
+
export declare const EXPECTED_VERSION_FLAG_HELP: string;
|
|
20
|
+
export type TaskVersionConflict = {
|
|
21
|
+
expectedVersion?: number;
|
|
22
|
+
currentVersion?: number;
|
|
23
|
+
};
|
|
24
|
+
/** The version a Task reports, with an absent field read as 0 (the server's own reading). */
|
|
25
|
+
export declare function taskVersionOf(task: Record<string, unknown> | null | undefined): number;
|
|
26
|
+
/** The `Version:` line `tasks show` prints, with the flag that uses it. */
|
|
27
|
+
export declare function taskVersionLine(version: number): string;
|
|
28
|
+
/**
|
|
29
|
+
* The same line after a write, from the version the server answered with, or
|
|
30
|
+
* null when it answered without one. Every user edit moves the version, fenced
|
|
31
|
+
* or not, so the version a caller read before its own write is already stale:
|
|
32
|
+
* this is the one to fence the next write on.
|
|
33
|
+
*/
|
|
34
|
+
export declare function writtenTaskVersionLine(task: Record<string, unknown> | null | undefined): string | null;
|
|
35
|
+
/** The two versions of a `TASK_VERSION_CONFLICT` refusal, or null for any other error. */
|
|
36
|
+
export declare function taskVersionConflictOf(err: unknown): TaskVersionConflict | null;
|
|
37
|
+
/**
|
|
38
|
+
* The conflict as a sentence that names the next step. `expectedVersion` is the
|
|
39
|
+
* one the caller sent, which the server echoes on `move` but not on `update`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function describeTaskVersionConflict({ taskRef, expectedVersion, currentVersion, bin, }: {
|
|
42
|
+
taskRef: string;
|
|
43
|
+
expectedVersion?: number;
|
|
44
|
+
currentVersion?: number;
|
|
45
|
+
bin: string;
|
|
46
|
+
}): string;
|
|
47
|
+
/**
|
|
48
|
+
* Why `tasks update --expected-version` cannot send this patch, or null when
|
|
49
|
+
* the fence carries all of it. The fenced server path writes only
|
|
50
|
+
* `TASK_VERSIONED_PATCH_FIELDS` and silently drops the rest, so sending
|
|
51
|
+
* anything else would report an update that partly did not happen.
|
|
52
|
+
*/
|
|
53
|
+
export declare function taskVersionFenceRefusal(patch: Record<string, unknown>): string | null;
|