@skrr-ai/cli 0.1.152 → 0.1.153
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/send.d.ts +3 -1
- package/dist/commands/agent/message/send.js +52 -1
- package/dist/commands/agents/always-on/held-messages.d.ts +22 -0
- package/dist/commands/agents/always-on/held-messages.js +62 -0
- package/dist/commands/agents/always-on/release-run.d.ts +37 -0
- package/dist/commands/agents/always-on/release-run.js +92 -0
- package/dist/commands/agents/always-on/status.js +5 -0
- package/dist/commands/duties/create.js +24 -9
- package/dist/commands/duties/export.js +2 -1
- package/dist/commands/duties/preflight.js +17 -0
- package/dist/commands/duties/update.d.ts +1 -0
- package/dist/commands/duties/update.js +87 -66
- package/dist/commands/triggers/fire-detail.js +19 -0
- package/dist/generated/agent-guides.json +35 -35
- package/dist/lib/duties.d.ts +5 -0
- package/dist/lib/duties.js +75 -1
- package/dist/lib/duty-event-wakes.js +6 -3
- package/dist/lib/duty-loop-status.js +26 -2
- package/dist/lib/duty-product.js +4 -1
- package/dist/lib/held-messages.d.ts +11 -0
- package/dist/lib/held-messages.js +93 -0
- package/dist/lib/message-intent.d.ts +15 -0
- package/dist/lib/roles.d.ts +1 -1
- package/dist/lib/triggers.d.ts +13 -1
- package/dist/lib/triggers.js +43 -0
- package/dist/lib/update-check.js +9 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.js +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.js +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +6070 -6030
- package/oclif.manifest.json +191 -2
- package/package.json +4 -3
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.heldReasonLabel = heldReasonLabel;
|
|
4
|
+
exports.parseHeldOwnerMessages = parseHeldOwnerMessages;
|
|
5
|
+
exports.heldMessageLines = heldMessageLines;
|
|
6
|
+
/**
|
|
7
|
+
* Presentation of `GET /api/agents/:id/always-on/held-messages` for `skrr agents always-on
|
|
8
|
+
* held-messages`.
|
|
9
|
+
*
|
|
10
|
+
* What the endpoint is: the CURRENT OWNER's session app-DMs that the delivery policy is holding for
|
|
11
|
+
* one agent in one workspace. It returns metadata only (an id, when it was submitted, when the hold
|
|
12
|
+
* expires, and a neutral reason code). Message text is never returned: the service withholds it
|
|
13
|
+
* until the message's source lineage has a revocation-safe authorization and deletion contract.
|
|
14
|
+
*
|
|
15
|
+
* What it is NOT: the `ask_first` queue. Those are `skrr agent message pending|approve|decline`.
|
|
16
|
+
* A held message here follows the delivery policy and there is no manual release, so nothing in
|
|
17
|
+
* this output points at one.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* English labels for the reason codes the service emits (`HeldOwnerMessageService` `REASONS`, plus
|
|
21
|
+
* its `policy_hold` default). The web keeps its own copy in client i18n (`HELD_REASON_KEYS`) because
|
|
22
|
+
* it is localised; the CLI is English-only, so this is a second copy of the sentences and not of the
|
|
23
|
+
* vocabulary. A code missing from this map is printed AS ITSELF and never relabelled as a known one,
|
|
24
|
+
* so the server gaining a reason degrades to showing the raw code and not to a wrong sentence.
|
|
25
|
+
*/
|
|
26
|
+
const HELD_REASON_LABELS = {
|
|
27
|
+
policy_hold: 'Held by delivery policy',
|
|
28
|
+
destination_not_allowed: 'This destination is not allowed by the delivery policy',
|
|
29
|
+
delivery_mode_off: 'Message delivery is off',
|
|
30
|
+
delivery_mode_suggestions_only: 'The delivery policy allows suggestions only',
|
|
31
|
+
delivery_policy_unavailable: 'The delivery policy could not be checked',
|
|
32
|
+
prior_delivery_pending: 'An earlier message is still pending',
|
|
33
|
+
quiet_hours: 'Held during quiet hours',
|
|
34
|
+
do_not_disturb: 'Held while Do Not Disturb is active',
|
|
35
|
+
rate_limit: 'Held by an attention rate limit',
|
|
36
|
+
check_unavailable: 'A delivery check was unavailable',
|
|
37
|
+
};
|
|
38
|
+
/** The sentence for a reason code, or an explicit "unrecognised" line carrying the code. */
|
|
39
|
+
function heldReasonLabel(reason) {
|
|
40
|
+
return HELD_REASON_LABELS[reason] ?? `Unrecognised reason: ${reason}`;
|
|
41
|
+
}
|
|
42
|
+
const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
|
|
43
|
+
/**
|
|
44
|
+
* Accept a response only if it has the documented shape. A body that merely LOOKS empty (a proxy
|
|
45
|
+
* page, a server that answers a different contract) must not render as "no held messages": that is
|
|
46
|
+
* the one reading that would reassure about exactly the thing this command exists to show.
|
|
47
|
+
*/
|
|
48
|
+
function parseHeldOwnerMessages(value) {
|
|
49
|
+
if (!value || typeof value !== 'object')
|
|
50
|
+
return null;
|
|
51
|
+
const body = value;
|
|
52
|
+
if (!Array.isArray(body.messages) || !isNonEmptyString(body.observedAt))
|
|
53
|
+
return null;
|
|
54
|
+
if (body.nextCursor !== undefined && !isNonEmptyString(body.nextCursor))
|
|
55
|
+
return null;
|
|
56
|
+
for (const message of body.messages) {
|
|
57
|
+
if (!message || typeof message !== 'object')
|
|
58
|
+
return null;
|
|
59
|
+
const row = message;
|
|
60
|
+
if (!isNonEmptyString(row.id) || !isNonEmptyString(row.reason))
|
|
61
|
+
return null;
|
|
62
|
+
if (!isNonEmptyString(row.submittedAt))
|
|
63
|
+
return null;
|
|
64
|
+
if (row.expiresAt !== undefined && !isNonEmptyString(row.expiresAt))
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return body;
|
|
68
|
+
}
|
|
69
|
+
/** Human-readable output, one block per message. Pure, so the command's wording is testable. */
|
|
70
|
+
function heldMessageLines(agentId, result) {
|
|
71
|
+
const lines = [];
|
|
72
|
+
lines.push(`Agent: ${agentId}`);
|
|
73
|
+
lines.push(`Checked: ${result.observedAt} (delivery status can change)`);
|
|
74
|
+
lines.push(result.messages.length === 0
|
|
75
|
+
? 'Held: none'
|
|
76
|
+
: `Held: ${result.messages.length} shown${result.nextCursor ? ', more available' : ''}`);
|
|
77
|
+
for (const message of result.messages) {
|
|
78
|
+
lines.push('');
|
|
79
|
+
lines.push(` ${message.id}`);
|
|
80
|
+
lines.push(` Reason: ${message.reason} - ${heldReasonLabel(message.reason)}`);
|
|
81
|
+
lines.push(` Submitted: ${message.submittedAt}`);
|
|
82
|
+
if (message.expiresAt) {
|
|
83
|
+
lines.push(` Expires: ${message.expiresAt} (not a promised release time)`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
lines.push('');
|
|
87
|
+
// Said on every output, empty included: "none" on its own reads as "nothing is held anywhere".
|
|
88
|
+
lines.push('Scope: your held session messages for this agent in this workspace; other held message types are not shown.');
|
|
89
|
+
lines.push('Message text is not returned. These messages follow your delivery policy; there is no manual release.');
|
|
90
|
+
if (result.nextCursor)
|
|
91
|
+
lines.push(`next page: --cursor ${result.nextCursor}`);
|
|
92
|
+
return lines;
|
|
93
|
+
}
|
|
@@ -103,8 +103,23 @@ export type CanonicalMessageIntentResponse = {
|
|
|
103
103
|
* output that a priority was lowered (OSK-22368). Absent from an older server.
|
|
104
104
|
*/
|
|
105
105
|
presentation?: Pick<CommunicationPresentation, 'kind' | 'attention' | 'attentionRequested'>;
|
|
106
|
+
/**
|
|
107
|
+
* Whether One Voice counted this delivered message against the owner's shared attention budget, so
|
|
108
|
+
* the platform's heuristic producers back off (OSK-22367). Present on a delivered response only;
|
|
109
|
+
* absent from an older server.
|
|
110
|
+
*/
|
|
111
|
+
oneVoice?: OneVoiceOutcome;
|
|
106
112
|
[key: string]: unknown;
|
|
107
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* `reason` is open on purpose: a newer server may name a reason this CLI has no wording for, and it
|
|
116
|
+
* is shown as sent rather than dropped.
|
|
117
|
+
*/
|
|
118
|
+
export type OneVoiceOutcome = {
|
|
119
|
+
counted: boolean;
|
|
120
|
+
reason?: 'interactive_session' | 'not_owner_attention_destination' | 'accounting_failed' | string;
|
|
121
|
+
lease?: 'claimed' | 'contended' | 'unavailable';
|
|
122
|
+
};
|
|
108
123
|
export type AgentSessionMessageContext = {
|
|
109
124
|
token: string;
|
|
110
125
|
sessionId: string | null;
|
package/dist/lib/roles.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare const roleApi: {
|
|
|
53
53
|
config?: Record<string, unknown> | undefined;
|
|
54
54
|
}[];
|
|
55
55
|
sources: {
|
|
56
|
-
source: "space" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "conversations" | "slack" | "agent_initiatives" | "
|
|
56
|
+
source: "space" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "conversations" | "slack" | "agent_initiatives" | "messages" | "github" | "calendar" | "docs" | "metrics" | "agent_run" | "documents" | "product_metrics" | "business_metrics" | "state_monitor" | "monitor";
|
|
57
57
|
enabled: boolean;
|
|
58
58
|
config?: Record<string, unknown> | undefined;
|
|
59
59
|
}[];
|
package/dist/lib/triggers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EmbeddedActionRef, type TriggerIntentUnsupportedItem, type TriggerPreflightReport, type TriggerSensorConfig } from '@skrr-ai/data-provider';
|
|
1
|
+
import { type EmbeddedActionRef, type FireRunClaimRefusal, type TriggerIntentUnsupportedItem, type TriggerPreflightReport, type TriggerSensorConfig } from '@skrr-ai/data-provider';
|
|
2
2
|
export declare const TRIGGER_KINDS: readonly ["schedule", "once", "event", "stochastic", "self_scheduled", "on_demand", "form", "chat_message"];
|
|
3
3
|
/**
|
|
4
4
|
* The scope kinds the trigger endpoints accept. NOT a list of its own: `@skrr-ai/data-provider` owns it
|
|
@@ -219,6 +219,11 @@ export interface TriggerFireRecord {
|
|
|
219
219
|
conversationId?: string;
|
|
220
220
|
durationMs?: number;
|
|
221
221
|
finalizedAt?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Fire-detail read only: the durable Run is still queued behind a refused claim (for example
|
|
224
|
+
* waiting for the previous executor's stop receipt). Absent is not proof that nothing holds it.
|
|
225
|
+
*/
|
|
226
|
+
claimRefusal?: FireRunClaimRefusal;
|
|
222
227
|
metadata?: {
|
|
223
228
|
recordKind?: string;
|
|
224
229
|
afterOccurrenceId?: string;
|
|
@@ -847,6 +852,13 @@ export declare function coalescedAuditExplanation(fire: {
|
|
|
847
852
|
summary: string;
|
|
848
853
|
detail: string;
|
|
849
854
|
} | null;
|
|
855
|
+
/**
|
|
856
|
+
* One sentence on a scheduled fire that started long after the scheduler claimed it, or null when it
|
|
857
|
+
* started promptly or the record carries no timing (OSK-22613). `metadata.startLag` is the
|
|
858
|
+
* scheduler's own stage breakdown; this only reads it. "Most of that" is said only when the longest
|
|
859
|
+
* stage really is at least half of the span.
|
|
860
|
+
*/
|
|
861
|
+
export declare function scheduleStartLagSentence(metadata: unknown, thresholdMs?: number): string | null;
|
|
850
862
|
/** One sentence saying whether the fire left an inbox card, or null for a fire that predates the record. */
|
|
851
863
|
export declare function policyCardSentence(policyCard: unknown): string | null;
|
|
852
864
|
export declare function policyAuditExplanation(fire: {
|
package/dist/lib/triggers.js
CHANGED
|
@@ -70,6 +70,7 @@ exports.windowVerdictLines = windowVerdictLines;
|
|
|
70
70
|
exports.lastResultLabel = lastResultLabel;
|
|
71
71
|
exports.clockSkipAuditExplanation = clockSkipAuditExplanation;
|
|
72
72
|
exports.coalescedAuditExplanation = coalescedAuditExplanation;
|
|
73
|
+
exports.scheduleStartLagSentence = scheduleStartLagSentence;
|
|
73
74
|
exports.policyCardSentence = policyCardSentence;
|
|
74
75
|
exports.policyAuditExplanation = policyAuditExplanation;
|
|
75
76
|
exports.fireReasonText = fireReasonText;
|
|
@@ -2113,6 +2114,48 @@ const POLICY_CARD_REASONS = {
|
|
|
2113
2114
|
initiative_policy_source_off: 'this source is switched off for the Agent',
|
|
2114
2115
|
initiative_policy_channel_off: 'this channel is switched off for the Agent',
|
|
2115
2116
|
};
|
|
2117
|
+
/** What each claim-to-start stage means to a person (the vocabulary is `SCHEDULE_START_LAG_STAGES`). */
|
|
2118
|
+
const START_LAG_STAGE_PHRASES = {
|
|
2119
|
+
prior_attempt_wait: 'earlier hand-off attempts and their retry delays',
|
|
2120
|
+
dispatch_queue_wait: 'waiting for a free dispatcher slot',
|
|
2121
|
+
dispatch_pool_wait: 'waiting for a runner inside one dispatcher pass',
|
|
2122
|
+
handoff_to_start: 'the hand-off to the executor',
|
|
2123
|
+
};
|
|
2124
|
+
/**
|
|
2125
|
+
* One sentence on a scheduled fire that started long after the scheduler claimed it, or null when it
|
|
2126
|
+
* started promptly or the record carries no timing (OSK-22613). `metadata.startLag` is the
|
|
2127
|
+
* scheduler's own stage breakdown; this only reads it. "Most of that" is said only when the longest
|
|
2128
|
+
* stage really is at least half of the span.
|
|
2129
|
+
*/
|
|
2130
|
+
function scheduleStartLagSentence(metadata, thresholdMs = data_provider_1.SCHEDULE_START_LAG_WARN_DEFAULT_MS) {
|
|
2131
|
+
if (!metadata || typeof metadata !== 'object' || Array.isArray(metadata))
|
|
2132
|
+
return null;
|
|
2133
|
+
const lag = metadata.startLag;
|
|
2134
|
+
if (!lag || typeof lag !== 'object' || Array.isArray(lag))
|
|
2135
|
+
return null;
|
|
2136
|
+
const { claimToStartMs, stagesMs } = lag;
|
|
2137
|
+
if (typeof claimToStartMs !== 'number' || !Number.isFinite(claimToStartMs))
|
|
2138
|
+
return null;
|
|
2139
|
+
if (claimToStartMs <= thresholdMs)
|
|
2140
|
+
return null;
|
|
2141
|
+
const spans = stagesMs && typeof stagesMs === 'object' && !Array.isArray(stagesMs)
|
|
2142
|
+
? stagesMs
|
|
2143
|
+
: {};
|
|
2144
|
+
let dominant;
|
|
2145
|
+
let dominantMs = 0;
|
|
2146
|
+
for (const stage of data_provider_1.SCHEDULE_START_LAG_STAGES) {
|
|
2147
|
+
const ms = spans[stage];
|
|
2148
|
+
if (typeof ms === 'number' && Number.isFinite(ms) && ms > dominantMs) {
|
|
2149
|
+
dominant = stage;
|
|
2150
|
+
dominantMs = ms;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
const head = `Started ${(0, format_1.formatElapsed)(claimToStartMs / 1000)} after it was claimed`;
|
|
2154
|
+
if (!dominant)
|
|
2155
|
+
return `${head}.`;
|
|
2156
|
+
const lead = dominantMs * 2 >= claimToStartMs ? 'most of that was' : 'the longest part was';
|
|
2157
|
+
return `${head}; ${lead} ${START_LAG_STAGE_PHRASES[dominant]} (${(0, format_1.formatElapsed)(dominantMs / 1000)}).`;
|
|
2158
|
+
}
|
|
2116
2159
|
/** One sentence saying whether the fire left an inbox card, or null for a fire that predates the record. */
|
|
2117
2160
|
function policyCardSentence(policyCard) {
|
|
2118
2161
|
if (!policyCard || typeof policyCard !== 'object' || Array.isArray(policyCard))
|
package/dist/lib/update-check.js
CHANGED
|
@@ -457,7 +457,7 @@ function readCliUpdateStatus(opts) {
|
|
|
457
457
|
else if ((lastAttempt?.status === 'queued' || lastAttempt?.status === 'running') &&
|
|
458
458
|
installedVersion !== lastAttempt.version)
|
|
459
459
|
state = 'pending';
|
|
460
|
-
else if (lastAttempt?.status === 'failed' && newer)
|
|
460
|
+
else if (lastAttempt?.status === 'failed' && newer && lastAttempt.version === offeredVersion)
|
|
461
461
|
state = 'failed';
|
|
462
462
|
else if (installedVersion && isOlderVersion(opts.currentVersion, installedVersion))
|
|
463
463
|
state = 'restart-pending';
|
|
@@ -496,7 +496,14 @@ function readCliUpdateStatus(opts) {
|
|
|
496
496
|
lastCheckAt: matchingCache?.lastCheckAt ?? null,
|
|
497
497
|
lastAttempt,
|
|
498
498
|
logPath: path.join(directory, 'update.log'),
|
|
499
|
-
|
|
499
|
+
// Receipts remain history. Do not present an unrelated failure as the
|
|
500
|
+
// current status, or an older success as a newer uninstalled offer.
|
|
501
|
+
message: (lastAttempt?.status === 'failed' && offeredVersion &&
|
|
502
|
+
(lastAttempt.version !== offeredVersion || !newer)) ||
|
|
503
|
+
(state === 'update-available' && lastAttempt?.status === 'succeeded' &&
|
|
504
|
+
offeredVersion && lastAttempt.version !== offeredVersion)
|
|
505
|
+
? undefined
|
|
506
|
+
: lastAttempt?.message,
|
|
500
507
|
};
|
|
501
508
|
}
|
|
502
509
|
/** Bounded discovery, also usable without a daemon, account, or TTY. */
|
|
@@ -384,7 +384,7 @@ function validDelivery(value) {
|
|
|
384
384
|
function validDeliverySource(value) {
|
|
385
385
|
if (!hasOnlyKeys(value, /* @__PURE__ */ new Set(["parentTaskId", "branch", "headSha", "baseCommit", "runtime"])))
|
|
386
386
|
return false;
|
|
387
|
-
return typeof value.parentTaskId === "string" && value.parentTaskId.length > 0 && value.parentTaskId.length <= 200 && typeof value.branch === "string" && VALID_DELIVERY_SOURCE_RE.test(value.branch) && !value.branch.includes("..") && !value.branch.includes("@{") && VALID_DELIVERY_SOURCE_RE_2.test(value.headSha) && typeof value.baseCommit === "string" && VALID_DELIVERY_SOURCE_RE_2.test(value.baseCommit) && hasOnlyKeys(value.runtime, /* @__PURE__ */ new Set(["kind", "id"])) && ["local_daemon", "hosted_machine"].includes(String(value.runtime.kind)) && boundedString(value.runtime.id, 200) && (value.runtime.kind !== "hosted_machine" || value.runtime.id.startsWith("sbs_"));
|
|
387
|
+
return typeof value.parentTaskId === "string" && value.parentTaskId.length > 0 && value.parentTaskId.length <= 200 && typeof value.branch === "string" && VALID_DELIVERY_SOURCE_RE.test(value.branch) && !value.branch.includes("..") && !value.branch.includes("@{") && VALID_DELIVERY_SOURCE_RE_2.test(value.headSha) && typeof value.baseCommit === "string" && VALID_DELIVERY_SOURCE_RE_2.test(value.baseCommit) && hasOnlyKeys(value.runtime, /* @__PURE__ */ new Set(["kind", "id"])) && ["local_daemon", "hosted_machine", "agent_worker"].includes(String(value.runtime.kind)) && boundedString(value.runtime.id, 200) && (value.runtime.kind !== "hosted_machine" || value.runtime.id.startsWith("sbs_"));
|
|
388
388
|
}
|
|
389
389
|
function eventSourceRevision(event) {
|
|
390
390
|
if (!event)
|
|
@@ -453,7 +453,7 @@ function validDeliverySource(value) {
|
|
|
453
453
|
typeof value.baseCommit === 'string' &&
|
|
454
454
|
VALID_DELIVERY_SOURCE_RE_2.test(value.baseCommit) &&
|
|
455
455
|
hasOnlyKeys(value.runtime, new Set(['kind', 'id'])) &&
|
|
456
|
-
['local_daemon', 'hosted_machine'].includes(String(value.runtime.kind)) &&
|
|
456
|
+
['local_daemon', 'hosted_machine', 'agent_worker'].includes(String(value.runtime.kind)) &&
|
|
457
457
|
boundedString(value.runtime.id, 200) &&
|
|
458
458
|
(value.runtime.kind !== 'hosted_machine' || value.runtime.id.startsWith('sbs_')));
|
|
459
459
|
}
|