@skrr-ai/cli 0.1.139 → 0.1.141
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/base-command.js +4 -1
- package/dist/commands/agent/message/send.d.ts +11 -0
- package/dist/commands/agent/message/send.js +44 -0
- package/dist/commands/agents/always-on/status.js +24 -3
- package/dist/commands/agents/create.js +3 -1
- package/dist/commands/agents/spawn.js +68 -10
- package/dist/commands/agents/update.js +23 -0
- package/dist/commands/commitments/endpoints/list.d.ts +2 -2
- package/dist/commands/commitments/endpoints/list.js +3 -3
- package/dist/commands/store/install.js +19 -0
- package/dist/lib/proactiveApi.d.ts +33 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +4407 -4395
- package/oclif.manifest.json +6 -5
- package/package.json +1 -1
package/dist/base-command.js
CHANGED
|
@@ -1826,7 +1826,10 @@ class BaseCommand extends core_1.Command {
|
|
|
1826
1826
|
e.message.includes('ECONNREFUSED') ||
|
|
1827
1827
|
e.message.includes('fetch failed')) {
|
|
1828
1828
|
this.failWithCliError({
|
|
1829
|
-
message: say(
|
|
1829
|
+
message: say(e.code === 'ECONNREFUSED' || e.message.includes('ECONNREFUSED')
|
|
1830
|
+
? `Could not connect to ${this.cliConfig.baseURL}. Is the API server running?`
|
|
1831
|
+
: `The request to ${this.cliConfig.baseURL} failed before its outcome could be confirmed. ` +
|
|
1832
|
+
'It may have reached the server. Check the result before retrying.'),
|
|
1830
1833
|
code: e.code || 'NETWORK_ERROR',
|
|
1831
1834
|
exit: 5,
|
|
1832
1835
|
retryable: true,
|
|
@@ -73,6 +73,17 @@ export type CanonicalIntentEnvelope = {
|
|
|
73
73
|
* a compromised producer cannot elevate itself into a session principal.
|
|
74
74
|
*/
|
|
75
75
|
export default class AgentMessageSend extends BaseCommand {
|
|
76
|
+
private attemptedMessageKey?;
|
|
77
|
+
private partialSequence?;
|
|
78
|
+
protected failWithCliError(input: {
|
|
79
|
+
message: string;
|
|
80
|
+
code: string;
|
|
81
|
+
status?: number;
|
|
82
|
+
exit: number;
|
|
83
|
+
retryable: boolean;
|
|
84
|
+
details?: unknown;
|
|
85
|
+
requestId?: string;
|
|
86
|
+
}): never;
|
|
76
87
|
static description: string;
|
|
77
88
|
static examples: string[];
|
|
78
89
|
static args: {
|
|
@@ -75,6 +75,40 @@ const PROTOCOL_VERSION = 1;
|
|
|
75
75
|
* a compromised producer cannot elevate itself into a session principal.
|
|
76
76
|
*/
|
|
77
77
|
class AgentMessageSend extends base_command_1.BaseCommand {
|
|
78
|
+
attemptedMessageKey;
|
|
79
|
+
partialSequence;
|
|
80
|
+
failWithCliError(input) {
|
|
81
|
+
const partial = this.partialSequence;
|
|
82
|
+
const retry = this.attemptedMessageKey && input.exit === 5 && input.retryable && !input.status
|
|
83
|
+
? {
|
|
84
|
+
idempotencyKey: partial?.sequenceId || this.attemptedMessageKey,
|
|
85
|
+
...(partial ? { attemptedPartKey: this.attemptedMessageKey } : {}),
|
|
86
|
+
}
|
|
87
|
+
: undefined;
|
|
88
|
+
if (!partial && !retry)
|
|
89
|
+
return super.failWithCliError(input);
|
|
90
|
+
const originalDetails = input.details;
|
|
91
|
+
const extra = { ...(partial ? { partialSequence: partial } : {}), ...(retry ? { messageRetry: retry } : {}) };
|
|
92
|
+
const details = originalDetails && typeof originalDetails === 'object' && !Array.isArray(originalDetails)
|
|
93
|
+
? {
|
|
94
|
+
...originalDetails,
|
|
95
|
+
...(Object.keys(extra).some((key) => Object.hasOwn(originalDetails, key)) ? { originalDetails } : {}),
|
|
96
|
+
...extra,
|
|
97
|
+
}
|
|
98
|
+
: { ...(originalDetails === undefined ? {} : { originalDetails }), ...extra };
|
|
99
|
+
const outcomes = partial?.parts.map((part, index) => `${index + 1}: ${part.intent.status}`).join(', ');
|
|
100
|
+
const sequenceNote = partial ? `\nEarlier part outcomes: ${outcomes || 'none'}. ` +
|
|
101
|
+
`Part ${partial.attemptedPart} was attempted; ${partial.unattemptedParts} later part(s) were not sent.` : '';
|
|
102
|
+
const json = this.wantsJsonOutput();
|
|
103
|
+
if (retry && !json) {
|
|
104
|
+
// oclif wraps error text and inserts prefixes into long generated keys.
|
|
105
|
+
// Write the key as a single stderr line so it remains copyable.
|
|
106
|
+
process.stderr.write(`Retry idempotency key: ${retry.idempotencyKey}\n`);
|
|
107
|
+
}
|
|
108
|
+
const retryNote = retry ? '\nIf you retry the same message, reuse the retry key shown above.' : '';
|
|
109
|
+
const message = json ? input.message : input.message + sequenceNote + retryNote;
|
|
110
|
+
return super.failWithCliError({ ...input, message, details });
|
|
111
|
+
}
|
|
78
112
|
static description = 'Submit a channel-neutral agent message intent through the ProactiveMessageGateway';
|
|
79
113
|
static examples = [
|
|
80
114
|
'<%= config.bin %> agent message send --from-json payload.json --json',
|
|
@@ -314,6 +348,14 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
314
348
|
const envelopes = [];
|
|
315
349
|
let halt;
|
|
316
350
|
for (const [index, requestPart] of requests.entries()) {
|
|
351
|
+
this.attemptedMessageKey = requestPart.idempotencyKey;
|
|
352
|
+
this.partialSequence = requests.length > 1 ? {
|
|
353
|
+
sequenceId: idempotencyKey,
|
|
354
|
+
parts: [...envelopes],
|
|
355
|
+
attemptedPart: index + 1,
|
|
356
|
+
totalParts: requests.length,
|
|
357
|
+
unattemptedParts: requests.length - index - 1,
|
|
358
|
+
} : undefined;
|
|
317
359
|
const envelope = sessionContext
|
|
318
360
|
? await this.submitAsSession({
|
|
319
361
|
sessionContext,
|
|
@@ -326,6 +368,8 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
326
368
|
agentIdentity: agentIdentity,
|
|
327
369
|
principalSource,
|
|
328
370
|
});
|
|
371
|
+
this.partialSequence = undefined;
|
|
372
|
+
this.attemptedMessageKey = undefined;
|
|
329
373
|
envelopes.push(envelope);
|
|
330
374
|
// A part that did not reach the user must stop the sequence. Continuing
|
|
331
375
|
// would deliver thought 3 while thought 2 sits held for approval, and the
|
|
@@ -36,11 +36,32 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
|
|
|
36
36
|
catch (err) {
|
|
37
37
|
this.handleApiError(err);
|
|
38
38
|
}
|
|
39
|
+
// This endpoint authorizes and resolves by Agent ID. Its messaging scope is
|
|
40
|
+
// built from the Agent's own workspace, which can differ from the global
|
|
41
|
+
// workspace header supplied by the caller.
|
|
42
|
+
const resolvedWorkspaceId = status.messaging?.scope?.workspaceId;
|
|
43
|
+
const workspaceSelection = flags.workspace
|
|
44
|
+
? {
|
|
45
|
+
requestedWorkspaceId: flags.workspace,
|
|
46
|
+
resolvedWorkspaceId: resolvedWorkspaceId || null,
|
|
47
|
+
notice: !resolvedWorkspaceId
|
|
48
|
+
? 'Status was resolved by Agent ID; the Agent workspace could not be confirmed.'
|
|
49
|
+
: resolvedWorkspaceId !== flags.workspace
|
|
50
|
+
? 'Status was resolved by Agent ID in a different workspace than requested.'
|
|
51
|
+
: null,
|
|
52
|
+
}
|
|
53
|
+
: null;
|
|
39
54
|
if (flags.json) {
|
|
40
|
-
this.log(JSON.stringify(status, null, 2));
|
|
55
|
+
this.log(JSON.stringify(workspaceSelection ? { ...status, workspaceSelection } : status, null, 2));
|
|
41
56
|
return;
|
|
42
57
|
}
|
|
43
58
|
this.log(`Agent: ${args.id}`);
|
|
59
|
+
if (resolvedWorkspaceId)
|
|
60
|
+
this.log(`Agent workspace: ${resolvedWorkspaceId}`);
|
|
61
|
+
if (workspaceSelection?.notice) {
|
|
62
|
+
this.log(`Workspace: ${workspaceSelection.notice}`);
|
|
63
|
+
this.log(`Requested: ${workspaceSelection.requestedWorkspaceId}`);
|
|
64
|
+
}
|
|
44
65
|
this.log(`Desired: ${status.desiredEnabled ? 'on' : 'off'}`);
|
|
45
66
|
this.log(`Generation: ${status.generation}`);
|
|
46
67
|
this.log(`Operational: ${status.operationalState}`);
|
|
@@ -57,8 +78,8 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
|
|
|
57
78
|
}
|
|
58
79
|
const cr = status.checkRun;
|
|
59
80
|
this.log(`Checks/Runs: checks=${cr.checks.queued + cr.checks.running}` +
|
|
60
|
-
` runs=${cr.runs.queued + cr.runs.running + cr.runs.waiting}` +
|
|
61
|
-
` (active=${cr.activeTotal})`);
|
|
81
|
+
` runs=${(cr.runs.deferred ?? 0) + cr.runs.queued + cr.runs.running + cr.runs.waiting}` +
|
|
82
|
+
` (deferred=${cr.runs.deferred ?? 0}, active=${cr.activeTotal})`);
|
|
62
83
|
if (status.messaging?.degraded) {
|
|
63
84
|
const reasons = (status.messaging.degradedReasons || []).join(', ') || 'unknown';
|
|
64
85
|
this.log(`Messaging: degraded (${reasons})`);
|
|
@@ -288,7 +288,9 @@ class AgentsCreate extends base_command_1.BaseCommand {
|
|
|
288
288
|
'support-contact': core_1.Flags.string({
|
|
289
289
|
description: 'Support contact JSON object: {"name","email","security_email"}. The Store listing shows the email and security_email of the published release.',
|
|
290
290
|
}),
|
|
291
|
-
'install-first-contact': core_1.Flags.string({
|
|
291
|
+
'install-first-contact': core_1.Flags.string({
|
|
292
|
+
description: 'First-contact config JSON value; notificationPolicy is normal or silent (legacy quiet is also accepted)',
|
|
293
|
+
}),
|
|
292
294
|
'end-after-tools': core_1.Flags.boolean({ description: 'End turn after tools' }),
|
|
293
295
|
'hide-sequential-outputs': core_1.Flags.boolean({ description: 'Hide sequential outputs' }),
|
|
294
296
|
'is-collaborative': core_1.Flags.boolean({ description: 'Enable collaboration' }),
|
|
@@ -53,6 +53,27 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
53
53
|
if (result.warnings.length === 0) {
|
|
54
54
|
return { status: 'ready', message: 'All requested setup steps completed.' };
|
|
55
55
|
}
|
|
56
|
+
if (result.warnings.some((warning) => warning.step.startsWith('commitment.'))) {
|
|
57
|
+
const affected = (result.installed.commitments || []).filter((commitment) => commitment.status !== 'active' || result.warnings.some((warning) => warning.step === `commitment.${commitment.title}`));
|
|
58
|
+
const ids = [...new Set(affected.map((commitment) => commitment.id))]
|
|
59
|
+
.filter((id) => typeof id === 'string' && /^[A-Za-z0-9_-]+$/.test(id));
|
|
60
|
+
const safeAgentId = /^[A-Za-z0-9_-]+$/.test(result.agentId) ? result.agentId : null;
|
|
61
|
+
return {
|
|
62
|
+
status: 'degraded',
|
|
63
|
+
message: ids.length
|
|
64
|
+
? `Review the existing Commitment${ids.length === 1 ? '' : 's'} ${ids.join(', ')} and resolve the reported issues. Review any other setup warnings as well.`
|
|
65
|
+
: 'A requested Commitment needs attention. Review the setup warnings and inspect the Agent’s existing Commitments before deciding what to do next.',
|
|
66
|
+
...(ids.length === 1
|
|
67
|
+
? { repairCommand: `${bin} commitments preflight ${ids[0]}` }
|
|
68
|
+
: safeAgentId ? { repairCommand: `${bin} commitments list --agent ${safeAgentId}` } : {}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (result.warnings.some((warning) => ['job_preserved_disabled', 'job_already_fired', 'job_state_unavailable'].includes(warning.code))) {
|
|
72
|
+
return {
|
|
73
|
+
status: 'degraded',
|
|
74
|
+
message: 'An existing scheduled job needs attention. Review the setup warnings before deciding what to do next.',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
56
77
|
if (result.warnings.some((warning) => warning.code === 'always_on_off')) {
|
|
57
78
|
return {
|
|
58
79
|
status: 'degraded',
|
|
@@ -84,10 +105,11 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
84
105
|
};
|
|
85
106
|
}
|
|
86
107
|
const repairCommand = `${bin} agents spawn --agent-id ${result.agentId} --from-spec <spec.json> --approve`;
|
|
108
|
+
const watcherFailed = result.warnings.some((warning) => warning.step.startsWith('watcher.'));
|
|
87
109
|
return {
|
|
88
110
|
status: 'degraded',
|
|
89
|
-
message: '
|
|
90
|
-
'Do not assume failed watchers are active
|
|
111
|
+
message: 'Some requested setup steps need attention. Review the warnings.' +
|
|
112
|
+
(watcherFailed ? ' Do not assume failed watchers are active.' : ''),
|
|
91
113
|
repairCommand,
|
|
92
114
|
};
|
|
93
115
|
}
|
|
@@ -129,7 +151,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
129
151
|
description: 'Create the agent and install the proactive system(s) (otherwise plan-only)',
|
|
130
152
|
}),
|
|
131
153
|
recommend: core_1.Flags.boolean({
|
|
132
|
-
description: 'Persist a reviewable recommendation
|
|
154
|
+
description: 'Persist a reviewable recommendation from a sentence (cannot be combined with --from-spec)',
|
|
133
155
|
}),
|
|
134
156
|
'approve-recommendation': core_1.Flags.string({
|
|
135
157
|
description: 'Approve an existing proactive-agent recommendation id',
|
|
@@ -158,6 +180,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
158
180
|
async run() {
|
|
159
181
|
this.requireAuth();
|
|
160
182
|
const { args, flags } = await this.parse(AgentsSpawn);
|
|
183
|
+
if (flags.recommend && flags['from-spec']) {
|
|
184
|
+
this.error('--recommend cannot be combined with --from-spec. Use a sentence with --recommend, or review the spec and apply it with --from-spec and --approve.', { exit: 1 });
|
|
185
|
+
}
|
|
161
186
|
try {
|
|
162
187
|
if (flags['approve-recommendation'] || flags['apply-recommendation']) {
|
|
163
188
|
await this.runRecommendationAction(flags);
|
|
@@ -197,7 +222,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
197
222
|
...(flags.timezone ? { timezone: flags.timezone } : {}),
|
|
198
223
|
fromReviewedSpec: true,
|
|
199
224
|
});
|
|
200
|
-
this.renderApplyResult(result, flags.json);
|
|
225
|
+
this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
|
|
201
226
|
}
|
|
202
227
|
async runFromSentence(sentence, flags) {
|
|
203
228
|
const history = (flags.message ?? []).map((content) => ({
|
|
@@ -208,6 +233,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
208
233
|
const result = await proactiveApi_1.proactiveApi.planProactiveAgentRecommendation({
|
|
209
234
|
sentence,
|
|
210
235
|
source: 'manual',
|
|
236
|
+
...(flags.name ? { name: flags.name } : {}),
|
|
211
237
|
...(history.length > 0 ? { history } : {}),
|
|
212
238
|
...(flags.timezone ? { timezone: flags.timezone } : {}),
|
|
213
239
|
});
|
|
@@ -227,13 +253,17 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
227
253
|
if (plan.needsRefinement || !plan.spec) {
|
|
228
254
|
if (flags.json) {
|
|
229
255
|
this.log(JSON.stringify(plan, null, 2));
|
|
256
|
+
if (plan.failure)
|
|
257
|
+
this.exit(1);
|
|
230
258
|
return;
|
|
231
259
|
}
|
|
232
260
|
this.log(plan.message);
|
|
233
261
|
if (plan.droppedWatchers && plan.droppedWatchers.length > 0) {
|
|
234
262
|
this.log(`(ignored unknown sources: ${plan.droppedWatchers.join(', ')})`);
|
|
235
263
|
}
|
|
236
|
-
this.error(
|
|
264
|
+
this.error(plan.failure
|
|
265
|
+
? 'Planning could not start. Review the billing guidance above.'
|
|
266
|
+
: 'Could not build a complete agent yet — refine the sentence and try again.', {
|
|
237
267
|
exit: 1,
|
|
238
268
|
});
|
|
239
269
|
}
|
|
@@ -256,7 +286,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
256
286
|
...(flags.timezone ? { timezone: flags.timezone } : {}),
|
|
257
287
|
fromReviewedSpec: false,
|
|
258
288
|
});
|
|
259
|
-
this.renderApplyResult(result, flags.json);
|
|
289
|
+
this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
|
|
260
290
|
}
|
|
261
291
|
async runRecommendationAction(flags) {
|
|
262
292
|
if (flags['apply-recommendation'] && !flags['spec-hash']?.trim()) {
|
|
@@ -286,7 +316,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
286
316
|
...(flags.timezone ? { timezone: flags.timezone } : {}),
|
|
287
317
|
...(flags['spec-hash'] ? { specHash: flags['spec-hash'] } : {}),
|
|
288
318
|
});
|
|
289
|
-
this.renderApplyResult(result, flags.json);
|
|
319
|
+
this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
|
|
290
320
|
}
|
|
291
321
|
renderSpec(spec) {
|
|
292
322
|
const id = spec.identity;
|
|
@@ -314,8 +344,13 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
314
344
|
`hours: ${o.workingHours.start}–${o.workingHours.end}` +
|
|
315
345
|
`${o.workingHours.timezone ? ` ${o.workingHours.timezone}` : ''}`);
|
|
316
346
|
}
|
|
347
|
+
if (Array.isArray(spec.commitments) && spec.commitments.length > 0) {
|
|
348
|
+
this.log('');
|
|
349
|
+
this.log('Commitments (as provided; subject to validation):');
|
|
350
|
+
this.log(JSON.stringify(spec.commitments, null, 2));
|
|
351
|
+
}
|
|
317
352
|
}
|
|
318
|
-
renderApplyResult(result, json) {
|
|
353
|
+
renderApplyResult(result, json, existingAgent) {
|
|
319
354
|
const readiness = proactiveInstallReadiness(result, this.config.bin);
|
|
320
355
|
if (json) {
|
|
321
356
|
this.log(JSON.stringify({
|
|
@@ -325,7 +360,7 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
325
360
|
}, null, 2));
|
|
326
361
|
return;
|
|
327
362
|
}
|
|
328
|
-
this.log(
|
|
363
|
+
this.log(`${existingAgent ? 'Existing agent' : 'Spawned agent'} ${result.agentId}`);
|
|
329
364
|
this.log(`URL: ${(0, web_url_1.agentUrlFrom)(this.cliConfig.baseURL, { id: result.agentId }) ?? '-'}`);
|
|
330
365
|
this.log(`Status: ${readiness.status.toUpperCase()} — ${readiness.message}`);
|
|
331
366
|
const w = result.installed.worker;
|
|
@@ -336,6 +371,25 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
336
371
|
const o = result.installed.orchestrator;
|
|
337
372
|
if (o) {
|
|
338
373
|
this.log(` orchestrator: ${o.ok ? `installed${o.status ? ` (${o.status})` : ''}` : 'failed'}`);
|
|
374
|
+
if (o.scheduleNotice)
|
|
375
|
+
this.log(` ${o.scheduleNotice}`);
|
|
376
|
+
for (const schedule of o.schedules || []) {
|
|
377
|
+
const state = !schedule.triggerId
|
|
378
|
+
? 'not scheduled'
|
|
379
|
+
: schedule.enabled === null ? 'unknown' : schedule.enabled ? 'enabled' : 'disabled';
|
|
380
|
+
this.log(` ${schedule.kind}: ${state}` +
|
|
381
|
+
(schedule.triggerId ? ` (${schedule.triggerId})` : '') +
|
|
382
|
+
(schedule.reason ? ` — ${schedule.reason}` : ''));
|
|
383
|
+
}
|
|
384
|
+
if (o.schedules?.some((schedule) => schedule.triggerId)) {
|
|
385
|
+
this.log(` Preflight: ${this.config.bin} triggers preflight <trigger-id>`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
for (const watcher of result.installed.defaultWatchers || []) {
|
|
389
|
+
if (!watcher.ok)
|
|
390
|
+
continue;
|
|
391
|
+
const state = watcher.enabled == null ? 'unknown' : watcher.enabled ? 'enabled' : 'disabled';
|
|
392
|
+
this.log(` ${watcher.source}: ${state}` + (watcher.triggerId ? ` (${watcher.triggerId})` : ''));
|
|
339
393
|
}
|
|
340
394
|
if (result.warnings.length > 0) {
|
|
341
395
|
this.log(' warnings:');
|
|
@@ -353,6 +407,8 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
353
407
|
renderRecommendationResult(recommendation, plan, json) {
|
|
354
408
|
if (json) {
|
|
355
409
|
this.log(JSON.stringify({ plan, recommendation }, null, 2));
|
|
410
|
+
if (plan.failure)
|
|
411
|
+
this.exit(1);
|
|
356
412
|
return;
|
|
357
413
|
}
|
|
358
414
|
if (!recommendation) {
|
|
@@ -360,7 +416,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
360
416
|
if (plan.droppedWatchers && plan.droppedWatchers.length > 0) {
|
|
361
417
|
this.log(`(ignored unknown sources: ${plan.droppedWatchers.join(', ')})`);
|
|
362
418
|
}
|
|
363
|
-
this.error(
|
|
419
|
+
this.error(plan.failure
|
|
420
|
+
? 'Recommendation was not created because planning could not start. Review the billing guidance above.'
|
|
421
|
+
: 'Recommendation was not created — refine the sentence and try again.', {
|
|
364
422
|
exit: 1,
|
|
365
423
|
});
|
|
366
424
|
}
|
|
@@ -333,6 +333,29 @@ function alwaysOnReceiptLine(payload, updated) {
|
|
|
333
333
|
if (!receipt)
|
|
334
334
|
return null;
|
|
335
335
|
const state = payload.isAlwaysOn ? 'on' : 'off';
|
|
336
|
+
const reply = updated && typeof updated === 'object' && !Array.isArray(updated)
|
|
337
|
+
? updated
|
|
338
|
+
: null;
|
|
339
|
+
const command = reply?.controlCommand && typeof reply.controlCommand === 'object'
|
|
340
|
+
? reply.controlCommand
|
|
341
|
+
: null;
|
|
342
|
+
const current = reply?.state && typeof reply.state === 'object'
|
|
343
|
+
? reply.state
|
|
344
|
+
: null;
|
|
345
|
+
if (command?.enabled === payload.isAlwaysOn &&
|
|
346
|
+
typeof command.generation === 'number' &&
|
|
347
|
+
typeof command.supersededByGeneration === 'number' &&
|
|
348
|
+
typeof current?.isAlwaysOn === 'boolean') {
|
|
349
|
+
const action = receipt.unchanged.some((entry) => entry.field === 'isAlwaysOn')
|
|
350
|
+
? `already ${state}`
|
|
351
|
+
: receipt.applied.some((entry) => entry.field === 'isAlwaysOn')
|
|
352
|
+
? `turned ${state}`
|
|
353
|
+
: null;
|
|
354
|
+
if (action) {
|
|
355
|
+
return `Always-On: ${action} at generation ${command.generation}; ` +
|
|
356
|
+
`now ${current.isAlwaysOn ? 'on' : 'off'} at generation ${command.supersededByGeneration}.`;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
336
359
|
if (receipt.unchanged.some((entry) => entry.field === 'isAlwaysOn')) {
|
|
337
360
|
return `Always-On: already ${state}; nothing changed.`;
|
|
338
361
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
/**
|
|
3
|
-
* `skrr commitments endpoints list
|
|
3
|
+
* `skrr commitments endpoints list --agent <id>` — delivery targets for an Agent.
|
|
4
4
|
*
|
|
5
5
|
* The `USABLE` column is the one that matters: it is the field the commitment
|
|
6
6
|
* invocation actually reads when deciding whether a report target can be used.
|
|
@@ -12,7 +12,7 @@ export default class CommitmentsEndpointsList extends BaseCommand {
|
|
|
12
12
|
static examples: string[];
|
|
13
13
|
static flags: {
|
|
14
14
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
-
agent: import("@oclif/core/interfaces").OptionFlag<string
|
|
15
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
};
|
|
17
17
|
run(): Promise<void>;
|
|
18
18
|
}
|
|
@@ -5,7 +5,7 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
6
|
const commitment_endpoints_1 = require("../../../lib/commitment-endpoints");
|
|
7
7
|
/**
|
|
8
|
-
* `skrr commitments endpoints list
|
|
8
|
+
* `skrr commitments endpoints list --agent <id>` — delivery targets for an Agent.
|
|
9
9
|
*
|
|
10
10
|
* The `USABLE` column is the one that matters: it is the field the commitment
|
|
11
11
|
* invocation actually reads when deciding whether a report target can be used.
|
|
@@ -15,12 +15,12 @@ const commitment_endpoints_1 = require("../../../lib/commitment-endpoints");
|
|
|
15
15
|
class CommitmentsEndpointsList extends base_command_1.BaseCommand {
|
|
16
16
|
static description = 'List commitment delivery endpoints';
|
|
17
17
|
static examples = [
|
|
18
|
-
'<%= config.bin %> commitments endpoints list',
|
|
18
|
+
'<%= config.bin %> commitments endpoints list --agent agent_abc',
|
|
19
19
|
'<%= config.bin %> commitments endpoints list --agent agent_abc --json',
|
|
20
20
|
];
|
|
21
21
|
static flags = {
|
|
22
22
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
23
|
-
agent: core_1.Flags.string({ description: '
|
|
23
|
+
agent: core_1.Flags.string({ description: 'Agent ID whose delivery endpoints to list', required: true }),
|
|
24
24
|
};
|
|
25
25
|
async run() {
|
|
26
26
|
this.requireAuth();
|
|
@@ -197,6 +197,25 @@ class StoreInstall extends base_command_1.BaseCommand {
|
|
|
197
197
|
}
|
|
198
198
|
const installedId = response?.installedAgentId;
|
|
199
199
|
this.log(`Installed as ${installedId ?? '-'}.`);
|
|
200
|
+
if (response?.proactive?.armed === false) {
|
|
201
|
+
this.log('This Agent starts in standby (Always-On is off).');
|
|
202
|
+
if (response.proactive.enable?.cli) {
|
|
203
|
+
this.log(`To let it work on its own: ${response.proactive.enable.cli}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const firstContact = response?.installFirstContact;
|
|
207
|
+
if (firstContact?.scheduled === true) {
|
|
208
|
+
const rawRunAt = firstContact.runAt ?? firstContact.scheduledFor;
|
|
209
|
+
const date = rawRunAt instanceof Date ? rawRunAt : rawRunAt ? new Date(rawRunAt) : undefined;
|
|
210
|
+
const when = date && Number.isFinite(date.getTime()) ? ` for ${date.toISOString()}` : '';
|
|
211
|
+
this.log(`A one-time first-contact greeting is scheduled${when}.`);
|
|
212
|
+
}
|
|
213
|
+
else if (firstContact?.duplicate === true || firstContact?.reason === 'already_scheduled') {
|
|
214
|
+
this.log('A first-contact trigger already exists; check its status to see whether it is still pending.');
|
|
215
|
+
}
|
|
216
|
+
else if (firstContact?.scheduled === false) {
|
|
217
|
+
this.log('No first-contact greeting was scheduled by this install.');
|
|
218
|
+
}
|
|
200
219
|
// Report only what the server says it wrote. A server that does not echo a
|
|
201
220
|
// placement predates it and wrote none, so naming one here would be a claim
|
|
202
221
|
// about a copy this CLI cannot see.
|
|
@@ -48,6 +48,7 @@ export interface ProactiveAgentSpec {
|
|
|
48
48
|
mode: OrchestratorMode;
|
|
49
49
|
executePlan: boolean;
|
|
50
50
|
};
|
|
51
|
+
commitments?: Array<Record<string, unknown>>;
|
|
51
52
|
initialize?: {
|
|
52
53
|
goals?: Array<{
|
|
53
54
|
title: string;
|
|
@@ -82,6 +83,11 @@ export interface PlanProactiveAgentResponse {
|
|
|
82
83
|
spec: ProactiveAgentSpec | null;
|
|
83
84
|
message: string;
|
|
84
85
|
needsRefinement: boolean;
|
|
86
|
+
failure?: {
|
|
87
|
+
code: string;
|
|
88
|
+
retryable: boolean;
|
|
89
|
+
billingOwnerType: string | null;
|
|
90
|
+
};
|
|
85
91
|
droppedWatchers?: string[];
|
|
86
92
|
usage?: {
|
|
87
93
|
inputTokens: number;
|
|
@@ -120,7 +126,31 @@ export interface ApplyProactiveAgentResponse {
|
|
|
120
126
|
ok: boolean;
|
|
121
127
|
status?: string;
|
|
122
128
|
code?: string;
|
|
129
|
+
scheduleNotice?: string;
|
|
130
|
+
schedules?: Array<{
|
|
131
|
+
kind: string;
|
|
132
|
+
triggerId: string | null;
|
|
133
|
+
enabled: boolean | null;
|
|
134
|
+
reason?: string;
|
|
135
|
+
}>;
|
|
123
136
|
};
|
|
137
|
+
defaultWatchers?: Array<{
|
|
138
|
+
source: string;
|
|
139
|
+
ok: boolean;
|
|
140
|
+
triggerId?: string | null;
|
|
141
|
+
enabled?: boolean | null;
|
|
142
|
+
code?: string;
|
|
143
|
+
}>;
|
|
144
|
+
commitments?: Array<{
|
|
145
|
+
id: string;
|
|
146
|
+
title?: string;
|
|
147
|
+
status?: string;
|
|
148
|
+
activated?: boolean;
|
|
149
|
+
blockedBy?: Array<{
|
|
150
|
+
gate?: string;
|
|
151
|
+
reason?: string;
|
|
152
|
+
}>;
|
|
153
|
+
}>;
|
|
124
154
|
initialize?: {
|
|
125
155
|
goals: Array<{
|
|
126
156
|
id?: string;
|
|
@@ -136,6 +166,8 @@ export interface ApplyProactiveAgentResponse {
|
|
|
136
166
|
id?: string;
|
|
137
167
|
ok: boolean;
|
|
138
168
|
code?: string;
|
|
169
|
+
enabled?: boolean | null;
|
|
170
|
+
firedAt?: string;
|
|
139
171
|
}>;
|
|
140
172
|
};
|
|
141
173
|
};
|
|
@@ -230,6 +262,7 @@ export declare const proactiveApi: {
|
|
|
230
262
|
}) => Promise<ApplyProactiveAgentResponse>;
|
|
231
263
|
/** Meta-agent path: plan and persist a reviewable recommendation. */
|
|
232
264
|
planProactiveAgentRecommendation: (body: {
|
|
265
|
+
name?: string;
|
|
233
266
|
sentence?: string;
|
|
234
267
|
history?: Array<{
|
|
235
268
|
role: "user" | "assistant";
|