oh-my-claudecode-opencode 0.1.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.md +361 -0
- package/assets/AGENTS.md +357 -0
- package/assets/omco.example.json +34 -0
- package/assets/omco.schema.json +375 -0
- package/dist/agents/index.d.ts +139 -0
- package/dist/config/index.d.ts +179 -0
- package/dist/config/model-resolver.d.ts +46 -0
- package/dist/hooks/agent-usage-reminder.d.ts +12 -0
- package/dist/hooks/autopilot.d.ts +32 -0
- package/dist/hooks/context-recovery.d.ts +15 -0
- package/dist/hooks/continuation-messages.d.ts +24 -0
- package/dist/hooks/edit-error-recovery.d.ts +33 -0
- package/dist/hooks/index.d.ts +23 -0
- package/dist/hooks/keyword-detector.d.ts +23 -0
- package/dist/hooks/notepad.d.ts +109 -0
- package/dist/hooks/omc-orchestrator.d.ts +14 -0
- package/dist/hooks/persistent-mode.d.ts +60 -0
- package/dist/hooks/ralph-loop.d.ts +37 -0
- package/dist/hooks/ralph-verifier.d.ts +22 -0
- package/dist/hooks/remember-tag-processor.d.ts +47 -0
- package/dist/hooks/session-recovery.d.ts +10 -0
- package/dist/hooks/skill-injector.d.ts +16 -0
- package/dist/hooks/system-prompt-injector.d.ts +24 -0
- package/dist/hooks/todo-continuation-enforcer.d.ts +21 -0
- package/dist/hooks/tui-status.d.ts +72 -0
- package/dist/hooks/ultraqa-loop.d.ts +38 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +31047 -0
- package/dist/plugin-handlers/config-handler.d.ts +35 -0
- package/dist/plugin-handlers/index.d.ts +1 -0
- package/dist/prd/index.d.ts +2 -0
- package/dist/prd/prd-manager.d.ts +34 -0
- package/dist/prd/progress-tracker.d.ts +22 -0
- package/dist/prompts/ultrawork.d.ts +3 -0
- package/dist/shared/logger.d.ts +3 -0
- package/dist/shared/session-state.d.ts +5 -0
- package/dist/state/autopilot-state.d.ts +30 -0
- package/dist/state/index.d.ts +5 -0
- package/dist/state/ralph-state.d.ts +18 -0
- package/dist/state/ultraqa-state.d.ts +34 -0
- package/dist/state/ultrawork-state.d.ts +13 -0
- package/dist/state/verification-state.d.ts +15 -0
- package/dist/tools/background-manager.d.ts +22 -0
- package/dist/tools/background-tools.d.ts +3 -0
- package/dist/tools/builtin.d.ts +1 -0
- package/dist/tools/call-omo-agent.d.ts +3 -0
- package/dist/tools/index.d.ts +4 -0
- package/package.json +63 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const AgentConfigSchema: z.ZodObject<{
|
|
3
|
+
model: z.ZodOptional<z.ZodString>;
|
|
4
|
+
tier: z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
haiku: "haiku";
|
|
6
|
+
sonnet: "sonnet";
|
|
7
|
+
opus: "opus";
|
|
8
|
+
}>>;
|
|
9
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
declare const ModelMappingConfigSchema: z.ZodObject<{
|
|
15
|
+
tierDefaults: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
haiku: z.ZodOptional<z.ZodString>;
|
|
17
|
+
sonnet: z.ZodOptional<z.ZodString>;
|
|
18
|
+
opus: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
debugLogging: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
declare const BackgroundTaskConfigSchema: z.ZodObject<{
|
|
23
|
+
defaultConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
providerConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
25
|
+
modelConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
declare const RalphLoopConfigSchema: z.ZodObject<{
|
|
28
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
default_max_iterations: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
declare const AutopilotConfigSchema: z.ZodObject<{
|
|
32
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
maxPhaseRetries: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
delegationEnforcement: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
strict: "strict";
|
|
36
|
+
warn: "warn";
|
|
37
|
+
off: "off";
|
|
38
|
+
}>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
declare const UltraQAConfigSchema: z.ZodObject<{
|
|
41
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
maxIterations: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
buildCommand: z.ZodOptional<z.ZodString>;
|
|
44
|
+
testCommand: z.ZodOptional<z.ZodString>;
|
|
45
|
+
lintCommand: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
declare const ScientistConfigSchema: z.ZodObject<{
|
|
48
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
replFallback: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
bash: "bash";
|
|
51
|
+
disabled: "disabled";
|
|
52
|
+
}>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
declare const OrchestratorConfigSchema: z.ZodObject<{
|
|
55
|
+
delegationEnforcement: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
strict: "strict";
|
|
57
|
+
warn: "warn";
|
|
58
|
+
off: "off";
|
|
59
|
+
}>>;
|
|
60
|
+
auditLogEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
declare const ContextRecoveryConfigSchema: z.ZodObject<{
|
|
63
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
declare const EditErrorRecoveryConfigSchema: z.ZodObject<{
|
|
66
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
showToasts: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
declare const TuiStatusConfigSchema: z.ZodObject<{
|
|
71
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
showAgentNotifications: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
showModeChanges: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
toastDuration: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
trackMetrics: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type TuiStatusConfig = z.infer<typeof TuiStatusConfigSchema>;
|
|
78
|
+
declare const OmoOmcsConfigSchema: z.ZodObject<{
|
|
79
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
80
|
+
agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
81
|
+
model: z.ZodOptional<z.ZodString>;
|
|
82
|
+
tier: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
haiku: "haiku";
|
|
84
|
+
sonnet: "sonnet";
|
|
85
|
+
opus: "opus";
|
|
86
|
+
}>>;
|
|
87
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>>>;
|
|
92
|
+
model_mapping: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
tierDefaults: z.ZodOptional<z.ZodObject<{
|
|
94
|
+
haiku: z.ZodOptional<z.ZodString>;
|
|
95
|
+
sonnet: z.ZodOptional<z.ZodString>;
|
|
96
|
+
opus: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
debugLogging: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
disabled_hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
101
|
+
disabled_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
|
+
disabled_skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
disabled_mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
104
|
+
background_task: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
defaultConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
providerConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
107
|
+
modelConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
ralph_loop: z.ZodOptional<z.ZodObject<{
|
|
110
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
+
default_max_iterations: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
autopilot: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
maxPhaseRetries: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
delegationEnforcement: z.ZodOptional<z.ZodEnum<{
|
|
117
|
+
strict: "strict";
|
|
118
|
+
warn: "warn";
|
|
119
|
+
off: "off";
|
|
120
|
+
}>>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
ultraqa: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
+
maxIterations: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
buildCommand: z.ZodOptional<z.ZodString>;
|
|
126
|
+
testCommand: z.ZodOptional<z.ZodString>;
|
|
127
|
+
lintCommand: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
scientist: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
131
|
+
replFallback: z.ZodOptional<z.ZodEnum<{
|
|
132
|
+
bash: "bash";
|
|
133
|
+
disabled: "disabled";
|
|
134
|
+
}>>;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
orchestrator: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
delegationEnforcement: z.ZodOptional<z.ZodEnum<{
|
|
138
|
+
strict: "strict";
|
|
139
|
+
warn: "warn";
|
|
140
|
+
off: "off";
|
|
141
|
+
}>>;
|
|
142
|
+
auditLogEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
context_recovery: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
146
|
+
}, z.core.$strip>>;
|
|
147
|
+
edit_error_recovery: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
showToasts: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
tui_status: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
showAgentNotifications: z.ZodOptional<z.ZodBoolean>;
|
|
155
|
+
showModeChanges: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
toastDuration: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
trackMetrics: z.ZodOptional<z.ZodBoolean>;
|
|
158
|
+
}, z.core.$strip>>;
|
|
159
|
+
sisyphus_agent: z.ZodOptional<z.ZodObject<{
|
|
160
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
planner_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
+
replace_plan: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export type OmoOmcsConfig = z.infer<typeof OmoOmcsConfigSchema>;
|
|
166
|
+
export type AgentConfig = z.infer<typeof AgentConfigSchema>;
|
|
167
|
+
export type ModelMappingConfig = z.infer<typeof ModelMappingConfigSchema>;
|
|
168
|
+
export type BackgroundTaskConfig = z.infer<typeof BackgroundTaskConfigSchema>;
|
|
169
|
+
export type RalphLoopConfig = z.infer<typeof RalphLoopConfigSchema>;
|
|
170
|
+
export type AutopilotConfig = z.infer<typeof AutopilotConfigSchema>;
|
|
171
|
+
export type UltraQAConfig = z.infer<typeof UltraQAConfigSchema>;
|
|
172
|
+
export type ScientistConfig = z.infer<typeof ScientistConfigSchema>;
|
|
173
|
+
export type OrchestratorConfig = z.infer<typeof OrchestratorConfigSchema>;
|
|
174
|
+
export type ContextRecoveryConfig = z.infer<typeof ContextRecoveryConfigSchema>;
|
|
175
|
+
export type EditErrorRecoveryConfig = z.infer<typeof EditErrorRecoveryConfigSchema>;
|
|
176
|
+
export type HookName = "todo-continuation-enforcer" | "keyword-detector" | "ralph-loop" | "session-recovery" | "agent-usage-reminder" | "context-window-monitor" | "comment-checker" | "tool-output-truncator" | "system-prompt-injector" | "persistent-mode" | "remember-tag-processor" | "autopilot" | "ultraqa-loop" | "context-recovery" | "edit-error-recovery" | "omc-orchestrator";
|
|
177
|
+
export type AgentName = "oracle" | "librarian" | "explore" | "frontend-ui-ux-engineer" | "document-writer" | "multimodal-looker";
|
|
178
|
+
export declare function loadConfig(directory: string): OmoOmcsConfig;
|
|
179
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type ModelTier = "haiku" | "sonnet" | "opus";
|
|
2
|
+
export type ConcreteModel = string;
|
|
3
|
+
export interface TierModelMapping {
|
|
4
|
+
haiku: ConcreteModel;
|
|
5
|
+
sonnet: ConcreteModel;
|
|
6
|
+
opus: ConcreteModel;
|
|
7
|
+
}
|
|
8
|
+
export interface ModelMappingConfig {
|
|
9
|
+
tierDefaults?: Partial<TierModelMapping>;
|
|
10
|
+
debugLogging?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface AgentModelConfig {
|
|
13
|
+
model?: ConcreteModel;
|
|
14
|
+
tier?: ModelTier;
|
|
15
|
+
temperature?: number;
|
|
16
|
+
top_p?: number;
|
|
17
|
+
disable?: boolean;
|
|
18
|
+
prompt_append?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ModelResolutionResult {
|
|
21
|
+
model: ConcreteModel;
|
|
22
|
+
source: "per-agent-override" | "tier-default" | "hardcoded-fallback";
|
|
23
|
+
originalTier?: ModelTier;
|
|
24
|
+
}
|
|
25
|
+
export declare const HARDCODED_TIER_DEFAULTS: TierModelMapping;
|
|
26
|
+
/**
|
|
27
|
+
* Check if model follows "provider/model-name" pattern
|
|
28
|
+
*/
|
|
29
|
+
export declare function isValidModelFormat(model: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Log warning if invalid format
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateModelFormat(model: string, context: string): void;
|
|
34
|
+
export declare class ModelResolver {
|
|
35
|
+
private tierDefaults;
|
|
36
|
+
private debugLogging;
|
|
37
|
+
constructor(config?: ModelMappingConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Resolve model for an agent based on priority chain
|
|
40
|
+
*/
|
|
41
|
+
resolve(agentName: string, agentDefinitionTier: ModelTier | undefined, agentOverride?: AgentModelConfig): ModelResolutionResult;
|
|
42
|
+
/**
|
|
43
|
+
* Get current tier defaults
|
|
44
|
+
*/
|
|
45
|
+
getTierDefaults(): TierModelMapping;
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export declare function createAgentUsageReminderHook(_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,32 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import { type AutopilotState } from "../state/autopilot-state";
|
|
3
|
+
export interface AutopilotHookOptions {
|
|
4
|
+
config?: {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
maxPhaseRetries?: number;
|
|
7
|
+
delegationEnforcement?: 'strict' | 'warn' | 'off';
|
|
8
|
+
};
|
|
9
|
+
onPhaseChange?: (sessionId: string, phase: AutopilotState['phase']) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function createAutopilotHook(ctx: PluginInput, options?: AutopilotHookOptions): {
|
|
12
|
+
startAutopilot: (sessionId: string, task?: string) => void;
|
|
13
|
+
cancelAutopilot: (sessionId: string) => void;
|
|
14
|
+
getState: (sessionId: string) => AutopilotState | undefined;
|
|
15
|
+
isActive: (sessionId: string) => boolean;
|
|
16
|
+
"chat.message": (input: {
|
|
17
|
+
sessionID: string;
|
|
18
|
+
agent?: string;
|
|
19
|
+
}, output: {
|
|
20
|
+
message: unknown;
|
|
21
|
+
parts: Array<{
|
|
22
|
+
type: string;
|
|
23
|
+
text?: string;
|
|
24
|
+
}>;
|
|
25
|
+
}) => Promise<void>;
|
|
26
|
+
event: (input: {
|
|
27
|
+
event: {
|
|
28
|
+
type: string;
|
|
29
|
+
properties?: unknown;
|
|
30
|
+
};
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export interface ContextRecoveryOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function createContextRecoveryHook(_ctx: PluginInput, options?: ContextRecoveryOptions): {
|
|
6
|
+
"tool.execute.after": (input: {
|
|
7
|
+
tool: string;
|
|
8
|
+
sessionID: string;
|
|
9
|
+
callID: string;
|
|
10
|
+
}, output: {
|
|
11
|
+
title: string;
|
|
12
|
+
output: string;
|
|
13
|
+
metadata: any;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Continuation message variants to prevent pattern fatigue
|
|
3
|
+
* and provide contextual reminders
|
|
4
|
+
*/
|
|
5
|
+
export interface ContinuationContext {
|
|
6
|
+
completedCount: number;
|
|
7
|
+
totalCount: number;
|
|
8
|
+
nextTask?: string;
|
|
9
|
+
iteration?: number;
|
|
10
|
+
maxIterations?: number;
|
|
11
|
+
mode?: "todo" | "ralph-loop" | "ultrawork-ralph";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get a contextual continuation message
|
|
15
|
+
*/
|
|
16
|
+
export declare function getContinuationMessage(context: ContinuationContext): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get a progress summary message
|
|
19
|
+
*/
|
|
20
|
+
export declare function getProgressSummary(context: ContinuationContext): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get a short toast message
|
|
23
|
+
*/
|
|
24
|
+
export declare function getToastMessage(context: ContinuationContext): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export interface EditErrorRecoveryOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
maxRetries?: number;
|
|
5
|
+
showToasts?: boolean;
|
|
6
|
+
}
|
|
7
|
+
type ErrorType = "string_not_found" | "file_not_found" | "permission_denied" | "timeout" | "rate_limit" | "connection_error" | "unknown";
|
|
8
|
+
interface ErrorState {
|
|
9
|
+
tool: string;
|
|
10
|
+
consecutiveErrors: number;
|
|
11
|
+
lastErrorFile?: string;
|
|
12
|
+
lastErrorType: ErrorType;
|
|
13
|
+
lastErrorTime: number;
|
|
14
|
+
retryCount: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function createEditErrorRecoveryHook(ctx: PluginInput, options?: EditErrorRecoveryOptions): {
|
|
17
|
+
getErrorStats: (sessionId: string) => {
|
|
18
|
+
totalErrors: number;
|
|
19
|
+
errorsByType: Record<string, number>;
|
|
20
|
+
recentErrors: ErrorState[];
|
|
21
|
+
};
|
|
22
|
+
clearErrorState: (sessionId: string, key?: string) => void;
|
|
23
|
+
"tool.execute.after": (input: {
|
|
24
|
+
tool: string;
|
|
25
|
+
sessionID: string;
|
|
26
|
+
callID: string;
|
|
27
|
+
}, output: {
|
|
28
|
+
title: string;
|
|
29
|
+
output: string;
|
|
30
|
+
metadata: any;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { createTodoContinuationEnforcer } from "./todo-continuation-enforcer";
|
|
2
|
+
export { createKeywordDetectorHook } from "./keyword-detector";
|
|
3
|
+
export { createRalphLoopHook } from "./ralph-loop";
|
|
4
|
+
export { createSessionRecoveryHook } from "./session-recovery";
|
|
5
|
+
export { createAgentUsageReminderHook } from "./agent-usage-reminder";
|
|
6
|
+
export { createSystemPromptInjector } from "./system-prompt-injector";
|
|
7
|
+
export { createRalphVerifierHook } from "./ralph-verifier";
|
|
8
|
+
export { getContinuationMessage, getProgressSummary, getToastMessage } from "./continuation-messages";
|
|
9
|
+
export type { ContinuationContext } from "./continuation-messages";
|
|
10
|
+
export type { ActiveMode } from "./system-prompt-injector";
|
|
11
|
+
export type { PRD, UserStory } from "./ralph-loop";
|
|
12
|
+
export { createSkillInjector } from "./skill-injector";
|
|
13
|
+
export type { SkillInjection } from "./skill-injector";
|
|
14
|
+
export { initNotepad, readNotepad, getNotepadPath, getPriorityContext, getWorkingMemory, getManualSection, setPriorityContext, addWorkingMemoryEntry, addManualEntry, pruneOldEntries, getNotepadStats, formatNotepadContext, formatFullNotepad, processRememberTags, NOTEPAD_FILENAME, PRIORITY_HEADER, WORKING_MEMORY_HEADER, MANUAL_HEADER, DEFAULT_CONFIG as NOTEPAD_DEFAULT_CONFIG, } from "./notepad";
|
|
15
|
+
export type { NotepadConfig, NotepadStats, PriorityContextResult, PruneResult, } from "./notepad";
|
|
16
|
+
export { createPersistentModeHook, checkPersistentModes, resetTodoContinuationAttempts, } from "./persistent-mode";
|
|
17
|
+
export type { PersistentModeResult, PersistentModeOptions, } from "./persistent-mode";
|
|
18
|
+
export { createRememberTagProcessor, extractRememberTags, formatRememberTag, } from "./remember-tag-processor";
|
|
19
|
+
export type { RememberTagProcessorOptions } from "./remember-tag-processor";
|
|
20
|
+
export { createContextRecoveryHook, type ContextRecoveryOptions } from "./context-recovery";
|
|
21
|
+
export { createEditErrorRecoveryHook, type EditErrorRecoveryOptions } from "./edit-error-recovery";
|
|
22
|
+
export { createOmcOrchestratorHook, type OmcOrchestratorOptions } from "./omc-orchestrator";
|
|
23
|
+
export { createTuiStatusHook, type TuiStatusOptions } from "./tui-status";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { ActiveMode } from "./system-prompt-injector";
|
|
3
|
+
export interface KeywordDetectorOptions {
|
|
4
|
+
onModeChange?: (sessionID: string, mode: ActiveMode, task?: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function createKeywordDetectorHook(ctx: PluginInput, options?: KeywordDetectorOptions): {
|
|
7
|
+
"chat.message": (input: {
|
|
8
|
+
sessionID: string;
|
|
9
|
+
agent?: string;
|
|
10
|
+
model?: {
|
|
11
|
+
providerID: string;
|
|
12
|
+
modelID: string;
|
|
13
|
+
};
|
|
14
|
+
messageID?: string;
|
|
15
|
+
}, output: {
|
|
16
|
+
message: Record<string, unknown>;
|
|
17
|
+
parts: Array<{
|
|
18
|
+
type: string;
|
|
19
|
+
text?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
}) => Promise<void>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notepad Support - Compaction Resilient Memory
|
|
3
|
+
*
|
|
4
|
+
* Implements compaction-resilient memory persistence using notepad.md format.
|
|
5
|
+
* Provides a three-tier memory system:
|
|
6
|
+
* 1. Priority Context - Always loaded, critical discoveries (max 500 chars)
|
|
7
|
+
* 2. Working Memory - Session notes, auto-pruned after 7 days
|
|
8
|
+
* 3. MANUAL - User content, never auto-pruned
|
|
9
|
+
*
|
|
10
|
+
* Based on oh-my-claude-sisyphus notepad system.
|
|
11
|
+
*/
|
|
12
|
+
export interface NotepadConfig {
|
|
13
|
+
/** Maximum characters for Priority Context section */
|
|
14
|
+
priorityMaxChars: number;
|
|
15
|
+
/** Days to keep Working Memory entries before pruning */
|
|
16
|
+
workingMemoryDays: number;
|
|
17
|
+
/** Maximum total file size in bytes */
|
|
18
|
+
maxTotalSize: number;
|
|
19
|
+
}
|
|
20
|
+
export interface NotepadStats {
|
|
21
|
+
/** Whether notepad.md exists */
|
|
22
|
+
exists: boolean;
|
|
23
|
+
/** Total file size in bytes */
|
|
24
|
+
totalSize: number;
|
|
25
|
+
/** Priority Context section size in bytes */
|
|
26
|
+
prioritySize: number;
|
|
27
|
+
/** Number of Working Memory entries */
|
|
28
|
+
workingMemoryEntries: number;
|
|
29
|
+
/** ISO timestamp of oldest Working Memory entry */
|
|
30
|
+
oldestEntry: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface PriorityContextResult {
|
|
33
|
+
/** Whether the operation succeeded */
|
|
34
|
+
success: boolean;
|
|
35
|
+
/** Warning message if content exceeds limit */
|
|
36
|
+
warning?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PruneResult {
|
|
39
|
+
/** Number of entries pruned */
|
|
40
|
+
pruned: number;
|
|
41
|
+
/** Number of entries remaining */
|
|
42
|
+
remaining: number;
|
|
43
|
+
}
|
|
44
|
+
export declare const NOTEPAD_FILENAME = "notepad.md";
|
|
45
|
+
export declare const DEFAULT_CONFIG: NotepadConfig;
|
|
46
|
+
export declare const PRIORITY_HEADER = "## Priority Context";
|
|
47
|
+
export declare const WORKING_MEMORY_HEADER = "## Working Memory";
|
|
48
|
+
export declare const MANUAL_HEADER = "## MANUAL";
|
|
49
|
+
/**
|
|
50
|
+
* Get the path to notepad.md in .omc subdirectory
|
|
51
|
+
*/
|
|
52
|
+
export declare function getNotepadPath(directory: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Initialize notepad.md if it doesn't exist
|
|
55
|
+
*/
|
|
56
|
+
export declare function initNotepad(directory: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Read entire notepad content
|
|
59
|
+
*/
|
|
60
|
+
export declare function readNotepad(directory: string): string | null;
|
|
61
|
+
/**
|
|
62
|
+
* Get Priority Context section only (for injection)
|
|
63
|
+
*/
|
|
64
|
+
export declare function getPriorityContext(directory: string): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Get Working Memory section
|
|
67
|
+
*/
|
|
68
|
+
export declare function getWorkingMemory(directory: string): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Get MANUAL section
|
|
71
|
+
*/
|
|
72
|
+
export declare function getManualSection(directory: string): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Add/update Priority Context (replaces content, warns if over limit)
|
|
75
|
+
*/
|
|
76
|
+
export declare function setPriorityContext(directory: string, content: string, config?: NotepadConfig): PriorityContextResult;
|
|
77
|
+
/**
|
|
78
|
+
* Add entry to Working Memory with timestamp
|
|
79
|
+
*/
|
|
80
|
+
export declare function addWorkingMemoryEntry(directory: string, content: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Add to MANUAL section
|
|
83
|
+
*/
|
|
84
|
+
export declare function addManualEntry(directory: string, content: string): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Prune Working Memory entries older than N days
|
|
87
|
+
*/
|
|
88
|
+
export declare function pruneOldEntries(directory: string, daysOld?: number): PruneResult;
|
|
89
|
+
/**
|
|
90
|
+
* Get notepad stats
|
|
91
|
+
*/
|
|
92
|
+
export declare function getNotepadStats(directory: string): NotepadStats;
|
|
93
|
+
/**
|
|
94
|
+
* Format context for injection into session
|
|
95
|
+
*/
|
|
96
|
+
export declare function formatNotepadContext(directory: string): string | null;
|
|
97
|
+
/**
|
|
98
|
+
* Format full notepad for display
|
|
99
|
+
*/
|
|
100
|
+
export declare function formatFullNotepad(directory: string): string | null;
|
|
101
|
+
/**
|
|
102
|
+
* Process <remember> tags from tool output
|
|
103
|
+
* - <remember>content</remember> → Working Memory
|
|
104
|
+
* - <remember priority>content</remember> → Priority Context
|
|
105
|
+
*/
|
|
106
|
+
export declare function processRememberTags(directory: string, content: string): {
|
|
107
|
+
processed: number;
|
|
108
|
+
errors: number;
|
|
109
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export interface OmcOrchestratorOptions {
|
|
3
|
+
delegationEnforcement?: 'strict' | 'warn' | 'off';
|
|
4
|
+
auditLogEnabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function createOmcOrchestratorHook(ctx: PluginInput, options?: OmcOrchestratorOptions): {
|
|
7
|
+
"tool.execute.before": (input: {
|
|
8
|
+
tool: string;
|
|
9
|
+
sessionID: string;
|
|
10
|
+
callID: string;
|
|
11
|
+
}, output: {
|
|
12
|
+
args: Record<string, unknown>;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent Mode Handler
|
|
3
|
+
*
|
|
4
|
+
* Unified handler for persistent work modes: ultrawork, ralph-loop, and todo-continuation.
|
|
5
|
+
* This module intercepts session.idle events and enforces work continuation based on:
|
|
6
|
+
* 1. Active ralph-loop with incomplete promise
|
|
7
|
+
* 2. Active ultrawork mode with pending todos
|
|
8
|
+
* 3. Any pending todos (general enforcement)
|
|
9
|
+
*
|
|
10
|
+
* Priority order: Ralph Loop > Ultrawork > Todo Continuation
|
|
11
|
+
*
|
|
12
|
+
* Based on oh-my-claude-sisyphus persistent-mode hook.
|
|
13
|
+
*/
|
|
14
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
15
|
+
export interface PersistentModeResult {
|
|
16
|
+
/** Whether to inject a continuation message */
|
|
17
|
+
shouldContinue: boolean;
|
|
18
|
+
/** Message to inject into context */
|
|
19
|
+
message: string;
|
|
20
|
+
/** Which mode triggered the continuation */
|
|
21
|
+
mode: "ralph-loop" | "ultrawork" | "todo-continuation" | "none";
|
|
22
|
+
/** Additional metadata */
|
|
23
|
+
metadata?: {
|
|
24
|
+
todoCount?: number;
|
|
25
|
+
iteration?: number;
|
|
26
|
+
maxIterations?: number;
|
|
27
|
+
reinforcementCount?: number;
|
|
28
|
+
todoContinuationAttempts?: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface PersistentModeOptions {
|
|
32
|
+
/** Maximum todo-continuation attempts before giving up (prevents infinite loops) */
|
|
33
|
+
maxTodoContinuationAttempts?: number;
|
|
34
|
+
/** Whether to inject notepad context */
|
|
35
|
+
injectNotepadContext?: boolean;
|
|
36
|
+
/** Whether to prune old entries on session start */
|
|
37
|
+
pruneOnStart?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reset todo-continuation attempt counter (call when todos actually change)
|
|
41
|
+
*/
|
|
42
|
+
export declare function resetTodoContinuationAttempts(sessionId: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Main persistent mode checker
|
|
45
|
+
* Checks all persistent modes in priority order and returns appropriate action
|
|
46
|
+
*/
|
|
47
|
+
export declare function checkPersistentModes(ctx: PluginInput, sessionId: string, options?: PersistentModeOptions): Promise<PersistentModeResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Create the persistent mode hook
|
|
50
|
+
*/
|
|
51
|
+
export declare function createPersistentModeHook(ctx: PluginInput, options?: PersistentModeOptions): {
|
|
52
|
+
/**
|
|
53
|
+
* Check persistent modes on session.idle
|
|
54
|
+
*/
|
|
55
|
+
checkOnIdle: (sessionId: string) => Promise<PersistentModeResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Reset continuation attempts (call when todos change)
|
|
58
|
+
*/
|
|
59
|
+
resetAttempts: (sessionId: string) => void;
|
|
60
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { RalphLoopConfig } from "../config";
|
|
3
|
+
import type { ActiveMode } from "./system-prompt-injector";
|
|
4
|
+
import { type PRD, type UserStory } from "../prd/prd-manager";
|
|
5
|
+
export type { PRD, UserStory };
|
|
6
|
+
interface RalphLoopState {
|
|
7
|
+
sessionID: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
iteration: number;
|
|
10
|
+
maxIterations: number;
|
|
11
|
+
completionPromise: string;
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
startedAt: number;
|
|
14
|
+
mode: "ralph-loop" | "ultrawork-ralph";
|
|
15
|
+
prdPath?: string;
|
|
16
|
+
}
|
|
17
|
+
interface RalphLoopOptions {
|
|
18
|
+
config?: RalphLoopConfig;
|
|
19
|
+
onModeChange?: (sessionID: string, mode: ActiveMode, task?: string) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function createRalphLoopHook(ctx: PluginInput, options?: RalphLoopOptions): {
|
|
22
|
+
startLoop: (sessionID: string, prompt: string, opts?: {
|
|
23
|
+
maxIterations?: number;
|
|
24
|
+
mode?: "ralph-loop" | "ultrawork-ralph";
|
|
25
|
+
}) => boolean;
|
|
26
|
+
cancelLoop: (sessionID: string) => boolean;
|
|
27
|
+
getState: (sessionID?: string) => RalphLoopState | null;
|
|
28
|
+
event: (input: {
|
|
29
|
+
event: {
|
|
30
|
+
type: string;
|
|
31
|
+
properties?: unknown;
|
|
32
|
+
};
|
|
33
|
+
}) => Promise<void>;
|
|
34
|
+
readPrd: () => PRD | null;
|
|
35
|
+
writePrd: (prd: PRD) => void;
|
|
36
|
+
checkCompletionInContent: (content: string) => boolean;
|
|
37
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export interface RalphVerifierOptions {
|
|
3
|
+
maxVerificationAttempts?: number;
|
|
4
|
+
oracleModel?: string;
|
|
5
|
+
onVerified?: (sessionID: string) => void;
|
|
6
|
+
onRejected?: (sessionID: string, feedback: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createRalphVerifierHook(ctx: PluginInput, options?: RalphVerifierOptions): {
|
|
9
|
+
event: (input: {
|
|
10
|
+
event: {
|
|
11
|
+
type: string;
|
|
12
|
+
properties?: unknown;
|
|
13
|
+
};
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
isPendingVerification: () => boolean;
|
|
16
|
+
cancelVerification: () => void;
|
|
17
|
+
checkForCompletionClaim: (content: string) => string | null;
|
|
18
|
+
checkForOracleVerdict: (content: string) => {
|
|
19
|
+
approved: boolean;
|
|
20
|
+
feedback: string;
|
|
21
|
+
} | null;
|
|
22
|
+
};
|