@a4hgehad/weave-mcp 0.8.6 → 0.8.7
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/README.md +23 -8
- package/dist/agents/agent-builder.d.ts +49 -0
- package/dist/agents/builtin-agents.d.ts +34 -0
- package/dist/agents/custom-agent-factory.d.ts +24 -0
- package/dist/agents/dynamic-prompt-builder.d.ts +35 -0
- package/dist/agents/index.d.ts +12 -0
- package/dist/agents/loom/default.d.ts +2 -0
- package/dist/agents/loom/index.d.ts +11 -0
- package/dist/agents/loom/prompt-composer.d.ts +35 -0
- package/dist/agents/model-resolution.d.ts +27 -0
- package/dist/agents/pattern/default.d.ts +2 -0
- package/dist/agents/pattern/index.d.ts +2 -0
- package/dist/agents/prompt-loader.d.ts +9 -0
- package/dist/agents/prompt-utils.d.ts +2 -0
- package/dist/agents/shuttle/default.d.ts +2 -0
- package/dist/agents/shuttle/index.d.ts +2 -0
- package/dist/agents/spindle/default.d.ts +2 -0
- package/dist/agents/spindle/index.d.ts +2 -0
- package/dist/agents/tapestry/default.d.ts +2 -0
- package/dist/agents/tapestry/index.d.ts +9 -0
- package/dist/agents/tapestry/prompt-composer.d.ts +24 -0
- package/dist/agents/thread/default.d.ts +2 -0
- package/dist/agents/thread/index.d.ts +2 -0
- package/dist/agents/types.d.ts +82 -0
- package/dist/agents/warp/default.d.ts +2 -0
- package/dist/agents/warp/index.d.ts +2 -0
- package/dist/agents/weft/default.d.ts +2 -0
- package/dist/agents/weft/index.d.ts +2 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/loader.d.ts +2 -0
- package/dist/config/merge.d.ts +3 -0
- package/dist/config/schema.d.ts +344 -0
- package/dist/create-managers.d.ts +21 -0
- package/dist/create-tools.d.ts +16 -0
- package/dist/features/analytics/adherence.d.ts +10 -0
- package/dist/features/analytics/fingerprint.d.ts +33 -0
- package/dist/features/analytics/format-metrics.d.ts +10 -0
- package/dist/features/analytics/generate-metrics-report.d.ts +17 -0
- package/dist/features/analytics/git-diff.d.ts +7 -0
- package/dist/features/analytics/index.d.ts +29 -0
- package/dist/features/analytics/plan-parser.d.ts +7 -0
- package/dist/features/analytics/plan-token-aggregator.d.ts +11 -0
- package/dist/features/analytics/session-tracker.d.ts +68 -0
- package/dist/features/analytics/storage.d.ts +40 -0
- package/dist/features/analytics/suggestions.d.ts +10 -0
- package/dist/features/analytics/token-report.d.ts +14 -0
- package/dist/features/analytics/types.d.ts +194 -0
- package/dist/features/builtin-commands/commands.d.ts +2 -0
- package/dist/features/builtin-commands/index.d.ts +2 -0
- package/dist/features/builtin-commands/templates/metrics.d.ts +1 -0
- package/dist/features/builtin-commands/templates/run-workflow.d.ts +1 -0
- package/dist/features/builtin-commands/templates/start-work.d.ts +1 -0
- package/dist/features/builtin-commands/types.d.ts +16 -0
- package/dist/features/evals/baseline.d.ts +4 -0
- package/dist/features/evals/evaluators/deterministic.d.ts +2 -0
- package/dist/features/evals/evaluators/llm-judge.d.ts +2 -0
- package/dist/features/evals/executors/model-response.d.ts +2 -0
- package/dist/features/evals/executors/prompt-renderer.d.ts +2 -0
- package/dist/features/evals/index.d.ts +24 -0
- package/dist/features/evals/loader.d.ts +8 -0
- package/dist/features/evals/reporter.d.ts +2 -0
- package/dist/features/evals/runner.d.ts +7 -0
- package/dist/features/evals/schema.d.ts +478 -0
- package/dist/features/evals/storage.d.ts +7 -0
- package/dist/features/evals/targets/builtin-agent-target.d.ts +2 -0
- package/dist/features/evals/types.d.ts +223 -0
- package/dist/features/skill-loader/discovery.d.ts +12 -0
- package/dist/features/skill-loader/index.d.ts +6 -0
- package/dist/features/skill-loader/loader.d.ts +7 -0
- package/dist/features/skill-loader/opencode-client.d.ts +2 -0
- package/dist/features/skill-loader/resolver.d.ts +6 -0
- package/dist/features/skill-loader/types.d.ts +18 -0
- package/dist/features/task-system/index.d.ts +6 -0
- package/dist/features/task-system/storage.d.ts +38 -0
- package/dist/features/task-system/todo-sync.d.ts +38 -0
- package/dist/features/task-system/tools/index.d.ts +3 -0
- package/dist/features/task-system/tools/task-create.d.ts +9 -0
- package/dist/features/task-system/tools/task-list.d.ts +5 -0
- package/dist/features/task-system/tools/task-update.d.ts +7 -0
- package/dist/features/task-system/types.d.ts +63 -0
- package/dist/features/work-state/constants.d.ts +8 -0
- package/dist/features/work-state/index.d.ts +5 -0
- package/dist/features/work-state/storage.d.ts +53 -0
- package/dist/features/work-state/types.d.ts +35 -0
- package/dist/features/work-state/validation-types.d.ts +26 -0
- package/dist/features/work-state/validation.d.ts +9 -0
- package/dist/features/workflow/commands.d.ts +17 -0
- package/dist/features/workflow/completion.d.ts +31 -0
- package/dist/features/workflow/constants.d.ts +12 -0
- package/dist/features/workflow/context.d.ts +16 -0
- package/dist/features/workflow/discovery.d.ts +19 -0
- package/dist/features/workflow/engine.d.ts +49 -0
- package/dist/features/workflow/hook.d.ts +47 -0
- package/dist/features/workflow/index.d.ts +15 -0
- package/dist/features/workflow/schema.d.ts +118 -0
- package/dist/features/workflow/storage.d.ts +51 -0
- package/dist/features/workflow/types.d.ts +142 -0
- package/dist/hooks/context-window-monitor.d.ts +19 -0
- package/dist/hooks/create-hooks.d.ts +40 -0
- package/dist/hooks/first-message-variant.d.ts +5 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/keyword-detector.d.ts +8 -0
- package/dist/hooks/pattern-md-only.d.ts +13 -0
- package/dist/hooks/rules-injector.d.ts +6 -0
- package/dist/hooks/session-token-state.d.ts +42 -0
- package/dist/hooks/start-work-hook.d.ts +25 -0
- package/dist/hooks/verification-reminder.d.ts +22 -0
- package/dist/hooks/work-continuation.d.ts +26 -0
- package/dist/hooks/write-existing-file-guard.d.ts +14 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +18 -4
- package/dist/managers/background-manager.d.ts +88 -0
- package/dist/managers/config-handler.d.ts +54 -0
- package/dist/managers/index.d.ts +6 -0
- package/dist/managers/skill-mcp-manager.d.ts +30 -0
- package/dist/mcp/agent-defaults.d.ts +12 -0
- package/dist/mcp/index.d.ts +16 -0
- package/dist/mcp/types.d.ts +26 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/plugin-interface.d.ts +17 -0
- package/dist/plugin/types.d.ts +5 -0
- package/dist/shared/agent-display-names.d.ts +45 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/log.d.ts +11 -0
- package/dist/shared/types.d.ts +6 -0
- package/dist/shared/version.d.ts +5 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/permissions.d.ts +18 -0
- package/dist/tools/registry.d.ts +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type { WeaveAgentName } from "../../agents/types";
|
|
2
|
+
export declare const EVAL_PHASES: readonly ["phase1", "phase2", "phase3", "phase4"];
|
|
3
|
+
export type EvalPhase = (typeof EVAL_PHASES)[number];
|
|
4
|
+
export declare const EVAL_TARGET_KINDS: readonly ["builtin-agent-prompt", "custom-agent-prompt", "single-turn-agent", "trajectory-agent"];
|
|
5
|
+
export type EvalTargetKind = (typeof EVAL_TARGET_KINDS)[number];
|
|
6
|
+
export declare const EXECUTOR_KINDS: readonly ["prompt-render", "model-response", "trajectory-run"];
|
|
7
|
+
export type ExecutorKind = (typeof EXECUTOR_KINDS)[number];
|
|
8
|
+
export declare const EVALUATOR_KINDS: readonly ["contains-all", "contains-any", "excludes-all", "section-contains-all", "ordered-contains", "xml-sections-present", "tool-policy", "min-length", "llm-judge", "baseline-diff", "trajectory-assertion"];
|
|
9
|
+
export type EvaluatorKind = (typeof EVALUATOR_KINDS)[number];
|
|
10
|
+
export type BuiltinEvalAgentName = Exclude<WeaveAgentName, "shuttle">;
|
|
11
|
+
export interface BuiltinAgentPromptVariant {
|
|
12
|
+
disabledAgents?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface BuiltinAgentPromptTarget {
|
|
15
|
+
kind: "builtin-agent-prompt";
|
|
16
|
+
agent: BuiltinEvalAgentName;
|
|
17
|
+
variant?: BuiltinAgentPromptVariant;
|
|
18
|
+
}
|
|
19
|
+
export interface CustomAgentPromptTarget {
|
|
20
|
+
kind: "custom-agent-prompt";
|
|
21
|
+
agentId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SingleTurnAgentTarget {
|
|
24
|
+
kind: "single-turn-agent";
|
|
25
|
+
agent: string;
|
|
26
|
+
input?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface TrajectoryAgentTarget {
|
|
29
|
+
kind: "trajectory-agent";
|
|
30
|
+
agent: string;
|
|
31
|
+
scenarioRef?: string;
|
|
32
|
+
}
|
|
33
|
+
export type EvalTarget = BuiltinAgentPromptTarget | CustomAgentPromptTarget | SingleTurnAgentTarget | TrajectoryAgentTarget;
|
|
34
|
+
export interface PromptRenderExecutor {
|
|
35
|
+
kind: "prompt-render";
|
|
36
|
+
}
|
|
37
|
+
export interface ModelResponseExecutor {
|
|
38
|
+
kind: "model-response";
|
|
39
|
+
provider: string;
|
|
40
|
+
model: string;
|
|
41
|
+
input: string;
|
|
42
|
+
}
|
|
43
|
+
export interface TrajectoryRunExecutor {
|
|
44
|
+
kind: "trajectory-run";
|
|
45
|
+
scenarioRef: string;
|
|
46
|
+
}
|
|
47
|
+
export type ExecutorSpec = PromptRenderExecutor | ModelResponseExecutor | TrajectoryRunExecutor;
|
|
48
|
+
export interface WeightedEvaluatorSpec {
|
|
49
|
+
weight?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface ContainsAllEvaluator extends WeightedEvaluatorSpec {
|
|
52
|
+
kind: "contains-all";
|
|
53
|
+
patterns: string[];
|
|
54
|
+
}
|
|
55
|
+
export interface ContainsAnyEvaluator extends WeightedEvaluatorSpec {
|
|
56
|
+
kind: "contains-any";
|
|
57
|
+
patterns: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface ExcludesAllEvaluator extends WeightedEvaluatorSpec {
|
|
60
|
+
kind: "excludes-all";
|
|
61
|
+
patterns: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface SectionContainsAllEvaluator extends WeightedEvaluatorSpec {
|
|
64
|
+
kind: "section-contains-all";
|
|
65
|
+
section: string;
|
|
66
|
+
patterns: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface OrderedContainsEvaluator extends WeightedEvaluatorSpec {
|
|
69
|
+
kind: "ordered-contains";
|
|
70
|
+
patterns: string[];
|
|
71
|
+
}
|
|
72
|
+
export interface XmlSectionsPresentEvaluator extends WeightedEvaluatorSpec {
|
|
73
|
+
kind: "xml-sections-present";
|
|
74
|
+
sections: string[];
|
|
75
|
+
}
|
|
76
|
+
export interface ToolPolicyEvaluator extends WeightedEvaluatorSpec {
|
|
77
|
+
kind: "tool-policy";
|
|
78
|
+
expectations: Record<string, boolean>;
|
|
79
|
+
}
|
|
80
|
+
export interface MinLengthEvaluator extends WeightedEvaluatorSpec {
|
|
81
|
+
kind: "min-length";
|
|
82
|
+
min: number;
|
|
83
|
+
}
|
|
84
|
+
export interface LlmJudgeEvaluator extends WeightedEvaluatorSpec {
|
|
85
|
+
kind: "llm-judge";
|
|
86
|
+
rubricRef?: string;
|
|
87
|
+
expectedContains?: string[];
|
|
88
|
+
forbiddenContains?: string[];
|
|
89
|
+
}
|
|
90
|
+
export interface BaselineDiffEvaluator extends WeightedEvaluatorSpec {
|
|
91
|
+
kind: "baseline-diff";
|
|
92
|
+
baselineRef?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface TrajectoryAssertionEvaluator extends WeightedEvaluatorSpec {
|
|
95
|
+
kind: "trajectory-assertion";
|
|
96
|
+
assertionRef?: string;
|
|
97
|
+
}
|
|
98
|
+
export type EvaluatorSpec = ContainsAllEvaluator | ContainsAnyEvaluator | ExcludesAllEvaluator | SectionContainsAllEvaluator | OrderedContainsEvaluator | XmlSectionsPresentEvaluator | ToolPolicyEvaluator | MinLengthEvaluator | LlmJudgeEvaluator | BaselineDiffEvaluator | TrajectoryAssertionEvaluator;
|
|
99
|
+
export interface EvalSuiteManifest {
|
|
100
|
+
id: string;
|
|
101
|
+
title: string;
|
|
102
|
+
phase: EvalPhase;
|
|
103
|
+
caseFiles: string[];
|
|
104
|
+
tags?: string[];
|
|
105
|
+
}
|
|
106
|
+
export interface EvalCase {
|
|
107
|
+
id: string;
|
|
108
|
+
title: string;
|
|
109
|
+
phase: EvalPhase;
|
|
110
|
+
target: EvalTarget;
|
|
111
|
+
executor: ExecutorSpec;
|
|
112
|
+
evaluators: EvaluatorSpec[];
|
|
113
|
+
tags?: string[];
|
|
114
|
+
notes?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface LoadedEvalSuiteManifest extends EvalSuiteManifest {
|
|
117
|
+
filePath: string;
|
|
118
|
+
}
|
|
119
|
+
export interface LoadedEvalCase extends EvalCase {
|
|
120
|
+
filePath: string;
|
|
121
|
+
}
|
|
122
|
+
export interface AgentPromptMetadataArtifact {
|
|
123
|
+
agent: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
sourceKind: "composer" | "default";
|
|
126
|
+
}
|
|
127
|
+
export interface EvalArtifacts {
|
|
128
|
+
renderedPrompt?: string;
|
|
129
|
+
agentMetadata?: AgentPromptMetadataArtifact;
|
|
130
|
+
toolPolicy?: Record<string, boolean>;
|
|
131
|
+
promptLength?: number;
|
|
132
|
+
modelOutput?: string;
|
|
133
|
+
judgeOutput?: string;
|
|
134
|
+
trace?: unknown;
|
|
135
|
+
tokens?: number;
|
|
136
|
+
cost?: number;
|
|
137
|
+
baselineDelta?: unknown;
|
|
138
|
+
}
|
|
139
|
+
export interface AssertionResult {
|
|
140
|
+
evaluatorKind: EvaluatorKind;
|
|
141
|
+
passed: boolean;
|
|
142
|
+
score: number;
|
|
143
|
+
maxScore: number;
|
|
144
|
+
message: string;
|
|
145
|
+
}
|
|
146
|
+
export interface EvalCaseResult {
|
|
147
|
+
caseId: string;
|
|
148
|
+
status: "passed" | "failed" | "error";
|
|
149
|
+
score: number;
|
|
150
|
+
normalizedScore: number;
|
|
151
|
+
maxScore: number;
|
|
152
|
+
durationMs: number;
|
|
153
|
+
artifacts: EvalArtifacts;
|
|
154
|
+
assertionResults: AssertionResult[];
|
|
155
|
+
errors: string[];
|
|
156
|
+
}
|
|
157
|
+
export interface EvalRunSummary {
|
|
158
|
+
totalCases: number;
|
|
159
|
+
passedCases: number;
|
|
160
|
+
failedCases: number;
|
|
161
|
+
errorCases: number;
|
|
162
|
+
totalScore: number;
|
|
163
|
+
normalizedScore: number;
|
|
164
|
+
maxScore: number;
|
|
165
|
+
}
|
|
166
|
+
export interface EvalRunResult {
|
|
167
|
+
runId: string;
|
|
168
|
+
startedAt: string;
|
|
169
|
+
finishedAt: string;
|
|
170
|
+
suiteId: string;
|
|
171
|
+
phase: EvalPhase;
|
|
172
|
+
summary: EvalRunSummary;
|
|
173
|
+
caseResults: EvalCaseResult[];
|
|
174
|
+
}
|
|
175
|
+
export interface ResolvedTarget {
|
|
176
|
+
target: EvalTarget;
|
|
177
|
+
artifacts: EvalArtifacts;
|
|
178
|
+
}
|
|
179
|
+
export interface ExecutionContext {
|
|
180
|
+
mode: "local" | "ci" | "hosted";
|
|
181
|
+
directory: string;
|
|
182
|
+
outputPath?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface RunnerFilters {
|
|
185
|
+
caseIds?: string[];
|
|
186
|
+
agents?: string[];
|
|
187
|
+
tags?: string[];
|
|
188
|
+
}
|
|
189
|
+
export interface RunEvalSuiteOptions {
|
|
190
|
+
directory: string;
|
|
191
|
+
suite: string;
|
|
192
|
+
filters?: RunnerFilters;
|
|
193
|
+
outputPath?: string;
|
|
194
|
+
mode?: ExecutionContext["mode"];
|
|
195
|
+
}
|
|
196
|
+
export interface EvalLoadErrorContext {
|
|
197
|
+
filePath: string;
|
|
198
|
+
detail: string;
|
|
199
|
+
}
|
|
200
|
+
export interface DeterministicBaselineCase {
|
|
201
|
+
caseId: string;
|
|
202
|
+
status: EvalCaseResult["status"];
|
|
203
|
+
normalizedScore: number;
|
|
204
|
+
assertionPassed: number;
|
|
205
|
+
assertionFailed: number;
|
|
206
|
+
errorCount: number;
|
|
207
|
+
}
|
|
208
|
+
export interface DeterministicBaseline {
|
|
209
|
+
version: 1;
|
|
210
|
+
suiteId: string;
|
|
211
|
+
phase: EvalPhase;
|
|
212
|
+
generatedAt: string;
|
|
213
|
+
normalizedScore: number;
|
|
214
|
+
cases: DeterministicBaselineCase[];
|
|
215
|
+
}
|
|
216
|
+
export interface BaselineComparisonOptions {
|
|
217
|
+
scoreDropTolerance?: number;
|
|
218
|
+
}
|
|
219
|
+
export interface BaselineComparison {
|
|
220
|
+
outcome: "no-regression" | "informational-diff" | "regression";
|
|
221
|
+
regressions: string[];
|
|
222
|
+
informational: string[];
|
|
223
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LoadedSkill, SkillMetadata, SkillScope } from "./types";
|
|
2
|
+
interface ParsedFrontmatter {
|
|
3
|
+
metadata: SkillMetadata;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseFrontmatter(text: string): ParsedFrontmatter;
|
|
7
|
+
export interface ScanDirectoryOptions {
|
|
8
|
+
directory: string;
|
|
9
|
+
scope: SkillScope;
|
|
10
|
+
}
|
|
11
|
+
export declare function scanDirectory(options: ScanDirectoryOptions): LoadedSkill[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { loadSkills } from "./loader";
|
|
2
|
+
export type { LoadSkillsOptions } from "./loader";
|
|
3
|
+
export { createResolveSkillsFn, createSkillResolver, resolveMultipleSkills, resolveSkill } from "./resolver";
|
|
4
|
+
export { fetchSkillsFromOpenCode } from "./opencode-client";
|
|
5
|
+
export { scanDirectory, parseFrontmatter } from "./discovery";
|
|
6
|
+
export type { SkillScope, SkillMetadata, LoadedSkill, SkillDiscoveryResult } from "./types";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SkillDiscoveryResult } from './types';
|
|
2
|
+
export interface LoadSkillsOptions {
|
|
3
|
+
serverUrl: string | URL;
|
|
4
|
+
directory?: string;
|
|
5
|
+
disabledSkills?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function loadSkills(options: LoadSkillsOptions): Promise<SkillDiscoveryResult>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SkillDiscoveryResult } from "./types";
|
|
2
|
+
export declare function resolveSkill(name: string, result: SkillDiscoveryResult): string;
|
|
3
|
+
export declare function resolveMultipleSkills(skillNames: string[], disabledSkills?: Set<string>, discovered?: SkillDiscoveryResult): string;
|
|
4
|
+
export declare function createSkillResolver(discovered: SkillDiscoveryResult): (skillNames: string[], disabledSkills?: Set<string>) => string;
|
|
5
|
+
/** @deprecated Use createSkillResolver instead */
|
|
6
|
+
export declare const createResolveSkillsFn: typeof createSkillResolver;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type SkillScope = "builtin" | "user" | "project";
|
|
2
|
+
export interface SkillMetadata {
|
|
3
|
+
name?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
model?: string;
|
|
6
|
+
tools?: string | string[];
|
|
7
|
+
}
|
|
8
|
+
export interface LoadedSkill {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
content: string;
|
|
12
|
+
scope?: SkillScope;
|
|
13
|
+
path?: string;
|
|
14
|
+
model?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SkillDiscoveryResult {
|
|
17
|
+
skills: LoadedSkill[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createTaskCreateTool, createTaskUpdateTool, createTaskListTool } from "./tools";
|
|
2
|
+
export { TaskStatus, TaskObjectSchema, TaskStatusSchema } from "./types";
|
|
3
|
+
export type { TaskObject, TaskCreateInput, TaskUpdateInput, TaskListInput } from "./types";
|
|
4
|
+
export { getTaskDir, generateTaskId, readTask, writeTask, readAllTasks } from "./storage";
|
|
5
|
+
export { syncTaskToTodo, syncTaskTodoUpdate, syncAllTasksToTodos } from "./todo-sync";
|
|
6
|
+
export type { TodoWriter, TodoInfo } from "./todo-sync";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type TaskObject } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Derive the task storage directory for a given project.
|
|
4
|
+
* Uses the opencode config dir (~/.config/opencode by default) + sanitized project slug.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getTaskDir(directory: string, configDir?: string): string;
|
|
7
|
+
/** Generate a unique task ID */
|
|
8
|
+
export declare function generateTaskId(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Read and parse a JSON file safely. Returns null for missing, corrupt, or invalid data.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readJsonSafe<T>(filePath: string, schema: {
|
|
13
|
+
parse: (data: unknown) => T;
|
|
14
|
+
}): T | null;
|
|
15
|
+
/**
|
|
16
|
+
* Write JSON atomically: write to a temp file then rename.
|
|
17
|
+
* This prevents partial writes from corrupting the target file.
|
|
18
|
+
*/
|
|
19
|
+
export declare function writeJsonAtomic(filePath: string, data: unknown): void;
|
|
20
|
+
/**
|
|
21
|
+
* Acquire a file-based lock. Uses exclusive file creation (wx flag).
|
|
22
|
+
* Returns a release function on success, null on failure.
|
|
23
|
+
*
|
|
24
|
+
* Stale locks older than `staleThresholdMs` (default 30s) are automatically broken.
|
|
25
|
+
*/
|
|
26
|
+
export declare function acquireLock(lockPath: string, staleThresholdMs?: number): (() => void) | null;
|
|
27
|
+
/** Ensure a directory exists */
|
|
28
|
+
export declare function ensureDir(dirPath: string): void;
|
|
29
|
+
/** List task files (T-*.json) in the task directory */
|
|
30
|
+
export declare function listTaskFiles(taskDir: string): string[];
|
|
31
|
+
/** Get the file path for a task by ID */
|
|
32
|
+
export declare function getTaskFilePath(taskDir: string, taskId: string): string;
|
|
33
|
+
/** Read a single task from file storage */
|
|
34
|
+
export declare function readTask(taskDir: string, taskId: string): TaskObject | null;
|
|
35
|
+
/** Write a single task to file storage (atomic) */
|
|
36
|
+
export declare function writeTask(taskDir: string, task: TaskObject): void;
|
|
37
|
+
/** Read all tasks from a task directory */
|
|
38
|
+
export declare function readAllTasks(taskDir: string): TaskObject[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { TaskObject } from "./types";
|
|
2
|
+
/** TodoInfo matches the shape expected by OpenCode's todo sidebar */
|
|
3
|
+
export interface TodoInfo {
|
|
4
|
+
id?: string;
|
|
5
|
+
content: string;
|
|
6
|
+
status: "pending" | "in_progress" | "completed";
|
|
7
|
+
priority?: "high" | "medium" | "low";
|
|
8
|
+
}
|
|
9
|
+
/** TodoWriter interface — abstracts the OpenCode todo write API */
|
|
10
|
+
export interface TodoWriter {
|
|
11
|
+
read(sessionId: string): Promise<TodoInfo[]>;
|
|
12
|
+
update(sessionId: string, todos: TodoInfo[]): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Map a TaskObject to a TodoInfo for the sidebar.
|
|
16
|
+
* Returns null for deleted tasks (they should be removed from the sidebar).
|
|
17
|
+
*/
|
|
18
|
+
export declare function syncTaskToTodo(task: TaskObject): TodoInfo | null;
|
|
19
|
+
/**
|
|
20
|
+
* Check if two todo items match by ID first, then by content as fallback.
|
|
21
|
+
*/
|
|
22
|
+
export declare function todosMatch(a: TodoInfo, b: TodoInfo): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Sync a single task to the todo sidebar.
|
|
25
|
+
* This is the anti-obliteration mechanism:
|
|
26
|
+
* 1. Read current todos
|
|
27
|
+
* 2. Filter out the matching item (by ID or content)
|
|
28
|
+
* 3. Push the updated item (or omit it if deleted)
|
|
29
|
+
* 4. Write back the full list
|
|
30
|
+
*
|
|
31
|
+
* Non-task todos (those not matching any task ID) survive intact.
|
|
32
|
+
*/
|
|
33
|
+
export declare function syncTaskTodoUpdate(writer: TodoWriter | null, sessionId: string, task: TaskObject): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Sync all tasks to the todo sidebar, preserving non-task todos.
|
|
36
|
+
* Used for bulk reconciliation.
|
|
37
|
+
*/
|
|
38
|
+
export declare function syncAllTasksToTodos(writer: TodoWriter | null, sessionId: string, tasks: TaskObject[]): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
import { type TodoWriter } from "../todo-sync";
|
|
3
|
+
declare const TASK_ID_PATTERN: RegExp;
|
|
4
|
+
export declare function createTaskCreateTool(options: {
|
|
5
|
+
directory: string;
|
|
6
|
+
configDir?: string;
|
|
7
|
+
todoWriter?: TodoWriter | null;
|
|
8
|
+
}): ToolDefinition;
|
|
9
|
+
export { TASK_ID_PATTERN };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Task status values */
|
|
3
|
+
export declare const TaskStatus: {
|
|
4
|
+
readonly PENDING: "pending";
|
|
5
|
+
readonly IN_PROGRESS: "in_progress";
|
|
6
|
+
readonly COMPLETED: "completed";
|
|
7
|
+
readonly DELETED: "deleted";
|
|
8
|
+
};
|
|
9
|
+
export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];
|
|
10
|
+
export declare const TaskStatusSchema: z.ZodEnum<{
|
|
11
|
+
pending: "pending";
|
|
12
|
+
completed: "completed";
|
|
13
|
+
in_progress: "in_progress";
|
|
14
|
+
deleted: "deleted";
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Core task object — simplified from OmO's schema.
|
|
18
|
+
* Drops: activeForm, owner, repoURL, parentID (per design decision D4).
|
|
19
|
+
*/
|
|
20
|
+
export declare const TaskObjectSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
subject: z.ZodString;
|
|
23
|
+
description: z.ZodString;
|
|
24
|
+
status: z.ZodEnum<{
|
|
25
|
+
pending: "pending";
|
|
26
|
+
completed: "completed";
|
|
27
|
+
in_progress: "in_progress";
|
|
28
|
+
deleted: "deleted";
|
|
29
|
+
}>;
|
|
30
|
+
threadID: z.ZodString;
|
|
31
|
+
blocks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
32
|
+
blockedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
33
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type TaskObject = z.infer<typeof TaskObjectSchema>;
|
|
36
|
+
/** Input schema for task_create tool */
|
|
37
|
+
export declare const TaskCreateInputSchema: z.ZodObject<{
|
|
38
|
+
subject: z.ZodString;
|
|
39
|
+
description: z.ZodOptional<z.ZodString>;
|
|
40
|
+
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
+
blockedBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type TaskCreateInput = z.infer<typeof TaskCreateInputSchema>;
|
|
45
|
+
/** Input schema for task_update tool */
|
|
46
|
+
export declare const TaskUpdateInputSchema: z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
49
|
+
description: z.ZodOptional<z.ZodString>;
|
|
50
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
51
|
+
pending: "pending";
|
|
52
|
+
completed: "completed";
|
|
53
|
+
in_progress: "in_progress";
|
|
54
|
+
deleted: "deleted";
|
|
55
|
+
}>>;
|
|
56
|
+
addBlocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
+
addBlockedBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export type TaskUpdateInput = z.infer<typeof TaskUpdateInputSchema>;
|
|
61
|
+
/** Input schema for task_list tool (no args needed for PoC) */
|
|
62
|
+
export declare const TaskListInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
63
|
+
export type TaskListInput = z.infer<typeof TaskListInputSchema>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Root directory for Weave state and plans */
|
|
2
|
+
export declare const WEAVE_DIR = ".weave";
|
|
3
|
+
/** Work state file name */
|
|
4
|
+
export declare const WORK_STATE_FILE = "state.json";
|
|
5
|
+
/** Full relative path to work state */
|
|
6
|
+
export declare const WORK_STATE_PATH = ".weave/state.json";
|
|
7
|
+
/** Directory where plan files are stored */
|
|
8
|
+
export declare const PLANS_DIR = ".weave/plans";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { WorkState, PlanProgress } from "./types";
|
|
2
|
+
export type { ValidationResult, ValidationIssue, ValidationSeverity, ValidationCategory } from "./validation-types";
|
|
3
|
+
export { WEAVE_DIR, WORK_STATE_FILE, WORK_STATE_PATH, PLANS_DIR } from "./constants";
|
|
4
|
+
export { readWorkState, writeWorkState, clearWorkState, appendSessionId, createWorkState, findPlans, getPlanProgress, getPlanName, getHeadSha, pauseWork, resumeWork, } from "./storage";
|
|
5
|
+
export { validatePlan } from "./validation";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { WorkState, PlanProgress } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Read work state from .weave/state.json.
|
|
4
|
+
* Returns null if file is missing, unparseable, or invalid.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readWorkState(directory: string): WorkState | null;
|
|
7
|
+
/**
|
|
8
|
+
* Write work state to .weave/state.json.
|
|
9
|
+
* Creates .weave/ directory if needed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function writeWorkState(directory: string, state: WorkState): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Clear work state by deleting .weave/state.json.
|
|
14
|
+
*/
|
|
15
|
+
export declare function clearWorkState(directory: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Append a session ID to the work state (if not already present).
|
|
18
|
+
* Returns the updated state, or null if no state exists.
|
|
19
|
+
*/
|
|
20
|
+
export declare function appendSessionId(directory: string, sessionId: string): WorkState | null;
|
|
21
|
+
/**
|
|
22
|
+
* Create a fresh WorkState for a plan file.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createWorkState(planPath: string, sessionId: string, agent?: string, directory?: string): WorkState;
|
|
25
|
+
/**
|
|
26
|
+
* Get the current HEAD SHA of the git repo at the given directory.
|
|
27
|
+
* Returns undefined if not a git repo or git is unavailable.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getHeadSha(directory: string): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Find all plan files in .weave/plans/, sorted by modification time (newest first).
|
|
32
|
+
* Returns absolute paths.
|
|
33
|
+
*/
|
|
34
|
+
export declare function findPlans(directory: string): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Count checked and unchecked markdown checkboxes in a plan file.
|
|
37
|
+
* Returns isComplete: true if file is missing, has 0 checkboxes, or all are checked.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getPlanProgress(planPath: string): PlanProgress;
|
|
40
|
+
/**
|
|
41
|
+
* Extract plan name from file path (basename minus .md extension).
|
|
42
|
+
*/
|
|
43
|
+
export declare function getPlanName(planPath: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Pause work by setting paused: true in the work state.
|
|
46
|
+
* Returns false if no state exists (e.g., no active plan).
|
|
47
|
+
*/
|
|
48
|
+
export declare function pauseWork(directory: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Resume work by setting paused: false in the work state.
|
|
51
|
+
* Returns false if no state exists.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resumeWork(directory: string): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks the active plan being executed via /start-work.
|
|
3
|
+
* Stored at .weave/state.json in the project root.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkState {
|
|
6
|
+
/** Absolute path to the active plan file */
|
|
7
|
+
active_plan: string;
|
|
8
|
+
/** ISO timestamp when work started */
|
|
9
|
+
started_at: string;
|
|
10
|
+
/** Session IDs that have worked on this plan */
|
|
11
|
+
session_ids: string[];
|
|
12
|
+
/** Plan name derived from filename (without .md) */
|
|
13
|
+
plan_name: string;
|
|
14
|
+
/** Agent type to use when resuming (e.g., "tapestry") */
|
|
15
|
+
agent?: string;
|
|
16
|
+
/** Git HEAD SHA at the time work started (absent if not a git repo) */
|
|
17
|
+
start_sha?: string;
|
|
18
|
+
/** Whether work has been paused by a user interrupt; continuation is suppressed while true */
|
|
19
|
+
paused?: boolean;
|
|
20
|
+
/** The `completed` count from getPlanProgress() at the time of the last continuation prompt */
|
|
21
|
+
continuation_completed_snapshot?: number;
|
|
22
|
+
/** How many consecutive continuations have fired without progress changing */
|
|
23
|
+
stale_continuation_count?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Progress snapshot from counting checkboxes in a plan file.
|
|
27
|
+
*/
|
|
28
|
+
export interface PlanProgress {
|
|
29
|
+
/** Total number of checkboxes (checked + unchecked) */
|
|
30
|
+
total: number;
|
|
31
|
+
/** Number of completed checkboxes */
|
|
32
|
+
completed: number;
|
|
33
|
+
/** Whether all tasks are done (total === 0 or completed === total) */
|
|
34
|
+
isComplete: boolean;
|
|
35
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 6 validation categories checked by validatePlan().
|
|
3
|
+
*/
|
|
4
|
+
export type ValidationCategory = "structure" | "checkboxes" | "file-references" | "numbering" | "effort-estimate" | "verification";
|
|
5
|
+
/** Severity level for a validation issue. */
|
|
6
|
+
export type ValidationSeverity = "error" | "warning";
|
|
7
|
+
/**
|
|
8
|
+
* A single validation issue found in a plan file.
|
|
9
|
+
*/
|
|
10
|
+
export interface ValidationIssue {
|
|
11
|
+
severity: ValidationSeverity;
|
|
12
|
+
category: ValidationCategory;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The result of validating a plan file.
|
|
17
|
+
* `valid` is false if there are any blocking errors.
|
|
18
|
+
*/
|
|
19
|
+
export interface ValidationResult {
|
|
20
|
+
/** False when there is at least one error (blocking). True when only warnings or clean. */
|
|
21
|
+
valid: boolean;
|
|
22
|
+
/** Blocking issues — prevent /start-work from proceeding */
|
|
23
|
+
errors: ValidationIssue[];
|
|
24
|
+
/** Non-blocking issues — surfaced to user but don't block execution */
|
|
25
|
+
warnings: ValidationIssue[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ValidationResult } from "./validation-types";
|
|
2
|
+
/**
|
|
3
|
+
* Validates a plan file's structure and content before /start-work execution.
|
|
4
|
+
*
|
|
5
|
+
* @param planPath Absolute path to the plan markdown file
|
|
6
|
+
* @param projectDir Absolute path to the project root (used for file-reference checks)
|
|
7
|
+
* @returns ValidationResult with errors (blocking) and warnings (non-blocking)
|
|
8
|
+
*/
|
|
9
|
+
export declare function validatePlan(planPath: string, projectDir: string): ValidationResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow control sub-commands: keyword detection in user messages during active workflows.
|
|
3
|
+
* These are NOT separate slash commands — they're natural language keywords detected in chat.message.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkflowCommandResult {
|
|
6
|
+
/** Whether a workflow control keyword was detected and handled */
|
|
7
|
+
handled: boolean;
|
|
8
|
+
/** Context to inject into the response */
|
|
9
|
+
contextInjection?: string;
|
|
10
|
+
/** Agent to switch to (if any) */
|
|
11
|
+
switchAgent?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Check if a user message contains a workflow control keyword and handle it.
|
|
15
|
+
* Only active when a workflow instance is running.
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleWorkflowCommand(message: string, directory: string): WorkflowCommandResult;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CompletionConfig, CompletionMethod } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Result of checking whether a step's completion condition is met.
|
|
4
|
+
*/
|
|
5
|
+
export interface CompletionCheckResult {
|
|
6
|
+
complete: boolean;
|
|
7
|
+
verdict?: "approve" | "reject";
|
|
8
|
+
artifacts?: Record<string, string>;
|
|
9
|
+
/** Concise summary of step output for context threading */
|
|
10
|
+
summary?: string;
|
|
11
|
+
reason?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Context provided to completion checkers.
|
|
15
|
+
*/
|
|
16
|
+
export interface CompletionContext {
|
|
17
|
+
/** Last assistant message text (from message.part.updated tracking) */
|
|
18
|
+
lastAssistantMessage?: string;
|
|
19
|
+
/** Last user message text (for user_confirm) */
|
|
20
|
+
lastUserMessage?: string;
|
|
21
|
+
/** Working directory */
|
|
22
|
+
directory: string;
|
|
23
|
+
/** Completion config from the step definition */
|
|
24
|
+
config: CompletionConfig;
|
|
25
|
+
/** Current artifacts in the instance */
|
|
26
|
+
artifacts: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check whether a step's completion condition is met.
|
|
30
|
+
*/
|
|
31
|
+
export declare function checkStepCompletion(method: CompletionMethod, context: CompletionContext): CompletionCheckResult;
|