oh-my-opencode 5.0.0-beta.82 → 5.0.0-beta.84
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/.agents/skills/hyperplan/SKILL.md +1 -1
- package/.opencode/skills/hyperplan/SKILL.md +1 -1
- 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 +707 -146
- 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 +707 -146
- package/dist/config/schema/hooks.d.ts +1 -0
- package/dist/config-migration/harness-native-rename.d.ts +3 -0
- package/dist/config-migration/subscription-provider-rename.d.ts +4 -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 +1041 -387
- 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 +761 -100
- package/package.json +14 -14
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +84 -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/lcx/skills/lcx-contribute-bug-fix/SKILL.md +1 -1
- package/packages/omo-codex/plugin/components/lcx/skills/lcx-doctor/SKILL.md +3 -3
- package/packages/omo-codex/plugin/components/lcx/skills/lcx-report-bug/SKILL.md +5 -5
- 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/skills/lcx-contribute-bug-fix/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +5 -5
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +1 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +90 -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 -3
- package/dist/cli/install-senpi/index.d.ts +0 -1
- package/dist/cli/senpi-edition-hint.d.ts +0 -10
- package/dist/cli/senpi-platform-flag.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -20003,7 +20003,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20003
20003
|
fallbackChain: [
|
|
20004
20004
|
{
|
|
20005
20005
|
providers: ["anthropic", "github-copilot", "opencode"],
|
|
20006
|
-
model: "claude-opus-5",
|
|
20006
|
+
model: "claude-opus-5-5",
|
|
20007
20007
|
variant: "max"
|
|
20008
20008
|
},
|
|
20009
20009
|
{
|
|
@@ -20011,7 +20011,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20011
20011
|
model: "kimi-k3"
|
|
20012
20012
|
},
|
|
20013
20013
|
{
|
|
20014
|
-
providers: ["openai", "
|
|
20014
|
+
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
20015
20015
|
model: "gpt-5.6-sol",
|
|
20016
20016
|
variant: "medium"
|
|
20017
20017
|
},
|
|
@@ -20023,17 +20023,17 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20023
20023
|
hephaestus: {
|
|
20024
20024
|
fallbackChain: [
|
|
20025
20025
|
{
|
|
20026
|
-
providers: ["openai", "
|
|
20026
|
+
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
20027
20027
|
model: "gpt-5.6-sol",
|
|
20028
20028
|
variant: "medium"
|
|
20029
20029
|
}
|
|
20030
20030
|
],
|
|
20031
|
-
requiresProvider: ["openai", "
|
|
20031
|
+
requiresProvider: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
20032
20032
|
requiresAnyModel: true
|
|
20033
20033
|
},
|
|
20034
20034
|
oracle: {
|
|
20035
20035
|
fallbackChain: [
|
|
20036
|
-
{ providers: ["openai", "
|
|
20036
|
+
{ providers: ["openai", "chatgpt-subscription", "opencode"], model: "gpt-5.6-sol", variant: "xhigh" },
|
|
20037
20037
|
{ providers: ["github-copilot"], model: "gpt-5.6-sol", variant: "high" },
|
|
20038
20038
|
{
|
|
20039
20039
|
providers: ["google", "github-copilot", "opencode"],
|
|
@@ -20042,7 +20042,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20042
20042
|
},
|
|
20043
20043
|
{
|
|
20044
20044
|
providers: ["anthropic", "github-copilot", "opencode"],
|
|
20045
|
-
model: "claude-opus-5",
|
|
20045
|
+
model: "claude-opus-5-5",
|
|
20046
20046
|
variant: "max"
|
|
20047
20047
|
},
|
|
20048
20048
|
{ providers: ["opencode-go"], model: "glm-5.2" }
|
|
@@ -20050,34 +20050,36 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20050
20050
|
},
|
|
20051
20051
|
librarian: {
|
|
20052
20052
|
fallbackChain: [
|
|
20053
|
-
{ providers: ["
|
|
20053
|
+
{ providers: ["kimi-for-coding"], model: "kimi-for-coding-highspeed", variant: "off" },
|
|
20054
|
+
{ providers: ["openai", "chatgpt-subscription"], 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" },
|
|
20056
20057
|
{ providers: ["opencode-go"], model: "minimax-m3" },
|
|
20057
20058
|
{ providers: ["minimax-coding-plan", "minimax-cn-coding-plan"], model: "MiniMax-M3" },
|
|
20058
20059
|
{ providers: ["opencode-go"], model: "minimax-m2.7" },
|
|
20059
20060
|
{ providers: ["anthropic", "github-copilot"], model: "claude-haiku-4-5" },
|
|
20060
|
-
{ providers: ["openai", "
|
|
20061
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.4-nano" }
|
|
20061
20062
|
]
|
|
20062
20063
|
},
|
|
20063
20064
|
explore: {
|
|
20064
20065
|
fallbackChain: [
|
|
20065
|
-
{ providers: ["
|
|
20066
|
+
{ providers: ["kimi-for-coding"], model: "kimi-for-coding-highspeed", variant: "off" },
|
|
20067
|
+
{ providers: ["openai", "chatgpt-subscription"], 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" },
|
|
20068
20070
|
{ providers: ["opencode-go"], model: "minimax-m3" },
|
|
20069
20071
|
{ providers: ["minimax-coding-plan", "minimax-cn-coding-plan"], model: "MiniMax-M3" },
|
|
20070
20072
|
{ providers: ["opencode-go"], model: "minimax-m2.7" },
|
|
20071
20073
|
{ providers: ["anthropic", "github-copilot"], model: "claude-haiku-4-5" },
|
|
20072
|
-
{ providers: ["openai", "
|
|
20074
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.4-nano" }
|
|
20073
20075
|
]
|
|
20074
20076
|
},
|
|
20075
20077
|
"multimodal-looker": {
|
|
20076
20078
|
fallbackChain: [
|
|
20077
|
-
{ providers: ["openai", "
|
|
20079
|
+
{ providers: ["openai", "chatgpt-subscription", "opencode"], model: "gpt-5.6-sol", variant: "low" },
|
|
20078
20080
|
{ providers: ["opencode-go"], model: "kimi-k3" },
|
|
20079
20081
|
{ providers: ["zai-coding-plan"], model: "glm-4.6v" },
|
|
20080
|
-
{ providers: ["openai", "
|
|
20082
|
+
{ providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"], model: "gpt-5-nano" }
|
|
20081
20083
|
]
|
|
20082
20084
|
},
|
|
20083
20085
|
prometheus: {
|
|
@@ -20103,7 +20105,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20103
20105
|
},
|
|
20104
20106
|
{
|
|
20105
20107
|
providers: ["anthropic", "github-copilot", "opencode"],
|
|
20106
|
-
model: "claude-opus-5",
|
|
20108
|
+
model: "claude-opus-5-5",
|
|
20107
20109
|
variant: "max"
|
|
20108
20110
|
},
|
|
20109
20111
|
{
|
|
@@ -20115,12 +20117,12 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20115
20117
|
},
|
|
20116
20118
|
momus: {
|
|
20117
20119
|
fallbackChain: [
|
|
20118
|
-
{ providers: ["openai", "
|
|
20120
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-6-astra", variant: "xhigh" },
|
|
20119
20121
|
{ providers: ["github-copilot"], model: "gpt-6-astra", variant: "high" },
|
|
20120
|
-
{ providers: ["openai", "
|
|
20122
|
+
{ providers: ["openai", "chatgpt-subscription", "opencode"], model: "gpt-6-astra", variant: "high" },
|
|
20121
20123
|
{
|
|
20122
20124
|
providers: ["anthropic", "github-copilot", "opencode"],
|
|
20123
|
-
model: "claude-opus-5",
|
|
20125
|
+
model: "claude-opus-5-5",
|
|
20124
20126
|
variant: "max"
|
|
20125
20127
|
},
|
|
20126
20128
|
{
|
|
@@ -20136,7 +20138,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20136
20138
|
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-5" },
|
|
20137
20139
|
{ providers: ["opencode-go"], model: "kimi-k3" },
|
|
20138
20140
|
{
|
|
20139
|
-
providers: ["openai", "
|
|
20141
|
+
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
20140
20142
|
model: "gpt-5.6-sol",
|
|
20141
20143
|
variant: "medium"
|
|
20142
20144
|
},
|
|
@@ -20150,7 +20152,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20150
20152
|
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-5" },
|
|
20151
20153
|
{ providers: ["opencode-go"], model: "kimi-k3" },
|
|
20152
20154
|
{
|
|
20153
|
-
providers: ["openai", "
|
|
20155
|
+
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
20154
20156
|
model: "gpt-5.6-sol",
|
|
20155
20157
|
variant: "medium"
|
|
20156
20158
|
},
|
|
@@ -20172,7 +20174,7 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
20172
20174
|
},
|
|
20173
20175
|
{
|
|
20174
20176
|
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
20175
|
-
model: "claude-opus-5",
|
|
20177
|
+
model: "claude-opus-5-5",
|
|
20176
20178
|
variant: "max"
|
|
20177
20179
|
},
|
|
20178
20180
|
{
|
|
@@ -20184,18 +20186,18 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
20184
20186
|
},
|
|
20185
20187
|
ultrabrain: {
|
|
20186
20188
|
fallbackChain: [
|
|
20187
|
-
{ providers: ["openai", "
|
|
20189
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-6-astra", variant: "max" },
|
|
20188
20190
|
{ providers: ["github-copilot"], model: "gpt-6-astra", variant: "max" },
|
|
20189
|
-
{ providers: ["openai", "
|
|
20190
|
-
{ providers: ["openai", "
|
|
20191
|
+
{ providers: ["openai", "chatgpt-subscription", "opencode"], model: "gpt-6-astra", variant: "max" },
|
|
20192
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol", variant: "max" },
|
|
20191
20193
|
{ providers: ["github-copilot"], model: "gpt-5.6-sol", variant: "max" },
|
|
20192
|
-
{ providers: ["openai", "
|
|
20194
|
+
{ providers: ["openai", "chatgpt-subscription", "opencode"], model: "gpt-5.6-sol", variant: "max" }
|
|
20193
20195
|
]
|
|
20194
20196
|
},
|
|
20195
20197
|
"deep-low": {
|
|
20196
20198
|
fallbackChain: [
|
|
20197
20199
|
{
|
|
20198
|
-
providers: ["openai", "
|
|
20200
|
+
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
20199
20201
|
model: "gpt-5.6-sol",
|
|
20200
20202
|
variant: "medium"
|
|
20201
20203
|
}
|
|
@@ -20204,7 +20206,7 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
20204
20206
|
"deep-high": {
|
|
20205
20207
|
fallbackChain: [
|
|
20206
20208
|
{
|
|
20207
|
-
providers: ["openai", "
|
|
20209
|
+
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
20208
20210
|
model: "gpt-6-astra",
|
|
20209
20211
|
variant: "high"
|
|
20210
20212
|
}
|
|
@@ -20224,15 +20226,14 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
20224
20226
|
},
|
|
20225
20227
|
{
|
|
20226
20228
|
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
20227
|
-
model: "claude-opus-5",
|
|
20228
|
-
variant: "
|
|
20229
|
+
model: "claude-opus-5-5",
|
|
20230
|
+
variant: "max"
|
|
20229
20231
|
}
|
|
20230
20232
|
]
|
|
20231
20233
|
},
|
|
20232
20234
|
quick: {
|
|
20233
20235
|
fallbackChain: [
|
|
20234
|
-
{ providers: ["
|
|
20235
|
-
{ providers: ["openai-codex"], model: "gpt-5.6-luna-fast", variant: "low" },
|
|
20236
|
+
{ providers: ["chatgpt-subscription"], model: "gpt-5.6-luna-fast", variant: "low" },
|
|
20236
20237
|
{ providers: ["deepseek"], model: "deepseek-v4-flash", variant: "off" },
|
|
20237
20238
|
{
|
|
20238
20239
|
providers: ["qwen-token-plan", "alibaba-token-plan", "bailian-coding-plan"],
|
|
@@ -20251,9 +20252,10 @@ 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
|
-
providers: ["openai", "
|
|
20258
|
+
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
20257
20259
|
model: "gpt-5.6-terra",
|
|
20258
20260
|
variant: "high"
|
|
20259
20261
|
},
|
|
@@ -20273,15 +20275,10 @@ 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
|
-
model: "claude-opus-5",
|
|
20284
|
-
variant: "
|
|
20280
|
+
model: "claude-opus-5-5",
|
|
20281
|
+
variant: "max"
|
|
20285
20282
|
},
|
|
20286
20283
|
{ providers: ["zai-coding-plan", "opencode-go"], model: "glm-5.3", variant: "max" },
|
|
20287
20284
|
{
|
|
@@ -20299,14 +20296,14 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
20299
20296
|
variant: "low"
|
|
20300
20297
|
},
|
|
20301
20298
|
{
|
|
20302
|
-
providers: ["
|
|
20303
|
-
model: "
|
|
20299
|
+
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
20300
|
+
model: "claude-opus-5-5",
|
|
20304
20301
|
variant: "low"
|
|
20305
20302
|
},
|
|
20306
20303
|
{
|
|
20307
20304
|
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
20308
20305
|
model: "claude-opus-4-6",
|
|
20309
|
-
variant: "
|
|
20306
|
+
variant: "max"
|
|
20310
20307
|
}
|
|
20311
20308
|
]
|
|
20312
20309
|
}
|
|
@@ -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";
|
|
@@ -23656,6 +23715,7 @@ var OmoConfigProfileSchema = z14.object({
|
|
|
23656
23715
|
telemetry: OmoTelemetrySettingsLayerSchema.optional(),
|
|
23657
23716
|
disabled_skills: OmoDisabledSkillsSchema.optional(),
|
|
23658
23717
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
23718
|
+
"[native]": OmoTypedHarnessConfigSchema.optional(),
|
|
23659
23719
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
23660
23720
|
"[codex]": OmoTypedHarnessConfigSchema.optional()
|
|
23661
23721
|
}).strict();
|
|
@@ -23674,6 +23734,7 @@ var OmoConfigSchema = z14.object({
|
|
|
23674
23734
|
telemetry: OmoTelemetrySettingsSchema.optional(),
|
|
23675
23735
|
disabled_skills: OmoDisabledSkillsSchema.optional(),
|
|
23676
23736
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
23737
|
+
"[native]": OmoTypedHarnessConfigSchema.optional(),
|
|
23677
23738
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
23678
23739
|
"[codex]": OmoTypedHarnessConfigSchema.optional(),
|
|
23679
23740
|
profiles: z14.record(z14.string(), OmoConfigProfileSchema).default({}),
|
|
@@ -23695,6 +23756,7 @@ var OmoConfigLayerSchema = z14.object({
|
|
|
23695
23756
|
telemetry: OmoTelemetrySettingsLayerSchema.optional(),
|
|
23696
23757
|
disabled_skills: OmoDisabledSkillsSchema.optional(),
|
|
23697
23758
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
23759
|
+
"[native]": OmoTypedHarnessConfigSchema.optional(),
|
|
23698
23760
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
23699
23761
|
"[codex]": OmoTypedHarnessConfigSchema.optional(),
|
|
23700
23762
|
profiles: z14.record(z14.string(), OmoConfigProfileSchema).optional(),
|
|
@@ -23761,6 +23823,57 @@ function hasLegacyCategoryNames(document) {
|
|
|
23761
23823
|
return canonicalizeLegacyCategoryNames(document).renames.length > 0;
|
|
23762
23824
|
}
|
|
23763
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
|
+
|
|
23764
23877
|
// packages/omo-config-core/src/loader/loader.ts
|
|
23765
23878
|
init_main();
|
|
23766
23879
|
|
|
@@ -23901,7 +24014,7 @@ function resolveOmoConfigPaths(options) {
|
|
|
23901
24014
|
}
|
|
23902
24015
|
|
|
23903
24016
|
// packages/omo-config-core/src/loader/resolution.ts
|
|
23904
|
-
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));
|
|
23905
24018
|
function profileName(value) {
|
|
23906
24019
|
return value === "" ? undefined : value;
|
|
23907
24020
|
}
|
|
@@ -23930,7 +24043,13 @@ function withoutControlKeys(config) {
|
|
|
23930
24043
|
function harnessLayer(config, harness) {
|
|
23931
24044
|
if (harness === undefined)
|
|
23932
24045
|
return {};
|
|
23933
|
-
|
|
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;
|
|
23934
24053
|
}
|
|
23935
24054
|
function resolveOmoConfigView(options) {
|
|
23936
24055
|
const profiles = toRecord(options.config["profiles"]);
|
|
@@ -23981,6 +24100,7 @@ var DEFAULT_RAW_CONFIG = {
|
|
|
23981
24100
|
function stripResolutionControlKeys(config) {
|
|
23982
24101
|
const {
|
|
23983
24102
|
"[codex]": _codex,
|
|
24103
|
+
"[native]": _native,
|
|
23984
24104
|
"[opencode]": _opencode,
|
|
23985
24105
|
"[senpi]": _senpi,
|
|
23986
24106
|
profiles: _profiles,
|
|
@@ -24006,21 +24126,21 @@ function hasUnsafeUnrecognizedKey(issues) {
|
|
|
24006
24126
|
function hasTamperedPrototype(value) {
|
|
24007
24127
|
if (Array.isArray(value))
|
|
24008
24128
|
return value.some((entry) => hasTamperedPrototype(entry));
|
|
24009
|
-
if (!
|
|
24129
|
+
if (!isRecord12(value))
|
|
24010
24130
|
return false;
|
|
24011
24131
|
const prototype = Object.getPrototypeOf(value);
|
|
24012
24132
|
if (prototype !== Object.prototype && prototype !== null)
|
|
24013
24133
|
return true;
|
|
24014
24134
|
return Object.values(value).some((entry) => hasTamperedPrototype(entry));
|
|
24015
24135
|
}
|
|
24016
|
-
function
|
|
24136
|
+
function isRecord12(value) {
|
|
24017
24137
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24018
24138
|
}
|
|
24019
24139
|
function containerAt(record, path) {
|
|
24020
24140
|
let container = record;
|
|
24021
24141
|
for (const segment of path) {
|
|
24022
24142
|
const next = container[segment];
|
|
24023
|
-
if (!
|
|
24143
|
+
if (!isRecord12(next))
|
|
24024
24144
|
return null;
|
|
24025
24145
|
container = next;
|
|
24026
24146
|
}
|
|
@@ -24131,6 +24251,15 @@ function legacyCategoryDiagnostic(path, renames) {
|
|
|
24131
24251
|
issuePaths: renames.map((rename) => rename.path)
|
|
24132
24252
|
};
|
|
24133
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
|
+
}
|
|
24134
24263
|
function loadOmoConfig(options = {}) {
|
|
24135
24264
|
const fileSystem = options.fileSystem ?? DEFAULT_READ_FILE_SYSTEM;
|
|
24136
24265
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -24153,8 +24282,12 @@ function loadOmoConfig(options = {}) {
|
|
|
24153
24282
|
if (canonicalized.renames.length > 0) {
|
|
24154
24283
|
diagnostics.push(legacyCategoryDiagnostic(candidate.path, canonicalized.renames));
|
|
24155
24284
|
}
|
|
24156
|
-
|
|
24157
|
-
|
|
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);
|
|
24158
24291
|
}
|
|
24159
24292
|
}
|
|
24160
24293
|
const requestedProfile = resolveOmoProfileName({
|
|
@@ -25863,7 +25996,8 @@ var HookNameSchema = z32.enum([
|
|
|
25863
25996
|
"webfetch-redirect-guard",
|
|
25864
25997
|
"fsync-skip-warning",
|
|
25865
25998
|
"plan-format-validator",
|
|
25866
|
-
"legacy-plugin-toast"
|
|
25999
|
+
"legacy-plugin-toast",
|
|
26000
|
+
"native-edition-nudge"
|
|
25867
26001
|
]);
|
|
25868
26002
|
// packages/omo-opencode/src/config/schema/i18n.ts
|
|
25869
26003
|
import { z as z33 } from "zod";
|
|
@@ -27117,21 +27251,21 @@ var OPENAI_CATEGORIES = [
|
|
|
27117
27251
|
},
|
|
27118
27252
|
{
|
|
27119
27253
|
name: "quick",
|
|
27120
|
-
config: { model: "
|
|
27254
|
+
config: { model: "openai/gpt-5.6-luna-fast", variant: "low" },
|
|
27121
27255
|
description: "Trivial tasks - single file changes, typo fixes, simple modifications",
|
|
27122
27256
|
callerGuidance: QUICK_CATEGORY_CALLER_GUIDANCE,
|
|
27123
27257
|
promptAppend: QUICK_CATEGORY_PROMPT_APPEND
|
|
27124
27258
|
},
|
|
27125
27259
|
{
|
|
27126
27260
|
name: "unspecified-low",
|
|
27127
|
-
config: { model: "
|
|
27261
|
+
config: { model: "xiaomi/mimo-v2.6-pro", variant: "max" },
|
|
27128
27262
|
description: "Tasks that don't fit other categories, low effort required",
|
|
27129
27263
|
callerGuidance: UNSPECIFIED_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
27130
27264
|
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
27131
27265
|
},
|
|
27132
27266
|
{
|
|
27133
27267
|
name: "unspecified-high",
|
|
27134
|
-
config: { model: "
|
|
27268
|
+
config: { model: "anthropic/claude-opus-5-5", variant: "max" },
|
|
27135
27269
|
description: "Tasks that don't fit other categories, high effort required",
|
|
27136
27270
|
callerGuidance: UNSPECIFIED_HIGH_CATEGORY_CALLER_GUIDANCE,
|
|
27137
27271
|
promptAppend: UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND,
|
|
@@ -82518,6 +82652,216 @@ var model_capabilities_generated_default = {
|
|
|
82518
82652
|
context: 500000,
|
|
82519
82653
|
output: 500000
|
|
82520
82654
|
}
|
|
82655
|
+
},
|
|
82656
|
+
"claude-opus-5-5": {
|
|
82657
|
+
id: "claude-opus-5-5",
|
|
82658
|
+
family: "claude-opus",
|
|
82659
|
+
reasoning: true,
|
|
82660
|
+
temperature: false,
|
|
82661
|
+
toolCall: true,
|
|
82662
|
+
modalities: {
|
|
82663
|
+
input: [
|
|
82664
|
+
"text",
|
|
82665
|
+
"image",
|
|
82666
|
+
"pdf"
|
|
82667
|
+
],
|
|
82668
|
+
output: [
|
|
82669
|
+
"text"
|
|
82670
|
+
]
|
|
82671
|
+
},
|
|
82672
|
+
limit: {
|
|
82673
|
+
context: 1e6,
|
|
82674
|
+
output: 128000
|
|
82675
|
+
}
|
|
82676
|
+
},
|
|
82677
|
+
"claude-opus-5-5@default": {
|
|
82678
|
+
id: "claude-opus-5-5@default",
|
|
82679
|
+
family: "claude-opus",
|
|
82680
|
+
reasoning: true,
|
|
82681
|
+
temperature: false,
|
|
82682
|
+
toolCall: true,
|
|
82683
|
+
modalities: {
|
|
82684
|
+
input: [
|
|
82685
|
+
"text",
|
|
82686
|
+
"image",
|
|
82687
|
+
"pdf"
|
|
82688
|
+
],
|
|
82689
|
+
output: [
|
|
82690
|
+
"text"
|
|
82691
|
+
]
|
|
82692
|
+
},
|
|
82693
|
+
limit: {
|
|
82694
|
+
context: 1e6,
|
|
82695
|
+
output: 128000
|
|
82696
|
+
}
|
|
82697
|
+
},
|
|
82698
|
+
"anthropic/claude-opus-5.5": {
|
|
82699
|
+
id: "anthropic/claude-opus-5.5",
|
|
82700
|
+
family: "claude-opus",
|
|
82701
|
+
reasoning: true,
|
|
82702
|
+
temperature: true,
|
|
82703
|
+
toolCall: true,
|
|
82704
|
+
modalities: {
|
|
82705
|
+
input: [
|
|
82706
|
+
"text",
|
|
82707
|
+
"image",
|
|
82708
|
+
"pdf"
|
|
82709
|
+
],
|
|
82710
|
+
output: [
|
|
82711
|
+
"text"
|
|
82712
|
+
]
|
|
82713
|
+
},
|
|
82714
|
+
limit: {
|
|
82715
|
+
context: 1e6,
|
|
82716
|
+
output: 128000
|
|
82717
|
+
}
|
|
82718
|
+
},
|
|
82719
|
+
"au.anthropic.claude-opus-5-5": {
|
|
82720
|
+
id: "au.anthropic.claude-opus-5-5",
|
|
82721
|
+
family: "claude-opus",
|
|
82722
|
+
reasoning: true,
|
|
82723
|
+
temperature: false,
|
|
82724
|
+
toolCall: true,
|
|
82725
|
+
modalities: {
|
|
82726
|
+
input: [
|
|
82727
|
+
"text",
|
|
82728
|
+
"image",
|
|
82729
|
+
"pdf"
|
|
82730
|
+
],
|
|
82731
|
+
output: [
|
|
82732
|
+
"text"
|
|
82733
|
+
]
|
|
82734
|
+
},
|
|
82735
|
+
limit: {
|
|
82736
|
+
context: 1e6,
|
|
82737
|
+
output: 128000
|
|
82738
|
+
}
|
|
82739
|
+
},
|
|
82740
|
+
"anthropic.claude-opus-5-5": {
|
|
82741
|
+
id: "anthropic.claude-opus-5-5",
|
|
82742
|
+
family: "claude-opus",
|
|
82743
|
+
reasoning: true,
|
|
82744
|
+
temperature: false,
|
|
82745
|
+
toolCall: true,
|
|
82746
|
+
modalities: {
|
|
82747
|
+
input: [
|
|
82748
|
+
"text",
|
|
82749
|
+
"image",
|
|
82750
|
+
"pdf"
|
|
82751
|
+
],
|
|
82752
|
+
output: [
|
|
82753
|
+
"text"
|
|
82754
|
+
]
|
|
82755
|
+
},
|
|
82756
|
+
limit: {
|
|
82757
|
+
context: 1e6,
|
|
82758
|
+
output: 128000
|
|
82759
|
+
}
|
|
82760
|
+
},
|
|
82761
|
+
"eu.anthropic.claude-opus-5-5": {
|
|
82762
|
+
id: "eu.anthropic.claude-opus-5-5",
|
|
82763
|
+
family: "claude-opus",
|
|
82764
|
+
reasoning: true,
|
|
82765
|
+
temperature: false,
|
|
82766
|
+
toolCall: true,
|
|
82767
|
+
modalities: {
|
|
82768
|
+
input: [
|
|
82769
|
+
"text",
|
|
82770
|
+
"image",
|
|
82771
|
+
"pdf"
|
|
82772
|
+
],
|
|
82773
|
+
output: [
|
|
82774
|
+
"text"
|
|
82775
|
+
]
|
|
82776
|
+
},
|
|
82777
|
+
limit: {
|
|
82778
|
+
context: 1e6,
|
|
82779
|
+
output: 128000
|
|
82780
|
+
}
|
|
82781
|
+
},
|
|
82782
|
+
"global.anthropic.claude-opus-5-5": {
|
|
82783
|
+
id: "global.anthropic.claude-opus-5-5",
|
|
82784
|
+
family: "claude-opus",
|
|
82785
|
+
reasoning: true,
|
|
82786
|
+
temperature: false,
|
|
82787
|
+
toolCall: true,
|
|
82788
|
+
modalities: {
|
|
82789
|
+
input: [
|
|
82790
|
+
"text",
|
|
82791
|
+
"image",
|
|
82792
|
+
"pdf"
|
|
82793
|
+
],
|
|
82794
|
+
output: [
|
|
82795
|
+
"text"
|
|
82796
|
+
]
|
|
82797
|
+
},
|
|
82798
|
+
limit: {
|
|
82799
|
+
context: 1e6,
|
|
82800
|
+
output: 128000
|
|
82801
|
+
}
|
|
82802
|
+
},
|
|
82803
|
+
"jp.anthropic.claude-opus-5-5": {
|
|
82804
|
+
id: "jp.anthropic.claude-opus-5-5",
|
|
82805
|
+
family: "claude-opus",
|
|
82806
|
+
reasoning: true,
|
|
82807
|
+
temperature: false,
|
|
82808
|
+
toolCall: true,
|
|
82809
|
+
modalities: {
|
|
82810
|
+
input: [
|
|
82811
|
+
"text",
|
|
82812
|
+
"image",
|
|
82813
|
+
"pdf"
|
|
82814
|
+
],
|
|
82815
|
+
output: [
|
|
82816
|
+
"text"
|
|
82817
|
+
]
|
|
82818
|
+
},
|
|
82819
|
+
limit: {
|
|
82820
|
+
context: 1e6,
|
|
82821
|
+
output: 128000
|
|
82822
|
+
}
|
|
82823
|
+
},
|
|
82824
|
+
"us.anthropic.claude-opus-5-5": {
|
|
82825
|
+
id: "us.anthropic.claude-opus-5-5",
|
|
82826
|
+
family: "claude-opus",
|
|
82827
|
+
reasoning: true,
|
|
82828
|
+
temperature: false,
|
|
82829
|
+
toolCall: true,
|
|
82830
|
+
modalities: {
|
|
82831
|
+
input: [
|
|
82832
|
+
"text",
|
|
82833
|
+
"image",
|
|
82834
|
+
"pdf"
|
|
82835
|
+
],
|
|
82836
|
+
output: [
|
|
82837
|
+
"text"
|
|
82838
|
+
]
|
|
82839
|
+
},
|
|
82840
|
+
limit: {
|
|
82841
|
+
context: 1e6,
|
|
82842
|
+
output: 128000
|
|
82843
|
+
}
|
|
82844
|
+
},
|
|
82845
|
+
"anthropic/claude-opus-5-5": {
|
|
82846
|
+
id: "anthropic/claude-opus-5-5",
|
|
82847
|
+
family: "claude-opus",
|
|
82848
|
+
reasoning: true,
|
|
82849
|
+
temperature: false,
|
|
82850
|
+
toolCall: true,
|
|
82851
|
+
modalities: {
|
|
82852
|
+
input: [
|
|
82853
|
+
"text",
|
|
82854
|
+
"image",
|
|
82855
|
+
"pdf"
|
|
82856
|
+
],
|
|
82857
|
+
output: [
|
|
82858
|
+
"text"
|
|
82859
|
+
]
|
|
82860
|
+
},
|
|
82861
|
+
limit: {
|
|
82862
|
+
context: 1e6,
|
|
82863
|
+
output: 128000
|
|
82864
|
+
}
|
|
82521
82865
|
}
|
|
82522
82866
|
}
|
|
82523
82867
|
};
|
|
@@ -97276,7 +97620,7 @@ function getCachedVersion(options = {}) {
|
|
|
97276
97620
|
// package.json
|
|
97277
97621
|
var package_default = {
|
|
97278
97622
|
name: "oh-my-opencode",
|
|
97279
|
-
version: "5.0.0-beta.
|
|
97623
|
+
version: "5.0.0-beta.84",
|
|
97280
97624
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
97281
97625
|
main: "./dist/index.js",
|
|
97282
97626
|
types: "dist/index.d.ts",
|
|
@@ -97459,7 +97803,7 @@ var package_default = {
|
|
|
97459
97803
|
zod: "^4.6.5"
|
|
97460
97804
|
},
|
|
97461
97805
|
devDependencies: {
|
|
97462
|
-
"@code-yeongyu/senpi": "2026.9.22",
|
|
97806
|
+
"@code-yeongyu/senpi": "2026.9.22-4",
|
|
97463
97807
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
97464
97808
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
97465
97809
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -97499,18 +97843,18 @@ var package_default = {
|
|
|
97499
97843
|
typescript: "^7.0.2"
|
|
97500
97844
|
},
|
|
97501
97845
|
optionalDependencies: {
|
|
97502
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
97503
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
97504
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
97505
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
97506
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
97507
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
97508
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
97509
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
97510
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
97511
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
97512
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
97513
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
97846
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.84",
|
|
97847
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.84",
|
|
97848
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.84",
|
|
97849
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.84",
|
|
97850
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.84",
|
|
97851
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.84",
|
|
97852
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.84",
|
|
97853
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.84",
|
|
97854
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.84",
|
|
97855
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.84",
|
|
97856
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.84",
|
|
97857
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.84"
|
|
97514
97858
|
},
|
|
97515
97859
|
overrides: {
|
|
97516
97860
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -98034,14 +98378,14 @@ function transformConfigJsoncSources(input) {
|
|
|
98034
98378
|
const omo = recordAt(legacy, "[omo]");
|
|
98035
98379
|
const senpi = recordAt(legacy, "[senpi]");
|
|
98036
98380
|
const history = legacyMigrationHistory(input.discovered, input.sources);
|
|
98037
|
-
const diagnostics = omo !== undefined && senpi !== undefined ? ["conflict: [
|
|
98381
|
+
const diagnostics = omo !== undefined && senpi !== undefined ? ["conflict: [native] legacy [omo] kept [native]"] : [];
|
|
98038
98382
|
return {
|
|
98039
98383
|
diagnostics,
|
|
98040
98384
|
document: {
|
|
98041
98385
|
$schema: OMO_SCHEMA_URL,
|
|
98042
98386
|
...recordAt(legacy, "[opencode]") === undefined ? {} : { "[opencode]": recordAt(legacy, "[opencode]") },
|
|
98043
98387
|
...recordAt(legacy, "[codex]") === undefined ? {} : { "[codex]": recordAt(legacy, "[codex]") },
|
|
98044
|
-
...senpi === undefined && omo === undefined ? {} : { "[
|
|
98388
|
+
...senpi === undefined && omo === undefined ? {} : { "[native]": senpi ?? omo },
|
|
98045
98389
|
...Object.keys(history).length === 0 ? {} : { legacy_migrations: history }
|
|
98046
98390
|
}
|
|
98047
98391
|
};
|
|
@@ -98293,7 +98637,7 @@ function normalizeTypedBlock(value, path, diagnostics, recurseProfiles) {
|
|
|
98293
98637
|
}
|
|
98294
98638
|
if (result["models"] !== undefined)
|
|
98295
98639
|
result["models"] = normalizeCatalog(result["models"]);
|
|
98296
|
-
for (const harness of ["[senpi]", "[codex]"]) {
|
|
98640
|
+
for (const harness of ["[senpi]", "[native]", "[codex]"]) {
|
|
98297
98641
|
if (result[harness] !== undefined)
|
|
98298
98642
|
result[harness] = normalizeTypedBlock(result[harness], [...path, harness], diagnostics, false);
|
|
98299
98643
|
}
|
|
@@ -98339,6 +98683,71 @@ function transformCategoryDeepSplit(document) {
|
|
|
98339
98683
|
};
|
|
98340
98684
|
}
|
|
98341
98685
|
|
|
98686
|
+
// packages/omo-opencode/src/config-migration/harness-native-rename.ts
|
|
98687
|
+
var HARNESS_NATIVE_RENAME_MIGRATION_ID = "2026-09-harness-native-rename";
|
|
98688
|
+
function transformHarnessNativeRename(document) {
|
|
98689
|
+
const { document: canonicalized, renames } = canonicalizeLegacyHarnessBlocks(document);
|
|
98690
|
+
return {
|
|
98691
|
+
diagnostics: renames.map((rename) => rename.dropped ? `${rename.path} removed: ${rename.canonical} is already configured` : `${rename.path} renamed to ${rename.canonical}`),
|
|
98692
|
+
document: canonicalized
|
|
98693
|
+
};
|
|
98694
|
+
}
|
|
98695
|
+
|
|
98696
|
+
// packages/omo-opencode/src/config-migration/subscription-provider-rename.ts
|
|
98697
|
+
var SUBSCRIPTION_PROVIDER_RENAME_MIGRATION_ID = "2026-09-subscription-provider-rename";
|
|
98698
|
+
var LEGACY_PROVIDER_IDS = Object.freeze({
|
|
98699
|
+
"claude-sdk-oauth": "anthropic-subscription",
|
|
98700
|
+
"openai-codex": "chatgpt-subscription"
|
|
98701
|
+
});
|
|
98702
|
+
function renameProviderId(providerId) {
|
|
98703
|
+
return LEGACY_PROVIDER_IDS[providerId];
|
|
98704
|
+
}
|
|
98705
|
+
function renameModelReference(modelReference) {
|
|
98706
|
+
const providerSeparator = modelReference.indexOf("/");
|
|
98707
|
+
if (providerSeparator <= 0)
|
|
98708
|
+
return;
|
|
98709
|
+
const canonicalProvider = renameProviderId(modelReference.slice(0, providerSeparator));
|
|
98710
|
+
if (canonicalProvider === undefined)
|
|
98711
|
+
return;
|
|
98712
|
+
const modelPartVerbatim = modelReference.slice(providerSeparator);
|
|
98713
|
+
return `${canonicalProvider}${modelPartVerbatim}`;
|
|
98714
|
+
}
|
|
98715
|
+
function rewriteValue(value, path, rewrites) {
|
|
98716
|
+
if (typeof value === "string") {
|
|
98717
|
+
const renamed = renameModelReference(value) ?? renameProviderId(value);
|
|
98718
|
+
if (renamed === undefined)
|
|
98719
|
+
return value;
|
|
98720
|
+
rewrites.push({ from: value, path, to: renamed });
|
|
98721
|
+
return renamed;
|
|
98722
|
+
}
|
|
98723
|
+
if (Array.isArray(value))
|
|
98724
|
+
return value.map((entry, index) => rewriteValue(entry, `${path}[${index}]`, rewrites));
|
|
98725
|
+
if (value !== null && typeof value === "object") {
|
|
98726
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
98727
|
+
const canonicalKey = renameModelReference(key) ?? renameProviderId(key);
|
|
98728
|
+
const nextKey = canonicalKey ?? key;
|
|
98729
|
+
if (canonicalKey !== undefined)
|
|
98730
|
+
rewrites.push({ from: key, path: `${path}.${key}`, to: canonicalKey });
|
|
98731
|
+
return [nextKey, rewriteValue(entry, `${path}.${nextKey}`, rewrites)];
|
|
98732
|
+
}));
|
|
98733
|
+
}
|
|
98734
|
+
return value;
|
|
98735
|
+
}
|
|
98736
|
+
function hasLegacySubscriptionProviderIds(document) {
|
|
98737
|
+
const rewrites = [];
|
|
98738
|
+
rewriteValue(document, "$", rewrites);
|
|
98739
|
+
return rewrites.length > 0;
|
|
98740
|
+
}
|
|
98741
|
+
function transformSubscriptionProviderRename(document) {
|
|
98742
|
+
const rewrites = [];
|
|
98743
|
+
const rewritten = rewriteValue(document, "$", rewrites);
|
|
98744
|
+
const next = rewritten !== null && typeof rewritten === "object" && !Array.isArray(rewritten) ? rewritten : {};
|
|
98745
|
+
return {
|
|
98746
|
+
diagnostics: rewrites.map((rewrite) => `${rewrite.path}: ${rewrite.from} renamed to ${rewrite.to}`),
|
|
98747
|
+
document: next
|
|
98748
|
+
};
|
|
98749
|
+
}
|
|
98750
|
+
|
|
98342
98751
|
// packages/omo-opencode/src/config-migration/migration-plans.ts
|
|
98343
98752
|
function backupTimestamp(value) {
|
|
98344
98753
|
return value ?? new Date().toISOString().replace(/[:.]/g, "-");
|
|
@@ -98417,6 +98826,30 @@ function categoryDeepSplitPlan(targetPath) {
|
|
|
98417
98826
|
transform: inspect
|
|
98418
98827
|
};
|
|
98419
98828
|
}
|
|
98829
|
+
function harnessNativeRenamePlan(targetPath) {
|
|
98830
|
+
const inspect = (sources) => transformHarnessNativeRename(sources[0]?.value);
|
|
98831
|
+
return {
|
|
98832
|
+
id: HARNESS_NATIVE_RENAME_MIGRATION_ID,
|
|
98833
|
+
inspect,
|
|
98834
|
+
mode: "replace-target",
|
|
98835
|
+
shouldRun: hasLegacyHarnessBlocks,
|
|
98836
|
+
sources: [],
|
|
98837
|
+
targetPath,
|
|
98838
|
+
transform: inspect
|
|
98839
|
+
};
|
|
98840
|
+
}
|
|
98841
|
+
function subscriptionProviderRenamePlan(targetPath) {
|
|
98842
|
+
const inspect = (sources) => transformSubscriptionProviderRename(sources[0]?.value);
|
|
98843
|
+
return {
|
|
98844
|
+
id: SUBSCRIPTION_PROVIDER_RENAME_MIGRATION_ID,
|
|
98845
|
+
inspect,
|
|
98846
|
+
mode: "replace-target",
|
|
98847
|
+
shouldRun: hasLegacySubscriptionProviderIds,
|
|
98848
|
+
sources: [],
|
|
98849
|
+
targetPath,
|
|
98850
|
+
transform: inspect
|
|
98851
|
+
};
|
|
98852
|
+
}
|
|
98420
98853
|
function existingOmoConfigPath(directory, options) {
|
|
98421
98854
|
const fileSystem = discoveryFileSystem(options);
|
|
98422
98855
|
for (const fileName of ["omo.jsonc", "omo.json"]) {
|
|
@@ -98480,7 +98913,9 @@ function createLegacyConfigMigrationPlans(options) {
|
|
|
98480
98913
|
return [
|
|
98481
98914
|
...legacyPlans,
|
|
98482
98915
|
...inPlaceTargets.map(reasoningPlan),
|
|
98483
|
-
...inPlaceTargets.map(categoryDeepSplitPlan)
|
|
98916
|
+
...inPlaceTargets.map(categoryDeepSplitPlan),
|
|
98917
|
+
...inPlaceTargets.map(harnessNativeRenamePlan),
|
|
98918
|
+
...inPlaceTargets.map(subscriptionProviderRenamePlan)
|
|
98484
98919
|
];
|
|
98485
98920
|
}
|
|
98486
98921
|
// packages/omo-opencode/src/startup-migration.ts
|
|
@@ -122789,6 +123224,218 @@ Run: bunx ${PUBLISHED_PACKAGE_NAME} install`,
|
|
|
122789
123224
|
}
|
|
122790
123225
|
};
|
|
122791
123226
|
}
|
|
123227
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/types.ts
|
|
123228
|
+
var NUDGE_STATE_VERSION = 1;
|
|
123229
|
+
var NUDGE_INTERVALS_MS = [3, 7, 14].map((days) => days * 24 * 60 * 60 * 1000);
|
|
123230
|
+
var NUDGE_AUTO_SHOW_CAP = 4;
|
|
123231
|
+
var NUDGE_SNOOZE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
123232
|
+
var NUDGE_CORRUPT_RECOVERY_MS = 3 * 24 * 60 * 60 * 1000;
|
|
123233
|
+
|
|
123234
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/decide.ts
|
|
123235
|
+
function freshState(now, version) {
|
|
123236
|
+
return {
|
|
123237
|
+
schemaVersion: NUDGE_STATE_VERSION,
|
|
123238
|
+
autoShows: 0,
|
|
123239
|
+
lastShownAt: null,
|
|
123240
|
+
nextEligibleAt: now,
|
|
123241
|
+
decision: "none",
|
|
123242
|
+
decidedAt: null,
|
|
123243
|
+
writtenBy: version
|
|
123244
|
+
};
|
|
123245
|
+
}
|
|
123246
|
+
function recoveredState(now, version) {
|
|
123247
|
+
return { ...freshState(now, version), nextEligibleAt: now + NUDGE_CORRUPT_RECOVERY_MS };
|
|
123248
|
+
}
|
|
123249
|
+
function shownState(previous, now, version) {
|
|
123250
|
+
const autoShows = previous.autoShows + 1;
|
|
123251
|
+
const interval = NUDGE_INTERVALS_MS[Math.min(autoShows - 1, NUDGE_INTERVALS_MS.length - 1)] ?? 0;
|
|
123252
|
+
return {
|
|
123253
|
+
...previous,
|
|
123254
|
+
schemaVersion: NUDGE_STATE_VERSION,
|
|
123255
|
+
autoShows,
|
|
123256
|
+
lastShownAt: now,
|
|
123257
|
+
nextEligibleAt: now + interval,
|
|
123258
|
+
writtenBy: version
|
|
123259
|
+
};
|
|
123260
|
+
}
|
|
123261
|
+
function decideNativeEditionNudge(input) {
|
|
123262
|
+
const deny = (reason, nextState = null) => ({ show: false, reason, nextState });
|
|
123263
|
+
if (input.state !== "missing" && input.state !== "corrupt") {
|
|
123264
|
+
if (input.state.decision === "never")
|
|
123265
|
+
return deny("opted-out");
|
|
123266
|
+
if (input.state.decision === "migrated")
|
|
123267
|
+
return deny("already-migrated");
|
|
123268
|
+
}
|
|
123269
|
+
if (input.nativeEditionInstalled)
|
|
123270
|
+
return deny("already-migrated");
|
|
123271
|
+
if (input.hookDisabled)
|
|
123272
|
+
return deny("opted-out");
|
|
123273
|
+
if (!input.interactive)
|
|
123274
|
+
return deny("non-interactive");
|
|
123275
|
+
if (input.childSession)
|
|
123276
|
+
return deny("child-session");
|
|
123277
|
+
if (input.shownThisProcess)
|
|
123278
|
+
return deny("already-shown-this-process");
|
|
123279
|
+
if (!input.toastAvailable)
|
|
123280
|
+
return deny("toast-unavailable");
|
|
123281
|
+
if (!input.stateWritable)
|
|
123282
|
+
return deny("state-unwritable");
|
|
123283
|
+
if (input.state === "corrupt")
|
|
123284
|
+
return deny("state-corrupt-recovering", recoveredState(input.now, input.version));
|
|
123285
|
+
const current = input.state === "missing" ? freshState(input.now, input.version) : input.state;
|
|
123286
|
+
if (current.autoShows >= NUDGE_AUTO_SHOW_CAP)
|
|
123287
|
+
return deny("lifetime-cap-reached");
|
|
123288
|
+
if (input.now < current.nextEligibleAt)
|
|
123289
|
+
return deny("not-yet-eligible");
|
|
123290
|
+
return { show: true, reason: "eligible", nextState: shownState(current, input.now, input.version) };
|
|
123291
|
+
}
|
|
123292
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/hook.ts
|
|
123293
|
+
import { existsSync as existsSync84 } from "fs";
|
|
123294
|
+
import { homedir as homedir21 } from "os";
|
|
123295
|
+
import { join as join104 } from "path";
|
|
123296
|
+
|
|
123297
|
+
// packages/omo-opencode/src/cli/native-edition-hint.ts
|
|
123298
|
+
var NATIVE_EDITION_INSTALL_COMMAND = "bun add -g omo-ai@beta";
|
|
123299
|
+
|
|
123300
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/hook.ts
|
|
123301
|
+
init_logger2();
|
|
123302
|
+
|
|
123303
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/state.ts
|
|
123304
|
+
import { mkdirSync as mkdirSync20, readFileSync as readFileSync56, unlinkSync as unlinkSync15, writeFileSync as writeFileSync21 } from "fs";
|
|
123305
|
+
import { join as join103 } from "path";
|
|
123306
|
+
var NUDGE_STATE_FILE = "native-nudge.json";
|
|
123307
|
+
function isDecision(value) {
|
|
123308
|
+
return value === "none" || value === "snoozed" || value === "never" || value === "migrated";
|
|
123309
|
+
}
|
|
123310
|
+
function isEpoch(value) {
|
|
123311
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
123312
|
+
}
|
|
123313
|
+
function parseNudgeState(raw) {
|
|
123314
|
+
let parsed;
|
|
123315
|
+
try {
|
|
123316
|
+
parsed = JSON.parse(raw);
|
|
123317
|
+
} catch {
|
|
123318
|
+
return "corrupt";
|
|
123319
|
+
}
|
|
123320
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
123321
|
+
return "corrupt";
|
|
123322
|
+
const record = parsed;
|
|
123323
|
+
if (!isDecision(record["decision"]))
|
|
123324
|
+
return "corrupt";
|
|
123325
|
+
if (!isEpoch(record["nextEligibleAt"]))
|
|
123326
|
+
return "corrupt";
|
|
123327
|
+
const autoShows = record["autoShows"];
|
|
123328
|
+
return {
|
|
123329
|
+
schemaVersion: typeof record["schemaVersion"] === "number" ? record["schemaVersion"] : NUDGE_STATE_VERSION,
|
|
123330
|
+
autoShows: typeof autoShows === "number" && Number.isSafeInteger(autoShows) && autoShows >= 0 ? autoShows : 0,
|
|
123331
|
+
lastShownAt: isEpoch(record["lastShownAt"]) ? record["lastShownAt"] : null,
|
|
123332
|
+
nextEligibleAt: record["nextEligibleAt"],
|
|
123333
|
+
decision: record["decision"],
|
|
123334
|
+
decidedAt: isEpoch(record["decidedAt"]) ? record["decidedAt"] : null,
|
|
123335
|
+
writtenBy: typeof record["writtenBy"] === "string" ? record["writtenBy"] : "unknown"
|
|
123336
|
+
};
|
|
123337
|
+
}
|
|
123338
|
+
function createNudgeStateStore(stateDir) {
|
|
123339
|
+
const path = join103(stateDir, NUDGE_STATE_FILE);
|
|
123340
|
+
return {
|
|
123341
|
+
read: () => {
|
|
123342
|
+
let raw;
|
|
123343
|
+
try {
|
|
123344
|
+
raw = readFileSync56(path, "utf8");
|
|
123345
|
+
} catch {
|
|
123346
|
+
return "missing";
|
|
123347
|
+
}
|
|
123348
|
+
return parseNudgeState(raw);
|
|
123349
|
+
},
|
|
123350
|
+
write: (state) => {
|
|
123351
|
+
try {
|
|
123352
|
+
mkdirSync20(stateDir, { recursive: true });
|
|
123353
|
+
writeFileSync21(path, `${JSON.stringify(state, null, 2)}
|
|
123354
|
+
`, { mode: 384 });
|
|
123355
|
+
return true;
|
|
123356
|
+
} catch {
|
|
123357
|
+
return false;
|
|
123358
|
+
}
|
|
123359
|
+
},
|
|
123360
|
+
probeWritable: () => {
|
|
123361
|
+
const probe = join103(stateDir, `.${NUDGE_STATE_FILE}.probe`);
|
|
123362
|
+
try {
|
|
123363
|
+
mkdirSync20(stateDir, { recursive: true });
|
|
123364
|
+
writeFileSync21(probe, "", { mode: 384 });
|
|
123365
|
+
} catch {
|
|
123366
|
+
return false;
|
|
123367
|
+
}
|
|
123368
|
+
try {
|
|
123369
|
+
unlinkSync15(probe);
|
|
123370
|
+
} catch {}
|
|
123371
|
+
return true;
|
|
123372
|
+
}
|
|
123373
|
+
};
|
|
123374
|
+
}
|
|
123375
|
+
|
|
123376
|
+
// packages/omo-opencode/src/hooks/native-edition-nudge/hook.ts
|
|
123377
|
+
var NATIVE_NUDGE_TOAST_TITLE = "Try OmO Native: no host app needed";
|
|
123378
|
+
var NATIVE_NUDGE_TOAST_MESSAGE = `Same agent, one binary, nothing else to keep updated.
|
|
123379
|
+
Install: ${NATIVE_EDITION_INSTALL_COMMAND}`;
|
|
123380
|
+
function nativeEditionStateDir() {
|
|
123381
|
+
return join104(getUserConfigDir(), "oh-my-openagent");
|
|
123382
|
+
}
|
|
123383
|
+
function detectNativeEdition() {
|
|
123384
|
+
return existsSync84(join104(homedir21(), ".omo", "agent"));
|
|
123385
|
+
}
|
|
123386
|
+
function defaultInteractive() {
|
|
123387
|
+
if (process.env["CI"] !== undefined && process.env["CI"] !== "")
|
|
123388
|
+
return false;
|
|
123389
|
+
if (process.env["OMO_NON_INTERACTIVE"] === "1")
|
|
123390
|
+
return false;
|
|
123391
|
+
return process.stdout.isTTY === true;
|
|
123392
|
+
}
|
|
123393
|
+
function createNativeEditionNudgeHook(ctx, deps = {}) {
|
|
123394
|
+
let shownThisProcess = false;
|
|
123395
|
+
const store = deps.store ?? createNudgeStateStore(nativeEditionStateDir());
|
|
123396
|
+
const detect = deps.detectNativeEdition ?? detectNativeEdition;
|
|
123397
|
+
const now = deps.now ?? (() => Date.now());
|
|
123398
|
+
const interactive = deps.interactive ?? defaultInteractive;
|
|
123399
|
+
const version = deps.version ?? "unknown";
|
|
123400
|
+
const logFn = deps.log ?? log2;
|
|
123401
|
+
const persist = (next) => next === null ? true : store.write(next);
|
|
123402
|
+
return {
|
|
123403
|
+
event: async ({ event }) => {
|
|
123404
|
+
if (event.type !== "session.created")
|
|
123405
|
+
return;
|
|
123406
|
+
const props = event.properties;
|
|
123407
|
+
const decision = decideNativeEditionNudge({
|
|
123408
|
+
now: now(),
|
|
123409
|
+
state: store.read(),
|
|
123410
|
+
nativeEditionInstalled: detect(),
|
|
123411
|
+
hookDisabled: false,
|
|
123412
|
+
interactive: interactive(),
|
|
123413
|
+
childSession: props?.info?.parentID !== undefined,
|
|
123414
|
+
shownThisProcess,
|
|
123415
|
+
stateWritable: store.probeWritable(),
|
|
123416
|
+
toastAvailable: typeof ctx.client?.tui?.showToast === "function",
|
|
123417
|
+
version
|
|
123418
|
+
});
|
|
123419
|
+
if (!decision.show) {
|
|
123420
|
+
persist(decision.nextState);
|
|
123421
|
+
return;
|
|
123422
|
+
}
|
|
123423
|
+
if (!persist(decision.nextState)) {
|
|
123424
|
+
logFn("[native-edition-nudge] state write failed; suppressing the toast");
|
|
123425
|
+
return;
|
|
123426
|
+
}
|
|
123427
|
+
shownThisProcess = true;
|
|
123428
|
+
await ctx.client.tui.showToast({
|
|
123429
|
+
body: {
|
|
123430
|
+
title: NATIVE_NUDGE_TOAST_TITLE,
|
|
123431
|
+
message: NATIVE_NUDGE_TOAST_MESSAGE,
|
|
123432
|
+
variant: "info",
|
|
123433
|
+
duration: 1e4
|
|
123434
|
+
}
|
|
123435
|
+
}).catch(() => {});
|
|
123436
|
+
}
|
|
123437
|
+
};
|
|
123438
|
+
}
|
|
122792
123439
|
// packages/omo-opencode/src/shared/fsync-skip-warning-formatter.ts
|
|
122793
123440
|
var MAX_PATH_LINES = 5;
|
|
122794
123441
|
function selectMostCommonClassification(entries) {
|
|
@@ -122922,7 +123569,7 @@ function createNotepadWriteGuardHook() {
|
|
|
122922
123569
|
};
|
|
122923
123570
|
}
|
|
122924
123571
|
// packages/omo-opencode/src/hooks/plan-format-validator/hook.ts
|
|
122925
|
-
import { existsSync as
|
|
123572
|
+
import { existsSync as existsSync85, readFileSync as readFileSync57, writeFileSync as writeFileSync22 } from "fs";
|
|
122926
123573
|
import { resolve as resolve25 } from "path";
|
|
122927
123574
|
init_logger2();
|
|
122928
123575
|
var WRITE_TOOLS = new Set(["Write", "Edit", "write", "edit"]);
|
|
@@ -123120,13 +123767,13 @@ function createPlanFormatValidatorHook(_ctx) {
|
|
|
123120
123767
|
if (!isPlanFilePath(filePath))
|
|
123121
123768
|
return;
|
|
123122
123769
|
const resolvedPath = resolve25(_ctx.directory, filePath);
|
|
123123
|
-
if (!
|
|
123770
|
+
if (!existsSync85(resolvedPath))
|
|
123124
123771
|
return;
|
|
123125
|
-
let content =
|
|
123772
|
+
let content = readFileSync57(resolvedPath, "utf-8");
|
|
123126
123773
|
const effort = normalizePlanEffort(content);
|
|
123127
123774
|
if (effort !== null) {
|
|
123128
123775
|
content = effort.content;
|
|
123129
|
-
|
|
123776
|
+
writeFileSync22(resolvedPath, content, "utf-8");
|
|
123130
123777
|
log2(`[plan-format-validator] Plan ${filePath}: Effort "${effort.original}" normalized to ${effort.band}`, {
|
|
123131
123778
|
sessionID: input.sessionID,
|
|
123132
123779
|
filePath
|
|
@@ -123240,19 +123887,19 @@ tool.schema = z53;
|
|
|
123240
123887
|
|
|
123241
123888
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
123242
123889
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
123243
|
-
import { existsSync as
|
|
123244
|
-
import { dirname as dirname35, join as
|
|
123890
|
+
import { existsSync as existsSync87 } from "fs";
|
|
123891
|
+
import { dirname as dirname35, join as join106 } from "path";
|
|
123245
123892
|
|
|
123246
123893
|
// packages/omo-opencode/src/tools/grep/downloader.ts
|
|
123247
|
-
import { existsSync as
|
|
123248
|
-
import { join as
|
|
123894
|
+
import { existsSync as existsSync86, readdirSync as readdirSync24 } from "fs";
|
|
123895
|
+
import { join as join105 } from "path";
|
|
123249
123896
|
init_plugin_identity();
|
|
123250
123897
|
function findFileRecursive(dir, filename) {
|
|
123251
123898
|
try {
|
|
123252
123899
|
const entries = readdirSync24(dir, { withFileTypes: true, recursive: true });
|
|
123253
123900
|
for (const entry of entries) {
|
|
123254
123901
|
if (entry.isFile() && entry.name === filename) {
|
|
123255
|
-
return
|
|
123902
|
+
return join105(entry.parentPath ?? dir, entry.name);
|
|
123256
123903
|
}
|
|
123257
123904
|
}
|
|
123258
123905
|
} catch (error) {
|
|
@@ -123276,11 +123923,11 @@ function getPlatformKey() {
|
|
|
123276
123923
|
}
|
|
123277
123924
|
function getInstallDir() {
|
|
123278
123925
|
const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
|
|
123279
|
-
return
|
|
123926
|
+
return join105(homeDir, ".cache", CACHE_DIR_NAME, "bin");
|
|
123280
123927
|
}
|
|
123281
123928
|
function getRgPath() {
|
|
123282
123929
|
const isWindows = process.platform === "win32";
|
|
123283
|
-
return
|
|
123930
|
+
return join105(getInstallDir(), isWindows ? "rg.exe" : "rg");
|
|
123284
123931
|
}
|
|
123285
123932
|
async function extractTarGz2(archivePath, destDir) {
|
|
123286
123933
|
const platformKey = getPlatformKey();
|
|
@@ -123297,7 +123944,7 @@ async function extractZip2(archivePath, destDir) {
|
|
|
123297
123944
|
const binaryName = process.platform === "win32" ? "rg.exe" : "rg";
|
|
123298
123945
|
const foundPath = findFileRecursive(destDir, binaryName);
|
|
123299
123946
|
if (foundPath) {
|
|
123300
|
-
const destPath =
|
|
123947
|
+
const destPath = join105(destDir, binaryName);
|
|
123301
123948
|
if (foundPath !== destPath) {
|
|
123302
123949
|
const { renameSync } = await import("fs");
|
|
123303
123950
|
renameSync(foundPath, destPath);
|
|
@@ -123312,13 +123959,13 @@ async function downloadAndInstallRipgrep() {
|
|
|
123312
123959
|
}
|
|
123313
123960
|
const installDir = getInstallDir();
|
|
123314
123961
|
const rgPath = getRgPath();
|
|
123315
|
-
if (
|
|
123962
|
+
if (existsSync86(rgPath)) {
|
|
123316
123963
|
return rgPath;
|
|
123317
123964
|
}
|
|
123318
123965
|
ensureCacheDir(installDir);
|
|
123319
123966
|
const filename = `ripgrep-${RG_VERSION}-${config.platform}.${config.extension}`;
|
|
123320
123967
|
const url = `https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${filename}`;
|
|
123321
|
-
const archivePath =
|
|
123968
|
+
const archivePath = join105(installDir, filename);
|
|
123322
123969
|
try {
|
|
123323
123970
|
await downloadArchive(url, archivePath);
|
|
123324
123971
|
if (config.extension === "tar.gz") {
|
|
@@ -123327,7 +123974,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
123327
123974
|
await extractZip2(archivePath, installDir);
|
|
123328
123975
|
}
|
|
123329
123976
|
ensureExecutable(rgPath);
|
|
123330
|
-
if (!
|
|
123977
|
+
if (!existsSync86(rgPath)) {
|
|
123331
123978
|
throw new Error("ripgrep binary not found after extraction");
|
|
123332
123979
|
}
|
|
123333
123980
|
return rgPath;
|
|
@@ -123343,7 +123990,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
123343
123990
|
}
|
|
123344
123991
|
function getInstalledRipgrepPath() {
|
|
123345
123992
|
const rgPath = getRgPath();
|
|
123346
|
-
return
|
|
123993
|
+
return existsSync86(rgPath) ? rgPath : null;
|
|
123347
123994
|
}
|
|
123348
123995
|
|
|
123349
123996
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
@@ -123383,15 +124030,15 @@ function getOpenCodeBundledRg() {
|
|
|
123383
124030
|
const isWindows = process.platform === "win32";
|
|
123384
124031
|
const rgName = isWindows ? "rg.exe" : "rg";
|
|
123385
124032
|
const candidates = [
|
|
123386
|
-
|
|
123387
|
-
|
|
123388
|
-
|
|
123389
|
-
|
|
123390
|
-
|
|
123391
|
-
|
|
124033
|
+
join106(getOpenCodeCacheDir(), "bin", rgName),
|
|
124034
|
+
join106(getDataDir(), "opencode", "bin", rgName),
|
|
124035
|
+
join106(execDir, rgName),
|
|
124036
|
+
join106(execDir, "bin", rgName),
|
|
124037
|
+
join106(execDir, "..", "bin", rgName),
|
|
124038
|
+
join106(execDir, "..", "libexec", rgName)
|
|
123392
124039
|
];
|
|
123393
124040
|
for (const candidate of candidates) {
|
|
123394
|
-
if (
|
|
124041
|
+
if (existsSync87(candidate)) {
|
|
123395
124042
|
return candidate;
|
|
123396
124043
|
}
|
|
123397
124044
|
}
|
|
@@ -124565,9 +125212,9 @@ function createSkillTool(options) {
|
|
|
124565
125212
|
}
|
|
124566
125213
|
var skill = createSkillTool({ directory: process.cwd() });
|
|
124567
125214
|
// packages/omo-opencode/src/tools/session-manager/constants.ts
|
|
124568
|
-
import { join as
|
|
124569
|
-
var TODO_DIR2 =
|
|
124570
|
-
var TRANSCRIPT_DIR2 =
|
|
125215
|
+
import { join as join107 } from "path";
|
|
125216
|
+
var TODO_DIR2 = join107(getClaudeConfigDir(), "todos");
|
|
125217
|
+
var TRANSCRIPT_DIR2 = join107(getClaudeConfigDir(), "transcripts");
|
|
124571
125218
|
var SESSION_LIST_DESCRIPTION = `List all OpenCode sessions with optional filtering.
|
|
124572
125219
|
|
|
124573
125220
|
Returns a list of available session IDs with metadata including message count, date range, and agents used.
|
|
@@ -124640,9 +125287,9 @@ Has Todos: Yes (12 items, 8 completed)
|
|
|
124640
125287
|
Has Transcript: Yes (234 entries)`;
|
|
124641
125288
|
|
|
124642
125289
|
// packages/omo-opencode/src/tools/session-manager/file-storage.ts
|
|
124643
|
-
import { existsSync as
|
|
125290
|
+
import { existsSync as existsSync88 } from "fs";
|
|
124644
125291
|
import { readdir as readdir6, readFile as readFile8 } from "fs/promises";
|
|
124645
|
-
import { join as
|
|
125292
|
+
import { join as join108 } from "path";
|
|
124646
125293
|
|
|
124647
125294
|
// packages/omo-opencode/src/tools/session-manager/directory-filter.ts
|
|
124648
125295
|
import { normalize as normalize4, parse as parse3, sep as sep3 } from "path";
|
|
@@ -124666,7 +125313,7 @@ function ignoreFileStorageError(error) {
|
|
|
124666
125313
|
throw error;
|
|
124667
125314
|
}
|
|
124668
125315
|
async function getFileMainSessions(directory) {
|
|
124669
|
-
if (!
|
|
125316
|
+
if (!existsSync88(SESSION_STORAGE))
|
|
124670
125317
|
return [];
|
|
124671
125318
|
const sessions = [];
|
|
124672
125319
|
try {
|
|
@@ -124674,13 +125321,13 @@ async function getFileMainSessions(directory) {
|
|
|
124674
125321
|
for (const projectDir of projectDirs) {
|
|
124675
125322
|
if (!projectDir.isDirectory())
|
|
124676
125323
|
continue;
|
|
124677
|
-
const projectPath =
|
|
125324
|
+
const projectPath = join108(SESSION_STORAGE, projectDir.name);
|
|
124678
125325
|
const sessionFiles = await readdir6(projectPath);
|
|
124679
125326
|
for (const file of sessionFiles) {
|
|
124680
125327
|
if (!file.endsWith(".json"))
|
|
124681
125328
|
continue;
|
|
124682
125329
|
try {
|
|
124683
|
-
const content = await readFile8(
|
|
125330
|
+
const content = await readFile8(join108(projectPath, file), "utf-8");
|
|
124684
125331
|
const meta = JSON.parse(content);
|
|
124685
125332
|
if (meta.parentID)
|
|
124686
125333
|
continue;
|
|
@@ -124700,7 +125347,7 @@ async function getFileMainSessions(directory) {
|
|
|
124700
125347
|
return sessions.sort((a, b) => b.time.updated - a.time.updated);
|
|
124701
125348
|
}
|
|
124702
125349
|
async function getFileAllSessions() {
|
|
124703
|
-
if (!
|
|
125350
|
+
if (!existsSync88(MESSAGE_STORAGE))
|
|
124704
125351
|
return [];
|
|
124705
125352
|
const sessions = [];
|
|
124706
125353
|
async function scanDirectory(dir) {
|
|
@@ -124709,7 +125356,7 @@ async function getFileAllSessions() {
|
|
|
124709
125356
|
for (const entry of entries) {
|
|
124710
125357
|
if (!entry.isDirectory())
|
|
124711
125358
|
continue;
|
|
124712
|
-
const sessionPath =
|
|
125359
|
+
const sessionPath = join108(dir, entry.name);
|
|
124713
125360
|
const files = await readdir6(sessionPath);
|
|
124714
125361
|
if (files.some((file) => file.endsWith(".json"))) {
|
|
124715
125362
|
sessions.push(entry.name);
|
|
@@ -124730,7 +125377,7 @@ async function fileSessionExists(sessionID) {
|
|
|
124730
125377
|
}
|
|
124731
125378
|
async function getFileSessionMessages(sessionID) {
|
|
124732
125379
|
const messageDir = getMessageDir(sessionID);
|
|
124733
|
-
if (!messageDir || !
|
|
125380
|
+
if (!messageDir || !existsSync88(messageDir))
|
|
124734
125381
|
return [];
|
|
124735
125382
|
const messages = [];
|
|
124736
125383
|
try {
|
|
@@ -124739,7 +125386,7 @@ async function getFileSessionMessages(sessionID) {
|
|
|
124739
125386
|
if (!file.endsWith(".json"))
|
|
124740
125387
|
continue;
|
|
124741
125388
|
try {
|
|
124742
|
-
const content = await readFile8(
|
|
125389
|
+
const content = await readFile8(join108(messageDir, file), "utf-8");
|
|
124743
125390
|
const meta = JSON.parse(content);
|
|
124744
125391
|
const parts = await readParts2(meta.id);
|
|
124745
125392
|
messages.push({
|
|
@@ -124767,8 +125414,8 @@ async function getFileSessionMessages(sessionID) {
|
|
|
124767
125414
|
});
|
|
124768
125415
|
}
|
|
124769
125416
|
async function readParts2(messageID) {
|
|
124770
|
-
const partDir =
|
|
124771
|
-
if (!
|
|
125417
|
+
const partDir = join108(PART_STORAGE, messageID);
|
|
125418
|
+
if (!existsSync88(partDir))
|
|
124772
125419
|
return [];
|
|
124773
125420
|
const parts = [];
|
|
124774
125421
|
try {
|
|
@@ -124777,7 +125424,7 @@ async function readParts2(messageID) {
|
|
|
124777
125424
|
if (!file.endsWith(".json"))
|
|
124778
125425
|
continue;
|
|
124779
125426
|
try {
|
|
124780
|
-
const content = await readFile8(
|
|
125427
|
+
const content = await readFile8(join108(partDir, file), "utf-8");
|
|
124781
125428
|
parts.push(JSON.parse(content));
|
|
124782
125429
|
} catch (error) {
|
|
124783
125430
|
ignoreFileStorageError(error);
|
|
@@ -124791,14 +125438,14 @@ async function readParts2(messageID) {
|
|
|
124791
125438
|
return parts.sort((a, b) => a.id.localeCompare(b.id));
|
|
124792
125439
|
}
|
|
124793
125440
|
async function getFileSessionTodos(sessionID) {
|
|
124794
|
-
if (!
|
|
125441
|
+
if (!existsSync88(TODO_DIR2))
|
|
124795
125442
|
return [];
|
|
124796
125443
|
try {
|
|
124797
125444
|
const allFiles = await readdir6(TODO_DIR2);
|
|
124798
125445
|
const todoFiles = allFiles.filter((file) => file === `${sessionID}.json`);
|
|
124799
125446
|
for (const file of todoFiles) {
|
|
124800
125447
|
try {
|
|
124801
|
-
const content = await readFile8(
|
|
125448
|
+
const content = await readFile8(join108(TODO_DIR2, file), "utf-8");
|
|
124802
125449
|
const data = JSON.parse(content);
|
|
124803
125450
|
if (!Array.isArray(data))
|
|
124804
125451
|
continue;
|
|
@@ -124820,10 +125467,10 @@ async function getFileSessionTodos(sessionID) {
|
|
|
124820
125467
|
return [];
|
|
124821
125468
|
}
|
|
124822
125469
|
async function getFileSessionTranscript(sessionID) {
|
|
124823
|
-
if (!
|
|
125470
|
+
if (!existsSync88(TRANSCRIPT_DIR2))
|
|
124824
125471
|
return 0;
|
|
124825
|
-
const transcriptFile =
|
|
124826
|
-
if (!
|
|
125472
|
+
const transcriptFile = join108(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
|
|
125473
|
+
if (!existsSync88(transcriptFile))
|
|
124827
125474
|
return 0;
|
|
124828
125475
|
try {
|
|
124829
125476
|
const content = await readFile8(transcriptFile, "utf-8");
|
|
@@ -126685,23 +127332,23 @@ Other built-in agents, custom agents, and task categories are intentionally not
|
|
|
126685
127332
|
|
|
126686
127333
|
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.`;
|
|
126687
127334
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
126688
|
-
import { existsSync as
|
|
126689
|
-
import { join as
|
|
127335
|
+
import { existsSync as existsSync93, readdirSync as readdirSync25 } from "fs";
|
|
127336
|
+
import { join as join114 } from "path";
|
|
126690
127337
|
|
|
126691
127338
|
// packages/claude-code-compat-core/src/shared/claude-config-dir.ts
|
|
126692
|
-
import { homedir as
|
|
126693
|
-
import { join as
|
|
127339
|
+
import { homedir as homedir22 } from "os";
|
|
127340
|
+
import { join as join109 } from "path";
|
|
126694
127341
|
function getClaudeConfigDir3() {
|
|
126695
127342
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
126696
127343
|
if (envConfigDir) {
|
|
126697
127344
|
return envConfigDir;
|
|
126698
127345
|
}
|
|
126699
|
-
return
|
|
127346
|
+
return join109(process.env.HOME || process.env.USERPROFILE || homedir22(), ".claude");
|
|
126700
127347
|
}
|
|
126701
127348
|
// packages/claude-code-compat-core/src/shared/opencode-config-dir.ts
|
|
126702
|
-
import { existsSync as
|
|
126703
|
-
import { homedir as
|
|
126704
|
-
import { join as
|
|
127349
|
+
import { existsSync as existsSync89, realpathSync as realpathSync16 } from "fs";
|
|
127350
|
+
import { homedir as homedir23 } from "os";
|
|
127351
|
+
import { join as join110, posix as posix10, resolve as resolve29, win32 as win3211 } from "path";
|
|
126705
127352
|
var TAURI_APP_IDENTIFIER3 = "ai.opencode.desktop";
|
|
126706
127353
|
var TAURI_APP_IDENTIFIER_DEV3 = "ai.opencode.desktop.dev";
|
|
126707
127354
|
function isDevBuild3(version) {
|
|
@@ -126713,15 +127360,15 @@ function getTauriConfigDir3(identifier) {
|
|
|
126713
127360
|
const platform = process.platform;
|
|
126714
127361
|
switch (platform) {
|
|
126715
127362
|
case "darwin":
|
|
126716
|
-
return
|
|
127363
|
+
return join110(homedir23(), "Library", "Application Support", identifier);
|
|
126717
127364
|
case "win32": {
|
|
126718
|
-
const appData = process.env.APPDATA ||
|
|
127365
|
+
const appData = process.env.APPDATA || join110(homedir23(), "AppData", "Roaming");
|
|
126719
127366
|
return win3211.join(appData, identifier);
|
|
126720
127367
|
}
|
|
126721
127368
|
case "linux":
|
|
126722
127369
|
default: {
|
|
126723
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
126724
|
-
return
|
|
127370
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join110(homedir23(), ".config");
|
|
127371
|
+
return join110(xdgConfig, identifier);
|
|
126725
127372
|
}
|
|
126726
127373
|
}
|
|
126727
127374
|
}
|
|
@@ -126730,7 +127377,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
126730
127377
|
return posix10.normalize(pathValue);
|
|
126731
127378
|
}
|
|
126732
127379
|
const resolvedPath = resolve29(pathValue);
|
|
126733
|
-
if (!
|
|
127380
|
+
if (!existsSync89(resolvedPath))
|
|
126734
127381
|
return resolvedPath;
|
|
126735
127382
|
try {
|
|
126736
127383
|
return realpathSync16(resolvedPath);
|
|
@@ -126764,8 +127411,8 @@ function getWslLinuxHomeDir3(windowsConfigRoot) {
|
|
|
126764
127411
|
function getCliDefaultConfigDir3() {
|
|
126765
127412
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
126766
127413
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment3() && isWindowsUserConfigRoot3(envXdgConfig);
|
|
126767
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix10.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
126768
|
-
const configDir = isWslEnvironment3() ? posix10.join(xdgConfig, "opencode") :
|
|
127414
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix10.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join110(homedir23(), ".config");
|
|
127415
|
+
const configDir = isWslEnvironment3() ? posix10.join(xdgConfig, "opencode") : join110(xdgConfig, "opencode");
|
|
126769
127416
|
return resolveConfigPath3(configDir);
|
|
126770
127417
|
}
|
|
126771
127418
|
function getCliCustomConfigDir3() {
|
|
@@ -126798,9 +127445,9 @@ function getOpenCodeConfigDir3(options) {
|
|
|
126798
127445
|
const tauriDir = process.platform === "win32" ? win3211.isAbsolute(tauriDirBase) ? win3211.normalize(tauriDirBase) : win3211.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
126799
127446
|
if (checkExisting) {
|
|
126800
127447
|
const legacyDir = getCliConfigDir3();
|
|
126801
|
-
const legacyConfig =
|
|
126802
|
-
const legacyConfigC =
|
|
126803
|
-
if (
|
|
127448
|
+
const legacyConfig = join110(legacyDir, "opencode.json");
|
|
127449
|
+
const legacyConfigC = join110(legacyDir, "opencode.jsonc");
|
|
127450
|
+
if (existsSync89(legacyConfig) || existsSync89(legacyConfigC)) {
|
|
126804
127451
|
return legacyDir;
|
|
126805
127452
|
}
|
|
126806
127453
|
}
|
|
@@ -126809,11 +127456,11 @@ function getOpenCodeConfigDir3(options) {
|
|
|
126809
127456
|
// packages/claude-code-compat-core/src/shared/jsonc-parser.ts
|
|
126810
127457
|
init_src();
|
|
126811
127458
|
// packages/claude-code-compat-core/src/shared/resolve-agent-definition-paths.ts
|
|
126812
|
-
import { homedir as
|
|
126813
|
-
import { isAbsolute as isAbsolute16, join as
|
|
127459
|
+
import { homedir as homedir24 } from "os";
|
|
127460
|
+
import { isAbsolute as isAbsolute16, join as join111, resolve as resolve30 } from "path";
|
|
126814
127461
|
function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
|
|
126815
127462
|
return paths.flatMap((p) => {
|
|
126816
|
-
const expanded = p.startsWith("~/") ?
|
|
127463
|
+
const expanded = p.startsWith("~/") ? join111(homedir24(), p.slice(2)) : p;
|
|
126817
127464
|
const resolved = isAbsolute16(expanded) ? expanded : resolve30(baseDir, expanded);
|
|
126818
127465
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
126819
127466
|
log4(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
@@ -126841,7 +127488,7 @@ var EXCLUDED_DIR_NAMES2 = [
|
|
|
126841
127488
|
];
|
|
126842
127489
|
var EXCLUDED_DIRS3 = Object.freeze(new Set(EXCLUDED_DIR_NAMES2));
|
|
126843
127490
|
// packages/claude-code-compat-core/src/shared/opencode-command-dirs.ts
|
|
126844
|
-
import { basename as basename15, dirname as dirname38, join as
|
|
127491
|
+
import { basename as basename15, dirname as dirname38, join as join112 } from "path";
|
|
126845
127492
|
function getParentOpencodeConfigDir3(configDir) {
|
|
126846
127493
|
const parentDir = dirname38(configDir);
|
|
126847
127494
|
if (basename15(parentDir) !== "profiles") {
|
|
@@ -126855,21 +127502,21 @@ function getOpenCodeCommandDirs2(options) {
|
|
|
126855
127502
|
...configDirs.flatMap((configDir) => {
|
|
126856
127503
|
const parentConfigDir = getParentOpencodeConfigDir3(configDir);
|
|
126857
127504
|
return [
|
|
126858
|
-
|
|
126859
|
-
|
|
126860
|
-
...parentConfigDir ? [
|
|
127505
|
+
join112(configDir, "commands"),
|
|
127506
|
+
join112(configDir, "command"),
|
|
127507
|
+
...parentConfigDir ? [join112(parentConfigDir, "commands"), join112(parentConfigDir, "command")] : []
|
|
126861
127508
|
];
|
|
126862
127509
|
})
|
|
126863
127510
|
]));
|
|
126864
127511
|
}
|
|
126865
127512
|
// packages/claude-code-compat-core/src/shared/project-discovery-dirs.ts
|
|
126866
127513
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
126867
|
-
import { existsSync as
|
|
126868
|
-
import { dirname as dirname39, join as
|
|
127514
|
+
import { existsSync as existsSync90, realpathSync as realpathSync17 } from "fs";
|
|
127515
|
+
import { dirname as dirname39, join as join113, resolve as resolve31, win32 as win3212 } from "path";
|
|
126869
127516
|
var worktreePathCache3 = new Map;
|
|
126870
127517
|
function normalizePath6(path) {
|
|
126871
127518
|
const resolvedPath = process.platform !== "win32" && win3212.isAbsolute(path) ? path : resolve31(path);
|
|
126872
|
-
if (!
|
|
127519
|
+
if (!existsSync90(resolvedPath)) {
|
|
126873
127520
|
return resolvedPath;
|
|
126874
127521
|
}
|
|
126875
127522
|
try {
|
|
@@ -126924,7 +127571,7 @@ function detectWorktreePath4(directory) {
|
|
|
126924
127571
|
function findGitMarkerAncestor(directory) {
|
|
126925
127572
|
let currentDirectory = normalizePath6(directory);
|
|
126926
127573
|
while (true) {
|
|
126927
|
-
if (
|
|
127574
|
+
if (existsSync90(join113(currentDirectory, ".git"))) {
|
|
126928
127575
|
return currentDirectory;
|
|
126929
127576
|
}
|
|
126930
127577
|
const parentDirectory = dirname39(currentDirectory);
|
|
@@ -126942,8 +127589,8 @@ function findAncestorDirectories3(startDirectory, targetPaths, stopDirectory) {
|
|
|
126942
127589
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey4(resolvedStopDirectory) : undefined;
|
|
126943
127590
|
while (true) {
|
|
126944
127591
|
for (const targetPath of targetPaths) {
|
|
126945
|
-
const candidateDirectory =
|
|
126946
|
-
if (!
|
|
127592
|
+
const candidateDirectory = join113(currentDirectory, ...targetPath);
|
|
127593
|
+
if (!existsSync90(candidateDirectory)) {
|
|
126947
127594
|
continue;
|
|
126948
127595
|
}
|
|
126949
127596
|
const normalizedCandidateDirectory = normalizePath6(candidateDirectory);
|
|
@@ -126972,17 +127619,17 @@ function findProjectOpencodeCommandDirs2(startDirectory, stopDirectory) {
|
|
|
126972
127619
|
], detectedStopDirectory);
|
|
126973
127620
|
}
|
|
126974
127621
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
126975
|
-
import { existsSync as
|
|
127622
|
+
import { existsSync as existsSync92, readFileSync as readFileSync59 } from "fs";
|
|
126976
127623
|
import { basename as basename16, extname as extname3 } from "path";
|
|
126977
127624
|
|
|
126978
127625
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/json-agent-loader.ts
|
|
126979
|
-
import { existsSync as
|
|
127626
|
+
import { existsSync as existsSync91, readFileSync as readFileSync58 } from "fs";
|
|
126980
127627
|
function parseJsonAgentFile(filePath, scope) {
|
|
126981
127628
|
try {
|
|
126982
|
-
if (!
|
|
127629
|
+
if (!existsSync91(filePath)) {
|
|
126983
127630
|
return null;
|
|
126984
127631
|
}
|
|
126985
|
-
const content =
|
|
127632
|
+
const content = readFileSync58(filePath, "utf-8");
|
|
126986
127633
|
const { data } = parseJsoncSafe(content);
|
|
126987
127634
|
if (!data) {
|
|
126988
127635
|
return null;
|
|
@@ -127020,10 +127667,10 @@ function parseJsonAgentFile(filePath, scope) {
|
|
|
127020
127667
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
127021
127668
|
function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
127022
127669
|
try {
|
|
127023
|
-
if (!
|
|
127670
|
+
if (!existsSync92(filePath)) {
|
|
127024
127671
|
return null;
|
|
127025
127672
|
}
|
|
127026
|
-
const content =
|
|
127673
|
+
const content = readFileSync59(filePath, "utf-8");
|
|
127027
127674
|
const { data, body } = parseFrontmatter(content);
|
|
127028
127675
|
const fileName = basename16(filePath);
|
|
127029
127676
|
const agentName = fileName.replace(/\.md$/i, "");
|
|
@@ -127057,7 +127704,7 @@ function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
|
127057
127704
|
function loadAgentDefinitions(paths, scope, anthropicProvider) {
|
|
127058
127705
|
const result = Object.create(null);
|
|
127059
127706
|
for (const filePath of paths) {
|
|
127060
|
-
if (!
|
|
127707
|
+
if (!existsSync92(filePath)) {
|
|
127061
127708
|
log4(`[agent-definitions-loader] File not found, skipping: ${filePath}`);
|
|
127062
127709
|
continue;
|
|
127063
127710
|
}
|
|
@@ -127082,7 +127729,7 @@ function loadAgentDefinitions(paths, scope, anthropicProvider) {
|
|
|
127082
127729
|
|
|
127083
127730
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
127084
127731
|
function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
127085
|
-
if (!
|
|
127732
|
+
if (!existsSync93(agentsDir)) {
|
|
127086
127733
|
return [];
|
|
127087
127734
|
}
|
|
127088
127735
|
const entries = readdirSync25(agentsDir, { withFileTypes: true });
|
|
@@ -127090,7 +127737,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
127090
127737
|
for (const entry of entries) {
|
|
127091
127738
|
if (!isMarkdownFile(entry))
|
|
127092
127739
|
continue;
|
|
127093
|
-
const agentPath =
|
|
127740
|
+
const agentPath = join114(agentsDir, entry.name);
|
|
127094
127741
|
const agent = parseMarkdownAgentFile(agentPath, scope, anthropicProvider);
|
|
127095
127742
|
if (agent) {
|
|
127096
127743
|
agents.push(agent);
|
|
@@ -127099,7 +127746,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
127099
127746
|
return agents;
|
|
127100
127747
|
}
|
|
127101
127748
|
function loadUserAgents(anthropicProvider) {
|
|
127102
|
-
const userAgentsDir =
|
|
127749
|
+
const userAgentsDir = join114(getClaudeConfigDir3(), "agents");
|
|
127103
127750
|
const agents = loadAgentsFromDir(userAgentsDir, "user", anthropicProvider);
|
|
127104
127751
|
const result = Object.create(null);
|
|
127105
127752
|
for (const agent of agents) {
|
|
@@ -127108,7 +127755,7 @@ function loadUserAgents(anthropicProvider) {
|
|
|
127108
127755
|
return result;
|
|
127109
127756
|
}
|
|
127110
127757
|
function loadProjectAgents(directory, anthropicProvider) {
|
|
127111
|
-
const projectAgentsDir =
|
|
127758
|
+
const projectAgentsDir = join114(directory ?? process.cwd(), ".claude", "agents");
|
|
127112
127759
|
const agents = loadAgentsFromDir(projectAgentsDir, "project", anthropicProvider);
|
|
127113
127760
|
const result = Object.create(null);
|
|
127114
127761
|
for (const agent of agents) {
|
|
@@ -127120,7 +127767,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
127120
127767
|
const result = Object.create(null);
|
|
127121
127768
|
const configDirs = getOpenCodeConfigDirs3({ binary: "opencode" });
|
|
127122
127769
|
for (const configDir of configDirs) {
|
|
127123
|
-
const opencodeAgentsDir =
|
|
127770
|
+
const opencodeAgentsDir = join114(configDir, "agents");
|
|
127124
127771
|
const agents = loadAgentsFromDir(opencodeAgentsDir, "opencode");
|
|
127125
127772
|
for (const agent of agents) {
|
|
127126
127773
|
if (!(agent.name in result)) {
|
|
@@ -127131,7 +127778,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
127131
127778
|
return result;
|
|
127132
127779
|
}
|
|
127133
127780
|
function loadOpencodeProjectAgents(directory) {
|
|
127134
|
-
const opencodeProjectDir =
|
|
127781
|
+
const opencodeProjectDir = join114(directory ?? process.cwd(), ".opencode", "agents");
|
|
127135
127782
|
const agents = loadAgentsFromDir(opencodeProjectDir, "opencode-project");
|
|
127136
127783
|
const result = Object.create(null);
|
|
127137
127784
|
for (const agent of agents) {
|
|
@@ -127953,15 +128600,15 @@ function validateArgs(args) {
|
|
|
127953
128600
|
}
|
|
127954
128601
|
|
|
127955
128602
|
// packages/omo-opencode/src/tools/look-at/look-at-input-preparer.ts
|
|
127956
|
-
import { readFileSync as
|
|
128603
|
+
import { readFileSync as readFileSync62 } from "fs";
|
|
127957
128604
|
import { basename as basename17 } from "path";
|
|
127958
128605
|
import { pathToFileURL } from "url";
|
|
127959
128606
|
|
|
127960
128607
|
// packages/omo-opencode/src/tools/look-at/image-converter.ts
|
|
127961
128608
|
import * as childProcess2 from "child_process";
|
|
127962
|
-
import { existsSync as
|
|
128609
|
+
import { existsSync as existsSync95, mkdtempSync, readFileSync as readFileSync61, rmSync as rmSync5, unlinkSync as unlinkSync16, writeFileSync as writeFileSync23 } from "fs";
|
|
127963
128610
|
import { tmpdir as tmpdir7 } from "os";
|
|
127964
|
-
import { dirname as dirname41, join as
|
|
128611
|
+
import { dirname as dirname41, join as join116 } from "path";
|
|
127965
128612
|
var SUPPORTED_FORMATS = new Set([
|
|
127966
128613
|
"image/jpeg",
|
|
127967
128614
|
"image/png",
|
|
@@ -127991,8 +128638,8 @@ var UNSUPPORTED_FORMATS = new Set([
|
|
|
127991
128638
|
var CONVERSION_TIMEOUT_MS = 30000;
|
|
127992
128639
|
function cleanupTemporaryFileAfterFailure(filePath) {
|
|
127993
128640
|
try {
|
|
127994
|
-
if (
|
|
127995
|
-
|
|
128641
|
+
if (existsSync95(filePath)) {
|
|
128642
|
+
unlinkSync16(filePath);
|
|
127996
128643
|
}
|
|
127997
128644
|
} catch (cleanupError) {
|
|
127998
128645
|
const cleanupErrorDescription = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
|
|
@@ -128009,11 +128656,11 @@ function needsConversion(mimeType) {
|
|
|
128009
128656
|
return mimeType.startsWith("image/");
|
|
128010
128657
|
}
|
|
128011
128658
|
function convertImageToJpeg(inputPath, mimeType) {
|
|
128012
|
-
if (!
|
|
128659
|
+
if (!existsSync95(inputPath)) {
|
|
128013
128660
|
throw new Error(`File not found: ${inputPath}`);
|
|
128014
128661
|
}
|
|
128015
|
-
const tempDir = mkdtempSync(
|
|
128016
|
-
const outputPath =
|
|
128662
|
+
const tempDir = mkdtempSync(join116(tmpdir7(), "opencode-img-"));
|
|
128663
|
+
const outputPath = join116(tempDir, "converted.jpg");
|
|
128017
128664
|
log2(`[image-converter] Converting ${mimeType} to JPEG: ${inputPath}`);
|
|
128018
128665
|
try {
|
|
128019
128666
|
if (process.platform === "darwin") {
|
|
@@ -128023,7 +128670,7 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
128023
128670
|
encoding: "utf-8",
|
|
128024
128671
|
timeout: CONVERSION_TIMEOUT_MS
|
|
128025
128672
|
});
|
|
128026
|
-
if (
|
|
128673
|
+
if (existsSync95(outputPath)) {
|
|
128027
128674
|
log2(`[image-converter] Converted using sips: ${outputPath}`);
|
|
128028
128675
|
return outputPath;
|
|
128029
128676
|
}
|
|
@@ -128039,7 +128686,7 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
128039
128686
|
encoding: "utf-8",
|
|
128040
128687
|
timeout: CONVERSION_TIMEOUT_MS
|
|
128041
128688
|
});
|
|
128042
|
-
if (
|
|
128689
|
+
if (existsSync95(outputPath)) {
|
|
128043
128690
|
log2(`[image-converter] Converted using ImageMagick: ${outputPath}`);
|
|
128044
128691
|
return outputPath;
|
|
128045
128692
|
}
|
|
@@ -128063,11 +128710,11 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
128063
128710
|
function cleanupConvertedImage(filePath) {
|
|
128064
128711
|
try {
|
|
128065
128712
|
const tempDirectory = dirname41(filePath);
|
|
128066
|
-
if (
|
|
128067
|
-
|
|
128713
|
+
if (existsSync95(filePath)) {
|
|
128714
|
+
unlinkSync16(filePath);
|
|
128068
128715
|
log2(`[image-converter] Cleaned up temporary file: ${filePath}`);
|
|
128069
128716
|
}
|
|
128070
|
-
if (
|
|
128717
|
+
if (existsSync95(tempDirectory)) {
|
|
128071
128718
|
rmSync5(tempDirectory, { recursive: true, force: true });
|
|
128072
128719
|
log2(`[image-converter] Cleaned up temporary directory: ${tempDirectory}`);
|
|
128073
128720
|
}
|
|
@@ -128077,18 +128724,18 @@ function cleanupConvertedImage(filePath) {
|
|
|
128077
128724
|
}
|
|
128078
128725
|
}
|
|
128079
128726
|
function convertBase64ImageToJpeg(base64Data, mimeType) {
|
|
128080
|
-
const tempDir = mkdtempSync(
|
|
128727
|
+
const tempDir = mkdtempSync(join116(tmpdir7(), "opencode-b64-"));
|
|
128081
128728
|
const inputExt = mimeType.split("/")[1] || "bin";
|
|
128082
|
-
const inputPath =
|
|
128729
|
+
const inputPath = join116(tempDir, `input.${inputExt}`);
|
|
128083
128730
|
const tempFiles = [inputPath];
|
|
128084
128731
|
try {
|
|
128085
128732
|
const cleanBase64 = base64Data.replace(/^data:[^;]+;base64,/, "");
|
|
128086
128733
|
const buffer = Buffer.from(cleanBase64, "base64");
|
|
128087
|
-
|
|
128734
|
+
writeFileSync23(inputPath, buffer);
|
|
128088
128735
|
log2(`[image-converter] Converting Base64 ${mimeType} to JPEG`);
|
|
128089
128736
|
const outputPath = convertImageToJpeg(inputPath, mimeType);
|
|
128090
128737
|
tempFiles.push(outputPath);
|
|
128091
|
-
const convertedBuffer =
|
|
128738
|
+
const convertedBuffer = readFileSync61(outputPath);
|
|
128092
128739
|
const convertedBase64 = convertedBuffer.toString("base64");
|
|
128093
128740
|
log2(`[image-converter] Base64 conversion successful`);
|
|
128094
128741
|
return { base64: convertedBase64, tempFiles };
|
|
@@ -128118,7 +128765,7 @@ function getTemporaryConversionPath(error) {
|
|
|
128118
128765
|
function readJsonTextPart(filePath) {
|
|
128119
128766
|
let fileContent;
|
|
128120
128767
|
try {
|
|
128121
|
-
fileContent =
|
|
128768
|
+
fileContent = readFileSync62(filePath, "utf-8");
|
|
128122
128769
|
} catch (error) {
|
|
128123
128770
|
const code = error instanceof Error ? Reflect.get(error, "code") : undefined;
|
|
128124
128771
|
if (code === "ENOENT") {
|
|
@@ -132350,7 +132997,7 @@ function isExplicitSyncRun(runInBackground) {
|
|
|
132350
132997
|
return runInBackground === false || runInBackground === "false";
|
|
132351
132998
|
}
|
|
132352
132999
|
// packages/omo-opencode/src/tools/task/task-create.ts
|
|
132353
|
-
import { join as
|
|
133000
|
+
import { join as join118 } from "path";
|
|
132354
133001
|
|
|
132355
133002
|
// packages/omo-opencode/src/tools/task/types.ts
|
|
132356
133003
|
import { z as z54 } from "zod";
|
|
@@ -132405,8 +133052,8 @@ var TaskDeleteInputSchema = z54.object({
|
|
|
132405
133052
|
});
|
|
132406
133053
|
|
|
132407
133054
|
// packages/omo-opencode/src/features/claude-tasks/storage.ts
|
|
132408
|
-
import { join as
|
|
132409
|
-
import { existsSync as
|
|
133055
|
+
import { join as join117, dirname as dirname42, basename as basename18, isAbsolute as isAbsolute17 } from "path";
|
|
133056
|
+
import { existsSync as existsSync96, mkdirSync as mkdirSync21, readFileSync as readFileSync63, writeFileSync as writeFileSync24, renameSync as renameSync8, unlinkSync as unlinkSync17, readdirSync as readdirSync26 } from "fs";
|
|
132410
133057
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
132411
133058
|
function ignoreClaudeTaskStorageError(error) {
|
|
132412
133059
|
if (error instanceof Error)
|
|
@@ -132417,11 +133064,11 @@ function getTaskDir(config = {}) {
|
|
|
132417
133064
|
const tasksConfig = config.sisyphus?.tasks;
|
|
132418
133065
|
const storagePath = tasksConfig?.storage_path;
|
|
132419
133066
|
if (storagePath) {
|
|
132420
|
-
return isAbsolute17(storagePath) ? storagePath :
|
|
133067
|
+
return isAbsolute17(storagePath) ? storagePath : join117(process.cwd(), storagePath);
|
|
132421
133068
|
}
|
|
132422
133069
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
132423
133070
|
const listId = resolveTaskListId(config);
|
|
132424
|
-
return
|
|
133071
|
+
return join117(configDir, "tasks", listId);
|
|
132425
133072
|
}
|
|
132426
133073
|
function sanitizePathSegment(value) {
|
|
132427
133074
|
return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
|
|
@@ -132439,16 +133086,16 @@ function resolveTaskListId(config = {}) {
|
|
|
132439
133086
|
return sanitizePathSegment(basename18(process.cwd()));
|
|
132440
133087
|
}
|
|
132441
133088
|
function ensureDir(dirPath) {
|
|
132442
|
-
if (!
|
|
132443
|
-
|
|
133089
|
+
if (!existsSync96(dirPath)) {
|
|
133090
|
+
mkdirSync21(dirPath, { recursive: true });
|
|
132444
133091
|
}
|
|
132445
133092
|
}
|
|
132446
133093
|
function readJsonSafe(filePath, schema) {
|
|
132447
133094
|
try {
|
|
132448
|
-
if (!
|
|
133095
|
+
if (!existsSync96(filePath)) {
|
|
132449
133096
|
return null;
|
|
132450
133097
|
}
|
|
132451
|
-
const content =
|
|
133098
|
+
const content = readFileSync63(filePath, "utf-8");
|
|
132452
133099
|
const parsed = JSON.parse(content);
|
|
132453
133100
|
const result = schema.safeParse(parsed);
|
|
132454
133101
|
if (!result.success) {
|
|
@@ -132465,12 +133112,12 @@ function writeJsonAtomic(filePath, data) {
|
|
|
132465
133112
|
ensureDir(dir);
|
|
132466
133113
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
132467
133114
|
try {
|
|
132468
|
-
|
|
133115
|
+
writeFileSync24(tempPath, JSON.stringify(data, null, 2), "utf-8");
|
|
132469
133116
|
renameSync8(tempPath, filePath);
|
|
132470
133117
|
} catch (error) {
|
|
132471
133118
|
try {
|
|
132472
|
-
if (
|
|
132473
|
-
|
|
133119
|
+
if (existsSync96(tempPath)) {
|
|
133120
|
+
unlinkSync17(tempPath);
|
|
132474
133121
|
}
|
|
132475
133122
|
} catch (cleanupError) {
|
|
132476
133123
|
ignoreClaudeTaskStorageError(cleanupError);
|
|
@@ -132500,12 +133147,12 @@ function generateTaskId() {
|
|
|
132500
133147
|
return `T-${randomUUID9()}`;
|
|
132501
133148
|
}
|
|
132502
133149
|
async function acquireLock2(dirPath, options = {}) {
|
|
132503
|
-
const lockPath =
|
|
133150
|
+
const lockPath = join117(dirPath, ".lock");
|
|
132504
133151
|
const lockId = randomUUID9();
|
|
132505
133152
|
const waitTimeoutMs = options.waitTimeoutMs ?? resolveLockWaitTimeoutMs();
|
|
132506
133153
|
const baseRetryDelayMs = options.retryDelayMs ?? DEFAULT_LOCK_RETRY_DELAY_MS;
|
|
132507
133154
|
const createLock = (timestamp) => {
|
|
132508
|
-
|
|
133155
|
+
writeFileSync24(lockPath, JSON.stringify({ id: lockId, timestamp }), {
|
|
132509
133156
|
encoding: "utf-8",
|
|
132510
133157
|
flag: "wx"
|
|
132511
133158
|
});
|
|
@@ -132523,7 +133170,7 @@ async function acquireLock2(dirPath, options = {}) {
|
|
|
132523
133170
|
const reclaimStaleLock = () => {
|
|
132524
133171
|
let snapshot;
|
|
132525
133172
|
try {
|
|
132526
|
-
snapshot =
|
|
133173
|
+
snapshot = readFileSync63(lockPath, "utf-8");
|
|
132527
133174
|
} catch (error) {
|
|
132528
133175
|
ignoreClaudeTaskStorageError(error);
|
|
132529
133176
|
return true;
|
|
@@ -132531,9 +133178,9 @@ async function acquireLock2(dirPath, options = {}) {
|
|
|
132531
133178
|
if (!isStale(snapshot))
|
|
132532
133179
|
return false;
|
|
132533
133180
|
try {
|
|
132534
|
-
if (
|
|
133181
|
+
if (readFileSync63(lockPath, "utf-8") !== snapshot)
|
|
132535
133182
|
return false;
|
|
132536
|
-
|
|
133183
|
+
unlinkSync17(lockPath);
|
|
132537
133184
|
} catch (error) {
|
|
132538
133185
|
ignoreClaudeTaskStorageError(error);
|
|
132539
133186
|
}
|
|
@@ -132583,13 +133230,13 @@ async function acquireLock2(dirPath, options = {}) {
|
|
|
132583
133230
|
acquired: true,
|
|
132584
133231
|
release: () => {
|
|
132585
133232
|
try {
|
|
132586
|
-
if (!
|
|
133233
|
+
if (!existsSync96(lockPath))
|
|
132587
133234
|
return;
|
|
132588
|
-
const lockContent =
|
|
133235
|
+
const lockContent = readFileSync63(lockPath, "utf-8");
|
|
132589
133236
|
const lockData = JSON.parse(lockContent);
|
|
132590
133237
|
if (lockData.id !== lockId)
|
|
132591
133238
|
return;
|
|
132592
|
-
|
|
133239
|
+
unlinkSync17(lockPath);
|
|
132593
133240
|
} catch (error) {
|
|
132594
133241
|
ignoreClaudeTaskStorageError(error);
|
|
132595
133242
|
}
|
|
@@ -132751,7 +133398,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
132751
133398
|
threadID: context.sessionID
|
|
132752
133399
|
};
|
|
132753
133400
|
validatedTask = TaskObjectSchema.parse(task);
|
|
132754
|
-
writeJsonAtomic(
|
|
133401
|
+
writeJsonAtomic(join118(taskDir, `${taskId}.json`), validatedTask);
|
|
132755
133402
|
} finally {
|
|
132756
133403
|
lock.release();
|
|
132757
133404
|
}
|
|
@@ -132773,7 +133420,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
132773
133420
|
}
|
|
132774
133421
|
}
|
|
132775
133422
|
// packages/omo-opencode/src/tools/task/task-get.ts
|
|
132776
|
-
import { join as
|
|
133423
|
+
import { join as join119 } from "path";
|
|
132777
133424
|
var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
|
|
132778
133425
|
function parseTaskId(id) {
|
|
132779
133426
|
if (!TASK_ID_PATTERN.test(id))
|
|
@@ -132798,7 +133445,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
132798
133445
|
return JSON.stringify({ error: "invalid_task_id" });
|
|
132799
133446
|
}
|
|
132800
133447
|
const taskDir = getTaskDir(config);
|
|
132801
|
-
const taskPath =
|
|
133448
|
+
const taskPath = join119(taskDir, `${taskId}.json`);
|
|
132802
133449
|
const task = readJsonSafe(taskPath, TaskObjectSchema);
|
|
132803
133450
|
return JSON.stringify({ task: task ?? null });
|
|
132804
133451
|
} catch (error) {
|
|
@@ -132811,8 +133458,8 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
132811
133458
|
});
|
|
132812
133459
|
}
|
|
132813
133460
|
// packages/omo-opencode/src/tools/task/task-list.ts
|
|
132814
|
-
import { join as
|
|
132815
|
-
import { existsSync as
|
|
133461
|
+
import { join as join120 } from "path";
|
|
133462
|
+
import { existsSync as existsSync97, readdirSync as readdirSync27 } from "fs";
|
|
132816
133463
|
function createTaskList(config) {
|
|
132817
133464
|
return tool({
|
|
132818
133465
|
description: `List all active tasks with summary information.
|
|
@@ -132823,7 +133470,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
132823
133470
|
args: {},
|
|
132824
133471
|
execute: async () => {
|
|
132825
133472
|
const taskDir = getTaskDir(config);
|
|
132826
|
-
if (!
|
|
133473
|
+
if (!existsSync97(taskDir)) {
|
|
132827
133474
|
return JSON.stringify({ tasks: [] });
|
|
132828
133475
|
}
|
|
132829
133476
|
const files = readdirSync27(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
|
|
@@ -132832,7 +133479,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
132832
133479
|
}
|
|
132833
133480
|
const allTasks = [];
|
|
132834
133481
|
for (const fileId of files) {
|
|
132835
|
-
const task = readJsonSafe(
|
|
133482
|
+
const task = readJsonSafe(join120(taskDir, `${fileId}.json`), TaskObjectSchema);
|
|
132836
133483
|
if (task) {
|
|
132837
133484
|
allTasks.push(task);
|
|
132838
133485
|
}
|
|
@@ -132860,7 +133507,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
132860
133507
|
});
|
|
132861
133508
|
}
|
|
132862
133509
|
// packages/omo-opencode/src/tools/task/task-update.ts
|
|
132863
|
-
import { join as
|
|
133510
|
+
import { join as join121 } from "path";
|
|
132864
133511
|
var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
|
|
132865
133512
|
function parseTaskId2(id) {
|
|
132866
133513
|
if (!TASK_ID_PATTERN2.test(id))
|
|
@@ -132947,7 +133594,7 @@ async function handleUpdate(args, config, ctx, context) {
|
|
|
132947
133594
|
}
|
|
132948
133595
|
let updatedTask = null;
|
|
132949
133596
|
try {
|
|
132950
|
-
updatedTask = applyTaskUpdate(
|
|
133597
|
+
updatedTask = applyTaskUpdate(join121(taskDir, `${taskId}.json`), validatedArgs);
|
|
132951
133598
|
} finally {
|
|
132952
133599
|
lock.release();
|
|
132953
133600
|
}
|
|
@@ -134085,6 +134732,7 @@ function createSessionHooks(args) {
|
|
|
134085
134732
|
pluginConfig
|
|
134086
134733
|
})) : null;
|
|
134087
134734
|
const legacyPluginToast = isHookEnabled("legacy-plugin-toast") ? safeHook("legacy-plugin-toast", () => createLegacyPluginToastHook(ctx)) : null;
|
|
134735
|
+
const nativeEditionNudge = isHookEnabled("native-edition-nudge") ? safeHook("native-edition-nudge", () => createNativeEditionNudgeHook(ctx)) : null;
|
|
134088
134736
|
return {
|
|
134089
134737
|
preemptiveCompaction,
|
|
134090
134738
|
sessionNotification,
|
|
@@ -134108,7 +134756,8 @@ function createSessionHooks(args) {
|
|
|
134108
134756
|
questionLabelTruncator,
|
|
134109
134757
|
taskResumeInfo,
|
|
134110
134758
|
runtimeFallback,
|
|
134111
|
-
legacyPluginToast
|
|
134759
|
+
legacyPluginToast,
|
|
134760
|
+
nativeEditionNudge
|
|
134112
134761
|
};
|
|
134113
134762
|
}
|
|
134114
134763
|
|
|
@@ -134819,7 +135468,7 @@ function createHooks(args) {
|
|
|
134819
135468
|
};
|
|
134820
135469
|
}
|
|
134821
135470
|
// packages/omo-opencode/src/features/background-agent/manager.ts
|
|
134822
|
-
import { join as
|
|
135471
|
+
import { join as join123 } from "path";
|
|
134823
135472
|
|
|
134824
135473
|
// packages/omo-opencode/src/features/background-agent/abort-with-timeout.ts
|
|
134825
135474
|
function getAbortResponseError(response) {
|
|
@@ -135106,8 +135755,8 @@ function writeBackgroundTaskMarker(input) {
|
|
|
135106
135755
|
}
|
|
135107
135756
|
|
|
135108
135757
|
// packages/omo-opencode/src/features/background-agent/compaction-aware-message-resolver.ts
|
|
135109
|
-
import { readdirSync as readdirSync28, readFileSync as
|
|
135110
|
-
import { join as
|
|
135758
|
+
import { readdirSync as readdirSync28, readFileSync as readFileSync64 } from "fs";
|
|
135759
|
+
import { join as join122 } from "path";
|
|
135111
135760
|
function hasFullAgentAndModel(message) {
|
|
135112
135761
|
return !!message.agent && !isCompactionAgent(message.agent) && !!message.model?.providerID && !!message.model?.modelID;
|
|
135113
135762
|
}
|
|
@@ -135191,7 +135840,7 @@ function findNearestMessageExcludingCompaction(messageDir, sessionID) {
|
|
|
135191
135840
|
const messages = [];
|
|
135192
135841
|
for (const file of files) {
|
|
135193
135842
|
try {
|
|
135194
|
-
const content =
|
|
135843
|
+
const content = readFileSync64(join122(messageDir, file), "utf-8");
|
|
135195
135844
|
const parsed = JSON.parse(content);
|
|
135196
135845
|
if (hasCompactionPartInStorage(parsed.id) || isCompactionAgent(parsed.agent)) {
|
|
135197
135846
|
continue;
|
|
@@ -139989,7 +140638,7 @@ The task was re-queued on a fallback model after a retryable failure.
|
|
|
139989
140638
|
parentSessionID: task.parentSessionId
|
|
139990
140639
|
});
|
|
139991
140640
|
}
|
|
139992
|
-
const messageDir =
|
|
140641
|
+
const messageDir = join123(MESSAGE_STORAGE, task.parentSessionId);
|
|
139993
140642
|
const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir, task.parentSessionId) : null;
|
|
139994
140643
|
agent = currentMessage?.agent ?? task.parentAgent;
|
|
139995
140644
|
model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
|
|
@@ -141668,23 +142317,23 @@ function createMonitorManager(options) {
|
|
|
141668
142317
|
import { createHash as createHash4 } from "crypto";
|
|
141669
142318
|
import {
|
|
141670
142319
|
chmodSync as chmodSync4,
|
|
141671
|
-
existsSync as
|
|
141672
|
-
mkdirSync as
|
|
142320
|
+
existsSync as existsSync100,
|
|
142321
|
+
mkdirSync as mkdirSync22,
|
|
141673
142322
|
readdirSync as readdirSync29,
|
|
141674
|
-
readFileSync as
|
|
142323
|
+
readFileSync as readFileSync66,
|
|
141675
142324
|
renameSync as renameSync10,
|
|
141676
|
-
unlinkSync as
|
|
141677
|
-
writeFileSync as
|
|
142325
|
+
unlinkSync as unlinkSync18,
|
|
142326
|
+
writeFileSync as writeFileSync26
|
|
141678
142327
|
} from "fs";
|
|
141679
|
-
import { basename as basename19, dirname as dirname43, join as
|
|
142328
|
+
import { basename as basename19, dirname as dirname43, join as join126 } from "path";
|
|
141680
142329
|
|
|
141681
142330
|
// packages/mcp-client-core/src/config-dir.ts
|
|
141682
|
-
import { existsSync as
|
|
141683
|
-
import { homedir as
|
|
141684
|
-
import { join as
|
|
142331
|
+
import { existsSync as existsSync98, realpathSync as realpathSync18 } from "fs";
|
|
142332
|
+
import { homedir as homedir25 } from "os";
|
|
142333
|
+
import { join as join124, resolve as resolve32 } from "path";
|
|
141685
142334
|
function resolveConfigPath4(pathValue) {
|
|
141686
142335
|
const resolvedPath = resolve32(pathValue);
|
|
141687
|
-
if (!
|
|
142336
|
+
if (!existsSync98(resolvedPath))
|
|
141688
142337
|
return resolvedPath;
|
|
141689
142338
|
try {
|
|
141690
142339
|
return realpathSync18(resolvedPath);
|
|
@@ -141699,13 +142348,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
141699
142348
|
if (customConfigDir) {
|
|
141700
142349
|
return resolveConfigPath4(customConfigDir);
|
|
141701
142350
|
}
|
|
141702
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
141703
|
-
return resolveConfigPath4(
|
|
142351
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join124(homedir25(), ".config");
|
|
142352
|
+
return resolveConfigPath4(join124(xdgConfigDir, "opencode"));
|
|
141704
142353
|
}
|
|
141705
142354
|
|
|
141706
142355
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
141707
|
-
import { chmodSync as chmodSync3, existsSync as
|
|
141708
|
-
import { join as
|
|
142356
|
+
import { chmodSync as chmodSync3, existsSync as existsSync99, readFileSync as readFileSync65, renameSync as renameSync9, writeFileSync as writeFileSync25 } from "fs";
|
|
142357
|
+
import { join as join125 } from "path";
|
|
141709
142358
|
var INDEX_FILE_NAME = "index.json";
|
|
141710
142359
|
function isTokenIndex(value) {
|
|
141711
142360
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -141713,14 +142362,14 @@ function isTokenIndex(value) {
|
|
|
141713
142362
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
141714
142363
|
}
|
|
141715
142364
|
function getIndexPath(storageDir) {
|
|
141716
|
-
return
|
|
142365
|
+
return join125(storageDir, INDEX_FILE_NAME);
|
|
141717
142366
|
}
|
|
141718
142367
|
function readTokenIndex(storageDir) {
|
|
141719
142368
|
const indexPath = getIndexPath(storageDir);
|
|
141720
|
-
if (!
|
|
142369
|
+
if (!existsSync99(indexPath))
|
|
141721
142370
|
return {};
|
|
141722
142371
|
try {
|
|
141723
|
-
const parsed = JSON.parse(
|
|
142372
|
+
const parsed = JSON.parse(readFileSync65(indexPath, "utf-8"));
|
|
141724
142373
|
return isTokenIndex(parsed) ? parsed : {};
|
|
141725
142374
|
} catch (readError) {
|
|
141726
142375
|
if (!(readError instanceof Error))
|
|
@@ -141732,7 +142381,7 @@ function writeTokenIndex(storageDir, index) {
|
|
|
141732
142381
|
try {
|
|
141733
142382
|
const indexPath = getIndexPath(storageDir);
|
|
141734
142383
|
const tempPath = `${indexPath}.tmp.${Date.now()}`;
|
|
141735
|
-
|
|
142384
|
+
writeFileSync25(tempPath, JSON.stringify(index, null, 2), { encoding: "utf-8", mode: 384 });
|
|
141736
142385
|
chmodSync3(tempPath, 384);
|
|
141737
142386
|
renameSync9(tempPath, indexPath);
|
|
141738
142387
|
return true;
|
|
@@ -141750,16 +142399,16 @@ function saveTokenIndexEntry(storageDir, hash, key) {
|
|
|
141750
142399
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
141751
142400
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
141752
142401
|
function getMcpOauthStorageDir() {
|
|
141753
|
-
return
|
|
142402
|
+
return join126(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
141754
142403
|
}
|
|
141755
142404
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
141756
142405
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
141757
142406
|
}
|
|
141758
142407
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
141759
|
-
return
|
|
142408
|
+
return join126(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
141760
142409
|
}
|
|
141761
142410
|
function getLegacyStoragePath() {
|
|
141762
|
-
return
|
|
142411
|
+
return join126(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
141763
142412
|
}
|
|
141764
142413
|
function normalizeHost(serverHost) {
|
|
141765
142414
|
let host = serverHost.trim();
|
|
@@ -141820,10 +142469,10 @@ function isOAuthTokenData(value) {
|
|
|
141820
142469
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
141821
142470
|
}
|
|
141822
142471
|
function readTokenFile(filePath) {
|
|
141823
|
-
if (!
|
|
142472
|
+
if (!existsSync100(filePath))
|
|
141824
142473
|
return null;
|
|
141825
142474
|
try {
|
|
141826
|
-
const parsed = JSON.parse(
|
|
142475
|
+
const parsed = JSON.parse(readFileSync66(filePath, "utf-8"));
|
|
141827
142476
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
141828
142477
|
} catch (readError) {
|
|
141829
142478
|
if (!(readError instanceof Error))
|
|
@@ -141833,10 +142482,10 @@ function readTokenFile(filePath) {
|
|
|
141833
142482
|
}
|
|
141834
142483
|
function readLegacyStore() {
|
|
141835
142484
|
const filePath = getLegacyStoragePath();
|
|
141836
|
-
if (!
|
|
142485
|
+
if (!existsSync100(filePath))
|
|
141837
142486
|
return null;
|
|
141838
142487
|
try {
|
|
141839
|
-
const parsed = JSON.parse(
|
|
142488
|
+
const parsed = JSON.parse(readFileSync66(filePath, "utf-8"));
|
|
141840
142489
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
141841
142490
|
return null;
|
|
141842
142491
|
const result = {};
|
|
@@ -141854,11 +142503,11 @@ function readLegacyStore() {
|
|
|
141854
142503
|
function writeTokenFile(filePath, token) {
|
|
141855
142504
|
try {
|
|
141856
142505
|
const dir = dirname43(filePath);
|
|
141857
|
-
if (!
|
|
141858
|
-
|
|
142506
|
+
if (!existsSync100(dir)) {
|
|
142507
|
+
mkdirSync22(dir, { recursive: true });
|
|
141859
142508
|
}
|
|
141860
142509
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
141861
|
-
|
|
142510
|
+
writeFileSync26(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
141862
142511
|
chmodSync4(tempPath, 384);
|
|
141863
142512
|
renameSync10(tempPath, filePath);
|
|
141864
142513
|
return true;
|
|
@@ -147336,16 +147985,16 @@ var WRITE_DEBOUNCE_MS = 250;
|
|
|
147336
147985
|
init_logger2();
|
|
147337
147986
|
|
|
147338
147987
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-io.ts
|
|
147339
|
-
import { mkdirSync as
|
|
147988
|
+
import { mkdirSync as mkdirSync23, readFileSync as readFileSync67 } from "fs";
|
|
147340
147989
|
import { dirname as dirname44 } from "path";
|
|
147341
147990
|
|
|
147342
147991
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-path.ts
|
|
147343
147992
|
import { createHash as createHash6 } from "crypto";
|
|
147344
147993
|
import { realpathSync as realpathSync19 } from "fs";
|
|
147345
|
-
import { homedir as
|
|
147346
|
-
import { join as
|
|
147994
|
+
import { homedir as homedir26 } from "os";
|
|
147995
|
+
import { join as join127, resolve as resolve33 } from "path";
|
|
147347
147996
|
function mirrorStorageDir() {
|
|
147348
|
-
return
|
|
147997
|
+
return join127(process.env.XDG_DATA_HOME ?? join127(homedir26(), ".local", "share"), "opencode", "storage", "oh-my-openagent", MIRROR_DIR_NAME);
|
|
147349
147998
|
}
|
|
147350
147999
|
function canonicalProjectDir(projectDir) {
|
|
147351
148000
|
try {
|
|
@@ -147359,7 +148008,7 @@ function canonicalProjectDir(projectDir) {
|
|
|
147359
148008
|
}
|
|
147360
148009
|
function mirrorFilePath(projectDir) {
|
|
147361
148010
|
const projectHash = createHash6("sha1").update(canonicalProjectDir(projectDir)).digest("hex").slice(0, 16);
|
|
147362
|
-
return
|
|
148011
|
+
return join127(mirrorStorageDir(), `${projectHash}.json`);
|
|
147363
148012
|
}
|
|
147364
148013
|
|
|
147365
148014
|
// packages/omo-opencode/src/features/tui-sidebar/snapshot-schema.ts
|
|
@@ -147412,13 +148061,13 @@ var TuiRuntimeSnapshotSchema = z58.object({
|
|
|
147412
148061
|
function writeMirror(projectDir, snapshot) {
|
|
147413
148062
|
const filePath = mirrorFilePath(projectDir);
|
|
147414
148063
|
const content = JSON.stringify(snapshot);
|
|
147415
|
-
|
|
148064
|
+
mkdirSync23(dirname44(filePath), { recursive: true });
|
|
147416
148065
|
writeFileAtomically2(filePath, content, { mode: 384 });
|
|
147417
148066
|
}
|
|
147418
148067
|
|
|
147419
148068
|
// packages/omo-opencode/src/features/tui-sidebar/loop-reader.ts
|
|
147420
|
-
import { readdirSync as readdirSync30, readFileSync as
|
|
147421
|
-
import { join as
|
|
148069
|
+
import { readdirSync as readdirSync30, readFileSync as readFileSync68, statSync as statSync14 } from "fs";
|
|
148070
|
+
import { join as join128 } from "path";
|
|
147422
148071
|
import { z as z59 } from "zod";
|
|
147423
148072
|
var CriterionSchema = z59.object({
|
|
147424
148073
|
status: z59.string()
|
|
@@ -147448,7 +148097,7 @@ function enumerateCandidates(projectDir) {
|
|
|
147448
148097
|
return [...currentLoopCandidates(projectDir), legacyLoopCandidate(projectDir)].filter((candidate) => candidate !== null);
|
|
147449
148098
|
}
|
|
147450
148099
|
function currentLoopCandidates(projectDir) {
|
|
147451
|
-
const loopRoot =
|
|
148100
|
+
const loopRoot = join128(projectDir, ".omo", "ulw-loop");
|
|
147452
148101
|
let entries;
|
|
147453
148102
|
try {
|
|
147454
148103
|
entries = readdirSync30(loopRoot, { withFileTypes: true });
|
|
@@ -147458,10 +148107,10 @@ function currentLoopCandidates(projectDir) {
|
|
|
147458
148107
|
}
|
|
147459
148108
|
throw error;
|
|
147460
148109
|
}
|
|
147461
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(
|
|
148110
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(join128(loopRoot, entry.name, "goals.json"))).filter((candidate) => candidate !== null);
|
|
147462
148111
|
}
|
|
147463
148112
|
function legacyLoopCandidate(projectDir) {
|
|
147464
|
-
return statCandidate(
|
|
148113
|
+
return statCandidate(join128(projectDir, ".omo", "loop", "goals.json"));
|
|
147465
148114
|
}
|
|
147466
148115
|
function statCandidate(path) {
|
|
147467
148116
|
try {
|
|
@@ -147486,7 +148135,7 @@ function readLiveCandidate(candidate) {
|
|
|
147486
148135
|
function readParsedLoop(path) {
|
|
147487
148136
|
let raw;
|
|
147488
148137
|
try {
|
|
147489
|
-
raw = JSON.parse(
|
|
148138
|
+
raw = JSON.parse(readFileSync68(path, "utf8"));
|
|
147490
148139
|
} catch (error) {
|
|
147491
148140
|
if (error instanceof Error) {
|
|
147492
148141
|
return null;
|
|
@@ -150246,40 +150895,40 @@ async function isTmuxAvailableWithDeps(deps) {
|
|
|
150246
150895
|
import {
|
|
150247
150896
|
appendFileSync as appendFileSync6,
|
|
150248
150897
|
chmodSync as chmodSync5,
|
|
150249
|
-
existsSync as
|
|
150898
|
+
existsSync as existsSync102,
|
|
150250
150899
|
renameSync as renameSync11,
|
|
150251
150900
|
statSync as statSync15,
|
|
150252
|
-
unlinkSync as
|
|
150253
|
-
writeFileSync as
|
|
150901
|
+
unlinkSync as unlinkSync19,
|
|
150902
|
+
writeFileSync as writeFileSync27
|
|
150254
150903
|
} from "fs";
|
|
150255
150904
|
|
|
150256
150905
|
// packages/openclaw-core/src/reply-listener-paths.ts
|
|
150257
|
-
import { existsSync as
|
|
150258
|
-
import { homedir as
|
|
150259
|
-
import { join as
|
|
150906
|
+
import { existsSync as existsSync101, mkdirSync as mkdirSync24 } from "fs";
|
|
150907
|
+
import { homedir as homedir27 } from "os";
|
|
150908
|
+
import { join as join129 } from "path";
|
|
150260
150909
|
var REPLY_LISTENER_SECURE_FILE_MODE = 384;
|
|
150261
150910
|
function resolveReplyListenerHomeDir() {
|
|
150262
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
150911
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir27();
|
|
150263
150912
|
}
|
|
150264
150913
|
function getReplyListenerStateDir() {
|
|
150265
|
-
return
|
|
150914
|
+
return join129(resolveReplyListenerHomeDir(), ".omo", "openclaw", "state");
|
|
150266
150915
|
}
|
|
150267
150916
|
function getReplyListenerPidFilePath() {
|
|
150268
|
-
return
|
|
150917
|
+
return join129(getReplyListenerStateDir(), "reply-listener.pid");
|
|
150269
150918
|
}
|
|
150270
150919
|
function getReplyListenerStateFilePath() {
|
|
150271
|
-
return
|
|
150920
|
+
return join129(getReplyListenerStateDir(), "reply-listener-state.json");
|
|
150272
150921
|
}
|
|
150273
150922
|
function getReplyListenerConfigFilePath() {
|
|
150274
|
-
return
|
|
150923
|
+
return join129(getReplyListenerStateDir(), "reply-listener-config.json");
|
|
150275
150924
|
}
|
|
150276
150925
|
function getReplyListenerLogFilePath() {
|
|
150277
|
-
return
|
|
150926
|
+
return join129(getReplyListenerStateDir(), "reply-listener.log");
|
|
150278
150927
|
}
|
|
150279
150928
|
function ensureReplyListenerStateDir() {
|
|
150280
150929
|
const stateDir = getReplyListenerStateDir();
|
|
150281
|
-
if (!
|
|
150282
|
-
|
|
150930
|
+
if (!existsSync101(stateDir)) {
|
|
150931
|
+
mkdirSync24(stateDir, { recursive: true, mode: 448 });
|
|
150283
150932
|
}
|
|
150284
150933
|
}
|
|
150285
150934
|
|
|
@@ -150292,7 +150941,7 @@ function ignoreReplyListenerLogError(error) {
|
|
|
150292
150941
|
}
|
|
150293
150942
|
function writeSecureReplyListenerFile(filePath, content) {
|
|
150294
150943
|
ensureReplyListenerStateDir();
|
|
150295
|
-
|
|
150944
|
+
writeFileSync27(filePath, content, { mode: REPLY_LISTENER_SECURE_FILE_MODE });
|
|
150296
150945
|
try {
|
|
150297
150946
|
chmodSync5(filePath, REPLY_LISTENER_SECURE_FILE_MODE);
|
|
150298
150947
|
} catch (error) {
|
|
@@ -150301,14 +150950,14 @@ function writeSecureReplyListenerFile(filePath, content) {
|
|
|
150301
150950
|
}
|
|
150302
150951
|
function rotateReplyListenerLogIfNeeded(logPath) {
|
|
150303
150952
|
try {
|
|
150304
|
-
if (!
|
|
150953
|
+
if (!existsSync102(logPath))
|
|
150305
150954
|
return;
|
|
150306
150955
|
const stats = statSync15(logPath);
|
|
150307
150956
|
if (stats.size <= MAX_REPLY_LISTENER_LOG_SIZE_BYTES)
|
|
150308
150957
|
return;
|
|
150309
150958
|
const backupPath = `${logPath}.old`;
|
|
150310
|
-
if (
|
|
150311
|
-
|
|
150959
|
+
if (existsSync102(backupPath)) {
|
|
150960
|
+
unlinkSync19(backupPath);
|
|
150312
150961
|
}
|
|
150313
150962
|
renameSync11(logPath, backupPath);
|
|
150314
150963
|
} catch (error) {
|
|
@@ -150334,7 +150983,7 @@ import { constants as constants24, closeSync as closeSync5, openSync as openSync
|
|
|
150334
150983
|
|
|
150335
150984
|
// packages/openclaw-core/src/session-registry-paths.ts
|
|
150336
150985
|
init_src();
|
|
150337
|
-
import { join as
|
|
150986
|
+
import { join as join130 } from "path";
|
|
150338
150987
|
var SECURE_FILE_MODE = 384;
|
|
150339
150988
|
var MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
150340
150989
|
var LOCK_TIMEOUT_MS = 2000;
|
|
@@ -150345,16 +150994,16 @@ var cachedRegistryPaths = null;
|
|
|
150345
150994
|
function resolveRegistryPaths() {
|
|
150346
150995
|
if (cachedRegistryPaths !== null)
|
|
150347
150996
|
return cachedRegistryPaths;
|
|
150348
|
-
const openClawStorageDir =
|
|
150997
|
+
const openClawStorageDir = join130(getOpenCodeStorageDir2(), "openclaw");
|
|
150349
150998
|
cachedRegistryPaths = {
|
|
150350
150999
|
openClawStorageDir,
|
|
150351
|
-
registryPath:
|
|
150352
|
-
registryLockPath:
|
|
151000
|
+
registryPath: join130(openClawStorageDir, "reply-session-registry.jsonl"),
|
|
151001
|
+
registryLockPath: join130(openClawStorageDir, "reply-session-registry.lock")
|
|
150353
151002
|
};
|
|
150354
151003
|
return cachedRegistryPaths;
|
|
150355
151004
|
}
|
|
150356
151005
|
function getOpenCodeStorageDir2() {
|
|
150357
|
-
return
|
|
151006
|
+
return join130(resolveXdgDataDir("opencode"), "opencode", "storage");
|
|
150358
151007
|
}
|
|
150359
151008
|
function getRegistryPath() {
|
|
150360
151009
|
return resolveRegistryPaths().registryPath;
|
|
@@ -150364,11 +151013,11 @@ function getRegistryLockPath() {
|
|
|
150364
151013
|
}
|
|
150365
151014
|
|
|
150366
151015
|
// packages/openclaw-core/src/session-registry-lock.ts
|
|
150367
|
-
import { constants as constants23, closeSync as closeSync4, existsSync as
|
|
151016
|
+
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";
|
|
150368
151017
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
150369
151018
|
|
|
150370
151019
|
// packages/openclaw-core/src/session-registry-storage.ts
|
|
150371
|
-
import { existsSync as
|
|
151020
|
+
import { existsSync as existsSync103, mkdirSync as mkdirSync25, readFileSync as readFileSync69, writeFileSync as writeFileSync28 } from "fs";
|
|
150372
151021
|
import { dirname as dirname45 } from "path";
|
|
150373
151022
|
function isSessionMapping(value) {
|
|
150374
151023
|
if (typeof value !== "object" || value === null)
|
|
@@ -150391,16 +151040,16 @@ function isSessionMapping(value) {
|
|
|
150391
151040
|
}
|
|
150392
151041
|
function ensureRegistryDir() {
|
|
150393
151042
|
const registryDir = dirname45(getRegistryPath());
|
|
150394
|
-
if (!
|
|
150395
|
-
|
|
151043
|
+
if (!existsSync103(registryDir)) {
|
|
151044
|
+
mkdirSync25(registryDir, { recursive: true, mode: 448 });
|
|
150396
151045
|
}
|
|
150397
151046
|
}
|
|
150398
151047
|
function readAllMappingsUnsafe() {
|
|
150399
151048
|
const registryPath = getRegistryPath();
|
|
150400
|
-
if (!
|
|
151049
|
+
if (!existsSync103(registryPath))
|
|
150401
151050
|
return [];
|
|
150402
151051
|
try {
|
|
150403
|
-
const content =
|
|
151052
|
+
const content = readFileSync69(registryPath, "utf-8");
|
|
150404
151053
|
return content.split(`
|
|
150405
151054
|
`).filter((line) => line.trim()).map((line) => {
|
|
150406
151055
|
try {
|
|
@@ -150422,13 +151071,13 @@ function rewriteRegistryUnsafe(mappings) {
|
|
|
150422
151071
|
ensureRegistryDir();
|
|
150423
151072
|
const registryPath = getRegistryPath();
|
|
150424
151073
|
if (mappings.length === 0) {
|
|
150425
|
-
|
|
151074
|
+
writeFileSync28(registryPath, "", { mode: SECURE_FILE_MODE });
|
|
150426
151075
|
return;
|
|
150427
151076
|
}
|
|
150428
151077
|
const content = mappings.map((mapping) => JSON.stringify(mapping)).join(`
|
|
150429
151078
|
`) + `
|
|
150430
151079
|
`;
|
|
150431
|
-
|
|
151080
|
+
writeFileSync28(registryPath, content, { mode: SECURE_FILE_MODE });
|
|
150432
151081
|
}
|
|
150433
151082
|
|
|
150434
151083
|
// packages/openclaw-core/src/session-registry-lock.ts
|
|
@@ -150451,9 +151100,9 @@ function isPidAlive2(pid) {
|
|
|
150451
151100
|
function readLockSnapshot() {
|
|
150452
151101
|
try {
|
|
150453
151102
|
const registryLockPath = getRegistryLockPath();
|
|
150454
|
-
if (!
|
|
151103
|
+
if (!existsSync104(registryLockPath))
|
|
150455
151104
|
return null;
|
|
150456
|
-
const raw =
|
|
151105
|
+
const raw = readFileSync70(registryLockPath, "utf-8");
|
|
150457
151106
|
const trimmed = raw.trim();
|
|
150458
151107
|
if (!trimmed)
|
|
150459
151108
|
return { raw, pid: null, token: null };
|
|
@@ -150482,12 +151131,12 @@ function readLockSnapshot() {
|
|
|
150482
151131
|
function removeLockIfUnchanged(snapshot) {
|
|
150483
151132
|
try {
|
|
150484
151133
|
const registryLockPath = getRegistryLockPath();
|
|
150485
|
-
if (!
|
|
151134
|
+
if (!existsSync104(registryLockPath))
|
|
150486
151135
|
return false;
|
|
150487
|
-
const currentRaw =
|
|
151136
|
+
const currentRaw = readFileSync70(registryLockPath, "utf-8");
|
|
150488
151137
|
if (currentRaw !== snapshot.raw)
|
|
150489
151138
|
return false;
|
|
150490
|
-
|
|
151139
|
+
unlinkSync20(registryLockPath);
|
|
150491
151140
|
return true;
|
|
150492
151141
|
} catch (error) {
|
|
150493
151142
|
if (error instanceof Error)
|
|
@@ -150505,7 +151154,7 @@ function closeLockFd(fd) {
|
|
|
150505
151154
|
}
|
|
150506
151155
|
function unlinkLockFile() {
|
|
150507
151156
|
try {
|
|
150508
|
-
|
|
151157
|
+
unlinkSync20(getRegistryLockPath());
|
|
150509
151158
|
} catch (error) {
|
|
150510
151159
|
if (error instanceof Error)
|
|
150511
151160
|
return;
|
|
@@ -150633,7 +151282,7 @@ function removeSession(sessionId) {
|
|
|
150633
151282
|
}
|
|
150634
151283
|
|
|
150635
151284
|
// packages/openclaw-core/src/reply-listener-state.ts
|
|
150636
|
-
import { existsSync as
|
|
151285
|
+
import { existsSync as existsSync105, readFileSync as readFileSync71, unlinkSync as unlinkSync21 } from "fs";
|
|
150637
151286
|
var REPLY_LISTENER_STARTUP_TOKEN_ENV = "OMO_OPENCLAW_REPLY_LISTENER_STARTUP_TOKEN";
|
|
150638
151287
|
function ignoreReplyListenerStateReadError(error) {
|
|
150639
151288
|
if (error instanceof Error)
|
|
@@ -150700,9 +151349,9 @@ function createPendingReplyListenerState(startupToken) {
|
|
|
150700
151349
|
function readReplyListenerDaemonState() {
|
|
150701
151350
|
try {
|
|
150702
151351
|
const stateFilePath = getReplyListenerStateFilePath();
|
|
150703
|
-
if (!
|
|
151352
|
+
if (!existsSync105(stateFilePath))
|
|
150704
151353
|
return null;
|
|
150705
|
-
return normalizeReplyListenerState(JSON.parse(
|
|
151354
|
+
return normalizeReplyListenerState(JSON.parse(readFileSync71(stateFilePath, "utf-8")));
|
|
150706
151355
|
} catch (error) {
|
|
150707
151356
|
ignoreReplyListenerStateReadError(error);
|
|
150708
151357
|
return null;
|
|
@@ -150718,9 +151367,9 @@ function writeReplyListenerDaemonState(state) {
|
|
|
150718
151367
|
function readReplyListenerDaemonConfig() {
|
|
150719
151368
|
try {
|
|
150720
151369
|
const configFilePath = getReplyListenerConfigFilePath();
|
|
150721
|
-
if (!
|
|
151370
|
+
if (!existsSync105(configFilePath))
|
|
150722
151371
|
return null;
|
|
150723
|
-
return JSON.parse(
|
|
151372
|
+
return JSON.parse(readFileSync71(configFilePath, "utf-8"));
|
|
150724
151373
|
} catch (error) {
|
|
150725
151374
|
ignoreReplyListenerStateReadError(error);
|
|
150726
151375
|
return null;
|
|
@@ -150732,9 +151381,9 @@ function writeReplyListenerDaemonConfig(config) {
|
|
|
150732
151381
|
function readReplyListenerPid() {
|
|
150733
151382
|
try {
|
|
150734
151383
|
const pidFilePath = getReplyListenerPidFilePath();
|
|
150735
|
-
if (!
|
|
151384
|
+
if (!existsSync105(pidFilePath))
|
|
150736
151385
|
return null;
|
|
150737
|
-
const pid = Number.parseInt(
|
|
151386
|
+
const pid = Number.parseInt(readFileSync71(pidFilePath, "utf-8").trim(), 10);
|
|
150738
151387
|
return Number.isNaN(pid) ? null : pid;
|
|
150739
151388
|
} catch (error) {
|
|
150740
151389
|
ignoreReplyListenerStateReadError(error);
|
|
@@ -150746,8 +151395,8 @@ function writeReplyListenerPid(pid) {
|
|
|
150746
151395
|
}
|
|
150747
151396
|
function removeReplyListenerPid() {
|
|
150748
151397
|
const pidFilePath = getReplyListenerPidFilePath();
|
|
150749
|
-
if (
|
|
150750
|
-
|
|
151398
|
+
if (existsSync105(pidFilePath)) {
|
|
151399
|
+
unlinkSync21(pidFilePath);
|
|
150751
151400
|
}
|
|
150752
151401
|
}
|
|
150753
151402
|
function markReplyListenerStopped(state, error) {
|
|
@@ -150774,7 +151423,7 @@ function getReplyListenerRuntimeSignature(config) {
|
|
|
150774
151423
|
// packages/openclaw-core/src/reply-listener-poll-loop.ts
|
|
150775
151424
|
var PRUNE_INTERVAL_MS = 60 * 60 * 1000;
|
|
150776
151425
|
// packages/openclaw-core/src/reply-listener-start.ts
|
|
150777
|
-
import { dirname as dirname46, join as
|
|
151426
|
+
import { dirname as dirname46, join as join132 } from "path";
|
|
150778
151427
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
150779
151428
|
|
|
150780
151429
|
// packages/openclaw-core/src/reply-listener-spawn.ts
|
|
@@ -150782,8 +151431,8 @@ init_runtime();
|
|
|
150782
151431
|
|
|
150783
151432
|
// packages/openclaw-core/src/reply-listener-process.ts
|
|
150784
151433
|
init_runtime();
|
|
150785
|
-
import { readFileSync as
|
|
150786
|
-
import { join as
|
|
151434
|
+
import { readFileSync as readFileSync72 } from "fs";
|
|
151435
|
+
import { join as join131 } from "path";
|
|
150787
151436
|
var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
|
|
150788
151437
|
var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
150789
151438
|
"PATH",
|
|
@@ -150819,7 +151468,7 @@ var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
|
150819
151468
|
];
|
|
150820
151469
|
async function windowsProcessCommandLineHasMarker(pid, deps) {
|
|
150821
151470
|
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT ?? "C:\\Windows";
|
|
150822
|
-
const powershell =
|
|
151471
|
+
const powershell = join131(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
150823
151472
|
const processInfo = deps.spawn([
|
|
150824
151473
|
powershell,
|
|
150825
151474
|
"-NoProfile",
|
|
@@ -150864,7 +151513,7 @@ async function isReplyListenerDaemonProcessWithDeps(pid, deps) {
|
|
|
150864
151513
|
try {
|
|
150865
151514
|
const platform = deps.platform ?? process.platform;
|
|
150866
151515
|
if (platform === "linux") {
|
|
150867
|
-
const readProcCmdline = deps.readProcCmdline ?? ((targetPid) =>
|
|
151516
|
+
const readProcCmdline = deps.readProcCmdline ?? ((targetPid) => readFileSync72(`/proc/${targetPid}/cmdline`, "utf-8"));
|
|
150868
151517
|
const cmdline = readProcCmdline(pid);
|
|
150869
151518
|
return cmdline.includes(REPLY_LISTENER_DAEMON_IDENTITY_MARKER);
|
|
150870
151519
|
}
|
|
@@ -151036,7 +151685,7 @@ function createStartFailureResult(message, state) {
|
|
|
151036
151685
|
}
|
|
151037
151686
|
function resolveReplyListenerDaemonScript(currentFileUrl) {
|
|
151038
151687
|
const currentFilePath = fileURLToPath7(currentFileUrl);
|
|
151039
|
-
return currentFilePath.endsWith(".ts") ?
|
|
151688
|
+
return currentFilePath.endsWith(".ts") ? join132(dirname46(currentFilePath), "daemon.ts") : join132(dirname46(currentFilePath), "daemon.js");
|
|
151040
151689
|
}
|
|
151041
151690
|
async function startReplyListener(config) {
|
|
151042
151691
|
const normalizedConfig = getNormalizedReplyListenerConfig(config);
|
|
@@ -151459,13 +152108,13 @@ async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
|
|
|
151459
152108
|
};
|
|
151460
152109
|
}
|
|
151461
152110
|
// packages/claude-code-compat-core/src/features/claude-code-mcp-loader/loader.ts
|
|
151462
|
-
import { existsSync as
|
|
151463
|
-
import { join as
|
|
151464
|
-
import { homedir as
|
|
152111
|
+
import { existsSync as existsSync106, readFileSync as readFileSync73 } from "fs";
|
|
152112
|
+
import { join as join133 } from "path";
|
|
152113
|
+
import { homedir as homedir28 } from "os";
|
|
151465
152114
|
function resolveMcpLoaderContext(options = {}) {
|
|
151466
152115
|
const cwd = options.cwd ?? process.cwd();
|
|
151467
152116
|
const homeDir = options.homeDir ?? getHomeDir();
|
|
151468
|
-
const claudeConfigDir = options.claudeConfigDir ?? (options.homeDir === undefined ? getClaudeConfigDir3() :
|
|
152117
|
+
const claudeConfigDir = options.claudeConfigDir ?? (options.homeDir === undefined ? getClaudeConfigDir3() : join133(homeDir, ".claude"));
|
|
151469
152118
|
return { cwd, homeDir, claudeConfigDir };
|
|
151470
152119
|
}
|
|
151471
152120
|
var mcpLoaderInternals = {
|
|
@@ -151474,17 +152123,17 @@ var mcpLoaderInternals = {
|
|
|
151474
152123
|
function getMcpConfigPaths(context) {
|
|
151475
152124
|
const { claudeConfigDir, homeDir, cwd } = context;
|
|
151476
152125
|
return [
|
|
151477
|
-
{ path:
|
|
151478
|
-
{ path:
|
|
151479
|
-
{ path:
|
|
151480
|
-
{ path:
|
|
152126
|
+
{ path: join133(homeDir, ".claude.json"), scope: "user" },
|
|
152127
|
+
{ path: join133(claudeConfigDir, ".mcp.json"), scope: "user" },
|
|
152128
|
+
{ path: join133(cwd, ".mcp.json"), scope: "project" },
|
|
152129
|
+
{ path: join133(cwd, ".claude", ".mcp.json"), scope: "local" }
|
|
151481
152130
|
];
|
|
151482
152131
|
}
|
|
151483
152132
|
function getHomeDir() {
|
|
151484
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
152133
|
+
return process.env.HOME || process.env.USERPROFILE || homedir28();
|
|
151485
152134
|
}
|
|
151486
152135
|
async function loadMcpConfigFile(filePath) {
|
|
151487
|
-
if (!
|
|
152136
|
+
if (!existsSync106(filePath)) {
|
|
151488
152137
|
return null;
|
|
151489
152138
|
}
|
|
151490
152139
|
try {
|
|
@@ -151505,10 +152154,10 @@ function getSystemMcpServerNames(options = {}) {
|
|
|
151505
152154
|
const paths = getMcpConfigPaths(context);
|
|
151506
152155
|
const { cwd } = context;
|
|
151507
152156
|
for (const { path } of paths) {
|
|
151508
|
-
if (!
|
|
152157
|
+
if (!existsSync106(path))
|
|
151509
152158
|
continue;
|
|
151510
152159
|
try {
|
|
151511
|
-
const content =
|
|
152160
|
+
const content = readFileSync73(path, "utf-8");
|
|
151512
152161
|
const config = JSON.parse(content);
|
|
151513
152162
|
if (!config?.mcpServers)
|
|
151514
152163
|
continue;
|
|
@@ -155604,6 +156253,10 @@ function buildClaudeOpus5SisyphusPrompt(model, availableAgents, availableTools =
|
|
|
155604
156253
|
const todoHookNote = useTaskSystem ? "YOUR TASK CREATION WOULD BE TRACKED BY HOOK([SYSTEM REMINDER - TASK CONTINUATION])" : "YOUR TODO CREATION WOULD BE TRACKED BY HOOK([SYSTEM REMINDER - TODO CONTINUATION])";
|
|
155605
156254
|
const browserQaInstruction = availableSkills.some((skill) => skill.name === "playwright") ? "**Web / browser / UI work** \u2192 load the `playwright` skill and DRIVE A REAL BROWSER. Open the page. Click the elements. Fill the forms. WATCH THE CONSOLE. Screenshot if helpful. Visual changes NOT RENDERED in a browser are NOT VALIDATED." : "**Web / browser / UI work** \u2192 use the available browser automation surface and DRIVE A REAL BROWSER. Open the page. Click the elements. Fill the forms. WATCH THE CONSOLE. Screenshot if helpful. Visual changes NOT RENDERED in a browser are NOT VALIDATED.";
|
|
155606
156255
|
const agentIdentity = buildAgentIdentitySection("Sisyphus", "Powerful AI Agent with orchestration capabilities from OhMyOpenCode");
|
|
156256
|
+
const isOpus55 = /opus-5[-.]5/i.test(model);
|
|
156257
|
+
const modelDisplayName = isOpus55 ? "Claude Opus 5.5" : "Claude Opus 5";
|
|
156258
|
+
const modelIdentifier = isOpus55 ? "claude-opus-5-5" : "claude-opus-5";
|
|
156259
|
+
const modelFamilyLabel = isOpus55 ? "Opus 5.5" : "Opus 5";
|
|
155607
156260
|
return `${agentIdentity}
|
|
155608
156261
|
<Role>
|
|
155609
156262
|
You are **Sisyphus** - Powerful AI Agent with orchestration capabilities from OhMyOpenCode.
|
|
@@ -155618,9 +156271,9 @@ You are **Sisyphus** - Powerful AI Agent with orchestration capabilities from Oh
|
|
|
155618
156271
|
</Role>
|
|
155619
156272
|
|
|
155620
156273
|
<self_knowledge>
|
|
155621
|
-
You are **
|
|
156274
|
+
You are **${modelDisplayName}** (\`${modelIdentifier}\`) - built for long-horizon agentic coding. You complete full tasks without stubs or placeholders, and you verify your own work without being told.
|
|
155622
156275
|
|
|
155623
|
-
Five
|
|
156276
|
+
Five ${modelFamilyLabel} defaults you MUST counter:
|
|
155624
156277
|
|
|
155625
156278
|
1. **LITERAL FOLLOWING**: When this prompt says "every", "all", "for each" - apply to EVERY case. NEVER infer "first item only".
|
|
155626
156279
|
2. **SCOPE EXPANSION**: You add steps that were not requested and reinterpret what the task "should" be. Deliver what was asked, at the scope intended. Make routine judgment calls yourself; check in only when different readings of the request lead to materially different work. If the request seems mistaken or a better approach exists, say so in ONE sentence and continue with the task as asked - NEVER quietly narrow, widen, or transform it.
|
|
@@ -160995,15 +161648,15 @@ function createHephaestusAgent(model, availableAgents, availableToolNames, avail
|
|
|
160995
161648
|
}
|
|
160996
161649
|
createHephaestusAgent.mode = MODE9;
|
|
160997
161650
|
// packages/omo-opencode/src/agents/builtin-agents/resolve-file-uri.ts
|
|
160998
|
-
import { existsSync as
|
|
160999
|
-
import { homedir as
|
|
161000
|
-
import { isAbsolute as isAbsolute18, join as
|
|
161651
|
+
import { existsSync as existsSync107, readFileSync as readFileSync74 } from "fs";
|
|
161652
|
+
import { homedir as homedir29 } from "os";
|
|
161653
|
+
import { isAbsolute as isAbsolute18, join as join134, resolve as resolve34 } from "path";
|
|
161001
161654
|
init_logger2();
|
|
161002
161655
|
var ALLOWED_HOME_SUBDIRS = [
|
|
161003
|
-
|
|
161004
|
-
|
|
161005
|
-
|
|
161006
|
-
|
|
161656
|
+
join134(homedir29(), ".config", "opencode"),
|
|
161657
|
+
join134(homedir29(), ".config", "oh-my-openagent"),
|
|
161658
|
+
join134(homedir29(), ".omo"),
|
|
161659
|
+
join134(homedir29(), ".opencode")
|
|
161007
161660
|
];
|
|
161008
161661
|
function isWithinAllowedPaths(filePath, projectRoot) {
|
|
161009
161662
|
if (isWithinProject(filePath, projectRoot))
|
|
@@ -161021,7 +161674,7 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
161021
161674
|
let filePath;
|
|
161022
161675
|
try {
|
|
161023
161676
|
const decoded = decodeURIComponent(encoded);
|
|
161024
|
-
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${
|
|
161677
|
+
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir29()}/`) : decoded;
|
|
161025
161678
|
filePath = isAbsolute18(expanded) ? expanded : resolve34(configDir ?? process.cwd(), expanded);
|
|
161026
161679
|
} catch (error) {
|
|
161027
161680
|
if (!(error instanceof Error)) {
|
|
@@ -161039,11 +161692,11 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
161039
161692
|
});
|
|
161040
161693
|
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/)]`;
|
|
161041
161694
|
}
|
|
161042
|
-
if (!
|
|
161695
|
+
if (!existsSync107(filePath)) {
|
|
161043
161696
|
return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
|
|
161044
161697
|
}
|
|
161045
161698
|
try {
|
|
161046
|
-
return
|
|
161699
|
+
return readFileSync74(filePath, "utf8");
|
|
161047
161700
|
} catch (error) {
|
|
161048
161701
|
if (!(error instanceof Error)) {
|
|
161049
161702
|
throw error;
|
|
@@ -163761,7 +164414,7 @@ async function applyAgentConfig(params) {
|
|
|
163761
164414
|
}
|
|
163762
164415
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader.ts
|
|
163763
164416
|
import { promises as fs21 } from "fs";
|
|
163764
|
-
import { join as
|
|
164417
|
+
import { join as join135, basename as basename21 } from "path";
|
|
163765
164418
|
|
|
163766
164419
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader-cache.ts
|
|
163767
164420
|
var commandLoaderCache = new Map;
|
|
@@ -163809,7 +164462,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
163809
164462
|
continue;
|
|
163810
164463
|
if (entry.name.startsWith("."))
|
|
163811
164464
|
continue;
|
|
163812
|
-
const subDirPath =
|
|
164465
|
+
const subDirPath = join135(commandsDir, entry.name);
|
|
163813
164466
|
const subPrefix = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
163814
164467
|
const subCommands = await loadCommandsFromDir(subDirPath, scope, visited, subPrefix);
|
|
163815
164468
|
commands.push(...subCommands);
|
|
@@ -163817,7 +164470,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
163817
164470
|
}
|
|
163818
164471
|
if (!isMarkdownFile(entry))
|
|
163819
164472
|
continue;
|
|
163820
|
-
const commandPath =
|
|
164473
|
+
const commandPath = join135(commandsDir, entry.name);
|
|
163821
164474
|
const baseCommandName = basename21(entry.name, ".md");
|
|
163822
164475
|
const commandName = prefix ? `${prefix}/${baseCommandName}` : baseCommandName;
|
|
163823
164476
|
try {
|
|
@@ -163880,12 +164533,12 @@ function commandsToRecord(commands) {
|
|
|
163880
164533
|
return result;
|
|
163881
164534
|
}
|
|
163882
164535
|
async function loadUserCommands() {
|
|
163883
|
-
const userCommandsDir =
|
|
164536
|
+
const userCommandsDir = join135(getClaudeConfigDir3(), "commands");
|
|
163884
164537
|
const commands = await loadCommandsFromDir(userCommandsDir, "user");
|
|
163885
164538
|
return commandsToRecord(commands);
|
|
163886
164539
|
}
|
|
163887
164540
|
async function loadProjectCommands(directory) {
|
|
163888
|
-
const projectCommandsDir =
|
|
164541
|
+
const projectCommandsDir = join135(directory ?? process.cwd(), ".claude", "commands");
|
|
163889
164542
|
const commands = await loadCommandsFromDir(projectCommandsDir, "project");
|
|
163890
164543
|
return commandsToRecord(commands);
|
|
163891
164544
|
}
|
|
@@ -164074,7 +164727,7 @@ var grep_app = {
|
|
|
164074
164727
|
};
|
|
164075
164728
|
|
|
164076
164729
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
164077
|
-
import { existsSync as
|
|
164730
|
+
import { existsSync as existsSync108, readFileSync as readFileSync75 } from "fs";
|
|
164078
164731
|
import { delimiter as delimiter2, dirname as dirname47, resolve as resolve36 } from "path";
|
|
164079
164732
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
164080
164733
|
import { z as z60 } from "zod";
|
|
@@ -164219,7 +164872,7 @@ function findBootstrapRoot(candidates, pathExists) {
|
|
|
164219
164872
|
}
|
|
164220
164873
|
function readDaemonPackageVersion(root) {
|
|
164221
164874
|
try {
|
|
164222
|
-
const packageJson = JSON.parse(
|
|
164875
|
+
const packageJson = JSON.parse(readFileSync75(resolve36(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
164223
164876
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
164224
164877
|
} catch (error) {
|
|
164225
164878
|
if (!(error instanceof Error))
|
|
@@ -164241,7 +164894,7 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
164241
164894
|
};
|
|
164242
164895
|
}
|
|
164243
164896
|
function resolveLspCommand(options = {}) {
|
|
164244
|
-
const pathExists = options.exists ??
|
|
164897
|
+
const pathExists = options.exists ?? existsSync108;
|
|
164245
164898
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
164246
164899
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
164247
164900
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -171827,8 +172480,8 @@ function createChatHeadersHandler(args) {
|
|
|
171827
172480
|
}
|
|
171828
172481
|
|
|
171829
172482
|
// packages/omo-opencode/src/plugin/ultrawork-db-model-override.ts
|
|
171830
|
-
import { join as
|
|
171831
|
-
import { existsSync as
|
|
172483
|
+
import { join as join136 } from "path";
|
|
172484
|
+
import { existsSync as existsSync109 } from "fs";
|
|
171832
172485
|
async function importBunSqlite() {
|
|
171833
172486
|
if (typeof globalThis.Bun === "undefined") {
|
|
171834
172487
|
return null;
|
|
@@ -171844,7 +172497,7 @@ async function importBunSqlite() {
|
|
|
171844
172497
|
}
|
|
171845
172498
|
}
|
|
171846
172499
|
function getDbPath() {
|
|
171847
|
-
return
|
|
172500
|
+
return join136(getDataDir(), "opencode", "opencode.db");
|
|
171848
172501
|
}
|
|
171849
172502
|
var MAX_MICROTASK_RETRIES = 10;
|
|
171850
172503
|
function logCaughtDbError(message, metadata, error) {
|
|
@@ -171947,7 +172600,7 @@ async function scheduleDeferredModelOverride(messageId, targetModel, variant) {
|
|
|
171947
172600
|
return;
|
|
171948
172601
|
}
|
|
171949
172602
|
const dbPath = getDbPath();
|
|
171950
|
-
if (!
|
|
172603
|
+
if (!existsSync109(dbPath)) {
|
|
171951
172604
|
log2("[ultrawork-db-override] DB not found, skipping deferred override");
|
|
171952
172605
|
return;
|
|
171953
172606
|
}
|
|
@@ -172801,6 +173454,7 @@ function createEventHookDispatcher(hooks, runEventHookSafely) {
|
|
|
172801
173454
|
await runEventHookSafely("autoUpdateChecker", hooks.autoUpdateChecker?.event, input);
|
|
172802
173455
|
await runEventHookSafely("astGrepSgProvision", hooks.astGrepSgProvision?.event, input);
|
|
172803
173456
|
await runEventHookSafely("legacyPluginToast", hooks.legacyPluginToast?.event, input);
|
|
173457
|
+
await runEventHookSafely("nativeEditionNudge", hooks.nativeEditionNudge?.event, input);
|
|
172804
173458
|
await runEventHookSafely("claudeCodeHooks", hooks.claudeCodeHooks?.event, input);
|
|
172805
173459
|
await runEventHookSafely("backgroundNotificationHook", hooks.backgroundNotificationHook?.event, input);
|
|
172806
173460
|
await runEventHookSafely("sessionNotification", hooks.sessionNotification, input);
|
|
@@ -174664,7 +175318,7 @@ function parseWindowsProcessTable(output) {
|
|
|
174664
175318
|
const entries = Array.isArray(parsed) ? parsed : parsed === undefined ? [] : [parsed];
|
|
174665
175319
|
const processes = [];
|
|
174666
175320
|
for (const entry of entries) {
|
|
174667
|
-
if (!
|
|
175321
|
+
if (!isRecord13(entry))
|
|
174668
175322
|
continue;
|
|
174669
175323
|
const pid = numberField(entry, "ProcessId");
|
|
174670
175324
|
const ppid = numberField(entry, "ParentProcessId");
|
|
@@ -174698,7 +175352,7 @@ function stringField(record, key) {
|
|
|
174698
175352
|
const value = record[key];
|
|
174699
175353
|
return typeof value === "string" ? value : undefined;
|
|
174700
175354
|
}
|
|
174701
|
-
function
|
|
175355
|
+
function isRecord13(value) {
|
|
174702
175356
|
return typeof value === "object" && value !== null;
|
|
174703
175357
|
}
|
|
174704
175358
|
|
|
@@ -174776,9 +175430,9 @@ function processKillErrorMeansAlive(error) {
|
|
|
174776
175430
|
}
|
|
174777
175431
|
|
|
174778
175432
|
// packages/utils/src/process-sweep/lsp-daemon-family.ts
|
|
174779
|
-
import { readFileSync as
|
|
174780
|
-
import { homedir as
|
|
174781
|
-
import { basename as basename23, join as
|
|
175433
|
+
import { readFileSync as readFileSync76, readdirSync as readdirSync31 } from "fs";
|
|
175434
|
+
import { homedir as homedir30 } from "os";
|
|
175435
|
+
import { basename as basename23, join as join137, resolve as resolve37 } from "path";
|
|
174782
175436
|
|
|
174783
175437
|
// packages/utils/src/process-sweep/lsp-daemon-owner-attestation.ts
|
|
174784
175438
|
import { readFile as readFile13 } from "fs/promises";
|
|
@@ -174802,7 +175456,7 @@ async function attestLspDaemonOwner(target, deps = {}) {
|
|
|
174802
175456
|
}
|
|
174803
175457
|
}
|
|
174804
175458
|
function parseLspDaemonOwner(value) {
|
|
174805
|
-
if (!
|
|
175459
|
+
if (!isRecord14(value))
|
|
174806
175460
|
return null;
|
|
174807
175461
|
const pid = value["pid"];
|
|
174808
175462
|
const nonce = value["nonce"];
|
|
@@ -174814,7 +175468,7 @@ function parseLspDaemonOwner(value) {
|
|
|
174814
175468
|
return null;
|
|
174815
175469
|
if (typeof startedAt !== "string" || startedAt.length === 0)
|
|
174816
175470
|
return null;
|
|
174817
|
-
if (!
|
|
175471
|
+
if (!isRecord14(endpoint))
|
|
174818
175472
|
return null;
|
|
174819
175473
|
const kind = endpoint["kind"];
|
|
174820
175474
|
const path = endpoint["path"];
|
|
@@ -174866,7 +175520,7 @@ async function pingLspDaemonOwner(endpoint, authToken) {
|
|
|
174866
175520
|
return finish(null);
|
|
174867
175521
|
try {
|
|
174868
175522
|
const response = JSON.parse(line);
|
|
174869
|
-
if (!
|
|
175523
|
+
if (!isRecord14(response) || response["id"] !== OWNER_PING_REQUEST_ID || "error" in response) {
|
|
174870
175524
|
return finish(null);
|
|
174871
175525
|
}
|
|
174872
175526
|
finish(parseLspDaemonOwner(response["result"]));
|
|
@@ -174879,7 +175533,7 @@ async function pingLspDaemonOwner(endpoint, authToken) {
|
|
|
174879
175533
|
function sameOwner(left, right) {
|
|
174880
175534
|
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;
|
|
174881
175535
|
}
|
|
174882
|
-
function
|
|
175536
|
+
function isRecord14(value) {
|
|
174883
175537
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
174884
175538
|
}
|
|
174885
175539
|
|
|
@@ -174894,8 +175548,8 @@ function resolveLspDaemonBaseDir(options = {}) {
|
|
|
174894
175548
|
const override = env[OMO_LSP_DAEMON_DIR_ENV];
|
|
174895
175549
|
if (override !== undefined && override.trim().length > 0)
|
|
174896
175550
|
return resolve37(override);
|
|
174897
|
-
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ??
|
|
174898
|
-
return
|
|
175551
|
+
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir30();
|
|
175552
|
+
return join137(homeDir, ".omo", "lsp-daemon");
|
|
174899
175553
|
}
|
|
174900
175554
|
var VERSION_ENTRY_PATTERN = /^v([A-Za-z0-9][A-Za-z0-9._+-]{0,127})$/;
|
|
174901
175555
|
function listLspDaemonVersionDirs(baseDir) {
|
|
@@ -174914,12 +175568,12 @@ function listLspDaemonVersionDirs(baseDir) {
|
|
|
174914
175568
|
const version = VERSION_ENTRY_PATTERN.exec(entry.name)?.[1];
|
|
174915
175569
|
if (version === undefined)
|
|
174916
175570
|
continue;
|
|
174917
|
-
versions.push({ dir:
|
|
175571
|
+
versions.push({ dir: join137(baseDir, entry.name), version });
|
|
174918
175572
|
}
|
|
174919
175573
|
return versions.sort((left, right) => left.version.localeCompare(right.version));
|
|
174920
175574
|
}
|
|
174921
175575
|
function readLspDaemonOwnerTarget(versionDir) {
|
|
174922
|
-
const ownerPath =
|
|
175576
|
+
const ownerPath = join137(versionDir, "daemon.owner");
|
|
174923
175577
|
let raw;
|
|
174924
175578
|
try {
|
|
174925
175579
|
raw = requireOwnerText(ownerPath);
|
|
@@ -174930,13 +175584,13 @@ function readLspDaemonOwnerTarget(versionDir) {
|
|
|
174930
175584
|
const owner = parseLspDaemonOwner(JSON.parse(raw));
|
|
174931
175585
|
if (owner === null)
|
|
174932
175586
|
return null;
|
|
174933
|
-
return { authPath:
|
|
175587
|
+
return { authPath: join137(versionDir, "daemon.auth"), owner, ownerPath, pid: owner.pid };
|
|
174934
175588
|
} catch {
|
|
174935
175589
|
return null;
|
|
174936
175590
|
}
|
|
174937
175591
|
}
|
|
174938
175592
|
function requireOwnerText(path) {
|
|
174939
|
-
return
|
|
175593
|
+
return readFileSync76(path, "utf8");
|
|
174940
175594
|
}
|
|
174941
175595
|
async function planStaleLspDaemonVersionSweep(options) {
|
|
174942
175596
|
const platform = options.platform ?? process.platform;
|
|
@@ -175003,35 +175657,35 @@ function matchLspDaemonProxyCommand(command, roots, platform) {
|
|
|
175003
175657
|
}
|
|
175004
175658
|
|
|
175005
175659
|
// packages/utils/src/process-sweep/roots.ts
|
|
175006
|
-
import { existsSync as
|
|
175007
|
-
import { homedir as
|
|
175008
|
-
import { join as
|
|
175660
|
+
import { existsSync as existsSync110, readdirSync as readdirSync32, realpathSync as realpathSync20 } from "fs";
|
|
175661
|
+
import { homedir as homedir31 } from "os";
|
|
175662
|
+
import { join as join138, resolve as resolve38 } from "path";
|
|
175009
175663
|
function discoverOmoOwnedRoots(options = {}) {
|
|
175010
175664
|
const env = options.env ?? process.env;
|
|
175011
|
-
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ??
|
|
175665
|
+
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir31();
|
|
175012
175666
|
const roots = new Set;
|
|
175013
|
-
addRoot(roots,
|
|
175667
|
+
addRoot(roots, join138(homeDir, ".claude", "omo"));
|
|
175014
175668
|
addRoot(roots, options.pluginRoot);
|
|
175015
175669
|
for (const root of options.extraRoots ?? [])
|
|
175016
175670
|
addRoot(roots, root);
|
|
175017
|
-
for (const root of readCodexPluginCacheRoots(options.codexHome ?? env["CODEX_HOME"] ??
|
|
175671
|
+
for (const root of readCodexPluginCacheRoots(options.codexHome ?? env["CODEX_HOME"] ?? join138(homeDir, ".codex"))) {
|
|
175018
175672
|
addRoot(roots, root);
|
|
175019
175673
|
}
|
|
175020
175674
|
return [...roots];
|
|
175021
175675
|
}
|
|
175022
175676
|
function readCodexPluginCacheRoots(codexHome) {
|
|
175023
|
-
const cacheRoot =
|
|
175024
|
-
if (!
|
|
175677
|
+
const cacheRoot = join138(codexHome, "plugins", "cache");
|
|
175678
|
+
if (!existsSync110(cacheRoot))
|
|
175025
175679
|
return [];
|
|
175026
175680
|
const roots = [];
|
|
175027
175681
|
for (const publisher of safeReadDir(cacheRoot)) {
|
|
175028
175682
|
if (!OMO_CODEX_PLUGIN_CACHE_PUBLISHERS.has(publisher))
|
|
175029
175683
|
continue;
|
|
175030
|
-
const omoRoot =
|
|
175031
|
-
if (!
|
|
175684
|
+
const omoRoot = join138(cacheRoot, publisher, "omo");
|
|
175685
|
+
if (!existsSync110(omoRoot))
|
|
175032
175686
|
continue;
|
|
175033
175687
|
for (const version of safeReadDir(omoRoot))
|
|
175034
|
-
roots.push(
|
|
175688
|
+
roots.push(join138(omoRoot, version));
|
|
175035
175689
|
}
|
|
175036
175690
|
return roots;
|
|
175037
175691
|
}
|
|
@@ -175069,10 +175723,10 @@ function isNonFatalFsError(error) {
|
|
|
175069
175723
|
var OMO_CODEX_PLUGIN_CACHE_PUBLISHERS = new Set(["sisyphuslabs"]);
|
|
175070
175724
|
|
|
175071
175725
|
// packages/utils/src/process-sweep/sweeper.ts
|
|
175072
|
-
import { join as
|
|
175726
|
+
import { join as join139 } from "path";
|
|
175073
175727
|
|
|
175074
175728
|
// packages/utils/src/process-sweep/family-sweeper.ts
|
|
175075
|
-
import { existsSync as
|
|
175729
|
+
import { existsSync as existsSync111, mkdirSync as mkdirSync26, statSync as statSync17, utimesSync, writeFileSync as writeFileSync29 } from "fs";
|
|
175076
175730
|
import { dirname as dirname48 } from "path";
|
|
175077
175731
|
var DEFAULT_GRACE_MS = 2000;
|
|
175078
175732
|
var DEFAULT_THROTTLE_MS = 60 * 60 * 1000;
|
|
@@ -175164,13 +175818,13 @@ async function safelyKill(pid, context) {
|
|
|
175164
175818
|
}
|
|
175165
175819
|
}
|
|
175166
175820
|
function isSweepThrottled(stampFile, nowMs, throttleMs) {
|
|
175167
|
-
if (!
|
|
175821
|
+
if (!existsSync111(stampFile))
|
|
175168
175822
|
return false;
|
|
175169
175823
|
return nowMs - statSync17(stampFile).mtimeMs < throttleMs;
|
|
175170
175824
|
}
|
|
175171
175825
|
function writeSweepStamp(stampFile, nowMs) {
|
|
175172
|
-
|
|
175173
|
-
|
|
175826
|
+
mkdirSync26(dirname48(stampFile), { recursive: true });
|
|
175827
|
+
writeFileSync29(stampFile, `${new Date(nowMs).toISOString()}
|
|
175174
175828
|
`);
|
|
175175
175829
|
const stampDate = new Date(nowMs);
|
|
175176
175830
|
utimesSync(stampFile, stampDate, stampDate);
|
|
@@ -175186,7 +175840,7 @@ function delay6(ms) {
|
|
|
175186
175840
|
// packages/utils/src/process-sweep/sweeper.ts
|
|
175187
175841
|
var LSP_PROXY_SWEEP_STAMP_FILE = "lsp-proxy-sweep.stamp";
|
|
175188
175842
|
async function sweepOrphanedLspDaemonProxies(options = {}) {
|
|
175189
|
-
const stampFile =
|
|
175843
|
+
const stampFile = join139(resolveLspDaemonBaseDir(options), LSP_PROXY_SWEEP_STAMP_FILE);
|
|
175190
175844
|
const ownedRoots = options.ownedRoots ?? discoverOmoOwnedRoots(options);
|
|
175191
175845
|
const result = await runProcessFamilySweep({
|
|
175192
175846
|
familyLabel: "lsp-daemon proxy sweep",
|
|
@@ -175205,7 +175859,7 @@ async function sweepOrphanedLspDaemonProxies(options = {}) {
|
|
|
175205
175859
|
var LSP_DAEMON_SWEEP_STAMP_FILE = "lsp-daemon-sweep.stamp";
|
|
175206
175860
|
async function sweepStaleLspDaemonVersions(options = {}) {
|
|
175207
175861
|
const baseDir = resolveLspDaemonBaseDir(options);
|
|
175208
|
-
const stampFile =
|
|
175862
|
+
const stampFile = join139(baseDir, LSP_DAEMON_SWEEP_STAMP_FILE);
|
|
175209
175863
|
const currentVersion = resolveCurrentLspDaemonVersion(options);
|
|
175210
175864
|
const dryRun = options.dryRun === true;
|
|
175211
175865
|
if (currentVersion === undefined) {
|
|
@@ -175277,20 +175931,20 @@ function defaultPluginRoot() {
|
|
|
175277
175931
|
// packages/telemetry-core/src/activity-state.ts
|
|
175278
175932
|
init_atomic_write();
|
|
175279
175933
|
init_xdg_data_dir();
|
|
175280
|
-
import { existsSync as
|
|
175281
|
-
import { basename as basename24, join as
|
|
175934
|
+
import { existsSync as existsSync112, mkdirSync as mkdirSync28, readFileSync as readFileSync77 } from "fs";
|
|
175935
|
+
import { basename as basename24, join as join141 } from "path";
|
|
175282
175936
|
|
|
175283
175937
|
// packages/telemetry-core/src/day-claim.ts
|
|
175284
|
-
import { closeSync as closeSync6, mkdirSync as
|
|
175285
|
-
import { join as
|
|
175938
|
+
import { closeSync as closeSync6, mkdirSync as mkdirSync27, openSync as openSync6, readdirSync as readdirSync33, rmSync as rmSync6 } from "fs";
|
|
175939
|
+
import { join as join140 } from "path";
|
|
175286
175940
|
var CLAIM_PREFIX = "daily-active.";
|
|
175287
175941
|
var CLAIM_SUFFIX = ".claim";
|
|
175288
175942
|
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
175289
|
-
return
|
|
175943
|
+
return join140(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
175290
175944
|
}
|
|
175291
175945
|
function claimUtcDay(stateDir, dayUTC) {
|
|
175292
175946
|
try {
|
|
175293
|
-
|
|
175947
|
+
mkdirSync27(stateDir, { recursive: true });
|
|
175294
175948
|
closeSync6(openSync6(getTelemetryDayClaimFilePath(stateDir, dayUTC), "wx"));
|
|
175295
175949
|
} catch (error) {
|
|
175296
175950
|
return error.code === "EEXIST" ? "already-claimed" : "unavailable";
|
|
@@ -175312,7 +175966,7 @@ function pruneSupersededClaims(stateDir, dayUTC) {
|
|
|
175312
175966
|
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
175313
175967
|
continue;
|
|
175314
175968
|
try {
|
|
175315
|
-
rmSync6(
|
|
175969
|
+
rmSync6(join140(stateDir, entry), { force: true });
|
|
175316
175970
|
} catch {}
|
|
175317
175971
|
}
|
|
175318
175972
|
}
|
|
@@ -175325,14 +175979,14 @@ function resolveTelemetryStateDir(product, options = {}) {
|
|
|
175325
175979
|
env: options.env,
|
|
175326
175980
|
osProvider: options.osProvider
|
|
175327
175981
|
});
|
|
175328
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
175982
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join141(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
175329
175983
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename24(dataDir) === product.cacheDirName) {
|
|
175330
175984
|
return dataDir;
|
|
175331
175985
|
}
|
|
175332
|
-
return
|
|
175986
|
+
return join141(dataDir, product.cacheDirName);
|
|
175333
175987
|
}
|
|
175334
175988
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
175335
|
-
return
|
|
175989
|
+
return join141(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
175336
175990
|
}
|
|
175337
175991
|
function getDailyActiveCaptureState(input) {
|
|
175338
175992
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
@@ -175365,11 +176019,11 @@ function isPostHogActivityState(value) {
|
|
|
175365
176019
|
}
|
|
175366
176020
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
175367
176021
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
175368
|
-
if (!
|
|
176022
|
+
if (!existsSync112(stateFilePath)) {
|
|
175369
176023
|
return {};
|
|
175370
176024
|
}
|
|
175371
176025
|
try {
|
|
175372
|
-
const stateContent =
|
|
176026
|
+
const stateContent = readFileSync77(stateFilePath, "utf-8");
|
|
175373
176027
|
const stateJson = JSON.parse(stateContent);
|
|
175374
176028
|
if (!isPostHogActivityState(stateJson)) {
|
|
175375
176029
|
return {};
|
|
@@ -175388,7 +176042,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
175388
176042
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
175389
176043
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
175390
176044
|
try {
|
|
175391
|
-
|
|
176045
|
+
mkdirSync28(stateDir, { recursive: true });
|
|
175392
176046
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
175393
176047
|
`);
|
|
175394
176048
|
} catch (error) {
|
|
@@ -182656,7 +183310,7 @@ var TOPLEVEL_SENTINELS = [
|
|
|
182656
183310
|
field: "window_id"
|
|
182657
183311
|
}
|
|
182658
183312
|
];
|
|
182659
|
-
function
|
|
183313
|
+
function isRecord15(value) {
|
|
182660
183314
|
return typeof value == "object" && value !== null && !Array.isArray(value);
|
|
182661
183315
|
}
|
|
182662
183316
|
function toRfc3339(timestamp) {
|
|
@@ -182678,7 +183332,7 @@ function relocateInto(properties, key, value) {
|
|
|
182678
183332
|
properties[key] = value;
|
|
182679
183333
|
}
|
|
182680
183334
|
function buildV1Event(message) {
|
|
182681
|
-
const sourceProperties =
|
|
183335
|
+
const sourceProperties = isRecord15(message.properties) ? message.properties : {};
|
|
182682
183336
|
const properties = {
|
|
182683
183337
|
...sourceProperties
|
|
182684
183338
|
};
|