omo-ai 5.1.64 → 5.1.66
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/bin/darwin/omo-keychain +0 -0
- package/bin/lib/doctor-memory-runtime.js +167 -0
- package/bin/lib/doctor-reflection-lock.js +102 -6
- package/bin/lib/doctor.js +4 -2
- package/bin/lib/launcher.js +21 -3
- package/bin/lib/provider-map.json +1 -1
- package/bin/lib/reflection-lock.generated.js +39 -1
- package/bin/lib/service-auth.generated.js +39 -20
- package/bin/lib/thread.js +35 -2
- package/package.json +2 -2
- package/plugin/CHANGELOG.md +91 -0
- package/plugin/extensions/dream-persona.md +1 -1
- package/plugin/extensions/gateway-store-worker.mjs +2 -2
- package/plugin/extensions/memory-run-supervisor.mjs +3 -3
- package/plugin/extensions/omo-claim-receipt.js +1 -1
- package/plugin/extensions/omo-computer-use.js +1 -1
- package/plugin/extensions/omo-desktop-toolkit.js +1 -1
- package/plugin/extensions/omo-device-account.js +66 -2
- package/plugin/extensions/omo-device-service.js +5 -5
- package/plugin/extensions/omo-feedback.js +2 -2
- package/plugin/extensions/omo-init-deep-advisor.js +1 -1
- package/plugin/extensions/omo-member.js +2 -2
- package/plugin/extensions/omo-memory-commands.js +3 -3
- package/plugin/extensions/omo-memory-doctor.js +3 -3
- package/plugin/extensions/omo-memory-memfs.js +1 -1
- package/plugin/extensions/omo-memory-palace.js +2 -2
- package/plugin/extensions/omo-memory-sync.js +1 -1
- package/plugin/extensions/omo-onboarding-scan.js +3 -3
- package/plugin/extensions/omo-recall-store.js +1 -1
- package/plugin/extensions/omo-session-history.js +1 -1
- package/plugin/extensions/omo-side-panel.js +2 -2
- package/plugin/extensions/omo-task.js +2 -2
- package/plugin/extensions/omo-telemetry-otlp.js +2 -2
- package/plugin/extensions/omo-telemetry-posthog.js +1 -1
- package/plugin/extensions/omo-telemetry-recovery.js +1 -1
- package/plugin/extensions/omo-thread-client.js +5 -5
- package/plugin/extensions/omo.js +3 -3
- package/plugin/package.json +2 -1
- package/plugin/runtime/agent-toolkit-sdk/sdk.js +2 -2
- package/plugin/runtime/ast-grep-mcp/manifest.json +1 -1
- package/plugin/runtime/bunshin-ts/sdk.js +2 -2
- package/plugin/runtime/category-coverage/index.js +2 -2
- package/plugin/runtime/rollback-migrate.js +1 -1
- package/plugin/runtime/task-config/index.js +3 -3
- package/plugin/runtime/thread-sdk/sdk.js +5 -5
- package/plugin/skills/browser/SKILL.md +24 -7
- package/plugin/skills/browser/references/commands.md +41 -4
- package/plugin/skills/browser/references/owned-engine/frames-and-humans.md +15 -4
- package/plugin/skills/browser/references/recipes/1password.md +4 -2
- package/plugin/skills/browser/runtime/omowright/index.js +232 -341
- package/plugin/skills/browser/runtime/omowright/manifest.json +5 -5
- package/plugin/skills/browser/runtime/omowright/page-bundle.js +1586 -1394
- package/plugin/skills/browser/scripts/browser-doctor-report.mjs +68 -0
- package/plugin/skills/browser/scripts/browser-doctor.mjs +8 -43
- package/plugin/skills/browser/scripts/omowright.mjs +7 -1
- package/plugin/skills/debugging/references/tools/browser-qa.md +4 -3
- package/plugin/skills/mass-ulw/references/planning.md +2 -2
- package/plugin/skills/ultimate-browsing/SKILL.md +1 -1
- package/plugin/skills/ulw-research/SKILL.md +3 -3
- package/plugin/skills/ulw-research/references/research-collection.md +4 -4
- package/plugin/skills/visual-qa/references/browser-setup.md +5 -4
package/bin/darwin/omo-keychain
CHANGED
|
Binary file
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// omo doctor: how much each durable memory identity holds under runtime/ and the total (#10144). The
|
|
2
|
+
// number comes from the same measure the session's size cap acts on (memory-core retention/size.ts),
|
|
3
|
+
// run from the generated doctor bundle, so the CLI and the cap cannot count differently.
|
|
4
|
+
|
|
5
|
+
import { existsSync, readdirSync } from "node:fs"
|
|
6
|
+
import { createRequire } from "node:module"
|
|
7
|
+
import { homedir } from "node:os"
|
|
8
|
+
import { join, resolve } from "node:path"
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_RUNTIME_MAX_BYTES,
|
|
11
|
+
DEFAULT_RUNTIME_RETENTION,
|
|
12
|
+
buildIdentityPaths,
|
|
13
|
+
describeRuntimeCapExcess,
|
|
14
|
+
formatRuntimeBytes,
|
|
15
|
+
measureRuntimeCapEvictableBytes,
|
|
16
|
+
measureRuntimeSizeWithinBudget,
|
|
17
|
+
measureUnreflectedJournalBytes,
|
|
18
|
+
runtimeSizeStanding,
|
|
19
|
+
} from "./reflection-lock.generated.js"
|
|
20
|
+
|
|
21
|
+
const MEMORY_ROOT_ENV_VAR = "OMO_MEMORY_HOME"
|
|
22
|
+
// The listing stays readable on hosts with thousands of identities; the total and every warning still
|
|
23
|
+
// cover all of them.
|
|
24
|
+
const LISTED_IDENTITIES = 10
|
|
25
|
+
|
|
26
|
+
function memoryRoot(env) {
|
|
27
|
+
const override = env[MEMORY_ROOT_ENV_VAR]
|
|
28
|
+
if (override === undefined || override.trim() === "") return join(homedir(), ".omo", "memory")
|
|
29
|
+
return resolve(process.cwd(), override)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function listDurableIdentities(agentsRoot) {
|
|
33
|
+
try {
|
|
34
|
+
return readdirSync(agentsRoot, { withFileTypes: true })
|
|
35
|
+
.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."))
|
|
36
|
+
.map((entry) => entry.name)
|
|
37
|
+
.filter((name) => existsSync(join(agentsRoot, name, "repo")))
|
|
38
|
+
.sort()
|
|
39
|
+
} catch {
|
|
40
|
+
return []
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const requireRuntime = createRequire(import.meta.url)
|
|
45
|
+
const TASK_CONFIG_RUNTIME = join("runtime", "task-config", "index.js")
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* `memory.runtime.max_bytes` per identity, read through the staged config runtime (the loader every
|
|
49
|
+
* other omo.json key goes through). Fail-open: a payload without the runtime, or any error in it,
|
|
50
|
+
* reads the shipped default.
|
|
51
|
+
*/
|
|
52
|
+
function loadMemoryRuntimeCaps(options) {
|
|
53
|
+
try {
|
|
54
|
+
const runtime = (options.loadRuntime ?? ((pluginRoot) => requireRuntime(join(pluginRoot, TASK_CONFIG_RUNTIME))))(options.pluginRoot)
|
|
55
|
+
return runtime.resolveMemoryRuntimeCaps({ cwd: options.cwd ?? process.cwd(), env: options.env ?? process.env })
|
|
56
|
+
} catch {
|
|
57
|
+
return undefined
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function memoryRuntimeMaxBytesResolver(options) {
|
|
62
|
+
const caps = loadMemoryRuntimeCaps(options)
|
|
63
|
+
return (identity) => caps?.agents[identity] ?? caps?.maxBytes ?? DEFAULT_RUNTIME_MAX_BYTES
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** `memory.runtime.discard_unreflected_journals` per identity, from the same loader; fail-open to the shipped false. */
|
|
67
|
+
export function memoryRuntimeDiscardResolver(options) {
|
|
68
|
+
const caps = loadMemoryRuntimeCaps(options)
|
|
69
|
+
return (identity) => caps?.discardAgents?.[identity] ?? caps?.discardUnreflectedJournals ?? false
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function capText(maxBytes) {
|
|
73
|
+
return maxBytes > 0 ? `${formatRuntimeBytes(maxBytes)} cap` : "no cap"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function formatMemoryRuntimeLines(identities, totalBytes) {
|
|
77
|
+
if (identities.length === 0) return []
|
|
78
|
+
const bySize = [...identities].sort((left, right) => right.bytes - left.bytes || left.identity.localeCompare(right.identity))
|
|
79
|
+
const lines = bySize.slice(0, LISTED_IDENTITIES).map((entry) => {
|
|
80
|
+
if (entry.sizeUnknown !== undefined) return `INFO memory runtime: ${entry.identity} size unknown (${capText(entry.maxBytes)})`
|
|
81
|
+
const standing = runtimeSizeStanding(entry.bytes, entry.maxBytes)
|
|
82
|
+
const share = standing.percent === undefined ? "" : `, ${standing.percent}%`
|
|
83
|
+
return `INFO memory runtime: ${entry.identity} ${formatRuntimeBytes(entry.bytes)} (${capText(entry.maxBytes)}${share})`
|
|
84
|
+
})
|
|
85
|
+
const rest = bySize.slice(LISTED_IDENTITIES)
|
|
86
|
+
if (rest.length > 0) {
|
|
87
|
+
const restBytes = rest.reduce((sum, entry) => sum + entry.bytes, 0)
|
|
88
|
+
lines.push(`INFO memory runtime: ${rest.length} more identities hold ${formatRuntimeBytes(restBytes)}`)
|
|
89
|
+
}
|
|
90
|
+
const unknown = identities.filter((entry) => entry.sizeUnknown !== undefined).length
|
|
91
|
+
lines.push(`INFO memory runtime total: ${formatRuntimeBytes(totalBytes)} across ${identities.length} identit${identities.length === 1 ? "y" : "ies"}${unknown === 0 ? "" : ` (${unknown} not measured)`}`)
|
|
92
|
+
for (const entry of bySize) {
|
|
93
|
+
if (entry.sizeUnknown !== undefined) {
|
|
94
|
+
lines.push(`WARN memory runtime (${entry.identity}): size unknown: measurement exceeded ${entry.sizeUnknown.budgetMs} ms on ${entry.sizeUnknown.at}`)
|
|
95
|
+
continue
|
|
96
|
+
}
|
|
97
|
+
const excess = describeRuntimeCapExcess({
|
|
98
|
+
overCapBytes: entry.maxBytes > 0 ? entry.bytes - entry.maxBytes : 0,
|
|
99
|
+
evictableBytes: entry.evictableBytes ?? 0,
|
|
100
|
+
unreflectedBytes: entry.unreflectedBytes ?? 0,
|
|
101
|
+
discardUnreflectedJournals: entry.discardUnreflectedJournals,
|
|
102
|
+
})
|
|
103
|
+
// Over the cap, the excess line says what the next pass does; the near-cap line is for 80-100 %.
|
|
104
|
+
if (excess !== undefined) {
|
|
105
|
+
lines.push(`WARN memory runtime (${entry.identity}): ${excess}; raise memory.runtime.max_bytes, or set it to 0, to keep more.`)
|
|
106
|
+
continue
|
|
107
|
+
}
|
|
108
|
+
const standing = runtimeSizeStanding(entry.bytes, entry.maxBytes)
|
|
109
|
+
if (standing.level !== "warn") continue
|
|
110
|
+
lines.push(`WARN memory runtime is near its size cap (${entry.identity}): ${formatRuntimeBytes(entry.bytes)} is ${standing.percent}% of the ${formatRuntimeBytes(entry.maxBytes)} cap (memory.runtime.max_bytes). The next maintenance pass evicts the oldest runtime data down to the cap; raise the cap, or set it to 0, to keep more.`)
|
|
111
|
+
}
|
|
112
|
+
return lines
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @param options.env where OMO_MEMORY_HOME is read
|
|
117
|
+
* @param options.maxBytesFor the resolved `memory.runtime.max_bytes` for one identity (default: the shipped default)
|
|
118
|
+
* @param options.discardFor the resolved `memory.runtime.discard_unreflected_journals` for one identity (default: the shipped false)
|
|
119
|
+
* @param options.measureBudgetMs each identity's measurement deadline, the one `/doctor` uses (default: the shipped pass_budget_ms)
|
|
120
|
+
* @param options.measureSignal a caller deadline that replaces the per-identity timer
|
|
121
|
+
* @returns {Promise<{ identities: { identity: string, bytes: number, maxBytes: number, unreflectedBytes?: number, discardUnreflectedJournals: boolean, evictableBytes?: number, sizeUnknown?: { budgetMs: number, at: string } }[], totalBytes: number, lines: string[] }>}
|
|
122
|
+
*/
|
|
123
|
+
export async function memoryRuntimeReport(options = {}) {
|
|
124
|
+
const root = memoryRoot(options.env ?? process.env)
|
|
125
|
+
const agentsRoot = join(root, "agents")
|
|
126
|
+
const maxBytesFor = options.maxBytesFor ?? (() => DEFAULT_RUNTIME_MAX_BYTES)
|
|
127
|
+
const discardFor = options.discardFor ?? (() => false)
|
|
128
|
+
const budgetMs = options.measureBudgetMs ?? DEFAULT_RUNTIME_RETENTION.passBudgetMs
|
|
129
|
+
const identities = []
|
|
130
|
+
for (const identity of options.listIdentities?.(agentsRoot) ?? listDurableIdentities(agentsRoot)) {
|
|
131
|
+
const paths = buildIdentityPaths(root, identity)
|
|
132
|
+
const maxBytes = maxBytesFor(identity)
|
|
133
|
+
const discardUnreflectedJournals = discardFor(identity)
|
|
134
|
+
// One deadline per identity bounds the size walk and the journal scans that read whole transcripts.
|
|
135
|
+
const signal = options.measureSignal ?? AbortSignal.timeout(budgetMs)
|
|
136
|
+
const startedAt = Date.now()
|
|
137
|
+
const measured = await measureRuntimeSizeWithinBudget(paths.runtime, { budgetMs, now: startedAt, signal })
|
|
138
|
+
if ("sizeUnknown" in measured) {
|
|
139
|
+
identities.push({ identity, bytes: 0, maxBytes, discardUnreflectedJournals, sizeUnknown: measured.sizeUnknown })
|
|
140
|
+
continue
|
|
141
|
+
}
|
|
142
|
+
const bytes = measured.size.bytes
|
|
143
|
+
const policy = { ...DEFAULT_RUNTIME_RETENTION, discardUnreflectedJournals }
|
|
144
|
+
const overCap = maxBytes > 0 && bytes > maxBytes
|
|
145
|
+
let unreflectedBytes
|
|
146
|
+
let evictableBytes
|
|
147
|
+
try {
|
|
148
|
+
// Printed only on the over-cap line, and only with the switch off.
|
|
149
|
+
unreflectedBytes = overCap && !discardUnreflectedJournals ? await measureUnreflectedJournalBytes({ paths, policy, signal }) : undefined
|
|
150
|
+
evictableBytes = overCap ? await measureRuntimeCapEvictableBytes({ paths, policy, now: Date.now, signal }) : undefined
|
|
151
|
+
} catch (error) {
|
|
152
|
+
if (!signal.aborted) throw error
|
|
153
|
+
identities.push({ identity, bytes: 0, maxBytes, discardUnreflectedJournals, sizeUnknown: { budgetMs, at: new Date(startedAt).toISOString() } })
|
|
154
|
+
continue
|
|
155
|
+
}
|
|
156
|
+
identities.push({
|
|
157
|
+
identity,
|
|
158
|
+
bytes,
|
|
159
|
+
maxBytes,
|
|
160
|
+
discardUnreflectedJournals,
|
|
161
|
+
...(unreflectedBytes === undefined ? {} : { unreflectedBytes }),
|
|
162
|
+
...(evictableBytes === undefined ? {} : { evictableBytes }),
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
const totalBytes = identities.reduce((sum, entry) => sum + entry.bytes, 0)
|
|
166
|
+
return { identities, totalBytes, lines: formatMemoryRuntimeLines(identities, totalBytes) }
|
|
167
|
+
}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
// omo doctor: a reflection lock held by a run that cannot finish (#10377). The decision is the one the
|
|
2
2
|
// session uses (memory-core reflection/stale-holder.ts), run from its generated bundle, so the two
|
|
3
3
|
// surfaces cannot disagree. A dead holder and a stuck one are both reported with the next step;
|
|
4
|
-
// a live holder or no lock prints nothing.
|
|
4
|
+
// a live holder or no lock prints nothing. `omo doctor --fix` runs the shared reaper
|
|
5
|
+
// (stale-lock-reaper.ts) with its minimal settle on every durable identity (#11976).
|
|
5
6
|
|
|
6
7
|
import { existsSync, readdirSync } from "node:fs"
|
|
8
|
+
import { createRequire } from "node:module"
|
|
7
9
|
import { homedir } from "node:os"
|
|
8
10
|
import { basename, join, resolve } from "node:path"
|
|
9
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
classifyReflectionLockHolder,
|
|
13
|
+
createRetentionHostSweepStep,
|
|
14
|
+
decideStaleReflectionLock,
|
|
15
|
+
decideStrandedRun,
|
|
16
|
+
formatStaleLockFixLines,
|
|
17
|
+
reclaimDeadOwnerLocks,
|
|
18
|
+
runStaleLockReaper,
|
|
19
|
+
sweepHostIdentities,
|
|
20
|
+
sweepIdentityOrphanWorktrees,
|
|
21
|
+
} from "./reflection-lock.generated.js"
|
|
22
|
+
import { TASK_CONFIG_RUNTIME } from "./daemon-config.js"
|
|
23
|
+
import { packageRoot } from "./package-paths.js"
|
|
24
|
+
|
|
25
|
+
const requireRuntime = createRequire(import.meta.url)
|
|
10
26
|
|
|
11
27
|
const MEMORY_ROOT_ENV_VAR = "OMO_MEMORY_HOME"
|
|
12
28
|
|
|
@@ -20,13 +36,24 @@ export function classifyReflectionLock(reflectionDir, probe = {}) {
|
|
|
20
36
|
return classifyReflectionLockHolder(reflectionDir, probe)
|
|
21
37
|
}
|
|
22
38
|
|
|
23
|
-
export function
|
|
39
|
+
export function decideReflectionLock(reflectionDir, probe = {}) {
|
|
40
|
+
return decideStaleReflectionLock(reflectionDir, probe)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function decideStrandedReflectionRun(runDir, probe = {}) {
|
|
44
|
+
return decideStrandedRun(runDir, probe)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function formatReflectionLockLines(identity, verdict, reflectionDir, decision) {
|
|
24
48
|
if (verdict.state === "none" || verdict.state === "live") return []
|
|
25
49
|
const lock = join(reflectionDir, "active.lock")
|
|
26
50
|
if (verdict.state === "dead") {
|
|
27
51
|
return [`WARN memory reflection is stuck on a stale lock (${identity}): run ${verdict.runId} still holds ${lock}, but its launcher is gone and it already recorded its outcome. Next step: open a session and send /reflect (or any message); the session settles that run and starts any queued request.`]
|
|
28
52
|
}
|
|
29
|
-
|
|
53
|
+
if (decision?.kind === "reap") {
|
|
54
|
+
return [`WARN memory reflection is stuck on a stale lock (${identity}): run ${verdict.runId} still holds ${lock} and ${decision.reason}. Next step: omo doctor --fix (it would apply ${decision.action}).`]
|
|
55
|
+
}
|
|
56
|
+
return [`WARN memory reflection is stuck on a stale lock (${identity}): run ${verdict.runId} still holds ${lock} and ${verdict.reason}. Next step: run /doctor in a session; if no reflection run is active, run omo doctor --fix.`]
|
|
30
57
|
}
|
|
31
58
|
|
|
32
59
|
function listDurableIdentities(agentsRoot) {
|
|
@@ -45,8 +72,77 @@ export async function reflectionLockReport(options = {}) {
|
|
|
45
72
|
const lines = []
|
|
46
73
|
for (const identityRoot of options.listIdentities?.(agentsRoot) ?? listDurableIdentities(agentsRoot)) {
|
|
47
74
|
const reflectionDir = join(identityRoot, "runtime", "reflection")
|
|
48
|
-
const verdict = await
|
|
49
|
-
lines.push(...formatReflectionLockLines(basename(identityRoot), verdict, reflectionDir))
|
|
75
|
+
const { verdict, decision } = await decideStaleReflectionLock(reflectionDir, options.reflectionLockProbe ?? {})
|
|
76
|
+
lines.push(...formatReflectionLockLines(basename(identityRoot), verdict, reflectionDir, decision))
|
|
50
77
|
}
|
|
51
78
|
return lines
|
|
52
79
|
}
|
|
80
|
+
|
|
81
|
+
function orphanLines(identity, report, dryRun) {
|
|
82
|
+
if (report.skipped !== undefined) return []
|
|
83
|
+
const lines = report.removed.map((target) => `${dryRun ? "WOULD FIX" : "FIXED"} ${identity} removed orphan ${target}`)
|
|
84
|
+
if (dryRun) lines.push(...report.kept.map((entry) => `KEPT ${identity} worktree ${entry.target} (${entry.reason})`))
|
|
85
|
+
lines.push(...report.failed.map((entry) => `KEPT ${identity} orphan ${entry.target} (${entry.detail})`))
|
|
86
|
+
return lines
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function loadTaskConfigRuntime() {
|
|
90
|
+
return requireRuntime(join(packageRoot, "plugin", TASK_CONFIG_RUNTIME))
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// The memory settings of the user's GLOBAL omo config only (omo.jsonc, else omo.json under ~/.omo):
|
|
94
|
+
// `--fix` sweeps identities of every project, so it never reads a project layer (REVIEW-4 M-b). They
|
|
95
|
+
// are resolved by the session's own loader (`[senpi]`, `[native]`, the active profile, merged per agent
|
|
96
|
+
// and per runtime key) through the staged task-config runtime (task-config-entry.ts). Unreadable config
|
|
97
|
+
// or a runtime that cannot load means no settings, which keeps unreflected journal input.
|
|
98
|
+
export function readGlobalMemorySettings(home = homedir(), options = {}) {
|
|
99
|
+
try {
|
|
100
|
+
const runtime = (options.loadTaskConfig ?? loadTaskConfigRuntime)()
|
|
101
|
+
return runtime.resolveGlobalMemorySettings({ env: { ...(options.env ?? process.env), HOME: home, USERPROFILE: home } })
|
|
102
|
+
} catch {
|
|
103
|
+
return undefined
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// `omo doctor --fix`: driver 1 of the host sweep (memory-core reflection/host-sweep.ts). Every identity
|
|
108
|
+
// with a runtime/ is visited, repo or not, resuming at the persisted cursor; a repo-less identity gets
|
|
109
|
+
// the reaper and the lock sweep, never the git-backed orphan sweep.
|
|
110
|
+
export async function reflectionLockFix(options = {}) {
|
|
111
|
+
const memory = memoryRoot(options.env ?? process.env)
|
|
112
|
+
const dryRun = options.dryRun === true
|
|
113
|
+
const probe = options.reflectionLockProbe ?? {}
|
|
114
|
+
let failed = false
|
|
115
|
+
const reap = async (identity) => {
|
|
116
|
+
try {
|
|
117
|
+
const report = await runStaleLockReaper({ runtimeDir: identity.runtimeDir, probe, dryRun })
|
|
118
|
+
const locks = dryRun ? undefined : await reclaimDeadOwnerLocks(join(identity.runtimeDir, "locks"))
|
|
119
|
+
return formatStaleLockFixLines(identity.name, report, locks)
|
|
120
|
+
} catch (error) {
|
|
121
|
+
failed = true
|
|
122
|
+
return [`FAIL ${identity.name} reflection lock fix failed: ${error instanceof Error ? error.message : String(error)}`]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const orphans = async (identity) => {
|
|
126
|
+
try {
|
|
127
|
+
return orphanLines(identity.name, await sweepIdentityOrphanWorktrees(identity.root, { now: (probe.now ?? Date.now)(), dryRun }), dryRun)
|
|
128
|
+
} catch (error) {
|
|
129
|
+
failed = true
|
|
130
|
+
return [`FAIL ${identity.name} orphan worktree sweep failed: ${error instanceof Error ? error.message : String(error)}`]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const settings = options.memorySettings ?? readGlobalMemorySettings(options.home ?? homedir(), {
|
|
134
|
+
env: options.env ?? process.env,
|
|
135
|
+
...(options.loadTaskConfig === undefined ? {} : { loadTaskConfig: options.loadTaskConfig }),
|
|
136
|
+
})
|
|
137
|
+
const retention = createRetentionHostSweepStep({ ...(settings === undefined ? {} : { settings }), ...(probe.now === undefined ? {} : { now: probe.now }), dryRun })
|
|
138
|
+
const retain = async (identity) => {
|
|
139
|
+
const lines = await retention(identity)
|
|
140
|
+
if (lines.some((line) => line.startsWith("FAIL "))) failed = true
|
|
141
|
+
return lines
|
|
142
|
+
}
|
|
143
|
+
const result = await sweepHostIdentities({ memoryRoot: memory, steps: [reap, orphans, retain], dryRun })
|
|
144
|
+
if (result.status === "busy") return { lines: ["INFO another sweep is running on this host; try again when it finishes"], failed: false }
|
|
145
|
+
const lines = result.lines.filter((line) => !/^INFO \S+ locks reclaimed 0, kept 0$/.test(line))
|
|
146
|
+
if (lines.length === 0) lines.push(dryRun ? "INFO nothing to fix" : "PASS no stale reflection locks")
|
|
147
|
+
return { lines, failed }
|
|
148
|
+
}
|
package/bin/lib/doctor.js
CHANGED
|
@@ -91,9 +91,10 @@ const MANAGED_MODE_FLAG = "--mode"
|
|
|
91
91
|
* it can never be a reason for diagnostics to fail, so an unavailable or unparsable listing is an
|
|
92
92
|
* empty list.
|
|
93
93
|
*/
|
|
94
|
-
function listProcesses() {
|
|
94
|
+
export function listProcesses() {
|
|
95
95
|
if (process.platform === "win32") return []
|
|
96
|
-
|
|
96
|
+
// -ww: an unlimited width, so `args` is never cut at the terminal width (BSD/macOS `ps` truncates).
|
|
97
|
+
const listed = spawnSync("ps", ["-ww", "-axo", "pid=,ppid=,etime=,tty=,args="], { encoding: "utf8" })
|
|
97
98
|
if (listed.status !== 0 || typeof listed.stdout !== "string") return []
|
|
98
99
|
const entries = []
|
|
99
100
|
for (const line of listed.stdout.split("\n")) {
|
|
@@ -426,6 +427,7 @@ export function runDoctor(inventory, args = [], options = {}) {
|
|
|
426
427
|
lines.push(...retiredPayloadReport(options))
|
|
427
428
|
lines.push(...transientMemoryReport(options))
|
|
428
429
|
lines.push(...(options.reflectionLock ?? []))
|
|
430
|
+
lines.push(...(options.memoryRuntime ?? []))
|
|
429
431
|
const launchSpec = launchSpecDoctorLines(options.pluginRoot ?? join(packageRoot, "plugin"), options.launchSpecIo)
|
|
430
432
|
if (launchSpec.some((line) => line.startsWith("FAIL "))) failed = true
|
|
431
433
|
lines.push(...launchSpec)
|
package/bin/lib/launcher.js
CHANGED
|
@@ -14,7 +14,8 @@ import { runDaemonCommand } from "./daemon.js"
|
|
|
14
14
|
import { runThreadCommand } from "./thread.js"
|
|
15
15
|
import { isHostStatusAll, runHostStatusAll, sessionActivityReader } from "./host-status.js"
|
|
16
16
|
import { runDoctor } from "./doctor.js"
|
|
17
|
-
import { reflectionLockReport } from "./doctor-reflection-lock.js"
|
|
17
|
+
import { reflectionLockFix, reflectionLockReport } from "./doctor-reflection-lock.js"
|
|
18
|
+
import { memoryRuntimeDiscardResolver, memoryRuntimeMaxBytesResolver, memoryRuntimeReport } from "./doctor-memory-runtime.js"
|
|
18
19
|
import { ensureEnginePrepared, preparePluginLaunchSpec } from "./engine-prepare.js"
|
|
19
20
|
import { migrateLegacyBunGlobalManifest } from "./legacy-bun-global-migration.js"
|
|
20
21
|
import { removeLegacyServiceCredentials } from "./legacy-service-credentials.js"
|
|
@@ -218,13 +219,29 @@ export async function runLauncher(args = process.argv.slice(2)) {
|
|
|
218
219
|
process.exitCode = await runDoctorModels(args.slice(2), { agentDir: canonicalAgentDir() })
|
|
219
220
|
return
|
|
220
221
|
}
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
if (args[1] === "--fix") {
|
|
223
|
+
const extra = args.slice(2).filter((arg) => arg !== "--dry-run")
|
|
224
|
+
if (extra.length > 0) {
|
|
225
|
+
console.log(`FAIL unknown argument ${JSON.stringify(extra[0])}: omo doctor --fix [--dry-run]`)
|
|
226
|
+
process.exitCode = 1
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
const result = await reflectionLockFix({ dryRun: args.includes("--dry-run") })
|
|
230
|
+
console.log(result.lines.join("\n"))
|
|
231
|
+
process.exitCode = result.failed ? 1 : 0
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
const [categoryCoverage, computerUse, configDiagnostics, reflectionLock, memoryRuntime] = args[1] === "--reap"
|
|
235
|
+
? [[], [], [], [], []]
|
|
223
236
|
: await Promise.all([
|
|
224
237
|
doctorCoverageLines({ agentDir: canonicalAgentDir() }),
|
|
225
238
|
doctorComputerUseLines(),
|
|
226
239
|
doctorConfigLines(),
|
|
227
240
|
reflectionLockReport(),
|
|
241
|
+
memoryRuntimeReport({
|
|
242
|
+
maxBytesFor: memoryRuntimeMaxBytesResolver({ pluginRoot: join(packageRoot, "plugin") }),
|
|
243
|
+
discardFor: memoryRuntimeDiscardResolver({ pluginRoot: join(packageRoot, "plugin") }),
|
|
244
|
+
}).then((report) => report.lines, (error) => [`WARN memory runtime: unavailable: ${error instanceof Error ? error.message : String(error)}`]),
|
|
228
245
|
])
|
|
229
246
|
runDoctor(await detectHarnesses(), args.slice(1), {
|
|
230
247
|
daemonEngine: { run: engineHostCall },
|
|
@@ -232,6 +249,7 @@ export async function runLauncher(args = process.argv.slice(2)) {
|
|
|
232
249
|
computerUse,
|
|
233
250
|
configDiagnostics,
|
|
234
251
|
reflectionLock,
|
|
252
|
+
memoryRuntime,
|
|
235
253
|
})
|
|
236
254
|
return
|
|
237
255
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "Derived from @code-yeongyu/senpi 2026.11.
|
|
2
|
+
"_comment": "Derived from @code-yeongyu/senpi 2026.11.9-2 builtinProviders(). builtinProviderIds and oauthProviderIds are the engine registry verbatim; providers maps a source harness id onto the omo provider that serves the same endpoint; oauthLogins maps a source OAuth id onto the omo provider to run /login for. Re-derive all four whenever the senpi pin changes.",
|
|
3
3
|
"builtinProviderIds": [
|
|
4
4
|
"alibaba-token-plan",
|
|
5
5
|
"amazon-bedrock",
|