@skrr-ai/cli 0.1.137 → 0.1.139
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 +6 -1
- package/dist/commands/agent/message/send.js +15 -3
- package/dist/commands/agents/spawn.js +11 -6
- package/dist/commands/triggers/fire-detail.js +4 -0
- package/dist/lib/triggers.d.ts +7 -0
- package/dist/lib/triggers.js +10 -1
- package/oclif.manifest.json +6 -6
- package/package.json +1 -1
|
@@ -153,6 +153,9 @@ export declare function messageSegmentationAdvisory({ destination, text, followi
|
|
|
153
153
|
* from one explicit semantic idempotency key.
|
|
154
154
|
*/
|
|
155
155
|
export declare function buildSequencedRequests(request: CanonicalMessageIntentRequest, followingParts: string[], hasExplicitIdempotencyKey: boolean): CanonicalMessageIntentRequest[];
|
|
156
|
+
/** A final held or failed part still leaves the requested sequence incomplete,
|
|
157
|
+
* even though there are no later parts for sequenceHalt to withhold. */
|
|
158
|
+
export declare function sequenceComplete(envelopes: readonly CanonicalIntentEnvelope[], halt: SequenceHalt | undefined): boolean;
|
|
156
159
|
/**
|
|
157
160
|
* Exit codes for a submitted-but-undelivered message.
|
|
158
161
|
*
|
|
@@ -177,12 +180,14 @@ export declare const EXIT_DELIVERY_FAILED = 4;
|
|
|
177
180
|
*/
|
|
178
181
|
export declare function deliveryExitCode(envelopes: readonly CanonicalIntentEnvelope[]): number;
|
|
179
182
|
export type SequenceHalt = {
|
|
180
|
-
/** Parts
|
|
183
|
+
/** Parts submitted, including the one that halted the sequence. */
|
|
181
184
|
sentParts: number;
|
|
182
185
|
/** Parts the caller asked for but that were deliberately never submitted. */
|
|
183
186
|
unsentParts: number;
|
|
184
187
|
status: CanonicalIntentEnvelope['intent']['status'];
|
|
185
188
|
reason?: string;
|
|
189
|
+
/** The submitted part was stopped before delivery, rather than delivered. */
|
|
190
|
+
currentPartWithheld?: boolean;
|
|
186
191
|
};
|
|
187
192
|
/**
|
|
188
193
|
* Decide whether a sequence stops after this part. Returns `undefined` when the
|
|
@@ -37,6 +37,7 @@ exports.EXIT_DELIVERY_FAILED = exports.EXIT_DELIVERY_RETRYABLE = exports.OWNER_D
|
|
|
37
37
|
exports.withSendWaitNotice = withSendWaitNotice;
|
|
38
38
|
exports.messageSegmentationAdvisory = messageSegmentationAdvisory;
|
|
39
39
|
exports.buildSequencedRequests = buildSequencedRequests;
|
|
40
|
+
exports.sequenceComplete = sequenceComplete;
|
|
40
41
|
exports.deliveryExitCode = deliveryExitCode;
|
|
41
42
|
exports.sequenceHalt = sequenceHalt;
|
|
42
43
|
exports.rejectPrincipalOverrides = rejectPrincipalOverrides;
|
|
@@ -342,7 +343,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
342
343
|
this.log(JSON.stringify(requests.length === 1
|
|
343
344
|
? envelopes[0]
|
|
344
345
|
: {
|
|
345
|
-
ok: envelopes
|
|
346
|
+
ok: sequenceComplete(envelopes, halt),
|
|
346
347
|
sequenceId: idempotencyKey,
|
|
347
348
|
parts: envelopes,
|
|
348
349
|
...(halt ? { halt } : {}),
|
|
@@ -616,6 +617,11 @@ const SEQUENCE_CONTINUING_STATUSES = new Set([
|
|
|
616
617
|
'duplicate',
|
|
617
618
|
'queued_offline',
|
|
618
619
|
]);
|
|
620
|
+
/** A final held or failed part still leaves the requested sequence incomplete,
|
|
621
|
+
* even though there are no later parts for sequenceHalt to withhold. */
|
|
622
|
+
function sequenceComplete(envelopes, halt) {
|
|
623
|
+
return !halt && envelopes.every((envelope) => envelope.ok && SEQUENCE_CONTINUING_STATUSES.has(envelope.intent.status));
|
|
624
|
+
}
|
|
619
625
|
/**
|
|
620
626
|
* Statuses that mean the message will never reach the user without a new send.
|
|
621
627
|
*
|
|
@@ -672,18 +678,20 @@ function deliveryExitCode(envelopes) {
|
|
|
672
678
|
* left to withhold and reporting a halt would be noise.
|
|
673
679
|
*/
|
|
674
680
|
function sequenceHalt({ envelope, sentCount, totalParts, }) {
|
|
675
|
-
|
|
681
|
+
const currentPartWithheld = envelope.intent.status === 'dropped' && envelope.intent.reason === 'owner_replied';
|
|
682
|
+
if (totalParts < 2 || (sentCount >= totalParts && !currentPartWithheld))
|
|
676
683
|
return undefined;
|
|
677
684
|
// The owner replying mid-update is a halt for the same reason a failed
|
|
678
685
|
// delivery is: the remaining parts would land after their turn, so the
|
|
679
686
|
// thought arrives split around something the agent has not read yet.
|
|
680
687
|
// Delivery of the part that reported it still SUCCEEDED.
|
|
681
|
-
if (envelope.intent.ownerInterjected) {
|
|
688
|
+
if (envelope.intent.ownerInterjected || currentPartWithheld) {
|
|
682
689
|
return {
|
|
683
690
|
sentParts: sentCount,
|
|
684
691
|
unsentParts: totalParts - sentCount,
|
|
685
692
|
status: envelope.intent.status,
|
|
686
693
|
reason: 'owner_replied',
|
|
694
|
+
...(currentPartWithheld ? { currentPartWithheld: true } : {}),
|
|
687
695
|
};
|
|
688
696
|
}
|
|
689
697
|
if (envelope.ok && SEQUENCE_CONTINUING_STATUSES.has(envelope.intent.status))
|
|
@@ -697,6 +705,10 @@ function sequenceHalt({ envelope, sentCount, totalParts, }) {
|
|
|
697
705
|
}
|
|
698
706
|
function formatHalt(halt) {
|
|
699
707
|
if (halt.reason === 'owner_replied') {
|
|
708
|
+
if (halt.currentPartWithheld) {
|
|
709
|
+
return (`Stopped before delivering part ${halt.sentParts}: the user replied while you were still sending. ` +
|
|
710
|
+
`This part and ${halt.unsentParts} later part(s) were not delivered. Read what they said before continuing.`);
|
|
711
|
+
}
|
|
700
712
|
return (`Stopped after part ${halt.sentParts}: the user replied while you were still sending. ` +
|
|
701
713
|
`${halt.unsentParts} later part(s) were not sent. Read what they said before continuing — ` +
|
|
702
714
|
'the rest of your update may no longer be the right thing to say.');
|
|
@@ -113,8 +113,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
113
113
|
'<%= config.bin %> agents spawn "plan my day every morning, working hours 9-6" --approve',
|
|
114
114
|
'<%= config.bin %> agents spawn "ping me when a PR needs review" --json',
|
|
115
115
|
'<%= config.bin %> agents spawn "watch launch blockers" --recommend',
|
|
116
|
-
'<%= config.bin %> agents spawn --approve-recommendation par_123',
|
|
117
|
-
'<%= config.bin %> agents spawn --apply-recommendation par_123',
|
|
116
|
+
'<%= config.bin %> agents spawn --approve-recommendation par_123 --spec-hash <reviewed-hash>',
|
|
117
|
+
'<%= config.bin %> agents spawn --apply-recommendation par_123 --spec-hash <reviewed-hash>',
|
|
118
118
|
'<%= config.bin %> agents spawn --from-spec spec.json --approve',
|
|
119
119
|
];
|
|
120
120
|
static args = {
|
|
@@ -135,13 +135,13 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
135
135
|
description: 'Approve an existing proactive-agent recommendation id',
|
|
136
136
|
}),
|
|
137
137
|
'apply-recommendation': core_1.Flags.string({
|
|
138
|
-
description: 'Apply an already-approved proactive-agent recommendation id',
|
|
138
|
+
description: 'Apply an already-approved proactive-agent recommendation id (requires --spec-hash)',
|
|
139
139
|
}),
|
|
140
140
|
'spec-hash': core_1.Flags.string({
|
|
141
|
-
description: '
|
|
141
|
+
description: 'Hash from the reviewed recommendation (required for apply; optional for approval)',
|
|
142
142
|
}),
|
|
143
143
|
'from-spec': core_1.Flags.string({
|
|
144
|
-
description: 'Path to a spec JSON (or "-" for stdin) to apply directly (requires --approve)',
|
|
144
|
+
description: 'Path to a spec JSON (or "-" for stdin) to apply directly (requires --approve). An explicit empty systems list skips implicit baseline watchers.',
|
|
145
145
|
}),
|
|
146
146
|
'agent-id': core_1.Flags.string({
|
|
147
147
|
description: 'Apply onto an existing agent instead of creating a new one (convergent re-run)',
|
|
@@ -259,6 +259,11 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
259
259
|
this.renderApplyResult(result, flags.json);
|
|
260
260
|
}
|
|
261
261
|
async runRecommendationAction(flags) {
|
|
262
|
+
if (flags['apply-recommendation'] && !flags['spec-hash']?.trim()) {
|
|
263
|
+
this.error(`Applying a recommendation requires --spec-hash <reviewed-hash>. ` +
|
|
264
|
+
'Use the Spec hash from the recommendation preview or recommendation.specHash from the approval JSON. ' +
|
|
265
|
+
`Run: ${this.config.bin} agents spawn --apply-recommendation ${flags['apply-recommendation']} --spec-hash <reviewed-hash>`, { exit: 1 });
|
|
266
|
+
}
|
|
262
267
|
let approved = null;
|
|
263
268
|
if (flags['approve-recommendation']) {
|
|
264
269
|
approved = await proactiveApi_1.proactiveApi.approveProactiveAgentRecommendation(flags['approve-recommendation'], flags['spec-hash'] ? { specHash: flags['spec-hash'] } : undefined);
|
|
@@ -268,7 +273,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
268
273
|
return;
|
|
269
274
|
}
|
|
270
275
|
this.log(`Approved recommendation ${approved.recommendation.id}`);
|
|
271
|
-
this.log(`Apply it: ${this.config.bin} agents spawn --apply-recommendation ${approved.recommendation.id}`);
|
|
276
|
+
this.log(`Apply it: ${this.config.bin} agents spawn --apply-recommendation ${approved.recommendation.id} --spec-hash ${approved.recommendation.specHash}`);
|
|
272
277
|
return;
|
|
273
278
|
}
|
|
274
279
|
}
|
|
@@ -29,6 +29,10 @@ function describeFireAuditDetail(detail, fireId, triggerId) {
|
|
|
29
29
|
if (quietHours) {
|
|
30
30
|
lines.push(`Explanation: ${quietHours.summary}. ${quietHours.detail}`);
|
|
31
31
|
}
|
|
32
|
+
const policy = (0, triggers_1.policyAuditExplanation)(detail);
|
|
33
|
+
if (policy) {
|
|
34
|
+
lines.push(`Explanation: ${policy.summary}. ${policy.detail}`);
|
|
35
|
+
}
|
|
32
36
|
if (detail.durationMs !== undefined)
|
|
33
37
|
lines.push(`Duration: ${String(detail.durationMs)}ms`);
|
|
34
38
|
if (detail.conversationId)
|
package/dist/lib/triggers.d.ts
CHANGED
|
@@ -592,6 +592,13 @@ export declare function quietHoursAuditExplanation(fire: {
|
|
|
592
592
|
summary: string;
|
|
593
593
|
detail: string;
|
|
594
594
|
} | null;
|
|
595
|
+
export declare function policyAuditExplanation(fire: {
|
|
596
|
+
outcome?: unknown;
|
|
597
|
+
reason?: unknown;
|
|
598
|
+
}): {
|
|
599
|
+
summary: string;
|
|
600
|
+
detail: string;
|
|
601
|
+
} | null;
|
|
595
602
|
export declare function renderFireAudit(fires: TriggerFireRecord[], log: (line: string) => void): void;
|
|
596
603
|
/**
|
|
597
604
|
* Trigger budget for one scope. `active` counts only ENABLED rows — a disabled
|
package/dist/lib/triggers.js
CHANGED
|
@@ -54,6 +54,7 @@ exports.fireRefusalLines = fireRefusalLines;
|
|
|
54
54
|
exports.renderTriggerSummary = renderTriggerSummary;
|
|
55
55
|
exports.renderLegacyRuns = renderLegacyRuns;
|
|
56
56
|
exports.quietHoursAuditExplanation = quietHoursAuditExplanation;
|
|
57
|
+
exports.policyAuditExplanation = policyAuditExplanation;
|
|
57
58
|
exports.renderFireAudit = renderFireAudit;
|
|
58
59
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
59
60
|
const node_fs_1 = require("node:fs");
|
|
@@ -1541,6 +1542,14 @@ function quietHoursAuditExplanation(fire) {
|
|
|
1541
1542
|
detail: 'Review the trigger and Agent quiet-hours settings before retrying.',
|
|
1542
1543
|
};
|
|
1543
1544
|
}
|
|
1545
|
+
function policyAuditExplanation(fire) {
|
|
1546
|
+
if (fire.outcome !== 'skipped' || fire.reason !== 'initiative_policy_suggestions_only')
|
|
1547
|
+
return null;
|
|
1548
|
+
return {
|
|
1549
|
+
summary: 'Skipped: suggestions-only policy',
|
|
1550
|
+
detail: 'The Agent policy prevented autonomous execution. Review the trigger preflight and Agent policy; an inbox suggestion is not guaranteed.',
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1544
1553
|
function renderFireAudit(fires, log) {
|
|
1545
1554
|
if (fires.length === 0) {
|
|
1546
1555
|
log('No fire audit records.');
|
|
@@ -1553,7 +1562,7 @@ function renderFireAudit(fires, log) {
|
|
|
1553
1562
|
source: fire.source ?? '-',
|
|
1554
1563
|
reason: fire.metadata?.recordKind === 'schedule_end_marker'
|
|
1555
1564
|
? 'Schedule ended after prior fire'
|
|
1556
|
-
: quietHoursAuditExplanation(fire)?.summary ?? fire.reason ?? fire.errorMessage ?? '',
|
|
1565
|
+
: quietHoursAuditExplanation(fire)?.summary ?? policyAuditExplanation(fire)?.summary ?? fire.reason ?? fire.errorMessage ?? '',
|
|
1557
1566
|
duration: fire.durationMs === undefined ? '-' : `${fire.durationMs}ms`,
|
|
1558
1567
|
replay: fire.metadata?.replayable === true || fire.metadata?.replayContext
|
|
1559
1568
|
? 'yes'
|
package/oclif.manifest.json
CHANGED
|
@@ -15706,8 +15706,8 @@
|
|
|
15706
15706
|
"<%= config.bin %> agents spawn \"plan my day every morning, working hours 9-6\" --approve",
|
|
15707
15707
|
"<%= config.bin %> agents spawn \"ping me when a PR needs review\" --json",
|
|
15708
15708
|
"<%= config.bin %> agents spawn \"watch launch blockers\" --recommend",
|
|
15709
|
-
"<%= config.bin %> agents spawn --approve-recommendation par_123",
|
|
15710
|
-
"<%= config.bin %> agents spawn --apply-recommendation par_123",
|
|
15709
|
+
"<%= config.bin %> agents spawn --approve-recommendation par_123 --spec-hash <reviewed-hash>",
|
|
15710
|
+
"<%= config.bin %> agents spawn --apply-recommendation par_123 --spec-hash <reviewed-hash>",
|
|
15711
15711
|
"<%= config.bin %> agents spawn --from-spec spec.json --approve"
|
|
15712
15712
|
],
|
|
15713
15713
|
"flags": {
|
|
@@ -15770,21 +15770,21 @@
|
|
|
15770
15770
|
"type": "option"
|
|
15771
15771
|
},
|
|
15772
15772
|
"apply-recommendation": {
|
|
15773
|
-
"description": "Apply an already-approved proactive-agent recommendation id",
|
|
15773
|
+
"description": "Apply an already-approved proactive-agent recommendation id (requires --spec-hash)",
|
|
15774
15774
|
"name": "apply-recommendation",
|
|
15775
15775
|
"hasDynamicHelp": false,
|
|
15776
15776
|
"multiple": false,
|
|
15777
15777
|
"type": "option"
|
|
15778
15778
|
},
|
|
15779
15779
|
"spec-hash": {
|
|
15780
|
-
"description": "
|
|
15780
|
+
"description": "Hash from the reviewed recommendation (required for apply; optional for approval)",
|
|
15781
15781
|
"name": "spec-hash",
|
|
15782
15782
|
"hasDynamicHelp": false,
|
|
15783
15783
|
"multiple": false,
|
|
15784
15784
|
"type": "option"
|
|
15785
15785
|
},
|
|
15786
15786
|
"from-spec": {
|
|
15787
|
-
"description": "Path to a spec JSON (or \"-\" for stdin) to apply directly (requires --approve)",
|
|
15787
|
+
"description": "Path to a spec JSON (or \"-\" for stdin) to apply directly (requires --approve). An explicit empty systems list skips implicit baseline watchers.",
|
|
15788
15788
|
"name": "from-spec",
|
|
15789
15789
|
"hasDynamicHelp": false,
|
|
15790
15790
|
"multiple": false,
|
|
@@ -143532,5 +143532,5 @@
|
|
|
143532
143532
|
]
|
|
143533
143533
|
}
|
|
143534
143534
|
},
|
|
143535
|
-
"version": "0.1.
|
|
143535
|
+
"version": "0.1.139"
|
|
143536
143536
|
}
|