oh-my-opencode-serverlocal 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/LICENSE +21 -0
- package/README.ja-JP.md +775 -0
- package/README.ko-KR.md +796 -0
- package/README.md +792 -0
- package/README.zh-CN.md +765 -0
- package/dist/agents/council.d.ts +27 -0
- package/dist/agents/councillor.d.ts +2 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/explorer.d.ts +2 -0
- package/dist/agents/fixer.d.ts +2 -0
- package/dist/agents/index.d.ts +31 -0
- package/dist/agents/librarian.d.ts +2 -0
- package/dist/agents/observer.d.ts +2 -0
- package/dist/agents/oracle.d.ts +2 -0
- package/dist/agents/orchestrator.d.ts +28 -0
- package/dist/agents/permissions.d.ts +10 -0
- package/dist/cli/background-subagents.d.ts +13 -0
- package/dist/cli/companion.d.ts +4 -0
- package/dist/cli/config-io.d.ts +25 -0
- package/dist/cli/config-manager.d.ts +4 -0
- package/dist/cli/custom-skills-registry.d.ts +18 -0
- package/dist/cli/custom-skills.d.ts +13 -0
- package/dist/cli/doctor.d.ts +38 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +3565 -0
- package/dist/cli/install.d.ts +7 -0
- package/dist/cli/model-key-normalization.d.ts +1 -0
- package/dist/cli/paths.d.ts +35 -0
- package/dist/cli/providers.d.ts +145 -0
- package/dist/cli/skills.d.ts +24 -0
- package/dist/cli/system.d.ts +6 -0
- package/dist/cli/types.d.ts +47 -0
- package/dist/companion/manager.d.ts +50 -0
- package/dist/companion/updater.d.ts +36 -0
- package/dist/config/agent-mcps.d.ts +11 -0
- package/dist/config/constants.d.ts +38 -0
- package/dist/config/council-schema.d.ts +137 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/loader.d.ts +88 -0
- package/dist/config/runtime-preset.d.ts +11 -0
- package/dist/config/schema.d.ts +1107 -0
- package/dist/config/strip-orchestrator-model.d.ts +9 -0
- package/dist/config/utils.d.ts +18 -0
- package/dist/council/council-manager.d.ts +53 -0
- package/dist/council/index.d.ts +1 -0
- package/dist/hooks/apply-patch/codec.d.ts +7 -0
- package/dist/hooks/apply-patch/errors.d.ts +25 -0
- package/dist/hooks/apply-patch/execution-context.d.ts +27 -0
- package/dist/hooks/apply-patch/index.d.ts +15 -0
- package/dist/hooks/apply-patch/matching.d.ts +26 -0
- package/dist/hooks/apply-patch/operations.d.ts +3 -0
- package/dist/hooks/apply-patch/prepared-changes.d.ts +17 -0
- package/dist/hooks/apply-patch/resolution.d.ts +19 -0
- package/dist/hooks/apply-patch/rewrite.d.ts +7 -0
- package/dist/hooks/apply-patch/test-helpers.d.ts +6 -0
- package/dist/hooks/apply-patch/types.d.ts +80 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +11 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +38 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +12 -0
- package/dist/hooks/auto-update-checker/index.d.ts +18 -0
- package/dist/hooks/auto-update-checker/skill-sync.d.ts +67 -0
- package/dist/hooks/auto-update-checker/types.d.ts +34 -0
- package/dist/hooks/chat-headers.d.ts +16 -0
- package/dist/hooks/command-hook-utils.d.ts +5 -0
- package/dist/hooks/deepwork/index.d.ts +13 -0
- package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
- package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
- package/dist/hooks/filter-available-skills/index.d.ts +19 -0
- package/dist/hooks/foreground-fallback/index.d.ts +122 -0
- package/dist/hooks/image-hook.d.ts +8 -0
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
- package/dist/hooks/loop-command/index.d.ts +13 -0
- package/dist/hooks/phase-reminder/index.d.ts +25 -0
- package/dist/hooks/post-file-tool-nudge/index.d.ts +23 -0
- package/dist/hooks/reflect/index.d.ts +13 -0
- package/dist/hooks/session-lifecycle.d.ts +10 -0
- package/dist/hooks/task-session-manager/index.d.ts +58 -0
- package/dist/hooks/task-session-manager/pending-call-tracker.d.ts +13 -0
- package/dist/hooks/task-session-manager/task-context-tracker.d.ts +14 -0
- package/dist/hooks/types.d.ts +26 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +39519 -0
- package/dist/interview/dashboard-manager.d.ts +21 -0
- package/dist/interview/dashboard.d.ts +67 -0
- package/dist/interview/document.d.ts +29 -0
- package/dist/interview/helpers.d.ts +10 -0
- package/dist/interview/index.d.ts +1 -0
- package/dist/interview/manager.d.ts +21 -0
- package/dist/interview/parser.d.ts +11 -0
- package/dist/interview/prompts.d.ts +7 -0
- package/dist/interview/server.d.ts +15 -0
- package/dist/interview/service.d.ts +45 -0
- package/dist/interview/session-server.d.ts +21 -0
- package/dist/interview/types.d.ts +111 -0
- package/dist/interview/ui.d.ts +11 -0
- package/dist/loop/loop-session.d.ts +64 -0
- package/dist/mcp/context7.d.ts +6 -0
- package/dist/mcp/grep-app.d.ts +6 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/types.d.ts +12 -0
- package/dist/mcp/websearch.d.ts +9 -0
- package/dist/multiplexer/cmux/close-policy.d.ts +20 -0
- package/dist/multiplexer/cmux/index.d.ts +102 -0
- package/dist/multiplexer/cmux/session-lifecycle.d.ts +92 -0
- package/dist/multiplexer/cmux/session-state.d.ts +45 -0
- package/dist/multiplexer/factory.d.ts +17 -0
- package/dist/multiplexer/herdr/index.d.ts +35 -0
- package/dist/multiplexer/index.d.ts +12 -0
- package/dist/multiplexer/session-manager.d.ts +69 -0
- package/dist/multiplexer/shared.d.ts +31 -0
- package/dist/multiplexer/tmux/index.d.ts +26 -0
- package/dist/multiplexer/types.d.ts +57 -0
- package/dist/multiplexer/zellij/index.d.ts +47 -0
- package/dist/tools/acp-run.d.ts +3 -0
- package/dist/tools/ast-grep/cli.d.ts +15 -0
- package/dist/tools/ast-grep/constants.d.ts +25 -0
- package/dist/tools/ast-grep/downloader.d.ts +5 -0
- package/dist/tools/ast-grep/index.d.ts +10 -0
- package/dist/tools/ast-grep/tools.d.ts +3 -0
- package/dist/tools/ast-grep/types.d.ts +30 -0
- package/dist/tools/ast-grep/utils.d.ts +4 -0
- package/dist/tools/cancel-task.d.ts +16 -0
- package/dist/tools/council.d.ts +10 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/preset-manager.d.ts +26 -0
- package/dist/tools/smartfetch/binary.d.ts +3 -0
- package/dist/tools/smartfetch/cache.d.ts +6 -0
- package/dist/tools/smartfetch/constants.d.ts +12 -0
- package/dist/tools/smartfetch/index.d.ts +3 -0
- package/dist/tools/smartfetch/network.d.ts +38 -0
- package/dist/tools/smartfetch/secondary-model.d.ts +35 -0
- package/dist/tools/smartfetch/tool.d.ts +3 -0
- package/dist/tools/smartfetch/types.d.ts +122 -0
- package/dist/tools/smartfetch/utils.d.ts +20 -0
- package/dist/tui-state.d.ts +18 -0
- package/dist/tui.d.ts +13 -0
- package/dist/tui.js +1112 -0
- package/dist/utils/agent-variant.d.ts +23 -0
- package/dist/utils/background-job-board.d.ts +113 -0
- package/dist/utils/background-job-coordinator.d.ts +72 -0
- package/dist/utils/background-job-store.d.ts +46 -0
- package/dist/utils/compat.d.ts +29 -0
- package/dist/utils/councillor-models.d.ts +20 -0
- package/dist/utils/env.d.ts +3 -0
- package/dist/utils/escape-html.d.ts +1 -0
- package/dist/utils/frontmatter.d.ts +6 -0
- package/dist/utils/guards.d.ts +4 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/internal-initiator.d.ts +11 -0
- package/dist/utils/logger.d.ts +6 -0
- package/dist/utils/polling.d.ts +21 -0
- package/dist/utils/session.d.ts +75 -0
- package/dist/utils/subagent-depth.d.ts +35 -0
- package/dist/utils/system-collapse.d.ts +6 -0
- package/dist/utils/task.d.ts +20 -0
- package/dist/utils/zip-extractor.d.ts +1 -0
- package/package.json +108 -0
- package/src/companion/companion-manifest.json +12 -0
- package/src/skills/clonedeps/README.md +23 -0
- package/src/skills/clonedeps/SKILL.md +240 -0
- package/src/skills/clonedeps/codemap.md +32 -0
- package/src/skills/codemap/README.md +59 -0
- package/src/skills/codemap/SKILL.md +163 -0
- package/src/skills/codemap/codemap.md +36 -0
- package/src/skills/codemap/scripts/codemap.mjs +483 -0
- package/src/skills/codemap/scripts/codemap.test.ts +129 -0
- package/src/skills/codemap.md +78 -0
- package/src/skills/deepwork/SKILL.md +122 -0
- package/src/skills/loop-engineering/SKILL.md +30 -0
- package/src/skills/oh-my-opencode-slim/SKILL.md +326 -0
- package/src/skills/reflect/SKILL.md +326 -0
- package/src/skills/simplify/README.md +19 -0
- package/src/skills/simplify/SKILL.md +138 -0
- package/src/skills/simplify/codemap.md +36 -0
- package/src/skills/verification-planning/SKILL.md +102 -0
- package/src/skills/worktrees/SKILL.md +171 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Multiplexer } from '../types';
|
|
2
|
+
export interface CmuxSessionEvent {
|
|
3
|
+
type: string;
|
|
4
|
+
properties?: {
|
|
5
|
+
info?: {
|
|
6
|
+
id?: string;
|
|
7
|
+
parentID?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
directory?: string;
|
|
10
|
+
sessionID?: string;
|
|
11
|
+
};
|
|
12
|
+
part?: {
|
|
13
|
+
sessionID?: string;
|
|
14
|
+
};
|
|
15
|
+
sessionID?: string;
|
|
16
|
+
status?: {
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface BackgroundJobs {
|
|
22
|
+
deferIfRunning(session: string): boolean;
|
|
23
|
+
clearDeferredClose(session: string): void;
|
|
24
|
+
}
|
|
25
|
+
export interface CmuxSessionLifecycleOptions {
|
|
26
|
+
now?: () => number;
|
|
27
|
+
delay?: (milliseconds: number) => Promise<void>;
|
|
28
|
+
deferredRetryMs?: number;
|
|
29
|
+
deferredTtlMs?: number;
|
|
30
|
+
missingGraceMs?: number;
|
|
31
|
+
closeRetryMs?: number;
|
|
32
|
+
closeRetryTtlMs?: number;
|
|
33
|
+
closeRetryMaxAttempts?: number;
|
|
34
|
+
orphanCooldownMs?: number;
|
|
35
|
+
shutdownTimeoutMs?: number;
|
|
36
|
+
isServerRunning?: (url: string) => Promise<boolean>;
|
|
37
|
+
fetchStatuses?: () => Promise<Record<string, {
|
|
38
|
+
type: string;
|
|
39
|
+
}>>;
|
|
40
|
+
}
|
|
41
|
+
export declare class CmuxSessionLifecycle {
|
|
42
|
+
private readonly owner;
|
|
43
|
+
private readonly multiplexer;
|
|
44
|
+
private readonly resolveServerUrl;
|
|
45
|
+
private readonly defaultDirectory;
|
|
46
|
+
private readonly backgroundJobs?;
|
|
47
|
+
private readonly store;
|
|
48
|
+
private readonly policy;
|
|
49
|
+
private readonly now;
|
|
50
|
+
private readonly delay;
|
|
51
|
+
private readonly injectedDelay;
|
|
52
|
+
private readonly deferredRetryMs;
|
|
53
|
+
private readonly deferredTtlMs;
|
|
54
|
+
private readonly missingGraceMs;
|
|
55
|
+
private readonly closeRetryMs;
|
|
56
|
+
private readonly shutdownTimeoutMs;
|
|
57
|
+
private readonly serverCheck;
|
|
58
|
+
private readonly fetchStatuses;
|
|
59
|
+
private pollTimer?;
|
|
60
|
+
private polling;
|
|
61
|
+
private cleanupPromise?;
|
|
62
|
+
private disposed;
|
|
63
|
+
private spawnGeneration;
|
|
64
|
+
constructor(owner: string, multiplexer: Multiplexer, resolveServerUrl: () => string | null, defaultDirectory: string, backgroundJobs?: BackgroundJobs | undefined, options?: CmuxSessionLifecycleOptions);
|
|
65
|
+
onSessionCreated(event: CmuxSessionEvent): Promise<void>;
|
|
66
|
+
onSessionStatus(event: CmuxSessionEvent): Promise<void>;
|
|
67
|
+
onSessionDeleted(event: CmuxSessionEvent): Promise<void>;
|
|
68
|
+
closeSessionFromCoordinator(session: string): Promise<void>;
|
|
69
|
+
cleanup(): Promise<void>;
|
|
70
|
+
/** Runs one status pass; exposed for deterministic lifecycle tests. */
|
|
71
|
+
pollOnce(): Promise<void>;
|
|
72
|
+
private spawn;
|
|
73
|
+
private spawnOperation;
|
|
74
|
+
private deferSpawn;
|
|
75
|
+
private cancelDeferred;
|
|
76
|
+
private activity;
|
|
77
|
+
private requestClose;
|
|
78
|
+
private attemptClose;
|
|
79
|
+
private scheduleCooldown;
|
|
80
|
+
private poll;
|
|
81
|
+
private startPolling;
|
|
82
|
+
private updatePolling;
|
|
83
|
+
private runCleanup;
|
|
84
|
+
private attemptCloseWithoutTimer;
|
|
85
|
+
private adoptAndClose;
|
|
86
|
+
private closeLatePane;
|
|
87
|
+
private trackStalePane;
|
|
88
|
+
private eventSession;
|
|
89
|
+
private timer;
|
|
90
|
+
private loadStatuses;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { PaneResult } from '../types';
|
|
2
|
+
import type { CmuxCloseIntent } from './close-policy';
|
|
3
|
+
export type CmuxSpawnState = 'known' | 'spawning' | 'attached' | 'failed';
|
|
4
|
+
export type CmuxLifecycleState = 'active' | 'deleted' | 'orphaned';
|
|
5
|
+
export interface CmuxDeferredSpawn {
|
|
6
|
+
deadline: number;
|
|
7
|
+
generation: number;
|
|
8
|
+
timer?: {
|
|
9
|
+
cancel(): void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface CmuxSessionRecord {
|
|
13
|
+
session: string;
|
|
14
|
+
owner: string;
|
|
15
|
+
parent: string;
|
|
16
|
+
title: string;
|
|
17
|
+
directory: string;
|
|
18
|
+
paneId?: string;
|
|
19
|
+
spawnState: CmuxSpawnState;
|
|
20
|
+
lifecycle: CmuxLifecycleState;
|
|
21
|
+
attachedAt?: number;
|
|
22
|
+
lastActivityAt: number;
|
|
23
|
+
activityVersion: number;
|
|
24
|
+
idleConsecutive: number;
|
|
25
|
+
statusMissingSince?: number;
|
|
26
|
+
deferredSpawn?: CmuxDeferredSpawn;
|
|
27
|
+
closeIntent?: CmuxCloseIntent;
|
|
28
|
+
closeTimer?: {
|
|
29
|
+
cancel(): void;
|
|
30
|
+
};
|
|
31
|
+
spawnPromise?: Promise<PaneResult>;
|
|
32
|
+
}
|
|
33
|
+
export declare class CmuxSessionStore {
|
|
34
|
+
claimCreated(record: CmuxSessionRecord): boolean;
|
|
35
|
+
get(session: string): CmuxSessionRecord | undefined;
|
|
36
|
+
ownedBy(owner: string): CmuxSessionRecord[];
|
|
37
|
+
claimOrphans(owner: string, directory: string): CmuxSessionRecord[];
|
|
38
|
+
markAttached(session: string, paneId: string, now: number): void;
|
|
39
|
+
markActivity(session: string, now: number): void;
|
|
40
|
+
markDeleted(session: string): void;
|
|
41
|
+
markOrphaned(session: string): void;
|
|
42
|
+
removeAfterConfirmedClose(session: string): boolean;
|
|
43
|
+
removeWithoutPane(session: string): boolean;
|
|
44
|
+
resetForTests(): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multiplexer factory - creates the appropriate multiplexer instance
|
|
3
|
+
*/
|
|
4
|
+
import type { MultiplexerConfig } from '../config/schema';
|
|
5
|
+
import type { Multiplexer } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Create a multiplexer instance based on config.
|
|
8
|
+
*
|
|
9
|
+
* Do not cache instances: tmux/zellij/herdr integrations may depend on
|
|
10
|
+
* per-process environment like TMUX_PANE/ZELLIJ/HERDR_PANE_ID, which should
|
|
11
|
+
* be captured fresh for each plugin context.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getMultiplexer(config: MultiplexerConfig): Multiplexer | null;
|
|
14
|
+
/**
|
|
15
|
+
* Start background availability check for a multiplexer
|
|
16
|
+
*/
|
|
17
|
+
export declare function startAvailabilityCheck(config: MultiplexerConfig): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Herdr multiplexer implementation
|
|
3
|
+
*
|
|
4
|
+
* Splits panes for sub-agent sessions in Herdr.
|
|
5
|
+
*
|
|
6
|
+
* Herdr is an agent-aware terminal multiplexer (workspaces → tabs → panes).
|
|
7
|
+
* Pane IDs use the format `w<workspace>:p<pane>`. The CLI outputs
|
|
8
|
+
* newline-delimited JSON; `pane split` returns a `pane_info` result whose
|
|
9
|
+
* `pane.pane_id` field is the new pane's ID.
|
|
10
|
+
*
|
|
11
|
+
* Environment detection: Herdr injects `HERDR_ENV=1` and `HERDR_PANE_ID`
|
|
12
|
+
* into every pane it manages.
|
|
13
|
+
*/
|
|
14
|
+
import type { MultiplexerLayout } from '../../config/schema';
|
|
15
|
+
import type { Multiplexer, PaneResult } from '../types';
|
|
16
|
+
export declare class HerdrMultiplexer implements Multiplexer {
|
|
17
|
+
readonly type: "herdr";
|
|
18
|
+
private binaryPath;
|
|
19
|
+
private hasChecked;
|
|
20
|
+
private readonly parentPaneId;
|
|
21
|
+
private layout;
|
|
22
|
+
private paneDirection;
|
|
23
|
+
private agentAreaPaneId;
|
|
24
|
+
private spawnMutex;
|
|
25
|
+
constructor(layout?: MultiplexerLayout, mainPaneSize?: number);
|
|
26
|
+
isAvailable(): Promise<boolean>;
|
|
27
|
+
isInsideSession(): boolean;
|
|
28
|
+
spawnPane(sessionId: string, description: string, serverUrl: string, directory: string): Promise<PaneResult>;
|
|
29
|
+
private doSpawn;
|
|
30
|
+
closePane(paneId: string): Promise<boolean>;
|
|
31
|
+
applyLayout(layout: MultiplexerLayout, _mainPaneSize: number): Promise<void>;
|
|
32
|
+
private runSplit;
|
|
33
|
+
private targetPaneArg;
|
|
34
|
+
private getBinary;
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multiplexer module exports
|
|
3
|
+
*/
|
|
4
|
+
export type { CmuxClient, CommandRunner } from './cmux';
|
|
5
|
+
export { CliCmuxClient, CmuxMultiplexer } from './cmux';
|
|
6
|
+
export { getMultiplexer, startAvailabilityCheck, } from './factory';
|
|
7
|
+
export { HerdrMultiplexer } from './herdr';
|
|
8
|
+
export { MultiplexerSessionManager, TmuxSessionManager, } from './session-manager';
|
|
9
|
+
export { TmuxMultiplexer } from './tmux';
|
|
10
|
+
export type { Multiplexer, PaneResult } from './types';
|
|
11
|
+
export { isServerRunning } from './types';
|
|
12
|
+
export { ZellijMultiplexer } from './zellij';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
import type { MultiplexerConfig } from '../config/schema';
|
|
3
|
+
import type { BackgroundJobStore } from '../utils/background-job-store';
|
|
4
|
+
import { type CmuxSessionLifecycleOptions } from './cmux/session-lifecycle';
|
|
5
|
+
type BackgroundJobReader = Pick<BackgroundJobStore, 'getState' | 'deferIfRunning' | 'clearDeferredClose'>;
|
|
6
|
+
interface SessionEvent {
|
|
7
|
+
type: string;
|
|
8
|
+
properties?: {
|
|
9
|
+
info?: {
|
|
10
|
+
id?: string;
|
|
11
|
+
parentID?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
directory?: string;
|
|
14
|
+
sessionID?: string;
|
|
15
|
+
};
|
|
16
|
+
part?: {
|
|
17
|
+
sessionID?: string;
|
|
18
|
+
};
|
|
19
|
+
sessionID?: string;
|
|
20
|
+
status?: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare function resetMultiplexerSessionManagerState(): void;
|
|
26
|
+
export type MultiplexerSessionManagerOptions = CmuxSessionLifecycleOptions;
|
|
27
|
+
/**
|
|
28
|
+
* Tracks child sessions and spawns/closes multiplexer panes for them.
|
|
29
|
+
*
|
|
30
|
+
* Uses session.status events for completion detection instead of polling,
|
|
31
|
+
* with polling kept as a fallback for reliability.
|
|
32
|
+
*/
|
|
33
|
+
export declare class MultiplexerSessionManager {
|
|
34
|
+
private readonly backgroundJobBoard?;
|
|
35
|
+
private instanceId;
|
|
36
|
+
private readonly resolveServerUrl;
|
|
37
|
+
private directory;
|
|
38
|
+
private multiplexer;
|
|
39
|
+
private sessions;
|
|
40
|
+
private knownSessions;
|
|
41
|
+
private spawningSessions;
|
|
42
|
+
private closingSessions;
|
|
43
|
+
private pollInterval?;
|
|
44
|
+
private enabled;
|
|
45
|
+
private cmuxLifecycle?;
|
|
46
|
+
constructor(ctx: PluginInput, config: MultiplexerConfig, backgroundJobBoard?: BackgroundJobReader | undefined, options?: MultiplexerSessionManagerOptions);
|
|
47
|
+
onSessionCreated(event: SessionEvent): Promise<void>;
|
|
48
|
+
onSessionStatus(event: SessionEvent): Promise<void>;
|
|
49
|
+
onSessionDeleted(event: SessionEvent): Promise<void>;
|
|
50
|
+
private startPolling;
|
|
51
|
+
private stopPolling;
|
|
52
|
+
private pollSessions;
|
|
53
|
+
private fetchSessionStatuses;
|
|
54
|
+
private closeSession;
|
|
55
|
+
private respawnIfKnown;
|
|
56
|
+
private isTrackedOrSpawning;
|
|
57
|
+
private updatePolling;
|
|
58
|
+
private getSessionId;
|
|
59
|
+
private backgroundJobState;
|
|
60
|
+
private shouldCloseNow;
|
|
61
|
+
closeSessionFromCoordinator(sessionId: string): Promise<void>;
|
|
62
|
+
cleanup(): Promise<void>;
|
|
63
|
+
cleanupOnInstanceDisposed(): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated Use MultiplexerSessionManager instead
|
|
67
|
+
*/
|
|
68
|
+
export declare const TmuxSessionManager: typeof MultiplexerSessionManager;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared multiplexer infrastructure
|
|
3
|
+
*
|
|
4
|
+
* Functions used across tmux, zellij, and herdr backend adapters.
|
|
5
|
+
* Extracted to eliminate copy-paste duplication and prevent drift.
|
|
6
|
+
*/
|
|
7
|
+
export declare function quoteShellArg(value: string): string;
|
|
8
|
+
/** Normalize Windows backslashes to / so sh -lc (MSYS2/Git Bash) doesn't treat them as escape chars. */
|
|
9
|
+
export declare function normalizePathForShell(directory: string): string;
|
|
10
|
+
export declare function buildOpencodeAttachCommand(sessionId: string, serverUrl: string, directory: string, executable?: string): string;
|
|
11
|
+
export declare function resolveHostOpencodeBinary(options?: {
|
|
12
|
+
override?: string;
|
|
13
|
+
envOverride?: string;
|
|
14
|
+
execPath?: string;
|
|
15
|
+
argv0?: string;
|
|
16
|
+
pathExists?: (path: string) => boolean;
|
|
17
|
+
}): string | null;
|
|
18
|
+
export declare function findBinary(binaryName: string, options?: {
|
|
19
|
+
verify?: boolean;
|
|
20
|
+
}): Promise<string | null>;
|
|
21
|
+
export interface GracefulClosePaneOptions {
|
|
22
|
+
/** Backend-specific Ctrl+C command args (binary prepended by caller). */
|
|
23
|
+
ctrlC: string[];
|
|
24
|
+
/** Backend-specific close/kill command args (binary prepended by caller). */
|
|
25
|
+
close: string[];
|
|
26
|
+
/** Accept exit code 1 as success (zellij/herdr treat "already closed" as 1). */
|
|
27
|
+
acceptExitCode1?: boolean;
|
|
28
|
+
/** Return true for empty/unknown paneId instead of false (zellij/herdr behavior). */
|
|
29
|
+
emptyPaneReturnsTrue?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function gracefulClosePane(binary: string | null, paneId: string, options: GracefulClosePaneOptions): Promise<boolean>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tmux multiplexer implementation
|
|
3
|
+
*/
|
|
4
|
+
import type { MultiplexerLayout } from '../../config/schema';
|
|
5
|
+
import type { Multiplexer, PaneResult } from '../types';
|
|
6
|
+
export declare class TmuxMultiplexer implements Multiplexer {
|
|
7
|
+
readonly type: "tmux";
|
|
8
|
+
private binaryPath;
|
|
9
|
+
private hasChecked;
|
|
10
|
+
private storedLayout;
|
|
11
|
+
private storedMainPaneSize;
|
|
12
|
+
private targetPane;
|
|
13
|
+
private layoutTimer?;
|
|
14
|
+
private layoutGeneration;
|
|
15
|
+
constructor(layout?: MultiplexerLayout, mainPaneSize?: number);
|
|
16
|
+
isAvailable(): Promise<boolean>;
|
|
17
|
+
isInsideSession(): boolean;
|
|
18
|
+
spawnPane(sessionId: string, description: string, serverUrl: string, directory: string): Promise<PaneResult>;
|
|
19
|
+
closePane(paneId: string): Promise<boolean>;
|
|
20
|
+
applyLayout(layout: MultiplexerLayout, mainPaneSize: number): Promise<void>;
|
|
21
|
+
private scheduleLayout;
|
|
22
|
+
private applyLayoutNow;
|
|
23
|
+
private runTmux;
|
|
24
|
+
private getBinary;
|
|
25
|
+
private targetArgs;
|
|
26
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multiplexer abstraction layer
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified interface for terminal multiplexers (tmux, zellij,
|
|
5
|
+
* herdr, etc.) to spawn and manage panes for child agent sessions.
|
|
6
|
+
*/
|
|
7
|
+
import type { MultiplexerConfig, MultiplexerLayout } from '../config/schema';
|
|
8
|
+
export interface PaneResult {
|
|
9
|
+
success: boolean;
|
|
10
|
+
paneId?: string;
|
|
11
|
+
orphanPaneId?: string;
|
|
12
|
+
error?: 'unavailable' | 'not_found' | 'invalid_state' | 'hard';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Core multiplexer interface
|
|
16
|
+
* Implementations: TmuxMultiplexer, ZellijMultiplexer, HerdrMultiplexer,
|
|
17
|
+
* CmuxMultiplexer
|
|
18
|
+
*/
|
|
19
|
+
export interface Multiplexer {
|
|
20
|
+
readonly type: 'tmux' | 'zellij' | 'herdr' | 'cmux';
|
|
21
|
+
/**
|
|
22
|
+
* Check if the multiplexer binary is available on the system
|
|
23
|
+
*/
|
|
24
|
+
isAvailable(): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if currently running inside a multiplexer session
|
|
27
|
+
*/
|
|
28
|
+
isInsideSession(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Spawn a new pane running the given command
|
|
31
|
+
* @param sessionId - The OpenCode session ID to attach to
|
|
32
|
+
* @param description - Human-readable description for the pane
|
|
33
|
+
* @param serverUrl - The OpenCode server URL to attach to
|
|
34
|
+
* @param directory - The project directory to attach from
|
|
35
|
+
*/
|
|
36
|
+
spawnPane(sessionId: string, description: string, serverUrl: string, directory: string): Promise<PaneResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Close a pane by its ID
|
|
39
|
+
* @param paneId - The pane ID returned by spawnPane
|
|
40
|
+
* @returns true if successfully closed
|
|
41
|
+
*/
|
|
42
|
+
closePane(paneId: string): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Apply layout to rebalance panes
|
|
45
|
+
* @param layout - The layout type to apply
|
|
46
|
+
* @param mainPaneSize - Percentage for main pane (for main-* layouts)
|
|
47
|
+
*/
|
|
48
|
+
applyLayout(layout: MultiplexerLayout, mainPaneSize: number): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Factory function type for creating multiplexer instances
|
|
52
|
+
*/
|
|
53
|
+
export type MultiplexerFactory = (config: MultiplexerConfig) => Multiplexer;
|
|
54
|
+
/**
|
|
55
|
+
* Server health check utility (shared across implementations)
|
|
56
|
+
*/
|
|
57
|
+
export declare function isServerRunning(serverUrl: string, timeoutMs?: number, maxAttempts?: number): Promise<boolean>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zellij multiplexer implementation
|
|
3
|
+
*
|
|
4
|
+
* Creates panes for sub-agent sessions in Zellij.
|
|
5
|
+
*
|
|
6
|
+
* The default mode creates a dedicated "opencode-agents" tab:
|
|
7
|
+
* - First sub-agent uses the default pane from new-tab
|
|
8
|
+
* - Subsequent sub-agents create new panes
|
|
9
|
+
* - User stays in their original tab
|
|
10
|
+
*
|
|
11
|
+
* The optional "current-tab" mode creates panes in the tab containing the
|
|
12
|
+
* parent OpenCode pane instead.
|
|
13
|
+
*/
|
|
14
|
+
import type { MultiplexerLayout, ZellijPaneMode } from '../../config/schema';
|
|
15
|
+
import type { Multiplexer, PaneResult } from '../types';
|
|
16
|
+
export declare class ZellijMultiplexer implements Multiplexer {
|
|
17
|
+
private readonly paneMode;
|
|
18
|
+
readonly type: "zellij";
|
|
19
|
+
private binaryPath;
|
|
20
|
+
private hasChecked;
|
|
21
|
+
private agentTabId;
|
|
22
|
+
private firstPaneId;
|
|
23
|
+
private firstPaneUsed;
|
|
24
|
+
private parentTabId;
|
|
25
|
+
private readonly parentPaneId;
|
|
26
|
+
private readonly paneDirection;
|
|
27
|
+
constructor(layout?: MultiplexerLayout, mainPaneSize?: number, paneMode?: ZellijPaneMode);
|
|
28
|
+
isAvailable(): Promise<boolean>;
|
|
29
|
+
isInsideSession(): boolean;
|
|
30
|
+
spawnPane(sessionId: string, description: string, serverUrl: string, directory: string): Promise<PaneResult>;
|
|
31
|
+
private createPaneInCurrentTab;
|
|
32
|
+
private createPaneInAgentTab;
|
|
33
|
+
private runInPane;
|
|
34
|
+
private ensureAgentTab;
|
|
35
|
+
private listPanesJson;
|
|
36
|
+
private getFirstPaneInTab;
|
|
37
|
+
private findTabByName;
|
|
38
|
+
private findTabByNameText;
|
|
39
|
+
private getCurrentTabId;
|
|
40
|
+
closePane(paneId: string): Promise<boolean>;
|
|
41
|
+
applyLayout(_layout: MultiplexerLayout, _mainPaneSize: number): Promise<void>;
|
|
42
|
+
private directionArgs;
|
|
43
|
+
private tabIdArgs;
|
|
44
|
+
private getParentTabId;
|
|
45
|
+
private findTabIdForPane;
|
|
46
|
+
private getBinary;
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CliLanguage, SgResult } from './types';
|
|
2
|
+
export interface RunOptions {
|
|
3
|
+
pattern: string;
|
|
4
|
+
lang: CliLanguage;
|
|
5
|
+
paths?: string[];
|
|
6
|
+
globs?: string[];
|
|
7
|
+
rewrite?: string;
|
|
8
|
+
context?: number;
|
|
9
|
+
updateAll?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function getAstGrepPath(): Promise<string | null>;
|
|
12
|
+
export declare function startBackgroundInit(): void;
|
|
13
|
+
export declare function runSg(options: RunOptions): Promise<SgResult>;
|
|
14
|
+
export declare function isCliAvailable(): boolean;
|
|
15
|
+
export declare function ensureCliAvailable(): Promise<boolean>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CLI_LANGUAGES } from './types';
|
|
2
|
+
export declare function findSgCliPathSync(): string | null;
|
|
3
|
+
export declare function getSgCliPath(): string;
|
|
4
|
+
export declare function setSgCliPath(path: string): void;
|
|
5
|
+
export { CLI_LANGUAGES };
|
|
6
|
+
export declare const DEFAULT_TIMEOUT_MS = 300000;
|
|
7
|
+
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
|
8
|
+
export declare const DEFAULT_MAX_MATCHES = 500;
|
|
9
|
+
export declare const LANG_EXTENSIONS: Record<string, string[]>;
|
|
10
|
+
export interface EnvironmentCheckResult {
|
|
11
|
+
cli: {
|
|
12
|
+
available: boolean;
|
|
13
|
+
path: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if ast-grep CLI is available.
|
|
19
|
+
* Call this at startup to provide early feedback about missing dependencies.
|
|
20
|
+
*/
|
|
21
|
+
export declare function checkEnvironment(): EnvironmentCheckResult;
|
|
22
|
+
/**
|
|
23
|
+
* Format environment check result as user-friendly message.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatEnvironmentCheck(result: EnvironmentCheckResult): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getCacheDir(): string;
|
|
2
|
+
export declare function getBinaryName(): string;
|
|
3
|
+
export declare function getCachedBinaryPath(): string | null;
|
|
4
|
+
export declare function downloadAstGrep(version?: string): Promise<string | null>;
|
|
5
|
+
export declare function ensureAstGrepBinary(): Promise<string | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ToolDefinition } from '@opencode-ai/plugin';
|
|
2
|
+
import { ast_grep_replace, ast_grep_search } from './tools';
|
|
3
|
+
export declare const builtinTools: Record<string, ToolDefinition>;
|
|
4
|
+
export { ensureCliAvailable, getAstGrepPath, isCliAvailable, startBackgroundInit, } from './cli';
|
|
5
|
+
export type { EnvironmentCheckResult } from './constants';
|
|
6
|
+
export { checkEnvironment, formatEnvironmentCheck } from './constants';
|
|
7
|
+
export { ensureAstGrepBinary, getCacheDir, getCachedBinaryPath, } from './downloader';
|
|
8
|
+
export type { CliLanguage, CliMatch, SgResult } from './types';
|
|
9
|
+
export { CLI_LANGUAGES } from './types';
|
|
10
|
+
export { ast_grep_replace, ast_grep_search };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const CLI_LANGUAGES: readonly ["bash", "c", "cpp", "csharp", "css", "elixir", "go", "haskell", "html", "java", "javascript", "json", "kotlin", "lua", "nix", "php", "python", "ruby", "rust", "scala", "solidity", "swift", "typescript", "tsx", "yaml"];
|
|
2
|
+
export type CliLanguage = (typeof CLI_LANGUAGES)[number];
|
|
3
|
+
export interface CliMatch {
|
|
4
|
+
file: string;
|
|
5
|
+
range: {
|
|
6
|
+
byteOffset: {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
start: {
|
|
11
|
+
line: number;
|
|
12
|
+
column: number;
|
|
13
|
+
};
|
|
14
|
+
end: {
|
|
15
|
+
line: number;
|
|
16
|
+
column: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
lines: string;
|
|
20
|
+
text: string;
|
|
21
|
+
replacement?: string;
|
|
22
|
+
language: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SgResult {
|
|
25
|
+
matches: CliMatch[];
|
|
26
|
+
totalMatches: number;
|
|
27
|
+
truncated: boolean;
|
|
28
|
+
truncatedReason?: 'timeout' | 'max_output_bytes' | 'max_matches';
|
|
29
|
+
error?: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CliLanguage, SgResult } from './types';
|
|
2
|
+
export declare function formatSearchResult(result: SgResult): string;
|
|
3
|
+
export declare function formatReplaceResult(result: SgResult, isDryRun: boolean): string;
|
|
4
|
+
export declare function getEmptyResultHint(pattern: string, lang: CliLanguage): string | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PluginInput, type ToolDefinition } from '@opencode-ai/plugin';
|
|
2
|
+
import type { BackgroundJobStore } from '../utils/background-job-store';
|
|
3
|
+
interface CancelTaskToolOptions {
|
|
4
|
+
client: PluginInput['client'];
|
|
5
|
+
backgroundJobBoard: BackgroundJobStore;
|
|
6
|
+
shouldManageSession: (sessionID: string) => boolean;
|
|
7
|
+
abortTimeoutMs?: number;
|
|
8
|
+
verifyAbortMs?: number;
|
|
9
|
+
abortRetryIntervalMs?: number;
|
|
10
|
+
stableStoppedMs?: number;
|
|
11
|
+
deleteTimeoutMs?: number;
|
|
12
|
+
deleteVerifyMs?: number;
|
|
13
|
+
deleteStableStoppedMs?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function createCancelTaskTool(options: CancelTaskToolOptions): Record<string, ToolDefinition>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PluginInput, type ToolDefinition } from '@opencode-ai/plugin';
|
|
2
|
+
import type { CouncilManager } from '../council/council-manager';
|
|
3
|
+
/**
|
|
4
|
+
* Creates the council_session tool for multi-LLM orchestration.
|
|
5
|
+
*
|
|
6
|
+
* This tool triggers a full council session: parallel councillors →
|
|
7
|
+
* formatted results returned to the council agent for synthesis.
|
|
8
|
+
* Available to the council agent.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createCouncilTool(_ctx: PluginInput, councilManager: CouncilManager): Record<string, ToolDefinition>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createAcpRunTool } from './acp-run';
|
|
2
|
+
export { ast_grep_replace, ast_grep_search } from './ast-grep';
|
|
3
|
+
export { createCancelTaskTool } from './cancel-task';
|
|
4
|
+
export { createCouncilTool } from './council';
|
|
5
|
+
export type { PresetManager } from './preset-manager';
|
|
6
|
+
export { createPresetManager } from './preset-manager';
|
|
7
|
+
export { createWebfetchTool } from './smartfetch';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
import type { PluginConfig } from '../config';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a preset manager for the /preset slash command.
|
|
5
|
+
*
|
|
6
|
+
* Stores the requested runtime preset in plugin memory and updates the
|
|
7
|
+
* plugin-facing TUI snapshot. It deliberately does not call OpenCode's
|
|
8
|
+
* client.config.update() or instance.dispose() from command hooks because
|
|
9
|
+
* OpenCode continues the same command into the prompt loop after
|
|
10
|
+
* command.execute.before, which can break the active conversation while
|
|
11
|
+
* the agent registry is changing.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createPresetManager(ctx: PluginInput, config: PluginConfig): {
|
|
14
|
+
handleCommandExecuteBefore: (input: {
|
|
15
|
+
command: string;
|
|
16
|
+
sessionID: string;
|
|
17
|
+
arguments: string;
|
|
18
|
+
}, output: {
|
|
19
|
+
parts: Array<{
|
|
20
|
+
type: string;
|
|
21
|
+
text?: string;
|
|
22
|
+
}>;
|
|
23
|
+
}) => Promise<void>;
|
|
24
|
+
registerCommand: (opencodeConfig: Record<string, unknown>) => void;
|
|
25
|
+
};
|
|
26
|
+
export type PresetManager = ReturnType<typeof createPresetManager>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BinaryFetch } from './types';
|
|
2
|
+
export declare function buildBinaryResultMessage(fetchResult: BinaryFetch, savedPath?: string): string;
|
|
3
|
+
export declare function saveBinary(binaryDir: string, data: Uint8Array, contentType: string, filename?: string): Promise<string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LRUCache } from 'lru-cache';
|
|
2
|
+
import type { FetchResult } from './types';
|
|
3
|
+
export declare const CACHE: LRUCache<string, FetchResult, unknown>;
|
|
4
|
+
export declare function buildCacheKey(url: string, extractMain: boolean, preferLlmsTxt: 'auto' | 'always' | 'never', saveBinary: boolean): string;
|
|
5
|
+
export declare function cacheFetchResult(fetchResult: FetchResult, extractMain: boolean, preferLlmsTxt: 'auto' | 'always' | 'never', saveBinary: boolean): void;
|
|
6
|
+
export declare function isInvalidLlmsResult(fetchResult: FetchResult | undefined): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const DOCS_HOST_SUFFIXES: string[];
|
|
2
|
+
export declare const DOCS_HOST_PREFIXES: string[];
|
|
3
|
+
export declare const MAX_REDIRECTS = 10;
|
|
4
|
+
export declare const MAX_RESPONSE_BYTES: number;
|
|
5
|
+
export declare const MAX_BINARY_DOWNLOAD_BYTES: number;
|
|
6
|
+
export declare const DEFAULT_TIMEOUT_SECONDS = 30;
|
|
7
|
+
export declare const MAX_TIMEOUT_SECONDS = 120;
|
|
8
|
+
export declare const MAX_LLMS_PROBE_TIMEOUT_MS = 8000;
|
|
9
|
+
export declare const MAX_MODEL_CONTENT_CHARS = 100000;
|
|
10
|
+
export declare const DEFAULT_ACCEPT_LANGUAGE = "en;q=0.8,*;q=0.5";
|
|
11
|
+
export declare const BINARY_PREFIXES: string[];
|
|
12
|
+
export declare const WEBFETCH_DESCRIPTION = "Fetch a URL with better extraction for static/docs pages. Supports llms.txt probing, content-focused HTML extraction, metadata, redirects, and an optional prompt processed by a cheap secondary model.";
|