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,9 @@
|
|
|
1
|
+
import type { PluginConfig, Preset } from './schema';
|
|
2
|
+
export declare function stripOrchestratorModel(agents: Record<string, unknown>, enabled: boolean | undefined, preset: Preset | undefined): void;
|
|
3
|
+
export declare function applyOrchestratorModelConfig(input: {
|
|
4
|
+
agents: Record<string, unknown>;
|
|
5
|
+
enabled: boolean | undefined;
|
|
6
|
+
presets: PluginConfig['presets'];
|
|
7
|
+
configPreset: string | undefined;
|
|
8
|
+
runtimePreset: string | null;
|
|
9
|
+
}): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AgentOverrideConfig, PluginConfig } from './schema';
|
|
2
|
+
/**
|
|
3
|
+
* Get agent override config by name, supporting backward-compatible aliases.
|
|
4
|
+
* Checks both the current name and any legacy alias names.
|
|
5
|
+
*
|
|
6
|
+
* @param config - The plugin configuration
|
|
7
|
+
* @param name - The current agent name
|
|
8
|
+
* @returns The agent-specific override configuration if found
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAgentOverride(config: PluginConfig | undefined, name: string): AgentOverrideConfig | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Get custom agent names declared in config.agents.
|
|
13
|
+
*
|
|
14
|
+
* Custom agents are unknown keys that are neither built-in agent names nor
|
|
15
|
+
* legacy aliases.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getCustomAgentNames(config: PluginConfig | undefined): string[];
|
|
18
|
+
export declare function getAcpAgentNames(config: PluginConfig | undefined): string[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Council Manager
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates multi-LLM council sessions: launches councillors in
|
|
5
|
+
* parallel and collects their results for the council agent to synthesize.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
8
|
+
import type { PluginConfig } from '../config';
|
|
9
|
+
import type { CouncilResult } from '../config/council-schema';
|
|
10
|
+
import type { SubagentDepthTracker } from '../utils/subagent-depth';
|
|
11
|
+
export declare class CouncilManager {
|
|
12
|
+
private client;
|
|
13
|
+
private directory;
|
|
14
|
+
private config?;
|
|
15
|
+
private depthTracker?;
|
|
16
|
+
private tmuxEnabled;
|
|
17
|
+
private deprecatedFields?;
|
|
18
|
+
private legacyMasterModel?;
|
|
19
|
+
constructor(ctx: PluginInput, config?: PluginConfig, depthTracker?: SubagentDepthTracker, tmuxEnabled?: boolean);
|
|
20
|
+
/** Return deprecated config fields detected during parsing (for tool warnings). */
|
|
21
|
+
getDeprecatedFields(): string[] | undefined;
|
|
22
|
+
/** Return the legacy master.model if it was used as fallback. */
|
|
23
|
+
getLegacyMasterModel(): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Run a full council session.
|
|
26
|
+
*
|
|
27
|
+
* 1. Look up the preset
|
|
28
|
+
* 2. Launch all councillors in parallel
|
|
29
|
+
* 3. Collect results (respecting timeout)
|
|
30
|
+
* 4. Return formatted councillor results for synthesis
|
|
31
|
+
*/
|
|
32
|
+
runCouncil(prompt: string, presetName: string | undefined, parentSessionId: string): Promise<CouncilResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Inject a start notification into the parent session so the user
|
|
35
|
+
* sees immediate feedback while councillors are spinning up.
|
|
36
|
+
*/
|
|
37
|
+
private sendStartNotification;
|
|
38
|
+
/**
|
|
39
|
+
* Run a single agent session: create → register → prompt → extract → cleanup.
|
|
40
|
+
*/
|
|
41
|
+
private runAgentSession;
|
|
42
|
+
private runCouncillors;
|
|
43
|
+
/**
|
|
44
|
+
* Run a single councillor across its configured model chain.
|
|
45
|
+
*
|
|
46
|
+
* For each model in the chain, empty responses are retried up to
|
|
47
|
+
* `maxRetries` times (providers that silently rate-limit). Any other
|
|
48
|
+
* failure or timeout advances to the next model in the chain. The
|
|
49
|
+
* councillor only fails once every model has been exhausted; the reported
|
|
50
|
+
* `model` and `error` reflect the last model tried.
|
|
51
|
+
*/
|
|
52
|
+
private runCouncillorWithRetry;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CouncilManager } from './council-manager';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ParsedPatch } from './types';
|
|
2
|
+
export declare function normalizeUnicode(text: string): string;
|
|
3
|
+
export declare function stripHeredoc(input: string): string;
|
|
4
|
+
export declare function normalizePatchText(patchText: string): string;
|
|
5
|
+
export declare function parsePatch(patchText: string): ParsedPatch;
|
|
6
|
+
export declare function parsePatchStrict(patchText: string): ParsedPatch;
|
|
7
|
+
export declare function formatPatch(patch: ParsedPatch): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ApplyPatchErrorCode, ApplyPatchErrorKind } from './types';
|
|
2
|
+
export declare class ApplyPatchError extends Error {
|
|
3
|
+
readonly kind: ApplyPatchErrorKind;
|
|
4
|
+
readonly code: ApplyPatchErrorCode;
|
|
5
|
+
readonly cause?: unknown;
|
|
6
|
+
constructor(kind: ApplyPatchErrorKind, code: ApplyPatchErrorCode, message: string, options?: {
|
|
7
|
+
cause?: unknown;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
11
|
+
export declare function createApplyPatchBlockedError(message: string, cause?: unknown): ApplyPatchError;
|
|
12
|
+
export declare function createApplyPatchValidationError(message: string, cause?: unknown): ApplyPatchError;
|
|
13
|
+
export declare function createApplyPatchVerificationError(message: string, cause?: unknown): ApplyPatchError;
|
|
14
|
+
export declare function createApplyPatchInternalError(message: string, cause?: unknown): ApplyPatchError;
|
|
15
|
+
export declare function isApplyPatchError(error: unknown): error is ApplyPatchError;
|
|
16
|
+
export declare function isApplyPatchBlockedError(error: unknown): boolean;
|
|
17
|
+
export declare function isApplyPatchValidationError(error: unknown): boolean;
|
|
18
|
+
export declare function isApplyPatchVerificationError(error: unknown): boolean;
|
|
19
|
+
export declare function isApplyPatchInternalError(error: unknown): boolean;
|
|
20
|
+
export declare function getApplyPatchErrorDetails(error: unknown): {
|
|
21
|
+
kind: ApplyPatchErrorKind;
|
|
22
|
+
code: ApplyPatchErrorCode;
|
|
23
|
+
message: string;
|
|
24
|
+
} | undefined;
|
|
25
|
+
export declare function ensureApplyPatchError(error: unknown, context: string): ApplyPatchError;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { resolveUpdateChunksFromText } from './resolution';
|
|
2
|
+
import type { ApplyPatchRuntimeOptions, PatchHunk, UpdatePatchHunk } from './types';
|
|
3
|
+
export type PreparedFileState = {
|
|
4
|
+
exists: false;
|
|
5
|
+
derived: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
exists: true;
|
|
8
|
+
text: string;
|
|
9
|
+
mode?: number;
|
|
10
|
+
derived: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type PatchExecutionContext = {
|
|
13
|
+
hunks: PatchHunk[];
|
|
14
|
+
pathsNormalized: boolean;
|
|
15
|
+
staged: Map<string, PreparedFileState>;
|
|
16
|
+
getPreparedFileState: (filePath: string, verb: 'update' | 'delete') => Promise<PreparedFileState>;
|
|
17
|
+
assertPreparedPathMissing: (filePath: string, verb: 'add' | 'move') => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export type ResolvedPreparedUpdate = {
|
|
20
|
+
resolved: Awaited<ReturnType<typeof resolveUpdateChunksFromText>>['resolved'];
|
|
21
|
+
nextText: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function isMissingPathError(error: unknown): boolean;
|
|
24
|
+
export declare function parseValidatedPatch(patchText: string): PatchHunk[];
|
|
25
|
+
export declare function createPatchExecutionContext(root: string, patchText: string, worktree?: string): Promise<PatchExecutionContext>;
|
|
26
|
+
export declare function resolvePreparedUpdate(filePath: string, currentText: string, hunk: UpdatePatchHunk, cfg: ApplyPatchRuntimeOptions): ResolvedPreparedUpdate;
|
|
27
|
+
export declare function stageAddedText(contents: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
interface ToolExecuteBeforeInput {
|
|
3
|
+
tool: string;
|
|
4
|
+
directory?: string;
|
|
5
|
+
}
|
|
6
|
+
interface ToolExecuteBeforeOutput {
|
|
7
|
+
args?: {
|
|
8
|
+
patchText?: unknown;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function createApplyPatchHook(ctx: PluginInput): {
|
|
13
|
+
'tool.execute.before': (input: ToolExecuteBeforeInput, output: ToolExecuteBeforeOutput) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LineComparator, MatchComparatorName, RescueResult, SeekHit } from './types';
|
|
2
|
+
export type PreparedAutoRescueTarget = {
|
|
3
|
+
exact: string;
|
|
4
|
+
unicode: string;
|
|
5
|
+
trimEnd: string;
|
|
6
|
+
unicodeTrimEnd: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function equalExact(a: string, b: string): boolean;
|
|
9
|
+
export declare function equalUnicodeExact(a: string, b: string): boolean;
|
|
10
|
+
export declare function equalTrimEnd(a: string, b: string): boolean;
|
|
11
|
+
export declare function equalUnicodeTrimEnd(a: string, b: string): boolean;
|
|
12
|
+
export declare function equalTrim(a: string, b: string): boolean;
|
|
13
|
+
export declare function equalUnicodeTrim(a: string, b: string): boolean;
|
|
14
|
+
export declare const autoRescueComparators: LineComparator[];
|
|
15
|
+
export declare function prepareAutoRescueTarget(target: string): PreparedAutoRescueTarget;
|
|
16
|
+
export declare function matchPreparedAutoRescueComparator(candidate: string, target: PreparedAutoRescueTarget): MatchComparatorName | undefined;
|
|
17
|
+
export declare const permissiveComparators: LineComparator[];
|
|
18
|
+
export declare function seekMatch(lines: string[], pattern: string[], start: number, eof?: boolean): SeekHit | undefined;
|
|
19
|
+
export declare function seek(lines: string[], pattern: string[], start: number, eof?: boolean): number;
|
|
20
|
+
export declare function list(lines: string[], pattern: string[], start: number, same: LineComparator): number[];
|
|
21
|
+
export declare function sameRescueLine(a: string, b: string): boolean;
|
|
22
|
+
export declare function prefix(old_lines: string[], new_lines: string[]): number;
|
|
23
|
+
export declare function suffix(old_lines: string[], new_lines: string[], prefixLength: number): number;
|
|
24
|
+
export declare function rescueByPrefixSuffix(lines: string[], old_lines: string[], new_lines: string[], start: number): RescueResult;
|
|
25
|
+
export declare function score(a: string[], b: string[]): number;
|
|
26
|
+
export declare function rescueByLcs(lines: string[], old_lines: string[], new_lines: string[], start: number): RescueResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ApplyPatchRuntimeOptions, PreparedChange } from './types';
|
|
2
|
+
export declare function preparePatchChanges(root: string, patchText: string, cfg: ApplyPatchRuntimeOptions, worktree?: string): Promise<PreparedChange[]>;
|
|
3
|
+
/**
|
|
4
|
+
* Internal best-effort helper that applies the output of
|
|
5
|
+
* `preparePatchChanges()`: it snapshots all touched paths first and uses
|
|
6
|
+
* temp + rename for writes to regular files. It is not a universal multi-file
|
|
7
|
+
* transaction and is not perfect against concurrent external interference,
|
|
8
|
+
* but it avoids leaving silent partial states on normal apply failures.
|
|
9
|
+
*
|
|
10
|
+
* Contract: although it is exported for local tests/helpers, its expected
|
|
11
|
+
* input is the already prepared output of `preparePatchChanges()`. If it
|
|
12
|
+
* receives manual arrays, it revalidates the basic shape
|
|
13
|
+
* (types/text/normalized absolute paths) and filesystem invariants: it
|
|
14
|
+
* rejects updates/deletes/moves whose source does not exist, and add/move
|
|
15
|
+
* operations whose destination is already occupied.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyPreparedChanges(changes: PreparedChange[]): Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ApplyPatchRuntimeOptions, MatchHit, PatchChunk, ResolvedChunk } from './types';
|
|
2
|
+
export declare function readFileLines(file: string): Promise<string[]>;
|
|
3
|
+
export declare function resolveChunkStart(lines: string[], chunk: PatchChunk, start: number): number;
|
|
4
|
+
export declare function locateChunk(lines: string[], file: string, chunk: PatchChunk, start: number, cfg: ApplyPatchRuntimeOptions): ResolvedChunk;
|
|
5
|
+
export declare function applyHits(lines: string[], hits: MatchHit[], eol?: '\n' | '\r\n', hasFinalNewline?: boolean): string;
|
|
6
|
+
export declare function resolveUpdateChunks(file: string, chunks: PatchChunk[], cfg: ApplyPatchRuntimeOptions): Promise<{
|
|
7
|
+
lines: string[];
|
|
8
|
+
resolved: ResolvedChunk[];
|
|
9
|
+
eol: '\n' | '\r\n';
|
|
10
|
+
hasFinalNewline: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function deriveNewContentFromText(file: string, text: string, chunks: PatchChunk[], cfg: ApplyPatchRuntimeOptions): string;
|
|
13
|
+
export declare function resolveUpdateChunksFromText(file: string, text: string, chunks: PatchChunk[], cfg: ApplyPatchRuntimeOptions): {
|
|
14
|
+
lines: string[];
|
|
15
|
+
resolved: ResolvedChunk[];
|
|
16
|
+
eol: '\n' | '\r\n';
|
|
17
|
+
hasFinalNewline: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function deriveNewContent(file: string, chunks: PatchChunk[], cfg: ApplyPatchRuntimeOptions): Promise<string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApplyPatchRuntimeOptions } from './types';
|
|
2
|
+
export type RewritePatchResult = {
|
|
3
|
+
patchText: string;
|
|
4
|
+
changed: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function rewritePatch(root: string, patchText: string, cfg: ApplyPatchRuntimeOptions, worktree?: string): Promise<RewritePatchResult>;
|
|
7
|
+
export declare function rewritePatchText(root: string, patchText: string, cfg: ApplyPatchRuntimeOptions, worktree?: string): Promise<string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ApplyPatchRuntimeOptions } from './types';
|
|
2
|
+
export declare const DEFAULT_OPTIONS: ApplyPatchRuntimeOptions;
|
|
3
|
+
export declare function createTempDir(prefix?: string): Promise<string>;
|
|
4
|
+
export declare function writeFixture(root: string, relativePath: string, contents: string): Promise<void>;
|
|
5
|
+
export declare function readText(root: string, relativePath: string): Promise<string>;
|
|
6
|
+
export declare function applyPatch(root: string, patchText: string, cfg?: ApplyPatchRuntimeOptions): Promise<void>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export type ApplyPatchRuntimeOptions = {
|
|
2
|
+
prefixSuffix: boolean;
|
|
3
|
+
lcsRescue: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type ApplyPatchErrorKind = 'blocked' | 'validation' | 'verification' | 'internal';
|
|
6
|
+
export type ApplyPatchErrorCode = 'malformed_patch' | 'outside_workspace' | 'verification_failed' | 'internal_unexpected';
|
|
7
|
+
export type ApplyPatchRescueStrategy = 'prefix/suffix' | 'lcs' | 'anchor';
|
|
8
|
+
export type MatchComparatorName = 'exact' | 'unicode' | 'trim-end' | 'unicode-trim-end' | 'trim' | 'unicode-trim';
|
|
9
|
+
export type PatchChunk = {
|
|
10
|
+
old_lines: string[];
|
|
11
|
+
new_lines: string[];
|
|
12
|
+
change_context?: string;
|
|
13
|
+
is_end_of_file?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type AddPatchHunk = {
|
|
16
|
+
type: 'add';
|
|
17
|
+
path: string;
|
|
18
|
+
contents: string;
|
|
19
|
+
};
|
|
20
|
+
export type DeletePatchHunk = {
|
|
21
|
+
type: 'delete';
|
|
22
|
+
path: string;
|
|
23
|
+
};
|
|
24
|
+
export type UpdatePatchHunk = {
|
|
25
|
+
type: 'update';
|
|
26
|
+
path: string;
|
|
27
|
+
move_path?: string;
|
|
28
|
+
chunks: PatchChunk[];
|
|
29
|
+
};
|
|
30
|
+
export type PatchHunk = AddPatchHunk | DeletePatchHunk | UpdatePatchHunk;
|
|
31
|
+
export type ParsedPatch = {
|
|
32
|
+
hunks: PatchHunk[];
|
|
33
|
+
};
|
|
34
|
+
export type AddPreparedChange = {
|
|
35
|
+
type: 'add';
|
|
36
|
+
file: string;
|
|
37
|
+
text: string;
|
|
38
|
+
};
|
|
39
|
+
export type DeletePreparedChange = {
|
|
40
|
+
type: 'delete';
|
|
41
|
+
file: string;
|
|
42
|
+
};
|
|
43
|
+
export type UpdatePreparedChange = {
|
|
44
|
+
type: 'update';
|
|
45
|
+
file: string;
|
|
46
|
+
move?: string;
|
|
47
|
+
text: string;
|
|
48
|
+
};
|
|
49
|
+
export type PreparedChange = AddPreparedChange | DeletePreparedChange | UpdatePreparedChange;
|
|
50
|
+
export type MatchHit = {
|
|
51
|
+
start: number;
|
|
52
|
+
del: number;
|
|
53
|
+
add: string[];
|
|
54
|
+
};
|
|
55
|
+
export type SeekHit = {
|
|
56
|
+
index: number;
|
|
57
|
+
comparator: MatchComparatorName;
|
|
58
|
+
exact: boolean;
|
|
59
|
+
};
|
|
60
|
+
export type ResolvedChunk = {
|
|
61
|
+
hit: MatchHit;
|
|
62
|
+
old_lines: string[];
|
|
63
|
+
canonical_old_lines: string[];
|
|
64
|
+
canonical_new_lines: string[];
|
|
65
|
+
canonical_change_context?: string;
|
|
66
|
+
resolved_is_end_of_file: boolean;
|
|
67
|
+
rewritten: boolean;
|
|
68
|
+
strategy?: ApplyPatchRescueStrategy;
|
|
69
|
+
matchComparator?: MatchComparatorName;
|
|
70
|
+
};
|
|
71
|
+
export type RescueResult = {
|
|
72
|
+
kind: 'miss';
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'ambiguous';
|
|
75
|
+
phase: 'prefix_suffix' | 'lcs';
|
|
76
|
+
} | {
|
|
77
|
+
kind: 'match';
|
|
78
|
+
hit: MatchHit;
|
|
79
|
+
};
|
|
80
|
+
export type LineComparator = (a: string, b: string) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface AutoUpdateInstallContext {
|
|
2
|
+
installDir: string;
|
|
3
|
+
packageJsonPath: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function resolveInstallContext(runtimePackageJsonPath?: string | null): AutoUpdateInstallContext | null;
|
|
6
|
+
/**
|
|
7
|
+
* Prepares the current install root for a clean re-install of the target version.
|
|
8
|
+
* Returns the install directory to run `bun install` in.
|
|
9
|
+
*/
|
|
10
|
+
export declare function preparePackageUpdate(version: string, packageName?: string, runtimePackageJsonPath?: string | null): string | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CompatibleVersionResult, PluginEntryInfo } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the update channel (latest, alpha, beta, etc.) from a version string.
|
|
4
|
+
* @param version The version or tag to analyze.
|
|
5
|
+
* @returns The channel name.
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractChannel(version: string | null): string;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the version of the plugin when running in local development mode.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getLocalDevVersion(directory: string): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves the package.json for the currently running plugin bundle.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCurrentRuntimePackageJsonPath(currentModuleUrl?: string): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Searches across all config locations to find the current installation entry for this plugin.
|
|
18
|
+
*/
|
|
19
|
+
export declare function findPluginEntry(directory: string): PluginEntryInfo | null;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the installed version from node_modules, with memoization.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getCachedVersion(): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Safely updates a pinned version in the configuration file.
|
|
26
|
+
* It attempts to replace the exact plugin string to preserve comments and formatting.
|
|
27
|
+
*/
|
|
28
|
+
export declare function updatePinnedVersion(configPath: string, oldEntry: string, newVersion: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Fetches the latest version for a specific channel from the NPM registry.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getLatestVersion(channel?: string): Promise<string | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the newest version that is safe for the current install to use.
|
|
35
|
+
* Auto-update never crosses major versions; newer majors are surfaced as a
|
|
36
|
+
* manual migration notification instead.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getLatestCompatibleVersion(currentVersion: string, channel?: string): Promise<CompatibleVersionResult>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const PACKAGE_NAME = "oh-my-opencode-serverlocal";
|
|
2
|
+
export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org/-/package/oh-my-opencode-serverlocal/dist-tags";
|
|
3
|
+
export declare const NPM_PACKAGE_URL = "https://registry.npmjs.org/oh-my-opencode-serverlocal";
|
|
4
|
+
export declare const NPM_FETCH_TIMEOUT = 5000;
|
|
5
|
+
/** The directory used by OpenCode to cache node_modules for plugins. */
|
|
6
|
+
export declare const CACHE_DIR: string;
|
|
7
|
+
/** Path to this plugin's package.json within the OpenCode cache. */
|
|
8
|
+
export declare const INSTALLED_PACKAGE_JSON: string;
|
|
9
|
+
/** Primary OpenCode configuration file path (standard JSON). */
|
|
10
|
+
export declare const USER_OPENCODE_CONFIG: string;
|
|
11
|
+
/** Alternative OpenCode configuration file path (JSON with Comments). */
|
|
12
|
+
export declare const USER_OPENCODE_CONFIG_JSONC: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
import type { AutoUpdateCheckerOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an OpenCode hook that checks for plugin updates when a new session is created.
|
|
5
|
+
* @param ctx The plugin input context.
|
|
6
|
+
* @param options Configuration options for the update checker.
|
|
7
|
+
* @returns A hook object for the session.created event.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createAutoUpdateCheckerHook(ctx: PluginInput, options?: AutoUpdateCheckerOptions): {
|
|
10
|
+
event: ({ event }: {
|
|
11
|
+
event: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties?: unknown;
|
|
14
|
+
};
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function getAutoUpdateInstallDir(): string;
|
|
18
|
+
export type { AutoUpdateCheckerOptions } from './types';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface SkillSyncResult {
|
|
2
|
+
installed: string[];
|
|
3
|
+
skippedExisting: string[];
|
|
4
|
+
failed: string[];
|
|
5
|
+
staged: string[];
|
|
6
|
+
adopted: string[];
|
|
7
|
+
customized: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface SkillManifestEntry {
|
|
10
|
+
status: 'managed' | 'customized' | 'deleted' | 'conflict';
|
|
11
|
+
packageVersion: string;
|
|
12
|
+
sourceHash: string;
|
|
13
|
+
lastManagedHash: string;
|
|
14
|
+
lastSeenHash: string;
|
|
15
|
+
stagedPath?: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SkillsManifest {
|
|
19
|
+
schemaVersion: number;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
skills: Record<string, SkillManifestEntry>;
|
|
22
|
+
}
|
|
23
|
+
interface ManagedSkillSource {
|
|
24
|
+
name: string;
|
|
25
|
+
sourcePath: string;
|
|
26
|
+
}
|
|
27
|
+
interface SkillSyncOptions {
|
|
28
|
+
skills?: ManagedSkillSource[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Hashes of historically managed versions of skills.
|
|
32
|
+
* When a release changes skill content, this table must be populated
|
|
33
|
+
* from the published npm package tarballs to allow upgrading existing users.
|
|
34
|
+
*
|
|
35
|
+
* How to populate:
|
|
36
|
+
* 1. Download previous releases of the npm package: `npm pack oh-my-opencode-slim@<version>`
|
|
37
|
+
* 2. Compute directory hash for each legacy skill directory inside the unpacked tarball:
|
|
38
|
+
* `import { computeDirectoryHash } from './skill-sync';`
|
|
39
|
+
* `const hash = computeDirectoryHash('path/to/extracted/package/src/skills/<skill-name>');`
|
|
40
|
+
* 3. Append the hash to the skill's string array below:
|
|
41
|
+
* ```typescript
|
|
42
|
+
* export const LEGACY_MANAGED_SKILL_HASHES: Record<string, string[]> = {
|
|
43
|
+
* 'simplify': ['hash1', 'hash2'],
|
|
44
|
+
* 'codemap': ['hash3']
|
|
45
|
+
* };
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const LEGACY_MANAGED_SKILL_HASHES: Record<string, string[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Computes a deterministic SHA-256 hash of a directory's files.
|
|
51
|
+
*/
|
|
52
|
+
export declare function computeDirectoryHash(dirPath: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Acquires a simple lock under .oh-my-opencode-slim.
|
|
55
|
+
* Avoids stealing active locks purely by time; writes owner metadata
|
|
56
|
+
* and only steals dead same-host pid if detectable.
|
|
57
|
+
*/
|
|
58
|
+
export declare function acquireLock(lockDir: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Releases the lock.
|
|
61
|
+
*/
|
|
62
|
+
export declare function releaseLock(lockDir: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Synchronizes bundled skills from the newly installed package root to OpenCode config skills directory.
|
|
65
|
+
*/
|
|
66
|
+
export declare function syncBundledSkillsFromPackage(packageRoot: string, options?: SkillSyncOptions): SkillSyncResult;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CompanionConfig } from '../../config/schema';
|
|
2
|
+
export interface NpmDistTags {
|
|
3
|
+
latest: string;
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
}
|
|
6
|
+
export interface NpmPackageMetadata {
|
|
7
|
+
'dist-tags'?: NpmDistTags;
|
|
8
|
+
versions?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface CompatibleVersionResult {
|
|
11
|
+
latestVersion: string | null;
|
|
12
|
+
latestMajorVersion: string | null;
|
|
13
|
+
blockedByMajor: boolean;
|
|
14
|
+
unsafeReason?: 'unparseable-current-version';
|
|
15
|
+
}
|
|
16
|
+
export interface OpencodeConfig {
|
|
17
|
+
plugin?: unknown[];
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface PackageJson {
|
|
21
|
+
version: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
export interface AutoUpdateCheckerOptions {
|
|
26
|
+
autoUpdate?: boolean;
|
|
27
|
+
companion?: CompanionConfig;
|
|
28
|
+
}
|
|
29
|
+
export interface PluginEntryInfo {
|
|
30
|
+
entry: string;
|
|
31
|
+
isPinned: boolean;
|
|
32
|
+
pinnedVersion: string | null;
|
|
33
|
+
configPath: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PluginInput, ProviderContext } from '@opencode-ai/plugin';
|
|
2
|
+
import type { Model, UserMessage } from '@opencode-ai/sdk';
|
|
3
|
+
interface ChatHeadersInput {
|
|
4
|
+
sessionID: string;
|
|
5
|
+
model: Model;
|
|
6
|
+
provider: ProviderContext;
|
|
7
|
+
message: UserMessage;
|
|
8
|
+
}
|
|
9
|
+
interface ChatHeadersOutput {
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export declare function __resetInternalMarkerCacheForTesting(): void;
|
|
13
|
+
export declare function createChatHeadersHook(ctx: PluginInput): {
|
|
14
|
+
'chat.headers': (input: ChatHeadersInput, output: ChatHeadersOutput) => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register a command hook in the OpenCode config if it doesn't already exist.
|
|
3
|
+
* Returns true if the command was registered, false if it already existed.
|
|
4
|
+
*/
|
|
5
|
+
export declare function registerCommandHook(opencodeConfig: Record<string, unknown>, commandName: string, template: string, description: string): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function createDeepworkCommandHook(): {
|
|
2
|
+
registerCommand: (config: Record<string, unknown>) => void;
|
|
3
|
+
handleCommandExecuteBefore: (input: {
|
|
4
|
+
command: string;
|
|
5
|
+
sessionID: string;
|
|
6
|
+
arguments: string;
|
|
7
|
+
}, output: {
|
|
8
|
+
parts: Array<{
|
|
9
|
+
type: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
}>;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface DelegateTaskErrorPattern {
|
|
2
|
+
pattern: string;
|
|
3
|
+
errorType: string;
|
|
4
|
+
fixHint: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const DELEGATE_TASK_ERROR_PATTERNS: DelegateTaskErrorPattern[];
|
|
7
|
+
export interface DetectedError {
|
|
8
|
+
errorType: string;
|
|
9
|
+
originalOutput: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function detectDelegateTaskError(output: string): DetectedError | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter available_skills block based on the current agent's permission.skill rules.
|
|
3
|
+
* OpenCode core injects `<available_skills>` globally, so this hook rewrites that
|
|
4
|
+
* block before the prompt is sent.
|
|
5
|
+
*/
|
|
6
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
7
|
+
import { type PluginConfig } from '../../config';
|
|
8
|
+
type SkillRule = 'allow' | 'ask' | 'deny';
|
|
9
|
+
declare function filterAvailableSkillsText(text: string, permissionRules: Record<string, SkillRule>): string;
|
|
10
|
+
/**
|
|
11
|
+
* Creates the experimental.chat.messages.transform hook for filtering available skills.
|
|
12
|
+
* This hook runs right before sending to API, so it doesn't affect UI display.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createFilterAvailableSkillsHook(_ctx: PluginInput, config: PluginConfig): {
|
|
15
|
+
'experimental.chat.messages.transform': (_input: Record<string, never>, output: {
|
|
16
|
+
messages?: unknown;
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export { filterAvailableSkillsText };
|