agent-sh 0.14.10 → 0.15.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/README.md +36 -13
- package/dist/agent/agent-loop.d.ts +9 -17
- package/dist/agent/agent-loop.js +123 -150
- package/dist/agent/events.d.ts +10 -12
- package/dist/agent/host-types.d.ts +17 -11
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +76 -29
- package/dist/agent/live-view.d.ts +3 -3
- package/dist/agent/live-view.js +15 -7
- package/dist/agent/providers/deepseek.js +9 -1
- package/dist/agent/providers/openrouter.js +9 -0
- package/dist/agent/session-store.js +1 -1
- package/dist/agent/subagent.js +1 -1
- package/dist/agent/system-prompt.d.ts +7 -3
- package/dist/agent/system-prompt.js +11 -14
- package/dist/agent/tool-protocol.js +0 -7
- package/dist/cli/args.js +2 -1
- package/dist/cli/install.d.ts +1 -0
- package/dist/cli/install.js +39 -2
- package/dist/cli/subcommands.js +1 -0
- package/dist/core/event-bus.js +0 -2
- package/dist/core/extension-loader.js +3 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +3 -2
- package/dist/extensions/slash-commands/index.js +16 -11
- package/dist/shell/events.d.ts +3 -0
- package/dist/shell/index.js +9 -0
- package/dist/shell/shell-context.d.ts +2 -2
- package/dist/shell/shell-context.js +26 -11
- package/dist/shell/shell.js +3 -0
- package/dist/shell/tui-renderer.js +0 -1
- package/dist/utils/diff-renderer.d.ts +4 -0
- package/dist/utils/diff-renderer.js +15 -27
- package/dist/utils/handler-registry.d.ts +1 -6
- package/dist/utils/handler-registry.js +1 -6
- package/dist/utils/line-editor.js +0 -2
- package/dist/utils/palette.js +4 -4
- package/dist/utils/terminal-buffer.d.ts +2 -0
- package/dist/utils/terminal-buffer.js +4 -0
- package/examples/extensions/ads/SKILL.md +170 -0
- package/examples/extensions/ash-acp-bridge/src/index.ts +11 -7
- package/examples/extensions/ash-scheme/index.ts +377 -687
- package/examples/extensions/ash-scheme/package.json +1 -1
- package/examples/extensions/ashi/EXTENDING.md +118 -0
- package/examples/extensions/ashi/README.md +26 -54
- package/examples/extensions/ashi/docs/ui-surface-protocol.md +163 -0
- package/examples/extensions/ashi/package.json +14 -2
- package/examples/extensions/ashi/src/autocomplete-controller.ts +95 -0
- package/examples/extensions/ashi/src/autocomplete.ts +1 -23
- package/examples/extensions/ashi/src/capture.ts +54 -10
- package/examples/extensions/ashi/src/chat/assistant.ts +67 -0
- package/examples/extensions/ashi/src/chat/lines.ts +39 -0
- package/examples/extensions/ashi/src/chat/thinking.ts +42 -0
- package/examples/extensions/ashi/src/chat/tool-group.ts +84 -0
- package/examples/extensions/ashi/src/chat/user-message.ts +20 -0
- package/examples/extensions/ashi/src/cli.ts +80 -12
- package/examples/extensions/ashi/src/clipboard-image.ts +41 -0
- package/examples/extensions/ashi/src/commands.ts +11 -1
- package/examples/extensions/ashi/src/dialogs.ts +67 -0
- package/examples/extensions/ashi/src/display-config.ts +16 -1
- package/examples/extensions/ashi/src/docks.ts +31 -0
- package/examples/extensions/ashi/src/events.ts +16 -0
- package/examples/extensions/ashi/src/frontend.ts +456 -268
- package/examples/extensions/ashi/src/hooks.ts +27 -40
- package/examples/extensions/ashi/src/input-prompt.ts +64 -0
- package/examples/extensions/ashi/src/renderer.ts +222 -0
- package/examples/extensions/ashi/src/renderers/pi-tui/app.ts +122 -0
- package/examples/extensions/ashi/src/renderers/pi-tui/index.ts +27 -0
- package/examples/extensions/ashi/src/renderers/pi-tui/nodes.ts +190 -0
- package/examples/extensions/ashi/src/renderers/pi-tui/schema-mount.ts +203 -0
- package/examples/extensions/ashi/src/renderers/pi-tui/theme-adapters.ts +48 -0
- package/examples/extensions/ashi/src/renderers/pi-tui/tool-group.ts +21 -0
- package/examples/extensions/ashi/src/schema.ts +46 -205
- package/examples/extensions/ashi/src/session-commands.ts +2 -1
- package/examples/extensions/ashi/src/status-footer.ts +35 -25
- package/examples/extensions/ashi/src/terminal-mode.ts +9 -0
- package/examples/extensions/ashi/src/theme.ts +1 -47
- package/examples/extensions/ashi/src/ui.ts +88 -0
- package/examples/extensions/ashi-ink/README.md +61 -0
- package/examples/extensions/ashi-ink/package.json +30 -0
- package/examples/extensions/ashi-ink/src/index.ts +6 -0
- package/examples/extensions/ashi-ink/src/ink-renderer.tsx +865 -0
- package/examples/extensions/ashi-ink/src/shims.d.ts +5 -0
- package/examples/extensions/ashi-ink/test/render.test.tsx +408 -0
- package/examples/extensions/ashi-ink/tsconfig.json +14 -0
- package/examples/extensions/ashi-scheme-render.ts +10 -10
- package/examples/extensions/ashi-shell-passthrough.ts +95 -0
- package/examples/extensions/ashi-ui-demo.ts +63 -0
- package/examples/extensions/latex-images.ts +70 -19
- package/examples/extensions/overlay-agent.ts +5 -5
- package/examples/extensions/pi-bridge/index.ts +7 -12
- package/examples/extensions/terminal-buffer.ts +4 -2
- package/package.json +3 -9
- package/examples/extensions/ashi/src/components.ts +0 -238
- package/examples/extensions/ollama.ts +0 -108
- package/examples/extensions/opencode-provider.ts +0 -251
- package/examples/extensions/zai-coding-plan.ts +0 -35
|
@@ -5,13 +5,14 @@ export type ToolResultMode = "hidden" | "summary" | "preview";
|
|
|
5
5
|
export interface ToolEntryConfig {
|
|
6
6
|
result: ToolResultMode;
|
|
7
7
|
previewLines: number;
|
|
8
|
+
expandedLines: number;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export interface DisplayResolver {
|
|
11
12
|
resolve(name: string, modelDisplay?: Partial<ToolEntryConfig>): ToolEntryConfig;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const DEFAULT_ENTRY: ToolEntryConfig = { result: "preview", previewLines: 5 };
|
|
15
|
+
const DEFAULT_ENTRY: ToolEntryConfig = { result: "preview", previewLines: 5, expandedLines: 200 };
|
|
15
16
|
|
|
16
17
|
const BUILTIN_OVERRIDES: Record<string, Partial<ToolEntryConfig>> = {
|
|
17
18
|
read: { result: "hidden" },
|
|
@@ -29,6 +30,13 @@ const BUILTIN_OVERRIDES: Record<string, Partial<ToolEntryConfig>> = {
|
|
|
29
30
|
interface AshiSettings extends Record<string, unknown> {
|
|
30
31
|
display?: Record<string, Partial<ToolEntryConfig>>;
|
|
31
32
|
groupMaxVisible?: number;
|
|
33
|
+
renderer?: string;
|
|
34
|
+
imageScale?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function loadRendererPreference(): string | undefined {
|
|
38
|
+
const r = getExtensionSettings<AshiSettings>("ashi", {}).renderer;
|
|
39
|
+
return typeof r === "string" && r.trim() ? r.trim() : undefined;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
export function loadGroupMaxVisible(): number {
|
|
@@ -38,11 +46,18 @@ export function loadGroupMaxVisible(): number {
|
|
|
38
46
|
return Math.floor(v);
|
|
39
47
|
}
|
|
40
48
|
|
|
49
|
+
export function loadImageScale(fallback: number): number {
|
|
50
|
+
const v = getExtensionSettings<AshiSettings>("ashi", {}).imageScale;
|
|
51
|
+
if (typeof v !== "number" || !Number.isFinite(v) || v <= 0) return fallback;
|
|
52
|
+
return v;
|
|
53
|
+
}
|
|
54
|
+
|
|
41
55
|
function mergeEntry(base: ToolEntryConfig, patch?: Partial<ToolEntryConfig>): ToolEntryConfig {
|
|
42
56
|
if (!patch) return { ...base };
|
|
43
57
|
return {
|
|
44
58
|
result: patch.result ?? base.result,
|
|
45
59
|
previewLines: patch.previewLines ?? base.previewLines,
|
|
60
|
+
expandedLines: patch.expandedLines ?? base.expandedLines,
|
|
46
61
|
};
|
|
47
62
|
}
|
|
48
63
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { EventBus } from "agent-sh/event-bus";
|
|
2
|
+
import type { App, Renderer } from "./renderer.js";
|
|
3
|
+
|
|
4
|
+
export interface Dock {
|
|
5
|
+
refresh(): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function createDock(app: App, renderer: Renderer, bus: EventBus): Dock {
|
|
9
|
+
const container = renderer.container();
|
|
10
|
+
let mounted = false;
|
|
11
|
+
|
|
12
|
+
const refresh = (): void => {
|
|
13
|
+
container.clear();
|
|
14
|
+
const { views } = bus.emitPipe("ashi:dock:above-input", { nodes: renderer, views: [] });
|
|
15
|
+
for (const view of views) container.addChild(view);
|
|
16
|
+
// Mount only when non-empty: an always-present footer child (even empty) defeats the
|
|
17
|
+
// footer slot's blank-line spacing above the input.
|
|
18
|
+
if (views.length > 0 && !mounted) {
|
|
19
|
+
app.footerSlot.addChild(container.node);
|
|
20
|
+
mounted = true;
|
|
21
|
+
} else if (views.length === 0 && mounted) {
|
|
22
|
+
app.footerSlot.removeChild(container.node);
|
|
23
|
+
mounted = false;
|
|
24
|
+
}
|
|
25
|
+
app.requestRender();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
bus.on("ashi:dock:invalidate", refresh);
|
|
29
|
+
refresh();
|
|
30
|
+
return { refresh };
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// ui:* names are neutral by intent but declared HERE in ashi, not core, on purpose: a name
|
|
2
|
+
// graduates to core's BusEvents only when a second frontend outside ashi speaks it
|
|
3
|
+
// (see docs/ui-surface-protocol.md). ashi:* names carry TUI vocabulary and stay ashi-owned.
|
|
4
|
+
import type { RenderNode, RenderNodes } from "./renderer.js";
|
|
5
|
+
import type { StatusSegment } from "./status-footer.js";
|
|
6
|
+
|
|
7
|
+
declare module "agent-sh/event-bus" {
|
|
8
|
+
interface BusEvents {
|
|
9
|
+
"ui:notify": { message: string; level?: "info" | "warn" | "error" | "success" };
|
|
10
|
+
"ui:status": { segments: StatusSegment[] };
|
|
11
|
+
"ui:status:invalidate": Record<string, never>;
|
|
12
|
+
"ashi:dock:above-input": { nodes: RenderNodes; views: RenderNode[] };
|
|
13
|
+
"ashi:dock:invalidate": Record<string, never>;
|
|
14
|
+
"ashi:ready": Record<string, never>;
|
|
15
|
+
}
|
|
16
|
+
}
|