@skrr-ai/cli 0.1.207 → 0.1.208
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/resolve.d.ts +31 -0
- package/dist/commands/agent/message/resolve.js +111 -0
- package/dist/commands/agent/message/send.d.ts +17 -5
- package/dist/commands/agent/message/send.js +77 -26
- 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 +53 -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/import.d.ts +15 -1
- package/dist/commands/agents/import.js +211 -23
- 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/shared-memory.d.ts +24 -0
- package/dist/commands/agents/shared-memory.js +67 -0
- 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/duties/advance-next.js +15 -6
- 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 +123 -0
- 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 +60 -0
- 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 +9 -0
- package/dist/commands/tasks/ask.d.ts +50 -0
- package/dist/commands/tasks/ask.js +190 -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/move.d.ts +11 -0
- package/dist/commands/tasks/move.js +82 -1
- 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.js +22 -1
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +52 -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 +102 -1
- package/dist/generated/agent-guides.json +501 -92
- 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/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/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/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-recurrence-summary.d.ts +15 -0
- package/dist/lib/task-recurrence-summary.js +22 -0
- package/dist/lib/task-version.d.ts +44 -0
- package/dist/lib/task-version.js +73 -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/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/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 +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +13323 -12577
- package/oclif.manifest.json +1787 -107
- package/package.json +5 -2
package/dist/lib/followups.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FollowUpStopReason, type PullRequestWakeKind } from '@skrr-ai/data-provider';
|
|
1
2
|
import { withQuery } from './triggers';
|
|
2
3
|
type Query = Parameters<typeof withQuery>[1];
|
|
3
4
|
type Json = Record<string, unknown>;
|
|
@@ -90,9 +91,68 @@ export interface FollowUpRow {
|
|
|
90
91
|
capsule?: unknown;
|
|
91
92
|
nextRunAt?: string | null;
|
|
92
93
|
deadlineAt?: string | null;
|
|
94
|
+
/** A one-shot wait over several events: it wakes its agent on the first, once. */
|
|
95
|
+
once?: boolean;
|
|
96
|
+
/** The event that woke a one-shot wait, once one has. */
|
|
97
|
+
wake?: FollowUpWake | null;
|
|
98
|
+
/** Why it stopped instead of waking its agent again (`FOLLOWUP_STOP_REASONS`). */
|
|
99
|
+
stopReason?: FollowUpStopReason | null;
|
|
100
|
+
/** A pull-request watch: the PR, and the fix attempts the server holds for it. */
|
|
101
|
+
pullRequest?: FollowUpPullRequest | null;
|
|
102
|
+
/** The Task this wait blocked (`skrr tasks wait`). */
|
|
103
|
+
taskHold?: {
|
|
104
|
+
taskId: string;
|
|
105
|
+
previousStatus?: string | null;
|
|
106
|
+
blockedStatus?: string | null;
|
|
107
|
+
releasedAt?: string | null;
|
|
108
|
+
} | null;
|
|
93
109
|
createdAt?: string;
|
|
94
110
|
label?: string;
|
|
95
111
|
}
|
|
112
|
+
export interface FollowUpWake {
|
|
113
|
+
occurrenceId: string;
|
|
114
|
+
eventType?: string;
|
|
115
|
+
kind?: PullRequestWakeKind;
|
|
116
|
+
summary?: string;
|
|
117
|
+
/** The fix attempt this wake spent. */
|
|
118
|
+
attempt?: number;
|
|
119
|
+
/** The event did not wake the agent: its attempts were spent, so the wait stopped. */
|
|
120
|
+
stopped?: boolean;
|
|
121
|
+
at: string;
|
|
122
|
+
}
|
|
123
|
+
export interface FollowUpPullRequest {
|
|
124
|
+
key: string;
|
|
125
|
+
repoId: string;
|
|
126
|
+
repoFullName: string;
|
|
127
|
+
number: number;
|
|
128
|
+
url?: string;
|
|
129
|
+
title?: string;
|
|
130
|
+
armedHeadSha?: string;
|
|
131
|
+
attempts: {
|
|
132
|
+
used: number;
|
|
133
|
+
limit: number;
|
|
134
|
+
resetAt?: string;
|
|
135
|
+
resetBy?: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export interface PullRequestWatchResponse {
|
|
139
|
+
followup: FollowUpRow | null;
|
|
140
|
+
reused?: boolean;
|
|
141
|
+
pullRequest?: {
|
|
142
|
+
ref: string;
|
|
143
|
+
title?: string | null;
|
|
144
|
+
url?: string | null;
|
|
145
|
+
headSha?: string | null;
|
|
146
|
+
mergeableState?: string | null;
|
|
147
|
+
draft?: boolean;
|
|
148
|
+
deadlineSeconds?: number;
|
|
149
|
+
};
|
|
150
|
+
fallbackTriggerId?: string | null;
|
|
151
|
+
producerDowngraded?: FollowUpCreateResponse['producerDowngraded'];
|
|
152
|
+
}
|
|
153
|
+
export declare function stopReasonLine(row: FollowUpRow): string | undefined;
|
|
154
|
+
export declare function wakeLine(row: FollowUpRow): string | undefined;
|
|
155
|
+
export declare function pullRequestLine(row: FollowUpRow): string | undefined;
|
|
96
156
|
export interface FollowUpCreateResponse {
|
|
97
157
|
followup: FollowUpRow | null;
|
|
98
158
|
reused?: boolean;
|
|
@@ -216,5 +276,6 @@ export declare const followupsApi: {
|
|
|
216
276
|
resolve: (id: string, body: Json) => Promise<Json>;
|
|
217
277
|
cancel: (id: string, body?: Json) => Promise<Json>;
|
|
218
278
|
reschedule: (id: string, body: Json) => Promise<Json>;
|
|
279
|
+
watchPullRequest: (body: Json) => Promise<PullRequestWatchResponse>;
|
|
219
280
|
};
|
|
220
281
|
export declare function followupSummaryLine(row: FollowUpRow): string;
|
package/dist/lib/followups.js
CHANGED
|
@@ -4,6 +4,9 @@ exports.followupsApi = exports.FOLLOWUP_SUBJECT_FLAG_HELP = exports.FOLLOWUP_SUB
|
|
|
4
4
|
exports.whenFlagProblem = whenFlagProblem;
|
|
5
5
|
exports.settledLine = settledLine;
|
|
6
6
|
exports.recipeWatchBoundsRefusal = recipeWatchBoundsRefusal;
|
|
7
|
+
exports.stopReasonLine = stopReasonLine;
|
|
8
|
+
exports.wakeLine = wakeLine;
|
|
9
|
+
exports.pullRequestLine = pullRequestLine;
|
|
7
10
|
exports.gateAdvisoryNotice = gateAdvisoryNotice;
|
|
8
11
|
exports.producerDowngradeNotice = producerDowngradeNotice;
|
|
9
12
|
exports.reusedWithoutChangeMessage = reusedWithoutChangeMessage;
|
|
@@ -130,6 +133,41 @@ function recipeWatchBoundsRefusal(waitKind, passed) {
|
|
|
130
133
|
: 'A recipe watch ends through its --wait.',
|
|
131
134
|
].join(' ');
|
|
132
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Why a follow-up stopped, in the owner's words, with what to do next. A Record over the closed
|
|
138
|
+
* vocabulary, so a new stop reason cannot ship without its sentence here.
|
|
139
|
+
*/
|
|
140
|
+
const STOP_REASON_NEXT = {
|
|
141
|
+
deadline_passed: (row) => row.pullRequest
|
|
142
|
+
? `arm a new watch if it is still worth waiting for: skrr followups watch-pr ${(0, data_provider_1.formatPullRequestRef)(row.pullRequest)}${row.agentId ? ` --agent ${row.agentId}` : ''} --deadline <duration>. If the pull request did change in that time, its events may not be reaching this deployment: one possible cause is a GitHub App that does not subscribe to them, which an operator checks with \`npm run cloud-coding:github-app:verify\``
|
|
143
|
+
: 'arm a new wait with a longer --wait-fallback if it is still worth waiting for',
|
|
144
|
+
fix_attempts_exhausted: (row) => row.pullRequest
|
|
145
|
+
? `give the agent more attempts: skrr followups watch-pr ${(0, data_provider_1.formatPullRequestRef)(row.pullRequest)}${row.agentId ? ` --agent ${row.agentId}` : ''} --reset-attempts`
|
|
146
|
+
: 'arm the wait again with --reset-attempts',
|
|
147
|
+
};
|
|
148
|
+
function stopReasonLine(row) {
|
|
149
|
+
const reason = row.stopReason;
|
|
150
|
+
if (!reason || !(reason in STOP_REASON_NEXT))
|
|
151
|
+
return reason ?? undefined;
|
|
152
|
+
return `${reason}: ${data_provider_1.FOLLOWUP_STOP_REASON_LABELS[reason]}. Next, ${STOP_REASON_NEXT[reason](row)}`;
|
|
153
|
+
}
|
|
154
|
+
function wakeLine(row) {
|
|
155
|
+
const wake = row.wake;
|
|
156
|
+
if (!wake)
|
|
157
|
+
return undefined;
|
|
158
|
+
const label = wake.kind ? data_provider_1.PULL_REQUEST_WAKE_KIND_LABELS[wake.kind] : wake.eventType;
|
|
159
|
+
const attempt = wake.attempt && row.pullRequest
|
|
160
|
+
? `, fix attempt ${wake.attempt} of ${row.pullRequest.attempts.limit}`
|
|
161
|
+
: '';
|
|
162
|
+
const stopped = wake.stopped ? ' (did not wake the agent: its fix attempts were spent)' : '';
|
|
163
|
+
return `${wake.at} ${label ?? 'an event'}${attempt}${stopped}${wake.summary ? ` — ${wake.summary}` : ''}`;
|
|
164
|
+
}
|
|
165
|
+
function pullRequestLine(row) {
|
|
166
|
+
const pr = row.pullRequest;
|
|
167
|
+
if (!pr)
|
|
168
|
+
return undefined;
|
|
169
|
+
return `${(0, data_provider_1.formatPullRequestRef)(pr)}${pr.title ? ` "${pr.title}"` : ''} — fix attempts used ${pr.attempts.used} of ${pr.attempts.limit}`;
|
|
170
|
+
}
|
|
133
171
|
/** A heads-up that the follow-up just made will be refused at its due time, with the way out. */
|
|
134
172
|
function gateAdvisoryNotice(response) {
|
|
135
173
|
const advisory = response.gateAdvisory;
|
|
@@ -234,6 +272,7 @@ exports.followupsApi = {
|
|
|
234
272
|
resolve: (id, body) => data_provider_1.request.post(`${base(id)}/resolve`, body),
|
|
235
273
|
cancel: (id, body = {}) => data_provider_1.request.post(`${base(id)}/cancel`, body),
|
|
236
274
|
reschedule: (id, body) => data_provider_1.request.post(`${base(id)}/reschedule`, body),
|
|
275
|
+
watchPullRequest: (body) => data_provider_1.request.post(`${MOUNT}/watch-pr`, body),
|
|
237
276
|
};
|
|
238
277
|
/* ------------------------------------------------------------------ *
|
|
239
278
|
* Rendering *
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How `skrr` shows a continuation run's handover interview (execution handover §4.8):
|
|
3
|
+
* the previous owner's dated notes, or why there are none. The words, the sections and
|
|
4
|
+
* the reasons are the data-provider's, so the CLI says what the web says.
|
|
5
|
+
*
|
|
6
|
+
* The notes are the previous agent's own account. They are printed under a heading
|
|
7
|
+
* that says so and never mixed into the packet's `notCarried` line.
|
|
8
|
+
*/
|
|
9
|
+
/** A short cell for the runs table's HANDOVER column, or null when the run has none. */
|
|
10
|
+
export declare function handoverInterviewMarker(raw: unknown, now?: Date): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* The full block for a person: one line saying where the interview stands, then, when
|
|
13
|
+
* the previous owner answered, its notes by section with each item's date.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderHandoverInterview(raw: unknown, { indent, now }?: {
|
|
16
|
+
indent?: string;
|
|
17
|
+
now?: Date;
|
|
18
|
+
}): string[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handoverInterviewMarker = handoverInterviewMarker;
|
|
4
|
+
exports.renderHandoverInterview = renderHandoverInterview;
|
|
5
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
|
+
/**
|
|
7
|
+
* How `skrr` shows a continuation run's handover interview (execution handover §4.8):
|
|
8
|
+
* the previous owner's dated notes, or why there are none. The words, the sections and
|
|
9
|
+
* the reasons are the data-provider's, so the CLI says what the web says.
|
|
10
|
+
*
|
|
11
|
+
* The notes are the previous agent's own account. They are printed under a heading
|
|
12
|
+
* that says so and never mixed into the packet's `notCarried` line.
|
|
13
|
+
*/
|
|
14
|
+
/** A short cell for the runs table's HANDOVER column, or null when the run has none. */
|
|
15
|
+
function handoverInterviewMarker(raw, now = new Date()) {
|
|
16
|
+
const view = (0, data_provider_1.effectiveHandoverInterview)(raw, { now });
|
|
17
|
+
if (!view)
|
|
18
|
+
return null;
|
|
19
|
+
if (view.state === 'pending')
|
|
20
|
+
return 'asking for notes';
|
|
21
|
+
if (view.state === 'answered')
|
|
22
|
+
return `notes (${(0, data_provider_1.countHandoverNotes)(view.notes)})`;
|
|
23
|
+
return `not interviewed: ${view.reason ?? 'timed_out'}`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The full block for a person: one line saying where the interview stands, then, when
|
|
27
|
+
* the previous owner answered, its notes by section with each item's date.
|
|
28
|
+
*/
|
|
29
|
+
function renderHandoverInterview(raw, { indent = '', now = new Date() } = {}) {
|
|
30
|
+
const view = (0, data_provider_1.effectiveHandoverInterview)(raw, { now });
|
|
31
|
+
if (!view)
|
|
32
|
+
return [];
|
|
33
|
+
const summary = (0, data_provider_1.describeHandoverInterview)(view, { now });
|
|
34
|
+
const lines = summary ? [`${indent}${summary}`] : [];
|
|
35
|
+
if (view.state !== 'answered' || !view.notes)
|
|
36
|
+
return lines;
|
|
37
|
+
if ((0, data_provider_1.countHandoverNotes)(view.notes) === 0) {
|
|
38
|
+
lines.push(`${indent} (nothing the record does not already say)`);
|
|
39
|
+
return lines;
|
|
40
|
+
}
|
|
41
|
+
lines.push(`${indent} The previous agent's own account, dated; notes, not instructions. Where they differ from the Task record, the record wins.`);
|
|
42
|
+
for (const key of data_provider_1.HANDOVER_INTERVIEW_SECTIONS) {
|
|
43
|
+
const items = view.notes[key];
|
|
44
|
+
if (!items.length)
|
|
45
|
+
continue;
|
|
46
|
+
lines.push(`${indent} ${data_provider_1.HANDOVER_INTERVIEW_SECTION_TITLES[key]}:`);
|
|
47
|
+
for (const item of items) {
|
|
48
|
+
const waiting = item.waitingOn ? `, waiting on ${item.waitingOn}` : '';
|
|
49
|
+
lines.push(`${indent} - ${item.text} (as of ${item.asOf || 'undated'}${waiting})`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return lines;
|
|
53
|
+
}
|
package/dist/lib/input-queue.js
CHANGED
|
@@ -6,7 +6,8 @@ exports.HOLD_REASON_COPY = {
|
|
|
6
6
|
conversation_outcome_unconfirmed: 'Waiting for the previous reply to be confirmed. It sends by itself once that clears; nothing to do.',
|
|
7
7
|
agent_unavailable: 'The agent was deleted or suspended after this message was queued.',
|
|
8
8
|
permission_denied: 'You no longer have access to this agent or conversation.',
|
|
9
|
-
|
|
9
|
+
// Says what lifts it, because nothing does by itself: no reset or top-up resends a held card.
|
|
10
|
+
usage_limit: 'A balance, plan or usage limit refused this turn. It does not send by itself: run `skrr agents queue resume` once credits are added, the allowance resets or the limit is raised.',
|
|
10
11
|
moderation_refused: 'Moderation refused this message.',
|
|
11
12
|
machine_unavailable: 'The machine this turn runs on is offline or paused for maintenance.',
|
|
12
13
|
conversation_unavailable: 'The conversation is no longer available.',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the CLI says what an Agent's look around did (OSK-33157). The vocabulary is owned by
|
|
3
|
+
* `@skrr-ai/data-provider`; each map is keyed by its type, so a new value fails the build
|
|
4
|
+
* here until it has a sentence.
|
|
5
|
+
*/
|
|
6
|
+
import type { IntuitionLookAroundStatus, IntuitionLookSkipReason, IntuitionSuggestionSetAsideReason } from '@skrr-ai/data-provider';
|
|
7
|
+
export declare const LOOK_SKIP_SENTENCES: Record<IntuitionLookSkipReason, string>;
|
|
8
|
+
export declare const SET_ASIDE_SENTENCES: Record<IntuitionSuggestionSetAsideReason, string>;
|
|
9
|
+
/** Lines about the schedule; empty when there is nothing worth saying. */
|
|
10
|
+
export declare function describeLookAround(lookAround: IntuitionLookAroundStatus | null | undefined, agentId: string): string[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* How the CLI says what an Agent's look around did (OSK-33157). The vocabulary is owned by
|
|
4
|
+
* `@skrr-ai/data-provider`; each map is keyed by its type, so a new value fails the build
|
|
5
|
+
* here until it has a sentence.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.SET_ASIDE_SENTENCES = exports.LOOK_SKIP_SENTENCES = void 0;
|
|
9
|
+
exports.describeLookAround = describeLookAround;
|
|
10
|
+
exports.LOOK_SKIP_SENTENCES = {
|
|
11
|
+
owner_inactive: 'you have not chatted with it lately; it looks again once you do',
|
|
12
|
+
billing_refused: 'your balance did not cover a look',
|
|
13
|
+
agent_unavailable: 'the agent could not be read',
|
|
14
|
+
already_looking: 'a look was already running',
|
|
15
|
+
quiet_hours: 'it fell in quiet hours',
|
|
16
|
+
runtime_unavailable: 'its machine could not be reached',
|
|
17
|
+
runtime_not_fenced: 'this agent runs on a machine where a look cannot be kept to reading only',
|
|
18
|
+
};
|
|
19
|
+
exports.SET_ASIDE_SENTENCES = {
|
|
20
|
+
ungrounded: 'no source it could point to',
|
|
21
|
+
invalid: 'incomplete or too long',
|
|
22
|
+
unsafe_reference: 'its source could not be opened safely',
|
|
23
|
+
secret_like: 'it looked like it contained a secret',
|
|
24
|
+
dismissed_recently: 'you dismissed it recently',
|
|
25
|
+
accepted_recently: 'you took it up recently',
|
|
26
|
+
repeated: 'already suggested in this look',
|
|
27
|
+
over_limit: 'more than one look shows',
|
|
28
|
+
};
|
|
29
|
+
/** Lines about the schedule; empty when there is nothing worth saying. */
|
|
30
|
+
function describeLookAround(lookAround, agentId) {
|
|
31
|
+
if (!lookAround)
|
|
32
|
+
return [];
|
|
33
|
+
if (lookAround.state === 'paused') {
|
|
34
|
+
return [
|
|
35
|
+
`Looking around is paused: the last ${lookAround.consecutiveFailures} looks did not finish.`,
|
|
36
|
+
`Resume it with: skrr agents intuitions resume ${agentId}`,
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
if (lookAround.state === 'looking')
|
|
40
|
+
return ['Looking around now.'];
|
|
41
|
+
const lines = [];
|
|
42
|
+
const last = lookAround.lastLook;
|
|
43
|
+
if (last) {
|
|
44
|
+
if (last.outcome === 'suggested')
|
|
45
|
+
lines.push(`Last look (${last.at}) found ${last.suggested}.`);
|
|
46
|
+
else if (last.outcome === 'nothing_to_suggest') {
|
|
47
|
+
lines.push(`Last look (${last.at}) found nothing worth suggesting.`);
|
|
48
|
+
}
|
|
49
|
+
else if (last.outcome === 'failed')
|
|
50
|
+
lines.push(`Last look (${last.at}) did not finish.`);
|
|
51
|
+
else if (last.skipReason) {
|
|
52
|
+
lines.push(`Last look (${last.at}) skipped: ${exports.LOOK_SKIP_SENTENCES[last.skipReason] ?? last.skipReason}.`);
|
|
53
|
+
}
|
|
54
|
+
for (const entry of last.setAside ?? []) {
|
|
55
|
+
const why = exports.SET_ASIDE_SENTENCES[entry.reason] ?? entry.reason;
|
|
56
|
+
lines.push(` Set aside${entry.title ? ` "${entry.title}"` : ''}: ${why}.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (lookAround.waitingForQuietHours)
|
|
60
|
+
lines.push('Next look waits for quiet hours to end.');
|
|
61
|
+
else if (lookAround.nextLookAt)
|
|
62
|
+
lines.push(`Next look: ${lookAround.nextLookAt}.`);
|
|
63
|
+
return lines;
|
|
64
|
+
}
|
|
@@ -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),
|
|
@@ -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,44 @@
|
|
|
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 two versions of a `TASK_VERSION_CONFLICT` refusal, or null for any other error. */
|
|
27
|
+
export declare function taskVersionConflictOf(err: unknown): TaskVersionConflict | null;
|
|
28
|
+
/**
|
|
29
|
+
* The conflict as a sentence that names the next step. `expectedVersion` is the
|
|
30
|
+
* one the caller sent, which the server echoes on `move` but not on `update`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function describeTaskVersionConflict({ taskRef, expectedVersion, currentVersion, bin, }: {
|
|
33
|
+
taskRef: string;
|
|
34
|
+
expectedVersion?: number;
|
|
35
|
+
currentVersion?: number;
|
|
36
|
+
bin: string;
|
|
37
|
+
}): string;
|
|
38
|
+
/**
|
|
39
|
+
* Why `tasks update --expected-version` cannot send this patch, or null when
|
|
40
|
+
* the fence carries all of it. The fenced server path writes only
|
|
41
|
+
* `TASK_VERSIONED_PATCH_FIELDS` and silently drops the rest, so sending
|
|
42
|
+
* anything else would report an update that partly did not happen.
|
|
43
|
+
*/
|
|
44
|
+
export declare function taskVersionFenceRefusal(patch: Record<string, unknown>): string | null;
|