@astrosheep/keiyaku 2.9.3 → 2.9.5
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 +14 -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 +26 -222
- package/build/agents/harness/index.js +3 -1
- package/build/agents/harness/outcome.js +68 -5
- package/build/agents/harness/projection.js +179 -124
- 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 +82 -53
- package/build/agents/providers/codex-app-server/events.js +90 -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/events.js +4 -3
- 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 +10 -0
- package/build/artifact-directories.js +22 -0
- package/build/cli/commands/akuma/akuma/handler.js +1 -1
- package/build/cli/commands/akuma/akuma/meta.js +1 -1
- package/build/cli/commands/akuma/list/meta-ls.js +1 -1
- package/build/cli/commands/akuma/view/handler.js +5 -4
- package/build/cli/commands/akuma/view/meta.js +1 -1
- package/build/cli/commands/akuma.js +6 -0
- package/build/cli/commands/contract/amend/handler.js +8 -2
- package/build/cli/commands/contract/amend/meta.js +4 -4
- package/build/cli/commands/contract/arc/handler.js +8 -2
- package/build/cli/commands/contract/arc/meta.js +4 -4
- package/build/cli/commands/contract/audit/handler.js +16 -0
- package/build/cli/commands/contract/audit/meta.js +16 -0
- package/build/cli/commands/contract/bind/handler.js +4 -3
- package/build/cli/commands/contract/bind/meta.js +44 -8
- package/build/cli/commands/contract/catalog.js +2 -0
- package/build/cli/commands/contract/forfeit/handler.js +4 -4
- package/build/cli/commands/contract/forfeit/meta.js +1 -1
- package/build/cli/commands/contract/log/handler.js +3 -3
- package/build/cli/commands/contract/log/meta.js +1 -1
- package/build/cli/commands/contract/petition/handler.js +5 -8
- package/build/cli/commands/contract/petition/meta.js +6 -6
- package/build/cli/commands/contract/renew/handler.js +20 -6
- package/build/cli/commands/contract/renew/meta.js +6 -5
- package/build/cli/commands/metadata.js +59 -0
- package/build/cli/commands/projection/call/handler.js +6 -5
- package/build/cli/commands/projection/call/meta.js +4 -1
- package/build/cli/commands/projection/kill/handler.js +16 -32
- package/build/cli/commands/projection/kill/meta.js +1 -1
- package/build/cli/commands/projection/revive/meta.js +4 -1
- package/build/cli/commands/projection/shared.js +28 -0
- package/build/cli/commands/projection/status/handler.js +1 -1
- package/build/cli/commands/projection/status/meta.js +1 -1
- package/build/cli/commands/projection/tell/handler.js +14 -30
- package/build/cli/commands/projection/tell/meta.js +4 -1
- package/build/cli/commands/projection/wait/handler.js +45 -22
- package/build/cli/commands/projection/wait/meta.js +8 -3
- 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/install/meta.js +1 -1
- package/build/cli/commands/skills/skills/handler.js +1 -1
- package/build/cli/commands/skills/skills/meta.js +1 -1
- package/build/cli/commands/system/completion/meta.js +1 -1
- package/build/cli/commands/system/dump-env/meta.js +1 -1
- package/build/cli/commands/system/guide/meta.js +1 -1
- package/build/cli/commands/task/add/handler.js +7 -15
- package/build/cli/commands/task/add/meta.js +4 -1
- package/build/cli/commands/task/catalog.js +2 -2
- package/build/cli/commands/task/doctor/meta.js +1 -1
- package/build/cli/commands/task/done/handler.js +4 -8
- package/build/cli/commands/task/done/meta.js +1 -1
- package/build/cli/commands/task/drop/handler.js +3 -6
- package/build/cli/commands/task/drop/meta.js +1 -1
- package/build/cli/commands/task/ls/handler.js +12 -8
- package/build/cli/commands/task/ls/meta.js +3 -3
- 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/start/meta.js +1 -1
- package/build/cli/commands/task/stop/handler.js +4 -8
- package/build/cli/commands/task/stop/meta.js +1 -1
- package/build/cli/commands/task/task/handler.js +1 -1
- package/build/cli/commands/task/task/meta.js +1 -1
- package/build/cli/commands/task/update/handler.js +6 -11
- package/build/cli/commands/task/update/meta.js +4 -1
- package/build/cli/completion.js +1 -1
- package/build/cli/flags.js +37 -6
- package/build/cli/help.js +7 -14
- package/build/cli/index.js +112 -154
- package/build/cli/missing-subcommand.js +7 -0
- package/build/cli/output-stream-error-policy.js +19 -5
- package/build/cli/parse-flags.js +33 -7
- package/build/cli/parse-metadata.js +3 -9
- package/build/cli/parse-selectors.js +2 -1
- package/build/cli/parse.js +35 -5
- package/build/cli/projection-address.js +12 -12
- package/build/cli/render/address.js +41 -37
- package/build/cli/render/arc.js +24 -12
- package/build/cli/render/audit.js +121 -0
- 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 +58 -13
- package/build/cli/render/petition.js +20 -15
- package/build/cli/render/projection-activity.js +15 -6
- package/build/cli/render/shared.js +60 -21
- package/build/cli/render/skills.js +10 -0
- package/build/cli/render/status.js +56 -23
- package/build/cli/render/success-response.js +78 -0
- package/build/cli/render/task.js +66 -57
- package/build/cli/render/tell.js +5 -0
- package/build/cli/render/terminal-failure.js +63 -0
- package/build/cli/render/types.js +1 -0
- package/build/cli/render/wait.js +68 -38
- package/build/cli/types.js +1 -1
- package/build/config/akuma-loader.js +0 -5
- package/build/config/env-keys.js +3 -1
- package/build/config/env.js +3 -0
- 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 +61 -18
- package/build/core/arc.js +33 -73
- package/build/core/audit.js +650 -0
- 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 +22 -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 +22 -6
- package/build/core/draft.js +139 -19
- package/build/core/entry.js +3 -4
- 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/lex.js +2 -1
- 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 +41 -52
- package/build/core/projection/generation/model.js +63 -2
- 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} +36 -53
- 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} +9 -7
- 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} +19 -3
- package/build/core/projection/generation/store.js +3 -3
- package/build/core/projection/generation/transitions.js +19 -3
- 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} +13 -13
- 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} +37 -78
- 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} +16 -2
- package/build/core/{projection-mint.js → projection/projection-mint.js} +10 -10
- package/build/core/{projection-status.js → projection/projection-status.js} +163 -45
- package/build/core/projection/projection-terminal-failure.js +106 -0
- package/build/core/projection/projection-wait.js +275 -0
- package/build/core/projection/projection-wake.js +227 -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 +448 -102
- package/build/core/scope.js +272 -68
- package/build/core/seal.js +165 -40
- package/build/core/{claim-delivery.js → settlement/claim-delivery.js} +8 -8
- 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} +24 -49
- 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} +2 -2
- package/build/core/{petition.js → settlement/petition.js} +21 -12
- 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 +288 -0
- package/build/core/{verdict.js → settlement/verdict.js} +9 -37
- package/build/core/settlement/verification.js +59 -0
- package/build/core/status/board.js +62 -41
- package/build/core/status/ledger-batch.js +158 -0
- package/build/core/status/reconciliation.js +10 -4
- package/build/core/stored-agent-event.js +6 -2
- package/build/core/task/board.js +41 -4
- package/build/core/task/commands.js +45 -28
- package/build/core/task/document.js +5 -0
- package/build/core/task/index.js +12 -0
- package/build/core/task/model.js +8 -1
- package/build/core/task/query.js +172 -0
- package/build/core/task/settlement-git.js +265 -74
- package/build/core/task/settlement-policy.js +67 -29
- package/build/core/task/source-board.js +1 -0
- package/build/core/task/task-contract.js +444 -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} +90 -19
- package/build/core/task/task-repository.js +1 -0
- package/build/core/{task-store-repository.js → task/task-store-repository.js} +6 -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 +7 -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 +83 -39
- 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/diff/parsers.js +23 -13
- package/build/git/diff/structured.js +127 -0
- 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 +9 -9
- package/build/keiyaku.js +2 -36
- package/build/telemetry/logger.js +4 -2
- package/package.json +4 -10
- package/skills/keiyaku/SKILL.md +5 -4
- package/skills/keiyaku-akuma/SKILL.md +25 -11
- package/skills/keiyaku-task/SKILL.md +17 -8
- package/skills/keiyaku-workflow/SKILL.md +58 -9
- 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/agents/selector.js
CHANGED
|
@@ -5,35 +5,8 @@ import { resolveDefaultAgentName } from "../config/settings/knobs.js";
|
|
|
5
5
|
import { loadKeiyakuSettings } from "../config/settings/loader.js";
|
|
6
6
|
import { nativePolicyOwnership } from "../config/provider-policy-ownership.js";
|
|
7
7
|
import { FlowError } from "../flow-error.js";
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const SUPPORTED_EXPLICIT = {
|
|
11
|
-
"codex-sdk": {
|
|
12
|
-
access: new Set(ACCESS_VALUES),
|
|
13
|
-
network: new Set(NETWORK_VALUES),
|
|
14
|
-
webSearch: new Set(["disabled", "cached", "live"]),
|
|
15
|
-
},
|
|
16
|
-
"codex-app-server": {
|
|
17
|
-
access: new Set(["write"]),
|
|
18
|
-
network: new Set(NETWORK_VALUES),
|
|
19
|
-
webSearch: new Set(),
|
|
20
|
-
},
|
|
21
|
-
"claude-agent-sdk": {
|
|
22
|
-
access: new Set(ACCESS_VALUES),
|
|
23
|
-
network: new Set(),
|
|
24
|
-
webSearch: new Set(["disabled"]),
|
|
25
|
-
},
|
|
26
|
-
"opencode-sdk": {
|
|
27
|
-
access: new Set(),
|
|
28
|
-
network: new Set(),
|
|
29
|
-
webSearch: new Set(),
|
|
30
|
-
},
|
|
31
|
-
pi: {
|
|
32
|
-
access: new Set(),
|
|
33
|
-
network: new Set(),
|
|
34
|
-
webSearch: new Set(),
|
|
35
|
-
},
|
|
36
|
-
};
|
|
8
|
+
import { PROVIDER_PORTABLE_POLICY } from "./providers/registry.js";
|
|
9
|
+
const SUPPORTED_EXPLICIT = PROVIDER_PORTABLE_POLICY;
|
|
37
10
|
export function formatAvailableAgentNames(names) {
|
|
38
11
|
if (names.length === 0)
|
|
39
12
|
return "(none configured)";
|
package/build/agents/types.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
export const SUBAGENT_FAILURE_CODES = [
|
|
2
|
+
"SUBAGENT_TIMEOUT",
|
|
3
|
+
"SUBAGENT_TRANSPORT_ERROR",
|
|
4
|
+
"SUBAGENT_POLICY_BUDGET",
|
|
5
|
+
"SUBAGENT_NON_ZERO_EXIT",
|
|
6
|
+
"SUBAGENT_SPAWN_ERROR",
|
|
7
|
+
"SUBAGENT_EXEC_ERROR",
|
|
8
|
+
"SUBAGENT_PROVIDER_UNAVAILABLE",
|
|
9
|
+
];
|
|
10
|
+
export const OUTCOME_ERROR_VERSION = 1;
|
|
1
11
|
export class SubagentFailure extends Error {
|
|
2
12
|
code;
|
|
3
13
|
timeoutMs;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
export const KEIYAKU_DRAFT_DIR = path.join(".keiyaku", "draft");
|
|
3
|
+
export const RESPONSE_HISTORY_DIR = path.join(".keiyaku", "response");
|
|
4
|
+
export const KEIYAKU_ARTIFACT_DIRS = [KEIYAKU_DRAFT_DIR, RESPONSE_HISTORY_DIR];
|
|
5
|
+
function formatArtifactDirectory(directory) {
|
|
6
|
+
return `\`${directory}/\``;
|
|
7
|
+
}
|
|
8
|
+
export function formatArtifactDirectories(directories) {
|
|
9
|
+
const formatted = directories.map(formatArtifactDirectory);
|
|
10
|
+
if (formatted.length === 0)
|
|
11
|
+
return "";
|
|
12
|
+
if (formatted.length === 1)
|
|
13
|
+
return formatted[0];
|
|
14
|
+
if (formatted.length === 2)
|
|
15
|
+
return `${formatted[0]} and ${formatted[1]}`;
|
|
16
|
+
return `${formatted.slice(0, -1).join(", ")}, and ${formatted[formatted.length - 1]}`;
|
|
17
|
+
}
|
|
18
|
+
function buildArtifactNotice(directory) {
|
|
19
|
+
return `Auto-generated artifact. Add ${formatArtifactDirectory(directory)} to \`.gitignore\` if you do not want it tracked.`;
|
|
20
|
+
}
|
|
21
|
+
export const DRAFT_ARTIFACT_NOTICE = buildArtifactNotice(KEIYAKU_ARTIFACT_DIRS[0]);
|
|
22
|
+
export const RESPONSE_ARTIFACT_NOTICE = buildArtifactNotice(KEIYAKU_ARTIFACT_DIRS[1]);
|
|
@@ -2,7 +2,7 @@ export const meta = {
|
|
|
2
2
|
command: "akuma ls",
|
|
3
3
|
summary: "List Akuma profiles",
|
|
4
4
|
usage: ["keiyaku akuma ls [-C|--cwd DIR] [--repo DIR]"],
|
|
5
|
-
stdin: "
|
|
5
|
+
stdin: { mode: "argument" },
|
|
6
6
|
flags: ["cwd", "repo"],
|
|
7
7
|
purpose: "List configured helper profiles.",
|
|
8
8
|
notes: ["Project profiles override user profiles, which override builtins."],
|
|
@@ -2,12 +2,12 @@ import { FlowError } from "../../../../flow-error.js";
|
|
|
2
2
|
import { assertSettingsKnobUsable } from "../../../../config/settings/disease.js";
|
|
3
3
|
import { loadKeiyakuSettings } from "../../../../config/settings/loader.js";
|
|
4
4
|
import { loadAkumaCatalog } from "../../../../config/akuma-loader.js";
|
|
5
|
-
import { readProjectionStatusBoard } from "../../../../core/projection
|
|
5
|
+
import { readProjectionStatusBoard } from "../../../../core/projection/index.js";
|
|
6
6
|
import { isResponseArtifactId } from "../../../../core/response-artifact-id.js";
|
|
7
7
|
import { textResponse } from "../../../render/shared.js";
|
|
8
8
|
import { renderProjectionStatusSection } from "../../../render/status.js";
|
|
9
9
|
import { projectDirectory } from "../../shared.js";
|
|
10
|
-
import { renderAkumaShow } from "../../akuma.js";
|
|
10
|
+
import { renderAkumaShow, renderAkumaView } from "../../akuma.js";
|
|
11
11
|
const NONTERMINAL_PROJECTION_STATES = new Set([
|
|
12
12
|
"minting",
|
|
13
13
|
"startup-timeout",
|
|
@@ -28,7 +28,8 @@ export const handler = async (_stdin, flags, _signal, positional) => {
|
|
|
28
28
|
assertSettingsKnobUsable(loaded, "default");
|
|
29
29
|
assertSettingsKnobUsable(loaded, "reviewer");
|
|
30
30
|
const profile = renderAkumaShow(await loadAkumaCatalog(cwd), loaded.providerInstances, loaded.knobs, name).trimEnd();
|
|
31
|
-
const
|
|
31
|
+
const projectionStatus = await readProjectionStatusBoard(cwd, Date.now(), { showAll: true });
|
|
32
|
+
const rows = (projectionStatus?.rows ?? []).filter((row) => row.akuma === name && NONTERMINAL_PROJECTION_STATES.has(row.state));
|
|
32
33
|
const projections = renderProjectionStatusSection({ rows }).trimEnd();
|
|
33
|
-
return textResponse(
|
|
34
|
+
return textResponse(renderAkumaView(profile, projections));
|
|
34
35
|
};
|
|
@@ -2,7 +2,7 @@ export const meta = {
|
|
|
2
2
|
command: "akuma view",
|
|
3
3
|
summary: "View one Akuma profile",
|
|
4
4
|
usage: ["keiyaku akuma view NAME [-C|--cwd DIR] [--repo DIR]"],
|
|
5
|
-
stdin: "
|
|
5
|
+
stdin: { mode: "argument" },
|
|
6
6
|
flags: ["cwd", "repo"],
|
|
7
7
|
purpose: "Read one configured helper profile and its current nonterminal projections.",
|
|
8
8
|
};
|
|
@@ -140,6 +140,12 @@ export function renderAkumaList(catalog, providerInstances, settings) {
|
|
|
140
140
|
}
|
|
141
141
|
return lines.join("\n");
|
|
142
142
|
}
|
|
143
|
+
/** Compose profile inspection with an optional nonterminal projection section. */
|
|
144
|
+
export function renderAkumaView(profile, projectionsSection) {
|
|
145
|
+
return projectionsSection ? `${profile}
|
|
146
|
+
|
|
147
|
+
${projectionsSection}` : profile;
|
|
148
|
+
}
|
|
143
149
|
export function renderAkumaShow(catalog, providerInstances, settings, name) {
|
|
144
150
|
const candidate = catalog.selected[name];
|
|
145
151
|
if (candidate === undefined) {
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { amendKeiyaku } from "../../../../core/amend.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveExistingContractAddress } from "../../../../core/addressing.js";
|
|
3
|
+
import { buildAmendInput } from "../../../../core/amend.js";
|
|
3
4
|
import { buildAmendResponse } from "../../../render/arc.js";
|
|
4
5
|
import { renderCoreResult } from "../../../render/shared.js";
|
|
5
6
|
import { effectiveDirectory, repositoryDirectory } from "../../shared.js";
|
|
6
7
|
export const handler = async (stdin, flags) => {
|
|
7
8
|
const parsed = buildAmendInput(stdin, effectiveDirectory(flags), flags.contractId, flags.contractAddressSource);
|
|
8
9
|
const cwd = await repositoryDirectory(flags, "amend");
|
|
9
|
-
|
|
10
|
+
const address = await resolveExistingContractAddress(cwd, flags.contractId, flags.contractAddressSource, effectiveDirectory(flags));
|
|
11
|
+
return renderCoreResult(amendKeiyaku({
|
|
12
|
+
...parsed,
|
|
13
|
+
cwd,
|
|
14
|
+
address,
|
|
15
|
+
}), buildAmendResponse);
|
|
10
16
|
};
|
|
@@ -2,11 +2,11 @@ export const meta = {
|
|
|
2
2
|
command: "amend",
|
|
3
3
|
summary: "Record an amendment",
|
|
4
4
|
usage: [
|
|
5
|
-
"keiyaku amend [-C|--cwd DIR] [--repo DIR] [--contract ADDR] < amendment.md",
|
|
6
|
-
"keiyaku @addr amend [-C|--cwd DIR] [--repo DIR] < amendment.md",
|
|
5
|
+
"keiyaku amend [-C|--cwd DIR] [--repo DIR] [--contract ADDR] - < amendment.md",
|
|
6
|
+
"keiyaku @addr amend [-C|--cwd DIR] [--repo DIR] - < amendment.md",
|
|
7
7
|
],
|
|
8
|
-
stdin: "
|
|
8
|
+
stdin: { mode: "document", selector: { kind: "positional", index: 0, required: true, rejectBlank: true } },
|
|
9
9
|
flags: ["cwd", "repo", "contract"],
|
|
10
|
-
purpose: "Append a prose amendment and optional
|
|
10
|
+
purpose: "Append a prose amendment and optional Scope Append gitignore-pattern delta.",
|
|
11
11
|
completionRank: 8,
|
|
12
12
|
};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { arcKeiyaku, buildArcInput } from "../../../../core/arc.js";
|
|
2
|
+
import { resolveExistingContractAddress } from "../../../../core/addressing.js";
|
|
2
3
|
import { buildArcResponse } from "../../../render/arc.js";
|
|
3
4
|
import { renderCoreResult } from "../../../render/shared.js";
|
|
4
5
|
import { effectiveDirectory, repositoryDirectory } from "../../shared.js";
|
|
5
6
|
export const handler = async (stdin, flags) => {
|
|
6
|
-
const parsed = buildArcInput(stdin, effectiveDirectory(flags), flags.
|
|
7
|
+
const parsed = buildArcInput(stdin, effectiveDirectory(flags), flags.appendScope, flags.contractId, flags.contractAddressSource);
|
|
7
8
|
const cwd = await repositoryDirectory(flags, "arc");
|
|
8
|
-
|
|
9
|
+
const address = await resolveExistingContractAddress(cwd, flags.contractId, flags.contractAddressSource, effectiveDirectory(flags));
|
|
10
|
+
return renderCoreResult(arcKeiyaku({
|
|
11
|
+
...parsed,
|
|
12
|
+
cwd,
|
|
13
|
+
address,
|
|
14
|
+
}), buildArcResponse);
|
|
9
15
|
};
|
|
@@ -2,11 +2,11 @@ export const meta = {
|
|
|
2
2
|
command: "arc",
|
|
3
3
|
summary: "Optional iteration; seals current intent first",
|
|
4
4
|
usage: [
|
|
5
|
-
"keiyaku arc [-C|--cwd DIR] [--repo DIR] [--contract ADDR] [--
|
|
6
|
-
"keiyaku @addr arc [-C|--cwd DIR] [--repo DIR] [--
|
|
5
|
+
"keiyaku arc [-C|--cwd DIR] [--repo DIR] [--contract ADDR] [--append-scope PATTERN] - < arc.md",
|
|
6
|
+
"keiyaku @addr arc [-C|--cwd DIR] [--repo DIR] [--append-scope PATTERN] - < arc.md",
|
|
7
7
|
],
|
|
8
|
-
stdin: "
|
|
9
|
-
flags: ["cwd", "repo", "contract", "
|
|
8
|
+
stdin: { mode: "document", selector: { kind: "positional", index: 0, required: true, rejectBlank: true } },
|
|
9
|
+
flags: ["cwd", "repo", "contract", "append-scope"],
|
|
10
10
|
purpose: "Optional iteration boundary: record the next title, objective, and brief, and seal the current intent first.",
|
|
11
11
|
input: [
|
|
12
12
|
"# <arc title>",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { auditContract } from "../../../../core/audit.js";
|
|
2
|
+
import { resolveContractAddress, withResolvedAddress } from "../../../../core/addressing.js";
|
|
3
|
+
import { buildAuditConstructionFailure, buildAuditResponse } from "../../../render/audit.js";
|
|
4
|
+
import { effectiveDirectory, repositoryDirectory } from "../../shared.js";
|
|
5
|
+
export const handler = async (_stdin, flags) => {
|
|
6
|
+
try {
|
|
7
|
+
const cwd = await repositoryDirectory(flags, "audit");
|
|
8
|
+
const address = await resolveContractAddress(cwd, flags.contractId, flags.contractAddressSource, effectiveDirectory(flags));
|
|
9
|
+
return await withResolvedAddress(address, async () => {
|
|
10
|
+
return buildAuditResponse(await auditContract({ cwd, address, diffBudgetBytes: flags.auditDiffBudgetBytes }), flags.json === true);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
return buildAuditConstructionFailure(error, flags.json === true);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const meta = {
|
|
2
|
+
command: "audit",
|
|
3
|
+
summary: "Read settlement facts from one pinned delivery candidate",
|
|
4
|
+
usage: [
|
|
5
|
+
"keiyaku audit [-C|--cwd DIR] [--repo DIR] [--contract ADDR] [--diff-budget BYTES] [--json]",
|
|
6
|
+
"keiyaku @<id> audit [--diff-budget BYTES] [--json]",
|
|
7
|
+
],
|
|
8
|
+
stdin: { mode: "argument" },
|
|
9
|
+
flags: ["cwd", "repo", "contract", "diff-budget", "json"],
|
|
10
|
+
purpose: "Inspect one pinned delivery candidate, report settlement facts, and recheck its coordinates without mutating the source repository.",
|
|
11
|
+
notes: [
|
|
12
|
+
"Audit never invokes an Akuma or settles the contract.",
|
|
13
|
+
"Exit 0 means the report was constructed; exit 1 carries a typed construction cause.",
|
|
14
|
+
],
|
|
15
|
+
completionRank: 9,
|
|
16
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { bindContract } from "../../../../core/bind.js";
|
|
2
|
-
import { defaultActorClock } from "../../../../core/
|
|
2
|
+
import { defaultActorClock } from "../../../../core/outcome-base.js";
|
|
3
3
|
import { writeDraftArtifact } from "../../../draft-artifact.js";
|
|
4
4
|
import { buildBindDraftResponse, buildBindResponse, textResponse } from "../../../render/shared.js";
|
|
5
5
|
import { repositoryDirectory } from "../../shared.js";
|
|
6
|
-
export const handler = async (stdin, flags) => {
|
|
6
|
+
export const handler = async (stdin, flags, signal) => {
|
|
7
7
|
if (flags.dryRun) {
|
|
8
8
|
return textResponse(stdin);
|
|
9
9
|
}
|
|
@@ -14,7 +14,8 @@ export const handler = async (stdin, flags) => {
|
|
|
14
14
|
const result = await bindContract({
|
|
15
15
|
cwd, draft: stdin, ...defaultActorClock(), workspace: "worktree",
|
|
16
16
|
after: flags.after ?? [], exclusive: flags.exclusive,
|
|
17
|
-
...(flags.
|
|
17
|
+
...(flags.bindTaskIds === undefined ? {} : { taskIds: flags.bindTaskIds }),
|
|
18
|
+
signal,
|
|
18
19
|
onProgress: (line) => {
|
|
19
20
|
process.stdout.write(`${line}\n`);
|
|
20
21
|
},
|
|
@@ -2,14 +2,14 @@ export const meta = {
|
|
|
2
2
|
command: "bind",
|
|
3
3
|
summary: "Create a contract ledger and workspace files",
|
|
4
4
|
usage: [
|
|
5
|
-
"keiyaku bind [-C|--cwd DIR] [--repo DIR] [--task ID] <
|
|
6
|
-
"keiyaku bind [-C|--cwd DIR] [--repo DIR] [--task ID] --place NAME --objective TEXT --scope GLOB --checks CHECK [--dry-run]",
|
|
5
|
+
"keiyaku bind [-C|--cwd DIR] [--repo DIR] [--task ID]... [- < contract.md]",
|
|
6
|
+
"keiyaku bind [-C|--cwd DIR] [--repo DIR] [--task ID]... --place NAME --objective TEXT --scope GLOB --checks CHECK [--dry-run]",
|
|
7
7
|
],
|
|
8
|
-
stdin: "
|
|
8
|
+
stdin: { mode: "document", selector: { kind: "positional", index: 0, required: false, rejectBlank: false } },
|
|
9
9
|
flags: ["cwd", "repo", "after", "exclusive", "draft-only", "place", "objective", "scope", "checks", "task", "dry-run"],
|
|
10
10
|
// contract is parseable only so the mouth can reject it with bind-specific copy.
|
|
11
11
|
parseFlags: ["cwd", "repo", "contract", "after", "exclusive", "draft-only", "place", "objective", "scope", "checks", "task", "dry-run"],
|
|
12
|
-
purpose: "Bind a Keiyaku from
|
|
12
|
+
purpose: "Bind a Keiyaku from contract Markdown selected by literal -.",
|
|
13
13
|
input: [
|
|
14
14
|
"# <name>",
|
|
15
15
|
"",
|
|
@@ -17,14 +17,50 @@ export const meta = {
|
|
|
17
17
|
"<what the commission should accomplish>",
|
|
18
18
|
"",
|
|
19
19
|
"## Scope",
|
|
20
|
-
"
|
|
20
|
+
"```",
|
|
21
|
+
"<pattern>",
|
|
22
|
+
"<another-pattern>",
|
|
23
|
+
"```",
|
|
21
24
|
"",
|
|
22
25
|
"## Checks",
|
|
23
|
-
"- <
|
|
26
|
+
"- <verification>",
|
|
24
27
|
],
|
|
25
28
|
notes: [
|
|
26
|
-
"bind creates a
|
|
27
|
-
"
|
|
29
|
+
"bind creates a contract and does not accept @addr or --contract.",
|
|
30
|
+
"Primary document form is literal - followed by Markdown on stdin (full document below).",
|
|
31
|
+
"With --task, title and body supply name/objective defaults; literal - may send only the missing sections and any present section overrides the task default.",
|
|
32
|
+
"Domain flags remain available as a full-document alternative; they cannot mix with Markdown selected by literal -.",
|
|
33
|
+
],
|
|
34
|
+
examples: [
|
|
35
|
+
[
|
|
36
|
+
"keiyaku bind - <<'KEIYAKU'",
|
|
37
|
+
"# <name>",
|
|
38
|
+
"",
|
|
39
|
+
"## Objective",
|
|
40
|
+
"<what the commission should accomplish>",
|
|
41
|
+
"",
|
|
42
|
+
"## Scope",
|
|
43
|
+
"```",
|
|
44
|
+
"<pattern>",
|
|
45
|
+
"<another-pattern>",
|
|
46
|
+
"```",
|
|
47
|
+
"",
|
|
48
|
+
"## Checks",
|
|
49
|
+
"- <verification>",
|
|
50
|
+
"KEIYAKU",
|
|
51
|
+
].join("\n"),
|
|
52
|
+
[
|
|
53
|
+
"keiyaku bind --task fix-flaky-pump - <<'KEIYAKU'",
|
|
54
|
+
"## Scope",
|
|
55
|
+
"```",
|
|
56
|
+
"<pattern>",
|
|
57
|
+
"<another-pattern>",
|
|
58
|
+
"```",
|
|
59
|
+
"",
|
|
60
|
+
"## Checks",
|
|
61
|
+
"- <verification>",
|
|
62
|
+
"KEIYAKU",
|
|
63
|
+
].join("\n"),
|
|
28
64
|
],
|
|
29
65
|
completionRank: 0,
|
|
30
66
|
};
|
|
@@ -2,6 +2,7 @@ import { meta as bindMeta } from "./bind/meta.js";
|
|
|
2
2
|
import { meta as arcMeta } from "./arc/meta.js";
|
|
3
3
|
import { meta as logMeta } from "./log/meta.js";
|
|
4
4
|
import { meta as amendMeta } from "./amend/meta.js";
|
|
5
|
+
import { meta as auditMeta } from "./audit/meta.js";
|
|
5
6
|
import { meta as renewMeta } from "./renew/meta.js";
|
|
6
7
|
import { meta as petitionMeta } from "./petition/meta.js";
|
|
7
8
|
import { meta as forfeitMeta } from "./forfeit/meta.js";
|
|
@@ -10,6 +11,7 @@ export const contractCatalog = [
|
|
|
10
11
|
{ meta: arcMeta, load: () => import("./arc/handler.js") },
|
|
11
12
|
{ meta: logMeta, load: () => import("./log/handler.js") },
|
|
12
13
|
{ meta: amendMeta, load: () => import("./amend/handler.js") },
|
|
14
|
+
{ meta: auditMeta, load: () => import("./audit/handler.js") },
|
|
13
15
|
{ meta: renewMeta, load: () => import("./renew/handler.js") },
|
|
14
16
|
{ meta: petitionMeta, load: () => import("./petition/handler.js") },
|
|
15
17
|
{ meta: forfeitMeta, load: () => import("./forfeit/handler.js") },
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defaultActorClock } from "../../../../core/
|
|
1
|
+
import { resolveExistingContractAddress, withResolvedAddress } from "../../../../core/addressing.js";
|
|
2
|
+
import { defaultActorClock } from "../../../../core/outcome-base.js";
|
|
3
3
|
import { forfeitContractCommand } from "../../../../core/forfeit.js";
|
|
4
4
|
import { buildForfeitResponse } from "../../../render/shared.js";
|
|
5
|
-
import { repositoryDirectory } from "../../shared.js";
|
|
5
|
+
import { effectiveDirectory, repositoryDirectory } from "../../shared.js";
|
|
6
6
|
export const handler = async (_stdin, flags) => {
|
|
7
7
|
const cwd = await repositoryDirectory(flags, "forfeit");
|
|
8
|
-
const address = await
|
|
8
|
+
const address = await resolveExistingContractAddress(cwd, flags.contractId, flags.contractAddressSource, effectiveDirectory(flags));
|
|
9
9
|
return await withResolvedAddress(address, async () => buildForfeitResponse({
|
|
10
10
|
...await forfeitContractCommand({ cwd, contractId: address.binding.commissionId, ...defaultActorClock(), note: flags.reason }),
|
|
11
11
|
address,
|
|
@@ -5,7 +5,7 @@ export const meta = {
|
|
|
5
5
|
"keiyaku forfeit [-C|--cwd DIR] [--repo DIR] [--contract ADDR] [--reason TEXT]",
|
|
6
6
|
"keiyaku @addr forfeit [-C|--cwd DIR] [--repo DIR] [--reason TEXT]",
|
|
7
7
|
],
|
|
8
|
-
stdin: "
|
|
8
|
+
stdin: { mode: "argument" },
|
|
9
9
|
flags: ["cwd", "repo", "contract", "reason"],
|
|
10
10
|
purpose: "Record an abandoned contract without sealing it.",
|
|
11
11
|
completionRank: 11,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveExistingContractAddress, withResolvedAddress } from "../../../../core/addressing.js";
|
|
2
2
|
import { readContractLog } from "../../../../core/log.js";
|
|
3
3
|
import { buildLogResponse } from "../../../render/misc.js";
|
|
4
|
-
import { repositoryDirectory } from "../../shared.js";
|
|
4
|
+
import { effectiveDirectory, repositoryDirectory } from "../../shared.js";
|
|
5
5
|
export const handler = async (_stdin, flags) => {
|
|
6
6
|
const cwd = await repositoryDirectory(flags, "log");
|
|
7
|
-
const address = await
|
|
7
|
+
const address = await resolveExistingContractAddress(cwd, flags.contractId, flags.contractAddressSource, effectiveDirectory(flags));
|
|
8
8
|
return await withResolvedAddress(address, async () => {
|
|
9
9
|
const result = await readContractLog({ cwd, contractId: address.binding.commissionId });
|
|
10
10
|
return buildLogResponse({ ...result, address });
|
|
@@ -5,7 +5,7 @@ export const meta = {
|
|
|
5
5
|
"keiyaku log [-C|--cwd DIR] [--repo DIR] [--contract ADDR]",
|
|
6
6
|
"keiyaku @addr log [-C|--cwd DIR] [--repo DIR]",
|
|
7
7
|
],
|
|
8
|
-
stdin: "
|
|
8
|
+
stdin: { mode: "argument" },
|
|
9
9
|
flags: ["cwd", "repo", "contract"],
|
|
10
10
|
purpose: "Read a contract ledger.",
|
|
11
11
|
completionRank: 5,
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { FlowError } from "../../../../flow-error.js";
|
|
2
|
-
import {
|
|
3
|
-
import { buildPetitionClaimInput } from "../../../../core/
|
|
4
|
-
import { previewPetition } from "../../../../core/petition-preview.js";
|
|
5
|
-
import { petitionKeiyaku } from "../../../../core/petition-run.js";
|
|
2
|
+
import { resolveExistingContractAddress, withResolvedAddress } from "../../../../core/addressing.js";
|
|
3
|
+
import { buildPetitionClaimInput, petitionKeiyaku, previewPetition, } from "../../../../core/settlement/index.js";
|
|
6
4
|
import { buildPetitionClaimResponse, buildPetitionPreviewResponse } from "../../../render/petition.js";
|
|
7
|
-
import { repositoryDirectory } from "../../shared.js";
|
|
5
|
+
import { effectiveDirectory, repositoryDirectory } from "../../shared.js";
|
|
8
6
|
export const handler = async (stdin, flags, signal) => {
|
|
9
7
|
if (flags.json && !flags.dryRun) {
|
|
10
8
|
throw new FlowError("EMPTY_PARAM", "petition --json requires --dry-run");
|
|
11
9
|
}
|
|
12
10
|
const cwd = await repositoryDirectory(flags, "petition");
|
|
13
|
-
const address = await
|
|
11
|
+
const address = await resolveExistingContractAddress(cwd, flags.contractId, flags.contractAddressSource, effectiveDirectory(flags));
|
|
14
12
|
return await withResolvedAddress(address, async () => {
|
|
15
|
-
const input = buildPetitionClaimInput({ cwd, contractId: address.binding.commissionId, stdin, signal,
|
|
13
|
+
const input = buildPetitionClaimInput({ cwd, contractId: address.binding.commissionId, stdin, signal, appendScope: flags.appendScope });
|
|
16
14
|
if (flags.dryRun) {
|
|
17
15
|
return buildPetitionPreviewResponse(await previewPetition({
|
|
18
16
|
cwd,
|
|
19
17
|
contractId: address.binding.commissionId,
|
|
20
18
|
oath: input.oath,
|
|
21
|
-
waivePaths: flags.waivePaths,
|
|
22
19
|
}), flags.json === true);
|
|
23
20
|
}
|
|
24
21
|
return buildPetitionClaimResponse({ ...await petitionKeiyaku(input), address }, input);
|
|
@@ -2,19 +2,19 @@ export const meta = {
|
|
|
2
2
|
command: "petition",
|
|
3
3
|
summary: "Run or preview the gated settlement pipeline",
|
|
4
4
|
usage: [
|
|
5
|
-
"keiyaku petition [-C|--cwd DIR] [--repo DIR] [--contract ADDR] [--
|
|
6
|
-
"keiyaku @<id> petition [-C|--cwd DIR] [--repo DIR] [--
|
|
7
|
-
"keiyaku @<id> petition --dry-run [--json] [< petition.md]",
|
|
5
|
+
"keiyaku petition [-C|--cwd DIR] [--repo DIR] [--contract ADDR] [--append-scope PATTERN] [- < petition.md]",
|
|
6
|
+
"keiyaku @<id> petition [-C|--cwd DIR] [--repo DIR] [--append-scope PATTERN] [- < petition.md]",
|
|
7
|
+
"keiyaku @<id> petition --dry-run [--json] [- < petition.md]",
|
|
8
8
|
],
|
|
9
|
-
stdin: "
|
|
10
|
-
flags: ["cwd", "repo", "contract", "
|
|
9
|
+
stdin: { mode: "document", selector: { kind: "positional", index: 0, required: false, rejectBlank: false } },
|
|
10
|
+
flags: ["cwd", "repo", "contract", "append-scope", "dry-run", "json"],
|
|
11
11
|
purpose: "Seal the current a0 or open explicit arc, queue the contract, and run verdict and claim processing; dry-run previews deterministic gates without mutation.",
|
|
12
12
|
input: [
|
|
13
13
|
"## Oath",
|
|
14
14
|
"<free first-person attestation>",
|
|
15
15
|
],
|
|
16
16
|
notes: [
|
|
17
|
-
"Petition stdin is optional
|
|
17
|
+
"Petition stdin is optional and read only when literal - is supplied; a missing, empty, or blank oath is rejected by the settlement gate with OATH_MISSING.",
|
|
18
18
|
"The machine checks only that the oath is present. Accepted oath text is persisted in the petition entry and hidden from the reviewer.",
|
|
19
19
|
"Base drift requires explicit `keiyaku renew` before petition.",
|
|
20
20
|
"Dry-run never runs verification or review and exits 0, 1, or 2.",
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import { resolveContractAddress } from "../../../../core/addressing.js";
|
|
2
|
-
import { renewKeiyaku } from "../../../../core/renew.js";
|
|
3
|
-
import { buildRenewResponse } from "../../../render/arc.js";
|
|
1
|
+
import { resolveContractAddress, resolveExistingContractAddress } from "../../../../core/addressing.js";
|
|
2
|
+
import { abortRenewKeiyaku, continueRenewKeiyaku, renewKeiyaku } from "../../../../core/renew.js";
|
|
3
|
+
import { buildRenewAbortResponse, buildRenewResponse } from "../../../render/arc.js";
|
|
4
4
|
import { renderCoreResult } from "../../../render/shared.js";
|
|
5
|
-
import { repositoryDirectory } from "../../shared.js";
|
|
5
|
+
import { effectiveDirectory, repositoryDirectory } from "../../shared.js";
|
|
6
6
|
export const handler = async (_stdin, flags) => {
|
|
7
7
|
const cwd = await repositoryDirectory(flags, "renew");
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const resolveAddress = flags.renewContinue || flags.renewAbort
|
|
9
|
+
? resolveContractAddress
|
|
10
|
+
: resolveExistingContractAddress;
|
|
11
|
+
const address = await resolveAddress(cwd, flags.contractId, flags.contractAddressSource, effectiveDirectory(flags));
|
|
12
|
+
if (flags.renewContinue) {
|
|
13
|
+
return renderCoreResult(continueRenewKeiyaku({ cwd, address, appendScope: flags.appendScope }), buildRenewResponse);
|
|
14
|
+
}
|
|
15
|
+
if (flags.renewAbort) {
|
|
16
|
+
return renderCoreResult(abortRenewKeiyaku({ cwd, address }), buildRenewAbortResponse);
|
|
17
|
+
}
|
|
18
|
+
return renderCoreResult(renewKeiyaku({
|
|
19
|
+
cwd,
|
|
20
|
+
address,
|
|
21
|
+
appendScope: flags.appendScope,
|
|
22
|
+
resolveConflicts: flags.renewResolve,
|
|
23
|
+
}), buildRenewResponse);
|
|
10
24
|
};
|
|
@@ -2,16 +2,17 @@ export const meta = {
|
|
|
2
2
|
command: "renew",
|
|
3
3
|
summary: "Rewrite delivery onto the current base",
|
|
4
4
|
usage: [
|
|
5
|
-
"keiyaku renew [-C|--cwd DIR] [--repo DIR] [--contract ADDR] [--
|
|
6
|
-
"keiyaku @<id> renew
|
|
5
|
+
"keiyaku renew [-C|--cwd DIR] [--repo DIR] [--contract ADDR] [--append-scope PATTERN] [--resolve]",
|
|
6
|
+
"keiyaku @<id> renew --continue [--append-scope PATTERN]",
|
|
7
|
+
"keiyaku @<id> renew --abort",
|
|
7
8
|
],
|
|
8
|
-
stdin: "
|
|
9
|
-
flags: ["cwd", "repo", "contract", "
|
|
9
|
+
stdin: { mode: "argument" },
|
|
10
|
+
flags: ["cwd", "repo", "contract", "append-scope", "resolve", "continue", "abort"],
|
|
10
11
|
purpose: "Capture receipts, rewrite delivery onto the default branch, then seal the current a0 or open explicit arc and record the renewal.",
|
|
11
12
|
notes: [
|
|
12
13
|
"After an explicit arc closes, refuses loose commits until another arc is open.",
|
|
13
14
|
"Refuses while an Akuma is in flight.",
|
|
14
|
-
"
|
|
15
|
+
"Ordinary conflicts restore the delivery branch and worktree without ledger writes; --resolve opens an owned session for --continue or --abort.",
|
|
15
16
|
],
|
|
16
17
|
completionRank: 9,
|
|
17
18
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { meta as bindMeta } from "./contract/bind/meta.js";
|
|
2
|
+
import { meta as arcMeta } from "./contract/arc/meta.js";
|
|
3
|
+
import { meta as callMeta } from "./projection/call/meta.js";
|
|
4
|
+
import { meta as reviveMeta } from "./projection/revive/meta.js";
|
|
5
|
+
import { meta as waitMeta } from "./projection/wait/meta.js";
|
|
6
|
+
import { meta as tellMeta } from "./projection/tell/meta.js";
|
|
7
|
+
import { meta as killMeta } from "./projection/kill/meta.js";
|
|
8
|
+
import { meta as logMeta } from "./contract/log/meta.js";
|
|
9
|
+
import { meta as akumaMeta } from "./akuma/akuma/meta.js";
|
|
10
|
+
import { meta as akumaLsMeta } from "./akuma/list/meta-ls.js";
|
|
11
|
+
import { meta as akumaViewMeta } from "./akuma/view/meta.js";
|
|
12
|
+
import { meta as skillsMeta } from "./skills/skills/meta.js";
|
|
13
|
+
import { meta as skillsInstallMeta } from "./skills/install/meta.js";
|
|
14
|
+
import { meta as amendMeta } from "./contract/amend/meta.js";
|
|
15
|
+
import { meta as auditMeta } from "./contract/audit/meta.js";
|
|
16
|
+
import { meta as renewMeta } from "./contract/renew/meta.js";
|
|
17
|
+
import { meta as petitionMeta } from "./contract/petition/meta.js";
|
|
18
|
+
import { meta as forfeitMeta } from "./contract/forfeit/meta.js";
|
|
19
|
+
import { meta as guideMeta } from "./system/guide/meta.js";
|
|
20
|
+
import { meta as completionMeta } from "./system/completion/meta.js";
|
|
21
|
+
import { meta as statusMeta } from "./projection/status/meta.js";
|
|
22
|
+
import { meta as taskMeta } from "./task/task/meta.js";
|
|
23
|
+
import { meta as taskAddMeta } from "./task/add/meta.js";
|
|
24
|
+
import { meta as taskShowMeta } from "./task/show/meta.js";
|
|
25
|
+
import { meta as taskLsMeta } from "./task/ls/meta.js";
|
|
26
|
+
import { meta as taskStartMeta } from "./task/start/meta.js";
|
|
27
|
+
import { meta as taskStopMeta } from "./task/stop/meta.js";
|
|
28
|
+
import { meta as taskDoneMeta } from "./task/done/meta.js";
|
|
29
|
+
import { meta as taskDropMeta } from "./task/drop/meta.js";
|
|
30
|
+
import { meta as taskUpdateMeta } from "./task/update/meta.js";
|
|
31
|
+
import { meta as taskDoctorMeta } from "./task/doctor/meta.js";
|
|
32
|
+
import { meta as dumpEnvMeta } from "./system/dump-env/meta.js";
|
|
33
|
+
export const COMMAND_METADATA_ORDER = [
|
|
34
|
+
"bind", "arc", "call", "revive", "wait", "tell", "kill", "log",
|
|
35
|
+
"akuma", "akuma ls", "akuma view", "skills", "skills install", "amend", "audit",
|
|
36
|
+
"renew", "petition", "forfeit", "guide", "completion", "status", "task",
|
|
37
|
+
"task add", "task show", "task ls", "task start", "task stop", "task done",
|
|
38
|
+
"task drop", "task update", "task doctor", "dump-env",
|
|
39
|
+
];
|
|
40
|
+
const COMMAND_METADATA = [
|
|
41
|
+
bindMeta, arcMeta, callMeta, reviveMeta, waitMeta, tellMeta, killMeta, logMeta,
|
|
42
|
+
akumaMeta, akumaLsMeta, akumaViewMeta, skillsMeta, skillsInstallMeta, amendMeta, auditMeta,
|
|
43
|
+
renewMeta, petitionMeta, forfeitMeta, guideMeta, completionMeta, statusMeta,
|
|
44
|
+
taskMeta, taskAddMeta, taskShowMeta, taskLsMeta, taskStartMeta, taskStopMeta,
|
|
45
|
+
taskDoneMeta, taskDropMeta, taskUpdateMeta, taskDoctorMeta, dumpEnvMeta,
|
|
46
|
+
];
|
|
47
|
+
export const CLI_COMMAND_METADATA = Object.fromEntries(COMMAND_METADATA.map((meta) => [meta.command, meta]));
|
|
48
|
+
export function getCommandMetadata(command) {
|
|
49
|
+
return CLI_COMMAND_METADATA[command];
|
|
50
|
+
}
|
|
51
|
+
export function allCommandMetadata() {
|
|
52
|
+
return COMMAND_METADATA_ORDER.map((command) => CLI_COMMAND_METADATA[command]);
|
|
53
|
+
}
|
|
54
|
+
export function commandParseOrder() {
|
|
55
|
+
return [...COMMAND_METADATA_ORDER].sort((a, b) => {
|
|
56
|
+
const tokenDelta = b.split(" ").length - a.split(" ").length;
|
|
57
|
+
return tokenDelta !== 0 ? tokenDelta : COMMAND_METADATA_ORDER.indexOf(a) - COMMAND_METADATA_ORDER.indexOf(b);
|
|
58
|
+
});
|
|
59
|
+
}
|