@alisio/alisio-code 0.1.1 → 0.2.1

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/main.js CHANGED
@@ -156,7 +156,7 @@ async function run(cmd, prompt, sessionId) {
156
156
  let activeRunOptions = {};
157
157
  try {
158
158
  const reported = app.plugins.pluginState("subagents", "mainAgents");
159
- activeRunOptions = agentRunOptions(resolveActiveAgent(agentCatalogFromState(reported), app.config.agents.active));
159
+ activeRunOptions = agentRunOptions(resolveActiveAgent(agentCatalogFromState(reported), app.config.agents.active), { plan: app.config.plan });
160
160
  }
161
161
  catch {
162
162
  /* agent resolution is best-effort */
package/dist/tui/app.js CHANGED
@@ -18,7 +18,7 @@ import { formatGoalStatus, GoalBar, goalPickerItems, goalPickerPrefill, goalStop
18
18
  import { agentCycleHint, isPermissionMode, modeDisplay, permissionMenuRows, permissionTransition, reloadGuard, shiftTabDecision, } from "./modes.js";
19
19
  import { cannotOpenMessage, openPath, revealPath } from "./open-path.js";
20
20
  import { initialPanelState, reducePanel, visibleRows } from "./panel.js";
21
- import { planTranscriptMarkdown } from "./plan-review.js";
21
+ import { planDiagramsMarkdown, planTranscriptMarkdown } from "./plan-review.js";
22
22
  import { summarizeAnswers } from "./questions.js";
23
23
  import { InteractiveQueue } from "./queue.js";
24
24
  import { settingsMenuRows } from "./settings.js";
@@ -729,6 +729,23 @@ export async function runTui(options) {
729
729
  reasoning: "",
730
730
  done: true,
731
731
  });
732
+ if (plan.diagrams?.length) {
733
+ // The folder is resolved from the store, never from the model.
734
+ const record = plan.artifact ? app.artifacts.get(plan.artifact.id) : undefined;
735
+ const folder = record?.status === "ready"
736
+ ? shortenPath(join(app.artifacts.folder(record), "files"), homedir(), 96)
737
+ : undefined;
738
+ push({
739
+ kind: "assistant",
740
+ text: planDiagramsMarkdown({
741
+ revision: plan.revision,
742
+ diagrams: plan.diagrams,
743
+ ...(folder ? { folder } : {}),
744
+ }),
745
+ reasoning: "",
746
+ done: true,
747
+ });
748
+ }
732
749
  showPicker(new PlanReviewPanel(options, {
733
750
  title: plan.title,
734
751
  revision: plan.revision,
@@ -1430,7 +1447,7 @@ export async function runTui(options) {
1430
1447
  // An explicit /effort wins; otherwise the agent's own default effort (agentRunOptions) is kept.
1431
1448
  const effort = app.config.agents.effort || !agent.effort ? currentEffort() : undefined;
1432
1449
  // The goal tools are offered while the session has an ACTIVE goal (never to the plan agent).
1433
- const agentOptions = agentRunOptions(agent);
1450
+ const agentOptions = agentRunOptions(agent, { plan: app.config.plan });
1434
1451
  const goalTools = goalOptInTools(app.goals.get(app.store.rootOf(session)), agent.id === "plan");
1435
1452
  const optInTools = [...(agentOptions.optInTools ?? []), ...goalTools];
1436
1453
  const runId = crypto.randomUUID();
@@ -4,6 +4,7 @@
4
4
  * {state, effect}, fully testable without a terminal. Esc means "Skip for now" while choosing and
5
5
  * "back to the choices" while typing; Enter submits; an empty text never submits.
6
6
  */
7
+ import type { PlanDiagramInfo } from "@alisio/sdk";
7
8
  import { type ConnectInputState } from "./connect-input.ts";
8
9
  export interface PlanReviewOption {
9
10
  value: string;
@@ -46,3 +47,17 @@ export declare function planTranscriptMarkdown(plan: {
46
47
  revision: number;
47
48
  markdown: string;
48
49
  }): string;
50
+ /** Lines of Mermaid source the terminal shows per diagram (the full source is in the folder). */
51
+ export declare const DIAGRAM_SOURCE_LINES = 8;
52
+ /**
53
+ * What the terminal shows for a plan's diagrams, as Markdown for the transcript: per diagram its
54
+ * title, purpose, the plan section it illustrates, its explanation and the Mermaid source capped
55
+ * to a few lines (no attempt to draw it), then where the plan folder is and how to open it.
56
+ * Empty when the plan has no diagrams.
57
+ */
58
+ export declare function planDiagramsMarkdown(plan: {
59
+ revision: number;
60
+ diagrams?: PlanDiagramInfo[];
61
+ /** Display path of the plan folder on disk (absent when the plan could not be saved). */
62
+ folder?: string;
63
+ }): string;
@@ -1,9 +1,3 @@
1
- /**
2
- * Pure, pi-tui-free reducer of the plan review panel (`exit_plan`): three decisions and, for "Add
3
- * context", a one-line text field. Same convention as `questions.ts`: state + action ->
4
- * {state, effect}, fully testable without a terminal. Esc means "Skip for now" while choosing and
5
- * "back to the choices" while typing; Enter submits; an empty text never submits.
6
- */
7
1
  import { printableInput, reduceConnectInput } from "./connect-input.js";
8
2
  export const SKIP_VALUE = "skip";
9
3
  export function initialPlanReviewState(options) {
@@ -74,3 +68,43 @@ export function reducePlanReview(state, action) {
74
68
  export function planTranscriptMarkdown(plan) {
75
69
  return `**Plan: ${plan.title}**${plan.revision > 1 ? ` (revision ${plan.revision})` : ""}\n\n${plan.markdown}`;
76
70
  }
71
+ /** Lines of Mermaid source the terminal shows per diagram (the full source is in the folder). */
72
+ export const DIAGRAM_SOURCE_LINES = 8;
73
+ /**
74
+ * What the terminal shows for a plan's diagrams, as Markdown for the transcript: per diagram its
75
+ * title, purpose, the plan section it illustrates, its explanation and the Mermaid source capped
76
+ * to a few lines (no attempt to draw it), then where the plan folder is and how to open it.
77
+ * Empty when the plan has no diagrams.
78
+ */
79
+ export function planDiagramsMarkdown(plan) {
80
+ const diagrams = plan.diagrams ?? [];
81
+ if (!diagrams.length)
82
+ return "";
83
+ const blocks = diagrams.map((diagram, index) => {
84
+ const lines = diagram.mermaid.split("\n");
85
+ const shown = lines.slice(0, DIAGRAM_SOURCE_LINES);
86
+ const more = lines.length - shown.length;
87
+ const change = plan.revision > 1 && diagram.status !== "unchanged"
88
+ ? ` · ${diagram.status === "new" ? "new" : "updated"} in revision ${plan.revision}`
89
+ : "";
90
+ const section = diagram.section ? ` · section: ${diagram.section}` : "";
91
+ return [
92
+ `**${index + 1}. ${diagram.title}** · ${diagram.type}${section}${change}`,
93
+ diagram.explanation,
94
+ "",
95
+ "```mermaid",
96
+ ...shown,
97
+ "```",
98
+ ...(more > 0
99
+ ? [`_… ${more} more line${more === 1 ? "" : "s"} in diagrams/${diagram.id}.mmd_`]
100
+ : []),
101
+ ].join("\n");
102
+ });
103
+ return [
104
+ `**Diagrams (${diagrams.length})** · drawn in the web plan viewer; the terminal shows their source`,
105
+ ...blocks,
106
+ plan.folder
107
+ ? `Plan folder: \`${plan.folder}\` (plan.md, plan.json, diagrams/*.mmd). Open it from /artifacts.`
108
+ : "The plan folder could not be saved, so these diagrams are only shown here.",
109
+ ].join("\n\n");
110
+ }
@@ -93,6 +93,10 @@ export interface SettingsConfigView {
93
93
  noToolTurnsLimit: number;
94
94
  blockedRepeats: number;
95
95
  };
96
+ plan: {
97
+ diagrams: boolean;
98
+ maxDiagrams: number;
99
+ };
96
100
  }
97
101
  export interface SettingsMenuInput {
98
102
  config: SettingsConfigView;
@@ -31,6 +31,7 @@ export const defaultConfig = {
31
31
  noToolTurnsLimit: 3,
32
32
  blockedRepeats: 2,
33
33
  },
34
+ plan: { diagrams: true, maxDiagrams: 5 },
34
35
  };
35
36
  /** Strictly ascending number sequence with exact step arithmetic (0.85 stays 0.85). */
36
37
  function stepValues(start, end, step) {
@@ -294,6 +295,24 @@ export const SETTINGS_DEFINITIONS = [
294
295
  read: (config) => config.goal.blockedRepeats,
295
296
  description: "How many consecutive turns the agent must report the same blocker (with evidence) before the goal stops as blocked. A permission denial blocks at once.",
296
297
  },
298
+ {
299
+ id: "plan.diagrams",
300
+ label: "Plan diagrams",
301
+ category: "Plan",
302
+ valueType: "boolean",
303
+ values: [false, true],
304
+ read: (config) => config.plan.diagrams,
305
+ description: "The plan agent may add Mermaid diagrams to a plan (exit_plan). The terminal shows each diagram's title, explanation and source; the web draws them in the plan viewer. Off removes them from the tool and from the agent's instructions.",
306
+ },
307
+ {
308
+ id: "plan.maxDiagrams",
309
+ label: "Most diagrams per plan",
310
+ category: "Plan",
311
+ valueType: "number",
312
+ values: [0, 1, 2, 3, 4, 5, 6, 7, 8],
313
+ read: (config) => config.plan.maxDiagrams,
314
+ description: "Diagrams beyond this number are dropped (the tool result says so). 0 behaves like turning plan diagrams off.",
315
+ },
297
316
  {
298
317
  id: "tui.paddingX",
299
318
  label: "Editor padding",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alisio/alisio-code",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Alisio: an extensible, provider-agnostic coding-agent harness for your terminal. TUI, OpenAI-compatible providers, permissioned local tools, context compaction, persistent memory and a typed plugin SDK.",
5
5
  "author": "Gustavo Gutiérrez",
6
6
  "license": "MIT",
@@ -45,12 +45,12 @@
45
45
  "alisio": "./dist/main.js"
46
46
  },
47
47
  "dependencies": {
48
- "@alisio/core": "0.1.1",
49
- "@alisio/plugin-memory": "0.1.1",
50
- "@alisio/plugin-openai-compatible": "0.1.1",
51
- "@alisio/plugin-subagents": "0.1.1",
52
- "@alisio/sdk": "0.1.1",
53
- "@alisio/server": "0.1.1",
48
+ "@alisio/core": "0.2.1",
49
+ "@alisio/plugin-memory": "0.2.1",
50
+ "@alisio/plugin-openai-compatible": "0.2.1",
51
+ "@alisio/plugin-subagents": "0.2.1",
52
+ "@alisio/sdk": "0.2.1",
53
+ "@alisio/server": "0.2.1",
54
54
  "@earendil-works/pi-tui": "0.87.1",
55
55
  "commander": "15.0.0"
56
56
  },