|
@@ -17,13 +17,13 @@ import { pathToFileURL } from "url"
|
|
|
import { Effect } from "effect"
|
|
import { Effect } from "effect"
|
|
|
import { UI } from "../ui"
|
|
import { UI } from "../ui"
|
|
|
import { effectCmd } from "../effect-cmd"
|
|
import { effectCmd } from "../effect-cmd"
|
|
|
-import { Flag } from "@opencode-ai/core/flag/flag"
|
|
|
|
|
import { ServerAuth } from "@/server/auth"
|
|
import { ServerAuth } from "@/server/auth"
|
|
|
import { EOL } from "os"
|
|
import { EOL } from "os"
|
|
|
import { Filesystem } from "@/util/filesystem"
|
|
import { Filesystem } from "@/util/filesystem"
|
|
|
import { createOpencodeClient, type OpencodeClient, type ToolPart } from "@opencode-ai/sdk/v2"
|
|
import { createOpencodeClient, type OpencodeClient, type ToolPart } from "@opencode-ai/sdk/v2"
|
|
|
import { Agent } from "@/agent/agent"
|
|
import { Agent } from "@/agent/agent"
|
|
|
import { Permission } from "@/permission"
|
|
import { Permission } from "@/permission"
|
|
|
|
|
+import { RuntimeFlags } from "@/effect/runtime-flags"
|
|
|
import { FormatError, FormatUnknownError } from "../error"
|
|
import { FormatError, FormatUnknownError } from "../error"
|
|
|
import { INTERACTIVE_INPUT_ERROR, resolveInteractiveStdin } from "./run/runtime.stdin"
|
|
import { INTERACTIVE_INPUT_ERROR, resolveInteractiveStdin } from "./run/runtime.stdin"
|
|
|
|
|
|
|
@@ -235,6 +235,7 @@ export const RunCommand = effectCmd({
|
|
|
}),
|
|
}),
|
|
|
handler: Effect.fn("Cli.run")(function* (args) {
|
|
handler: Effect.fn("Cli.run")(function* (args) {
|
|
|
const agentSvc = yield* Agent.Service
|
|
const agentSvc = yield* Agent.Service
|
|
|
|
|
+ const flags = yield* RuntimeFlags.Service
|
|
|
yield* Effect.promise(async () => {
|
|
yield* Effect.promise(async () => {
|
|
|
const rawMessage = [...args.message, ...(args["--"] || [])].join(" ")
|
|
const rawMessage = [...args.message, ...(args["--"] || [])].join(" ")
|
|
|
const thinking = args.interactive ? (args.thinking ?? true) : (args.thinking ?? false)
|
|
const thinking = args.interactive ? (args.thinking ?? true) : (args.thinking ?? false)
|
|
@@ -446,7 +447,7 @@ export const RunCommand = effectCmd({
|
|
|
async function share(sdk: OpencodeClient, sessionID: string) {
|
|
async function share(sdk: OpencodeClient, sessionID: string) {
|
|
|
const cfg = await sdk.config.get()
|
|
const cfg = await sdk.config.get()
|
|
|
if (!cfg.data) return
|
|
if (!cfg.data) return
|
|
|
- if (cfg.data.share !== "auto" && !Flag.OPENCODE_AUTO_SHARE && !args.share) return
|
|
|
|
|
|
|
+ if (cfg.data.share !== "auto" && !flags.autoShare && !args.share) return
|
|
|
const res = await sdk.session.share({ sessionID }).catch((error) => {
|
|
const res = await sdk.session.share({ sessionID }).catch((error) => {
|
|
|
if (error instanceof Error && error.message.includes("disabled")) {
|
|
if (error instanceof Error && error.message.includes("disabled")) {
|
|
|
UI.println(UI.Style.TEXT_DANGER_BOLD + "! " + error.message)
|
|
UI.println(UI.Style.TEXT_DANGER_BOLD + "! " + error.message)
|