@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,344 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AgentOverrideConfigSchema: z.ZodObject<{
|
|
3
|
+
model: z.ZodOptional<z.ZodString>;
|
|
4
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
6
|
+
category: z.ZodOptional<z.ZodString>;
|
|
7
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
|
+
mcp: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
12
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
13
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
14
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
subagent: "subagent";
|
|
17
|
+
primary: "primary";
|
|
18
|
+
all: "all";
|
|
19
|
+
}>>;
|
|
20
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const AgentOverridesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
24
|
+
model: z.ZodOptional<z.ZodString>;
|
|
25
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
27
|
+
category: z.ZodOptional<z.ZodString>;
|
|
28
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
+
mcp: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
33
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
34
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
35
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
subagent: "subagent";
|
|
38
|
+
primary: "primary";
|
|
39
|
+
all: "all";
|
|
40
|
+
}>>;
|
|
41
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
export declare const CategoryConfigSchema: z.ZodObject<{
|
|
45
|
+
description: z.ZodOptional<z.ZodString>;
|
|
46
|
+
model: z.ZodOptional<z.ZodString>;
|
|
47
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
49
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
53
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
54
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export declare const CategoriesConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
57
|
+
description: z.ZodOptional<z.ZodString>;
|
|
58
|
+
model: z.ZodOptional<z.ZodString>;
|
|
59
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
60
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
61
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
65
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
66
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
export declare const BackgroundConfigSchema: z.ZodObject<{
|
|
69
|
+
defaultConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
providerConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
71
|
+
modelConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
72
|
+
staleTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export declare const TmuxConfigSchema: z.ZodObject<{
|
|
75
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
layout: z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
"main-horizontal": "main-horizontal";
|
|
78
|
+
"main-vertical": "main-vertical";
|
|
79
|
+
tiled: "tiled";
|
|
80
|
+
"even-horizontal": "even-horizontal";
|
|
81
|
+
"even-vertical": "even-vertical";
|
|
82
|
+
}>>;
|
|
83
|
+
main_pane_size: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
export declare const ExperimentalConfigSchema: z.ZodObject<{
|
|
86
|
+
plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
context_window_warning_threshold: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
context_window_critical_threshold: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
task_system: z.ZodDefault<z.ZodBoolean>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export declare const DelegationTriggerSchema: z.ZodObject<{
|
|
92
|
+
domain: z.ZodString;
|
|
93
|
+
trigger: z.ZodString;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
export declare const CustomAgentConfigSchema: z.ZodObject<{
|
|
96
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
97
|
+
prompt_file: z.ZodOptional<z.ZodString>;
|
|
98
|
+
model: z.ZodOptional<z.ZodString>;
|
|
99
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
100
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
subagent: "subagent";
|
|
102
|
+
primary: "primary";
|
|
103
|
+
all: "all";
|
|
104
|
+
}>>;
|
|
105
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
107
|
+
exploration: "exploration";
|
|
108
|
+
specialist: "specialist";
|
|
109
|
+
advisor: "advisor";
|
|
110
|
+
utility: "utility";
|
|
111
|
+
}>>;
|
|
112
|
+
cost: z.ZodOptional<z.ZodEnum<{
|
|
113
|
+
FREE: "FREE";
|
|
114
|
+
CHEAP: "CHEAP";
|
|
115
|
+
EXPENSIVE: "EXPENSIVE";
|
|
116
|
+
}>>;
|
|
117
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
121
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
122
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
123
|
+
domain: z.ZodString;
|
|
124
|
+
trigger: z.ZodString;
|
|
125
|
+
}, z.core.$strip>>>;
|
|
126
|
+
description: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export declare const CustomAgentsConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
129
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
130
|
+
prompt_file: z.ZodOptional<z.ZodString>;
|
|
131
|
+
model: z.ZodOptional<z.ZodString>;
|
|
132
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
133
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
134
|
+
subagent: "subagent";
|
|
135
|
+
primary: "primary";
|
|
136
|
+
all: "all";
|
|
137
|
+
}>>;
|
|
138
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
139
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
140
|
+
exploration: "exploration";
|
|
141
|
+
specialist: "specialist";
|
|
142
|
+
advisor: "advisor";
|
|
143
|
+
utility: "utility";
|
|
144
|
+
}>>;
|
|
145
|
+
cost: z.ZodOptional<z.ZodEnum<{
|
|
146
|
+
FREE: "FREE";
|
|
147
|
+
CHEAP: "CHEAP";
|
|
148
|
+
EXPENSIVE: "EXPENSIVE";
|
|
149
|
+
}>>;
|
|
150
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
154
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
155
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
156
|
+
domain: z.ZodString;
|
|
157
|
+
trigger: z.ZodString;
|
|
158
|
+
}, z.core.$strip>>>;
|
|
159
|
+
description: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
export declare const AnalyticsConfigSchema: z.ZodObject<{
|
|
162
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
use_fingerprint: z.ZodOptional<z.ZodBoolean>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export declare const WorkflowConfigSchema: z.ZodObject<{
|
|
166
|
+
disabled_workflows: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
export declare const BuiltInMcpSchema: z.ZodObject<{
|
|
169
|
+
websearch: z.ZodOptional<z.ZodBoolean>;
|
|
170
|
+
context7: z.ZodOptional<z.ZodBoolean>;
|
|
171
|
+
grep_app: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
export declare const CustomMcpServerSchema: z.ZodObject<{
|
|
174
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
175
|
+
local: "local";
|
|
176
|
+
remote: "remote";
|
|
177
|
+
}>>;
|
|
178
|
+
command: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
179
|
+
url: z.ZodOptional<z.ZodString>;
|
|
180
|
+
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
181
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
183
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
184
|
+
oauth: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodLiteral<false>]>>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
export declare const McpConfigSchema: z.ZodObject<{
|
|
187
|
+
enabled: z.ZodOptional<z.ZodObject<{
|
|
188
|
+
websearch: z.ZodOptional<z.ZodBoolean>;
|
|
189
|
+
context7: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
grep_app: z.ZodOptional<z.ZodBoolean>;
|
|
191
|
+
}, z.core.$strip>>;
|
|
192
|
+
servers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
193
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
194
|
+
local: "local";
|
|
195
|
+
remote: "remote";
|
|
196
|
+
}>>;
|
|
197
|
+
command: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
198
|
+
url: z.ZodOptional<z.ZodString>;
|
|
199
|
+
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
200
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
201
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
203
|
+
oauth: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodLiteral<false>]>>;
|
|
204
|
+
}, z.core.$strip>>>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
export declare const WeaveConfigSchema: z.ZodObject<{
|
|
207
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
208
|
+
agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
209
|
+
model: z.ZodOptional<z.ZodString>;
|
|
210
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
211
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
212
|
+
category: z.ZodOptional<z.ZodString>;
|
|
213
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
214
|
+
mcp: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
215
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
217
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
218
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
219
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
220
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
222
|
+
subagent: "subagent";
|
|
223
|
+
primary: "primary";
|
|
224
|
+
all: "all";
|
|
225
|
+
}>>;
|
|
226
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
227
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
228
|
+
}, z.core.$strip>>>;
|
|
229
|
+
custom_agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
230
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
231
|
+
prompt_file: z.ZodOptional<z.ZodString>;
|
|
232
|
+
model: z.ZodOptional<z.ZodString>;
|
|
233
|
+
display_name: z.ZodOptional<z.ZodString>;
|
|
234
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
235
|
+
subagent: "subagent";
|
|
236
|
+
primary: "primary";
|
|
237
|
+
all: "all";
|
|
238
|
+
}>>;
|
|
239
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
240
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
241
|
+
exploration: "exploration";
|
|
242
|
+
specialist: "specialist";
|
|
243
|
+
advisor: "advisor";
|
|
244
|
+
utility: "utility";
|
|
245
|
+
}>>;
|
|
246
|
+
cost: z.ZodOptional<z.ZodEnum<{
|
|
247
|
+
FREE: "FREE";
|
|
248
|
+
CHEAP: "CHEAP";
|
|
249
|
+
EXPENSIVE: "EXPENSIVE";
|
|
250
|
+
}>>;
|
|
251
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
253
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
255
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
256
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
257
|
+
domain: z.ZodString;
|
|
258
|
+
trigger: z.ZodString;
|
|
259
|
+
}, z.core.$strip>>>;
|
|
260
|
+
description: z.ZodOptional<z.ZodString>;
|
|
261
|
+
}, z.core.$strip>>>;
|
|
262
|
+
categories: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
263
|
+
description: z.ZodOptional<z.ZodString>;
|
|
264
|
+
model: z.ZodOptional<z.ZodString>;
|
|
265
|
+
fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
266
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
267
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
269
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
270
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
271
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
272
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
+
}, z.core.$strip>>>;
|
|
274
|
+
disabled_hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
275
|
+
disabled_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
276
|
+
disabled_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
277
|
+
disabled_skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
278
|
+
disabled_mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
279
|
+
background: z.ZodOptional<z.ZodObject<{
|
|
280
|
+
defaultConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
281
|
+
providerConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
282
|
+
modelConcurrency: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
283
|
+
staleTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
284
|
+
}, z.core.$strip>>;
|
|
285
|
+
analytics: z.ZodOptional<z.ZodObject<{
|
|
286
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
287
|
+
use_fingerprint: z.ZodOptional<z.ZodBoolean>;
|
|
288
|
+
}, z.core.$strip>>;
|
|
289
|
+
tmux: z.ZodOptional<z.ZodObject<{
|
|
290
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
291
|
+
layout: z.ZodOptional<z.ZodEnum<{
|
|
292
|
+
"main-horizontal": "main-horizontal";
|
|
293
|
+
"main-vertical": "main-vertical";
|
|
294
|
+
tiled: "tiled";
|
|
295
|
+
"even-horizontal": "even-horizontal";
|
|
296
|
+
"even-vertical": "even-vertical";
|
|
297
|
+
}>>;
|
|
298
|
+
main_pane_size: z.ZodOptional<z.ZodNumber>;
|
|
299
|
+
}, z.core.$strip>>;
|
|
300
|
+
experimental: z.ZodOptional<z.ZodObject<{
|
|
301
|
+
plugin_load_timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
302
|
+
context_window_warning_threshold: z.ZodOptional<z.ZodNumber>;
|
|
303
|
+
context_window_critical_threshold: z.ZodOptional<z.ZodNumber>;
|
|
304
|
+
task_system: z.ZodDefault<z.ZodBoolean>;
|
|
305
|
+
}, z.core.$strip>>;
|
|
306
|
+
workflows: z.ZodOptional<z.ZodObject<{
|
|
307
|
+
disabled_workflows: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
308
|
+
}, z.core.$strip>>;
|
|
309
|
+
mcp: z.ZodOptional<z.ZodObject<{
|
|
310
|
+
enabled: z.ZodOptional<z.ZodObject<{
|
|
311
|
+
websearch: z.ZodOptional<z.ZodBoolean>;
|
|
312
|
+
context7: z.ZodOptional<z.ZodBoolean>;
|
|
313
|
+
grep_app: z.ZodOptional<z.ZodBoolean>;
|
|
314
|
+
}, z.core.$strip>>;
|
|
315
|
+
servers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
316
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
317
|
+
local: "local";
|
|
318
|
+
remote: "remote";
|
|
319
|
+
}>>;
|
|
320
|
+
command: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
321
|
+
url: z.ZodOptional<z.ZodString>;
|
|
322
|
+
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
323
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
324
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
325
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
326
|
+
oauth: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodLiteral<false>]>>;
|
|
327
|
+
}, z.core.$strip>>>;
|
|
328
|
+
}, z.core.$strip>>;
|
|
329
|
+
}, z.core.$strip>;
|
|
330
|
+
export type WorkflowConfig = z.infer<typeof WorkflowConfigSchema>;
|
|
331
|
+
export type McpConfig = z.infer<typeof McpConfigSchema>;
|
|
332
|
+
export type BuiltInMcp = z.infer<typeof BuiltInMcpSchema>;
|
|
333
|
+
export type CustomMcpServer = z.infer<typeof CustomMcpServerSchema>;
|
|
334
|
+
export type WeaveConfig = z.infer<typeof WeaveConfigSchema>;
|
|
335
|
+
export type AgentOverrideConfig = z.infer<typeof AgentOverrideConfigSchema>;
|
|
336
|
+
export type AgentOverrides = z.infer<typeof AgentOverridesSchema>;
|
|
337
|
+
export type CustomAgentConfig = z.infer<typeof CustomAgentConfigSchema>;
|
|
338
|
+
export type CustomAgentsConfig = z.infer<typeof CustomAgentsConfigSchema>;
|
|
339
|
+
export type CategoryConfig = z.infer<typeof CategoryConfigSchema>;
|
|
340
|
+
export type CategoriesConfig = z.infer<typeof CategoriesConfigSchema>;
|
|
341
|
+
export type BackgroundConfig = z.infer<typeof BackgroundConfigSchema>;
|
|
342
|
+
export type AnalyticsConfig = z.infer<typeof AnalyticsConfigSchema>;
|
|
343
|
+
export type TmuxConfig = z.infer<typeof TmuxConfigSchema>;
|
|
344
|
+
export type ExperimentalConfig = z.infer<typeof ExperimentalConfigSchema>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
import type { AgentConfig } from '@opencode-ai/sdk';
|
|
3
|
+
import type { ResolveSkillsFn } from './agents/agent-builder';
|
|
4
|
+
import type { WeaveConfig } from './config/schema';
|
|
5
|
+
import type { ProjectFingerprint } from './features/analytics/types';
|
|
6
|
+
import { BackgroundManager } from './managers/background-manager';
|
|
7
|
+
import { ConfigHandler } from './managers/config-handler';
|
|
8
|
+
import { SkillMcpManager } from './managers/skill-mcp-manager';
|
|
9
|
+
export interface WeaveManagers {
|
|
10
|
+
configHandler: ConfigHandler;
|
|
11
|
+
backgroundManager: BackgroundManager;
|
|
12
|
+
skillMcpManager: SkillMcpManager;
|
|
13
|
+
agents: Record<string, AgentConfig>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createManagers(options: {
|
|
16
|
+
ctx: PluginInput;
|
|
17
|
+
pluginConfig: WeaveConfig;
|
|
18
|
+
resolveSkills?: ResolveSkillsFn;
|
|
19
|
+
fingerprint?: ProjectFingerprint | null;
|
|
20
|
+
configDir?: string;
|
|
21
|
+
}): WeaveManagers;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { WeaveConfig } from "./config/schema";
|
|
3
|
+
import type { WeaveManagers } from "./create-managers";
|
|
4
|
+
import type { ToolsRecord } from "./plugin/types";
|
|
5
|
+
import type { LoadedSkill } from "./features/skill-loader/types";
|
|
6
|
+
import type { ResolveSkillsFn } from "./agents/agent-builder";
|
|
7
|
+
export interface ToolsResult {
|
|
8
|
+
tools: ToolsRecord;
|
|
9
|
+
availableSkills: LoadedSkill[];
|
|
10
|
+
resolveSkillsFn: ResolveSkillsFn;
|
|
11
|
+
}
|
|
12
|
+
export declare function createTools(options: {
|
|
13
|
+
ctx: PluginInput;
|
|
14
|
+
pluginConfig: WeaveConfig;
|
|
15
|
+
managers?: WeaveManagers;
|
|
16
|
+
}): Promise<ToolsResult>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AdherenceReport } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Calculate plan adherence by comparing planned vs actual file changes.
|
|
4
|
+
*
|
|
5
|
+
* - **coverage**: fraction of planned files that were actually changed (0-1).
|
|
6
|
+
* If no files were planned, coverage = 1 (vacuously complete).
|
|
7
|
+
* - **precision**: fraction of actual changes that were planned (0-1).
|
|
8
|
+
* If no files were changed, precision = 1 (vacuously precise).
|
|
9
|
+
*/
|
|
10
|
+
export declare function calculateAdherence(plannedFiles: string[], actualFiles: string[]): AdherenceReport;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ProjectFingerprint, DetectedStack } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Detect the technology stack of a project by scanning for marker files.
|
|
4
|
+
* This is a fast, synchronous scan — suitable for fire-and-forget use.
|
|
5
|
+
*/
|
|
6
|
+
export declare function detectStack(directory: string): DetectedStack[];
|
|
7
|
+
/**
|
|
8
|
+
* Detect the package manager used by the project.
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectPackageManager(directory: string): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Detect whether the project is a monorepo.
|
|
13
|
+
*/
|
|
14
|
+
export declare function detectMonorepo(directory: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Detect the primary language of the project.
|
|
17
|
+
*/
|
|
18
|
+
export declare function detectPrimaryLanguage(stack: DetectedStack[]): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a complete project fingerprint.
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateFingerprint(directory: string): ProjectFingerprint;
|
|
23
|
+
/**
|
|
24
|
+
* Generate and persist a project fingerprint.
|
|
25
|
+
* Fire-and-forget: errors are logged but never thrown.
|
|
26
|
+
*/
|
|
27
|
+
export declare function fingerprintProject(directory: string): ProjectFingerprint | null;
|
|
28
|
+
/**
|
|
29
|
+
* Get the cached fingerprint, or generate a new one if missing or stale.
|
|
30
|
+
* Regenerates if the cached fingerprint was generated by a different Weave version.
|
|
31
|
+
* Fire-and-forget: errors are logged but never thrown.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getOrCreateFingerprint(directory: string): ProjectFingerprint | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MetricsReport, SessionSummary } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Format metrics reports and session summaries into a markdown dashboard.
|
|
4
|
+
*
|
|
5
|
+
* @param reports - Array of MetricsReport from readMetricsReports()
|
|
6
|
+
* @param summaries - Array of SessionSummary from readSessionSummaries()
|
|
7
|
+
* @param args - Optional arguments: a plan name to filter, "all" for all reports, or empty for last 5
|
|
8
|
+
* @returns Formatted markdown string
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatMetricsMarkdown(reports: MetricsReport[], summaries: SessionSummary[], args?: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { WorkState } from "../work-state/types";
|
|
2
|
+
import type { MetricsReport } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Generate a Phase 1 metrics report for a completed plan.
|
|
5
|
+
*
|
|
6
|
+
* Orchestrates:
|
|
7
|
+
* 1. Extract planned files from the plan markdown
|
|
8
|
+
* 2. Get actual changed files via git diff (startSha..HEAD)
|
|
9
|
+
* 3. Calculate adherence (coverage, precision)
|
|
10
|
+
* 4. Aggregate token usage across all sessions for this plan
|
|
11
|
+
* 5. Compute total duration from session summaries
|
|
12
|
+
* 6. Write the report to metrics-reports.jsonl
|
|
13
|
+
*
|
|
14
|
+
* In Phase 1, `quality` and `gaps` are undefined.
|
|
15
|
+
* Returns the report if successful, null on error.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateMetricsReport(directory: string, state: WorkState): MetricsReport | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the list of files changed between a given SHA and HEAD.
|
|
3
|
+
*
|
|
4
|
+
* Uses `git diff --name-only fromSha..HEAD` and returns relative paths.
|
|
5
|
+
* Returns an empty array on any error (non-git repo, invalid SHA, etc.).
|
|
6
|
+
*/
|
|
7
|
+
export declare function getChangedFiles(directory: string, fromSha: string): string[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type { ToolUsageEntry, DelegationEntry, SessionSummary, TokenUsage, MetricsTokenUsage, AdherenceReport, MetricsReport, DetectedStack, ProjectFingerprint, Suggestion, InFlightToolCall, TrackedSession, } from "./types";
|
|
2
|
+
export { ANALYTICS_DIR, SESSION_SUMMARIES_FILE, FINGERPRINT_FILE, METRICS_REPORTS_FILE, MAX_METRICS_ENTRIES, zeroTokenUsage, } from "./types";
|
|
3
|
+
export { ensureAnalyticsDir, appendSessionSummary, readSessionSummaries, writeFingerprint, readFingerprint, writeMetricsReport, readMetricsReports, } from "./storage";
|
|
4
|
+
export { detectStack, detectPackageManager, detectMonorepo, detectPrimaryLanguage, generateFingerprint, fingerprintProject, getOrCreateFingerprint, } from "./fingerprint";
|
|
5
|
+
export { SessionTracker, createSessionTracker } from "./session-tracker";
|
|
6
|
+
export { generateSuggestions, getSuggestionsForProject } from "./suggestions";
|
|
7
|
+
export { generateTokenReport, getTokenReport } from "./token-report";
|
|
8
|
+
export { formatMetricsMarkdown } from "./format-metrics";
|
|
9
|
+
export { generateMetricsReport } from "./generate-metrics-report";
|
|
10
|
+
export { extractPlannedFiles } from "./plan-parser";
|
|
11
|
+
export { getChangedFiles } from "./git-diff";
|
|
12
|
+
export { calculateAdherence } from "./adherence";
|
|
13
|
+
export { aggregateTokensForPlan } from "./plan-token-aggregator";
|
|
14
|
+
import type { SessionTracker } from "./session-tracker";
|
|
15
|
+
import type { ProjectFingerprint } from "./types";
|
|
16
|
+
/** Return value of createAnalytics — bundles tracker + fingerprint */
|
|
17
|
+
export interface Analytics {
|
|
18
|
+
/** Session tracker instance — wire into tool.execute.before/after */
|
|
19
|
+
tracker: SessionTracker;
|
|
20
|
+
/** Project fingerprint (may be null if detection fails) */
|
|
21
|
+
fingerprint: ProjectFingerprint | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create all analytics services for a project.
|
|
25
|
+
* Instantiates the session tracker and uses the provided fingerprint (if any).
|
|
26
|
+
* Fingerprint generation is the caller's responsibility — pass null to opt out.
|
|
27
|
+
* This is the single entry point called from the plugin's main init.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createAnalytics(directory: string, fingerprint: ProjectFingerprint | null): Analytics;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract all planned file paths from a plan's `## TODOs` section.
|
|
3
|
+
*
|
|
4
|
+
* Parses `**Files**:` lines, splits on commas, strips `(new)` / `Create` prefixes,
|
|
5
|
+
* deduplicates, and returns normalized relative paths.
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractPlannedFiles(planPath: string): string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MetricsTokenUsage } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Aggregate token usage for a plan by summing across matching session summaries.
|
|
4
|
+
*
|
|
5
|
+
* Reads all session summaries, filters to those whose `sessionId` is in `sessionIds`,
|
|
6
|
+
* and sums their `tokenUsage` fields. Sessions without `tokenUsage` contribute zeros
|
|
7
|
+
* (backward compatibility).
|
|
8
|
+
*
|
|
9
|
+
* Maps from session TokenUsage (inputTokens/outputTokens) to MetricsTokenUsage (input/output).
|
|
10
|
+
*/
|
|
11
|
+
export declare function aggregateTokensForPlan(directory: string, sessionIds: string[]): MetricsTokenUsage;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { TrackedSession, SessionSummary } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* SessionTracker tracks tool usage and delegations across sessions,
|
|
4
|
+
* producing SessionSummary records when sessions end.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* - Call `startSession()` when a session begins (or lazily on first tool call)
|
|
8
|
+
* - Call `trackToolStart()` / `trackToolEnd()` on tool.execute.before/after
|
|
9
|
+
* - Call `endSession()` when the session ends → writes summary to JSONL
|
|
10
|
+
*/
|
|
11
|
+
export declare class SessionTracker {
|
|
12
|
+
private sessions;
|
|
13
|
+
private directory;
|
|
14
|
+
constructor(directory: string);
|
|
15
|
+
/**
|
|
16
|
+
* Start tracking a session. Idempotent — if already tracking, returns existing.
|
|
17
|
+
*/
|
|
18
|
+
startSession(sessionId: string): TrackedSession;
|
|
19
|
+
/**
|
|
20
|
+
* Track a tool execution start. Lazily starts the session if needed.
|
|
21
|
+
*/
|
|
22
|
+
trackToolStart(sessionId: string, toolName: string, callId: string, agent?: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Track a tool execution end. Records delegation if it was a task tool.
|
|
25
|
+
*/
|
|
26
|
+
trackToolEnd(sessionId: string, toolName: string, callId: string, agent?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Set the agent name for a session. Only sets on first call (captures primary agent).
|
|
29
|
+
*/
|
|
30
|
+
setAgentName(sessionId: string, agentName: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Accumulate dollar cost from a message into the session total.
|
|
33
|
+
*/
|
|
34
|
+
trackCost(sessionId: string, cost: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Track token usage from a message.updated event.
|
|
37
|
+
* Accumulates all token fields into the session's running totals.
|
|
38
|
+
* Lazily starts the session if needed.
|
|
39
|
+
*/
|
|
40
|
+
trackTokenUsage(sessionId: string, tokens: {
|
|
41
|
+
input?: number;
|
|
42
|
+
output?: number;
|
|
43
|
+
reasoning?: number;
|
|
44
|
+
cacheRead?: number;
|
|
45
|
+
cacheWrite?: number;
|
|
46
|
+
}): void;
|
|
47
|
+
/**
|
|
48
|
+
* End a session and persist the summary. Removes the session from tracking.
|
|
49
|
+
* Returns the generated summary, or null if the session wasn't being tracked.
|
|
50
|
+
*/
|
|
51
|
+
endSession(sessionId: string): SessionSummary | null;
|
|
52
|
+
/**
|
|
53
|
+
* Check if a session is currently being tracked.
|
|
54
|
+
*/
|
|
55
|
+
isTracking(sessionId: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Get the current tracked session data (for inspection/testing).
|
|
58
|
+
*/
|
|
59
|
+
getSession(sessionId: string): TrackedSession | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Get the number of sessions currently being tracked.
|
|
62
|
+
*/
|
|
63
|
+
get activeSessionCount(): number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create a new SessionTracker instance.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createSessionTracker(directory: string): SessionTracker;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SessionSummary, ProjectFingerprint, MetricsReport } from "./types";
|
|
2
|
+
/** Maximum number of session summary entries to keep in the JSONL file */
|
|
3
|
+
export declare const MAX_SESSION_ENTRIES = 1000;
|
|
4
|
+
/**
|
|
5
|
+
* Ensure the analytics directory exists, creating it if needed.
|
|
6
|
+
* Returns the absolute path to the analytics directory.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ensureAnalyticsDir(directory: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Append a session summary to the JSONL file.
|
|
11
|
+
* Auto-creates the analytics directory if needed.
|
|
12
|
+
* Rotates the file to at most MAX_SESSION_ENTRIES when the threshold is exceeded.
|
|
13
|
+
*/
|
|
14
|
+
export declare function appendSessionSummary(directory: string, summary: SessionSummary): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Read all session summaries from the JSONL file.
|
|
17
|
+
* Returns an empty array if the file doesn't exist or is unparseable.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readSessionSummaries(directory: string): SessionSummary[];
|
|
20
|
+
/**
|
|
21
|
+
* Write a project fingerprint to the analytics directory.
|
|
22
|
+
* Auto-creates the analytics directory if needed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function writeFingerprint(directory: string, fingerprint: ProjectFingerprint): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Read the project fingerprint from the analytics directory.
|
|
27
|
+
* Returns null if the file doesn't exist or is unparseable.
|
|
28
|
+
*/
|
|
29
|
+
export declare function readFingerprint(directory: string): ProjectFingerprint | null;
|
|
30
|
+
/**
|
|
31
|
+
* Write a metrics report to the JSONL file.
|
|
32
|
+
* Auto-creates the analytics directory if needed.
|
|
33
|
+
* Appends the report and rotates if exceeding MAX_METRICS_ENTRIES.
|
|
34
|
+
*/
|
|
35
|
+
export declare function writeMetricsReport(directory: string, report: MetricsReport): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Read all metrics reports from the JSONL file.
|
|
38
|
+
* Returns an empty array if the file doesn't exist or is unparseable.
|
|
39
|
+
*/
|
|
40
|
+
export declare function readMetricsReports(directory: string): MetricsReport[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SessionSummary, Suggestion } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Generate suggestions based on session history.
|
|
4
|
+
* Analyzes tool usage patterns, delegation frequency, and workflow patterns.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateSuggestions(summaries: SessionSummary[]): Suggestion[];
|
|
7
|
+
/**
|
|
8
|
+
* Generate suggestions from stored session summaries for a project.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getSuggestionsForProject(directory: string): Suggestion[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SessionSummary } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Generate a human-readable token usage and cost report from session summaries.
|
|
4
|
+
*
|
|
5
|
+
* Sections:
|
|
6
|
+
* 1. Overall Totals — aggregate metrics across all sessions
|
|
7
|
+
* 2. Per-Agent Breakdown — grouped by agentName, sorted by total cost
|
|
8
|
+
* 3. Top 5 Costliest Sessions — most expensive individual sessions
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateTokenReport(summaries: SessionSummary[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* Convenience function: read summaries from disk and generate the report.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getTokenReport(directory: string): string;
|