@skrr-ai/cli 0.1.230 → 0.1.232
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/README.md +22 -0
- package/bin/dev.cjs +4 -0
- package/dist/base-command.d.ts +0 -10
- package/dist/base-command.js +10 -39
- package/dist/commands/agent/message/context.d.ts +2 -0
- package/dist/commands/agent/message/context.js +18 -3
- package/dist/commands/agent/message/list.d.ts +22 -0
- package/dist/commands/agent/message/list.js +66 -0
- package/dist/commands/agent/message/send.d.ts +1 -1
- package/dist/commands/agent/message/send.js +1 -3
- package/dist/commands/agent/message/show.d.ts +14 -0
- package/dist/commands/agent/message/show.js +39 -0
- package/dist/commands/agents/chat.d.ts +2 -0
- package/dist/commands/agents/chat.js +20 -4
- package/dist/commands/agents/eval/show.d.ts +1 -0
- package/dist/commands/agents/eval/show.js +19 -0
- package/dist/commands/agents/intuitions/generate.js +1 -1
- package/dist/commands/agents/intuitions/list.js +1 -1
- package/dist/commands/code/acp.js +1 -1
- package/dist/commands/code/handover.d.ts +3 -3
- package/dist/commands/code/handover.js +12 -12
- package/dist/commands/code/index.d.ts +3 -8
- package/dist/commands/code/index.js +15 -21
- package/dist/commands/code/jobs/show.js +1 -0
- package/dist/commands/code/run.js +1 -1
- package/dist/commands/goals/plan-now.d.ts +5 -3
- package/dist/commands/goals/plan-now.js +21 -16
- package/dist/commands/runs/events.d.ts +14 -0
- package/dist/commands/runs/events.js +59 -0
- package/dist/commands/runs/list.d.ts +21 -0
- package/dist/commands/runs/list.js +87 -0
- package/dist/commands/runs/show.d.ts +13 -0
- package/dist/commands/runs/show.js +63 -0
- package/dist/commands/runs/stop.d.ts +14 -0
- package/dist/commands/runs/stop.js +78 -0
- package/dist/commands/runs/transcript.d.ts +17 -0
- package/dist/commands/runs/transcript.js +93 -0
- package/dist/commands/tasks/runs.js +7 -0
- package/dist/commands/tasks/start-receipt.js +8 -8
- package/dist/commands/tasks/start.js +12 -1
- package/dist/generated/agent-guides.json +226 -5
- package/dist/lib/agent-chat-queue.d.ts +2 -1
- package/dist/lib/agent-chat-queue.js +26 -21
- package/dist/lib/agent-runs.d.ts +41 -0
- package/dist/lib/agent-runs.js +177 -0
- package/dist/lib/agentic-stream.d.ts +1 -1
- package/dist/lib/agentic-stream.js +2 -2
- package/dist/lib/api-fetch.d.ts +2 -2
- package/dist/lib/api-fetch.js +5 -4
- package/dist/lib/code-handover.d.ts +2 -3
- package/dist/lib/code-handover.js +4 -6
- package/dist/lib/communication-history.d.ts +27 -0
- package/dist/lib/communication-history.js +45 -0
- package/dist/lib/execution-history.d.ts +31 -0
- package/dist/lib/execution-history.js +7 -0
- package/dist/lib/first-party-harness-broker.d.ts +1 -1
- package/dist/lib/first-party-harness-broker.js +3 -5
- package/dist/lib/inbound-messages.d.ts +1 -0
- package/dist/lib/inbound-messages.js +3 -0
- package/dist/lib/intuition-look.js +20 -4
- package/dist/lib/memory-history-session.d.ts +8 -4
- package/dist/lib/memory-history-session.js +30 -23
- package/dist/lib/task-agent-run.d.ts +4 -0
- package/dist/lib/task-agent-run.js +15 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.d.ts +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +35 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +62 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +56 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.d.ts +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +29 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +62 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +51 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10997 -10987
- package/oclif.manifest.json +1065 -1648
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -193,6 +193,28 @@ skrr agents activity <agent-id> --limit 10 # merged DM + conversations + ta
|
|
|
193
193
|
`SERVER_AGENT_FILTER_UNSUPPORTED` rather than returning another agent's
|
|
194
194
|
conversations, and `agents activity` filters locally with a printed caveat.
|
|
195
195
|
|
|
196
|
+
### Inspecting Agent Runs
|
|
197
|
+
|
|
198
|
+
Use the `ar_…` Run ID from a Chat acceptance. An interactive Chat prints it
|
|
199
|
+
on the Run line, and `--jsonl` includes it in the `run.accepted` event.
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
skrr runs show <run-id>
|
|
203
|
+
skrr runs events <run-id> --json
|
|
204
|
+
skrr runs events <run-id> --cursor <cursor> --json
|
|
205
|
+
skrr runs stop <run-id>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
The first event read returns the current Run snapshot and a cursor. Pass that
|
|
209
|
+
cursor on later reads to replay new events. By default, Stop targets the
|
|
210
|
+
current snapshot. An accepted request reports `stop_requested` until the
|
|
211
|
+
platform confirms cancellation.
|
|
212
|
+
|
|
213
|
+
If a Stop response is lost, repeat the exact request in the same workspace.
|
|
214
|
+
Use `skrr runs stop <run-id> --attempt <attempt-id>` for the original Attempt or
|
|
215
|
+
`skrr runs stop <run-id> --queued` if the Run was queued before any Attempt
|
|
216
|
+
started. These forms can recover the retained receipt after the Run ends.
|
|
217
|
+
|
|
196
218
|
### Production CLI Contract
|
|
197
219
|
|
|
198
220
|
skrr CLI is designed for both humans and daemon agents. New commands should
|
package/bin/dev.cjs
CHANGED
|
@@ -17,6 +17,10 @@ async function main(argv) {
|
|
|
17
17
|
settings.enableAutoTranspile = true;
|
|
18
18
|
const source = new Plugin({ root, isRoot: true, ignoreManifest: true, errorOnManifestCreate: true });
|
|
19
19
|
await source.load();
|
|
20
|
+
if (argv.length === 1 && argv[0] === '--print-source-command-manifest') {
|
|
21
|
+
process.stdout.write(JSON.stringify(source.manifest));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
20
24
|
const bundled = await Promise.all(
|
|
21
25
|
(pjson.oclif.plugins ?? []).map(async (name) => {
|
|
22
26
|
const plugin = new Plugin({ root, name, parent: source, type: 'core' });
|
package/dist/base-command.d.ts
CHANGED
|
@@ -36,19 +36,9 @@ export declare abstract class BaseCommand extends Command {
|
|
|
36
36
|
* acquiring unrelated account authority. Human invocations are unaffected.
|
|
37
37
|
*/
|
|
38
38
|
static autonomousCredentialPolicy: 'delegated' | 'bound-session' | 'scoped-task-operation';
|
|
39
|
-
/**
|
|
40
|
-
* What a managed command may do when the daemon cannot mint the delegated credential it asked for.
|
|
41
|
-
* `none` fails, as always. `bound-session-when-daemon-brokered` keeps the bound session credential
|
|
42
|
-
* only when the daemon has flagged this session for its own message broker
|
|
43
|
-
* (OVERSKY_OFFLINE_MESSAGE_SUBMIT_VIA_DAEMON=1): that route is WAL-first and needs no cloud
|
|
44
|
-
* credential, so a machine that is cut off from the server can still hand the message to the daemon
|
|
45
|
-
* (OSK-23049). It never widens authority: the session credential is what the command was given.
|
|
46
|
-
*/
|
|
47
|
-
static autonomousCredentialFallback: 'none' | 'bound-session-when-daemon-brokered';
|
|
48
39
|
static sessionReadPolicy?: 'memory-history-v1';
|
|
49
40
|
/** Report a refused delegated credential and exit; `failWithCliError` throws. */
|
|
50
41
|
private failDelegatedCredentialUnavailable;
|
|
51
|
-
private mayKeepBoundSessionCredential;
|
|
52
42
|
/** Add the owning agent's web detail link without overwriting resource URLs. */
|
|
53
43
|
protected withAgentContext<T>(agentId: string, value: T): T & {
|
|
54
44
|
agentUrl: string | null;
|
package/dist/base-command.js
CHANGED
|
@@ -157,15 +157,6 @@ class BaseCommand extends core_1.Command {
|
|
|
157
157
|
* acquiring unrelated account authority. Human invocations are unaffected.
|
|
158
158
|
*/
|
|
159
159
|
static autonomousCredentialPolicy = 'delegated';
|
|
160
|
-
/**
|
|
161
|
-
* What a managed command may do when the daemon cannot mint the delegated credential it asked for.
|
|
162
|
-
* `none` fails, as always. `bound-session-when-daemon-brokered` keeps the bound session credential
|
|
163
|
-
* only when the daemon has flagged this session for its own message broker
|
|
164
|
-
* (OVERSKY_OFFLINE_MESSAGE_SUBMIT_VIA_DAEMON=1): that route is WAL-first and needs no cloud
|
|
165
|
-
* credential, so a machine that is cut off from the server can still hand the message to the daemon
|
|
166
|
-
* (OSK-23049). It never widens authority: the session credential is what the command was given.
|
|
167
|
-
*/
|
|
168
|
-
static autonomousCredentialFallback = 'none';
|
|
169
160
|
static sessionReadPolicy;
|
|
170
161
|
/** Report a refused delegated credential and exit; `failWithCliError` throws. */
|
|
171
162
|
failDelegatedCredentialUnavailable(err) {
|
|
@@ -200,13 +191,6 @@ class BaseCommand extends core_1.Command {
|
|
|
200
191
|
retryable: true,
|
|
201
192
|
});
|
|
202
193
|
}
|
|
203
|
-
mayKeepBoundSessionCredential(err, haveBoundSessionCredential) {
|
|
204
|
-
return (haveBoundSessionCredential &&
|
|
205
|
-
this.constructor.autonomousCredentialFallback ===
|
|
206
|
-
'bound-session-when-daemon-brokered' &&
|
|
207
|
-
process.env.OVERSKY_OFFLINE_MESSAGE_SUBMIT_VIA_DAEMON === '1' &&
|
|
208
|
-
err?.name === 'DelegatedCliUnavailableError');
|
|
209
|
-
}
|
|
210
194
|
/** Add the owning agent's web detail link without overwriting resource URLs. */
|
|
211
195
|
withAgentContext(agentId, value) {
|
|
212
196
|
const agentUrl = (0, web_url_1.agentUrlFrom)(this.cliConfig.baseURL, { id: agentId });
|
|
@@ -447,35 +431,22 @@ class BaseCommand extends core_1.Command {
|
|
|
447
431
|
// time with the exit signal as its cause: two JSON documents on stdout and a message ending
|
|
448
432
|
// in `EEXIT: 75` (OSK-23475).
|
|
449
433
|
let delegatedCredential;
|
|
450
|
-
let keepBoundSession = false;
|
|
451
434
|
try {
|
|
452
435
|
delegatedCredential = await (0, delegated_cli_1.fetchDelegatedCliCredential)();
|
|
453
436
|
}
|
|
454
437
|
catch (err) {
|
|
455
|
-
|
|
456
|
-
// credential to hand a message over, so a refused mint keeps the bound session credential for a
|
|
457
|
-
// command that declared it. Everything else reports the refusal exactly as before.
|
|
458
|
-
// `resolveTrustedAutonomousCredential` answers an object with `token: null` when the session token is
|
|
459
|
-
// missing (so the command fails closed), which is truthy: ask for the token itself.
|
|
460
|
-
if (this.mayKeepBoundSessionCredential(err, Boolean(autonomousCredential?.token))) {
|
|
461
|
-
keepBoundSession = true;
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
this.failDelegatedCredentialUnavailable(err);
|
|
465
|
-
}
|
|
438
|
+
this.failDelegatedCredentialUnavailable(err);
|
|
466
439
|
}
|
|
467
|
-
if (!
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
autonomousCredential = delegatedCredential;
|
|
477
|
-
this.credentialProvenance = { kind: 'daemon-delegated' };
|
|
440
|
+
if (!delegatedCredential) {
|
|
441
|
+
this.failWithCliError({
|
|
442
|
+
message: 'Daemon delegated skrr credential is unavailable.',
|
|
443
|
+
code: 'DELEGATED_CLI_CREDENTIAL_UNAVAILABLE',
|
|
444
|
+
exit: 75,
|
|
445
|
+
retryable: true,
|
|
446
|
+
});
|
|
478
447
|
}
|
|
448
|
+
autonomousCredential = delegatedCredential;
|
|
449
|
+
this.credentialProvenance = { kind: 'daemon-delegated' };
|
|
479
450
|
}
|
|
480
451
|
if (autonomousCredential) {
|
|
481
452
|
// Parse for normal oclif flag validation, but intentionally ignore both
|
|
@@ -5,12 +5,14 @@ import { BaseCommand } from '../../../base-command';
|
|
|
5
5
|
* it never returns a schedule or tells the model that it must send a message.
|
|
6
6
|
*/
|
|
7
7
|
export default class AgentMessageContext extends BaseCommand {
|
|
8
|
+
static autonomousCredentialPolicy: "bound-session";
|
|
8
9
|
static description: string;
|
|
9
10
|
static examples: string[];
|
|
10
11
|
static args: {
|
|
11
12
|
agent: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
12
13
|
};
|
|
13
14
|
static flags: {
|
|
15
|
+
view: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
16
|
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
17
|
task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
18
|
run: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -5,6 +5,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
6
|
const agent_resolver_1 = require("../../../lib/agent-resolver");
|
|
7
7
|
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
8
|
+
const communication_history_1 = require("../../../lib/communication-history");
|
|
8
9
|
const message_intent_1 = require("../../../lib/message-intent");
|
|
9
10
|
/**
|
|
10
11
|
* Show durable communication observations before an interactive local agent
|
|
@@ -12,17 +13,24 @@ const message_intent_1 = require("../../../lib/message-intent");
|
|
|
12
13
|
* it never returns a schedule or tells the model that it must send a message.
|
|
13
14
|
*/
|
|
14
15
|
class AgentMessageContext extends base_command_1.BaseCommand {
|
|
16
|
+
static autonomousCredentialPolicy = 'bound-session';
|
|
15
17
|
static description = "Show what the owner saw in a conversation with the Agent (its replies, its messages, the platform's and the owner's), how far they read, what they said since, and recent Agent Updates, as observations for communication judgment";
|
|
16
18
|
static examples = [
|
|
17
19
|
'<%= config.bin %> agent message context --agent <agent-id>',
|
|
18
20
|
'<%= config.bin %> agent message context --agent <agent-id> --conversation <conversation-id>',
|
|
19
21
|
'<%= config.bin %> agent message context --agent <agent-id> --limit 20 --before <cursor>',
|
|
20
22
|
'<%= config.bin %> agent message context --agent <agent-id> --task <task-id>',
|
|
23
|
+
'<%= config.bin %> agent message context --view outreach --json',
|
|
21
24
|
];
|
|
22
25
|
static args = {
|
|
23
26
|
agent: core_1.Args.string({ description: 'Agent ID', required: false, ignoreStdin: true }),
|
|
24
27
|
};
|
|
25
28
|
static flags = {
|
|
29
|
+
view: core_1.Flags.string({
|
|
30
|
+
options: ['outreach'],
|
|
31
|
+
description: 'Read the commitments, replies, and recent messages relevant to contacting the owner',
|
|
32
|
+
exclusive: ['run', 'conversation', 'before'],
|
|
33
|
+
}),
|
|
26
34
|
agent: core_1.Flags.string({ description: 'Agent ID' }),
|
|
27
35
|
task: core_1.Flags.string({ description: 'Optional task context to narrow recent updates' }),
|
|
28
36
|
run: core_1.Flags.string({
|
|
@@ -45,9 +53,9 @@ class AgentMessageContext extends base_command_1.BaseCommand {
|
|
|
45
53
|
};
|
|
46
54
|
async run() {
|
|
47
55
|
const { args, flags } = await this.parse(AgentMessageContext);
|
|
48
|
-
const sessionContext =
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
const sessionContext = flags.view === 'outreach'
|
|
57
|
+
? (0, communication_history_1.resolveHistorySession)(() => this.requireAuth())
|
|
58
|
+
: (0, message_intent_1.resolveMessageCommandSessionContext)({ requireHumanAuth: () => this.requireAuth() });
|
|
51
59
|
let agentId;
|
|
52
60
|
try {
|
|
53
61
|
const explicitAgentId = (0, agent_resolver_1.mergeExplicitAgentInputs)([
|
|
@@ -69,6 +77,13 @@ class AgentMessageContext extends base_command_1.BaseCommand {
|
|
|
69
77
|
});
|
|
70
78
|
}
|
|
71
79
|
try {
|
|
80
|
+
if (flags.view === 'outreach') {
|
|
81
|
+
const result = await (0, communication_history_1.readCommunicationHistory)('outreach', agentId, sessionContext, {
|
|
82
|
+
taskId: flags.task, limit: flags.limit,
|
|
83
|
+
});
|
|
84
|
+
this.log(JSON.stringify(result, null, 2));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
72
87
|
if (sessionContext?.sessionId) {
|
|
73
88
|
// The session endpoint derives the run from the session CLAIM, not
|
|
74
89
|
// from the query — forwarding --run would either be a no-op (the
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export default class AgentMessageList extends BaseCommand {
|
|
3
|
+
static autonomousCredentialPolicy: "bound-session";
|
|
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
|
+
task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
direction: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
kind: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
q: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
sort: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
to: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
since: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
timezone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
};
|
|
21
|
+
run(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../base-command");
|
|
5
|
+
const agent_resolver_1 = require("../../../lib/agent-resolver");
|
|
6
|
+
const communication_history_1 = require("../../../lib/communication-history");
|
|
7
|
+
const search_display_1 = require("../../../lib/search-display");
|
|
8
|
+
class AgentMessageList extends base_command_1.BaseCommand {
|
|
9
|
+
static autonomousCredentialPolicy = 'bound-session';
|
|
10
|
+
static description = 'List recent owner-facing messages in the Agent’s authorized conversation';
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> agent message list --direction inbound --since today --limit 5 --json',
|
|
13
|
+
'<%= config.bin %> agent message list --since 7d --q rollback --sort relevance --json',
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
...communication_history_1.historyTimeFlags,
|
|
17
|
+
agent: core_1.Flags.string({ description: 'Agent ID (the session binds it automatically)' }),
|
|
18
|
+
task: core_1.Flags.string({ description: 'Narrow the list to an authorized Task reference' }),
|
|
19
|
+
direction: core_1.Flags.string({ options: ['inbound', 'outbound', 'both'], description: 'Direction relative to the Agent (default both)' }),
|
|
20
|
+
kind: core_1.Flags.string({ description: 'Outbound communication kind', dependsOn: ['direction'] }),
|
|
21
|
+
q: core_1.Flags.string({ description: 'Search authorized message text for a phrase' }),
|
|
22
|
+
sort: core_1.Flags.string({ options: ['newest', 'oldest', 'relevance'], description: 'Choose the order (default newest, relevance requires --q)' }),
|
|
23
|
+
limit: core_1.Flags.integer({ min: 1, max: 20, description: 'Maximum messages on this page (default 8)' }),
|
|
24
|
+
cursor: core_1.Flags.string({ description: 'Continue from nextCursor with the same filters' }),
|
|
25
|
+
json: core_1.Flags.boolean({ description: 'Output one result as JSON' }),
|
|
26
|
+
};
|
|
27
|
+
async run() {
|
|
28
|
+
const { flags } = await this.parse(AgentMessageList);
|
|
29
|
+
const session = (0, communication_history_1.resolveHistorySession)(() => this.requireAuth());
|
|
30
|
+
let agentId;
|
|
31
|
+
try {
|
|
32
|
+
agentId = session ? (0, agent_resolver_1.resolveSessionAgentIdentity)(flags.agent).id : (await (0, agent_resolver_1.resolveAgentIdentity)(flags.agent)).id;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const failure = (0, agent_resolver_1.agentResolutionFailure)(error);
|
|
36
|
+
this.failWithCliError({ ...failure, exit: 2, retryable: false, details: { suggestion: failure.suggestion } });
|
|
37
|
+
}
|
|
38
|
+
if ((flags.kind && flags.direction !== 'outbound') || (flags.sort === 'relevance' && !flags.q) ||
|
|
39
|
+
(flags.timezone && flags.since !== 'today')) {
|
|
40
|
+
this.failWithCliError({ code: 'HISTORY_FILTER_CONFLICT', exit: 2, retryable: false,
|
|
41
|
+
message: '--kind requires outbound, relevance requires --q, and --timezone requires --since today.' });
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const { from, to, since, timezone, direction, kind, q, sort, limit, cursor } = flags;
|
|
45
|
+
const result = await (0, communication_history_1.readCommunicationHistory)('list', agentId, session, {
|
|
46
|
+
from, to, since, timezone, direction, kind, q, sort, limit, cursor, taskId: flags.task,
|
|
47
|
+
});
|
|
48
|
+
if (flags.json) {
|
|
49
|
+
this.log(JSON.stringify(result, null, 2));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
for (const item of result.items ?? [])
|
|
53
|
+
this.log((0, communication_history_1.formatCommunicationHistoryItem)(item));
|
|
54
|
+
if (!result.items?.length)
|
|
55
|
+
this.log('No visible messages on this page.');
|
|
56
|
+
if (result.coverage === 'partial')
|
|
57
|
+
this.log('Message history coverage is partial.');
|
|
58
|
+
if (result.nextCursor)
|
|
59
|
+
this.log(`Next page Repeat the filters with --cursor ${(0, search_display_1.shellSearchCursor)(result.nextCursor)}.`);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
this.handleApiError(error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.default = AgentMessageList;
|
|
@@ -79,7 +79,7 @@ export type CanonicalIntentEnvelope = {
|
|
|
79
79
|
* a compromised producer cannot elevate itself into a session principal.
|
|
80
80
|
*/
|
|
81
81
|
export default class AgentMessageSend extends BaseCommand {
|
|
82
|
-
static
|
|
82
|
+
static autonomousCredentialPolicy: "bound-session";
|
|
83
83
|
private attemptedMessageKey?;
|
|
84
84
|
private partialSequence?;
|
|
85
85
|
protected failWithCliError(input: {
|
|
@@ -82,9 +82,7 @@ const PROTOCOL_VERSION = 1;
|
|
|
82
82
|
* a compromised producer cannot elevate itself into a session principal.
|
|
83
83
|
*/
|
|
84
84
|
class AgentMessageSend extends base_command_1.BaseCommand {
|
|
85
|
-
|
|
86
|
-
// so a machine cut off from the server must not fail before it gets there on a refused credential mint.
|
|
87
|
-
static autonomousCredentialFallback = 'bound-session-when-daemon-brokered';
|
|
85
|
+
static autonomousCredentialPolicy = 'bound-session';
|
|
88
86
|
attemptedMessageKey;
|
|
89
87
|
partialSequence;
|
|
90
88
|
failWithCliError(input) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export default class AgentMessageShow extends BaseCommand {
|
|
3
|
+
static autonomousCredentialPolicy: "bound-session";
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
messageId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../base-command");
|
|
5
|
+
const agent_resolver_1 = require("../../../lib/agent-resolver");
|
|
6
|
+
const communication_history_1 = require("../../../lib/communication-history");
|
|
7
|
+
class AgentMessageShow extends base_command_1.BaseCommand {
|
|
8
|
+
static autonomousCredentialPolicy = 'bound-session';
|
|
9
|
+
static description = 'Read a specific message in the Agent’s authorized conversation';
|
|
10
|
+
static args = { messageId: core_1.Args.string({ required: true, description: 'Message ID', ignoreStdin: true }) };
|
|
11
|
+
static examples = ['<%= config.bin %> agent message show <message-id> --json'];
|
|
12
|
+
static flags = {
|
|
13
|
+
agent: core_1.Flags.string({ description: 'Agent ID (the session binds it automatically)' }),
|
|
14
|
+
json: core_1.Flags.boolean({ description: 'Output one result as JSON' }),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { args, flags } = await this.parse(AgentMessageShow);
|
|
18
|
+
const session = (0, communication_history_1.resolveHistorySession)(() => this.requireAuth());
|
|
19
|
+
let agentId;
|
|
20
|
+
try {
|
|
21
|
+
agentId = session ? (0, agent_resolver_1.resolveSessionAgentIdentity)(flags.agent).id : (await (0, agent_resolver_1.resolveAgentIdentity)(flags.agent)).id;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const failure = (0, agent_resolver_1.agentResolutionFailure)(error);
|
|
25
|
+
this.failWithCliError({ ...failure, exit: 2, retryable: false, details: { suggestion: failure.suggestion } });
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const result = await (0, communication_history_1.readCommunicationHistory)('show', agentId, session, { messageId: args.messageId });
|
|
29
|
+
if (flags.json)
|
|
30
|
+
this.log(JSON.stringify(result, null, 2));
|
|
31
|
+
else if (result.message)
|
|
32
|
+
this.log((0, communication_history_1.formatCommunicationHistoryItem)(result.message));
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
this.handleApiError(error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = AgentMessageShow;
|
|
@@ -226,6 +226,7 @@ export declare function interactionUnavailableFrom(event: unknown): InteractionU
|
|
|
226
226
|
export declare function interactionUnavailableWarning(notice: InteractionUnavailableNotice): string;
|
|
227
227
|
export declare function noStreamJsonPayload(input: {
|
|
228
228
|
result: AgenticStreamResult;
|
|
229
|
+
runId?: string;
|
|
229
230
|
conversationId?: string;
|
|
230
231
|
agentId: string;
|
|
231
232
|
baseURL: string;
|
|
@@ -243,6 +244,7 @@ export declare function noStreamJsonPayload(input: {
|
|
|
243
244
|
export declare function chatStreamHeaderLines(input: {
|
|
244
245
|
agentId: string;
|
|
245
246
|
sessionId: string;
|
|
247
|
+
runId?: string;
|
|
246
248
|
conversationId?: string;
|
|
247
249
|
agentUrl?: string | null;
|
|
248
250
|
threadRootMessageId?: string;
|
|
@@ -26,6 +26,7 @@ const core_1 = require("@oclif/core");
|
|
|
26
26
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
27
27
|
const base_command_1 = require("../../base-command");
|
|
28
28
|
const api_fetch_1 = require("../../lib/api-fetch");
|
|
29
|
+
const agent_runs_1 = require("../../lib/agent-runs");
|
|
29
30
|
const agent_chat_start_1 = require("../../lib/agent-chat-start");
|
|
30
31
|
const agent_home_workspace_1 = require("../../lib/agent-home-workspace");
|
|
31
32
|
const agentic_stream_1 = require("../../lib/agentic-stream");
|
|
@@ -392,12 +393,13 @@ function interactionUnavailableWarning(notice) {
|
|
|
392
393
|
: `This turn ran without its managed Task tools (${notice.reason}).`;
|
|
393
394
|
}
|
|
394
395
|
function noStreamJsonPayload(input) {
|
|
395
|
-
const { result, conversationId, agentId, baseURL, threadRootMessageId } = input;
|
|
396
|
+
const { result, runId, conversationId, agentId, baseURL, threadRootMessageId } = input;
|
|
396
397
|
const routing = admittedRouting(input.admittedRuntime);
|
|
397
398
|
const interactionUnavailable = interactionUnavailableFrom(result.lastEvent);
|
|
398
399
|
return {
|
|
399
400
|
mode: 'no-stream',
|
|
400
401
|
executed: true,
|
|
402
|
+
...(runId ? { runId } : {}),
|
|
401
403
|
sessionId: result.sessionId,
|
|
402
404
|
conversationId,
|
|
403
405
|
responseMessageId: result.responseMessageId,
|
|
@@ -450,8 +452,10 @@ function noStreamJsonPayload(input) {
|
|
|
450
452
|
* and print the conversation id on its own line with the exact reuse invocation.
|
|
451
453
|
*/
|
|
452
454
|
function chatStreamHeaderLines(input) {
|
|
453
|
-
const { agentId, sessionId, conversationId, agentUrl, threadRootMessageId } = input;
|
|
455
|
+
const { agentId, sessionId, runId, conversationId, agentUrl, threadRootMessageId } = input;
|
|
454
456
|
const lines = [`Streaming agent ${agentId} — session ${sessionId}`];
|
|
457
|
+
if (runId)
|
|
458
|
+
lines.push(`Run: ${runId}`);
|
|
455
459
|
if (conversationId) {
|
|
456
460
|
lines.push(`Conversation: ${conversationId} (reuse with --conversation ${conversationId})`);
|
|
457
461
|
}
|
|
@@ -925,6 +929,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
925
929
|
case 'turn':
|
|
926
930
|
return {
|
|
927
931
|
sessionId: next.sessionId,
|
|
932
|
+
...(next.runId ? { runId: next.runId } : {}),
|
|
928
933
|
conversationId,
|
|
929
934
|
responseMessageId: next.responseMessageId,
|
|
930
935
|
replayed: answer.idempotentReplay === true,
|
|
@@ -1424,12 +1429,15 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1424
1429
|
}
|
|
1425
1430
|
// `--no-stream` runs the SAME turn; it only withholds the live output.
|
|
1426
1431
|
const quiet = !!flags['no-stream'];
|
|
1432
|
+
const runId = (0, agent_runs_1.canonicalRunId)(started.runId);
|
|
1433
|
+
const runRef = runId ? { runId } : {};
|
|
1427
1434
|
if (flags.jsonl) {
|
|
1428
1435
|
// Written through the one JSONL helper, not `this.log`: oclif routes that
|
|
1429
1436
|
// through `util.format`, which rewrites `%s`-shaped sequences that appear
|
|
1430
1437
|
// in ordinary agent output (OSK-7629).
|
|
1431
1438
|
(0, agentic_stream_1.writeJsonLine)(process.stdout, {
|
|
1432
1439
|
type: 'run.accepted',
|
|
1440
|
+
...runRef,
|
|
1433
1441
|
sessionId: started.sessionId,
|
|
1434
1442
|
conversationId: started.conversationId,
|
|
1435
1443
|
...(flags['thread-root'] ? { threadRootMessageId: flags['thread-root'] } : {}),
|
|
@@ -1453,6 +1461,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1453
1461
|
for (const line of chatStreamHeaderLines({
|
|
1454
1462
|
agentId: args.agentId,
|
|
1455
1463
|
sessionId: started.sessionId,
|
|
1464
|
+
runId,
|
|
1456
1465
|
conversationId: started.conversationId,
|
|
1457
1466
|
agentUrl: (0, web_url_1.agentUrlFrom)(this.cliConfig.baseURL, { id: args.agentId }),
|
|
1458
1467
|
threadRootMessageId: flags['thread-root'],
|
|
@@ -1460,6 +1469,9 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1460
1469
|
this.log(line);
|
|
1461
1470
|
}
|
|
1462
1471
|
}
|
|
1472
|
+
else if (runId && !flags.json) {
|
|
1473
|
+
this.logToStderr(`Run: ${runId}`);
|
|
1474
|
+
}
|
|
1463
1475
|
// The durable record, consulted when the stream goes quiet. Without this
|
|
1464
1476
|
// the CLI has no terminal condition for a run-level failure at all: the
|
|
1465
1477
|
// refusal is written to the message and the session stream is never closed,
|
|
@@ -1500,7 +1512,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1500
1512
|
quiet,
|
|
1501
1513
|
approveTools: flags['approve-tools'],
|
|
1502
1514
|
reconcileTerminal,
|
|
1503
|
-
resumeRecordedResponseId: replayedInbound ? started.responseMessageId : undefined,
|
|
1515
|
+
resumeRecordedResponseId: replayedInbound || started.idempotentReplay === true ? started.responseMessageId : undefined,
|
|
1504
1516
|
awaitHandover,
|
|
1505
1517
|
replayEnvelopes: (from) => (0, api_fetch_1.apiFetch)(`/api/agentic/sessions/${encodeURIComponent(started.sessionId)}/envelopes?from=${from}&limit=500`, { credential: this.resolvedCredential, signal: AbortSignal.timeout(5000) }),
|
|
1506
1518
|
});
|
|
@@ -1560,6 +1572,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1560
1572
|
if (flags.jsonl) {
|
|
1561
1573
|
writeNotice(process.stdout.fd, `${JSON.stringify({
|
|
1562
1574
|
type: 'run.detached',
|
|
1575
|
+
...runRef,
|
|
1563
1576
|
sessionId: started.sessionId,
|
|
1564
1577
|
conversationId: started.conversationId,
|
|
1565
1578
|
interrupted: true,
|
|
@@ -1601,6 +1614,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1601
1614
|
if (flags.jsonl) {
|
|
1602
1615
|
writeNotice(process.stdout.fd, `${JSON.stringify({
|
|
1603
1616
|
type: 'run.detached',
|
|
1617
|
+
...runRef,
|
|
1604
1618
|
sessionId: started.sessionId,
|
|
1605
1619
|
conversationId: started.conversationId,
|
|
1606
1620
|
interrupted: true,
|
|
@@ -1659,6 +1673,7 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1659
1673
|
if (flags.jsonl) {
|
|
1660
1674
|
(0, agentic_stream_1.writeJsonLine)(process.stdout, {
|
|
1661
1675
|
type: 'run.detached',
|
|
1676
|
+
...runRef,
|
|
1662
1677
|
sessionId: started.sessionId,
|
|
1663
1678
|
conversationId: started.conversationId,
|
|
1664
1679
|
interrupted: interrupts > 0,
|
|
@@ -1678,13 +1693,14 @@ class AgentsChat extends base_command_1.BaseCommand {
|
|
|
1678
1693
|
// The event stream already contains the terminal event. This summary
|
|
1679
1694
|
// makes shell consumers able to find the final text without replaying
|
|
1680
1695
|
// the event reducer.
|
|
1681
|
-
(0, agentic_stream_1.writeJsonLine)(process.stdout, { type: 'run.result', ...result });
|
|
1696
|
+
(0, agentic_stream_1.writeJsonLine)(process.stdout, { type: 'run.result', ...result, ...runRef });
|
|
1682
1697
|
process.exitCode = streamedResultExitCode(result);
|
|
1683
1698
|
}
|
|
1684
1699
|
else if (quiet && flags.json) {
|
|
1685
1700
|
// A real executed turn — the metadata says so, unlike `--quick`.
|
|
1686
1701
|
this.log(JSON.stringify(noStreamJsonPayload({
|
|
1687
1702
|
result,
|
|
1703
|
+
runId,
|
|
1688
1704
|
admittedRuntime: started.runtime,
|
|
1689
1705
|
conversationId: started.conversationId,
|
|
1690
1706
|
agentId: args.agentId,
|
|
@@ -13,6 +13,7 @@ class AgentsEvalShow extends base_command_1.BaseCommand {
|
|
|
13
13
|
};
|
|
14
14
|
static flags = {
|
|
15
15
|
json: core_1.Flags.boolean({ description: 'Output JSON' }),
|
|
16
|
+
runs: core_1.Flags.boolean({ description: 'Show the evaluation’s available Run addresses' }),
|
|
16
17
|
};
|
|
17
18
|
async run() {
|
|
18
19
|
this.requireAuth();
|
|
@@ -30,6 +31,24 @@ class AgentsEvalShow extends base_command_1.BaseCommand {
|
|
|
30
31
|
}
|
|
31
32
|
for (const line of (0, agent_evals_1.describeEvalReport)(evaluation))
|
|
32
33
|
this.log(line);
|
|
34
|
+
if (flags.runs) {
|
|
35
|
+
const references = new Map();
|
|
36
|
+
if (evaluation.runHistorySupported) {
|
|
37
|
+
for (const { key, runId } of [...(evaluation.attemptErrors ?? []), ...evaluation.trials]) {
|
|
38
|
+
if (runId)
|
|
39
|
+
references.set(runId, key);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (references.size) {
|
|
43
|
+
this.log('');
|
|
44
|
+
this.log(' Recorded runs');
|
|
45
|
+
for (const [runId, key] of references)
|
|
46
|
+
this.log(` ${key} skrr runs show ${runId}`);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.log(' No Run addresses are available for this evaluation.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
33
52
|
this.printAgentUrl(args.agentId);
|
|
34
53
|
}
|
|
35
54
|
}
|
|
@@ -24,7 +24,7 @@ class AgentsIntuitionsGenerate extends base_command_1.BaseCommand {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
// The look runs on an agent worker; the server only queued it.
|
|
27
|
-
this.log(`
|
|
27
|
+
this.log(`Look requested. Follow its status with: skrr agents intuitions list ${args.agentId}`);
|
|
28
28
|
this.printAgentUrl(args.agentId);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -20,7 +20,7 @@ class AgentsIntuitionsList extends base_command_1.BaseCommand {
|
|
|
20
20
|
const response = result;
|
|
21
21
|
const intuitions = response.intuitions ?? result;
|
|
22
22
|
if (Array.isArray(intuitions) && intuitions.length === 0) {
|
|
23
|
-
this.log(response.canLook
|
|
23
|
+
this.log(response.canLook && response.lookAround?.state !== 'looking'
|
|
24
24
|
? `No open suggestions. Ask it to look around now: skrr agents intuitions generate ${args.agentId}`
|
|
25
25
|
: 'No open suggestions.');
|
|
26
26
|
}
|
|
@@ -35,7 +35,7 @@ class CodeAcp extends core_1.Command {
|
|
|
35
35
|
// The unit tests did not catch it because they cover `buildEngineArgs`, which
|
|
36
36
|
// always forwarded verbatim. The args never reached it.
|
|
37
37
|
//
|
|
38
|
-
// OSK-3892 — and
|
|
38
|
+
// OSK-3892 — and no `brokerInference` here. The daemon that
|
|
39
39
|
// drives this command already brokers inference for the session: it admits the
|
|
40
40
|
// lease, hosts the loopback broker, and injects the relay env. A second broker
|
|
41
41
|
// in this process would double-wrap the relay and mint a second lease against
|
|
@@ -7,10 +7,10 @@ import { BaseCommand } from '../../base-command';
|
|
|
7
7
|
*
|
|
8
8
|
* The interactive session's transcript lives inside the engine, which
|
|
9
9
|
* is a separately released binary (`resolveEngine` in `lib/first-party-harness.ts`), and
|
|
10
|
-
* the server holds none of it: a managed
|
|
10
|
+
* the server holds none of it: a local engine with managed inference calls
|
|
11
11
|
* `/api/agentic/sessions/:id/inference/{admit,release}` and the token endpoints,
|
|
12
|
-
* never `/ingest`.
|
|
13
|
-
*
|
|
12
|
+
* never `/ingest`. The brief comes from the human and the workspace context
|
|
13
|
+
* comes from git. An explicit transcript export can supply more context.
|
|
14
14
|
*
|
|
15
15
|
* ── Why it dispatches a Cloud Coding task ──────────────────────────────────
|
|
16
16
|
*
|