drizzy-agent 0.2.0 → 0.3.0
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/LICENSE.md +1 -1
- package/README.md +19 -3
- package/dist/cli/config-manager/config-context.d.ts +1 -1
- package/dist/cli/config-manager/detect-and-remove-oh-my-opencode.d.ts +29 -0
- package/dist/cli/config-manager/detect-current-config.d.ts +13 -1
- package/dist/cli/config-manager/generate-drizzy-config.d.ts +2 -0
- package/dist/cli/config-manager/oh-my-opencode-paths.d.ts +6 -0
- package/dist/cli/config-manager/write-drizzy-config.d.ts +2 -0
- package/dist/cli/config-manager.d.ts +4 -2
- package/dist/cli/index.js +11203 -11260
- package/dist/cli/run/agent-resolver.d.ts +2 -2
- package/dist/cli/tui-install-prompts.d.ts +2 -1
- package/dist/cli/types.d.ts +6 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/schema/{oh-my-opencode-config.d.ts → drizzy-agent-config.d.ts} +2 -2
- package/dist/config/schema.d.ts +1 -1
- package/dist/create-hooks.d.ts +2 -2
- package/dist/create-managers.d.ts +2 -2
- package/dist/create-tools.d.ts +2 -2
- package/dist/features/claude-code-plugin-loader/types.d.ts +1 -1
- package/dist/features/claude-tasks/session-storage.d.ts +5 -5
- package/dist/features/claude-tasks/storage.d.ts +4 -4
- package/dist/hooks/anthropic-context-window-limit-recovery/executor.d.ts +2 -2
- package/dist/hooks/anthropic-context-window-limit-recovery/recovery-hook.d.ts +2 -2
- package/dist/hooks/anthropic-context-window-limit-recovery/summarize-retry-strategy.d.ts +2 -2
- package/dist/hooks/auto-update-checker/constants.d.ts +2 -2
- package/dist/hooks/comment-checker/downloader.d.ts +1 -1
- package/dist/hooks/keyword-detector/constants.d.ts +1 -0
- package/dist/hooks/keyword-detector/detector.d.ts +1 -1
- package/dist/hooks/keyword-detector/git/default.d.ts +12 -0
- package/dist/hooks/keyword-detector/git/index.d.ts +1 -0
- package/dist/hooks/preemptive-compaction.d.ts +2 -2
- package/dist/hooks/runtime-fallback/fallback-models.d.ts +2 -2
- package/dist/hooks/runtime-fallback/types.d.ts +3 -3
- package/dist/hooks/shared/compaction-model-resolver.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +354 -344
- package/dist/mcp/index.d.ts +2 -2
- package/dist/plugin/available-categories.d.ts +2 -2
- package/dist/plugin/chat-message.d.ts +2 -2
- package/dist/plugin/event.d.ts +2 -2
- package/dist/plugin/hooks/create-continuation-hooks.d.ts +2 -2
- package/dist/plugin/hooks/create-core-hooks.d.ts +2 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -2
- package/dist/plugin/hooks/create-skill-hooks.d.ts +2 -2
- package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +2 -2
- package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -2
- package/dist/plugin/skill-context.d.ts +2 -2
- package/dist/plugin/tool-registry.d.ts +2 -2
- package/dist/plugin/ultrawork-model-override.d.ts +3 -3
- package/dist/plugin/unstable-agent-babysitter.d.ts +2 -2
- package/dist/plugin-config.d.ts +5 -5
- package/dist/plugin-handlers/agent-config-handler.d.ts +2 -2
- package/dist/plugin-handlers/command-config-handler.d.ts +2 -2
- package/dist/plugin-handlers/config-handler.d.ts +2 -2
- package/dist/plugin-handlers/mcp-config-handler.d.ts +2 -2
- package/dist/plugin-handlers/plugin-components-loader.d.ts +2 -2
- package/dist/plugin-handlers/tool-config-handler.d.ts +2 -2
- package/dist/plugin-interface.d.ts +2 -2
- package/dist/shared/agent-variant.d.ts +4 -4
- package/dist/shared/data-path.d.ts +3 -3
- package/dist/shared/external-plugin-detector.d.ts +1 -1
- package/dist/shared/opencode-config-dir-types.d.ts +1 -1
- package/dist/shared/system-directive.d.ts +2 -2
- package/dist/tools/task/task-create.d.ts +2 -2
- package/dist/tools/task/task-get.d.ts +2 -2
- package/dist/tools/task/task-list.d.ts +2 -2
- package/dist/tools/task/task-update.d.ts +2 -2
- package/package.json +12 -12
- package/dist/cli/config-manager/generate-omo-config.d.ts +0 -2
- package/dist/cli/config-manager/write-omo-config.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -57,8 +57,8 @@ import * as os from "os";
|
|
|
57
57
|
import * as path from "path";
|
|
58
58
|
function log(message, data) {
|
|
59
59
|
try {
|
|
60
|
-
const
|
|
61
|
-
const logEntry = `[${
|
|
60
|
+
const timestamp = new Date().toISOString();
|
|
61
|
+
const logEntry = `[${timestamp}] ${message} ${data ? JSON.stringify(data) : ""}
|
|
62
62
|
`;
|
|
63
63
|
fs.appendFileSync(logFile, logEntry);
|
|
64
64
|
} catch {}
|
|
@@ -5343,7 +5343,7 @@ var init_constants = __esm(() => {
|
|
|
5343
5343
|
DEFAULT_CATEGORIES = {
|
|
5344
5344
|
"visual-engineering": { model: "google/gemini-3.1-pro", variant: "high" },
|
|
5345
5345
|
ultrabrain: { model: "openai/gpt-5.4", variant: "xhigh" },
|
|
5346
|
-
deep: { model: "openai/gpt-5.
|
|
5346
|
+
deep: { model: "openai/gpt-5.4", variant: "medium" },
|
|
5347
5347
|
artistry: { model: "google/gemini-3.1-pro", variant: "high" },
|
|
5348
5348
|
quick: { model: "anthropic/claude-haiku-4-5" },
|
|
5349
5349
|
"unspecified-low": { model: "anthropic/claude-sonnet-4-6" },
|
|
@@ -12302,6 +12302,186 @@ var require_cross_spawn = __commonJS((exports, module) => {
|
|
|
12302
12302
|
module.exports._enoent = enoent;
|
|
12303
12303
|
});
|
|
12304
12304
|
|
|
12305
|
+
// src/shared/opencode-config-dir.ts
|
|
12306
|
+
import { existsSync } from "fs";
|
|
12307
|
+
import { homedir } from "os";
|
|
12308
|
+
import { join, resolve } from "path";
|
|
12309
|
+
var TAURI_APP_IDENTIFIER = "ai.opencode.desktop";
|
|
12310
|
+
var TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
|
|
12311
|
+
function isDevBuild(version) {
|
|
12312
|
+
if (!version)
|
|
12313
|
+
return false;
|
|
12314
|
+
return version.includes("-dev") || version.includes(".dev");
|
|
12315
|
+
}
|
|
12316
|
+
function getTauriConfigDir(identifier) {
|
|
12317
|
+
const platform = process.platform;
|
|
12318
|
+
switch (platform) {
|
|
12319
|
+
case "darwin":
|
|
12320
|
+
return join(homedir(), "Library", "Application Support", identifier);
|
|
12321
|
+
case "win32": {
|
|
12322
|
+
const appData = process.env.APPDATA || join(homedir(), "AppData", "Roaming");
|
|
12323
|
+
return join(appData, identifier);
|
|
12324
|
+
}
|
|
12325
|
+
case "linux":
|
|
12326
|
+
default: {
|
|
12327
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
|
|
12328
|
+
return join(xdgConfig, identifier);
|
|
12329
|
+
}
|
|
12330
|
+
}
|
|
12331
|
+
}
|
|
12332
|
+
function getCliConfigDir() {
|
|
12333
|
+
const envConfigDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
12334
|
+
if (envConfigDir) {
|
|
12335
|
+
return resolve(envConfigDir);
|
|
12336
|
+
}
|
|
12337
|
+
if (process.platform === "win32") {
|
|
12338
|
+
const crossPlatformDir = join(homedir(), ".config", "opencode");
|
|
12339
|
+
const crossPlatformConfig = join(crossPlatformDir, "opencode.json");
|
|
12340
|
+
if (existsSync(crossPlatformConfig)) {
|
|
12341
|
+
return crossPlatformDir;
|
|
12342
|
+
}
|
|
12343
|
+
const appData = process.env.APPDATA || join(homedir(), "AppData", "Roaming");
|
|
12344
|
+
const appdataDir = join(appData, "opencode");
|
|
12345
|
+
const appdataConfig = join(appdataDir, "opencode.json");
|
|
12346
|
+
if (existsSync(appdataConfig)) {
|
|
12347
|
+
return appdataDir;
|
|
12348
|
+
}
|
|
12349
|
+
return crossPlatformDir;
|
|
12350
|
+
}
|
|
12351
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
|
|
12352
|
+
return join(xdgConfig, "opencode");
|
|
12353
|
+
}
|
|
12354
|
+
function getOpenCodeConfigDir(options) {
|
|
12355
|
+
const { binary, version, checkExisting = true } = options;
|
|
12356
|
+
if (binary === "opencode") {
|
|
12357
|
+
return getCliConfigDir();
|
|
12358
|
+
}
|
|
12359
|
+
const identifier = isDevBuild(version) ? TAURI_APP_IDENTIFIER_DEV : TAURI_APP_IDENTIFIER;
|
|
12360
|
+
const tauriDir = getTauriConfigDir(identifier);
|
|
12361
|
+
if (checkExisting) {
|
|
12362
|
+
const legacyDir = getCliConfigDir();
|
|
12363
|
+
const legacyConfig = join(legacyDir, "opencode.json");
|
|
12364
|
+
const legacyConfigC = join(legacyDir, "opencode.jsonc");
|
|
12365
|
+
if (existsSync(legacyConfig) || existsSync(legacyConfigC)) {
|
|
12366
|
+
return legacyDir;
|
|
12367
|
+
}
|
|
12368
|
+
}
|
|
12369
|
+
return tauriDir;
|
|
12370
|
+
}
|
|
12371
|
+
function getOpenCodeConfigPaths(options) {
|
|
12372
|
+
const configDir = getOpenCodeConfigDir(options);
|
|
12373
|
+
return {
|
|
12374
|
+
configDir,
|
|
12375
|
+
configJson: join(configDir, "opencode.json"),
|
|
12376
|
+
configJsonc: join(configDir, "opencode.jsonc"),
|
|
12377
|
+
packageJson: join(configDir, "package.json"),
|
|
12378
|
+
drizzyConfig: join(configDir, "drizzy-agent.json")
|
|
12379
|
+
};
|
|
12380
|
+
}
|
|
12381
|
+
|
|
12382
|
+
// src/cli/config-manager/config-context.ts
|
|
12383
|
+
var configContext = null;
|
|
12384
|
+
function initConfigContext(binary, version) {
|
|
12385
|
+
const paths = getOpenCodeConfigPaths({ binary, version });
|
|
12386
|
+
configContext = { binary, version, paths };
|
|
12387
|
+
}
|
|
12388
|
+
|
|
12389
|
+
// src/hooks/todo-continuation-enforcer/index.ts
|
|
12390
|
+
init_logger();
|
|
12391
|
+
|
|
12392
|
+
// src/shared/system-directive.ts
|
|
12393
|
+
var SYSTEM_DIRECTIVE_PREFIX = "[SYSTEM DIRECTIVE: OH-MY-OPENCODE";
|
|
12394
|
+
function createSystemDirective(type) {
|
|
12395
|
+
return `${SYSTEM_DIRECTIVE_PREFIX} - ${type}]`;
|
|
12396
|
+
}
|
|
12397
|
+
function isSystemDirective(text) {
|
|
12398
|
+
return text.trimStart().startsWith(SYSTEM_DIRECTIVE_PREFIX);
|
|
12399
|
+
}
|
|
12400
|
+
function removeSystemReminders(text) {
|
|
12401
|
+
return text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/gi, "").trim();
|
|
12402
|
+
}
|
|
12403
|
+
var SystemDirectiveTypes = {
|
|
12404
|
+
TODO_CONTINUATION: "TODO CONTINUATION",
|
|
12405
|
+
RALPH_LOOP: "RALPH LOOP",
|
|
12406
|
+
BOULDER_CONTINUATION: "BOULDER CONTINUATION",
|
|
12407
|
+
DELEGATION_REQUIRED: "DELEGATION REQUIRED",
|
|
12408
|
+
SINGLE_TASK_ONLY: "SINGLE TASK ONLY",
|
|
12409
|
+
COMPACTION_CONTEXT: "COMPACTION CONTEXT",
|
|
12410
|
+
CONTEXT_WINDOW_MONITOR: "CONTEXT WINDOW MONITOR",
|
|
12411
|
+
PLANNER_READ_ONLY: "PLANNER READ-ONLY"
|
|
12412
|
+
};
|
|
12413
|
+
|
|
12414
|
+
// src/hooks/todo-continuation-enforcer/constants.ts
|
|
12415
|
+
var HOOK_NAME = "todo-continuation-enforcer";
|
|
12416
|
+
var DEFAULT_SKIP_AGENTS = ["planner", "compaction"];
|
|
12417
|
+
var CONTINUATION_PROMPT = `${createSystemDirective(SystemDirectiveTypes.TODO_CONTINUATION)}
|
|
12418
|
+
|
|
12419
|
+
Incomplete tasks remain in your todo list. Continue working on the next pending task.
|
|
12420
|
+
|
|
12421
|
+
- Proceed without asking for permission
|
|
12422
|
+
- Mark each task complete when finished
|
|
12423
|
+
- Do not stop until all tasks are done`;
|
|
12424
|
+
var COUNTDOWN_SECONDS = 2;
|
|
12425
|
+
var TOAST_DURATION_MS = 900;
|
|
12426
|
+
var COUNTDOWN_GRACE_PERIOD_MS = 500;
|
|
12427
|
+
var ABORT_WINDOW_MS = 3000;
|
|
12428
|
+
var CONTINUATION_COOLDOWN_MS = 5000;
|
|
12429
|
+
var MAX_STAGNATION_COUNT = 3;
|
|
12430
|
+
var MAX_CONSECUTIVE_FAILURES = 5;
|
|
12431
|
+
var FAILURE_RESET_WINDOW_MS = 5 * 60 * 1000;
|
|
12432
|
+
// src/features/run-continuation-state/constants.ts
|
|
12433
|
+
var CONTINUATION_MARKER_DIR = ".drizzy/run-continuation";
|
|
12434
|
+
// src/features/run-continuation-state/storage.ts
|
|
12435
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
12436
|
+
import { join as join3 } from "path";
|
|
12437
|
+
function getMarkerPath(directory, sessionID) {
|
|
12438
|
+
return join3(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
12439
|
+
}
|
|
12440
|
+
function readContinuationMarker(directory, sessionID) {
|
|
12441
|
+
const markerPath = getMarkerPath(directory, sessionID);
|
|
12442
|
+
if (!existsSync2(markerPath))
|
|
12443
|
+
return null;
|
|
12444
|
+
try {
|
|
12445
|
+
const raw = readFileSync(markerPath, "utf-8");
|
|
12446
|
+
const parsed = JSON.parse(raw);
|
|
12447
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
12448
|
+
return null;
|
|
12449
|
+
return parsed;
|
|
12450
|
+
} catch {
|
|
12451
|
+
return null;
|
|
12452
|
+
}
|
|
12453
|
+
}
|
|
12454
|
+
function setContinuationMarkerSource(directory, sessionID, source, state, reason) {
|
|
12455
|
+
const now = new Date().toISOString();
|
|
12456
|
+
const existing = readContinuationMarker(directory, sessionID);
|
|
12457
|
+
const next = {
|
|
12458
|
+
sessionID,
|
|
12459
|
+
updatedAt: now,
|
|
12460
|
+
sources: {
|
|
12461
|
+
...existing?.sources ?? {},
|
|
12462
|
+
[source]: {
|
|
12463
|
+
state,
|
|
12464
|
+
...reason ? { reason } : {},
|
|
12465
|
+
updatedAt: now
|
|
12466
|
+
}
|
|
12467
|
+
}
|
|
12468
|
+
};
|
|
12469
|
+
const markerPath = getMarkerPath(directory, sessionID);
|
|
12470
|
+
mkdirSync(join3(directory, CONTINUATION_MARKER_DIR), { recursive: true });
|
|
12471
|
+
writeFileSync(markerPath, JSON.stringify(next, null, 2), "utf-8");
|
|
12472
|
+
return next;
|
|
12473
|
+
}
|
|
12474
|
+
function clearContinuationMarker(directory, sessionID) {
|
|
12475
|
+
const markerPath = getMarkerPath(directory, sessionID);
|
|
12476
|
+
if (!existsSync2(markerPath))
|
|
12477
|
+
return;
|
|
12478
|
+
try {
|
|
12479
|
+
rmSync(markerPath);
|
|
12480
|
+
} catch {}
|
|
12481
|
+
}
|
|
12482
|
+
// src/hooks/todo-continuation-enforcer/handler.ts
|
|
12483
|
+
init_logger();
|
|
12484
|
+
|
|
12305
12485
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
12306
12486
|
/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
|
|
12307
12487
|
function isNothing(subject) {
|
|
@@ -14952,7 +15132,7 @@ var load = loader.load;
|
|
|
14952
15132
|
var loadAll = loader.loadAll;
|
|
14953
15133
|
var dump = dumper.dump;
|
|
14954
15134
|
var YAMLException = exception;
|
|
14955
|
-
var
|
|
15135
|
+
var types2 = {
|
|
14956
15136
|
binary,
|
|
14957
15137
|
float,
|
|
14958
15138
|
map,
|
|
@@ -14981,7 +15161,7 @@ var jsYaml = {
|
|
|
14981
15161
|
loadAll,
|
|
14982
15162
|
dump,
|
|
14983
15163
|
YAMLException,
|
|
14984
|
-
types,
|
|
15164
|
+
types: types2,
|
|
14985
15165
|
safeLoad,
|
|
14986
15166
|
safeLoadAll,
|
|
14987
15167
|
safeDump
|
|
@@ -15008,22 +15188,22 @@ function parseFrontmatter(content) {
|
|
|
15008
15188
|
import { spawn } from "child_process";
|
|
15009
15189
|
|
|
15010
15190
|
// src/shared/command-executor/home-directory.ts
|
|
15011
|
-
import { homedir } from "os";
|
|
15191
|
+
import { homedir as homedir2 } from "os";
|
|
15012
15192
|
function getHomeDirectory() {
|
|
15013
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
15193
|
+
return process.env.HOME || process.env.USERPROFILE || homedir2();
|
|
15014
15194
|
}
|
|
15015
15195
|
|
|
15016
15196
|
// src/shared/command-executor/shell-path.ts
|
|
15017
|
-
import { existsSync } from "fs";
|
|
15197
|
+
import { existsSync as existsSync3 } from "fs";
|
|
15018
15198
|
var DEFAULT_ZSH_PATHS = ["/bin/zsh", "/usr/bin/zsh", "/usr/local/bin/zsh"];
|
|
15019
15199
|
var DEFAULT_BASH_PATHS = ["/bin/bash", "/usr/bin/bash", "/usr/local/bin/bash"];
|
|
15020
15200
|
function findShellPath(defaultPaths, customPath) {
|
|
15021
|
-
if (customPath &&
|
|
15201
|
+
if (customPath && existsSync3(customPath)) {
|
|
15022
15202
|
return customPath;
|
|
15023
15203
|
}
|
|
15024
|
-
for (const
|
|
15025
|
-
if (
|
|
15026
|
-
return
|
|
15204
|
+
for (const path2 of defaultPaths) {
|
|
15205
|
+
if (existsSync3(path2)) {
|
|
15206
|
+
return path2;
|
|
15027
15207
|
}
|
|
15028
15208
|
}
|
|
15029
15209
|
return null;
|
|
@@ -15055,7 +15235,7 @@ async function executeHookCommand(command, stdin, cwd, options) {
|
|
|
15055
15235
|
}
|
|
15056
15236
|
}
|
|
15057
15237
|
}
|
|
15058
|
-
return new Promise((
|
|
15238
|
+
return new Promise((resolve2) => {
|
|
15059
15239
|
let settled = false;
|
|
15060
15240
|
let killTimer = null;
|
|
15061
15241
|
const isWin32 = process.platform === "win32";
|
|
@@ -15084,7 +15264,7 @@ async function executeHookCommand(command, stdin, cwd, options) {
|
|
|
15084
15264
|
clearTimeout(killTimer);
|
|
15085
15265
|
if (timeoutTimer)
|
|
15086
15266
|
clearTimeout(timeoutTimer);
|
|
15087
|
-
|
|
15267
|
+
resolve2(result);
|
|
15088
15268
|
};
|
|
15089
15269
|
proc.on("close", (code) => {
|
|
15090
15270
|
settle({
|
|
@@ -15196,8 +15376,8 @@ async function resolveCommandsInText(text, depth = 0, maxDepth = 3) {
|
|
|
15196
15376
|
return resolved;
|
|
15197
15377
|
}
|
|
15198
15378
|
// src/shared/file-reference-resolver.ts
|
|
15199
|
-
import { existsSync as
|
|
15200
|
-
import { join, isAbsolute } from "path";
|
|
15379
|
+
import { existsSync as existsSync4, readFileSync as readFileSync2, statSync } from "fs";
|
|
15380
|
+
import { join as join4, isAbsolute } from "path";
|
|
15201
15381
|
var FILE_REFERENCE_PATTERN = /@([^\s@]+)/g;
|
|
15202
15382
|
function findFileReferences(text) {
|
|
15203
15383
|
const matches = [];
|
|
@@ -15217,17 +15397,17 @@ function resolveFilePath(filePath, cwd) {
|
|
|
15217
15397
|
if (isAbsolute(filePath)) {
|
|
15218
15398
|
return filePath;
|
|
15219
15399
|
}
|
|
15220
|
-
return
|
|
15400
|
+
return join4(cwd, filePath);
|
|
15221
15401
|
}
|
|
15222
15402
|
function readFileContent(resolvedPath) {
|
|
15223
|
-
if (!
|
|
15403
|
+
if (!existsSync4(resolvedPath)) {
|
|
15224
15404
|
return `[file not found: ${resolvedPath}]`;
|
|
15225
15405
|
}
|
|
15226
15406
|
const stat = statSync(resolvedPath);
|
|
15227
15407
|
if (stat.isDirectory()) {
|
|
15228
15408
|
return `[cannot read directory: ${resolvedPath}]`;
|
|
15229
15409
|
}
|
|
15230
|
-
const content =
|
|
15410
|
+
const content = readFileSync2(resolvedPath, "utf-8");
|
|
15231
15411
|
return content;
|
|
15232
15412
|
}
|
|
15233
15413
|
async function resolveFileReferencesInText(text, cwd = process.cwd(), depth = 0, maxDepth = 3) {
|
|
@@ -15577,7 +15757,7 @@ function getOpenCodeStorageDir() {
|
|
|
15577
15757
|
function getCacheDir() {
|
|
15578
15758
|
return process.env.XDG_CACHE_HOME ?? path2.join(os2.homedir(), ".cache");
|
|
15579
15759
|
}
|
|
15580
|
-
function
|
|
15760
|
+
function getDrizzyAgentCacheDir() {
|
|
15581
15761
|
return path2.join(getCacheDir(), "drizzy-agent");
|
|
15582
15762
|
}
|
|
15583
15763
|
function getOpenCodeCacheDir() {
|
|
@@ -15595,17 +15775,17 @@ function addConfigLoadError(error) {
|
|
|
15595
15775
|
configLoadErrors.push(error);
|
|
15596
15776
|
}
|
|
15597
15777
|
// src/shared/claude-config-dir.ts
|
|
15598
|
-
import { homedir as
|
|
15599
|
-
import { join as
|
|
15778
|
+
import { homedir as homedir4 } from "os";
|
|
15779
|
+
import { join as join6 } from "path";
|
|
15600
15780
|
function getClaudeConfigDir() {
|
|
15601
15781
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
15602
15782
|
if (envConfigDir) {
|
|
15603
15783
|
return envConfigDir;
|
|
15604
15784
|
}
|
|
15605
|
-
return
|
|
15785
|
+
return join6(homedir4(), ".claude");
|
|
15606
15786
|
}
|
|
15607
15787
|
// src/shared/jsonc-parser.ts
|
|
15608
|
-
import { existsSync as
|
|
15788
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
|
|
15609
15789
|
|
|
15610
15790
|
// node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
15611
15791
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -16479,10 +16659,10 @@ function parseJsoncSafe(content) {
|
|
|
16479
16659
|
function detectConfigFile(basePath) {
|
|
16480
16660
|
const jsoncPath = `${basePath}.jsonc`;
|
|
16481
16661
|
const jsonPath = `${basePath}.json`;
|
|
16482
|
-
if (
|
|
16662
|
+
if (existsSync5(jsoncPath)) {
|
|
16483
16663
|
return { format: "jsonc", path: jsoncPath };
|
|
16484
16664
|
}
|
|
16485
|
-
if (
|
|
16665
|
+
if (existsSync5(jsonPath)) {
|
|
16486
16666
|
return { format: "json", path: jsonPath };
|
|
16487
16667
|
}
|
|
16488
16668
|
return { format: "none", path: jsonPath };
|
|
@@ -16713,82 +16893,6 @@ function migrateConfigFile(configPath, rawConfig) {
|
|
|
16713
16893
|
}
|
|
16714
16894
|
return needsWrite;
|
|
16715
16895
|
}
|
|
16716
|
-
// src/shared/opencode-config-dir.ts
|
|
16717
|
-
import { existsSync as existsSync4 } from "fs";
|
|
16718
|
-
import { homedir as homedir4 } from "os";
|
|
16719
|
-
import { join as join5, resolve } from "path";
|
|
16720
|
-
var TAURI_APP_IDENTIFIER = "ai.opencode.desktop";
|
|
16721
|
-
var TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
|
|
16722
|
-
function isDevBuild(version) {
|
|
16723
|
-
if (!version)
|
|
16724
|
-
return false;
|
|
16725
|
-
return version.includes("-dev") || version.includes(".dev");
|
|
16726
|
-
}
|
|
16727
|
-
function getTauriConfigDir(identifier) {
|
|
16728
|
-
const platform = process.platform;
|
|
16729
|
-
switch (platform) {
|
|
16730
|
-
case "darwin":
|
|
16731
|
-
return join5(homedir4(), "Library", "Application Support", identifier);
|
|
16732
|
-
case "win32": {
|
|
16733
|
-
const appData = process.env.APPDATA || join5(homedir4(), "AppData", "Roaming");
|
|
16734
|
-
return join5(appData, identifier);
|
|
16735
|
-
}
|
|
16736
|
-
case "linux":
|
|
16737
|
-
default: {
|
|
16738
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join5(homedir4(), ".config");
|
|
16739
|
-
return join5(xdgConfig, identifier);
|
|
16740
|
-
}
|
|
16741
|
-
}
|
|
16742
|
-
}
|
|
16743
|
-
function getCliConfigDir() {
|
|
16744
|
-
const envConfigDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
16745
|
-
if (envConfigDir) {
|
|
16746
|
-
return resolve(envConfigDir);
|
|
16747
|
-
}
|
|
16748
|
-
if (process.platform === "win32") {
|
|
16749
|
-
const crossPlatformDir = join5(homedir4(), ".config", "opencode");
|
|
16750
|
-
const crossPlatformConfig = join5(crossPlatformDir, "opencode.json");
|
|
16751
|
-
if (existsSync4(crossPlatformConfig)) {
|
|
16752
|
-
return crossPlatformDir;
|
|
16753
|
-
}
|
|
16754
|
-
const appData = process.env.APPDATA || join5(homedir4(), "AppData", "Roaming");
|
|
16755
|
-
const appdataDir = join5(appData, "opencode");
|
|
16756
|
-
const appdataConfig = join5(appdataDir, "opencode.json");
|
|
16757
|
-
if (existsSync4(appdataConfig)) {
|
|
16758
|
-
return appdataDir;
|
|
16759
|
-
}
|
|
16760
|
-
return crossPlatformDir;
|
|
16761
|
-
}
|
|
16762
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join5(homedir4(), ".config");
|
|
16763
|
-
return join5(xdgConfig, "opencode");
|
|
16764
|
-
}
|
|
16765
|
-
function getOpenCodeConfigDir(options) {
|
|
16766
|
-
const { binary: binary2, version, checkExisting = true } = options;
|
|
16767
|
-
if (binary2 === "opencode") {
|
|
16768
|
-
return getCliConfigDir();
|
|
16769
|
-
}
|
|
16770
|
-
const identifier = isDevBuild(version) ? TAURI_APP_IDENTIFIER_DEV : TAURI_APP_IDENTIFIER;
|
|
16771
|
-
const tauriDir = getTauriConfigDir(identifier);
|
|
16772
|
-
if (checkExisting) {
|
|
16773
|
-
const legacyDir = getCliConfigDir();
|
|
16774
|
-
const legacyConfig = join5(legacyDir, "opencode.json");
|
|
16775
|
-
const legacyConfigC = join5(legacyDir, "opencode.jsonc");
|
|
16776
|
-
if (existsSync4(legacyConfig) || existsSync4(legacyConfigC)) {
|
|
16777
|
-
return legacyDir;
|
|
16778
|
-
}
|
|
16779
|
-
}
|
|
16780
|
-
return tauriDir;
|
|
16781
|
-
}
|
|
16782
|
-
function getOpenCodeConfigPaths(options) {
|
|
16783
|
-
const configDir = getOpenCodeConfigDir(options);
|
|
16784
|
-
return {
|
|
16785
|
-
configDir,
|
|
16786
|
-
configJson: join5(configDir, "opencode.json"),
|
|
16787
|
-
configJsonc: join5(configDir, "opencode.jsonc"),
|
|
16788
|
-
packageJson: join5(configDir, "package.json"),
|
|
16789
|
-
omoConfig: join5(configDir, "drizzy-agent.json")
|
|
16790
|
-
};
|
|
16791
|
-
}
|
|
16792
16896
|
// src/shared/opencode-version.ts
|
|
16793
16897
|
import { execSync } from "child_process";
|
|
16794
16898
|
var OPENCODE_NATIVE_AGENTS_INJECTION_VERSION = "1.1.37";
|
|
@@ -16838,8 +16942,8 @@ function isOpenCodeVersionAtLeast(version) {
|
|
|
16838
16942
|
return compareVersions(current, version) >= 0;
|
|
16839
16943
|
}
|
|
16840
16944
|
// src/shared/opencode-storage-detection.ts
|
|
16841
|
-
import { existsSync as
|
|
16842
|
-
import { join as
|
|
16945
|
+
import { existsSync as existsSync6 } from "fs";
|
|
16946
|
+
import { join as join7 } from "path";
|
|
16843
16947
|
var NOT_CACHED2 = Symbol("NOT_CACHED");
|
|
16844
16948
|
var FALSE_PENDING_RETRY = Symbol("FALSE_PENDING_RETRY");
|
|
16845
16949
|
var cachedResult = NOT_CACHED2;
|
|
@@ -16850,8 +16954,8 @@ function isSqliteBackend() {
|
|
|
16850
16954
|
return false;
|
|
16851
16955
|
const check = () => {
|
|
16852
16956
|
const versionOk = isOpenCodeVersionAtLeast(OPENCODE_SQLITE_VERSION);
|
|
16853
|
-
const dbPath =
|
|
16854
|
-
return versionOk &&
|
|
16957
|
+
const dbPath = join7(getDataDir(), "opencode", "opencode.db");
|
|
16958
|
+
return versionOk && existsSync6(dbPath);
|
|
16855
16959
|
};
|
|
16856
16960
|
if (cachedResult === FALSE_PENDING_RETRY) {
|
|
16857
16961
|
const result2 = check();
|
|
@@ -17069,16 +17173,16 @@ async function extractZip(archivePath, destDir) {
|
|
|
17069
17173
|
}
|
|
17070
17174
|
}
|
|
17071
17175
|
// src/shared/binary-downloader.ts
|
|
17072
|
-
import { chmodSync, existsSync as
|
|
17176
|
+
import { chmodSync, existsSync as existsSync8, mkdirSync as mkdirSync2, unlinkSync } from "fs";
|
|
17073
17177
|
import * as path4 from "path";
|
|
17074
17178
|
var {spawn: spawn3 } = globalThis.Bun;
|
|
17075
17179
|
function getCachedBinaryPath(cacheDir, binaryName) {
|
|
17076
17180
|
const binaryPath = path4.join(cacheDir, binaryName);
|
|
17077
|
-
return
|
|
17181
|
+
return existsSync8(binaryPath) ? binaryPath : null;
|
|
17078
17182
|
}
|
|
17079
17183
|
function ensureCacheDir(cacheDir) {
|
|
17080
|
-
if (!
|
|
17081
|
-
|
|
17184
|
+
if (!existsSync8(cacheDir)) {
|
|
17185
|
+
mkdirSync2(cacheDir, { recursive: true });
|
|
17082
17186
|
}
|
|
17083
17187
|
}
|
|
17084
17188
|
async function downloadArchive(downloadUrl, archivePath) {
|
|
@@ -17106,12 +17210,12 @@ async function extractZipArchive(archivePath, destDir) {
|
|
|
17106
17210
|
await extractZip(archivePath, destDir);
|
|
17107
17211
|
}
|
|
17108
17212
|
function cleanupArchive(archivePath) {
|
|
17109
|
-
if (
|
|
17213
|
+
if (existsSync8(archivePath)) {
|
|
17110
17214
|
unlinkSync(archivePath);
|
|
17111
17215
|
}
|
|
17112
17216
|
}
|
|
17113
17217
|
function ensureExecutable(binaryPath) {
|
|
17114
|
-
if (process.platform !== "win32" &&
|
|
17218
|
+
if (process.platform !== "win32" && existsSync8(binaryPath)) {
|
|
17115
17219
|
chmodSync(binaryPath, 493);
|
|
17116
17220
|
}
|
|
17117
17221
|
}
|
|
@@ -17186,7 +17290,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
17186
17290
|
fallbackChain: [
|
|
17187
17291
|
{
|
|
17188
17292
|
providers: ["openai", "venice", "opencode"],
|
|
17189
|
-
model: "gpt-5.
|
|
17293
|
+
model: "gpt-5.4",
|
|
17190
17294
|
variant: "medium"
|
|
17191
17295
|
},
|
|
17192
17296
|
{ providers: ["github-copilot"], model: "gpt-5.4", variant: "medium" }
|
|
@@ -17367,7 +17471,7 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
17367
17471
|
fallbackChain: [
|
|
17368
17472
|
{
|
|
17369
17473
|
providers: ["openai", "opencode"],
|
|
17370
|
-
model: "gpt-5.
|
|
17474
|
+
model: "gpt-5.4",
|
|
17371
17475
|
variant: "medium"
|
|
17372
17476
|
},
|
|
17373
17477
|
{
|
|
@@ -17381,7 +17485,7 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
17381
17485
|
variant: "high"
|
|
17382
17486
|
}
|
|
17383
17487
|
],
|
|
17384
|
-
requiresModel: "gpt-5.
|
|
17488
|
+
requiresModel: "gpt-5.4"
|
|
17385
17489
|
},
|
|
17386
17490
|
artistry: {
|
|
17387
17491
|
fallbackChain: [
|
|
@@ -17420,7 +17524,7 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
17420
17524
|
},
|
|
17421
17525
|
{
|
|
17422
17526
|
providers: ["openai", "opencode"],
|
|
17423
|
-
model: "gpt-5.
|
|
17527
|
+
model: "gpt-5.4",
|
|
17424
17528
|
variant: "medium"
|
|
17425
17529
|
},
|
|
17426
17530
|
{
|
|
@@ -17564,27 +17668,6 @@ function buildEnvPrefix(env, shellType) {
|
|
|
17564
17668
|
return "";
|
|
17565
17669
|
}
|
|
17566
17670
|
}
|
|
17567
|
-
// src/shared/system-directive.ts
|
|
17568
|
-
var SYSTEM_DIRECTIVE_PREFIX = "[SYSTEM DIRECTIVE: OH-MY-OPENCODE";
|
|
17569
|
-
function createSystemDirective(type2) {
|
|
17570
|
-
return `${SYSTEM_DIRECTIVE_PREFIX} - ${type2}]`;
|
|
17571
|
-
}
|
|
17572
|
-
function isSystemDirective(text) {
|
|
17573
|
-
return text.trimStart().startsWith(SYSTEM_DIRECTIVE_PREFIX);
|
|
17574
|
-
}
|
|
17575
|
-
function removeSystemReminders(text) {
|
|
17576
|
-
return text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/gi, "").trim();
|
|
17577
|
-
}
|
|
17578
|
-
var SystemDirectiveTypes = {
|
|
17579
|
-
TODO_CONTINUATION: "TODO CONTINUATION",
|
|
17580
|
-
RALPH_LOOP: "RALPH LOOP",
|
|
17581
|
-
BOULDER_CONTINUATION: "BOULDER CONTINUATION",
|
|
17582
|
-
DELEGATION_REQUIRED: "DELEGATION REQUIRED",
|
|
17583
|
-
SINGLE_TASK_ONLY: "SINGLE TASK ONLY",
|
|
17584
|
-
COMPACTION_CONTEXT: "COMPACTION CONTEXT",
|
|
17585
|
-
CONTEXT_WINDOW_MONITOR: "CONTEXT WINDOW MONITOR",
|
|
17586
|
-
PLANNER_READ_ONLY: "PLANNER READ-ONLY"
|
|
17587
|
-
};
|
|
17588
17671
|
// src/shared/agent-tool-restrictions.ts
|
|
17589
17672
|
var EXPLORATION_AGENT_DENYLIST = {
|
|
17590
17673
|
write: false,
|
|
@@ -17638,27 +17721,27 @@ init_logger();
|
|
|
17638
17721
|
|
|
17639
17722
|
// src/shared/connected-providers-cache.ts
|
|
17640
17723
|
init_logger();
|
|
17641
|
-
import { existsSync as
|
|
17642
|
-
import { join as
|
|
17724
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
|
|
17725
|
+
import { join as join10 } from "path";
|
|
17643
17726
|
var CONNECTED_PROVIDERS_CACHE_FILE = "connected-providers.json";
|
|
17644
17727
|
var PROVIDER_MODELS_CACHE_FILE = "provider-models.json";
|
|
17645
17728
|
function getCacheFilePath(filename) {
|
|
17646
|
-
return
|
|
17729
|
+
return join10(getDrizzyAgentCacheDir(), filename);
|
|
17647
17730
|
}
|
|
17648
17731
|
function ensureCacheDir2() {
|
|
17649
|
-
const cacheDir =
|
|
17650
|
-
if (!
|
|
17651
|
-
|
|
17732
|
+
const cacheDir = getDrizzyAgentCacheDir();
|
|
17733
|
+
if (!existsSync9(cacheDir)) {
|
|
17734
|
+
mkdirSync3(cacheDir, { recursive: true });
|
|
17652
17735
|
}
|
|
17653
17736
|
}
|
|
17654
17737
|
function readConnectedProvidersCache() {
|
|
17655
17738
|
const cacheFile = getCacheFilePath(CONNECTED_PROVIDERS_CACHE_FILE);
|
|
17656
|
-
if (!
|
|
17739
|
+
if (!existsSync9(cacheFile)) {
|
|
17657
17740
|
log("[connected-providers-cache] Cache file not found", { cacheFile });
|
|
17658
17741
|
return null;
|
|
17659
17742
|
}
|
|
17660
17743
|
try {
|
|
17661
|
-
const content =
|
|
17744
|
+
const content = readFileSync5(cacheFile, "utf-8");
|
|
17662
17745
|
const data = JSON.parse(content);
|
|
17663
17746
|
log("[connected-providers-cache] Read cache", { count: data.connected.length, updatedAt: data.updatedAt });
|
|
17664
17747
|
return data.connected;
|
|
@@ -17669,7 +17752,7 @@ function readConnectedProvidersCache() {
|
|
|
17669
17752
|
}
|
|
17670
17753
|
function hasConnectedProvidersCache() {
|
|
17671
17754
|
const cacheFile = getCacheFilePath(CONNECTED_PROVIDERS_CACHE_FILE);
|
|
17672
|
-
return
|
|
17755
|
+
return existsSync9(cacheFile);
|
|
17673
17756
|
}
|
|
17674
17757
|
function writeConnectedProvidersCache(connected) {
|
|
17675
17758
|
ensureCacheDir2();
|
|
@@ -17679,7 +17762,7 @@ function writeConnectedProvidersCache(connected) {
|
|
|
17679
17762
|
updatedAt: new Date().toISOString()
|
|
17680
17763
|
};
|
|
17681
17764
|
try {
|
|
17682
|
-
|
|
17765
|
+
writeFileSync3(cacheFile, JSON.stringify(data, null, 2));
|
|
17683
17766
|
log("[connected-providers-cache] Cache written", { count: connected.length });
|
|
17684
17767
|
} catch (err) {
|
|
17685
17768
|
log("[connected-providers-cache] Error writing cache", { error: String(err) });
|
|
@@ -17687,12 +17770,12 @@ function writeConnectedProvidersCache(connected) {
|
|
|
17687
17770
|
}
|
|
17688
17771
|
function readProviderModelsCache() {
|
|
17689
17772
|
const cacheFile = getCacheFilePath(PROVIDER_MODELS_CACHE_FILE);
|
|
17690
|
-
if (!
|
|
17773
|
+
if (!existsSync9(cacheFile)) {
|
|
17691
17774
|
log("[connected-providers-cache] Provider-models cache file not found", { cacheFile });
|
|
17692
17775
|
return null;
|
|
17693
17776
|
}
|
|
17694
17777
|
try {
|
|
17695
|
-
const content =
|
|
17778
|
+
const content = readFileSync5(cacheFile, "utf-8");
|
|
17696
17779
|
const data = JSON.parse(content);
|
|
17697
17780
|
log("[connected-providers-cache] Read provider-models cache", {
|
|
17698
17781
|
providerCount: Object.keys(data.models).length,
|
|
@@ -17706,7 +17789,7 @@ function readProviderModelsCache() {
|
|
|
17706
17789
|
}
|
|
17707
17790
|
function hasProviderModelsCache() {
|
|
17708
17791
|
const cacheFile = getCacheFilePath(PROVIDER_MODELS_CACHE_FILE);
|
|
17709
|
-
return
|
|
17792
|
+
return existsSync9(cacheFile);
|
|
17710
17793
|
}
|
|
17711
17794
|
function writeProviderModelsCache(data) {
|
|
17712
17795
|
ensureCacheDir2();
|
|
@@ -17716,7 +17799,7 @@ function writeProviderModelsCache(data) {
|
|
|
17716
17799
|
updatedAt: new Date().toISOString()
|
|
17717
17800
|
};
|
|
17718
17801
|
try {
|
|
17719
|
-
|
|
17802
|
+
writeFileSync3(cacheFile, JSON.stringify(cacheData, null, 2));
|
|
17720
17803
|
log("[connected-providers-cache] Provider-models cache written", {
|
|
17721
17804
|
providerCount: Object.keys(data.models).length
|
|
17722
17805
|
});
|
|
@@ -17759,8 +17842,8 @@ async function updateConnectedProvidersCache(client) {
|
|
|
17759
17842
|
|
|
17760
17843
|
// src/shared/model-availability.ts
|
|
17761
17844
|
init_logger();
|
|
17762
|
-
import { existsSync as
|
|
17763
|
-
import { join as
|
|
17845
|
+
import { existsSync as existsSync10, readFileSync as readFileSync6 } from "fs";
|
|
17846
|
+
import { join as join11 } from "path";
|
|
17764
17847
|
function normalizeModelName(name) {
|
|
17765
17848
|
return name.toLowerCase().replace(/claude-(opus|sonnet|haiku)-(\d+)[.-](\d+)/g, "claude-$1-$2.$3");
|
|
17766
17849
|
}
|
|
@@ -17896,12 +17979,12 @@ async function fetchAvailableModels(client, options) {
|
|
|
17896
17979
|
}
|
|
17897
17980
|
}
|
|
17898
17981
|
log("[fetchAvailableModels] provider-models cache not found, falling back to models.json");
|
|
17899
|
-
const cacheFile =
|
|
17900
|
-
if (!
|
|
17982
|
+
const cacheFile = join11(getOpenCodeCacheDir(), "models.json");
|
|
17983
|
+
if (!existsSync10(cacheFile)) {
|
|
17901
17984
|
log("[fetchAvailableModels] models.json cache file not found, falling back to client");
|
|
17902
17985
|
} else {
|
|
17903
17986
|
try {
|
|
17904
|
-
const content =
|
|
17987
|
+
const content = readFileSync6(cacheFile, "utf-8");
|
|
17905
17988
|
const data = JSON.parse(content);
|
|
17906
17989
|
const providerIds = Object.keys(data);
|
|
17907
17990
|
log("[fetchAvailableModels] providers found in models.json", { count: providerIds.length, providers: providerIds.slice(0, 10) });
|
|
@@ -17953,8 +18036,8 @@ function isModelCacheAvailable() {
|
|
|
17953
18036
|
if (hasProviderModelsCache()) {
|
|
17954
18037
|
return true;
|
|
17955
18038
|
}
|
|
17956
|
-
const cacheFile =
|
|
17957
|
-
return
|
|
18039
|
+
const cacheFile = join11(getOpenCodeCacheDir(), "models.json");
|
|
18040
|
+
return existsSync10(cacheFile);
|
|
17958
18041
|
}
|
|
17959
18042
|
|
|
17960
18043
|
// src/shared/provider-model-id-transform.ts
|
|
@@ -18218,9 +18301,9 @@ function isAnyProviderConnected(providers, availableModels) {
|
|
|
18218
18301
|
return false;
|
|
18219
18302
|
}
|
|
18220
18303
|
// src/features/hook-message-injector/injector.ts
|
|
18221
|
-
import { existsSync as
|
|
18304
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync7, readdirSync, writeFileSync as writeFileSync4 } from "fs";
|
|
18222
18305
|
import { randomBytes } from "crypto";
|
|
18223
|
-
import { join as
|
|
18306
|
+
import { join as join12 } from "path";
|
|
18224
18307
|
init_logger();
|
|
18225
18308
|
var processPrefix = randomBytes(4).toString("hex");
|
|
18226
18309
|
function convertSDKMessageToStoredMessage(msg) {
|
|
@@ -18289,7 +18372,7 @@ function findNearestMessageWithFields(messageDir) {
|
|
|
18289
18372
|
const files = readdirSync(messageDir).filter((f) => f.endsWith(".json")).sort().reverse();
|
|
18290
18373
|
for (const file of files) {
|
|
18291
18374
|
try {
|
|
18292
|
-
const content =
|
|
18375
|
+
const content = readFileSync7(join12(messageDir, file), "utf-8");
|
|
18293
18376
|
const msg = JSON.parse(content);
|
|
18294
18377
|
if (msg.agent && msg.model?.providerID && msg.model?.modelID) {
|
|
18295
18378
|
return msg;
|
|
@@ -18300,7 +18383,7 @@ function findNearestMessageWithFields(messageDir) {
|
|
|
18300
18383
|
}
|
|
18301
18384
|
for (const file of files) {
|
|
18302
18385
|
try {
|
|
18303
|
-
const content =
|
|
18386
|
+
const content = readFileSync7(join12(messageDir, file), "utf-8");
|
|
18304
18387
|
const msg = JSON.parse(content);
|
|
18305
18388
|
if (msg.agent || msg.model?.providerID && msg.model?.modelID) {
|
|
18306
18389
|
return msg;
|
|
@@ -18322,7 +18405,7 @@ function findFirstMessageWithAgent(messageDir) {
|
|
|
18322
18405
|
const files = readdirSync(messageDir).filter((f) => f.endsWith(".json")).sort();
|
|
18323
18406
|
for (const file of files) {
|
|
18324
18407
|
try {
|
|
18325
|
-
const content =
|
|
18408
|
+
const content = readFileSync7(join12(messageDir, file), "utf-8");
|
|
18326
18409
|
const msg = JSON.parse(content);
|
|
18327
18410
|
if (msg.agent) {
|
|
18328
18411
|
return msg.agent;
|
|
@@ -18347,15 +18430,15 @@ async function resolveMessageContext(sessionID, client, messageDir) {
|
|
|
18347
18430
|
return { prevMessage, firstMessageAgent };
|
|
18348
18431
|
}
|
|
18349
18432
|
// src/shared/opencode-message-dir.ts
|
|
18350
|
-
import { existsSync as
|
|
18351
|
-
import { join as
|
|
18433
|
+
import { existsSync as existsSync12, readdirSync as readdirSync2 } from "fs";
|
|
18434
|
+
import { join as join14 } from "path";
|
|
18352
18435
|
|
|
18353
18436
|
// src/shared/opencode-storage-paths.ts
|
|
18354
|
-
import { join as
|
|
18437
|
+
import { join as join13 } from "path";
|
|
18355
18438
|
var OPENCODE_STORAGE = getOpenCodeStorageDir();
|
|
18356
|
-
var MESSAGE_STORAGE =
|
|
18357
|
-
var PART_STORAGE =
|
|
18358
|
-
var SESSION_STORAGE =
|
|
18439
|
+
var MESSAGE_STORAGE = join13(OPENCODE_STORAGE, "message");
|
|
18440
|
+
var PART_STORAGE = join13(OPENCODE_STORAGE, "part");
|
|
18441
|
+
var SESSION_STORAGE = join13(OPENCODE_STORAGE, "session");
|
|
18359
18442
|
|
|
18360
18443
|
// src/shared/opencode-message-dir.ts
|
|
18361
18444
|
init_logger();
|
|
@@ -18366,16 +18449,16 @@ function getMessageDir(sessionID) {
|
|
|
18366
18449
|
return null;
|
|
18367
18450
|
if (isSqliteBackend())
|
|
18368
18451
|
return null;
|
|
18369
|
-
if (!
|
|
18452
|
+
if (!existsSync12(MESSAGE_STORAGE))
|
|
18370
18453
|
return null;
|
|
18371
|
-
const directPath =
|
|
18372
|
-
if (
|
|
18454
|
+
const directPath = join14(MESSAGE_STORAGE, sessionID);
|
|
18455
|
+
if (existsSync12(directPath)) {
|
|
18373
18456
|
return directPath;
|
|
18374
18457
|
}
|
|
18375
18458
|
try {
|
|
18376
18459
|
for (const dir of readdirSync2(MESSAGE_STORAGE)) {
|
|
18377
|
-
const sessionPath =
|
|
18378
|
-
if (
|
|
18460
|
+
const sessionPath = join14(MESSAGE_STORAGE, dir, sessionID);
|
|
18461
|
+
if (existsSync12(sessionPath)) {
|
|
18379
18462
|
return sessionPath;
|
|
18380
18463
|
}
|
|
18381
18464
|
}
|
|
@@ -19224,8 +19307,8 @@ function parseGitDiffNumstat(output, statusMap) {
|
|
|
19224
19307
|
}
|
|
19225
19308
|
// src/shared/git-worktree/collect-git-diff-stats.ts
|
|
19226
19309
|
import { execFileSync } from "child_process";
|
|
19227
|
-
import { readFileSync as
|
|
19228
|
-
import { join as
|
|
19310
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
19311
|
+
import { join as join15 } from "path";
|
|
19229
19312
|
function collectGitDiffStats(directory) {
|
|
19230
19313
|
try {
|
|
19231
19314
|
const diffOutput = execFileSync("git", ["diff", "--numstat", "HEAD"], {
|
|
@@ -19249,7 +19332,7 @@ function collectGitDiffStats(directory) {
|
|
|
19249
19332
|
const untrackedNumstat = untrackedOutput ? untrackedOutput.split(`
|
|
19250
19333
|
`).filter(Boolean).map((filePath) => {
|
|
19251
19334
|
try {
|
|
19252
|
-
const content =
|
|
19335
|
+
const content = readFileSync8(join15(directory, filePath), "utf-8");
|
|
19253
19336
|
const lineCount = content.split(`
|
|
19254
19337
|
`).length - (content.endsWith(`
|
|
19255
19338
|
`) ? 1 : 0);
|
|
@@ -19376,25 +19459,25 @@ init_logger();
|
|
|
19376
19459
|
|
|
19377
19460
|
// src/features/claude-code-plugin-loader/discovery.ts
|
|
19378
19461
|
init_logger();
|
|
19379
|
-
import { existsSync as
|
|
19462
|
+
import { existsSync as existsSync13, readFileSync as readFileSync9 } from "fs";
|
|
19380
19463
|
import { homedir as homedir6 } from "os";
|
|
19381
|
-
import { join as
|
|
19464
|
+
import { join as join16 } from "path";
|
|
19382
19465
|
function getPluginsBaseDir() {
|
|
19383
19466
|
if (process.env.CLAUDE_PLUGINS_HOME) {
|
|
19384
19467
|
return process.env.CLAUDE_PLUGINS_HOME;
|
|
19385
19468
|
}
|
|
19386
|
-
return
|
|
19469
|
+
return join16(homedir6(), ".claude", "plugins");
|
|
19387
19470
|
}
|
|
19388
19471
|
function getInstalledPluginsPath() {
|
|
19389
|
-
return
|
|
19472
|
+
return join16(getPluginsBaseDir(), "installed_plugins.json");
|
|
19390
19473
|
}
|
|
19391
19474
|
function loadInstalledPlugins() {
|
|
19392
19475
|
const dbPath = getInstalledPluginsPath();
|
|
19393
|
-
if (!
|
|
19476
|
+
if (!existsSync13(dbPath)) {
|
|
19394
19477
|
return null;
|
|
19395
19478
|
}
|
|
19396
19479
|
try {
|
|
19397
|
-
const content =
|
|
19480
|
+
const content = readFileSync9(dbPath, "utf-8");
|
|
19398
19481
|
return JSON.parse(content);
|
|
19399
19482
|
} catch (error) {
|
|
19400
19483
|
log("Failed to load installed plugins database", error);
|
|
@@ -19405,15 +19488,15 @@ function getClaudeSettingsPath() {
|
|
|
19405
19488
|
if (process.env.CLAUDE_SETTINGS_PATH) {
|
|
19406
19489
|
return process.env.CLAUDE_SETTINGS_PATH;
|
|
19407
19490
|
}
|
|
19408
|
-
return
|
|
19491
|
+
return join16(homedir6(), ".claude", "settings.json");
|
|
19409
19492
|
}
|
|
19410
19493
|
function loadClaudeSettings() {
|
|
19411
19494
|
const settingsPath = getClaudeSettingsPath();
|
|
19412
|
-
if (!
|
|
19495
|
+
if (!existsSync13(settingsPath)) {
|
|
19413
19496
|
return null;
|
|
19414
19497
|
}
|
|
19415
19498
|
try {
|
|
19416
|
-
const content =
|
|
19499
|
+
const content = readFileSync9(settingsPath, "utf-8");
|
|
19417
19500
|
return JSON.parse(content);
|
|
19418
19501
|
} catch (error) {
|
|
19419
19502
|
log("Failed to load Claude settings", error);
|
|
@@ -19421,12 +19504,12 @@ function loadClaudeSettings() {
|
|
|
19421
19504
|
}
|
|
19422
19505
|
}
|
|
19423
19506
|
function loadPluginManifest(installPath) {
|
|
19424
|
-
const manifestPath =
|
|
19425
|
-
if (!
|
|
19507
|
+
const manifestPath = join16(installPath, ".claude-plugin", "plugin.json");
|
|
19508
|
+
if (!existsSync13(manifestPath)) {
|
|
19426
19509
|
return null;
|
|
19427
19510
|
}
|
|
19428
19511
|
try {
|
|
19429
|
-
const content =
|
|
19512
|
+
const content = readFileSync9(manifestPath, "utf-8");
|
|
19430
19513
|
return JSON.parse(content);
|
|
19431
19514
|
} catch (error) {
|
|
19432
19515
|
log(`Failed to load plugin manifest from ${manifestPath}`, error);
|
|
@@ -19470,7 +19553,7 @@ function discoverInstalledPlugins(options) {
|
|
|
19470
19553
|
continue;
|
|
19471
19554
|
}
|
|
19472
19555
|
const { installPath, scope, version } = installation;
|
|
19473
|
-
if (!
|
|
19556
|
+
if (!existsSync13(installPath)) {
|
|
19474
19557
|
errors.push({
|
|
19475
19558
|
pluginKey,
|
|
19476
19559
|
installPath,
|
|
@@ -19488,21 +19571,21 @@ function discoverInstalledPlugins(options) {
|
|
|
19488
19571
|
pluginKey,
|
|
19489
19572
|
manifest: manifest ?? undefined
|
|
19490
19573
|
};
|
|
19491
|
-
if (
|
|
19492
|
-
loadedPlugin.commandsDir =
|
|
19574
|
+
if (existsSync13(join16(installPath, "commands"))) {
|
|
19575
|
+
loadedPlugin.commandsDir = join16(installPath, "commands");
|
|
19493
19576
|
}
|
|
19494
|
-
if (
|
|
19495
|
-
loadedPlugin.agentsDir =
|
|
19577
|
+
if (existsSync13(join16(installPath, "agents"))) {
|
|
19578
|
+
loadedPlugin.agentsDir = join16(installPath, "agents");
|
|
19496
19579
|
}
|
|
19497
|
-
if (
|
|
19498
|
-
loadedPlugin.skillsDir =
|
|
19580
|
+
if (existsSync13(join16(installPath, "skills"))) {
|
|
19581
|
+
loadedPlugin.skillsDir = join16(installPath, "skills");
|
|
19499
19582
|
}
|
|
19500
|
-
const hooksPath =
|
|
19501
|
-
if (
|
|
19583
|
+
const hooksPath = join16(installPath, "hooks", "hooks.json");
|
|
19584
|
+
if (existsSync13(hooksPath)) {
|
|
19502
19585
|
loadedPlugin.hooksPath = hooksPath;
|
|
19503
19586
|
}
|
|
19504
|
-
const mcpPath =
|
|
19505
|
-
if (
|
|
19587
|
+
const mcpPath = join16(installPath, ".mcp.json");
|
|
19588
|
+
if (existsSync13(mcpPath)) {
|
|
19506
19589
|
loadedPlugin.mcpPath = mcpPath;
|
|
19507
19590
|
}
|
|
19508
19591
|
plugins.push(loadedPlugin);
|
|
@@ -19515,23 +19598,23 @@ function discoverInstalledPlugins(options) {
|
|
|
19515
19598
|
}
|
|
19516
19599
|
|
|
19517
19600
|
// src/features/claude-code-plugin-loader/command-loader.ts
|
|
19518
|
-
import { existsSync as
|
|
19519
|
-
import { basename, join as
|
|
19601
|
+
import { existsSync as existsSync14, readdirSync as readdirSync3, readFileSync as readFileSync10 } from "fs";
|
|
19602
|
+
import { basename, join as join17 } from "path";
|
|
19520
19603
|
init_logger();
|
|
19521
19604
|
function loadPluginCommands(plugins) {
|
|
19522
19605
|
const commands = {};
|
|
19523
19606
|
for (const plugin of plugins) {
|
|
19524
|
-
if (!plugin.commandsDir || !
|
|
19607
|
+
if (!plugin.commandsDir || !existsSync14(plugin.commandsDir))
|
|
19525
19608
|
continue;
|
|
19526
19609
|
const entries = readdirSync3(plugin.commandsDir, { withFileTypes: true });
|
|
19527
19610
|
for (const entry of entries) {
|
|
19528
19611
|
if (!isMarkdownFile(entry))
|
|
19529
19612
|
continue;
|
|
19530
|
-
const commandPath =
|
|
19613
|
+
const commandPath = join17(plugin.commandsDir, entry.name);
|
|
19531
19614
|
const commandName = basename(entry.name, ".md");
|
|
19532
19615
|
const namespacedName = `${plugin.name}:${commandName}`;
|
|
19533
19616
|
try {
|
|
19534
|
-
const content =
|
|
19617
|
+
const content = readFileSync10(commandPath, "utf-8");
|
|
19535
19618
|
const { data, body } = parseFrontmatter(content);
|
|
19536
19619
|
const wrappedTemplate = `<command-instruction>
|
|
19537
19620
|
${body.trim()}
|
|
@@ -19562,14 +19645,14 @@ $ARGUMENTS
|
|
|
19562
19645
|
}
|
|
19563
19646
|
|
|
19564
19647
|
// src/features/claude-code-plugin-loader/skill-loader.ts
|
|
19565
|
-
import { existsSync as
|
|
19566
|
-
import { join as
|
|
19648
|
+
import { existsSync as existsSync15, readdirSync as readdirSync4, readFileSync as readFileSync11 } from "fs";
|
|
19649
|
+
import { join as join19 } from "path";
|
|
19567
19650
|
|
|
19568
19651
|
// src/shared/skill-path-resolver.ts
|
|
19569
|
-
import { join as
|
|
19652
|
+
import { join as join18 } from "path";
|
|
19570
19653
|
function resolveSkillPathReferences(content, basePath) {
|
|
19571
19654
|
const normalizedBase = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
|
|
19572
|
-
return content.replace(/(?<![a-zA-Z0-9])@([a-zA-Z0-9_-]+\/[a-zA-Z0-9_.\-\/]*)/g, (_, relativePath) =>
|
|
19655
|
+
return content.replace(/(?<![a-zA-Z0-9])@([a-zA-Z0-9_-]+\/[a-zA-Z0-9_.\-\/]*)/g, (_, relativePath) => join18(normalizedBase, relativePath));
|
|
19573
19656
|
}
|
|
19574
19657
|
|
|
19575
19658
|
// src/features/claude-code-plugin-loader/skill-loader.ts
|
|
@@ -19577,21 +19660,21 @@ init_logger();
|
|
|
19577
19660
|
function loadPluginSkillsAsCommands(plugins) {
|
|
19578
19661
|
const skills = {};
|
|
19579
19662
|
for (const plugin of plugins) {
|
|
19580
|
-
if (!plugin.skillsDir || !
|
|
19663
|
+
if (!plugin.skillsDir || !existsSync15(plugin.skillsDir))
|
|
19581
19664
|
continue;
|
|
19582
19665
|
const entries = readdirSync4(plugin.skillsDir, { withFileTypes: true });
|
|
19583
19666
|
for (const entry of entries) {
|
|
19584
19667
|
if (entry.name.startsWith("."))
|
|
19585
19668
|
continue;
|
|
19586
|
-
const skillPath =
|
|
19669
|
+
const skillPath = join19(plugin.skillsDir, entry.name);
|
|
19587
19670
|
if (!entry.isDirectory() && !entry.isSymbolicLink())
|
|
19588
19671
|
continue;
|
|
19589
19672
|
const resolvedPath = resolveSymlink(skillPath);
|
|
19590
|
-
const skillMdPath =
|
|
19591
|
-
if (!
|
|
19673
|
+
const skillMdPath = join19(resolvedPath, "SKILL.md");
|
|
19674
|
+
if (!existsSync15(skillMdPath))
|
|
19592
19675
|
continue;
|
|
19593
19676
|
try {
|
|
19594
|
-
const content =
|
|
19677
|
+
const content = readFileSync11(skillMdPath, "utf-8");
|
|
19595
19678
|
const { data, body } = parseFrontmatter(content);
|
|
19596
19679
|
const skillName = data.name || entry.name;
|
|
19597
19680
|
const namespacedName = `${plugin.name}:${skillName}`;
|
|
@@ -19626,8 +19709,8 @@ $ARGUMENTS
|
|
|
19626
19709
|
}
|
|
19627
19710
|
|
|
19628
19711
|
// src/features/claude-code-plugin-loader/agent-loader.ts
|
|
19629
|
-
import { existsSync as
|
|
19630
|
-
import { basename as basename2, join as
|
|
19712
|
+
import { existsSync as existsSync16, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "fs";
|
|
19713
|
+
import { basename as basename2, join as join20 } from "path";
|
|
19631
19714
|
init_logger();
|
|
19632
19715
|
|
|
19633
19716
|
// src/shared/model-format-normalizer.ts
|
|
@@ -19694,17 +19777,17 @@ function parseToolsConfig(toolsStr) {
|
|
|
19694
19777
|
function loadPluginAgents(plugins) {
|
|
19695
19778
|
const agents = {};
|
|
19696
19779
|
for (const plugin of plugins) {
|
|
19697
|
-
if (!plugin.agentsDir || !
|
|
19780
|
+
if (!plugin.agentsDir || !existsSync16(plugin.agentsDir))
|
|
19698
19781
|
continue;
|
|
19699
19782
|
const entries = readdirSync5(plugin.agentsDir, { withFileTypes: true });
|
|
19700
19783
|
for (const entry of entries) {
|
|
19701
19784
|
if (!isMarkdownFile(entry))
|
|
19702
19785
|
continue;
|
|
19703
|
-
const agentPath =
|
|
19786
|
+
const agentPath = join20(plugin.agentsDir, entry.name);
|
|
19704
19787
|
const agentName = basename2(entry.name, ".md");
|
|
19705
19788
|
const namespacedName = `${plugin.name}:${agentName}`;
|
|
19706
19789
|
try {
|
|
19707
|
-
const content =
|
|
19790
|
+
const content = readFileSync12(agentPath, "utf-8");
|
|
19708
19791
|
const { data, body } = parseFrontmatter(content);
|
|
19709
19792
|
const originalDescription = data.description || "";
|
|
19710
19793
|
const formattedDescription = `(plugin: ${plugin.name}) ${originalDescription}`;
|
|
@@ -19730,7 +19813,7 @@ function loadPluginAgents(plugins) {
|
|
|
19730
19813
|
}
|
|
19731
19814
|
|
|
19732
19815
|
// src/features/claude-code-plugin-loader/mcp-server-loader.ts
|
|
19733
|
-
import { existsSync as
|
|
19816
|
+
import { existsSync as existsSync17 } from "fs";
|
|
19734
19817
|
|
|
19735
19818
|
// src/features/claude-code-mcp-loader/env-expander.ts
|
|
19736
19819
|
function expandEnvVars(value) {
|
|
@@ -19825,7 +19908,7 @@ function resolvePluginPaths(obj, pluginRoot) {
|
|
|
19825
19908
|
async function loadPluginMcpServers(plugins) {
|
|
19826
19909
|
const servers = {};
|
|
19827
19910
|
for (const plugin of plugins) {
|
|
19828
|
-
if (!plugin.mcpPath || !
|
|
19911
|
+
if (!plugin.mcpPath || !existsSync17(plugin.mcpPath))
|
|
19829
19912
|
continue;
|
|
19830
19913
|
try {
|
|
19831
19914
|
const content = await Bun.file(plugin.mcpPath).text();
|
|
@@ -19857,14 +19940,14 @@ async function loadPluginMcpServers(plugins) {
|
|
|
19857
19940
|
|
|
19858
19941
|
// src/features/claude-code-plugin-loader/hook-loader.ts
|
|
19859
19942
|
init_logger();
|
|
19860
|
-
import { existsSync as
|
|
19943
|
+
import { existsSync as existsSync18, readFileSync as readFileSync13 } from "fs";
|
|
19861
19944
|
function loadPluginHooksConfigs(plugins) {
|
|
19862
19945
|
const configs = [];
|
|
19863
19946
|
for (const plugin of plugins) {
|
|
19864
|
-
if (!plugin.hooksPath || !
|
|
19947
|
+
if (!plugin.hooksPath || !existsSync18(plugin.hooksPath))
|
|
19865
19948
|
continue;
|
|
19866
19949
|
try {
|
|
19867
|
-
const content =
|
|
19950
|
+
const content = readFileSync13(plugin.hooksPath, "utf-8");
|
|
19868
19951
|
let config = JSON.parse(content);
|
|
19869
19952
|
config = resolvePluginPaths(config, plugin.installPath);
|
|
19870
19953
|
configs.push(config);
|
|
@@ -19932,87 +20015,6 @@ var SessionCategoryRegistry = {
|
|
|
19932
20015
|
sessionCategoryMap.clear();
|
|
19933
20016
|
}
|
|
19934
20017
|
};
|
|
19935
|
-
// src/cli/config-manager/config-context.ts
|
|
19936
|
-
var configContext = null;
|
|
19937
|
-
function initConfigContext(binary2, version) {
|
|
19938
|
-
const paths = getOpenCodeConfigPaths({ binary: binary2, version });
|
|
19939
|
-
configContext = { binary: binary2, version, paths };
|
|
19940
|
-
}
|
|
19941
|
-
|
|
19942
|
-
// src/hooks/todo-continuation-enforcer/index.ts
|
|
19943
|
-
init_logger();
|
|
19944
|
-
|
|
19945
|
-
// src/hooks/todo-continuation-enforcer/constants.ts
|
|
19946
|
-
var HOOK_NAME = "todo-continuation-enforcer";
|
|
19947
|
-
var DEFAULT_SKIP_AGENTS = ["planner", "compaction"];
|
|
19948
|
-
var CONTINUATION_PROMPT = `${createSystemDirective(SystemDirectiveTypes.TODO_CONTINUATION)}
|
|
19949
|
-
|
|
19950
|
-
Incomplete tasks remain in your todo list. Continue working on the next pending task.
|
|
19951
|
-
|
|
19952
|
-
- Proceed without asking for permission
|
|
19953
|
-
- Mark each task complete when finished
|
|
19954
|
-
- Do not stop until all tasks are done`;
|
|
19955
|
-
var COUNTDOWN_SECONDS = 2;
|
|
19956
|
-
var TOAST_DURATION_MS = 900;
|
|
19957
|
-
var COUNTDOWN_GRACE_PERIOD_MS = 500;
|
|
19958
|
-
var ABORT_WINDOW_MS = 3000;
|
|
19959
|
-
var CONTINUATION_COOLDOWN_MS = 5000;
|
|
19960
|
-
var MAX_STAGNATION_COUNT = 3;
|
|
19961
|
-
var MAX_CONSECUTIVE_FAILURES = 5;
|
|
19962
|
-
var FAILURE_RESET_WINDOW_MS = 5 * 60 * 1000;
|
|
19963
|
-
// src/features/run-continuation-state/constants.ts
|
|
19964
|
-
var CONTINUATION_MARKER_DIR = ".drizzy/run-continuation";
|
|
19965
|
-
// src/features/run-continuation-state/storage.ts
|
|
19966
|
-
import { existsSync as existsSync18, mkdirSync as mkdirSync4, readFileSync as readFileSync13, rmSync, writeFileSync as writeFileSync4 } from "fs";
|
|
19967
|
-
import { join as join20 } from "path";
|
|
19968
|
-
function getMarkerPath(directory, sessionID) {
|
|
19969
|
-
return join20(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
19970
|
-
}
|
|
19971
|
-
function readContinuationMarker(directory, sessionID) {
|
|
19972
|
-
const markerPath = getMarkerPath(directory, sessionID);
|
|
19973
|
-
if (!existsSync18(markerPath))
|
|
19974
|
-
return null;
|
|
19975
|
-
try {
|
|
19976
|
-
const raw = readFileSync13(markerPath, "utf-8");
|
|
19977
|
-
const parsed = JSON.parse(raw);
|
|
19978
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
19979
|
-
return null;
|
|
19980
|
-
return parsed;
|
|
19981
|
-
} catch {
|
|
19982
|
-
return null;
|
|
19983
|
-
}
|
|
19984
|
-
}
|
|
19985
|
-
function setContinuationMarkerSource(directory, sessionID, source, state, reason) {
|
|
19986
|
-
const now = new Date().toISOString();
|
|
19987
|
-
const existing = readContinuationMarker(directory, sessionID);
|
|
19988
|
-
const next = {
|
|
19989
|
-
sessionID,
|
|
19990
|
-
updatedAt: now,
|
|
19991
|
-
sources: {
|
|
19992
|
-
...existing?.sources ?? {},
|
|
19993
|
-
[source]: {
|
|
19994
|
-
state,
|
|
19995
|
-
...reason ? { reason } : {},
|
|
19996
|
-
updatedAt: now
|
|
19997
|
-
}
|
|
19998
|
-
}
|
|
19999
|
-
};
|
|
20000
|
-
const markerPath = getMarkerPath(directory, sessionID);
|
|
20001
|
-
mkdirSync4(join20(directory, CONTINUATION_MARKER_DIR), { recursive: true });
|
|
20002
|
-
writeFileSync4(markerPath, JSON.stringify(next, null, 2), "utf-8");
|
|
20003
|
-
return next;
|
|
20004
|
-
}
|
|
20005
|
-
function clearContinuationMarker(directory, sessionID) {
|
|
20006
|
-
const markerPath = getMarkerPath(directory, sessionID);
|
|
20007
|
-
if (!existsSync18(markerPath))
|
|
20008
|
-
return;
|
|
20009
|
-
try {
|
|
20010
|
-
rmSync(markerPath);
|
|
20011
|
-
} catch {}
|
|
20012
|
-
}
|
|
20013
|
-
// src/hooks/todo-continuation-enforcer/handler.ts
|
|
20014
|
-
init_logger();
|
|
20015
|
-
|
|
20016
20018
|
// src/hooks/todo-continuation-enforcer/idle-event.ts
|
|
20017
20019
|
init_logger();
|
|
20018
20020
|
|
|
@@ -35786,11 +35788,11 @@ function getCacheDir2() {
|
|
|
35786
35788
|
if (process.platform === "win32") {
|
|
35787
35789
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
35788
35790
|
const base2 = localAppData || join27(homedir7(), "AppData", "Local");
|
|
35789
|
-
return join27(base2, "
|
|
35791
|
+
return join27(base2, "drizzy-agent", "bin");
|
|
35790
35792
|
}
|
|
35791
35793
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
35792
35794
|
const base = xdgCache || join27(homedir7(), ".cache");
|
|
35793
|
-
return join27(base, "
|
|
35795
|
+
return join27(base, "drizzy-agent", "bin");
|
|
35794
35796
|
}
|
|
35795
35797
|
function getBinaryName() {
|
|
35796
35798
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -35826,7 +35828,7 @@ async function downloadCommentChecker() {
|
|
|
35826
35828
|
const assetName = `comment-checker_v${version2}_${os4}_${arch}.${ext}`;
|
|
35827
35829
|
const downloadUrl = `https://github.com/${REPO}/releases/download/v${version2}/${assetName}`;
|
|
35828
35830
|
debugLog(`Downloading from: ${downloadUrl}`);
|
|
35829
|
-
log(`[
|
|
35831
|
+
log(`[drizzy-agent] Downloading comment-checker binary...`);
|
|
35830
35832
|
try {
|
|
35831
35833
|
ensureCacheDir(cacheDir);
|
|
35832
35834
|
const archivePath = join27(cacheDir, assetName);
|
|
@@ -35841,12 +35843,12 @@ async function downloadCommentChecker() {
|
|
|
35841
35843
|
cleanupArchive(archivePath);
|
|
35842
35844
|
ensureExecutable(binaryPath);
|
|
35843
35845
|
debugLog(`Successfully downloaded binary to: ${binaryPath}`);
|
|
35844
|
-
log(`[
|
|
35846
|
+
log(`[drizzy-agent] comment-checker binary ready.`);
|
|
35845
35847
|
return binaryPath;
|
|
35846
35848
|
} catch (err) {
|
|
35847
35849
|
debugLog(`Failed to download: ${err}`);
|
|
35848
|
-
log(`[
|
|
35849
|
-
log(`[
|
|
35850
|
+
log(`[drizzy-agent] Failed to download comment-checker: ${err instanceof Error ? err.message : err}`);
|
|
35851
|
+
log(`[drizzy-agent] Comment checking disabled.`);
|
|
35850
35852
|
return null;
|
|
35851
35853
|
}
|
|
35852
35854
|
}
|
|
@@ -40529,7 +40531,7 @@ import { fileURLToPath } from "url";
|
|
|
40529
40531
|
// src/hooks/auto-update-checker/constants.ts
|
|
40530
40532
|
import * as path5 from "path";
|
|
40531
40533
|
import * as os4 from "os";
|
|
40532
|
-
var PACKAGE_NAME = "
|
|
40534
|
+
var PACKAGE_NAME = "drizzy-agent";
|
|
40533
40535
|
var NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME}/dist-tags`;
|
|
40534
40536
|
var NPM_FETCH_TIMEOUT = 5000;
|
|
40535
40537
|
var CACHE_DIR = getOpenCodeCacheDir();
|
|
@@ -41052,7 +41054,7 @@ init_logger();
|
|
|
41052
41054
|
async function showUpdateAvailableToast(ctx, latestVersion, getToastMessage) {
|
|
41053
41055
|
await ctx.client.tui.showToast({
|
|
41054
41056
|
body: {
|
|
41055
|
-
title: `
|
|
41057
|
+
title: `DrizzyAgent ${latestVersion}`,
|
|
41056
41058
|
message: getToastMessage(true, latestVersion),
|
|
41057
41059
|
variant: "info",
|
|
41058
41060
|
duration: 8000
|
|
@@ -41063,7 +41065,7 @@ async function showUpdateAvailableToast(ctx, latestVersion, getToastMessage) {
|
|
|
41063
41065
|
async function showAutoUpdatedToast(ctx, oldVersion, newVersion) {
|
|
41064
41066
|
await ctx.client.tui.showToast({
|
|
41065
41067
|
body: {
|
|
41066
|
-
title: "
|
|
41068
|
+
title: "DrizzyAgent Updated!",
|
|
41067
41069
|
message: `v${oldVersion} \u2192 v${newVersion}
|
|
41068
41070
|
Restart OpenCode to apply.`,
|
|
41069
41071
|
variant: "success",
|
|
@@ -41231,7 +41233,7 @@ async function showSpinnerToast(ctx, version2, message) {
|
|
|
41231
41233
|
const spinner = CODER_SPINNER[i2 % CODER_SPINNER.length];
|
|
41232
41234
|
await ctx.client.tui.showToast({
|
|
41233
41235
|
body: {
|
|
41234
|
-
title: `${spinner}
|
|
41236
|
+
title: `${spinner} DrizzyAgent ${version2}`,
|
|
41235
41237
|
message,
|
|
41236
41238
|
variant: "info",
|
|
41237
41239
|
duration: frameInterval + 50
|
|
@@ -42424,6 +42426,14 @@ IF COMPLEX - DO NOT STRUGGLE ALONE. Consult specialists:
|
|
|
42424
42426
|
- **Artistry**: Non-conventional problems (different approach needed)
|
|
42425
42427
|
|
|
42426
42428
|
SYNTHESIZE findings before proceeding.`;
|
|
42429
|
+
// src/hooks/keyword-detector/git/default.ts
|
|
42430
|
+
var GIT_PATTERN = /\b(commit|commits|rebase|squash|cherry[\s-]?pick|revert|blame|bisect|stash|amend)\b|\uCEE4\uBC0B|\uB9AC\uBCA0\uC774\uC2A4|\uC2A4\uCFFC\uC2DC|\uCCB4\uB9AC\uD53D|\uB9AC\uBC84\uD2B8|\uBE14\uB808\uC784|\uBE44\uC139\uD2B8|\uC2A4\uD0DC\uC2DC|\uC218\uC815\s*\uCEE4\uBC0B|\u30B3\u30DF\u30C3\u30C8|\u30EA\u30D9\u30FC\u30B9|\u30B9\u30AB\u30C3\u30B7\u30E5|\u30C1\u30A7\u30EA\u30FC\u30D4\u30C3\u30AF|\u30EA\u30D0\u30FC\u30C8|\u63D0\u4EA4|\u53D8\u57FA|\u538B\u7F29\u63D0\u4EA4|\u6311\u62E3|\u56DE\u9000|\u8FFD\u6EAF|\u4E8C\u5206\u67E5\u627E|\u6682\u5B58/i;
|
|
42431
|
+
var GIT_MESSAGE = `[git-mode]
|
|
42432
|
+
Git intent detected. Treat git work as specialized work:
|
|
42433
|
+
- Load the \`git-master\` skill before acting on git requests
|
|
42434
|
+
- For commit requests, inspect status, diff, and recent commit style first
|
|
42435
|
+
- Prefer atomic commits and follow existing repository commit conventions
|
|
42436
|
+
- Avoid destructive git commands unless the user explicitly asks for them`;
|
|
42427
42437
|
// src/hooks/keyword-detector/constants.ts
|
|
42428
42438
|
var CODE_BLOCK_PATTERN2 = /```[\s\S]*?```/g;
|
|
42429
42439
|
var INLINE_CODE_PATTERN2 = /`[^`]+`/g;
|
|
@@ -42439,6 +42449,10 @@ var KEYWORD_DETECTORS = [
|
|
|
42439
42449
|
{
|
|
42440
42450
|
pattern: ANALYZE_PATTERN,
|
|
42441
42451
|
message: ANALYZE_MESSAGE
|
|
42452
|
+
},
|
|
42453
|
+
{
|
|
42454
|
+
pattern: GIT_PATTERN,
|
|
42455
|
+
message: GIT_MESSAGE
|
|
42442
42456
|
}
|
|
42443
42457
|
];
|
|
42444
42458
|
|
|
@@ -42451,7 +42465,7 @@ function resolveMessage(message, agentName, modelID) {
|
|
|
42451
42465
|
}
|
|
42452
42466
|
function detectKeywordsWithType(text, agentName, modelID) {
|
|
42453
42467
|
const textWithoutCode = removeCodeBlocks2(text);
|
|
42454
|
-
const types6 = ["ultrawork", "search", "analyze"];
|
|
42468
|
+
const types6 = ["ultrawork", "search", "analyze", "git"];
|
|
42455
42469
|
return KEYWORD_DETECTORS.map(({ pattern, message }, index) => ({
|
|
42456
42470
|
matches: pattern.test(textWithoutCode),
|
|
42457
42471
|
type: types6[index],
|
|
@@ -48843,8 +48857,8 @@ var WebsearchConfigSchema = exports_external.object({
|
|
|
48843
48857
|
provider: WebsearchProviderSchema.optional()
|
|
48844
48858
|
});
|
|
48845
48859
|
|
|
48846
|
-
// src/config/schema/
|
|
48847
|
-
var
|
|
48860
|
+
// src/config/schema/drizzy-agent-config.ts
|
|
48861
|
+
var DrizzyAgentConfigSchema = exports_external.object({
|
|
48848
48862
|
$schema: exports_external.string().optional(),
|
|
48849
48863
|
new_task_system_enabled: exports_external.boolean().optional(),
|
|
48850
48864
|
default_run_agent: exports_external.string().optional(),
|
|
@@ -52166,7 +52180,7 @@ var PARTIAL_STRING_ARRAY_KEYS = new Set([
|
|
|
52166
52180
|
"disabled_tools"
|
|
52167
52181
|
]);
|
|
52168
52182
|
function parseConfigPartially(rawConfig) {
|
|
52169
|
-
const fullResult =
|
|
52183
|
+
const fullResult = DrizzyAgentConfigSchema.safeParse(rawConfig);
|
|
52170
52184
|
if (fullResult.success) {
|
|
52171
52185
|
return fullResult.data;
|
|
52172
52186
|
}
|
|
@@ -52180,7 +52194,7 @@ function parseConfigPartially(rawConfig) {
|
|
|
52180
52194
|
}
|
|
52181
52195
|
continue;
|
|
52182
52196
|
}
|
|
52183
|
-
const sectionResult =
|
|
52197
|
+
const sectionResult = DrizzyAgentConfigSchema.safeParse({ [key]: rawConfig[key] });
|
|
52184
52198
|
if (sectionResult.success) {
|
|
52185
52199
|
const parsed = sectionResult.data;
|
|
52186
52200
|
if (parsed[key] !== undefined) {
|
|
@@ -52204,7 +52218,7 @@ function loadConfigFromPath2(configPath, _ctx) {
|
|
|
52204
52218
|
const content = fs18.readFileSync(configPath, "utf-8");
|
|
52205
52219
|
const rawConfig = parseJsonc(content);
|
|
52206
52220
|
migrateConfigFile(configPath, rawConfig);
|
|
52207
|
-
const result =
|
|
52221
|
+
const result = DrizzyAgentConfigSchema.safeParse(rawConfig);
|
|
52208
52222
|
if (result.success) {
|
|
52209
52223
|
log(`Config loaded from ${configPath}`, { agents: result.data.agents });
|
|
52210
52224
|
return result.data;
|
|
@@ -52271,15 +52285,11 @@ function mergeConfigs(base, override) {
|
|
|
52271
52285
|
function loadPluginConfig(directory, ctx) {
|
|
52272
52286
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
52273
52287
|
const userBasePath = path11.join(configDir, "drizzy-agent");
|
|
52274
|
-
const legacyUserBasePath = path11.join(configDir, "oh-my-opencode");
|
|
52275
52288
|
const userDetected = detectConfigFile(userBasePath);
|
|
52276
|
-
const
|
|
52277
|
-
const userConfigPath = userDetected.format !== "none" ? userDetected.path : legacyUserDetected.format !== "none" ? legacyUserDetected.path : userBasePath + ".json";
|
|
52289
|
+
const userConfigPath = userDetected.format !== "none" ? userDetected.path : userBasePath + ".json";
|
|
52278
52290
|
const projectBasePath = path11.join(directory, ".opencode", "drizzy-agent");
|
|
52279
|
-
const legacyProjectBasePath = path11.join(directory, ".opencode", "oh-my-opencode");
|
|
52280
52291
|
const projectDetected = detectConfigFile(projectBasePath);
|
|
52281
|
-
const
|
|
52282
|
-
const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : legacyProjectDetected.format !== "none" ? legacyProjectDetected.path : projectBasePath + ".json";
|
|
52292
|
+
const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : projectBasePath + ".json";
|
|
52283
52293
|
let config2 = loadConfigFromPath2(userConfigPath, ctx) ?? {};
|
|
52284
52294
|
const projectConfig = loadConfigFromPath2(projectConfigPath, ctx);
|
|
52285
52295
|
if (projectConfig) {
|
|
@@ -54538,8 +54548,8 @@ function getConfigPaths3() {
|
|
|
54538
54548
|
const cwd = process.cwd();
|
|
54539
54549
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
54540
54550
|
return {
|
|
54541
|
-
project: detectConfigFile(join65(cwd, ".opencode", "
|
|
54542
|
-
user: detectConfigFile(join65(configDir, "
|
|
54551
|
+
project: detectConfigFile(join65(cwd, ".opencode", "drizzy-agent")).path,
|
|
54552
|
+
user: detectConfigFile(join65(configDir, "drizzy-agent")).path,
|
|
54543
54553
|
opencode: detectConfigFile(join65(configDir, "opencode")).path
|
|
54544
54554
|
};
|
|
54545
54555
|
}
|
|
@@ -55520,7 +55530,7 @@ function formatServerLookupError(result) {
|
|
|
55520
55530
|
``,
|
|
55521
55531
|
`Available servers: ${result.availableServers.slice(0, 10).join(", ")}${result.availableServers.length > 10 ? "..." : ""}`,
|
|
55522
55532
|
``,
|
|
55523
|
-
`To add a custom server, configure 'lsp' in
|
|
55533
|
+
`To add a custom server, configure 'lsp' in drizzy-agent.json:`,
|
|
55524
55534
|
` {`,
|
|
55525
55535
|
` "lsp": {`,
|
|
55526
55536
|
` "my-server": {`,
|
|
@@ -68496,11 +68506,11 @@ function getCacheDir3() {
|
|
|
68496
68506
|
if (process.platform === "win32") {
|
|
68497
68507
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
68498
68508
|
const base2 = localAppData || join69(homedir13(), "AppData", "Local");
|
|
68499
|
-
return join69(base2, "
|
|
68509
|
+
return join69(base2, "drizzy-agent", "bin");
|
|
68500
68510
|
}
|
|
68501
68511
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
68502
68512
|
const base = xdgCache || join69(homedir13(), ".cache");
|
|
68503
|
-
return join69(base, "
|
|
68513
|
+
return join69(base, "drizzy-agent", "bin");
|
|
68504
68514
|
}
|
|
68505
68515
|
function getBinaryName3() {
|
|
68506
68516
|
return process.platform === "win32" ? "sg.exe" : "sg";
|
|
@@ -68512,7 +68522,7 @@ async function downloadAstGrep(version3 = DEFAULT_VERSION) {
|
|
|
68512
68522
|
const platformKey = `${process.platform}-${process.arch}`;
|
|
68513
68523
|
const platformInfo = PLATFORM_MAP2[platformKey];
|
|
68514
68524
|
if (!platformInfo) {
|
|
68515
|
-
log(`[
|
|
68525
|
+
log(`[drizzy-agent] Unsupported platform for ast-grep: ${platformKey}`);
|
|
68516
68526
|
return null;
|
|
68517
68527
|
}
|
|
68518
68528
|
const cacheDir = getCacheDir3();
|
|
@@ -68524,7 +68534,7 @@ async function downloadAstGrep(version3 = DEFAULT_VERSION) {
|
|
|
68524
68534
|
const { arch, os: os6 } = platformInfo;
|
|
68525
68535
|
const assetName = `app-${arch}-${os6}.zip`;
|
|
68526
68536
|
const downloadUrl = `https://github.com/${REPO2}/releases/download/${version3}/${assetName}`;
|
|
68527
|
-
log(`[
|
|
68537
|
+
log(`[drizzy-agent] Downloading ast-grep binary...`);
|
|
68528
68538
|
try {
|
|
68529
68539
|
const archivePath = join69(cacheDir, assetName);
|
|
68530
68540
|
ensureCacheDir(cacheDir);
|
|
@@ -68532,10 +68542,10 @@ async function downloadAstGrep(version3 = DEFAULT_VERSION) {
|
|
|
68532
68542
|
await extractZipArchive(archivePath, cacheDir);
|
|
68533
68543
|
cleanupArchive(archivePath);
|
|
68534
68544
|
ensureExecutable(binaryPath);
|
|
68535
|
-
log(`[
|
|
68545
|
+
log(`[drizzy-agent] ast-grep binary ready.`);
|
|
68536
68546
|
return binaryPath;
|
|
68537
68547
|
} catch (err) {
|
|
68538
|
-
log(`[
|
|
68548
|
+
log(`[drizzy-agent] Failed to download ast-grep: ${err instanceof Error ? err.message : err}`);
|
|
68539
68549
|
return null;
|
|
68540
68550
|
}
|
|
68541
68551
|
}
|
|
@@ -69026,7 +69036,7 @@ function getPlatformKey() {
|
|
|
69026
69036
|
}
|
|
69027
69037
|
function getInstallDir() {
|
|
69028
69038
|
const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
|
|
69029
|
-
return join71(homeDir, ".cache", "
|
|
69039
|
+
return join71(homeDir, ".cache", "drizzy-agent", "bin");
|
|
69030
69040
|
}
|
|
69031
69041
|
function getRgPath() {
|
|
69032
69042
|
const isWindows2 = process.platform === "win32";
|
|
@@ -74009,7 +74019,7 @@ async function resolveCategoryExecution(args, executorCtx, inheritedModel, syste
|
|
|
74009
74019
|
|
|
74010
74020
|
To use this category:
|
|
74011
74021
|
1. Connect a provider with this model: ${requirement2.requiresModel}
|
|
74012
|
-
2. Or configure an alternative model in your
|
|
74022
|
+
2. Or configure an alternative model in your drizzy-agent.json for this category
|
|
74013
74023
|
|
|
74014
74024
|
Available categories: ${allCategoryNames}`
|
|
74015
74025
|
};
|
|
@@ -74088,7 +74098,7 @@ Available categories: ${allCategoryNames}`
|
|
|
74088
74098
|
|
|
74089
74099
|
Configure in one of:
|
|
74090
74100
|
1. OpenCode: Set "model" in opencode.json
|
|
74091
|
-
2. Oh-My-OpenCode: Set category model in
|
|
74101
|
+
2. Oh-My-OpenCode: Set category model in drizzy-agent.json
|
|
74092
74102
|
3. Provider: Connect a provider with available models
|
|
74093
74103
|
|
|
74094
74104
|
Current category: ${args.category}
|
|
@@ -83313,7 +83323,7 @@ class McpOAuthProvider {
|
|
|
83313
83323
|
const clientInfo = await getOrRegisterClient({
|
|
83314
83324
|
registrationEndpoint: metadata.registrationEndpoint,
|
|
83315
83325
|
serverIdentifier: this.serverUrl,
|
|
83316
|
-
clientName: "
|
|
83326
|
+
clientName: "drizzy-agent",
|
|
83317
83327
|
redirectUris: [this.redirectUrl()],
|
|
83318
83328
|
tokenEndpointAuthMethod: "none",
|
|
83319
83329
|
clientId: this.configClientId,
|
|
@@ -87572,7 +87582,7 @@ var MULTIMODAL_LOOKER_PROMPT_METADATA = {
|
|
|
87572
87582
|
function createMultimodalLookerAgent(model) {
|
|
87573
87583
|
const restrictions = createAgentToolAllowlist(["read"]);
|
|
87574
87584
|
return {
|
|
87575
|
-
description: "Analyze media files (PDFs, images, diagrams) that require interpretation beyond raw text. Extracts specific information or summaries from documents, describes visual content. Use when you need analyzed/extracted data rather than literal file contents. (Multimodal-Looker -
|
|
87585
|
+
description: "Analyze media files (PDFs, images, diagrams) that require interpretation beyond raw text. Extracts specific information or summaries from documents, describes visual content. Use when you need analyzed/extracted data rather than literal file contents. (Multimodal-Looker - DrizzyAgent)",
|
|
87576
87586
|
mode: MODE5,
|
|
87577
87587
|
model,
|
|
87578
87588
|
temperature: 0.1,
|
|
@@ -96724,9 +96734,9 @@ function createFirstMessageVariantGate() {
|
|
|
96724
96734
|
|
|
96725
96735
|
// src/index.ts
|
|
96726
96736
|
var activePluginDispose = null;
|
|
96727
|
-
var
|
|
96737
|
+
var DrizzyAgentPlugin = async (ctx) => {
|
|
96728
96738
|
initConfigContext("opencode", null);
|
|
96729
|
-
log("[
|
|
96739
|
+
log("[DrizzyAgentPlugin] ENTRY - plugin loading", {
|
|
96730
96740
|
directory: ctx.directory
|
|
96731
96741
|
});
|
|
96732
96742
|
injectServerAuthIntoClient(ctx.client);
|
|
@@ -96793,7 +96803,7 @@ var OhMyOpenCodePlugin = async (ctx) => {
|
|
|
96793
96803
|
}
|
|
96794
96804
|
};
|
|
96795
96805
|
};
|
|
96796
|
-
var src_default =
|
|
96806
|
+
var src_default = DrizzyAgentPlugin;
|
|
96797
96807
|
export {
|
|
96798
96808
|
src_default as default
|
|
96799
96809
|
};
|