@skj1724/oh-my-opencode 3.19.4 → 3.19.6

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.
@@ -71,6 +71,7 @@ export declare const HookNameSchema: z.ZodEnum<{
71
71
  "edit-error-recovery": "edit-error-recovery";
72
72
  "delegate-task-retry": "delegate-task-retry";
73
73
  "prometheus-md-only": "prometheus-md-only";
74
+ "perf-profiler": "perf-profiler";
74
75
  "start-work": "start-work";
75
76
  }>;
76
77
  export declare const BuiltinCommandNameSchema: z.ZodEnum<{
@@ -890,6 +891,15 @@ export declare const DynamicContextPruningConfigSchema: z.ZodObject<{
890
891
  }, z.core.$strip>>;
891
892
  }, z.core.$strip>>;
892
893
  }, z.core.$strip>;
894
+ export declare const ProfilingConfigSchema: z.ZodObject<{
895
+ enabled: z.ZodDefault<z.ZodBoolean>;
896
+ output_dir: z.ZodOptional<z.ZodString>;
897
+ slow_threshold_ms: z.ZodDefault<z.ZodNumber>;
898
+ memory_snapshot_interval: z.ZodDefault<z.ZodNumber>;
899
+ trace_api: z.ZodDefault<z.ZodBoolean>;
900
+ trace_fileio: z.ZodDefault<z.ZodBoolean>;
901
+ trace_polling: z.ZodDefault<z.ZodBoolean>;
902
+ }, z.core.$strip>;
893
903
  export declare const ExperimentalConfigSchema: z.ZodObject<{
894
904
  aggressive_truncation: z.ZodOptional<z.ZodBoolean>;
895
905
  auto_resume: z.ZodOptional<z.ZodBoolean>;
@@ -920,6 +930,15 @@ export declare const ExperimentalConfigSchema: z.ZodObject<{
920
930
  }, z.core.$strip>>;
921
931
  }, z.core.$strip>>;
922
932
  }, z.core.$strip>>;
933
+ profiling: z.ZodOptional<z.ZodObject<{
934
+ enabled: z.ZodDefault<z.ZodBoolean>;
935
+ output_dir: z.ZodOptional<z.ZodString>;
936
+ slow_threshold_ms: z.ZodDefault<z.ZodNumber>;
937
+ memory_snapshot_interval: z.ZodDefault<z.ZodNumber>;
938
+ trace_api: z.ZodDefault<z.ZodBoolean>;
939
+ trace_fileio: z.ZodDefault<z.ZodBoolean>;
940
+ trace_polling: z.ZodDefault<z.ZodBoolean>;
941
+ }, z.core.$strip>>;
923
942
  }, z.core.$strip>;
924
943
  export declare const SkillSourceSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
925
944
  path: z.ZodString;
@@ -986,6 +1005,9 @@ export declare const BackgroundTaskConfigSchema: z.ZodObject<{
986
1005
  providerConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
987
1006
  modelConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
988
1007
  staleTimeoutMs: z.ZodOptional<z.ZodNumber>;
1008
+ maxSteps: z.ZodOptional<z.ZodNumber>;
1009
+ maxRuntimeMs: z.ZodOptional<z.ZodNumber>;
1010
+ stepTimeoutMs: z.ZodOptional<z.ZodNumber>;
989
1011
  }, z.core.$strip>;
990
1012
  export declare const NotificationConfigSchema: z.ZodObject<{
991
1013
  force_enable: z.ZodOptional<z.ZodBoolean>;
@@ -1043,6 +1065,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1043
1065
  "edit-error-recovery": "edit-error-recovery";
1044
1066
  "delegate-task-retry": "delegate-task-retry";
1045
1067
  "prometheus-md-only": "prometheus-md-only";
1068
+ "perf-profiler": "perf-profiler";
1046
1069
  "start-work": "start-work";
1047
1070
  }>>>;
1048
1071
  disabled_commands: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -1778,6 +1801,15 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1778
1801
  }, z.core.$strip>>;
1779
1802
  }, z.core.$strip>>;
1780
1803
  }, z.core.$strip>>;
1804
+ profiling: z.ZodOptional<z.ZodObject<{
1805
+ enabled: z.ZodDefault<z.ZodBoolean>;
1806
+ output_dir: z.ZodOptional<z.ZodString>;
1807
+ slow_threshold_ms: z.ZodDefault<z.ZodNumber>;
1808
+ memory_snapshot_interval: z.ZodDefault<z.ZodNumber>;
1809
+ trace_api: z.ZodDefault<z.ZodBoolean>;
1810
+ trace_fileio: z.ZodDefault<z.ZodBoolean>;
1811
+ trace_polling: z.ZodDefault<z.ZodBoolean>;
1812
+ }, z.core.$strip>>;
1781
1813
  }, z.core.$strip>>;
1782
1814
  auto_update: z.ZodOptional<z.ZodBoolean>;
1783
1815
  skills: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
@@ -1812,6 +1844,9 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1812
1844
  providerConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1813
1845
  modelConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1814
1846
  staleTimeoutMs: z.ZodOptional<z.ZodNumber>;
1847
+ maxSteps: z.ZodOptional<z.ZodNumber>;
1848
+ maxRuntimeMs: z.ZodOptional<z.ZodNumber>;
1849
+ stepTimeoutMs: z.ZodOptional<z.ZodNumber>;
1815
1850
  }, z.core.$strip>>;
1816
1851
  notification: z.ZodOptional<z.ZodObject<{
1817
1852
  force_enable: z.ZodOptional<z.ZodBoolean>;
@@ -1833,6 +1868,7 @@ export type SisyphusAgentConfig = z.infer<typeof SisyphusAgentConfigSchema>;
1833
1868
  export type CommentCheckerConfig = z.infer<typeof CommentCheckerConfigSchema>;
1834
1869
  export type ExperimentalConfig = z.infer<typeof ExperimentalConfigSchema>;
1835
1870
  export type DynamicContextPruningConfig = z.infer<typeof DynamicContextPruningConfigSchema>;
1871
+ export type ProfilingConfig = z.infer<typeof ProfilingConfigSchema>;
1836
1872
  export type SkillsConfig = z.infer<typeof SkillsConfigSchema>;
1837
1873
  export type SkillDefinition = z.infer<typeof SkillDefinitionSchema>;
1838
1874
  export type RalphLoopConfig = z.infer<typeof RalphLoopConfigSchema>;
@@ -1,5 +1,6 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
2
  import type { BackgroundTask, LaunchInput, ResumeInput } from "./types";
3
+ import type { PerfTracer } from "../../shared/perf-tracer";
3
4
  import type { BackgroundTaskConfig } from "../../config/schema";
4
5
  interface EventProperties {
5
6
  sessionID?: string;
@@ -26,9 +27,11 @@ export declare class BackgroundManager {
26
27
  private shutdownTriggered;
27
28
  private config?;
28
29
  private perfAggregator;
30
+ private perfTracer?;
29
31
  private queuesByKey;
30
32
  private processingKeys;
31
33
  constructor(ctx: PluginInput, config?: BackgroundTaskConfig);
34
+ setPerfTracer(tracer: PerfTracer): void;
32
35
  launch(input: LaunchInput): Promise<BackgroundTask>;
33
36
  private processKey;
34
37
  private startTask;
@@ -93,6 +96,9 @@ export declare class BackgroundManager {
93
96
  private hasRunningTasks;
94
97
  private pruneStaleTasksAndNotifications;
95
98
  private checkAndInterruptStaleTasks;
99
+ private isStepLimitExceeded;
100
+ private isRuntimeLimitExceeded;
101
+ private isStepTimeoutExceeded;
96
102
  private pollRunningTasks;
97
103
  /**
98
104
  * Shutdown the manager gracefully.
@@ -20,6 +20,8 @@ export interface TaskProgress {
20
20
  lastMessage?: string;
21
21
  lastMessageAt?: Date;
22
22
  phaseTiming?: PhaseTiming;
23
+ /** Timestamp when the current LLM step started (reset on each session.idle) */
24
+ stepStartedAt?: number;
23
25
  }
24
26
  export interface BackgroundTask {
25
27
  id: string;
@@ -55,6 +57,14 @@ export interface BackgroundTask {
55
57
  lastMsgCount?: number;
56
58
  /** Number of consecutive polls with stable message count */
57
59
  stablePolls?: number;
60
+ /** Step count (incremented on session.idle events) */
61
+ stepCount?: number;
62
+ /** Max steps before auto-completion (0 = unlimited) */
63
+ maxSteps?: number;
64
+ /** Max runtime in ms before auto-completion (0 / undefined = unlimited, uses TASK_TTL_MS) */
65
+ maxRuntimeMs?: number;
66
+ /** Max duration of a single step in ms (0 / undefined = unlimited) */
67
+ stepTimeoutMs?: number;
58
68
  }
59
69
  export interface LaunchInput {
60
70
  description: string;
@@ -8,11 +8,5 @@ export interface StoredMessage {
8
8
  tools?: Record<string, ToolPermission>;
9
9
  }
10
10
  export declare function findNearestMessageWithFields(messageDir: string): StoredMessage | null;
11
- /**
12
- * Finds the FIRST (oldest) message in the session with agent field.
13
- * This is used to get the original agent that started the session,
14
- * avoiding issues where newer messages may have a different agent
15
- * due to OpenCode's internal agent switching.
16
- */
17
11
  export declare function findFirstMessageWithAgent(messageDir: string): string | null;
18
12
  export declare function injectHookMessage(sessionID: string, hookContent: string, originalMessage: OriginalMessageContext): boolean;
@@ -6,6 +6,9 @@ export declare class TaskToastManager {
6
6
  private tasks;
7
7
  private client;
8
8
  private concurrencyManager?;
9
+ private completionBatch;
10
+ private completionDebounceTimer?;
11
+ private static COMPLETION_DEBOUNCE_MS;
9
12
  constructor(client: OpencodeClient, concurrencyManager?: ConcurrencyManager);
10
13
  setConcurrencyManager(manager: ConcurrencyManager): void;
11
14
  addTask(task: {
@@ -45,13 +48,14 @@ export declare class TaskToastManager {
45
48
  */
46
49
  private showTaskListToast;
47
50
  /**
48
- * Show task completion toast
51
+ * Show task completion toast with debounce to batch rapid completions.
49
52
  */
50
53
  showCompletionToast(task: {
51
54
  id: string;
52
55
  description: string;
53
56
  duration: string;
54
57
  }): void;
58
+ private flushCompletionBatch;
55
59
  }
56
60
  export declare function getTaskToastManager(): TaskToastManager | null;
57
61
  export declare function initTaskToastManager(client: OpencodeClient, concurrencyManager?: ConcurrencyManager): TaskToastManager;
@@ -28,3 +28,4 @@ export { createStartWorkHook } from "./start-work";
28
28
  export { createAtlasHook } from "./atlas";
29
29
  export { createDelegateTaskRetryHook } from "./delegate-task-retry";
30
30
  export { createQuestionLabelTruncatorHook } from "./question-label-truncator";
31
+ export { createPerfProfilerHook } from "./perf-profiler";
@@ -0,0 +1,2 @@
1
+ import type { PerfProfilerOptions, PerfProfilerHook } from "./types";
2
+ export declare function createPerfProfilerHook(options: PerfProfilerOptions): PerfProfilerHook;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ import type { ProfilingConfig } from "../../config/schema";
2
+ import type { PerfTracer } from "../../shared/perf-tracer";
3
+ export interface PerfProfilerOptions {
4
+ config: ProfilingConfig;
5
+ tracer: PerfTracer;
6
+ /** 注册 Map/Set size 采集回调,key 为探针名称,fn 返回当前 size */
7
+ memoryProbes?: Record<string, () => number>;
8
+ }
9
+ export interface PerfProfilerHook {
10
+ "event": (input: {
11
+ event: {
12
+ type: string;
13
+ properties?: unknown;
14
+ };
15
+ }) => Promise<void>;
16
+ "tool.execute.before": (input: {
17
+ tool: string;
18
+ sessionID: string;
19
+ callID: string;
20
+ }, output: {
21
+ args: Record<string, unknown>;
22
+ }) => Promise<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: unknown;
31
+ }) => Promise<void>;
32
+ "chat.message": (input: {
33
+ sessionID: string;
34
+ agent?: string;
35
+ }, output: {
36
+ message: Record<string, unknown>;
37
+ parts: Array<{
38
+ type: string;
39
+ text?: string;
40
+ }>;
41
+ }) => Promise<void>;
42
+ }
@@ -1,10 +1,34 @@
1
- import type { ThinkModeInput } from "./types";
2
1
  export * from "./detector";
3
2
  export * from "./switcher";
4
3
  export * from "./types";
5
4
  export declare function clearThinkModeState(sessionID: string): void;
6
5
  export declare function createThinkModeHook(): {
7
- "chat.params": (output: ThinkModeInput, sessionID: string) => Promise<void>;
6
+ "chat.params": (input: {
7
+ sessionID: string;
8
+ agent: string;
9
+ model: {
10
+ id: string;
11
+ providerID: string;
12
+ };
13
+ provider: {
14
+ source: string;
15
+ info: unknown;
16
+ options: Record<string, unknown>;
17
+ };
18
+ message: {
19
+ role: string;
20
+ parts?: Array<{
21
+ type: string;
22
+ text?: string;
23
+ }>;
24
+ };
25
+ }, output: {
26
+ temperature: number;
27
+ topP: number;
28
+ topK: number;
29
+ maxOutputTokens: number | undefined;
30
+ options: Record<string, unknown>;
31
+ }) => Promise<void>;
8
32
  event: ({ event }: {
9
33
  event: {
10
34
  type: string;
@@ -1,3 +1,5 @@
1
+ import type { Model, UserMessage } from "@opencode-ai/sdk";
2
+ import type { ProviderContext } from "@opencode-ai/plugin";
1
3
  export interface ThinkModeState {
2
4
  requested: boolean;
3
5
  modelSwitched: boolean;
@@ -5,17 +7,17 @@ export interface ThinkModeState {
5
7
  providerID?: string;
6
8
  modelID?: string;
7
9
  }
8
- export interface ModelRef {
9
- providerID: string;
10
- modelID: string;
11
- }
12
- export interface MessageWithModel {
13
- model?: ModelRef;
14
- }
15
10
  export interface ThinkModeInput {
16
- parts: Array<{
17
- type: string;
18
- text?: string;
19
- }>;
20
- message: MessageWithModel;
11
+ sessionID: string;
12
+ agent: string;
13
+ model: Model;
14
+ provider: ProviderContext;
15
+ message: UserMessage;
16
+ }
17
+ export interface ThinkModeOutput {
18
+ temperature: number;
19
+ topP: number;
20
+ topK: number;
21
+ maxOutputTokens: number | undefined;
22
+ options: Record<string, unknown>;
21
23
  }