@skrr-ai/cli 0.1.207 → 0.1.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/agent/message/resolve.d.ts +31 -0
- package/dist/commands/agent/message/resolve.js +111 -0
- package/dist/commands/agent/message/send.d.ts +17 -5
- package/dist/commands/agent/message/send.js +77 -26
- package/dist/commands/agent/request/list.d.ts +15 -0
- package/dist/commands/agent/request/list.js +82 -0
- package/dist/commands/agent/request/send.d.ts +18 -0
- package/dist/commands/agent/request/send.js +56 -0
- package/dist/commands/agents/access/approve.d.ts +17 -0
- package/dist/commands/agents/access/approve.js +94 -0
- package/dist/commands/agents/access/deny.d.ts +10 -0
- package/dist/commands/agents/access/deny.js +36 -0
- package/dist/commands/agents/access/list.d.ts +10 -0
- package/dist/commands/agents/access/list.js +53 -0
- package/dist/commands/agents/access/reach.d.ts +13 -0
- package/dist/commands/agents/access/reach.js +53 -0
- package/dist/commands/agents/access/revoke.d.ts +13 -0
- package/dist/commands/agents/access/revoke.js +50 -0
- package/dist/commands/agents/import.d.ts +15 -1
- package/dist/commands/agents/import.js +211 -23
- package/dist/commands/agents/intuitions/accept.d.ts +0 -1
- package/dist/commands/agents/intuitions/accept.js +22 -7
- package/dist/commands/agents/intuitions/generate.d.ts +0 -1
- package/dist/commands/agents/intuitions/generate.js +4 -16
- package/dist/commands/agents/intuitions/list.js +9 -3
- package/dist/commands/agents/intuitions/resume.d.ts +11 -0
- package/dist/commands/agents/intuitions/resume.js +37 -0
- package/dist/commands/agents/shared-memory.d.ts +24 -0
- package/dist/commands/agents/shared-memory.js +67 -0
- package/dist/commands/agents/visibility.d.ts +1 -0
- package/dist/commands/agents/visibility.js +14 -0
- package/dist/commands/code/migrate.js +3 -1
- package/dist/commands/duties/advance-next.js +15 -6
- package/dist/commands/followups/show.js +9 -0
- package/dist/commands/followups/watch-pr.d.ts +27 -0
- package/dist/commands/followups/watch-pr.js +123 -0
- package/dist/commands/memory/consolidation/index.d.ts +20 -0
- package/dist/commands/memory/consolidation/index.js +78 -0
- package/dist/commands/memory/consolidation/resume.d.ts +14 -0
- package/dist/commands/memory/consolidation/resume.js +46 -0
- package/dist/commands/memory/consolidation/undo.d.ts +18 -0
- package/dist/commands/memory/consolidation/undo.js +60 -0
- package/dist/commands/slack/mutes.d.ts +10 -0
- package/dist/commands/slack/mutes.js +62 -0
- package/dist/commands/slack/unmute.d.ts +12 -0
- package/dist/commands/slack/unmute.js +44 -0
- package/dist/commands/tasks/actionability.js +9 -0
- package/dist/commands/tasks/ask.d.ts +50 -0
- package/dist/commands/tasks/ask.js +190 -0
- package/dist/commands/tasks/handover.js +14 -0
- package/dist/commands/tasks/input/answer.js +8 -2
- package/dist/commands/tasks/input/show.d.ts +26 -0
- package/dist/commands/tasks/input/show.js +185 -17
- package/dist/commands/tasks/move.d.ts +11 -0
- package/dist/commands/tasks/move.js +82 -1
- package/dist/commands/tasks/result/submit.js +3 -0
- package/dist/commands/tasks/runs.d.ts +4 -1
- package/dist/commands/tasks/runs.js +22 -3
- package/dist/commands/tasks/show.js +22 -1
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +52 -1
- package/dist/commands/tasks/updates/add.js +3 -0
- package/dist/commands/tasks/wait.d.ts +20 -0
- package/dist/commands/tasks/wait.js +102 -1
- package/dist/generated/agent-guides.json +501 -92
- package/dist/generated/managed-instruction-guides.json +1 -1
- package/dist/lib/agent-access-command.d.ts +19 -0
- package/dist/lib/agent-access-command.js +44 -0
- package/dist/lib/agent-access.d.ts +18 -0
- package/dist/lib/agent-access.js +48 -0
- package/dist/lib/agent-import/apply.d.ts +50 -0
- package/dist/lib/agent-import/apply.js +85 -0
- package/dist/lib/agent-import/plan.d.ts +132 -0
- package/dist/lib/agent-import/plan.js +504 -0
- package/dist/lib/agent-import/reader.d.ts +94 -0
- package/dist/lib/agent-import/reader.js +326 -0
- package/dist/lib/agent-import/schedule.d.ts +46 -0
- package/dist/lib/agent-import/schedule.js +220 -0
- package/dist/lib/agent-import/sources.d.ts +124 -0
- package/dist/lib/agent-import/sources.js +797 -0
- package/dist/lib/followups.d.ts +61 -0
- package/dist/lib/followups.js +39 -0
- package/dist/lib/handover-interview.d.ts +18 -0
- package/dist/lib/handover-interview.js +53 -0
- package/dist/lib/input-queue.js +2 -1
- package/dist/lib/intuition-look.d.ts +10 -0
- package/dist/lib/intuition-look.js +64 -0
- package/dist/lib/record-output.d.ts +1 -1
- package/dist/lib/record-output.js +2 -0
- package/dist/lib/skill-import.d.ts +19 -0
- package/dist/lib/skill-import.js +34 -0
- package/dist/lib/slack-thread-mutes.d.ts +25 -0
- package/dist/lib/slack-thread-mutes.js +12 -0
- package/dist/lib/task-carriers.d.ts +18 -0
- package/dist/lib/task-carriers.js +43 -0
- package/dist/lib/task-extras.d.ts +5 -0
- package/dist/lib/task-extras.js +5 -0
- package/dist/lib/task-recurrence-summary.d.ts +15 -0
- package/dist/lib/task-recurrence-summary.js +22 -0
- package/dist/lib/task-version.d.ts +44 -0
- package/dist/lib/task-version.js +73 -0
- package/dist/lib/task-write-attribution.d.ts +7 -0
- package/dist/lib/task-write-attribution.js +14 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +13323 -12577
- package/oclif.manifest.json +1787 -107
- package/package.json +5 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/** What the server answers a resolution with (`Communication/messageAsks.resolveAsk`). */
|
|
3
|
+
export type AskResolution = {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
messageId?: string;
|
|
6
|
+
already?: boolean;
|
|
7
|
+
reason?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
currentMessageId?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Record that this Agent has the answer to a question it asked its owner (a message sent with
|
|
13
|
+
* `--requires-response`, a `decision` or a `blocker`). Nothing is sent: the server marks the ask
|
|
14
|
+
* resolved after proving, through the session, that this Agent sent it. The person's Needs-you list
|
|
15
|
+
* stops showing the wait, and the Agent's next turn stops listing it as open.
|
|
16
|
+
*
|
|
17
|
+
* Only inside an Agent session: a person at a terminal has no ask of their own to resolve.
|
|
18
|
+
*/
|
|
19
|
+
export default class AgentMessageResolve extends BaseCommand {
|
|
20
|
+
static description: string;
|
|
21
|
+
static examples: string[];
|
|
22
|
+
static args: {
|
|
23
|
+
messageId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
24
|
+
};
|
|
25
|
+
static flags: {
|
|
26
|
+
note: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
};
|
|
29
|
+
run(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare function describeAskResolution(messageId: string, result: AskResolution): string;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describeAskResolution = describeAskResolution;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
|
+
const base_command_1 = require("../../../base-command");
|
|
7
|
+
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
8
|
+
const message_intent_1 = require("../../../lib/message-intent");
|
|
9
|
+
/**
|
|
10
|
+
* Record that this Agent has the answer to a question it asked its owner (a message sent with
|
|
11
|
+
* `--requires-response`, a `decision` or a `blocker`). Nothing is sent: the server marks the ask
|
|
12
|
+
* resolved after proving, through the session, that this Agent sent it. The person's Needs-you list
|
|
13
|
+
* stops showing the wait, and the Agent's next turn stops listing it as open.
|
|
14
|
+
*
|
|
15
|
+
* Only inside an Agent session: a person at a terminal has no ask of their own to resolve.
|
|
16
|
+
*/
|
|
17
|
+
class AgentMessageResolve extends base_command_1.BaseCommand {
|
|
18
|
+
static description = 'Record that a question this Agent asked its owner is answered, so it stops showing as waiting on them. Nothing is sent. Only inside an Agent session, for its own messages';
|
|
19
|
+
static examples = [
|
|
20
|
+
'<%= config.bin %> agent message resolve <message-id>',
|
|
21
|
+
'<%= config.bin %> agent message resolve <message-id> --note "They chose staging"',
|
|
22
|
+
];
|
|
23
|
+
static args = {
|
|
24
|
+
messageId: core_1.Args.string({
|
|
25
|
+
description: 'The messageId of the question (printed by `agent message send`, listed among your open questions at the start of a turn, and in `agent message context`)',
|
|
26
|
+
required: true,
|
|
27
|
+
ignoreStdin: true,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
static flags = {
|
|
31
|
+
note: core_1.Flags.string({
|
|
32
|
+
description: `A short note of the answer, kept with the question (at most ${data_provider_1.MESSAGE_ASK_NOTE_MAX_CHARS} characters)`,
|
|
33
|
+
}),
|
|
34
|
+
json: core_1.Flags.boolean({ description: 'Print the server’s answer as JSON' }),
|
|
35
|
+
};
|
|
36
|
+
async run() {
|
|
37
|
+
const { args, flags } = await this.parse(AgentMessageResolve);
|
|
38
|
+
const messageId = args.messageId.trim();
|
|
39
|
+
if (!messageId) {
|
|
40
|
+
this.failWithCliError({
|
|
41
|
+
message: 'Name the messageId of the question to resolve.',
|
|
42
|
+
code: 'INVALID_MESSAGE_ID',
|
|
43
|
+
exit: 1,
|
|
44
|
+
retryable: false,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (flags.note !== undefined && flags.note.length > data_provider_1.MESSAGE_ASK_NOTE_MAX_CHARS) {
|
|
48
|
+
this.failWithCliError({
|
|
49
|
+
message: `--note is at most ${data_provider_1.MESSAGE_ASK_NOTE_MAX_CHARS} characters.`,
|
|
50
|
+
code: 'ASK_NOTE_TOO_LONG',
|
|
51
|
+
exit: 1,
|
|
52
|
+
retryable: false,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
let sessionContext;
|
|
56
|
+
try {
|
|
57
|
+
sessionContext = (0, message_intent_1.resolveMessageCommandSessionContext)({
|
|
58
|
+
// A person has no ask of their own to resolve: only the Agent's session can.
|
|
59
|
+
requireHumanAuth: () => undefined,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
this.failWithCliError({
|
|
64
|
+
message: error.message,
|
|
65
|
+
code: error.code || 'MESSAGE_INTENT_ERROR',
|
|
66
|
+
exit: 2,
|
|
67
|
+
retryable: false,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (!sessionContext?.sessionId) {
|
|
71
|
+
this.failWithCliError({
|
|
72
|
+
message: '`agent message resolve` closes one of the Agent’s own questions, so it only works inside that Agent’s session.',
|
|
73
|
+
code: 'MESSAGE_OPERATION_REQUIRES_SESSION',
|
|
74
|
+
exit: 2,
|
|
75
|
+
retryable: false,
|
|
76
|
+
details: {
|
|
77
|
+
suggestion: 'Run it from the session of the Agent that asked. Outside one there is no Agent to resolve it as.',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
let result;
|
|
82
|
+
try {
|
|
83
|
+
result = (await (0, api_fetch_1.apiFetch)(`/api/agentic/sessions/${encodeURIComponent(sessionContext.sessionId)}/message-asks/${encodeURIComponent(messageId)}/resolve`, {
|
|
84
|
+
method: 'POST',
|
|
85
|
+
credential: (0, message_intent_1.sessionCredential)(sessionContext.token),
|
|
86
|
+
body: flags.note ? { note: flags.note } : {},
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
this.handleApiError(error);
|
|
91
|
+
}
|
|
92
|
+
if (flags.json) {
|
|
93
|
+
this.log(JSON.stringify(result, null, 2));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.log(describeAskResolution(messageId, result));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.default = AgentMessageResolve;
|
|
100
|
+
function describeAskResolution(messageId, result) {
|
|
101
|
+
if (result.ok && result.already) {
|
|
102
|
+
return `Question ${messageId} was already resolved; nothing changed.`;
|
|
103
|
+
}
|
|
104
|
+
if (result.ok) {
|
|
105
|
+
return `Resolved question ${messageId}. It no longer shows as waiting on the person.`;
|
|
106
|
+
}
|
|
107
|
+
if (result.reason === data_provider_1.MESSAGE_ASK_REFUSALS.NOT_CURRENT && result.currentMessageId) {
|
|
108
|
+
return `Question ${messageId} was replaced by ${result.currentMessageId}; resolve that one instead.`;
|
|
109
|
+
}
|
|
110
|
+
return `Question ${messageId} was not resolved: ${result.message || result.reason || 'unknown'}.`;
|
|
111
|
+
}
|
|
@@ -158,16 +158,28 @@ export type NormalizedIntentPayload = {
|
|
|
158
158
|
goalId?: string;
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
|
-
/**
|
|
162
|
-
* Keep segmentation a sender decision: this advisory must never rewrite,
|
|
163
|
-
* reject, or automatically split the text. It only covers private owner DMs,
|
|
164
|
-
* where a chat-like reading cadence is normally expected.
|
|
165
|
-
*/
|
|
161
|
+
/** A long owner DM sent as one message. Silent once the sender split it with `--part`. */
|
|
166
162
|
export declare function messageSegmentationAdvisory({ destination, text, followingParts, }: {
|
|
167
163
|
destination: CanonicalMessageDestination;
|
|
168
164
|
text: string;
|
|
169
165
|
followingParts: string[];
|
|
170
166
|
}): string | undefined;
|
|
167
|
+
/** The two voice habits the doctrine names and a check can see: a label opener, named filler. */
|
|
168
|
+
export declare function messageVoiceAdvisory({ destination, text, }: {
|
|
169
|
+
destination: CanonicalMessageDestination;
|
|
170
|
+
text: string;
|
|
171
|
+
}): string | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* A `result` delivered from an Agent session that is not a Task run: the turn's final reply must
|
|
174
|
+
* not say it again (C13's `turn_duplicate_result`).
|
|
175
|
+
*/
|
|
176
|
+
export declare function resultReplyAdvisory({ inSession, inTaskRun, kind, destination, envelopes, }: {
|
|
177
|
+
inSession: boolean;
|
|
178
|
+
inTaskRun: boolean;
|
|
179
|
+
kind: string | undefined;
|
|
180
|
+
destination: CanonicalMessageDestination;
|
|
181
|
+
envelopes: readonly CanonicalIntentEnvelope[];
|
|
182
|
+
}): string | undefined;
|
|
171
183
|
/**
|
|
172
184
|
* Preserve the caller's semantic boundary while allowing them to send a few
|
|
173
185
|
* naturally separate short messages. A sequence is never automatic: the model
|
|
@@ -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,7 @@ 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 runtime_context_1 = require("../../../lib/runtime-context");
|
|
62
65
|
const BUILD_DESTINATION_RE = /^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;
|
|
63
66
|
// eslint-disable-next-line no-control-regex -- Reject control characters in mail headers.
|
|
64
67
|
const BUILD_DESTINATION_RE_2 = /[\r\n\x00-\x1f\x7f]/;
|
|
@@ -71,7 +74,7 @@ const MAX_SEQUENCE_PARTS = data_provider_1.MAX_AGENT_MESSAGE_SEQUENCE_PARTS;
|
|
|
71
74
|
* permits much larger payloads; the sender remains responsible for choosing
|
|
72
75
|
* meaningful conversational boundaries.
|
|
73
76
|
*/
|
|
74
|
-
exports.OWNER_DM_SEGMENTATION_SOFT_LIMIT =
|
|
77
|
+
exports.OWNER_DM_SEGMENTATION_SOFT_LIMIT = data_provider_1.AGENT_MESSAGE_SEGMENTATION_SOFT_LIMIT;
|
|
75
78
|
const PROTOCOL_VERSION = 1;
|
|
76
79
|
/**
|
|
77
80
|
* Canonical CLI entry for agent-authored messages.
|
|
@@ -132,17 +135,32 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
132
135
|
const message = json ? input.message : input.message + sequenceNote + retryNote;
|
|
133
136
|
return super.failWithCliError({ ...input, message, details });
|
|
134
137
|
}
|
|
135
|
-
|
|
138
|
+
// An Agent reads `--help` as instructions, so the description says what the command is FOR and
|
|
139
|
+
// the examples are the messages worth sending, in the order a piece of work sends them. Every
|
|
140
|
+
// send still goes through the ProactiveMessageGateway; that is the mechanism, not the purpose.
|
|
141
|
+
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. ' +
|
|
142
|
+
'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. ' +
|
|
143
|
+
'Run `agent message context` first to see what they have already read from you. ' +
|
|
144
|
+
'Judgment and a worked example: `skrr guide communication pacing`.';
|
|
145
|
+
// The story here (a search reindex) deliberately differs from the one in
|
|
146
|
+
// `skrr guide communication pacing` (a payment bug): an Agent copies the example it saw last, so
|
|
147
|
+
// two surfaces that tell one story teach one sentence instead of a shape.
|
|
136
148
|
static examples = [
|
|
137
|
-
|
|
138
|
-
'<%= config.bin %> agent message send --
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
//
|
|
142
|
-
'<%= config.bin %> agent message send --
|
|
143
|
-
|
|
149
|
+
// Starting: what you are doing and when they will hear back, as one status later sends replace.
|
|
150
|
+
'<%= 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',
|
|
151
|
+
// A finding that changes the plan.
|
|
152
|
+
'<%= 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',
|
|
153
|
+
// A choice only they can make, with a recommendation and what happens meanwhile.
|
|
154
|
+
'<%= 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',
|
|
155
|
+
// The outcome, once.
|
|
156
|
+
'<%= 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',
|
|
157
|
+
// Something said earlier was wrong: replace it rather than contradict it.
|
|
144
158
|
'<%= config.bin %> agent message send --supersedes <message-id> --text "Correction: the deploy is at 15:00, not 14:00." --json',
|
|
145
|
-
|
|
159
|
+
// Two thoughts as two short messages. The key carries the task id because dedup is scoped
|
|
160
|
+
// (owner, agent, key) for all time; a bare `checkpoint:verify` collides on the next run.
|
|
161
|
+
'<%= 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',
|
|
162
|
+
'<%= config.bin %> agent message send --agent <agent-id> --destination slack_channel --channel C123 --text "Deploy finished." --json',
|
|
163
|
+
'<%= config.bin %> agent message send --from-json payload.json --json',
|
|
146
164
|
];
|
|
147
165
|
static args = {
|
|
148
166
|
agent: core_1.Args.string({
|
|
@@ -338,6 +356,12 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
338
356
|
});
|
|
339
357
|
if (flags['message-lint'] && segmentationAdvisory)
|
|
340
358
|
this.warn(segmentationAdvisory);
|
|
359
|
+
const voiceAdvisory = messageVoiceAdvisory({
|
|
360
|
+
destination: payload.destination,
|
|
361
|
+
text: payload.content.text,
|
|
362
|
+
});
|
|
363
|
+
if (flags['message-lint'] && voiceAdvisory)
|
|
364
|
+
this.warn(voiceAdvisory);
|
|
341
365
|
// Resolve BEFORE the first send. A sequence that fails on part 2 because of
|
|
342
366
|
// a typo'd embed would have already delivered part 1, and a delivered
|
|
343
367
|
// message cannot be taken back.
|
|
@@ -441,6 +465,15 @@ class AgentMessageSend extends base_command_1.BaseCommand {
|
|
|
441
465
|
}
|
|
442
466
|
return { envelopes, halt };
|
|
443
467
|
});
|
|
468
|
+
const resultAdvisory = resultReplyAdvisory({
|
|
469
|
+
inSession: Boolean(sessionContext),
|
|
470
|
+
inTaskRun: Boolean((0, runtime_context_1.readRuntimeContext)().task.id),
|
|
471
|
+
kind: payload.presentation?.kind,
|
|
472
|
+
destination: payload.destination,
|
|
473
|
+
envelopes,
|
|
474
|
+
});
|
|
475
|
+
if (flags['message-lint'] && resultAdvisory)
|
|
476
|
+
this.warn(resultAdvisory);
|
|
444
477
|
if (flags.json) {
|
|
445
478
|
// Branch on the REQUESTED part count, not the sent count: a sequence that
|
|
446
479
|
// halted on its first part still has to report the parts it skipped.
|
|
@@ -659,24 +692,42 @@ function request_post(path, body) {
|
|
|
659
692
|
return data_provider_1.request.post(path, body);
|
|
660
693
|
}
|
|
661
694
|
/**
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
695
|
+
* The send-time advice is decided by `adviseAgentMessage` / `adviseAgentMessageDelivery` in
|
|
696
|
+
* `@skrr-ai/data-provider`, the rules a cloud turn's `send_message` tool reads too (OSK-33221), so
|
|
697
|
+
* the two surfaces cannot drift. What lives here is only the CLI's line around them. None of it
|
|
698
|
+
* ever rewrites, rejects, splits or delays a send: the message is already on its way, so each note
|
|
699
|
+
* is phrased for the next one.
|
|
665
700
|
*/
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
if (destination.kind !== 'app_owner_dm' && destination.kind !== 'slack_owner_dm')
|
|
701
|
+
const LINT_SUFFIX = 'This is only an advisory; use --no-message-lint to suppress it.';
|
|
702
|
+
function cliAdviceLine(advice, suffix = LINT_SUFFIX) {
|
|
703
|
+
if (advice.length === 0)
|
|
670
704
|
return undefined;
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
705
|
+
const sentences = advice.map((note) => (0, data_provider_1.renderAgentMessageAdvice)(note, 'cli'));
|
|
706
|
+
return `[skrr] ${[...sentences, suffix].filter(Boolean).join(' ')}`;
|
|
707
|
+
}
|
|
708
|
+
/** A long owner DM sent as one message. Silent once the sender split it with `--part`. */
|
|
709
|
+
function messageSegmentationAdvisory({ destination, text, followingParts, }) {
|
|
710
|
+
return cliAdviceLine((0, data_provider_1.adviseAgentMessage)({
|
|
711
|
+
destinationKind: destination.kind,
|
|
712
|
+
text,
|
|
713
|
+
followingParts: followingParts.length,
|
|
714
|
+
}).filter((note) => note.code === 'long_message'));
|
|
715
|
+
}
|
|
716
|
+
/** The two voice habits the doctrine names and a check can see: a label opener, named filler. */
|
|
717
|
+
function messageVoiceAdvisory({ destination, text, }) {
|
|
718
|
+
return cliAdviceLine((0, data_provider_1.adviseAgentMessage)({ destinationKind: destination.kind, text }).filter((note) => note.code === 'label_opener' || note.code === 'named_filler'));
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* A `result` delivered from an Agent session that is not a Task run: the turn's final reply must
|
|
722
|
+
* not say it again (C13's `turn_duplicate_result`).
|
|
723
|
+
*/
|
|
724
|
+
function resultReplyAdvisory({ inSession, inTaskRun, kind, destination, envelopes, }) {
|
|
725
|
+
return cliAdviceLine((0, data_provider_1.adviseAgentMessageDelivery)({
|
|
726
|
+
destinationKind: destination.kind,
|
|
727
|
+
kind,
|
|
728
|
+
delivered: envelopes.some((envelope) => envelope.intent?.status === 'delivered'),
|
|
729
|
+
inInteractiveTurn: inSession && !inTaskRun,
|
|
730
|
+
}), '');
|
|
680
731
|
}
|
|
681
732
|
/**
|
|
682
733
|
* Preserve the caller's semantic boundary while allowing them to send a few
|
|
@@ -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.log(JSON.stringify(result, null, 2));
|
|
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
|
+
}
|