@skrr-ai/cli 0.1.207 → 0.1.209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/agent/message/no-reply.js +1 -1
- package/dist/commands/agent/message/react.d.ts +23 -0
- package/dist/commands/agent/message/react.js +125 -0
- package/dist/commands/agent/message/resolve.d.ts +31 -0
- package/dist/commands/agent/message/resolve.js +111 -0
- package/dist/commands/agent/message/retract.js +1 -1
- package/dist/commands/agent/message/send.d.ts +25 -6
- package/dist/commands/agent/message/send.js +135 -30
- package/dist/commands/agent/request/list.d.ts +15 -0
- package/dist/commands/agent/request/list.js +82 -0
- package/dist/commands/agent/request/send.d.ts +18 -0
- package/dist/commands/agent/request/send.js +56 -0
- package/dist/commands/agents/access/approve.d.ts +17 -0
- package/dist/commands/agents/access/approve.js +94 -0
- package/dist/commands/agents/access/deny.d.ts +10 -0
- package/dist/commands/agents/access/deny.js +36 -0
- package/dist/commands/agents/access/list.d.ts +10 -0
- package/dist/commands/agents/access/list.js +55 -0
- package/dist/commands/agents/access/reach.d.ts +13 -0
- package/dist/commands/agents/access/reach.js +53 -0
- package/dist/commands/agents/access/revoke.d.ts +13 -0
- package/dist/commands/agents/access/revoke.js +50 -0
- package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
- package/dist/commands/agents/always-on/recovery-review.js +16 -0
- package/dist/commands/agents/chat.d.ts +8 -0
- package/dist/commands/agents/chat.js +369 -90
- package/dist/commands/agents/import.d.ts +15 -1
- package/dist/commands/agents/import.js +212 -24
- package/dist/commands/agents/intuitions/accept.d.ts +0 -1
- package/dist/commands/agents/intuitions/accept.js +22 -7
- package/dist/commands/agents/intuitions/generate.d.ts +0 -1
- package/dist/commands/agents/intuitions/generate.js +4 -16
- package/dist/commands/agents/intuitions/list.js +9 -3
- package/dist/commands/agents/intuitions/resume.d.ts +11 -0
- package/dist/commands/agents/intuitions/resume.js +37 -0
- package/dist/commands/agents/manager/status.js +7 -6
- package/dist/commands/agents/not-for-task.d.ts +24 -0
- package/dist/commands/agents/not-for-task.js +60 -0
- package/dist/commands/agents/schedule-overview.d.ts +20 -0
- package/dist/commands/agents/schedule-overview.js +35 -2
- package/dist/commands/agents/shared-memory.d.ts +24 -0
- package/dist/commands/agents/shared-memory.js +67 -0
- package/dist/commands/agents/stop.d.ts +23 -0
- package/dist/commands/agents/stop.js +61 -0
- package/dist/commands/agents/update.d.ts +7 -0
- package/dist/commands/agents/update.js +45 -2
- package/dist/commands/agents/visibility.d.ts +1 -0
- package/dist/commands/agents/visibility.js +14 -0
- package/dist/commands/code/migrate.js +3 -1
- package/dist/commands/convos/messages.js +5 -0
- package/dist/commands/convos/transcript.js +2 -2
- package/dist/commands/daemon/logs.d.ts +3 -1
- package/dist/commands/daemon/logs.js +6 -2
- package/dist/commands/duties/advance-next.js +16 -7
- package/dist/commands/duties/preflight.js +17 -13
- package/dist/commands/followups/show.js +9 -0
- package/dist/commands/followups/watch-pr.d.ts +27 -0
- package/dist/commands/followups/watch-pr.js +124 -0
- package/dist/commands/harnesses/evaluations/evidence.js +2 -2
- package/dist/commands/harnesses/evaluations/grant.js +1 -1
- package/dist/commands/harnesses/evaluations/revoke.js +1 -1
- package/dist/commands/harnesses/evaluations/show.js +1 -1
- package/dist/commands/harnesses/rollouts/grant.js +1 -1
- package/dist/commands/harnesses/rollouts/revoke.js +1 -1
- package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
- package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
- package/dist/commands/memory/consolidation/index.d.ts +20 -0
- package/dist/commands/memory/consolidation/index.js +78 -0
- package/dist/commands/memory/consolidation/resume.d.ts +14 -0
- package/dist/commands/memory/consolidation/resume.js +46 -0
- package/dist/commands/memory/consolidation/undo.d.ts +18 -0
- package/dist/commands/memory/consolidation/undo.js +61 -0
- package/dist/commands/messages/list.js +9 -1
- package/dist/commands/slack/mutes.d.ts +10 -0
- package/dist/commands/slack/mutes.js +62 -0
- package/dist/commands/slack/unmute.d.ts +12 -0
- package/dist/commands/slack/unmute.js +44 -0
- package/dist/commands/tasks/actionability.js +10 -0
- package/dist/commands/tasks/ask.d.ts +50 -0
- package/dist/commands/tasks/ask.js +190 -0
- package/dist/commands/tasks/bulk-update.js +12 -0
- package/dist/commands/tasks/handover.js +14 -0
- package/dist/commands/tasks/input/answer.js +8 -2
- package/dist/commands/tasks/input/show.d.ts +26 -0
- package/dist/commands/tasks/input/show.js +185 -17
- package/dist/commands/tasks/list.d.ts +8 -0
- package/dist/commands/tasks/list.js +50 -9
- package/dist/commands/tasks/move.d.ts +3 -0
- package/dist/commands/tasks/move.js +71 -1
- package/dist/commands/tasks/result/show.js +19 -7
- package/dist/commands/tasks/result/submit.js +3 -0
- package/dist/commands/tasks/runs.d.ts +4 -1
- package/dist/commands/tasks/runs.js +22 -3
- package/dist/commands/tasks/show.d.ts +4 -3
- package/dist/commands/tasks/show.js +40 -7
- package/dist/commands/tasks/start.js +35 -16
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +55 -1
- package/dist/commands/tasks/updates/add.js +3 -0
- package/dist/commands/tasks/wait.d.ts +20 -0
- package/dist/commands/tasks/wait.js +103 -2
- package/dist/generated/agent-guides.json +892 -183
- package/dist/generated/managed-instruction-guides.json +1 -1
- package/dist/lib/agent-access-command.d.ts +19 -0
- package/dist/lib/agent-access-command.js +44 -0
- package/dist/lib/agent-access.d.ts +18 -0
- package/dist/lib/agent-access.js +48 -0
- package/dist/lib/agent-import/apply.d.ts +50 -0
- package/dist/lib/agent-import/apply.js +85 -0
- package/dist/lib/agent-import/plan.d.ts +132 -0
- package/dist/lib/agent-import/plan.js +504 -0
- package/dist/lib/agent-import/reader.d.ts +94 -0
- package/dist/lib/agent-import/reader.js +326 -0
- package/dist/lib/agent-import/schedule.d.ts +46 -0
- package/dist/lib/agent-import/schedule.js +220 -0
- package/dist/lib/agent-import/sources.d.ts +124 -0
- package/dist/lib/agent-import/sources.js +797 -0
- package/dist/lib/chat-stop.d.ts +17 -0
- package/dist/lib/chat-stop.js +70 -0
- package/dist/lib/cloud-reply.d.ts +21 -0
- package/dist/lib/cloud-reply.js +52 -0
- package/dist/lib/duties.js +24 -4
- package/dist/lib/duty-ledgers.js +19 -2
- package/dist/lib/file-mime.js +8 -0
- package/dist/lib/followups.d.ts +61 -0
- package/dist/lib/followups.js +39 -0
- package/dist/lib/handover-interview.d.ts +18 -0
- package/dist/lib/handover-interview.js +53 -0
- package/dist/lib/inbound-messages.d.ts +156 -0
- package/dist/lib/inbound-messages.js +375 -0
- package/dist/lib/input-queue.js +2 -1
- package/dist/lib/intuition-look.d.ts +10 -0
- package/dist/lib/intuition-look.js +64 -0
- package/dist/lib/message-intent.d.ts +18 -2
- package/dist/lib/message-intent.js +23 -1
- package/dist/lib/preflight-copy.d.ts +16 -1
- package/dist/lib/preflight-copy.js +33 -1
- package/dist/lib/record-output.d.ts +1 -1
- package/dist/lib/record-output.js +2 -0
- package/dist/lib/skill-import.d.ts +19 -0
- package/dist/lib/skill-import.js +34 -0
- package/dist/lib/slack-thread-mutes.d.ts +25 -0
- package/dist/lib/slack-thread-mutes.js +12 -0
- package/dist/lib/task-carriers.d.ts +18 -0
- package/dist/lib/task-carriers.js +43 -0
- package/dist/lib/task-extras.d.ts +5 -0
- package/dist/lib/task-extras.js +5 -0
- package/dist/lib/task-operations.d.ts +2 -0
- package/dist/lib/task-operations.js +28 -4
- package/dist/lib/task-preflight.js +1 -0
- package/dist/lib/task-recurrence-summary.d.ts +15 -0
- package/dist/lib/task-recurrence-summary.js +22 -0
- package/dist/lib/task-review-notice.d.ts +21 -0
- package/dist/lib/task-review-notice.js +46 -0
- package/dist/lib/task-version.d.ts +53 -0
- package/dist/lib/task-version.js +89 -0
- package/dist/lib/task-write-attribution.d.ts +7 -0
- package/dist/lib/task-write-attribution.js +14 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +13492 -12505
- package/oclif.manifest.json +2090 -132
- package/package.json +9 -2
|
@@ -36,6 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.EXIT_DELIVERY_FAILED = exports.EXIT_DELIVERY_RETRYABLE = exports.OWNER_DM_SEGMENTATION_SOFT_LIMIT = void 0;
|
|
37
37
|
exports.withSendWaitNotice = withSendWaitNotice;
|
|
38
38
|
exports.messageSegmentationAdvisory = messageSegmentationAdvisory;
|
|
39
|
+
exports.messageVoiceAdvisory = messageVoiceAdvisory;
|
|
40
|
+
exports.resultReplyAdvisory = resultReplyAdvisory;
|
|
39
41
|
exports.buildSequencedRequests = buildSequencedRequests;
|
|
40
42
|
exports.sequenceComplete = sequenceComplete;
|
|
41
43
|
exports.deliveryExitCode = deliveryExitCode;
|
|
@@ -59,6 +61,9 @@ const cli_runtime_1 = require("../../../lib/cli-runtime");
|
|
|
59
61
|
const message_intent_1 = require("../../../lib/message-intent");
|
|
60
62
|
const entity_embeds_1 = require("../../../lib/entity-embeds");
|
|
61
63
|
const prompt_1 = require("../../../lib/prompt");
|
|
64
|
+
const http_error_1 = require("../../../lib/http-error");
|
|
65
|
+
const inbound_messages_1 = require("../../../lib/inbound-messages");
|
|
66
|
+
const runtime_context_1 = require("../../../lib/runtime-context");
|
|
62
67
|
const BUILD_DESTINATION_RE = /^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;
|
|
63
68
|
// eslint-disable-next-line no-control-regex -- Reject control characters in mail headers.
|
|
64
69
|
const BUILD_DESTINATION_RE_2 = /[\r\n\x00-\x1f\x7f]/;
|
|
@@ -71,7 +76,7 @@ const MAX_SEQUENCE_PARTS = data_provider_1.MAX_AGENT_MESSAGE_SEQUENCE_PARTS;
|
|
|
71
76
|
* permits much larger payloads; the sender remains responsible for choosing
|
|
72
77
|
* meaningful conversational boundaries.
|
|
73
78
|
*/
|
|
74
|
-
exports.OWNER_DM_SEGMENTATION_SOFT_LIMIT =
|
|
79
|
+
exports.OWNER_DM_SEGMENTATION_SOFT_LIMIT = data_provider_1.AGENT_MESSAGE_SEGMENTATION_SOFT_LIMIT;
|
|
75
80
|
const PROTOCOL_VERSION = 1;
|
|
76
81
|
/**
|
|
77
82
|
* Canonical CLI entry for agent-authored messages.
|
|
@@ -132,17 +137,32 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
132
137
|
const message = json ? input.message : input.message + sequenceNote + retryNote;
|
|
133
138
|
return super.failWithCliError({ ...input, message, details });
|
|
134
139
|
}
|
|
135
|
-
|
|
140
|
+
// An Agent reads `--help` as instructions, so the description says what the command is FOR and
|
|
141
|
+
// the examples are the messages worth sending, in the order a piece of work sends them. Every
|
|
142
|
+
// send still goes through the ProactiveMessageGateway; that is the mechanism, not the purpose.
|
|
143
|
+
static description = 'Send the owner a message from this Agent: it lands in their chat with the Agent (or another destination you name), and their policy decides how it reaches them. ' +
|
|
144
|
+
'Send when something changes what they know or should decide: what you are starting and when they will hear back, a finding, a choice they must make, a blocker, the result. ' +
|
|
145
|
+
'Run `agent message context` first to see what they have already read from you. ' +
|
|
146
|
+
'Judgment and a worked example: `skrr guide communication pacing`.';
|
|
147
|
+
// The story here (a search reindex) deliberately differs from the one in
|
|
148
|
+
// `skrr guide communication pacing` (a payment bug): an Agent copies the example it saw last, so
|
|
149
|
+
// two surfaces that tell one story teach one sentence instead of a shape.
|
|
136
150
|
static examples = [
|
|
137
|
-
|
|
138
|
-
'<%= config.bin %> agent message send --
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
//
|
|
142
|
-
'<%= config.bin %> agent message send --
|
|
143
|
-
|
|
151
|
+
// Starting: what you are doing and when they will hear back, as one status later sends replace.
|
|
152
|
+
'<%= config.bin %> agent message send --kind status --status-key search-reindex --text "Rebuilding the search index for the March archive. Searches keep using the old index until it is done, in about 15 minutes." --json',
|
|
153
|
+
// A finding that changes the plan.
|
|
154
|
+
'<%= config.bin %> agent message send --kind milestone --text "1,200 of the March documents have no language tag. I am indexing them as English and will list them for you to check." --json',
|
|
155
|
+
// A choice only they can make, with a recommendation and what happens meanwhile.
|
|
156
|
+
'<%= config.bin %> agent message send --kind decision --attention interrupt --text "Switch searches to the new index now, or after tonight\'s traffic peak? I recommend after the peak. I\'ll keep spot-checking results until you answer." --json',
|
|
157
|
+
// The outcome, once.
|
|
158
|
+
'<%= config.bin %> agent message send --kind result --text "Search finds the March archive again: 3,400 documents are back. The 1,200 untagged ones still need a language check." --json',
|
|
159
|
+
// Something said earlier was wrong: replace it rather than contradict it.
|
|
144
160
|
'<%= config.bin %> agent message send --supersedes <message-id> --text "Correction: the deploy is at 15:00, not 14:00." --json',
|
|
145
|
-
|
|
161
|
+
// Two thoughts as two short messages. The key carries the task id because dedup is scoped
|
|
162
|
+
// (owner, agent, key) for all time; a bare `checkpoint:verify` collides on the next run.
|
|
163
|
+
'<%= config.bin %> agent message send --kind milestone --idempotency-key <task-id>:verify --text "The adapter works end to end." --part "Group chats are next; 1:1 is done." --json',
|
|
164
|
+
'<%= config.bin %> agent message send --agent <agent-id> --destination slack_channel --channel C123 --text "Deploy finished." --json',
|
|
165
|
+
'<%= config.bin %> agent message send --from-json payload.json --json',
|
|
146
166
|
];
|
|
147
167
|
static args = {
|
|
148
168
|
agent: core_1.Args.string({
|
|
@@ -189,6 +209,12 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
189
209
|
'thread-root': core_1.Flags.string({
|
|
190
210
|
description: 'Agent Chat Thread root message ID for app_owner_dm. Do not use this for Slack; use --thread-ts.',
|
|
191
211
|
}),
|
|
212
|
+
'reply-to': core_1.Flags.string({
|
|
213
|
+
description: "The owner's message this one answers (app_owner_dm only). Repeat it for up to 10. The " +
|
|
214
|
+
'owner sees a quote of it above this message. Each must be one of their messages in the ' +
|
|
215
|
+
'chat this one lands in, or nothing is sent. With --part, only the first part names it.',
|
|
216
|
+
multiple: true,
|
|
217
|
+
}),
|
|
192
218
|
'from-json': core_1.Flags.string({
|
|
193
219
|
description: 'Path to a canonical intent JSON payload, or "-" for stdin',
|
|
194
220
|
}),
|
|
@@ -255,6 +281,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
255
281
|
channelId: flags.channel,
|
|
256
282
|
threadTs: flags['thread-ts'],
|
|
257
283
|
threadRootMessageId: flags['thread-root'],
|
|
284
|
+
replyTo: flags['reply-to'],
|
|
258
285
|
idempotencyKey: flags['idempotency-key'],
|
|
259
286
|
communicationKind: flags.kind,
|
|
260
287
|
phase: flags.phase,
|
|
@@ -323,6 +350,14 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
323
350
|
});
|
|
324
351
|
if (unsupported)
|
|
325
352
|
this.failWithCliError({ ...unsupported, retryable: false });
|
|
353
|
+
if (operation.kind === 'retract' && payload.replyTo) {
|
|
354
|
+
this.failWithCliError({
|
|
355
|
+
message: 'A withdrawal takes a message back; it answers nothing. Drop --reply-to.',
|
|
356
|
+
code: 'reply_to_invalid',
|
|
357
|
+
exit: 1,
|
|
358
|
+
retryable: false,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
326
361
|
}
|
|
327
362
|
// Manual task context accepts the same titles and references as task
|
|
328
363
|
// commands. Managed sessions must leave the claim-derived context alone.
|
|
@@ -338,6 +373,12 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
338
373
|
});
|
|
339
374
|
if (flags['message-lint'] && segmentationAdvisory)
|
|
340
375
|
this.warn(segmentationAdvisory);
|
|
376
|
+
const voiceAdvisory = messageVoiceAdvisory({
|
|
377
|
+
destination: payload.destination,
|
|
378
|
+
text: payload.content.text,
|
|
379
|
+
});
|
|
380
|
+
if (flags['message-lint'] && voiceAdvisory)
|
|
381
|
+
this.warn(voiceAdvisory);
|
|
341
382
|
// Resolve BEFORE the first send. A sequence that fails on part 2 because of
|
|
342
383
|
// a typo'd embed would have already delivered part 1, and a delivered
|
|
343
384
|
// message cannot be taken back.
|
|
@@ -373,6 +414,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
373
414
|
notificationPolicy: payload.notificationPolicy,
|
|
374
415
|
context: payload.context,
|
|
375
416
|
threadRootMessageId: payload.threadRootMessageId,
|
|
417
|
+
replyTo: payload.replyTo,
|
|
376
418
|
embeds,
|
|
377
419
|
operation,
|
|
378
420
|
});
|
|
@@ -441,6 +483,15 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
441
483
|
}
|
|
442
484
|
return { envelopes, halt };
|
|
443
485
|
});
|
|
486
|
+
const resultAdvisory = resultReplyAdvisory({
|
|
487
|
+
inSession: Boolean(sessionContext),
|
|
488
|
+
inTaskRun: Boolean((0, runtime_context_1.readRuntimeContext)().task.id),
|
|
489
|
+
kind: payload.presentation?.kind,
|
|
490
|
+
destination: payload.destination,
|
|
491
|
+
envelopes,
|
|
492
|
+
});
|
|
493
|
+
if (flags['message-lint'] && resultAdvisory)
|
|
494
|
+
this.warn(resultAdvisory);
|
|
444
495
|
if (flags.json) {
|
|
445
496
|
// Branch on the REQUESTED part count, not the sent count: a sequence that
|
|
446
497
|
// halted on its first part still has to report the parts it skipped.
|
|
@@ -494,12 +545,29 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
494
545
|
});
|
|
495
546
|
}
|
|
496
547
|
}
|
|
548
|
+
/** A reply the server refused, in the CLI's words, with the ids it could not prove. */
|
|
549
|
+
failOnReplyRefusal(err) {
|
|
550
|
+
if (err instanceof Error && err.name === 'MessageIntentCliError')
|
|
551
|
+
return;
|
|
552
|
+
const refusal = (0, inbound_messages_1.agentReplyRefusalOf)(err);
|
|
553
|
+
if (!refusal)
|
|
554
|
+
return;
|
|
555
|
+
this.failWithCliError({
|
|
556
|
+
message: inbound_messages_1.AGENT_REPLY_REFUSAL_COPY[refusal.code],
|
|
557
|
+
code: refusal.code,
|
|
558
|
+
status: (0, http_error_1.httpStatusOf)(err),
|
|
559
|
+
exit: 1,
|
|
560
|
+
retryable: false,
|
|
561
|
+
...(refusal.missing ? { details: { missing: refusal.missing } } : {}),
|
|
562
|
+
});
|
|
563
|
+
}
|
|
497
564
|
async submitAsSession({ sessionContext, request, agentIdentity, principalSource, }) {
|
|
498
565
|
let result;
|
|
499
566
|
try {
|
|
500
567
|
result = await (0, message_intent_1.submitSessionMessageIntent)({ context: sessionContext, request });
|
|
501
568
|
}
|
|
502
569
|
catch (err) {
|
|
570
|
+
this.failOnReplyRefusal(err);
|
|
503
571
|
if (err instanceof Error && err.name === 'MessageIntentCliError') {
|
|
504
572
|
this.failWithCliError({
|
|
505
573
|
message: err.message,
|
|
@@ -521,6 +589,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
521
589
|
content: request.content,
|
|
522
590
|
idempotencyKey: request.idempotencyKey,
|
|
523
591
|
threadRootMessageId: request.threadRootMessageId,
|
|
592
|
+
replyTo: request.replyTo,
|
|
524
593
|
presentation: request.presentation,
|
|
525
594
|
appliedPresentation: result.presentation,
|
|
526
595
|
notificationPolicy: request.notificationPolicy,
|
|
@@ -561,11 +630,13 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
561
630
|
...(request.threadRootMessageId
|
|
562
631
|
? { threadRootMessageId: request.threadRootMessageId }
|
|
563
632
|
: {}),
|
|
633
|
+
...(request.replyTo ? { replyTo: request.replyTo } : {}),
|
|
564
634
|
...(request.embeds && request.embeds.length > 0 ? { embeds: request.embeds } : {}),
|
|
565
635
|
...(request.context || {}),
|
|
566
636
|
});
|
|
567
637
|
}
|
|
568
638
|
catch (err) {
|
|
639
|
+
this.failOnReplyRefusal(err);
|
|
569
640
|
this.handleApiError(err);
|
|
570
641
|
}
|
|
571
642
|
return buildEnvelope({
|
|
@@ -579,6 +650,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
579
650
|
content: request.content,
|
|
580
651
|
idempotencyKey: request.idempotencyKey,
|
|
581
652
|
threadRootMessageId: request.threadRootMessageId,
|
|
653
|
+
replyTo: request.replyTo,
|
|
582
654
|
presentation: request.presentation,
|
|
583
655
|
notificationPolicy: request.notificationPolicy,
|
|
584
656
|
embeds: request.embeds,
|
|
@@ -659,24 +731,42 @@ function request_post(path, body) {
|
|
|
659
731
|
return data_provider_1.request.post(path, body);
|
|
660
732
|
}
|
|
661
733
|
/**
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
734
|
+
* The send-time advice is decided by `adviseAgentMessage` / `adviseAgentMessageDelivery` in
|
|
735
|
+
* `@skrr-ai/data-provider`, the rules a cloud turn's `send_message` tool reads too (OSK-33221), so
|
|
736
|
+
* the two surfaces cannot drift. What lives here is only the CLI's line around them. None of it
|
|
737
|
+
* ever rewrites, rejects, splits or delays a send: the message is already on its way, so each note
|
|
738
|
+
* is phrased for the next one.
|
|
665
739
|
*/
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
if (destination.kind !== 'app_owner_dm' && destination.kind !== 'slack_owner_dm')
|
|
740
|
+
const LINT_SUFFIX = 'This is only an advisory; use --no-message-lint to suppress it.';
|
|
741
|
+
function cliAdviceLine(advice, suffix = LINT_SUFFIX) {
|
|
742
|
+
if (advice.length === 0)
|
|
670
743
|
return undefined;
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
744
|
+
const sentences = advice.map((note) => (0, data_provider_1.renderAgentMessageAdvice)(note, 'cli'));
|
|
745
|
+
return `[skrr] ${[...sentences, suffix].filter(Boolean).join(' ')}`;
|
|
746
|
+
}
|
|
747
|
+
/** A long owner DM sent as one message. Silent once the sender split it with `--part`. */
|
|
748
|
+
function messageSegmentationAdvisory({ destination, text, followingParts, }) {
|
|
749
|
+
return cliAdviceLine((0, data_provider_1.adviseAgentMessage)({
|
|
750
|
+
destinationKind: destination.kind,
|
|
751
|
+
text,
|
|
752
|
+
followingParts: followingParts.length,
|
|
753
|
+
}).filter((note) => note.code === 'long_message'));
|
|
754
|
+
}
|
|
755
|
+
/** The two voice habits the doctrine names and a check can see: a label opener, named filler. */
|
|
756
|
+
function messageVoiceAdvisory({ destination, text, }) {
|
|
757
|
+
return cliAdviceLine((0, data_provider_1.adviseAgentMessage)({ destinationKind: destination.kind, text }).filter((note) => note.code === 'label_opener' || note.code === 'named_filler'));
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* A `result` delivered from an Agent session that is not a Task run: the turn's final reply must
|
|
761
|
+
* not say it again (C13's `turn_duplicate_result`).
|
|
762
|
+
*/
|
|
763
|
+
function resultReplyAdvisory({ inSession, inTaskRun, kind, destination, envelopes, }) {
|
|
764
|
+
return cliAdviceLine((0, data_provider_1.adviseAgentMessageDelivery)({
|
|
765
|
+
destinationKind: destination.kind,
|
|
766
|
+
kind,
|
|
767
|
+
delivered: envelopes.some((envelope) => envelope.intent?.status === 'delivered'),
|
|
768
|
+
inInteractiveTurn: inSession && !inTaskRun,
|
|
769
|
+
}), '');
|
|
680
770
|
}
|
|
681
771
|
/**
|
|
682
772
|
* Preserve the caller's semantic boundary while allowing them to send a few
|
|
@@ -702,8 +792,11 @@ function buildSequencedRequests(request, followingParts, hasExplicitIdempotencyK
|
|
|
702
792
|
if (!hasExplicitIdempotencyKey) {
|
|
703
793
|
throw new Error('A multi-message update requires an explicit --idempotency-key for safe retries.');
|
|
704
794
|
}
|
|
795
|
+
// A reply is named once, on the part that begins the answer; the rest continue it.
|
|
796
|
+
const { replyTo, ...rest } = request;
|
|
705
797
|
return parts.map((text, index) => ({
|
|
706
|
-
...
|
|
798
|
+
...rest,
|
|
799
|
+
...(index === 0 && replyTo ? { replyTo } : {}),
|
|
707
800
|
content: { text },
|
|
708
801
|
idempotencyKey: sequencePartKey(request.idempotencyKey, index),
|
|
709
802
|
sequence: sequenceMetadata(request.idempotencyKey, index, parts.length),
|
|
@@ -932,6 +1025,13 @@ function normalizeIntentPayload({ agentId, jsonBody, merged, }) {
|
|
|
932
1025
|
if (threadRootMessageId && destination.kind !== 'app_owner_dm') {
|
|
933
1026
|
throw invalidIntent('threadRootMessageId only applies to app_owner_dm; use --thread-ts for Slack.');
|
|
934
1027
|
}
|
|
1028
|
+
const replyTo = (0, inbound_messages_1.normalizeReplyTo)(merged.replyTo ?? jsonBody.replyTo);
|
|
1029
|
+
if (replyTo === 'invalid') {
|
|
1030
|
+
throw invalidIntent(inbound_messages_1.AGENT_REPLY_REFUSAL_COPY.reply_to_invalid, 'reply_to_invalid');
|
|
1031
|
+
}
|
|
1032
|
+
if (replyTo && destination.kind !== 'app_owner_dm') {
|
|
1033
|
+
throw invalidIntent(inbound_messages_1.AGENT_REPLY_REFUSAL_COPY.reply_to_destination_unsupported, 'reply_to_destination_unsupported');
|
|
1034
|
+
}
|
|
935
1035
|
const jsonContext = jsonBody.context && typeof jsonBody.context === 'object' && !Array.isArray(jsonBody.context)
|
|
936
1036
|
? jsonBody.context
|
|
937
1037
|
: {};
|
|
@@ -960,6 +1060,7 @@ function normalizeIntentPayload({ agentId, jsonBody, merged, }) {
|
|
|
960
1060
|
presentation,
|
|
961
1061
|
notificationPolicy,
|
|
962
1062
|
...(threadRootMessageId ? { threadRootMessageId } : {}),
|
|
1063
|
+
...(replyTo ? { replyTo } : {}),
|
|
963
1064
|
...(Object.keys(context).length > 0 ? { context } : {}),
|
|
964
1065
|
};
|
|
965
1066
|
}
|
|
@@ -1121,7 +1222,7 @@ function booleanFlagInput(argv, name, parsedValue) {
|
|
|
1121
1222
|
void parsedValue;
|
|
1122
1223
|
return undefined;
|
|
1123
1224
|
}
|
|
1124
|
-
function canonicalIntentFromDestination({ agentId, idempotencyKey, destination, text, presentation, notificationPolicy, context, threadRootMessageId, embeds, operation, }) {
|
|
1225
|
+
function canonicalIntentFromDestination({ agentId, idempotencyKey, destination, text, presentation, notificationPolicy, context, threadRootMessageId, replyTo, embeds, operation, }) {
|
|
1125
1226
|
switch (destination.kind) {
|
|
1126
1227
|
case 'agent_email':
|
|
1127
1228
|
return {
|
|
@@ -1141,6 +1242,7 @@ function canonicalIntentFromDestination({ agentId, idempotencyKey, destination,
|
|
|
1141
1242
|
presentation,
|
|
1142
1243
|
notificationPolicy,
|
|
1143
1244
|
threadRootMessageId,
|
|
1245
|
+
replyTo,
|
|
1144
1246
|
embeds,
|
|
1145
1247
|
operation,
|
|
1146
1248
|
...context,
|
|
@@ -1213,6 +1315,8 @@ function generateIdempotencyKey(agentId, payload, operation) {
|
|
|
1213
1315
|
presentation: payload.presentation,
|
|
1214
1316
|
context: payload.context,
|
|
1215
1317
|
threadRootMessageId: payload.threadRootMessageId,
|
|
1318
|
+
// The same words answering another message are another send; absent, the key is unchanged.
|
|
1319
|
+
...(payload.replyTo ? { replyTo: payload.replyTo } : {}),
|
|
1216
1320
|
// The same words correcting another message are another send. Absent for an ordinary
|
|
1217
1321
|
// send, so its key is the one it had before C10.
|
|
1218
1322
|
...(operation ? { operation } : {}),
|
|
@@ -1268,6 +1372,7 @@ function buildEnvelope(input) {
|
|
|
1268
1372
|
content: input.content,
|
|
1269
1373
|
idempotencyKey: input.idempotencyKey,
|
|
1270
1374
|
...(input.threadRootMessageId ? { threadRootMessageId: input.threadRootMessageId } : {}),
|
|
1375
|
+
...(input.replyTo && input.replyTo.length > 0 ? { replyTo: input.replyTo } : {}),
|
|
1271
1376
|
...(presentation ? { presentation } : {}),
|
|
1272
1377
|
...(input.notificationPolicy ? { notificationPolicy: input.notificationPolicy } : {}),
|
|
1273
1378
|
...(input.embeds && input.embeds.length > 0 ? { embeds: input.embeds } : {}),
|
|
@@ -1480,8 +1585,8 @@ function describeDestination(destination) {
|
|
|
1480
1585
|
}
|
|
1481
1586
|
return destination.kind;
|
|
1482
1587
|
}
|
|
1483
|
-
function invalidIntent(message) {
|
|
1588
|
+
function invalidIntent(message, code = 'INVALID_MESSAGE_INTENT') {
|
|
1484
1589
|
const err = new Error(message);
|
|
1485
|
-
err.code =
|
|
1590
|
+
err.code = code;
|
|
1486
1591
|
return err;
|
|
1487
1592
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/** The owner's record of peer requests between their Agents, newest first. */
|
|
3
|
+
export default class AgentRequestList extends BaseCommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
direction: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
state: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const format_1 = require("../../../lib/format");
|
|
7
|
+
const list_output_1 = require("../../../lib/list-output");
|
|
8
|
+
function stateText(row) {
|
|
9
|
+
const label = data_provider_1.PEER_REQUEST_STATE_LABELS[row.state] ?? row.state;
|
|
10
|
+
if (row.state !== 'unanswered' || !row.unansweredReason)
|
|
11
|
+
return label;
|
|
12
|
+
return `${label}: ${(0, data_provider_1.describePeerRequestUnanswered)(row.unansweredReason, 'the peer').sentence}`;
|
|
13
|
+
}
|
|
14
|
+
/** The owner's record of peer requests between their Agents, newest first. */
|
|
15
|
+
class AgentRequestList extends base_command_1.BaseCommand {
|
|
16
|
+
static description = 'List peer requests between your Agents (questions, handoffs and notes), newest first, with whether each was answered and why not';
|
|
17
|
+
static examples = [
|
|
18
|
+
'<%= config.bin %> agent request list',
|
|
19
|
+
'<%= config.bin %> agent request list --agent <agent-id> --direction received',
|
|
20
|
+
'<%= config.bin %> agent request list --task <task-id> --state unanswered --json',
|
|
21
|
+
];
|
|
22
|
+
static flags = {
|
|
23
|
+
agent: core_1.Flags.string({ description: 'Only requests this Agent sent or received' }),
|
|
24
|
+
direction: core_1.Flags.string({
|
|
25
|
+
options: [...data_provider_1.PEER_REQUEST_LIST_DIRECTIONS],
|
|
26
|
+
description: 'With --agent: only what it sent, only what it received, or both (default)',
|
|
27
|
+
}),
|
|
28
|
+
task: core_1.Flags.string({ description: 'Only requests asked from, or carried by, this Task' }),
|
|
29
|
+
state: core_1.Flags.string({
|
|
30
|
+
options: [...data_provider_1.PEER_REQUEST_STATES],
|
|
31
|
+
description: 'Only requests in this state',
|
|
32
|
+
}),
|
|
33
|
+
limit: core_1.Flags.integer({
|
|
34
|
+
description: 'At most this many (1-100, default 25)',
|
|
35
|
+
min: 1,
|
|
36
|
+
max: 100,
|
|
37
|
+
}),
|
|
38
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
39
|
+
};
|
|
40
|
+
async run() {
|
|
41
|
+
this.requireAuth();
|
|
42
|
+
const { flags } = await this.parse(AgentRequestList);
|
|
43
|
+
let response;
|
|
44
|
+
try {
|
|
45
|
+
response = await data_provider_1.dataService.listPeerRequests({
|
|
46
|
+
...(flags.agent ? { agentId: flags.agent } : {}),
|
|
47
|
+
...(flags.direction
|
|
48
|
+
? { direction: flags.direction }
|
|
49
|
+
: {}),
|
|
50
|
+
...(flags.task ? { taskId: flags.task } : {}),
|
|
51
|
+
...(flags.state ? { state: flags.state } : {}),
|
|
52
|
+
...(flags.limit ? { limit: flags.limit } : {}),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
this.handleApiError(error, { subject: 'peer requests' });
|
|
57
|
+
}
|
|
58
|
+
const rows = response.requests ?? [];
|
|
59
|
+
if (flags.json)
|
|
60
|
+
return void this.printJsonResult((0, list_output_1.listResult)({ data: rows }));
|
|
61
|
+
if (!rows.length)
|
|
62
|
+
return void this.log('No peer requests.');
|
|
63
|
+
(0, format_1.renderTable)(rows.map((row) => ({
|
|
64
|
+
kind: row.kind,
|
|
65
|
+
from: row.fromAgentId,
|
|
66
|
+
to: row.toAgentId,
|
|
67
|
+
state: stateText(row),
|
|
68
|
+
subject: row.subject,
|
|
69
|
+
task: row.homeTaskId,
|
|
70
|
+
id: row.id,
|
|
71
|
+
})), [
|
|
72
|
+
{ key: 'kind', header: 'KIND' },
|
|
73
|
+
{ key: 'from', header: 'FROM', maxWidth: 24 },
|
|
74
|
+
{ key: 'to', header: 'TO', maxWidth: 24 },
|
|
75
|
+
{ key: 'state', header: 'STATE', maxWidth: 60 },
|
|
76
|
+
{ key: 'subject', header: 'SUBJECT', maxWidth: 48 },
|
|
77
|
+
{ key: 'task', header: 'TASK', maxWidth: 24 },
|
|
78
|
+
{ key: 'id', header: 'ID' },
|
|
79
|
+
], (line) => this.log(line));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.default = AgentRequestList;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* Ask another Agent something from inside a Task run: the same verb as the Tasks MCP tool
|
|
4
|
+
* `agent_peer_request`. The run proves who is asking (its Task is where the answer arrives), so
|
|
5
|
+
* there is no flag for the asking Agent or its Task.
|
|
6
|
+
*/
|
|
7
|
+
export default class AgentRequestSend extends BaseCommand {
|
|
8
|
+
static description: string;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
to: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
kind: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
subject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
/**
|
|
7
|
+
* Ask another Agent something from inside a Task run: the same verb as the Tasks MCP tool
|
|
8
|
+
* `agent_peer_request`. The run proves who is asking (its Task is where the answer arrives), so
|
|
9
|
+
* there is no flag for the asking Agent or its Task.
|
|
10
|
+
*/
|
|
11
|
+
class AgentRequestSend extends base_command_1.BaseCommand {
|
|
12
|
+
static description = 'From inside a Task run, ask another Agent a question (its answer arrives on this Task and wakes you), hand it this Task when your run ends, or leave it a note that wakes nobody';
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> agent request send --to <agent-id> --subject "Which region serves EU traffic?" --body "Context the other agent needs"',
|
|
15
|
+
'<%= config.bin %> agent request send --to <agent-id> --kind handoff --subject "Finish the migration review"',
|
|
16
|
+
'<%= config.bin %> agent request send --to <agent-id> --kind status --subject "Schema change landed" --json',
|
|
17
|
+
];
|
|
18
|
+
static flags = {
|
|
19
|
+
to: core_1.Flags.string({ description: 'The id of the Agent to ask', required: true }),
|
|
20
|
+
kind: core_1.Flags.string({
|
|
21
|
+
options: [...data_provider_1.PEER_REQUEST_KINDS],
|
|
22
|
+
default: 'question',
|
|
23
|
+
description: 'question: it answers once with a Result, delivered here; handoff: it takes this Task over when your run ends; status: a note on this Task that wakes nobody',
|
|
24
|
+
}),
|
|
25
|
+
subject: core_1.Flags.string({
|
|
26
|
+
description: `The question, or what the handoff or note is about, in one line (at most ${data_provider_1.PEER_REQUEST_LIMITS.subjectMaxLength} characters)`,
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
body: core_1.Flags.string({
|
|
30
|
+
description: `Everything the other Agent needs without your context (at most ${data_provider_1.PEER_REQUEST_LIMITS.bodyMaxLength} characters)`,
|
|
31
|
+
}),
|
|
32
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
33
|
+
};
|
|
34
|
+
async run() {
|
|
35
|
+
this.requireAuth();
|
|
36
|
+
const { flags } = await this.parse(AgentRequestSend);
|
|
37
|
+
let response;
|
|
38
|
+
try {
|
|
39
|
+
response = await data_provider_1.dataService.sendPeerRequest({
|
|
40
|
+
to: flags.to,
|
|
41
|
+
kind: flags.kind,
|
|
42
|
+
subject: flags.subject,
|
|
43
|
+
...(flags.body ? { body: flags.body } : {}),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
this.handleApiError(error, { subject: 'peer request' });
|
|
48
|
+
}
|
|
49
|
+
if (flags.json)
|
|
50
|
+
return void this.printJsonResult(response);
|
|
51
|
+
this.log(response.message);
|
|
52
|
+
if (response.request)
|
|
53
|
+
this.log(`Peer request: ${response.request.id} (${response.request.state})`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = AgentRequestSend;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AgentAccessCommand } from '../../../lib/agent-access-command';
|
|
2
|
+
/**
|
|
3
|
+
* Approve an access request. Prints exactly what the person will be able to do
|
|
4
|
+
* through the agent (the same confirm the web shows) before it is saved.
|
|
5
|
+
*/
|
|
6
|
+
export default class AgentsAccessApprove extends AgentAccessCommand {
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static args: {
|
|
10
|
+
requestId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
11
|
+
};
|
|
12
|
+
static flags: {
|
|
13
|
+
reach: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const agent_access_command_1 = require("../../../lib/agent-access-command");
|
|
6
|
+
const agent_access_1 = require("../../../lib/agent-access");
|
|
7
|
+
const prompt_1 = require("../../../lib/prompt");
|
|
8
|
+
/**
|
|
9
|
+
* Approve an access request. Prints exactly what the person will be able to do
|
|
10
|
+
* through the agent (the same confirm the web shows) before it is saved.
|
|
11
|
+
*/
|
|
12
|
+
class AgentsAccessApprove extends agent_access_command_1.AgentAccessCommand {
|
|
13
|
+
static description = 'Approve an access request, choosing what the person may reach through the agent';
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> agents access approve <request-id> --agent <agent-id>',
|
|
16
|
+
'<%= config.bin %> agents access approve <request-id> --reach connected_apps --yes',
|
|
17
|
+
];
|
|
18
|
+
static args = {
|
|
19
|
+
requestId: core_1.Args.string({ description: 'Access request id', required: true, ignoreStdin: true }),
|
|
20
|
+
};
|
|
21
|
+
static flags = {
|
|
22
|
+
reach: core_1.Flags.string({
|
|
23
|
+
multiple: true,
|
|
24
|
+
description: `What they may reach: ${agent_access_1.TRUSTED_ASKER_REACH.join(', ')} (comma-separated), or none for conversation only`,
|
|
25
|
+
}),
|
|
26
|
+
yes: core_1.Flags.boolean({ char: 'y', description: 'Approve without asking to confirm' }),
|
|
27
|
+
};
|
|
28
|
+
async run() {
|
|
29
|
+
this.requireAuth();
|
|
30
|
+
const { args, flags } = await this.parse(AgentsAccessApprove);
|
|
31
|
+
const { reach, unknown } = (0, agent_access_1.parseReachFlag)(flags.reach);
|
|
32
|
+
if (unknown.length) {
|
|
33
|
+
this.failWithCliError({
|
|
34
|
+
message: `Unknown reach: ${unknown.join(', ')}. Use ${agent_access_1.TRUSTED_ASKER_REACH.join(', ')} or none.`,
|
|
35
|
+
code: 'INVALID_REACH',
|
|
36
|
+
exit: 2,
|
|
37
|
+
retryable: false,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const agentId = await this.accessAgentId(flags.agent);
|
|
41
|
+
const access = await this.readAccess(agentId);
|
|
42
|
+
const request = access.requests.find((row) => row.id === args.requestId);
|
|
43
|
+
if (!request) {
|
|
44
|
+
this.failWithCliError({
|
|
45
|
+
message: `No access request ${args.requestId} on this agent. List them with \`${this.config.bin} agents access list\`.`,
|
|
46
|
+
code: 'not_found',
|
|
47
|
+
status: 404,
|
|
48
|
+
exit: 1,
|
|
49
|
+
retryable: false,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const personName = request.requesterName || request.platformUserId;
|
|
53
|
+
if (!flags.json) {
|
|
54
|
+
this.log(`Approving ${personName} for ${access.agentName || access.agentId}:`);
|
|
55
|
+
const lines = (0, agent_access_1.confirmLines)((0, data_provider_1.describeTrustedAskerReach)(reach, {
|
|
56
|
+
agentName: access.agentName,
|
|
57
|
+
personName,
|
|
58
|
+
connectedApps: access.connectedApps,
|
|
59
|
+
}));
|
|
60
|
+
for (const line of lines)
|
|
61
|
+
this.log(line);
|
|
62
|
+
}
|
|
63
|
+
let ok = false;
|
|
64
|
+
try {
|
|
65
|
+
ok = await (0, prompt_1.confirmDestructive)('Approve?', Boolean(flags.yes));
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
const e = err;
|
|
69
|
+
if (e.exit === 7)
|
|
70
|
+
this.error(e.message ?? 'Confirmation required.', { exit: 7 });
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
if (!ok) {
|
|
74
|
+
this.log('Not approved.');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
let result;
|
|
78
|
+
try {
|
|
79
|
+
result = await data_provider_1.dataService.decideAgentAccessRequest(agentId, args.requestId, {
|
|
80
|
+
decision: 'approve',
|
|
81
|
+
reach,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
this.handleApiError(err);
|
|
86
|
+
}
|
|
87
|
+
if (flags.json) {
|
|
88
|
+
this.printJsonResult(result);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.log(`Approved. ${personName} is trusted from their next message (${result.trustedAsker?.id ?? 'saved'}).`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.default = AgentsAccessApprove;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AgentAccessCommand } from '../../../lib/agent-access-command';
|
|
2
|
+
/** Decline an access request. The person cannot ask again for a week. */
|
|
3
|
+
export default class AgentsAccessDeny extends AgentAccessCommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static args: {
|
|
7
|
+
requestId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|