@opencode_weave/weave
Advanced tools
| import type { AgentConfig } from "@opencode-ai/sdk"; | ||
| import type { CreatedHooks } from "../../hooks/create-hooks"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| export declare function routeCommandExecuteBefore(input: { | ||
| command: string; | ||
| argumentsText: string; | ||
| directory: string; | ||
| hooks: CreatedHooks; | ||
| agents: Record<string, AgentConfig>; | ||
| }): RuntimeEffect[]; |
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| export declare function executeMetricsCommand(input: { | ||
| directory: string; | ||
| argumentsText: string; | ||
| analyticsEnabled: boolean; | ||
| }): RuntimeEffect[]; |
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeChatMessageInput } from "../policy/runtime-policy"; | ||
| export declare function executeRunWorkflowCommand(input: { | ||
| hooks: RuntimeChatMessageInput["hooks"]; | ||
| promptText: string; | ||
| sessionId: string; | ||
| parsedEnvelope: RuntimeChatMessageInput["parsedEnvelope"]; | ||
| isRunWorkflowCommand: boolean; | ||
| }): RuntimeEffect[]; |
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeChatMessageInput } from "../policy/runtime-policy"; | ||
| export declare function executeStartWorkCommand(input: { | ||
| hooks: RuntimeChatMessageInput["hooks"]; | ||
| promptText: string; | ||
| sessionId: string; | ||
| parsedEnvelope: RuntimeChatMessageInput["parsedEnvelope"]; | ||
| isWorkflowCommand: boolean; | ||
| }): RuntimeEffect[]; |
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| export declare function executeTokenReportCommand(directory: string): RuntimeEffect[]; |
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { AgentConfig } from "@opencode-ai/sdk"; | ||
| export declare function executeWeaveHealthCommand(agents: Record<string, AgentConfig>): RuntimeEffect[]; |
| import type { RuntimeSessionIdleInput } from "../policy/runtime-policy"; | ||
| import { type ExecutionLeaseSnapshot } from "../../domain/session/execution-lease"; | ||
| export type ExecutionOwner = "none" | "plan" | "workflow"; | ||
| export interface ExecutionSnapshot extends ExecutionLeaseSnapshot { | ||
| } | ||
| export declare function getExecutionSnapshot(directory: string): ExecutionSnapshot; | ||
| export declare function shouldAutoPauseForUserMessage(input: { | ||
| directory: string; | ||
| sessionId: string; | ||
| isBuiltinCommand: boolean; | ||
| isContinuation: boolean; | ||
| }): boolean; | ||
| export declare function shouldHandleWorkflowCommand(directory: string, sessionId: string): boolean; | ||
| export declare function shouldCheckWorkflowContinuation(hooks: RuntimeSessionIdleInput["hooks"], directory: string): boolean; | ||
| export declare function shouldCheckWorkContinuation(hooks: RuntimeSessionIdleInput["hooks"], directory: string): boolean; | ||
| export declare function doesSessionOwnExecution(directory: string, sessionId: string, owner?: ExecutionOwner): boolean; | ||
| export declare function shouldFinalizeTodos(hooks: RuntimeSessionIdleInput["hooks"], directory: string, continuationFired: boolean): boolean; |
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeSessionIdleInput } from "../policy/runtime-policy"; | ||
| export interface IdleCycleInput { | ||
| sessionId: string; | ||
| directory: string; | ||
| hooks: RuntimeSessionIdleInput["hooks"]; | ||
| lastAssistantMessage?: string; | ||
| lastUserMessage?: string; | ||
| todoContinuationEnforcer: { | ||
| checkAndFinalize: (sessionId: string) => Promise<void>; | ||
| } | null; | ||
| } | ||
| export interface IdleContinuationStepResult { | ||
| effects: RuntimeEffect[]; | ||
| continuationFired: boolean; | ||
| } | ||
| export declare function runWorkflowIdleStep(input: IdleCycleInput): RuntimeEffect[]; | ||
| export declare function runWorkIdleStep(input: IdleCycleInput): IdleContinuationStepResult; | ||
| export declare function runTodoFinalizationIdleStep(input: IdleCycleInput, continuationFired: boolean): Promise<void>; | ||
| export declare function runVerificationIdleStep(_input: IdleCycleInput): RuntimeEffect[]; | ||
| export declare function runIdleCycle(input: IdleCycleInput): Promise<RuntimeEffect[]>; |
| export type { RuntimePolicyFlags, RuntimeAssistantMessageInput, RuntimeAfterToolInput, RuntimeBeforeCompactionInput, RuntimeBeforeToolInput, RuntimeChatMessageInput, RuntimeCompactionInput, RuntimeSessionDeletedInput, RuntimeSessionIdleInput, RuntimeLifecyclePolicySurface, RuntimeToolDefinitionInput, } from "../policy/runtime-policy"; | ||
| import type { CreatedHooks } from "../../hooks/create-hooks"; | ||
| import type { PluginContext } from "../../plugin/types"; | ||
| export declare function createRuntimeLifecyclePolicySurface(args: { | ||
| hooks: CreatedHooks; | ||
| client?: PluginContext["client"]; | ||
| }): import("../policy/runtime-policy").RuntimeLifecyclePolicySurface; |
| import type { ParsedCommandEnvelope } from "../../runtime/opencode/command-envelope"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeChatMessageInput } from "./runtime-policy"; | ||
| export interface ChatPolicyInput { | ||
| directory: string; | ||
| hooks: RuntimeChatMessageInput["hooks"]; | ||
| parsedEnvelope: ParsedCommandEnvelope | null; | ||
| promptText: string; | ||
| sessionId: string; | ||
| } | ||
| export interface ChatPolicy { | ||
| onChatMessage(input: ChatPolicyInput): PolicyResult<RuntimeEffect> | Promise<PolicyResult<RuntimeEffect>>; | ||
| } | ||
| export declare function createCommandChatPolicy(): ChatPolicy; | ||
| export declare function createAutoPauseChatPolicy(): ChatPolicy; | ||
| export declare function createTodoFinalizationChatPolicy(todoContinuationEnforcer?: { | ||
| clearFinalized: (sessionId: string) => void; | ||
| } | null): ChatPolicy; |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeBeforeCompactionInput, RuntimeCompactionInput } from "./runtime-policy"; | ||
| export interface CompactionSessionPolicy { | ||
| beforeCompaction(input: RuntimeBeforeCompactionInput): void | Promise<void>; | ||
| onCompaction(input: RuntimeCompactionInput): PolicyResult<RuntimeEffect> | Promise<PolicyResult<RuntimeEffect>>; | ||
| onSessionDeleted?(sessionId: string): void; | ||
| } | ||
| export declare function createCompactionSessionPolicy(compactionPreserver?: { | ||
| capture: (sessionId: string) => Promise<void>; | ||
| restore: (sessionId: string) => Promise<void>; | ||
| clearSession: (sessionId: string) => void; | ||
| } | null): CompactionSessionPolicy; |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeAssistantMessageInput } from "./runtime-policy"; | ||
| export interface ContextWindowSessionPolicy { | ||
| onAssistantMessage(input: RuntimeAssistantMessageInput): PolicyResult<RuntimeEffect>; | ||
| } | ||
| export declare function createContextWindowSessionPolicy(): ContextWindowSessionPolicy; |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeBeforeToolInput } from "./runtime-policy"; | ||
| export interface PatternToolPolicy { | ||
| beforeTool(input: RuntimeBeforeToolInput): PolicyResult<RuntimeEffect>; | ||
| } | ||
| export declare function createPatternToolPolicy(): PatternToolPolicy; |
| import type { RuntimeLifecyclePolicySurface } from "./runtime-policy"; | ||
| import type { ChatPolicy } from "./chat-policy"; | ||
| import type { SessionPolicy } from "./session-policy"; | ||
| import type { ToolDefinitionPolicy } from "./tool-definition-policy"; | ||
| import type { ToolPolicy } from "./tool-policy"; | ||
| export declare function createPolicyEngine(args: { | ||
| chatPolicies: ChatPolicy[]; | ||
| toolPolicies: ToolPolicy[]; | ||
| toolDefinitionPolicies: ToolDefinitionPolicy[]; | ||
| sessionPolicies: SessionPolicy[]; | ||
| }): RuntimeLifecyclePolicySurface; |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeBeforeToolInput } from "./runtime-policy"; | ||
| export interface RulesToolPolicy { | ||
| beforeTool(input: RuntimeBeforeToolInput): PolicyResult<RuntimeEffect>; | ||
| } | ||
| export declare function createRulesToolPolicy(): RulesToolPolicy; |
| import type { CreatedHooks } from "../../hooks/create-hooks"; | ||
| import type { ParsedCommandEnvelope } from "../../runtime/opencode/command-envelope"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| export interface RuntimePolicyFlags { | ||
| contextWindowThresholds: { | ||
| warningPct: number; | ||
| criticalPct: number; | ||
| } | null; | ||
| rulesInjectorEnabled: boolean; | ||
| patternMdOnlyEnabled: boolean; | ||
| verificationReminderEnabled: boolean; | ||
| todoDescriptionOverrideEnabled: boolean; | ||
| todoContinuationEnforcerEnabled: boolean; | ||
| } | ||
| export interface RuntimeChatMessageInput { | ||
| directory: string; | ||
| sessionId: string; | ||
| promptText: string; | ||
| parsedEnvelope: ParsedCommandEnvelope | null; | ||
| hooks: RuntimePolicyFlags & Pick<CreatedHooks, "startWork" | "workflowStart" | "workflowCommand" | "continuation">; | ||
| } | ||
| export interface RuntimeBeforeToolInput { | ||
| directory: string; | ||
| sessionId: string; | ||
| tool: string; | ||
| callId: string; | ||
| hooks: RuntimePolicyFlags & Pick<CreatedHooks, "writeGuard">; | ||
| agent?: string; | ||
| toolArgs?: Record<string, unknown> | null; | ||
| } | ||
| export interface RuntimeAfterToolInput { | ||
| directory: string; | ||
| sessionId: string; | ||
| tool: string; | ||
| callId: string; | ||
| hooks: RuntimePolicyFlags; | ||
| agent?: string; | ||
| toolArgs?: Record<string, unknown> | null; | ||
| } | ||
| export interface RuntimeSessionIdleInput { | ||
| directory: string; | ||
| sessionId: string; | ||
| hooks: RuntimePolicyFlags & Pick<CreatedHooks, "continuation" | "workContinuation" | "workflowContinuation">; | ||
| lastAssistantMessage?: string; | ||
| lastUserMessage?: string; | ||
| } | ||
| export interface RuntimeSessionDeletedInput { | ||
| directory: string; | ||
| sessionId: string; | ||
| hooks: RuntimePolicyFlags; | ||
| } | ||
| export interface RuntimeCompactionInput { | ||
| directory: string; | ||
| sessionId: string; | ||
| hooks: RuntimePolicyFlags & Pick<CreatedHooks, "continuation" | "compactionRecovery">; | ||
| enabledAgents?: ReadonlySet<string>; | ||
| } | ||
| export interface RuntimeBeforeCompactionInput { | ||
| directory: string; | ||
| sessionId: string; | ||
| hooks: RuntimePolicyFlags; | ||
| } | ||
| export interface RuntimeAssistantMessageInput { | ||
| sessionId: string; | ||
| hooks: RuntimePolicyFlags; | ||
| inputTokens: number; | ||
| } | ||
| export interface RuntimeToolDefinitionInput { | ||
| toolId: string; | ||
| hooks: RuntimePolicyFlags; | ||
| output: { | ||
| description: string; | ||
| parameters?: unknown; | ||
| }; | ||
| } | ||
| export interface RuntimeLifecyclePolicySurface { | ||
| onChatMessage(input: RuntimeChatMessageInput): RuntimeEffect[] | Promise<RuntimeEffect[]>; | ||
| beforeTool(input: RuntimeBeforeToolInput): RuntimeEffect[] | Promise<RuntimeEffect[]>; | ||
| afterTool(input: RuntimeAfterToolInput): RuntimeEffect[] | Promise<RuntimeEffect[]>; | ||
| onToolDefinition(input: RuntimeToolDefinitionInput): void | Promise<void>; | ||
| onAssistantMessage(input: RuntimeAssistantMessageInput): RuntimeEffect[] | Promise<RuntimeEffect[]>; | ||
| onSessionIdle(input: RuntimeSessionIdleInput): RuntimeEffect[] | Promise<RuntimeEffect[]>; | ||
| onSessionDeleted(input: RuntimeSessionDeletedInput): RuntimeEffect[] | Promise<RuntimeEffect[]>; | ||
| beforeCompaction(input: RuntimeBeforeCompactionInput): void | Promise<void>; | ||
| onCompaction(input: RuntimeCompactionInput): RuntimeEffect[] | Promise<RuntimeEffect[]>; | ||
| } |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeAssistantMessageInput, RuntimeBeforeCompactionInput, RuntimeCompactionInput, RuntimeSessionDeletedInput, RuntimeSessionIdleInput } from "./runtime-policy"; | ||
| export interface SessionPolicy { | ||
| onAssistantMessage(input: RuntimeAssistantMessageInput): PolicyResult<RuntimeEffect> | Promise<PolicyResult<RuntimeEffect>>; | ||
| onSessionIdle(input: RuntimeSessionIdleInput): PolicyResult<RuntimeEffect> | Promise<PolicyResult<RuntimeEffect>>; | ||
| onSessionDeleted(input: RuntimeSessionDeletedInput): PolicyResult<RuntimeEffect> | Promise<PolicyResult<RuntimeEffect>>; | ||
| beforeCompaction?(input: RuntimeBeforeCompactionInput): void | Promise<void>; | ||
| onCompaction(input: RuntimeCompactionInput): PolicyResult<RuntimeEffect> | Promise<PolicyResult<RuntimeEffect>>; | ||
| } | ||
| export declare function createHookBackedSessionPolicy(args?: { | ||
| todoContinuationEnforcer?: { | ||
| checkAndFinalize: (sessionId: string) => Promise<void>; | ||
| clearSession: (sessionId: string) => void; | ||
| } | null; | ||
| compactionPreserver?: { | ||
| capture: (sessionId: string) => Promise<void>; | ||
| restore: (sessionId: string) => Promise<void>; | ||
| clearSession: (sessionId: string) => void; | ||
| } | null; | ||
| }): SessionPolicy; |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeSessionDeletedInput } from "./runtime-policy"; | ||
| export interface TodoSessionPolicy { | ||
| onSessionDeleted(input: RuntimeSessionDeletedInput): PolicyResult<RuntimeEffect>; | ||
| } | ||
| export declare function createTodoSessionPolicy(todoContinuationEnforcer?: { | ||
| clearSession: (sessionId: string) => void; | ||
| } | null): TodoSessionPolicy; |
| import type { RuntimePolicyFlags } from "./runtime-policy"; | ||
| export interface ToolDefinitionPolicyInput { | ||
| toolId: string; | ||
| hooks: RuntimePolicyFlags; | ||
| output: { | ||
| description: string; | ||
| parameters?: unknown; | ||
| }; | ||
| } | ||
| export interface ToolDefinitionPolicy { | ||
| onToolDefinition(input: ToolDefinitionPolicyInput): void | Promise<void>; | ||
| } | ||
| export declare function createTodoDescriptionToolDefinitionPolicy(): ToolDefinitionPolicy; |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeAfterToolInput, RuntimeBeforeToolInput } from "./runtime-policy"; | ||
| export interface ToolPolicy { | ||
| beforeTool(input: RuntimeBeforeToolInput): PolicyResult<RuntimeEffect> | Promise<PolicyResult<RuntimeEffect>>; | ||
| afterTool(input: RuntimeAfterToolInput): PolicyResult<RuntimeEffect> | Promise<PolicyResult<RuntimeEffect>>; | ||
| } | ||
| export declare function createHookBackedToolPolicy(): ToolPolicy; |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeSessionIdleInput } from "./runtime-policy"; | ||
| export interface VerificationSessionPolicy { | ||
| onSessionIdle(input: RuntimeSessionIdleInput): PolicyResult<RuntimeEffect>; | ||
| } | ||
| export declare function createVerificationSessionPolicy(): VerificationSessionPolicy; |
| import { type PolicyResult } from "../../domain/policy/policy-result"; | ||
| import type { RuntimeEffect } from "../../runtime/opencode/effects"; | ||
| import type { RuntimeBeforeToolInput } from "./runtime-policy"; | ||
| export interface WriteGuardToolPolicy { | ||
| beforeTool(input: RuntimeBeforeToolInput): PolicyResult<RuntimeEffect>; | ||
| } | ||
| export declare function createWriteGuardToolPolicy(): WriteGuardToolPolicy; |
| import type { MetricsReport, ProjectFingerprint, SessionSummary } from "../../features/analytics/types"; | ||
| export interface AnalyticsService { | ||
| ensureAnalyticsDir(directory: string): string; | ||
| appendSessionSummary(directory: string, summary: SessionSummary): boolean; | ||
| readSessionSummaries(directory: string): SessionSummary[]; | ||
| writeFingerprint(directory: string, fingerprint: ProjectFingerprint): boolean; | ||
| readFingerprint(directory: string): ProjectFingerprint | null; | ||
| writeMetricsReport(directory: string, report: MetricsReport): boolean; | ||
| readMetricsReports(directory: string): MetricsReport[]; | ||
| } |
| import { type ExecutionLeaseRepository } from "../session/execution-lease"; | ||
| import type { WorkState } from "../../features/work-state/types"; | ||
| import type { PlanRepository } from "./plan-repository"; | ||
| export declare function createFreshPlanExecution(args: { | ||
| planRepository: PlanRepository; | ||
| executionLeaseRepository?: ExecutionLeaseRepository; | ||
| directory: string; | ||
| planPath: string; | ||
| sessionId: string; | ||
| agent: string; | ||
| }): WorkState; | ||
| export declare function resumePlanExecution(args: { | ||
| planRepository: PlanRepository; | ||
| executionLeaseRepository?: ExecutionLeaseRepository; | ||
| directory: string; | ||
| sessionId: string; | ||
| }): WorkState | null; |
| import type { PlanProgress } from "../../features/work-state/types"; | ||
| import type { PlanRepository } from "./plan-repository"; | ||
| export declare function getPlanProgressView(planRepository: PlanRepository, planPath: string): PlanProgress; | ||
| export declare function isPlanComplete(planRepository: PlanRepository, planPath: string): boolean; |
| import type { PlanProgress, WorkState } from "../../features/work-state/types"; | ||
| export interface PlanRepository { | ||
| readWorkState(directory: string): WorkState | null; | ||
| writeWorkState(directory: string, state: WorkState): boolean; | ||
| clearWorkState(directory: string): boolean; | ||
| appendSessionId(directory: string, sessionId: string): WorkState | null; | ||
| createWorkState(planPath: string, sessionId: string, agent?: string, directory?: string): WorkState; | ||
| findPlans(directory: string): string[]; | ||
| getPlanProgress(planPath: string): PlanProgress; | ||
| getPlanName(planPath: string): string; | ||
| getHeadSha(directory: string): string | undefined; | ||
| pauseWork(directory: string): boolean; | ||
| resumeWork(directory: string): boolean; | ||
| } |
| import type { PlanRepository } from "./plan-repository"; | ||
| export declare function findPlanByName(planRepository: PlanRepository, plans: string[], requestedName: string): string | null; | ||
| export declare function listIncompletePlans(planRepository: PlanRepository, plans: string[]): string[]; |
| import type { ValidationResult } from "../../features/work-state"; | ||
| import type { WorkState } from "../../features/work-state/types"; | ||
| import type { PlanRepository } from "./plan-repository"; | ||
| import type { ExecutionLeaseRepository } from "../session/execution-lease"; | ||
| export interface PlanService { | ||
| readWorkState(directory: string): WorkState | null; | ||
| findPlans(directory: string): string[]; | ||
| getPlanProgress(planPath: string): { | ||
| total: number; | ||
| completed: number; | ||
| isComplete: boolean; | ||
| }; | ||
| getPlanName(planPath: string): string; | ||
| findIncompletePlans(plans: string[]): string[]; | ||
| matchPlanByName(plans: string[], requestedName: string): string | null; | ||
| createExecution(directory: string, planPath: string, sessionId: string, agent: string): WorkState; | ||
| resumeExecution(directory: string, sessionId: string): WorkState | null; | ||
| clearExecution(directory: string): boolean; | ||
| } | ||
| export declare function createPlanService(planRepository: PlanRepository): PlanService; | ||
| export declare function createPlanServiceWithExecutionLease(planRepository: PlanRepository, executionLeaseRepository?: ExecutionLeaseRepository): PlanService; | ||
| export type { ValidationResult }; |
| export interface PolicyResult<TEffect> { | ||
| effects: TEffect[]; | ||
| } | ||
| export declare function createPolicyResult<TEffect>(effects?: TEffect[]): PolicyResult<TEffect>; | ||
| export declare function mergePolicyResults<TEffect>(results: Array<PolicyResult<TEffect> | Promise<PolicyResult<TEffect>>>): Promise<TEffect[]>; | ||
| export declare function runPolicySteps(steps: Array<void | Promise<void>>): Promise<void>; |
| import type { ExecutionLeaseState, ExecutionLeaseStatus, ExecutionOwnerKind, SessionRuntimeMode, SessionRuntimeState, SessionRuntimeStatus } from "../../features/work-state/types"; | ||
| export type ExecutionLeaseOwner = ExecutionOwnerKind; | ||
| export type ExecutionTransitionEvent = "observe_ad_hoc_agent" | "start_plan" | "resume_plan" | "start_workflow" | "resume_workflow" | "advance_workflow_step" | "pause_owner" | "complete_owner" | "clear_owner" | "delete_session"; | ||
| export type ExecutionLeaseAction = "preserve" | "upsert" | "clear" | "clear_if_owned_by_session"; | ||
| export type SessionRuntimeAction = "preserve" | "upsert" | "clear"; | ||
| export interface ExecutionStateTransition { | ||
| event: ExecutionTransitionEvent; | ||
| leaseAction: ExecutionLeaseAction; | ||
| sessionAction: SessionRuntimeAction; | ||
| ownerKind?: ExecutionOwnerKind; | ||
| leaseStatus?: ExecutionLeaseStatus; | ||
| sessionMode?: SessionRuntimeMode; | ||
| sessionStatus?: SessionRuntimeStatus; | ||
| foregroundAgent: "observed" | "executor" | "preserve"; | ||
| note: string; | ||
| } | ||
| export interface ExecutionTransitionProjection { | ||
| lease: ExecutionLeaseState | null; | ||
| sessionRuntime: SessionRuntimeState | null; | ||
| } | ||
| export declare const ExecutionStateTransitions: readonly ExecutionStateTransition[]; | ||
| export interface ExecutionLeaseSnapshot { | ||
| owner: ExecutionLeaseOwner; | ||
| ownerRef: string | null; | ||
| status: ExecutionLeaseStatus; | ||
| sessionId: string | null; | ||
| executorAgent: string | null; | ||
| hasActivePlan: boolean; | ||
| hasActiveWorkflow: boolean; | ||
| activePlanPaused: boolean; | ||
| activeWorkflowPaused: boolean; | ||
| } | ||
| export interface ExecutionLeaseRepository { | ||
| readExecutionLease(directory: string): ExecutionLeaseState | null; | ||
| writeExecutionLease(directory: string, state: ExecutionLeaseState): boolean; | ||
| clearExecutionLease(directory: string): boolean; | ||
| readSessionRuntime(directory: string, sessionId: string): SessionRuntimeState | null; | ||
| writeSessionRuntime(directory: string, state: SessionRuntimeState): boolean; | ||
| clearSessionRuntime(directory: string, sessionId: string): boolean; | ||
| getExecutionSnapshot(directory: string): ExecutionLeaseSnapshot; | ||
| } | ||
| export declare function getExecutionStateTransition(event: ExecutionTransitionEvent): ExecutionStateTransition; | ||
| export declare function determineExecutionOwner(snapshot: Omit<ExecutionLeaseSnapshot, "owner" | "ownerRef" | "status" | "sessionId" | "executorAgent">): ExecutionLeaseOwner; | ||
| export declare function createExecutionLeaseState(input: { | ||
| ownerKind: ExecutionOwnerKind; | ||
| ownerRef?: string | null; | ||
| status: ExecutionLeaseStatus; | ||
| sessionId?: string | null; | ||
| executorAgent?: string | null; | ||
| startedAt?: string; | ||
| updatedAt?: string; | ||
| }): ExecutionLeaseState; | ||
| export declare function createSessionRuntimeState(input: { | ||
| sessionId: string; | ||
| foregroundAgent?: string | null; | ||
| mode: SessionRuntimeMode; | ||
| executionRef?: string | null; | ||
| status: SessionRuntimeStatus; | ||
| updatedAt?: string; | ||
| }): SessionRuntimeState; | ||
| export declare function createExecutionLeaseSnapshot(input: { | ||
| lease?: ExecutionLeaseState | null; | ||
| hasActivePlan: boolean; | ||
| hasActiveWorkflow: boolean; | ||
| activePlanPaused: boolean; | ||
| activeWorkflowPaused: boolean; | ||
| }): ExecutionLeaseSnapshot; | ||
| export declare function isExecutionOwnerActive(snapshot: ExecutionLeaseSnapshot, owner: ExecutionLeaseOwner): boolean; | ||
| export declare function isExecutionOwnerPaused(snapshot: ExecutionLeaseSnapshot, owner: ExecutionLeaseOwner): boolean; | ||
| export declare function projectExecutionTransition(input: { | ||
| event: ExecutionTransitionEvent; | ||
| sessionId: string; | ||
| ownerRef?: string | null; | ||
| executionRef?: string | null; | ||
| foregroundAgent?: string | null; | ||
| executorAgent?: string | null; | ||
| currentLease?: ExecutionLeaseState | null; | ||
| currentSessionRuntime?: SessionRuntimeState | null; | ||
| at?: string; | ||
| }): ExecutionTransitionProjection; |
| import type { CompletionContext } from "../../features/workflow"; | ||
| export declare function checkWorkflowCompletion(directory: string, context: CompletionContext): import("../../features/workflow").EngineAction; |
| export declare function buildWorkflowContinuationPrompt(args: { | ||
| sessionId: string; | ||
| body: string; | ||
| }): string; |
| import type { ActiveInstancePointer, StepState, WorkflowDefinition, WorkflowInstance } from "../../features/workflow/types"; | ||
| export interface WorkflowRepository { | ||
| generateInstanceId(): string; | ||
| generateSlug(goal: string): string; | ||
| createWorkflowInstance(definition: WorkflowDefinition, definitionPath: string, goal: string, sessionId: string): WorkflowInstance; | ||
| readWorkflowInstance(directory: string, instanceId: string): WorkflowInstance | null; | ||
| writeWorkflowInstance(directory: string, instance: WorkflowInstance): boolean; | ||
| readActiveInstance(directory: string): ActiveInstancePointer | null; | ||
| setActiveInstance(directory: string, instanceId: string): boolean; | ||
| clearActiveInstance(directory: string): boolean; | ||
| getActiveWorkflowInstance(directory: string): WorkflowInstance | null; | ||
| listInstances(directory: string): string[]; | ||
| appendInstanceSessionId(directory: string, instanceId: string, sessionId: string): WorkflowInstance | null; | ||
| } | ||
| export type { StepState }; |
| import { discoverWorkflows, loadWorkflowDefinition, resumeWorkflow, startWorkflow } from "../../features/workflow"; | ||
| import type { WorkflowHookResult } from "../../features/workflow"; | ||
| import type { WorkflowInstance } from "../../features/workflow"; | ||
| export interface WorkflowService { | ||
| getActiveWorkflowInstance(directory: string): WorkflowInstance | null; | ||
| loadWorkflowDefinition(path: string): ReturnType<typeof loadWorkflowDefinition>; | ||
| discoverWorkflows(directory: string, workflowDirs?: string[]): ReturnType<typeof discoverWorkflows>; | ||
| startWorkflow(args: Parameters<typeof startWorkflow>[0]): ReturnType<typeof startWorkflow>; | ||
| resumeWorkflow(directory: string, sessionId?: string): ReturnType<typeof resumeWorkflow>; | ||
| pauseWorkflow(directory: string, reason?: string): boolean; | ||
| abortWorkflow(directory: string): boolean; | ||
| } | ||
| export declare function createWorkflowService(): WorkflowService; | ||
| export type { WorkflowHookResult }; |
| export declare const OPENROUTER_API_URL = "https://openrouter.ai/api/v1/chat/completions"; | ||
| export interface OpenRouterResponse { | ||
| content: string; | ||
| durationMs: number; | ||
| } | ||
| export declare function callOpenRouter(systemPrompt: string, userMessage: string, model: string, apiKey: string): Promise<OpenRouterResponse>; |
| import type { AnalyticsService } from "../../domain/analytics/analytics-service"; | ||
| export declare const MaxSessionEntries = 1000; | ||
| export declare function createAnalyticsFsStore(): AnalyticsService; |
| import { type WeaveConfig } from "../../config/schema"; | ||
| export interface ConfigDiagnostic { | ||
| level: "warn" | "error"; | ||
| section: string; | ||
| message: string; | ||
| fields?: Array<{ | ||
| path: string; | ||
| message: string; | ||
| }>; | ||
| } | ||
| export interface ConfigLoadResult { | ||
| config: WeaveConfig; | ||
| loadedFiles: string[]; | ||
| diagnostics: ConfigDiagnostic[]; | ||
| } | ||
| export interface ConfigLoader { | ||
| loadWeaveConfig(directory: string, ctx?: unknown, homeDir?: string): WeaveConfig; | ||
| getLastConfigLoadResult(): ConfigLoadResult | null; | ||
| } | ||
| export declare function createConfigFsLoader(): ConfigLoader; |
| import type { ExecutionLeaseRepository } from "../../domain/session/execution-lease"; | ||
| import type { SessionRuntimeState } from "../../features/work-state/types"; | ||
| export declare function createExecutionLeaseFsStore(): ExecutionLeaseRepository; | ||
| export declare function deriveLegacySessionRuntime(directory: string, sessionId: string): SessionRuntimeState | null; |
| import type { PlanRepository } from "../../domain/plans/plan-repository"; | ||
| export declare function createPlanFsRepository(): PlanRepository; |
| import type { PlanProgress, SessionRuntimeState, WorkState } from "../../features/work-state/types"; | ||
| export declare function readWorkStateFromFs(directory: string): WorkState | null; | ||
| export declare function writeWorkStateToFs(directory: string, state: WorkState): boolean; | ||
| export declare function clearWorkStateFromFs(directory: string): boolean; | ||
| export declare function appendSessionIdInFs(directory: string, sessionId: string): WorkState | null; | ||
| export declare function createWorkStateRecord(planPath: string, sessionId: string, agent?: string, directory?: string): WorkState; | ||
| export declare function getHeadShaFromFs(directory: string): string | undefined; | ||
| export declare function findPlansInFs(directory: string): string[]; | ||
| export declare function getPlanProgressFromFs(planPath: string): PlanProgress; | ||
| export declare function getPlanNameFromPath(planPath: string): string; | ||
| export declare function pauseWorkInFs(directory: string): boolean; | ||
| export declare function resumeWorkInFs(directory: string): boolean; | ||
| export declare function readSessionRuntimeFromFs(directory: string, sessionId: string): SessionRuntimeState | null; | ||
| export declare function writeSessionRuntimeToFs(directory: string, state: SessionRuntimeState): boolean; | ||
| export declare function clearSessionRuntimeFromFs(directory: string, sessionId: string): boolean; |
| import type { WorkflowRepository } from "../../domain/workflows/workflow-repository"; | ||
| export declare function createWorkflowFsRepository(): WorkflowRepository; |
| import type { PluginContext } from "../../plugin/types"; | ||
| export interface SessionClient { | ||
| promptAsync(input: { | ||
| sessionId: string; | ||
| parts: Array<{ | ||
| type: "text"; | ||
| text: string; | ||
| }>; | ||
| agent?: string; | ||
| }): Promise<void>; | ||
| restoreAgent(input: { | ||
| sessionId: string; | ||
| agent: string; | ||
| }): Promise<void>; | ||
| todo(sessionId: string): Promise<{ | ||
| data?: unknown[]; | ||
| }>; | ||
| } | ||
| export declare function createSessionClient(client: PluginContext["client"]): SessionClient; |
| import type { PluginContext } from "../../plugin/types"; | ||
| import type { SessionTracker } from "../../features/analytics"; | ||
| import type { RuntimeEffect } from "./effects"; | ||
| export declare function applyRuntimeEffects(args: { | ||
| effects: RuntimeEffect[]; | ||
| output?: { | ||
| message?: Record<string, unknown>; | ||
| parts?: Array<{ | ||
| type: string; | ||
| text?: string; | ||
| }>; | ||
| }; | ||
| client?: PluginContext["client"]; | ||
| tracker?: SessionTracker; | ||
| recordInjectedPrompt?: (sessionId: string, text: string) => void; | ||
| pausePlan?: () => void; | ||
| pauseWorkflow?: (reason: string) => void; | ||
| }): Promise<void>; |
| import { type BuiltinCommandEnvelope, type ContinuationEnvelope } from "./protocol"; | ||
| export type ParsedCommandEnvelope = BuiltinCommandEnvelope | ContinuationEnvelope; | ||
| export declare function parseCommandEnvelope(promptText: string): ParsedCommandEnvelope | null; | ||
| export declare function parseBuiltinCommandEnvelope(promptText: string): BuiltinCommandEnvelope | null; | ||
| export declare function parseContinuationEnvelope(promptText: string): ContinuationEnvelope | null; |
| export type RuntimeEffect = SwitchAgentEffect | RestoreAgentEffect | AppendPromptTextEffect | InjectPromptAsyncEffect | PauseExecutionEffect | TrackAnalyticsEffect | AppendCommandOutputEffect; | ||
| export interface SwitchAgentEffect { | ||
| type: "switchAgent"; | ||
| agent: string; | ||
| } | ||
| export interface RestoreAgentEffect { | ||
| type: "restoreAgent"; | ||
| sessionId: string; | ||
| agent: string; | ||
| } | ||
| export interface AppendPromptTextEffect { | ||
| type: "appendPromptText"; | ||
| text: string; | ||
| separator?: string; | ||
| } | ||
| export interface InjectPromptAsyncEffect { | ||
| type: "injectPromptAsync"; | ||
| sessionId: string; | ||
| text: string; | ||
| agent?: string | null; | ||
| } | ||
| export interface PauseExecutionEffect { | ||
| type: "pauseExecution"; | ||
| target: "plan" | "workflow" | "both" | "none"; | ||
| reason: string; | ||
| sessionId?: string; | ||
| } | ||
| export interface TrackAnalyticsEffect { | ||
| type: "trackAnalytics"; | ||
| event: { | ||
| kind: "setAgentName"; | ||
| sessionId: string; | ||
| agent: string; | ||
| } | { | ||
| kind: "trackModel"; | ||
| sessionId: string; | ||
| modelId: string; | ||
| } | { | ||
| kind: "endSession"; | ||
| sessionId: string; | ||
| } | { | ||
| kind: "trackCost"; | ||
| sessionId: string; | ||
| cost: number; | ||
| } | { | ||
| kind: "trackTokenUsage"; | ||
| sessionId: string; | ||
| usage: { | ||
| input: number; | ||
| output: number; | ||
| reasoning: number; | ||
| cacheRead: number; | ||
| cacheWrite: number; | ||
| }; | ||
| } | { | ||
| kind: "trackToolStart"; | ||
| sessionId: string; | ||
| tool: string; | ||
| callId: string; | ||
| agent?: string; | ||
| } | { | ||
| kind: "trackToolEnd"; | ||
| sessionId: string; | ||
| tool: string; | ||
| callId: string; | ||
| agent?: string; | ||
| }; | ||
| } | ||
| export interface AppendCommandOutputEffect { | ||
| type: "appendCommandOutput"; | ||
| text: string; | ||
| } |
| import type { CreatedHooks } from "../../hooks/create-hooks"; | ||
| import type { PluginContext } from "../../plugin/types"; | ||
| import type { SessionTracker } from "../../features/analytics"; | ||
| import type { RuntimeEffect } from "./effects"; | ||
| import type { RuntimeLifecyclePolicySurface } from "../../application/orchestration/session-runtime"; | ||
| export interface EventRouterState { | ||
| lastAssistantMessageText: Map<string, string>; | ||
| lastUserMessageText: Map<string, string>; | ||
| } | ||
| export declare function routeRuntimeEvent(input: { | ||
| event: { | ||
| type: string; | ||
| properties?: unknown; | ||
| }; | ||
| directory: string; | ||
| hooks: CreatedHooks; | ||
| enabledAgents?: ReadonlySet<string>; | ||
| client?: PluginContext["client"]; | ||
| tracker?: SessionTracker; | ||
| state: EventRouterState; | ||
| lifecyclePolicy: RuntimeLifecyclePolicySurface; | ||
| }): Promise<RuntimeEffect[]>; | ||
| export declare function handlePauseExecutionEffect(input: { | ||
| effectReason: string; | ||
| directory: string; | ||
| sessionId?: string; | ||
| target?: "plan" | "workflow" | "both" | "none"; | ||
| }): void; |
| import type { AgentConfig } from "@opencode-ai/sdk"; | ||
| import type { WeaveConfig } from "../../config/schema"; | ||
| import type { ConfigHandler } from "../../managers/config-handler"; | ||
| import type { CreatedHooks } from "../../hooks/create-hooks"; | ||
| import type { PluginContext, ToolsRecord } from "../../plugin/types"; | ||
| import type { SessionTracker } from "../../features/analytics"; | ||
| export declare function createPluginAdapter(args: { | ||
| pluginConfig: WeaveConfig; | ||
| hooks: CreatedHooks; | ||
| tools: ToolsRecord; | ||
| configHandler: ConfigHandler; | ||
| agents: Record<string, AgentConfig>; | ||
| client?: PluginContext["client"]; | ||
| directory?: string; | ||
| tracker?: SessionTracker; | ||
| }): { | ||
| config: (config: Record<string, unknown>) => Promise<void>; | ||
| handleChatMessage: (input: { | ||
| sessionID: string; | ||
| }, output: { | ||
| message?: Record<string, unknown>; | ||
| parts?: Array<{ | ||
| type: string; | ||
| text?: string; | ||
| }>; | ||
| }) => Promise<void>; | ||
| handleChatParams: (input: { | ||
| sessionID?: string; | ||
| agent?: string; | ||
| model?: { | ||
| id?: string; | ||
| limit?: { | ||
| context?: number; | ||
| }; | ||
| }; | ||
| }) => Promise<void>; | ||
| handleEvent: (input: { | ||
| event: { | ||
| type: string; | ||
| properties?: unknown; | ||
| }; | ||
| }) => Promise<void>; | ||
| handleToolExecuteBefore: (input: { | ||
| sessionID: string; | ||
| tool: string; | ||
| callID: string; | ||
| agent?: string; | ||
| }, output: { | ||
| args?: Record<string, unknown> | null; | ||
| }) => Promise<void>; | ||
| handleToolExecuteAfter: (input: { | ||
| sessionID: string; | ||
| tool: string; | ||
| callID: string; | ||
| args?: Record<string, unknown>; | ||
| }) => Promise<void>; | ||
| handleCommandExecuteBefore: (input: { | ||
| command: string; | ||
| sessionID: string; | ||
| arguments: string; | ||
| }, output: { | ||
| parts: Array<{ | ||
| type: string; | ||
| text: string; | ||
| }>; | ||
| }) => Promise<void>; | ||
| handleToolDefinition: (input: { | ||
| toolID: string; | ||
| }, output: { | ||
| description: string; | ||
| parameters?: unknown; | ||
| }) => Promise<void>; | ||
| handleSessionCompacting: (input: { | ||
| sessionID?: string; | ||
| }) => Promise<void>; | ||
| }; |
| export declare const WEAVE_COMMAND_ENVELOPE_TAG = "weave-command-envelope"; | ||
| export declare const WEAVE_CONTINUATION_ENVELOPE_TAG = "weave-continuation-envelope"; | ||
| export declare const WEAVE_PROTOCOL_VERSION = "1"; | ||
| export declare const FINALIZE_TODOS_MARKER = "<!-- weave:finalize-todos -->"; | ||
| export type BuiltinCommandEnvelopeName = "start-work" | "run-workflow" | "metrics" | "token-report" | "weave-health"; | ||
| export type ContinuationEnvelopeKind = "work" | "workflow" | "todo-finalize"; | ||
| export interface BuiltinCommandEnvelope { | ||
| kind: "builtin-command"; | ||
| source: "envelope" | "legacy"; | ||
| protocolVersion?: string; | ||
| command: BuiltinCommandEnvelopeName; | ||
| arguments: string; | ||
| sessionId: string | null; | ||
| timestamp: string | null; | ||
| } | ||
| export interface ContinuationEnvelope { | ||
| kind: "continuation"; | ||
| source: "envelope" | "legacy"; | ||
| protocolVersion?: string; | ||
| continuation: ContinuationEnvelopeKind; | ||
| sessionId: string | null; | ||
| planName?: string | null; | ||
| planPath?: string | null; | ||
| progress?: string | null; | ||
| workingDirectory?: string | null; | ||
| } | ||
| export type ParsedWeaveEnvelope = BuiltinCommandEnvelope | ContinuationEnvelope; | ||
| export declare function renderBuiltinCommandEnvelope(input: { | ||
| command: BuiltinCommandEnvelopeName; | ||
| arguments: string; | ||
| sessionId?: string; | ||
| timestamp?: string; | ||
| }): string; | ||
| export declare function renderContinuationEnvelope(input: { | ||
| continuation: ContinuationEnvelopeKind; | ||
| sessionId?: string; | ||
| planName?: string; | ||
| planPath?: string; | ||
| progress?: string; | ||
| workingDirectory?: string; | ||
| }): string; | ||
| export declare function parseEnvelopeBlock(text: string, tagName: string): Record<string, string> | null; |
| import type { BuiltinCommandEnvelopeName } from "./protocol"; | ||
| import { type ParsedCommandEnvelope } from "./command-envelope"; | ||
| export interface TrustedMessageState { | ||
| registerBuiltinCommand(sessionId: string, command: BuiltinCommandEnvelopeName, argumentsText: string): void; | ||
| registerInjectedPrompt(sessionId: string, text: string): void; | ||
| clearSession(sessionId: string): void; | ||
| clearPendingBuiltin(sessionId: string): void; | ||
| consumeTrustedEnvelope(sessionId: string, promptText: string): ParsedCommandEnvelope | null; | ||
| } | ||
| export declare function createTrustedMessageState(): TrustedMessageState; |
@@ -15,3 +15,4 @@ /** | ||
| } | ||
| export declare function buildTapestryRoleSection(disabled?: Set<string>): string; | ||
| export declare function buildTapestryRoleSection(): string; | ||
| export declare function buildTapestryInvariantSection(): string; | ||
| export declare function buildTapestryDisciplineSection(): string; | ||
@@ -18,0 +19,0 @@ export declare function buildTapestrySidebarTodosSection(): string; |
@@ -1,21 +0,4 @@ | ||
| import { type WeaveConfig } from "./schema"; | ||
| export interface ConfigDiagnostic { | ||
| level: "warn" | "error"; | ||
| section: string; | ||
| message: string; | ||
| /** Individual field-level issues within the section */ | ||
| fields?: Array<{ | ||
| path: string; | ||
| message: string; | ||
| }>; | ||
| } | ||
| export interface ConfigLoadResult { | ||
| config: WeaveConfig; | ||
| /** Config files that were found and loaded (may be empty) */ | ||
| loadedFiles: string[]; | ||
| /** Validation diagnostics — empty when config is fully valid */ | ||
| diagnostics: ConfigDiagnostic[]; | ||
| } | ||
| /** Retrieve the most recent config load result (for /weave-health command). */ | ||
| export declare function getLastConfigLoadResult(): ConfigLoadResult | null; | ||
| export declare function loadWeaveConfig(directory: string, _ctx?: unknown, _homeDir?: string): WeaveConfig; | ||
| import type { WeaveConfig } from "./schema"; | ||
| export type { ConfigDiagnostic, ConfigLoadResult } from "../infrastructure/fs/config-fs-loader"; | ||
| export declare function getLastConfigLoadResult(): import("./loader").ConfigLoadResult | null; | ||
| export declare function loadWeaveConfig(directory: string, ctx?: unknown, homeDir?: string): WeaveConfig; |
@@ -6,2 +6,3 @@ export type { ToolUsageEntry, DelegationEntry, SessionSummary, TokenUsage, MetricsTokenUsage, AdherenceReport, MetricsReport, QualityReport, SessionTokenBreakdown, DetectedStack, ProjectFingerprint, InFlightToolCall, TrackedSession, } from "./types"; | ||
| export { SessionTracker, createSessionTracker } from "./session-tracker"; | ||
| export type { AnalyticsService } from "../../domain/analytics/analytics-service"; | ||
| export { generateTokenReport, getTokenReport } from "./token-report"; | ||
@@ -8,0 +9,0 @@ export { formatMetricsMarkdown } from "./format-metrics"; |
@@ -1,2 +0,2 @@ | ||
| import type { SessionSummary, ProjectFingerprint, MetricsReport } from "./types"; | ||
| import type { MetricsReport, ProjectFingerprint, SessionSummary } from "./types"; | ||
| /** Maximum number of session summary entries to keep in the JSONL file */ | ||
@@ -3,0 +3,0 @@ export declare const MAX_SESSION_ENTRIES = 1000; |
@@ -1,1 +0,1 @@ | ||
| export declare const START_WORK_TEMPLATE = "You are being activated by the /start-work command to execute a Weave plan.\n\n## Your Mission\nRead and execute the work plan, completing each task systematically.\n\n## Startup Procedure\n\n1. **Check for active work state**: Read `.weave/state.json` to see if there's a plan already in progress.\n2. **If resuming**: The system has injected context below with the active plan path and progress. Read the plan file, find the first unchecked `- [ ]` task, and continue from there.\n3. **If starting fresh**: The system has selected a plan and created work state. Read the plan file and begin from the first task.\n\n## Execution Loop\n\nFor each unchecked `- [ ]` task in the plan:\n\n1. **Read** the task description, acceptance criteria, and any references\n2. **Execute** the task \u2014 write code, run commands, create files as needed\n3. **Verify** the work \u2014 run tests, check for errors, validate acceptance criteria\n4. **Mark complete** \u2014 use the Edit tool to change `- [ ]` to `- [x]` in the plan file\n5. **Move on** \u2014 find the next unchecked task and repeat\n\n## Rules\n\n- Work through tasks **top to bottom** unless dependencies require a different order\n- **Verify every task** before marking it complete\n- If blocked on a task, document the reason as a comment in the plan and move to the next unblocked task\n- Report progress after each task: \"Completed task N/M: [title]\"\n- Do NOT stop until all checkboxes are checked or you are explicitly told to stop\n- After all tasks are complete, report a final summary"; | ||
| export declare const START_WORK_TEMPLATE = "You are being activated by the /start-work command to execute a Weave plan.\n\n## Your Mission\nRead and execute the work plan, completing each unchecked task until every checkbox is checked.\n\nExecution is non-terminal while any `- [ ]` task remains.\nDo not stop, ask what to do next, or wait for acknowledgment while unchecked tasks remain.\n\n## Startup Procedure\n\n1. **Check for active work state**: Read `.weave/state.json` to see if there's a plan already in progress.\n2. **If resuming**: The system has injected context below with the active plan path and progress. Read the plan file, find the first unchecked `- [ ]` task, and continue from there.\n3. **If starting fresh**: The system has selected a plan and created work state. Read the plan file and begin from the first unchecked task.\n\n## Execution Loop\n\nFor each unchecked `- [ ]` task in the plan:\n\n1. **Read** the task description, acceptance criteria, and any references\n2. **Execute** the task \u2014 write code, run commands, create files as needed\n3. **Verify** the work \u2014 run tests, check for errors, validate acceptance criteria\n4. **Mark complete** \u2014 use the Edit tool to change `- [ ]` to `- [x]` in the plan file\n5. **Report progress** \u2014 \"Completed task N/M: [title]\"\n6. **Continue immediately** \u2014 find the next unchecked task and begin it without waiting for user acknowledgment\n\n## Rules\n\n- Work through tasks **top to bottom** unless dependencies require a different order\n- **Verify every task** before marking it complete\n- A progress update is **not** a stopping point\n- Do **not** ask the user what to do next while unchecked tasks remain\n- Do **not** mention final review or final summary while unchecked tasks remain\n- If the current task is blocked, document the reason and move to the next unchecked task that is not blocked\n- Stop only when:\n 1. all checkboxes are checked, or\n 2. the user explicitly tells you to stop, or\n 3. every remaining unchecked task is truly blocked\n- After all tasks are complete, run any required post-execution review and then report a final summary"; |
| import type { EvalArtifacts, ExecutionContext, ModelResponseExecutor, ResolvedTarget } from "../types"; | ||
| /** | ||
| * Executes a model-response eval case by calling the GitHub Models API. | ||
| * | ||
| * Phase 2 is live-only — requires GITHUB_TOKEN env var. | ||
| */ | ||
| export declare function executeModelResponse(resolvedTarget: ResolvedTarget, executor: ModelResponseExecutor, context: ExecutionContext): Promise<EvalArtifacts>; |
@@ -12,5 +12,5 @@ /** | ||
| */ | ||
| export type { EvalPhase, EvalTarget, ExecutorSpec, EvaluatorSpec, EvalSuiteManifest, EvalCase, LoadedEvalCase, LoadedEvalSuiteManifest, EvalArtifacts, AssertionResult, EvalCaseResult, EvalRunResult, EvalRunSummary, RunEvalSuiteOptions, RunnerFilters, TrajectoryScenario, TrajectoryTurn, TrajectoryTrace, TrajectoryTurnResult, TrajectoryAssertionEvaluator, } from "./types"; | ||
| export type { EvalPhase, EvalRoutingKind, EvalTarget, ExecutorSpec, EvaluatorSpec, EvalSuiteManifest, EvalSuiteMetadata, EvalCase, LoadedEvalCase, LoadedEvalSuiteManifest, EvalArtifacts, AssertionResult, EvalCaseResult, EvalRunMetadata, EvalRunResult, EvalRunSummary, RunEvalSuiteOptions, RunnerFilters, TrajectoryScenario, TrajectoryTurn, TrajectoryTrace, TrajectoryTurnResult, TrajectoryAssertionEvaluator, } from "./types"; | ||
| export { isTrajectoryTrace } from "./types"; | ||
| export { EvalCaseSchema, EvalSuiteManifestSchema, EvalRunResultSchema, TrajectoryScenarioSchema, TrajectoryTurnSchema, TrajectoryAssertionEvaluatorSchema, } from "./schema"; | ||
| export { EvalCaseSchema, EvalRoutingKindSchema, EvalSuiteManifestSchema, EvalSuiteMetadataSchema, EvalRunResultSchema, TrajectoryScenarioSchema, TrajectoryTurnSchema, TrajectoryAssertionEvaluatorSchema, } from "./schema"; | ||
| export { EvalConfigError, loadEvalSuiteManifest, loadEvalCasesForSuite, resolveSuitePath, loadTrajectoryScenario, } from "./loader"; | ||
@@ -17,0 +17,0 @@ export { resolveBuiltinAgentTarget } from "./targets/builtin-agent-target"; |
@@ -8,2 +8,21 @@ import { z } from "zod"; | ||
| }>; | ||
| export declare const EvalRoutingKindSchema: z.ZodEnum<{ | ||
| other: "other"; | ||
| trajectory: "trajectory"; | ||
| identity: "identity"; | ||
| intent: "intent"; | ||
| }>; | ||
| export declare const EvalSuiteMetadataSchema: z.ZodObject<{ | ||
| title: z.ZodString; | ||
| routingKind: z.ZodOptional<z.ZodEnum<{ | ||
| other: "other"; | ||
| trajectory: "trajectory"; | ||
| identity: "identity"; | ||
| intent: "intent"; | ||
| }>>; | ||
| familyId: z.ZodOptional<z.ZodString>; | ||
| familyTitle: z.ZodOptional<z.ZodString>; | ||
| viewId: z.ZodOptional<z.ZodString>; | ||
| viewTitle: z.ZodOptional<z.ZodString>; | ||
| }, z.core.$strip>; | ||
| export declare const BuiltinAgentPromptVariantSchema: z.ZodObject<{ | ||
@@ -74,3 +93,6 @@ disabledAgents: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
| kind: z.ZodLiteral<"model-response">; | ||
| provider: z.ZodString; | ||
| provider: z.ZodEnum<{ | ||
| "github-models": "github-models"; | ||
| openrouter: "openrouter"; | ||
| }>; | ||
| model: z.ZodString; | ||
@@ -87,3 +109,6 @@ input: z.ZodString; | ||
| kind: z.ZodLiteral<"model-response">; | ||
| provider: z.ZodString; | ||
| provider: z.ZodEnum<{ | ||
| "github-models": "github-models"; | ||
| openrouter: "openrouter"; | ||
| }>; | ||
| model: z.ZodString; | ||
@@ -141,2 +166,3 @@ input: z.ZodString; | ||
| expectedContains: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
| expectedAnyOf: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
| forbiddenContains: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
@@ -225,2 +251,3 @@ }, z.core.$strip>; | ||
| expectedContains: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
| expectedAnyOf: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
| forbiddenContains: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
@@ -282,3 +309,6 @@ }, z.core.$strip>, z.ZodObject<{ | ||
| kind: z.ZodLiteral<"model-response">; | ||
| provider: z.ZodString; | ||
| provider: z.ZodEnum<{ | ||
| "github-models": "github-models"; | ||
| openrouter: "openrouter"; | ||
| }>; | ||
| model: z.ZodString; | ||
@@ -328,2 +358,3 @@ input: z.ZodString; | ||
| expectedContains: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
| expectedAnyOf: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
| forbiddenContains: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
@@ -357,2 +388,15 @@ }, z.core.$strip>, z.ZodObject<{ | ||
| caseFiles: z.ZodArray<z.ZodString>; | ||
| suiteMetadata: z.ZodOptional<z.ZodObject<{ | ||
| title: z.ZodString; | ||
| routingKind: z.ZodOptional<z.ZodEnum<{ | ||
| other: "other"; | ||
| trajectory: "trajectory"; | ||
| identity: "identity"; | ||
| intent: "intent"; | ||
| }>>; | ||
| familyId: z.ZodOptional<z.ZodString>; | ||
| familyTitle: z.ZodOptional<z.ZodString>; | ||
| viewId: z.ZodOptional<z.ZodString>; | ||
| viewTitle: z.ZodOptional<z.ZodString>; | ||
| }, z.core.$strip>>; | ||
| tags: z.ZodOptional<z.ZodArray<z.ZodString>>; | ||
@@ -459,2 +503,20 @@ }, z.core.$strip>; | ||
| }, z.core.$strip>; | ||
| export declare const EvalRunMetadataSchema: z.ZodObject<{ | ||
| provider: z.ZodOptional<z.ZodString>; | ||
| model: z.ZodOptional<z.ZodString>; | ||
| modelKey: z.ZodOptional<z.ZodString>; | ||
| source: z.ZodOptional<z.ZodEnum<{ | ||
| local: "local"; | ||
| ci: "ci"; | ||
| scheduled: "scheduled"; | ||
| workflow_dispatch: "workflow_dispatch"; | ||
| }>>; | ||
| repo: z.ZodOptional<z.ZodString>; | ||
| branch: z.ZodOptional<z.ZodString>; | ||
| commitSha: z.ZodOptional<z.ZodString>; | ||
| runGroup: z.ZodOptional<z.ZodString>; | ||
| workflow: z.ZodOptional<z.ZodString>; | ||
| job: z.ZodOptional<z.ZodString>; | ||
| matrix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; | ||
| }, z.core.$strip>; | ||
| export declare const EvalRunResultSchema: z.ZodObject<{ | ||
@@ -471,2 +533,33 @@ runId: z.ZodString; | ||
| }>; | ||
| suiteMetadata: z.ZodOptional<z.ZodObject<{ | ||
| title: z.ZodString; | ||
| routingKind: z.ZodOptional<z.ZodEnum<{ | ||
| other: "other"; | ||
| trajectory: "trajectory"; | ||
| identity: "identity"; | ||
| intent: "intent"; | ||
| }>>; | ||
| familyId: z.ZodOptional<z.ZodString>; | ||
| familyTitle: z.ZodOptional<z.ZodString>; | ||
| viewId: z.ZodOptional<z.ZodString>; | ||
| viewTitle: z.ZodOptional<z.ZodString>; | ||
| }, z.core.$strip>>; | ||
| runMetadata: z.ZodOptional<z.ZodObject<{ | ||
| provider: z.ZodOptional<z.ZodString>; | ||
| model: z.ZodOptional<z.ZodString>; | ||
| modelKey: z.ZodOptional<z.ZodString>; | ||
| source: z.ZodOptional<z.ZodEnum<{ | ||
| local: "local"; | ||
| ci: "ci"; | ||
| scheduled: "scheduled"; | ||
| workflow_dispatch: "workflow_dispatch"; | ||
| }>>; | ||
| repo: z.ZodOptional<z.ZodString>; | ||
| branch: z.ZodOptional<z.ZodString>; | ||
| commitSha: z.ZodOptional<z.ZodString>; | ||
| runGroup: z.ZodOptional<z.ZodString>; | ||
| workflow: z.ZodOptional<z.ZodString>; | ||
| job: z.ZodOptional<z.ZodString>; | ||
| matrix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; | ||
| }, z.core.$strip>>; | ||
| summary: z.ZodObject<{ | ||
@@ -473,0 +566,0 @@ totalCases: z.ZodNumber; |
| import type { WeaveAgentName } from "../../agents/types"; | ||
| export declare const EVAL_PHASES: readonly ["prompt", "routing", "trajectory", "experimental"]; | ||
| export type EvalPhase = (typeof EVAL_PHASES)[number]; | ||
| export declare const EVAL_ROUTING_KINDS: readonly ["identity", "intent", "trajectory", "other"]; | ||
| export type EvalRoutingKind = (typeof EVAL_ROUTING_KINDS)[number]; | ||
| export declare const EVAL_TARGET_KINDS: readonly ["builtin-agent-prompt", "custom-agent-prompt", "single-turn-agent", "trajectory-agent"]; | ||
@@ -88,4 +90,13 @@ export type EvalTargetKind = (typeof EVAL_TARGET_KINDS)[number]; | ||
| expectedContains?: string[]; | ||
| expectedAnyOf?: string[]; | ||
| forbiddenContains?: string[]; | ||
| } | ||
| export interface EvalSuiteMetadata { | ||
| title: string; | ||
| routingKind?: EvalRoutingKind; | ||
| familyId?: string; | ||
| familyTitle?: string; | ||
| viewId?: string; | ||
| viewTitle?: string; | ||
| } | ||
| export interface BaselineDiffEvaluator extends WeightedEvaluatorSpec { | ||
@@ -110,2 +121,3 @@ kind: "baseline-diff"; | ||
| caseFiles: string[]; | ||
| suiteMetadata?: EvalSuiteMetadata; | ||
| tags?: string[]; | ||
@@ -175,2 +187,16 @@ } | ||
| } | ||
| export type EvalRunSource = "local" | "ci" | "scheduled" | "workflow_dispatch"; | ||
| export interface EvalRunMetadata { | ||
| provider?: string; | ||
| model?: string; | ||
| modelKey?: string; | ||
| source?: EvalRunSource; | ||
| repo?: string; | ||
| branch?: string; | ||
| commitSha?: string; | ||
| runGroup?: string; | ||
| workflow?: string; | ||
| job?: string; | ||
| matrix?: Record<string, string>; | ||
| } | ||
| export interface EvalRunResult { | ||
@@ -182,2 +208,4 @@ runId: string; | ||
| phase: EvalPhase; | ||
| suiteMetadata?: EvalSuiteMetadata; | ||
| runMetadata?: EvalRunMetadata; | ||
| summary: EvalRunSummary; | ||
@@ -194,3 +222,5 @@ caseResults: EvalCaseResult[]; | ||
| outputPath?: string; | ||
| providerOverride?: string; | ||
| modelOverride?: string; | ||
| runMetadata?: EvalRunMetadata; | ||
| } | ||
@@ -208,3 +238,5 @@ export interface RunnerFilters { | ||
| mode?: ExecutionContext["mode"]; | ||
| providerOverride?: string; | ||
| modelOverride?: string; | ||
| runMetadata?: EvalRunMetadata; | ||
| } | ||
@@ -211,0 +243,0 @@ export interface EvalLoadErrorContext { |
@@ -7,3 +7,11 @@ /** Root directory for Weave state and plans */ | ||
| export declare const WORK_STATE_PATH = ".weave/state.json"; | ||
| /** Directory containing runtime execution/session state */ | ||
| export declare const RUNTIME_DIR = ".weave/runtime"; | ||
| /** Repo-scoped execution lease file */ | ||
| export declare const ACTIVE_EXECUTION_FILE = "active-execution.json"; | ||
| /** Full relative path to active execution lease */ | ||
| export declare const ACTIVE_EXECUTION_PATH = ".weave/runtime/active-execution.json"; | ||
| /** Directory containing per-session runtime records */ | ||
| export declare const SESSION_RUNTIME_DIR = ".weave/runtime/sessions"; | ||
| /** Directory where plan files are stored */ | ||
| export declare const PLANS_DIR = ".weave/plans"; |
@@ -1,2 +0,2 @@ | ||
| import type { WorkState, PlanProgress } from "./types"; | ||
| import type { PlanProgress, WorkState } from "./types"; | ||
| /** | ||
@@ -3,0 +3,0 @@ * Read work state from .weave/state.json. |
@@ -0,2 +1,29 @@ | ||
| export type ExecutionOwnerKind = "none" | "plan" | "workflow"; | ||
| export type ExecutionLeaseStatus = "running" | "paused" | "completed"; | ||
| export type SessionRuntimeMode = "ad_hoc" | "plan" | "workflow"; | ||
| export type SessionRuntimeStatus = "running" | "paused" | "awaiting_user" | "idle"; | ||
| /** | ||
| * Repo-scoped runtime execution lease stored at .weave/runtime/active-execution.json. | ||
| */ | ||
| export interface ExecutionLeaseState { | ||
| owner_kind: ExecutionOwnerKind; | ||
| owner_ref: string | null; | ||
| status: ExecutionLeaseStatus; | ||
| session_id: string | null; | ||
| executor_agent: string | null; | ||
| started_at: string; | ||
| updated_at: string; | ||
| } | ||
| /** | ||
| * Session-scoped runtime state stored at .weave/runtime/sessions/{sessionId}.json. | ||
| */ | ||
| export interface SessionRuntimeState { | ||
| session_id: string; | ||
| foreground_agent: string | null; | ||
| mode: SessionRuntimeMode; | ||
| execution_ref: string | null; | ||
| status: SessionRuntimeStatus; | ||
| updated_at: string; | ||
| } | ||
| /** | ||
| * Tracks the active plan being executed via /start-work. | ||
@@ -24,2 +51,4 @@ * Stored at .weave/state.json in the project root. | ||
| stale_continuation_count?: number; | ||
| /** Whether the completion verification reminder was already sent */ | ||
| verification_reminder_sent?: boolean; | ||
| } | ||
@@ -26,0 +55,0 @@ /** |
@@ -17,2 +17,2 @@ /** | ||
| */ | ||
| export declare function handleWorkflowCommand(message: string, directory: string): WorkflowCommandResult; | ||
| export declare function handleWorkflowCommand(message: string, directory: string, sessionId?: string): WorkflowCommandResult; |
@@ -1,2 +0,2 @@ | ||
| import type { WorkflowDefinition, WorkflowInstance, ActiveInstancePointer } from "./types"; | ||
| import type { ActiveInstancePointer, WorkflowDefinition, WorkflowInstance } from "./types"; | ||
| /** | ||
@@ -3,0 +3,0 @@ * Generate a unique instance ID. |
| export interface CompactionRecoveryInput { | ||
| sessionId: string; | ||
| directory: string; | ||
| enabledAgents?: ReadonlySet<string>; | ||
| } | ||
@@ -5,0 +6,0 @@ export interface CompactionRecoveryResult { |
@@ -15,7 +15,5 @@ /** | ||
| capture: (sessionID: string) => Promise<void>; | ||
| handleEvent: (event: { | ||
| type: string; | ||
| properties?: unknown; | ||
| }) => Promise<void>; | ||
| restore: (sessionID: string) => Promise<void>; | ||
| clearSession: (sessionID: string) => void; | ||
| getSnapshot: (sessionID: string) => TodoSnapshot[] | undefined; | ||
| }; |
| import type { WeaveConfig } from "../config/schema"; | ||
| import type { ResolvedContinuationConfig } from "../config/continuation"; | ||
| import { checkContextWindow } from "./context-window-monitor"; | ||
| import { getRulesForFile, shouldInjectRules } from "./rules-injector"; | ||
| import type { ContextWindowThresholds } from "./context-window-monitor"; | ||
| import { shouldApplyVariant, markApplied, markSessionCreated, clearSession } from "./first-message-variant"; | ||
| import { processMessageForKeywords } from "./keyword-detector"; | ||
| import { checkPatternWrite } from "./pattern-md-only"; | ||
| import { buildVerificationReminder } from "./verification-reminder"; | ||
| import { applyTodoDescriptionOverride } from "./todo-description-override"; | ||
| export type CreatedHooks = ReturnType<typeof createHooks>; | ||
@@ -18,3 +14,4 @@ export declare function createHooks(args: { | ||
| }): { | ||
| checkContextWindow: ((state: Parameters<typeof checkContextWindow>[0]) => import("./context-window-monitor").ContextWindowCheckResult) | null; | ||
| contextWindowThresholds: ContextWindowThresholds | null; | ||
| rulesInjectorEnabled: boolean; | ||
| writeGuard: { | ||
@@ -24,4 +21,2 @@ trackRead: (filePath: string) => void; | ||
| } | null; | ||
| shouldInjectRules: typeof shouldInjectRules | null; | ||
| getRulesForFile: typeof getRulesForFile | null; | ||
| firstMessageVariant: { | ||
@@ -34,6 +29,6 @@ shouldApplyVariant: typeof shouldApplyVariant; | ||
| processMessageForKeywords: typeof processMessageForKeywords | null; | ||
| patternMdOnly: typeof checkPatternWrite | null; | ||
| patternMdOnlyEnabled: boolean; | ||
| startWork: ((promptText: string, sessionId: string) => import("./start-work-hook").StartWorkResult) | null; | ||
| workContinuation: ((sessionId: string) => import("./work-continuation").ContinuationResult) | null; | ||
| compactionRecovery: ((sessionId: string) => import("./compaction-recovery").CompactionRecoveryResult) | null; | ||
| compactionRecovery: ((sessionId: string, enabledAgents?: ReadonlySet<string>) => import("./compaction-recovery").CompactionRecoveryResult) | null; | ||
| workflowStart: ((promptText: string, sessionId: string) => import("../features/workflow").WorkflowHookResult) | null; | ||
@@ -44,5 +39,5 @@ workflowContinuation: ((sessionId: string, lastAssistantMessage?: string, lastUserMessage?: string) => { | ||
| }) | null; | ||
| workflowCommand: ((message: string) => import("../features/workflow").WorkflowCommandResult) | null; | ||
| verificationReminder: typeof buildVerificationReminder | null; | ||
| todoDescriptionOverride: typeof applyTodoDescriptionOverride | null; | ||
| workflowCommand: ((message: string, sessionId: string) => import("../features/workflow").WorkflowCommandResult) | null; | ||
| verificationReminderEnabled: boolean; | ||
| todoDescriptionOverrideEnabled: boolean; | ||
| compactionTodoPreserverEnabled: boolean; | ||
@@ -49,0 +44,0 @@ todoContinuationEnforcerEnabled: boolean; |
@@ -18,4 +18,5 @@ export { createHooks } from "./create-hooks"; | ||
| export type { TodoSnapshot } from "./compaction-todo-preserver"; | ||
| export { createTodoContinuationEnforcer, FINALIZE_TODOS_MARKER } from "./todo-continuation-enforcer"; | ||
| export { createTodoContinuationEnforcer } from "./todo-continuation-enforcer"; | ||
| export { FINALIZE_TODOS_MARKER } from "../runtime/opencode/protocol"; | ||
| export { resolveTodoWriter } from "./todo-writer"; | ||
| export type { TodoItem, TodoWriter } from "./todo-writer"; |
@@ -15,3 +15,2 @@ /** | ||
| import { type TodoWriter } from "./todo-writer"; | ||
| export declare const FINALIZE_TODOS_MARKER = "<!-- weave:finalize-todos -->"; | ||
| export declare function createTodoContinuationEnforcer(client: PluginContext["client"], options?: { | ||
@@ -18,0 +17,0 @@ /** Inject a mock todo writer for testing (bypasses dynamic import) */ |
@@ -21,2 +21,4 @@ /** | ||
| continuationPrompt: string | null; | ||
| /** Agent to restore before injecting continuation, when needed */ | ||
| switchAgent?: string | null; | ||
| } | ||
@@ -23,0 +25,0 @@ /** |
+1
-1
| { | ||
| "name": "@opencode_weave/weave", | ||
| "version": "0.7.6-preview.2", | ||
| "version": "0.7.6-preview.3", | ||
| "description": "Weave — lean OpenCode plugin with multi-agent orchestration", | ||
@@ -5,0 +5,0 @@ "author": "Weave", |
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
547292
29.87%180
37.4%13926
29.71%26
8.33%