@revition/plugin-agents 0.0.0-canary.2a173bc

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.
Files changed (53) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +8 -0
  3. package/dist/commands/agents/create.d.ts +26 -0
  4. package/dist/commands/agents/create.js +46 -0
  5. package/dist/commands/agents/create.js.map +1 -0
  6. package/dist/commands/agents/diff.d.ts +22 -0
  7. package/dist/commands/agents/diff.js +41 -0
  8. package/dist/commands/agents/diff.js.map +1 -0
  9. package/dist/commands/agents/environments/list.d.ts +37 -0
  10. package/dist/commands/agents/environments/list.js +39 -0
  11. package/dist/commands/agents/environments/list.js.map +1 -0
  12. package/dist/commands/agents/list.d.ts +44 -0
  13. package/dist/commands/agents/list.js +75 -0
  14. package/dist/commands/agents/list.js.map +1 -0
  15. package/dist/commands/agents/open.d.ts +31 -0
  16. package/dist/commands/agents/open.js +47 -0
  17. package/dist/commands/agents/open.js.map +1 -0
  18. package/dist/commands/agents/pull.d.ts +29 -0
  19. package/dist/commands/agents/pull.js +69 -0
  20. package/dist/commands/agents/pull.js.map +1 -0
  21. package/dist/commands/agents/push.d.ts +31 -0
  22. package/dist/commands/agents/push.js +63 -0
  23. package/dist/commands/agents/push.js.map +1 -0
  24. package/dist/commands/agents/runs.d.ts +47 -0
  25. package/dist/commands/agents/runs.js +70 -0
  26. package/dist/commands/agents/runs.js.map +1 -0
  27. package/dist/commands/agents/status.d.ts +29 -0
  28. package/dist/commands/agents/status.js +47 -0
  29. package/dist/commands/agents/status.js.map +1 -0
  30. package/dist/commands/agents/templates.d.ts +20 -0
  31. package/dist/commands/agents/templates.js +26 -0
  32. package/dist/commands/agents/templates.js.map +1 -0
  33. package/dist/commands/agents/test.d.ts +58 -0
  34. package/dist/commands/agents/test.js +73 -0
  35. package/dist/commands/agents/test.js.map +1 -0
  36. package/dist/commands/agents/traces.d.ts +46 -0
  37. package/dist/commands/agents/traces.js +80 -0
  38. package/dist/commands/agents/traces.js.map +1 -0
  39. package/dist/commands/agents/validate.d.ts +43 -0
  40. package/dist/commands/agents/validate.js +76 -0
  41. package/dist/commands/agents/validate.js.map +1 -0
  42. package/dist/format.d.ts +49 -0
  43. package/dist/format.js +48 -0
  44. package/dist/format.js.map +1 -0
  45. package/dist/index.d.ts +2 -0
  46. package/dist/index.js +5 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/schema/agent-definition.v1.json +233 -0
  49. package/dist/validate.d.ts +21 -0
  50. package/dist/validate.js +55 -0
  51. package/dist/validate.js.map +1 -0
  52. package/oclif.manifest.json +1463 -0
  53. package/package.json +60 -0
@@ -0,0 +1,47 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { canOpenBrowser, EXIT, isWebLink, openBrowser, PRODUCTION_WEB_LINKS, RevitionCliError, RevitionCommand, webLinksOf, } from '@revition/cli-core';
3
+ export const OPEN_ACTIONS = ['publish', 'promote'];
4
+ /**
5
+ * The portal page where a person publishes an agent's draft or promotes an environment: the agent's page, the same
6
+ * page the server names when it refuses a CLI token on those routes (sentinel/cli-scopes human-only-routes.ts
7
+ * portalUrlFor: `/deployments/...` -> `/foundry/agents/{id}`), on the profile's web app (plan amendment 2026-11-27). PURE.
8
+ */
9
+ export function agentPageUrl(agentId, links = PRODUCTION_WEB_LINKS) {
10
+ return `${links.app}/foundry/agents/${encodeURIComponent(agentId)}`;
11
+ }
12
+ /** Only https pages on the profile's own web hosts are opened. */
13
+ export function assertRevitionPage(url, links = PRODUCTION_WEB_LINKS) {
14
+ if (!isWebLink(url, links)) {
15
+ throw new RevitionCliError({ code: 'URL_NOT_ALLOWED', message: `Refusing to open ${url}: not a Revition page.` }, EXIT.usage);
16
+ }
17
+ return new URL(url).toString();
18
+ }
19
+ /** T3.1.4 - `revition agents open <id> [--action publish|promote]`: the human step's page (D9: the CLI never publishes). */
20
+ export default class AgentsOpen extends RevitionCommand {
21
+ static summary = "Open the agent's portal page, where a person publishes the draft or promotes an environment.";
22
+ static examples = ['revition agents open dep_123 --action publish'];
23
+ static meta = {
24
+ id: 'agents:open',
25
+ summary: AgentsOpen.summary,
26
+ examples: AgentsOpen.examples,
27
+ requiredScopes: [],
28
+ mutates: false,
29
+ confirm: 'none',
30
+ jsonSchemaId: 'revition.agents.open.v1',
31
+ stability: 'beta',
32
+ };
33
+ static args = { id: Args.string({ required: true, description: 'The agent (deployment id).' }) };
34
+ static flags = { action: Flags.option({ options: OPEN_ACTIONS, description: 'The human step you will take there.' })() };
35
+ async run2(ctx) {
36
+ const agentId = String(ctx.args['id']);
37
+ const a = ctx.commandFlags['action'];
38
+ const links = await webLinksOf(ctx);
39
+ const url = assertRevitionPage(agentPageUrl(agentId, links), links);
40
+ const opened = !ctx.flags.json && canOpenBrowser(ctx.env, process.platform) ? await openBrowser(url) : false;
41
+ return { agentId, action: OPEN_ACTIONS.find((x) => x === a) ?? null, url, opened };
42
+ }
43
+ human(o) {
44
+ return { text: `${o.opened ? 'Opened' : 'Open'} ${o.url}${o.action === null ? '' : ` to ${o.action}`} (a person does it there).\n` };
45
+ }
46
+ }
47
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/agents/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,IAAI,EACJ,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,UAAU,GAKX,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,SAAS,CAAU,CAAC;AAE5D;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,QAAkB,oBAAoB;IAClF,OAAO,GAAG,KAAK,CAAC,GAAG,mBAAmB,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;AACtE,CAAC;A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C,MAAM,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,GAAG,GAAG,kBAAkB,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7G,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IACrF,CAAC;IAEkB,KAAK,CAAC,CAAM;QAC7B,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,8BAA8B,EAAE,CAAC;IACvI,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
2
+ /** `agents/<slug>.agent.yaml` from the agent's name. PURE. */
3
+ export declare function defaultDefinitionPath(dir: string, name: string): string;
4
+ interface Out {
5
+ readonly agentId: string;
6
+ readonly file: string;
7
+ readonly version: number;
8
+ readonly written: boolean;
9
+ }
10
+ /**
11
+ * T3.1.3 - `revition agents pull <id> [-o file] [--force]`: the agent's current draft as a definition file (references
12
+ * only; the server never returns a secret value). An existing file that was edited since the last pull is not
13
+ * overwritten without --force.
14
+ */
15
+ export default class AgentsPull extends RevitionCommand<Out> {
16
+ static summary: string;
17
+ static examples: string[];
18
+ static meta: CommandMeta;
19
+ static args: {
20
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
21
+ };
22
+ static flags: {
23
+ output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
+ };
26
+ protected run2(ctx: CommandContext): Promise<Out>;
27
+ protected human(o: Out): HumanView;
28
+ }
29
+ export {};
@@ -0,0 +1,69 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join, resolve } from 'node:path';
3
+ import { Args, Flags } from '@oclif/core';
4
+ import { atomicWriteFile, EXIT, RevitionCliError, RevitionCommand } from '@revition/cli-core';
5
+ import { DEFINITION_SUFFIX, definitionFromDraft, definitionText, parseDefinitionText } from '../../format.js';
6
+ import { agentsApi, bodyHash, getDraft, projectDir, readPullRecord, seg, writePullRecord } from './list.js';
7
+ /** `agents/<slug>.agent.yaml` from the agent's name. PURE. */
8
+ export function defaultDefinitionPath(dir, name) {
9
+ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'agent';
10
+ return join(dir, 'agents', `${slug}${DEFINITION_SUFFIX}`);
11
+ }
12
+ /**
13
+ * T3.1.3 - `revition agents pull <id> [-o file] [--force]`: the agent's current draft as a definition file (references
14
+ * only; the server never returns a secret value). An existing file that was edited since the last pull is not
15
+ * overwritten without --force.
16
+ */
17
+ export default class AgentsPull extends RevitionCommand {
18
+ static summary = "Write an agent's draft to a definition file (keeps your local edits unless --force).";
19
+ static examples = ['revition agents pull dep_123', 'revition agents pull dep_123 -o agents/support.agent.yaml --force'];
20
+ static meta = {
21
+ id: 'agents:pull',
22
+ summary: AgentsPull.summary,
23
+ examples: AgentsPull.examples,
24
+ requiredScopes: ['cli:agents'],
25
+ mutates: false,
26
+ confirm: 'none',
27
+ jsonSchemaId: 'revition.agents.pull.v1',
28
+ stability: 'beta',
29
+ };
30
+ static args = { id: Args.string({ required: true, description: 'The agent (deployment id).' }) };
31
+ static flags = {
32
+ output: Flags.string({ char: 'o', description: 'The file to write (default: agents/<name>.agent.yaml).' }),
33
+ force: Flags.boolean({ description: 'Overwrite a file that has local edits.' }),
34
+ };
35
+ async run2(ctx) {
36
+ const id = String(ctx.args['id']);
37
+ const dir = projectDir();
38
+ const api = await agentsApi(ctx);
39
+ const agent = (await api.request({ method: 'GET', path: `/deployments/${seg(id)}` })).body;
40
+ const draft = await getDraft(api, id);
41
+ const def = definitionFromDraft({ id, name: agent.name }, draft);
42
+ const out = typeof ctx.commandFlags['output'] === 'string' ? resolve(dir, ctx.commandFlags['output']) : defaultDefinitionPath(dir, agent.name);
43
+ if (existsSync(out) && ctx.commandFlags['force'] !== true && locallyEdited(out, dir, id, def)) {
44
+ throw new RevitionCliError({ code: 'LOCAL_CHANGES', message: `${out} has changes since the last pull; not overwritten.`, hint: 'Push them first (`revition agents push`), or re-run with --force to discard them.' }, EXIT.conflict);
45
+ }
46
+ await atomicWriteFile(out, definitionText(def));
47
+ await writePullRecord(dir, { agentId: id, version: draft.version, bodyHash: bodyHash(def.config) });
48
+ return { agentId: id, file: out, version: draft.version, written: true };
49
+ }
50
+ human(o) {
51
+ return { text: `Pulled ${o.agentId} (draft version ${o.version}) to ${o.file}.\n` };
52
+ }
53
+ }
54
+ /** The file differs from what was last pulled (and from the remote draft): it holds edits a pull would lose. */
55
+ function locallyEdited(file, dir, id, remote) {
56
+ let local;
57
+ try {
58
+ local = parseDefinitionText(readFileSync(file, 'utf8'));
59
+ }
60
+ catch {
61
+ return true;
62
+ }
63
+ const localHash = bodyHash(local.config ?? { config: {}, sections: {} });
64
+ if (localHash === bodyHash(remote.config))
65
+ return false;
66
+ const record = readPullRecord(dir, id);
67
+ return record === null || record.bodyHash !== localHash;
68
+ }
69
+ //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oB,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACzE,IAAI,SAAS,KAAK,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IACxD,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACvC,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
2
+ export interface DraftDiff {
3
+ readonly changedSections: readonly string[];
4
+ readonly added: readonly string[];
5
+ readonly removed: readonly string[];
6
+ readonly hasUnsavedChanges?: boolean;
7
+ }
8
+ interface Out {
9
+ readonly agentId: string;
10
+ readonly saved: boolean;
11
+ readonly version: number;
12
+ /** The draft against the live agent, after the save (GET .../draft/diff). */
13
+ readonly vsLive: DraftDiff | null;
14
+ }
15
+ /**
16
+ * T3.1.3 - `revition agents push <file>`: validate, then save the DRAFT (PUT .../draft) with the version the file was
17
+ * pulled at (`baseVersion`): a draft changed since then is refused (409 AGENT_DRAFT_CONFLICT, exit 6) and nothing is
18
+ * overwritten. A file equal to the draft is "no changes" and nothing is sent. The live agent never changes here: going
19
+ * live is a human step in the portal (D9).
20
+ */
21
+ export default class AgentsPush extends RevitionCommand<Out> {
22
+ static summary: string;
23
+ static examples: string[];
24
+ static meta: CommandMeta;
25
+ static args: {
26
+ file: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
27
+ };
28
+ protected run2(ctx: CommandContext): Promise<Out>;
29
+ protected human(o: Out): HumanView;
30
+ }
31
+ export {};
@@ -0,0 +1,63 @@
1
+ import { resolve } from 'node:path';
2
+ import { Args } from '@oclif/core';
3
+ import { EXIT, RevitionCliError, RevitionCommand, usageError } from '@revition/cli-core';
4
+ import { draftBody } from '../../format.js';
5
+ import { agentsApi, bodyHash, getDraft, projectDir, readDefinition, readPullRecord, seg, writePullRecord } from './list.js';
6
+ /**
7
+ * T3.1.3 - `revition agents push <file>`: validate, then save the DRAFT (PUT .../draft) with the version the file was
8
+ * pulled at (`baseVersion`): a draft changed since then is refused (409 AGENT_DRAFT_CONFLICT, exit 6) and nothing is
9
+ * overwritten. A file equal to the draft is "no changes" and nothing is sent. The live agent never changes here: going
10
+ * live is a human step in the portal (D9).
11
+ */
12
+ export default class AgentsPush extends RevitionCommand {
13
+ static summary = "Save a definition file to the agent's draft (never live; publishing is done in the portal).";
14
+ static examples = ['revition agents push agents/support.agent.yaml', 'revition agents push agents/support.agent.yaml --yes --json'];
15
+ static meta = {
16
+ id: 'agents:push',
17
+ summary: AgentsPush.summary,
18
+ examples: AgentsPush.examples,
19
+ requiredScopes: ['cli:agents'],
20
+ mutates: true,
21
+ confirm: 'prompt',
22
+ jsonSchemaId: 'revition.agents.push.v1',
23
+ stability: 'beta',
24
+ };
25
+ static args = { file: Args.string({ required: true, description: 'The definition file.' }) };
26
+ async run2(ctx) {
27
+ const dir = projectDir();
28
+ const { definition, warnings } = readDefinition(resolve(dir, String(ctx.args['file'])));
29
+ for (const w of warnings)
30
+ ctx.warn(`${w.path}: ${w.message}`);
31
+ const id = definition.agent.id;
32
+ if (id === null)
33
+ throw usageError('NO_AGENT_ID', 'This file names no agent yet (agent.id is null).', 'Create the agent with `revition agents create <file>`.');
34
+ const api = await agentsApi(ctx);
35
+ const current = await getDraft(api, id);
36
+ const record = readPullRecord(dir, id);
37
+ if (bodyHash(definition.config) === bodyHash({ config: current.config, sections: current.sections })) {
38
+ return { agentId: id, saved: false, version: current.version, vsLive: null };
39
+ }
40
+ let version;
41
+ try {
42
+ const res = await api.request({ method: 'PUT', path: `/deployments/${seg(id)}/draft`, body: draftBody(definition, record?.version ?? current.version) });
43
+ version = res.body.draft.version;
44
+ }
45
+ catch (e) {
46
+ if (e instanceof RevitionCliError && e.error.code === 'AGENT_DRAFT_CONFLICT') {
47
+ throw new RevitionCliError({ ...e.error, message: 'The draft was changed by someone else since you pulled it; nothing was overwritten.', hint: `Run \`revition agents pull ${id} --force\` into a copy, re-apply your change, then push again.` }, EXIT.conflict);
48
+ }
49
+ throw e;
50
+ }
51
+ await writePullRecord(dir, { agentId: id, version, bodyHash: bodyHash(definition.config) });
52
+ const vsLive = (await api.request({ method: 'GET', path: `/deployments/${seg(id)}/draft/diff` })).body;
53
+ return { agentId: id, saved: true, version, vsLive };
54
+ }
55
+ human(o) {
56
+ if (!o.saved)
57
+ return { text: `No changes: ${o.agentId}'s draft already matches the file.\n` };
58
+ const d = o.vsLive;
59
+ const changes = d === null ? '' : `Draft vs live: ${[...d.changedSections].join(', ') || 'no difference'}.\n`;
60
+ return { text: `Saved the draft of ${o.agentId} (version ${o.version}).\n${changes}Go live in the portal: revition agents open ${o.agentId} --action publish\n` };
61
+ }
62
+ }
63
+ //# sourceMappingURL=push.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.js","sourceRoot":"","sources":["../../../src/commands/agents/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAyD,MAAM,oBAAoB,CAAC;AAEhJ,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAiB5H;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SA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5F,MAAM,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,CAAY,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,GAAG,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAClH,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACvD,CAAC;IAEkB,KAAK,CAAC,CAAM;QAC7B,IAAI,CAAC,CAAC,CAAC,KAAK;YAAE,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,OAAO,sCAAsC,EAAE,CAAC;QAC9F,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;QACnB,MAAM,OAAO,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe,KAAK,CAAC;QAC9G,OAAO,EAAE,IAAI,EAAE,sBAAsB,CAAC,CAAC,OAAO,aAAa,CAAC,CAAC,OAAO,OAAO,OAAO,+CAA+C,CAAC,CAAC,OAAO,qBAAqB,EAAE,CAAC;IACpK,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { RevitionCommand, type ApiClient, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
2
+ /** One run as GET /deployments/{id}/runs lists it (foundry work/observability-port AgentRunObservation). */
3
+ export interface AgentRun {
4
+ readonly runId: string;
5
+ readonly workTitle: string;
6
+ readonly status: string;
7
+ readonly inFlight: boolean;
8
+ readonly startedMs: number;
9
+ readonly endedMs?: number;
10
+ readonly traceRef: string | null;
11
+ readonly costUsd: number | null;
12
+ readonly costNote: string;
13
+ }
14
+ /** Every page, following the server's cursor to the end (at most `maxPages`). */
15
+ export declare function allPages<T>(fetchPage: (cursor: string | null) => Promise<{
16
+ readonly items: readonly T[];
17
+ readonly nextCursor: string | null;
18
+ }>, maxPages?: number): Promise<T[]>;
19
+ export declare const scopeFlags: {
20
+ scope: import("@oclif/core/interfaces").OptionFlag<"all" | "project" | "goal" | "task" | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'scope-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ };
23
+ export declare function scopeQuery(f: Readonly<Record<string, unknown>>): Record<string, string>;
24
+ export declare function listAgentRuns(api: ApiClient, id: string, query: Record<string, string | number>): Promise<AgentRun[]>;
25
+ interface Out {
26
+ readonly agentId: string;
27
+ readonly runs: readonly AgentRun[];
28
+ }
29
+ /** T3.1.5 - `revition agents runs <id>`: the agent's runs for a scope and range, every page. Read only. */
30
+ export default class AgentsRuns extends RevitionCommand<Out> {
31
+ static summary: string;
32
+ static examples: string[];
33
+ static meta: CommandMeta;
34
+ static args: {
35
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
36
+ };
37
+ static flags: {
38
+ from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
+ to: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
41
+ scope: import("@oclif/core/interfaces").OptionFlag<"all" | "project" | "goal" | "task" | undefined, import("@oclif/core/interfaces").CustomOptions>;
42
+ 'scope-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
43
+ };
44
+ protected run2(ctx: CommandContext): Promise<Out>;
45
+ protected human(o: Out): HumanView;
46
+ }
47
+ export {};
@@ -0,0 +1,70 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { RevitionCommand, renderTable, terminalTable } from '@revition/cli-core';
3
+ import { agentsApi, seg } from './list.js';
4
+ /** Every page, following the server's cursor to the end (at most `maxPages`). */
5
+ export async function allPages(fetchPage, maxPages = 200) {
6
+ const out = [];
7
+ let cursor = null;
8
+ for (let i = 0; i < maxPages; i++) {
9
+ const page = await fetchPage(cursor);
10
+ out.push(...page.items);
11
+ if (page.nextCursor === null || page.nextCursor === '')
12
+ break;
13
+ cursor = page.nextCursor;
14
+ }
15
+ return out;
16
+ }
17
+ export const scopeFlags = {
18
+ scope: Flags.option({ options: ['all', 'project', 'goal', 'task'], description: 'all (default), or project / goal / task with --scope-id.' })(),
19
+ 'scope-id': Flags.string({ description: 'With --scope project / goal / task: its id.' }),
20
+ };
21
+ export function scopeQuery(f) {
22
+ const scope = typeof f['scope'] === 'string' ? f['scope'] : 'all';
23
+ return { scope, ...(typeof f['scope-id'] === 'string' ? { scopeId: f['scope-id'] } : {}) };
24
+ }
25
+ export async function listAgentRuns(api, id, query) {
26
+ return allPages((cursor) => api
27
+ .request({ method: 'GET', path: `/deployments/${seg(id)}/runs`, query: { ...query, ...(cursor === null ? {} : { cursor }) } })
28
+ .then((r) => r.body));
29
+ }
30
+ /** T3.1.5 - `revition agents runs <id>`: the agent's runs for a scope and range, every page. Read only. */
31
+ export default class AgentsRuns extends RevitionCommand {
32
+ static summary = "An agent's runs (scope and time range), with their billed cost.";
33
+ static examples = ['revition agents runs dep_123', 'revition agents runs dep_123 --scope goal --scope-id goal_1 --from 2026-11-01T00:00:00Z --json'];
34
+ static meta = {
35
+ id: 'agents:runs',
36
+ summary: AgentsRuns.summary,
37
+ examples: AgentsRuns.examples,
38
+ requiredScopes: ['cli:agents'],
39
+ mutates: false,
40
+ confirm: 'none',
41
+ jsonSchemaId: 'revition.agents.runs.v1',
42
+ stability: 'beta',
43
+ };
44
+ static args = { id: Args.string({ required: true, description: 'The agent (deployment id).' }) };
45
+ static flags = {
46
+ ...scopeFlags,
47
+ from: Flags.string({ description: 'Runs started at or after this time (ISO 8601).' }),
48
+ to: Flags.string({ description: 'Runs started before this time (ISO 8601).' }),
49
+ limit: Flags.integer({ description: 'Page size the server returns (it pages to the end).', min: 1, max: 100 }),
50
+ };
51
+ async run2(ctx) {
52
+ const f = ctx.commandFlags;
53
+ const id = String(ctx.args['id']);
54
+ const query = {
55
+ ...scopeQuery(f),
56
+ ...(typeof f['from'] === 'string' ? { from: f['from'] } : {}),
57
+ ...(typeof f['to'] === 'string' ? { to: f['to'] } : {}),
58
+ ...(typeof f['limit'] === 'number' ? { limit: f['limit'] } : {}),
59
+ };
60
+ return { agentId: id, runs: await listAgentRuns(await agentsApi(ctx), id, query) };
61
+ }
62
+ human(o) {
63
+ if (o.runs.length === 0)
64
+ return { text: `No runs of ${o.agentId} in this scope and range.\n` };
65
+ return {
66
+ text: renderTable(['run', 'work', 'status', 'started', 'cost'], o.runs.map((r) => [r.runId, r.workTitle, r.inFlight ? `${r.status} (running)` : r.status, new Date(r.startedMs).toISOString(), r.costUsd === null ? r.costNote : `$${r.costUsd.toFixed(4)}`]), terminalTable()),
67
+ };
68
+ }
69
+ }
70
+ //# sourceMappingURL=runs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.js","sourceRoot":"","sources":["../../../src/commands/agents/runs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAyE,MAAM,oBAAoB,CAAC;AAExJ,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAe3C,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,SAAmH,EACnH,QAAQ,GAAG,GAAG;IAEd,MAAM,GAAG,GAAQ,EAAE,CAAC;IACpB,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC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M,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC7L,aAAa,EAAE,CAChB;SACF,CAAC;IACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { RevitionCommand, type CommandContext, type CommandMeta, type HumanView } from '@revition/cli-core';
2
+ import { type EnvView } from './environments/list.js';
3
+ import type { DraftDiff } from './push.js';
4
+ import { type RunState, type TestsReport } from './test.js';
5
+ interface Out {
6
+ readonly agentId: string;
7
+ readonly draftVsLive: DraftDiff;
8
+ readonly tests: {
9
+ readonly report: TestsReport | null;
10
+ readonly run: RunState | null;
11
+ };
12
+ readonly environments: readonly EnvView[];
13
+ }
14
+ /**
15
+ * T3.1.4 - `revition agents status <id>`: the draft against live, the latest Tests report and the environments with any
16
+ * pending approval, each as the platform reports it. Go-live readiness is the Verification gate's decision when a
17
+ * person publishes in the portal (no readiness route exists, none is invented).
18
+ */
19
+ export default class AgentsStatus extends RevitionCommand<Out> {
20
+ static summary: string;
21
+ static examples: string[];
22
+ static meta: CommandMeta;
23
+ static args: {
24
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
25
+ };
26
+ protected run2(ctx: CommandContext): Promise<Out>;
27
+ protected human(o: Out): HumanView;
28
+ }
29
+ export {};
@@ -0,0 +1,47 @@
1
+ import { Args } from '@oclif/core';
2
+ import { RevitionCommand } from '@revition/cli-core';
3
+ import { envLines, environmentsOf } from './environments/list.js';
4
+ import { agentsApi, seg } from './list.js';
5
+ import { latestReport, reportLines } from './test.js';
6
+ /**
7
+ * T3.1.4 - `revition agents status <id>`: the draft against live, the latest Tests report and the environments with any
8
+ * pending approval, each as the platform reports it. Go-live readiness is the Verification gate's decision when a
9
+ * person publishes in the portal (no readiness route exists, none is invented).
10
+ */
11
+ export default class AgentsStatus extends RevitionCommand {
12
+ static summary = "An agent's draft vs live, its latest Tests report and its environments.";
13
+ static examples = ['revition agents status dep_123', 'revition agents status dep_123 --json'];
14
+ static meta = {
15
+ id: 'agents:status',
16
+ summary: AgentsStatus.summary,
17
+ examples: AgentsStatus.examples,
18
+ requiredScopes: ['cli:agents'],
19
+ mutates: false,
20
+ confirm: 'none',
21
+ jsonSchemaId: 'revition.agents.status.v1',
22
+ stability: 'beta',
23
+ };
24
+ static args = { id: Args.string({ required: true, description: 'The agent (deployment id).' }) };
25
+ async run2(ctx) {
26
+ const id = String(ctx.args['id']);
27
+ const api = await agentsApi(ctx);
28
+ const [draftVsLive, tests, envs] = await Promise.all([
29
+ api.request({ method: 'GET', path: `/deployments/${seg(id)}/draft/diff` }).then((r) => r.body),
30
+ latestReport(api, id),
31
+ environmentsOf(api, id),
32
+ ]);
33
+ return { agentId: id, draftVsLive, tests, environments: envs.environments };
34
+ }
35
+ human(o) {
36
+ const run = o.tests.run;
37
+ const lines = [
38
+ `${o.agentId}: draft vs live: ${o.draftVsLive.changedSections.join(', ') || 'no difference'}`,
39
+ ...(run === null ? [] : [`tests: ${run.status} (${run.done} of ${run.total})${run.reason === undefined ? '' : `: ${run.reason}`}`]),
40
+ ...(o.tests.report === null ? ['tests: no report yet (revition agents test)'] : reportLines(o.tests.report)),
41
+ ...envLines(o.environments),
42
+ `Go live or promote in the portal: revition agents open ${o.agentId} --action publish`,
43
+ ];
44
+ return { text: `${lines.join('\n')}\n` };
45
+ }
46
+ }
47
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/agents/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,eAAe,EAAyD,MAAM,oBAA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2
+ /** T3.1.3 - the templates an agent can be created from (GET /agent-templates; `blank` is one of them). Read only. */
3
+ interface Template {
4
+ readonly appId?: string;
5
+ readonly templateAppId?: string;
6
+ readonly name?: string;
7
+ readonly title?: string;
8
+ readonly useCase?: string;
9
+ }
10
+ interface Out {
11
+ readonly templates: readonly Template[];
12
+ }
13
+ export default class AgentsTemplates extends RevitionCommand<Out> {
14
+ static summary: string;
15
+ static examples: string[];
16
+ static meta: CommandMeta;
17
+ protected run2(ctx: CommandContext): Promise<Out>;
18
+ protected human(o: Out): HumanView;
19
+ }
20
+ export {};
@@ -0,0 +1,26 @@
1
+ import { RevitionCommand, renderTable, terminalTable } from '@revition/cli-core';
2
+ import { agentsApi } from './list.js';
3
+ export default class AgentsTemplates extends RevitionCommand {
4
+ static summary = 'The agent templates `agents create --template` can start from.';
5
+ static examples = ['revition agents templates', 'revition agents templates --json'];
6
+ static meta = {
7
+ id: 'agents:templates',
8
+ summary: AgentsTemplates.summary,
9
+ examples: AgentsTemplates.examples,
10
+ requiredScopes: ['cli:agents'],
11
+ mutates: false,
12
+ confirm: 'none',
13
+ jsonSchemaId: 'revition.agents.templates.v1',
14
+ stability: 'beta',
15
+ };
16
+ async run2(ctx) {
17
+ const api = await agentsApi(ctx);
18
+ return { templates: (await api.request({ method: 'GET', path: '/agent-templates' })).body.templates };
19
+ }
20
+ human(o) {
21
+ return {
22
+ text: renderTable(['template', 'name', 'use case'], o.templates.map((t) => [t.templateAppId ?? t.appId ?? '-', t.name ?? t.title ?? '-', t.useCase ?? '-']), terminalTable()),
23
+ };
24
+ }
25
+ }
26
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/commands/agents/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAyD,MAAM,oBAAoB,CAAC;AAExI,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAetC,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 - `revition agents test <id>`: the draft's own Tests. The quote first (paid draft runs, free cases); a run
4
+ * with paid calls needs confirmation (or --yes) and is sent with its quoteId (the server refuses it otherwise); a long
5
+ * suite runs in the background and is followed to its report. The report is the portal's (GET .../tests/report).
6
+ */
7
+ export interface TestsQuote {
8
+ readonly quoteId: string;
9
+ readonly draftVersion: number;
10
+ readonly modelCalls: number;
11
+ readonly verificationCalls?: number;
12
+ readonly freeCases: number;
13
+ readonly available: boolean;
14
+ readonly billedEstimateUsd?: number | null;
15
+ }
16
+ export interface TestResult {
17
+ readonly caseId: string;
18
+ readonly type: string;
19
+ readonly status: string;
20
+ readonly passed: boolean;
21
+ readonly detail?: string;
22
+ readonly regressionOf?: string;
23
+ }
24
+ export interface TestsReport {
25
+ readonly draftVersion: number;
26
+ readonly results: readonly TestResult[];
27
+ readonly regressionCount: number;
28
+ readonly allPassed: boolean;
29
+ }
30
+ export interface RunState {
31
+ readonly status: 'running' | 'finished' | 'failed' | 'refused';
32
+ readonly done: number;
33
+ readonly total: number;
34
+ readonly reason?: string;
35
+ }
36
+ /** The report as lines: the tally, each case, the regressions. PURE. */
37
+ export declare function reportLines(r: TestsReport): string[];
38
+ export declare function latestReport(api: ApiClient, id: string): Promise<{
39
+ report: TestsReport | null;
40
+ run: RunState | null;
41
+ }>;
42
+ interface Out {
43
+ readonly agentId: string;
44
+ readonly quote: TestsQuote;
45
+ readonly report: TestsReport;
46
+ }
47
+ export default class AgentsTest extends RevitionCommand<Out> {
48
+ static summary: string;
49
+ static examples: string[];
50
+ static meta: CommandMeta;
51
+ static args: {
52
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
53
+ };
54
+ protected run2(ctx: CommandContext): Promise<Out>;
55
+ private awaitReport;
56
+ protected human(o: Out): HumanView;
57
+ }
58
+ export {};