@ouro.bot/cli 0.1.0-alpha.1338 → 0.1.0-alpha.1340
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/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1340",
|
|
6
|
+
"changes": [
|
|
7
|
+
"media_fill_missing now finishes its job in one call: up to three passes in three minutes, never grabbing anything twice, with a result that says what is still missing and why. media_search_now says in one sentence what it does, and its result says what it started."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1338",
|
|
6
12
|
"changes": [
|
|
@@ -1108,7 +1108,10 @@ export async function mediaSearchNow(a) {
|
|
|
1108
1108
|
if (!found.item) return { result: found.result, kind: a.kind, candidates: found.candidates }
|
|
1109
1109
|
const { item } = found
|
|
1110
1110
|
const command = await runSearch(a.kind, item.id)
|
|
1111
|
-
|
|
1111
|
+
const queue = queueReport(await itemQueue(a.kind, item.id), a.kind)
|
|
1112
|
+
const rows = queue.length
|
|
1113
|
+
const summary = `${a.kind === "series" ? "Sonarr" : "Radarr"} started a search for ${item.title}; ${rows === 0 ? "nothing is downloading for it yet" : `${rows} download${rows === 1 ? " is" : "s are"} in its queue`}.`
|
|
1114
|
+
return { result: "search_started", kind: a.kind, service_id: item.id, title: item.title, command, queue, summary }
|
|
1112
1115
|
}
|
|
1113
1116
|
|
|
1114
1117
|
// Whether a download may be removed without the owner naming it. A download that has never
|
|
@@ -1492,7 +1495,11 @@ export async function mediaManualImport(a) {
|
|
|
1492
1495
|
// Sonarr parse whose own numbering agrees with the episode's TVDB or scene code.
|
|
1493
1496
|
|
|
1494
1497
|
const FILL_MAX_GRABS = 3
|
|
1495
|
-
|
|
1498
|
+
// One call runs up to FILL_MAX_PASSES passes inside FILL_BUDGET_MS; with the action grace that stays inside the 240 s tool timeout.
|
|
1499
|
+
const FILL_BUDGET_MS = 180_000
|
|
1500
|
+
const FILL_MAX_PASSES = 3
|
|
1501
|
+
// A later pass starts only with at least this much of the budget left.
|
|
1502
|
+
const FILL_MIN_PASS_MS = 20_000
|
|
1496
1503
|
const FILL_RECENT_GRAB_MS = 15 * 60_000
|
|
1497
1504
|
const FILL_EVIDENCE_ROWS = 5
|
|
1498
1505
|
// A torrent with no ETA is called stalled only after its remaining size has not moved for this long.
|
|
@@ -1706,16 +1713,34 @@ export async function mediaFillMissing(a, opts = {}) {
|
|
|
1706
1713
|
if (!found.item) return { result: found.result, candidates: found.candidates, message: "Name the series by its Sonarr service_id or exact title." }
|
|
1707
1714
|
const seriesId = found.item.id
|
|
1708
1715
|
// One pass per series at a time: a retry after a timeout must not grab beside a pass still running.
|
|
1709
|
-
if (fillRunning.has(seriesId)) return { result: "already_running", series_id: seriesId, message: "A media_fill_missing
|
|
1716
|
+
if (fillRunning.has(seriesId)) return { result: "already_running", series_id: seriesId, message: "A media_fill_missing call for this series is still running; its result covers this request." }
|
|
1710
1717
|
fillRunning.add(seriesId)
|
|
1711
1718
|
try {
|
|
1712
|
-
|
|
1719
|
+
const budgetMs = opts.deadlineMs ?? FILL_BUDGET_MS
|
|
1720
|
+
const startedAt = Date.now()
|
|
1721
|
+
const actions = []
|
|
1722
|
+
// What earlier passes grabbed counts as in flight in later ones, even before Sonarr's queue and history show it.
|
|
1723
|
+
const held = []
|
|
1724
|
+
let out
|
|
1725
|
+
let passes = 0
|
|
1726
|
+
while (passes < FILL_MAX_PASSES) {
|
|
1727
|
+
const leftMs = budgetMs - (Date.now() - startedAt)
|
|
1728
|
+
if (passes > 0 && leftMs < FILL_MIN_PASS_MS) break
|
|
1729
|
+
out = await fillPass(a, seriesId, found.item.title, { ...opts, deadlineMs: leftMs, held })
|
|
1730
|
+
passes += 1
|
|
1731
|
+
actions.push(...out.actions)
|
|
1732
|
+
held.push(...(out.held ?? []))
|
|
1733
|
+
// Another pass helps only when this one ran out of time or grab room; a failed step is reported, not retried.
|
|
1734
|
+
if (!out.incomplete || out.errors) break
|
|
1735
|
+
}
|
|
1736
|
+
const { held: _held, ...result } = out
|
|
1737
|
+
return { ...result, actions, passes }
|
|
1713
1738
|
} finally {
|
|
1714
1739
|
fillRunning.delete(seriesId)
|
|
1715
1740
|
}
|
|
1716
1741
|
}
|
|
1717
1742
|
|
|
1718
|
-
async function fillPass(a, seriesId, seriesTitle, { nowMs = Date.now(), deadlineMs =
|
|
1743
|
+
async function fillPass(a, seriesId, seriesTitle, { nowMs = Date.now(), deadlineMs, held = [] }) {
|
|
1719
1744
|
const startedAt = Date.now()
|
|
1720
1745
|
const remainingMs = () => deadlineMs - (Date.now() - startedAt)
|
|
1721
1746
|
const timeLeft = () => remainingMs() > 0
|
|
@@ -1740,7 +1765,7 @@ async function fillPass(a, seriesId, seriesTitle, { nowMs = Date.now(), deadline
|
|
|
1740
1765
|
if (!wanted.length) {
|
|
1741
1766
|
return { ...base, goal_met: true, in_flight: [], not_found: [], actions: [],
|
|
1742
1767
|
summary: `Nothing monitored is missing: ${have.length} of ${base.on_shelf.of} aired episodes are on the shelf.`,
|
|
1743
|
-
next_step: "Goal met
|
|
1768
|
+
next_step: "Goal met: nothing is left to get." }
|
|
1744
1769
|
}
|
|
1745
1770
|
|
|
1746
1771
|
const actions = []
|
|
@@ -1792,6 +1817,13 @@ async function fillPass(a, seriesId, seriesTitle, { nowMs = Date.now(), deadline
|
|
|
1792
1817
|
else { inFlight.push({ ...info, state: importDone(d.row) ? "importing" : "downloading" }); ids.forEach((id) => covered.add(id)) }
|
|
1793
1818
|
}
|
|
1794
1819
|
|
|
1820
|
+
for (const h of held) {
|
|
1821
|
+
const ids = wanted.map((e) => e.id).filter((id) => h.ids.includes(id) && !covered.has(id))
|
|
1822
|
+
if (!ids.length) continue
|
|
1823
|
+
inFlight.push({ title: h.title, download_id: h.download_id, episodes: ids.map((id) => sxe(byId.get(id))), state: "just_grabbed" })
|
|
1824
|
+
ids.forEach((id) => covered.add(id))
|
|
1825
|
+
}
|
|
1826
|
+
const passHeld = []
|
|
1795
1827
|
// Search for everything not covered by a moving download, stalled ones included.
|
|
1796
1828
|
const need = wanted.filter((e) => !covered.has(e.id))
|
|
1797
1829
|
const searched = []
|
|
@@ -1899,6 +1931,7 @@ async function fillPass(a, seriesId, seriesTitle, { nowMs = Date.now(), deadline
|
|
|
1899
1931
|
actions.push({ action: "grabbed", title: c.raw.title ?? null, indexer: c.raw.indexer ?? null, seeders: c.raw.seeders ?? null, matched_by: c.basis,
|
|
1900
1932
|
episodes: ids.map((id) => sxe(byId.get(id))), download_id: res.downloadId ?? null, ...(seeded ? {} : { may_never_finish: true }) })
|
|
1901
1933
|
inFlight.push({ title: c.raw.title ?? null, download_id: res.downloadId ?? null, episodes: ids.map((id) => sxe(byId.get(id))), state: "just_grabbed" })
|
|
1934
|
+
passHeld.push({ title: c.raw.title ?? null, download_id: res.downloadId ?? null, ids })
|
|
1902
1935
|
// Only after the replacement is grabbed, and only for a confirmed stall it fully covers with a seeded release.
|
|
1903
1936
|
if (!seeded) continue
|
|
1904
1937
|
for (const s of stalled.filter((x) => !x.replaced && x.confirmed && x.ids.every((id) => ids.includes(id)))) {
|
|
@@ -1959,20 +1992,22 @@ async function fillPass(a, seriesId, seriesTitle, { nowMs = Date.now(), deadline
|
|
|
1959
1992
|
deferred.size || unsearched.length ? `${deferred.size + unsearched.length} episode(s) not handled yet in this pass.` : "",
|
|
1960
1993
|
errors.length ? `${errors.length} step(s) failed: ${errors.map((x) => x.step).join("; ")}.` : "",
|
|
1961
1994
|
].filter(Boolean).join(" ")
|
|
1962
|
-
const nextStep = incomplete
|
|
1963
|
-
? "
|
|
1995
|
+
const nextStep = incomplete && errors.length
|
|
1996
|
+
? "Some steps failed (listed in errors); calling media_fill_missing again retries them."
|
|
1997
|
+
: incomplete
|
|
1998
|
+
? "Time ran out before every episode was handled; calling media_fill_missing again continues from the ones listed as deferred or unsearched."
|
|
1964
1999
|
: stuck.length || notFound.length
|
|
1965
|
-
? "
|
|
2000
|
+
? "Everything findable is requested; what is still missing is listed with why. Calling media_fill_missing later retries those."
|
|
1966
2001
|
: unseeded.length
|
|
1967
|
-
? "
|
|
1968
|
-
: "Work is in progress
|
|
2002
|
+
? "Everything findable is requested; the unseeded grab waits for peers and may never finish. An await_condition watch can bring this back to media_fill_missing later."
|
|
2003
|
+
: "Work is in progress: everything findable is requested and downloading. Calling media_fill_missing later imports and confirms it."
|
|
1969
2004
|
const blockedHint = !blockedReport.length ? ""
|
|
1970
|
-
: ownerRetry ? " The owner's retry could not take the blocklisted release back (see errors and blocklisted_matches)
|
|
1971
|
-
: " The only matching release is on the blocklist
|
|
2005
|
+
: ownerRetry ? " The owner's retry could not take the blocklisted release back (see errors and blocklisted_matches)."
|
|
2006
|
+
: " The only matching release is on the blocklist; media_fill_missing with retry_blocklisted set to the asker's own words takes it off and grabs it."
|
|
1972
2007
|
return { ...base, goal_met: false, in_flight: inFlight, not_found: notFound, actions,
|
|
1973
2008
|
...(deferred.size ? { deferred: need.filter((e) => deferred.has(e.id)).map(code) } : {}), ...(unsearched.length ? { unsearched: unsearched.map(code) } : {}),
|
|
1974
2009
|
searched, ...(blockedReport.length ? { blocklisted_matches: blockedReport } : {}), ...(rejected.size ? { rejected_releases: [...rejected.values()].slice(0, 12) } : {}), ...(evidence ? { indexer_evidence: evidence } : {}),
|
|
1975
|
-
...(errors.length ? { errors } : {}), ...(incomplete ? { incomplete: true } : {}), summary, next_step: nextStep + blockedHint }
|
|
2010
|
+
...(errors.length ? { errors } : {}), ...(incomplete ? { incomplete: true } : {}), summary, next_step: nextStep + blockedHint, held: passHeld }
|
|
1976
2011
|
}
|
|
1977
2012
|
|
|
1978
2013
|
// ------------------------------------------------- tool: quality profiles
|
|
@@ -2220,7 +2255,7 @@ const TOOL_LIST = [
|
|
|
2220
2255
|
},
|
|
2221
2256
|
{
|
|
2222
2257
|
name: "media_search_now",
|
|
2223
|
-
description: "
|
|
2258
|
+
description: "Asks Sonarr or Radarr to search again for a series or movie already in the library (by service_id, tmdb_id or title) and returns what it started and the item's queue.",
|
|
2224
2259
|
inputSchema: { type: "object", properties: {
|
|
2225
2260
|
kind: { type: "string", enum: ["series", "movie"] },
|
|
2226
2261
|
service_id: { type: "number", description: "Sonarr series id or Radarr movie id." },
|
|
@@ -2242,7 +2277,7 @@ const TOOL_LIST = [
|
|
|
2242
2277
|
{
|
|
2243
2278
|
name: "media_fill_missing",
|
|
2244
2279
|
_meta: { [TIMEOUT_META_KEY]: 240_000 },
|
|
2245
|
-
description: "
|
|
2280
|
+
description: "Gets a series' missing episodes in one call: it re-reads Sonarr, searches the indexers, grabs the best seeded release for each monitored aired episode (matched by episode title and air year as well as Sonarr's numbering), imports finished downloads, and replaces a stalled download it keeps by itself once a seeded alternative exists, over up to 3 passes in 3 minutes. It never grabs what is already in flight. Returns on_shelf, in_flight, not_found, actions, indexer_evidence, summary and next_step; goal_met is true when nothing is left to get, and blocklisted_matches lists episodes whose only release is blocklisted.",
|
|
2246
2281
|
inputSchema: { type: "object", properties: {
|
|
2247
2282
|
series: { type: "string", description: "Series title as the owner said it." },
|
|
2248
2283
|
service_id: { type: "number", description: "Sonarr series id, when known." },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0"?>
|
|
2
2
|
<Container version="2">
|
|
3
3
|
<Name>ouro-butler</Name>
|
|
4
|
-
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1340</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1340",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@ouro.bot/cli",
|
|
9
|
-
"version": "0.1.0-alpha.
|
|
9
|
+
"version": "0.1.0-alpha.1340",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1340",
|
|
4
4
|
"description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
|
|
5
5
|
"homepage": "https://ouroboros.bot/",
|
|
6
6
|
"engines": {
|