@skrr-ai/cli 0.1.231 → 0.1.233
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 +42 -4
- package/bin/dev.cjs +4 -1
- package/bin/run.js +0 -15
- package/dist/base-command.d.ts +6 -11
- package/dist/base-command.js +34 -43
- package/dist/commands/agenda/plan.d.ts +2 -1
- package/dist/commands/agenda/plan.js +18 -4
- 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 +4 -0
- package/dist/commands/agents/chat.js +79 -17
- package/dist/commands/agents/eval/list.d.ts +4 -0
- package/dist/commands/agents/eval/list.js +33 -0
- 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/agents/permissions/policy.js +25 -2
- package/dist/commands/agents/spawn.js +61 -24
- package/dist/commands/agents/triggers/fire.js +1 -1
- package/dist/commands/agents/triggers/runs.js +3 -0
- 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/approve.d.ts +1 -11
- package/dist/commands/code/jobs/approve.js +3 -15
- package/dist/commands/code/jobs/cancel.js +3 -2
- package/dist/commands/code/jobs/index.js +1 -1
- package/dist/commands/code/jobs/list.js +4 -11
- package/dist/commands/code/jobs/run.js +13 -7
- package/dist/commands/code/jobs/show.js +52 -6
- package/dist/commands/code/run.js +1 -1
- package/dist/commands/commands.d.ts +1 -0
- package/dist/commands/commands.js +5 -1
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/context.js +1 -0
- package/dist/commands/duties/catalog/add.d.ts +18 -0
- package/dist/commands/duties/catalog/add.js +52 -0
- package/dist/commands/duties/catalog/index.d.ts +18 -0
- package/dist/commands/duties/catalog/index.js +88 -0
- package/dist/commands/duties/receipt.js +56 -1
- package/dist/commands/goals/plan-now.d.ts +5 -3
- package/dist/commands/goals/plan-now.js +21 -16
- package/dist/commands/goals/planner-compare.js +5 -3
- package/dist/commands/instructions/discovery.d.ts +10 -0
- package/dist/commands/instructions/discovery.js +74 -0
- package/dist/commands/runs/admission.d.ts +12 -0
- package/dist/commands/runs/admission.js +66 -0
- package/dist/commands/runs/events.d.ts +16 -0
- package/dist/commands/runs/events.js +89 -0
- package/dist/commands/runs/list.d.ts +27 -0
- package/dist/commands/runs/list.js +151 -0
- package/dist/commands/runs/show.d.ts +14 -0
- package/dist/commands/runs/show.js +273 -0
- package/dist/commands/runs/stop.d.ts +15 -0
- package/dist/commands/runs/stop.js +105 -0
- package/dist/commands/runs/transcript.d.ts +19 -0
- package/dist/commands/runs/transcript.js +178 -0
- package/dist/commands/tasks/attachments/download.d.ts +1 -0
- package/dist/commands/tasks/attachments/download.js +6 -4
- package/dist/commands/tasks/attachments/source.d.ts +6 -0
- package/dist/commands/tasks/attachments/source.js +18 -0
- package/dist/commands/tasks/chat/exchange.d.ts +0 -14
- package/dist/commands/tasks/chat/exchange.js +8 -39
- package/dist/commands/tasks/chat/reply-run.d.ts +15 -0
- package/dist/commands/tasks/chat/reply-run.js +69 -0
- package/dist/commands/tasks/complete.js +1 -1
- package/dist/commands/tasks/lifecycle/transition.d.ts +1 -0
- package/dist/commands/tasks/lifecycle/transition.js +51 -13
- package/dist/commands/tasks/operations/show.js +5 -0
- package/dist/commands/tasks/result/submit.js +4 -2
- package/dist/commands/tasks/retry.js +25 -16
- 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/commands/triggers/audit.js +3 -1
- package/dist/commands/triggers/fire-detail.js +4 -1
- package/dist/commands/triggers/fire.js +1 -1
- package/dist/commands/usage.d.ts +1 -0
- package/dist/commands/usage.js +1 -0
- package/dist/generated/agent-guides.json +350 -777
- package/dist/help.d.ts +2 -7
- package/dist/help.js +13 -7
- package/dist/hooks/init.js +10 -0
- package/dist/lib/agent-chat-queue.d.ts +2 -1
- package/dist/lib/agent-chat-queue.js +26 -21
- package/dist/lib/agent-evals.d.ts +1 -1
- package/dist/lib/agent-evals.js +13 -3
- package/dist/lib/agent-guides.d.ts +3 -5
- package/dist/lib/agent-guides.js +12 -13
- package/dist/lib/agent-runs.d.ts +101 -0
- package/dist/lib/agent-runs.js +350 -0
- package/dist/lib/agentic-stream.d.ts +13 -1
- package/dist/lib/agentic-stream.js +165 -81
- package/dist/lib/api-fetch.d.ts +4 -2
- package/dist/lib/api-fetch.js +11 -5
- package/dist/lib/code-handover.d.ts +2 -3
- package/dist/lib/code-handover.js +4 -6
- package/dist/lib/command-manifest.d.ts +1 -6
- package/dist/lib/command-manifest.js +86 -13
- package/dist/lib/communication-history.d.ts +27 -0
- package/dist/lib/communication-history.js +45 -0
- package/dist/lib/config.d.ts +2 -3
- package/dist/lib/config.js +2 -3
- package/dist/lib/duties.d.ts +5 -1
- package/dist/lib/duties.js +4 -0
- package/dist/lib/execution-history.d.ts +34 -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/format.d.ts +1 -0
- package/dist/lib/format.js +18 -0
- package/dist/lib/guide-pointer.d.ts +5 -1
- package/dist/lib/guide-pointer.js +21 -2
- package/dist/lib/hosted-job-status.d.ts +4 -0
- package/dist/lib/hosted-job-status.js +19 -0
- package/dist/lib/inbound-messages.d.ts +2 -0
- package/dist/lib/inbound-messages.js +5 -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/roles.d.ts +2 -2
- package/dist/lib/schedule.d.ts +4 -0
- package/dist/lib/schedule.js +4 -3
- package/dist/lib/task-agent-run.d.ts +4 -0
- package/dist/lib/task-agent-run.js +15 -0
- package/dist/lib/task-execution.d.ts +1 -1
- package/dist/lib/task-execution.js +3 -19
- package/dist/lib/task-extras.d.ts +11 -1
- package/dist/lib/task-extras.js +15 -1
- package/dist/lib/task-transcript.js +3 -8
- package/dist/lib/triggers.d.ts +5 -36
- package/dist/lib/triggers.js +48 -33
- 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 +40 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.d.ts +37 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.js +59 -0
- 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 +34 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.d.ts +37 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.js +57 -0
- 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/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +12259 -12160
- package/docs/v1/quickstart.md +18 -0
- package/oclif.manifest.json +3405 -2112
- package/package.json +6 -2
- package/skills/skrr/SKILL.md +14 -0
- package/dist/commands/triggers/runs.d.ts +0 -22
- package/dist/commands/triggers/runs.js +0 -58
package/README.md
CHANGED
|
@@ -57,6 +57,13 @@ the local daemon's account, server and profile, then previews the real file path
|
|
|
57
57
|
whether the agent can read them. Use `--provider codex --review` to inspect the exact content
|
|
58
58
|
without installing. To choose a different machine explicitly, pass `--daemon <id>`.
|
|
59
59
|
|
|
60
|
+
After installing for a coding agent, run `skrr instructions discovery --provider codex`
|
|
61
|
+
from the project directory (also supports `claude` and `skrr-code`). Start a new
|
|
62
|
+
agent session there. The Skill helps the agent recognize requests about shared
|
|
63
|
+
Tasks and find the CLI guides. Setup works before sign-in. For Beta, the
|
|
64
|
+
[verified build's install summary](https://github.com/skrr-ai/OverSky/actions/workflows/npm-release-verify.yml?query=branch%3Abeta)
|
|
65
|
+
includes the project setup and identifies the exact source commit.
|
|
66
|
+
|
|
60
67
|
Automation never prompts. For an explicit installation, use
|
|
61
68
|
`skrr instructions setup --provider codex --update-policy latest --yes --json`.
|
|
62
69
|
Use `--update-policy pinned` to keep the current version, or `--review --json` to get a
|
|
@@ -193,6 +200,35 @@ skrr agents activity <agent-id> --limit 10 # merged DM + conversations + ta
|
|
|
193
200
|
`SERVER_AGENT_FILTER_UNSUPPORTED` rather than returning another agent's
|
|
194
201
|
conversations, and `agents activity` filters locally with a printed caveat.
|
|
195
202
|
|
|
203
|
+
### Inspecting Agent Runs
|
|
204
|
+
|
|
205
|
+
Use the `ar_…` Run ID from a Chat acceptance. An interactive Chat prints it
|
|
206
|
+
on the Run line, and `--jsonl` includes it in the `run.accepted` event.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
skrr runs show <run-id>
|
|
210
|
+
skrr runs events <run-id> --json
|
|
211
|
+
skrr runs events <run-id> --attempt <attempt-id> --workspace <workspace-id>
|
|
212
|
+
skrr runs events <run-id> --attempt <attempt-id> --workspace <workspace-id> --cursor=<cursor> --json
|
|
213
|
+
skrr runs stop <run-id>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The first event read returns the current Run snapshot and a cursor. Use
|
|
217
|
+
`--attempt` to replay events for an exact Attempt. Continue with the same
|
|
218
|
+
Run, Attempt selection and workspace. The human-readable output prints that
|
|
219
|
+
command. An exact Attempt page can be empty while more journal positions
|
|
220
|
+
remain. Pass its returned cursor to continue. For a personal Run, omit the
|
|
221
|
+
workspace flag.
|
|
222
|
+
|
|
223
|
+
By default, Stop targets the current snapshot. An accepted request reports
|
|
224
|
+
`stop_requested` until the platform confirms cancellation.
|
|
225
|
+
|
|
226
|
+
If a Stop response is lost, the CLI checks the journal from its original
|
|
227
|
+
snapshot in the same workspace. If the result is still unconfirmed, use the
|
|
228
|
+
printed command to retry the original target. Use `--attempt <attempt-id>`
|
|
229
|
+
for the original Attempt or `--queued` if the Run was queued before any
|
|
230
|
+
Attempt started. These forms can recover the retained receipt after the Run ends.
|
|
231
|
+
|
|
196
232
|
### Production CLI Contract
|
|
197
233
|
|
|
198
234
|
skrr CLI is designed for both humans and daemon agents. New commands should
|
|
@@ -746,10 +782,10 @@ sky triggers list --scope agent
|
|
|
746
782
|
sky triggers create --scope agent --ref agentId=<agent-id> --kind schedule --mode send_message --cron "0 9 * * *" --prompt "Prepare the daily brief"
|
|
747
783
|
sky triggers update <trigger-id> --no-enabled
|
|
748
784
|
sky triggers fire <trigger-id>
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
785
|
+
skrr triggers audit <trigger-id> --json
|
|
786
|
+
skrr triggers audit --scope agent --limit 50
|
|
787
|
+
skrr triggers fire-detail <trigger-id> <occurrence-id>
|
|
788
|
+
skrr runs show <run-id>
|
|
753
789
|
sky triggers event-catalog
|
|
754
790
|
sky triggers parse-intent --scope agent --ref agentId=<agent-id> --message "Every weekday at 9, review tasks"
|
|
755
791
|
sky triggers capabilities space_subscriber
|
|
@@ -757,6 +793,8 @@ sky triggers capabilities space_subscriber
|
|
|
757
793
|
|
|
758
794
|
Use `--from-json <file|->` on `create`, `update`, and `fire` for full request
|
|
759
795
|
bodies. Scope refs are passed as repeatable `--ref key=value` flags.
|
|
796
|
+
Use the occurrence ID from the audit to open Fire detail, then follow its
|
|
797
|
+
`runs show` command when it includes a verified Agent Run.
|
|
760
798
|
|
|
761
799
|
### `sky duties ...`
|
|
762
800
|
|
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' });
|
|
@@ -25,7 +29,6 @@ async function main(argv) {
|
|
|
25
29
|
}),
|
|
26
30
|
);
|
|
27
31
|
require('../src/lib/command-manifest.ts').useSourceCommandManifest(root, source.manifest);
|
|
28
|
-
require('../src/lib/config.ts').seedWorkspaceEnv();
|
|
29
32
|
await run(argv, { root, plugins: [source, ...bundled] });
|
|
30
33
|
}
|
|
31
34
|
|
package/bin/run.js
CHANGED
|
@@ -148,21 +148,6 @@ if (missingBuildPath) {
|
|
|
148
148
|
|
|
149
149
|
const oclif = require('@oclif/core');
|
|
150
150
|
|
|
151
|
-
// The workspace this machine works in (`skrr workspaces use`) becomes
|
|
152
|
-
// `OVERSKY_WORKSPACE_ID` before any command runs, so every reader of that
|
|
153
|
-
// variable honours the selection without learning about a config file.
|
|
154
|
-
//
|
|
155
|
-
// Here rather than in `BaseCommand.init` because `skrr code` deliberately does
|
|
156
|
-
// not extend BaseCommand, and it is the command that needed this most.
|
|
157
|
-
//
|
|
158
|
-
// Best-effort: a read-only home or a corrupt config means "no selection", and a
|
|
159
|
-
// stored preference must never be the reason a command cannot start.
|
|
160
|
-
try {
|
|
161
|
-
require('../dist/lib/config').seedWorkspaceEnv();
|
|
162
|
-
} catch {
|
|
163
|
-
/* no selection */
|
|
164
|
-
}
|
|
165
|
-
|
|
166
151
|
oclif.execute({ dir: __dirname }).catch((err) => {
|
|
167
152
|
if (err && typeof err.oclif === 'object' && typeof err.oclif.exit === 'number') {
|
|
168
153
|
process.exit(err.oclif.exit);
|
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;
|
|
@@ -137,6 +127,8 @@ export declare abstract class BaseCommand extends Command {
|
|
|
137
127
|
*/
|
|
138
128
|
protected credentialProvenance: CredentialProvenance | null;
|
|
139
129
|
protected bareMode: boolean;
|
|
130
|
+
static credentialMode: 'standard' | 'borrow-only' | 'local';
|
|
131
|
+
private parsedBeforeAuth?;
|
|
140
132
|
/** Managed runtimes must never suggest a human's local credential store. */
|
|
141
133
|
private authManagedRuntime;
|
|
142
134
|
/**
|
|
@@ -243,7 +235,10 @@ export declare abstract class BaseCommand extends Command {
|
|
|
243
235
|
protected resolveEntityRef(kind: 'task' | 'space' | 'project', value: string, opts?: {
|
|
244
236
|
space?: string;
|
|
245
237
|
}): Promise<string>;
|
|
246
|
-
protected resolveTaskReference(value: string
|
|
238
|
+
protected resolveTaskReference(value: string, listCandidates?: (params: {
|
|
239
|
+
q: string;
|
|
240
|
+
limit: number;
|
|
241
|
+
}) => Promise<unknown>): Promise<string>;
|
|
247
242
|
/**
|
|
248
243
|
* Parse flags, then resolve any `--space` reference to an id.
|
|
249
244
|
*
|
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 });
|
|
@@ -384,6 +368,8 @@ class BaseCommand extends core_1.Command {
|
|
|
384
368
|
*/
|
|
385
369
|
credentialProvenance = null;
|
|
386
370
|
bareMode = false;
|
|
371
|
+
static credentialMode = 'standard';
|
|
372
|
+
parsedBeforeAuth;
|
|
387
373
|
/** Managed runtimes must never suggest a human's local credential store. */
|
|
388
374
|
authManagedRuntime = false;
|
|
389
375
|
/**
|
|
@@ -394,6 +380,9 @@ class BaseCommand extends core_1.Command {
|
|
|
394
380
|
brokerRefusal = null;
|
|
395
381
|
async init() {
|
|
396
382
|
await super.init();
|
|
383
|
+
const ctor = this.constructor;
|
|
384
|
+
if (ctor.credentialMode === 'local')
|
|
385
|
+
return;
|
|
397
386
|
// Task Agent Context compatibility is meaningful only when the API can
|
|
398
387
|
// distinguish a real CLI build from a generic HTTP caller. This is still
|
|
399
388
|
// telemetry/presentation metadata: the server must never treat it as an
|
|
@@ -447,35 +436,22 @@ class BaseCommand extends core_1.Command {
|
|
|
447
436
|
// time with the exit signal as its cause: two JSON documents on stdout and a message ending
|
|
448
437
|
// in `EEXIT: 75` (OSK-23475).
|
|
449
438
|
let delegatedCredential;
|
|
450
|
-
let keepBoundSession = false;
|
|
451
439
|
try {
|
|
452
440
|
delegatedCredential = await (0, delegated_cli_1.fetchDelegatedCliCredential)();
|
|
453
441
|
}
|
|
454
442
|
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
|
-
}
|
|
443
|
+
this.failDelegatedCredentialUnavailable(err);
|
|
466
444
|
}
|
|
467
|
-
if (!
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
autonomousCredential = delegatedCredential;
|
|
477
|
-
this.credentialProvenance = { kind: 'daemon-delegated' };
|
|
445
|
+
if (!delegatedCredential) {
|
|
446
|
+
this.failWithCliError({
|
|
447
|
+
message: 'Daemon delegated skrr credential is unavailable.',
|
|
448
|
+
code: 'DELEGATED_CLI_CREDENTIAL_UNAVAILABLE',
|
|
449
|
+
exit: 75,
|
|
450
|
+
retryable: true,
|
|
451
|
+
});
|
|
478
452
|
}
|
|
453
|
+
autonomousCredential = delegatedCredential;
|
|
454
|
+
this.credentialProvenance = { kind: 'daemon-delegated' };
|
|
479
455
|
}
|
|
480
456
|
if (autonomousCredential) {
|
|
481
457
|
// Parse for normal oclif flag validation, but intentionally ignore both
|
|
@@ -615,6 +591,17 @@ class BaseCommand extends core_1.Command {
|
|
|
615
591
|
!ignoredStoredCredential.bundle &&
|
|
616
592
|
ignoredStoredCredential.ownerStatus !== 'foreign' &&
|
|
617
593
|
(ignoredStoredCredential.originStatus ?? 'none') === 'none';
|
|
594
|
+
// Only a validated invocation may create a durable sign-in. Reuse the
|
|
595
|
+
// parser result because passing an argument on stdin consumes it.
|
|
596
|
+
// Commands with an opaque argument tail can borrow for this invocation.
|
|
597
|
+
const mayAdopt = nothingStored &&
|
|
598
|
+
!earlyAutoBroker &&
|
|
599
|
+
ctor.credentialMode === 'standard' &&
|
|
600
|
+
ctor.strict !== false &&
|
|
601
|
+
!this.argv.includes('--');
|
|
602
|
+
if (mayAdopt) {
|
|
603
|
+
this.parsedBeforeAuth = await super.parse();
|
|
604
|
+
}
|
|
618
605
|
// Daemon-as-broker auto-mint. When the resolver came up empty AND
|
|
619
606
|
// a local `oversky` daemon is already authenticated for this user,
|
|
620
607
|
// silently mint a sibling cli-scope refresh family via the daemon's
|
|
@@ -642,7 +629,7 @@ class BaseCommand extends core_1.Command {
|
|
|
642
629
|
cliConfig: this.cliConfig,
|
|
643
630
|
bareMode: this.bareMode,
|
|
644
631
|
commandId: this.id,
|
|
645
|
-
adopt:
|
|
632
|
+
adopt: mayAdopt,
|
|
646
633
|
}));
|
|
647
634
|
if (autoResult.adoptedBySibling) {
|
|
648
635
|
// Another `skrr` adopted this profile's session while this one waited
|
|
@@ -1005,7 +992,7 @@ class BaseCommand extends core_1.Command {
|
|
|
1005
992
|
return this.resolveSpaceReference(value);
|
|
1006
993
|
return (await this.resolveProjectReference(value, opts.space)).projectRef;
|
|
1007
994
|
}
|
|
1008
|
-
async resolveTaskReference(value) {
|
|
995
|
+
async resolveTaskReference(value, listCandidates = data_provider_1.dataService.listTasks) {
|
|
1009
996
|
const direct = (0, task_ref_resolver_1.directTaskRef)(value);
|
|
1010
997
|
if (direct)
|
|
1011
998
|
return direct;
|
|
@@ -1035,7 +1022,7 @@ class BaseCommand extends core_1.Command {
|
|
|
1035
1022
|
}
|
|
1036
1023
|
let response;
|
|
1037
1024
|
try {
|
|
1038
|
-
response = await
|
|
1025
|
+
response = await listCandidates({ q: query, limit: 50 });
|
|
1039
1026
|
}
|
|
1040
1027
|
catch (err) {
|
|
1041
1028
|
this.handleApiError(err);
|
|
@@ -1078,7 +1065,11 @@ class BaseCommand extends core_1.Command {
|
|
|
1078
1065
|
* `--space` is repeatable on `spaces reorder`, so both shapes are handled.
|
|
1079
1066
|
*/
|
|
1080
1067
|
async parse(options, argv) {
|
|
1081
|
-
const
|
|
1068
|
+
const cached = this.parsedBeforeAuth;
|
|
1069
|
+
const parsed = cached && (options === undefined || options === this.constructor) && argv === undefined
|
|
1070
|
+
? cached
|
|
1071
|
+
: await super.parse(options, argv);
|
|
1072
|
+
this.parsedBeforeAuth = undefined;
|
|
1082
1073
|
const ctor = this.constructor;
|
|
1083
1074
|
const flags = parsed.flags;
|
|
1084
1075
|
const raw = flags?.space;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PlanAgendaResponse } from '@skrr-ai/data-provider';
|
|
1
2
|
import { BaseCommand } from '../../base-command';
|
|
2
3
|
/**
|
|
3
4
|
* The first thing a following terminal says after the runtime line. The turn is
|
|
@@ -5,7 +6,7 @@ import { BaseCommand } from '../../base-command';
|
|
|
5
6
|
* stream reports `run.started` nothing else prints, which reads as a hang
|
|
6
7
|
* (OSK-22554). Names the cloud worker when that is where the turn is queued.
|
|
7
8
|
*/
|
|
8
|
-
export declare function describeQueuedProgress(runtime: unknown): string;
|
|
9
|
+
export declare function describeQueuedProgress(runtime: unknown, phase?: PlanAgendaResponse['phase']): string;
|
|
9
10
|
/**
|
|
10
11
|
* Why a followed Agenda turn failed, in words.
|
|
11
12
|
*
|
|
@@ -6,6 +6,7 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
7
|
const base_command_1 = require("../../base-command");
|
|
8
8
|
const api_fetch_1 = require("../../lib/api-fetch");
|
|
9
|
+
const agent_runs_1 = require("../../lib/agent-runs");
|
|
9
10
|
const agentic_stream_1 = require("../../lib/agentic-stream");
|
|
10
11
|
const chat_1 = require("../agents/chat");
|
|
11
12
|
/**
|
|
@@ -14,7 +15,9 @@ const chat_1 = require("../agents/chat");
|
|
|
14
15
|
* stream reports `run.started` nothing else prints, which reads as a hang
|
|
15
16
|
* (OSK-22554). Names the cloud worker when that is where the turn is queued.
|
|
16
17
|
*/
|
|
17
|
-
function describeQueuedProgress(runtime) {
|
|
18
|
+
function describeQueuedProgress(runtime, phase) {
|
|
19
|
+
if (phase === 'request_recorded')
|
|
20
|
+
return 'Waiting for Run acceptance…';
|
|
18
21
|
const plan = runtime && typeof runtime === 'object'
|
|
19
22
|
? runtime.executionPlan
|
|
20
23
|
: null;
|
|
@@ -113,7 +116,13 @@ class AgendaPlan extends base_command_1.BaseCommand {
|
|
|
113
116
|
this.log(JSON.stringify(response, null, 2));
|
|
114
117
|
return;
|
|
115
118
|
}
|
|
116
|
-
|
|
119
|
+
const requestRecorded = response.phase === 'request_recorded';
|
|
120
|
+
this.log(requestRecorded
|
|
121
|
+
? `Agenda planning request recorded for agent ${args.agentId}`
|
|
122
|
+
: `Agenda planning accepted for agent ${args.agentId}`);
|
|
123
|
+
const runId = (0, agent_runs_1.canonicalRunId)(response.runId);
|
|
124
|
+
if (runId)
|
|
125
|
+
this.log(`Run ID: ${runId}`);
|
|
117
126
|
this.log(`Conversation ID: ${response.conversationId}`);
|
|
118
127
|
this.log(`Session ID: ${response.sessionId}`);
|
|
119
128
|
this.log(`New conversation: ${response.isNewConversation ? 'yes' : 'no'}`);
|
|
@@ -122,10 +131,15 @@ class AgendaPlan extends base_command_1.BaseCommand {
|
|
|
122
131
|
this.log(`Runtime: ${runtimeDescription}`);
|
|
123
132
|
this.log('');
|
|
124
133
|
if (!follow) {
|
|
125
|
-
|
|
134
|
+
if (requestRecorded && response.clientRequestId) {
|
|
135
|
+
this.log(`Check Run acceptance with: ${this.config.bin} runs admission ${response.clientRequestId}`);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this.log(`Follow progress in conversation ${response.conversationId}.`);
|
|
139
|
+
}
|
|
126
140
|
return;
|
|
127
141
|
}
|
|
128
|
-
this.log(describeQueuedProgress(response.runtime));
|
|
142
|
+
this.log(describeQueuedProgress(response.runtime, response.phase));
|
|
129
143
|
const readMessages = async () => {
|
|
130
144
|
const messages = await data_provider_1.dataService.getMessagesByConvoId(response.conversationId);
|
|
131
145
|
return Array.isArray(messages) ? messages : [];
|
|
@@ -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;
|