oh-my-opencode 3.8.5 → 3.10.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/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +3 -3
- package/README.ru.md +367 -0
- package/README.zh-cn.md +3 -3
- package/bin/oh-my-opencode.js +96 -34
- package/bin/platform.d.ts +14 -0
- package/bin/platform.js +44 -0
- package/bin/platform.test.ts +56 -1
- package/dist/agents/atlas/agent.d.ts +1 -1
- package/dist/agents/dynamic-agent-prompt-builder.d.ts +1 -0
- package/dist/agents/env-context.d.ts +1 -1
- package/dist/agents/hephaestus.d.ts +1 -1
- package/dist/agents/sisyphus-gemini-overlays.d.ts +2 -0
- package/dist/agents/sisyphus.d.ts +1 -1
- package/dist/cli/config-manager/antigravity-provider-configuration.d.ts +3 -3
- package/dist/cli/index.js +208 -64
- package/dist/cli/run/event-state.d.ts +2 -0
- package/dist/cli/run/poll-for-completion.d.ts +2 -0
- package/dist/config/schema/agent-overrides.d.ts +1 -0
- package/dist/config/schema/categories.d.ts +2 -0
- package/dist/config/schema/hooks.d.ts +1 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +3 -12
- package/dist/create-hooks.d.ts +1 -0
- package/dist/features/background-agent/manager.d.ts +9 -0
- package/dist/features/boulder-state/storage.d.ts +1 -1
- package/dist/features/boulder-state/types.d.ts +2 -0
- package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
- package/dist/features/claude-code-plugin-loader/types.d.ts +13 -3
- package/dist/features/context-injector/types.d.ts +2 -2
- package/dist/features/hook-message-injector/injector.d.ts +2 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/types.d.ts +1 -0
- package/dist/hooks/atlas/boulder-continuation-injector.d.ts +1 -0
- package/dist/hooks/atlas/types.d.ts +1 -0
- package/dist/hooks/background-notification/hook.d.ts +11 -0
- package/dist/hooks/claude-code-hooks/dispatch-hook.d.ts +4 -0
- package/dist/hooks/claude-code-hooks/execute-http-hook.d.ts +4 -0
- package/dist/hooks/claude-code-hooks/types.d.ts +9 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/no-hephaestus-non-gpt/hook.d.ts +5 -1
- package/dist/hooks/ralph-loop/completion-promise-detector.d.ts +1 -0
- package/dist/hooks/ralph-loop/loop-state-controller.d.ts +2 -0
- package/dist/hooks/ralph-loop/ralph-loop-hook.d.ts +1 -0
- package/dist/hooks/ralph-loop/types.d.ts +1 -0
- package/dist/hooks/read-image-resizer/hook.d.ts +12 -0
- package/dist/hooks/read-image-resizer/image-dimensions.d.ts +2 -0
- package/dist/hooks/read-image-resizer/image-resizer.d.ts +3 -0
- package/dist/hooks/read-image-resizer/index.d.ts +1 -0
- package/dist/hooks/read-image-resizer/types.d.ts +14 -0
- package/dist/hooks/session-notification.d.ts +1 -0
- package/dist/hooks/start-work/index.d.ts +3 -0
- package/dist/hooks/start-work/parse-user-request.d.ts +5 -0
- package/dist/hooks/start-work/worktree-detector.d.ts +1 -0
- package/dist/hooks/stop-continuation-guard/hook.d.ts +6 -1
- package/dist/hooks/think-mode/hook.d.ts +14 -2
- package/dist/hooks/think-mode/switcher.d.ts +0 -56
- package/dist/hooks/think-mode/types.d.ts +1 -15
- package/dist/hooks/todo-continuation-enforcer/constants.d.ts +1 -1
- package/dist/hooks/todo-continuation-enforcer/pending-question-detection.d.ts +14 -0
- package/dist/index.js +2203 -704
- package/dist/oh-my-opencode.schema.json +10 -14
- package/dist/plugin/hooks/create-core-hooks.d.ts +1 -0
- package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +2 -1
- package/dist/shared/model-suggestion-retry.d.ts +4 -2
- package/dist/shared/prompt-timeout-context.d.ts +12 -0
- package/dist/shared/spawn-with-windows-hide.d.ts +15 -0
- package/dist/tools/delegate-task/category-resolver.d.ts +1 -0
- package/dist/tools/delegate-task/skill-resolver.d.ts +1 -0
- package/dist/tools/delegate-task/token-limiter.d.ts +4 -0
- package/dist/tools/delegate-task/types.d.ts +9 -0
- package/dist/tools/hashline-edit/tool-description.d.ts +1 -1
- package/dist/tools/hashline-edit/validation.d.ts +1 -0
- package/package.json +13 -8
- package/postinstall.mjs +23 -7
|
@@ -7,6 +7,8 @@ export interface EventState {
|
|
|
7
7
|
currentTool: string | null;
|
|
8
8
|
/** Set to true when the main session has produced meaningful work (text, tool call, or tool result) */
|
|
9
9
|
hasReceivedMeaningfulWork: boolean;
|
|
10
|
+
/** Timestamp of the last received event (for watchdog detection) */
|
|
11
|
+
lastEventTimestamp: number;
|
|
10
12
|
/** Count of assistant messages for the main session */
|
|
11
13
|
messageCount: number;
|
|
12
14
|
/** Current agent name from the latest assistant message */
|
|
@@ -4,5 +4,7 @@ export interface PollOptions {
|
|
|
4
4
|
pollIntervalMs?: number;
|
|
5
5
|
requiredConsecutive?: number;
|
|
6
6
|
minStabilizationMs?: number;
|
|
7
|
+
eventWatchdogMs?: number;
|
|
8
|
+
secondaryMeaningfulWorkTimeoutMs?: number;
|
|
7
9
|
}
|
|
8
10
|
export declare function pollForCompletion(ctx: RunContext, eventState: EventState, abortController: AbortController, options?: PollOptions): Promise<number>;
|
|
@@ -419,6 +419,7 @@ export declare const AgentOverridesSchema: z.ZodObject<{
|
|
|
419
419
|
model: z.ZodOptional<z.ZodString>;
|
|
420
420
|
variant: z.ZodOptional<z.ZodString>;
|
|
421
421
|
}, z.core.$strip>>;
|
|
422
|
+
allow_non_gpt_model: z.ZodOptional<z.ZodBoolean>;
|
|
422
423
|
}, z.core.$strip>>;
|
|
423
424
|
"sisyphus-junior": z.ZodOptional<z.ZodObject<{
|
|
424
425
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -27,6 +27,7 @@ export declare const CategoryConfigSchema: z.ZodObject<{
|
|
|
27
27
|
}>>;
|
|
28
28
|
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
29
29
|
prompt_append: z.ZodOptional<z.ZodString>;
|
|
30
|
+
max_prompt_tokens: z.ZodOptional<z.ZodNumber>;
|
|
30
31
|
is_unstable_agent: z.ZodOptional<z.ZodBoolean>;
|
|
31
32
|
disable: z.ZodOptional<z.ZodBoolean>;
|
|
32
33
|
}, z.core.$strip>;
|
|
@@ -68,6 +69,7 @@ export declare const CategoriesConfigSchema: z.ZodRecord<z.ZodString, z.ZodObjec
|
|
|
68
69
|
}>>;
|
|
69
70
|
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
70
71
|
prompt_append: z.ZodOptional<z.ZodString>;
|
|
72
|
+
max_prompt_tokens: z.ZodOptional<z.ZodNumber>;
|
|
71
73
|
is_unstable_agent: z.ZodOptional<z.ZodBoolean>;
|
|
72
74
|
disable: z.ZodOptional<z.ZodBoolean>;
|
|
73
75
|
}, z.core.$strip>>;
|
|
@@ -46,5 +46,6 @@ export declare const HookNameSchema: z.ZodEnum<{
|
|
|
46
46
|
"write-existing-file-guard": "write-existing-file-guard";
|
|
47
47
|
"anthropic-effort": "anthropic-effort";
|
|
48
48
|
"hashline-read-enhancer": "hashline-read-enhancer";
|
|
49
|
+
"read-image-resizer": "read-image-resizer";
|
|
49
50
|
}>;
|
|
50
51
|
export type HookName = z.infer<typeof HookNameSchema>;
|
|
@@ -4,18 +4,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
4
4
|
new_task_system_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
5
5
|
default_run_agent: z.ZodOptional<z.ZodString>;
|
|
6
6
|
disabled_mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
|
-
disabled_agents: z.ZodOptional<z.ZodArray<z.
|
|
8
|
-
sisyphus: "sisyphus";
|
|
9
|
-
hephaestus: "hephaestus";
|
|
10
|
-
oracle: "oracle";
|
|
11
|
-
librarian: "librarian";
|
|
12
|
-
explore: "explore";
|
|
13
|
-
"multimodal-looker": "multimodal-looker";
|
|
14
|
-
metis: "metis";
|
|
15
|
-
momus: "momus";
|
|
16
|
-
atlas: "atlas";
|
|
17
|
-
prometheus: "prometheus";
|
|
18
|
-
}>>>;
|
|
7
|
+
disabled_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
8
|
disabled_skills: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
20
9
|
playwright: "playwright";
|
|
21
10
|
"agent-browser": "agent-browser";
|
|
@@ -372,6 +361,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
372
361
|
model: z.ZodOptional<z.ZodString>;
|
|
373
362
|
variant: z.ZodOptional<z.ZodString>;
|
|
374
363
|
}, z.core.$strip>>;
|
|
364
|
+
allow_non_gpt_model: z.ZodOptional<z.ZodBoolean>;
|
|
375
365
|
}, z.core.$strip>>;
|
|
376
366
|
"sisyphus-junior": z.ZodOptional<z.ZodObject<{
|
|
377
367
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -1242,6 +1232,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1242
1232
|
}>>;
|
|
1243
1233
|
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
1244
1234
|
prompt_append: z.ZodOptional<z.ZodString>;
|
|
1235
|
+
max_prompt_tokens: z.ZodOptional<z.ZodNumber>;
|
|
1245
1236
|
is_unstable_agent: z.ZodOptional<z.ZodBoolean>;
|
|
1246
1237
|
disable: z.ZodOptional<z.ZodBoolean>;
|
|
1247
1238
|
}, z.core.$strip>>>;
|
package/dist/create-hooks.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare function createHooks(args: {
|
|
|
38
38
|
writeExistingFileGuard: ReturnType<typeof import("./hooks").createWriteExistingFileGuardHook> | null;
|
|
39
39
|
hashlineReadEnhancer: ReturnType<typeof import("./hooks").createHashlineReadEnhancerHook> | null;
|
|
40
40
|
jsonErrorRecovery: ReturnType<typeof import("./hooks").createJsonErrorRecoveryHook> | null;
|
|
41
|
+
readImageResizer: ReturnType<typeof import("./hooks").createReadImageResizerHook> | null;
|
|
41
42
|
contextWindowMonitor: ReturnType<typeof import("./hooks").createContextWindowMonitorHook> | null;
|
|
42
43
|
preemptiveCompaction: ReturnType<typeof import("./hooks").createPreemptiveCompactionHook> | null;
|
|
43
44
|
sessionRecovery: ReturnType<typeof import("./hooks").createSessionRecoveryHook> | null;
|
|
@@ -22,6 +22,7 @@ export type OnSubagentSessionCreated = (event: SubagentSessionCreatedEvent) => P
|
|
|
22
22
|
export declare class BackgroundManager {
|
|
23
23
|
private tasks;
|
|
24
24
|
private notifications;
|
|
25
|
+
private pendingNotifications;
|
|
25
26
|
private pendingByParent;
|
|
26
27
|
private client;
|
|
27
28
|
private directory;
|
|
@@ -74,6 +75,14 @@ export declare class BackgroundManager {
|
|
|
74
75
|
markForNotification(task: BackgroundTask): void;
|
|
75
76
|
getPendingNotifications(sessionID: string): BackgroundTask[];
|
|
76
77
|
clearNotifications(sessionID: string): void;
|
|
78
|
+
queuePendingNotification(sessionID: string | undefined, notification: string): void;
|
|
79
|
+
injectPendingNotificationsIntoChatMessage(output: {
|
|
80
|
+
parts: Array<{
|
|
81
|
+
type: string;
|
|
82
|
+
text?: string;
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}>;
|
|
85
|
+
}, sessionID: string): void;
|
|
77
86
|
/**
|
|
78
87
|
* Validates that a session has actual assistant/tool output before marking complete.
|
|
79
88
|
* Prevents premature completion when session.idle fires before agent responds.
|
|
@@ -25,4 +25,4 @@ export declare function getPlanName(planPath: string): string;
|
|
|
25
25
|
/**
|
|
26
26
|
* Create a new boulder state for a plan.
|
|
27
27
|
*/
|
|
28
|
-
export declare function createBoulderState(planPath: string, sessionId: string, agent?: string): BoulderState;
|
|
28
|
+
export declare function createBoulderState(planPath: string, sessionId: string, agent?: string, worktreePath?: string): BoulderState;
|
|
@@ -15,6 +15,8 @@ export interface BoulderState {
|
|
|
15
15
|
plan_name: string;
|
|
16
16
|
/** Agent type to use when resuming (e.g., 'atlas') */
|
|
17
17
|
agent?: string;
|
|
18
|
+
/** Absolute path to the git worktree root where work happens */
|
|
19
|
+
worktree_path?: string;
|
|
18
20
|
}
|
|
19
21
|
export interface PlanProgress {
|
|
20
22
|
/** Total number of checkboxes */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const START_WORK_TEMPLATE = "You are starting a Sisyphus work session.\n\n## WHAT TO DO\n\n1. **Find available plans**: Search for Prometheus-generated plan files at `.sisyphus/plans/`\n\n2. **Check for active boulder state**: Read `.sisyphus/boulder.json` if it exists\n\n3. **Decision logic**:\n - If `.sisyphus/boulder.json` exists AND plan is NOT complete (has unchecked boxes):\n - **APPEND** current session to session_ids\n - Continue work on existing plan\n - If no active plan OR plan is complete:\n - List available plan files\n - If ONE plan: auto-select it\n - If MULTIPLE plans: show list with timestamps, ask user to select\n\n4. **Create/Update boulder.json**:\n ```json\n {\n \"active_plan\": \"/absolute/path/to/plan.md\",\n \"started_at\": \"ISO_TIMESTAMP\",\n \"session_ids\": [\"session_id_1\", \"session_id_2\"],\n \"plan_name\": \"plan-name\"\n }\n ```\n\
|
|
1
|
+
export declare const START_WORK_TEMPLATE = "You are starting a Sisyphus work session.\n\n## ARGUMENTS\n\n- `/start-work [plan-name] [--worktree <path>]`\n - `plan-name` (optional): name or partial match of the plan to start\n - `--worktree <path>` (optional): absolute path to an existing git worktree to work in\n - If specified and valid: hook pre-sets worktree_path in boulder.json\n - If specified but invalid: you must run `git worktree add <path> <branch>` first\n - If omitted: you MUST choose or create a worktree (see Worktree Setup below)\n\n## WHAT TO DO\n\n1. **Find available plans**: Search for Prometheus-generated plan files at `.sisyphus/plans/`\n\n2. **Check for active boulder state**: Read `.sisyphus/boulder.json` if it exists\n\n3. **Decision logic**:\n - If `.sisyphus/boulder.json` exists AND plan is NOT complete (has unchecked boxes):\n - **APPEND** current session to session_ids\n - Continue work on existing plan\n - If no active plan OR plan is complete:\n - List available plan files\n - If ONE plan: auto-select it\n - If MULTIPLE plans: show list with timestamps, ask user to select\n\n4. **Worktree Setup** (when `worktree_path` not already set in boulder.json):\n 1. `git worktree list --porcelain` \u2014 see available worktrees\n 2. Create: `git worktree add <absolute-path> <branch-or-HEAD>`\n 3. Update boulder.json to add `\"worktree_path\": \"<absolute-path>\"`\n 4. All work happens inside that worktree directory\n\n5. **Create/Update boulder.json**:\n ```json\n {\n \"active_plan\": \"/absolute/path/to/plan.md\",\n \"started_at\": \"ISO_TIMESTAMP\",\n \"session_ids\": [\"session_id_1\", \"session_id_2\"],\n \"plan_name\": \"plan-name\",\n \"worktree_path\": \"/absolute/path/to/git/worktree\"\n }\n ```\n\n6. **Read the plan file** and start executing tasks according to atlas workflow\n\n## OUTPUT FORMAT\n\nWhen listing plans for selection:\n```\nAvailable Work Plans\n\nCurrent Time: {ISO timestamp}\nSession ID: {current session id}\n\n1. [plan-name-1.md] - Modified: {date} - Progress: 3/10 tasks\n2. [plan-name-2.md] - Modified: {date} - Progress: 0/5 tasks\n\nWhich plan would you like to work on? (Enter number or plan name)\n```\n\nWhen resuming existing work:\n```\nResuming Work Session\n\nActive Plan: {plan-name}\nProgress: {completed}/{total} tasks\nSessions: {count} (appending current session)\nWorktree: {worktree_path}\n\nReading plan and continuing from last incomplete task...\n```\n\nWhen auto-selecting single plan:\n```\nStarting Work Session\n\nPlan: {plan-name}\nSession ID: {session_id}\nStarted: {timestamp}\nWorktree: {worktree_path}\n\nReading plan and beginning execution...\n```\n\n## CRITICAL\n\n- The session_id is injected by the hook - use it directly\n- Always update boulder.json BEFORE starting work\n- Always set worktree_path in boulder.json before executing any tasks\n- Read the FULL plan file before delegating any tasks\n- Follow atlas delegation protocols (7-section format)";
|
|
@@ -70,12 +70,22 @@ export interface PluginManifest {
|
|
|
70
70
|
/**
|
|
71
71
|
* Hooks configuration
|
|
72
72
|
*/
|
|
73
|
-
export
|
|
74
|
-
type: "command"
|
|
73
|
+
export type HookEntry = {
|
|
74
|
+
type: "command";
|
|
75
75
|
command?: string;
|
|
76
|
+
} | {
|
|
77
|
+
type: "prompt";
|
|
76
78
|
prompt?: string;
|
|
79
|
+
} | {
|
|
80
|
+
type: "agent";
|
|
77
81
|
agent?: string;
|
|
78
|
-
}
|
|
82
|
+
} | {
|
|
83
|
+
type: "http";
|
|
84
|
+
url: string;
|
|
85
|
+
headers?: Record<string, string>;
|
|
86
|
+
allowedEnvVars?: string[];
|
|
87
|
+
timeout?: number;
|
|
88
|
+
};
|
|
79
89
|
export interface HookMatcher {
|
|
80
90
|
matcher?: string;
|
|
81
91
|
hooks: HookEntry[];
|
|
@@ -20,8 +20,8 @@ export interface ContextEntry {
|
|
|
20
20
|
content: string;
|
|
21
21
|
/** Priority for ordering (default: normal) */
|
|
22
22
|
priority: ContextPriority;
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/** Monotonic order when registered */
|
|
24
|
+
registrationOrder: number;
|
|
25
25
|
/** Optional metadata for debugging/logging */
|
|
26
26
|
metadata?: Record<string, unknown>;
|
|
27
27
|
}
|
|
@@ -41,6 +41,8 @@ export declare function findNearestMessageWithFields(messageDir: string): Stored
|
|
|
41
41
|
* @deprecated Use findFirstMessageWithAgentFromSDK for beta/SQLite backend
|
|
42
42
|
*/
|
|
43
43
|
export declare function findFirstMessageWithAgent(messageDir: string): string | null;
|
|
44
|
+
export declare function generateMessageId(): string;
|
|
45
|
+
export declare function generatePartId(): string;
|
|
44
46
|
/**
|
|
45
47
|
* Injects a hook message into the session storage.
|
|
46
48
|
*
|
|
@@ -6,6 +6,16 @@ interface Event {
|
|
|
6
6
|
interface EventInput {
|
|
7
7
|
event: Event;
|
|
8
8
|
}
|
|
9
|
+
interface ChatMessageInput {
|
|
10
|
+
sessionID: string;
|
|
11
|
+
}
|
|
12
|
+
interface ChatMessageOutput {
|
|
13
|
+
parts: Array<{
|
|
14
|
+
type: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
9
19
|
/**
|
|
10
20
|
* Background notification hook - handles event routing to BackgroundManager.
|
|
11
21
|
*
|
|
@@ -13,6 +23,7 @@ interface EventInput {
|
|
|
13
23
|
* from the manager, so this hook only needs to handle event routing.
|
|
14
24
|
*/
|
|
15
25
|
export declare function createBackgroundNotificationHook(manager: BackgroundManager): {
|
|
26
|
+
"chat.message": (input: ChatMessageInput, output: ChatMessageOutput) => Promise<void>;
|
|
16
27
|
event: ({ event }: EventInput) => Promise<void>;
|
|
17
28
|
};
|
|
18
29
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HookAction } from "./types";
|
|
2
|
+
import type { CommandResult } from "../../shared/command-executor/execute-hook-command";
|
|
3
|
+
export declare function getHookIdentifier(hook: HookAction): string;
|
|
4
|
+
export declare function dispatchHook(hook: HookAction, stdinJson: string, cwd: string): Promise<CommandResult>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HookHttp } from "./types";
|
|
2
|
+
import type { CommandResult } from "../../shared/command-executor/execute-hook-command";
|
|
3
|
+
export declare function interpolateEnvVars(value: string, allowedEnvVars: string[]): string;
|
|
4
|
+
export declare function executeHttpHook(hook: HookHttp, stdin: string): Promise<CommandResult>;
|
|
@@ -5,12 +5,20 @@
|
|
|
5
5
|
export type ClaudeHookEvent = "PreToolUse" | "PostToolUse" | "UserPromptSubmit" | "Stop" | "PreCompact";
|
|
6
6
|
export interface HookMatcher {
|
|
7
7
|
matcher: string;
|
|
8
|
-
hooks:
|
|
8
|
+
hooks: HookAction[];
|
|
9
9
|
}
|
|
10
10
|
export interface HookCommand {
|
|
11
11
|
type: "command";
|
|
12
12
|
command: string;
|
|
13
13
|
}
|
|
14
|
+
export interface HookHttp {
|
|
15
|
+
type: "http";
|
|
16
|
+
url: string;
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
allowedEnvVars?: string[];
|
|
19
|
+
timeout?: number;
|
|
20
|
+
}
|
|
21
|
+
export type HookAction = HookCommand | HookHttp;
|
|
14
22
|
export interface ClaudeHooksConfig {
|
|
15
23
|
PreToolUse?: HookMatcher[];
|
|
16
24
|
PostToolUse?: HookMatcher[];
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -46,3 +46,4 @@ export { createRuntimeFallbackHook, type RuntimeFallbackHook, type RuntimeFallba
|
|
|
46
46
|
export { createWriteExistingFileGuardHook } from "./write-existing-file-guard";
|
|
47
47
|
export { createHashlineReadEnhancerHook } from "./hashline-read-enhancer";
|
|
48
48
|
export { createJsonErrorRecoveryHook, JSON_ERROR_TOOL_EXCLUDE_LIST, JSON_ERROR_PATTERNS, JSON_ERROR_REMINDER } from "./json-error-recovery";
|
|
49
|
+
export { createReadImageResizerHook } from "./read-image-resizer";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
|
|
2
|
+
type NoHephaestusNonGptHookOptions = {
|
|
3
|
+
allowNonGptModel?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare function createNoHephaestusNonGptHook(ctx: PluginInput, options?: NoHephaestusNonGptHookOptions): {
|
|
3
6
|
"chat.message": (input: {
|
|
4
7
|
sessionID: string;
|
|
5
8
|
agent?: string;
|
|
@@ -14,3 +17,4 @@ export declare function createNoHephaestusNonGptHook(ctx: PluginInput): {
|
|
|
14
17
|
};
|
|
15
18
|
}) => Promise<void>;
|
|
16
19
|
};
|
|
20
|
+
export {};
|
|
@@ -7,6 +7,7 @@ export declare function createLoopStateController(options: {
|
|
|
7
7
|
startLoop(sessionID: string, prompt: string, loopOptions?: {
|
|
8
8
|
maxIterations?: number;
|
|
9
9
|
completionPromise?: string;
|
|
10
|
+
messageCountAtStart?: number;
|
|
10
11
|
ultrawork?: boolean;
|
|
11
12
|
strategy?: "reset" | "continue";
|
|
12
13
|
}): boolean;
|
|
@@ -15,4 +16,5 @@ export declare function createLoopStateController(options: {
|
|
|
15
16
|
clear(): boolean;
|
|
16
17
|
incrementIteration(): RalphLoopState | null;
|
|
17
18
|
setSessionID(sessionID: string): RalphLoopState | null;
|
|
19
|
+
setMessageCountAtStart(sessionID: string, messageCountAtStart: number): RalphLoopState | null;
|
|
18
20
|
};
|
|
@@ -10,6 +10,7 @@ export interface RalphLoopHook {
|
|
|
10
10
|
startLoop: (sessionID: string, prompt: string, options?: {
|
|
11
11
|
maxIterations?: number;
|
|
12
12
|
completionPromise?: string;
|
|
13
|
+
messageCountAtStart?: number;
|
|
13
14
|
ultrawork?: boolean;
|
|
14
15
|
strategy?: "reset" | "continue";
|
|
15
16
|
}) => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export declare function createReadImageResizerHook(_ctx: PluginInput): {
|
|
3
|
+
"tool.execute.after": (input: {
|
|
4
|
+
tool: string;
|
|
5
|
+
sessionID: string;
|
|
6
|
+
callID: string;
|
|
7
|
+
}, output: {
|
|
8
|
+
title: string;
|
|
9
|
+
output: string;
|
|
10
|
+
metadata: unknown;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ImageDimensions, ResizeResult } from "./types";
|
|
2
|
+
export declare function calculateTargetDimensions(width: number, height: number, maxLongEdge?: number): ImageDimensions | null;
|
|
3
|
+
export declare function resizeImage(base64DataUrl: string, mimeType: string, target: ImageDimensions): Promise<ResizeResult | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createReadImageResizerHook } from "./hook";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ImageDimensions {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ImageAttachment {
|
|
6
|
+
mime: string;
|
|
7
|
+
url: string;
|
|
8
|
+
filename?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ResizeResult {
|
|
11
|
+
resizedDataUrl: string;
|
|
12
|
+
original: ImageDimensions;
|
|
13
|
+
resized: ImageDimensions;
|
|
14
|
+
}
|
|
@@ -12,6 +12,7 @@ interface SessionNotificationConfig {
|
|
|
12
12
|
skipIfIncompleteTodos?: boolean;
|
|
13
13
|
/** Maximum number of sessions to track before cleanup (default: 100) */
|
|
14
14
|
maxTrackedSessions?: number;
|
|
15
|
+
enforceMainSessionFilter?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare function createSessionNotification(ctx: PluginInput, config?: SessionNotificationConfig): ({ event }: {
|
|
17
18
|
event: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectWorktreePath(directory: string): string | null;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { BackgroundManager } from "../../features/background-agent";
|
|
3
|
+
type StopContinuationBackgroundManager = Pick<BackgroundManager, "getAllDescendantTasks" | "cancelTask">;
|
|
2
4
|
export interface StopContinuationGuard {
|
|
3
5
|
event: (input: {
|
|
4
6
|
event: {
|
|
@@ -13,4 +15,7 @@ export interface StopContinuationGuard {
|
|
|
13
15
|
isStopped: (sessionID: string) => boolean;
|
|
14
16
|
clear: (sessionID: string) => void;
|
|
15
17
|
}
|
|
16
|
-
export declare function createStopContinuationGuardHook(ctx: PluginInput
|
|
18
|
+
export declare function createStopContinuationGuardHook(ctx: PluginInput, options?: {
|
|
19
|
+
backgroundManager?: StopContinuationBackgroundManager;
|
|
20
|
+
}): StopContinuationGuard;
|
|
21
|
+
export {};
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import type { ThinkModeInput } from "./types";
|
|
2
1
|
export declare function clearThinkModeState(sessionID: string): void;
|
|
3
2
|
export declare function createThinkModeHook(): {
|
|
4
|
-
"chat.
|
|
3
|
+
"chat.message": (input: {
|
|
4
|
+
sessionID: string;
|
|
5
|
+
model?: {
|
|
6
|
+
providerID: string;
|
|
7
|
+
modelID: string;
|
|
8
|
+
};
|
|
9
|
+
}, output: {
|
|
10
|
+
message: Record<string, unknown>;
|
|
11
|
+
parts: Array<{
|
|
12
|
+
type: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}>;
|
|
16
|
+
}) => Promise<void>;
|
|
5
17
|
event: ({ event }: {
|
|
6
18
|
event: {
|
|
7
19
|
type: string;
|
|
@@ -15,61 +15,5 @@
|
|
|
15
15
|
* Model IDs are normalized (dots → hyphens in version numbers) to handle API
|
|
16
16
|
* inconsistencies defensively while maintaining backwards compatibility.
|
|
17
17
|
*/
|
|
18
|
-
export declare const THINKING_CONFIGS: {
|
|
19
|
-
readonly anthropic: {
|
|
20
|
-
readonly thinking: {
|
|
21
|
-
readonly type: "enabled";
|
|
22
|
-
readonly budgetTokens: 64000;
|
|
23
|
-
};
|
|
24
|
-
readonly maxTokens: 128000;
|
|
25
|
-
};
|
|
26
|
-
readonly "google-vertex-anthropic": {
|
|
27
|
-
readonly thinking: {
|
|
28
|
-
readonly type: "enabled";
|
|
29
|
-
readonly budgetTokens: 64000;
|
|
30
|
-
};
|
|
31
|
-
readonly maxTokens: 128000;
|
|
32
|
-
};
|
|
33
|
-
readonly "amazon-bedrock": {
|
|
34
|
-
readonly reasoningConfig: {
|
|
35
|
-
readonly type: "enabled";
|
|
36
|
-
readonly budgetTokens: 32000;
|
|
37
|
-
};
|
|
38
|
-
readonly maxTokens: 64000;
|
|
39
|
-
};
|
|
40
|
-
readonly google: {
|
|
41
|
-
readonly providerOptions: {
|
|
42
|
-
readonly google: {
|
|
43
|
-
readonly thinkingConfig: {
|
|
44
|
-
readonly thinkingLevel: "HIGH";
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
readonly "google-vertex": {
|
|
50
|
-
readonly providerOptions: {
|
|
51
|
-
readonly "google-vertex": {
|
|
52
|
-
readonly thinkingConfig: {
|
|
53
|
-
readonly thinkingLevel: "HIGH";
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
readonly openai: {
|
|
59
|
-
readonly reasoning_effort: "high";
|
|
60
|
-
};
|
|
61
|
-
readonly "zai-coding-plan": {
|
|
62
|
-
readonly providerOptions: {
|
|
63
|
-
readonly "zai-coding-plan": {
|
|
64
|
-
readonly extra_body: {
|
|
65
|
-
readonly thinking: {
|
|
66
|
-
readonly type: "disabled";
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
18
|
export declare function getHighVariant(modelID: string): string | null;
|
|
74
19
|
export declare function isAlreadyHighVariant(modelID: string): boolean;
|
|
75
|
-
export declare function getThinkingConfig(providerID: string, modelID: string): Record<string, unknown> | null;
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
export interface ThinkModeState {
|
|
2
2
|
requested: boolean;
|
|
3
3
|
modelSwitched: boolean;
|
|
4
|
-
|
|
4
|
+
variantSet: boolean;
|
|
5
5
|
providerID?: string;
|
|
6
6
|
modelID?: string;
|
|
7
7
|
}
|
|
8
|
-
export interface ModelRef {
|
|
9
|
-
providerID: string;
|
|
10
|
-
modelID: string;
|
|
11
|
-
}
|
|
12
|
-
export interface MessageWithModel {
|
|
13
|
-
model?: ModelRef;
|
|
14
|
-
}
|
|
15
|
-
export interface ThinkModeInput {
|
|
16
|
-
parts: Array<{
|
|
17
|
-
type: string;
|
|
18
|
-
text?: string;
|
|
19
|
-
}>;
|
|
20
|
-
message: MessageWithModel;
|
|
21
|
-
}
|
|
@@ -5,6 +5,6 @@ export declare const COUNTDOWN_SECONDS = 2;
|
|
|
5
5
|
export declare const TOAST_DURATION_MS = 900;
|
|
6
6
|
export declare const COUNTDOWN_GRACE_PERIOD_MS = 500;
|
|
7
7
|
export declare const ABORT_WINDOW_MS = 3000;
|
|
8
|
-
export declare const CONTINUATION_COOLDOWN_MS =
|
|
8
|
+
export declare const CONTINUATION_COOLDOWN_MS = 5000;
|
|
9
9
|
export declare const MAX_CONSECUTIVE_FAILURES = 5;
|
|
10
10
|
export declare const FAILURE_RESET_WINDOW_MS: number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface MessagePart {
|
|
2
|
+
type: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
toolName?: string;
|
|
5
|
+
}
|
|
6
|
+
interface Message {
|
|
7
|
+
info?: {
|
|
8
|
+
role?: string;
|
|
9
|
+
};
|
|
10
|
+
role?: string;
|
|
11
|
+
parts?: MessagePart[];
|
|
12
|
+
}
|
|
13
|
+
export declare function hasUnansweredQuestion(messages: Message[]): boolean;
|
|
14
|
+
export {};
|