@astrosheep/keiyaku 4.6.15 → 4.6.16
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/build/plugins/claude/skills/keiyaku/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +13 -8
- package/build/plugins/codex/skills/keiyaku/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +13 -8
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +13 -8
- package/build/skills/keiyaku/SKILL.md +1 -1
- package/build/skills/keiyaku-akuma/SKILL.md +13 -8
- package/build/src/akuma/archetype.js +2 -2
- package/build/src/cli/commands/akuma-grammar.js +18 -14
- package/build/src/cli/commands/akuma.d.ts +2 -1
- package/build/src/cli/commands/akuma.js +24 -25
- package/build/src/cli/commands/contract-help.d.ts +11 -11
- package/build/src/cli/commands/contract-help.js +16 -16
- package/build/src/cli/commands/contract.d.ts +3 -2
- package/build/src/cli/commands/contract.js +45 -65
- package/build/src/cli/commands/debt-grammar.js +8 -15
- package/build/src/cli/commands/debt.d.ts +2 -1
- package/build/src/cli/commands/debt.js +22 -22
- package/build/src/cli/commands/install.d.ts +2 -1
- package/build/src/cli/commands/install.js +4 -3
- package/build/src/cli/commands/whoami.d.ts +46 -0
- package/build/src/cli/commands/whoami.js +127 -0
- package/build/src/cli/main.js +5 -4
- package/build/src/cli/parse.d.ts +7 -1
- package/build/src/cli/parse.js +23 -3
- package/build/src/cli/render/akuma-activity.d.ts +10 -23
- package/build/src/cli/render/akuma-activity.js +178 -212
- package/build/src/cli/render/akuma.d.ts +7 -6
- package/build/src/cli/render/akuma.js +22 -18
- package/build/src/cli/render/catalog.js +4 -3
- package/build/src/cli/render/contract-history.js +5 -16
- package/build/src/cli/render/debt.d.ts +2 -1
- package/build/src/cli/render/debt.js +6 -6
- package/build/src/cli/render/nuke.d.ts +2 -1
- package/build/src/cli/render/nuke.js +4 -2
- package/build/src/cli/render/receipt.js +8 -3
- package/build/src/cli/render/reconcile.js +8 -7
- package/build/src/cli/render/refusal.js +7 -3
- package/build/src/cli/render/terminal.d.ts +5 -2
- package/build/src/cli/render/terminal.js +74 -12
- package/build/src/cli/render/whoami.d.ts +2 -0
- package/build/src/cli/render/whoami.js +56 -0
- package/build/src/cli/runtime.d.ts +2 -1
- package/build/src/cli/runtime.js +59 -58
- package/build/src/cli/streams.d.ts +11 -1
- package/build/src/cli/streams.js +6 -2
- package/build/src/cli/usage.d.ts +1 -0
- package/build/src/cli/usage.js +7 -6
- package/build/src/contract-worktree.js +1 -1
- package/build/src/library/selection.d.ts +1 -0
- package/build/src/library/selection.js +1 -1
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/package.json +1 -1
- package/skills/keiyaku/SKILL.md +1 -1
- package/skills/keiyaku-akuma/SKILL.md +13 -8
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cliExitCode } from "../streams.js";
|
|
1
2
|
import { dirname, resolve } from "node:path";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { CliUsageError, commandGuide, usageLine } from "../usage.js";
|
|
@@ -44,7 +45,7 @@ export function parseInstallCommand(argv) {
|
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
export function renderInstallHelp() {
|
|
47
|
-
return `${INSTALL_ROOT_PURPOSE}\n\n${usageLine(INSTALL_USAGE)}\n\n--all continues past failures; any failure exits
|
|
48
|
+
return `${INSTALL_ROOT_PURPOSE}\n\n${usageLine(INSTALL_USAGE)}\n\n--all continues past failures; any failure exits ${cliExitCode("failed")}.`;
|
|
48
49
|
}
|
|
49
50
|
const INSTALL_TIMEOUT_MS = 5 * 60 * 1000;
|
|
50
51
|
const ASSET_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "../../../plugins");
|
|
@@ -108,6 +109,6 @@ export function renderInstallText(result) {
|
|
|
108
109
|
.map((item) => item.status === "installed" ? `${item.harness} installed` : `${item.harness} failed: ${item.diagnostic}`)
|
|
109
110
|
.join("\n");
|
|
110
111
|
}
|
|
111
|
-
export function
|
|
112
|
-
return result.results.some((item) => item.status === "failed") ?
|
|
112
|
+
export function installOutcome(result) {
|
|
113
|
+
return result.results.some((item) => item.status === "failed") ? "failed" : "accepted";
|
|
113
114
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CliOutcome } from "../streams.js";
|
|
2
|
+
import { type AkumaCaller, type AkumaStatus, type ContractId } from "../../index.js";
|
|
3
|
+
import { type WorldRoot } from "../../world.js";
|
|
4
|
+
import type { CliCoordinates } from "../coordinates.js";
|
|
5
|
+
import type { ParsedWhoamiCommand } from "../parse.js";
|
|
6
|
+
type Self = AkumaCaller | Readonly<{
|
|
7
|
+
kind: "none";
|
|
8
|
+
}> | Readonly<{
|
|
9
|
+
kind: "invalid";
|
|
10
|
+
reason: string;
|
|
11
|
+
}>;
|
|
12
|
+
type Contract = Readonly<{
|
|
13
|
+
kind: "resolved";
|
|
14
|
+
id: ContractId;
|
|
15
|
+
}> | Readonly<{
|
|
16
|
+
kind: "none" | "ambiguous";
|
|
17
|
+
}> | Readonly<{
|
|
18
|
+
kind: "unavailable";
|
|
19
|
+
reason: string;
|
|
20
|
+
}>;
|
|
21
|
+
type Profile = Readonly<{
|
|
22
|
+
kind: "available";
|
|
23
|
+
archetype: string;
|
|
24
|
+
aliases: readonly string[];
|
|
25
|
+
provider: string | null;
|
|
26
|
+
model: string | null;
|
|
27
|
+
workdir: string | null;
|
|
28
|
+
birth: AkumaStatus["birth"];
|
|
29
|
+
bornAt: string | null;
|
|
30
|
+
allowed: AkumaStatus["allowed"];
|
|
31
|
+
contracts: readonly ContractId[];
|
|
32
|
+
}> | Readonly<{
|
|
33
|
+
kind: "unavailable";
|
|
34
|
+
reason: string;
|
|
35
|
+
}>;
|
|
36
|
+
export type WhoamiFacts = Readonly<{
|
|
37
|
+
world: WorldRoot | null;
|
|
38
|
+
self: Self;
|
|
39
|
+
initiator: string | null;
|
|
40
|
+
initiatorUnavailable?: string;
|
|
41
|
+
requests: "local" | "parent";
|
|
42
|
+
contract: Contract;
|
|
43
|
+
profile?: Profile;
|
|
44
|
+
}>;
|
|
45
|
+
export declare function runWhoami(command: ParsedWhoamiCommand, coordinates: CliCoordinates, environment: NodeJS.ProcessEnv): Promise<CliOutcome>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { AKUMA_REQUESTS_ENTRY_ENV, AKUMA_REQUESTS_ENV } from "../../akuma/providers/execution-environment.js";
|
|
2
|
+
import { AkumaOwner } from "../../akuma/akuma-owner.js";
|
|
3
|
+
import { readHeart, readLatestTurnForBody } from "../../akuma/heart/index.js";
|
|
4
|
+
import { parseAkuId, pathsForAkuId } from "../../akuma/identity.js";
|
|
5
|
+
import { Keiyaku, NoGitWorldError, Repo } from "../../index.js";
|
|
6
|
+
import { observeNamedAddress } from "../../library/address.js";
|
|
7
|
+
import { dispatchAssociations } from "../../library/selection.js";
|
|
8
|
+
import { World } from "../../world.js";
|
|
9
|
+
import { akumaCallerFromEnvironment } from "../akuma-caller.js";
|
|
10
|
+
import { renderWhoami } from "../render/whoami.js";
|
|
11
|
+
import { emit } from "../streams.js";
|
|
12
|
+
function reason(error) {
|
|
13
|
+
return error instanceof Error ? error.message : String(error);
|
|
14
|
+
}
|
|
15
|
+
async function selfFrom(environment) {
|
|
16
|
+
try {
|
|
17
|
+
return (await akumaCallerFromEnvironment(environment)) ?? { kind: "none" };
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return { kind: "invalid", reason: reason(error) };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function contextualContract(coordinates, world) {
|
|
24
|
+
if (world === null || coordinates.repo === undefined)
|
|
25
|
+
return { kind: "none" };
|
|
26
|
+
try {
|
|
27
|
+
const result = await Keiyaku.with().resolve({ repo: coordinates.repo, cwd: coordinates.cwd });
|
|
28
|
+
if (result.kind === "resolved")
|
|
29
|
+
return result;
|
|
30
|
+
return { kind: result.refusal.kind === "ambiguous-selector" ? "ambiguous" : "none" };
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return { kind: "unavailable", reason: reason(error) };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function callerRepo(world, coordinates, environment) {
|
|
37
|
+
if (coordinates.repo?.root === world)
|
|
38
|
+
return coordinates.repo;
|
|
39
|
+
try {
|
|
40
|
+
const repo = await Repo.at({
|
|
41
|
+
path: world,
|
|
42
|
+
...(environment.KEIYAKU_GIT_PATH === undefined ? {} : { gitPath: environment.KEIYAKU_GIT_PATH }),
|
|
43
|
+
});
|
|
44
|
+
return repo.root === world ? repo : undefined;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error instanceof NoGitWorldError)
|
|
48
|
+
return undefined;
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function currentTurn(self) {
|
|
53
|
+
let bornAt = null;
|
|
54
|
+
try {
|
|
55
|
+
const paths = pathsForAkuId(self.world, self.akuId);
|
|
56
|
+
const heart = await readHeart(paths);
|
|
57
|
+
bornAt = heart.soul?.createdAt ?? null;
|
|
58
|
+
const body = heart.latestBody;
|
|
59
|
+
if (body === null || body.end !== undefined || body.hung !== undefined)
|
|
60
|
+
return { initiator: null, bornAt };
|
|
61
|
+
const turn = await readLatestTurnForBody(paths, body.sequence);
|
|
62
|
+
if (turn === null || turn.end !== undefined)
|
|
63
|
+
return { initiator: null, bornAt };
|
|
64
|
+
// Confirm that the Body was still current and open when this Turn was observed.
|
|
65
|
+
const latest = (await readHeart(paths)).latestBody;
|
|
66
|
+
const initiator = latest?.sequence === body.sequence && latest.end === undefined && latest.hung === undefined
|
|
67
|
+
? (turn.initiator ?? null)
|
|
68
|
+
: null;
|
|
69
|
+
return { initiator, bornAt };
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return { initiator: null, bornAt, unavailable: reason(error) };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function callerProfile(caller, coordinates, environment, bornAt) {
|
|
76
|
+
try {
|
|
77
|
+
if (!(await World.established(caller.world)))
|
|
78
|
+
throw new Error("caller World is not established");
|
|
79
|
+
const id = parseAkuId(caller.akuId);
|
|
80
|
+
// This is the same status owner as the public read, without its plugin outcome observer.
|
|
81
|
+
const [status, aliases, repo] = await Promise.all([
|
|
82
|
+
new AkumaOwner(id.id, caller.world).status(),
|
|
83
|
+
observeNamedAddress({ world: caller.world, repo: null }),
|
|
84
|
+
callerRepo(caller.world, coordinates, environment),
|
|
85
|
+
]);
|
|
86
|
+
if (aliases.aliases.kind !== "present") {
|
|
87
|
+
throw new Error(aliases.aliases.kind === "failed" ? aliases.aliases.failure.message : "aliases unavailable");
|
|
88
|
+
}
|
|
89
|
+
const dispatch = (await dispatchAssociations(repo, [id.id])).get(id.id);
|
|
90
|
+
if (dispatch.kind === "failed")
|
|
91
|
+
throw new Error(dispatch.diagnostic);
|
|
92
|
+
return {
|
|
93
|
+
kind: "available",
|
|
94
|
+
archetype: id.archetype,
|
|
95
|
+
aliases: aliases.aliases.value.filter((binding) => binding.akuId === id.id).map((binding) => binding.alias),
|
|
96
|
+
provider: status.provider ?? null,
|
|
97
|
+
model: status.model ?? null,
|
|
98
|
+
workdir: status.cwd ?? null,
|
|
99
|
+
birth: status.birth,
|
|
100
|
+
bornAt,
|
|
101
|
+
allowed: status.allowed,
|
|
102
|
+
contracts: dispatch.kind === "associated" ? [dispatch.contractId] : [],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
return { kind: "unavailable", reason: reason(error) };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export async function runWhoami(command, coordinates, environment) {
|
|
110
|
+
const world = coordinates.world !== null && (await World.established(coordinates.world)) ? coordinates.world : null;
|
|
111
|
+
const [self, contract] = await Promise.all([selfFrom(environment), contextualContract(coordinates, world)]);
|
|
112
|
+
const turn = self.kind === "akuma" ? await currentTurn(self) : undefined;
|
|
113
|
+
const facts = {
|
|
114
|
+
world,
|
|
115
|
+
self,
|
|
116
|
+
initiator: turn?.initiator ?? null,
|
|
117
|
+
...(turn?.unavailable === undefined ? {} : { initiatorUnavailable: turn.unavailable }),
|
|
118
|
+
requests: environment[AKUMA_REQUESTS_ENV] !== undefined || environment[AKUMA_REQUESTS_ENTRY_ENV] !== undefined
|
|
119
|
+
? "parent"
|
|
120
|
+
: "local",
|
|
121
|
+
contract,
|
|
122
|
+
...(self.kind === "akuma"
|
|
123
|
+
? { profile: await callerProfile(self, coordinates, environment, turn?.bornAt ?? null) }
|
|
124
|
+
: {}),
|
|
125
|
+
};
|
|
126
|
+
return emit(command.output, facts, () => renderWhoami(facts), "accepted");
|
|
127
|
+
}
|
package/build/src/cli/main.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CliUsageError, parseArgv, renderHelp } from "./parse.js";
|
|
2
|
+
import { cliExitCode } from "./streams.js";
|
|
2
3
|
import { installedPackageVersion } from "./version.js";
|
|
3
4
|
function handleBrokenPipe(stream) {
|
|
4
5
|
stream.on("error", (error) => {
|
|
5
6
|
if (error.code === "EPIPE")
|
|
6
|
-
process.exit(
|
|
7
|
+
process.exit(cliExitCode("accepted"));
|
|
7
8
|
throw error;
|
|
8
9
|
});
|
|
9
10
|
}
|
|
@@ -16,17 +17,17 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
16
17
|
const columns = process.stdout.isTTY === true && Number.isInteger(process.stdout.columns) ? process.stdout.columns : undefined;
|
|
17
18
|
const help = renderHelp(parsed.help, columns);
|
|
18
19
|
process.stdout.write(help.endsWith("\n") ? help : `${help}\n`);
|
|
19
|
-
return
|
|
20
|
+
return cliExitCode("accepted");
|
|
20
21
|
}
|
|
21
22
|
if ("version" in parsed) {
|
|
22
23
|
process.stdout.write(`${await installedPackageVersion()}\n`);
|
|
23
|
-
return
|
|
24
|
+
return cliExitCode("accepted");
|
|
24
25
|
}
|
|
25
26
|
return await (await import("./runtime.js")).runCliCommand(parsed);
|
|
26
27
|
}
|
|
27
28
|
catch (error) {
|
|
28
29
|
const diagnostic = error instanceof Error ? error.message : String(error);
|
|
29
30
|
process.stderr.write(diagnostic.endsWith("\n") ? diagnostic : `${diagnostic}\n`);
|
|
30
|
-
return error instanceof CliUsageError ?
|
|
31
|
+
return cliExitCode(error instanceof CliUsageError ? "usage" : "failed");
|
|
31
32
|
}
|
|
32
33
|
}
|
package/build/src/cli/parse.d.ts
CHANGED
|
@@ -10,7 +10,11 @@ export type { Command };
|
|
|
10
10
|
export declare function renderRootHelp(columns?: number): string;
|
|
11
11
|
export declare function usageGuideForCommand(command: ParsedCommand): CliUsageGuide;
|
|
12
12
|
export declare function renderHelp(coordinate: CliHelpCoordinate, columns?: number): string;
|
|
13
|
-
export type
|
|
13
|
+
export type ParsedWhoamiCommand = Readonly<{
|
|
14
|
+
command: "whoami";
|
|
15
|
+
output: "text" | "json";
|
|
16
|
+
}>;
|
|
17
|
+
export type ParsedCommand = ParsedContractCommand | ParsedInstallCommand | ParsedAkumaCommand | ParsedDebtCommand | ParsedWhoamiCommand;
|
|
14
18
|
type CliHelpCoordinate = Readonly<{
|
|
15
19
|
kind: "root";
|
|
16
20
|
}> | Readonly<{
|
|
@@ -21,6 +25,8 @@ type CliHelpCoordinate = Readonly<{
|
|
|
21
25
|
action?: DebtAction;
|
|
22
26
|
}> | Readonly<{
|
|
23
27
|
kind: "install";
|
|
28
|
+
}> | Readonly<{
|
|
29
|
+
kind: "whoami";
|
|
24
30
|
}> | Readonly<{
|
|
25
31
|
kind: "akuma";
|
|
26
32
|
action: AkumaAction;
|
package/build/src/cli/parse.js
CHANGED
|
@@ -5,13 +5,15 @@ import { parseContractCommand, } from "./commands/contract-grammar.js";
|
|
|
5
5
|
import { CONTRACT_COMMAND_SPECS, renderContractHelp as renderContractHelpForOwner, } from "./commands/contract-help.js";
|
|
6
6
|
import { renderOpaqueBlock, renderTextBlock } from "./render/terminal.js";
|
|
7
7
|
import { scanArgs } from "./scan.js";
|
|
8
|
-
import { CliUsageError, commandGuide, isBlankInput, ROOT_USAGE_GUIDE, unknownCommandGuide, } from "./usage.js";
|
|
8
|
+
import { CliUsageError, commandGuide, isBlankInput, ROOT_USAGE_GUIDE, unknownCommandGuide, usageLine, } from "./usage.js";
|
|
9
9
|
export { CliUsageError } from "./usage.js";
|
|
10
10
|
const ROOT_USAGE = [
|
|
11
11
|
"usage keiyaku <command> [options]",
|
|
12
12
|
" keiyaku <command> --help shows that command's complete usage",
|
|
13
13
|
].join("\n");
|
|
14
14
|
const INVOCATION_PATH_OPTIONS = new Set(["-C", "--cwd", "--repo", "--workdir"]);
|
|
15
|
+
const WHOAMI_USAGE = "whoami [--json]";
|
|
16
|
+
const WHOAMI_PURPOSE = "Observe self, current Turn initiator, and Akuma profile.";
|
|
15
17
|
export function renderRootHelp(columns) {
|
|
16
18
|
return renderHelpText([
|
|
17
19
|
"keiyaku — Contract, Debt, and Akuma control for one repository",
|
|
@@ -32,6 +34,7 @@ export function renderRootHelp(columns) {
|
|
|
32
34
|
"Workspace",
|
|
33
35
|
` ${"install".padEnd(10)} ${INSTALL_ROOT_PURPOSE}`,
|
|
34
36
|
` ${"settings".padEnd(10)} ${CONTRACT_COMMAND_SPECS.settings.purpose}`,
|
|
37
|
+
` ${"whoami".padEnd(10)} ${WHOAMI_PURPOSE}`,
|
|
35
38
|
"",
|
|
36
39
|
"Package",
|
|
37
40
|
" --version Print the running package version.",
|
|
@@ -41,7 +44,7 @@ export function renderRootHelp(columns) {
|
|
|
41
44
|
" --repo <path> Select the Git repository coordinate.",
|
|
42
45
|
" --workdir <path> Set the execution directory for call only.",
|
|
43
46
|
"",
|
|
44
|
-
"Outcomes: exit 0 accepted · 1 refused · 2
|
|
47
|
+
"Outcomes: exit 0 accepted · 1 refused · 2 retryable · 3 failed · 64 usage",
|
|
45
48
|
].join("\n"), columns);
|
|
46
49
|
}
|
|
47
50
|
function renderHelpText(help, columns) {
|
|
@@ -62,6 +65,8 @@ function renderHelpText(help, columns) {
|
|
|
62
65
|
.join("\n");
|
|
63
66
|
}
|
|
64
67
|
export function usageGuideForCommand(command) {
|
|
68
|
+
if (command.command === "whoami")
|
|
69
|
+
return commandGuide("whoami", WHOAMI_USAGE);
|
|
65
70
|
if (command.command === "install")
|
|
66
71
|
return commandGuide("install", INSTALL_USAGE);
|
|
67
72
|
if (command.command === "debt")
|
|
@@ -81,6 +86,8 @@ export function renderHelp(coordinate, columns) {
|
|
|
81
86
|
return renderDebtHelp(coordinate.action);
|
|
82
87
|
case "install":
|
|
83
88
|
return renderInstallHelp();
|
|
89
|
+
case "whoami":
|
|
90
|
+
return `${WHOAMI_PURPOSE}\n\n${usageLine(WHOAMI_USAGE)}\n\nRead-only; an Akuma's current initiator and birth parent are distinct. Absent, invalid, and unavailable facts remain explicit.`;
|
|
84
91
|
case "akuma":
|
|
85
92
|
return renderAkumaHelp(coordinate.action);
|
|
86
93
|
}
|
|
@@ -102,6 +109,7 @@ export function commandRepoPolicy(command) {
|
|
|
102
109
|
case "ls":
|
|
103
110
|
return { use: command.query.kind === "contracts" ? "required" : "none", acceptsExplicit: false };
|
|
104
111
|
case "status":
|
|
112
|
+
case "whoami":
|
|
105
113
|
case "tell":
|
|
106
114
|
case "ask":
|
|
107
115
|
return { use: "optional", acceptsExplicit: false };
|
|
@@ -240,6 +248,8 @@ function helpCoordinate(argv) {
|
|
|
240
248
|
}
|
|
241
249
|
if (root === "install")
|
|
242
250
|
return { kind: "install" };
|
|
251
|
+
if (root === "whoami")
|
|
252
|
+
return { kind: "whoami" };
|
|
243
253
|
if (isAkumaAction(root))
|
|
244
254
|
return { kind: "akuma", action: root };
|
|
245
255
|
if (root !== undefined && Object.hasOwn(CONTRACT_COMMAND_SPECS, root)) {
|
|
@@ -247,6 +257,15 @@ function helpCoordinate(argv) {
|
|
|
247
257
|
}
|
|
248
258
|
return { kind: "root" };
|
|
249
259
|
}
|
|
260
|
+
function parseWhoami(argv) {
|
|
261
|
+
const fail = (message) => {
|
|
262
|
+
throw new CliUsageError(message, commandGuide("whoami", WHOAMI_USAGE));
|
|
263
|
+
};
|
|
264
|
+
const scanned = scanArgs(argv, { subject: "whoami", flags: { json: "boolean" }, stdinRefusal: "whoami reads no stdin" }, fail);
|
|
265
|
+
if (scanned.positionals.length > 0)
|
|
266
|
+
fail("whoami accepts no arguments");
|
|
267
|
+
return { command: "whoami", output: scanned.flags.json === true ? "json" : "text" };
|
|
268
|
+
}
|
|
250
269
|
export function parseArgv(argv) {
|
|
251
270
|
const invocation = invocationOptions(argv);
|
|
252
271
|
const help = helpCoordinate(invocation.commandArgv);
|
|
@@ -259,10 +278,11 @@ export function parseArgv(argv) {
|
|
|
259
278
|
return { help: { kind: "debt" } };
|
|
260
279
|
if (invocation.commandArgv.length === 1 && invocation.commandArgv[0] === "--version")
|
|
261
280
|
return { version: true };
|
|
281
|
+
const whoami = invocation.commandArgv[0] === "whoami" ? parseWhoami(invocation.commandArgv) : undefined;
|
|
262
282
|
const debt = invocation.commandArgv[0] === "debt" ? parseDebtCommand(invocation.commandArgv.slice(1)) : undefined;
|
|
263
283
|
const install = invocation.commandArgv[0] === "install" ? parseInstallCommand(invocation.commandArgv.slice(1)) : undefined;
|
|
264
284
|
const akuma = isAkumaAction(invocation.commandArgv[0]) ? parseAkumaCommand(invocation.commandArgv) : undefined;
|
|
265
|
-
const command = debt ?? akuma ?? install ?? parseContractCommand(scanArgv(invocation.commandArgv));
|
|
285
|
+
const command = whoami ?? debt ?? akuma ?? install ?? parseContractCommand(scanArgv(invocation.commandArgv));
|
|
266
286
|
if (invocation.workdir !== undefined && command.command !== "call") {
|
|
267
287
|
throw new CliUsageError(`option --workdir is not valid for ${command.command}`, usageGuideForCommand(command));
|
|
268
288
|
}
|
|
@@ -37,20 +37,6 @@ export declare function actionReceipt(input: Readonly<{
|
|
|
37
37
|
alias?: string;
|
|
38
38
|
evidence?: readonly string[];
|
|
39
39
|
}>): readonly string[];
|
|
40
|
-
/**
|
|
41
|
-
* The one place row prefixes live: time, mark, verb, content.
|
|
42
|
-
*/
|
|
43
|
-
type RowLayout = Readonly<{
|
|
44
|
-
head: (time: string | undefined, glyph: string, verb: string, columns: number) => string;
|
|
45
|
-
continuation: (verb: string) => string;
|
|
46
|
-
marker: (count: number) => string;
|
|
47
|
-
history?: true;
|
|
48
|
-
compactRun?: true;
|
|
49
|
-
/** A one-row receipt keeps that row on one line; speech can use its two-line budget. */
|
|
50
|
-
singleLine?: true;
|
|
51
|
-
/** World-board answer previews keep the conclusion at the tail. */
|
|
52
|
-
tailAnswer?: true;
|
|
53
|
-
}>;
|
|
54
40
|
/**
|
|
55
41
|
* Shared snapshot activity rendering. Full snapshots render the selected
|
|
56
42
|
* activity evidence; an idle snapshot is settled evidence. `latest` preserves
|
|
@@ -75,7 +61,7 @@ export type ActivityStream = ((activity: RenderedActivity) => readonly string[])
|
|
|
75
61
|
* tools until the next checkpoint fold into one omission marker. Failed tools
|
|
76
62
|
* always print.
|
|
77
63
|
*/
|
|
78
|
-
export declare function activityStream(context: TextRenderContext
|
|
64
|
+
export declare function activityStream(context: TextRenderContext): ActivityStream;
|
|
79
65
|
export declare function inputWaitConclusion(observation: AkumaAskObservation, input: Readonly<{
|
|
80
66
|
startedAt: number;
|
|
81
67
|
completedAt?: string | null;
|
|
@@ -158,23 +144,24 @@ export declare function askRawAnswer(result: AkumaAskResult, structured: boolean
|
|
|
158
144
|
export declare function callRawAnswer(result: CallResult, streamed: boolean): string | undefined;
|
|
159
145
|
export declare function historyRawAnswer(result: AkumaHistoryResult, historyId: string | undefined): string | undefined;
|
|
160
146
|
/**
|
|
161
|
-
* One wait's final text:
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* snapshot's own outcome row.
|
|
147
|
+
* One wait's final text: one compact line per observed member, then one failure line per member
|
|
148
|
+
* the wait could not read. A wait opens no frame and extracts no separate answer, so an answer is
|
|
149
|
+
* visible only as the snapshot's own bounded summary.
|
|
165
150
|
*/
|
|
166
151
|
export declare function waitText(result: AkumaWaitResult, presentation: AkumaPresentation, context: TextRenderContext): string;
|
|
167
152
|
export declare function historyText(result: AkumaHistoryResult, presentation: AkumaPresentation & Readonly<{
|
|
168
153
|
id?: string;
|
|
169
154
|
last?: boolean;
|
|
170
155
|
}>, context: TextRenderContext): string;
|
|
171
|
-
/** One bounded preview of a
|
|
156
|
+
/** One bounded, quoted preview of a Tell an outer receipt already admitted, indented beneath it. */
|
|
172
157
|
export declare function tellPayloadLines(text: string, context: TextRenderContext): readonly string[];
|
|
173
|
-
/** One admitted Tell as a timeline row inside a shared
|
|
158
|
+
/** One admitted Tell as a timeline input row inside a shared panel; the panel owns the identity. */
|
|
174
159
|
export declare function tellAdmissionRow(tell: AkumaTellResult["tell"], context: TextRenderContext): string;
|
|
175
160
|
/**
|
|
176
|
-
* One Tell action receipt: the delivery verdict and complete subject
|
|
177
|
-
*
|
|
161
|
+
* One Tell action receipt: the delivery verdict and complete subject stand whole on the first line
|
|
162
|
+
* with the submitted payload folded onto that same line, bounded so only its preview truncates. A
|
|
163
|
+
* held Tell keeps neutral vocabulary; a failed delivery keeps its concrete diagnosis and native log
|
|
164
|
+
* coordinates as separate supporting facts.
|
|
178
165
|
*/
|
|
179
166
|
export declare function tellText(result: AkumaTellResult, alias: string | undefined, context: TextRenderContext): string;
|
|
180
167
|
export {};
|