@imricci/zaker 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/commands/dialog-handlers/basic.d.ts +7 -0
  2. package/dist/commands/dialog-handlers/basic.js +83 -0
  3. package/dist/commands/dialog-handlers/basic.js.map +1 -0
  4. package/dist/commands/dialog-handlers/bootstrap.d.ts +10 -0
  5. package/dist/commands/dialog-handlers/bootstrap.js +38 -0
  6. package/dist/commands/dialog-handlers/bootstrap.js.map +1 -0
  7. package/dist/commands/dialog-handlers/index.d.ts +2 -0
  8. package/dist/commands/dialog-handlers/index.js +6 -0
  9. package/dist/commands/dialog-handlers/index.js.map +1 -0
  10. package/dist/commands/dialog-handlers/message.d.ts +2 -0
  11. package/dist/commands/dialog-handlers/message.js +12 -0
  12. package/dist/commands/dialog-handlers/message.js.map +1 -0
  13. package/dist/commands/dialog-handlers/resume.d.ts +2 -0
  14. package/dist/commands/dialog-handlers/resume.js +25 -0
  15. package/dist/commands/dialog-handlers/resume.js.map +1 -0
  16. package/dist/commands/dialog-handlers/router.d.ts +11 -0
  17. package/dist/commands/dialog-handlers/router.js +76 -0
  18. package/dist/commands/dialog-handlers/router.js.map +1 -0
  19. package/dist/commands/dialog-handlers/run.d.ts +2 -0
  20. package/dist/commands/dialog-handlers/run.js +125 -0
  21. package/dist/commands/dialog-handlers/run.js.map +1 -0
  22. package/dist/commands/dialog-handlers/status.d.ts +2 -0
  23. package/dist/commands/dialog-handlers/status.js +13 -0
  24. package/dist/commands/dialog-handlers/status.js.map +1 -0
  25. package/dist/commands/dialog-handlers/types.d.ts +108 -0
  26. package/dist/commands/dialog-handlers/types.js +3 -0
  27. package/dist/commands/dialog-handlers/types.js.map +1 -0
  28. package/dist/commands/dialog.js +639 -211
  29. package/dist/commands/dialog.js.map +1 -1
  30. package/dist/index.js +14 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/infra/intent.d.ts +1 -0
  33. package/dist/infra/intent.js +13 -0
  34. package/dist/infra/intent.js.map +1 -1
  35. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ import { DialogHandlerContext, HandleDialogInputResult } from "./types";
2
+ export declare function handleExitCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
3
+ export declare function handleHelpCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
4
+ export declare function handleInitCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
5
+ export declare function handleDebugCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
6
+ export declare function handleEditCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
7
+ export declare function handleConfirmCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleExitCommand = handleExitCommand;
4
+ exports.handleHelpCommand = handleHelpCommand;
5
+ exports.handleInitCommand = handleInitCommand;
6
+ exports.handleDebugCommand = handleDebugCommand;
7
+ exports.handleEditCommand = handleEditCommand;
8
+ exports.handleConfirmCommand = handleConfirmCommand;
9
+ async function handleExitCommand(context) {
10
+ const { cwd, services } = context;
11
+ await services.appendDialogEntry(cwd, "system", "status", "dialog ended");
12
+ return { action: "exit", notice: "dialog ended" };
13
+ }
14
+ async function handleHelpCommand(context) {
15
+ const { cwd, services, logger } = context;
16
+ const help = services.helpText();
17
+ logger.info(help);
18
+ await services.appendDialogEntry(cwd, "system", "status", help);
19
+ return { action: "continue", notice: "help shown" };
20
+ }
21
+ async function handleInitCommand(context) {
22
+ const { cwd, options, services, logger } = context;
23
+ await services.runInit(cwd);
24
+ services.resetBoard(options.board);
25
+ options.board.run_stage = "ALIGN";
26
+ await services.persistActiveConversation(options.conversations, cwd);
27
+ const message = "workspace init checked";
28
+ await services.appendDialogEntry(cwd, "system", "status", message);
29
+ logger.info(message);
30
+ return { action: "continue", notice: message };
31
+ }
32
+ async function handleDebugCommand(context) {
33
+ const { cwd, rest, services, logger } = context;
34
+ if (rest !== "on" && rest !== "off") {
35
+ throw new Error("Usage: /debug on|off");
36
+ }
37
+ await services.mutateDialogSession(cwd, (session) => {
38
+ const dialog = session.dialog ?? {
39
+ debug: false,
40
+ turn: 0,
41
+ rounds: [],
42
+ history: []
43
+ };
44
+ return {
45
+ ...session,
46
+ dialog: {
47
+ ...dialog,
48
+ debug: rest === "on",
49
+ rounds: [...dialog.rounds],
50
+ history: [...dialog.history]
51
+ },
52
+ updated_at: services.now()
53
+ };
54
+ });
55
+ await services.appendDialogEntry(cwd, "system", "status", `debug mode ${rest}`);
56
+ logger.info(`debug mode: ${rest}`);
57
+ return { action: "continue", notice: `debug mode ${rest}` };
58
+ }
59
+ async function handleEditCommand(context) {
60
+ const { cwd, rest, services, logger } = context;
61
+ if (!rest) {
62
+ throw new Error("Usage: /edit <text>");
63
+ }
64
+ const updated = await services.upsertDraftIntent(cwd, rest, true);
65
+ await services.appendDialogEntry(cwd, "system", "status", "intent.card replaced");
66
+ logger.info(updated);
67
+ return { action: "continue", notice: "intent.card replaced" };
68
+ }
69
+ async function handleConfirmCommand(context) {
70
+ const { cwd, options, services, logger } = context;
71
+ const confirmed = await services.confirmIntent(cwd);
72
+ options.board.run_stage = "READY";
73
+ options.board.run_status = "IDLE";
74
+ options.board.audit_verdict = "PENDING";
75
+ options.board.audit_reason = "-";
76
+ options.board.audit_conclusion = "intent confirmed; waiting /run";
77
+ options.board.retry_allowed = "-";
78
+ const message = `intent confirmed: ${confirmed.intent.intent_id} (state=READY, intent_sha256=${confirmed.binding.intent_sha256})`;
79
+ await services.appendDialogEntry(cwd, "system", "status", message);
80
+ logger.success(message);
81
+ return { action: "continue", notice: `confirmed ${confirmed.intent.intent_id}` };
82
+ }
83
+ //# sourceMappingURL=basic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/basic.ts"],"names":[],"mappings":";;AAEA,8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E,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;AACnF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { DialogHandlerServices, DialogLogger, HandleDialogInputOptions, HandleDialogInputResult } from "./types";
2
+ interface BootstrapContext {
3
+ input: string;
4
+ cwd: string;
5
+ options: HandleDialogInputOptions;
6
+ services: DialogHandlerServices;
7
+ logger: DialogLogger;
8
+ }
9
+ export declare function handleBootstrapInput(context: BootstrapContext): Promise<HandleDialogInputResult>;
10
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleBootstrapInput = handleBootstrapInput;
4
+ async function handleBootstrapInput(context) {
5
+ const { input, cwd, options, services, logger } = context;
6
+ if (!input.startsWith("/")) {
7
+ const notice = "workspace not initialized. run /init first.";
8
+ logger.warn(notice);
9
+ return { action: "continue", notice };
10
+ }
11
+ const [command] = input.split(" ");
12
+ if (command === "/exit" || command === "/quit") {
13
+ return { action: "exit", notice: "dialog ended" };
14
+ }
15
+ if (command === "/help") {
16
+ logger.info(services.helpText());
17
+ return { action: "continue", notice: "help shown" };
18
+ }
19
+ if (command === "/resume") {
20
+ const notice = "workspace not initialized. run /init first.";
21
+ logger.warn(notice);
22
+ return { action: "continue", notice };
23
+ }
24
+ if (command === "/init") {
25
+ await services.runInit(cwd);
26
+ await services.requireSessionWithDialog(cwd);
27
+ services.resetBoard(options.board);
28
+ options.board.run_stage = "ALIGN";
29
+ options.conversations.index = services.createDefaultConversationIndex();
30
+ await services.persistActiveConversation(options.conversations, cwd);
31
+ logger.success("workspace initialized");
32
+ return { action: "continue", notice: "workspace initialized" };
33
+ }
34
+ const notice = "workspace not initialized. only /init, /help, /exit are available.";
35
+ logger.warn(notice);
36
+ return { action: "continue", notice };
37
+ }
38
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/bootstrap.ts"],"names":[],"mappings":";;AAeA,oDAyCC;AAzCM,KAAK,UAAU,oBAAoB,CACxC,OAAyB;IAEzB,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE1D,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,6CAA6C,CAAC;QAC7D,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACpD,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IACtD,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,6CAA6C,CAAC;QAC7D,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,MAAM,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,QAAQ,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;QAC7C,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC;QAClC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG,QAAQ,CAAC,8BAA8B,EAAE,CAAC;QACxE,MAAM,QAAQ,CAAC,yBAAyB,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QACrE,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QACxC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;IACjE,CAAC;IAED,MAAM,MAAM,GAAG,oEAAoE,CAAC;IACpF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { dispatchDialogInput } from "./router";
2
+ export type { ConversationRecord, ConversationIndex, ConversationRuntime, HandleDialogInputOptions, HandleDialogInputResult, TaskBoardState, DialogHandlerServices, DialogLogger, DialogRunSummary } from "./types";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dispatchDialogInput = void 0;
4
+ var router_1 = require("./router");
5
+ Object.defineProperty(exports, "dispatchDialogInput", { enumerable: true, get: function () { return router_1.dispatchDialogInput; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA"}
@@ -0,0 +1,2 @@
1
+ import { DialogHandlerContext, HandleDialogInputResult } from "./types";
2
+ export declare function handleMessageInput(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleMessageInput = handleMessageInput;
4
+ async function handleMessageInput(context) {
5
+ const { cwd, input, services, logger } = context;
6
+ await services.appendDialogEntry(cwd, "user", "message", input);
7
+ const updated = await services.upsertDraftIntent(cwd, input, false);
8
+ await services.appendDialogEntry(cwd, "system", "status", updated);
9
+ logger.info(updated);
10
+ return { action: "continue", notice: updated };
11
+ }
12
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/message.ts"],"names":[],"mappings":";;AAEA,gDASC;AATM,KAAK,UAAU,kBAAkB,CACtC,OAA6B;IAE7B,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACjD,MAAM,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACpE,MAAM,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AACjD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { DialogHandlerContext, HandleDialogInputResult } from "./types";
2
+ export declare function handleResumeCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleResumeCommand = handleResumeCommand;
4
+ async function handleResumeCommand(context) {
5
+ const { cwd, rest, options, services, logger } = context;
6
+ if (!rest) {
7
+ const ids = await services.listConversationIds(options.conversations.index, cwd);
8
+ const active = options.conversations.index.active_id || services.defaultConversationId;
9
+ const listing = ids.map((id) => (id === active ? `*${id}` : id)).join(", ");
10
+ const message = `sessions: ${listing}`;
11
+ await services.appendDialogEntry(cwd, "system", "status", message);
12
+ logger.info(message);
13
+ return { action: "continue", notice: message };
14
+ }
15
+ const targetId = services.normalizeConversationId(rest.split(/\s+/)[0] || "");
16
+ const switched = await services.switchConversation(options.conversations, targetId, cwd);
17
+ services.resetBoard(options.board);
18
+ const switchedSession = await services.readSessionStore(cwd);
19
+ options.board.run_stage = switchedSession?.state ?? "ALIGN";
20
+ const message = `conversation switched: ${switched.previous} -> ${switched.current}`;
21
+ await services.appendDialogEntry(cwd, "system", "status", message);
22
+ logger.success(message);
23
+ return { action: "continue", notice: message };
24
+ }
25
+ //# sourceMappingURL=resume.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/resume.ts"],"names":[],"mappings":";;AAEA,kDAyBC;AAzBM,KAAK,UAAU,mBAAmB,CACvC,OAA6B;IAE7B,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEzD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,mBAAmB,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACjF,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,IAAI,QAAQ,CAAC,qBAAqB,CAAC;QACvF,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,MAA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ions, HandleDialogInputResult } from "./types";
2
+ interface DispatchInput {
3
+ input: string;
4
+ initialized: boolean;
5
+ cwd: string;
6
+ options: HandleDialogInputOptions;
7
+ services: DialogHandlerServices;
8
+ logger: DialogLogger;
9
+ }
10
+ export declare function dispatchDialogInput(params: DispatchInput): Promise<HandleDialogInputResult>;
11
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dispatchDialogInput = dispatchDialogInput;
4
+ const bootstrap_1 = require("./bootstrap");
5
+ const basic_1 = require("./basic");
6
+ const message_1 = require("./message");
7
+ const resume_1 = require("./resume");
8
+ const run_1 = require("./run");
9
+ const status_1 = require("./status");
10
+ const activeHandlers = {
11
+ "/exit": basic_1.handleExitCommand,
12
+ "/quit": basic_1.handleExitCommand,
13
+ "/help": basic_1.handleHelpCommand,
14
+ "/init": basic_1.handleInitCommand,
15
+ "/resume": resume_1.handleResumeCommand,
16
+ "/status": status_1.handleStatusCommand,
17
+ "/debug": basic_1.handleDebugCommand,
18
+ "/edit": basic_1.handleEditCommand,
19
+ "/confirm": basic_1.handleConfirmCommand,
20
+ "/run": run_1.handleRunCommand
21
+ };
22
+ function createCommandContext(params) {
23
+ return {
24
+ cwd: params.cwd,
25
+ input: params.input,
26
+ command: params.command,
27
+ rest: params.rest,
28
+ options: params.options,
29
+ services: params.services,
30
+ logger: params.logger
31
+ };
32
+ }
33
+ async function dispatchDialogInput(params) {
34
+ const { input, initialized, cwd, options, services, logger } = params;
35
+ if (!input.trim()) {
36
+ return { action: "continue" };
37
+ }
38
+ if (!initialized) {
39
+ return await (0, bootstrap_1.handleBootstrapInput)({
40
+ input: input.trim(),
41
+ cwd,
42
+ options,
43
+ services,
44
+ logger
45
+ });
46
+ }
47
+ const trimmed = input.trim();
48
+ if (!trimmed.startsWith("/")) {
49
+ return await (0, message_1.handleMessageInput)(createCommandContext({
50
+ cwd,
51
+ input: trimmed,
52
+ command: "",
53
+ rest: "",
54
+ options,
55
+ services,
56
+ logger
57
+ }));
58
+ }
59
+ const [command, ...args] = trimmed.split(" ");
60
+ const rest = args.join(" ").trim();
61
+ await services.appendDialogEntry(cwd, "user", "command", trimmed);
62
+ const handler = activeHandlers[command];
63
+ if (!handler) {
64
+ throw new Error(`Unknown command: ${command}`);
65
+ }
66
+ return await handler(createCommandContext({
67
+ cwd,
68
+ input: trimmed,
69
+ command,
70
+ rest,
71
+ options,
72
+ services,
73
+ logger
74
+ }));
75
+ }
76
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/router.ts"],"names":[],"mappings":";;AAgEA,kDAqDC;AArHD,2CAAmD;AACnD,mCAOiB;AACjB,uCAA+C;AAC/C,qCAA+C;AAC/C,+BAAyC;AACzC,qCAA+C;AAmB/C,MAAM,cAAc,GAAyC;IAC3D,OAAO,EAAE,yBAAiB;IAC1B,OAAO,EAAE,yBAAiB;IAC1B,OAAO,EAAE,yBAAiB;IAC1B,OAAO,EAAE,yBAAiB;IAC1B,SAAS,EAAE,4BAAmB;IAC9B,SAAS,EAAE,4BAAmB;IAC9B,QAAQ,EAAE,0BAAkB;IAC5B,OAAO,EAAE,yBAAiB;IAC1B,UAAU,EAAE,4BAAoB;IAChC,MAAM,EAAE,sBAAgB;CACzB,CAAC;AAEF,SAAS,oBAAoB,CAAC,MAQ7B;IACC,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,mBAAmB,CACvC,MAAqB;IAErB,MAAM,EAAE,KAAK,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,OAAO;QACP,IAAI;QACJ,OAAO;QACP,QAAQ;QACR,MAAM;KACP,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { DialogHandlerContext, HandleDialogInputResult } from "./types";
2
+ export declare function handleRunCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleRunCommand = handleRunCommand;
4
+ async function handleRunCommand(context) {
5
+ const { cwd, options, services, logger } = context;
6
+ const roundStart = services.now();
7
+ const session = await services.requireSessionWithDialog(cwd);
8
+ if (session.state !== "READY") {
9
+ throw new Error(`Run blocked: session state is ${session.state}. Use \`/confirm\` first.`);
10
+ }
11
+ const nextRound = (session.dialog?.rounds.at(-1)?.round ?? 0) + 1;
12
+ options.board.run_status = "RUNNING";
13
+ options.board.run_stage = "ONBOARDING";
14
+ options.board.audit_verdict = "PENDING";
15
+ options.board.audit_reason = "-";
16
+ options.board.audit_conclusion = "pipeline running";
17
+ options.board.retry_allowed = "-";
18
+ options.board.verification_status = "PENDING";
19
+ options.board.risk_hit = "-";
20
+ options.board.budget_plan_calls = 0;
21
+ options.board.budget_audit_calls = 0;
22
+ options.board.budget_challenge_used = 0;
23
+ if (options.interactive && options.redraw) {
24
+ await options.redraw("pipeline started");
25
+ }
26
+ const appendRound = async (verdict, reasonCode, checkpointId) => {
27
+ await services.mutateDialogSession(cwd, (current) => {
28
+ const next = {
29
+ ...current,
30
+ dialog: {
31
+ ...current.dialog,
32
+ rounds: [
33
+ ...(current.dialog?.rounds ?? []),
34
+ {
35
+ round: nextRound,
36
+ started_at: roundStart,
37
+ completed_at: services.now(),
38
+ verdict,
39
+ reason_code: reasonCode,
40
+ checkpoint_id: checkpointId
41
+ }
42
+ ].slice(-services.maxDialogRounds),
43
+ history: [...(current.dialog?.history ?? [])],
44
+ turn: current.dialog?.turn ?? 0,
45
+ debug: current.dialog?.debug ?? false
46
+ },
47
+ updated_at: services.now()
48
+ };
49
+ return next;
50
+ });
51
+ };
52
+ try {
53
+ const output = await services.runConfirmedPipeline(options.sopOut, options.checkpointOut, cwd, async (event) => {
54
+ options.board.run_stage = event.stage.toUpperCase();
55
+ if (event.status === "failed") {
56
+ options.board.run_status = "FAILED";
57
+ }
58
+ else if (event.stage === "complete" && event.status === "completed") {
59
+ options.board.run_status = "COMPLETED";
60
+ }
61
+ else {
62
+ options.board.run_status = "RUNNING";
63
+ }
64
+ if (event.stage === "verify" && event.status === "completed") {
65
+ const allPassed = Boolean(event.data?.all_passed);
66
+ options.board.verification_status = allPassed ? "PASS" : "FAIL";
67
+ }
68
+ if (event.stage === "c3fi" && event.status === "completed") {
69
+ const message = typeof event.data?.message === "string" ? event.data.message : "";
70
+ options.board.risk_hit = message || options.board.risk_hit;
71
+ }
72
+ if (options.interactive && options.redraw) {
73
+ await options.redraw(event.message);
74
+ }
75
+ });
76
+ const debug = (await services.requireSessionWithDialog(cwd)).dialog?.debug ?? false;
77
+ const summary = services.summarizeVerdict(output, debug);
78
+ const panel = summary.panel;
79
+ options.board.run_stage = "COMPLETE";
80
+ options.board.run_status = panel.verdict === "FAIL" ? "FAILED" : "COMPLETED";
81
+ options.board.verification_status = panel.test_status;
82
+ options.board.verification_passed = panel.tests_passed;
83
+ options.board.verification_total = panel.tests_total;
84
+ options.board.risk_hit = panel.risk_hit;
85
+ options.board.audit_verdict = panel.verdict;
86
+ options.board.audit_reason = panel.reason_code;
87
+ options.board.audit_conclusion = panel.audit_conclusion;
88
+ options.board.retry_allowed = panel.retry_allowed ? "YES" : "NO";
89
+ options.board.budget_plan_calls = output.checkpoint?.budget.cloud_plan_calls ?? 0;
90
+ options.board.budget_audit_calls = output.checkpoint?.budget.cloud_audit_calls ?? 0;
91
+ options.board.budget_challenge_used = output.checkpoint?.budget.challenge_used ?? 0;
92
+ if (!options.interactive && !options.quiet) {
93
+ services.printVerdictLines(summary.lines, output.interpretation.verdict);
94
+ }
95
+ const reasonCode = output.finalAuditResult.reason_code || "UNKNOWN";
96
+ await appendRound(output.interpretation.verdict, reasonCode, output.checkpoint?.checkpoint_id);
97
+ await services.appendDialogEntry(cwd, "system", "result", `round #${nextRound} ${summary.historyEntry}`);
98
+ return { action: "continue", notice: `round #${nextRound} ${summary.historyEntry}` };
99
+ }
100
+ catch (error) {
101
+ const message = error instanceof Error ? error.message : String(error);
102
+ const reasonCode = "RUN_COMMAND_ERROR";
103
+ options.board.run_stage = "ERROR";
104
+ options.board.run_status = "FAILED";
105
+ options.board.audit_verdict = "FAIL";
106
+ options.board.audit_reason = reasonCode;
107
+ options.board.audit_conclusion = message;
108
+ options.board.retry_allowed = "NO";
109
+ await appendRound("FAIL", reasonCode);
110
+ const historyEntry = `verdict=FAIL | rule=${reasonCode} | tests=${options.board.verification_status} (${options.board.verification_passed}/${options.board.verification_total}) | risk=${options.board.risk_hit} | retry=NO`;
111
+ await services.appendDialogEntry(cwd, "system", "result", `round #${nextRound} ${historyEntry}`);
112
+ if (options.interactive && options.redraw) {
113
+ await options.redraw(message);
114
+ }
115
+ if (!options.interactive && !options.quiet) {
116
+ logger.error("FAIL");
117
+ logger.error(message);
118
+ }
119
+ if (options.interactive) {
120
+ return { action: "continue", notice: `round #${nextRound} ${historyEntry}` };
121
+ }
122
+ throw error;
123
+ }
124
+ }
125
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/run.ts"],"names":[],"mappings":";;AAEA,4CA8IC;AA9IM,KAAK,UAAU,gBAAgB,CACpC,OAA6B;IAE7B,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAC7D,IAAI,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EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,SAAS,IAAI,YAAY,EAAE,CAAC,CAAC;QAEjG,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YAC1C,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACrB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACxB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,SAAS,IAAI,YAAY,EAAE,EAAE,CAAC;QAC/E,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { DialogHandlerContext, HandleDialogInputResult } from "./types";
2
+ export declare function handleStatusCommand(context: DialogHandlerContext): Promise<HandleDialogInputResult>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleStatusCommand = handleStatusCommand;
4
+ async function handleStatusCommand(context) {
5
+ const { cwd, services, logger } = context;
6
+ const lines = await services.buildSessionStatusLines(cwd);
7
+ for (const line of lines) {
8
+ logger.info(line);
9
+ }
10
+ await services.appendDialogEntry(cwd, "system", "status", `status snapshot: ${lines.join(" | ")}`);
11
+ return { action: "continue", notice: "status refreshed" };
12
+ }
13
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/status.ts"],"names":[],"mappings":";;AAEA,kDAUC;AAVM,KAAK,UAAU,mBAAmB,CACvC,OAA6B;IAE7B,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC1C,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC;IAC1D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,oBAAoB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,108 @@
1
+ import type { IntentCard, SessionStore } from "../../core/types";
2
+ import type { PipelineRunOutput, PipelineStageEvent } from "../run";
3
+ export interface HandleDialogInputResult {
4
+ action: "continue" | "exit";
5
+ notice?: string;
6
+ }
7
+ export interface TaskBoardState {
8
+ run_stage: string;
9
+ run_status: "IDLE" | "RUNNING" | "COMPLETED" | "FAILED";
10
+ verification_status: "PASS" | "FAIL" | "PENDING";
11
+ verification_passed: number;
12
+ verification_total: number;
13
+ risk_hit: string;
14
+ audit_verdict: "PASS" | "CHALLENGE" | "FAIL" | "PENDING";
15
+ audit_reason: string;
16
+ audit_conclusion: string;
17
+ retry_allowed: "YES" | "NO" | "-";
18
+ budget_plan_calls: number;
19
+ budget_audit_calls: number;
20
+ budget_challenge_used: number;
21
+ }
22
+ export interface ConversationRecord {
23
+ id: string;
24
+ updated_at: string;
25
+ state?: string;
26
+ last_run_verdict?: string;
27
+ current_intent_id?: string;
28
+ }
29
+ export interface ConversationIndex {
30
+ schema_version: string;
31
+ active_id: string;
32
+ updated_at: string;
33
+ sessions: ConversationRecord[];
34
+ }
35
+ export interface ConversationRuntime {
36
+ index: ConversationIndex;
37
+ }
38
+ export interface HandleDialogInputOptions {
39
+ sopOut: string;
40
+ checkpointOut: string;
41
+ interactive: boolean;
42
+ quiet: boolean;
43
+ board: TaskBoardState;
44
+ conversations: ConversationRuntime;
45
+ redraw?: (nextNotice?: string) => Promise<void>;
46
+ }
47
+ export interface DialogLogger {
48
+ info(message: string): void;
49
+ warn(message: string): void;
50
+ success(message: string): void;
51
+ error(message: string): void;
52
+ }
53
+ export interface DialogRunSummaryPanel {
54
+ verdict: "PASS" | "CHALLENGE" | "FAIL";
55
+ test_status: "PASS" | "FAIL" | "PENDING";
56
+ tests_passed: number;
57
+ tests_total: number;
58
+ risk_hit: string;
59
+ reason_code: string;
60
+ audit_conclusion: string;
61
+ retry_allowed: boolean;
62
+ }
63
+ export interface DialogRunSummary {
64
+ lines: string[];
65
+ historyEntry: string;
66
+ panel: DialogRunSummaryPanel;
67
+ }
68
+ export interface DialogHandlerServices {
69
+ now(): string;
70
+ maxDialogRounds: number;
71
+ defaultConversationId: string;
72
+ helpText(): string;
73
+ createDefaultConversationIndex(): ConversationIndex;
74
+ resetBoard(board: TaskBoardState): void;
75
+ readSessionStore(cwd: string): Promise<SessionStore | null>;
76
+ requireSessionWithDialog(cwd: string): Promise<SessionStore>;
77
+ mutateDialogSession(cwd: string, updater: (session: SessionStore) => SessionStore): Promise<SessionStore>;
78
+ appendDialogEntry(cwd: string, role: "user" | "system", kind: "message" | "command" | "status" | "result", content: string): Promise<void>;
79
+ upsertDraftIntent(cwd: string, content: string, replace?: boolean): Promise<string>;
80
+ buildSessionStatusLines(cwd: string): Promise<string[]>;
81
+ runInit(cwd: string): Promise<void>;
82
+ persistActiveConversation(runtime: ConversationRuntime, cwd: string): Promise<void>;
83
+ listConversationIds(index: ConversationIndex, cwd: string): Promise<string[]>;
84
+ switchConversation(runtime: ConversationRuntime, targetId: string, cwd: string): Promise<{
85
+ previous: string;
86
+ current: string;
87
+ }>;
88
+ normalizeConversationId(raw: string): string;
89
+ confirmIntent(cwd: string): Promise<{
90
+ intent: IntentCard;
91
+ binding: {
92
+ intent_sha256: string;
93
+ };
94
+ }>;
95
+ runConfirmedPipeline(sopOut: string, checkpointOut: string, cwd: string, onStage: (event: PipelineStageEvent) => Promise<void>): Promise<PipelineRunOutput>;
96
+ summarizeVerdict(output: PipelineRunOutput, debug: boolean): DialogRunSummary;
97
+ printVerdictLines(lines: string[], verdict: "PASS" | "CHALLENGE" | "FAIL"): void;
98
+ }
99
+ export interface DialogHandlerContext {
100
+ cwd: string;
101
+ input: string;
102
+ command: string;
103
+ rest: string;
104
+ options: HandleDialogInputOptions;
105
+ services: DialogHandlerServices;
106
+ logger: DialogLogger;
107
+ }
108
+ export type DialogCommandHandler = (context: DialogHandlerContext) => Promise<HandleDialogInputResult>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/dialog-handlers/types.ts"],"names":[],"mappings":""}