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.
Files changed (97) hide show
  1. package/README.md +36 -13
  2. package/dist/agent/agent-loop.d.ts +9 -17
  3. package/dist/agent/agent-loop.js +123 -150
  4. package/dist/agent/events.d.ts +10 -12
  5. package/dist/agent/host-types.d.ts +17 -11
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +76 -29
  8. package/dist/agent/live-view.d.ts +3 -3
  9. package/dist/agent/live-view.js +15 -7
  10. package/dist/agent/providers/deepseek.js +9 -1
  11. package/dist/agent/providers/openrouter.js +9 -0
  12. package/dist/agent/session-store.js +1 -1
  13. package/dist/agent/subagent.js +1 -1
  14. package/dist/agent/system-prompt.d.ts +7 -3
  15. package/dist/agent/system-prompt.js +11 -14
  16. package/dist/agent/tool-protocol.js +0 -7
  17. package/dist/cli/args.js +2 -1
  18. package/dist/cli/install.d.ts +1 -0
  19. package/dist/cli/install.js +39 -2
  20. package/dist/cli/subcommands.js +1 -0
  21. package/dist/core/event-bus.js +0 -2
  22. package/dist/core/extension-loader.js +3 -1
  23. package/dist/core/index.d.ts +1 -1
  24. package/dist/core/index.js +3 -2
  25. package/dist/extensions/slash-commands/index.js +16 -11
  26. package/dist/shell/events.d.ts +3 -0
  27. package/dist/shell/index.js +9 -0
  28. package/dist/shell/shell-context.d.ts +2 -2
  29. package/dist/shell/shell-context.js +26 -11
  30. package/dist/shell/shell.js +3 -0
  31. package/dist/shell/tui-renderer.js +0 -1
  32. package/dist/utils/diff-renderer.d.ts +4 -0
  33. package/dist/utils/diff-renderer.js +15 -27
  34. package/dist/utils/handler-registry.d.ts +1 -6
  35. package/dist/utils/handler-registry.js +1 -6
  36. package/dist/utils/line-editor.js +0 -2
  37. package/dist/utils/palette.js +4 -4
  38. package/dist/utils/terminal-buffer.d.ts +2 -0
  39. package/dist/utils/terminal-buffer.js +4 -0
  40. package/examples/extensions/ads/SKILL.md +170 -0
  41. package/examples/extensions/ash-acp-bridge/src/index.ts +11 -7
  42. package/examples/extensions/ash-scheme/index.ts +377 -687
  43. package/examples/extensions/ash-scheme/package.json +1 -1
  44. package/examples/extensions/ashi/EXTENDING.md +118 -0
  45. package/examples/extensions/ashi/README.md +26 -54
  46. package/examples/extensions/ashi/docs/ui-surface-protocol.md +163 -0
  47. package/examples/extensions/ashi/package.json +14 -2
  48. package/examples/extensions/ashi/src/autocomplete-controller.ts +95 -0
  49. package/examples/extensions/ashi/src/autocomplete.ts +1 -23
  50. package/examples/extensions/ashi/src/capture.ts +54 -10
  51. package/examples/extensions/ashi/src/chat/assistant.ts +67 -0
  52. package/examples/extensions/ashi/src/chat/lines.ts +39 -0
  53. package/examples/extensions/ashi/src/chat/thinking.ts +42 -0
  54. package/examples/extensions/ashi/src/chat/tool-group.ts +84 -0
  55. package/examples/extensions/ashi/src/chat/user-message.ts +20 -0
  56. package/examples/extensions/ashi/src/cli.ts +80 -12
  57. package/examples/extensions/ashi/src/clipboard-image.ts +41 -0
  58. package/examples/extensions/ashi/src/commands.ts +11 -1
  59. package/examples/extensions/ashi/src/dialogs.ts +67 -0
  60. package/examples/extensions/ashi/src/display-config.ts +16 -1
  61. package/examples/extensions/ashi/src/docks.ts +31 -0
  62. package/examples/extensions/ashi/src/events.ts +16 -0
  63. package/examples/extensions/ashi/src/frontend.ts +456 -268
  64. package/examples/extensions/ashi/src/hooks.ts +27 -40
  65. package/examples/extensions/ashi/src/input-prompt.ts +64 -0
  66. package/examples/extensions/ashi/src/renderer.ts +222 -0
  67. package/examples/extensions/ashi/src/renderers/pi-tui/app.ts +122 -0
  68. package/examples/extensions/ashi/src/renderers/pi-tui/index.ts +27 -0
  69. package/examples/extensions/ashi/src/renderers/pi-tui/nodes.ts +190 -0
  70. package/examples/extensions/ashi/src/renderers/pi-tui/schema-mount.ts +203 -0
  71. package/examples/extensions/ashi/src/renderers/pi-tui/theme-adapters.ts +48 -0
  72. package/examples/extensions/ashi/src/renderers/pi-tui/tool-group.ts +21 -0
  73. package/examples/extensions/ashi/src/schema.ts +46 -205
  74. package/examples/extensions/ashi/src/session-commands.ts +2 -1
  75. package/examples/extensions/ashi/src/status-footer.ts +35 -25
  76. package/examples/extensions/ashi/src/terminal-mode.ts +9 -0
  77. package/examples/extensions/ashi/src/theme.ts +1 -47
  78. package/examples/extensions/ashi/src/ui.ts +88 -0
  79. package/examples/extensions/ashi-ink/README.md +61 -0
  80. package/examples/extensions/ashi-ink/package.json +30 -0
  81. package/examples/extensions/ashi-ink/src/index.ts +6 -0
  82. package/examples/extensions/ashi-ink/src/ink-renderer.tsx +865 -0
  83. package/examples/extensions/ashi-ink/src/shims.d.ts +5 -0
  84. package/examples/extensions/ashi-ink/test/render.test.tsx +408 -0
  85. package/examples/extensions/ashi-ink/tsconfig.json +14 -0
  86. package/examples/extensions/ashi-scheme-render.ts +10 -10
  87. package/examples/extensions/ashi-shell-passthrough.ts +95 -0
  88. package/examples/extensions/ashi-ui-demo.ts +63 -0
  89. package/examples/extensions/latex-images.ts +70 -19
  90. package/examples/extensions/overlay-agent.ts +5 -5
  91. package/examples/extensions/pi-bridge/index.ts +7 -12
  92. package/examples/extensions/terminal-buffer.ts +4 -2
  93. package/package.json +3 -9
  94. package/examples/extensions/ashi/src/components.ts +0 -238
  95. package/examples/extensions/ollama.ts +0 -108
  96. package/examples/extensions/opencode-provider.ts +0 -251
  97. package/examples/extensions/zai-coding-plan.ts +0 -35
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: ads
3
+ description: >-
4
+ Full ADS query syntax reference and search strategy for the ads_search, ads_paper, ads_citations,
5
+ and ads_download_pdf tools. Load this before composing ADS queries — the tool descriptions only
6
+ cover basic field prefixes. Contains: fielded search syntax, date/class filters (entdate, arxiv_class),
7
+ citation operators, wildcards, positional search, properties, doctypes, daily arXiv listing patterns,
8
+ and query recipes.
9
+ ---
10
+
11
+ # ADS Query Syntax & Search Strategy
12
+
13
+ Reference: <https://ui.adsabs.harvard.edu/help/search/>
14
+
15
+ ## Query Basics
16
+
17
+ - Space = AND, `OR`, `NOT` / `-` (exclude), `()` group, `"phrase"`
18
+ - Precedence: `NOT` > `AND` > `OR` > implicit-AND > `-`
19
+
20
+ ## Fielded Search
21
+
22
+ ### Text Fields
23
+
24
+ | Field | Syntax |
25
+ |-------|--------|
26
+ | Title+Abstract+Keywords | `abs:"phrase"` |
27
+ | Title only | `title:"phrase"` |
28
+ | Abstract only | `abstract:"phrase"` |
29
+ | Keywords | `keyword:"phrase"` |
30
+ | Full text (body+abs+title+ack+kw) | `full:"phrase"` |
31
+ | Body only | `body:"phrase"` |
32
+ | Acknowledgements | `ack:"phrase"` |
33
+
34
+ ### Author
35
+
36
+ | Syntax | Meaning |
37
+ |--------|---------|
38
+ | `author:"Last, F"` | Greedy match (initials, variations) |
39
+ | `author:"Last, First M"` | More precise (recommended) |
40
+ | `author:"^Last, F"` | First-author only |
41
+ | `=author:"Last, F"` | Exact match, no synonym expansion |
42
+
43
+ Precision: `author:"murray, s"` (broadest) → `"murray, stephen"` → `"murray, stephen s"` (tightest)
44
+
45
+ ### Identifiers & Publication
46
+
47
+ `bibcode:ID`, `doi:DOI`, `arXiv:ID`, `identifier:ID`, `bibstem:ApJ`, `volume:N`, `issue:N`, `page:N`, `year:YYYY` or `year:YYYY-YYYY`, `pubdate:[YYYY-MM TO YYYY-MM]`
48
+
49
+ ### Affiliation
50
+
51
+ `aff:"phrase"` (raw), `inst:"Harvard U"` (curated, matches variants), `inst:"UCLA/IGPP"` (department), `aff_id:ID`
52
+
53
+ ### Object & Position
54
+
55
+ `object:Andromeda` (SIMBAD+NED), `object:"(SMC OR LMC) AND M31"` (combined), cone search: `object:"RA Dec:radius"` (decimal deg or sexagesimal, default 2', max 60')
56
+
57
+ ### Classification & Counts
58
+
59
+ `database:astronomy|physics|general`, `doctype:type`, `arxiv_class:"class"`, `property:flag`, `bibgroup:name`, `citation_count:[10 TO 100]`, `author_count:[10 TO 100]`, `read_count:N`, `facility:/regex/`, `orcid:ID`, `grant:agency`
60
+
61
+ ## Synonyms & Case Sensitivity
62
+
63
+ - lowercase → matches variations + synonyms (e.g. `title:star` → star, stars, stellar…)
64
+ - UPPERCASE → acronym-only (`title:STAR` → only "STAR")
65
+ - `=field:` prefix → exact match, no synonym expansion
66
+
67
+ ## Wildcards & Proximity
68
+
69
+ | Syntax | Meaning |
70
+ |--------|---------|
71
+ | `*` / `?` | Multi/single-char wildcard |
72
+ | `NEAR[N]` | ≤N words apart, any order |
73
+ | `"term1 term2"~N` | In-order proximity within N positions |
74
+ | `/regex/` | Lucene regex on indexed tokens |
75
+
76
+ ## Positional Search — `pos(query, positions...)`
77
+
78
+ Works on: `author`, `aff`, `title`. Examples: `pos(author:"Oort, J", 2)` (2nd author), `pos(author:"Oort", 1,3)` (1st–3rd), `pos(author:"Oort", -1)` (last), `pos(aff:"harvard", 1)` (1st author at Harvard)
79
+
80
+ ## Citation & Reference Operators
81
+
82
+ `citations(query)` = papers citing query results, `references(query)` = papers cited by query results. Nestable with other terms.
83
+
84
+ ## Second-Order Operators
85
+
86
+ `similar(query)` (textually similar), `trending(query)` (read by same readers), `useful(query)` (frequently cited by results), `reviews(query)` (citing papers ranked by freq), `topn(N, query, sort)`
87
+
88
+ Tip: `similar()` excludes originals; use disjoint `entdate` ranges to control overlap.
89
+
90
+ ## Properties
91
+
92
+ `refereed`, `notrefereed`, `article`, `nonarticle`, `openaccess`, `ads_openaccess`, `pub_openaccess`, `eprint_openaccess`, `author_openaccess`, `data`, `esource`, `inspire`, `toc`
93
+
94
+ ## Document Types
95
+
96
+ `article`, `eprint`, `inproceedings`, `inbook`, `abstract`, `book`, `bookreview`, `catalog`, `circular`, `erratum`, `mastersthesis`, `newsletter`, `obituary`, `phdthesis`, `pressrelease`, `proceedings`, `proposal`, `software`, `talk`, `techreport`, `misc`
97
+
98
+ ## Bibliographic Groups
99
+
100
+ Institutional: ARI, CfA, CFHT, Leiden, USNO | Telescope: ALMA, CXC, ESO, Gemini, Herschel, HST, ISO, IUE, JCMT, Keck, Magellan, NOIRLab, NRAO, ROSAT, SDO, SMA, Spitzer, Subaru, Swift, UKIRT, XMM
101
+
102
+ ## Daily arXiv Listings
103
+
104
+ Use `entdate` (day-resolution) with `doctype:eprint` and `arxiv_class`. Note: `pubdate` is month-resolution only.
105
+
106
+ ```
107
+ # Today's astro-ph.CO (±2 day window)
108
+ arxiv_class:"astro-ph.CO" entdate:[2026-04-07 TO 2026-04-09] doctype:eprint
109
+
110
+ # All astro-ph classes
111
+ arxiv_class:("astro-ph.CO" OR "astro-ph.GA" OR "astro-ph.HE" OR "astro-ph.IM" OR "astro-ph.EP" OR "astro-ph.SR") entdate:[2026-04-07 TO 2026-04-09] doctype:eprint
112
+ ```
113
+
114
+ Subclasses: `CO` (Cosmology), `EP` (Earth & Planetary), `GA` (Galaxy Astrophysics), `HE` (High Energy), `IM` (Instrumentation), `SR` (Solar & Stellar).
115
+
116
+ ## Search Strategy: Simplicity First
117
+
118
+ - Start with 2–3 core nouns. If too many results, add constraints (year, author, title:). Don't start with a sentence.
119
+ - ADS is keyword/metadata matching, not semantic search. Overloading queries kills recall.
120
+ - Use `detail='full'` on fewer results rather than compact on many — abstracts often contain the answer.
121
+
122
+ ### Common Pitfalls
123
+
124
+ **1. Compound multi-concept queries → zero results.**
125
+ Fix: 1–2 core terms + `sort_by` + `year_from:`. Scan abstracts for specifics.
126
+ ```
127
+ # Bad: "Population III He II helium 1640 JWST metal-poor galaxy candidate"
128
+ # Good: "Population III JWST" sort_by:date year_from:2024
129
+ ```
130
+
131
+ **2. Non-article doctypes polluting results.**
132
+ Fix: `doctype:article` or `property:refereed`.
133
+
134
+ **3. Iterative reformulation without simplifying.**
135
+ If 2+ zero-result queries on the same topic: strip to 1–2 broadest terms, or use `web_search` first to find titles/authors, then look up in ADS.
136
+
137
+ **4. Use `web_search` → ADS as a two-step pipeline.**
138
+ For complex/emerging topics, start with `web_search` (plural `queries`, 2–4 varied angles) to identify key papers/arXiv IDs, then verify via `ads_paper` or targeted `ads_search`.
139
+
140
+ ### When Keyword Search Fails, Use Citation Networks
141
+
142
+ For interdisciplinary connections, find a known paper then walk citations (`ads_citations`) or references. Citation chains beat keyword matching for cross-domain discovery.
143
+
144
+ ## Quick Query Recipes
145
+
146
+ ```
147
+ # Recent refereed articles on a topic
148
+ abs:"dark energy" year:2023-2025 property:refereed doctype:article
149
+
150
+ # Papers by first author at an institution
151
+ author:"^smith, john" inst:"MIT"
152
+
153
+ # Highly-cited reviews
154
+ reviews("machine learning astronomy") property:refereed
155
+
156
+ # Papers citing a specific work, sorted by citations
157
+ citations(bibcode:2023ApJ...950L..12A) sort:citation_count
158
+
159
+ # Object in specific journal
160
+ object:Andromeda bibstem:ApJ
161
+
162
+ # Open access with data links
163
+ property:openaccess property:data keyword:"gravitational waves"
164
+
165
+ # Exclude preprints, keep only journal articles
166
+ abs:"transiting exoplanet" doctype:article -arxiv_class:*
167
+
168
+ # Cone search
169
+ object:"12h30m49.4s +12d29m40s:5"
170
+ ```
@@ -434,10 +434,10 @@ function waitForModelsToSettle(
434
434
  timer = setTimeout(done, Math.max(0, Math.min(quietMs, remaining)));
435
435
  };
436
436
  const done = () => {
437
- core.bus.off("agent:modes-changed", arm);
437
+ core.bus.off("agent:models-changed", arm);
438
438
  resolve();
439
439
  };
440
- core.bus.on("agent:modes-changed", arm);
440
+ core.bus.on("agent:models-changed", arm);
441
441
  arm();
442
442
  });
443
443
  }
@@ -446,15 +446,14 @@ function getModelsPayload(): Record<string, unknown> | undefined {
446
446
  if (!core) return undefined;
447
447
  const info = core.bus.emitPipe("config:get-models", { models: [], active: null });
448
448
  if (!info.models.length) return undefined;
449
- const idFor = (m: { model: string; provider: string }) =>
450
- m.provider ? `${m.model}@${m.provider}` : m.model;
449
+ const idFor = (m: { id: string; provider: string }) => `${m.id}@${m.provider}`;
451
450
  const current = info.active ?? info.models[0]!;
452
451
  return {
453
452
  currentModelId: idFor(current),
454
453
  availableModels: info.models.map((m) => ({
455
454
  modelId: idFor(m),
456
- name: m.provider ? `${m.provider}/${m.model}` : m.model,
457
- description: m.provider ? `Provider: ${m.provider}` : "",
455
+ name: `${m.provider}/${m.id}`,
456
+ description: `Provider: ${m.provider}`,
458
457
  })),
459
458
  };
460
459
  }
@@ -601,7 +600,12 @@ function dispatch(msg: JsonRpcRequest): void {
601
600
  break;
602
601
  case "session/set_model":
603
602
  if (core && params?.modelId) {
604
- core.bus.emit("config:switch-model", { model: params.modelId as string });
603
+ const raw = params.modelId as string;
604
+ const at = raw.lastIndexOf("@");
605
+ core.bus.emit("config:switch-model", {
606
+ id: at > 0 ? raw.slice(0, at) : raw,
607
+ provider: at > 0 ? raw.slice(at + 1) : "",
608
+ });
605
609
  }
606
610
  sendResult(id!, {
607
611
  models: getModelsPayload() ?? {},