omo-ai 5.1.43 → 5.1.45
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/lib/bun-bin-shim.js +53 -72
- package/bin/lib/doctor.js +2 -2
- package/bin/lib/dori.js +187 -0
- package/bin/lib/launcher.js +7 -6
- package/bin/lib/provider-map.json +1 -1
- package/bin/lib/service-auth.generated.js +4 -4
- package/bin/omo.js +3 -4
- package/bin/senpi-patch.mjs +3 -4
- package/package.json +2 -2
- package/plugin/CHANGELOG.md +159 -7
- package/plugin/extensions/dream-persona.md +1 -1
- package/plugin/extensions/gateway-rules-extension.mjs +1 -1
- package/plugin/extensions/gateway-store-worker.mjs +2 -2
- package/plugin/extensions/memory-run-supervisor.mjs +1 -1
- package/plugin/extensions/omo-claim-receipt.js +2 -2
- package/plugin/extensions/omo-computer-use.js +2 -2
- package/plugin/extensions/omo-device-account.js +2 -0
- package/plugin/extensions/omo-dori-migration.js +2 -0
- package/plugin/extensions/omo-feedback.js +2 -2
- package/plugin/extensions/omo-init-deep-advisor.js +2 -2
- package/plugin/extensions/omo-member.js +2 -2
- package/plugin/extensions/omo-memory-commands.js +11 -0
- package/plugin/extensions/omo-memory-doctor.js +3 -3
- package/plugin/extensions/omo-memory-memfs.js +3 -3
- package/plugin/extensions/omo-memory-palace.js +3 -3
- package/plugin/extensions/omo-memory-sync.js +2 -2
- 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 +2 -2
- package/plugin/extensions/omo-side-panel.js +3 -3
- package/plugin/extensions/omo-task.js +2 -2
- package/plugin/extensions/omo-telemetry-posthog.js +2 -2
- package/plugin/extensions/omo-telemetry-recovery.js +2 -0
- package/plugin/extensions/omo-thread-client.js +2 -2
- package/plugin/extensions/omo.js +3 -3
- package/plugin/extensions/reflection-persona.md +1 -1
- package/plugin/package.json +9 -2
- package/plugin/runtime/agent-toolkit-sdk/sdk.js +2 -2
- package/plugin/runtime/ast-grep-mcp/cli.js +6 -6
- package/plugin/runtime/ast-grep-mcp/manifest.json +2 -2
- package/plugin/runtime/category-coverage/index.js +39 -75
- package/plugin/runtime/dori/layer2.js +2 -0
- package/plugin/runtime/dori/replay.js +2 -0
- package/plugin/runtime/lsp-daemon/dist/.omo-runtime-manifest.json +4 -4
- package/plugin/runtime/lsp-daemon/dist/cli.js +4 -4
- package/plugin/runtime/lsp-daemon/dist/client.js +4 -4
- package/plugin/runtime/lsp-daemon/dist/index.js +4 -4
- package/plugin/runtime/rollback-migrate.js +2 -2
- package/plugin/runtime/task-config/index.js +1 -1
- package/plugin/runtime/thread-sdk/sdk.js +2 -2
- package/plugin/scripts/install.mjs +5 -2
- package/plugin/skills/browser/SKILL.md +21 -22
- package/plugin/skills/browser/references/commands.md +2 -9
- package/plugin/skills/browser/references/install.md +1 -2
- package/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
- package/plugin/skills/browser/scripts/browser-doctor.mjs +2 -2
- package/plugin/skills/browser/scripts/browser-engine-guard.mjs +63 -487
- package/plugin/skills/browser/scripts/browser-install.mjs +1 -1
- package/plugin/skills/browser/scripts/omowright.mjs +1 -10
- package/plugin/skills/frontend/SKILL.md +79 -118
- package/plugin/skills/frontend/references/design/README.md +75 -221
- package/plugin/skills/frontend/references/design/stylegallery.md +32 -27
- package/plugin/skills/frontend/references/perfection/README.md +2 -2
- package/plugin/skills/frontend/scripts/perfection/check-accent-stripes.ts +8 -24
- package/plugin/skills/frontend/scripts/perfection/check-draft-guard.ts +40 -0
- package/plugin/skills/frontend/scripts/perfection/collect-files.ts +53 -0
- package/plugin/skills/frontend/scripts/perfection/draft-guard/findings.ts +16 -0
- package/plugin/skills/frontend/scripts/perfection/draft-guard/lint.ts +38 -0
- package/plugin/skills/frontend/scripts/perfection/draft-guard/rules.ts +69 -0
- package/plugin/skills/frontend/scripts/perfection/draft-guard/text-nodes.ts +121 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/negative/attr-lookalikes.tsx +10 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/negative/bound-values.tsx +12 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/negative/const-generics.tsx +3 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/negative/generics.tsx +7 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/negative/measured-stats.html +6 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/negative/plain-copy.html +9 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/negative/state-copy.html +11 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/positive/attribute-edges.html +7 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/positive/components.tsx +16 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/positive/decorative-badge.vue +7 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/positive/emoji-icons.tsx +9 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/positive/jsx-edges.tsx +1 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/positive/promo-copy.html +6 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/positive/promo-copy.tsx +8 -0
- package/plugin/skills/frontend/scripts/perfection/fixtures/draft-guard/positive/vanity-stats.html +5 -0
- package/plugin/skills/programming/SKILL.md +10 -7
- package/plugin/skills/programming/references/typescript/README.md +10 -7
- package/plugin/skills/programming/references/typescript/bootstrap.md +9 -23
- package/plugin/skills/programming/references/typescript/oxc-lint.md +130 -0
- package/plugin/skills/programming/references/typescript/tsconfig-strict.md +6 -62
- package/plugin/skills/programming/scripts/typescript/check-no-excuse-rules.ts +12 -12
- package/plugin/skills/programming/scripts/typescript/new-project.ts +20 -81
- package/plugin/skills/programming/scripts/typescript/oxc/.oxfmtrc.json +9 -0
- package/plugin/skills/programming/scripts/typescript/oxc/.oxlintrc.json +46 -0
- package/plugin/skills/programming/scripts/typescript/oxc/lint/oxlint-plugin/LICENSE +21 -0
- package/plugin/skills/programming/scripts/typescript/oxc/lint/oxlint-plugin/index.js +10 -0
- package/plugin/skills/programming/scripts/typescript/oxc/lint/oxlint-plugin/no-em-dash-copy.js +28 -0
- package/plugin/skills/programming/scripts/typescript/oxc/lint/oxlint-plugin/require-suppression-reason.js +62 -0
- package/plugin/skills/programming/scripts/typescript/oxc/tsconfig.json +29 -0
- package/plugin/skills/refactor/SKILL.md +13 -13
- package/plugin/skills/ulw-execute/SKILL.md +1 -1
- package/plugin/skills/ulw-research/SKILL.md +1 -1
- package/plugin/skills/ulw-research/references/deliverable-phase.md +7 -6
- package/plugin/skills/ulw-research/references/fact-ledger-grammar.md +116 -0
- package/plugin/skills/ulw-research/references/report-gates.md +51 -3
- package/plugin/skills/ulw-research/scripts/claims-index.mjs +125 -0
- package/plugin/skills/ulw-research/scripts/contracts.mjs +68 -3
- package/plugin/skills/ulw-research/scripts/fact-ledger-kinds.mjs +136 -0
- package/plugin/skills/ulw-research/scripts/fact-ledger-schema.mjs +204 -0
- package/plugin/skills/ulw-research/scripts/fact-ledger.mjs +103 -0
- package/plugin/skills/ulw-research/scripts/fidelity-brief.mjs +145 -0
- package/plugin/skills/ulw-research/scripts/fidelity-state.mjs +63 -0
- package/plugin/skills/ulw-research/scripts/gates-static.mjs +1 -1
- package/plugin/skills/ulw-research/scripts/gates-structure.mjs +1 -1
- package/plugin/skills/ulw-research/scripts/gates-text.mjs +1 -27
- package/plugin/skills/ulw-research/scripts/lexicon.mjs +47 -0
- package/plugin/skills/ulw-research/scripts/numerals.mjs +226 -0
- package/plugin/skills/ulw-research/scripts/outcome.mjs +2 -3
- package/plugin/skills/ulw-research/scripts/particles-ko.mjs +108 -0
- package/plugin/skills/ulw-research/scripts/rational.mjs +139 -0
- package/plugin/skills/ulw-research/scripts/report-tools-commands.mjs +2 -2
- package/plugin/skills/ulw-research/scripts/sentence-split.mjs +77 -0
- package/plugin/skills/ulw-research/scripts/text-normalize.mjs +82 -0
- package/plugin/skills/ulw-research/scripts/text-similarity.mjs +28 -0
- package/plugin/skills/ulw-research/scripts/units.mjs +105 -0
- package/plugin/skills/visual-qa/SKILL.md +70 -63
- package/plugin/skills/visualize/SKILL.md +1 -1
- package/plugin/telemetry-schema.json +3857 -0
- package/plugin/telemetry-schema.omo-cloud.json +3850 -0
- package/bin/lib/gateway.js +0 -166
package/bin/lib/bun-bin-shim.js
CHANGED
|
@@ -1,53 +1,38 @@
|
|
|
1
|
-
import { chmodSync, lstatSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs"
|
|
1
|
+
import { chmodSync, lstatSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync } from "node:fs"
|
|
2
2
|
import { homedir as osHomedir } from "node:os"
|
|
3
|
-
import { join } from "node:path"
|
|
3
|
+
import { dirname, join, relative } from "node:path"
|
|
4
4
|
import { bunRoot, findBunBinary, isUnderBunGlobalTree } from "./bun-runtime.js"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
const
|
|
6
|
+
const NODE_SHEBANG = "#!/usr/bin/env node\n"
|
|
7
|
+
// sh executes the second line; JS sees a string expression followed by a comment. No install
|
|
8
|
+
// paths are interpolated into code, so spaces, quotes and newlines in BUN_INSTALL stay data.
|
|
9
|
+
const BUN_PRELUDE = [
|
|
10
|
+
"#!/bin/sh",
|
|
11
|
+
`':' //; if [ "$OMO_RUNTIME" != node ]; then for b in "\${BUN_INSTALL:-$HOME/.bun}/bin/bun" "$HOME/.bun/bin/bun"; do if [ -x "$b" ]; then exec "$b" "$0" "$@"; fi; done; if command -v bun >/dev/null 2>&1; then exec bun "$0" "$@"; fi; fi; exec node "$0" "$@"`,
|
|
12
|
+
"",
|
|
13
|
+
].join("\n")
|
|
10
14
|
|
|
11
|
-
// The two bins a POSIX bun-global install exposes for the same launcher. `bun add -g` links the
|
|
12
|
-
// package bin into BOTH, and a bun layout that puts the global node_modules/.bin on PATH first
|
|
13
|
-
// makes the second one the entry a typed `omo` actually reaches - so repairing only the first
|
|
14
|
-
// leaves those machines paying for a node boot on every launch. Each entry is judged on its own.
|
|
15
15
|
const BIN_ENTRIES = [
|
|
16
16
|
{ label: "bin", segments: ["bin", "omo"] },
|
|
17
17
|
{ label: "node-modules-bin", segments: ["install", "global", "node_modules", ".bin", "omo"] },
|
|
18
18
|
]
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return [
|
|
34
|
-
"#!/bin/sh",
|
|
35
|
-
`# ${SHIM_MARKER} v${SHIM_VERSION} - generated by omo-ai; safe to delete, the next launch recreates it`,
|
|
36
|
-
`# entry: ${entryPath}`,
|
|
37
|
-
`if [ "$OMO_RUNTIME" != "node" ] && [ -x ${quoteForShell(bunPath)} ]; then exec ${quoteForShell(bunPath)} ${quoteForShell(entryPath)} "$@"; fi`,
|
|
38
|
-
`exec ${quoteForShell(entryPath)} "$@"`,
|
|
39
|
-
"",
|
|
40
|
-
].join("\n")
|
|
20
|
+
/** Prepare only the package-owned file. Bun's bin symlinks must never become regular files. */
|
|
21
|
+
function prepareEntrypoint(io) {
|
|
22
|
+
const source = io.readFile(io.scriptPath, "utf8")
|
|
23
|
+
if (source.startsWith(BUN_PRELUDE)) return
|
|
24
|
+
if (!source.startsWith(NODE_SHEBANG)) throw new Error("unrecognized omo entrypoint")
|
|
25
|
+
const temporary = `${io.scriptPath}.${io.pid}.tmp`
|
|
26
|
+
try {
|
|
27
|
+
io.write(temporary, BUN_PRELUDE + source.slice(NODE_SHEBANG.length), { mode: 0o755 })
|
|
28
|
+
io.chmod(temporary, 0o755)
|
|
29
|
+
io.rename(temporary, io.scriptPath)
|
|
30
|
+
} finally {
|
|
31
|
+
io.remove(temporary, { force: true })
|
|
32
|
+
}
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
* Brings ONE bin entry to the shim, or explains why it was left as it was. Only bun's own link to
|
|
45
|
-
* THIS install, or a file already carrying the marker, is ever replaced; anything else - a link
|
|
46
|
-
* into another install, a hand-written file, a directory, a socket - is not ours to touch.
|
|
47
|
-
* Returns the labelled action; the caller owns the try/catch, so a broken entry cannot take the
|
|
48
|
-
* other one down with it.
|
|
49
|
-
*/
|
|
50
|
-
function applyShim(binPath, script, io) {
|
|
35
|
+
function restoreLegacyBin(binPath, io) {
|
|
51
36
|
let stats
|
|
52
37
|
try {
|
|
53
38
|
stats = io.lstat(binPath)
|
|
@@ -55,47 +40,36 @@ function applyShim(binPath, script, io) {
|
|
|
55
40
|
return "absent-bin"
|
|
56
41
|
}
|
|
57
42
|
if (stats.isSymbolicLink()) {
|
|
58
|
-
|
|
59
|
-
} else if (stats.isFile()) {
|
|
60
|
-
const current = io.readFile(binPath, "utf8")
|
|
61
|
-
if (current === script) return "current"
|
|
62
|
-
if (!current.includes(SHIM_MARKER)) return "foreign-file"
|
|
63
|
-
} else {
|
|
64
|
-
return "foreign-entry"
|
|
43
|
+
return io.realpath(binPath) === io.scriptPath ? "current" : "foreign-link"
|
|
65
44
|
}
|
|
66
|
-
|
|
45
|
+
if (!stats.isFile()) return "foreign-entry"
|
|
46
|
+
const source = io.readFile(binPath, "utf8")
|
|
47
|
+
const legacy = /^#!\/bin\/sh\n# omo-ai bun launcher shim v\d+[^\n]*\n/.exec(source)
|
|
48
|
+
if (!legacy || !source.slice(legacy[0].length).startsWith(`# entry: ${io.scriptPath}\n`)) return "foreign-file"
|
|
67
49
|
const temporary = `${binPath}.${io.pid}.tmp`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
try {
|
|
51
|
+
io.symlink(relative(io.realpath(dirname(binPath)), io.scriptPath), temporary)
|
|
52
|
+
io.rename(temporary, binPath)
|
|
53
|
+
} finally {
|
|
54
|
+
io.remove(temporary, { force: true })
|
|
55
|
+
}
|
|
72
56
|
return "repaired"
|
|
73
57
|
}
|
|
74
58
|
|
|
75
|
-
function repairBinEntry(entry, root,
|
|
59
|
+
function repairBinEntry(entry, root, io) {
|
|
76
60
|
const path = join(root, ...entry.segments)
|
|
77
61
|
try {
|
|
78
|
-
return { label: entry.label, path, action:
|
|
62
|
+
return { label: entry.label, path, action: restoreLegacyBin(path, io), error: undefined }
|
|
79
63
|
} catch (error) {
|
|
80
|
-
if (io.env.OMO_DEBUG) io.warn(`omo: bun launcher
|
|
64
|
+
if (io.env.OMO_DEBUG) io.warn(`omo: bun launcher migration left untouched at ${path}: ${error.message}`)
|
|
81
65
|
return { label: entry.label, path, action: "failed", error: error.message }
|
|
82
66
|
}
|
|
83
67
|
}
|
|
84
68
|
|
|
85
69
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* launch: every failure path - foreign file, missing bin, unwritable bin dir - returns quietly,
|
|
90
|
-
* one entry's failure never stops the other from being repaired, and only OMO_DEBUG narrates.
|
|
91
|
-
* It runs under bun as well as node: `bun add -g` links the bin back to the node-shebang entrypoint
|
|
92
|
-
* and then runs omo-ai's postinstall (`bin/senpi-patch.mjs`) under bun whenever node is not on
|
|
93
|
-
* PATH, and that postinstall is the only code that runs before the next `omo`. A node-only repair
|
|
94
|
-
* left a bun-only machine (a launchd job, cron, node only through nvm) with an `omo` that cannot
|
|
95
|
-
* start until something boots it under node (#9293).
|
|
96
|
-
*
|
|
97
|
-
* The answer is per entry (`entries`), with the primary `<bunRoot>/bin/omo` entry's action and
|
|
98
|
-
* error mirrored at the top level for callers that only ever cared about that one.
|
|
70
|
+
* Trusted postinstall prepares Bun-only startup (#9293); launches also repair older installs.
|
|
71
|
+
* Prepare the entrypoint before replacing old marked wrappers, so a failed preparation leaves
|
|
72
|
+
* their working Bun launch path intact. Windows/npm retain their shipped Node entrypoint.
|
|
99
73
|
*/
|
|
100
74
|
export function ensureBunBinShim(input) {
|
|
101
75
|
const env = input.env ?? process.env
|
|
@@ -110,6 +84,8 @@ export function ensureBunBinShim(input) {
|
|
|
110
84
|
write: input.write ?? writeFileSync,
|
|
111
85
|
rename: input.rename ?? renameSync,
|
|
112
86
|
chmod: input.chmod ?? chmodSync,
|
|
87
|
+
symlink: input.symlink ?? symlinkSync,
|
|
88
|
+
remove: input.remove ?? rmSync,
|
|
113
89
|
pid: input.pid ?? process.pid,
|
|
114
90
|
warn: input.warn ?? ((message) => console.error(message)),
|
|
115
91
|
}
|
|
@@ -118,12 +94,17 @@ export function ensureBunBinShim(input) {
|
|
|
118
94
|
if (!isUnderBunGlobalTree(input.scriptPath, { env, homedir, platform, realpath: io.realpath })) {
|
|
119
95
|
return { action: "skipped-install", error: undefined, entries: [] }
|
|
120
96
|
}
|
|
121
|
-
|
|
122
|
-
|
|
97
|
+
if (!findBunBinary({ env, homedir, platform, exists: input.exists, realpath: io.realpath })) {
|
|
98
|
+
return { action: "skipped-no-bun", error: undefined, entries: [] }
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
prepareEntrypoint(io)
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (env.OMO_DEBUG) io.warn(`omo: bun entrypoint left untouched at ${io.scriptPath}: ${error.message}`)
|
|
104
|
+
return { action: "failed", error: error.message, entries: [] }
|
|
105
|
+
}
|
|
123
106
|
|
|
124
|
-
const
|
|
125
|
-
const script = bunBinShimScript(input.scriptPath, bunPath)
|
|
126
|
-
const entries = BIN_ENTRIES.map((entry) => repairBinEntry(entry, root, script, io))
|
|
107
|
+
const entries = BIN_ENTRIES.map((entry) => repairBinEntry(entry, bunRoot(env, homedir, platform), io))
|
|
127
108
|
const primary = entries[0]
|
|
128
109
|
return { action: primary.action, error: primary.error, entries }
|
|
129
110
|
}
|
package/bin/lib/doctor.js
CHANGED
|
@@ -426,9 +426,9 @@ export function runDoctor(inventory, args = [], options = {}) {
|
|
|
426
426
|
const launchSpec = launchSpecDoctorLines(options.pluginRoot ?? join(packageRoot, "plugin"), options.launchSpecIo)
|
|
427
427
|
if (launchSpec.some((line) => line.startsWith("FAIL "))) failed = true
|
|
428
428
|
lines.push(...launchSpec)
|
|
429
|
-
lines.push(...daemonReport(options), ...(options.computerUse ?? []), ...(options.categoryCoverage ?? []), ...(options.
|
|
429
|
+
lines.push(...daemonReport(options), ...(options.computerUse ?? []), ...(options.categoryCoverage ?? []), ...(options.dori ?? []))
|
|
430
430
|
if ((options.computerUse ?? []).some((line) => line.startsWith("FAIL "))) failed = true
|
|
431
|
-
if ((options.
|
|
431
|
+
if ((options.dori ?? []).some((line) => line.startsWith("FAIL "))) failed = true
|
|
432
432
|
if (needsSetupSuggestion(inventory)) {
|
|
433
433
|
lines.push("INFO no credentials found; run omo setup to review sibling stores")
|
|
434
434
|
}
|
package/bin/lib/dori.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs"
|
|
2
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path"
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url"
|
|
4
|
+
import { canonicalAgentDir, runtimeHome } from "./agent-dir.js"
|
|
5
|
+
import { parseJsonc } from "./jsonc.js"
|
|
6
|
+
import { packageRoot } from "./package-paths.js"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* omo ships no dori code. `omo dori` and the `omo doctor` dori rows import a separately
|
|
10
|
+
* installed package's host entry by name from omo's own install, lazily: only for `omo dori`, or
|
|
11
|
+
* for doctor when the user config has a `dori` section. Without one, doctor output is unchanged.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const DORI_PACKAGE = "dori-extension"
|
|
15
|
+
export const DORI_HOST_ENTRY = `${DORI_PACKAGE}/host`
|
|
16
|
+
export const DORI_HOST_CONTRACT_VERSION = 1
|
|
17
|
+
export const DORI_NOT_INSTALLED = `${DORI_PACKAGE} is not installed: install the ${DORI_PACKAGE} package where omo is installed (for a global omo, \`bun add -g <package>\`), then run \`omo doctor\``
|
|
18
|
+
|
|
19
|
+
// Where the dori finds omo's plugin payload and the thread SDK in it. The SDK file ships with the thread
|
|
20
|
+
// SDK itself; the URL is handed over either way and nothing here checks that the file exists.
|
|
21
|
+
const PLUGIN_ROOT = join(packageRoot, "plugin")
|
|
22
|
+
const PLUGIN_PATHS = {
|
|
23
|
+
pluginRoot: PLUGIN_ROOT,
|
|
24
|
+
threadSdkUrl: pathToFileURL(join(PLUGIN_ROOT, "runtime", "thread-sdk", "sdk.js")).href,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const DORI_KEY = "dori"
|
|
28
|
+
const NATIVE_BLOCK_KEYS = ["[native]", "[senpi]"]
|
|
29
|
+
|
|
30
|
+
export async function loadDoriHost(importHost) {
|
|
31
|
+
let load = importHost
|
|
32
|
+
if (load === undefined) {
|
|
33
|
+
const verified = verifyDoriPackage()
|
|
34
|
+
if (verified.status !== "verified") return verified
|
|
35
|
+
load = () => import(verified.entryUrl)
|
|
36
|
+
}
|
|
37
|
+
let host
|
|
38
|
+
try {
|
|
39
|
+
host = await load()
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (isMissingPackage(error)) return { status: "missing" }
|
|
42
|
+
return { status: "broken", reason: `cannot load ${DORI_HOST_ENTRY}: ${error instanceof Error ? error.message : String(error)}` }
|
|
43
|
+
}
|
|
44
|
+
if (host?.HOST_CONTRACT_VERSION !== DORI_HOST_CONTRACT_VERSION) {
|
|
45
|
+
return {
|
|
46
|
+
status: "broken",
|
|
47
|
+
reason: `the installed ${DORI_PACKAGE} speaks host contract ${String(host?.HOST_CONTRACT_VERSION)}, this omo speaks ${DORI_HOST_CONTRACT_VERSION}: ${contractRemedy(host?.HOST_CONTRACT_VERSION)}`,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { status: "installed", host }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Whichever side is older is the one to upgrade; an unreadable version names both.
|
|
54
|
+
function contractRemedy(found) {
|
|
55
|
+
const older = typeof found !== "number" ? `${DORI_PACKAGE} or omo` : found > DORI_HOST_CONTRACT_VERSION ? "omo" : DORI_PACKAGE
|
|
56
|
+
return `upgrade ${older} so both speak the same host contract`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// The node_modules directories above omo's own install, nearest first. Node's global folders
|
|
60
|
+
// (~/.node_modules, NODE_PATH) are left out: ESM resolution from omo never reaches them.
|
|
61
|
+
function doriSearchPaths() {
|
|
62
|
+
const paths = []
|
|
63
|
+
for (let dir = dirname(fileURLToPath(import.meta.url)); ; dir = dirname(dir)) {
|
|
64
|
+
if (basename(dir) !== "node_modules") paths.push(join(dir, "node_modules"))
|
|
65
|
+
if (dirname(dir) === dir) return paths
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// The `./host` target of the package's own manifest: a string, or the `import`/`default` condition.
|
|
70
|
+
function hostExportTarget(manifest) {
|
|
71
|
+
let target = isRecord(manifest.exports) ? manifest.exports["./host"] : undefined
|
|
72
|
+
while (isRecord(target)) target = target.import ?? target.default
|
|
73
|
+
return typeof target === "string" ? target : undefined
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Before anything of the package runs: the nearest installed package above omo's own install must
|
|
78
|
+
* be the one this omo expects, declare the host contract in its manifest, and export a host entry
|
|
79
|
+
* that stays inside its own directory once symlinks are resolved on both sides. The entry comes
|
|
80
|
+
* from that same directory's manifest, so the checked package and the loaded file are one copy.
|
|
81
|
+
*/
|
|
82
|
+
export function verifyDoriPackage() {
|
|
83
|
+
const root = doriSearchPaths().map((path) => join(path, DORI_PACKAGE)).find((dir) => existsSync(dir))
|
|
84
|
+
if (root === undefined) return { status: "missing" }
|
|
85
|
+
const refuse = (why) => ({ status: "broken", reason: `refusing the installed dori at ${root}: ${why}` })
|
|
86
|
+
let manifest
|
|
87
|
+
try {
|
|
88
|
+
manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"))
|
|
89
|
+
} catch (error) {
|
|
90
|
+
return refuse(`cannot read its package.json: ${error instanceof Error ? error.message : String(error)}`)
|
|
91
|
+
}
|
|
92
|
+
if (!isRecord(manifest)) return refuse("its package.json is not an object")
|
|
93
|
+
if (manifest.name !== DORI_PACKAGE) return refuse(`its package.json names ${JSON.stringify(manifest.name)}, not "${DORI_PACKAGE}"`)
|
|
94
|
+
const declared = isRecord(manifest.doriExtension) ? manifest.doriExtension.hostContract : undefined
|
|
95
|
+
if (declared === undefined) return refuse("its package.json does not declare doriExtension.hostContract")
|
|
96
|
+
if (declared !== DORI_HOST_CONTRACT_VERSION) {
|
|
97
|
+
return refuse(`its package.json declares host contract ${JSON.stringify(declared)}, this omo speaks ${DORI_HOST_CONTRACT_VERSION}: ${contractRemedy(declared)}`)
|
|
98
|
+
}
|
|
99
|
+
const target = hostExportTarget(manifest)
|
|
100
|
+
if (target === undefined) return refuse('its package.json does not export "./host"')
|
|
101
|
+
let entry
|
|
102
|
+
let realRoot
|
|
103
|
+
try {
|
|
104
|
+
entry = realpathSync.native(resolve(root, target))
|
|
105
|
+
realRoot = realpathSync.native(root)
|
|
106
|
+
} catch (error) {
|
|
107
|
+
return { status: "broken", reason: `cannot load ${DORI_HOST_ENTRY}: ${error instanceof Error ? error.message : String(error)}` }
|
|
108
|
+
}
|
|
109
|
+
const inside = relative(realRoot, entry)
|
|
110
|
+
if (inside === "" || inside === ".." || inside.startsWith(`..${sep}`) || isAbsolute(inside)) return refuse(`its host entry resolves to ${entry}, outside the package`)
|
|
111
|
+
return { status: "verified", entryUrl: pathToFileURL(entry).href }
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// A missing module inside an installed package is broken, not missing.
|
|
115
|
+
function isMissingPackage(error) {
|
|
116
|
+
if (!(error instanceof Error)) return false
|
|
117
|
+
const code = "code" in error ? error.code : undefined
|
|
118
|
+
if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND") return false
|
|
119
|
+
if (!error.message.includes(`'${DORI_PACKAGE}`) && !error.message.includes(`"${DORI_PACKAGE}`)) return false
|
|
120
|
+
// Bun also names the package when its exported host file is absent. Check the
|
|
121
|
+
// package directory without resolving an entry that exports may hide or break.
|
|
122
|
+
return !doriSearchPaths().some((path) => existsSync(join(path, DORI_PACKAGE)))
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** `omo dori <args>`: the installed package runs it; without the package, one stderr line and exit 1. */
|
|
126
|
+
export async function runDoriCommand(args, options = {}) {
|
|
127
|
+
const { stdout = process.stdout, stderr = process.stderr, env = process.env, cwd = process.cwd() } = options
|
|
128
|
+
const loaded = await loadDoriHost(options.importHost)
|
|
129
|
+
if (loaded.status === "missing") {
|
|
130
|
+
stderr.write(`omo dori: ${DORI_NOT_INSTALLED}\n`)
|
|
131
|
+
return 1
|
|
132
|
+
}
|
|
133
|
+
if (loaded.status === "broken") {
|
|
134
|
+
stderr.write(`omo dori: ${loaded.reason}\n`)
|
|
135
|
+
return 1
|
|
136
|
+
}
|
|
137
|
+
return loaded.host.runGatewayCommand(args, {
|
|
138
|
+
stdout,
|
|
139
|
+
stderr,
|
|
140
|
+
env,
|
|
141
|
+
cwd,
|
|
142
|
+
agentDir: canonicalAgentDir(env),
|
|
143
|
+
home: runtimeHome(env),
|
|
144
|
+
...PLUGIN_PATHS,
|
|
145
|
+
launch: options.launch ?? [process.execPath, process.argv[1], "dori", "connect"],
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function userConfigPath(env) {
|
|
150
|
+
const dir = join(runtimeHome(env), ".omo")
|
|
151
|
+
const jsonc = join(dir, "omo.jsonc")
|
|
152
|
+
if (existsSync(jsonc)) return jsonc
|
|
153
|
+
const json = join(dir, "omo.json")
|
|
154
|
+
return existsSync(json) ? json : null
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function isRecord(value) {
|
|
158
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function hasDoriSection(env = process.env) {
|
|
162
|
+
const path = userConfigPath(env)
|
|
163
|
+
if (path === null) return false
|
|
164
|
+
let document
|
|
165
|
+
try {
|
|
166
|
+
document = parseJsonc(readFileSync(path, "utf8"))
|
|
167
|
+
} catch {
|
|
168
|
+
return false
|
|
169
|
+
}
|
|
170
|
+
if (!isRecord(document)) return false
|
|
171
|
+
if (Object.hasOwn(document, DORI_KEY)) return true
|
|
172
|
+
return NATIVE_BLOCK_KEYS.some((key) => isRecord(document[key]) && Object.hasOwn(document[key], DORI_KEY))
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** No `dori` section: no rows. Otherwise one installed/not-installed row; an installed package adds its own rows. */
|
|
176
|
+
export async function doriDoctorLines(options = {}) {
|
|
177
|
+
const { env = process.env, cwd = process.cwd() } = options
|
|
178
|
+
if (!hasDoriSection(env)) return []
|
|
179
|
+
const loaded = await loadDoriHost(options.importHost)
|
|
180
|
+
if (loaded.status === "missing") return [`WARN dori: ${DORI_NOT_INSTALLED}`]
|
|
181
|
+
if (loaded.status === "broken") return [`FAIL dori: ${loaded.reason}`]
|
|
182
|
+
try {
|
|
183
|
+
return ["PASS dori: installed", ...(await loaded.host.gatewayDoctorLines({ env, cwd, ...PLUGIN_PATHS }))]
|
|
184
|
+
} catch (error) {
|
|
185
|
+
return ["PASS dori: installed", `WARN dori: the dori's doctor rows failed: ${error instanceof Error ? error.message : String(error)}`]
|
|
186
|
+
}
|
|
187
|
+
}
|
package/bin/lib/launcher.js
CHANGED
|
@@ -184,26 +184,27 @@ export async function runLauncher(args = process.argv.slice(2)) {
|
|
|
184
184
|
process.exitCode = await runDoctorModels(args.slice(2), { agentDir: canonicalAgentDir() })
|
|
185
185
|
return
|
|
186
186
|
}
|
|
187
|
-
const [categoryCoverage, computerUse, configDiagnostics,
|
|
187
|
+
const [categoryCoverage, computerUse, configDiagnostics, dori] = args[1] === "--reap"
|
|
188
188
|
? [[], [], [], []]
|
|
189
189
|
: await Promise.all([
|
|
190
190
|
doctorCoverageLines({ agentDir: canonicalAgentDir() }),
|
|
191
191
|
doctorComputerUseLines(),
|
|
192
192
|
doctorConfigLines(),
|
|
193
|
-
import("./
|
|
193
|
+
import("./dori.js").then((hook) => hook.doriDoctorLines()),
|
|
194
194
|
])
|
|
195
195
|
runDoctor(await detectHarnesses(), args.slice(1), {
|
|
196
196
|
daemonEngine: { run: engineHostCall },
|
|
197
197
|
categoryCoverage,
|
|
198
198
|
computerUse,
|
|
199
199
|
configDiagnostics,
|
|
200
|
-
|
|
200
|
+
dori,
|
|
201
201
|
})
|
|
202
202
|
return
|
|
203
203
|
}
|
|
204
|
-
if (command === "gateway") {
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
if (command === "dori" || command === "gateway") {
|
|
205
|
+
if (command === "gateway") process.stderr.write("omo gateway is deprecated; use omo dori instead\n")
|
|
206
|
+
const { runDoriCommand } = await import("./dori.js")
|
|
207
|
+
process.exitCode = await runDoriCommand(args.slice(1))
|
|
207
208
|
return
|
|
208
209
|
}
|
|
209
210
|
if (command === "setup") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "Derived from @code-yeongyu/senpi 2026.10.
|
|
2
|
+
"_comment": "Derived from @code-yeongyu/senpi 2026.10.23-1 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",
|