oh-my-opencode 3.7.4 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +206 -243
- package/README.ko.md +205 -244
- package/README.md +176 -174
- package/README.zh-cn.md +211 -255
- package/dist/agents/atlas/default.d.ts +1 -1
- package/dist/agents/atlas/gpt.d.ts +1 -1
- package/dist/agents/atlas/prompt-section-builder.d.ts +1 -1
- package/dist/agents/builtin-agents/environment-context.d.ts +5 -1
- package/dist/agents/builtin-agents/general-agents.d.ts +1 -0
- package/dist/agents/builtin-agents/hephaestus-agent.d.ts +1 -0
- package/dist/agents/builtin-agents/sisyphus-agent.d.ts +1 -0
- package/dist/agents/builtin-agents.d.ts +1 -1
- package/dist/agents/dynamic-agent-prompt-builder.d.ts +1 -5
- package/dist/agents/index.d.ts +2 -1
- package/dist/agents/prometheus/gpt.d.ts +24 -0
- package/dist/agents/prometheus/index.d.ts +3 -1
- package/dist/agents/prometheus/system-prompt.d.ts +12 -1
- package/dist/agents/types.d.ts +1 -0
- package/dist/cli/fallback-chain-resolution.d.ts +1 -1
- package/dist/cli/index.js +366 -118
- package/dist/cli/model-fallback-requirements.d.ts +3 -0
- package/dist/cli/model-fallback-types.d.ts +0 -5
- package/dist/cli/provider-model-id-transform.d.ts +1 -1
- package/dist/cli/run/timestamp-output.d.ts +5 -0
- package/dist/cli/run/types.d.ts +1 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/schema/agent-overrides.d.ts +75 -60
- package/dist/config/schema/categories.d.ts +3 -1
- package/dist/config/schema/experimental.d.ts +2 -0
- package/dist/config/schema/fallback-models.d.ts +3 -0
- package/dist/config/schema/hooks.d.ts +3 -3
- package/dist/config/schema/oh-my-opencode-config.d.ts +87 -104
- package/dist/config/schema/ralph-loop.d.ts +4 -0
- package/dist/config/schema/runtime-fallback.d.ts +10 -0
- package/dist/config/schema.d.ts +2 -0
- package/dist/create-hooks.d.ts +7 -5
- package/dist/features/background-agent/compaction-aware-message-resolver.d.ts +3 -0
- package/dist/features/background-agent/error-classifier.d.ts +8 -0
- package/dist/features/background-agent/fallback-retry-handler.d.ts +16 -0
- package/dist/features/background-agent/manager.d.ts +1 -6
- package/dist/features/background-agent/process-cleanup.d.ts +8 -0
- package/dist/features/background-agent/types.d.ts +7 -0
- package/dist/features/builtin-commands/templates/ralph-loop.d.ts +1 -1
- package/dist/features/claude-code-session-state/state.d.ts +1 -0
- package/dist/features/task-toast-manager/manager.d.ts +5 -0
- package/dist/features/task-toast-manager/types.d.ts +2 -1
- package/dist/features/tmux-subagent/action-executor.d.ts +10 -3
- package/dist/features/tmux-subagent/grid-planning.d.ts +5 -3
- package/dist/features/tmux-subagent/manager.d.ts +12 -0
- package/dist/features/tmux-subagent/pane-split-availability.d.ts +0 -1
- package/dist/features/tmux-subagent/spawn-target-finder.d.ts +2 -2
- package/dist/features/tmux-subagent/tmux-grid-constants.d.ts +4 -0
- package/dist/features/tmux-subagent/types.d.ts +2 -0
- package/dist/hooks/hashline-edit-diff-enhancer/hook.d.ts +28 -0
- package/dist/hooks/hashline-edit-diff-enhancer/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/model-fallback/hook.d.ts +60 -0
- package/dist/hooks/no-hephaestus-non-gpt/hook.d.ts +16 -0
- package/dist/hooks/no-hephaestus-non-gpt/index.d.ts +1 -0
- package/dist/hooks/ralph-loop/command-arguments.d.ts +8 -0
- package/dist/hooks/ralph-loop/continuation-prompt-injector.d.ts +1 -0
- package/dist/hooks/ralph-loop/iteration-continuation.d.ts +12 -0
- package/dist/hooks/ralph-loop/loop-state-controller.d.ts +2 -0
- package/dist/hooks/ralph-loop/ralph-loop-event-handler.d.ts +1 -0
- package/dist/hooks/ralph-loop/ralph-loop-hook.d.ts +1 -0
- package/dist/hooks/ralph-loop/session-reset-strategy.d.ts +3 -0
- package/dist/hooks/ralph-loop/types.d.ts +1 -0
- package/dist/hooks/runtime-fallback/agent-resolver.d.ts +5 -0
- package/dist/hooks/runtime-fallback/auto-retry.d.ts +10 -0
- package/dist/hooks/runtime-fallback/chat-message-handler.d.ts +20 -0
- package/dist/hooks/runtime-fallback/constants.d.ts +19 -0
- package/dist/hooks/runtime-fallback/error-classifier.d.ts +17 -0
- package/dist/hooks/runtime-fallback/event-handler.d.ts +8 -0
- package/dist/hooks/runtime-fallback/fallback-models.d.ts +2 -0
- package/dist/hooks/runtime-fallback/fallback-state.d.ts +6 -0
- package/dist/hooks/runtime-fallback/hook.d.ts +3 -0
- package/dist/hooks/runtime-fallback/index.d.ts +2 -0
- package/dist/hooks/runtime-fallback/message-update-handler.d.ts +5 -0
- package/dist/hooks/runtime-fallback/types.d.ts +59 -0
- package/dist/hooks/session-recovery/detect-error-type.d.ts +2 -1
- package/dist/hooks/session-recovery/recover-unavailable-tool.d.ts +5 -0
- package/dist/hooks/todo-continuation-enforcer/continuation-injection.d.ts +1 -0
- package/dist/hooks/todo-continuation-enforcer/countdown.d.ts +1 -0
- package/dist/hooks/write-existing-file-guard/hook.d.ts +1 -0
- package/dist/index.js +6685 -3057
- package/dist/oh-my-opencode.schema.json +3681 -0
- package/dist/plugin/chat-headers.d.ts +4 -0
- package/dist/plugin/chat-message.d.ts +9 -8
- package/dist/plugin/chat-params.d.ts +2 -3
- package/dist/plugin/event.d.ts +2 -6
- package/dist/plugin/hooks/create-core-hooks.d.ts +7 -5
- package/dist/plugin/hooks/create-session-hooks.d.ts +6 -6
- package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +2 -1
- package/dist/plugin/hooks/create-transform-hooks.d.ts +1 -1
- package/dist/plugin/system-transform.d.ts +5 -0
- package/dist/plugin/types.d.ts +7 -1
- package/dist/plugin/ultrawork-db-model-override.d.ts +11 -0
- package/dist/plugin/ultrawork-model-override.d.ts +37 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/internal-initiator-marker.d.ts +5 -0
- package/dist/shared/model-error-classifier.d.ts +31 -0
- package/dist/shared/model-resolution-pipeline.d.ts +1 -0
- package/dist/shared/model-resolver.d.ts +6 -0
- package/dist/shared/provider-model-id-transform.d.ts +1 -0
- package/dist/shared/session-category-registry.d.ts +32 -0
- package/dist/shared/session-model-state.d.ts +7 -0
- package/dist/shared/tmux/tmux-utils/layout.d.ts +17 -2
- package/dist/tools/delegate-task/background-task.d.ts +2 -1
- package/dist/tools/delegate-task/category-resolver.d.ts +2 -0
- package/dist/tools/delegate-task/skill-resolver.d.ts +1 -0
- package/dist/tools/delegate-task/subagent-resolver.d.ts +2 -0
- package/dist/tools/delegate-task/sync-task.d.ts +1 -1
- package/dist/tools/hashline-edit/constants.d.ts +5 -2
- package/dist/tools/hashline-edit/diff-utils.d.ts +6 -0
- package/dist/tools/hashline-edit/edit-operations.d.ts +12 -4
- package/dist/tools/hashline-edit/edit-text-normalization.d.ts +7 -0
- package/dist/tools/hashline-edit/hash-computation.d.ts +8 -1
- package/dist/tools/hashline-edit/hashline-chunk-formatter.d.ts +10 -0
- package/dist/tools/hashline-edit/index.d.ts +4 -4
- package/dist/tools/hashline-edit/tool-description.d.ts +1 -0
- package/dist/tools/hashline-edit/types.d.ts +16 -5
- package/dist/tools/hashline-edit/validation.d.ts +13 -0
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/skill/constants.d.ts +2 -2
- package/dist/tools/skill/types.d.ts +4 -0
- package/dist/tools/slashcommand/index.d.ts +1 -1
- package/dist/tools/slashcommand/types.d.ts +1 -7
- package/package.json +10 -10
- package/dist/features/background-agent/notification-builder.d.ts +0 -8
- package/dist/hooks/ultrawork-model-override/hook.d.ts +0 -6
- package/dist/hooks/ultrawork-model-override/index.d.ts +0 -1
- package/dist/tools/slashcommand/skill-command-converter.d.ts +0 -3
- package/dist/tools/slashcommand/slashcommand-description.d.ts +0 -3
- package/dist/tools/slashcommand/slashcommand-tool.d.ts +0 -4
- package/dist/tools/slashcommand/tools.d.ts +0 -2
|
@@ -10,21 +10,22 @@ type ChatMessagePart = {
|
|
|
10
10
|
text?: string;
|
|
11
11
|
[key: string]: unknown;
|
|
12
12
|
};
|
|
13
|
-
type ChatMessageHandlerOutput = {
|
|
13
|
+
export type ChatMessageHandlerOutput = {
|
|
14
14
|
message: Record<string, unknown>;
|
|
15
15
|
parts: ChatMessagePart[];
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
ctx: PluginContext;
|
|
19
|
-
pluginConfig: OhMyOpenCodeConfig;
|
|
20
|
-
firstMessageVariantGate: FirstMessageVariantGate;
|
|
21
|
-
hooks: CreatedHooks;
|
|
22
|
-
}): (input: {
|
|
17
|
+
export type ChatMessageInput = {
|
|
23
18
|
sessionID: string;
|
|
24
19
|
agent?: string;
|
|
25
20
|
model?: {
|
|
26
21
|
providerID: string;
|
|
27
22
|
modelID: string;
|
|
28
23
|
};
|
|
29
|
-
}
|
|
24
|
+
};
|
|
25
|
+
export declare function createChatMessageHandler(args: {
|
|
26
|
+
ctx: PluginContext;
|
|
27
|
+
pluginConfig: OhMyOpenCodeConfig;
|
|
28
|
+
firstMessageVariantGate: FirstMessageVariantGate;
|
|
29
|
+
hooks: CreatedHooks;
|
|
30
|
+
}): (input: ChatMessageInput, output: ChatMessageHandlerOutput) => Promise<void>;
|
|
30
31
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ChatParamsInput = {
|
|
1
|
+
export type ChatParamsInput = {
|
|
2
2
|
sessionID: string;
|
|
3
3
|
agent: {
|
|
4
4
|
name?: string;
|
|
@@ -14,7 +14,7 @@ type ChatParamsInput = {
|
|
|
14
14
|
variant?: string;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
type ChatParamsOutput = {
|
|
17
|
+
export type ChatParamsOutput = {
|
|
18
18
|
temperature?: number;
|
|
19
19
|
topP?: number;
|
|
20
20
|
topK?: number;
|
|
@@ -25,4 +25,3 @@ export declare function createChatParamsHandler(args: {
|
|
|
25
25
|
"chat.params"?: (input: ChatParamsInput, output: ChatParamsOutput) => Promise<void>;
|
|
26
26
|
} | null;
|
|
27
27
|
}): (input: unknown, output: unknown) => Promise<void>;
|
|
28
|
-
export {};
|
package/dist/plugin/event.d.ts
CHANGED
|
@@ -10,16 +10,12 @@ type FirstMessageVariantGate = {
|
|
|
10
10
|
} | undefined) => void;
|
|
11
11
|
clear: (sessionID: string) => void;
|
|
12
12
|
};
|
|
13
|
+
type EventInput = Parameters<NonNullable<NonNullable<CreatedHooks["writeExistingFileGuard"]>["event"]>>[0];
|
|
13
14
|
export declare function createEventHandler(args: {
|
|
14
15
|
ctx: PluginContext;
|
|
15
16
|
pluginConfig: OhMyOpenCodeConfig;
|
|
16
17
|
firstMessageVariantGate: FirstMessageVariantGate;
|
|
17
18
|
managers: Managers;
|
|
18
19
|
hooks: CreatedHooks;
|
|
19
|
-
}): (input:
|
|
20
|
-
event: {
|
|
21
|
-
type: string;
|
|
22
|
-
properties?: Record<string, unknown>;
|
|
23
|
-
};
|
|
24
|
-
}) => Promise<void>;
|
|
20
|
+
}): (input: EventInput) => Promise<void>;
|
|
25
21
|
export {};
|
|
@@ -8,7 +8,7 @@ export declare function createCoreHooks(args: {
|
|
|
8
8
|
isHookEnabled: (hookName: HookName) => boolean;
|
|
9
9
|
safeHookEnabled: boolean;
|
|
10
10
|
}): {
|
|
11
|
-
claudeCodeHooks: ReturnType<typeof import("../../hooks").createClaudeCodeHooksHook
|
|
11
|
+
claudeCodeHooks: ReturnType<typeof import("../../hooks").createClaudeCodeHooksHook> | null;
|
|
12
12
|
keywordDetector: ReturnType<typeof import("../../hooks").createKeywordDetectorHook> | null;
|
|
13
13
|
contextInjectorMessagesTransform: ReturnType<typeof import("../../features/context-injector").createContextInjectorMessagesTransformHook>;
|
|
14
14
|
thinkingBlockValidator: ReturnType<typeof import("../../hooks").createThinkingBlockValidatorHook> | null;
|
|
@@ -21,11 +21,13 @@ export declare function createCoreHooks(args: {
|
|
|
21
21
|
tasksTodowriteDisabler: ReturnType<typeof import("../../hooks").createTasksTodowriteDisablerHook> | null;
|
|
22
22
|
writeExistingFileGuard: ReturnType<typeof import("../../hooks").createWriteExistingFileGuardHook> | null;
|
|
23
23
|
hashlineReadEnhancer: ReturnType<typeof import("../../hooks").createHashlineReadEnhancerHook> | null;
|
|
24
|
+
jsonErrorRecovery: ReturnType<typeof import("../../hooks").createJsonErrorRecoveryHook> | null;
|
|
24
25
|
contextWindowMonitor: ReturnType<typeof import("../../hooks").createContextWindowMonitorHook> | null;
|
|
25
26
|
preemptiveCompaction: ReturnType<typeof import("../../hooks").createPreemptiveCompactionHook> | null;
|
|
26
27
|
sessionRecovery: ReturnType<typeof import("../../hooks").createSessionRecoveryHook> | null;
|
|
27
28
|
sessionNotification: ReturnType<typeof import("../../hooks").createSessionNotification> | null;
|
|
28
29
|
thinkMode: ReturnType<typeof import("../../hooks").createThinkModeHook> | null;
|
|
30
|
+
modelFallback: ReturnType<typeof import("../../hooks").createModelFallbackHook> | null;
|
|
29
31
|
anthropicContextWindowLimitRecovery: ReturnType<typeof import("../../hooks").createAnthropicContextWindowLimitRecoveryHook> | null;
|
|
30
32
|
autoUpdateChecker: ReturnType<typeof import("../../hooks").createAutoUpdateCheckerHook> | null;
|
|
31
33
|
agentUsageReminder: ReturnType<typeof import("../../hooks").createAgentUsageReminderHook> | null;
|
|
@@ -33,14 +35,14 @@ export declare function createCoreHooks(args: {
|
|
|
33
35
|
interactiveBashSession: ReturnType<typeof import("../../hooks").createInteractiveBashSessionHook> | null;
|
|
34
36
|
ralphLoop: ReturnType<typeof import("../../hooks").createRalphLoopHook> | null;
|
|
35
37
|
editErrorRecovery: ReturnType<typeof import("../../hooks").createEditErrorRecoveryHook> | null;
|
|
36
|
-
jsonErrorRecovery: ReturnType<typeof import("../../hooks").createJsonErrorRecoveryHook> | null;
|
|
37
38
|
delegateTaskRetry: ReturnType<typeof import("../../hooks").createDelegateTaskRetryHook> | null;
|
|
38
39
|
startWork: ReturnType<typeof import("../../hooks").createStartWorkHook> | null;
|
|
39
40
|
prometheusMdOnly: ReturnType<typeof import("../../hooks").createPrometheusMdOnlyHook> | null;
|
|
40
41
|
sisyphusJuniorNotepad: ReturnType<typeof import("../../hooks").createSisyphusJuniorNotepadHook> | null;
|
|
41
42
|
noSisyphusGpt: ReturnType<typeof import("../../hooks").createNoSisyphusGptHook> | null;
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
noHephaestusNonGpt: ReturnType<typeof import("../../hooks").createNoHephaestusNonGptHook> | null;
|
|
44
|
+
questionLabelTruncator: ReturnType<typeof import("../../hooks").createQuestionLabelTruncatorHook> | null;
|
|
45
|
+
taskResumeInfo: ReturnType<typeof import("../../hooks").createTaskResumeInfoHook> | null;
|
|
44
46
|
anthropicEffort: ReturnType<typeof import("../../hooks/anthropic-effort").createAnthropicEffortHook> | null;
|
|
45
|
-
|
|
47
|
+
runtimeFallback: ReturnType<typeof import("../../hooks").createRuntimeFallbackHook> | null;
|
|
46
48
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { OhMyOpenCodeConfig, HookName } from "../../config";
|
|
2
2
|
import type { ModelCacheState } from "../../plugin-state";
|
|
3
3
|
import type { PluginContext } from "../types";
|
|
4
|
-
import { createContextWindowMonitorHook, createSessionRecoveryHook, createSessionNotification, createThinkModeHook, createAnthropicContextWindowLimitRecoveryHook, createAutoUpdateCheckerHook, createAgentUsageReminderHook, createNonInteractiveEnvHook, createInteractiveBashSessionHook, createRalphLoopHook, createEditErrorRecoveryHook,
|
|
4
|
+
import { createContextWindowMonitorHook, createSessionRecoveryHook, createSessionNotification, createThinkModeHook, createModelFallbackHook, createAnthropicContextWindowLimitRecoveryHook, createAutoUpdateCheckerHook, createAgentUsageReminderHook, createNonInteractiveEnvHook, createInteractiveBashSessionHook, createRalphLoopHook, createEditErrorRecoveryHook, createDelegateTaskRetryHook, createTaskResumeInfoHook, createStartWorkHook, createPrometheusMdOnlyHook, createSisyphusJuniorNotepadHook, createNoSisyphusGptHook, createNoHephaestusNonGptHook, createQuestionLabelTruncatorHook, createPreemptiveCompactionHook, createRuntimeFallbackHook } from "../../hooks";
|
|
5
5
|
import { createAnthropicEffortHook } from "../../hooks/anthropic-effort";
|
|
6
|
-
import { createUltraworkModelOverrideHook } from "../../hooks/ultrawork-model-override";
|
|
7
6
|
export type SessionHooks = {
|
|
8
7
|
contextWindowMonitor: ReturnType<typeof createContextWindowMonitorHook> | null;
|
|
9
8
|
preemptiveCompaction: ReturnType<typeof createPreemptiveCompactionHook> | null;
|
|
10
9
|
sessionRecovery: ReturnType<typeof createSessionRecoveryHook> | null;
|
|
11
10
|
sessionNotification: ReturnType<typeof createSessionNotification> | null;
|
|
12
11
|
thinkMode: ReturnType<typeof createThinkModeHook> | null;
|
|
12
|
+
modelFallback: ReturnType<typeof createModelFallbackHook> | null;
|
|
13
13
|
anthropicContextWindowLimitRecovery: ReturnType<typeof createAnthropicContextWindowLimitRecoveryHook> | null;
|
|
14
14
|
autoUpdateChecker: ReturnType<typeof createAutoUpdateCheckerHook> | null;
|
|
15
15
|
agentUsageReminder: ReturnType<typeof createAgentUsageReminderHook> | null;
|
|
@@ -17,16 +17,16 @@ export type SessionHooks = {
|
|
|
17
17
|
interactiveBashSession: ReturnType<typeof createInteractiveBashSessionHook> | null;
|
|
18
18
|
ralphLoop: ReturnType<typeof createRalphLoopHook> | null;
|
|
19
19
|
editErrorRecovery: ReturnType<typeof createEditErrorRecoveryHook> | null;
|
|
20
|
-
jsonErrorRecovery: ReturnType<typeof createJsonErrorRecoveryHook> | null;
|
|
21
20
|
delegateTaskRetry: ReturnType<typeof createDelegateTaskRetryHook> | null;
|
|
22
21
|
startWork: ReturnType<typeof createStartWorkHook> | null;
|
|
23
22
|
prometheusMdOnly: ReturnType<typeof createPrometheusMdOnlyHook> | null;
|
|
24
23
|
sisyphusJuniorNotepad: ReturnType<typeof createSisyphusJuniorNotepadHook> | null;
|
|
25
24
|
noSisyphusGpt: ReturnType<typeof createNoSisyphusGptHook> | null;
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
noHephaestusNonGpt: ReturnType<typeof createNoHephaestusNonGptHook> | null;
|
|
26
|
+
questionLabelTruncator: ReturnType<typeof createQuestionLabelTruncatorHook> | null;
|
|
27
|
+
taskResumeInfo: ReturnType<typeof createTaskResumeInfoHook> | null;
|
|
28
28
|
anthropicEffort: ReturnType<typeof createAnthropicEffortHook> | null;
|
|
29
|
-
|
|
29
|
+
runtimeFallback: ReturnType<typeof createRuntimeFallbackHook> | null;
|
|
30
30
|
};
|
|
31
31
|
export declare function createSessionHooks(args: {
|
|
32
32
|
ctx: PluginContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HookName, OhMyOpenCodeConfig } from "../../config";
|
|
2
2
|
import type { ModelCacheState } from "../../plugin-state";
|
|
3
3
|
import type { PluginContext } from "../types";
|
|
4
|
-
import { createCommentCheckerHooks, createToolOutputTruncatorHook, createDirectoryAgentsInjectorHook, createDirectoryReadmeInjectorHook, createEmptyTaskResponseDetectorHook, createRulesInjectorHook, createTasksTodowriteDisablerHook, createWriteExistingFileGuardHook, createHashlineReadEnhancerHook } from "../../hooks";
|
|
4
|
+
import { createCommentCheckerHooks, createToolOutputTruncatorHook, createDirectoryAgentsInjectorHook, createDirectoryReadmeInjectorHook, createEmptyTaskResponseDetectorHook, createRulesInjectorHook, createTasksTodowriteDisablerHook, createWriteExistingFileGuardHook, createHashlineReadEnhancerHook, createJsonErrorRecoveryHook } from "../../hooks";
|
|
5
5
|
export type ToolGuardHooks = {
|
|
6
6
|
commentChecker: ReturnType<typeof createCommentCheckerHooks> | null;
|
|
7
7
|
toolOutputTruncator: ReturnType<typeof createToolOutputTruncatorHook> | null;
|
|
@@ -12,6 +12,7 @@ export type ToolGuardHooks = {
|
|
|
12
12
|
tasksTodowriteDisabler: ReturnType<typeof createTasksTodowriteDisablerHook> | null;
|
|
13
13
|
writeExistingFileGuard: ReturnType<typeof createWriteExistingFileGuardHook> | null;
|
|
14
14
|
hashlineReadEnhancer: ReturnType<typeof createHashlineReadEnhancerHook> | null;
|
|
15
|
+
jsonErrorRecovery: ReturnType<typeof createJsonErrorRecoveryHook> | null;
|
|
15
16
|
};
|
|
16
17
|
export declare function createToolGuardHooks(args: {
|
|
17
18
|
ctx: PluginContext;
|
|
@@ -3,7 +3,7 @@ import type { PluginContext } from "../types";
|
|
|
3
3
|
import { createClaudeCodeHooksHook, createKeywordDetectorHook, createThinkingBlockValidatorHook } from "../../hooks";
|
|
4
4
|
import { createContextInjectorMessagesTransformHook } from "../../features/context-injector";
|
|
5
5
|
export type TransformHooks = {
|
|
6
|
-
claudeCodeHooks: ReturnType<typeof createClaudeCodeHooksHook
|
|
6
|
+
claudeCodeHooks: ReturnType<typeof createClaudeCodeHooksHook> | null;
|
|
7
7
|
keywordDetector: ReturnType<typeof createKeywordDetectorHook> | null;
|
|
8
8
|
contextInjectorMessagesTransform: ReturnType<typeof createContextInjectorMessagesTransformHook>;
|
|
9
9
|
thinkingBlockValidator: ReturnType<typeof createThinkingBlockValidatorHook> | null;
|
package/dist/plugin/types.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { Plugin, ToolDefinition } from "@opencode-ai/plugin";
|
|
2
2
|
export type PluginContext = Parameters<Plugin>[0];
|
|
3
3
|
export type PluginInstance = Awaited<ReturnType<Plugin>>;
|
|
4
|
-
|
|
4
|
+
type ChatHeadersHook = PluginInstance extends {
|
|
5
|
+
"chat.headers"?: infer T;
|
|
6
|
+
} ? T : (input: unknown, output: unknown) => Promise<void>;
|
|
7
|
+
export type PluginInterface = Omit<PluginInstance, "experimental.session.compacting" | "chat.headers"> & {
|
|
8
|
+
"chat.headers"?: ChatHeadersHook;
|
|
9
|
+
};
|
|
5
10
|
export type ToolsRecord = Record<string, ToolDefinition>;
|
|
6
11
|
export type TmuxConfig = {
|
|
7
12
|
enabled: boolean;
|
|
@@ -10,3 +15,4 @@ export type TmuxConfig = {
|
|
|
10
15
|
main_pane_min_width: number;
|
|
11
16
|
agent_pane_min_width: number;
|
|
12
17
|
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schedules a deferred SQLite update to change the message model in the DB
|
|
3
|
+
* WITHOUT triggering a Bus event. Uses microtask retry loop to wait for
|
|
4
|
+
* Session.updateMessage() to save the message first, then overwrites the model.
|
|
5
|
+
*
|
|
6
|
+
* Falls back to setTimeout(fn, 0) after 10 microtask attempts.
|
|
7
|
+
*/
|
|
8
|
+
export declare function scheduleDeferredModelOverride(messageId: string, targetModel: {
|
|
9
|
+
providerID: string;
|
|
10
|
+
modelID: string;
|
|
11
|
+
}, variant?: string): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { OhMyOpenCodeConfig } from "../config";
|
|
2
|
+
export declare function detectUltrawork(text: string): boolean;
|
|
3
|
+
export type UltraworkOverrideResult = {
|
|
4
|
+
providerID?: string;
|
|
5
|
+
modelID?: string;
|
|
6
|
+
variant?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the ultrawork model override config for the given agent and prompt text.
|
|
10
|
+
* Returns null if no override should be applied.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveUltraworkOverride(pluginConfig: OhMyOpenCodeConfig, inputAgentName: string | undefined, output: {
|
|
13
|
+
message: Record<string, unknown>;
|
|
14
|
+
parts: Array<{
|
|
15
|
+
type: string;
|
|
16
|
+
text?: string;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}>;
|
|
19
|
+
}, sessionID?: string): UltraworkOverrideResult | null;
|
|
20
|
+
/**
|
|
21
|
+
* Applies ultrawork model override using a deferred DB update strategy.
|
|
22
|
+
*
|
|
23
|
+
* Instead of directly mutating output.message.model (which would cause the TUI
|
|
24
|
+
* bottom bar to show the override model), this schedules a queueMicrotask that
|
|
25
|
+
* updates the message model directly in SQLite AFTER Session.updateMessage()
|
|
26
|
+
* saves the original model, but BEFORE loop() reads it for the API call.
|
|
27
|
+
*
|
|
28
|
+
* Result: API call uses opus, TUI bottom bar stays on sonnet.
|
|
29
|
+
*/
|
|
30
|
+
export declare function applyUltraworkModelOverrideOnMessage(pluginConfig: OhMyOpenCodeConfig, inputAgentName: string | undefined, output: {
|
|
31
|
+
message: Record<string, unknown>;
|
|
32
|
+
parts: Array<{
|
|
33
|
+
type: string;
|
|
34
|
+
text?: string;
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
}, tui: unknown, sessionID?: string): void;
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./system-directive";
|
|
|
30
30
|
export * from "./agent-tool-restrictions";
|
|
31
31
|
export * from "./model-requirements";
|
|
32
32
|
export * from "./model-resolver";
|
|
33
|
+
export { normalizeFallbackModels } from "./model-resolver";
|
|
33
34
|
export { resolveModelPipeline } from "./model-resolution-pipeline";
|
|
34
35
|
export type { ModelResolutionRequest, ModelResolutionProvenance, ModelResolutionResult, } from "./model-resolution-types";
|
|
35
36
|
export * from "./model-availability";
|
|
@@ -49,3 +50,5 @@ export * from "./opencode-message-dir";
|
|
|
49
50
|
export * from "./normalize-sdk-response";
|
|
50
51
|
export * from "./session-directory-resolver";
|
|
51
52
|
export * from "./prompt-tools";
|
|
53
|
+
export * from "./internal-initiator-marker";
|
|
54
|
+
export { SessionCategoryRegistry } from "./session-category-registry";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FallbackEntry } from "./model-requirements";
|
|
2
|
+
export interface ErrorInfo {
|
|
3
|
+
name?: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Determines if an error is a retryable model error.
|
|
8
|
+
* Returns true if the error is a known retryable type OR matches retryable message patterns.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isRetryableModelError(error: ErrorInfo): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Determines if an error should trigger a fallback retry.
|
|
13
|
+
* Returns true for deadstop errors that completely halt the action loop.
|
|
14
|
+
*/
|
|
15
|
+
export declare function shouldRetryError(error: ErrorInfo): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Gets the next fallback model from the chain based on attempt count.
|
|
18
|
+
* Returns undefined if all fallbacks have been exhausted.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getNextFallback(fallbackChain: FallbackEntry[], attemptCount: number): FallbackEntry | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if there are more fallbacks available after the current attempt.
|
|
23
|
+
*/
|
|
24
|
+
export declare function hasMoreFallbacks(fallbackChain: FallbackEntry[], attemptCount: number): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Selects the best provider for a fallback entry.
|
|
27
|
+
* Priority:
|
|
28
|
+
* 1) First connected provider in the entry's provider preference order
|
|
29
|
+
* 2) First provider listed in the fallback entry (when cache is missing)
|
|
30
|
+
*/
|
|
31
|
+
export declare function selectFallbackProvider(providers: string[], preferredProviderID?: string): string;
|
|
@@ -13,6 +13,7 @@ export type ModelResolutionResult = {
|
|
|
13
13
|
export type ExtendedModelResolutionInput = {
|
|
14
14
|
uiSelectedModel?: string;
|
|
15
15
|
userModel?: string;
|
|
16
|
+
userFallbackModels?: string[];
|
|
16
17
|
categoryDefaultModel?: string;
|
|
17
18
|
fallbackChain?: FallbackEntry[];
|
|
18
19
|
availableModels: Set<string>;
|
|
@@ -20,3 +21,8 @@ export type ExtendedModelResolutionInput = {
|
|
|
20
21
|
};
|
|
21
22
|
export declare function resolveModel(input: ModelResolutionInput): string | undefined;
|
|
22
23
|
export declare function resolveModelWithFallback(input: ExtendedModelResolutionInput): ModelResolutionResult | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Normalizes fallback_models config (which can be string or string[]) to string[]
|
|
26
|
+
* Centralized helper to avoid duplicated normalization logic
|
|
27
|
+
*/
|
|
28
|
+
export declare function normalizeFallbackModels(models: string | string[] | undefined): string[] | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transformModelForProvider(provider: string, model: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Category Registry
|
|
3
|
+
*
|
|
4
|
+
* Maintains a mapping of session IDs to their assigned categories.
|
|
5
|
+
* Used by runtime-fallback hook to lookup category-specific fallback_models.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SessionCategoryRegistry: {
|
|
8
|
+
/**
|
|
9
|
+
* Register a session with its category
|
|
10
|
+
*/
|
|
11
|
+
register: (sessionID: string, category: string) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Get the category for a session
|
|
14
|
+
*/
|
|
15
|
+
get: (sessionID: string) => string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Remove a session from the registry (cleanup)
|
|
18
|
+
*/
|
|
19
|
+
remove: (sessionID: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a session is registered
|
|
22
|
+
*/
|
|
23
|
+
has: (sessionID: string) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get the size of the registry (for debugging)
|
|
26
|
+
*/
|
|
27
|
+
size: () => number;
|
|
28
|
+
/**
|
|
29
|
+
* Clear all entries (use with caution, mainly for testing)
|
|
30
|
+
*/
|
|
31
|
+
clear: () => void;
|
|
32
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type SessionModel = {
|
|
2
|
+
providerID: string;
|
|
3
|
+
modelID: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function setSessionModel(sessionID: string, model: SessionModel): void;
|
|
6
|
+
export declare function getSessionModel(sessionID: string): SessionModel | undefined;
|
|
7
|
+
export declare function clearSessionModel(sessionID: string): void;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import type { TmuxLayout } from "../../../config/schema";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type TmuxSpawnCommand = (args: string[], options: {
|
|
3
|
+
stdout: "ignore";
|
|
4
|
+
stderr: "ignore";
|
|
5
|
+
}) => {
|
|
6
|
+
exited: Promise<number>;
|
|
7
|
+
};
|
|
8
|
+
interface LayoutDeps {
|
|
9
|
+
spawnCommand?: TmuxSpawnCommand;
|
|
10
|
+
}
|
|
11
|
+
interface MainPaneWidthOptions {
|
|
12
|
+
mainPaneSize?: number;
|
|
13
|
+
mainPaneMinWidth?: number;
|
|
14
|
+
agentPaneMinWidth?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function applyLayout(tmux: string, layout: TmuxLayout, mainPaneSize: number, deps?: LayoutDeps): Promise<void>;
|
|
17
|
+
export declare function enforceMainPaneWidth(mainPaneId: string, windowWidth: number, mainPaneSizeOrOptions?: number | MainPaneWidthOptions): Promise<void>;
|
|
18
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types";
|
|
2
2
|
import type { ExecutorContext, ParentContext } from "./executor-types";
|
|
3
|
+
import type { FallbackEntry } from "../../shared/model-requirements";
|
|
3
4
|
export declare function executeBackgroundTask(args: DelegateTaskArgs, ctx: ToolContextWithMetadata, executorCtx: ExecutorContext, parentContext: ParentContext, agentToUse: string, categoryModel: {
|
|
4
5
|
providerID: string;
|
|
5
6
|
modelID: string;
|
|
6
7
|
variant?: string;
|
|
7
|
-
} | undefined, systemContent: string | undefined): Promise<string>;
|
|
8
|
+
} | undefined, systemContent: string | undefined, fallbackChain?: FallbackEntry[]): Promise<string>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModelFallbackInfo } from "../../features/task-toast-manager/types";
|
|
2
2
|
import type { DelegateTaskArgs } from "./types";
|
|
3
3
|
import type { ExecutorContext } from "./executor-types";
|
|
4
|
+
import type { FallbackEntry } from "../../shared/model-requirements";
|
|
4
5
|
export interface CategoryResolutionResult {
|
|
5
6
|
agentToUse: string;
|
|
6
7
|
categoryModel: {
|
|
@@ -12,6 +13,7 @@ export interface CategoryResolutionResult {
|
|
|
12
13
|
modelInfo: ModelFallbackInfo | undefined;
|
|
13
14
|
actualModel: string | undefined;
|
|
14
15
|
isUnstableAgent: boolean;
|
|
16
|
+
fallbackChain?: FallbackEntry[];
|
|
15
17
|
error?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare function resolveCategoryExecution(args: DelegateTaskArgs, executorCtx: ExecutorContext, inheritedModel: string | undefined, systemDefaultModel: string | undefined): Promise<CategoryResolutionResult>;
|
|
@@ -3,6 +3,7 @@ export declare function resolveSkillContent(skills: string[], options: {
|
|
|
3
3
|
gitMasterConfig?: GitMasterConfig;
|
|
4
4
|
browserProvider?: BrowserAutomationProvider;
|
|
5
5
|
disabledSkills?: Set<string>;
|
|
6
|
+
directory?: string;
|
|
6
7
|
}): Promise<{
|
|
7
8
|
content: string | undefined;
|
|
8
9
|
error: string | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DelegateTaskArgs } from "./types";
|
|
2
2
|
import type { ExecutorContext } from "./executor-types";
|
|
3
|
+
import type { FallbackEntry } from "../../shared/model-requirements";
|
|
3
4
|
export declare function resolveSubagentExecution(args: DelegateTaskArgs, executorCtx: ExecutorContext, parentAgent: string | undefined, categoryExamples: string): Promise<{
|
|
4
5
|
agentToUse: string;
|
|
5
6
|
categoryModel: {
|
|
@@ -7,5 +8,6 @@ export declare function resolveSubagentExecution(args: DelegateTaskArgs, executo
|
|
|
7
8
|
modelID: string;
|
|
8
9
|
variant?: string;
|
|
9
10
|
} | undefined;
|
|
11
|
+
fallbackChain?: FallbackEntry[];
|
|
10
12
|
error?: string;
|
|
11
13
|
}>;
|
|
@@ -6,4 +6,4 @@ export declare function executeSyncTask(args: DelegateTaskArgs, ctx: ToolContext
|
|
|
6
6
|
providerID: string;
|
|
7
7
|
modelID: string;
|
|
8
8
|
variant?: string;
|
|
9
|
-
} | undefined, systemContent: string | undefined, modelInfo?: ModelFallbackInfo, deps?: SyncTaskDeps): Promise<string>;
|
|
9
|
+
} | undefined, systemContent: string | undefined, modelInfo?: ModelFallbackInfo, fallbackChain?: import("../../shared/model-requirements").FallbackEntry[], deps?: SyncTaskDeps): Promise<string>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const NIBBLE_STR = "ZPMQVRWSNKTXJBYH";
|
|
2
|
+
export declare const HASHLINE_DICT: string[];
|
|
3
|
+
export declare const HASHLINE_REF_PATTERN: RegExp;
|
|
4
|
+
export declare const HASHLINE_OUTPUT_PATTERN: RegExp;
|
|
5
|
+
export declare const HASHLINE_LEGACY_REF_PATTERN: RegExp;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function toHashlineContent(content: string): string;
|
|
2
|
+
export declare function generateUnifiedDiff(oldContent: string, newContent: string, filePath: string): string;
|
|
3
|
+
export declare function countLineDiffs(oldContent: string, newContent: string): {
|
|
4
|
+
additions: number;
|
|
5
|
+
deletions: number;
|
|
6
|
+
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { HashlineEdit } from "./types";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export interface HashlineApplyReport {
|
|
3
|
+
content: string;
|
|
4
|
+
noopEdits: number;
|
|
5
|
+
deduplicatedEdits: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function applySetLine(lines: string[], anchor: string, newText: string | string[]): string[];
|
|
8
|
+
export declare function applyReplaceLines(lines: string[], startAnchor: string, endAnchor: string, newText: string | string[]): string[];
|
|
9
|
+
export declare function applyInsertAfter(lines: string[], anchor: string, text: string | string[]): string[];
|
|
10
|
+
export declare function applyInsertBefore(lines: string[], anchor: string, text: string | string[]): string[];
|
|
11
|
+
export declare function applyInsertBetween(lines: string[], afterAnchor: string, beforeAnchor: string, text: string | string[]): string[];
|
|
12
|
+
export declare function applyReplace(content: string, oldText: string, newText: string | string[]): string;
|
|
13
|
+
export declare function applyHashlineEditsWithReport(content: string, edits: HashlineEdit[]): HashlineApplyReport;
|
|
6
14
|
export declare function applyHashlineEdits(content: string, edits: HashlineEdit[]): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function stripLinePrefixes(lines: string[]): string[];
|
|
2
|
+
export declare function toNewLines(input: string | string[]): string[];
|
|
3
|
+
export declare function restoreLeadingIndent(templateLine: string, line: string): string;
|
|
4
|
+
export declare function stripInsertAnchorEcho(anchorLine: string, newLines: string[]): string[];
|
|
5
|
+
export declare function stripInsertBeforeEcho(anchorLine: string, newLines: string[]): string[];
|
|
6
|
+
export declare function stripInsertBoundaryEcho(afterLine: string, beforeLine: string, newLines: string[]): string[];
|
|
7
|
+
export declare function stripRangeBoundaryEcho(lines: string[], startLine: number, endLine: number, newLines: string[]): string[];
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
export declare function computeLineHash(
|
|
1
|
+
export declare function computeLineHash(lineNumber: number, content: string): string;
|
|
2
2
|
export declare function formatHashLine(lineNumber: number, content: string): string;
|
|
3
3
|
export declare function formatHashLines(content: string): string;
|
|
4
|
+
export interface HashlineStreamOptions {
|
|
5
|
+
startLine?: number;
|
|
6
|
+
maxChunkLines?: number;
|
|
7
|
+
maxChunkBytes?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function streamHashLinesFromUtf8(source: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>, options?: HashlineStreamOptions): AsyncGenerator<string>;
|
|
10
|
+
export declare function streamHashLinesFromLines(lines: Iterable<string> | AsyncIterable<string>, options?: HashlineStreamOptions): AsyncGenerator<string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface HashlineChunkFormatter {
|
|
2
|
+
push(formattedLine: string): string[];
|
|
3
|
+
flush(): string | undefined;
|
|
4
|
+
}
|
|
5
|
+
interface HashlineChunkFormatterOptions {
|
|
6
|
+
maxChunkLines: number;
|
|
7
|
+
maxChunkBytes: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function createHashlineChunkFormatter(options: HashlineChunkFormatterOptions): HashlineChunkFormatter;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { computeLineHash, formatHashLine, formatHashLines } from "./hash-computation";
|
|
1
|
+
export { computeLineHash, formatHashLine, formatHashLines, streamHashLinesFromLines, streamHashLinesFromUtf8, } from "./hash-computation";
|
|
2
2
|
export { parseLineRef, validateLineRef } from "./validation";
|
|
3
3
|
export type { LineRef } from "./validation";
|
|
4
|
-
export type { SetLine, ReplaceLines, InsertAfter, Replace, HashlineEdit } from "./types";
|
|
5
|
-
export {
|
|
6
|
-
export { applyHashlineEdits, applyInsertAfter, applyReplace, applyReplaceLines, applySetLine, } from "./edit-operations";
|
|
4
|
+
export type { SetLine, ReplaceLines, InsertAfter, InsertBefore, InsertBetween, Replace, HashlineEdit } from "./types";
|
|
5
|
+
export { NIBBLE_STR, HASHLINE_DICT, HASHLINE_REF_PATTERN, HASHLINE_OUTPUT_PATTERN } from "./constants";
|
|
6
|
+
export { applyHashlineEdits, applyInsertAfter, applyInsertBefore, applyInsertBetween, applyReplace, applyReplaceLines, applySetLine, } from "./edit-operations";
|
|
7
7
|
export { createHashlineEditTool } from "./tools";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HASHLINE_EDIT_DESCRIPTION = "Edit files using LINE#ID format for precise, safe modifications.\n\nWORKFLOW:\n1. Read the file and copy exact LINE#ID anchors.\n2. Submit one edit call with all related operations for that file.\n3. If more edits are needed after success, use the latest anchors from read/edit output.\n4. Use anchors as \"LINE#ID\" only (never include trailing \":content\").\n\nVALIDATION:\n- Payload shape: { \"filePath\": string, \"edits\": [...], \"delete\"?: boolean, \"rename\"?: string }\n- Each edit must be one of: set_line, replace_lines, insert_after, insert_before, insert_between, replace\n- text/new_text must contain plain replacement text only (no LINE#ID prefixes, no diff + markers)\n\nLINE#ID FORMAT (CRITICAL - READ CAREFULLY):\nEach line reference must be in \"LINE#ID\" format where:\n- LINE: 1-based line number\n- ID: Two CID letters from the set ZPMQVRWSNKTXJBYH\n\nOPERATION TYPES:\n1. set_line\n2. replace_lines\n3. insert_after\n4. insert_before\n5. insert_between\n6. replace\n\nFILE MODES:\n- delete=true deletes file and requires edits=[] with no rename\n- rename moves final content to a new path and removes old path\n\nCONTENT FORMAT:\n- text/new_text can be a string (single line) or string[] (multi-line, preferred).\n- If you pass a multi-line string, it is split by real newline characters.\n- Literal \"\\n\" is preserved as text.";
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
export interface SetLine {
|
|
2
2
|
type: "set_line";
|
|
3
3
|
line: string;
|
|
4
|
-
text: string;
|
|
4
|
+
text: string | string[];
|
|
5
5
|
}
|
|
6
6
|
export interface ReplaceLines {
|
|
7
7
|
type: "replace_lines";
|
|
8
8
|
start_line: string;
|
|
9
9
|
end_line: string;
|
|
10
|
-
text: string;
|
|
10
|
+
text: string | string[];
|
|
11
11
|
}
|
|
12
12
|
export interface InsertAfter {
|
|
13
13
|
type: "insert_after";
|
|
14
14
|
line: string;
|
|
15
|
-
text: string;
|
|
15
|
+
text: string | string[];
|
|
16
|
+
}
|
|
17
|
+
export interface InsertBefore {
|
|
18
|
+
type: "insert_before";
|
|
19
|
+
line: string;
|
|
20
|
+
text: string | string[];
|
|
21
|
+
}
|
|
22
|
+
export interface InsertBetween {
|
|
23
|
+
type: "insert_between";
|
|
24
|
+
after_line: string;
|
|
25
|
+
before_line: string;
|
|
26
|
+
text: string | string[];
|
|
16
27
|
}
|
|
17
28
|
export interface Replace {
|
|
18
29
|
type: "replace";
|
|
19
30
|
old_text: string;
|
|
20
|
-
new_text: string;
|
|
31
|
+
new_text: string | string[];
|
|
21
32
|
}
|
|
22
|
-
export type HashlineEdit = SetLine | ReplaceLines | InsertAfter | Replace;
|
|
33
|
+
export type HashlineEdit = SetLine | ReplaceLines | InsertAfter | InsertBefore | InsertBetween | Replace;
|