agent-sh 0.15.0 → 0.15.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 (124) hide show
  1. package/dist/agent/agent-loop.js +11 -8
  2. package/dist/agent/events.d.ts +4 -0
  3. package/docs/README.md +14 -0
  4. package/docs/agent.md +398 -0
  5. package/docs/architecture.md +196 -0
  6. package/docs/context-management.md +200 -0
  7. package/docs/extensions.md +951 -0
  8. package/docs/library.md +84 -0
  9. package/docs/troubleshooting.md +65 -0
  10. package/docs/tui-composition.md +294 -0
  11. package/docs/usage.md +306 -0
  12. package/examples/extensions/ash-scheme/package.json +1 -1
  13. package/examples/extensions/ashi/EXTENDING.md +2 -2
  14. package/examples/extensions/ashi/README.md +2 -2
  15. package/examples/extensions/ashi/docs/ui-surface-protocol.md +1 -1
  16. package/examples/extensions/ashi/package.json +5 -3
  17. package/examples/extensions/ashi/src/chat/tool-group.ts +3 -2
  18. package/examples/extensions/ashi/src/cli.ts +9 -8
  19. package/examples/extensions/ashi/src/dialogs.ts +16 -1
  20. package/examples/extensions/ashi/src/events.ts +1 -0
  21. package/examples/extensions/ashi/src/frontend.ts +26 -6
  22. package/examples/extensions/ashi/src/renderer.ts +24 -4
  23. package/examples/extensions/ashi/src/renderers/pi-tui/schema-mount.ts +4 -3
  24. package/examples/extensions/ashi/src/renderers/pi-tui/tool-group.ts +5 -8
  25. package/examples/extensions/ashi/src/ui.ts +11 -0
  26. package/examples/extensions/ashi-ink/package.json +2 -2
  27. package/examples/extensions/claude-code-bridge/package.json +1 -1
  28. package/examples/extensions/opencode-bridge/package.json +1 -1
  29. package/package.json +3 -1
  30. package/src/agent/agent-loop.ts +1566 -0
  31. package/src/agent/entry-format.ts +19 -0
  32. package/src/agent/events.ts +153 -0
  33. package/src/agent/extensions/rolling-history/constants.ts +1 -0
  34. package/src/agent/extensions/rolling-history/index.ts +202 -0
  35. package/src/agent/extensions/rolling-history/recall.ts +131 -0
  36. package/src/agent/extensions/rolling-history/strategy.ts +404 -0
  37. package/src/agent/host-types.ts +192 -0
  38. package/src/agent/index.ts +591 -0
  39. package/src/agent/live-view.ts +279 -0
  40. package/src/agent/llm-client.ts +111 -0
  41. package/src/agent/llm-facade.ts +43 -0
  42. package/src/agent/normalize-args.ts +61 -0
  43. package/src/agent/nuclear-form.ts +382 -0
  44. package/src/agent/providers/deepseek.ts +39 -0
  45. package/src/agent/providers/ollama.ts +92 -0
  46. package/src/agent/providers/openai-compatible.ts +36 -0
  47. package/src/agent/providers/openai.ts +52 -0
  48. package/src/agent/providers/opencode.ts +142 -0
  49. package/src/agent/providers/openrouter.ts +105 -0
  50. package/src/agent/providers/zai-coding-plan.ts +33 -0
  51. package/src/agent/session-store.ts +336 -0
  52. package/src/agent/skills.ts +228 -0
  53. package/src/agent/store.ts +310 -0
  54. package/src/agent/subagent.ts +305 -0
  55. package/src/agent/system-prompt.ts +151 -0
  56. package/src/agent/token-budget.ts +12 -0
  57. package/src/agent/tool-protocol.ts +722 -0
  58. package/src/agent/tool-registry.ts +66 -0
  59. package/src/agent/tools/bash.ts +95 -0
  60. package/src/agent/tools/edit-file.ts +154 -0
  61. package/src/agent/tools/expand-home.ts +7 -0
  62. package/src/agent/tools/glob.ts +108 -0
  63. package/src/agent/tools/grep.ts +228 -0
  64. package/src/agent/tools/list-skills.ts +37 -0
  65. package/src/agent/tools/ls.ts +81 -0
  66. package/src/agent/tools/pwsh.ts +140 -0
  67. package/src/agent/tools/read-file.ts +164 -0
  68. package/src/agent/tools/write-file.ts +72 -0
  69. package/src/agent/types.ts +149 -0
  70. package/src/cli/args.ts +91 -0
  71. package/src/cli/auth/cli.ts +244 -0
  72. package/src/cli/auth/discover.ts +52 -0
  73. package/src/cli/auth/keys.ts +143 -0
  74. package/src/cli/index.ts +295 -0
  75. package/src/cli/init.ts +74 -0
  76. package/src/cli/install.ts +439 -0
  77. package/src/cli/shell-env.ts +68 -0
  78. package/src/cli/subcommands.ts +24 -0
  79. package/src/core/event-bus.ts +252 -0
  80. package/src/core/extension-loader.ts +347 -0
  81. package/src/core/index.ts +152 -0
  82. package/src/core/settings.ts +398 -0
  83. package/src/core/types.ts +61 -0
  84. package/src/extensions/file-autocomplete.ts +71 -0
  85. package/src/extensions/index.ts +38 -0
  86. package/src/extensions/slash-commands/events.ts +14 -0
  87. package/src/extensions/slash-commands/index.ts +269 -0
  88. package/src/shell/events.ts +73 -0
  89. package/src/shell/host-types.ts +150 -0
  90. package/src/shell/index.ts +159 -0
  91. package/src/shell/input-handler.ts +505 -0
  92. package/src/shell/output-parser.ts +156 -0
  93. package/src/shell/shell-context.ts +193 -0
  94. package/src/shell/shell.ts +414 -0
  95. package/src/shell/strategies/bash.ts +83 -0
  96. package/src/shell/strategies/fish.ts +77 -0
  97. package/src/shell/strategies/index.ts +24 -0
  98. package/src/shell/strategies/types.ts +64 -0
  99. package/src/shell/strategies/zsh.ts +92 -0
  100. package/src/shell/terminal.ts +124 -0
  101. package/src/shell/tui-input-view.ts +222 -0
  102. package/src/shell/tui-renderer.ts +1126 -0
  103. package/src/utils/ansi.ts +140 -0
  104. package/src/utils/box-frame.ts +138 -0
  105. package/src/utils/compositor.ts +157 -0
  106. package/src/utils/diff-renderer.ts +829 -0
  107. package/src/utils/diff.ts +244 -0
  108. package/src/utils/executor.ts +305 -0
  109. package/src/utils/file-watcher.ts +110 -0
  110. package/src/utils/floating-panel.ts +1160 -0
  111. package/src/utils/handler-registry.ts +110 -0
  112. package/src/utils/line-editor.ts +636 -0
  113. package/src/utils/markdown.ts +437 -0
  114. package/src/utils/message-utils.ts +113 -0
  115. package/src/utils/package-version.ts +12 -0
  116. package/src/utils/palette.ts +64 -0
  117. package/src/utils/ref-counter.ts +9 -0
  118. package/src/utils/ripgrep-path.ts +17 -0
  119. package/src/utils/shell-output-spill.ts +76 -0
  120. package/src/utils/stream-transform.ts +292 -0
  121. package/src/utils/terminal-buffer.ts +213 -0
  122. package/src/utils/tool-display.ts +315 -0
  123. package/src/utils/tool-interactive.ts +71 -0
  124. package/src/utils/tty.ts +14 -0
@@ -136,8 +136,9 @@ class SchemaResultComponent extends Container {
136
136
  this.handle.dispatch("status", { ...opts, elapsedMs: 0 });
137
137
  HANDLES.delete(this.handle.toolCallId);
138
138
  }
139
- toggleExpanded(): void {
140
- this.handle.cell.env = { ...this.handle.cell.env, expanded: !this.handle.cell.env.expanded };
139
+ setExpanded(expanded: boolean): void {
140
+ if (this.handle.cell.env.expanded === expanded) return;
141
+ this.handle.cell.env = { ...this.handle.cell.env, expanded };
141
142
  this.repaint();
142
143
  this.handle.cell.callView?.repaint();
143
144
  }
@@ -198,6 +199,6 @@ export function mountResult<S>(model: RenderModel<S>, args: MountArgs, env: Moun
198
199
  appendChunk: (chunk) => comp.appendChunk(chunk),
199
200
  setDiffRenderer: (fn) => comp.setDiffRenderer(fn),
200
201
  finalize: (opts) => comp.finalize(opts),
201
- toggleExpanded: () => comp.toggleExpanded(),
202
+ setExpanded: (expanded) => comp.setExpanded(expanded),
202
203
  };
203
204
  }
@@ -3,18 +3,15 @@ import { createNodes } from "./nodes.js";
3
3
 
4
4
  export function createPiTuiToolGroup(): ToolGroupView {
5
5
  const nodes = createNodes();
6
- const rows = nodes.container();
7
6
  const container = nodes.container();
8
7
  container.addChild(nodes.spacer(1));
9
- container.addChild(rows.node);
8
+ const text = nodes.text({ paddingX: 1 });
9
+ container.addChild(text.node);
10
10
 
11
11
  const update = (model: ToolGroupModel): void => {
12
- rows.clear();
13
- for (const line of renderToolGroupLines(model)) {
14
- const t = nodes.text({ paddingX: 1 });
15
- t.setText(line);
16
- rows.addChild(t.node);
17
- }
12
+ // paddingX:1 on both sides → content area is width-2; render width-aware so
13
+ // long paths truncate to fit rather than wrap.
14
+ text.setRenderFn((width) => renderToolGroupLines(model, Math.max(1, width - 2)));
18
15
  };
19
16
 
20
17
  return { node: container.node, update };
@@ -10,6 +10,13 @@ export type { StatusSegment } from "./status-footer.js";
10
10
 
11
11
  export type NoticeLevel = "info" | "warn" | "error" | "success";
12
12
 
13
+ export interface DiffOpts {
14
+ before?: string | null;
15
+ after?: string;
16
+ filePath?: string;
17
+ boxed?: boolean;
18
+ }
19
+
13
20
  export interface Contribution {
14
21
  /** Re-pull this surface (call after the content it depends on changes). */
15
22
  refresh(): void;
@@ -26,6 +33,7 @@ export interface Ui {
26
33
  notify(message: string, level?: NoticeLevel): void;
27
34
  select(opts: SelectOpts): Promise<string | undefined>;
28
35
  confirm(opts: ConfirmOpts): Promise<boolean>;
36
+ diff(opts: DiffOpts): (width: number) => string[];
29
37
  input(opts?: InputOpts): Promise<string | undefined>;
30
38
  getEditorText(): string;
31
39
  setEditorText(text: string): void;
@@ -50,6 +58,9 @@ export function createUi(ctx: ExtensionContext): Ui {
50
58
  if (!has("ui:confirm")) return Promise.resolve(false);
51
59
  return ctx.call("ui:confirm", opts) as Promise<boolean>;
52
60
  },
61
+ diff(opts) {
62
+ return has("ui:diff") ? (ctx.call("ui:diff", opts) as (width: number) => string[]) : (() => []);
63
+ },
53
64
  input(opts = {}) {
54
65
  if (!has("ui:input")) return Promise.resolve(undefined);
55
66
  return ctx.call("ui:input", opts) as Promise<string | undefined>;
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@earendil-works/pi-tui": "^0.74.0",
14
- "@guanyilun/ashi": "^0.2.0",
15
- "agent-sh": "^0.14.0",
14
+ "@guanyilun/ashi": "^0.3.0",
15
+ "agent-sh": "^0.15.0",
16
16
  "cli-table3": "^0.6.0",
17
17
  "ink": "^5.0.0",
18
18
  "ink-spinner": "^5.0.0",
@@ -6,7 +6,7 @@
6
6
  "main": "index.ts",
7
7
  "dependencies": {
8
8
  "@anthropic-ai/claude-agent-sdk": "^0.2.0",
9
- "agent-sh": "^0.14.0",
9
+ "agent-sh": "^0.15.0",
10
10
  "zod": "^4.0.0"
11
11
  }
12
12
  }
@@ -6,6 +6,6 @@
6
6
  "main": "index.ts",
7
7
  "dependencies": {
8
8
  "@opencode-ai/sdk": "^1.14.41",
9
- "agent-sh": "^0.14.0"
9
+ "agent-sh": "^0.15.0"
10
10
  }
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-sh",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "A composable agent runtime — pair any frontend with any agent backend over one shared extension layer",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -140,6 +140,8 @@
140
140
  },
141
141
  "files": [
142
142
  "dist",
143
+ "src",
144
+ "docs",
143
145
  "examples/extensions"
144
146
  ],
145
147
  "scripts": {