@imricci/zaker 0.1.0
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/dist/commands/align.d.ts +3 -0
- package/dist/commands/align.js +28 -0
- package/dist/commands/align.js.map +1 -0
- package/dist/commands/audit.d.ts +3 -0
- package/dist/commands/audit.js +59 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/confirm.d.ts +3 -0
- package/dist/commands/confirm.js +22 -0
- package/dist/commands/confirm.js.map +1 -0
- package/dist/commands/dialog.d.ts +9 -0
- package/dist/commands/dialog.js +396 -0
- package/dist/commands/dialog.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.js +31 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/models.d.ts +9 -0
- package/dist/commands/models.js +65 -0
- package/dist/commands/models.js.map +1 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.js +69 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/run.d.ts +40 -0
- package/dist/commands/run.js +310 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +39 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/tui.d.ts +14 -0
- package/dist/commands/tui.js +394 -0
- package/dist/commands/tui.js.map +1 -0
- package/dist/core/auditor.d.ts +13 -0
- package/dist/core/auditor.js +122 -0
- package/dist/core/auditor.js.map +1 -0
- package/dist/core/c3fi.d.ts +10 -0
- package/dist/core/c3fi.js +305 -0
- package/dist/core/c3fi.js.map +1 -0
- package/dist/core/challenge.d.ts +8 -0
- package/dist/core/challenge.js +29 -0
- package/dist/core/challenge.js.map +1 -0
- package/dist/core/checkpoint.d.ts +20 -0
- package/dist/core/checkpoint.js +192 -0
- package/dist/core/checkpoint.js.map +1 -0
- package/dist/core/execution-provider.d.ts +2 -0
- package/dist/core/execution-provider.js +125 -0
- package/dist/core/execution-provider.js.map +1 -0
- package/dist/core/executor.d.ts +16 -0
- package/dist/core/executor.js +68 -0
- package/dist/core/executor.js.map +1 -0
- package/dist/core/memory.d.ts +11 -0
- package/dist/core/memory.js +105 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/planner.d.ts +146 -0
- package/dist/core/planner.js +152 -0
- package/dist/core/planner.js.map +1 -0
- package/dist/core/preflight.d.ts +6 -0
- package/dist/core/preflight.js +140 -0
- package/dist/core/preflight.js.map +1 -0
- package/dist/core/provider-onboarding.d.ts +12 -0
- package/dist/core/provider-onboarding.js +32 -0
- package/dist/core/provider-onboarding.js.map +1 -0
- package/dist/core/run-loop.d.ts +32 -0
- package/dist/core/run-loop.js +205 -0
- package/dist/core/run-loop.js.map +1 -0
- package/dist/core/scope.d.ts +3 -0
- package/dist/core/scope.js +75 -0
- package/dist/core/scope.js.map +1 -0
- package/dist/core/types.d.ts +288 -0
- package/dist/core/types.js +11 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/verdict-panel.d.ts +29 -0
- package/dist/core/verdict-panel.js +120 -0
- package/dist/core/verdict-panel.js.map +1 -0
- package/dist/core/verifier.d.ts +2 -0
- package/dist/core/verifier.js +47 -0
- package/dist/core/verifier.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/config.d.ts +36 -0
- package/dist/infra/config.js +397 -0
- package/dist/infra/config.js.map +1 -0
- package/dist/infra/git.d.ts +6 -0
- package/dist/infra/git.js +35 -0
- package/dist/infra/git.js.map +1 -0
- package/dist/infra/hashing.d.ts +1 -0
- package/dist/infra/hashing.js +8 -0
- package/dist/infra/hashing.js.map +1 -0
- package/dist/infra/intent.d.ts +30 -0
- package/dist/infra/intent.js +357 -0
- package/dist/infra/intent.js.map +1 -0
- package/dist/infra/memory.d.ts +10 -0
- package/dist/infra/memory.js +94 -0
- package/dist/infra/memory.js.map +1 -0
- package/dist/infra/model-catalog.d.ts +27 -0
- package/dist/infra/model-catalog.js +273 -0
- package/dist/infra/model-catalog.js.map +1 -0
- package/dist/infra/process.d.ts +12 -0
- package/dist/infra/process.js +32 -0
- package/dist/infra/process.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runAlign = runAlign;
|
|
7
|
+
exports.registerAlignCommand = registerAlignCommand;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const config_1 = require("../infra/config");
|
|
10
|
+
const intent_1 = require("../infra/intent");
|
|
11
|
+
async function runAlign(description, cwd = process.cwd()) {
|
|
12
|
+
const config = await (0, config_1.readConfig)(cwd);
|
|
13
|
+
const draft = await (0, intent_1.alignIntent)(description, config.scope, cwd);
|
|
14
|
+
console.log(chalk_1.default.green(`intent aligned: ${draft.intent_id} (state=ALIGN, allowed_paths=${draft.scope.allowed_paths.join(",")})`));
|
|
15
|
+
}
|
|
16
|
+
function registerAlignCommand(program) {
|
|
17
|
+
program
|
|
18
|
+
.command("align <description...>")
|
|
19
|
+
.description("update draft intent card in ALIGN state")
|
|
20
|
+
.action(async (descriptionParts) => {
|
|
21
|
+
const description = descriptionParts.join(" ").trim();
|
|
22
|
+
if (!description) {
|
|
23
|
+
throw new Error("Description is required.");
|
|
24
|
+
}
|
|
25
|
+
await runAlign(description);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=align.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align.js","sourceRoot":"","sources":["../../src/commands/align.ts"],"names":[],"mappings":";;;;;AAKA,4BAQC;AAED,oDAWC;AA1BD,kDAA0B;AAE1B,4CAA6C;AAC7C,4CAA8C;AAEvC,KAAK,UAAU,QAAQ,CAAC,WAAmB,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IACrE,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAU,EAAC,GAAG,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,MAAM,IAAA,oBAAW,EAAC,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,KAAK,CACT,mBAAmB,KAAK,CAAC,SAAS,gCAAgC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CACzG,CACF,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,wBAAwB,CAAC;SACjC,WAAW,CAAC,yCAAyC,CAAC;SACtD,MAAM,CAAC,KAAK,EAAE,gBAA0B,EAAE,EAAE;QAC3C,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACtD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QACD,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runAudit = runAudit;
|
|
7
|
+
exports.registerAuditCommand = registerAuditCommand;
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const auditor_1 = require("../core/auditor");
|
|
12
|
+
const checkpoint_1 = require("../core/checkpoint");
|
|
13
|
+
const provider_onboarding_1 = require("../core/provider-onboarding");
|
|
14
|
+
const config_1 = require("../infra/config");
|
|
15
|
+
function printAudit(interpretation) {
|
|
16
|
+
const status = interpretation.verdict;
|
|
17
|
+
if (status === "PASS") {
|
|
18
|
+
console.log(chalk_1.default.green(status));
|
|
19
|
+
}
|
|
20
|
+
else if (status === "CHALLENGE") {
|
|
21
|
+
console.log(chalk_1.default.yellow(status));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log(chalk_1.default.red(status));
|
|
25
|
+
}
|
|
26
|
+
for (const line of interpretation.lines.slice(1)) {
|
|
27
|
+
console.log(line);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function runAudit(checkpointPath = "checkpoint.json", cwd = process.cwd()) {
|
|
31
|
+
const config = await (0, config_1.readConfig)(cwd);
|
|
32
|
+
const onboarding = await (0, provider_onboarding_1.ensureProviderOnboarding)(config);
|
|
33
|
+
if (onboarding.required) {
|
|
34
|
+
console.log(chalk_1.default.gray(`provider: READY (${onboarding.provider}, catalog=${onboarding.catalog_size}, planner=${onboarding.selected.planner}, auditor=${onboarding.selected.auditor})`));
|
|
35
|
+
}
|
|
36
|
+
const provider = (0, config_1.createLLMProvider)(config);
|
|
37
|
+
const checkpointRaw = await (0, promises_1.readFile)((0, node_path_1.resolve)(cwd, checkpointPath), "utf8");
|
|
38
|
+
const checkpoint = (0, checkpoint_1.normalizeCheckpoint)(JSON.parse(checkpointRaw));
|
|
39
|
+
const preconditionResult = (0, auditor_1.guardCheckpointForAudit)(checkpoint);
|
|
40
|
+
if (preconditionResult) {
|
|
41
|
+
printAudit(preconditionResult);
|
|
42
|
+
process.exitCode = preconditionResult.exitCode;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const auditResult = await provider.audit(checkpoint);
|
|
46
|
+
const interpretation = (0, auditor_1.interpretAuditResult)(auditResult, { allowChallenge: true });
|
|
47
|
+
printAudit(interpretation);
|
|
48
|
+
process.exitCode = interpretation.exitCode;
|
|
49
|
+
}
|
|
50
|
+
function registerAuditCommand(program) {
|
|
51
|
+
program
|
|
52
|
+
.command("audit")
|
|
53
|
+
.description("upload checkpoint and get verdict")
|
|
54
|
+
.option("-c, --checkpoint <path>", "checkpoint input path", "checkpoint.json")
|
|
55
|
+
.action(async (options) => {
|
|
56
|
+
await runAudit(options.checkpoint);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":";;;;;AAwBA,4BAwBC;AAED,oDAQC;AA1DD,+CAA4C;AAC5C,yCAAoC;AACpC,kDAA0B;AAE1B,6CAAkG;AAClG,mDAAyD;AACzD,qEAAuE;AACvE,4CAAgE;AAEhE,SAAS,UAAU,CAAC,cAAgC;IAClD,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;IACtC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACnC,CAAC;SAAM,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,QAAQ,CAAC,cAAc,GAAG,iBAAiB,EAAE,GAAG,GA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IACnD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,mCAAmC,CAAC;SAChD,MAAM,CAAC,yBAAyB,EAAE,uBAAuB,EAAE,iBAAiB,CAAC;SAC7E,MAAM,CAAC,KAAK,EAAE,OAA+B,EAAE,EAAE;QAChD,MAAM,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runConfirm = runConfirm;
|
|
7
|
+
exports.registerConfirmCommand = registerConfirmCommand;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const intent_1 = require("../infra/intent");
|
|
10
|
+
async function runConfirm(cwd = process.cwd()) {
|
|
11
|
+
const { intent, binding } = await (0, intent_1.confirmIntent)(cwd);
|
|
12
|
+
console.log(chalk_1.default.green(`intent confirmed: ${intent.intent_id} (state=READY, intent_sha256=${binding.intent_sha256})`));
|
|
13
|
+
}
|
|
14
|
+
function registerConfirmCommand(program) {
|
|
15
|
+
program
|
|
16
|
+
.command("confirm")
|
|
17
|
+
.description("freeze current intent.card into intent.confirmed and switch to READY")
|
|
18
|
+
.action(async () => {
|
|
19
|
+
await runConfirm();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=confirm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../src/commands/confirm.ts"],"names":[],"mappings":";;;;;AAIA,gCAOC;AAED,wDAOC;AApBD,kDAA0B;AAE1B,4CAAgD;AAEzC,KAAK,UAAU,UAAU,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAClD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,sBAAa,EAAC,GAAG,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,KAAK,CACT,qBAAqB,MAAM,CAAC,SAAS,gCAAgC,OAAO,CAAC,aAAa,GAAG,CAC9F,CACF,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAAgB;IACrD,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,sEAAsE,CAAC;SACnF,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,UAAU,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export interface DialogueSessionOptions {
|
|
3
|
+
script?: string[];
|
|
4
|
+
quiet?: boolean;
|
|
5
|
+
sopOut?: string;
|
|
6
|
+
checkpointOut?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function runDialogueSession(cwd?: string, options?: DialogueSessionOptions): Promise<void>;
|
|
9
|
+
export declare function registerDialogCommand(program: Command): void;
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runDialogueSession = runDialogueSession;
|
|
7
|
+
exports.registerDialogCommand = registerDialogCommand;
|
|
8
|
+
const node_readline_1 = __importDefault(require("node:readline"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const verdict_panel_1 = require("../core/verdict-panel");
|
|
11
|
+
const config_1 = require("../infra/config");
|
|
12
|
+
const intent_1 = require("../infra/intent");
|
|
13
|
+
const run_1 = require("./run");
|
|
14
|
+
const MAX_DIALOG_HISTORY = 200;
|
|
15
|
+
const MAX_DIALOG_ROUNDS = 50;
|
|
16
|
+
const MAX_SCREEN_HISTORY = 14;
|
|
17
|
+
function now() {
|
|
18
|
+
return new Date().toISOString();
|
|
19
|
+
}
|
|
20
|
+
function helpText() {
|
|
21
|
+
return "commands: /confirm | /run | /edit <text> | /status | /debug on|off | /help | /exit";
|
|
22
|
+
}
|
|
23
|
+
function compactLine(input, maxLength = 120) {
|
|
24
|
+
const singleLine = input.replace(/\s+/g, " ").trim();
|
|
25
|
+
if (singleLine.length <= maxLength) {
|
|
26
|
+
return singleLine;
|
|
27
|
+
}
|
|
28
|
+
return `${singleLine.slice(0, maxLength - 3)}...`;
|
|
29
|
+
}
|
|
30
|
+
function divider(width = 80) {
|
|
31
|
+
return "─".repeat(width);
|
|
32
|
+
}
|
|
33
|
+
function toSessionWithDialog(session) {
|
|
34
|
+
const dialog = session.dialog ?? {
|
|
35
|
+
debug: false,
|
|
36
|
+
turn: 0,
|
|
37
|
+
rounds: [],
|
|
38
|
+
history: []
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
...session,
|
|
42
|
+
dialog: {
|
|
43
|
+
...dialog,
|
|
44
|
+
rounds: [...dialog.rounds],
|
|
45
|
+
history: [...dialog.history]
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
async function requireSessionWithDialog(cwd) {
|
|
50
|
+
const session = await (0, intent_1.readSessionStore)(cwd);
|
|
51
|
+
if (!session) {
|
|
52
|
+
throw new Error("Missing .molo/session.json. Run `zaker init` first.");
|
|
53
|
+
}
|
|
54
|
+
const normalized = toSessionWithDialog(session);
|
|
55
|
+
await (0, intent_1.writeSessionStore)(normalized, cwd);
|
|
56
|
+
return normalized;
|
|
57
|
+
}
|
|
58
|
+
async function mutateDialogSession(cwd, updater) {
|
|
59
|
+
const current = await requireSessionWithDialog(cwd);
|
|
60
|
+
const next = updater(current);
|
|
61
|
+
const normalized = toSessionWithDialog(next);
|
|
62
|
+
await (0, intent_1.writeSessionStore)(normalized, cwd);
|
|
63
|
+
return normalized;
|
|
64
|
+
}
|
|
65
|
+
async function appendDialogEntry(cwd, role, kind, content) {
|
|
66
|
+
const text = content.trim();
|
|
67
|
+
if (!text) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
await mutateDialogSession(cwd, (session) => {
|
|
71
|
+
const normalized = toSessionWithDialog(session);
|
|
72
|
+
const turn = normalized.dialog.turn + 1;
|
|
73
|
+
normalized.dialog.turn = turn;
|
|
74
|
+
normalized.dialog.history = [
|
|
75
|
+
...normalized.dialog.history,
|
|
76
|
+
{
|
|
77
|
+
turn,
|
|
78
|
+
timestamp: now(),
|
|
79
|
+
role,
|
|
80
|
+
kind,
|
|
81
|
+
content: text
|
|
82
|
+
}
|
|
83
|
+
].slice(-MAX_DIALOG_HISTORY);
|
|
84
|
+
normalized.updated_at = now();
|
|
85
|
+
return normalized;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async function buildSessionStatusLines(cwd) {
|
|
89
|
+
const session = await requireSessionWithDialog(cwd);
|
|
90
|
+
const draft = await (0, intent_1.readIntentCard)(cwd);
|
|
91
|
+
const rounds = session.dialog?.rounds ?? [];
|
|
92
|
+
const lines = [
|
|
93
|
+
`state: ${session.state}`,
|
|
94
|
+
`current_intent_id: ${session.current_intent_id ?? "-"}`,
|
|
95
|
+
`debug: ${session.dialog?.debug ? "on" : "off"}`,
|
|
96
|
+
`history_turns: ${session.dialog?.history.length ?? 0}`,
|
|
97
|
+
`intent.card: ${draft ? `${draft.intent_id} (${draft.status})` : "-"}`
|
|
98
|
+
];
|
|
99
|
+
if (rounds.length > 0) {
|
|
100
|
+
lines.push("recent_rounds:");
|
|
101
|
+
for (const item of rounds.slice(-5)) {
|
|
102
|
+
lines.push(`- #${item.round} verdict=${item.verdict} reason=${item.reason_code} checkpoint=${item.checkpoint_id ?? "-"}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return lines;
|
|
106
|
+
}
|
|
107
|
+
async function upsertDraftIntent(cwd, content, replace = false) {
|
|
108
|
+
const text = content.trim();
|
|
109
|
+
if (!text) {
|
|
110
|
+
throw new Error("Intent text cannot be empty.");
|
|
111
|
+
}
|
|
112
|
+
const config = await (0, config_1.readConfig)(cwd);
|
|
113
|
+
const existing = await (0, intent_1.readIntentCard)(cwd);
|
|
114
|
+
const nextDescription = replace || !existing?.goal?.trim()
|
|
115
|
+
? text
|
|
116
|
+
: `${existing.goal.trim()}\n${text}`;
|
|
117
|
+
const intent = await (0, intent_1.alignIntent)(nextDescription, config.scope, cwd);
|
|
118
|
+
return `intent.card updated: ${intent.intent_id} (state=ALIGN)`;
|
|
119
|
+
}
|
|
120
|
+
function printVerdictLines(lines, verdict) {
|
|
121
|
+
const first = lines[0] ?? verdict;
|
|
122
|
+
if (verdict === "PASS") {
|
|
123
|
+
console.log(chalk_1.default.green(first));
|
|
124
|
+
}
|
|
125
|
+
else if (verdict === "CHALLENGE") {
|
|
126
|
+
console.log(chalk_1.default.yellow(first));
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
console.log(chalk_1.default.red(first));
|
|
130
|
+
}
|
|
131
|
+
for (const line of lines.slice(1)) {
|
|
132
|
+
console.log(line);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function summarizeVerdict(output, debug) {
|
|
136
|
+
const checkpoint = output.checkpoint;
|
|
137
|
+
const panel = (0, verdict_panel_1.buildVerdictPanel)(output.finalAuditResult, checkpoint);
|
|
138
|
+
const testsLabel = `${panel.test_status} (${panel.tests_passed}/${panel.tests_total})`;
|
|
139
|
+
const lines = [
|
|
140
|
+
panel.verdict,
|
|
141
|
+
`Rule Hits: ${panel.rule_hits.join(", ") || "-"}`,
|
|
142
|
+
`Changed Files: ${panel.changed_files}`,
|
|
143
|
+
`Test Status: ${testsLabel}`,
|
|
144
|
+
`Risk Hit: ${panel.risk_hit}`,
|
|
145
|
+
`Audit: ${panel.audit_conclusion}`,
|
|
146
|
+
`Retry: ${panel.retry_allowed ? "YES" : "NO"} (${panel.retry_reason})`,
|
|
147
|
+
"Skills:",
|
|
148
|
+
...panel.skill_statuses.map((item) => `- ${item.skill}: ${item.status} (${item.detail})`),
|
|
149
|
+
"Evidence Refs:",
|
|
150
|
+
...panel.evidence_refs.map((ref) => `- ${ref}`)
|
|
151
|
+
];
|
|
152
|
+
if (panel.verdict === "CHALLENGE") {
|
|
153
|
+
lines.push(`Challenge Type: ${panel.challenge_type ?? "-"}`);
|
|
154
|
+
lines.push("Objections:");
|
|
155
|
+
lines.push(...panel.objections.map((item) => `- ${item}`));
|
|
156
|
+
lines.push("Required Evidence:");
|
|
157
|
+
lines.push(...panel.required_evidence.map((item) => `- ${item}`));
|
|
158
|
+
}
|
|
159
|
+
if (panel.verdict === "FAIL") {
|
|
160
|
+
lines.push(`Reason Code: ${panel.reason_code}`);
|
|
161
|
+
}
|
|
162
|
+
if (debug) {
|
|
163
|
+
lines.push("Debug: raw final audit");
|
|
164
|
+
lines.push(JSON.stringify(output.finalAuditResult, null, 2));
|
|
165
|
+
lines.push("Debug: raw checkpoint");
|
|
166
|
+
lines.push(JSON.stringify(output.checkpoint ?? null, null, 2));
|
|
167
|
+
lines.push("Debug: raw model traces");
|
|
168
|
+
lines.push(JSON.stringify(output.modelTraces, null, 2));
|
|
169
|
+
}
|
|
170
|
+
const historyEntry = [
|
|
171
|
+
`verdict=${panel.verdict}`,
|
|
172
|
+
`rule=${panel.trigger_rule}`,
|
|
173
|
+
`tests=${testsLabel}`,
|
|
174
|
+
`risk=${panel.risk_hit}`,
|
|
175
|
+
`retry=${panel.retry_allowed ? "YES" : "NO"}`
|
|
176
|
+
].join(" | ");
|
|
177
|
+
return { lines, historyEntry };
|
|
178
|
+
}
|
|
179
|
+
async function renderDialogueScreen(cwd, notice) {
|
|
180
|
+
const session = await requireSessionWithDialog(cwd);
|
|
181
|
+
const draft = await (0, intent_1.readIntentCard)(cwd);
|
|
182
|
+
const history = session.dialog?.history ?? [];
|
|
183
|
+
const rounds = session.dialog?.rounds ?? [];
|
|
184
|
+
const lastRound = rounds.at(-1);
|
|
185
|
+
const lines = [];
|
|
186
|
+
lines.push(chalk_1.default.bold("MOLO Agent TUI"));
|
|
187
|
+
lines.push(chalk_1.default.gray(`state=${session.state} | debug=${session.dialog?.debug ? "on" : "off"} | turns=${history.length} | rounds=${rounds.length}`));
|
|
188
|
+
lines.push(chalk_1.default.gray(helpText()));
|
|
189
|
+
lines.push(divider());
|
|
190
|
+
lines.push(chalk_1.default.bold("Conversation"));
|
|
191
|
+
if (history.length === 0) {
|
|
192
|
+
lines.push(chalk_1.default.gray("(empty) 输入需求文本以更新 intent.card,然后 /confirm -> /run"));
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
for (const entry of history.slice(-MAX_SCREEN_HISTORY)) {
|
|
196
|
+
const role = entry.role === "user" ? "YOU " : "MOLO";
|
|
197
|
+
const kind = entry.kind.toUpperCase().padEnd(7, " ");
|
|
198
|
+
lines.push(`${chalk_1.default.cyan(role)} [${kind}] ${compactLine(entry.content, 180)}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
lines.push(divider());
|
|
202
|
+
lines.push(chalk_1.default.bold("Intent"));
|
|
203
|
+
lines.push(`intent_id: ${draft?.intent_id ?? session.current_intent_id ?? "-"}`);
|
|
204
|
+
lines.push(`goal: ${compactLine(draft?.goal ?? "-", 180)}`);
|
|
205
|
+
if (lastRound) {
|
|
206
|
+
lines.push(`last_round: #${lastRound.round} ${lastRound.verdict} (${lastRound.reason_code}) checkpoint=${lastRound.checkpoint_id ?? "-"}`);
|
|
207
|
+
}
|
|
208
|
+
if (notice) {
|
|
209
|
+
lines.push(chalk_1.default.yellow(`notice: ${notice}`));
|
|
210
|
+
}
|
|
211
|
+
lines.push("");
|
|
212
|
+
process.stdout.write("\x1Bc");
|
|
213
|
+
process.stdout.write(`${lines.join("\n")}\n`);
|
|
214
|
+
return session;
|
|
215
|
+
}
|
|
216
|
+
async function handleDialogInput(line, cwd, options) {
|
|
217
|
+
const input = line.trim();
|
|
218
|
+
if (!input) {
|
|
219
|
+
return { action: "continue" };
|
|
220
|
+
}
|
|
221
|
+
if (!input.startsWith("/")) {
|
|
222
|
+
await appendDialogEntry(cwd, "user", "message", input);
|
|
223
|
+
const updated = await upsertDraftIntent(cwd, input, false);
|
|
224
|
+
await appendDialogEntry(cwd, "system", "status", updated);
|
|
225
|
+
if (!options.interactive && !options.quiet) {
|
|
226
|
+
console.log(chalk_1.default.gray(updated));
|
|
227
|
+
}
|
|
228
|
+
return { action: "continue", notice: updated };
|
|
229
|
+
}
|
|
230
|
+
const [command, ...args] = input.split(" ");
|
|
231
|
+
const rest = args.join(" ").trim();
|
|
232
|
+
await appendDialogEntry(cwd, "user", "command", input);
|
|
233
|
+
if (command === "/exit" || command === "/quit") {
|
|
234
|
+
await appendDialogEntry(cwd, "system", "status", "dialog ended");
|
|
235
|
+
return { action: "exit", notice: "dialog ended" };
|
|
236
|
+
}
|
|
237
|
+
if (command === "/help") {
|
|
238
|
+
const help = helpText();
|
|
239
|
+
if (!options.interactive && !options.quiet) {
|
|
240
|
+
console.log(chalk_1.default.gray(help));
|
|
241
|
+
}
|
|
242
|
+
await appendDialogEntry(cwd, "system", "status", help);
|
|
243
|
+
return { action: "continue", notice: "help shown" };
|
|
244
|
+
}
|
|
245
|
+
if (command === "/status") {
|
|
246
|
+
const lines = await buildSessionStatusLines(cwd);
|
|
247
|
+
if (!options.interactive && !options.quiet) {
|
|
248
|
+
for (const lineItem of lines) {
|
|
249
|
+
console.log(chalk_1.default.gray(lineItem));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
await appendDialogEntry(cwd, "system", "status", `status snapshot: ${lines.join(" | ")}`);
|
|
253
|
+
return { action: "continue", notice: "status refreshed" };
|
|
254
|
+
}
|
|
255
|
+
if (command === "/debug") {
|
|
256
|
+
if (rest !== "on" && rest !== "off") {
|
|
257
|
+
throw new Error("Usage: /debug on|off");
|
|
258
|
+
}
|
|
259
|
+
await mutateDialogSession(cwd, (session) => {
|
|
260
|
+
const normalized = toSessionWithDialog(session);
|
|
261
|
+
normalized.dialog.debug = rest === "on";
|
|
262
|
+
normalized.updated_at = now();
|
|
263
|
+
return normalized;
|
|
264
|
+
});
|
|
265
|
+
await appendDialogEntry(cwd, "system", "status", `debug mode ${rest}`);
|
|
266
|
+
if (!options.interactive && !options.quiet) {
|
|
267
|
+
console.log(chalk_1.default.gray(`debug mode: ${rest}`));
|
|
268
|
+
}
|
|
269
|
+
return { action: "continue", notice: `debug mode ${rest}` };
|
|
270
|
+
}
|
|
271
|
+
if (command === "/edit") {
|
|
272
|
+
if (!rest) {
|
|
273
|
+
throw new Error("Usage: /edit <text>");
|
|
274
|
+
}
|
|
275
|
+
const updated = await upsertDraftIntent(cwd, rest, true);
|
|
276
|
+
await appendDialogEntry(cwd, "system", "status", "intent.card replaced");
|
|
277
|
+
if (!options.interactive && !options.quiet) {
|
|
278
|
+
console.log(chalk_1.default.gray(updated));
|
|
279
|
+
}
|
|
280
|
+
return { action: "continue", notice: "intent.card replaced" };
|
|
281
|
+
}
|
|
282
|
+
if (command === "/confirm") {
|
|
283
|
+
const confirmed = await (0, intent_1.confirmIntent)(cwd);
|
|
284
|
+
const message = `intent confirmed: ${confirmed.intent.intent_id} (state=READY, intent_sha256=${confirmed.binding.intent_sha256})`;
|
|
285
|
+
await appendDialogEntry(cwd, "system", "status", message);
|
|
286
|
+
if (!options.interactive && !options.quiet) {
|
|
287
|
+
console.log(chalk_1.default.green(message));
|
|
288
|
+
}
|
|
289
|
+
return { action: "continue", notice: `confirmed ${confirmed.intent.intent_id}` };
|
|
290
|
+
}
|
|
291
|
+
if (command === "/run") {
|
|
292
|
+
const roundStart = now();
|
|
293
|
+
const session = await requireSessionWithDialog(cwd);
|
|
294
|
+
const nextRound = (session.dialog?.rounds.at(-1)?.round ?? 0) + 1;
|
|
295
|
+
const output = await (0, run_1.runConfirmedPipeline)(options.sopOut, options.checkpointOut, cwd, {
|
|
296
|
+
quiet: true
|
|
297
|
+
});
|
|
298
|
+
const debug = (await requireSessionWithDialog(cwd)).dialog?.debug ?? false;
|
|
299
|
+
const summary = summarizeVerdict(output, debug);
|
|
300
|
+
if (!options.interactive && !options.quiet) {
|
|
301
|
+
printVerdictLines(summary.lines, output.interpretation.verdict);
|
|
302
|
+
}
|
|
303
|
+
const reasonCode = output.finalAuditResult.reason_code || "UNKNOWN";
|
|
304
|
+
await mutateDialogSession(cwd, (current) => {
|
|
305
|
+
const normalized = toSessionWithDialog(current);
|
|
306
|
+
normalized.dialog.rounds = [
|
|
307
|
+
...normalized.dialog.rounds,
|
|
308
|
+
{
|
|
309
|
+
round: nextRound,
|
|
310
|
+
started_at: roundStart,
|
|
311
|
+
completed_at: now(),
|
|
312
|
+
verdict: output.interpretation.verdict,
|
|
313
|
+
reason_code: reasonCode,
|
|
314
|
+
checkpoint_id: output.checkpoint?.checkpoint_id
|
|
315
|
+
}
|
|
316
|
+
].slice(-MAX_DIALOG_ROUNDS);
|
|
317
|
+
normalized.updated_at = now();
|
|
318
|
+
return normalized;
|
|
319
|
+
});
|
|
320
|
+
await appendDialogEntry(cwd, "system", "result", `round #${nextRound} ${summary.historyEntry}`);
|
|
321
|
+
return { action: "continue", notice: `round #${nextRound} ${summary.historyEntry}` };
|
|
322
|
+
}
|
|
323
|
+
throw new Error(`Unknown command: ${command}`);
|
|
324
|
+
}
|
|
325
|
+
async function runDialogueSession(cwd = process.cwd(), options = {}) {
|
|
326
|
+
const sopOut = options.sopOut ?? "sop.json";
|
|
327
|
+
const checkpointOut = options.checkpointOut ?? "checkpoint.json";
|
|
328
|
+
const quiet = options.quiet ?? false;
|
|
329
|
+
const scripted = options.script;
|
|
330
|
+
await requireSessionWithDialog(cwd);
|
|
331
|
+
if (Array.isArray(scripted)) {
|
|
332
|
+
for (const line of scripted) {
|
|
333
|
+
const result = await handleDialogInput(line, cwd, {
|
|
334
|
+
sopOut,
|
|
335
|
+
checkpointOut,
|
|
336
|
+
interactive: false,
|
|
337
|
+
quiet
|
|
338
|
+
});
|
|
339
|
+
if (result.action === "exit") {
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
346
|
+
throw new Error("Dialogue TUI requires a TTY or scripted inputs.");
|
|
347
|
+
}
|
|
348
|
+
const rl = node_readline_1.default.createInterface({
|
|
349
|
+
input: process.stdin,
|
|
350
|
+
output: process.stdout
|
|
351
|
+
});
|
|
352
|
+
let notice = "输入需求文本更新 intent.card;/confirm 冻结;/run 执行。";
|
|
353
|
+
try {
|
|
354
|
+
while (true) {
|
|
355
|
+
const session = await renderDialogueScreen(cwd, notice);
|
|
356
|
+
const prompt = `zaker:${session.state.toLowerCase()} > `;
|
|
357
|
+
const line = await new Promise((resolve) => {
|
|
358
|
+
rl.question(prompt, resolve);
|
|
359
|
+
});
|
|
360
|
+
try {
|
|
361
|
+
const result = await handleDialogInput(line, cwd, {
|
|
362
|
+
sopOut,
|
|
363
|
+
checkpointOut,
|
|
364
|
+
interactive: true,
|
|
365
|
+
quiet
|
|
366
|
+
});
|
|
367
|
+
notice = result.notice ?? "";
|
|
368
|
+
if (result.action === "exit") {
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
374
|
+
notice = message;
|
|
375
|
+
await appendDialogEntry(cwd, "system", "status", `error: ${message}`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
finally {
|
|
380
|
+
rl.close();
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function registerDialogCommand(program) {
|
|
384
|
+
program
|
|
385
|
+
.command("dialog")
|
|
386
|
+
.description("interactive contract-gated dialogue TUI")
|
|
387
|
+
.option("-o, --sop-out <path>", "sop output path", "sop.json")
|
|
388
|
+
.option("-c, --checkpoint-out <path>", "checkpoint output path", "checkpoint.json")
|
|
389
|
+
.action(async (options) => {
|
|
390
|
+
await runDialogueSession(process.cwd(), {
|
|
391
|
+
sopOut: options.sopOut,
|
|
392
|
+
checkpointOut: options.checkpointOut
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/commands/dialog.ts"],"names":[],"mappings":";;;;;AA0ZA,gDA8DC;AAED,sDAYC;AAteD,kEAAqC;AACrC,kDAA0B;AAE1B,yDAA0D;AAE1D,4CAA6C;AAC7C,4CAMyB;AACzB,+BAA6C;AAE7C,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAqB9B,SAAS,GAAG;IACV,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,oFAAoF,CAAC;AAC9F,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAE,SAAS,GAAG,GAAG;IACjD,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,IAAI,UAAU,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QACnC,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC;AACpD,CAAC;AAED,SAAS,OAAO,CAAC,KAAK,GAAG,EAAE;IACzB,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,mBAAmB,CAAC,OA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,MAAM,GAAG,OAAO,CAAC;gBACjB,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,OAAO,EAAE,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC;AAED,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,yCAAyC,CAAC;SACtD,MAAM,CAAC,sBAAsB,EAAE,iBAAiB,EAAE,UAAU,CAAC;SAC7D,MAAM,CAAC,6BAA6B,EAAE,wBAAwB,EAAE,iBAAiB,CAAC;SAClF,MAAM,CAAC,KAAK,EAAE,OAAkD,EAAE,EAAE;QACnE,MAAM,kBAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE;YACtC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runInit = runInit;
|
|
7
|
+
exports.registerInitCommand = registerInitCommand;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const config_1 = require("../infra/config");
|
|
10
|
+
async function runInit(force = false, cwd = process.cwd()) {
|
|
11
|
+
const result = await (0, config_1.initMoloFiles)(cwd, force);
|
|
12
|
+
if (result.created.length > 0) {
|
|
13
|
+
console.log(chalk_1.default.green(`created: ${result.created.join(", ")}`));
|
|
14
|
+
}
|
|
15
|
+
if (result.updated.length > 0) {
|
|
16
|
+
console.log(chalk_1.default.yellow(`updated: ${result.updated.join(", ")}`));
|
|
17
|
+
}
|
|
18
|
+
if (result.skipped.length > 0) {
|
|
19
|
+
console.log(chalk_1.default.gray(`skipped: ${result.skipped.join(", ")}`));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function registerInitCommand(program) {
|
|
23
|
+
program
|
|
24
|
+
.command("init")
|
|
25
|
+
.description("initialize config, risk, memory, intent, and session files")
|
|
26
|
+
.option("-f, --force", "overwrite existing files", false)
|
|
27
|
+
.action(async (options) => {
|
|
28
|
+
await runInit(Boolean(options.force));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;;;AAIA,0BAYC;AAED,kDAQC;AA1BD,kDAA0B;AAE1B,4CAAgD;AAEzC,KAAK,UAAU,OAAO,CAAC,KAAK,GAAG,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAC9D,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAa,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAE/C,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACnE,CAAC;AACH,CAAC;AAED,SAAgB,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,4DAA4D,CAAC;SACzE,MAAM,CAAC,aAAa,EAAE,0BAA0B,EAAE,KAAK,CAAC;SACxD,MAAM,CAAC,KAAK,EAAE,OAA4B,EAAE,EAAE;QAC7C,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
interface ModelsCommandOptions {
|
|
3
|
+
planner?: string;
|
|
4
|
+
auditor?: string;
|
|
5
|
+
execution?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function runModels(options: ModelsCommandOptions, cwd?: string): Promise<void>;
|
|
8
|
+
export declare function registerModelsCommand(program: Command): void;
|
|
9
|
+
export {};
|