@parcha/agentrun-serve 0.1.0-beta.56 → 0.1.0-beta.57

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 (275) hide show
  1. package/CHANGELOG.md +229 -0
  2. package/README.md +201 -52
  3. package/dist/acp-package.d.ts +2 -0
  4. package/dist/adapters.d.ts +15 -3
  5. package/dist/adapters.js +17 -6
  6. package/dist/agent-package.d.ts +3 -3
  7. package/dist/agent-package.js +17 -8
  8. package/dist/api-keys.d.ts +76 -0
  9. package/dist/api-keys.js +217 -0
  10. package/dist/api-only.d.ts +17 -5
  11. package/dist/api-only.js +34 -8
  12. package/dist/browser-hold.d.ts +23 -0
  13. package/dist/browser-hold.js +48 -0
  14. package/dist/browser-person.d.ts +3 -0
  15. package/dist/browser-person.js +4 -1
  16. package/dist/chatgpt-plan.d.ts +18 -8
  17. package/dist/chatgpt-plan.js +91 -34
  18. package/dist/claude-login.d.ts +74 -16
  19. package/dist/claude-login.js +215 -56
  20. package/dist/claude-sign-in.d.ts +17 -6
  21. package/dist/claude-sign-in.js +42 -39
  22. package/dist/cli.js +63 -6
  23. package/dist/composio-made.d.ts +4 -0
  24. package/dist/composio-made.js +4 -0
  25. package/dist/composio-preset.d.ts +43 -2
  26. package/dist/composio-preset.js +92 -4
  27. package/dist/computer-held-routes.d.ts +5 -4
  28. package/dist/computer-held-routes.js +29 -8
  29. package/dist/computer-held.d.ts +6 -1
  30. package/dist/computer-held.js +14 -0
  31. package/dist/computer-record.js +4 -2
  32. package/dist/computer-viewer.js +4 -1
  33. package/dist/console/assets/{backend-Boh7tC4i.js → backend-DVhHzJX2.js} +19 -19
  34. package/dist/console/assets/index-Bwn1oTem.css +1 -0
  35. package/dist/console/assets/index-okP-y8PK.js +747 -0
  36. package/dist/console/index.html +2 -2
  37. package/dist/decisions.d.ts +1 -1
  38. package/dist/decisions.js +1 -1
  39. package/dist/docker-host-addresses.d.ts +22 -11
  40. package/dist/docker-host-addresses.js +38 -26
  41. package/dist/env-switch.d.ts +10 -0
  42. package/dist/env-switch.js +33 -2
  43. package/dist/errors.d.ts +1 -0
  44. package/dist/errors.js +2 -0
  45. package/dist/fal-price.d.ts +58 -20
  46. package/dist/fal-price.js +341 -82
  47. package/dist/handed-values.d.ts +43 -1
  48. package/dist/handed-values.js +119 -2
  49. package/dist/harness-archive.d.ts +13 -10
  50. package/dist/harness-archive.js +60 -34
  51. package/dist/harness-check.d.ts +3 -1
  52. package/dist/harness-check.js +25 -46
  53. package/dist/harness-keys.d.ts +73 -27
  54. package/dist/harness-keys.js +194 -61
  55. package/dist/harness-recipe-entry.d.ts +8 -7
  56. package/dist/harness-recipe-entry.js +21 -32
  57. package/dist/harness-recipe.d.ts +38 -25
  58. package/dist/harness-recipe.js +49 -36
  59. package/dist/harness-sign-in.js +12 -23
  60. package/dist/harness-table.d.ts +10 -3
  61. package/dist/harness-table.js +26 -21
  62. package/dist/harness.d.ts +1 -0
  63. package/dist/harness.js +17 -5
  64. package/dist/hosted-search.d.ts +1 -1
  65. package/dist/hosted-search.js +1 -2
  66. package/dist/import-worker.d.ts +4 -2
  67. package/dist/import-worker.js +9 -2
  68. package/dist/in-flight.d.ts +26 -0
  69. package/dist/in-flight.js +52 -0
  70. package/dist/key-refusal.d.ts +9 -4
  71. package/dist/key-refusal.js +107 -25
  72. package/dist/learn/secrets.d.ts +13 -3
  73. package/dist/learn/secrets.js +118 -17
  74. package/dist/learning-cost.d.ts +6 -3
  75. package/dist/learning-cost.js +4 -2
  76. package/dist/link-check.js +1 -1
  77. package/dist/llms.txt +1 -1
  78. package/dist/marketplace.d.ts +77 -0
  79. package/dist/marketplace.js +224 -0
  80. package/dist/mcp-api-only-origins.d.ts +30 -0
  81. package/dist/mcp-api-only-origins.js +57 -0
  82. package/dist/mcp-gateway.d.ts +7 -5
  83. package/dist/mcp-gateway.js +9 -12
  84. package/dist/mcp-secret-writes.js +5 -3
  85. package/dist/mcp-servers-store.d.ts +28 -6
  86. package/dist/mcp-servers-store.js +53 -4
  87. package/dist/media-duration.d.ts +3 -0
  88. package/dist/media-duration.js +90 -9
  89. package/dist/model-form.d.ts +5 -4
  90. package/dist/model-form.js +11 -7
  91. package/dist/model.d.ts +5 -2
  92. package/dist/model.js +9 -5
  93. package/dist/ollama-provider.d.ts +7 -1
  94. package/dist/ollama-provider.js +14 -2
  95. package/dist/openapi.js +178 -27
  96. package/dist/otel/genai.d.ts +65 -0
  97. package/dist/otel/genai.js +116 -0
  98. package/dist/otel/tracer.d.ts +55 -0
  99. package/dist/otel/tracer.js +308 -0
  100. package/dist/page.d.ts +2 -0
  101. package/dist/page.js +3 -1
  102. package/dist/paid-calls.d.ts +1 -32
  103. package/dist/paid-calls.js +4 -39
  104. package/dist/provider.d.ts +9 -0
  105. package/dist/provider.js +50 -3
  106. package/dist/redact/match.d.ts +30 -3
  107. package/dist/redact/match.js +422 -41
  108. package/dist/refusal-words.d.ts +11 -0
  109. package/dist/refusal-words.js +11 -0
  110. package/dist/run-census.d.ts +67 -0
  111. package/dist/run-census.js +240 -0
  112. package/dist/run-computer.d.ts +6 -3
  113. package/dist/run-computer.js +4 -1
  114. package/dist/run-cut.d.ts +15 -6
  115. package/dist/run-cut.js +30 -9
  116. package/dist/run-files.d.ts +3 -0
  117. package/dist/run-files.js +3 -0
  118. package/dist/run-launch.d.ts +12 -1
  119. package/dist/run-launch.js +9 -10
  120. package/dist/run-learning-served.d.ts +2 -0
  121. package/dist/run-model-key.d.ts +8 -0
  122. package/dist/run-model-key.js +31 -1
  123. package/dist/run-reads-over-store.d.ts +24 -6
  124. package/dist/run-reads-over-store.js +67 -23
  125. package/dist/run-recordings.d.ts +5 -1
  126. package/dist/run-recordings.js +39 -14
  127. package/dist/run-timeline-served.d.ts +2 -0
  128. package/dist/run-timeline-served.js +2 -2
  129. package/dist/run-usage.d.ts +1 -0
  130. package/dist/runnable.d.ts +10 -1
  131. package/dist/runnable.js +20 -8
  132. package/dist/runner/adapter-loop.d.ts +11 -0
  133. package/dist/runner/adapter-loop.js +55 -10
  134. package/dist/runner/adapter-run-spec.d.ts +45 -8
  135. package/dist/runner/adapter-run-spec.js +150 -28
  136. package/dist/runner/adapters/pi.js +25 -3
  137. package/dist/runner/beside.js +4 -3
  138. package/dist/runner/big-writes.js +1 -10
  139. package/dist/runner/claim-secrets.d.ts +18 -3
  140. package/dist/runner/claim-secrets.js +35 -6
  141. package/dist/runner/cli-run-spec.d.ts +6 -0
  142. package/dist/runner/cli-run-spec.js +82 -35
  143. package/dist/runner/computer-journal.d.ts +9 -1
  144. package/dist/runner/computer-journal.js +26 -0
  145. package/dist/runner/conformance/harness.js +1 -1
  146. package/dist/runner/feedback-round.js +3 -0
  147. package/dist/runner/harness-loops.d.ts +6 -5
  148. package/dist/runner/harness-loops.js +7 -7
  149. package/dist/runner/held.d.ts +11 -5
  150. package/dist/runner/journal-kinds.d.ts +5 -0
  151. package/dist/runner/journal-kinds.js +5 -0
  152. package/dist/runner/main.js +7 -2
  153. package/dist/runner/mcp-claim.js +30 -3
  154. package/dist/runner/mcp-run.d.ts +12 -0
  155. package/dist/runner/mcp-run.js +12 -5
  156. package/dist/runner/model-route.d.ts +17 -0
  157. package/dist/runner/model-route.js +120 -2
  158. package/dist/runner/run-child-host.d.ts +3 -0
  159. package/dist/runner/run-child-host.js +69 -28
  160. package/dist/runner/run-child.js +5 -2
  161. package/dist/runner/runner.d.ts +14 -3
  162. package/dist/runner/runner.js +129 -33
  163. package/dist/runner/store-port.d.ts +1 -1
  164. package/dist/runner/store-secrets.d.ts +6 -0
  165. package/dist/runner/store-secrets.js +49 -7
  166. package/dist/runner/subagent.js +4 -40
  167. package/dist/runner/workflow-first.d.ts +11 -4
  168. package/dist/runner/workflow-first.js +14 -8
  169. package/dist/runner/workflow-spec.js +3 -2
  170. package/dist/runs-over-store.d.ts +15 -6
  171. package/dist/runs-over-store.js +33 -21
  172. package/dist/scrub-command.d.ts +73 -0
  173. package/dist/scrub-command.js +307 -0
  174. package/dist/secret-cut.d.ts +73 -0
  175. package/dist/secret-cut.js +291 -4
  176. package/dist/secret-rules.d.ts +143 -0
  177. package/dist/secret-rules.js +2564 -0
  178. package/dist/secrets.d.ts +7 -0
  179. package/dist/secrets.js +20 -0
  180. package/dist/server-keys.d.ts +20 -0
  181. package/dist/server-keys.js +25 -6
  182. package/dist/server.d.ts +52 -11
  183. package/dist/server.js +345 -118
  184. package/dist/skills/agentrun-serve/SKILL.md +4 -0
  185. package/dist/store/index.d.ts +1 -1
  186. package/dist/store/index.js +1 -1
  187. package/dist/store/journal/storage.js +1 -1
  188. package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
  189. package/dist/store/schema.d.ts +6 -0
  190. package/dist/store/schema.js +11 -1
  191. package/dist/store/seal.d.ts +6 -1
  192. package/dist/store/seal.js +5 -3
  193. package/dist/store/sqlite/run-launch.d.ts +9 -1
  194. package/dist/store/sqlite/run-launch.js +24 -13
  195. package/dist/store/sqlite/run-patch.d.ts +1 -1
  196. package/dist/store/sqlite/run-patch.js +13 -4
  197. package/dist/store/sqlite/store.js +34 -4
  198. package/dist/store/store.d.ts +43 -2
  199. package/dist/store/store.js +20 -0
  200. package/dist/store-reads/learning.d.ts +6 -3
  201. package/dist/store-reads/learning.js +22 -7
  202. package/dist/store-view.d.ts +3 -0
  203. package/dist/store-view.js +3 -3
  204. package/dist/suggestions.js +3 -2
  205. package/dist/template-eval.d.ts +20 -9
  206. package/dist/template-eval.js +115 -33
  207. package/dist/template-import.d.ts +10 -0
  208. package/dist/template-import.js +16 -7
  209. package/dist/templates.d.ts +10 -2
  210. package/dist/templates.js +28 -8
  211. package/dist/timeline/labels.d.ts +6 -4
  212. package/dist/timeline/labels.js +18 -6
  213. package/dist/timeline/timeline.d.ts +5 -0
  214. package/dist/timeline/timeline.js +14 -8
  215. package/dist/timeline/util.js +1 -1
  216. package/dist/timeline/web-calls.d.ts +26 -9
  217. package/dist/timeline/web-calls.js +124 -37
  218. package/dist/tool-gate.d.ts +42 -3
  219. package/dist/tool-gate.js +66 -5
  220. package/dist/tool-keys-store.d.ts +2 -4
  221. package/dist/tool-keys-store.js +5 -21
  222. package/dist/tool-keys.d.ts +2 -2
  223. package/dist/tool-keys.js +2 -2
  224. package/dist/tool-list.js +1 -1
  225. package/dist/tool-plane.d.ts +2 -2
  226. package/dist/tool-plane.js +35 -33
  227. package/dist/tools.js +13 -7
  228. package/dist/trigger-targets.d.ts +4 -0
  229. package/dist/trigger-targets.js +9 -2
  230. package/dist/triggers.d.ts +67 -4
  231. package/dist/triggers.js +171 -22
  232. package/dist/until.d.ts +3 -0
  233. package/dist/until.js +11 -0
  234. package/dist/web-fake.d.ts +1 -3
  235. package/dist/web-fake.js +7 -18
  236. package/dist/web-fetch.d.ts +6 -72
  237. package/dist/web-fetch.js +11 -265
  238. package/dist/web-run.d.ts +31 -0
  239. package/dist/web-run.js +90 -0
  240. package/dist/web-save.d.ts +6 -4
  241. package/dist/web-save.js +9 -12
  242. package/dist/web-search.d.ts +9 -127
  243. package/dist/web-search.js +23 -259
  244. package/dist/wires.d.ts +13 -0
  245. package/dist/wires.js +11 -0
  246. package/dist/workflow-run.d.ts +5 -4
  247. package/dist/workflow-run.js +5 -4
  248. package/dist/workspace/computer-deps.d.ts +2 -1
  249. package/dist/workspace/computer-deps.js +9 -2
  250. package/dist/workspace/computer-for-claim.d.ts +12 -1
  251. package/dist/workspace/computer-for-claim.js +77 -8
  252. package/dist/workspace/computer-kept.d.ts +3 -0
  253. package/dist/workspace/computer-kept.js +11 -2
  254. package/dist/workspace/index.d.ts +1 -1
  255. package/dist/workspace/index.js +1 -1
  256. package/dist/workspace/kind-skills.d.ts +4 -0
  257. package/dist/workspace/kind-skills.js +9 -0
  258. package/dist/workspace/synced-folder.js +3 -4
  259. package/dist/wrapped.d.ts +13 -5
  260. package/dist/wrapped.js +52 -26
  261. package/package.json +17 -11
  262. package/skills/agentrun-serve/SKILL.md +4 -0
  263. package/templates/README.md +30 -8
  264. package/dist/console/assets/index-CQ3cJRzI.js +0 -746
  265. package/dist/console/assets/index-DKkaS3a0.css +0 -1
  266. package/dist/exa-keyless.d.ts +0 -34
  267. package/dist/exa-keyless.js +0 -118
  268. package/dist/firecrawl-keyless.d.ts +0 -41
  269. package/dist/firecrawl-keyless.js +0 -152
  270. package/dist/keyless-mcp.d.ts +0 -36
  271. package/dist/keyless-mcp.js +0 -127
  272. package/dist/text-urls.d.ts +0 -38
  273. package/dist/text-urls.js +0 -170
  274. package/dist/web-fetch-direct.d.ts +0 -119
  275. package/dist/web-fetch-direct.js +0 -190
package/dist/model.js CHANGED
@@ -20,6 +20,8 @@ import { LOGIN_DEFAULT_MODEL, onClaudeLogin } from "./claude-login.js";
20
20
  import { OLLAMA_PROVIDER, ollamaBase, ollamaHostRefused, ollamaModels, ollamaProvider, ollamaRelisted, ollamaShown, ollamaToolsModel } from "./ollama-provider.js";
21
21
  /** The child's environment names the faux module by absolute path. */
22
22
  export const FAUX_ENV = "AGENTRUN_SERVE_FAUX";
23
+ /** The provider of a --faux start's model (chooseModel), which stands in for the run's and sends no key. */
24
+ export const FAUX_PROVIDER = "faux";
23
25
  /** The Ollama tags among a run's models (`ollama/<tag>`): what providerModels resolves for it, one /api/show each. */
24
26
  export const ollamaTagsOf = (refs) => [...new Set([...refs].flatMap((ref) => (ref?.provider === OLLAMA_PROVIDER ? [ref.modelId] : [])))];
25
27
  /** Whether the Ollama here is asked for its models under `env`: not under the faux model or a model gateway, which take
@@ -137,8 +139,9 @@ export const harnessRuns = (env, id, harness) => harnessOf(env, harness)?.runs(e
137
139
  /** The model a revision that names none runs on with `harness`, for `tier`: the tier's own variable, else AGENT_MODEL,
138
140
  * each only when `harness` runs it (harnessRuns; one it can't is skipped, never an error), else that of the first of
139
141
  * MODEL_KEYS whose key is here (a placeholder behind a base URL counts) and that `harness` runs on, else, in a run's
140
- * process that holds none of those keys, the one the server's keys gave it (DEFAULT_MODEL_ENV), else, on pi, the first
141
- * model of the Ollama here that calls tools (localDefault). Undefined when none is: the harness has no default here. */
142
+ * process that holds none of those keys, the one the server's keys gave it (DEFAULT_MODEL_ENV), else, where `harness`
143
+ * runs it (pi, a harness on a wire the route translates it onto), the first model of the Ollama here that calls tools
144
+ * (localDefault). Undefined when none is: the harness has no default here. */
142
145
  export function hostModel(env, tier = "default", harness = DEFAULT_HARNESS) {
143
146
  return settingsModel(env, tier, harness) ?? localDefault(env, harness);
144
147
  }
@@ -159,8 +162,9 @@ function settingsModel(env, tier, harness) {
159
162
  }
160
163
  /** The default with no key held: the first model of the Ollama here that calls tools (ollama-provider.ts
161
164
  * ollamaToolsModel, from its last listing, which chooseModel asks for first), where `harness` runs it (harnessRuns, its
162
- * entry's facts: pi any model, an adapter its wire's vendor's alone); none behind a gateway or under the faux model. A
163
- * model that takes no tools is never a default: a run on it would have none. */
165
+ * entry's: pi any model, an adapter its wire's vendor's and the models the route translates onto its wire); none behind a gateway or under the faux model. A
166
+ * model that takes no tools is never a default: a run on it gets its tools as text, and text tools are unreliable on
167
+ * small models. */
164
168
  function localDefault(env, harness) {
165
169
  if (!asksOllama(env))
166
170
  return undefined;
@@ -242,7 +246,7 @@ async function choose(env, ref, tier, harness, relisted) {
242
246
  if (typeof ref === "object")
243
247
  return pinnedChoice(env, ref, tier, harness);
244
248
  if (env[FAUX_ENV])
245
- return { model: { provider: "faux", modelId: fauxModel(env, tier) } };
249
+ return { model: { provider: FAUX_PROVIDER, modelId: fauxModel(env, tier) } };
246
250
  // A host whose own settings name no model reads its default from the Ollama here (hostModel's localDefault): its
247
251
  // listing first (ollamaModels: kept while fresh, asked now where none is, and a stale one asked again behind this
248
252
  // choice), so a tag it took is never the last listing's for good. A ref, a key, a default or a plan never waits on it.
@@ -27,6 +27,11 @@ export declare function ollamaClock(clock?: () => number): void;
27
27
  /** The listing under way for the Ollama `env` names (one a stale answer started behind its caller), or undefined: for a
28
28
  * test to await what a refresh brings. */
29
29
  export declare function ollamaAsking(env: NodeJS.ProcessEnv): Promise<readonly OllamaListed[]> | undefined;
30
+ /** `read` as a reading no run waits on: the offers and the server's model needs, made again at each key save
31
+ * (harness.ts harnessOffers, server.ts needsOf). Inside it, ollamaShown answers from the kept listing at any age, which
32
+ * is the listing the offers are made from, and asks Ollama nothing when one is kept. So a save never waits on one
33
+ * /api/show per model of a stuck Ollama. A run's own choice is never made inside it. */
34
+ export declare const ollamaReading: <T>(read: () => Promise<T>) => Promise<T>;
30
35
  /** A test process's switch, read from its own environment (process.env), never from the `env` a caller passes: set, no
31
36
  * Ollama is asked, whatever address that `env` names or leaves to the default. A test hook's name (model.ts FAUX_PREFIX),
32
37
  * so a server never hands it on to its runs. The test suites set it (test/support.mjs); a test of Ollama clears it. */
@@ -59,7 +64,8 @@ export declare const OLLAMA_SHOW_TIMEOUT_MS = 10000;
59
64
  /** Model `tag` of the Ollama `env` names, for a run that names it (`ollama/<tag>`): from its address's kept listing while
60
65
  * that is fresh (OLLAMA_TTL_MS), else its own /api/show within `timeoutMs`, never /api/tags, so a run never waits on a
61
66
  * whole listing and never runs on a model's context from before it was pulled again. Undefined where it is not there,
62
- * does not answer, is a cloud model or OLLAMA_HOST is refused. Nothing kept: the listing is the kept one. */
67
+ * does not answer, is a cloud model or OLLAMA_HOST is refused. Nothing kept: the listing is the kept one. Inside
68
+ * ollamaReading, the kept listing at any age, and nothing asked when one is kept. */
63
69
  export declare function ollamaShown(env: NodeJS.ProcessEnv, tag: string, { fetch: send, timeoutMs }?: {
64
70
  fetch?: typeof fetch;
65
71
  timeoutMs?: number;
@@ -1,5 +1,6 @@
1
1
  // Ollama as a model provider: the models the Ollama on this machine (or the one OLLAMA_HOST names) has pulled, listed live
2
- // from its own API, run by pi alone, at $0, on Ollama's native chat API. No key: Ollama has none.
2
+ // from its own API, run by pi and by every harness on a wire the route translates (wires.ts TRANSLATED), at $0, on
3
+ // Ollama's native chat API. No key: Ollama has none.
3
4
  // Where: OLLAMA_HOST, Ollama's own variable, read as the ollama CLI reads it (ollamaBase), from the server's environment,
4
5
  // never from a provider's auth context, so it is never a held secret. Unset, the server names the default address
5
6
  // itself only on one owner's own machine (ollamaHostOf); unset anywhere else, no Ollama is asked. Plain http only to this machine (provider.ts
@@ -13,6 +14,7 @@
13
14
  // (OLLAMA_NUM_CTX), and the model's window here is that same number.
14
15
  // Listing never stalls a caller: one short deadline for the whole listing, no redirects, and a down, hung or refused Ollama
15
16
  // lists no models and throws nothing. Each address's answer is kept (OLLAMA_TTL_MS) and refreshed behind the caller.
17
+ import { AsyncLocalStorage } from "node:async_hooks";
16
18
  import { calculateCost, collapseSystemMessages, createAssistantMessageEventStream, getCurrentSystemPrompt, getCurrentTools } from "@earendil-works/pi-ai";
17
19
  import { transformMessages } from "@earendil-works/pi-ai/api/transform-messages";
18
20
  import { createProvider } from "@earendil-works/pi-ai/models";
@@ -85,6 +87,13 @@ export function ollamaAsking(env) {
85
87
  const base = baseOf(env);
86
88
  return base === undefined ? undefined : asking.get(base);
87
89
  }
90
+ /** Set inside ollamaReading: a reading no run waits on. */
91
+ const reading = new AsyncLocalStorage();
92
+ /** `read` as a reading no run waits on: the offers and the server's model needs, made again at each key save
93
+ * (harness.ts harnessOffers, server.ts needsOf). Inside it, ollamaShown answers from the kept listing at any age, which
94
+ * is the listing the offers are made from, and asks Ollama nothing when one is kept. So a save never waits on one
95
+ * /api/show per model of a stuck Ollama. A run's own choice is never made inside it. */
96
+ export const ollamaReading = (read) => reading.run(true, read);
88
97
  /** Whether an /api/tags or /api/show entry is a cloud model's. Its prompts leave this machine, so it is never listed: the
89
98
  * models here are local, $0 and uncounted, and a cloud model is none of those. */
90
99
  const remote = (entry) => entry?.remote_host !== undefined || entry?.remote_model !== undefined;
@@ -181,12 +190,15 @@ export const OLLAMA_SHOW_TIMEOUT_MS = 10_000;
181
190
  /** Model `tag` of the Ollama `env` names, for a run that names it (`ollama/<tag>`): from its address's kept listing while
182
191
  * that is fresh (OLLAMA_TTL_MS), else its own /api/show within `timeoutMs`, never /api/tags, so a run never waits on a
183
192
  * whole listing and never runs on a model's context from before it was pulled again. Undefined where it is not there,
184
- * does not answer, is a cloud model or OLLAMA_HOST is refused. Nothing kept: the listing is the kept one. */
193
+ * does not answer, is a cloud model or OLLAMA_HOST is refused. Nothing kept: the listing is the kept one. Inside
194
+ * ollamaReading, the kept listing at any age, and nothing asked when one is kept. */
185
195
  export async function ollamaShown(env, tag, { fetch: send = globalThis.fetch, timeoutMs = OLLAMA_SHOW_TIMEOUT_MS } = {}) {
186
196
  const base = baseOf(env);
187
197
  if (base === undefined)
188
198
  return undefined;
189
199
  const known = kept.get(base);
200
+ if (known && reading.getStore())
201
+ return known.models.find((model) => model.name === tag);
190
202
  const fresh = known && now() - known.at < OLLAMA_TTL_MS ? known.models.find((model) => model.name === tag) : undefined;
191
203
  return fresh ?? shownOf(askerOf(base, send, AbortSignal.timeout(timeoutMs)), tag);
192
204
  }