@astrosheep/keiyaku 2.9.2 → 2.9.4
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/.tsbuildinfo +1 -1
- package/build/agents/call-terms.js +13 -94
- package/build/agents/harness/activity-values.js +16 -0
- package/build/agents/harness/event-persistence.js +218 -0
- package/build/agents/harness/execution-handle.js +25 -222
- package/build/agents/harness/index.js +3 -1
- package/build/agents/harness/outcome.js +47 -4
- package/build/agents/harness/projection.js +42 -59
- package/build/agents/harness/provider-adapter.js +58 -0
- package/build/agents/harness/router.js +11 -187
- package/build/agents/harness/runtime.js +17 -4
- package/build/agents/harness/session.js +15 -0
- package/build/agents/launch-snapshot/model.js +15 -236
- package/build/agents/launch-snapshot/parse-helpers.js +114 -0
- package/build/agents/launch-snapshot/resolve.js +17 -43
- package/build/agents/opencode-sdk.js +45 -12
- package/build/agents/providers/claude-agent-sdk/adapter.js +6 -17
- package/build/agents/providers/claude-agent-sdk/registration.js +214 -0
- package/build/agents/providers/claude-agent-sdk/session-schema.js +2 -0
- package/build/agents/providers/codex-app-server/adapter.js +50 -53
- package/build/agents/providers/codex-app-server/events.js +67 -11
- package/build/agents/providers/codex-app-server/identity.js +1 -0
- package/build/agents/providers/codex-app-server/policy.js +29 -0
- package/build/agents/providers/codex-app-server/registration.js +248 -0
- package/build/agents/providers/codex-app-server/session-schema.js +6 -0
- package/build/agents/providers/codex-app-server/session.js +23 -17
- package/build/agents/providers/codex-app-server/terms.js +1 -0
- package/build/agents/providers/opencode-sdk/adapter.js +94 -50
- package/build/agents/providers/opencode-sdk/events.js +8 -4
- package/build/agents/providers/opencode-sdk/registration.js +135 -0
- package/build/agents/providers/opencode-sdk/session-schema.js +2 -0
- package/build/agents/providers/opencode-sdk/session.js +21 -14
- package/build/agents/providers/opencode-sdk/terms.js +1 -0
- package/build/agents/providers/pi/adapter.js +36 -30
- package/build/agents/providers/pi/registration.js +145 -0
- package/build/agents/providers/pi/session-schema.js +6 -0
- package/build/agents/providers/pi/terms.js +1 -0
- package/build/agents/providers/registration.js +7 -0
- package/build/agents/providers/registry.js +76 -0
- package/build/agents/selector.js +2 -29
- package/build/agents/types.js +8 -0
- package/build/artifact-directories.js +22 -0
- package/build/cli/commands/akuma/akuma/handler.js +1 -1
- package/build/cli/commands/akuma/view/handler.js +5 -4
- package/build/cli/commands/akuma.js +6 -0
- package/build/cli/commands/contract/amend/handler.js +8 -2
- package/build/cli/commands/contract/arc/handler.js +7 -1
- package/build/cli/commands/contract/bind/handler.js +4 -3
- package/build/cli/commands/contract/bind/meta.js +34 -7
- package/build/cli/commands/contract/forfeit/handler.js +4 -4
- package/build/cli/commands/contract/log/handler.js +3 -3
- package/build/cli/commands/contract/petition/handler.js +4 -6
- package/build/cli/commands/contract/renew/handler.js +20 -6
- package/build/cli/commands/contract/renew/meta.js +5 -4
- package/build/cli/commands/metadata.js +58 -0
- package/build/cli/commands/projection/call/handler.js +6 -5
- package/build/cli/commands/projection/kill/handler.js +16 -32
- package/build/cli/commands/projection/shared.js +28 -0
- package/build/cli/commands/projection/status/handler.js +1 -1
- package/build/cli/commands/projection/tell/handler.js +14 -30
- package/build/cli/commands/projection/wait/handler.js +45 -22
- package/build/cli/commands/projection/wait/meta.js +7 -2
- package/build/cli/commands/registry.js +2 -54
- package/build/cli/commands/shared.js +10 -7
- package/build/cli/commands/skills/install/handler.js +2 -5
- package/build/cli/commands/skills/skills/handler.js +1 -1
- package/build/cli/commands/task/add/handler.js +5 -13
- package/build/cli/commands/task/catalog.js +2 -2
- package/build/cli/commands/task/done/handler.js +4 -8
- package/build/cli/commands/task/drop/handler.js +3 -6
- package/build/cli/commands/task/ls/handler.js +3 -5
- package/build/cli/commands/task/shared.js +14 -4
- package/build/cli/commands/task/{view → show}/handler.js +7 -8
- package/build/cli/commands/task/show/meta.js +8 -0
- package/build/cli/commands/task/start/handler.js +3 -6
- package/build/cli/commands/task/stop/handler.js +4 -8
- package/build/cli/commands/task/task/handler.js +1 -1
- package/build/cli/commands/task/update/handler.js +4 -8
- package/build/cli/completion.js +1 -1
- package/build/cli/flags.js +19 -3
- package/build/cli/help.js +4 -11
- package/build/cli/index.js +57 -83
- package/build/cli/missing-subcommand.js +7 -0
- package/build/cli/parse-flags.js +14 -5
- package/build/cli/parse-metadata.js +3 -3
- package/build/cli/parse-selectors.js +1 -1
- package/build/cli/parse.js +21 -0
- package/build/cli/projection-address.js +7 -12
- package/build/cli/render/address.js +41 -37
- package/build/cli/render/arc.js +24 -12
- package/build/cli/render/call.js +11 -5
- package/build/cli/render/errors.js +36 -1
- package/build/cli/render/format.js +4 -0
- package/build/cli/render/kanshi.js +6 -12
- package/build/cli/render/kill.js +9 -0
- package/build/cli/render/misc.js +55 -12
- package/build/cli/render/petition.js +20 -15
- package/build/cli/render/projection-activity.js +3 -0
- package/build/cli/render/shared.js +60 -21
- package/build/cli/render/skills.js +10 -0
- package/build/cli/render/status.js +37 -14
- package/build/cli/render/success-response.js +77 -0
- package/build/cli/render/task.js +54 -14
- package/build/cli/render/tell.js +5 -0
- package/build/cli/render/terminal-failure.js +58 -0
- package/build/cli/render/types.js +1 -0
- package/build/cli/render/wait.js +38 -36
- package/build/cli/types.js +1 -1
- package/build/config/akuma-loader.js +0 -5
- package/build/config/env-keys.js +1 -1
- package/build/config/provider-policy-ownership.js +3 -32
- package/build/config/settings/disease.js +8 -1
- package/build/config/settings/loader.js +11 -3
- package/build/config/settings/provider-instance-fields.js +51 -0
- package/build/config/settings/schema.js +6 -176
- package/build/core/addressing.js +66 -16
- package/build/core/amend.js +135 -18
- package/build/core/arc.js +19 -67
- package/build/core/bind.js +82 -35
- package/build/core/call/call.js +15 -9
- package/build/core/call/context.js +6 -51
- package/build/core/call/execution.js +21 -22
- package/build/core/call/prompt.js +14 -1
- package/build/core/command-markdown.js +45 -0
- package/build/core/context.js +13 -7
- package/build/core/contract-view.js +20 -3
- package/build/core/draft.js +123 -16
- package/build/core/forfeit.js +5 -2
- package/build/core/hints.js +1 -75
- package/build/core/identifier-slug.js +66 -0
- package/build/core/ids.js +25 -11
- package/build/core/ledger.js +20 -68
- package/build/core/markdown/parser.js +0 -68
- package/build/core/markdown/render.js +68 -0
- package/build/core/markdown/sections.js +2 -1
- package/build/core/outcome-base.js +4 -0
- package/build/core/projection/generation/database.js +2 -38
- package/build/core/projection/generation/model.js +42 -1
- package/build/core/{projection-generation-continuation.js → projection/generation/projection-generation-continuation.js} +3 -3
- package/build/core/{projection-generation-execution.js → projection/generation/projection-generation-execution.js} +19 -49
- package/build/core/{projection-generation-identity.js → projection/generation/projection-generation-identity.js} +2 -2
- package/build/core/{projection-generation-launcher.js → projection/generation/projection-generation-launcher.js} +5 -3
- package/build/core/{projection-generation-process.js → projection/generation/projection-generation-process.js} +2 -1
- package/build/core/{projection-generation-runner.js → projection/generation/projection-generation-runner.js} +18 -3
- package/build/core/projection/generation/store.js +2 -2
- package/build/core/projection/generation/transitions.js +1 -1
- package/build/core/projection/index.js +27 -0
- package/build/core/{projection-activity.js → projection/projection-activity.js} +12 -0
- package/build/core/{projection-alias.js → projection/projection-alias.js} +14 -19
- package/build/core/projection/projection-coordinate.js +61 -0
- package/build/core/{projection-core.js → projection/projection-core.js} +9 -9
- package/build/core/{projection-execution-observer.js → projection/projection-execution-observer.js} +2 -57
- package/build/core/{projection-identity.js → projection/projection-identity.js} +1 -1
- package/build/core/{projection-kill.js → projection/projection-kill.js} +1 -1
- package/build/core/{projection-life-observer.js → projection/projection-life-observer.js} +1 -1
- package/build/core/{projection-mint.js → projection/projection-mint.js} +10 -10
- package/build/core/{projection-status.js → projection/projection-status.js} +98 -25
- package/build/core/projection/projection-terminal-failure.js +104 -0
- package/build/core/projection/projection-wait.js +278 -0
- package/build/core/projection/projection-wake.js +203 -0
- package/build/core/provider-loader-ports.js +4 -0
- package/build/core/ref-log.js +65 -40
- package/build/core/registry.js +63 -10
- package/build/core/renew-session.js +128 -0
- package/build/core/renew.js +426 -99
- package/build/core/scope.js +143 -66
- package/build/core/seal.js +139 -35
- package/build/core/{claim-delivery.js → settlement/claim-delivery.js} +9 -14
- package/build/core/{claim.js → settlement/claim.js} +32 -8
- package/build/core/settlement/index.js +19 -0
- package/build/core/{petition-claim-gates.js → settlement/petition-claim-gates.js} +22 -18
- package/build/core/{petition-forfeit.js → settlement/petition-forfeit.js} +2 -2
- package/build/core/{petition-head-guard.js → settlement/petition-head-guard.js} +2 -2
- package/build/core/settlement/petition-io.js +1 -0
- package/build/core/{petition-preview.js → settlement/petition-preview.js} +1 -1
- package/build/core/{petition.js → settlement/petition.js} +12 -10
- package/build/core/settlement/queue-read-model.js +143 -0
- package/build/core/settlement/queue-seat-allocation.js +156 -0
- package/build/core/settlement/queue.js +6 -0
- package/build/core/settlement/settlement.js +295 -0
- package/build/core/{verdict.js → settlement/verdict.js} +9 -37
- package/build/core/status/board.js +24 -23
- package/build/core/status/ledger-batch.js +158 -0
- package/build/core/status/reconciliation.js +10 -4
- package/build/core/stored-agent-event.js +3 -0
- package/build/core/task/board.js +40 -4
- package/build/core/task/commands.js +30 -21
- package/build/core/task/index.js +12 -0
- package/build/core/task/settlement-git.js +157 -65
- package/build/core/task/settlement-policy.js +54 -24
- package/build/core/task/task-contract.js +370 -0
- package/build/core/{task-doctor.js → task/task-doctor.js} +1 -1
- package/build/core/{task-git-actor.js → task/task-git-actor.js} +5 -10
- package/build/core/{task-git-runtime.js → task/task-git-runtime.js} +3 -3
- package/build/core/{task-git-store.js → task/task-git-store.js} +92 -29
- package/build/core/task/task-repository.js +1 -0
- package/build/core/{task-store-repository.js → task/task-store-repository.js} +5 -4
- package/build/core/task/task-store.js +1 -0
- package/build/core/{task-worktree.js → task/task-worktree.js} +2 -1
- package/build/core/task/task.js +5 -0
- package/build/core/task/tree.js +37 -0
- package/build/core/task/validation.js +5 -2
- package/build/core/transcripts.js +15 -3
- package/build/core/worktree-path.js +43 -28
- package/build/flow-error.js +85 -39
- package/build/fs/durability.js +27 -0
- package/build/fs/path-coordinate.js +16 -0
- package/build/generated/version.js +3 -2
- package/build/git/branches.js +2 -1
- package/build/git/core.js +106 -2
- package/build/git/path-coordinate.js +17 -0
- package/build/git/refs.js +57 -0
- package/build/git/streaming-batch.js +301 -0
- package/build/git/worktree.js +65 -0
- package/build/index.js +3 -3
- package/build/keiyaku.js +2 -36
- package/package.json +4 -10
- package/skills/keiyaku/SKILL.md +3 -2
- package/skills/keiyaku-akuma/SKILL.md +10 -6
- package/skills/keiyaku-task/SKILL.md +1 -1
- package/skills/keiyaku-workflow/SKILL.md +25 -4
- package/build/agents/providers/codex-sdk.js +0 -329
- package/build/cli/commands/task/view/meta.js +0 -8
- package/build/core/command-io.js +0 -174
- package/build/core/path-coordinate.js +0 -27
- package/build/core/petition-claim.js +0 -117
- package/build/core/petition-run.js +0 -83
- package/build/core/projection-coordinate.js +0 -63
- package/build/core/projection-wait.js +0 -165
- package/build/core/projection-wake.js +0 -136
- package/build/core/queue.js +0 -343
- package/build/core/task-contract.js +0 -237
- package/build/core/task.js +0 -4
- /package/build/{core/task-repository.js → agents/launch-snapshot/types.js} +0 -0
- /package/build/{core/task-store.js → agents/providers/claude-agent-sdk/terms.js} +0 -0
- /package/build/core/{projection-generation-runtime.js → projection/generation/projection-generation-runtime.js} +0 -0
- /package/build/core/{projection-life-protocol.js → projection/projection-life-protocol.js} +0 -0
- /package/build/core/{projection-runner-lock.js → projection/projection-runner-lock.js} +0 -0
package/build/cli/index.js
CHANGED
|
@@ -6,11 +6,10 @@ import { handleCliError } from "./render/errors.js";
|
|
|
6
6
|
import { FLAG_SPECS } from "./flags.js";
|
|
7
7
|
import { renderCliCommandHelp as renderCliCommandHelpText, renderCliHelp as renderCliHelpText, } from "./help.js";
|
|
8
8
|
import { commandUsesPromptInput, isCallCommand, isPetitionDryRunInvocation, parseCliArgs } from "./parse.js";
|
|
9
|
-
import { getCommandMetadata
|
|
10
|
-
import {
|
|
9
|
+
import { getCommandMetadata } from "./commands/metadata.js";
|
|
10
|
+
import { loadCommandHandler } from "./commands/registry.js";
|
|
11
11
|
import { shellQuote } from "./render/format.js";
|
|
12
|
-
import {
|
|
13
|
-
import { renderResolvedAddressReceipt } from "./render/address.js";
|
|
12
|
+
import { writeSuccessResponse } from "./render/success-response.js";
|
|
14
13
|
function commandRequiresStdin(command) {
|
|
15
14
|
return getCommandMetadata(command).stdin === "required";
|
|
16
15
|
}
|
|
@@ -59,6 +58,10 @@ function prepareBindInput(stdin, flags) {
|
|
|
59
58
|
throw new FlowError("EMPTY_PARAM", "--dry-run requires --place, --objective, --scope, and --checks");
|
|
60
59
|
}
|
|
61
60
|
if (!nonblankStdin) {
|
|
61
|
+
// --task may supply name/objective defaults; core merges and reports missing sections.
|
|
62
|
+
if (flags.bindTaskIds !== undefined && flags.bindTaskIds.length > 0) {
|
|
63
|
+
return "";
|
|
64
|
+
}
|
|
62
65
|
throw new FlowError("EMPTY_PARAM", `No Markdown input received on stdin.\n\nExample:\n ${usageExample("bind")}`);
|
|
63
66
|
}
|
|
64
67
|
return stdin;
|
|
@@ -80,77 +83,6 @@ function makeAbortSignal() {
|
|
|
80
83
|
function responseText(response) {
|
|
81
84
|
return response.text;
|
|
82
85
|
}
|
|
83
|
-
function responseData(response) {
|
|
84
|
-
const payload = response.payload;
|
|
85
|
-
if (!payload || typeof payload !== "object" || Array.isArray(payload) || "error" in payload)
|
|
86
|
-
return {};
|
|
87
|
-
return payload;
|
|
88
|
-
}
|
|
89
|
-
function isCallProjectionFacts(value) {
|
|
90
|
-
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
91
|
-
return false;
|
|
92
|
-
const facts = value;
|
|
93
|
-
return typeof facts.id === "string"
|
|
94
|
-
&& (facts.phase === "active" || facts.phase === "done" || facts.phase === "failed"
|
|
95
|
-
|| facts.phase === "dismissed" || facts.phase === "lost" || facts.phase === "quiescent");
|
|
96
|
-
}
|
|
97
|
-
function conversationalFooter(response) {
|
|
98
|
-
const data = responseData(response);
|
|
99
|
-
const lines = [];
|
|
100
|
-
if (response.address) {
|
|
101
|
-
const projection = data.projection;
|
|
102
|
-
const projectionFacts = isCallProjectionFacts(projection) ? projection : undefined;
|
|
103
|
-
const receiptArtifactId = typeof data.revivedArtifactId === "string"
|
|
104
|
-
? data.revivedArtifactId
|
|
105
|
-
: typeof data.artifactId === "string" ? data.artifactId : undefined;
|
|
106
|
-
lines.push(renderResolvedAddressReceipt(response.address, { artifactId: receiptArtifactId, projectionId: projectionFacts?.id }));
|
|
107
|
-
}
|
|
108
|
-
const responsePath = typeof data.responsePath === "string" ? data.responsePath : undefined;
|
|
109
|
-
const agent = typeof data.agent === "string" ? data.agent : undefined;
|
|
110
|
-
const meta = data.meta && typeof data.meta === "object" && !Array.isArray(data.meta) ? data.meta : undefined;
|
|
111
|
-
const warnings = Array.isArray(meta?.warnings) ? meta.warnings.filter((warning) => typeof warning === "string") : [];
|
|
112
|
-
if (responsePath) {
|
|
113
|
-
lines.push(`Saved to ${responsePath}.`);
|
|
114
|
-
}
|
|
115
|
-
if (agent) {
|
|
116
|
-
lines.push(`Akuma: ${agent}`);
|
|
117
|
-
}
|
|
118
|
-
if (warnings.length > 0) {
|
|
119
|
-
lines.push("Warnings:", ...warnings.map((warning) => `- ${warning}`));
|
|
120
|
-
}
|
|
121
|
-
if (typeof data.summary === "string") {
|
|
122
|
-
const projection = data.projection;
|
|
123
|
-
const projectionFacts = isCallProjectionFacts(projection) ? projection : undefined;
|
|
124
|
-
const artifactId = typeof data.artifactId === "string" ? data.artifactId : undefined;
|
|
125
|
-
lines.push(formatCallNextAction({
|
|
126
|
-
projection: projectionFacts,
|
|
127
|
-
artifactId,
|
|
128
|
-
repositoryCoordinate: repositoryCoordinateFromAddress(response.address),
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
return lines.join("\n");
|
|
132
|
-
}
|
|
133
|
-
function writeSuccessResponse(command, flags, response) {
|
|
134
|
-
// Plain tell is always silent; tell --wait owns the ordinary wait response.
|
|
135
|
-
if (command === "tell" && flags.timeoutMs === undefined)
|
|
136
|
-
return;
|
|
137
|
-
if (command === "bind" && flags.dryRun) {
|
|
138
|
-
// Canonical Markdown already ends with exactly one newline.
|
|
139
|
-
process.stdout.write(responseText(response));
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
if (command !== "revive") {
|
|
143
|
-
process.stdout.write(`${responseText(response)}\n`);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const data = responseData(response);
|
|
147
|
-
const answer = typeof data.summary === "string" ? data.summary.trim() : responseText(response).trim();
|
|
148
|
-
const footer = conversationalFooter(response);
|
|
149
|
-
process.stdout.write(`${answer}\n`);
|
|
150
|
-
if (footer) {
|
|
151
|
-
process.stderr.write(`${footer}\n`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
86
|
async function saveFailedStdin(input) {
|
|
155
87
|
if (!input.content.trim())
|
|
156
88
|
return undefined;
|
|
@@ -160,12 +92,49 @@ async function saveFailedStdin(input) {
|
|
|
160
92
|
content: input.content,
|
|
161
93
|
});
|
|
162
94
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Rebuild bind flags for a failed-stdin retry in deterministic shell-safe order.
|
|
97
|
+
* Order follows bind usage/parse authority: cwd, repo, after, exclusive,
|
|
98
|
+
* draft-only, task. Domain-flag bind does not save stdin, so place/objective/
|
|
99
|
+
* scope/checks are not reconstructed. --dry-run never reaches this path.
|
|
100
|
+
*/
|
|
101
|
+
function bindRetryFlagTokens(flags) {
|
|
102
|
+
const tokens = [];
|
|
103
|
+
if (flags.cwd !== undefined) {
|
|
104
|
+
tokens.push("--cwd", shellQuote(flags.cwd));
|
|
105
|
+
}
|
|
106
|
+
if (flags.repo !== undefined) {
|
|
107
|
+
tokens.push("--repo", shellQuote(flags.repo));
|
|
108
|
+
}
|
|
109
|
+
for (const after of flags.after ?? []) {
|
|
110
|
+
tokens.push("--after", shellQuote(after));
|
|
111
|
+
}
|
|
112
|
+
if (flags.exclusive === true) {
|
|
113
|
+
tokens.push("--exclusive");
|
|
114
|
+
}
|
|
115
|
+
if (flags.draftOnly === true) {
|
|
116
|
+
tokens.push("--draft-only");
|
|
117
|
+
}
|
|
118
|
+
if (flags.bindTaskIds !== undefined) {
|
|
119
|
+
for (const taskId of flags.bindTaskIds) {
|
|
120
|
+
tokens.push("--task", shellQuote(taskId));
|
|
121
|
+
}
|
|
166
122
|
}
|
|
167
|
-
|
|
168
|
-
|
|
123
|
+
return tokens;
|
|
124
|
+
}
|
|
125
|
+
function retryHint(input) {
|
|
126
|
+
const draftArg = input.flags.cwd === undefined
|
|
127
|
+
? shellQuote(input.draftPath)
|
|
128
|
+
: shellQuote(path.resolve(input.cwd, input.draftPath));
|
|
129
|
+
if (input.command === "bind") {
|
|
130
|
+
const flagTokens = bindRetryFlagTokens(input.flags);
|
|
131
|
+
const flagPart = flagTokens.length > 0 ? ` ${flagTokens.join(" ")}` : "";
|
|
132
|
+
return `Retry: keiyaku bind${flagPart} < ${draftArg}`;
|
|
133
|
+
}
|
|
134
|
+
if (input.flags.cwd === undefined) {
|
|
135
|
+
return `Retry: keiyaku ${input.command} < ${shellQuote(input.draftPath)}`;
|
|
136
|
+
}
|
|
137
|
+
return `Retry: keiyaku ${input.command} --cwd ${shellQuote(input.flags.cwd)} < ${draftArg}`;
|
|
169
138
|
}
|
|
170
139
|
async function printFailure(error, cwd) {
|
|
171
140
|
const response = await handleCliError({
|
|
@@ -195,7 +164,12 @@ async function handleFailureAfterStdin(input) {
|
|
|
195
164
|
content: input.stdin,
|
|
196
165
|
});
|
|
197
166
|
if (draftPath) {
|
|
198
|
-
process.stderr.write(`\nSaved stdin input to ${draftPath}.\n${retryHint(
|
|
167
|
+
process.stderr.write(`\nSaved stdin input to ${draftPath}.\n${retryHint({
|
|
168
|
+
command: input.command,
|
|
169
|
+
draftPath,
|
|
170
|
+
cwd: input.cwd,
|
|
171
|
+
flags: input.flags,
|
|
172
|
+
})}\n`);
|
|
199
173
|
}
|
|
200
174
|
}
|
|
201
175
|
catch (draftError) {
|
|
@@ -309,9 +283,9 @@ export async function runCliCommand(tokens) {
|
|
|
309
283
|
return await handleFailureAfterStdin({
|
|
310
284
|
error,
|
|
311
285
|
cwd,
|
|
312
|
-
cwdFlag: parsed.flags.cwd,
|
|
313
286
|
command: parsed.command,
|
|
314
287
|
stdin,
|
|
288
|
+
flags: parsed.flags,
|
|
315
289
|
saveStdin: !(parsed.command === "bind" && hasBindDomainFlags(parsed.flags)),
|
|
316
290
|
});
|
|
317
291
|
}
|
|
@@ -329,9 +303,9 @@ export async function runCliCommand(tokens) {
|
|
|
329
303
|
return await handleFailureAfterStdin({
|
|
330
304
|
response,
|
|
331
305
|
cwd,
|
|
332
|
-
cwdFlag: parsed.flags.cwd,
|
|
333
306
|
command: parsed.command,
|
|
334
307
|
stdin,
|
|
308
|
+
flags: parsed.flags,
|
|
335
309
|
saveStdin: !(parsed.command === "bind" && hasBindDomainFlags(parsed.flags)),
|
|
336
310
|
});
|
|
337
311
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FlowError } from "../flow-error.js";
|
|
2
|
+
export function formatSubcommandList(subcommands) {
|
|
3
|
+
return subcommands.length < 2 ? (subcommands[0] ?? "") : `${subcommands.slice(0, -1).join(", ")} or ${subcommands.at(-1)}`;
|
|
4
|
+
}
|
|
5
|
+
export function missingSubcommandError(name, subcommands) {
|
|
6
|
+
return new FlowError("EMPTY_PARAM", `${name} requires subcommand: ${formatSubcommandList(subcommands)}`);
|
|
7
|
+
}
|
package/build/cli/parse-flags.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlowError } from "../flow-error.js";
|
|
2
|
-
import { getCommandMetadata } from "./commands/
|
|
2
|
+
import { getCommandMetadata } from "./commands/metadata.js";
|
|
3
3
|
import { BOOLEAN_FLAGS, CONTROL_FLAGS, SHORT_FLAG_ALIASES, VALUE_FLAGS, } from "./flags.js";
|
|
4
4
|
import { normalizeContractAddress, parseWaitTimeout } from "./parse-metadata.js";
|
|
5
5
|
function allowedFlagsForParse(command) {
|
|
@@ -85,10 +85,7 @@ export function assignFlag(flags, name, value) {
|
|
|
85
85
|
flags.bindChecks = String(value);
|
|
86
86
|
return;
|
|
87
87
|
case "task":
|
|
88
|
-
|
|
89
|
-
throw new FlowError("EMPTY_PARAM", "option --task may only be specified once");
|
|
90
|
-
}
|
|
91
|
-
flags.bindTaskId = String(value);
|
|
88
|
+
flags.bindTaskIds = [...(flags.bindTaskIds ?? []), String(value)];
|
|
92
89
|
return;
|
|
93
90
|
case "after":
|
|
94
91
|
flags.after = [...(flags.after ?? []), String(value)];
|
|
@@ -105,6 +102,15 @@ export function assignFlag(flags, name, value) {
|
|
|
105
102
|
case "waive":
|
|
106
103
|
flags.waivePaths = [...(flags.waivePaths ?? []), String(value)];
|
|
107
104
|
return;
|
|
105
|
+
case "resolve":
|
|
106
|
+
flags.renewResolve = Boolean(value);
|
|
107
|
+
return;
|
|
108
|
+
case "continue":
|
|
109
|
+
flags.renewContinue = Boolean(value);
|
|
110
|
+
return;
|
|
111
|
+
case "abort":
|
|
112
|
+
flags.renewAbort = Boolean(value);
|
|
113
|
+
return;
|
|
108
114
|
case "shell":
|
|
109
115
|
flags.shell = String(value);
|
|
110
116
|
return;
|
|
@@ -120,6 +126,9 @@ export function assignFlag(flags, name, value) {
|
|
|
120
126
|
case "all":
|
|
121
127
|
flags.all = Boolean(value);
|
|
122
128
|
return;
|
|
129
|
+
case "any":
|
|
130
|
+
flags.any = Boolean(value);
|
|
131
|
+
return;
|
|
123
132
|
case "target":
|
|
124
133
|
if (flags.target !== undefined) {
|
|
125
134
|
throw new FlowError("EMPTY_PARAM", "option --target may only be specified once");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FlowError } from "../flow-error.js";
|
|
2
2
|
import { HELP_FLAGS, SHORT_FLAG_ALIASES, VALUE_FLAGS } from "./flags.js";
|
|
3
|
-
import { commandParseOrder, getCommandMetadata } from "./commands/
|
|
3
|
+
import { commandParseOrder, getCommandMetadata } from "./commands/metadata.js";
|
|
4
4
|
import { TASK_SUBCOMMANDS } from "./types.js";
|
|
5
5
|
export function normalizeContractAddress(raw) {
|
|
6
6
|
const value = raw.startsWith("@") ? raw.slice(1) : raw;
|
|
@@ -75,7 +75,7 @@ export function commandPositionalRange(command) {
|
|
|
75
75
|
return { min: 1, max: 2, label: "<ARTIFACT> [BODY|-]" };
|
|
76
76
|
}
|
|
77
77
|
if (command === "wait") {
|
|
78
|
-
return { min:
|
|
78
|
+
return { min: 0, max: Number.MAX_SAFE_INTEGER, label: "<projection-address>" };
|
|
79
79
|
}
|
|
80
80
|
if (command === "kill") {
|
|
81
81
|
return { min: 1, max: 1, label: "<projection-address>" };
|
|
@@ -86,7 +86,7 @@ export function commandPositionalRange(command) {
|
|
|
86
86
|
if (command === "task add") {
|
|
87
87
|
return { min: 1, max: 1, label: "<BODY|->" };
|
|
88
88
|
}
|
|
89
|
-
if (command === "task
|
|
89
|
+
if (command === "task show" || command === "task start" || command === "task drop") {
|
|
90
90
|
return { min: 1, max: 1, label: "<ID>" };
|
|
91
91
|
}
|
|
92
92
|
if (command === "task update") {
|
|
@@ -56,7 +56,7 @@ export function assertProjectionSelectorPresent(command, flags, atTokens, contra
|
|
|
56
56
|
? atTokens[0] ?? `@${flags.contractId}`
|
|
57
57
|
: `--contract ${contractFlagRaws[0] ?? flags.contractId}`;
|
|
58
58
|
const message = `${command} requires a projection id or alias; ${selectorSpelling} only limits projection lookup, so add the projection address`;
|
|
59
|
-
if (command === "wait" && restLength + payloadLength === 0) {
|
|
59
|
+
if (command === "wait" && restLength + payloadLength === 0 && !flags.any && !flags.all) {
|
|
60
60
|
throw new FlowError("EMPTY_PARAM", message);
|
|
61
61
|
}
|
|
62
62
|
if (command === "tell" && restLength === 0) {
|
package/build/cli/parse.js
CHANGED
|
@@ -5,6 +5,7 @@ import { HELP_FLAGS } from "./flags.js";
|
|
|
5
5
|
import { assertAllowedFlag, assignFlag, BOOLEAN_FLAGS, CONTROL_FLAGS, parseFlagName, readValueFlag, SHORT_FLAG_ALIASES, VALUE_FLAGS, } from "./parse-flags.js";
|
|
6
6
|
import { commandPositionalRange, commandRequiresStdin, isCallCommand, resolveCommand, splitAtLiteralBoundary, TASK_SUBCOMMANDS, } from "./parse-metadata.js";
|
|
7
7
|
import { applyCommissionSelector, assertCommissionSelectorAllowed, assertProjectionSelectorPresent, } from "./parse-selectors.js";
|
|
8
|
+
import { WAIT_SET_SELECTION_ERROR } from "./commands/projection/wait/meta.js";
|
|
8
9
|
export { commandPositionalRange, commandUsesPromptInput, isCallCommand, isPetitionDryRunInvocation, normalizeContractAddress, parseWaitTimeout, } from "./parse-metadata.js";
|
|
9
10
|
export function parseCliArgs(tokens) {
|
|
10
11
|
const { head, payload } = splitAtLiteralBoundary(tokens);
|
|
@@ -120,6 +121,9 @@ export function parseCliArgs(tokens) {
|
|
|
120
121
|
if (command === "task ls" && flags.all && flags.done) {
|
|
121
122
|
throw new FlowError("EMPTY_PARAM", "task ls cannot combine --all and --done");
|
|
122
123
|
}
|
|
124
|
+
if (command === "wait" && flags.any && flags.all) {
|
|
125
|
+
throw new FlowError("EMPTY_PARAM", WAIT_SET_SELECTION_ERROR);
|
|
126
|
+
}
|
|
123
127
|
if (command === "task update" && flags.taskParent !== undefined && flags.taskNoParent) {
|
|
124
128
|
throw new FlowError("EMPTY_PARAM", "task update cannot combine --parent and --no-parent");
|
|
125
129
|
}
|
|
@@ -131,9 +135,26 @@ export function parseCliArgs(tokens) {
|
|
|
131
135
|
if (command === "petition" && flags.json && !flags.dryRun) {
|
|
132
136
|
throw new FlowError("EMPTY_PARAM", "petition --json requires --dry-run");
|
|
133
137
|
}
|
|
138
|
+
if (command === "renew") {
|
|
139
|
+
const recoveryModes = [flags.renewResolve, flags.renewContinue, flags.renewAbort].filter(Boolean).length;
|
|
140
|
+
if (recoveryModes > 1) {
|
|
141
|
+
throw new FlowError("EMPTY_PARAM", "renew accepts only one of --resolve, --continue, or --abort");
|
|
142
|
+
}
|
|
143
|
+
if (flags.renewAbort && (flags.waivePaths?.length ?? 0) > 0) {
|
|
144
|
+
throw new FlowError("EMPTY_PARAM", "renew --abort does not accept --waive");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
134
147
|
assertCommissionSelectorAllowed(command, flags);
|
|
135
148
|
assertProjectionSelectorPresent(command, flags, atTokens, contractFlagRaws, rest.length, payload.length);
|
|
136
149
|
const positional = [...rest, ...payload];
|
|
150
|
+
if (command === "wait") {
|
|
151
|
+
if (positional.length === 0 && !flags.contractId) {
|
|
152
|
+
throw new FlowError("EMPTY_PARAM", "wait requires <projection-address>");
|
|
153
|
+
}
|
|
154
|
+
if (positional.length > 1 && !flags.any && !flags.all) {
|
|
155
|
+
throw new FlowError("EMPTY_PARAM", WAIT_SET_SELECTION_ERROR);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
137
158
|
if (isCallCommand(command)) {
|
|
138
159
|
if (flags.akuma) {
|
|
139
160
|
if (positional.length > 1) {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { AddressResolutionError, buildObjectResolutionAttempt, } from "../core/addressing.js";
|
|
4
|
-
import { resolveProjectionCoordinate } from "../core/projection
|
|
5
|
-
import { isProjectionId, projectionDir } from "../core/projection
|
|
6
|
-
import { isProjectionAlias, readProjectionAlias } from "../core/projection
|
|
7
|
-
import { readProjectionIdentity } from "../core/projection
|
|
8
|
-
import { isProjectionGenerationSchemaV1Residue } from "../core/projection/generation/store.js";
|
|
4
|
+
import { resolveProjectionCoordinate } from "../core/projection/index.js";
|
|
5
|
+
import { isProjectionId, projectionDir } from "../core/projection/index.js";
|
|
6
|
+
import { isProjectionAlias, readProjectionAlias } from "../core/projection/index.js";
|
|
7
|
+
import { readProjectionIdentity } from "../core/projection/index.js";
|
|
9
8
|
import { isResponseArtifactId } from "../core/response-artifact-id.js";
|
|
10
9
|
import { isErrnoException } from "../errno.js";
|
|
11
10
|
function isRealDirectory(directory) {
|
|
@@ -41,7 +40,7 @@ export async function resolveProjectionAddress(input) {
|
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
else {
|
|
44
|
-
const coordinate = resolveProjectionCoordinate(input.cwd);
|
|
43
|
+
const coordinate = await resolveProjectionCoordinate(input.cwd);
|
|
45
44
|
repo = coordinate.authority.kind === "repository"
|
|
46
45
|
? { kind: "repository", stableRoot: coordinate.authority.stableRoot }
|
|
47
46
|
: { kind: "user" };
|
|
@@ -70,21 +69,17 @@ export async function resolveProjectionAddress(input) {
|
|
|
70
69
|
else {
|
|
71
70
|
if (!isProjectionAlias(input.address))
|
|
72
71
|
throw new AddressResolutionError("EMPTY_PARAM", `projection alias ${input.address} has no match ${suffix}`, attempt);
|
|
73
|
-
const target = readProjectionAlias(physicalRoot, input.address);
|
|
72
|
+
const target = await readProjectionAlias(physicalRoot, input.address);
|
|
74
73
|
if (!target)
|
|
75
74
|
throw new AddressResolutionError("EMPTY_PARAM", `projection alias ${input.address} has no match ${suffix}`, attempt);
|
|
76
75
|
id = target;
|
|
77
76
|
alias = input.address;
|
|
78
77
|
}
|
|
79
|
-
const directory = projectionDir(physicalRoot, id);
|
|
78
|
+
const directory = await projectionDir(physicalRoot, id);
|
|
80
79
|
if (!isRealDirectory(directory)) {
|
|
81
80
|
const subject = alias ? `projection alias ${alias} points to missing projection ${id}` : `projection ${id}`;
|
|
82
81
|
throw new AddressResolutionError("EMPTY_PARAM", `${subject} has no match ${suffix}`, attempt);
|
|
83
82
|
}
|
|
84
|
-
if (isProjectionGenerationSchemaV1Residue(directory)) {
|
|
85
|
-
const subject = alias ? `projection alias ${alias} points to missing projection ${id}` : `projection ${id}`;
|
|
86
|
-
throw new AddressResolutionError("EMPTY_PARAM", `${subject} has no match ${suffix}`, attempt);
|
|
87
|
-
}
|
|
88
83
|
let identity;
|
|
89
84
|
try {
|
|
90
85
|
identity = readProjectionIdentity(directory);
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
return sourceName(address.spelling.source);
|
|
3
|
-
}
|
|
4
|
-
function sourceName(source) {
|
|
5
|
-
switch (source) {
|
|
6
|
-
case "at-address": return "explicit @";
|
|
7
|
-
case "explicit-flag": return "explicit --contract";
|
|
8
|
-
case "worktree-presented": return "worktree cwd";
|
|
9
|
-
case "sole-active": return "only active commission";
|
|
10
|
-
case "artifact-provenance": return "artifact provenance";
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
import { formatCommissionCoordinate } from "../../core/ids.js";
|
|
13
2
|
function isCommissionAddress(address) {
|
|
14
3
|
return address.binding.kind === "commission";
|
|
15
4
|
}
|
|
5
|
+
function projectionSegment(facts) {
|
|
6
|
+
if (!facts.projectionId)
|
|
7
|
+
return undefined;
|
|
8
|
+
return facts.projectionAlias
|
|
9
|
+
? `projection ${facts.projectionId} (${facts.projectionAlias})`
|
|
10
|
+
: `projection ${facts.projectionId}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Human-facing address receipt. Contract coordinates are `<slug> @<place>` or `<slug>`;
|
|
14
|
+
* Opaque contract identity, branch ref, binding source, and repo path stay in payload/carrier.
|
|
15
|
+
*/
|
|
16
16
|
export function renderResolvedAddressReceipt(address, facts = {}) {
|
|
17
17
|
if (!isCommissionAddress(address)) {
|
|
18
18
|
if (address.binding.kind === "unbound") {
|
|
@@ -22,43 +22,50 @@ export function renderResolvedAddressReceipt(address, facts = {}) {
|
|
|
22
22
|
return [
|
|
23
23
|
"Unbound",
|
|
24
24
|
"no active commission",
|
|
25
|
-
`repo ${address.repo.stableRoot}`,
|
|
26
25
|
`workdir ${address.workdir}`,
|
|
27
26
|
facts.artifactId ? `artifact ${facts.artifactId}` : undefined,
|
|
28
|
-
|
|
27
|
+
projectionSegment(facts),
|
|
29
28
|
].filter((part) => part !== undefined).join(" · ");
|
|
30
29
|
}
|
|
31
|
-
const repository = address.repo.kind === "repository"
|
|
32
|
-
? `repo ${address.repo.stableRoot}`
|
|
33
|
-
: "no repository";
|
|
34
30
|
return [
|
|
35
31
|
"Bare",
|
|
36
32
|
"no contract",
|
|
37
|
-
repository,
|
|
38
33
|
`workdir ${address.workdir}`,
|
|
39
34
|
facts.artifactId ? `artifact ${facts.artifactId}` : undefined,
|
|
40
|
-
|
|
35
|
+
projectionSegment(facts),
|
|
41
36
|
].filter((part) => part !== undefined).join(" · ");
|
|
42
37
|
}
|
|
38
|
+
const place = address.place.display;
|
|
39
|
+
if (facts.akumaName) {
|
|
40
|
+
if (!facts.projectionId)
|
|
41
|
+
throw new Error("commissioned call receipt requires projection id");
|
|
42
|
+
return `call ${facts.akumaName} · ${formatCommissionCoordinate({
|
|
43
|
+
commissionId: address.binding.commissionId,
|
|
44
|
+
place,
|
|
45
|
+
})} · projection ${facts.projectionId} · out there`;
|
|
46
|
+
}
|
|
43
47
|
return [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
formatCommissionCoordinate({
|
|
49
|
+
commissionId: address.binding.commissionId,
|
|
50
|
+
place,
|
|
51
|
+
}),
|
|
48
52
|
facts.artifactId ? `artifact ${facts.artifactId}` : undefined,
|
|
49
|
-
|
|
50
|
-
`via ${sourceLabel(address)}`,
|
|
53
|
+
projectionSegment(facts),
|
|
51
54
|
].filter((part) => part !== undefined).join(" · ");
|
|
52
55
|
}
|
|
53
56
|
function renderAttemptCandidate(candidate) {
|
|
57
|
+
const coordinate = formatCommissionCoordinate({
|
|
58
|
+
commissionId: candidate.commissionId,
|
|
59
|
+
place: candidate.place,
|
|
60
|
+
});
|
|
61
|
+
const objectiveLine = candidate.objective.split(/\r?\n/, 1)[0]?.trim() ?? "";
|
|
62
|
+
const objective = objectiveLine.length > 60
|
|
63
|
+
? `${objectiveLine.slice(0, 60)}…`
|
|
64
|
+
: objectiveLine;
|
|
54
65
|
return [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
candidate.
|
|
58
|
-
`target ${candidate.target.branch}`,
|
|
59
|
-
`commission ${candidate.commissionId}`,
|
|
60
|
-
`lifecycle ${candidate.lifecycle.state}`,
|
|
61
|
-
candidate.matchedBy ? `matched by ${candidate.matchedBy}` : undefined,
|
|
66
|
+
coordinate,
|
|
67
|
+
objective || undefined,
|
|
68
|
+
candidate.commissionId,
|
|
62
69
|
].filter((part) => part !== undefined).join(" · ");
|
|
63
70
|
}
|
|
64
71
|
function isCommissionResolutionAttempt(attempt) {
|
|
@@ -67,20 +74,17 @@ function isCommissionResolutionAttempt(attempt) {
|
|
|
67
74
|
export function renderResolutionAttemptPreamble(attempt) {
|
|
68
75
|
if (!isCommissionResolutionAttempt(attempt)) {
|
|
69
76
|
return [
|
|
70
|
-
attempt.repo.kind === "repository" ? `At repo ${attempt.repo.stableRoot}` : "At no repository",
|
|
71
77
|
attempt.scope ? `scope ${attempt.scope.asTyped}` : undefined,
|
|
72
|
-
].filter((part) => part !== undefined).join(" · ");
|
|
78
|
+
].filter((part) => part !== undefined).join(" · ") || "resolution failed";
|
|
73
79
|
}
|
|
74
80
|
const parts = [
|
|
75
|
-
attempt.repo.kind === "repository" ? `At repo ${attempt.repo.stableRoot}` : "At no repository",
|
|
76
81
|
attempt.spelling ? `address ${attempt.spelling.asTyped}` : undefined,
|
|
77
82
|
attempt.candidates.length > 0
|
|
78
83
|
? `candidates ${attempt.candidates.map(renderAttemptCandidate).join("; ")}`
|
|
79
84
|
: undefined,
|
|
80
|
-
attempt.spelling ? `via ${sourceName(attempt.spelling.source)}` : undefined,
|
|
81
85
|
attempt.inference.length > 0 ? `inference ${attempt.inference.join("; ")}` : undefined,
|
|
82
86
|
];
|
|
83
|
-
return parts.filter((part) => part !== undefined).join(" · ");
|
|
87
|
+
return parts.filter((part) => part !== undefined).join(" · ") || "resolution failed";
|
|
84
88
|
}
|
|
85
89
|
export function renderAddressCarrier(carrier, facts = {}) {
|
|
86
90
|
return "expected" in carrier
|
package/build/cli/render/arc.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { renderSealDiffSection } from "../../core/transcripts.js";
|
|
1
2
|
import { shortCommitHash } from "../../git/commits.js";
|
|
2
3
|
import { assembleResponse, buildPayload, buildSection, formatHints, formatList, formatMaybe, formatWarnings, } from "./format.js";
|
|
3
4
|
import { DIFF_OVERVIEW_SECTION_TITLE, RESPONSE_MARKERS, WARNING_SECTION_TITLE } from "./response-style.js";
|
|
4
|
-
import { appendPersistenceSummary,
|
|
5
|
+
import { appendPersistenceSummary, CONTENT_SECTION_TITLE, HINTS_LIST_MAX_ITEMS, HINTS_SECTION_TITLE, INFO_COMMIT_MAX_CHARS, INFO_PLEA_MAX_CHARS, INFO_SECTION_TITLE, } from "./shared.js";
|
|
5
6
|
import { prependAddressReceipt } from "./address.js";
|
|
6
7
|
function sealLines(result) {
|
|
7
8
|
if (!result.sealed)
|
|
@@ -15,25 +16,27 @@ function sealLines(result) {
|
|
|
15
16
|
}
|
|
16
17
|
export function buildArcResponse(result) {
|
|
17
18
|
const { status: _status, address: _address, ...resultData } = result;
|
|
19
|
+
const diff = renderSealDiffSection(result.sealed, "working tree untouched");
|
|
20
|
+
const payload = { ...resultData, diff };
|
|
18
21
|
const summarySection = buildSection(CONTENT_SECTION_TITLE, sealLines(result));
|
|
19
22
|
const warningSection = buildSection(WARNING_SECTION_TITLE, formatWarnings(result.meta?.warnings ?? []));
|
|
20
23
|
const hintsSection = buildSection(HINTS_SECTION_TITLE, formatHints(result.meta?.hints ?? [], { maxItems: HINTS_LIST_MAX_ITEMS }));
|
|
21
24
|
const infoSection = buildSection(INFO_SECTION_TITLE, [
|
|
22
|
-
...formatMaybe("Title", result.title
|
|
25
|
+
...formatMaybe("Title", result.title),
|
|
23
26
|
...formatMaybe("Objective", result.objective, INFO_PLEA_MAX_CHARS),
|
|
24
27
|
...formatMaybe("Brief", result.brief, INFO_PLEA_MAX_CHARS),
|
|
25
28
|
...formatMaybe("Ledger Commit", result.ledgerCommit, INFO_COMMIT_MAX_CHARS),
|
|
26
|
-
...formatMaybe(BRANCH_LABEL, result.currentBranch, INFO_BRANCH_MAX_CHARS),
|
|
27
|
-
...formatMaybe("Base Branch", result.baseBranch, INFO_BRANCH_MAX_CHARS),
|
|
28
29
|
]);
|
|
29
30
|
const summaryLine = appendPersistenceSummary(result.summary, result.responsePath);
|
|
30
31
|
return prependAddressReceipt({
|
|
31
|
-
text: assembleResponse(`${RESPONSE_MARKERS.arc} Arc Opened (a${result.arc})`, summaryLine, [summarySection, infoSection, buildSection(DIFF_OVERVIEW_SECTION_TITLE,
|
|
32
|
-
payload: buildPayload(
|
|
32
|
+
text: assembleResponse(`${RESPONSE_MARKERS.arc} Arc Opened (a${result.arc})`, summaryLine, [summarySection, infoSection, buildSection(DIFF_OVERVIEW_SECTION_TITLE, diff), warningSection, hintsSection].filter((section) => section !== null)),
|
|
33
|
+
payload: buildPayload(payload, result.responsePath),
|
|
33
34
|
}, result.address);
|
|
34
35
|
}
|
|
35
36
|
export function buildRenewResponse(result) {
|
|
36
37
|
const { status: _status, address: _address, ...resultData } = result;
|
|
38
|
+
const diff = renderSealDiffSection(result.sealed, "nothing sealed");
|
|
39
|
+
const payload = { ...resultData, diff };
|
|
37
40
|
const infoSection = buildSection(INFO_SECTION_TITLE, [
|
|
38
41
|
...formatMaybe("Old Base", result.oldBase, INFO_COMMIT_MAX_CHARS),
|
|
39
42
|
...formatMaybe("New Base", result.newBase, INFO_COMMIT_MAX_CHARS),
|
|
@@ -42,22 +45,31 @@ export function buildRenewResponse(result) {
|
|
|
42
45
|
...formatMaybe("Ledger Head", result.ledgerHead, INFO_COMMIT_MAX_CHARS),
|
|
43
46
|
...formatList("Seal", sealLines(result)),
|
|
44
47
|
]);
|
|
48
|
+
const warningSection = buildSection(WARNING_SECTION_TITLE, formatWarnings(result.meta?.warnings ?? []));
|
|
45
49
|
return prependAddressReceipt({
|
|
46
|
-
text: assembleResponse(`${RESPONSE_MARKERS.arc} Renewed`, appendPersistenceSummary(result.summary, result.responsePath), [buildSection(CONTENT_SECTION_TITLE,
|
|
47
|
-
payload: buildPayload(
|
|
50
|
+
text: assembleResponse(`${RESPONSE_MARKERS.arc} Renewed`, appendPersistenceSummary(result.summary, result.responsePath), [buildSection(CONTENT_SECTION_TITLE, diff), infoSection, warningSection].filter((section) => section !== null)),
|
|
51
|
+
payload: buildPayload(payload, result.responsePath),
|
|
48
52
|
}, result.address);
|
|
49
53
|
}
|
|
54
|
+
export function buildRenewAbortResponse(result) {
|
|
55
|
+
const payload = {
|
|
56
|
+
contractId: result.contractId,
|
|
57
|
+
oldHead: result.oldHead,
|
|
58
|
+
recoveryCleanup: result.recoveryCleanup,
|
|
59
|
+
summary: result.summary,
|
|
60
|
+
};
|
|
61
|
+
return prependAddressReceipt({ text: result.summary, payload }, result.address);
|
|
62
|
+
}
|
|
50
63
|
export function buildAmendResponse(result) {
|
|
51
64
|
const { status: _status, address: _address, ...resultData } = result;
|
|
65
|
+
const payload = resultData;
|
|
52
66
|
const renderedLedgerCommit = shortCommitHash(result.ledgerCommit);
|
|
53
67
|
const infoSection = buildSection(INFO_SECTION_TITLE, [
|
|
54
68
|
...formatMaybe("Amendment", String(result.amendmentNumber), INFO_COMMIT_MAX_CHARS),
|
|
55
|
-
...formatMaybe(BRANCH_LABEL, result.currentBranch, INFO_BRANCH_MAX_CHARS),
|
|
56
|
-
...formatMaybe("Base Branch", result.baseBranch, INFO_BRANCH_MAX_CHARS),
|
|
57
69
|
...formatMaybe("Ledger Commit", renderedLedgerCommit, INFO_COMMIT_MAX_CHARS),
|
|
58
70
|
]);
|
|
59
71
|
return prependAddressReceipt({
|
|
60
|
-
text: assembleResponse(`${RESPONSE_MARKERS.arc} Amended`, `Amended contract ledger
|
|
61
|
-
payload: buildPayload(
|
|
72
|
+
text: assembleResponse(`${RESPONSE_MARKERS.arc} Amended`, `Amended contract ledger with Amendment ${result.amendmentNumber} [${renderedLedgerCommit}].`, [buildSection(CONTENT_SECTION_TITLE, result.summary), infoSection].filter((section) => section !== null)),
|
|
73
|
+
payload: buildPayload(payload),
|
|
62
74
|
}, result.address);
|
|
63
75
|
}
|
package/build/cli/render/call.js
CHANGED
|
@@ -2,9 +2,13 @@ import { assembleResponse, buildPayload, buildSection, formatMaybe, formatWarnin
|
|
|
2
2
|
import { WARNING_SECTION_TITLE } from "./response-style.js";
|
|
3
3
|
import { CONTENT_SECTION_TITLE, formatPersistenceSummary, formatCallCompletionHeading, formatCallNextAction, INFO_AKUMA_MAX_CHARS, projectionRejoinHintLines, } from "./shared.js";
|
|
4
4
|
import { carryAddress, prependAddressReceipt, renderResolvedAddressReceipt } from "./address.js";
|
|
5
|
-
export function renderAdoptedLaunchReceipt(address, projectionId, alias, previousAliasTarget) {
|
|
5
|
+
export function renderAdoptedLaunchReceipt(address, projectionId, alias, previousAliasTarget, akumaName) {
|
|
6
6
|
return [
|
|
7
|
-
renderResolvedAddressReceipt(address, {
|
|
7
|
+
renderResolvedAddressReceipt(address, {
|
|
8
|
+
projectionId,
|
|
9
|
+
...(alias ? { projectionAlias: alias } : {}),
|
|
10
|
+
...(akumaName ? { akumaName } : {}),
|
|
11
|
+
}),
|
|
8
12
|
...(alias ? [`alias ${alias} → ${projectionId}`] : []),
|
|
9
13
|
...(alias && previousAliasTarget ? [`(moved from ${previousAliasTarget}, still running)`] : []),
|
|
10
14
|
...projectionRejoinHintLines(alias ?? projectionId),
|
|
@@ -15,14 +19,15 @@ export function buildCallResponse(result, input) {
|
|
|
15
19
|
if (!result.projection)
|
|
16
20
|
throw new Error("launched call response requires projection facts");
|
|
17
21
|
const { session: _session, evidenceCwd: _evidenceCwd, address: _address, foregroundWait: _foregroundWait, ...responseData } = result;
|
|
22
|
+
const payload = responseData;
|
|
18
23
|
const output = {
|
|
19
24
|
text: input.addressPlacement === "stdout"
|
|
20
|
-
? renderAdoptedLaunchReceipt(result.address, result.projection.id, result.projection.alias, result.projection.previousAliasTarget)
|
|
25
|
+
? renderAdoptedLaunchReceipt(result.address, result.projection.id, result.projection.alias, result.projection.previousAliasTarget, result.agent ?? input.agent)
|
|
21
26
|
: [
|
|
22
27
|
...(result.projection.alias ? [`alias ${result.projection.alias} → ${result.projection.id}`] : []),
|
|
23
28
|
...projectionRejoinHintLines(result.projection.alias ?? result.projection.id),
|
|
24
29
|
].join("\n"),
|
|
25
|
-
payload: buildPayload(
|
|
30
|
+
payload: buildPayload(payload),
|
|
26
31
|
};
|
|
27
32
|
switch (input.addressPlacement) {
|
|
28
33
|
case "stdout":
|
|
@@ -49,9 +54,10 @@ export function buildCallResponse(result, input) {
|
|
|
49
54
|
repositoryCoordinate,
|
|
50
55
|
})}`;
|
|
51
56
|
const { session: _session, evidenceCwd: _evidenceCwd, address: _address, foregroundWait: _foregroundWait, ...responseData } = result;
|
|
57
|
+
const payload = responseData;
|
|
52
58
|
const output = {
|
|
53
59
|
text,
|
|
54
|
-
payload: buildPayload(
|
|
60
|
+
payload: buildPayload(payload, input.responsePath),
|
|
55
61
|
};
|
|
56
62
|
switch (input.addressPlacement) {
|
|
57
63
|
case "stdout":
|