oh-my-opencode 3.0.1 → 3.1.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/dist/agents/utils.d.ts +3 -2
- package/dist/cli/index.js +313 -106
- package/dist/cli/index.test.d.ts +1 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/schema.d.ts +602 -3
- package/dist/features/background-agent/manager.d.ts +13 -2
- package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
- package/dist/features/builtin-skills/index.d.ts +1 -1
- package/dist/features/builtin-skills/skills.d.ts +5 -1
- package/dist/features/builtin-skills/skills.test.d.ts +1 -0
- package/dist/features/opencode-skill-loader/skill-content.d.ts +3 -2
- package/dist/features/tmux-subagent/action-executor.d.ts +22 -0
- package/dist/features/tmux-subagent/decision-engine.d.ts +38 -0
- package/dist/features/tmux-subagent/decision-engine.test.d.ts +1 -0
- package/dist/features/tmux-subagent/index.d.ts +5 -0
- package/dist/features/tmux-subagent/manager.d.ts +54 -0
- package/dist/features/tmux-subagent/manager.test.d.ts +1 -0
- package/dist/features/tmux-subagent/pane-state-querier.d.ts +2 -0
- package/dist/features/tmux-subagent/types.d.ts +51 -0
- package/dist/hooks/category-skill-reminder/index.d.ts +22 -0
- package/dist/hooks/category-skill-reminder/index.test.d.ts +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/sisyphus-junior-notepad/constants.d.ts +2 -0
- package/dist/hooks/sisyphus-junior-notepad/index.d.ts +12 -0
- package/dist/index.js +3265 -1073
- package/dist/shared/connected-providers-cache.d.ts +52 -0
- package/dist/shared/data-path.d.ts +16 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/model-availability.d.ts +4 -5
- package/dist/shared/model-resolver.d.ts +4 -4
- package/dist/shared/session-utils.d.ts +2 -0
- package/dist/shared/tmux/constants.d.ts +5 -0
- package/dist/shared/tmux/index.d.ts +3 -0
- package/dist/shared/tmux/tmux-utils.d.ts +17 -0
- package/dist/shared/tmux/tmux-utils.test.d.ts +1 -0
- package/dist/shared/tmux/types.d.ts +4 -0
- package/dist/tools/delegate-task/constants.d.ts +18 -0
- package/dist/tools/delegate-task/tools.d.ts +11 -3
- package/dist/tools/slashcommand/tools.test.d.ts +1 -0
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
2
|
import type { BackgroundTask, LaunchInput, ResumeInput } from "./types";
|
|
3
|
-
import type { BackgroundTaskConfig } from "../../config/schema";
|
|
3
|
+
import type { BackgroundTaskConfig, TmuxConfig } from "../../config/schema";
|
|
4
4
|
interface EventProperties {
|
|
5
5
|
sessionID?: string;
|
|
6
6
|
info?: {
|
|
@@ -12,6 +12,12 @@ interface Event {
|
|
|
12
12
|
type: string;
|
|
13
13
|
properties?: EventProperties;
|
|
14
14
|
}
|
|
15
|
+
export interface SubagentSessionCreatedEvent {
|
|
16
|
+
sessionID: string;
|
|
17
|
+
parentID: string;
|
|
18
|
+
title: string;
|
|
19
|
+
}
|
|
20
|
+
export type OnSubagentSessionCreated = (event: SubagentSessionCreatedEvent) => Promise<void>;
|
|
15
21
|
export declare class BackgroundManager {
|
|
16
22
|
private static cleanupManagers;
|
|
17
23
|
private static cleanupRegistered;
|
|
@@ -25,9 +31,14 @@ export declare class BackgroundManager {
|
|
|
25
31
|
private concurrencyManager;
|
|
26
32
|
private shutdownTriggered;
|
|
27
33
|
private config?;
|
|
34
|
+
private tmuxEnabled;
|
|
35
|
+
private onSubagentSessionCreated?;
|
|
28
36
|
private queuesByKey;
|
|
29
37
|
private processingKeys;
|
|
30
|
-
constructor(ctx: PluginInput, config?: BackgroundTaskConfig
|
|
38
|
+
constructor(ctx: PluginInput, config?: BackgroundTaskConfig, options?: {
|
|
39
|
+
tmuxConfig?: TmuxConfig;
|
|
40
|
+
onSubagentSessionCreated?: OnSubagentSessionCreated;
|
|
41
|
+
});
|
|
31
42
|
launch(input: LaunchInput): Promise<BackgroundTask>;
|
|
32
43
|
private processKey;
|
|
33
44
|
private startTask;
|
|
@@ -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\n5. **Read the plan file** and start executing tasks according to
|
|
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\n5. **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)\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}\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- Read the FULL plan file before delegating any tasks\n- Follow atlas delegation protocols (7-section format)";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./types";
|
|
2
|
-
export { createBuiltinSkills } from "./skills";
|
|
2
|
+
export { createBuiltinSkills, type CreateBuiltinSkillsOptions } from "./skills";
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { BuiltinSkill } from "./types";
|
|
2
|
-
|
|
2
|
+
import type { BrowserAutomationProvider } from "../../config/schema";
|
|
3
|
+
export interface CreateBuiltinSkillsOptions {
|
|
4
|
+
browserProvider?: BrowserAutomationProvider;
|
|
5
|
+
}
|
|
6
|
+
export declare function createBuiltinSkills(options?: CreateBuiltinSkillsOptions): BuiltinSkill[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { LoadedSkill } from "./types";
|
|
2
|
-
import type { GitMasterConfig } from "../../config/schema";
|
|
2
|
+
import type { GitMasterConfig, BrowserAutomationProvider } from "../../config/schema";
|
|
3
3
|
export interface SkillResolutionOptions {
|
|
4
4
|
gitMasterConfig?: GitMasterConfig;
|
|
5
|
+
browserProvider?: BrowserAutomationProvider;
|
|
5
6
|
}
|
|
6
7
|
declare function clearSkillCache(): void;
|
|
7
|
-
declare function getAllSkills(): Promise<LoadedSkill[]>;
|
|
8
|
+
declare function getAllSkills(options?: SkillResolutionOptions): Promise<LoadedSkill[]>;
|
|
8
9
|
declare function extractSkillTemplate(skill: LoadedSkill): Promise<string>;
|
|
9
10
|
export { clearSkillCache, getAllSkills, extractSkillTemplate };
|
|
10
11
|
export declare function injectGitMasterConfig(template: string, config?: GitMasterConfig): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TmuxConfig } from "../../config/schema";
|
|
2
|
+
import type { PaneAction, WindowState } from "./types";
|
|
3
|
+
export interface ActionResult {
|
|
4
|
+
success: boolean;
|
|
5
|
+
paneId?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ExecuteActionsResult {
|
|
9
|
+
success: boolean;
|
|
10
|
+
spawnedPaneId?: string;
|
|
11
|
+
results: Array<{
|
|
12
|
+
action: PaneAction;
|
|
13
|
+
result: ActionResult;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export interface ExecuteContext {
|
|
17
|
+
config: TmuxConfig;
|
|
18
|
+
serverUrl: string;
|
|
19
|
+
windowState: WindowState;
|
|
20
|
+
}
|
|
21
|
+
export declare function executeAction(action: PaneAction, ctx: ExecuteContext): Promise<ActionResult>;
|
|
22
|
+
export declare function executeActions(actions: PaneAction[], ctx: ExecuteContext): Promise<ExecuteActionsResult>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { WindowState, PaneAction, SpawnDecision, CapacityConfig, TmuxPaneInfo, SplitDirection } from "./types";
|
|
2
|
+
export interface SessionMapping {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
paneId: string;
|
|
5
|
+
createdAt: Date;
|
|
6
|
+
}
|
|
7
|
+
export interface GridCapacity {
|
|
8
|
+
cols: number;
|
|
9
|
+
rows: number;
|
|
10
|
+
total: number;
|
|
11
|
+
}
|
|
12
|
+
export interface GridSlot {
|
|
13
|
+
row: number;
|
|
14
|
+
col: number;
|
|
15
|
+
}
|
|
16
|
+
export interface GridPlan {
|
|
17
|
+
cols: number;
|
|
18
|
+
rows: number;
|
|
19
|
+
slotWidth: number;
|
|
20
|
+
slotHeight: number;
|
|
21
|
+
}
|
|
22
|
+
export interface SpawnTarget {
|
|
23
|
+
targetPaneId: string;
|
|
24
|
+
splitDirection: SplitDirection;
|
|
25
|
+
}
|
|
26
|
+
export declare function getColumnCount(paneCount: number): number;
|
|
27
|
+
export declare function getColumnWidth(agentAreaWidth: number, paneCount: number): number;
|
|
28
|
+
export declare function isSplittableAtCount(agentAreaWidth: number, paneCount: number): boolean;
|
|
29
|
+
export declare function findMinimalEvictions(agentAreaWidth: number, currentCount: number): number | null;
|
|
30
|
+
export declare function canSplitPane(pane: TmuxPaneInfo, direction: SplitDirection): boolean;
|
|
31
|
+
export declare function canSplitPaneAnyDirection(pane: TmuxPaneInfo): boolean;
|
|
32
|
+
export declare function getBestSplitDirection(pane: TmuxPaneInfo): SplitDirection | null;
|
|
33
|
+
export declare function calculateCapacity(windowWidth: number, windowHeight: number): GridCapacity;
|
|
34
|
+
export declare function computeGridPlan(windowWidth: number, windowHeight: number, paneCount: number): GridPlan;
|
|
35
|
+
export declare function mapPaneToSlot(pane: TmuxPaneInfo, plan: GridPlan, mainPaneWidth: number): GridSlot;
|
|
36
|
+
export declare function findSpawnTarget(state: WindowState): SpawnTarget | null;
|
|
37
|
+
export declare function decideSpawnActions(state: WindowState, sessionId: string, description: string, _config: CapacityConfig, sessionMappings: SessionMapping[]): SpawnDecision;
|
|
38
|
+
export declare function decideCloseAction(state: WindowState, sessionId: string, sessionMappings: SessionMapping[]): PaneAction | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { TmuxConfig } from "../../config/schema";
|
|
3
|
+
interface SessionCreatedEvent {
|
|
4
|
+
type: string;
|
|
5
|
+
properties?: {
|
|
6
|
+
info?: {
|
|
7
|
+
id?: string;
|
|
8
|
+
parentID?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* State-first Tmux Session Manager
|
|
15
|
+
*
|
|
16
|
+
* Architecture:
|
|
17
|
+
* 1. QUERY: Get actual tmux pane state (source of truth)
|
|
18
|
+
* 2. DECIDE: Pure function determines actions based on state
|
|
19
|
+
* 3. EXECUTE: Execute actions with verification
|
|
20
|
+
* 4. UPDATE: Update internal cache only after tmux confirms success
|
|
21
|
+
*
|
|
22
|
+
* The internal `sessions` Map is just a cache for sessionId<->paneId mapping.
|
|
23
|
+
* The REAL source of truth is always queried from tmux.
|
|
24
|
+
*/
|
|
25
|
+
export declare class TmuxSessionManager {
|
|
26
|
+
private client;
|
|
27
|
+
private tmuxConfig;
|
|
28
|
+
private serverUrl;
|
|
29
|
+
private sourcePaneId;
|
|
30
|
+
private sessions;
|
|
31
|
+
private pendingSessions;
|
|
32
|
+
private pollInterval?;
|
|
33
|
+
constructor(ctx: PluginInput, tmuxConfig: TmuxConfig);
|
|
34
|
+
private isEnabled;
|
|
35
|
+
private getCapacityConfig;
|
|
36
|
+
private getSessionMappings;
|
|
37
|
+
private waitForSessionReady;
|
|
38
|
+
onSessionCreated(event: SessionCreatedEvent): Promise<void>;
|
|
39
|
+
onSessionDeleted(event: {
|
|
40
|
+
sessionID: string;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
private startPolling;
|
|
43
|
+
private stopPolling;
|
|
44
|
+
private pollSessions;
|
|
45
|
+
private closeSessionById;
|
|
46
|
+
createEventHandler(): (input: {
|
|
47
|
+
event: {
|
|
48
|
+
type: string;
|
|
49
|
+
properties?: unknown;
|
|
50
|
+
};
|
|
51
|
+
}) => Promise<void>;
|
|
52
|
+
cleanup(): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface TrackedSession {
|
|
2
|
+
sessionId: string;
|
|
3
|
+
paneId: string;
|
|
4
|
+
description: string;
|
|
5
|
+
createdAt: Date;
|
|
6
|
+
lastSeenAt: Date;
|
|
7
|
+
}
|
|
8
|
+
export declare const MIN_PANE_WIDTH = 52;
|
|
9
|
+
export declare const MIN_PANE_HEIGHT = 11;
|
|
10
|
+
export interface TmuxPaneInfo {
|
|
11
|
+
paneId: string;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
left: number;
|
|
15
|
+
top: number;
|
|
16
|
+
title: string;
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface WindowState {
|
|
20
|
+
windowWidth: number;
|
|
21
|
+
windowHeight: number;
|
|
22
|
+
mainPane: TmuxPaneInfo | null;
|
|
23
|
+
agentPanes: TmuxPaneInfo[];
|
|
24
|
+
}
|
|
25
|
+
export type SplitDirection = "-h" | "-v";
|
|
26
|
+
export type PaneAction = {
|
|
27
|
+
type: "close";
|
|
28
|
+
paneId: string;
|
|
29
|
+
sessionId: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: "spawn";
|
|
32
|
+
sessionId: string;
|
|
33
|
+
description: string;
|
|
34
|
+
targetPaneId: string;
|
|
35
|
+
splitDirection: SplitDirection;
|
|
36
|
+
} | {
|
|
37
|
+
type: "replace";
|
|
38
|
+
paneId: string;
|
|
39
|
+
oldSessionId: string;
|
|
40
|
+
newSessionId: string;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
export interface SpawnDecision {
|
|
44
|
+
canSpawn: boolean;
|
|
45
|
+
actions: PaneAction[];
|
|
46
|
+
reason?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface CapacityConfig {
|
|
49
|
+
mainPaneMinWidth: number;
|
|
50
|
+
agentPaneWidth: number;
|
|
51
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
interface ToolExecuteInput {
|
|
3
|
+
tool: string;
|
|
4
|
+
sessionID: string;
|
|
5
|
+
callID: string;
|
|
6
|
+
agent?: string;
|
|
7
|
+
}
|
|
8
|
+
interface ToolExecuteOutput {
|
|
9
|
+
title: string;
|
|
10
|
+
output: string;
|
|
11
|
+
metadata: unknown;
|
|
12
|
+
}
|
|
13
|
+
export declare function createCategorySkillReminderHook(_ctx: PluginInput): {
|
|
14
|
+
"tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
|
|
15
|
+
event: ({ event }: {
|
|
16
|
+
event: {
|
|
17
|
+
type: string;
|
|
18
|
+
properties?: unknown;
|
|
19
|
+
};
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -19,10 +19,12 @@ export { createKeywordDetectorHook } from "./keyword-detector";
|
|
|
19
19
|
export { createNonInteractiveEnvHook } from "./non-interactive-env";
|
|
20
20
|
export { createInteractiveBashSessionHook } from "./interactive-bash-session";
|
|
21
21
|
export { createThinkingBlockValidatorHook } from "./thinking-block-validator";
|
|
22
|
+
export { createCategorySkillReminderHook } from "./category-skill-reminder";
|
|
22
23
|
export { createRalphLoopHook, type RalphLoopHook } from "./ralph-loop";
|
|
23
24
|
export { createAutoSlashCommandHook } from "./auto-slash-command";
|
|
24
25
|
export { createEditErrorRecoveryHook } from "./edit-error-recovery";
|
|
25
26
|
export { createPrometheusMdOnlyHook } from "./prometheus-md-only";
|
|
27
|
+
export { createSisyphusJuniorNotepadHook } from "./sisyphus-junior-notepad";
|
|
26
28
|
export { createTaskResumeInfoHook } from "./task-resume-info";
|
|
27
29
|
export { createStartWorkHook } from "./start-work";
|
|
28
30
|
export { createAtlasHook } from "./atlas";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const HOOK_NAME = "sisyphus-junior-notepad";
|
|
2
|
+
export declare const NOTEPAD_DIRECTIVE = "\n<Work_Context>\n## Notepad Location (for recording learnings)\nNOTEPAD PATH: .sisyphus/notepads/{plan-name}/\n- learnings.md: Record patterns, conventions, successful approaches\n- issues.md: Record problems, blockers, gotchas encountered\n- decisions.md: Record architectural choices and rationales\n- problems.md: Record unresolved issues, technical debt\n\nYou SHOULD append findings to notepad files after completing work.\nIMPORTANT: Always APPEND to notepad files - never overwrite or use Edit tool.\n\n## Plan Location (READ ONLY)\nPLAN PATH: .sisyphus/plans/{plan-name}.md\n\nCRITICAL RULE: NEVER MODIFY THE PLAN FILE\n\nThe plan file (.sisyphus/plans/*.md) is SACRED and READ-ONLY.\n- You may READ the plan to understand tasks\n- You may READ checkbox items to know what to do\n- You MUST NOT edit, modify, or update the plan file\n- You MUST NOT mark checkboxes as complete in the plan\n- Only the Orchestrator manages the plan file\n\nVIOLATION = IMMEDIATE FAILURE. The Orchestrator tracks plan state.\n</Work_Context>\n";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export * from "./constants";
|
|
3
|
+
export declare function createSisyphusJuniorNotepadHook(ctx: PluginInput): {
|
|
4
|
+
"tool.execute.before": (input: {
|
|
5
|
+
tool: string;
|
|
6
|
+
sessionID: string;
|
|
7
|
+
callID: string;
|
|
8
|
+
}, output: {
|
|
9
|
+
args: Record<string, unknown>;
|
|
10
|
+
message?: string;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
};
|