oh-my-opencode 5.0.0-beta.81 → 5.0.0-beta.83
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/README.ja.md +2 -2
- package/README.ko.md +2 -2
- package/README.md +4 -4
- package/README.ru.md +2 -2
- package/README.zh-cn.md +2 -2
- package/dist/cli/index.js +439 -98
- package/dist/cli/install-native/index.d.ts +4 -0
- package/dist/cli/install-native/plan.d.ts +11 -0
- package/dist/cli/install-native/run-native-install.d.ts +23 -0
- package/dist/cli/install-native-dev/index.d.ts +4 -0
- package/dist/cli/native-dev-platform-flag.d.ts +5 -0
- package/dist/cli/native-edition-hint.d.ts +10 -0
- package/dist/cli/types.d.ts +3 -2
- package/dist/cli-node/index.js +439 -98
- package/dist/config/schema/hooks.d.ts +1 -0
- package/dist/config-migration/harness-native-rename.d.ts +3 -0
- package/dist/create-hooks.d.ts +1 -0
- package/dist/features/native-edition-nudge/index.d.ts +2 -0
- package/dist/features/native-edition-nudge/tui.d.ts +33 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/native-edition-nudge/decide.d.ts +4 -0
- package/dist/hooks/native-edition-nudge/hook.d.ts +26 -0
- package/dist/hooks/native-edition-nudge/index.d.ts +5 -0
- package/dist/hooks/native-edition-nudge/state.d.ts +9 -0
- package/dist/hooks/native-edition-nudge/types.d.ts +38 -0
- package/dist/index.js +753 -352
- package/dist/plugin/hooks/create-core-hooks.d.ts +1 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
- package/dist/skills/browser/ATTRIBUTION.md +25 -0
- package/dist/skills/browser/SKILL.md +89 -0
- package/dist/skills/browser/references/commands.md +90 -0
- package/dist/skills/browser/references/install.md +71 -0
- package/dist/skills/browser/references/owned-engine/README.md +42 -0
- package/dist/skills/browser/references/owned-engine/frames-and-humans.md +39 -0
- package/dist/skills/browser/references/owned-engine/ladder.md +59 -0
- package/dist/skills/browser/references/owned-engine/network.md +42 -0
- package/dist/skills/browser/references/recipes/1password.md +59 -0
- package/dist/skills/browser/references/remote.md +24 -0
- package/dist/skills/browser/scripts/browser-doctor.mjs +41 -0
- package/dist/skills/browser/scripts/browser-env.mjs +41 -0
- package/dist/skills/browser/scripts/browser-install.mjs +51 -0
- package/dist/tui.js +545 -67
- package/package.json +17 -15
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +111 -11
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +24 -10
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.js +8 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.js +21 -4
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-guard.ts +10 -5
- package/packages/omo-codex/plugin/components/ulw-loop/src/surface.ts +24 -6
- package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-guard-native-reviewer.test.ts +207 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-guard.test.ts +6 -4
- package/packages/omo-codex/plugin/components/ulw-loop/test/surface.test.ts +43 -4
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/browser/ATTRIBUTION.md +25 -0
- package/packages/omo-codex/plugin/skills/browser/SKILL.md +89 -0
- package/packages/omo-codex/plugin/skills/browser/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/browser/references/commands.md +90 -0
- package/packages/omo-codex/plugin/skills/browser/references/install.md +71 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +42 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +39 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/ladder.md +59 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +42 -0
- package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +59 -0
- package/packages/omo-codex/plugin/skills/browser/references/remote.md +24 -0
- package/packages/omo-codex/plugin/skills/browser/scripts/browser-doctor.mjs +41 -0
- package/packages/omo-codex/plugin/skills/browser/scripts/browser-env.mjs +41 -0
- package/packages/omo-codex/plugin/skills/browser/scripts/browser-install.mjs +51 -0
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +1 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +117 -17
- package/packages/shared-skills/skills/browser/ATTRIBUTION.md +25 -0
- package/packages/shared-skills/skills/browser/SKILL.md +89 -0
- package/packages/shared-skills/skills/browser/references/commands.md +90 -0
- package/packages/shared-skills/skills/browser/references/install.md +71 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/README.md +42 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +39 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/ladder.md +59 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/network.md +42 -0
- package/packages/shared-skills/skills/browser/references/recipes/1password.md +59 -0
- package/packages/shared-skills/skills/browser/references/remote.md +24 -0
- package/packages/shared-skills/skills/browser/scripts/browser-doctor.mjs +41 -0
- package/packages/shared-skills/skills/browser/scripts/browser-env.mjs +41 -0
- package/packages/shared-skills/skills/browser/scripts/browser-install.mjs +51 -0
- package/postinstall.mjs +3 -0
- package/dist/cli/install-senpi/index.d.ts +0 -1
- package/dist/cli/senpi-platform-flag.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -20050,6 +20050,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20050
20050
|
},
|
|
20051
20051
|
librarian: {
|
|
20052
20052
|
fallbackChain: [
|
|
20053
|
+
{ providers: ["kimi-for-coding"], model: "kimi-for-coding-highspeed", variant: "off" },
|
|
20053
20054
|
{ providers: ["openai", "openai-codex"], model: "gpt-5.6-luna-fast", variant: "low" },
|
|
20054
20055
|
{ providers: ["deepseek"], model: "deepseek-v4-flash", variant: "max" },
|
|
20055
20056
|
{ providers: ["opencode-go", "bailian-coding-plan"], model: "qwen3.7-plus" },
|
|
@@ -20062,6 +20063,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20062
20063
|
},
|
|
20063
20064
|
explore: {
|
|
20064
20065
|
fallbackChain: [
|
|
20066
|
+
{ providers: ["kimi-for-coding"], model: "kimi-for-coding-highspeed", variant: "off" },
|
|
20065
20067
|
{ providers: ["openai", "openai-codex"], model: "gpt-5.6-luna-fast", variant: "low" },
|
|
20066
20068
|
{ providers: ["deepseek"], model: "deepseek-v4-flash", variant: "max" },
|
|
20067
20069
|
{ providers: ["opencode-go", "bailian-coding-plan"], model: "qwen3.7-plus" },
|
|
@@ -20231,7 +20233,6 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
20231
20233
|
},
|
|
20232
20234
|
quick: {
|
|
20233
20235
|
fallbackChain: [
|
|
20234
|
-
{ providers: ["kimi-for-coding"], model: "kimi-for-coding-highspeed" },
|
|
20235
20236
|
{ providers: ["openai-codex"], model: "gpt-5.6-luna-fast", variant: "low" },
|
|
20236
20237
|
{ providers: ["deepseek"], model: "deepseek-v4-flash", variant: "off" },
|
|
20237
20238
|
{
|
|
@@ -20251,7 +20252,8 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
20251
20252
|
},
|
|
20252
20253
|
"unspecified-low": {
|
|
20253
20254
|
fallbackChain: [
|
|
20254
|
-
{ providers: ["
|
|
20255
|
+
{ providers: ["xiaomi", "opencode-go"], model: "mimo-v2.6-pro", variant: "max" },
|
|
20256
|
+
{ providers: ["xai", "github-copilot", "opencode-go"], model: "grok-4.7", variant: "xhigh" },
|
|
20255
20257
|
{
|
|
20256
20258
|
providers: ["openai", "openai-codex", "github-copilot", "opencode"],
|
|
20257
20259
|
model: "gpt-5.6-terra",
|
|
@@ -20273,11 +20275,6 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
20273
20275
|
},
|
|
20274
20276
|
"unspecified-high": {
|
|
20275
20277
|
fallbackChain: [
|
|
20276
|
-
{
|
|
20277
|
-
providers: ["openai", "openai-codex", "github-copilot", "opencode"],
|
|
20278
|
-
model: "gpt-6-astra",
|
|
20279
|
-
variant: "high"
|
|
20280
|
-
},
|
|
20281
20278
|
{
|
|
20282
20279
|
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
20283
20280
|
model: "claude-opus-5",
|
|
@@ -22034,6 +22031,36 @@ var SUPPLEMENTAL_MODEL_CAPABILITIES = {
|
|
|
22034
22031
|
output: 32768
|
|
22035
22032
|
}
|
|
22036
22033
|
},
|
|
22034
|
+
"grok-4.7": {
|
|
22035
|
+
id: "grok-4.7",
|
|
22036
|
+
family: "grok",
|
|
22037
|
+
reasoning: false,
|
|
22038
|
+
temperature: true,
|
|
22039
|
+
toolCall: true,
|
|
22040
|
+
modalities: {
|
|
22041
|
+
input: ["text", "image"],
|
|
22042
|
+
output: ["text"]
|
|
22043
|
+
},
|
|
22044
|
+
limit: {
|
|
22045
|
+
context: 500000,
|
|
22046
|
+
output: 32768
|
|
22047
|
+
}
|
|
22048
|
+
},
|
|
22049
|
+
"xai/grok-4.7": {
|
|
22050
|
+
id: "xai/grok-4.7",
|
|
22051
|
+
family: "grok",
|
|
22052
|
+
reasoning: false,
|
|
22053
|
+
temperature: true,
|
|
22054
|
+
toolCall: true,
|
|
22055
|
+
modalities: {
|
|
22056
|
+
input: ["text", "image"],
|
|
22057
|
+
output: ["text"]
|
|
22058
|
+
},
|
|
22059
|
+
limit: {
|
|
22060
|
+
context: 500000,
|
|
22061
|
+
output: 32768
|
|
22062
|
+
}
|
|
22063
|
+
},
|
|
22037
22064
|
"xai/grok-build-0.1": {
|
|
22038
22065
|
id: "xai/grok-build-0.1",
|
|
22039
22066
|
family: "grok",
|
|
@@ -22063,6 +22090,36 @@ var SUPPLEMENTAL_MODEL_CAPABILITIES = {
|
|
|
22063
22090
|
context: 256000,
|
|
22064
22091
|
output: 32768
|
|
22065
22092
|
}
|
|
22093
|
+
},
|
|
22094
|
+
"mimo-v2.6-pro": {
|
|
22095
|
+
id: "mimo-v2.6-pro",
|
|
22096
|
+
family: "mimo",
|
|
22097
|
+
reasoning: true,
|
|
22098
|
+
temperature: true,
|
|
22099
|
+
toolCall: true,
|
|
22100
|
+
modalities: {
|
|
22101
|
+
input: ["text", "image"],
|
|
22102
|
+
output: ["text"]
|
|
22103
|
+
},
|
|
22104
|
+
limit: {
|
|
22105
|
+
context: 1048576,
|
|
22106
|
+
output: 131072
|
|
22107
|
+
}
|
|
22108
|
+
},
|
|
22109
|
+
"xiaomi/mimo-v2.6-pro": {
|
|
22110
|
+
id: "xiaomi/mimo-v2.6-pro",
|
|
22111
|
+
family: "mimo",
|
|
22112
|
+
reasoning: true,
|
|
22113
|
+
temperature: true,
|
|
22114
|
+
toolCall: true,
|
|
22115
|
+
modalities: {
|
|
22116
|
+
input: ["text", "image"],
|
|
22117
|
+
output: ["text"]
|
|
22118
|
+
},
|
|
22119
|
+
limit: {
|
|
22120
|
+
context: 1048576,
|
|
22121
|
+
output: 131072
|
|
22122
|
+
}
|
|
22066
22123
|
}
|
|
22067
22124
|
};
|
|
22068
22125
|
|
|
@@ -23189,8 +23246,10 @@ var OmoGitMasterSettingsSchema = OmoGitMasterSettingsLayerSchema.extend({
|
|
|
23189
23246
|
// packages/omo-config-core/src/schema/harness.ts
|
|
23190
23247
|
import * as z6 from "zod";
|
|
23191
23248
|
var HARNESS_IDS = ["codex", "opencode", "omo"];
|
|
23192
|
-
var OMO_CONFIG_HARNESS_IDS = ["opencode", "
|
|
23249
|
+
var OMO_CONFIG_HARNESS_IDS = ["opencode", "native", "codex"];
|
|
23193
23250
|
var OmoHarnessIdSchema = z6.enum(OMO_CONFIG_HARNESS_IDS);
|
|
23251
|
+
var OMO_CONFIG_LEGACY_HARNESS_ALIASES = { senpi: "native" };
|
|
23252
|
+
var OMO_CONFIG_LEGACY_HARNESS_IDS = Object.keys(OMO_CONFIG_LEGACY_HARNESS_ALIASES);
|
|
23194
23253
|
|
|
23195
23254
|
// packages/omo-config-core/src/schema/memory.ts
|
|
23196
23255
|
import * as z7 from "zod";
|
|
@@ -23436,6 +23495,31 @@ var OmoTaskTeamSettingsSchema = z10.object({
|
|
|
23436
23495
|
var OmoTaskWarningsSchema = z10.object({
|
|
23437
23496
|
unavailable_categories: z10.boolean().default(true)
|
|
23438
23497
|
}).strict();
|
|
23498
|
+
var IsolationBackendKindSchema = z10.enum([
|
|
23499
|
+
"auto",
|
|
23500
|
+
"apfs",
|
|
23501
|
+
"btrfs",
|
|
23502
|
+
"zfs",
|
|
23503
|
+
"reflink",
|
|
23504
|
+
"overlayfs",
|
|
23505
|
+
"block-clone",
|
|
23506
|
+
"rcopy"
|
|
23507
|
+
]);
|
|
23508
|
+
var OmoTaskIsolationSchema = z10.object({
|
|
23509
|
+
enabled: z10.boolean().default(false),
|
|
23510
|
+
backend: IsolationBackendKindSchema.default("auto"),
|
|
23511
|
+
apply: z10.boolean().default(true),
|
|
23512
|
+
merge: z10.enum(["patch", "branch"]).default("patch"),
|
|
23513
|
+
commits: z10.enum(["generic", "ai"]).default("generic")
|
|
23514
|
+
}).strict();
|
|
23515
|
+
var isolationDefaults = OmoTaskIsolationSchema.parse({});
|
|
23516
|
+
var OmoTaskIsolationLayerSchema = z10.object({
|
|
23517
|
+
enabled: z10.boolean().optional(),
|
|
23518
|
+
backend: IsolationBackendKindSchema.optional(),
|
|
23519
|
+
apply: z10.boolean().optional(),
|
|
23520
|
+
merge: z10.enum(["patch", "branch"]).optional(),
|
|
23521
|
+
commits: z10.enum(["generic", "ai"]).optional()
|
|
23522
|
+
}).strict();
|
|
23439
23523
|
var OmoTaskDagSettingsSchema = z10.object({
|
|
23440
23524
|
max_nodes_per_run: z10.number().int().positive().default(64),
|
|
23441
23525
|
max_runs_per_session: z10.number().int().positive().default(16),
|
|
@@ -23447,6 +23531,7 @@ var OmoTaskDagSettingsSchema = z10.object({
|
|
|
23447
23531
|
max_prompt_bytes: z10.number().int().positive().default(262144)
|
|
23448
23532
|
}).strict();
|
|
23449
23533
|
var OmoTaskSettingsSchema = z10.object({
|
|
23534
|
+
isolation: OmoTaskIsolationSchema.default(isolationDefaults),
|
|
23450
23535
|
default_execution_mode: z10.enum(["auto", "in-process", "process"]).default("auto"),
|
|
23451
23536
|
process_runner: z10.enum(["host", "child-process"]).default("host"),
|
|
23452
23537
|
host_engine_policy: z10.enum(["upgrade", "fallback"]).default("upgrade"),
|
|
@@ -23495,6 +23580,7 @@ var OmoTaskWarningsLayerSchema = z10.object({
|
|
|
23495
23580
|
unavailable_categories: z10.boolean().optional()
|
|
23496
23581
|
}).strict();
|
|
23497
23582
|
var OmoTaskSettingsLayerSchema = z10.object({
|
|
23583
|
+
isolation: OmoTaskIsolationLayerSchema.optional(),
|
|
23498
23584
|
default_execution_mode: z10.enum(["auto", "in-process", "process"]).optional(),
|
|
23499
23585
|
process_runner: z10.enum(["host", "child-process"]).optional(),
|
|
23500
23586
|
host_engine_policy: z10.enum(["upgrade", "fallback"]).optional(),
|
|
@@ -23629,6 +23715,7 @@ var OmoConfigProfileSchema = z14.object({
|
|
|
23629
23715
|
telemetry: OmoTelemetrySettingsLayerSchema.optional(),
|
|
23630
23716
|
disabled_skills: OmoDisabledSkillsSchema.optional(),
|
|
23631
23717
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
23718
|
+
"[native]": OmoTypedHarnessConfigSchema.optional(),
|
|
23632
23719
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
23633
23720
|
"[codex]": OmoTypedHarnessConfigSchema.optional()
|
|
23634
23721
|
}).strict();
|
|
@@ -23647,6 +23734,7 @@ var OmoConfigSchema = z14.object({
|
|
|
23647
23734
|
telemetry: OmoTelemetrySettingsSchema.optional(),
|
|
23648
23735
|
disabled_skills: OmoDisabledSkillsSchema.optional(),
|
|
23649
23736
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
23737
|
+
"[native]": OmoTypedHarnessConfigSchema.optional(),
|
|
23650
23738
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
23651
23739
|
"[codex]": OmoTypedHarnessConfigSchema.optional(),
|
|
23652
23740
|
profiles: z14.record(z14.string(), OmoConfigProfileSchema).default({}),
|
|
@@ -23668,6 +23756,7 @@ var OmoConfigLayerSchema = z14.object({
|
|
|
23668
23756
|
telemetry: OmoTelemetrySettingsLayerSchema.optional(),
|
|
23669
23757
|
disabled_skills: OmoDisabledSkillsSchema.optional(),
|
|
23670
23758
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
23759
|
+
"[native]": OmoTypedHarnessConfigSchema.optional(),
|
|
23671
23760
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
23672
23761
|
"[codex]": OmoTypedHarnessConfigSchema.optional(),
|
|
23673
23762
|
profiles: z14.record(z14.string(), OmoConfigProfileSchema).optional(),
|
|
@@ -23734,6 +23823,57 @@ function hasLegacyCategoryNames(document) {
|
|
|
23734
23823
|
return canonicalizeLegacyCategoryNames(document).renames.length > 0;
|
|
23735
23824
|
}
|
|
23736
23825
|
|
|
23826
|
+
// packages/omo-config-core/src/schema/legacy-harness-names.ts
|
|
23827
|
+
function canonicalHarnessName(name) {
|
|
23828
|
+
return Object.hasOwn(OMO_CONFIG_LEGACY_HARNESS_ALIASES, name) ? OMO_CONFIG_LEGACY_HARNESS_ALIASES[name] : name;
|
|
23829
|
+
}
|
|
23830
|
+
function harnessBlockKey(harness) {
|
|
23831
|
+
return `[${harness}]`;
|
|
23832
|
+
}
|
|
23833
|
+
function legacyHarnessOfBlockKey(key) {
|
|
23834
|
+
if (!key.startsWith("[") || !key.endsWith("]"))
|
|
23835
|
+
return;
|
|
23836
|
+
const harness = key.slice(1, -1);
|
|
23837
|
+
return Object.hasOwn(OMO_CONFIG_LEGACY_HARNESS_ALIASES, harness) ? harness : undefined;
|
|
23838
|
+
}
|
|
23839
|
+
function isRecord11(value) {
|
|
23840
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23841
|
+
}
|
|
23842
|
+
function canonicalizeBlocksIn(container, path, renames) {
|
|
23843
|
+
const result = {};
|
|
23844
|
+
for (const [key, value] of Object.entries(container)) {
|
|
23845
|
+
const legacyHarness = legacyHarnessOfBlockKey(key);
|
|
23846
|
+
if (legacyHarness === undefined) {
|
|
23847
|
+
result[key] = value;
|
|
23848
|
+
continue;
|
|
23849
|
+
}
|
|
23850
|
+
const canonical = harnessBlockKey(canonicalHarnessName(legacyHarness));
|
|
23851
|
+
const dropped = Object.hasOwn(container, canonical);
|
|
23852
|
+
renames.push({ canonical, dropped, legacy: key, path: [...path, key].join(".") });
|
|
23853
|
+
if (!dropped)
|
|
23854
|
+
result[canonical] = value;
|
|
23855
|
+
}
|
|
23856
|
+
return result;
|
|
23857
|
+
}
|
|
23858
|
+
function canonicalizeLegacyHarnessBlocks(document) {
|
|
23859
|
+
if (!isRecord11(document))
|
|
23860
|
+
return { document: {}, renames: [] };
|
|
23861
|
+
const renames = [];
|
|
23862
|
+
const canonicalized = canonicalizeBlocksIn(document, [], renames);
|
|
23863
|
+
const profiles = canonicalized["profiles"];
|
|
23864
|
+
if (isRecord11(profiles)) {
|
|
23865
|
+
const canonicalProfiles = {};
|
|
23866
|
+
for (const [name, profile] of Object.entries(profiles)) {
|
|
23867
|
+
canonicalProfiles[name] = isRecord11(profile) ? canonicalizeBlocksIn(profile, ["profiles", name], renames) : profile;
|
|
23868
|
+
}
|
|
23869
|
+
canonicalized["profiles"] = canonicalProfiles;
|
|
23870
|
+
}
|
|
23871
|
+
return { document: canonicalized, renames };
|
|
23872
|
+
}
|
|
23873
|
+
function hasLegacyHarnessBlocks(document) {
|
|
23874
|
+
return canonicalizeLegacyHarnessBlocks(document).renames.length > 0;
|
|
23875
|
+
}
|
|
23876
|
+
|
|
23737
23877
|
// packages/omo-config-core/src/loader/loader.ts
|
|
23738
23878
|
init_main();
|
|
23739
23879
|
|
|
@@ -23874,7 +24014,7 @@ function resolveOmoConfigPaths(options) {
|
|
|
23874
24014
|
}
|
|
23875
24015
|
|
|
23876
24016
|
// packages/omo-config-core/src/loader/resolution.ts
|
|
23877
|
-
var HARNESS_KEYS = [...new Set([...HARNESS_IDS, ...OMO_CONFIG_HARNESS_IDS])].map((harness) =>
|
|
24017
|
+
var HARNESS_KEYS = [...new Set([...HARNESS_IDS, ...OMO_CONFIG_HARNESS_IDS, ...OMO_CONFIG_LEGACY_HARNESS_IDS])].map((harness) => harnessBlockKey(harness));
|
|
23878
24018
|
function profileName(value) {
|
|
23879
24019
|
return value === "" ? undefined : value;
|
|
23880
24020
|
}
|
|
@@ -23903,7 +24043,13 @@ function withoutControlKeys(config) {
|
|
|
23903
24043
|
function harnessLayer(config, harness) {
|
|
23904
24044
|
if (harness === undefined)
|
|
23905
24045
|
return {};
|
|
23906
|
-
|
|
24046
|
+
const canonical = canonicalHarnessName(harness);
|
|
24047
|
+
const legacyKeys = Object.entries(OMO_CONFIG_LEGACY_HARNESS_ALIASES).filter(([, target]) => target === canonical).map(([legacy]) => harnessBlockKey(legacy));
|
|
24048
|
+
let layer = {};
|
|
24049
|
+
for (const key of [...legacyKeys, harnessBlockKey(canonical)]) {
|
|
24050
|
+
layer = mergeOmoConfigRecords(layer, toRecord(config[key]) ?? {});
|
|
24051
|
+
}
|
|
24052
|
+
return layer;
|
|
23907
24053
|
}
|
|
23908
24054
|
function resolveOmoConfigView(options) {
|
|
23909
24055
|
const profiles = toRecord(options.config["profiles"]);
|
|
@@ -23954,6 +24100,7 @@ var DEFAULT_RAW_CONFIG = {
|
|
|
23954
24100
|
function stripResolutionControlKeys(config) {
|
|
23955
24101
|
const {
|
|
23956
24102
|
"[codex]": _codex,
|
|
24103
|
+
"[native]": _native,
|
|
23957
24104
|
"[opencode]": _opencode,
|
|
23958
24105
|
"[senpi]": _senpi,
|
|
23959
24106
|
profiles: _profiles,
|
|
@@ -23979,21 +24126,21 @@ function hasUnsafeUnrecognizedKey(issues) {
|
|
|
23979
24126
|
function hasTamperedPrototype(value) {
|
|
23980
24127
|
if (Array.isArray(value))
|
|
23981
24128
|
return value.some((entry) => hasTamperedPrototype(entry));
|
|
23982
|
-
if (!
|
|
24129
|
+
if (!isRecord12(value))
|
|
23983
24130
|
return false;
|
|
23984
24131
|
const prototype = Object.getPrototypeOf(value);
|
|
23985
24132
|
if (prototype !== Object.prototype && prototype !== null)
|
|
23986
24133
|
return true;
|
|
23987
24134
|
return Object.values(value).some((entry) => hasTamperedPrototype(entry));
|
|
23988
24135
|
}
|
|
23989
|
-
function
|
|
24136
|
+
function isRecord12(value) {
|
|
23990
24137
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23991
24138
|
}
|
|
23992
24139
|
function containerAt(record, path) {
|
|
23993
24140
|
let container = record;
|
|
23994
24141
|
for (const segment of path) {
|
|
23995
24142
|
const next = container[segment];
|
|
23996
|
-
if (!
|
|
24143
|
+
if (!isRecord12(next))
|
|
23997
24144
|
return null;
|
|
23998
24145
|
container = next;
|
|
23999
24146
|
}
|
|
@@ -24104,6 +24251,15 @@ function legacyCategoryDiagnostic(path, renames) {
|
|
|
24104
24251
|
issuePaths: renames.map((rename) => rename.path)
|
|
24105
24252
|
};
|
|
24106
24253
|
}
|
|
24254
|
+
function legacyHarnessDiagnostic(path, renames) {
|
|
24255
|
+
const detail = renames.map((rename) => rename.dropped ? `${rename.path} ignored because ${rename.canonical} is also configured` : `${rename.path} renamed to ${rename.canonical}`).join(", ");
|
|
24256
|
+
return {
|
|
24257
|
+
kind: "deprecated-keys",
|
|
24258
|
+
message: `Deprecated harness block in ${path}: ${detail}. Rename it; the alias is removed in a future release.`,
|
|
24259
|
+
path,
|
|
24260
|
+
issuePaths: renames.map((rename) => rename.path)
|
|
24261
|
+
};
|
|
24262
|
+
}
|
|
24107
24263
|
function loadOmoConfig(options = {}) {
|
|
24108
24264
|
const fileSystem = options.fileSystem ?? DEFAULT_READ_FILE_SYSTEM;
|
|
24109
24265
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -24126,8 +24282,12 @@ function loadOmoConfig(options = {}) {
|
|
|
24126
24282
|
if (canonicalized.renames.length > 0) {
|
|
24127
24283
|
diagnostics.push(legacyCategoryDiagnostic(candidate.path, canonicalized.renames));
|
|
24128
24284
|
}
|
|
24129
|
-
|
|
24130
|
-
|
|
24285
|
+
const harnessCanonicalized = canonicalizeLegacyHarnessBlocks(canonicalized.document);
|
|
24286
|
+
if (harnessCanonicalized.renames.length > 0) {
|
|
24287
|
+
diagnostics.push(legacyHarnessDiagnostic(candidate.path, harnessCanonicalized.renames));
|
|
24288
|
+
}
|
|
24289
|
+
layers.push({ config: harnessCanonicalized.document, source: loaded.source });
|
|
24290
|
+
merged = mergeOmoConfigRecords(merged, harnessCanonicalized.document);
|
|
24131
24291
|
}
|
|
24132
24292
|
}
|
|
24133
24293
|
const requestedProfile = resolveOmoProfileName({
|
|
@@ -25836,7 +25996,8 @@ var HookNameSchema = z32.enum([
|
|
|
25836
25996
|
"webfetch-redirect-guard",
|
|
25837
25997
|
"fsync-skip-warning",
|
|
25838
25998
|
"plan-format-validator",
|
|
25839
|
-
"legacy-plugin-toast"
|
|
25999
|
+
"legacy-plugin-toast",
|
|
26000
|
+
"native-edition-nudge"
|
|
25840
26001
|
]);
|
|
25841
26002
|
// packages/omo-opencode/src/config/schema/i18n.ts
|
|
25842
26003
|
import { z as z33 } from "zod";
|
|
@@ -27090,21 +27251,21 @@ var OPENAI_CATEGORIES = [
|
|
|
27090
27251
|
},
|
|
27091
27252
|
{
|
|
27092
27253
|
name: "quick",
|
|
27093
|
-
config: { model: "
|
|
27254
|
+
config: { model: "openai/gpt-5.6-luna-fast", variant: "low" },
|
|
27094
27255
|
description: "Trivial tasks - single file changes, typo fixes, simple modifications",
|
|
27095
27256
|
callerGuidance: QUICK_CATEGORY_CALLER_GUIDANCE,
|
|
27096
27257
|
promptAppend: QUICK_CATEGORY_PROMPT_APPEND
|
|
27097
27258
|
},
|
|
27098
27259
|
{
|
|
27099
27260
|
name: "unspecified-low",
|
|
27100
|
-
config: { model: "
|
|
27261
|
+
config: { model: "xiaomi/mimo-v2.6-pro", variant: "max" },
|
|
27101
27262
|
description: "Tasks that don't fit other categories, low effort required",
|
|
27102
27263
|
callerGuidance: UNSPECIFIED_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
27103
27264
|
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
27104
27265
|
},
|
|
27105
27266
|
{
|
|
27106
27267
|
name: "unspecified-high",
|
|
27107
|
-
config: { model: "
|
|
27268
|
+
config: { model: "anthropic/claude-opus-5", variant: "xhigh" },
|
|
27108
27269
|
description: "Tasks that don't fit other categories, high effort required",
|
|
27109
27270
|
callerGuidance: UNSPECIFIED_HIGH_CATEGORY_CALLER_GUIDANCE,
|
|
27110
27271
|
promptAppend: UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND,
|
|
@@ -97249,7 +97410,7 @@ function getCachedVersion(options = {}) {
|
|
|
97249
97410
|
// package.json
|
|
97250
97411
|
var package_default = {
|
|
97251
97412
|
name: "oh-my-opencode",
|
|
97252
|
-
version: "5.0.0-beta.
|
|
97413
|
+
version: "5.0.0-beta.83",
|
|
97253
97414
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
97254
97415
|
main: "./dist/index.js",
|
|
97255
97416
|
types: "dist/index.d.ts",
|
|
@@ -97273,6 +97434,7 @@ var package_default = {
|
|
|
97273
97434
|
"packages/openclaw-core",
|
|
97274
97435
|
"packages/boulder-state",
|
|
97275
97436
|
"packages/memory-core",
|
|
97437
|
+
"packages/isolation-core",
|
|
97276
97438
|
"packages/telemetry-core",
|
|
97277
97439
|
"packages/claude-code-compat-core",
|
|
97278
97440
|
"packages/skills-loader-core",
|
|
@@ -97382,7 +97544,7 @@ var package_default = {
|
|
|
97382
97544
|
prepublishOnly: "bun run clean && bun run build:lsp-tools-mcp && bun run build:lsp-daemon && bun run build",
|
|
97383
97545
|
"test:model-capabilities": "bun test --timeout 20000 packages/model-core/src/model-capability-aliases.test.ts packages/model-core/src/model-capability-guardrails.test.ts packages/model-core/src/model-capabilities.test.ts packages/omo-opencode/src/cli/doctor/checks/model-resolution.test.ts --bail",
|
|
97384
97546
|
typecheck: "tsgo --noEmit && bun run typecheck:script && bun run typecheck:packages",
|
|
97385
|
-
"typecheck:packages": "tsgo --noEmit -p packages/rules-engine/tsconfig.json && tsgo --noEmit -p packages/delegate-core/tsconfig.json && tsgo --noEmit -p packages/mcp-stdio-core/tsconfig.json && tsgo --noEmit -p packages/mcp-client-core/tsconfig.json && tsgo --noEmit -p packages/git-bash-mcp/tsconfig.json && tsgo --noEmit -p packages/ast-grep-mcp/tsconfig.json && tsgo --noEmit -p packages/lsp-core/tsconfig.json && tsgo --noEmit -p packages/utils/tsconfig.json && tsgo --noEmit -p packages/model-core/tsconfig.json && tsgo --noEmit -p packages/omo-config-core/tsconfig.json && tsgo --noEmit -p packages/prompts-core/tsconfig.json && tsgo --noEmit -p packages/comment-checker-core/tsconfig.json && tsgo --noEmit -p packages/hashline-core/tsconfig.json && tsgo --noEmit -p packages/tmux-core/tsconfig.json && tsgo --noEmit -p packages/team-core/tsconfig.json && tsgo --noEmit -p packages/openclaw-core/tsconfig.json && tsgo --noEmit -p packages/boulder-state/tsconfig.json && tsgo --noEmit -p packages/memory-core/tsconfig.json && tsgo --noEmit -p packages/telemetry-core/tsconfig.json && tsgo --noEmit -p packages/claude-code-compat-core/tsconfig.json && tsgo --noEmit -p packages/skills-loader-core/tsconfig.json && tsgo --noEmit -p packages/agents-md-core/tsconfig.json && tsgo --noEmit -p packages/omo-codex/plugin/shared/tsconfig.json && tsgo --noEmit -p packages/omo-codex/tsconfig.json && tsgo --noEmit -p packages/omo-senpi/tsconfig.json && tsgo --noEmit -p packages/senpi-task/tsconfig.json && tsgo --noEmit -p packages/omo-opencode/tsconfig.json && tsgo --noEmit -p packages/omo-native/tsconfig.json",
|
|
97547
|
+
"typecheck:packages": "tsgo --noEmit -p packages/rules-engine/tsconfig.json && tsgo --noEmit -p packages/delegate-core/tsconfig.json && tsgo --noEmit -p packages/mcp-stdio-core/tsconfig.json && tsgo --noEmit -p packages/mcp-client-core/tsconfig.json && tsgo --noEmit -p packages/git-bash-mcp/tsconfig.json && tsgo --noEmit -p packages/ast-grep-mcp/tsconfig.json && tsgo --noEmit -p packages/lsp-core/tsconfig.json && tsgo --noEmit -p packages/utils/tsconfig.json && tsgo --noEmit -p packages/model-core/tsconfig.json && tsgo --noEmit -p packages/omo-config-core/tsconfig.json && tsgo --noEmit -p packages/prompts-core/tsconfig.json && tsgo --noEmit -p packages/comment-checker-core/tsconfig.json && tsgo --noEmit -p packages/hashline-core/tsconfig.json && tsgo --noEmit -p packages/tmux-core/tsconfig.json && tsgo --noEmit -p packages/team-core/tsconfig.json && tsgo --noEmit -p packages/openclaw-core/tsconfig.json && tsgo --noEmit -p packages/boulder-state/tsconfig.json && tsgo --noEmit -p packages/isolation-core/tsconfig.json && tsgo --noEmit -p packages/memory-core/tsconfig.json && tsgo --noEmit -p packages/telemetry-core/tsconfig.json && tsgo --noEmit -p packages/claude-code-compat-core/tsconfig.json && tsgo --noEmit -p packages/skills-loader-core/tsconfig.json && tsgo --noEmit -p packages/agents-md-core/tsconfig.json && tsgo --noEmit -p packages/omo-codex/plugin/shared/tsconfig.json && tsgo --noEmit -p packages/omo-codex/tsconfig.json && tsgo --noEmit -p packages/omo-senpi/tsconfig.json && tsgo --noEmit -p packages/senpi-task/tsconfig.json && tsgo --noEmit -p packages/omo-opencode/tsconfig.json && tsgo --noEmit -p packages/omo-native/tsconfig.json",
|
|
97386
97548
|
"typecheck:script": "tsgo --noEmit -p script/tsconfig.json",
|
|
97387
97549
|
test: "bun test --timeout 20000",
|
|
97388
97550
|
"changelog:section": "bun script/changelog-section.ts",
|
|
@@ -97431,7 +97593,7 @@ var package_default = {
|
|
|
97431
97593
|
zod: "^4.6.5"
|
|
97432
97594
|
},
|
|
97433
97595
|
devDependencies: {
|
|
97434
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
97596
|
+
"@code-yeongyu/senpi": "2026.9.22-2",
|
|
97435
97597
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
97436
97598
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
97437
97599
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -97441,6 +97603,7 @@ var package_default = {
|
|
|
97441
97603
|
"@oh-my-opencode/git-bash-mcp": "workspace:*",
|
|
97442
97604
|
"@oh-my-opencode/hashline-core": "workspace:*",
|
|
97443
97605
|
"@oh-my-opencode/lsp-core": "workspace:*",
|
|
97606
|
+
"@oh-my-opencode/isolation-core": "workspace:*",
|
|
97444
97607
|
"@oh-my-opencode/memory-core": "workspace:*",
|
|
97445
97608
|
"@oh-my-opencode/mcp-client-core": "workspace:*",
|
|
97446
97609
|
"@oh-my-opencode/mcp-stdio-core": "workspace:*",
|
|
@@ -97470,18 +97633,18 @@ var package_default = {
|
|
|
97470
97633
|
typescript: "^7.0.2"
|
|
97471
97634
|
},
|
|
97472
97635
|
optionalDependencies: {
|
|
97473
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
97474
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
97475
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
97476
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
97477
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
97478
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
97479
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
97480
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
97481
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
97482
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
97483
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
97484
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
97636
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.83",
|
|
97637
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.83",
|
|
97638
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.83",
|
|
97639
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.83",
|
|
97640
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.83",
|
|
97641
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.83",
|
|
97642
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.83",
|
|
97643
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.83",
|
|
97644
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.83",
|
|
97645
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.83",
|
|
97646
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.83",
|
|
97647
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.83"
|
|
97485
97648
|
},
|
|
97486
97649
|
overrides: {
|
|
97487
97650
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -98005,14 +98168,14 @@ function transformConfigJsoncSources(input) {
|
|
|
98005
98168
|
const omo = recordAt(legacy, "[omo]");
|
|
98006
98169
|
const senpi = recordAt(legacy, "[senpi]");
|
|
98007
98170
|
const history = legacyMigrationHistory(input.discovered, input.sources);
|
|
98008
|
-
const diagnostics = omo !== undefined && senpi !== undefined ? ["conflict: [
|
|
98171
|
+
const diagnostics = omo !== undefined && senpi !== undefined ? ["conflict: [native] legacy [omo] kept [native]"] : [];
|
|
98009
98172
|
return {
|
|
98010
98173
|
diagnostics,
|
|
98011
98174
|
document: {
|
|
98012
98175
|
$schema: OMO_SCHEMA_URL,
|
|
98013
98176
|
...recordAt(legacy, "[opencode]") === undefined ? {} : { "[opencode]": recordAt(legacy, "[opencode]") },
|
|
98014
98177
|
...recordAt(legacy, "[codex]") === undefined ? {} : { "[codex]": recordAt(legacy, "[codex]") },
|
|
98015
|
-
...senpi === undefined && omo === undefined ? {} : { "[
|
|
98178
|
+
...senpi === undefined && omo === undefined ? {} : { "[native]": senpi ?? omo },
|
|
98016
98179
|
...Object.keys(history).length === 0 ? {} : { legacy_migrations: history }
|
|
98017
98180
|
}
|
|
98018
98181
|
};
|
|
@@ -98264,7 +98427,7 @@ function normalizeTypedBlock(value, path, diagnostics, recurseProfiles) {
|
|
|
98264
98427
|
}
|
|
98265
98428
|
if (result["models"] !== undefined)
|
|
98266
98429
|
result["models"] = normalizeCatalog(result["models"]);
|
|
98267
|
-
for (const harness of ["[senpi]", "[codex]"]) {
|
|
98430
|
+
for (const harness of ["[senpi]", "[native]", "[codex]"]) {
|
|
98268
98431
|
if (result[harness] !== undefined)
|
|
98269
98432
|
result[harness] = normalizeTypedBlock(result[harness], [...path, harness], diagnostics, false);
|
|
98270
98433
|
}
|
|
@@ -98310,6 +98473,16 @@ function transformCategoryDeepSplit(document) {
|
|
|
98310
98473
|
};
|
|
98311
98474
|
}
|
|
98312
98475
|
|
|
98476
|
+
// packages/omo-opencode/src/config-migration/harness-native-rename.ts
|
|
98477
|
+
var HARNESS_NATIVE_RENAME_MIGRATION_ID = "2026-09-harness-native-rename";
|
|
98478
|
+
function transformHarnessNativeRename(document) {
|
|
98479
|
+
const { document: canonicalized, renames } = canonicalizeLegacyHarnessBlocks(document);
|
|
98480
|
+
return {
|
|
98481
|
+
diagnostics: renames.map((rename) => rename.dropped ? `${rename.path} removed: ${rename.canonical} is already configured` : `${rename.path} renamed to ${rename.canonical}`),
|
|
98482
|
+
document: canonicalized
|
|
98483
|
+
};
|
|
98484
|
+
}
|
|
98485
|
+
|
|
98313
98486
|
// packages/omo-opencode/src/config-migration/migration-plans.ts
|
|
98314
98487
|
function backupTimestamp(value) {
|
|
98315
98488
|
return value ?? new Date().toISOString().replace(/[:.]/g, "-");
|
|
@@ -98388,6 +98561,18 @@ function categoryDeepSplitPlan(targetPath) {
|
|
|
98388
98561
|
transform: inspect
|
|
98389
98562
|
};
|
|
98390
98563
|
}
|
|
98564
|
+
function harnessNativeRenamePlan(targetPath) {
|
|
98565
|
+
const inspect = (sources) => transformHarnessNativeRename(sources[0]?.value);
|
|
98566
|
+
return {
|
|
98567
|
+
id: HARNESS_NATIVE_RENAME_MIGRATION_ID,
|
|
98568
|
+
inspect,
|
|
98569
|
+
mode: "replace-target",
|
|
98570
|
+
shouldRun: hasLegacyHarnessBlocks,
|
|
98571
|
+
sources: [],
|
|
98572
|
+
targetPath,
|
|
98573
|
+
transform: inspect
|
|
98574
|
+
};
|
|
98575
|
+
}
|
|
98391
98576
|
function existingOmoConfigPath(directory, options) {
|
|
98392
98577
|
const fileSystem = discoveryFileSystem(options);
|
|
98393
98578
|
for (const fileName of ["omo.jsonc", "omo.json"]) {
|
|
@@ -98451,7 +98636,8 @@ function createLegacyConfigMigrationPlans(options) {
|
|
|
98451
98636
|
return [
|
|
98452
98637
|
...legacyPlans,
|
|
98453
98638
|
...inPlaceTargets.map(reasoningPlan),
|
|
98454
|
-
...inPlaceTargets.map(categoryDeepSplitPlan)
|
|
98639
|
+
...inPlaceTargets.map(categoryDeepSplitPlan),
|
|
98640
|
+
...inPlaceTargets.map(harnessNativeRenamePlan)
|
|
98455
98641
|
];
|
|
98456
98642
|
}
|
|
98457
98643
|
// packages/omo-opencode/src/startup-migration.ts
|
|
@@ -122760,6 +122946,218 @@ Run: bunx ${PUBLISHED_PACKAGE_NAME} install`,
|
|
|
122760
122946
|
}
|
|
122761
122947
|
};
|
|
122762
122948
|
}
|
|
122949
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/types.ts
|
|
122950
|
+
var NUDGE_STATE_VERSION = 1;
|
|
122951
|
+
var NUDGE_INTERVALS_MS = [3, 7, 14].map((days) => days * 24 * 60 * 60 * 1000);
|
|
122952
|
+
var NUDGE_AUTO_SHOW_CAP = 4;
|
|
122953
|
+
var NUDGE_SNOOZE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
122954
|
+
var NUDGE_CORRUPT_RECOVERY_MS = 3 * 24 * 60 * 60 * 1000;
|
|
122955
|
+
|
|
122956
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/decide.ts
|
|
122957
|
+
function freshState(now, version) {
|
|
122958
|
+
return {
|
|
122959
|
+
schemaVersion: NUDGE_STATE_VERSION,
|
|
122960
|
+
autoShows: 0,
|
|
122961
|
+
lastShownAt: null,
|
|
122962
|
+
nextEligibleAt: now,
|
|
122963
|
+
decision: "none",
|
|
122964
|
+
decidedAt: null,
|
|
122965
|
+
writtenBy: version
|
|
122966
|
+
};
|
|
122967
|
+
}
|
|
122968
|
+
function recoveredState(now, version) {
|
|
122969
|
+
return { ...freshState(now, version), nextEligibleAt: now + NUDGE_CORRUPT_RECOVERY_MS };
|
|
122970
|
+
}
|
|
122971
|
+
function shownState(previous, now, version) {
|
|
122972
|
+
const autoShows = previous.autoShows + 1;
|
|
122973
|
+
const interval = NUDGE_INTERVALS_MS[Math.min(autoShows - 1, NUDGE_INTERVALS_MS.length - 1)] ?? 0;
|
|
122974
|
+
return {
|
|
122975
|
+
...previous,
|
|
122976
|
+
schemaVersion: NUDGE_STATE_VERSION,
|
|
122977
|
+
autoShows,
|
|
122978
|
+
lastShownAt: now,
|
|
122979
|
+
nextEligibleAt: now + interval,
|
|
122980
|
+
writtenBy: version
|
|
122981
|
+
};
|
|
122982
|
+
}
|
|
122983
|
+
function decideNativeEditionNudge(input) {
|
|
122984
|
+
const deny = (reason, nextState = null) => ({ show: false, reason, nextState });
|
|
122985
|
+
if (input.state !== "missing" && input.state !== "corrupt") {
|
|
122986
|
+
if (input.state.decision === "never")
|
|
122987
|
+
return deny("opted-out");
|
|
122988
|
+
if (input.state.decision === "migrated")
|
|
122989
|
+
return deny("already-migrated");
|
|
122990
|
+
}
|
|
122991
|
+
if (input.nativeEditionInstalled)
|
|
122992
|
+
return deny("already-migrated");
|
|
122993
|
+
if (input.hookDisabled)
|
|
122994
|
+
return deny("opted-out");
|
|
122995
|
+
if (!input.interactive)
|
|
122996
|
+
return deny("non-interactive");
|
|
122997
|
+
if (input.childSession)
|
|
122998
|
+
return deny("child-session");
|
|
122999
|
+
if (input.shownThisProcess)
|
|
123000
|
+
return deny("already-shown-this-process");
|
|
123001
|
+
if (!input.toastAvailable)
|
|
123002
|
+
return deny("toast-unavailable");
|
|
123003
|
+
if (!input.stateWritable)
|
|
123004
|
+
return deny("state-unwritable");
|
|
123005
|
+
if (input.state === "corrupt")
|
|
123006
|
+
return deny("state-corrupt-recovering", recoveredState(input.now, input.version));
|
|
123007
|
+
const current = input.state === "missing" ? freshState(input.now, input.version) : input.state;
|
|
123008
|
+
if (current.autoShows >= NUDGE_AUTO_SHOW_CAP)
|
|
123009
|
+
return deny("lifetime-cap-reached");
|
|
123010
|
+
if (input.now < current.nextEligibleAt)
|
|
123011
|
+
return deny("not-yet-eligible");
|
|
123012
|
+
return { show: true, reason: "eligible", nextState: shownState(current, input.now, input.version) };
|
|
123013
|
+
}
|
|
123014
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/hook.ts
|
|
123015
|
+
import { existsSync as existsSync84 } from "fs";
|
|
123016
|
+
import { homedir as homedir21 } from "os";
|
|
123017
|
+
import { join as join104 } from "path";
|
|
123018
|
+
|
|
123019
|
+
// packages/omo-opencode/src/cli/native-edition-hint.ts
|
|
123020
|
+
var NATIVE_EDITION_INSTALL_COMMAND = "bun add -g omo-ai@beta";
|
|
123021
|
+
|
|
123022
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/hook.ts
|
|
123023
|
+
init_logger2();
|
|
123024
|
+
|
|
123025
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/state.ts
|
|
123026
|
+
import { mkdirSync as mkdirSync20, readFileSync as readFileSync56, unlinkSync as unlinkSync15, writeFileSync as writeFileSync21 } from "fs";
|
|
123027
|
+
import { join as join103 } from "path";
|
|
123028
|
+
var NUDGE_STATE_FILE = "native-nudge.json";
|
|
123029
|
+
function isDecision(value) {
|
|
123030
|
+
return value === "none" || value === "snoozed" || value === "never" || value === "migrated";
|
|
123031
|
+
}
|
|
123032
|
+
function isEpoch(value) {
|
|
123033
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
123034
|
+
}
|
|
123035
|
+
function parseNudgeState(raw) {
|
|
123036
|
+
let parsed;
|
|
123037
|
+
try {
|
|
123038
|
+
parsed = JSON.parse(raw);
|
|
123039
|
+
} catch {
|
|
123040
|
+
return "corrupt";
|
|
123041
|
+
}
|
|
123042
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
123043
|
+
return "corrupt";
|
|
123044
|
+
const record = parsed;
|
|
123045
|
+
if (!isDecision(record["decision"]))
|
|
123046
|
+
return "corrupt";
|
|
123047
|
+
if (!isEpoch(record["nextEligibleAt"]))
|
|
123048
|
+
return "corrupt";
|
|
123049
|
+
const autoShows = record["autoShows"];
|
|
123050
|
+
return {
|
|
123051
|
+
schemaVersion: typeof record["schemaVersion"] === "number" ? record["schemaVersion"] : NUDGE_STATE_VERSION,
|
|
123052
|
+
autoShows: typeof autoShows === "number" && Number.isSafeInteger(autoShows) && autoShows >= 0 ? autoShows : 0,
|
|
123053
|
+
lastShownAt: isEpoch(record["lastShownAt"]) ? record["lastShownAt"] : null,
|
|
123054
|
+
nextEligibleAt: record["nextEligibleAt"],
|
|
123055
|
+
decision: record["decision"],
|
|
123056
|
+
decidedAt: isEpoch(record["decidedAt"]) ? record["decidedAt"] : null,
|
|
123057
|
+
writtenBy: typeof record["writtenBy"] === "string" ? record["writtenBy"] : "unknown"
|
|
123058
|
+
};
|
|
123059
|
+
}
|
|
123060
|
+
function createNudgeStateStore(stateDir) {
|
|
123061
|
+
const path = join103(stateDir, NUDGE_STATE_FILE);
|
|
123062
|
+
return {
|
|
123063
|
+
read: () => {
|
|
123064
|
+
let raw;
|
|
123065
|
+
try {
|
|
123066
|
+
raw = readFileSync56(path, "utf8");
|
|
123067
|
+
} catch {
|
|
123068
|
+
return "missing";
|
|
123069
|
+
}
|
|
123070
|
+
return parseNudgeState(raw);
|
|
123071
|
+
},
|
|
123072
|
+
write: (state) => {
|
|
123073
|
+
try {
|
|
123074
|
+
mkdirSync20(stateDir, { recursive: true });
|
|
123075
|
+
writeFileSync21(path, `${JSON.stringify(state, null, 2)}
|
|
123076
|
+
`, { mode: 384 });
|
|
123077
|
+
return true;
|
|
123078
|
+
} catch {
|
|
123079
|
+
return false;
|
|
123080
|
+
}
|
|
123081
|
+
},
|
|
123082
|
+
probeWritable: () => {
|
|
123083
|
+
const probe = join103(stateDir, `.${NUDGE_STATE_FILE}.probe`);
|
|
123084
|
+
try {
|
|
123085
|
+
mkdirSync20(stateDir, { recursive: true });
|
|
123086
|
+
writeFileSync21(probe, "", { mode: 384 });
|
|
123087
|
+
} catch {
|
|
123088
|
+
return false;
|
|
123089
|
+
}
|
|
123090
|
+
try {
|
|
123091
|
+
unlinkSync15(probe);
|
|
123092
|
+
} catch {}
|
|
123093
|
+
return true;
|
|
123094
|
+
}
|
|
123095
|
+
};
|
|
123096
|
+
}
|
|
123097
|
+
|
|
123098
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/hook.ts
|
|
123099
|
+
var NATIVE_NUDGE_TOAST_TITLE = "Try OmO Native: no host app needed";
|
|
123100
|
+
var NATIVE_NUDGE_TOAST_MESSAGE = `Same agent, one binary, nothing else to keep updated.
|
|
123101
|
+
Install: ${NATIVE_EDITION_INSTALL_COMMAND}`;
|
|
123102
|
+
function nativeEditionStateDir() {
|
|
123103
|
+
return join104(getUserConfigDir(), "oh-my-openagent");
|
|
123104
|
+
}
|
|
123105
|
+
function detectNativeEdition() {
|
|
123106
|
+
return existsSync84(join104(homedir21(), ".omo", "agent"));
|
|
123107
|
+
}
|
|
123108
|
+
function defaultInteractive() {
|
|
123109
|
+
if (process.env["CI"] !== undefined && process.env["CI"] !== "")
|
|
123110
|
+
return false;
|
|
123111
|
+
if (process.env["OMO_NON_INTERACTIVE"] === "1")
|
|
123112
|
+
return false;
|
|
123113
|
+
return process.stdout.isTTY === true;
|
|
123114
|
+
}
|
|
123115
|
+
function createNativeEditionNudgeHook(ctx, deps = {}) {
|
|
123116
|
+
let shownThisProcess = false;
|
|
123117
|
+
const store = deps.store ?? createNudgeStateStore(nativeEditionStateDir());
|
|
123118
|
+
const detect = deps.detectNativeEdition ?? detectNativeEdition;
|
|
123119
|
+
const now = deps.now ?? (() => Date.now());
|
|
123120
|
+
const interactive = deps.interactive ?? defaultInteractive;
|
|
123121
|
+
const version = deps.version ?? "unknown";
|
|
123122
|
+
const logFn = deps.log ?? log2;
|
|
123123
|
+
const persist = (next) => next === null ? true : store.write(next);
|
|
123124
|
+
return {
|
|
123125
|
+
event: async ({ event }) => {
|
|
123126
|
+
if (event.type !== "session.created")
|
|
123127
|
+
return;
|
|
123128
|
+
const props = event.properties;
|
|
123129
|
+
const decision = decideNativeEditionNudge({
|
|
123130
|
+
now: now(),
|
|
123131
|
+
state: store.read(),
|
|
123132
|
+
nativeEditionInstalled: detect(),
|
|
123133
|
+
hookDisabled: false,
|
|
123134
|
+
interactive: interactive(),
|
|
123135
|
+
childSession: props?.info?.parentID !== undefined,
|
|
123136
|
+
shownThisProcess,
|
|
123137
|
+
stateWritable: store.probeWritable(),
|
|
123138
|
+
toastAvailable: typeof ctx.client?.tui?.showToast === "function",
|
|
123139
|
+
version
|
|
123140
|
+
});
|
|
123141
|
+
if (!decision.show) {
|
|
123142
|
+
persist(decision.nextState);
|
|
123143
|
+
return;
|
|
123144
|
+
}
|
|
123145
|
+
if (!persist(decision.nextState)) {
|
|
123146
|
+
logFn("[native-edition-nudge] state write failed; suppressing the toast");
|
|
123147
|
+
return;
|
|
123148
|
+
}
|
|
123149
|
+
shownThisProcess = true;
|
|
123150
|
+
await ctx.client.tui.showToast({
|
|
123151
|
+
body: {
|
|
123152
|
+
title: NATIVE_NUDGE_TOAST_TITLE,
|
|
123153
|
+
message: NATIVE_NUDGE_TOAST_MESSAGE,
|
|
123154
|
+
variant: "info",
|
|
123155
|
+
duration: 1e4
|
|
123156
|
+
}
|
|
123157
|
+
}).catch(() => {});
|
|
123158
|
+
}
|
|
123159
|
+
};
|
|
123160
|
+
}
|
|
122763
123161
|
// packages/omo-opencode/src/shared/fsync-skip-warning-formatter.ts
|
|
122764
123162
|
var MAX_PATH_LINES = 5;
|
|
122765
123163
|
function selectMostCommonClassification(entries) {
|
|
@@ -122893,7 +123291,7 @@ function createNotepadWriteGuardHook() {
|
|
|
122893
123291
|
};
|
|
122894
123292
|
}
|
|
122895
123293
|
// packages/omo-opencode/src/hooks/plan-format-validator/hook.ts
|
|
122896
|
-
import { existsSync as
|
|
123294
|
+
import { existsSync as existsSync85, readFileSync as readFileSync57, writeFileSync as writeFileSync22 } from "fs";
|
|
122897
123295
|
import { resolve as resolve25 } from "path";
|
|
122898
123296
|
init_logger2();
|
|
122899
123297
|
var WRITE_TOOLS = new Set(["Write", "Edit", "write", "edit"]);
|
|
@@ -123091,13 +123489,13 @@ function createPlanFormatValidatorHook(_ctx) {
|
|
|
123091
123489
|
if (!isPlanFilePath(filePath))
|
|
123092
123490
|
return;
|
|
123093
123491
|
const resolvedPath = resolve25(_ctx.directory, filePath);
|
|
123094
|
-
if (!
|
|
123492
|
+
if (!existsSync85(resolvedPath))
|
|
123095
123493
|
return;
|
|
123096
|
-
let content =
|
|
123494
|
+
let content = readFileSync57(resolvedPath, "utf-8");
|
|
123097
123495
|
const effort = normalizePlanEffort(content);
|
|
123098
123496
|
if (effort !== null) {
|
|
123099
123497
|
content = effort.content;
|
|
123100
|
-
|
|
123498
|
+
writeFileSync22(resolvedPath, content, "utf-8");
|
|
123101
123499
|
log2(`[plan-format-validator] Plan ${filePath}: Effort "${effort.original}" normalized to ${effort.band}`, {
|
|
123102
123500
|
sessionID: input.sessionID,
|
|
123103
123501
|
filePath
|
|
@@ -123211,19 +123609,19 @@ tool.schema = z53;
|
|
|
123211
123609
|
|
|
123212
123610
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
123213
123611
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
123214
|
-
import { existsSync as
|
|
123215
|
-
import { dirname as dirname35, join as
|
|
123612
|
+
import { existsSync as existsSync87 } from "fs";
|
|
123613
|
+
import { dirname as dirname35, join as join106 } from "path";
|
|
123216
123614
|
|
|
123217
123615
|
// packages/omo-opencode/src/tools/grep/downloader.ts
|
|
123218
|
-
import { existsSync as
|
|
123219
|
-
import { join as
|
|
123616
|
+
import { existsSync as existsSync86, readdirSync as readdirSync24 } from "fs";
|
|
123617
|
+
import { join as join105 } from "path";
|
|
123220
123618
|
init_plugin_identity();
|
|
123221
123619
|
function findFileRecursive(dir, filename) {
|
|
123222
123620
|
try {
|
|
123223
123621
|
const entries = readdirSync24(dir, { withFileTypes: true, recursive: true });
|
|
123224
123622
|
for (const entry of entries) {
|
|
123225
123623
|
if (entry.isFile() && entry.name === filename) {
|
|
123226
|
-
return
|
|
123624
|
+
return join105(entry.parentPath ?? dir, entry.name);
|
|
123227
123625
|
}
|
|
123228
123626
|
}
|
|
123229
123627
|
} catch (error) {
|
|
@@ -123247,11 +123645,11 @@ function getPlatformKey() {
|
|
|
123247
123645
|
}
|
|
123248
123646
|
function getInstallDir() {
|
|
123249
123647
|
const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
|
|
123250
|
-
return
|
|
123648
|
+
return join105(homeDir, ".cache", CACHE_DIR_NAME, "bin");
|
|
123251
123649
|
}
|
|
123252
123650
|
function getRgPath() {
|
|
123253
123651
|
const isWindows = process.platform === "win32";
|
|
123254
|
-
return
|
|
123652
|
+
return join105(getInstallDir(), isWindows ? "rg.exe" : "rg");
|
|
123255
123653
|
}
|
|
123256
123654
|
async function extractTarGz2(archivePath, destDir) {
|
|
123257
123655
|
const platformKey = getPlatformKey();
|
|
@@ -123268,7 +123666,7 @@ async function extractZip2(archivePath, destDir) {
|
|
|
123268
123666
|
const binaryName = process.platform === "win32" ? "rg.exe" : "rg";
|
|
123269
123667
|
const foundPath = findFileRecursive(destDir, binaryName);
|
|
123270
123668
|
if (foundPath) {
|
|
123271
|
-
const destPath =
|
|
123669
|
+
const destPath = join105(destDir, binaryName);
|
|
123272
123670
|
if (foundPath !== destPath) {
|
|
123273
123671
|
const { renameSync } = await import("fs");
|
|
123274
123672
|
renameSync(foundPath, destPath);
|
|
@@ -123283,13 +123681,13 @@ async function downloadAndInstallRipgrep() {
|
|
|
123283
123681
|
}
|
|
123284
123682
|
const installDir = getInstallDir();
|
|
123285
123683
|
const rgPath = getRgPath();
|
|
123286
|
-
if (
|
|
123684
|
+
if (existsSync86(rgPath)) {
|
|
123287
123685
|
return rgPath;
|
|
123288
123686
|
}
|
|
123289
123687
|
ensureCacheDir(installDir);
|
|
123290
123688
|
const filename = `ripgrep-${RG_VERSION}-${config.platform}.${config.extension}`;
|
|
123291
123689
|
const url = `https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${filename}`;
|
|
123292
|
-
const archivePath =
|
|
123690
|
+
const archivePath = join105(installDir, filename);
|
|
123293
123691
|
try {
|
|
123294
123692
|
await downloadArchive(url, archivePath);
|
|
123295
123693
|
if (config.extension === "tar.gz") {
|
|
@@ -123298,7 +123696,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
123298
123696
|
await extractZip2(archivePath, installDir);
|
|
123299
123697
|
}
|
|
123300
123698
|
ensureExecutable(rgPath);
|
|
123301
|
-
if (!
|
|
123699
|
+
if (!existsSync86(rgPath)) {
|
|
123302
123700
|
throw new Error("ripgrep binary not found after extraction");
|
|
123303
123701
|
}
|
|
123304
123702
|
return rgPath;
|
|
@@ -123314,7 +123712,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
123314
123712
|
}
|
|
123315
123713
|
function getInstalledRipgrepPath() {
|
|
123316
123714
|
const rgPath = getRgPath();
|
|
123317
|
-
return
|
|
123715
|
+
return existsSync86(rgPath) ? rgPath : null;
|
|
123318
123716
|
}
|
|
123319
123717
|
|
|
123320
123718
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
@@ -123354,15 +123752,15 @@ function getOpenCodeBundledRg() {
|
|
|
123354
123752
|
const isWindows = process.platform === "win32";
|
|
123355
123753
|
const rgName = isWindows ? "rg.exe" : "rg";
|
|
123356
123754
|
const candidates = [
|
|
123357
|
-
|
|
123358
|
-
|
|
123359
|
-
|
|
123360
|
-
|
|
123361
|
-
|
|
123362
|
-
|
|
123755
|
+
join106(getOpenCodeCacheDir(), "bin", rgName),
|
|
123756
|
+
join106(getDataDir(), "opencode", "bin", rgName),
|
|
123757
|
+
join106(execDir, rgName),
|
|
123758
|
+
join106(execDir, "bin", rgName),
|
|
123759
|
+
join106(execDir, "..", "bin", rgName),
|
|
123760
|
+
join106(execDir, "..", "libexec", rgName)
|
|
123363
123761
|
];
|
|
123364
123762
|
for (const candidate of candidates) {
|
|
123365
|
-
if (
|
|
123763
|
+
if (existsSync87(candidate)) {
|
|
123366
123764
|
return candidate;
|
|
123367
123765
|
}
|
|
123368
123766
|
}
|
|
@@ -124536,9 +124934,9 @@ function createSkillTool(options) {
|
|
|
124536
124934
|
}
|
|
124537
124935
|
var skill = createSkillTool({ directory: process.cwd() });
|
|
124538
124936
|
// packages/omo-opencode/src/tools/session-manager/constants.ts
|
|
124539
|
-
import { join as
|
|
124540
|
-
var TODO_DIR2 =
|
|
124541
|
-
var TRANSCRIPT_DIR2 =
|
|
124937
|
+
import { join as join107 } from "path";
|
|
124938
|
+
var TODO_DIR2 = join107(getClaudeConfigDir(), "todos");
|
|
124939
|
+
var TRANSCRIPT_DIR2 = join107(getClaudeConfigDir(), "transcripts");
|
|
124542
124940
|
var SESSION_LIST_DESCRIPTION = `List all OpenCode sessions with optional filtering.
|
|
124543
124941
|
|
|
124544
124942
|
Returns a list of available session IDs with metadata including message count, date range, and agents used.
|
|
@@ -124611,9 +125009,9 @@ Has Todos: Yes (12 items, 8 completed)
|
|
|
124611
125009
|
Has Transcript: Yes (234 entries)`;
|
|
124612
125010
|
|
|
124613
125011
|
// packages/omo-opencode/src/tools/session-manager/file-storage.ts
|
|
124614
|
-
import { existsSync as
|
|
125012
|
+
import { existsSync as existsSync88 } from "fs";
|
|
124615
125013
|
import { readdir as readdir6, readFile as readFile8 } from "fs/promises";
|
|
124616
|
-
import { join as
|
|
125014
|
+
import { join as join108 } from "path";
|
|
124617
125015
|
|
|
124618
125016
|
// packages/omo-opencode/src/tools/session-manager/directory-filter.ts
|
|
124619
125017
|
import { normalize as normalize4, parse as parse3, sep as sep3 } from "path";
|
|
@@ -124637,7 +125035,7 @@ function ignoreFileStorageError(error) {
|
|
|
124637
125035
|
throw error;
|
|
124638
125036
|
}
|
|
124639
125037
|
async function getFileMainSessions(directory) {
|
|
124640
|
-
if (!
|
|
125038
|
+
if (!existsSync88(SESSION_STORAGE))
|
|
124641
125039
|
return [];
|
|
124642
125040
|
const sessions = [];
|
|
124643
125041
|
try {
|
|
@@ -124645,13 +125043,13 @@ async function getFileMainSessions(directory) {
|
|
|
124645
125043
|
for (const projectDir of projectDirs) {
|
|
124646
125044
|
if (!projectDir.isDirectory())
|
|
124647
125045
|
continue;
|
|
124648
|
-
const projectPath =
|
|
125046
|
+
const projectPath = join108(SESSION_STORAGE, projectDir.name);
|
|
124649
125047
|
const sessionFiles = await readdir6(projectPath);
|
|
124650
125048
|
for (const file of sessionFiles) {
|
|
124651
125049
|
if (!file.endsWith(".json"))
|
|
124652
125050
|
continue;
|
|
124653
125051
|
try {
|
|
124654
|
-
const content = await readFile8(
|
|
125052
|
+
const content = await readFile8(join108(projectPath, file), "utf-8");
|
|
124655
125053
|
const meta = JSON.parse(content);
|
|
124656
125054
|
if (meta.parentID)
|
|
124657
125055
|
continue;
|
|
@@ -124671,7 +125069,7 @@ async function getFileMainSessions(directory) {
|
|
|
124671
125069
|
return sessions.sort((a, b) => b.time.updated - a.time.updated);
|
|
124672
125070
|
}
|
|
124673
125071
|
async function getFileAllSessions() {
|
|
124674
|
-
if (!
|
|
125072
|
+
if (!existsSync88(MESSAGE_STORAGE))
|
|
124675
125073
|
return [];
|
|
124676
125074
|
const sessions = [];
|
|
124677
125075
|
async function scanDirectory(dir) {
|
|
@@ -124680,7 +125078,7 @@ async function getFileAllSessions() {
|
|
|
124680
125078
|
for (const entry of entries) {
|
|
124681
125079
|
if (!entry.isDirectory())
|
|
124682
125080
|
continue;
|
|
124683
|
-
const sessionPath =
|
|
125081
|
+
const sessionPath = join108(dir, entry.name);
|
|
124684
125082
|
const files = await readdir6(sessionPath);
|
|
124685
125083
|
if (files.some((file) => file.endsWith(".json"))) {
|
|
124686
125084
|
sessions.push(entry.name);
|
|
@@ -124701,7 +125099,7 @@ async function fileSessionExists(sessionID) {
|
|
|
124701
125099
|
}
|
|
124702
125100
|
async function getFileSessionMessages(sessionID) {
|
|
124703
125101
|
const messageDir = getMessageDir(sessionID);
|
|
124704
|
-
if (!messageDir || !
|
|
125102
|
+
if (!messageDir || !existsSync88(messageDir))
|
|
124705
125103
|
return [];
|
|
124706
125104
|
const messages = [];
|
|
124707
125105
|
try {
|
|
@@ -124710,7 +125108,7 @@ async function getFileSessionMessages(sessionID) {
|
|
|
124710
125108
|
if (!file.endsWith(".json"))
|
|
124711
125109
|
continue;
|
|
124712
125110
|
try {
|
|
124713
|
-
const content = await readFile8(
|
|
125111
|
+
const content = await readFile8(join108(messageDir, file), "utf-8");
|
|
124714
125112
|
const meta = JSON.parse(content);
|
|
124715
125113
|
const parts = await readParts2(meta.id);
|
|
124716
125114
|
messages.push({
|
|
@@ -124738,8 +125136,8 @@ async function getFileSessionMessages(sessionID) {
|
|
|
124738
125136
|
});
|
|
124739
125137
|
}
|
|
124740
125138
|
async function readParts2(messageID) {
|
|
124741
|
-
const partDir =
|
|
124742
|
-
if (!
|
|
125139
|
+
const partDir = join108(PART_STORAGE, messageID);
|
|
125140
|
+
if (!existsSync88(partDir))
|
|
124743
125141
|
return [];
|
|
124744
125142
|
const parts = [];
|
|
124745
125143
|
try {
|
|
@@ -124748,7 +125146,7 @@ async function readParts2(messageID) {
|
|
|
124748
125146
|
if (!file.endsWith(".json"))
|
|
124749
125147
|
continue;
|
|
124750
125148
|
try {
|
|
124751
|
-
const content = await readFile8(
|
|
125149
|
+
const content = await readFile8(join108(partDir, file), "utf-8");
|
|
124752
125150
|
parts.push(JSON.parse(content));
|
|
124753
125151
|
} catch (error) {
|
|
124754
125152
|
ignoreFileStorageError(error);
|
|
@@ -124762,14 +125160,14 @@ async function readParts2(messageID) {
|
|
|
124762
125160
|
return parts.sort((a, b) => a.id.localeCompare(b.id));
|
|
124763
125161
|
}
|
|
124764
125162
|
async function getFileSessionTodos(sessionID) {
|
|
124765
|
-
if (!
|
|
125163
|
+
if (!existsSync88(TODO_DIR2))
|
|
124766
125164
|
return [];
|
|
124767
125165
|
try {
|
|
124768
125166
|
const allFiles = await readdir6(TODO_DIR2);
|
|
124769
125167
|
const todoFiles = allFiles.filter((file) => file === `${sessionID}.json`);
|
|
124770
125168
|
for (const file of todoFiles) {
|
|
124771
125169
|
try {
|
|
124772
|
-
const content = await readFile8(
|
|
125170
|
+
const content = await readFile8(join108(TODO_DIR2, file), "utf-8");
|
|
124773
125171
|
const data = JSON.parse(content);
|
|
124774
125172
|
if (!Array.isArray(data))
|
|
124775
125173
|
continue;
|
|
@@ -124791,10 +125189,10 @@ async function getFileSessionTodos(sessionID) {
|
|
|
124791
125189
|
return [];
|
|
124792
125190
|
}
|
|
124793
125191
|
async function getFileSessionTranscript(sessionID) {
|
|
124794
|
-
if (!
|
|
125192
|
+
if (!existsSync88(TRANSCRIPT_DIR2))
|
|
124795
125193
|
return 0;
|
|
124796
|
-
const transcriptFile =
|
|
124797
|
-
if (!
|
|
125194
|
+
const transcriptFile = join108(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
|
|
125195
|
+
if (!existsSync88(transcriptFile))
|
|
124798
125196
|
return 0;
|
|
124799
125197
|
try {
|
|
124800
125198
|
const content = await readFile8(transcriptFile, "utf-8");
|
|
@@ -126656,23 +127054,23 @@ Other built-in agents, custom agents, and task categories are intentionally not
|
|
|
126656
127054
|
|
|
126657
127055
|
Pass \`session_id=<id>\` to continue previous agent with full context. Nested subagent depth is tracked automatically and blocked past the configured limit. Prompts MUST be in English. Use \`background_output\` for async results.`;
|
|
126658
127056
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
126659
|
-
import { existsSync as
|
|
126660
|
-
import { join as
|
|
127057
|
+
import { existsSync as existsSync93, readdirSync as readdirSync25 } from "fs";
|
|
127058
|
+
import { join as join114 } from "path";
|
|
126661
127059
|
|
|
126662
127060
|
// packages/claude-code-compat-core/src/shared/claude-config-dir.ts
|
|
126663
|
-
import { homedir as
|
|
126664
|
-
import { join as
|
|
127061
|
+
import { homedir as homedir22 } from "os";
|
|
127062
|
+
import { join as join109 } from "path";
|
|
126665
127063
|
function getClaudeConfigDir3() {
|
|
126666
127064
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
126667
127065
|
if (envConfigDir) {
|
|
126668
127066
|
return envConfigDir;
|
|
126669
127067
|
}
|
|
126670
|
-
return
|
|
127068
|
+
return join109(process.env.HOME || process.env.USERPROFILE || homedir22(), ".claude");
|
|
126671
127069
|
}
|
|
126672
127070
|
// packages/claude-code-compat-core/src/shared/opencode-config-dir.ts
|
|
126673
|
-
import { existsSync as
|
|
126674
|
-
import { homedir as
|
|
126675
|
-
import { join as
|
|
127071
|
+
import { existsSync as existsSync89, realpathSync as realpathSync16 } from "fs";
|
|
127072
|
+
import { homedir as homedir23 } from "os";
|
|
127073
|
+
import { join as join110, posix as posix10, resolve as resolve29, win32 as win3211 } from "path";
|
|
126676
127074
|
var TAURI_APP_IDENTIFIER3 = "ai.opencode.desktop";
|
|
126677
127075
|
var TAURI_APP_IDENTIFIER_DEV3 = "ai.opencode.desktop.dev";
|
|
126678
127076
|
function isDevBuild3(version) {
|
|
@@ -126684,15 +127082,15 @@ function getTauriConfigDir3(identifier) {
|
|
|
126684
127082
|
const platform = process.platform;
|
|
126685
127083
|
switch (platform) {
|
|
126686
127084
|
case "darwin":
|
|
126687
|
-
return
|
|
127085
|
+
return join110(homedir23(), "Library", "Application Support", identifier);
|
|
126688
127086
|
case "win32": {
|
|
126689
|
-
const appData = process.env.APPDATA ||
|
|
127087
|
+
const appData = process.env.APPDATA || join110(homedir23(), "AppData", "Roaming");
|
|
126690
127088
|
return win3211.join(appData, identifier);
|
|
126691
127089
|
}
|
|
126692
127090
|
case "linux":
|
|
126693
127091
|
default: {
|
|
126694
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
126695
|
-
return
|
|
127092
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join110(homedir23(), ".config");
|
|
127093
|
+
return join110(xdgConfig, identifier);
|
|
126696
127094
|
}
|
|
126697
127095
|
}
|
|
126698
127096
|
}
|
|
@@ -126701,7 +127099,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
126701
127099
|
return posix10.normalize(pathValue);
|
|
126702
127100
|
}
|
|
126703
127101
|
const resolvedPath = resolve29(pathValue);
|
|
126704
|
-
if (!
|
|
127102
|
+
if (!existsSync89(resolvedPath))
|
|
126705
127103
|
return resolvedPath;
|
|
126706
127104
|
try {
|
|
126707
127105
|
return realpathSync16(resolvedPath);
|
|
@@ -126735,8 +127133,8 @@ function getWslLinuxHomeDir3(windowsConfigRoot) {
|
|
|
126735
127133
|
function getCliDefaultConfigDir3() {
|
|
126736
127134
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
126737
127135
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment3() && isWindowsUserConfigRoot3(envXdgConfig);
|
|
126738
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix10.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
126739
|
-
const configDir = isWslEnvironment3() ? posix10.join(xdgConfig, "opencode") :
|
|
127136
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix10.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join110(homedir23(), ".config");
|
|
127137
|
+
const configDir = isWslEnvironment3() ? posix10.join(xdgConfig, "opencode") : join110(xdgConfig, "opencode");
|
|
126740
127138
|
return resolveConfigPath3(configDir);
|
|
126741
127139
|
}
|
|
126742
127140
|
function getCliCustomConfigDir3() {
|
|
@@ -126769,9 +127167,9 @@ function getOpenCodeConfigDir3(options) {
|
|
|
126769
127167
|
const tauriDir = process.platform === "win32" ? win3211.isAbsolute(tauriDirBase) ? win3211.normalize(tauriDirBase) : win3211.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
126770
127168
|
if (checkExisting) {
|
|
126771
127169
|
const legacyDir = getCliConfigDir3();
|
|
126772
|
-
const legacyConfig =
|
|
126773
|
-
const legacyConfigC =
|
|
126774
|
-
if (
|
|
127170
|
+
const legacyConfig = join110(legacyDir, "opencode.json");
|
|
127171
|
+
const legacyConfigC = join110(legacyDir, "opencode.jsonc");
|
|
127172
|
+
if (existsSync89(legacyConfig) || existsSync89(legacyConfigC)) {
|
|
126775
127173
|
return legacyDir;
|
|
126776
127174
|
}
|
|
126777
127175
|
}
|
|
@@ -126780,11 +127178,11 @@ function getOpenCodeConfigDir3(options) {
|
|
|
126780
127178
|
// packages/claude-code-compat-core/src/shared/jsonc-parser.ts
|
|
126781
127179
|
init_src();
|
|
126782
127180
|
// packages/claude-code-compat-core/src/shared/resolve-agent-definition-paths.ts
|
|
126783
|
-
import { homedir as
|
|
126784
|
-
import { isAbsolute as isAbsolute16, join as
|
|
127181
|
+
import { homedir as homedir24 } from "os";
|
|
127182
|
+
import { isAbsolute as isAbsolute16, join as join111, resolve as resolve30 } from "path";
|
|
126785
127183
|
function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
|
|
126786
127184
|
return paths.flatMap((p) => {
|
|
126787
|
-
const expanded = p.startsWith("~/") ?
|
|
127185
|
+
const expanded = p.startsWith("~/") ? join111(homedir24(), p.slice(2)) : p;
|
|
126788
127186
|
const resolved = isAbsolute16(expanded) ? expanded : resolve30(baseDir, expanded);
|
|
126789
127187
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
126790
127188
|
log4(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
@@ -126812,7 +127210,7 @@ var EXCLUDED_DIR_NAMES2 = [
|
|
|
126812
127210
|
];
|
|
126813
127211
|
var EXCLUDED_DIRS3 = Object.freeze(new Set(EXCLUDED_DIR_NAMES2));
|
|
126814
127212
|
// packages/claude-code-compat-core/src/shared/opencode-command-dirs.ts
|
|
126815
|
-
import { basename as basename15, dirname as dirname38, join as
|
|
127213
|
+
import { basename as basename15, dirname as dirname38, join as join112 } from "path";
|
|
126816
127214
|
function getParentOpencodeConfigDir3(configDir) {
|
|
126817
127215
|
const parentDir = dirname38(configDir);
|
|
126818
127216
|
if (basename15(parentDir) !== "profiles") {
|
|
@@ -126826,21 +127224,21 @@ function getOpenCodeCommandDirs2(options) {
|
|
|
126826
127224
|
...configDirs.flatMap((configDir) => {
|
|
126827
127225
|
const parentConfigDir = getParentOpencodeConfigDir3(configDir);
|
|
126828
127226
|
return [
|
|
126829
|
-
|
|
126830
|
-
|
|
126831
|
-
...parentConfigDir ? [
|
|
127227
|
+
join112(configDir, "commands"),
|
|
127228
|
+
join112(configDir, "command"),
|
|
127229
|
+
...parentConfigDir ? [join112(parentConfigDir, "commands"), join112(parentConfigDir, "command")] : []
|
|
126832
127230
|
];
|
|
126833
127231
|
})
|
|
126834
127232
|
]));
|
|
126835
127233
|
}
|
|
126836
127234
|
// packages/claude-code-compat-core/src/shared/project-discovery-dirs.ts
|
|
126837
127235
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
126838
|
-
import { existsSync as
|
|
126839
|
-
import { dirname as dirname39, join as
|
|
127236
|
+
import { existsSync as existsSync90, realpathSync as realpathSync17 } from "fs";
|
|
127237
|
+
import { dirname as dirname39, join as join113, resolve as resolve31, win32 as win3212 } from "path";
|
|
126840
127238
|
var worktreePathCache3 = new Map;
|
|
126841
127239
|
function normalizePath6(path) {
|
|
126842
127240
|
const resolvedPath = process.platform !== "win32" && win3212.isAbsolute(path) ? path : resolve31(path);
|
|
126843
|
-
if (!
|
|
127241
|
+
if (!existsSync90(resolvedPath)) {
|
|
126844
127242
|
return resolvedPath;
|
|
126845
127243
|
}
|
|
126846
127244
|
try {
|
|
@@ -126895,7 +127293,7 @@ function detectWorktreePath4(directory) {
|
|
|
126895
127293
|
function findGitMarkerAncestor(directory) {
|
|
126896
127294
|
let currentDirectory = normalizePath6(directory);
|
|
126897
127295
|
while (true) {
|
|
126898
|
-
if (
|
|
127296
|
+
if (existsSync90(join113(currentDirectory, ".git"))) {
|
|
126899
127297
|
return currentDirectory;
|
|
126900
127298
|
}
|
|
126901
127299
|
const parentDirectory = dirname39(currentDirectory);
|
|
@@ -126913,8 +127311,8 @@ function findAncestorDirectories3(startDirectory, targetPaths, stopDirectory) {
|
|
|
126913
127311
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey4(resolvedStopDirectory) : undefined;
|
|
126914
127312
|
while (true) {
|
|
126915
127313
|
for (const targetPath of targetPaths) {
|
|
126916
|
-
const candidateDirectory =
|
|
126917
|
-
if (!
|
|
127314
|
+
const candidateDirectory = join113(currentDirectory, ...targetPath);
|
|
127315
|
+
if (!existsSync90(candidateDirectory)) {
|
|
126918
127316
|
continue;
|
|
126919
127317
|
}
|
|
126920
127318
|
const normalizedCandidateDirectory = normalizePath6(candidateDirectory);
|
|
@@ -126943,17 +127341,17 @@ function findProjectOpencodeCommandDirs2(startDirectory, stopDirectory) {
|
|
|
126943
127341
|
], detectedStopDirectory);
|
|
126944
127342
|
}
|
|
126945
127343
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
126946
|
-
import { existsSync as
|
|
127344
|
+
import { existsSync as existsSync92, readFileSync as readFileSync59 } from "fs";
|
|
126947
127345
|
import { basename as basename16, extname as extname3 } from "path";
|
|
126948
127346
|
|
|
126949
127347
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/json-agent-loader.ts
|
|
126950
|
-
import { existsSync as
|
|
127348
|
+
import { existsSync as existsSync91, readFileSync as readFileSync58 } from "fs";
|
|
126951
127349
|
function parseJsonAgentFile(filePath, scope) {
|
|
126952
127350
|
try {
|
|
126953
|
-
if (!
|
|
127351
|
+
if (!existsSync91(filePath)) {
|
|
126954
127352
|
return null;
|
|
126955
127353
|
}
|
|
126956
|
-
const content =
|
|
127354
|
+
const content = readFileSync58(filePath, "utf-8");
|
|
126957
127355
|
const { data } = parseJsoncSafe(content);
|
|
126958
127356
|
if (!data) {
|
|
126959
127357
|
return null;
|
|
@@ -126991,10 +127389,10 @@ function parseJsonAgentFile(filePath, scope) {
|
|
|
126991
127389
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
126992
127390
|
function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
126993
127391
|
try {
|
|
126994
|
-
if (!
|
|
127392
|
+
if (!existsSync92(filePath)) {
|
|
126995
127393
|
return null;
|
|
126996
127394
|
}
|
|
126997
|
-
const content =
|
|
127395
|
+
const content = readFileSync59(filePath, "utf-8");
|
|
126998
127396
|
const { data, body } = parseFrontmatter(content);
|
|
126999
127397
|
const fileName = basename16(filePath);
|
|
127000
127398
|
const agentName = fileName.replace(/\.md$/i, "");
|
|
@@ -127028,7 +127426,7 @@ function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
|
127028
127426
|
function loadAgentDefinitions(paths, scope, anthropicProvider) {
|
|
127029
127427
|
const result = Object.create(null);
|
|
127030
127428
|
for (const filePath of paths) {
|
|
127031
|
-
if (!
|
|
127429
|
+
if (!existsSync92(filePath)) {
|
|
127032
127430
|
log4(`[agent-definitions-loader] File not found, skipping: ${filePath}`);
|
|
127033
127431
|
continue;
|
|
127034
127432
|
}
|
|
@@ -127053,7 +127451,7 @@ function loadAgentDefinitions(paths, scope, anthropicProvider) {
|
|
|
127053
127451
|
|
|
127054
127452
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
127055
127453
|
function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
127056
|
-
if (!
|
|
127454
|
+
if (!existsSync93(agentsDir)) {
|
|
127057
127455
|
return [];
|
|
127058
127456
|
}
|
|
127059
127457
|
const entries = readdirSync25(agentsDir, { withFileTypes: true });
|
|
@@ -127061,7 +127459,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
127061
127459
|
for (const entry of entries) {
|
|
127062
127460
|
if (!isMarkdownFile(entry))
|
|
127063
127461
|
continue;
|
|
127064
|
-
const agentPath =
|
|
127462
|
+
const agentPath = join114(agentsDir, entry.name);
|
|
127065
127463
|
const agent = parseMarkdownAgentFile(agentPath, scope, anthropicProvider);
|
|
127066
127464
|
if (agent) {
|
|
127067
127465
|
agents.push(agent);
|
|
@@ -127070,7 +127468,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
127070
127468
|
return agents;
|
|
127071
127469
|
}
|
|
127072
127470
|
function loadUserAgents(anthropicProvider) {
|
|
127073
|
-
const userAgentsDir =
|
|
127471
|
+
const userAgentsDir = join114(getClaudeConfigDir3(), "agents");
|
|
127074
127472
|
const agents = loadAgentsFromDir(userAgentsDir, "user", anthropicProvider);
|
|
127075
127473
|
const result = Object.create(null);
|
|
127076
127474
|
for (const agent of agents) {
|
|
@@ -127079,7 +127477,7 @@ function loadUserAgents(anthropicProvider) {
|
|
|
127079
127477
|
return result;
|
|
127080
127478
|
}
|
|
127081
127479
|
function loadProjectAgents(directory, anthropicProvider) {
|
|
127082
|
-
const projectAgentsDir =
|
|
127480
|
+
const projectAgentsDir = join114(directory ?? process.cwd(), ".claude", "agents");
|
|
127083
127481
|
const agents = loadAgentsFromDir(projectAgentsDir, "project", anthropicProvider);
|
|
127084
127482
|
const result = Object.create(null);
|
|
127085
127483
|
for (const agent of agents) {
|
|
@@ -127091,7 +127489,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
127091
127489
|
const result = Object.create(null);
|
|
127092
127490
|
const configDirs = getOpenCodeConfigDirs3({ binary: "opencode" });
|
|
127093
127491
|
for (const configDir of configDirs) {
|
|
127094
|
-
const opencodeAgentsDir =
|
|
127492
|
+
const opencodeAgentsDir = join114(configDir, "agents");
|
|
127095
127493
|
const agents = loadAgentsFromDir(opencodeAgentsDir, "opencode");
|
|
127096
127494
|
for (const agent of agents) {
|
|
127097
127495
|
if (!(agent.name in result)) {
|
|
@@ -127102,7 +127500,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
127102
127500
|
return result;
|
|
127103
127501
|
}
|
|
127104
127502
|
function loadOpencodeProjectAgents(directory) {
|
|
127105
|
-
const opencodeProjectDir =
|
|
127503
|
+
const opencodeProjectDir = join114(directory ?? process.cwd(), ".opencode", "agents");
|
|
127106
127504
|
const agents = loadAgentsFromDir(opencodeProjectDir, "opencode-project");
|
|
127107
127505
|
const result = Object.create(null);
|
|
127108
127506
|
for (const agent of agents) {
|
|
@@ -127924,15 +128322,15 @@ function validateArgs(args) {
|
|
|
127924
128322
|
}
|
|
127925
128323
|
|
|
127926
128324
|
// packages/omo-opencode/src/tools/look-at/look-at-input-preparer.ts
|
|
127927
|
-
import { readFileSync as
|
|
128325
|
+
import { readFileSync as readFileSync62 } from "fs";
|
|
127928
128326
|
import { basename as basename17 } from "path";
|
|
127929
128327
|
import { pathToFileURL } from "url";
|
|
127930
128328
|
|
|
127931
128329
|
// packages/omo-opencode/src/tools/look-at/image-converter.ts
|
|
127932
128330
|
import * as childProcess2 from "child_process";
|
|
127933
|
-
import { existsSync as
|
|
128331
|
+
import { existsSync as existsSync95, mkdtempSync, readFileSync as readFileSync61, rmSync as rmSync5, unlinkSync as unlinkSync16, writeFileSync as writeFileSync23 } from "fs";
|
|
127934
128332
|
import { tmpdir as tmpdir7 } from "os";
|
|
127935
|
-
import { dirname as dirname41, join as
|
|
128333
|
+
import { dirname as dirname41, join as join116 } from "path";
|
|
127936
128334
|
var SUPPORTED_FORMATS = new Set([
|
|
127937
128335
|
"image/jpeg",
|
|
127938
128336
|
"image/png",
|
|
@@ -127962,8 +128360,8 @@ var UNSUPPORTED_FORMATS = new Set([
|
|
|
127962
128360
|
var CONVERSION_TIMEOUT_MS = 30000;
|
|
127963
128361
|
function cleanupTemporaryFileAfterFailure(filePath) {
|
|
127964
128362
|
try {
|
|
127965
|
-
if (
|
|
127966
|
-
|
|
128363
|
+
if (existsSync95(filePath)) {
|
|
128364
|
+
unlinkSync16(filePath);
|
|
127967
128365
|
}
|
|
127968
128366
|
} catch (cleanupError) {
|
|
127969
128367
|
const cleanupErrorDescription = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
|
|
@@ -127980,11 +128378,11 @@ function needsConversion(mimeType) {
|
|
|
127980
128378
|
return mimeType.startsWith("image/");
|
|
127981
128379
|
}
|
|
127982
128380
|
function convertImageToJpeg(inputPath, mimeType) {
|
|
127983
|
-
if (!
|
|
128381
|
+
if (!existsSync95(inputPath)) {
|
|
127984
128382
|
throw new Error(`File not found: ${inputPath}`);
|
|
127985
128383
|
}
|
|
127986
|
-
const tempDir = mkdtempSync(
|
|
127987
|
-
const outputPath =
|
|
128384
|
+
const tempDir = mkdtempSync(join116(tmpdir7(), "opencode-img-"));
|
|
128385
|
+
const outputPath = join116(tempDir, "converted.jpg");
|
|
127988
128386
|
log2(`[image-converter] Converting ${mimeType} to JPEG: ${inputPath}`);
|
|
127989
128387
|
try {
|
|
127990
128388
|
if (process.platform === "darwin") {
|
|
@@ -127994,7 +128392,7 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
127994
128392
|
encoding: "utf-8",
|
|
127995
128393
|
timeout: CONVERSION_TIMEOUT_MS
|
|
127996
128394
|
});
|
|
127997
|
-
if (
|
|
128395
|
+
if (existsSync95(outputPath)) {
|
|
127998
128396
|
log2(`[image-converter] Converted using sips: ${outputPath}`);
|
|
127999
128397
|
return outputPath;
|
|
128000
128398
|
}
|
|
@@ -128010,7 +128408,7 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
128010
128408
|
encoding: "utf-8",
|
|
128011
128409
|
timeout: CONVERSION_TIMEOUT_MS
|
|
128012
128410
|
});
|
|
128013
|
-
if (
|
|
128411
|
+
if (existsSync95(outputPath)) {
|
|
128014
128412
|
log2(`[image-converter] Converted using ImageMagick: ${outputPath}`);
|
|
128015
128413
|
return outputPath;
|
|
128016
128414
|
}
|
|
@@ -128034,11 +128432,11 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
128034
128432
|
function cleanupConvertedImage(filePath) {
|
|
128035
128433
|
try {
|
|
128036
128434
|
const tempDirectory = dirname41(filePath);
|
|
128037
|
-
if (
|
|
128038
|
-
|
|
128435
|
+
if (existsSync95(filePath)) {
|
|
128436
|
+
unlinkSync16(filePath);
|
|
128039
128437
|
log2(`[image-converter] Cleaned up temporary file: ${filePath}`);
|
|
128040
128438
|
}
|
|
128041
|
-
if (
|
|
128439
|
+
if (existsSync95(tempDirectory)) {
|
|
128042
128440
|
rmSync5(tempDirectory, { recursive: true, force: true });
|
|
128043
128441
|
log2(`[image-converter] Cleaned up temporary directory: ${tempDirectory}`);
|
|
128044
128442
|
}
|
|
@@ -128048,18 +128446,18 @@ function cleanupConvertedImage(filePath) {
|
|
|
128048
128446
|
}
|
|
128049
128447
|
}
|
|
128050
128448
|
function convertBase64ImageToJpeg(base64Data, mimeType) {
|
|
128051
|
-
const tempDir = mkdtempSync(
|
|
128449
|
+
const tempDir = mkdtempSync(join116(tmpdir7(), "opencode-b64-"));
|
|
128052
128450
|
const inputExt = mimeType.split("/")[1] || "bin";
|
|
128053
|
-
const inputPath =
|
|
128451
|
+
const inputPath = join116(tempDir, `input.${inputExt}`);
|
|
128054
128452
|
const tempFiles = [inputPath];
|
|
128055
128453
|
try {
|
|
128056
128454
|
const cleanBase64 = base64Data.replace(/^data:[^;]+;base64,/, "");
|
|
128057
128455
|
const buffer = Buffer.from(cleanBase64, "base64");
|
|
128058
|
-
|
|
128456
|
+
writeFileSync23(inputPath, buffer);
|
|
128059
128457
|
log2(`[image-converter] Converting Base64 ${mimeType} to JPEG`);
|
|
128060
128458
|
const outputPath = convertImageToJpeg(inputPath, mimeType);
|
|
128061
128459
|
tempFiles.push(outputPath);
|
|
128062
|
-
const convertedBuffer =
|
|
128460
|
+
const convertedBuffer = readFileSync61(outputPath);
|
|
128063
128461
|
const convertedBase64 = convertedBuffer.toString("base64");
|
|
128064
128462
|
log2(`[image-converter] Base64 conversion successful`);
|
|
128065
128463
|
return { base64: convertedBase64, tempFiles };
|
|
@@ -128089,7 +128487,7 @@ function getTemporaryConversionPath(error) {
|
|
|
128089
128487
|
function readJsonTextPart(filePath) {
|
|
128090
128488
|
let fileContent;
|
|
128091
128489
|
try {
|
|
128092
|
-
fileContent =
|
|
128490
|
+
fileContent = readFileSync62(filePath, "utf-8");
|
|
128093
128491
|
} catch (error) {
|
|
128094
128492
|
const code = error instanceof Error ? Reflect.get(error, "code") : undefined;
|
|
128095
128493
|
if (code === "ENOENT") {
|
|
@@ -132321,7 +132719,7 @@ function isExplicitSyncRun(runInBackground) {
|
|
|
132321
132719
|
return runInBackground === false || runInBackground === "false";
|
|
132322
132720
|
}
|
|
132323
132721
|
// packages/omo-opencode/src/tools/task/task-create.ts
|
|
132324
|
-
import { join as
|
|
132722
|
+
import { join as join118 } from "path";
|
|
132325
132723
|
|
|
132326
132724
|
// packages/omo-opencode/src/tools/task/types.ts
|
|
132327
132725
|
import { z as z54 } from "zod";
|
|
@@ -132376,8 +132774,8 @@ var TaskDeleteInputSchema = z54.object({
|
|
|
132376
132774
|
});
|
|
132377
132775
|
|
|
132378
132776
|
// packages/omo-opencode/src/features/claude-tasks/storage.ts
|
|
132379
|
-
import { join as
|
|
132380
|
-
import { existsSync as
|
|
132777
|
+
import { join as join117, dirname as dirname42, basename as basename18, isAbsolute as isAbsolute17 } from "path";
|
|
132778
|
+
import { existsSync as existsSync96, mkdirSync as mkdirSync21, readFileSync as readFileSync63, writeFileSync as writeFileSync24, renameSync as renameSync8, unlinkSync as unlinkSync17, readdirSync as readdirSync26 } from "fs";
|
|
132381
132779
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
132382
132780
|
function ignoreClaudeTaskStorageError(error) {
|
|
132383
132781
|
if (error instanceof Error)
|
|
@@ -132388,11 +132786,11 @@ function getTaskDir(config = {}) {
|
|
|
132388
132786
|
const tasksConfig = config.sisyphus?.tasks;
|
|
132389
132787
|
const storagePath = tasksConfig?.storage_path;
|
|
132390
132788
|
if (storagePath) {
|
|
132391
|
-
return isAbsolute17(storagePath) ? storagePath :
|
|
132789
|
+
return isAbsolute17(storagePath) ? storagePath : join117(process.cwd(), storagePath);
|
|
132392
132790
|
}
|
|
132393
132791
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
132394
132792
|
const listId = resolveTaskListId(config);
|
|
132395
|
-
return
|
|
132793
|
+
return join117(configDir, "tasks", listId);
|
|
132396
132794
|
}
|
|
132397
132795
|
function sanitizePathSegment(value) {
|
|
132398
132796
|
return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
|
|
@@ -132410,16 +132808,16 @@ function resolveTaskListId(config = {}) {
|
|
|
132410
132808
|
return sanitizePathSegment(basename18(process.cwd()));
|
|
132411
132809
|
}
|
|
132412
132810
|
function ensureDir(dirPath) {
|
|
132413
|
-
if (!
|
|
132414
|
-
|
|
132811
|
+
if (!existsSync96(dirPath)) {
|
|
132812
|
+
mkdirSync21(dirPath, { recursive: true });
|
|
132415
132813
|
}
|
|
132416
132814
|
}
|
|
132417
132815
|
function readJsonSafe(filePath, schema) {
|
|
132418
132816
|
try {
|
|
132419
|
-
if (!
|
|
132817
|
+
if (!existsSync96(filePath)) {
|
|
132420
132818
|
return null;
|
|
132421
132819
|
}
|
|
132422
|
-
const content =
|
|
132820
|
+
const content = readFileSync63(filePath, "utf-8");
|
|
132423
132821
|
const parsed = JSON.parse(content);
|
|
132424
132822
|
const result = schema.safeParse(parsed);
|
|
132425
132823
|
if (!result.success) {
|
|
@@ -132436,12 +132834,12 @@ function writeJsonAtomic(filePath, data) {
|
|
|
132436
132834
|
ensureDir(dir);
|
|
132437
132835
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
132438
132836
|
try {
|
|
132439
|
-
|
|
132837
|
+
writeFileSync24(tempPath, JSON.stringify(data, null, 2), "utf-8");
|
|
132440
132838
|
renameSync8(tempPath, filePath);
|
|
132441
132839
|
} catch (error) {
|
|
132442
132840
|
try {
|
|
132443
|
-
if (
|
|
132444
|
-
|
|
132841
|
+
if (existsSync96(tempPath)) {
|
|
132842
|
+
unlinkSync17(tempPath);
|
|
132445
132843
|
}
|
|
132446
132844
|
} catch (cleanupError) {
|
|
132447
132845
|
ignoreClaudeTaskStorageError(cleanupError);
|
|
@@ -132471,12 +132869,12 @@ function generateTaskId() {
|
|
|
132471
132869
|
return `T-${randomUUID9()}`;
|
|
132472
132870
|
}
|
|
132473
132871
|
async function acquireLock2(dirPath, options = {}) {
|
|
132474
|
-
const lockPath =
|
|
132872
|
+
const lockPath = join117(dirPath, ".lock");
|
|
132475
132873
|
const lockId = randomUUID9();
|
|
132476
132874
|
const waitTimeoutMs = options.waitTimeoutMs ?? resolveLockWaitTimeoutMs();
|
|
132477
132875
|
const baseRetryDelayMs = options.retryDelayMs ?? DEFAULT_LOCK_RETRY_DELAY_MS;
|
|
132478
132876
|
const createLock = (timestamp) => {
|
|
132479
|
-
|
|
132877
|
+
writeFileSync24(lockPath, JSON.stringify({ id: lockId, timestamp }), {
|
|
132480
132878
|
encoding: "utf-8",
|
|
132481
132879
|
flag: "wx"
|
|
132482
132880
|
});
|
|
@@ -132494,7 +132892,7 @@ async function acquireLock2(dirPath, options = {}) {
|
|
|
132494
132892
|
const reclaimStaleLock = () => {
|
|
132495
132893
|
let snapshot;
|
|
132496
132894
|
try {
|
|
132497
|
-
snapshot =
|
|
132895
|
+
snapshot = readFileSync63(lockPath, "utf-8");
|
|
132498
132896
|
} catch (error) {
|
|
132499
132897
|
ignoreClaudeTaskStorageError(error);
|
|
132500
132898
|
return true;
|
|
@@ -132502,9 +132900,9 @@ async function acquireLock2(dirPath, options = {}) {
|
|
|
132502
132900
|
if (!isStale(snapshot))
|
|
132503
132901
|
return false;
|
|
132504
132902
|
try {
|
|
132505
|
-
if (
|
|
132903
|
+
if (readFileSync63(lockPath, "utf-8") !== snapshot)
|
|
132506
132904
|
return false;
|
|
132507
|
-
|
|
132905
|
+
unlinkSync17(lockPath);
|
|
132508
132906
|
} catch (error) {
|
|
132509
132907
|
ignoreClaudeTaskStorageError(error);
|
|
132510
132908
|
}
|
|
@@ -132554,13 +132952,13 @@ async function acquireLock2(dirPath, options = {}) {
|
|
|
132554
132952
|
acquired: true,
|
|
132555
132953
|
release: () => {
|
|
132556
132954
|
try {
|
|
132557
|
-
if (!
|
|
132955
|
+
if (!existsSync96(lockPath))
|
|
132558
132956
|
return;
|
|
132559
|
-
const lockContent =
|
|
132957
|
+
const lockContent = readFileSync63(lockPath, "utf-8");
|
|
132560
132958
|
const lockData = JSON.parse(lockContent);
|
|
132561
132959
|
if (lockData.id !== lockId)
|
|
132562
132960
|
return;
|
|
132563
|
-
|
|
132961
|
+
unlinkSync17(lockPath);
|
|
132564
132962
|
} catch (error) {
|
|
132565
132963
|
ignoreClaudeTaskStorageError(error);
|
|
132566
132964
|
}
|
|
@@ -132722,7 +133120,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
132722
133120
|
threadID: context.sessionID
|
|
132723
133121
|
};
|
|
132724
133122
|
validatedTask = TaskObjectSchema.parse(task);
|
|
132725
|
-
writeJsonAtomic(
|
|
133123
|
+
writeJsonAtomic(join118(taskDir, `${taskId}.json`), validatedTask);
|
|
132726
133124
|
} finally {
|
|
132727
133125
|
lock.release();
|
|
132728
133126
|
}
|
|
@@ -132744,7 +133142,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
132744
133142
|
}
|
|
132745
133143
|
}
|
|
132746
133144
|
// packages/omo-opencode/src/tools/task/task-get.ts
|
|
132747
|
-
import { join as
|
|
133145
|
+
import { join as join119 } from "path";
|
|
132748
133146
|
var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
|
|
132749
133147
|
function parseTaskId(id) {
|
|
132750
133148
|
if (!TASK_ID_PATTERN.test(id))
|
|
@@ -132769,7 +133167,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
132769
133167
|
return JSON.stringify({ error: "invalid_task_id" });
|
|
132770
133168
|
}
|
|
132771
133169
|
const taskDir = getTaskDir(config);
|
|
132772
|
-
const taskPath =
|
|
133170
|
+
const taskPath = join119(taskDir, `${taskId}.json`);
|
|
132773
133171
|
const task = readJsonSafe(taskPath, TaskObjectSchema);
|
|
132774
133172
|
return JSON.stringify({ task: task ?? null });
|
|
132775
133173
|
} catch (error) {
|
|
@@ -132782,8 +133180,8 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
132782
133180
|
});
|
|
132783
133181
|
}
|
|
132784
133182
|
// packages/omo-opencode/src/tools/task/task-list.ts
|
|
132785
|
-
import { join as
|
|
132786
|
-
import { existsSync as
|
|
133183
|
+
import { join as join120 } from "path";
|
|
133184
|
+
import { existsSync as existsSync97, readdirSync as readdirSync27 } from "fs";
|
|
132787
133185
|
function createTaskList(config) {
|
|
132788
133186
|
return tool({
|
|
132789
133187
|
description: `List all active tasks with summary information.
|
|
@@ -132794,7 +133192,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
132794
133192
|
args: {},
|
|
132795
133193
|
execute: async () => {
|
|
132796
133194
|
const taskDir = getTaskDir(config);
|
|
132797
|
-
if (!
|
|
133195
|
+
if (!existsSync97(taskDir)) {
|
|
132798
133196
|
return JSON.stringify({ tasks: [] });
|
|
132799
133197
|
}
|
|
132800
133198
|
const files = readdirSync27(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
|
|
@@ -132803,7 +133201,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
132803
133201
|
}
|
|
132804
133202
|
const allTasks = [];
|
|
132805
133203
|
for (const fileId of files) {
|
|
132806
|
-
const task = readJsonSafe(
|
|
133204
|
+
const task = readJsonSafe(join120(taskDir, `${fileId}.json`), TaskObjectSchema);
|
|
132807
133205
|
if (task) {
|
|
132808
133206
|
allTasks.push(task);
|
|
132809
133207
|
}
|
|
@@ -132831,7 +133229,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
132831
133229
|
});
|
|
132832
133230
|
}
|
|
132833
133231
|
// packages/omo-opencode/src/tools/task/task-update.ts
|
|
132834
|
-
import { join as
|
|
133232
|
+
import { join as join121 } from "path";
|
|
132835
133233
|
var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
|
|
132836
133234
|
function parseTaskId2(id) {
|
|
132837
133235
|
if (!TASK_ID_PATTERN2.test(id))
|
|
@@ -132918,7 +133316,7 @@ async function handleUpdate(args, config, ctx, context) {
|
|
|
132918
133316
|
}
|
|
132919
133317
|
let updatedTask = null;
|
|
132920
133318
|
try {
|
|
132921
|
-
updatedTask = applyTaskUpdate(
|
|
133319
|
+
updatedTask = applyTaskUpdate(join121(taskDir, `${taskId}.json`), validatedArgs);
|
|
132922
133320
|
} finally {
|
|
132923
133321
|
lock.release();
|
|
132924
133322
|
}
|
|
@@ -134056,6 +134454,7 @@ function createSessionHooks(args) {
|
|
|
134056
134454
|
pluginConfig
|
|
134057
134455
|
})) : null;
|
|
134058
134456
|
const legacyPluginToast = isHookEnabled("legacy-plugin-toast") ? safeHook("legacy-plugin-toast", () => createLegacyPluginToastHook(ctx)) : null;
|
|
134457
|
+
const nativeEditionNudge = isHookEnabled("native-edition-nudge") ? safeHook("native-edition-nudge", () => createNativeEditionNudgeHook(ctx)) : null;
|
|
134059
134458
|
return {
|
|
134060
134459
|
preemptiveCompaction,
|
|
134061
134460
|
sessionNotification,
|
|
@@ -134079,7 +134478,8 @@ function createSessionHooks(args) {
|
|
|
134079
134478
|
questionLabelTruncator,
|
|
134080
134479
|
taskResumeInfo,
|
|
134081
134480
|
runtimeFallback,
|
|
134082
|
-
legacyPluginToast
|
|
134481
|
+
legacyPluginToast,
|
|
134482
|
+
nativeEditionNudge
|
|
134083
134483
|
};
|
|
134084
134484
|
}
|
|
134085
134485
|
|
|
@@ -134790,7 +135190,7 @@ function createHooks(args) {
|
|
|
134790
135190
|
};
|
|
134791
135191
|
}
|
|
134792
135192
|
// packages/omo-opencode/src/features/background-agent/manager.ts
|
|
134793
|
-
import { join as
|
|
135193
|
+
import { join as join123 } from "path";
|
|
134794
135194
|
|
|
134795
135195
|
// packages/omo-opencode/src/features/background-agent/abort-with-timeout.ts
|
|
134796
135196
|
function getAbortResponseError(response) {
|
|
@@ -135077,8 +135477,8 @@ function writeBackgroundTaskMarker(input) {
|
|
|
135077
135477
|
}
|
|
135078
135478
|
|
|
135079
135479
|
// packages/omo-opencode/src/features/background-agent/compaction-aware-message-resolver.ts
|
|
135080
|
-
import { readdirSync as readdirSync28, readFileSync as
|
|
135081
|
-
import { join as
|
|
135480
|
+
import { readdirSync as readdirSync28, readFileSync as readFileSync64 } from "fs";
|
|
135481
|
+
import { join as join122 } from "path";
|
|
135082
135482
|
function hasFullAgentAndModel(message) {
|
|
135083
135483
|
return !!message.agent && !isCompactionAgent(message.agent) && !!message.model?.providerID && !!message.model?.modelID;
|
|
135084
135484
|
}
|
|
@@ -135162,7 +135562,7 @@ function findNearestMessageExcludingCompaction(messageDir, sessionID) {
|
|
|
135162
135562
|
const messages = [];
|
|
135163
135563
|
for (const file of files) {
|
|
135164
135564
|
try {
|
|
135165
|
-
const content =
|
|
135565
|
+
const content = readFileSync64(join122(messageDir, file), "utf-8");
|
|
135166
135566
|
const parsed = JSON.parse(content);
|
|
135167
135567
|
if (hasCompactionPartInStorage(parsed.id) || isCompactionAgent(parsed.agent)) {
|
|
135168
135568
|
continue;
|
|
@@ -139960,7 +140360,7 @@ The task was re-queued on a fallback model after a retryable failure.
|
|
|
139960
140360
|
parentSessionID: task.parentSessionId
|
|
139961
140361
|
});
|
|
139962
140362
|
}
|
|
139963
|
-
const messageDir =
|
|
140363
|
+
const messageDir = join123(MESSAGE_STORAGE, task.parentSessionId);
|
|
139964
140364
|
const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir, task.parentSessionId) : null;
|
|
139965
140365
|
agent = currentMessage?.agent ?? task.parentAgent;
|
|
139966
140366
|
model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
|
|
@@ -141639,23 +142039,23 @@ function createMonitorManager(options) {
|
|
|
141639
142039
|
import { createHash as createHash4 } from "crypto";
|
|
141640
142040
|
import {
|
|
141641
142041
|
chmodSync as chmodSync4,
|
|
141642
|
-
existsSync as
|
|
141643
|
-
mkdirSync as
|
|
142042
|
+
existsSync as existsSync100,
|
|
142043
|
+
mkdirSync as mkdirSync22,
|
|
141644
142044
|
readdirSync as readdirSync29,
|
|
141645
|
-
readFileSync as
|
|
142045
|
+
readFileSync as readFileSync66,
|
|
141646
142046
|
renameSync as renameSync10,
|
|
141647
|
-
unlinkSync as
|
|
141648
|
-
writeFileSync as
|
|
142047
|
+
unlinkSync as unlinkSync18,
|
|
142048
|
+
writeFileSync as writeFileSync26
|
|
141649
142049
|
} from "fs";
|
|
141650
|
-
import { basename as basename19, dirname as dirname43, join as
|
|
142050
|
+
import { basename as basename19, dirname as dirname43, join as join126 } from "path";
|
|
141651
142051
|
|
|
141652
142052
|
// packages/mcp-client-core/src/config-dir.ts
|
|
141653
|
-
import { existsSync as
|
|
141654
|
-
import { homedir as
|
|
141655
|
-
import { join as
|
|
142053
|
+
import { existsSync as existsSync98, realpathSync as realpathSync18 } from "fs";
|
|
142054
|
+
import { homedir as homedir25 } from "os";
|
|
142055
|
+
import { join as join124, resolve as resolve32 } from "path";
|
|
141656
142056
|
function resolveConfigPath4(pathValue) {
|
|
141657
142057
|
const resolvedPath = resolve32(pathValue);
|
|
141658
|
-
if (!
|
|
142058
|
+
if (!existsSync98(resolvedPath))
|
|
141659
142059
|
return resolvedPath;
|
|
141660
142060
|
try {
|
|
141661
142061
|
return realpathSync18(resolvedPath);
|
|
@@ -141670,13 +142070,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
141670
142070
|
if (customConfigDir) {
|
|
141671
142071
|
return resolveConfigPath4(customConfigDir);
|
|
141672
142072
|
}
|
|
141673
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
141674
|
-
return resolveConfigPath4(
|
|
142073
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join124(homedir25(), ".config");
|
|
142074
|
+
return resolveConfigPath4(join124(xdgConfigDir, "opencode"));
|
|
141675
142075
|
}
|
|
141676
142076
|
|
|
141677
142077
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
141678
|
-
import { chmodSync as chmodSync3, existsSync as
|
|
141679
|
-
import { join as
|
|
142078
|
+
import { chmodSync as chmodSync3, existsSync as existsSync99, readFileSync as readFileSync65, renameSync as renameSync9, writeFileSync as writeFileSync25 } from "fs";
|
|
142079
|
+
import { join as join125 } from "path";
|
|
141680
142080
|
var INDEX_FILE_NAME = "index.json";
|
|
141681
142081
|
function isTokenIndex(value) {
|
|
141682
142082
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -141684,14 +142084,14 @@ function isTokenIndex(value) {
|
|
|
141684
142084
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
141685
142085
|
}
|
|
141686
142086
|
function getIndexPath(storageDir) {
|
|
141687
|
-
return
|
|
142087
|
+
return join125(storageDir, INDEX_FILE_NAME);
|
|
141688
142088
|
}
|
|
141689
142089
|
function readTokenIndex(storageDir) {
|
|
141690
142090
|
const indexPath = getIndexPath(storageDir);
|
|
141691
|
-
if (!
|
|
142091
|
+
if (!existsSync99(indexPath))
|
|
141692
142092
|
return {};
|
|
141693
142093
|
try {
|
|
141694
|
-
const parsed = JSON.parse(
|
|
142094
|
+
const parsed = JSON.parse(readFileSync65(indexPath, "utf-8"));
|
|
141695
142095
|
return isTokenIndex(parsed) ? parsed : {};
|
|
141696
142096
|
} catch (readError) {
|
|
141697
142097
|
if (!(readError instanceof Error))
|
|
@@ -141703,7 +142103,7 @@ function writeTokenIndex(storageDir, index) {
|
|
|
141703
142103
|
try {
|
|
141704
142104
|
const indexPath = getIndexPath(storageDir);
|
|
141705
142105
|
const tempPath = `${indexPath}.tmp.${Date.now()}`;
|
|
141706
|
-
|
|
142106
|
+
writeFileSync25(tempPath, JSON.stringify(index, null, 2), { encoding: "utf-8", mode: 384 });
|
|
141707
142107
|
chmodSync3(tempPath, 384);
|
|
141708
142108
|
renameSync9(tempPath, indexPath);
|
|
141709
142109
|
return true;
|
|
@@ -141721,16 +142121,16 @@ function saveTokenIndexEntry(storageDir, hash, key) {
|
|
|
141721
142121
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
141722
142122
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
141723
142123
|
function getMcpOauthStorageDir() {
|
|
141724
|
-
return
|
|
142124
|
+
return join126(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
141725
142125
|
}
|
|
141726
142126
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
141727
142127
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
141728
142128
|
}
|
|
141729
142129
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
141730
|
-
return
|
|
142130
|
+
return join126(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
141731
142131
|
}
|
|
141732
142132
|
function getLegacyStoragePath() {
|
|
141733
|
-
return
|
|
142133
|
+
return join126(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
141734
142134
|
}
|
|
141735
142135
|
function normalizeHost(serverHost) {
|
|
141736
142136
|
let host = serverHost.trim();
|
|
@@ -141791,10 +142191,10 @@ function isOAuthTokenData(value) {
|
|
|
141791
142191
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
141792
142192
|
}
|
|
141793
142193
|
function readTokenFile(filePath) {
|
|
141794
|
-
if (!
|
|
142194
|
+
if (!existsSync100(filePath))
|
|
141795
142195
|
return null;
|
|
141796
142196
|
try {
|
|
141797
|
-
const parsed = JSON.parse(
|
|
142197
|
+
const parsed = JSON.parse(readFileSync66(filePath, "utf-8"));
|
|
141798
142198
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
141799
142199
|
} catch (readError) {
|
|
141800
142200
|
if (!(readError instanceof Error))
|
|
@@ -141804,10 +142204,10 @@ function readTokenFile(filePath) {
|
|
|
141804
142204
|
}
|
|
141805
142205
|
function readLegacyStore() {
|
|
141806
142206
|
const filePath = getLegacyStoragePath();
|
|
141807
|
-
if (!
|
|
142207
|
+
if (!existsSync100(filePath))
|
|
141808
142208
|
return null;
|
|
141809
142209
|
try {
|
|
141810
|
-
const parsed = JSON.parse(
|
|
142210
|
+
const parsed = JSON.parse(readFileSync66(filePath, "utf-8"));
|
|
141811
142211
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
141812
142212
|
return null;
|
|
141813
142213
|
const result = {};
|
|
@@ -141825,11 +142225,11 @@ function readLegacyStore() {
|
|
|
141825
142225
|
function writeTokenFile(filePath, token) {
|
|
141826
142226
|
try {
|
|
141827
142227
|
const dir = dirname43(filePath);
|
|
141828
|
-
if (!
|
|
141829
|
-
|
|
142228
|
+
if (!existsSync100(dir)) {
|
|
142229
|
+
mkdirSync22(dir, { recursive: true });
|
|
141830
142230
|
}
|
|
141831
142231
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
141832
|
-
|
|
142232
|
+
writeFileSync26(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
141833
142233
|
chmodSync4(tempPath, 384);
|
|
141834
142234
|
renameSync10(tempPath, filePath);
|
|
141835
142235
|
return true;
|
|
@@ -147307,16 +147707,16 @@ var WRITE_DEBOUNCE_MS = 250;
|
|
|
147307
147707
|
init_logger2();
|
|
147308
147708
|
|
|
147309
147709
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-io.ts
|
|
147310
|
-
import { mkdirSync as
|
|
147710
|
+
import { mkdirSync as mkdirSync23, readFileSync as readFileSync67 } from "fs";
|
|
147311
147711
|
import { dirname as dirname44 } from "path";
|
|
147312
147712
|
|
|
147313
147713
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-path.ts
|
|
147314
147714
|
import { createHash as createHash6 } from "crypto";
|
|
147315
147715
|
import { realpathSync as realpathSync19 } from "fs";
|
|
147316
|
-
import { homedir as
|
|
147317
|
-
import { join as
|
|
147716
|
+
import { homedir as homedir26 } from "os";
|
|
147717
|
+
import { join as join127, resolve as resolve33 } from "path";
|
|
147318
147718
|
function mirrorStorageDir() {
|
|
147319
|
-
return
|
|
147719
|
+
return join127(process.env.XDG_DATA_HOME ?? join127(homedir26(), ".local", "share"), "opencode", "storage", "oh-my-openagent", MIRROR_DIR_NAME);
|
|
147320
147720
|
}
|
|
147321
147721
|
function canonicalProjectDir(projectDir) {
|
|
147322
147722
|
try {
|
|
@@ -147330,7 +147730,7 @@ function canonicalProjectDir(projectDir) {
|
|
|
147330
147730
|
}
|
|
147331
147731
|
function mirrorFilePath(projectDir) {
|
|
147332
147732
|
const projectHash = createHash6("sha1").update(canonicalProjectDir(projectDir)).digest("hex").slice(0, 16);
|
|
147333
|
-
return
|
|
147733
|
+
return join127(mirrorStorageDir(), `${projectHash}.json`);
|
|
147334
147734
|
}
|
|
147335
147735
|
|
|
147336
147736
|
// packages/omo-opencode/src/features/tui-sidebar/snapshot-schema.ts
|
|
@@ -147383,13 +147783,13 @@ var TuiRuntimeSnapshotSchema = z58.object({
|
|
|
147383
147783
|
function writeMirror(projectDir, snapshot) {
|
|
147384
147784
|
const filePath = mirrorFilePath(projectDir);
|
|
147385
147785
|
const content = JSON.stringify(snapshot);
|
|
147386
|
-
|
|
147786
|
+
mkdirSync23(dirname44(filePath), { recursive: true });
|
|
147387
147787
|
writeFileAtomically2(filePath, content, { mode: 384 });
|
|
147388
147788
|
}
|
|
147389
147789
|
|
|
147390
147790
|
// packages/omo-opencode/src/features/tui-sidebar/loop-reader.ts
|
|
147391
|
-
import { readdirSync as readdirSync30, readFileSync as
|
|
147392
|
-
import { join as
|
|
147791
|
+
import { readdirSync as readdirSync30, readFileSync as readFileSync68, statSync as statSync14 } from "fs";
|
|
147792
|
+
import { join as join128 } from "path";
|
|
147393
147793
|
import { z as z59 } from "zod";
|
|
147394
147794
|
var CriterionSchema = z59.object({
|
|
147395
147795
|
status: z59.string()
|
|
@@ -147419,7 +147819,7 @@ function enumerateCandidates(projectDir) {
|
|
|
147419
147819
|
return [...currentLoopCandidates(projectDir), legacyLoopCandidate(projectDir)].filter((candidate) => candidate !== null);
|
|
147420
147820
|
}
|
|
147421
147821
|
function currentLoopCandidates(projectDir) {
|
|
147422
|
-
const loopRoot =
|
|
147822
|
+
const loopRoot = join128(projectDir, ".omo", "ulw-loop");
|
|
147423
147823
|
let entries;
|
|
147424
147824
|
try {
|
|
147425
147825
|
entries = readdirSync30(loopRoot, { withFileTypes: true });
|
|
@@ -147429,10 +147829,10 @@ function currentLoopCandidates(projectDir) {
|
|
|
147429
147829
|
}
|
|
147430
147830
|
throw error;
|
|
147431
147831
|
}
|
|
147432
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(
|
|
147832
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(join128(loopRoot, entry.name, "goals.json"))).filter((candidate) => candidate !== null);
|
|
147433
147833
|
}
|
|
147434
147834
|
function legacyLoopCandidate(projectDir) {
|
|
147435
|
-
return statCandidate(
|
|
147835
|
+
return statCandidate(join128(projectDir, ".omo", "loop", "goals.json"));
|
|
147436
147836
|
}
|
|
147437
147837
|
function statCandidate(path) {
|
|
147438
147838
|
try {
|
|
@@ -147457,7 +147857,7 @@ function readLiveCandidate(candidate) {
|
|
|
147457
147857
|
function readParsedLoop(path) {
|
|
147458
147858
|
let raw;
|
|
147459
147859
|
try {
|
|
147460
|
-
raw = JSON.parse(
|
|
147860
|
+
raw = JSON.parse(readFileSync68(path, "utf8"));
|
|
147461
147861
|
} catch (error) {
|
|
147462
147862
|
if (error instanceof Error) {
|
|
147463
147863
|
return null;
|
|
@@ -150217,40 +150617,40 @@ async function isTmuxAvailableWithDeps(deps) {
|
|
|
150217
150617
|
import {
|
|
150218
150618
|
appendFileSync as appendFileSync6,
|
|
150219
150619
|
chmodSync as chmodSync5,
|
|
150220
|
-
existsSync as
|
|
150620
|
+
existsSync as existsSync102,
|
|
150221
150621
|
renameSync as renameSync11,
|
|
150222
150622
|
statSync as statSync15,
|
|
150223
|
-
unlinkSync as
|
|
150224
|
-
writeFileSync as
|
|
150623
|
+
unlinkSync as unlinkSync19,
|
|
150624
|
+
writeFileSync as writeFileSync27
|
|
150225
150625
|
} from "fs";
|
|
150226
150626
|
|
|
150227
150627
|
// packages/openclaw-core/src/reply-listener-paths.ts
|
|
150228
|
-
import { existsSync as
|
|
150229
|
-
import { homedir as
|
|
150230
|
-
import { join as
|
|
150628
|
+
import { existsSync as existsSync101, mkdirSync as mkdirSync24 } from "fs";
|
|
150629
|
+
import { homedir as homedir27 } from "os";
|
|
150630
|
+
import { join as join129 } from "path";
|
|
150231
150631
|
var REPLY_LISTENER_SECURE_FILE_MODE = 384;
|
|
150232
150632
|
function resolveReplyListenerHomeDir() {
|
|
150233
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
150633
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir27();
|
|
150234
150634
|
}
|
|
150235
150635
|
function getReplyListenerStateDir() {
|
|
150236
|
-
return
|
|
150636
|
+
return join129(resolveReplyListenerHomeDir(), ".omo", "openclaw", "state");
|
|
150237
150637
|
}
|
|
150238
150638
|
function getReplyListenerPidFilePath() {
|
|
150239
|
-
return
|
|
150639
|
+
return join129(getReplyListenerStateDir(), "reply-listener.pid");
|
|
150240
150640
|
}
|
|
150241
150641
|
function getReplyListenerStateFilePath() {
|
|
150242
|
-
return
|
|
150642
|
+
return join129(getReplyListenerStateDir(), "reply-listener-state.json");
|
|
150243
150643
|
}
|
|
150244
150644
|
function getReplyListenerConfigFilePath() {
|
|
150245
|
-
return
|
|
150645
|
+
return join129(getReplyListenerStateDir(), "reply-listener-config.json");
|
|
150246
150646
|
}
|
|
150247
150647
|
function getReplyListenerLogFilePath() {
|
|
150248
|
-
return
|
|
150648
|
+
return join129(getReplyListenerStateDir(), "reply-listener.log");
|
|
150249
150649
|
}
|
|
150250
150650
|
function ensureReplyListenerStateDir() {
|
|
150251
150651
|
const stateDir = getReplyListenerStateDir();
|
|
150252
|
-
if (!
|
|
150253
|
-
|
|
150652
|
+
if (!existsSync101(stateDir)) {
|
|
150653
|
+
mkdirSync24(stateDir, { recursive: true, mode: 448 });
|
|
150254
150654
|
}
|
|
150255
150655
|
}
|
|
150256
150656
|
|
|
@@ -150263,7 +150663,7 @@ function ignoreReplyListenerLogError(error) {
|
|
|
150263
150663
|
}
|
|
150264
150664
|
function writeSecureReplyListenerFile(filePath, content) {
|
|
150265
150665
|
ensureReplyListenerStateDir();
|
|
150266
|
-
|
|
150666
|
+
writeFileSync27(filePath, content, { mode: REPLY_LISTENER_SECURE_FILE_MODE });
|
|
150267
150667
|
try {
|
|
150268
150668
|
chmodSync5(filePath, REPLY_LISTENER_SECURE_FILE_MODE);
|
|
150269
150669
|
} catch (error) {
|
|
@@ -150272,14 +150672,14 @@ function writeSecureReplyListenerFile(filePath, content) {
|
|
|
150272
150672
|
}
|
|
150273
150673
|
function rotateReplyListenerLogIfNeeded(logPath) {
|
|
150274
150674
|
try {
|
|
150275
|
-
if (!
|
|
150675
|
+
if (!existsSync102(logPath))
|
|
150276
150676
|
return;
|
|
150277
150677
|
const stats = statSync15(logPath);
|
|
150278
150678
|
if (stats.size <= MAX_REPLY_LISTENER_LOG_SIZE_BYTES)
|
|
150279
150679
|
return;
|
|
150280
150680
|
const backupPath = `${logPath}.old`;
|
|
150281
|
-
if (
|
|
150282
|
-
|
|
150681
|
+
if (existsSync102(backupPath)) {
|
|
150682
|
+
unlinkSync19(backupPath);
|
|
150283
150683
|
}
|
|
150284
150684
|
renameSync11(logPath, backupPath);
|
|
150285
150685
|
} catch (error) {
|
|
@@ -150305,7 +150705,7 @@ import { constants as constants24, closeSync as closeSync5, openSync as openSync
|
|
|
150305
150705
|
|
|
150306
150706
|
// packages/openclaw-core/src/session-registry-paths.ts
|
|
150307
150707
|
init_src();
|
|
150308
|
-
import { join as
|
|
150708
|
+
import { join as join130 } from "path";
|
|
150309
150709
|
var SECURE_FILE_MODE = 384;
|
|
150310
150710
|
var MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
150311
150711
|
var LOCK_TIMEOUT_MS = 2000;
|
|
@@ -150316,16 +150716,16 @@ var cachedRegistryPaths = null;
|
|
|
150316
150716
|
function resolveRegistryPaths() {
|
|
150317
150717
|
if (cachedRegistryPaths !== null)
|
|
150318
150718
|
return cachedRegistryPaths;
|
|
150319
|
-
const openClawStorageDir =
|
|
150719
|
+
const openClawStorageDir = join130(getOpenCodeStorageDir2(), "openclaw");
|
|
150320
150720
|
cachedRegistryPaths = {
|
|
150321
150721
|
openClawStorageDir,
|
|
150322
|
-
registryPath:
|
|
150323
|
-
registryLockPath:
|
|
150722
|
+
registryPath: join130(openClawStorageDir, "reply-session-registry.jsonl"),
|
|
150723
|
+
registryLockPath: join130(openClawStorageDir, "reply-session-registry.lock")
|
|
150324
150724
|
};
|
|
150325
150725
|
return cachedRegistryPaths;
|
|
150326
150726
|
}
|
|
150327
150727
|
function getOpenCodeStorageDir2() {
|
|
150328
|
-
return
|
|
150728
|
+
return join130(resolveXdgDataDir("opencode"), "opencode", "storage");
|
|
150329
150729
|
}
|
|
150330
150730
|
function getRegistryPath() {
|
|
150331
150731
|
return resolveRegistryPaths().registryPath;
|
|
@@ -150335,11 +150735,11 @@ function getRegistryLockPath() {
|
|
|
150335
150735
|
}
|
|
150336
150736
|
|
|
150337
150737
|
// packages/openclaw-core/src/session-registry-lock.ts
|
|
150338
|
-
import { constants as constants23, closeSync as closeSync4, existsSync as
|
|
150738
|
+
import { constants as constants23, closeSync as closeSync4, existsSync as existsSync104, openSync as openSync4, readFileSync as readFileSync70, statSync as statSync16, unlinkSync as unlinkSync20, writeSync } from "fs";
|
|
150339
150739
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
150340
150740
|
|
|
150341
150741
|
// packages/openclaw-core/src/session-registry-storage.ts
|
|
150342
|
-
import { existsSync as
|
|
150742
|
+
import { existsSync as existsSync103, mkdirSync as mkdirSync25, readFileSync as readFileSync69, writeFileSync as writeFileSync28 } from "fs";
|
|
150343
150743
|
import { dirname as dirname45 } from "path";
|
|
150344
150744
|
function isSessionMapping(value) {
|
|
150345
150745
|
if (typeof value !== "object" || value === null)
|
|
@@ -150362,16 +150762,16 @@ function isSessionMapping(value) {
|
|
|
150362
150762
|
}
|
|
150363
150763
|
function ensureRegistryDir() {
|
|
150364
150764
|
const registryDir = dirname45(getRegistryPath());
|
|
150365
|
-
if (!
|
|
150366
|
-
|
|
150765
|
+
if (!existsSync103(registryDir)) {
|
|
150766
|
+
mkdirSync25(registryDir, { recursive: true, mode: 448 });
|
|
150367
150767
|
}
|
|
150368
150768
|
}
|
|
150369
150769
|
function readAllMappingsUnsafe() {
|
|
150370
150770
|
const registryPath = getRegistryPath();
|
|
150371
|
-
if (!
|
|
150771
|
+
if (!existsSync103(registryPath))
|
|
150372
150772
|
return [];
|
|
150373
150773
|
try {
|
|
150374
|
-
const content =
|
|
150774
|
+
const content = readFileSync69(registryPath, "utf-8");
|
|
150375
150775
|
return content.split(`
|
|
150376
150776
|
`).filter((line) => line.trim()).map((line) => {
|
|
150377
150777
|
try {
|
|
@@ -150393,13 +150793,13 @@ function rewriteRegistryUnsafe(mappings) {
|
|
|
150393
150793
|
ensureRegistryDir();
|
|
150394
150794
|
const registryPath = getRegistryPath();
|
|
150395
150795
|
if (mappings.length === 0) {
|
|
150396
|
-
|
|
150796
|
+
writeFileSync28(registryPath, "", { mode: SECURE_FILE_MODE });
|
|
150397
150797
|
return;
|
|
150398
150798
|
}
|
|
150399
150799
|
const content = mappings.map((mapping) => JSON.stringify(mapping)).join(`
|
|
150400
150800
|
`) + `
|
|
150401
150801
|
`;
|
|
150402
|
-
|
|
150802
|
+
writeFileSync28(registryPath, content, { mode: SECURE_FILE_MODE });
|
|
150403
150803
|
}
|
|
150404
150804
|
|
|
150405
150805
|
// packages/openclaw-core/src/session-registry-lock.ts
|
|
@@ -150422,9 +150822,9 @@ function isPidAlive2(pid) {
|
|
|
150422
150822
|
function readLockSnapshot() {
|
|
150423
150823
|
try {
|
|
150424
150824
|
const registryLockPath = getRegistryLockPath();
|
|
150425
|
-
if (!
|
|
150825
|
+
if (!existsSync104(registryLockPath))
|
|
150426
150826
|
return null;
|
|
150427
|
-
const raw =
|
|
150827
|
+
const raw = readFileSync70(registryLockPath, "utf-8");
|
|
150428
150828
|
const trimmed = raw.trim();
|
|
150429
150829
|
if (!trimmed)
|
|
150430
150830
|
return { raw, pid: null, token: null };
|
|
@@ -150453,12 +150853,12 @@ function readLockSnapshot() {
|
|
|
150453
150853
|
function removeLockIfUnchanged(snapshot) {
|
|
150454
150854
|
try {
|
|
150455
150855
|
const registryLockPath = getRegistryLockPath();
|
|
150456
|
-
if (!
|
|
150856
|
+
if (!existsSync104(registryLockPath))
|
|
150457
150857
|
return false;
|
|
150458
|
-
const currentRaw =
|
|
150858
|
+
const currentRaw = readFileSync70(registryLockPath, "utf-8");
|
|
150459
150859
|
if (currentRaw !== snapshot.raw)
|
|
150460
150860
|
return false;
|
|
150461
|
-
|
|
150861
|
+
unlinkSync20(registryLockPath);
|
|
150462
150862
|
return true;
|
|
150463
150863
|
} catch (error) {
|
|
150464
150864
|
if (error instanceof Error)
|
|
@@ -150476,7 +150876,7 @@ function closeLockFd(fd) {
|
|
|
150476
150876
|
}
|
|
150477
150877
|
function unlinkLockFile() {
|
|
150478
150878
|
try {
|
|
150479
|
-
|
|
150879
|
+
unlinkSync20(getRegistryLockPath());
|
|
150480
150880
|
} catch (error) {
|
|
150481
150881
|
if (error instanceof Error)
|
|
150482
150882
|
return;
|
|
@@ -150604,7 +151004,7 @@ function removeSession(sessionId) {
|
|
|
150604
151004
|
}
|
|
150605
151005
|
|
|
150606
151006
|
// packages/openclaw-core/src/reply-listener-state.ts
|
|
150607
|
-
import { existsSync as
|
|
151007
|
+
import { existsSync as existsSync105, readFileSync as readFileSync71, unlinkSync as unlinkSync21 } from "fs";
|
|
150608
151008
|
var REPLY_LISTENER_STARTUP_TOKEN_ENV = "OMO_OPENCLAW_REPLY_LISTENER_STARTUP_TOKEN";
|
|
150609
151009
|
function ignoreReplyListenerStateReadError(error) {
|
|
150610
151010
|
if (error instanceof Error)
|
|
@@ -150671,9 +151071,9 @@ function createPendingReplyListenerState(startupToken) {
|
|
|
150671
151071
|
function readReplyListenerDaemonState() {
|
|
150672
151072
|
try {
|
|
150673
151073
|
const stateFilePath = getReplyListenerStateFilePath();
|
|
150674
|
-
if (!
|
|
151074
|
+
if (!existsSync105(stateFilePath))
|
|
150675
151075
|
return null;
|
|
150676
|
-
return normalizeReplyListenerState(JSON.parse(
|
|
151076
|
+
return normalizeReplyListenerState(JSON.parse(readFileSync71(stateFilePath, "utf-8")));
|
|
150677
151077
|
} catch (error) {
|
|
150678
151078
|
ignoreReplyListenerStateReadError(error);
|
|
150679
151079
|
return null;
|
|
@@ -150689,9 +151089,9 @@ function writeReplyListenerDaemonState(state) {
|
|
|
150689
151089
|
function readReplyListenerDaemonConfig() {
|
|
150690
151090
|
try {
|
|
150691
151091
|
const configFilePath = getReplyListenerConfigFilePath();
|
|
150692
|
-
if (!
|
|
151092
|
+
if (!existsSync105(configFilePath))
|
|
150693
151093
|
return null;
|
|
150694
|
-
return JSON.parse(
|
|
151094
|
+
return JSON.parse(readFileSync71(configFilePath, "utf-8"));
|
|
150695
151095
|
} catch (error) {
|
|
150696
151096
|
ignoreReplyListenerStateReadError(error);
|
|
150697
151097
|
return null;
|
|
@@ -150703,9 +151103,9 @@ function writeReplyListenerDaemonConfig(config) {
|
|
|
150703
151103
|
function readReplyListenerPid() {
|
|
150704
151104
|
try {
|
|
150705
151105
|
const pidFilePath = getReplyListenerPidFilePath();
|
|
150706
|
-
if (!
|
|
151106
|
+
if (!existsSync105(pidFilePath))
|
|
150707
151107
|
return null;
|
|
150708
|
-
const pid = Number.parseInt(
|
|
151108
|
+
const pid = Number.parseInt(readFileSync71(pidFilePath, "utf-8").trim(), 10);
|
|
150709
151109
|
return Number.isNaN(pid) ? null : pid;
|
|
150710
151110
|
} catch (error) {
|
|
150711
151111
|
ignoreReplyListenerStateReadError(error);
|
|
@@ -150717,8 +151117,8 @@ function writeReplyListenerPid(pid) {
|
|
|
150717
151117
|
}
|
|
150718
151118
|
function removeReplyListenerPid() {
|
|
150719
151119
|
const pidFilePath = getReplyListenerPidFilePath();
|
|
150720
|
-
if (
|
|
150721
|
-
|
|
151120
|
+
if (existsSync105(pidFilePath)) {
|
|
151121
|
+
unlinkSync21(pidFilePath);
|
|
150722
151122
|
}
|
|
150723
151123
|
}
|
|
150724
151124
|
function markReplyListenerStopped(state, error) {
|
|
@@ -150745,7 +151145,7 @@ function getReplyListenerRuntimeSignature(config) {
|
|
|
150745
151145
|
// packages/openclaw-core/src/reply-listener-poll-loop.ts
|
|
150746
151146
|
var PRUNE_INTERVAL_MS = 60 * 60 * 1000;
|
|
150747
151147
|
// packages/openclaw-core/src/reply-listener-start.ts
|
|
150748
|
-
import { dirname as dirname46, join as
|
|
151148
|
+
import { dirname as dirname46, join as join132 } from "path";
|
|
150749
151149
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
150750
151150
|
|
|
150751
151151
|
// packages/openclaw-core/src/reply-listener-spawn.ts
|
|
@@ -150753,8 +151153,8 @@ init_runtime();
|
|
|
150753
151153
|
|
|
150754
151154
|
// packages/openclaw-core/src/reply-listener-process.ts
|
|
150755
151155
|
init_runtime();
|
|
150756
|
-
import { readFileSync as
|
|
150757
|
-
import { join as
|
|
151156
|
+
import { readFileSync as readFileSync72 } from "fs";
|
|
151157
|
+
import { join as join131 } from "path";
|
|
150758
151158
|
var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
|
|
150759
151159
|
var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
150760
151160
|
"PATH",
|
|
@@ -150790,7 +151190,7 @@ var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
|
150790
151190
|
];
|
|
150791
151191
|
async function windowsProcessCommandLineHasMarker(pid, deps) {
|
|
150792
151192
|
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT ?? "C:\\Windows";
|
|
150793
|
-
const powershell =
|
|
151193
|
+
const powershell = join131(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
150794
151194
|
const processInfo = deps.spawn([
|
|
150795
151195
|
powershell,
|
|
150796
151196
|
"-NoProfile",
|
|
@@ -150835,7 +151235,7 @@ async function isReplyListenerDaemonProcessWithDeps(pid, deps) {
|
|
|
150835
151235
|
try {
|
|
150836
151236
|
const platform = deps.platform ?? process.platform;
|
|
150837
151237
|
if (platform === "linux") {
|
|
150838
|
-
const readProcCmdline = deps.readProcCmdline ?? ((targetPid) =>
|
|
151238
|
+
const readProcCmdline = deps.readProcCmdline ?? ((targetPid) => readFileSync72(`/proc/${targetPid}/cmdline`, "utf-8"));
|
|
150839
151239
|
const cmdline = readProcCmdline(pid);
|
|
150840
151240
|
return cmdline.includes(REPLY_LISTENER_DAEMON_IDENTITY_MARKER);
|
|
150841
151241
|
}
|
|
@@ -151007,7 +151407,7 @@ function createStartFailureResult(message, state) {
|
|
|
151007
151407
|
}
|
|
151008
151408
|
function resolveReplyListenerDaemonScript(currentFileUrl) {
|
|
151009
151409
|
const currentFilePath = fileURLToPath7(currentFileUrl);
|
|
151010
|
-
return currentFilePath.endsWith(".ts") ?
|
|
151410
|
+
return currentFilePath.endsWith(".ts") ? join132(dirname46(currentFilePath), "daemon.ts") : join132(dirname46(currentFilePath), "daemon.js");
|
|
151011
151411
|
}
|
|
151012
151412
|
async function startReplyListener(config) {
|
|
151013
151413
|
const normalizedConfig = getNormalizedReplyListenerConfig(config);
|
|
@@ -151430,13 +151830,13 @@ async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
|
|
|
151430
151830
|
};
|
|
151431
151831
|
}
|
|
151432
151832
|
// packages/claude-code-compat-core/src/features/claude-code-mcp-loader/loader.ts
|
|
151433
|
-
import { existsSync as
|
|
151434
|
-
import { join as
|
|
151435
|
-
import { homedir as
|
|
151833
|
+
import { existsSync as existsSync106, readFileSync as readFileSync73 } from "fs";
|
|
151834
|
+
import { join as join133 } from "path";
|
|
151835
|
+
import { homedir as homedir28 } from "os";
|
|
151436
151836
|
function resolveMcpLoaderContext(options = {}) {
|
|
151437
151837
|
const cwd = options.cwd ?? process.cwd();
|
|
151438
151838
|
const homeDir = options.homeDir ?? getHomeDir();
|
|
151439
|
-
const claudeConfigDir = options.claudeConfigDir ?? (options.homeDir === undefined ? getClaudeConfigDir3() :
|
|
151839
|
+
const claudeConfigDir = options.claudeConfigDir ?? (options.homeDir === undefined ? getClaudeConfigDir3() : join133(homeDir, ".claude"));
|
|
151440
151840
|
return { cwd, homeDir, claudeConfigDir };
|
|
151441
151841
|
}
|
|
151442
151842
|
var mcpLoaderInternals = {
|
|
@@ -151445,17 +151845,17 @@ var mcpLoaderInternals = {
|
|
|
151445
151845
|
function getMcpConfigPaths(context) {
|
|
151446
151846
|
const { claudeConfigDir, homeDir, cwd } = context;
|
|
151447
151847
|
return [
|
|
151448
|
-
{ path:
|
|
151449
|
-
{ path:
|
|
151450
|
-
{ path:
|
|
151451
|
-
{ path:
|
|
151848
|
+
{ path: join133(homeDir, ".claude.json"), scope: "user" },
|
|
151849
|
+
{ path: join133(claudeConfigDir, ".mcp.json"), scope: "user" },
|
|
151850
|
+
{ path: join133(cwd, ".mcp.json"), scope: "project" },
|
|
151851
|
+
{ path: join133(cwd, ".claude", ".mcp.json"), scope: "local" }
|
|
151452
151852
|
];
|
|
151453
151853
|
}
|
|
151454
151854
|
function getHomeDir() {
|
|
151455
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
151855
|
+
return process.env.HOME || process.env.USERPROFILE || homedir28();
|
|
151456
151856
|
}
|
|
151457
151857
|
async function loadMcpConfigFile(filePath) {
|
|
151458
|
-
if (!
|
|
151858
|
+
if (!existsSync106(filePath)) {
|
|
151459
151859
|
return null;
|
|
151460
151860
|
}
|
|
151461
151861
|
try {
|
|
@@ -151476,10 +151876,10 @@ function getSystemMcpServerNames(options = {}) {
|
|
|
151476
151876
|
const paths = getMcpConfigPaths(context);
|
|
151477
151877
|
const { cwd } = context;
|
|
151478
151878
|
for (const { path } of paths) {
|
|
151479
|
-
if (!
|
|
151879
|
+
if (!existsSync106(path))
|
|
151480
151880
|
continue;
|
|
151481
151881
|
try {
|
|
151482
|
-
const content =
|
|
151882
|
+
const content = readFileSync73(path, "utf-8");
|
|
151483
151883
|
const config = JSON.parse(content);
|
|
151484
151884
|
if (!config?.mcpServers)
|
|
151485
151885
|
continue;
|
|
@@ -160966,15 +161366,15 @@ function createHephaestusAgent(model, availableAgents, availableToolNames, avail
|
|
|
160966
161366
|
}
|
|
160967
161367
|
createHephaestusAgent.mode = MODE9;
|
|
160968
161368
|
// packages/omo-opencode/src/agents/builtin-agents/resolve-file-uri.ts
|
|
160969
|
-
import { existsSync as
|
|
160970
|
-
import { homedir as
|
|
160971
|
-
import { isAbsolute as isAbsolute18, join as
|
|
161369
|
+
import { existsSync as existsSync107, readFileSync as readFileSync74 } from "fs";
|
|
161370
|
+
import { homedir as homedir29 } from "os";
|
|
161371
|
+
import { isAbsolute as isAbsolute18, join as join134, resolve as resolve34 } from "path";
|
|
160972
161372
|
init_logger2();
|
|
160973
161373
|
var ALLOWED_HOME_SUBDIRS = [
|
|
160974
|
-
|
|
160975
|
-
|
|
160976
|
-
|
|
160977
|
-
|
|
161374
|
+
join134(homedir29(), ".config", "opencode"),
|
|
161375
|
+
join134(homedir29(), ".config", "oh-my-openagent"),
|
|
161376
|
+
join134(homedir29(), ".omo"),
|
|
161377
|
+
join134(homedir29(), ".opencode")
|
|
160978
161378
|
];
|
|
160979
161379
|
function isWithinAllowedPaths(filePath, projectRoot) {
|
|
160980
161380
|
if (isWithinProject(filePath, projectRoot))
|
|
@@ -160992,7 +161392,7 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
160992
161392
|
let filePath;
|
|
160993
161393
|
try {
|
|
160994
161394
|
const decoded = decodeURIComponent(encoded);
|
|
160995
|
-
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${
|
|
161395
|
+
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir29()}/`) : decoded;
|
|
160996
161396
|
filePath = isAbsolute18(expanded) ? expanded : resolve34(configDir ?? process.cwd(), expanded);
|
|
160997
161397
|
} catch (error) {
|
|
160998
161398
|
if (!(error instanceof Error)) {
|
|
@@ -161010,11 +161410,11 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
161010
161410
|
});
|
|
161011
161411
|
return `[WARNING: Path rejected: ${promptAppend} (resolved outside project root ${projectRoot} and allowed home directories; file:// prompts must reside within the project directory, ~/.config/opencode/, ~/.config/oh-my-openagent/, ~/.omo/, or ~/.opencode/)]`;
|
|
161012
161412
|
}
|
|
161013
|
-
if (!
|
|
161413
|
+
if (!existsSync107(filePath)) {
|
|
161014
161414
|
return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
|
|
161015
161415
|
}
|
|
161016
161416
|
try {
|
|
161017
|
-
return
|
|
161417
|
+
return readFileSync74(filePath, "utf8");
|
|
161018
161418
|
} catch (error) {
|
|
161019
161419
|
if (!(error instanceof Error)) {
|
|
161020
161420
|
throw error;
|
|
@@ -163732,7 +164132,7 @@ async function applyAgentConfig(params) {
|
|
|
163732
164132
|
}
|
|
163733
164133
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader.ts
|
|
163734
164134
|
import { promises as fs21 } from "fs";
|
|
163735
|
-
import { join as
|
|
164135
|
+
import { join as join135, basename as basename21 } from "path";
|
|
163736
164136
|
|
|
163737
164137
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader-cache.ts
|
|
163738
164138
|
var commandLoaderCache = new Map;
|
|
@@ -163780,7 +164180,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
163780
164180
|
continue;
|
|
163781
164181
|
if (entry.name.startsWith("."))
|
|
163782
164182
|
continue;
|
|
163783
|
-
const subDirPath =
|
|
164183
|
+
const subDirPath = join135(commandsDir, entry.name);
|
|
163784
164184
|
const subPrefix = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
163785
164185
|
const subCommands = await loadCommandsFromDir(subDirPath, scope, visited, subPrefix);
|
|
163786
164186
|
commands.push(...subCommands);
|
|
@@ -163788,7 +164188,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
163788
164188
|
}
|
|
163789
164189
|
if (!isMarkdownFile(entry))
|
|
163790
164190
|
continue;
|
|
163791
|
-
const commandPath =
|
|
164191
|
+
const commandPath = join135(commandsDir, entry.name);
|
|
163792
164192
|
const baseCommandName = basename21(entry.name, ".md");
|
|
163793
164193
|
const commandName = prefix ? `${prefix}/${baseCommandName}` : baseCommandName;
|
|
163794
164194
|
try {
|
|
@@ -163851,12 +164251,12 @@ function commandsToRecord(commands) {
|
|
|
163851
164251
|
return result;
|
|
163852
164252
|
}
|
|
163853
164253
|
async function loadUserCommands() {
|
|
163854
|
-
const userCommandsDir =
|
|
164254
|
+
const userCommandsDir = join135(getClaudeConfigDir3(), "commands");
|
|
163855
164255
|
const commands = await loadCommandsFromDir(userCommandsDir, "user");
|
|
163856
164256
|
return commandsToRecord(commands);
|
|
163857
164257
|
}
|
|
163858
164258
|
async function loadProjectCommands(directory) {
|
|
163859
|
-
const projectCommandsDir =
|
|
164259
|
+
const projectCommandsDir = join135(directory ?? process.cwd(), ".claude", "commands");
|
|
163860
164260
|
const commands = await loadCommandsFromDir(projectCommandsDir, "project");
|
|
163861
164261
|
return commandsToRecord(commands);
|
|
163862
164262
|
}
|
|
@@ -164045,7 +164445,7 @@ var grep_app = {
|
|
|
164045
164445
|
};
|
|
164046
164446
|
|
|
164047
164447
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
164048
|
-
import { existsSync as
|
|
164448
|
+
import { existsSync as existsSync108, readFileSync as readFileSync75 } from "fs";
|
|
164049
164449
|
import { delimiter as delimiter2, dirname as dirname47, resolve as resolve36 } from "path";
|
|
164050
164450
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
164051
164451
|
import { z as z60 } from "zod";
|
|
@@ -164190,7 +164590,7 @@ function findBootstrapRoot(candidates, pathExists) {
|
|
|
164190
164590
|
}
|
|
164191
164591
|
function readDaemonPackageVersion(root) {
|
|
164192
164592
|
try {
|
|
164193
|
-
const packageJson = JSON.parse(
|
|
164593
|
+
const packageJson = JSON.parse(readFileSync75(resolve36(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
164194
164594
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
164195
164595
|
} catch (error) {
|
|
164196
164596
|
if (!(error instanceof Error))
|
|
@@ -164212,7 +164612,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
164212
164612
|
};
|
|
164213
164613
|
}
|
|
164214
164614
|
function resolveLspCommand(options = {}) {
|
|
164215
|
-
const pathExists = options.exists ??
|
|
164615
|
+
const pathExists = options.exists ?? existsSync108;
|
|
164216
164616
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
164217
164617
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
164218
164618
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -171798,8 +172198,8 @@ function createChatHeadersHandler(args) {
|
|
|
171798
172198
|
}
|
|
171799
172199
|
|
|
171800
172200
|
// packages/omo-opencode/src/plugin/ultrawork-db-model-override.ts
|
|
171801
|
-
import { join as
|
|
171802
|
-
import { existsSync as
|
|
172201
|
+
import { join as join136 } from "path";
|
|
172202
|
+
import { existsSync as existsSync109 } from "fs";
|
|
171803
172203
|
async function importBunSqlite() {
|
|
171804
172204
|
if (typeof globalThis.Bun === "undefined") {
|
|
171805
172205
|
return null;
|
|
@@ -171815,7 +172215,7 @@ async function importBunSqlite() {
|
|
|
171815
172215
|
}
|
|
171816
172216
|
}
|
|
171817
172217
|
function getDbPath() {
|
|
171818
|
-
return
|
|
172218
|
+
return join136(getDataDir(), "opencode", "opencode.db");
|
|
171819
172219
|
}
|
|
171820
172220
|
var MAX_MICROTASK_RETRIES = 10;
|
|
171821
172221
|
function logCaughtDbError(message, metadata, error) {
|
|
@@ -171918,7 +172318,7 @@ async function scheduleDeferredModelOverride(messageId, targetModel, variant) {
|
|
|
171918
172318
|
return;
|
|
171919
172319
|
}
|
|
171920
172320
|
const dbPath = getDbPath();
|
|
171921
|
-
if (!
|
|
172321
|
+
if (!existsSync109(dbPath)) {
|
|
171922
172322
|
log2("[ultrawork-db-override] DB not found, skipping deferred override");
|
|
171923
172323
|
return;
|
|
171924
172324
|
}
|
|
@@ -172772,6 +173172,7 @@ function createEventHookDispatcher(hooks, runEventHookSafely) {
|
|
|
172772
173172
|
await runEventHookSafely("autoUpdateChecker", hooks.autoUpdateChecker?.event, input);
|
|
172773
173173
|
await runEventHookSafely("astGrepSgProvision", hooks.astGrepSgProvision?.event, input);
|
|
172774
173174
|
await runEventHookSafely("legacyPluginToast", hooks.legacyPluginToast?.event, input);
|
|
173175
|
+
await runEventHookSafely("nativeEditionNudge", hooks.nativeEditionNudge?.event, input);
|
|
172775
173176
|
await runEventHookSafely("claudeCodeHooks", hooks.claudeCodeHooks?.event, input);
|
|
172776
173177
|
await runEventHookSafely("backgroundNotificationHook", hooks.backgroundNotificationHook?.event, input);
|
|
172777
173178
|
await runEventHookSafely("sessionNotification", hooks.sessionNotification, input);
|
|
@@ -174635,7 +175036,7 @@ function parseWindowsProcessTable(output) {
|
|
|
174635
175036
|
const entries = Array.isArray(parsed) ? parsed : parsed === undefined ? [] : [parsed];
|
|
174636
175037
|
const processes = [];
|
|
174637
175038
|
for (const entry of entries) {
|
|
174638
|
-
if (!
|
|
175039
|
+
if (!isRecord13(entry))
|
|
174639
175040
|
continue;
|
|
174640
175041
|
const pid = numberField(entry, "ProcessId");
|
|
174641
175042
|
const ppid = numberField(entry, "ParentProcessId");
|
|
@@ -174669,7 +175070,7 @@ function stringField(record, key) {
|
|
|
174669
175070
|
const value = record[key];
|
|
174670
175071
|
return typeof value === "string" ? value : undefined;
|
|
174671
175072
|
}
|
|
174672
|
-
function
|
|
175073
|
+
function isRecord13(value) {
|
|
174673
175074
|
return typeof value === "object" && value !== null;
|
|
174674
175075
|
}
|
|
174675
175076
|
|
|
@@ -174747,9 +175148,9 @@ function processKillErrorMeansAlive(error) {
|
|
|
174747
175148
|
}
|
|
174748
175149
|
|
|
174749
175150
|
// packages/utils/src/process-sweep/lsp-daemon-family.ts
|
|
174750
|
-
import { readFileSync as
|
|
174751
|
-
import { homedir as
|
|
174752
|
-
import { basename as basename23, join as
|
|
175151
|
+
import { readFileSync as readFileSync76, readdirSync as readdirSync31 } from "fs";
|
|
175152
|
+
import { homedir as homedir30 } from "os";
|
|
175153
|
+
import { basename as basename23, join as join137, resolve as resolve37 } from "path";
|
|
174753
175154
|
|
|
174754
175155
|
// packages/utils/src/process-sweep/lsp-daemon-owner-attestation.ts
|
|
174755
175156
|
import { readFile as readFile13 } from "fs/promises";
|
|
@@ -174773,7 +175174,7 @@ async function attestLspDaemonOwner(target, deps = {}) {
|
|
|
174773
175174
|
}
|
|
174774
175175
|
}
|
|
174775
175176
|
function parseLspDaemonOwner(value) {
|
|
174776
|
-
if (!
|
|
175177
|
+
if (!isRecord14(value))
|
|
174777
175178
|
return null;
|
|
174778
175179
|
const pid = value["pid"];
|
|
174779
175180
|
const nonce = value["nonce"];
|
|
@@ -174785,7 +175186,7 @@ function parseLspDaemonOwner(value) {
|
|
|
174785
175186
|
return null;
|
|
174786
175187
|
if (typeof startedAt !== "string" || startedAt.length === 0)
|
|
174787
175188
|
return null;
|
|
174788
|
-
if (!
|
|
175189
|
+
if (!isRecord14(endpoint))
|
|
174789
175190
|
return null;
|
|
174790
175191
|
const kind = endpoint["kind"];
|
|
174791
175192
|
const path = endpoint["path"];
|
|
@@ -174837,7 +175238,7 @@ async function pingLspDaemonOwner(endpoint, authToken) {
|
|
|
174837
175238
|
return finish(null);
|
|
174838
175239
|
try {
|
|
174839
175240
|
const response = JSON.parse(line);
|
|
174840
|
-
if (!
|
|
175241
|
+
if (!isRecord14(response) || response["id"] !== OWNER_PING_REQUEST_ID || "error" in response) {
|
|
174841
175242
|
return finish(null);
|
|
174842
175243
|
}
|
|
174843
175244
|
finish(parseLspDaemonOwner(response["result"]));
|
|
@@ -174850,7 +175251,7 @@ async function pingLspDaemonOwner(endpoint, authToken) {
|
|
|
174850
175251
|
function sameOwner(left, right) {
|
|
174851
175252
|
return left.pid === right.pid && left.nonce === right.nonce && left.startedAt === right.startedAt && left.endpoint.kind === right.endpoint.kind && left.endpoint.path === right.endpoint.path && left.endpoint.dev === right.endpoint.dev && left.endpoint.ino === right.endpoint.ino;
|
|
174852
175253
|
}
|
|
174853
|
-
function
|
|
175254
|
+
function isRecord14(value) {
|
|
174854
175255
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
174855
175256
|
}
|
|
174856
175257
|
|
|
@@ -174865,8 +175266,8 @@ function resolveLspDaemonBaseDir(options = {}) {
|
|
|
174865
175266
|
const override = env[OMO_LSP_DAEMON_DIR_ENV];
|
|
174866
175267
|
if (override !== undefined && override.trim().length > 0)
|
|
174867
175268
|
return resolve37(override);
|
|
174868
|
-
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ??
|
|
174869
|
-
return
|
|
175269
|
+
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir30();
|
|
175270
|
+
return join137(homeDir, ".omo", "lsp-daemon");
|
|
174870
175271
|
}
|
|
174871
175272
|
var VERSION_ENTRY_PATTERN = /^v([A-Za-z0-9][A-Za-z0-9._+-]{0,127})$/;
|
|
174872
175273
|
function listLspDaemonVersionDirs(baseDir) {
|
|
@@ -174885,12 +175286,12 @@ function listLspDaemonVersionDirs(baseDir) {
|
|
|
174885
175286
|
const version = VERSION_ENTRY_PATTERN.exec(entry.name)?.[1];
|
|
174886
175287
|
if (version === undefined)
|
|
174887
175288
|
continue;
|
|
174888
|
-
versions.push({ dir:
|
|
175289
|
+
versions.push({ dir: join137(baseDir, entry.name), version });
|
|
174889
175290
|
}
|
|
174890
175291
|
return versions.sort((left, right) => left.version.localeCompare(right.version));
|
|
174891
175292
|
}
|
|
174892
175293
|
function readLspDaemonOwnerTarget(versionDir) {
|
|
174893
|
-
const ownerPath =
|
|
175294
|
+
const ownerPath = join137(versionDir, "daemon.owner");
|
|
174894
175295
|
let raw;
|
|
174895
175296
|
try {
|
|
174896
175297
|
raw = requireOwnerText(ownerPath);
|
|
@@ -174901,13 +175302,13 @@ function readLspDaemonOwnerTarget(versionDir) {
|
|
|
174901
175302
|
const owner = parseLspDaemonOwner(JSON.parse(raw));
|
|
174902
175303
|
if (owner === null)
|
|
174903
175304
|
return null;
|
|
174904
|
-
return { authPath:
|
|
175305
|
+
return { authPath: join137(versionDir, "daemon.auth"), owner, ownerPath, pid: owner.pid };
|
|
174905
175306
|
} catch {
|
|
174906
175307
|
return null;
|
|
174907
175308
|
}
|
|
174908
175309
|
}
|
|
174909
175310
|
function requireOwnerText(path) {
|
|
174910
|
-
return
|
|
175311
|
+
return readFileSync76(path, "utf8");
|
|
174911
175312
|
}
|
|
174912
175313
|
async function planStaleLspDaemonVersionSweep(options) {
|
|
174913
175314
|
const platform = options.platform ?? process.platform;
|
|
@@ -174974,35 +175375,35 @@ function matchLspDaemonProxyCommand(command, roots, platform) {
|
|
|
174974
175375
|
}
|
|
174975
175376
|
|
|
174976
175377
|
// packages/utils/src/process-sweep/roots.ts
|
|
174977
|
-
import { existsSync as
|
|
174978
|
-
import { homedir as
|
|
174979
|
-
import { join as
|
|
175378
|
+
import { existsSync as existsSync110, readdirSync as readdirSync32, realpathSync as realpathSync20 } from "fs";
|
|
175379
|
+
import { homedir as homedir31 } from "os";
|
|
175380
|
+
import { join as join138, resolve as resolve38 } from "path";
|
|
174980
175381
|
function discoverOmoOwnedRoots(options = {}) {
|
|
174981
175382
|
const env = options.env ?? process.env;
|
|
174982
|
-
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ??
|
|
175383
|
+
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir31();
|
|
174983
175384
|
const roots = new Set;
|
|
174984
|
-
addRoot(roots,
|
|
175385
|
+
addRoot(roots, join138(homeDir, ".claude", "omo"));
|
|
174985
175386
|
addRoot(roots, options.pluginRoot);
|
|
174986
175387
|
for (const root of options.extraRoots ?? [])
|
|
174987
175388
|
addRoot(roots, root);
|
|
174988
|
-
for (const root of readCodexPluginCacheRoots(options.codexHome ?? env["CODEX_HOME"] ??
|
|
175389
|
+
for (const root of readCodexPluginCacheRoots(options.codexHome ?? env["CODEX_HOME"] ?? join138(homeDir, ".codex"))) {
|
|
174989
175390
|
addRoot(roots, root);
|
|
174990
175391
|
}
|
|
174991
175392
|
return [...roots];
|
|
174992
175393
|
}
|
|
174993
175394
|
function readCodexPluginCacheRoots(codexHome) {
|
|
174994
|
-
const cacheRoot =
|
|
174995
|
-
if (!
|
|
175395
|
+
const cacheRoot = join138(codexHome, "plugins", "cache");
|
|
175396
|
+
if (!existsSync110(cacheRoot))
|
|
174996
175397
|
return [];
|
|
174997
175398
|
const roots = [];
|
|
174998
175399
|
for (const publisher of safeReadDir(cacheRoot)) {
|
|
174999
175400
|
if (!OMO_CODEX_PLUGIN_CACHE_PUBLISHERS.has(publisher))
|
|
175000
175401
|
continue;
|
|
175001
|
-
const omoRoot =
|
|
175002
|
-
if (!
|
|
175402
|
+
const omoRoot = join138(cacheRoot, publisher, "omo");
|
|
175403
|
+
if (!existsSync110(omoRoot))
|
|
175003
175404
|
continue;
|
|
175004
175405
|
for (const version of safeReadDir(omoRoot))
|
|
175005
|
-
roots.push(
|
|
175406
|
+
roots.push(join138(omoRoot, version));
|
|
175006
175407
|
}
|
|
175007
175408
|
return roots;
|
|
175008
175409
|
}
|
|
@@ -175040,10 +175441,10 @@ function isNonFatalFsError(error) {
|
|
|
175040
175441
|
var OMO_CODEX_PLUGIN_CACHE_PUBLISHERS = new Set(["sisyphuslabs"]);
|
|
175041
175442
|
|
|
175042
175443
|
// packages/utils/src/process-sweep/sweeper.ts
|
|
175043
|
-
import { join as
|
|
175444
|
+
import { join as join139 } from "path";
|
|
175044
175445
|
|
|
175045
175446
|
// packages/utils/src/process-sweep/family-sweeper.ts
|
|
175046
|
-
import { existsSync as
|
|
175447
|
+
import { existsSync as existsSync111, mkdirSync as mkdirSync26, statSync as statSync17, utimesSync, writeFileSync as writeFileSync29 } from "fs";
|
|
175047
175448
|
import { dirname as dirname48 } from "path";
|
|
175048
175449
|
var DEFAULT_GRACE_MS = 2000;
|
|
175049
175450
|
var DEFAULT_THROTTLE_MS = 60 * 60 * 1000;
|
|
@@ -175135,13 +175536,13 @@ async function safelyKill(pid, context) {
|
|
|
175135
175536
|
}
|
|
175136
175537
|
}
|
|
175137
175538
|
function isSweepThrottled(stampFile, nowMs, throttleMs) {
|
|
175138
|
-
if (!
|
|
175539
|
+
if (!existsSync111(stampFile))
|
|
175139
175540
|
return false;
|
|
175140
175541
|
return nowMs - statSync17(stampFile).mtimeMs < throttleMs;
|
|
175141
175542
|
}
|
|
175142
175543
|
function writeSweepStamp(stampFile, nowMs) {
|
|
175143
|
-
|
|
175144
|
-
|
|
175544
|
+
mkdirSync26(dirname48(stampFile), { recursive: true });
|
|
175545
|
+
writeFileSync29(stampFile, `${new Date(nowMs).toISOString()}
|
|
175145
175546
|
`);
|
|
175146
175547
|
const stampDate = new Date(nowMs);
|
|
175147
175548
|
utimesSync(stampFile, stampDate, stampDate);
|
|
@@ -175157,7 +175558,7 @@ function delay6(ms) {
|
|
|
175157
175558
|
// packages/utils/src/process-sweep/sweeper.ts
|
|
175158
175559
|
var LSP_PROXY_SWEEP_STAMP_FILE = "lsp-proxy-sweep.stamp";
|
|
175159
175560
|
async function sweepOrphanedLspDaemonProxies(options = {}) {
|
|
175160
|
-
const stampFile =
|
|
175561
|
+
const stampFile = join139(resolveLspDaemonBaseDir(options), LSP_PROXY_SWEEP_STAMP_FILE);
|
|
175161
175562
|
const ownedRoots = options.ownedRoots ?? discoverOmoOwnedRoots(options);
|
|
175162
175563
|
const result = await runProcessFamilySweep({
|
|
175163
175564
|
familyLabel: "lsp-daemon proxy sweep",
|
|
@@ -175176,7 +175577,7 @@ async function sweepOrphanedLspDaemonProxies(options = {}) {
|
|
|
175176
175577
|
var LSP_DAEMON_SWEEP_STAMP_FILE = "lsp-daemon-sweep.stamp";
|
|
175177
175578
|
async function sweepStaleLspDaemonVersions(options = {}) {
|
|
175178
175579
|
const baseDir = resolveLspDaemonBaseDir(options);
|
|
175179
|
-
const stampFile =
|
|
175580
|
+
const stampFile = join139(baseDir, LSP_DAEMON_SWEEP_STAMP_FILE);
|
|
175180
175581
|
const currentVersion = resolveCurrentLspDaemonVersion(options);
|
|
175181
175582
|
const dryRun = options.dryRun === true;
|
|
175182
175583
|
if (currentVersion === undefined) {
|
|
@@ -175248,20 +175649,20 @@ function defaultPluginRoot() {
|
|
|
175248
175649
|
// packages/telemetry-core/src/activity-state.ts
|
|
175249
175650
|
init_atomic_write();
|
|
175250
175651
|
init_xdg_data_dir();
|
|
175251
|
-
import { existsSync as
|
|
175252
|
-
import { basename as basename24, join as
|
|
175652
|
+
import { existsSync as existsSync112, mkdirSync as mkdirSync28, readFileSync as readFileSync77 } from "fs";
|
|
175653
|
+
import { basename as basename24, join as join141 } from "path";
|
|
175253
175654
|
|
|
175254
175655
|
// packages/telemetry-core/src/day-claim.ts
|
|
175255
|
-
import { closeSync as closeSync6, mkdirSync as
|
|
175256
|
-
import { join as
|
|
175656
|
+
import { closeSync as closeSync6, mkdirSync as mkdirSync27, openSync as openSync6, readdirSync as readdirSync33, rmSync as rmSync6 } from "fs";
|
|
175657
|
+
import { join as join140 } from "path";
|
|
175257
175658
|
var CLAIM_PREFIX = "daily-active.";
|
|
175258
175659
|
var CLAIM_SUFFIX = ".claim";
|
|
175259
175660
|
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
175260
|
-
return
|
|
175661
|
+
return join140(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
175261
175662
|
}
|
|
175262
175663
|
function claimUtcDay(stateDir, dayUTC) {
|
|
175263
175664
|
try {
|
|
175264
|
-
|
|
175665
|
+
mkdirSync27(stateDir, { recursive: true });
|
|
175265
175666
|
closeSync6(openSync6(getTelemetryDayClaimFilePath(stateDir, dayUTC), "wx"));
|
|
175266
175667
|
} catch (error) {
|
|
175267
175668
|
return error.code === "EEXIST" ? "already-claimed" : "unavailable";
|
|
@@ -175283,7 +175684,7 @@ function pruneSupersededClaims(stateDir, dayUTC) {
|
|
|
175283
175684
|
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
175284
175685
|
continue;
|
|
175285
175686
|
try {
|
|
175286
|
-
rmSync6(
|
|
175687
|
+
rmSync6(join140(stateDir, entry), { force: true });
|
|
175287
175688
|
} catch {}
|
|
175288
175689
|
}
|
|
175289
175690
|
}
|
|
@@ -175296,14 +175697,14 @@ function resolveTelemetryStateDir(product, options = {}) {
|
|
|
175296
175697
|
env: options.env,
|
|
175297
175698
|
osProvider: options.osProvider
|
|
175298
175699
|
});
|
|
175299
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
175700
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join141(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
175300
175701
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename24(dataDir) === product.cacheDirName) {
|
|
175301
175702
|
return dataDir;
|
|
175302
175703
|
}
|
|
175303
|
-
return
|
|
175704
|
+
return join141(dataDir, product.cacheDirName);
|
|
175304
175705
|
}
|
|
175305
175706
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
175306
|
-
return
|
|
175707
|
+
return join141(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
175307
175708
|
}
|
|
175308
175709
|
function getDailyActiveCaptureState(input) {
|
|
175309
175710
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
@@ -175336,11 +175737,11 @@ function isPostHogActivityState(value) {
|
|
|
175336
175737
|
}
|
|
175337
175738
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
175338
175739
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
175339
|
-
if (!
|
|
175740
|
+
if (!existsSync112(stateFilePath)) {
|
|
175340
175741
|
return {};
|
|
175341
175742
|
}
|
|
175342
175743
|
try {
|
|
175343
|
-
const stateContent =
|
|
175744
|
+
const stateContent = readFileSync77(stateFilePath, "utf-8");
|
|
175344
175745
|
const stateJson = JSON.parse(stateContent);
|
|
175345
175746
|
if (!isPostHogActivityState(stateJson)) {
|
|
175346
175747
|
return {};
|
|
@@ -175359,7 +175760,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
175359
175760
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
175360
175761
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
175361
175762
|
try {
|
|
175362
|
-
|
|
175763
|
+
mkdirSync28(stateDir, { recursive: true });
|
|
175363
175764
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
175364
175765
|
`);
|
|
175365
175766
|
} catch (error) {
|
|
@@ -182627,7 +183028,7 @@ var TOPLEVEL_SENTINELS = [
|
|
|
182627
183028
|
field: "window_id"
|
|
182628
183029
|
}
|
|
182629
183030
|
];
|
|
182630
|
-
function
|
|
183031
|
+
function isRecord15(value) {
|
|
182631
183032
|
return typeof value == "object" && value !== null && !Array.isArray(value);
|
|
182632
183033
|
}
|
|
182633
183034
|
function toRfc3339(timestamp) {
|
|
@@ -182649,7 +183050,7 @@ function relocateInto(properties, key, value) {
|
|
|
182649
183050
|
properties[key] = value;
|
|
182650
183051
|
}
|
|
182651
183052
|
function buildV1Event(message) {
|
|
182652
|
-
const sourceProperties =
|
|
183053
|
+
const sourceProperties = isRecord15(message.properties) ? message.properties : {};
|
|
182653
183054
|
const properties = {
|
|
182654
183055
|
...sourceProperties
|
|
182655
183056
|
};
|