@llmnative/agentico 0.13.2 → 0.14.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/dist/index.mjs CHANGED
@@ -1381,7 +1381,20 @@ var Rt = 20, zt = 26e4;
1381
1381
  function Bt(e) {
1382
1382
  return e.filter((e) => !g.isTextAttachment(e.mimeType) || e.base64.length <= zt);
1383
1383
  }
1384
- function Vt(e, t = {}) {
1384
+ function Vt(e) {
1385
+ return e.map((e) => e.status !== "running" && !e.parts?.some((e) => e.type === "tool" && e.status === "running" || (e.type === "text" || e.type === "reasoning") && e.streaming) ? e : {
1386
+ ...e,
1387
+ status: e.status === "running" ? "stopped" : e.status,
1388
+ ...e.parts ? { parts: e.parts.map((e) => e.type === "tool" && e.status === "running" ? {
1389
+ ...e,
1390
+ status: "stopped"
1391
+ } : (e.type === "text" || e.type === "reasoning") && e.streaming ? {
1392
+ ...e,
1393
+ streaming: !1
1394
+ } : e) } : {}
1395
+ });
1396
+ }
1397
+ function Ht(e, t = {}) {
1385
1398
  let { defaultEnabled: n = !1 } = t, [r, i] = N(n), { hasProviders: a, modelsByProvider: o, modelsLoading: s, selectedModel: c, setSelectedModel: l } = Pt(), [u, d] = N(!1), [f, p] = N(null), [m, h] = N(!1), [_, v] = N([]), y = M([]), x = (e) => {
1386
1399
  v((t) => {
1387
1400
  let n = typeof e == "function" ? e(t) : e;
@@ -1846,7 +1859,7 @@ function Vt(e, t = {}) {
1846
1859
  p(T.current.requestInProgress);
1847
1860
  return;
1848
1861
  }
1849
- D.current = !0, p(null), x(n.activity), d(!0);
1862
+ D.current = !0, p(null), x(Vt(n.activity)), d(!0);
1850
1863
  try {
1851
1864
  let i = await e.buildContext(t), a = { current: void 0 }, o = e.getTools?.(t, i, a) ?? [];
1852
1865
  E.current = {
@@ -1930,28 +1943,29 @@ function Vt(e, t = {}) {
1930
1943
  runFallback: ve,
1931
1944
  snapshot: ye,
1932
1945
  answerQuestions: de,
1933
- cardAction: ue
1946
+ cardAction: ue,
1947
+ offersFallback: e.offersFallback !== !1
1934
1948
  };
1935
1949
  }
1936
1950
  //#endregion
1937
1951
  //#region src/domain/orchestrator/prompt.ts
1938
- function Ht() {
1952
+ function Ut() {
1939
1953
  let e = X();
1940
1954
  return [e.responseRulesHeading, ...e.responseRules.map((e) => `- ${e}`)].join("\n");
1941
1955
  }
1942
- function Ut(e, t, n) {
1956
+ function Wt(e, t, n) {
1943
1957
  let r = X(), i = n ? `\n${r.pageContextHeading}\n${r.pageContextIntro}\n${n}\n` : "";
1944
1958
  return `${r.orchestratorIntro}
1945
1959
 
1946
1960
  ${r.toolsHeading}
1947
1961
  ${t}
1948
1962
  ${i}
1949
- ${Ht()}
1963
+ ${Ut()}
1950
1964
 
1951
1965
  ${r.userRequestHeading}
1952
1966
  ${e}`;
1953
1967
  }
1954
- function Wt(e, t) {
1968
+ function Gt(e, t) {
1955
1969
  return t ? {
1956
1970
  kind: "handoff",
1957
1971
  ...t
@@ -1962,27 +1976,27 @@ function Wt(e, t) {
1962
1976
  }
1963
1977
  //#endregion
1964
1978
  //#region src/domain/orchestrator/agenticoOrchestratorAgent.ts
1965
- function Gt(e) {
1979
+ function Kt(e) {
1966
1980
  return U().filter((t) => !t.onlyWhenAnchored || e === t.id);
1967
1981
  }
1968
- function Kt(e) {
1982
+ function qt(e) {
1969
1983
  return {
1970
1984
  buildContext(e) {
1971
1985
  return {
1972
- cliCatalog: de(Gt(e.scopedSubagentId)),
1986
+ cliCatalog: de(Kt(e.scopedSubagentId)),
1973
1987
  handoff: { current: null },
1974
1988
  collected: {}
1975
1989
  };
1976
1990
  },
1977
1991
  buildPrompt({ userGoal: e, pageContext: t }, { cliCatalog: n }) {
1978
- return Ut(e, n, t);
1992
+ return Wt(e, n, t);
1979
1993
  },
1980
1994
  buildFollowUpPrompt(e, t, { cliCatalog: n }) {
1981
- return `${e}\n\n${Ht()}\n\n${X().toolsHeading}\n${n}`;
1995
+ return `${e}\n\n${Ut()}\n\n${X().toolsHeading}\n${n}`;
1982
1996
  },
1983
1997
  parseResponse(e, t, n) {
1984
1998
  let r = n.handoff.current;
1985
- return n.handoff.current = null, Wt(e, r);
1999
+ return n.handoff.current = null, Gt(e, r);
1986
2000
  },
1987
2001
  fallback() {
1988
2002
  return {
@@ -1998,7 +2012,7 @@ function Kt(e) {
1998
2012
  attachmentsRef: r,
1999
2013
  collected: n.collected,
2000
2014
  proxyFetch: x
2001
- }), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Gt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
2015
+ }), a = t.scopedSubagentId ? W(t.scopedSubagentId) : null, o = a ? i.filter((e) => (a.crossAgentToolIds ?? []).includes(e.name)) : i, s = Kt(t.scopedSubagentId).flatMap((t) => t.commands.map((r) => ({
2002
2016
  name: `${t.id}_${r.name}`,
2003
2017
  description: `${t.label}: ${r.summary}`,
2004
2018
  inputSchema: r.inputSchema,
@@ -2022,12 +2036,12 @@ function Kt(e) {
2022
2036
  }
2023
2037
  //#endregion
2024
2038
  //#region src/presentation/deriveHistoryTitle.ts
2025
- function qt(e, t) {
2039
+ function Jt(e, t) {
2026
2040
  return e.deriveHistoryTitle?.(t) ?? e.label;
2027
2041
  }
2028
2042
  //#endregion
2029
2043
  //#region src/presentation/ResultDestinationPicker.tsx
2030
- function Jt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2044
+ function Yt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, onApplied: a, extraDestinations: o }) {
2031
2045
  let s = $(), c = tt(), l = c.scope, u = T(), [d, f] = N(null), [p, m] = N(new Set(i ?? [])), [h, g] = N(null), _ = Se(), v = /* @__PURE__ */ new Map();
2032
2046
  e.destinationIds.forEach((e) => {
2033
2047
  let t = _[e];
@@ -2045,7 +2059,7 @@ function Jt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2045
2059
  storageProvider: l?.storageProvider ?? null,
2046
2060
  proxyFetch: u
2047
2061
  }, n);
2048
- m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, qt(e, n));
2062
+ m((e) => new Set(e).add(i)), a?.(i), d?.id && c.commitEntityChat(e.id, d.id, r, l?.id, n, Jt(e, n));
2049
2063
  } catch (e) {
2050
2064
  g(e instanceof Error ? e.message : String(e));
2051
2065
  } finally {
@@ -2078,16 +2092,16 @@ function Jt({ manifest: e, result: t, meta: n, taskId: r, initiallyApplied: i, o
2078
2092
  }
2079
2093
  //#endregion
2080
2094
  //#region src/presentation/reports/subagentReportRegistry.tsx
2081
- var Yt = {};
2082
- function Xt(e) {
2083
- Object.assign(Yt, e);
2084
- }
2095
+ var Xt = {};
2085
2096
  function Zt(e) {
2086
- return Yt[e];
2097
+ Object.assign(Xt, e);
2098
+ }
2099
+ function Qt(e) {
2100
+ return Xt[e];
2087
2101
  }
2088
2102
  //#endregion
2089
2103
  //#region src/presentation/reports/GenericResultPreview.tsx
2090
- function Qt({ result: e }) {
2104
+ function $t({ result: e }) {
2091
2105
  let [t, n] = N(!1);
2092
2106
  return /* @__PURE__ */ I("div", {
2093
2107
  className: `relative cursor-pointer rounded-md border border-border/60 ${t ? "max-h-80 overflow-y-auto" : "max-h-28 overflow-hidden"}`,
@@ -2104,7 +2118,7 @@ function Qt({ result: e }) {
2104
2118
  }
2105
2119
  //#endregion
2106
2120
  //#region src/presentation/liveAnchorDestination.ts
2107
- function $t(e, t, n) {
2121
+ function en(e, t, n) {
2108
2122
  return e.length === 0 ? null : {
2109
2123
  id: "live-component",
2110
2124
  label: "Applica al componente aperto",
@@ -2115,37 +2129,37 @@ function $t(e, t, n) {
2115
2129
  }
2116
2130
  //#endregion
2117
2131
  //#region src/presentation/subagentControls.ts
2118
- var en = {};
2119
- function tn(e) {
2120
- Object.assign(en, e);
2121
- }
2132
+ var tn = {};
2122
2133
  function nn(e) {
2123
- return en[e];
2134
+ Object.assign(tn, e);
2135
+ }
2136
+ function rn(e) {
2137
+ return tn[e];
2124
2138
  }
2125
2139
  //#endregion
2126
2140
  //#region src/presentation/chatTitles.ts
2127
- function rn(e, t = 6e3) {
2141
+ function an(e, t = 6e3) {
2128
2142
  let n = e.filter((e) => (e.kind === "user" || e.kind === "thinking") && e.detail?.trim() && !Ge(e)).map((e) => `${e.kind === "user" ? "Person" : "Agent"}: ${e.detail.trim()}`).join("\n\n");
2129
2143
  return n.length > t ? `${n.slice(0, t * .7)}\n\n[…]\n\n${n.slice(-t * .3)}` : n;
2130
2144
  }
2131
- function an(e) {
2145
+ function on(e) {
2132
2146
  return (e.trim().split("\n").map((e) => e.trim()).find(Boolean) ?? "").replace(/^(title|titolo)\s*:\s*/i, "").replace(/^#+\s*/, "").replace(/^["'«“]+|["'»”]+$/g, "").replace(/[.。]+$/, "").trim().slice(0, 80);
2133
2147
  }
2134
- function on(e, t) {
2148
+ function sn(e, t) {
2135
2149
  try {
2136
2150
  return e.definition.executor?.catalogProviders?.(e.toParams(t));
2137
2151
  } catch {
2138
2152
  return;
2139
2153
  }
2140
2154
  }
2141
- function sn(e, t, n, r, i) {
2142
- let a = on(e, t), o = (e) => {
2155
+ function cn(e, t, n, r, i) {
2156
+ let a = sn(e, t), o = (e) => {
2143
2157
  let t = e ? b(e) : null;
2144
2158
  return !(!t || !i[t.provider] || a && !a.includes(t.provider));
2145
2159
  };
2146
2160
  return o(n) ? n : Object.values(r).flat().map((e) => e.id).find(o);
2147
2161
  }
2148
- function cn(e) {
2162
+ function ln(e) {
2149
2163
  let t = S()?.registry ?? {}, { modelsByProvider: n, selectedModel: r } = Pt(), i = M({
2150
2164
  registry: t,
2151
2165
  modelsByProvider: n,
@@ -2160,15 +2174,15 @@ function cn(e) {
2160
2174
  if (!e) return !1;
2161
2175
  let o = Re(e, t, n), s = W(t), c = `${e}:${t}:${n}`;
2162
2176
  if (!o || !s?.autoTitle || o.name || !We(o) || a.current.has(c)) return !1;
2163
- let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = sn(s, o.params, r ?? d, u, l), p = f ? b(f) : null;
2177
+ let { registry: l, modelsByProvider: u, selectedModel: d } = i.current, f = cn(s, o.params, r ?? d, u, l), p = f ? b(f) : null;
2164
2178
  if (!p) return !1;
2165
2179
  a.current.add(c);
2166
2180
  try {
2167
2181
  let r = await l[p.provider].complete({
2168
- prompt: X().chatTitle.replace("{chat}", rn(o.activity)),
2182
+ prompt: X().chatTitle.replace("{chat}", an(o.activity)),
2169
2183
  model: p.model,
2170
2184
  history: []
2171
- }), i = r && r.type === "text" ? an(r.text) : "";
2185
+ }), i = r && r.type === "text" ? on(r.text) : "";
2172
2186
  return i ? Ke(e, t, n, i, "model") : !1;
2173
2187
  } catch {
2174
2188
  return !1;
@@ -2177,7 +2191,7 @@ function cn(e) {
2177
2191
  }
2178
2192
  }, [e]), s = Object.keys(n).length > 0;
2179
2193
  return k(() => {
2180
- e && s && !ln.has(e) && (ln.add(e), (async () => {
2194
+ e && s && !un.has(e) && (un.add(e), (async () => {
2181
2195
  for (let t of Ye(e)) {
2182
2196
  let n = W(t.subagentId);
2183
2197
  if (n?.autoTitle) {
@@ -2195,11 +2209,11 @@ function cn(e) {
2195
2209
  o
2196
2210
  ]), o;
2197
2211
  }
2198
- var ln = /* @__PURE__ */ new Set(), un = () => ({});
2199
- function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2200
- let c = Vt(e.definition, { defaultEnabled: !0 }), l = tt(), u = l.scope, d = T(), f = M(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = N(null), h = (t) => {
2212
+ var un = /* @__PURE__ */ new Set(), dn = () => ({});
2213
+ function fn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r, taskId: i, resumeSeed: a, model: o, openingMessage: s }) {
2214
+ let c = Ht(e.definition, { defaultEnabled: !0 }), l = tt(), u = l.scope, d = T(), f = M(i ?? `subagent-${e.id}-${crypto.randomUUID()}`).current, [p, m] = N(null), h = (t) => {
2201
2215
  e.definition.conversational || m(t);
2202
- }, [g, _] = N([]), [v, y] = N(null), b = Zt(e.id), x = b?.kind === "selection" ? b : null, [S, C] = N(null), w = M(!1), E = M(0), D = M(null);
2216
+ }, [g, _] = N([]), [v, y] = N(null), b = Qt(e.id), x = b?.kind === "selection" ? b : null, [S, C] = N(null), w = M(!1), E = M(0), D = M(null);
2203
2217
  p && p !== D.current && (D.current = p, E.current = (r?.length ?? 0) + c.activity.length);
2204
2218
  let O = M(!1), A = c.remote || !c.hasProviders || c.selectedModel !== "";
2205
2219
  k(() => {
@@ -2223,7 +2237,7 @@ function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2223
2237
  ...t,
2224
2238
  pinnedEntityId: r
2225
2239
  }).then((n) => {
2226
- n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, qt(e, t));
2240
+ n?.id && l.commitEntityChat(e.id, n.id, f, u.id, t, Jt(e, t));
2227
2241
  }).catch((e) => y(e instanceof Error ? e.message : String(e))));
2228
2242
  });
2229
2243
  }, [
@@ -2242,11 +2256,11 @@ function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2242
2256
  p,
2243
2257
  x,
2244
2258
  S
2245
- ]), ee = j(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = j(() => $t(ee, t, f), [
2259
+ ]), ee = j(() => l.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [l.componentAnchors, e.id]), B = j(() => en(ee, t, f), [
2246
2260
  ee,
2247
2261
  t,
2248
2262
  f
2249
- ]), te = j(() => B ? [B, ...n ?? []] : n, [B, n]), V = e.chatEntityId?.(t), H = cn(u?.id), U = M(!1), W = M(!1);
2263
+ ]), te = j(() => B ? [B, ...n ?? []] : n, [B, n]), V = e.chatEntityId?.(t), H = ln(u?.id), U = M(!1), W = M(!1);
2250
2264
  k(() => {
2251
2265
  let n = !U.current && c.running, i = U.current && !c.running;
2252
2266
  if (U.current = c.running, !n && !i || !V || !u) return;
@@ -2262,14 +2276,14 @@ function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2262
2276
  subagentId: e.id,
2263
2277
  entityId: V,
2264
2278
  params: t,
2265
- title: qt(e, t),
2279
+ title: Jt(e, t),
2266
2280
  history: a.history,
2267
2281
  activity: o
2268
2282
  }), i && e.autoTitle && H(e.id, V, c.selectedModel));
2269
2283
  }, [c.running]);
2270
2284
  let G = () => {
2271
2285
  O.current = !0, c.running && c.stop(), l.closeTask(f);
2272
- }, K = M(nn(e.id) ?? un).current, q = K({
2286
+ }, K = M(rn(e.id) ?? dn).current, q = K({
2273
2287
  params: t,
2274
2288
  taskId: f,
2275
2289
  running: c.running,
@@ -2280,7 +2294,7 @@ function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2280
2294
  return k(() => {
2281
2295
  O.current || l.openTask({
2282
2296
  id: f,
2283
- title: qt(e, t),
2297
+ title: Jt(e, t),
2284
2298
  icon: e.icon,
2285
2299
  agent: c,
2286
2300
  onApplied: (e) => h(e),
@@ -2299,12 +2313,12 @@ function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2299
2313
  }) : b?.kind === "editable" ? /* @__PURE__ */ F(b.Report, {
2300
2314
  result: p,
2301
2315
  onResultChange: R
2302
- }) : /* @__PURE__ */ F(Qt, { result: z }),
2316
+ }) : /* @__PURE__ */ F($t, { result: z }),
2303
2317
  v && /* @__PURE__ */ I("p", {
2304
2318
  className: "text-xs text-destructive",
2305
2319
  children: ["Salvataggio automatico non riuscito: ", v]
2306
2320
  }),
2307
- /* @__PURE__ */ F(Jt, {
2321
+ /* @__PURE__ */ F(Yt, {
2308
2322
  manifest: e,
2309
2323
  result: z,
2310
2324
  meta: t,
@@ -2345,8 +2359,8 @@ function dn({ manifest: e, params: t, extraDestinations: n, precedingActivity: r
2345
2359
  }
2346
2360
  //#endregion
2347
2361
  //#region src/presentation/OrchestratorRunner.tsx
2348
- function fn({ userGoal: e }) {
2349
- let t = $(), n = Vt(j(() => Kt({
2362
+ function pn({ userGoal: e }) {
2363
+ let t = $(), n = Ht(j(() => qt({
2350
2364
  unavailable: t.orchestratorUnavailable,
2351
2365
  continueWithoutAi: t.orchestratorContinueWithoutAi,
2352
2366
  preparing: t.orchestratorPreparing,
@@ -2394,7 +2408,7 @@ function fn({ userGoal: e }) {
2394
2408
  let h = j(() => [...f.current?.activity ?? [], ...n.activity], [n.activity]);
2395
2409
  if (!i) return null;
2396
2410
  let g = W(i.subagentId);
2397
- return g ? /* @__PURE__ */ F(dn, {
2411
+ return g ? /* @__PURE__ */ F(fn, {
2398
2412
  manifest: g,
2399
2413
  params: i.params,
2400
2414
  extraDestinations: c.current,
@@ -2405,8 +2419,8 @@ function fn({ userGoal: e }) {
2405
2419
  }
2406
2420
  //#endregion
2407
2421
  //#region src/presentation/ManualEntryRunner.tsx
2408
- function pn({ manifest: e, extraDestinations: n }) {
2409
- let r = Vt(e.definition, { defaultEnabled: !1 }), i = $(), a = tt(), o = M(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = N(null), [l, u] = N([]), d = Zt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = N(null), [h, g] = N(null), _ = M(!1), v = (t) => {
2422
+ function mn({ manifest: e, extraDestinations: n }) {
2423
+ let r = Ht(e.definition, { defaultEnabled: !1 }), i = $(), a = tt(), o = M(`manual-${e.id}-${crypto.randomUUID()}`).current, [s, c] = N(null), [l, u] = N([]), d = Qt(e.id), f = d?.kind === "selection" ? d : null, [p, m] = N(null), [h, g] = N(null), _ = M(!1), v = (t) => {
2410
2424
  if (!e.manualEntry) return;
2411
2425
  let n;
2412
2426
  try {
@@ -2433,7 +2447,7 @@ function pn({ manifest: e, extraDestinations: n }) {
2433
2447
  p
2434
2448
  ]), S = (e) => {
2435
2449
  u((t) => t.includes(e) ? t : [...t, e]);
2436
- }, C = j(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = j(() => h ? $t(C, h, o) : null, [
2450
+ }, C = j(() => a.componentAnchors.filter((t) => t.subagentId === e.id && t.onResult), [a.componentAnchors, e.id]), w = j(() => h ? en(C, h, o) : null, [
2437
2451
  C,
2438
2452
  h,
2439
2453
  o
@@ -2462,8 +2476,8 @@ function pn({ manifest: e, extraDestinations: n }) {
2462
2476
  }) : d?.kind === "editable" ? /* @__PURE__ */ F(d.Report, {
2463
2477
  result: s,
2464
2478
  onResultChange: b
2465
- }) : /* @__PURE__ */ F(Qt, { result: x }),
2466
- /* @__PURE__ */ F(Jt, {
2479
+ }) : /* @__PURE__ */ F($t, { result: x }),
2480
+ /* @__PURE__ */ F(Yt, {
2467
2481
  manifest: e,
2468
2482
  result: x,
2469
2483
  meta: h ?? {},
@@ -2500,7 +2514,7 @@ function pn({ manifest: e, extraDestinations: n }) {
2500
2514
  }
2501
2515
  //#endregion
2502
2516
  //#region src/presentation/Agentico.tsx
2503
- function mn(e, t) {
2517
+ function hn(e, t) {
2504
2518
  return Object.values(e).flat().map((e) => {
2505
2519
  let n = t?.(e.provider, e.providerLabel ?? e.provider);
2506
2520
  return {
@@ -2512,7 +2526,7 @@ function mn(e, t) {
2512
2526
  };
2513
2527
  });
2514
2528
  }
2515
- function hn({ task: e }) {
2529
+ function gn({ task: e }) {
2516
2530
  let t = $(), [n, r] = N(""), { agent: i, onApplied: a, manualEntry: o } = e, c = i.running, l = (e) => {
2517
2531
  if (r(""), o) {
2518
2532
  o.onSubmit(e.text);
@@ -2524,7 +2538,7 @@ function hn({ task: e }) {
2524
2538
  }).then((e) => {
2525
2539
  e && a(e);
2526
2540
  });
2527
- }, u = !!o || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...mn(i.modelsByProvider, i.catalogGroup)] : mn(i.modelsByProvider);
2541
+ }, u = !!o || i.remote && i.remoteModels.length === 0, d = i.alongside && i.remoteModels.some((e) => e.value === i.selectedModel), f = !u && !i.remote && !d && i.hasProviders && !i.selectedModel, p = u ? [] : i.remote ? i.remoteModels : i.alongside ? [...i.remoteModels, ...hn(i.modelsByProvider, i.catalogGroup)] : hn(i.modelsByProvider);
2528
2542
  return /* @__PURE__ */ F(s, {
2529
2543
  value: n,
2530
2544
  onChange: r,
@@ -2544,7 +2558,7 @@ function hn({ task: e }) {
2544
2558
  maxHeight: 220
2545
2559
  });
2546
2560
  }
2547
- function gn() {
2561
+ function _n() {
2548
2562
  let { startOrchestrator: e } = tt(), t = $(), [n, r] = N(""), { hasProviders: i, modelsByProvider: a, selectedModel: o, setSelectedModel: c } = Pt(), l = (t) => {
2549
2563
  t.text.trim() && (e(t.text.trim(), {
2550
2564
  attachments: t.files.length > 0 ? t.files : void 0,
@@ -2558,7 +2572,7 @@ function gn() {
2558
2572
  disabled: !n.trim() || u,
2559
2573
  onSubmit: l,
2560
2574
  attachments: !0,
2561
- models: mn(a),
2575
+ models: hn(a),
2562
2576
  selectedModel: o,
2563
2577
  onModelChange: c,
2564
2578
  modelPlaceholder: t.selectModelPlaceholder,
@@ -2566,7 +2580,7 @@ function gn() {
2566
2580
  maxHeight: 220
2567
2581
  });
2568
2582
  }
2569
- function _n({ chat: e, onClose: t }) {
2583
+ function vn({ chat: e, onClose: t }) {
2570
2584
  let n = $(), r = C();
2571
2585
  return /* @__PURE__ */ F(h, {
2572
2586
  title: n.renameChat,
@@ -2589,7 +2603,7 @@ function _n({ chat: e, onClose: t }) {
2589
2603
  })
2590
2604
  });
2591
2605
  }
2592
- function vn(e, t, n = Date.now()) {
2606
+ function yn(e, t, n = Date.now()) {
2593
2607
  let r = Math.round((e - n) / 1e3), i = new Intl.RelativeTimeFormat(t, {
2594
2608
  numeric: "auto",
2595
2609
  style: "short"
@@ -2601,7 +2615,7 @@ function vn(e, t, n = Date.now()) {
2601
2615
  ]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
2602
2616
  return i.format(0, "minute");
2603
2617
  }
2604
- function yn({ card: e }) {
2618
+ function bn({ card: e }) {
2605
2619
  let t = $();
2606
2620
  return e.humanSummaryOnly ? /* @__PURE__ */ I("div", {
2607
2621
  className: "space-y-2 rounded-lg border border-border/60 p-3",
@@ -2657,7 +2671,7 @@ function yn({ card: e }) {
2657
2671
  ]
2658
2672
  });
2659
2673
  }
2660
- function bn({ messages: e }) {
2674
+ function xn({ messages: e }) {
2661
2675
  return /* @__PURE__ */ F("div", {
2662
2676
  className: "space-y-2 rounded-lg border border-border/60 p-3",
2663
2677
  children: e.map((e, t) => /* @__PURE__ */ F("p", {
@@ -2666,7 +2680,7 @@ function bn({ messages: e }) {
2666
2680
  }, t))
2667
2681
  });
2668
2682
  }
2669
- function xn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2683
+ function Sn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect: a, onNewChat: o, onArchivedCurrent: s }) {
2670
2684
  let c = $(), { locale: d } = w(), [p, m] = N(""), [h, g] = N(0);
2671
2685
  k(() => Ie(() => g((e) => e + 1)), []);
2672
2686
  let _ = j(() => r ? Ye(e) : [], [
@@ -2755,19 +2769,19 @@ function xn({ scopeId: e, currentTaskId: n, open: r, onOpenChange: i, onSelect:
2755
2769
  }), /* @__PURE__ */ F("span", {
2756
2770
  className: "shrink-0 text-xs text-muted-foreground",
2757
2771
  title: `${c.chatStarted.replace("{at}", new Date(qe(e)).toLocaleString(d))} · ${c.chatLastMessage.replace("{at}", new Date(e.savedAt).toLocaleString(d))}`,
2758
- children: vn(qe(e), d)
2772
+ children: yn(qe(e), d)
2759
2773
  })]
2760
2774
  })
2761
2775
  }, `${e.subagentId}:${e.entityId}`);
2762
2776
  })
2763
- }), v && /* @__PURE__ */ F(_n, {
2777
+ }), v && /* @__PURE__ */ F(vn, {
2764
2778
  chat: v,
2765
2779
  onClose: () => y(null)
2766
2780
  })] });
2767
2781
  }
2768
- function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2782
+ function Cn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}) {
2769
2783
  let { task: a, isOpen: o, pendingGoal: s, orchestratorRunId: c, pageContext: l, pageContextCard: u, anchoredUserMessages: d, pendingResume: f, resumeRunId: p, dismissForeignTask: m, resumeEntityChat: h, pendingManualEntry: g, manualEntryRunId: _, startManualEntry: v, pendingExtraDestinations: y, pendingResumeWithAI: b, resumeWithAIRunId: x, pendingStart: S, startRunId: C, scope: w } = tt(), T = $(), E = M(null), [D, O] = N(!1);
2770
- cn(w?.id);
2784
+ ln(w?.id);
2771
2785
  let A = Ot({
2772
2786
  defaultWidth: e,
2773
2787
  minWidth: n,
@@ -2811,7 +2825,7 @@ function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2811
2825
  });
2812
2826
  return n.observe(t), () => n.disconnect();
2813
2827
  }, [a?.id, o]);
2814
- let J = s ? /* @__PURE__ */ F(fn, { userGoal: s }, c) : null, ie = f ? W(f.subagentId) : void 0, ae = f && ie ? /* @__PURE__ */ F(dn, {
2828
+ let J = s ? /* @__PURE__ */ F(pn, { userGoal: s }, c) : null, ie = f ? W(f.subagentId) : void 0, ae = f && ie ? /* @__PURE__ */ F(fn, {
2815
2829
  manifest: ie,
2816
2830
  params: f.snapshot.params,
2817
2831
  taskId: Xe(f.subagentId, f.entityId),
@@ -2819,14 +2833,14 @@ function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2819
2833
  history: f.snapshot.history,
2820
2834
  activity: f.snapshot.activity
2821
2835
  }
2822
- }, p) : null, Y = g ? W(g.subagentId) : void 0, oe = g && Y ? /* @__PURE__ */ F(pn, {
2836
+ }, p) : null, Y = g ? W(g.subagentId) : void 0, oe = g && Y ? /* @__PURE__ */ F(mn, {
2823
2837
  manifest: Y,
2824
2838
  extraDestinations: g.extraDestinations
2825
- }, _) : null, X = b ? W(b.subagentId) : void 0, Z = b && X ? /* @__PURE__ */ F(dn, {
2839
+ }, _) : null, X = b ? W(b.subagentId) : void 0, Z = b && X ? /* @__PURE__ */ F(fn, {
2826
2840
  manifest: X,
2827
2841
  params: b.params,
2828
2842
  extraDestinations: b.extraDestinations
2829
- }, x) : null, se = S ? W(S.subagentId) : void 0, ce = S && se ? /* @__PURE__ */ F(dn, {
2843
+ }, x) : null, se = S ? W(S.subagentId) : void 0, ce = S && se ? /* @__PURE__ */ F(fn, {
2830
2844
  manifest: se,
2831
2845
  params: S.params,
2832
2846
  taskId: S.taskId,
@@ -2857,7 +2871,7 @@ function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2857
2871
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-tight",
2858
2872
  children: a ? a.title : "Agentico"
2859
2873
  }),
2860
- w && /* @__PURE__ */ F(xn, {
2874
+ w && /* @__PURE__ */ F(Sn, {
2861
2875
  scopeId: w.id,
2862
2876
  currentTaskId: a?.id ?? null,
2863
2877
  open: D,
@@ -2913,7 +2927,7 @@ function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2913
2927
  });
2914
2928
  }
2915
2929
  }),
2916
- !a.agent.remote && /* @__PURE__ */ F(t, {
2930
+ !a.agent.remote && a.agent.offersFallback !== !1 && /* @__PURE__ */ F(t, {
2917
2931
  label: T.continueWithoutAi,
2918
2932
  variant: "secondary",
2919
2933
  className: "shrink-0",
@@ -2928,7 +2942,7 @@ function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2928
2942
  })
2929
2943
  ]
2930
2944
  })
2931
- ] }) : d.length > 0 ? /* @__PURE__ */ F(bn, { messages: d }) : u ? /* @__PURE__ */ F(yn, { card: u }) : /* @__PURE__ */ F("p", {
2945
+ ] }) : d.length > 0 ? /* @__PURE__ */ F(xn, { messages: d }) : u ? /* @__PURE__ */ F(bn, { card: u }) : /* @__PURE__ */ F("p", {
2932
2946
  className: "text-xs text-muted-foreground",
2933
2947
  children: l ?? T.orchestratorStarterHint
2934
2948
  })
@@ -2966,7 +2980,7 @@ function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2966
2980
  children: [a?.panelActions && /* @__PURE__ */ F("div", {
2967
2981
  className: "mb-2",
2968
2982
  children: a.panelActions
2969
- }), a ? /* @__PURE__ */ F(hn, { task: a }, a.id) : /* @__PURE__ */ F(gn, {})]
2983
+ }), a ? /* @__PURE__ */ F(gn, { task: a }, a.id) : /* @__PURE__ */ F(_n, {})]
2970
2984
  })
2971
2985
  ]
2972
2986
  })
@@ -2980,13 +2994,13 @@ function Sn({ defaultWidth: e, minWidth: n, maxWidth: r, onWidthChange: i } = {}
2980
2994
  }
2981
2995
  //#endregion
2982
2996
  //#region src/presentation/useAgenticoPageContext.ts
2983
- function Cn(e, t) {
2997
+ function wn(e, t) {
2984
2998
  let { setPageContext: n } = tt(), r = M(crypto.randomUUID()).current;
2985
2999
  k(() => (n(r, e, t ?? null), () => n(r, null)), [e, t]);
2986
3000
  }
2987
3001
  //#endregion
2988
3002
  //#region src/presentation/useSubagentComponentContext.ts
2989
- function wn(e, t, n, r, i = !0, a) {
3003
+ function Tn(e, t, n, r, i = !0, a) {
2990
3004
  let { registerComponentAnchor: o } = tt(), s = M(crypto.randomUUID()).current, c = M(n);
2991
3005
  c.current = n, k(() => {
2992
3006
  if (i) return o(s, {
@@ -3005,6 +3019,6 @@ function wn(e, t, n, r, i = !0, a) {
3005
3019
  ]);
3006
3020
  }
3007
3021
  //#endregion
3008
- export { xt as AGENTICO_MAX_WIDTH, bt as AGENTICO_MIN_WIDTH, yt as AGENTICO_WIDTH, St as AGENTICO_WIDTH_STORAGE_KEY, Sn as Agentico, et as AgenticoProvider, At as AgenticoToggle, R as DEFAULT_REASONING_PART_ID, L as DEFAULT_TEXT_PART_ID, ve as JSON_EXPORT_DESTINATION_ID, pe as MICRO_PROMPT_REGISTRY, Qe as ORCHESTRATOR_TASK_ID, fe as SUMMARY_MICRO_PROMPT, Te as agenticoDe, Ce as agenticoEn, we as agenticoIt, ie as agenticoPromptsEn, ae as agenticoPromptsIt, Ze as agenticoTranslations, me as applyMicroPrompts, We as chatHasPersonMessage, qe as chatStartedAt, Ue as chatTitle, oe as configureAgenticoPrompts, Oe as configureEntityChatStore, q as createCrossAgentTools, te as defineSubagent, Xe as entityChatTaskId, he as extractErrorMessage, ge as extractJsonBlock, W as findSubagentManifest, B as formatQuestionAnswers, X as getAgenticoPrompts, Se as getDestinationRegistry, Re as getEntityChat, nn as getSubagentControls, U as getSubagentRegistry, Zt as getSubagentReport, ke as hasEntityChatBackend, ye as jsonExportDestination, Ye as listEntityChats, ee as messagePartsText, Ie as onEntityChatsChange, K as registerCrossAgentTools, xe as registerDestinations, tn as registerSubagentControls, Xt as registerSubagentReports, H as registerSubagents, Je as removeEntityChat, Ke as renameEntityChat, de as renderRegistryCli, ue as renderSubagentCli, Z as resetAgenticoPrompts, ze as saveEntityChat, Me as syncEntityChats, ne as toJsonSchema, re as toMcpTool, z as upsertMessagePart, Vt as useAgent, tt as useAgentico, $ as useAgenticoI18n, Cn as useAgenticoPageContext, wn as useSubagentComponentContext };
3022
+ export { xt as AGENTICO_MAX_WIDTH, bt as AGENTICO_MIN_WIDTH, yt as AGENTICO_WIDTH, St as AGENTICO_WIDTH_STORAGE_KEY, Cn as Agentico, et as AgenticoProvider, At as AgenticoToggle, R as DEFAULT_REASONING_PART_ID, L as DEFAULT_TEXT_PART_ID, ve as JSON_EXPORT_DESTINATION_ID, pe as MICRO_PROMPT_REGISTRY, Qe as ORCHESTRATOR_TASK_ID, fe as SUMMARY_MICRO_PROMPT, Te as agenticoDe, Ce as agenticoEn, we as agenticoIt, ie as agenticoPromptsEn, ae as agenticoPromptsIt, Ze as agenticoTranslations, me as applyMicroPrompts, We as chatHasPersonMessage, qe as chatStartedAt, Ue as chatTitle, oe as configureAgenticoPrompts, Oe as configureEntityChatStore, q as createCrossAgentTools, te as defineSubagent, Xe as entityChatTaskId, he as extractErrorMessage, ge as extractJsonBlock, W as findSubagentManifest, B as formatQuestionAnswers, X as getAgenticoPrompts, Se as getDestinationRegistry, Re as getEntityChat, rn as getSubagentControls, U as getSubagentRegistry, Qt as getSubagentReport, ke as hasEntityChatBackend, ye as jsonExportDestination, Ye as listEntityChats, ee as messagePartsText, Ie as onEntityChatsChange, K as registerCrossAgentTools, xe as registerDestinations, nn as registerSubagentControls, Zt as registerSubagentReports, H as registerSubagents, Je as removeEntityChat, Ke as renameEntityChat, de as renderRegistryCli, ue as renderSubagentCli, Z as resetAgenticoPrompts, ze as saveEntityChat, Me as syncEntityChats, ne as toJsonSchema, re as toMcpTool, z as upsertMessagePart, Ht as useAgent, tt as useAgentico, $ as useAgenticoI18n, wn as useAgenticoPageContext, Tn as useSubagentComponentContext };
3009
3023
 
3010
3024
  //# sourceMappingURL=index.mjs.map