@ericsanchezok/synergy-workbench 0.0.0-stage → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +30 -0
- package/README.md +16 -2
- package/dist/agents.js +11 -0
- package/dist/cli-adapter.js +8 -0
- package/dist/component.js +65 -0
- package/dist/config-schema.js +265 -0
- package/dist/execution/activity.js +78 -0
- package/dist/execution/content.js +184 -0
- package/dist/execution/json-sections.js +231 -0
- package/dist/execution/presentation.js +79 -0
- package/dist/execution/preview.js +13 -0
- package/dist/execution/process.js +125 -0
- package/dist/execution/projection.js +327 -0
- package/dist/execution/query.js +18 -0
- package/dist/execution/routes.js +189 -0
- package/dist/execution/schema.js +322 -0
- package/dist/execution/service.js +1993 -0
- package/dist/features.js +22 -0
- package/dist/http.js +65 -0
- package/dist/performance/analysis.js +330 -0
- package/dist/performance/catalog.js +391 -0
- package/dist/performance/dashboard.js +483 -0
- package/dist/performance/error.js +15 -0
- package/dist/performance/index.js +6 -0
- package/dist/performance/inflight.js +43 -0
- package/dist/performance/projection.js +138 -0
- package/dist/performance/prompt/base.txt +38 -0
- package/dist/performance/prompt/builder.js +21 -0
- package/dist/performance/routes/performance-route.js +439 -0
- package/dist/performance/schema.js +628 -0
- package/dist/performance/timeline.js +98 -0
- package/dist/performance/trace-detail.js +91 -0
- package/dist/presentation/service.js +270 -0
- package/dist/presentation/tools/workbench-view.js +65 -0
- package/dist/presentation/tools.js +10 -0
- package/dist/project/directories.js +363 -0
- package/dist/project/git-health.js +498 -0
- package/dist/project/ide.js +66 -0
- package/dist/project/migration.js +22 -0
- package/dist/project/routes/directories.js +89 -0
- package/dist/project/routes/git.js +30 -0
- package/dist/project/routes/task-defaults.js +42 -0
- package/dist/project/session-health.js +9 -0
- package/dist/project/startup.js +28 -0
- package/dist/project/task-defaults.js +68 -0
- package/dist/project/tools/session-control.js +664 -0
- package/dist/project/tools/session-control.txt +60 -0
- package/dist/project/tools/worktree-archive.js +76 -0
- package/dist/project/tools/worktree-enter.js +175 -0
- package/dist/project/tools/worktree-leave.js +119 -0
- package/dist/project/tools/worktree-list.js +52 -0
- package/dist/project/tools.js +26 -0
- package/dist/project/vcs-branch-watcher.js +76 -0
- package/dist/project/vcs.js +114 -0
- package/dist/project/worktree-janitor.js +140 -0
- package/dist/project/worktrees.js +98 -0
- package/dist/push/bridge.js +171 -0
- package/dist/push/index.js +4 -0
- package/dist/push/routes/push.js +224 -0
- package/dist/push/service.js +93 -0
- package/dist/push/store.js +121 -0
- package/dist/push/types.js +58 -0
- package/dist/review/git.js +226 -0
- package/dist/review/routes.js +45 -0
- package/dist/review/schema.js +32 -0
- package/dist/review/state.js +79 -0
- package/dist/stats/aggregator.js +252 -0
- package/dist/stats/canonical.js +89 -0
- package/dist/stats/cli/stats.js +302 -0
- package/dist/stats/engine.js +176 -0
- package/dist/stats/index.js +5 -0
- package/dist/stats/rollup.js +460 -0
- package/dist/stats/routes/stats.js +94 -0
- package/dist/stats/routes/usage.js +83 -0
- package/dist/stats/storage.js +86 -0
- package/dist/stats/types.js +267 -0
- package/dist/worker.js +6 -0
- package/package.json +232 -4
- package/src/agents.ts +15 -0
- package/src/cli-adapter.ts +11 -0
- package/src/component.ts +73 -0
- package/src/config-schema.ts +289 -0
- package/src/execution/activity.ts +83 -0
- package/src/execution/content.ts +189 -0
- package/src/execution/json-sections.ts +230 -0
- package/src/execution/presentation.ts +91 -0
- package/src/execution/preview.ts +12 -0
- package/src/execution/process.ts +118 -0
- package/src/execution/projection.ts +330 -0
- package/src/execution/query.ts +19 -0
- package/src/execution/routes.ts +324 -0
- package/src/execution/schema.ts +336 -0
- package/src/execution/service.ts +2149 -0
- package/src/features.ts +22 -0
- package/src/http.ts +75 -0
- package/src/performance/analysis.ts +356 -0
- package/src/performance/catalog.ts +902 -0
- package/src/performance/dashboard.ts +521 -0
- package/src/performance/error.ts +32 -0
- package/src/performance/index.ts +6 -0
- package/src/performance/inflight.ts +46 -0
- package/src/performance/projection.ts +143 -0
- package/src/performance/prompt/base.txt +38 -0
- package/src/performance/prompt/builder.ts +24 -0
- package/src/performance/routes/performance-route.ts +541 -0
- package/src/performance/schema.ts +695 -0
- package/src/performance/timeline.ts +100 -0
- package/src/performance/trace-detail.ts +97 -0
- package/src/presentation/service.ts +303 -0
- package/src/presentation/tools/workbench-view.ts +75 -0
- package/src/presentation/tools.ts +11 -0
- package/src/project/directories.ts +391 -0
- package/src/project/git-health.ts +577 -0
- package/src/project/ide.ts +80 -0
- package/src/project/migration.ts +24 -0
- package/src/project/routes/directories.ts +124 -0
- package/src/project/routes/git.ts +42 -0
- package/src/project/routes/task-defaults.ts +50 -0
- package/src/project/session-health.ts +10 -0
- package/src/project/startup.ts +28 -0
- package/src/project/task-defaults.ts +70 -0
- package/src/project/tools/session-control.ts +725 -0
- package/src/project/tools/session-control.txt +60 -0
- package/src/project/tools/worktree-archive.ts +92 -0
- package/src/project/tools/worktree-enter.ts +227 -0
- package/src/project/tools/worktree-leave.ts +140 -0
- package/src/project/tools/worktree-list.ts +68 -0
- package/src/project/tools.ts +29 -0
- package/src/project/vcs-branch-watcher.ts +81 -0
- package/src/project/vcs.ts +124 -0
- package/src/project/worktree-janitor.ts +153 -0
- package/src/project/worktrees.ts +110 -0
- package/src/push/bridge.ts +182 -0
- package/src/push/index.ts +4 -0
- package/src/push/routes/push.ts +267 -0
- package/src/push/service.ts +108 -0
- package/src/push/store.ts +120 -0
- package/src/push/types.ts +67 -0
- package/src/review/git.ts +221 -0
- package/src/review/routes.ts +65 -0
- package/src/review/schema.ts +34 -0
- package/src/review/state.ts +77 -0
- package/src/stats/aggregator.ts +277 -0
- package/src/stats/canonical.ts +93 -0
- package/src/stats/cli/stats.ts +348 -0
- package/src/stats/engine.ts +197 -0
- package/src/stats/index.ts +5 -0
- package/src/stats/rollup.ts +522 -0
- package/src/stats/routes/stats.ts +107 -0
- package/src/stats/routes/usage.ts +103 -0
- package/src/stats/storage.ts +78 -0
- package/src/stats/types.ts +351 -0
- package/src/worker.ts +7 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Storage } from "@ericsanchezok/synergy-harness/storage/storage";
|
|
2
|
+
import { StoragePath } from "@ericsanchezok/synergy-harness/storage/path";
|
|
3
|
+
export var StatsStorage;
|
|
4
|
+
(function (StatsStorage) {
|
|
5
|
+
async function getWatermark() {
|
|
6
|
+
try {
|
|
7
|
+
return await Storage.read(StoragePath.statsWatermark());
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
if (e instanceof Storage.NotFoundError)
|
|
11
|
+
return undefined;
|
|
12
|
+
throw e;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
StatsStorage.getWatermark = getWatermark;
|
|
16
|
+
async function setWatermark(watermark) {
|
|
17
|
+
await Storage.write(StoragePath.statsWatermark(), watermark);
|
|
18
|
+
}
|
|
19
|
+
StatsStorage.setWatermark = setWatermark;
|
|
20
|
+
async function getDigest(sessionID) {
|
|
21
|
+
try {
|
|
22
|
+
return await Storage.read(StoragePath.statsDigest(sessionID));
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
if (e instanceof Storage.NotFoundError)
|
|
26
|
+
return undefined;
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
StatsStorage.getDigest = getDigest;
|
|
31
|
+
async function setDigest(digest) {
|
|
32
|
+
await Storage.write(StoragePath.statsDigest(digest.sessionID), digest);
|
|
33
|
+
}
|
|
34
|
+
StatsStorage.setDigest = setDigest;
|
|
35
|
+
async function removeDigest(sessionID) {
|
|
36
|
+
await Storage.remove(StoragePath.statsDigest(sessionID));
|
|
37
|
+
}
|
|
38
|
+
StatsStorage.removeDigest = removeDigest;
|
|
39
|
+
async function listDigestIDs() {
|
|
40
|
+
return Storage.scan(StoragePath.statsDigestsRoot());
|
|
41
|
+
}
|
|
42
|
+
StatsStorage.listDigestIDs = listDigestIDs;
|
|
43
|
+
async function getAllDigests() {
|
|
44
|
+
const ids = await listDigestIDs();
|
|
45
|
+
if (ids.length === 0)
|
|
46
|
+
return [];
|
|
47
|
+
const keys = ids.map((id) => StoragePath.statsDigest(id));
|
|
48
|
+
const results = await Storage.readMany(keys);
|
|
49
|
+
return results.filter((d) => d !== undefined);
|
|
50
|
+
}
|
|
51
|
+
StatsStorage.getAllDigests = getAllDigests;
|
|
52
|
+
async function getDailyBucket(day) {
|
|
53
|
+
try {
|
|
54
|
+
return await Storage.read(StoragePath.statsDaily(day));
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
if (e instanceof Storage.NotFoundError)
|
|
58
|
+
return undefined;
|
|
59
|
+
throw e;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
StatsStorage.getDailyBucket = getDailyBucket;
|
|
63
|
+
async function setDailyBucket(day, bucket) {
|
|
64
|
+
await Storage.write(StoragePath.statsDaily(day), bucket);
|
|
65
|
+
}
|
|
66
|
+
StatsStorage.setDailyBucket = setDailyBucket;
|
|
67
|
+
async function listDailyKeys() {
|
|
68
|
+
return Storage.scan(StoragePath.statsDailyRoot());
|
|
69
|
+
}
|
|
70
|
+
StatsStorage.listDailyKeys = listDailyKeys;
|
|
71
|
+
async function getSnapshot() {
|
|
72
|
+
try {
|
|
73
|
+
return await Storage.read(StoragePath.statsSnapshot());
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
if (e instanceof Storage.NotFoundError)
|
|
77
|
+
return undefined;
|
|
78
|
+
throw e;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
StatsStorage.getSnapshot = getSnapshot;
|
|
82
|
+
async function setSnapshot(snapshot) {
|
|
83
|
+
await Storage.write(StoragePath.statsSnapshot(), snapshot);
|
|
84
|
+
}
|
|
85
|
+
StatsStorage.setSnapshot = setSnapshot;
|
|
86
|
+
})(StatsStorage || (StatsStorage = {}));
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { RolloutAccounting } from "@ericsanchezok/synergy-harness/session/rollout/accounting";
|
|
3
|
+
import { ExecutionPresentation } from "../execution/presentation.js";
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Shared primitives
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
export const TokenBreakdown = z.object({
|
|
8
|
+
input: z.number(),
|
|
9
|
+
output: z.number(),
|
|
10
|
+
reasoning: z.number(),
|
|
11
|
+
cache: z.object({
|
|
12
|
+
read: z.number(),
|
|
13
|
+
write: z.number(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Dimension 1 — Overview
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
export const OverviewStats = z.object({
|
|
20
|
+
totalSessions: z.number(),
|
|
21
|
+
activeSessions: z.number(),
|
|
22
|
+
archivedSessions: z.number(),
|
|
23
|
+
totalMessages: z.number(),
|
|
24
|
+
totalTurns: z.number(),
|
|
25
|
+
totalDays: z.number(),
|
|
26
|
+
longestStreak: z.number(),
|
|
27
|
+
currentStreak: z.number(),
|
|
28
|
+
projectCount: z.number(),
|
|
29
|
+
});
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Dimension 2 — Tokens & Cost
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
export const TokenCostStats = z.object({
|
|
34
|
+
tokens: TokenBreakdown,
|
|
35
|
+
cost: z.number(),
|
|
36
|
+
accounting: RolloutAccounting.Summary.optional(),
|
|
37
|
+
costPresentation: ExecutionPresentation.Cost.optional(),
|
|
38
|
+
cacheHitRate: z.number(),
|
|
39
|
+
avgCostPerTurn: z.number(),
|
|
40
|
+
avgTokensPerTurn: z.number(),
|
|
41
|
+
dailyCost: z.number(),
|
|
42
|
+
dailyTokens: z.number(),
|
|
43
|
+
});
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Dimension 3 — By Model (providerID/modelID → usage)
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
export const ModelUsage = z.object({
|
|
48
|
+
providerID: z.string(),
|
|
49
|
+
modelID: z.string(),
|
|
50
|
+
messages: z.number(),
|
|
51
|
+
turns: z.number(),
|
|
52
|
+
tokens: TokenBreakdown,
|
|
53
|
+
cost: z.number(),
|
|
54
|
+
accounting: RolloutAccounting.Summary.optional(),
|
|
55
|
+
avgResponseMs: z.number(),
|
|
56
|
+
});
|
|
57
|
+
export const ModelStats = z.object({
|
|
58
|
+
models: z.array(ModelUsage),
|
|
59
|
+
});
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Dimension 4 — By Agent
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
export const AgentUsage = z.object({
|
|
64
|
+
agent: z.string(),
|
|
65
|
+
messages: z.number(),
|
|
66
|
+
sessions: z.number(),
|
|
67
|
+
tokens: TokenBreakdown,
|
|
68
|
+
cost: z.number(),
|
|
69
|
+
accounting: RolloutAccounting.Summary.optional(),
|
|
70
|
+
subagentInvocations: z.number(),
|
|
71
|
+
});
|
|
72
|
+
export const AgentStats = z.object({
|
|
73
|
+
agents: z.array(AgentUsage),
|
|
74
|
+
totalSubagentCalls: z.number(),
|
|
75
|
+
});
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Dimension 5 — By Tool
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
export const ToolUsage = z.object({
|
|
80
|
+
tool: z.string(),
|
|
81
|
+
calls: z.number(),
|
|
82
|
+
successes: z.number(),
|
|
83
|
+
errors: z.number(),
|
|
84
|
+
avgDurationMs: z.number(),
|
|
85
|
+
});
|
|
86
|
+
export const ToolStats = z.object({
|
|
87
|
+
tools: z.array(ToolUsage),
|
|
88
|
+
});
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Dimension 6 — Code Changes
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
export const CodeChangeStats = z.object({
|
|
93
|
+
totalAdditions: z.number(),
|
|
94
|
+
totalDeletions: z.number(),
|
|
95
|
+
totalFiles: z.number(),
|
|
96
|
+
netLines: z.number(),
|
|
97
|
+
dailyAdditions: z.number(),
|
|
98
|
+
dailyDeletions: z.number(),
|
|
99
|
+
});
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Dimension 7 — Session Lifecycle
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
export const SessionLifecycleStats = z.object({
|
|
104
|
+
pinnedCount: z.number(),
|
|
105
|
+
avgTurnsPerSession: z.number(),
|
|
106
|
+
medianTurnsPerSession: z.number(),
|
|
107
|
+
compactionCount: z.number(),
|
|
108
|
+
retryCount: z.number(),
|
|
109
|
+
errorCount: z.number(),
|
|
110
|
+
errorRate: z.number(),
|
|
111
|
+
/** Bucketed session duration: short (<5min), medium (5-30min), long (>30min) */
|
|
112
|
+
durationBuckets: z.object({
|
|
113
|
+
short: z.number(),
|
|
114
|
+
medium: z.number(),
|
|
115
|
+
long: z.number(),
|
|
116
|
+
}),
|
|
117
|
+
});
|
|
118
|
+
// ---------------------------------------------------------------------------
|
|
119
|
+
// Dimension 8 — By Channel / Endpoint
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
export const ChannelUsage = z.object({
|
|
122
|
+
channel: z.string(),
|
|
123
|
+
sessions: z.number(),
|
|
124
|
+
messages: z.number(),
|
|
125
|
+
});
|
|
126
|
+
export const ChannelStats = z.object({
|
|
127
|
+
channels: z.array(ChannelUsage),
|
|
128
|
+
interactiveSessions: z.number(),
|
|
129
|
+
unattendedSessions: z.number(),
|
|
130
|
+
});
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// Dimension 9 — Time Series (per-day bucket)
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
export const DailyBucket = z.object({
|
|
135
|
+
day: z.string(),
|
|
136
|
+
sessions: z.number(),
|
|
137
|
+
turns: z.number(),
|
|
138
|
+
tokens: TokenBreakdown,
|
|
139
|
+
cost: z.number(),
|
|
140
|
+
accounting: RolloutAccounting.Summary.optional(),
|
|
141
|
+
additions: z.number(),
|
|
142
|
+
deletions: z.number(),
|
|
143
|
+
files: z.number(),
|
|
144
|
+
toolCalls: z.number(),
|
|
145
|
+
errors: z.number(),
|
|
146
|
+
});
|
|
147
|
+
export const HourlyBucket = z.object({
|
|
148
|
+
hour: z.string(),
|
|
149
|
+
turns: z.number(),
|
|
150
|
+
});
|
|
151
|
+
export const TimeSeriesStats = z.object({
|
|
152
|
+
days: z.array(DailyBucket),
|
|
153
|
+
hours: z.array(HourlyBucket),
|
|
154
|
+
/** Hour-of-day activity: 24-element array, each = turn count */
|
|
155
|
+
hourlyActivity: z.array(z.number()),
|
|
156
|
+
});
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
// Composite — Full Stats Snapshot
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
export const StatsSnapshot = z.object({
|
|
161
|
+
overview: OverviewStats,
|
|
162
|
+
tokenCost: TokenCostStats,
|
|
163
|
+
models: ModelStats,
|
|
164
|
+
agents: AgentStats,
|
|
165
|
+
tools: ToolStats,
|
|
166
|
+
codeChanges: CodeChangeStats,
|
|
167
|
+
lifecycle: SessionLifecycleStats,
|
|
168
|
+
channels: ChannelStats,
|
|
169
|
+
timeSeries: TimeSeriesStats,
|
|
170
|
+
/** Timestamp when this snapshot was computed */
|
|
171
|
+
computedAt: z.number(),
|
|
172
|
+
/** Watermark: latest session.updated we scanned up to */
|
|
173
|
+
watermark: z.number(),
|
|
174
|
+
});
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
// Per-Session Digest (intermediate product for incremental aggregation)
|
|
177
|
+
// ---------------------------------------------------------------------------
|
|
178
|
+
export const SessionDigest = z.object({
|
|
179
|
+
sessionID: z.string(),
|
|
180
|
+
scopeID: z.string(),
|
|
181
|
+
created: z.number(),
|
|
182
|
+
updated: z.number(),
|
|
183
|
+
rolloutRevision: z.number().int().nonnegative().optional(),
|
|
184
|
+
archived: z.number().optional(),
|
|
185
|
+
pinned: z.boolean(),
|
|
186
|
+
parentID: z.string().optional(),
|
|
187
|
+
endpoint: z
|
|
188
|
+
.object({
|
|
189
|
+
kind: z.string(),
|
|
190
|
+
type: z.string().optional(),
|
|
191
|
+
})
|
|
192
|
+
.optional(),
|
|
193
|
+
interaction: z
|
|
194
|
+
.object({
|
|
195
|
+
mode: z.string(),
|
|
196
|
+
source: z.string().optional(),
|
|
197
|
+
})
|
|
198
|
+
.optional(),
|
|
199
|
+
turns: z.number(),
|
|
200
|
+
messages: z.number(),
|
|
201
|
+
tokens: TokenBreakdown,
|
|
202
|
+
cost: z.number(),
|
|
203
|
+
accounting: RolloutAccounting.Summary.optional(),
|
|
204
|
+
/** model key (providerID/modelID) → { messages, tokens, cost, totalResponseMs } */
|
|
205
|
+
modelUsage: z.record(z.string(), z.object({
|
|
206
|
+
messages: z.number(),
|
|
207
|
+
tokens: TokenBreakdown,
|
|
208
|
+
cost: z.number(),
|
|
209
|
+
accounting: RolloutAccounting.Summary.optional(),
|
|
210
|
+
totalResponseMs: z.number(),
|
|
211
|
+
})),
|
|
212
|
+
/** agent → { messages, tokens, cost } */
|
|
213
|
+
agentUsage: z.record(z.string(), z.object({
|
|
214
|
+
messages: z.number(),
|
|
215
|
+
tokens: TokenBreakdown,
|
|
216
|
+
cost: z.number(),
|
|
217
|
+
accounting: RolloutAccounting.Summary.optional(),
|
|
218
|
+
})),
|
|
219
|
+
/** tool → { calls, successes, errors, totalDurationMs } */
|
|
220
|
+
toolUsage: z.record(z.string(), z.object({
|
|
221
|
+
calls: z.number(),
|
|
222
|
+
successes: z.number(),
|
|
223
|
+
errors: z.number(),
|
|
224
|
+
totalDurationMs: z.number(),
|
|
225
|
+
timedSamples: z.number().int().nonnegative().optional(),
|
|
226
|
+
})),
|
|
227
|
+
/** YYYY-MM-DDTHH → turn count */
|
|
228
|
+
hourlyTurns: z.record(z.string(), z.number()),
|
|
229
|
+
additions: z.number(),
|
|
230
|
+
deletions: z.number(),
|
|
231
|
+
files: z.number(),
|
|
232
|
+
compactionCount: z.number(),
|
|
233
|
+
retryCount: z.number(),
|
|
234
|
+
errorCount: z.number(),
|
|
235
|
+
/** Duration in ms (updated - created) */
|
|
236
|
+
durationMs: z.number(),
|
|
237
|
+
});
|
|
238
|
+
export const OperationDigest = SessionDigest.pick({
|
|
239
|
+
scopeID: true,
|
|
240
|
+
created: true,
|
|
241
|
+
updated: true,
|
|
242
|
+
tokens: true,
|
|
243
|
+
cost: true,
|
|
244
|
+
accounting: true,
|
|
245
|
+
modelUsage: true,
|
|
246
|
+
agentUsage: true,
|
|
247
|
+
}).extend({ operationID: z.string(), rolloutRevision: z.number().int().nonnegative(), turns: z.literal(0) });
|
|
248
|
+
// ---------------------------------------------------------------------------
|
|
249
|
+
// Watermark — tracks incremental scan progress
|
|
250
|
+
// ---------------------------------------------------------------------------
|
|
251
|
+
export const StatsWatermark = z.object({
|
|
252
|
+
/** Last session.updated timestamp we scanned */
|
|
253
|
+
lastUpdated: z.number(),
|
|
254
|
+
/** Set of sessionIDs already digested (to detect deletions) */
|
|
255
|
+
sessionIDs: z.array(z.string()),
|
|
256
|
+
/** Timestamp of last full scan */
|
|
257
|
+
lastFullScanAt: z.number(),
|
|
258
|
+
});
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
// Progress callback
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
export const ProgressEvent = z.object({
|
|
263
|
+
phase: z.enum(["scan", "digest", "bucket", "snapshot"]),
|
|
264
|
+
current: z.number(),
|
|
265
|
+
total: z.number(),
|
|
266
|
+
message: z.string().optional(),
|
|
267
|
+
});
|
package/dist/worker.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,234 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ericsanchezok/synergy-workbench",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./stats/cli/stats": {
|
|
8
|
+
"types": "./src/stats/cli/stats.ts",
|
|
9
|
+
"bun": "./dist/stats/cli/stats.js",
|
|
10
|
+
"import": "./dist/stats/cli/stats.js"
|
|
11
|
+
},
|
|
12
|
+
"./stats/aggregator": {
|
|
13
|
+
"types": "./src/stats/aggregator.ts",
|
|
14
|
+
"bun": "./dist/stats/aggregator.js",
|
|
15
|
+
"import": "./dist/stats/aggregator.js"
|
|
16
|
+
},
|
|
17
|
+
"./project/tools": {
|
|
18
|
+
"types": "./src/project/tools.ts",
|
|
19
|
+
"bun": "./dist/project/tools.js",
|
|
20
|
+
"import": "./dist/project/tools.js"
|
|
21
|
+
},
|
|
22
|
+
"./presentation/service": {
|
|
23
|
+
"types": "./src/presentation/service.ts",
|
|
24
|
+
"bun": "./dist/presentation/service.js",
|
|
25
|
+
"import": "./dist/presentation/service.js"
|
|
26
|
+
},
|
|
27
|
+
"./presentation/tools": {
|
|
28
|
+
"types": "./src/presentation/tools.ts",
|
|
29
|
+
"bun": "./dist/presentation/tools.js",
|
|
30
|
+
"import": "./dist/presentation/tools.js"
|
|
31
|
+
},
|
|
32
|
+
"./presentation/tools/workbench-view": {
|
|
33
|
+
"types": "./src/presentation/tools/workbench-view.ts",
|
|
34
|
+
"bun": "./dist/presentation/tools/workbench-view.js",
|
|
35
|
+
"import": "./dist/presentation/tools/workbench-view.js"
|
|
36
|
+
},
|
|
37
|
+
"./project/startup": {
|
|
38
|
+
"types": "./src/project/startup.ts",
|
|
39
|
+
"bun": "./dist/project/startup.js",
|
|
40
|
+
"import": "./dist/project/startup.js"
|
|
41
|
+
},
|
|
42
|
+
"./project/session-health": {
|
|
43
|
+
"types": "./src/project/session-health.ts",
|
|
44
|
+
"bun": "./dist/project/session-health.js",
|
|
45
|
+
"import": "./dist/project/session-health.js"
|
|
46
|
+
},
|
|
47
|
+
"./project/vcs": {
|
|
48
|
+
"types": "./src/project/vcs.ts",
|
|
49
|
+
"bun": "./dist/project/vcs.js",
|
|
50
|
+
"import": "./dist/project/vcs.js"
|
|
51
|
+
},
|
|
52
|
+
"./project/worktree-janitor": {
|
|
53
|
+
"types": "./src/project/worktree-janitor.ts",
|
|
54
|
+
"bun": "./dist/project/worktree-janitor.js",
|
|
55
|
+
"import": "./dist/project/worktree-janitor.js"
|
|
56
|
+
},
|
|
57
|
+
"./push/bridge": {
|
|
58
|
+
"types": "./src/push/bridge.ts",
|
|
59
|
+
"bun": "./dist/push/bridge.js",
|
|
60
|
+
"import": "./dist/push/bridge.js"
|
|
61
|
+
},
|
|
62
|
+
"./stats/routes/stats": {
|
|
63
|
+
"types": "./src/stats/routes/stats.ts",
|
|
64
|
+
"bun": "./dist/stats/routes/stats.js",
|
|
65
|
+
"import": "./dist/stats/routes/stats.js"
|
|
66
|
+
},
|
|
67
|
+
"./performance/routes/performance-route": {
|
|
68
|
+
"types": "./src/performance/routes/performance-route.ts",
|
|
69
|
+
"bun": "./dist/performance/routes/performance-route.js",
|
|
70
|
+
"import": "./dist/performance/routes/performance-route.js"
|
|
71
|
+
},
|
|
72
|
+
"./push/routes/push": {
|
|
73
|
+
"types": "./src/push/routes/push.ts",
|
|
74
|
+
"bun": "./dist/push/routes/push.js",
|
|
75
|
+
"import": "./dist/push/routes/push.js"
|
|
76
|
+
},
|
|
77
|
+
"./project/ide": {
|
|
78
|
+
"types": "./src/project/ide.ts",
|
|
79
|
+
"bun": "./dist/project/ide.js",
|
|
80
|
+
"import": "./dist/project/ide.js"
|
|
81
|
+
},
|
|
82
|
+
"./performance/catalog": {
|
|
83
|
+
"types": "./src/performance/catalog.ts",
|
|
84
|
+
"bun": "./dist/performance/catalog.js",
|
|
85
|
+
"import": "./dist/performance/catalog.js"
|
|
86
|
+
},
|
|
87
|
+
"./performance/dashboard": {
|
|
88
|
+
"types": "./src/performance/dashboard.ts",
|
|
89
|
+
"bun": "./dist/performance/dashboard.js",
|
|
90
|
+
"import": "./dist/performance/dashboard.js"
|
|
91
|
+
},
|
|
92
|
+
"./push/service": {
|
|
93
|
+
"types": "./src/push/service.ts",
|
|
94
|
+
"bun": "./dist/push/service.js",
|
|
95
|
+
"import": "./dist/push/service.js"
|
|
96
|
+
},
|
|
97
|
+
"./push/store": {
|
|
98
|
+
"types": "./src/push/store.ts",
|
|
99
|
+
"bun": "./dist/push/store.js",
|
|
100
|
+
"import": "./dist/push/store.js"
|
|
101
|
+
},
|
|
102
|
+
"./project/tools/session-control": {
|
|
103
|
+
"types": "./src/project/tools/session-control.ts",
|
|
104
|
+
"bun": "./dist/project/tools/session-control.js",
|
|
105
|
+
"import": "./dist/project/tools/session-control.js"
|
|
106
|
+
},
|
|
107
|
+
"./project/tools/worktree-enter": {
|
|
108
|
+
"types": "./src/project/tools/worktree-enter.ts",
|
|
109
|
+
"bun": "./dist/project/tools/worktree-enter.js",
|
|
110
|
+
"import": "./dist/project/tools/worktree-enter.js"
|
|
111
|
+
},
|
|
112
|
+
"./project/tools/worktree-leave": {
|
|
113
|
+
"types": "./src/project/tools/worktree-leave.ts",
|
|
114
|
+
"bun": "./dist/project/tools/worktree-leave.js",
|
|
115
|
+
"import": "./dist/project/tools/worktree-leave.js"
|
|
116
|
+
},
|
|
117
|
+
"./project/tools/worktree-archive": {
|
|
118
|
+
"types": "./src/project/tools/worktree-archive.ts",
|
|
119
|
+
"bun": "./dist/project/tools/worktree-archive.js",
|
|
120
|
+
"import": "./dist/project/tools/worktree-archive.js"
|
|
121
|
+
},
|
|
122
|
+
"./project/tools/worktree-list": {
|
|
123
|
+
"types": "./src/project/tools/worktree-list.ts",
|
|
124
|
+
"bun": "./dist/project/tools/worktree-list.js",
|
|
125
|
+
"import": "./dist/project/tools/worktree-list.js"
|
|
126
|
+
},
|
|
127
|
+
"./performance/timeline": {
|
|
128
|
+
"types": "./src/performance/timeline.ts",
|
|
129
|
+
"bun": "./dist/performance/timeline.js",
|
|
130
|
+
"import": "./dist/performance/timeline.js"
|
|
131
|
+
},
|
|
132
|
+
"./config-schema": {
|
|
133
|
+
"types": "./src/config-schema.ts",
|
|
134
|
+
"bun": "./dist/config-schema.js",
|
|
135
|
+
"import": "./dist/config-schema.js"
|
|
136
|
+
},
|
|
137
|
+
"./agents": {
|
|
138
|
+
"types": "./src/agents.ts",
|
|
139
|
+
"bun": "./dist/agents.js",
|
|
140
|
+
"import": "./dist/agents.js"
|
|
141
|
+
},
|
|
142
|
+
"./performance/prompt/builder": {
|
|
143
|
+
"types": "./src/performance/prompt/builder.ts",
|
|
144
|
+
"bun": "./dist/performance/prompt/builder.js",
|
|
145
|
+
"import": "./dist/performance/prompt/builder.js"
|
|
146
|
+
},
|
|
147
|
+
"./project/routes/git": {
|
|
148
|
+
"types": "./src/project/routes/git.ts",
|
|
149
|
+
"bun": "./dist/project/routes/git.js",
|
|
150
|
+
"import": "./dist/project/routes/git.js"
|
|
151
|
+
},
|
|
152
|
+
"./component": {
|
|
153
|
+
"types": "./src/component.ts",
|
|
154
|
+
"bun": "./dist/component.js",
|
|
155
|
+
"import": "./dist/component.js"
|
|
156
|
+
},
|
|
157
|
+
"./http": {
|
|
158
|
+
"types": "./src/http.ts",
|
|
159
|
+
"bun": "./dist/http.js",
|
|
160
|
+
"import": "./dist/http.js"
|
|
161
|
+
},
|
|
162
|
+
"./features": {
|
|
163
|
+
"types": "./src/features.ts",
|
|
164
|
+
"bun": "./dist/features.js",
|
|
165
|
+
"import": "./dist/features.js"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"dependencies": {
|
|
169
|
+
"@ericsanchezok/synergy-harness": "3.1.0",
|
|
170
|
+
"@ericsanchezok/synergy-local-runtime": "3.1.0",
|
|
171
|
+
"@ericsanchezok/synergy-util": "3.1.0",
|
|
172
|
+
"@hono/standard-validator": "0.4.0",
|
|
173
|
+
"hono": "4.13.13",
|
|
174
|
+
"hono-openapi": "1.1.2",
|
|
175
|
+
"web-push": "3.6.7",
|
|
176
|
+
"yargs": "18.2.0",
|
|
177
|
+
"zod": "4.6.7"
|
|
178
|
+
},
|
|
179
|
+
"peerDependencies": {
|
|
180
|
+
"@ericsanchezok/synergy-server": "3.1.0"
|
|
181
|
+
},
|
|
182
|
+
"peerDependenciesMeta": {
|
|
183
|
+
"@ericsanchezok/synergy-server": {
|
|
184
|
+
"optional": true
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"synergy": {
|
|
188
|
+
"formatVersion": 1,
|
|
189
|
+
"kind": "component",
|
|
190
|
+
"id": "workbench",
|
|
191
|
+
"version": "3.1.0",
|
|
192
|
+
"compatibility": {
|
|
193
|
+
"synergy": "3.1.0"
|
|
194
|
+
},
|
|
195
|
+
"apiVersion": 1,
|
|
196
|
+
"entry": "./dist/component.js",
|
|
197
|
+
"export": "workbench",
|
|
198
|
+
"requires": {
|
|
199
|
+
"local-runtime": "3.1.0"
|
|
200
|
+
},
|
|
201
|
+
"features": {
|
|
202
|
+
"kind": "product",
|
|
203
|
+
"definitions": [
|
|
204
|
+
{
|
|
205
|
+
"id": "workbench",
|
|
206
|
+
"owner": "workbench",
|
|
207
|
+
"maturity": "stable",
|
|
208
|
+
"activation": "restart",
|
|
209
|
+
"name": "Workbench",
|
|
210
|
+
"description": "Projects, task presentation, reviews and activity.",
|
|
211
|
+
"component": "workbench"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"id": "kanban",
|
|
215
|
+
"owner": "workbench",
|
|
216
|
+
"maturity": "experimental",
|
|
217
|
+
"activation": "restart",
|
|
218
|
+
"name": "Kanban",
|
|
219
|
+
"description": "View and organize tasks on a board."
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
"packages": {}
|
|
224
|
+
},
|
|
225
|
+
"files": [
|
|
226
|
+
"src",
|
|
227
|
+
"dist",
|
|
228
|
+
"README.md",
|
|
229
|
+
"AGENTS.md"
|
|
230
|
+
],
|
|
231
|
+
"engines": {
|
|
232
|
+
"bun": ">=1.4.3"
|
|
233
|
+
}
|
|
234
|
+
}
|
package/src/agents.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Agent } from "@ericsanchezok/synergy-harness/agent/agent"
|
|
2
|
+
import { resolveAgentModelRole, type BuiltinAgentContext } from "@ericsanchezok/synergy-harness/agent/builtin-context"
|
|
3
|
+
import { createPerformanceAnalystAgent } from "./performance/prompt/builder"
|
|
4
|
+
import { AgentBuiltins } from "@ericsanchezok/synergy-harness/agent/builtins"
|
|
5
|
+
|
|
6
|
+
export function createDomainAgents(ctx: BuiltinAgentContext): Record<string, Agent.Info> {
|
|
7
|
+
const performanceAnalyst = createPerformanceAnalystAgent(ctx)
|
|
8
|
+
return {
|
|
9
|
+
[performanceAnalyst.name]: performanceAnalyst,
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function registerWorkbenchAgents() {
|
|
14
|
+
AgentBuiltins.register("workbench", createDomainAgents)
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandEntry } from "@ericsanchezok/synergy-util/cli-command"
|
|
2
|
+
import type { CommandModule } from "@ericsanchezok/synergy-util/cli-command"
|
|
3
|
+
|
|
4
|
+
export const commands: CommandEntry[] = [
|
|
5
|
+
{
|
|
6
|
+
command: "stats",
|
|
7
|
+
describe: "show token usage and cost statistics",
|
|
8
|
+
storage: "maintenance",
|
|
9
|
+
load: async () => (await import("./stats/cli/stats")).StatsCommand as unknown as CommandModule,
|
|
10
|
+
},
|
|
11
|
+
]
|