-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.ts
More file actions
59 lines (58 loc) · 2.71 KB
/
types.ts
File metadata and controls
59 lines (58 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import type { Database } from 'bun:sqlite'
import type { PluginConfig, Logger } from '../types'
import type { createLoopEventHandler } from '../hooks'
import type { createOpencodeClient as createV2Client } from '@opencode-ai/sdk/v2'
import type { PluginInput } from '@opencode-ai/plugin'
import type { createSandboxManager } from '../sandbox/manager'
import type { SandboxContext } from '../sandbox/context'
import type { PlansRepo } from '../storage/repos/plans-repo'
import type { ReviewFindingsRepo } from '../storage/repos/review-findings-repo'
import type { LoopsRepo } from '../storage/repos/loops-repo'
import type { SectionPlansRepo } from '../storage/repos/section-plans-repo'
import type { LoopSessionUsageRepo } from '../storage/repos/loop-session-usage-repo'
import type { Loop } from '../loop'
/**
* Context passed to all tool implementations providing access to plugin services.
*/
export interface ToolContext {
/** The current project ID. */
projectId: string
/** The working directory of the project. */
directory: string
/** The plugin configuration. */
config: PluginConfig
/** Logger instance for the plugin. */
logger: Logger
/** Bun SQLite database instance. */
db: Database
/** Data directory path for plugin storage. */
dataDir: string
/** Loop event handler for triggering loop lifecycle events. */
loopHandler: ReturnType<typeof createLoopEventHandler>
/** Loop runtime interface for state management and lifecycle operations. */
loop: Loop
/** OpenCode v2 API client. */
v2: ReturnType<typeof createV2Client>
/** Cleanup function to call on plugin shutdown. */
cleanup: () => Promise<void>
/** Original plugin input from OpenCode. */
input: PluginInput
/** Sandbox manager instance, null if sandboxing is disabled. */
sandboxManager: ReturnType<typeof createSandboxManager> | null
/** Plans repo for plan storage. */
plansRepo: PlansRepo
/** Review findings repo for review findings storage. */
reviewFindingsRepo: ReviewFindingsRepo
/** Loops repo for loop storage. */
loopsRepo: LoopsRepo
/** Section plans repo for section-scoped plan storage. */
sectionPlansRepo: SectionPlansRepo
/** Loop session usage repo for usage tracking. */
loopSessionUsageRepo?: LoopSessionUsageRepo
/** Workspace status registry for tracking workspace readiness. */
workspaceStatusRegistry: import('../utils/workspace-status-registry').WorkspaceStatusRegistry
/** Pending teardown registry for workspace removal context. */
pendingTeardowns: import('../workspace/pending-teardown').PendingTeardownRegistry
/** Resolves the active sandbox context for a session, or null when no sandbox is active. */
resolveSandboxForSession: (sessionID: string) => Promise<SandboxContext | null>
}