@pennyfarthing/cyclist 10.4.0 → 11.0.0-alpha.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/dist/api/agent-load.d.ts +1 -2
- package/dist/api/agent-load.d.ts.map +1 -1
- package/dist/api/agent-load.js +2 -123
- package/dist/api/agent-load.js.map +1 -1
- package/dist/api/audit-log.d.ts +1 -17
- package/dist/api/audit-log.d.ts.map +1 -1
- package/dist/api/audit-log.js +2 -162
- package/dist/api/audit-log.js.map +1 -1
- package/dist/api/background-tasks.d.ts +1 -26
- package/dist/api/background-tasks.d.ts.map +1 -1
- package/dist/api/background-tasks.js +2 -55
- package/dist/api/background-tasks.js.map +1 -1
- package/dist/api/bell.d.ts +1 -18
- package/dist/api/bell.d.ts.map +1 -1
- package/dist/api/bell.js +2 -33
- package/dist/api/bell.js.map +1 -1
- package/dist/api/code-markers.d.ts +1 -8
- package/dist/api/code-markers.d.ts.map +1 -1
- package/dist/api/code-markers.js +2 -61
- package/dist/api/code-markers.js.map +1 -1
- package/dist/api/complexity.d.ts +1 -2
- package/dist/api/complexity.d.ts.map +1 -1
- package/dist/api/complexity.js +2 -46
- package/dist/api/complexity.js.map +1 -1
- package/dist/api/context.d.ts +1 -37
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/context.js +2 -143
- package/dist/api/context.js.map +1 -1
- package/dist/api/dead-code.d.ts +1 -2
- package/dist/api/dead-code.d.ts.map +1 -1
- package/dist/api/dead-code.js +2 -69
- package/dist/api/dead-code.js.map +1 -1
- package/dist/api/dependencies.d.ts +1 -2
- package/dist/api/dependencies.d.ts.map +1 -1
- package/dist/api/dependencies.js +2 -42
- package/dist/api/dependencies.js.map +1 -1
- package/dist/api/evaluation.d.ts +1 -19
- package/dist/api/evaluation.d.ts.map +1 -1
- package/dist/api/evaluation.js +2 -127
- package/dist/api/evaluation.js.map +1 -1
- package/dist/api/file-browser.d.ts +1 -8
- package/dist/api/file-browser.d.ts.map +1 -1
- package/dist/api/file-browser.js +2 -114
- package/dist/api/file-browser.js.map +1 -1
- package/dist/api/git.d.ts +1 -46
- package/dist/api/git.d.ts.map +1 -1
- package/dist/api/git.js +2 -354
- package/dist/api/git.js.map +1 -1
- package/dist/api/health-score.d.ts +1 -2
- package/dist/api/health-score.d.ts.map +1 -1
- package/dist/api/health-score.js +2 -46
- package/dist/api/health-score.js.map +1 -1
- package/dist/api/hook-request.d.ts +1 -40
- package/dist/api/hook-request.d.ts.map +1 -1
- package/dist/api/hook-request.js +2 -277
- package/dist/api/hook-request.js.map +1 -1
- package/dist/api/hotspots.d.ts +1 -2
- package/dist/api/hotspots.d.ts.map +1 -1
- package/dist/api/hotspots.js +2 -61
- package/dist/api/hotspots.js.map +1 -1
- package/dist/api/identity.d.ts +1 -16
- package/dist/api/identity.d.ts.map +1 -1
- package/dist/api/identity.js +2 -78
- package/dist/api/identity.js.map +1 -1
- package/dist/api/index.d.ts +1 -34
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -44
- package/dist/api/index.js.map +1 -1
- package/dist/api/mode.d.ts +1 -22
- package/dist/api/mode.d.ts.map +1 -1
- package/dist/api/mode.js +2 -37
- package/dist/api/mode.js.map +1 -1
- package/dist/api/otlp.d.ts +1 -2
- package/dist/api/otlp.d.ts.map +1 -1
- package/dist/api/otlp.js +2 -46
- package/dist/api/otlp.js.map +1 -1
- package/dist/api/permissions.d.ts +1 -15
- package/dist/api/permissions.d.ts.map +1 -1
- package/dist/api/permissions.js +2 -66
- package/dist/api/permissions.js.map +1 -1
- package/dist/api/persona.d.ts +1 -8
- package/dist/api/persona.d.ts.map +1 -1
- package/dist/api/persona.js +2 -67
- package/dist/api/persona.js.map +1 -1
- package/dist/api/portrait.d.ts +1 -5
- package/dist/api/portrait.d.ts.map +1 -1
- package/dist/api/portrait.js +2 -27
- package/dist/api/portrait.js.map +1 -1
- package/dist/api/settings.d.ts +1 -53
- package/dist/api/settings.d.ts.map +1 -1
- package/dist/api/settings.js +2 -464
- package/dist/api/settings.js.map +1 -1
- package/dist/api/spans.d.ts +1 -16
- package/dist/api/spans.d.ts.map +1 -1
- package/dist/api/spans.js +2 -244
- package/dist/api/spans.js.map +1 -1
- package/dist/api/stats.d.ts +1 -12
- package/dist/api/stats.d.ts.map +1 -1
- package/dist/api/stats.js +2 -84
- package/dist/api/stats.js.map +1 -1
- package/dist/api/story.d.ts +1 -2
- package/dist/api/story.d.ts.map +1 -1
- package/dist/api/story.js +2 -14
- package/dist/api/story.js.map +1 -1
- package/dist/api/telemetry.d.ts +1 -18
- package/dist/api/telemetry.d.ts.map +1 -1
- package/dist/api/telemetry.js +2 -164
- package/dist/api/telemetry.js.map +1 -1
- package/dist/api/theme-agents.d.ts +1 -60
- package/dist/api/theme-agents.d.ts.map +1 -1
- package/dist/api/theme-agents.js +2 -213
- package/dist/api/theme-agents.js.map +1 -1
- package/dist/api/todos.d.ts +1 -32
- package/dist/api/todos.d.ts.map +1 -1
- package/dist/api/todos.js +2 -43
- package/dist/api/todos.js.map +1 -1
- package/dist/api/token-stats.d.ts +1 -7
- package/dist/api/token-stats.d.ts.map +1 -1
- package/dist/api/token-stats.js +2 -35
- package/dist/api/token-stats.js.map +1 -1
- package/dist/api/welcome.d.ts +1 -21
- package/dist/api/welcome.d.ts.map +1 -1
- package/dist/api/welcome.js +2 -34
- package/dist/api/welcome.js.map +1 -1
- package/dist/env.d.ts +6 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +10 -0
- package/dist/env.js.map +1 -0
- package/dist/focus.d.ts +53 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +122 -0
- package/dist/focus.js.map +1 -0
- package/dist/menu-builder.d.ts.map +1 -1
- package/dist/menu-builder.js +0 -1
- package/dist/menu-builder.js.map +1 -1
- package/dist/public/css/react.css +1 -1
- package/dist/public/js/react/react.js +51 -59
- package/dist/server.d.ts +16 -85
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +38 -409
- package/dist/server.js.map +1 -1
- package/dist/sprint-data.d.ts +1 -1
- package/dist/sprint-data.d.ts.map +1 -1
- package/dist/sprint-data.js +2 -2
- package/dist/sprint-data.js.map +1 -1
- package/dist/websocket.d.ts +2 -0
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +42 -75
- package/dist/websocket.js.map +1 -1
- package/package.json +3 -6
- package/portraits/hogans-heroes/large/burkhalter-35312.png +0 -0
- package/portraits/hogans-heroes/large/carter-34352.png +0 -0
- package/portraits/hogans-heroes/large/hochstetter-45314.png +0 -0
- package/portraits/hogans-heroes/large/hogan-44541.png +0 -0
- package/portraits/hogans-heroes/large/kinch-35241.png +0 -0
- package/portraits/hogans-heroes/large/klink-23434.png +0 -0
- package/portraits/hogans-heroes/large/lebeau-45443.png +0 -0
- package/portraits/hogans-heroes/large/marya-53543.png +0 -0
- package/portraits/hogans-heroes/large/newkirk-54432.png +0 -0
- package/portraits/hogans-heroes/large/schultz-42453.png +0 -0
- package/portraits/hogans-heroes/large/underground-55131.png +0 -0
- package/portraits/hogans-heroes/medium/burkhalter-35312.png +0 -0
- package/portraits/hogans-heroes/medium/carter-34352.png +0 -0
- package/portraits/hogans-heroes/medium/hochstetter-45314.png +0 -0
- package/portraits/hogans-heroes/medium/hogan-44541.png +0 -0
- package/portraits/hogans-heroes/medium/kinch-35241.png +0 -0
- package/portraits/hogans-heroes/medium/klink-23434.png +0 -0
- package/portraits/hogans-heroes/medium/lebeau-45443.png +0 -0
- package/portraits/hogans-heroes/medium/marya-53543.png +0 -0
- package/portraits/hogans-heroes/medium/newkirk-54432.png +0 -0
- package/portraits/hogans-heroes/medium/schultz-42453.png +0 -0
- package/portraits/hogans-heroes/medium/underground-55131.png +0 -0
- package/portraits/monty-python/large/announcer-44441.png +0 -0
- package/portraits/monty-python/large/arguer-35412.png +0 -0
- package/portraits/monty-python/large/bicycle-repair-man-35241.png +0 -0
- package/portraits/monty-python/large/colonel-35423.png +0 -0
- package/portraits/monty-python/large/counsellor-45341.png +0 -0
- package/portraits/monty-python/large/gumbys-23524.png +0 -0
- package/portraits/monty-python/large/nudge-43533.png +0 -0
- package/portraits/monty-python/large/praline-45413.png +0 -0
- package/portraits/monty-python/large/silly-walks-55322.png +0 -0
- package/portraits/monty-python/large/wensleydale-54451.png +0 -0
- package/portraits/monty-python/large/xim-nez-43534.png +0 -0
- package/portraits/monty-python/medium/announcer-44441.png +0 -0
- package/portraits/monty-python/medium/arguer-35412.png +0 -0
- package/portraits/monty-python/medium/bicycle-repair-man-35241.png +0 -0
- package/portraits/monty-python/medium/colonel-35423.png +0 -0
- package/portraits/monty-python/medium/counsellor-45341.png +0 -0
- package/portraits/monty-python/medium/gumbys-23524.png +0 -0
- package/portraits/monty-python/medium/nudge-43533.png +0 -0
- package/portraits/monty-python/medium/praline-45413.png +0 -0
- package/portraits/monty-python/medium/silly-walks-55322.png +0 -0
- package/portraits/monty-python/medium/wensleydale-54451.png +0 -0
- package/portraits/monty-python/medium/xim-nez-43534.png +0 -0
- package/portraits/stephen-king/large/andy-55231.png +0 -0
- package/portraits/stephen-king/large/christine-25112.png +0 -0
- package/portraits/stephen-king/large/danny-53243.png +0 -0
- package/portraits/stephen-king/large/flagg-55311.png +0 -0
- package/portraits/stephen-king/large/gaunt-54421.png +0 -0
- package/portraits/stephen-king/large/jack-44224.png +0 -0
- package/portraits/stephen-king/large/johnny-44353.png +0 -0
- package/portraits/stephen-king/large/margaret-15415.png +0 -0
- package/portraits/stephen-king/large/paul-45233.png +0 -0
- package/portraits/stephen-king/large/pennywise-54411.png +0 -0
- package/portraits/stephen-king/large/roland-35121.png +0 -0
- package/portraits/stephen-king/medium/andy-55231.png +0 -0
- package/portraits/stephen-king/medium/christine-25112.png +0 -0
- package/portraits/stephen-king/medium/danny-53243.png +0 -0
- package/portraits/stephen-king/medium/flagg-55311.png +0 -0
- package/portraits/stephen-king/medium/gaunt-54421.png +0 -0
- package/portraits/stephen-king/medium/jack-44224.png +0 -0
- package/portraits/stephen-king/medium/johnny-44353.png +0 -0
- package/portraits/stephen-king/medium/margaret-15415.png +0 -0
- package/portraits/stephen-king/medium/paul-45233.png +0 -0
- package/portraits/stephen-king/medium/pennywise-54411.png +0 -0
- package/portraits/stephen-king/medium/roland-35121.png +0 -0
- package/src/public/App.tsx +21 -5
- package/src/public/components/BikeRackIndex.tsx +0 -1
- package/src/public/components/BikeRackWorkspace.tsx +86 -11
- package/src/public/components/DockviewWorkspace.tsx +19 -8
- package/src/public/components/StandalonePanel.tsx +1 -3
- package/src/public/components/panel-registry.ts +3 -1
- package/src/public/components/panels/AuditLogPanel.tsx +28 -4
- package/src/public/components/panels/GitPanel.tsx +1 -20
- package/src/public/components/panels/SettingsPanel.tsx +0 -1
- package/src/public/components/panels/SprintPanel.tsx +32 -1
- package/src/public/components/panels/index.ts +0 -2
- package/src/public/hooks/useFocusPanel.ts +137 -0
- package/src/public/hooks/useLayoutPersistence.ts +8 -5
- package/src/public/styles/dockview-theme.css +1 -84
- package/src/public/styles/tailwind.css +27 -32
- package/src/public/utils/slash-commands.ts +122 -98
- package/dist/hooks/cyclist-pretooluse-hook.d.ts +0 -60
- package/dist/hooks/cyclist-pretooluse-hook.d.ts.map +0 -1
- package/dist/hooks/cyclist-pretooluse-hook.js +0 -57
- package/dist/hooks/cyclist-pretooluse-hook.js.map +0 -1
- package/dist/hooks/pretooluse-hook.d.ts +0 -89
- package/dist/hooks/pretooluse-hook.d.ts.map +0 -1
- package/dist/hooks/pretooluse-hook.js +0 -235
- package/dist/hooks/pretooluse-hook.js.map +0 -1
- package/dist/notification-sound.d.ts +0 -59
- package/dist/notification-sound.d.ts.map +0 -1
- package/dist/notification-sound.js +0 -219
- package/dist/notification-sound.js.map +0 -1
- package/dist/plugin-loader.test.d.ts +0 -17
- package/dist/plugin-loader.test.d.ts.map +0 -1
- package/dist/plugin-loader.test.js +0 -407
- package/dist/plugin-loader.test.js.map +0 -1
- package/portraits/star-trek-tng/large/beverly-44352.png +0 -0
- package/portraits/star-trek-tng/large/data-55241.png +0 -0
- package/portraits/star-trek-tng/large/deanna-43353.png +0 -0
- package/portraits/star-trek-tng/large/geordi-54342.png +0 -0
- package/portraits/star-trek-tng/large/jean-luc-45342.png +0 -0
- package/portraits/star-trek-tng/large/kathryn-45332.png +0 -0
- package/portraits/star-trek-tng/large/miles-35342.png +0 -0
- package/portraits/star-trek-tng/large/q-53521.png +0 -0
- package/portraits/star-trek-tng/large/spock-45231.png +0 -0
- package/portraits/star-trek-tng/large/troi-44352.png +0 -0
- package/portraits/star-trek-tng/medium/beverly-44352.png +0 -0
- package/portraits/star-trek-tng/medium/data-55241.png +0 -0
- package/portraits/star-trek-tng/medium/deanna-43353.png +0 -0
- package/portraits/star-trek-tng/medium/geordi-54342.png +0 -0
- package/portraits/star-trek-tng/medium/jean-luc-45342.png +0 -0
- package/portraits/star-trek-tng/medium/kathryn-45332.png +0 -0
- package/portraits/star-trek-tng/medium/miles-35342.png +0 -0
- package/portraits/star-trek-tng/medium/q-53521.png +0 -0
- package/portraits/star-trek-tng/medium/spock-45231.png +0 -0
- package/portraits/star-trek-tng/medium/troi-44352.png +0 -0
- package/src/public/components/panels/TTYPanel.tsx +0 -299
- package/src/public/types/electron.d.ts +0 -18
package/dist/api/complexity.js
CHANGED
|
@@ -1,47 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
export function createComplexityRouter(getProjectDir) {
|
|
5
|
-
const router = Router();
|
|
6
|
-
router.get('/', (req, res) => {
|
|
7
|
-
const projectDir = getProjectDir();
|
|
8
|
-
const top = req.query.top;
|
|
9
|
-
const args = [
|
|
10
|
-
'-m', 'pennyfarthing_scripts.complexity',
|
|
11
|
-
'analyze',
|
|
12
|
-
'--format', 'json',
|
|
13
|
-
'--path', projectDir,
|
|
14
|
-
];
|
|
15
|
-
if (top) {
|
|
16
|
-
args.push('--top', top);
|
|
17
|
-
}
|
|
18
|
-
const pythonPath = join(projectDir, 'pennyfarthing');
|
|
19
|
-
execFile('python3', args, {
|
|
20
|
-
cwd: pythonPath,
|
|
21
|
-
env: { ...process.env, PYTHONPATH: pythonPath },
|
|
22
|
-
timeout: 30000,
|
|
23
|
-
}, (err, stdout, stderr) => {
|
|
24
|
-
if (err) {
|
|
25
|
-
console.error('[Complexity] Analysis failed:', stderr || err.message);
|
|
26
|
-
res.status(500).json({
|
|
27
|
-
success: false,
|
|
28
|
-
error: stderr || err.message,
|
|
29
|
-
});
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const data = JSON.parse(stdout);
|
|
34
|
-
res.json(data);
|
|
35
|
-
}
|
|
36
|
-
catch (parseErr) {
|
|
37
|
-
console.error('[Complexity] JSON parse failed:', parseErr);
|
|
38
|
-
res.status(500).json({
|
|
39
|
-
success: false,
|
|
40
|
-
error: 'Failed to parse complexity analysis output',
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
return router;
|
|
46
|
-
}
|
|
1
|
+
// Re-export from @pennyfarthing/core (Story 98-17)
|
|
2
|
+
export * from '@pennyfarthing/core/dist/server/api/complexity.js';
|
|
47
3
|
//# sourceMappingURL=complexity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complexity.js","sourceRoot":"","sources":["../../src/api/complexity.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"complexity.js","sourceRoot":"","sources":["../../src/api/complexity.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,mDAAmD,CAAC"}
|
package/dist/api/context.d.ts
CHANGED
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ContextTier } from '../prime.js';
|
|
3
|
-
/**
|
|
4
|
-
* Context usage information from check-context.sh
|
|
5
|
-
*/
|
|
6
|
-
export interface ContextInfo {
|
|
7
|
-
percent: number | null;
|
|
8
|
-
tokens: number | null;
|
|
9
|
-
status: string | null;
|
|
10
|
-
error: string | null;
|
|
11
|
-
sessionId?: string;
|
|
12
|
-
/** System prompt overhead (first turn tokens) */
|
|
13
|
-
baseline: number | null;
|
|
14
|
-
/** Tokens used by conversation (total - baseline) */
|
|
15
|
-
usableTokens: number | null;
|
|
16
|
-
/** Conversation usage as % of available capacity */
|
|
17
|
-
usablePercent: number | null;
|
|
18
|
-
/** Available capacity (max - baseline) */
|
|
19
|
-
available: number | null;
|
|
20
|
-
/** Current context tier (FULL, REFRESH, HANDOFF, MINIMAL) */
|
|
21
|
-
tier?: ContextTier;
|
|
22
|
-
/** Per-component token counts (MSSCI-12800) */
|
|
23
|
-
tokenCounts?: Record<string, number>;
|
|
24
|
-
/** Total tokens across all injected components (MSSCI-12800) */
|
|
25
|
-
totalTokens?: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get context usage by running check-context.sh
|
|
29
|
-
* @param projectDir - The project directory
|
|
30
|
-
* @param sessionId - Optional session ID to check specific transcript
|
|
31
|
-
* @returns Context usage info
|
|
32
|
-
*/
|
|
33
|
-
export declare function getContextUsage(projectDir: string, sessionId?: string): ContextInfo;
|
|
34
|
-
/**
|
|
35
|
-
* Create context API router
|
|
36
|
-
*/
|
|
37
|
-
export declare function createContextRouter(getProjectDir: () => string): Router;
|
|
1
|
+
export * from '@pennyfarthing/core/dist/server/api/context.js';
|
|
38
2
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/api/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/api/context.ts"],"names":[],"mappings":"AACA,cAAc,gDAAgD,CAAC"}
|
package/dist/api/context.js
CHANGED
|
@@ -1,144 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
/**
|
|
6
|
-
* Get context usage by running check-context.sh
|
|
7
|
-
* @param projectDir - The project directory
|
|
8
|
-
* @param sessionId - Optional session ID to check specific transcript
|
|
9
|
-
* @returns Context usage info
|
|
10
|
-
*/
|
|
11
|
-
export function getContextUsage(projectDir, sessionId) {
|
|
12
|
-
// Find the check-context.sh script
|
|
13
|
-
const possiblePaths = [
|
|
14
|
-
join(projectDir, 'pennyfarthing-dist', 'scripts', 'core', 'check-context.sh'),
|
|
15
|
-
join(projectDir, '.pennyfarthing', 'scripts', 'core', 'check-context.sh'),
|
|
16
|
-
];
|
|
17
|
-
let scriptPath = null;
|
|
18
|
-
for (const path of possiblePaths) {
|
|
19
|
-
if (existsSync(path)) {
|
|
20
|
-
scriptPath = path;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (!scriptPath) {
|
|
25
|
-
return { percent: null, tokens: null, status: null, error: 'check-context.sh not found', baseline: null, usableTokens: null, usablePercent: null, available: null };
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
// Build environment with optional SESSION_ID
|
|
29
|
-
const env = {
|
|
30
|
-
...process.env,
|
|
31
|
-
PROJECT_ROOT: projectDir,
|
|
32
|
-
};
|
|
33
|
-
if (sessionId) {
|
|
34
|
-
env.SESSION_ID = sessionId;
|
|
35
|
-
}
|
|
36
|
-
const output = execSync(`"${scriptPath}"`, {
|
|
37
|
-
encoding: 'utf-8',
|
|
38
|
-
timeout: 5000,
|
|
39
|
-
cwd: projectDir,
|
|
40
|
-
env,
|
|
41
|
-
});
|
|
42
|
-
// Parse the output which looks like:
|
|
43
|
-
// CONTEXT_TOKENS=12345
|
|
44
|
-
// CONTEXT_PERCENT=45
|
|
45
|
-
// CONTEXT_STATUS=OK
|
|
46
|
-
// HANDOFF_MODE=ask
|
|
47
|
-
const result = {
|
|
48
|
-
percent: null,
|
|
49
|
-
tokens: null,
|
|
50
|
-
status: null,
|
|
51
|
-
error: null,
|
|
52
|
-
sessionId,
|
|
53
|
-
baseline: null,
|
|
54
|
-
usableTokens: null,
|
|
55
|
-
usablePercent: null,
|
|
56
|
-
available: null,
|
|
57
|
-
};
|
|
58
|
-
for (const line of output.split('\n')) {
|
|
59
|
-
const [key, value] = line.split('=');
|
|
60
|
-
if (key === 'CONTEXT_PERCENT') {
|
|
61
|
-
result.percent = parseInt(value, 10);
|
|
62
|
-
}
|
|
63
|
-
else if (key === 'CONTEXT_TOKENS') {
|
|
64
|
-
result.tokens = parseInt(value, 10);
|
|
65
|
-
}
|
|
66
|
-
else if (key === 'CONTEXT_STATUS') {
|
|
67
|
-
result.status = value;
|
|
68
|
-
}
|
|
69
|
-
else if (key === 'CONTEXT_ERROR') {
|
|
70
|
-
// Translate session_not_found to user-friendly message
|
|
71
|
-
if (value === 'session_not_found') {
|
|
72
|
-
result.error = `session transcript not found: ${sessionId}`;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
result.error = value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
else if (key === 'CONTEXT_BASELINE') {
|
|
79
|
-
result.baseline = parseInt(value, 10);
|
|
80
|
-
}
|
|
81
|
-
else if (key === 'CONTEXT_USABLE_TOKENS') {
|
|
82
|
-
result.usableTokens = parseInt(value, 10);
|
|
83
|
-
}
|
|
84
|
-
else if (key === 'CONTEXT_USABLE_PERCENT') {
|
|
85
|
-
result.usablePercent = parseInt(value, 10);
|
|
86
|
-
}
|
|
87
|
-
else if (key === 'CONTEXT_AVAILABLE') {
|
|
88
|
-
result.available = parseInt(value, 10);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
catch (err) {
|
|
94
|
-
// execSync throws when script exits with non-zero code
|
|
95
|
-
// The error may contain stdout/stderr with our structured output
|
|
96
|
-
let errMsg = 'Failed to get context';
|
|
97
|
-
if (err && typeof err === 'object') {
|
|
98
|
-
const execErr = err;
|
|
99
|
-
// Try to get output from the error object
|
|
100
|
-
const stdout = execErr.stdout?.toString() || '';
|
|
101
|
-
const stderr = execErr.stderr?.toString() || '';
|
|
102
|
-
const combined = stdout + stderr + (execErr.message || '');
|
|
103
|
-
// Check for session-specific errors
|
|
104
|
-
if (sessionId && (combined.includes('session_not_found') || combined.includes('session transcript not found'))) {
|
|
105
|
-
errMsg = `session transcript not found: ${sessionId}`;
|
|
106
|
-
}
|
|
107
|
-
else if (combined.includes('CONTEXT_ERROR=')) {
|
|
108
|
-
// Parse the error from script output
|
|
109
|
-
const match = combined.match(/CONTEXT_ERROR=(\w+)/);
|
|
110
|
-
if (match) {
|
|
111
|
-
errMsg = match[1] === 'session_not_found' ? `session transcript not found: ${sessionId}` : match[1];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
errMsg = execErr.message || 'Failed to get context';
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
percent: null,
|
|
120
|
-
tokens: null,
|
|
121
|
-
status: null,
|
|
122
|
-
error: errMsg,
|
|
123
|
-
sessionId,
|
|
124
|
-
baseline: null,
|
|
125
|
-
usableTokens: null,
|
|
126
|
-
usablePercent: null,
|
|
127
|
-
available: null,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Create context API router
|
|
133
|
-
*/
|
|
134
|
-
export function createContextRouter(getProjectDir) {
|
|
135
|
-
const router = Router();
|
|
136
|
-
// Context API - GET current context usage
|
|
137
|
-
router.get('/', (_req, res) => {
|
|
138
|
-
const projectDir = getProjectDir();
|
|
139
|
-
const context = getContextUsage(projectDir);
|
|
140
|
-
res.json(context);
|
|
141
|
-
});
|
|
142
|
-
return router;
|
|
143
|
-
}
|
|
1
|
+
// Re-export from @pennyfarthing/core (Story 98-17)
|
|
2
|
+
export * from '@pennyfarthing/core/dist/server/api/context.js';
|
|
144
3
|
//# sourceMappingURL=context.js.map
|
package/dist/api/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/api/context.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/api/context.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,gDAAgD,CAAC"}
|
package/dist/api/dead-code.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dead-code.d.ts","sourceRoot":"","sources":["../../src/api/dead-code.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dead-code.d.ts","sourceRoot":"","sources":["../../src/api/dead-code.ts"],"names":[],"mappings":"AACA,cAAc,kDAAkD,CAAC"}
|
package/dist/api/dead-code.js
CHANGED
|
@@ -1,70 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
function runDeadCodeCommand(command, projectDir, days, repo) {
|
|
5
|
-
return new Promise((resolve, reject) => {
|
|
6
|
-
const args = ['-m', 'pennyfarthing_scripts.deadcode', command, '--format', 'json'];
|
|
7
|
-
if (command === 'stale') {
|
|
8
|
-
args.push('--days', days);
|
|
9
|
-
}
|
|
10
|
-
if (repo) {
|
|
11
|
-
args.push('--repo', repo);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
args.push('--path', projectDir);
|
|
15
|
-
}
|
|
16
|
-
const pythonPath = join(projectDir, 'pennyfarthing');
|
|
17
|
-
execFile('python3', args, {
|
|
18
|
-
cwd: pythonPath,
|
|
19
|
-
env: { ...process.env, PYTHONPATH: pythonPath },
|
|
20
|
-
timeout: 30000,
|
|
21
|
-
}, (err, stdout, stderr) => {
|
|
22
|
-
if (err) {
|
|
23
|
-
reject(new Error(stderr || err.message));
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
resolve(JSON.parse(stdout));
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
reject(new Error('Failed to parse dead code analysis output'));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export function createDeadCodeRouter(getProjectDir) {
|
|
36
|
-
const router = Router();
|
|
37
|
-
// GET /api/dead-code?days=180&repo=pennyfarthing&layer=all|stale|exports
|
|
38
|
-
router.get('/', async (req, res) => {
|
|
39
|
-
const projectDir = getProjectDir();
|
|
40
|
-
const days = String(req.query.days || '180');
|
|
41
|
-
const repo = req.query.repo;
|
|
42
|
-
const layer = String(req.query.layer || 'all');
|
|
43
|
-
try {
|
|
44
|
-
if (layer === 'stale' || layer === 'exports') {
|
|
45
|
-
const data = await runDeadCodeCommand(layer, projectDir, days, repo);
|
|
46
|
-
res.json(data);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
// layer=all: run both and merge
|
|
50
|
-
const [staleData, exportsData] = await Promise.all([
|
|
51
|
-
runDeadCodeCommand('stale', projectDir, days, repo),
|
|
52
|
-
runDeadCodeCommand('exports', projectDir, days, repo).catch(() => ({})),
|
|
53
|
-
]);
|
|
54
|
-
res.json({
|
|
55
|
-
success: true,
|
|
56
|
-
...staleData,
|
|
57
|
-
unused_exports: exportsData.unused_exports ?? [],
|
|
58
|
-
unused_export_count: exportsData.unused_export_count ?? 0,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
64
|
-
console.error('[DeadCode] Analysis failed:', message);
|
|
65
|
-
res.status(500).json({ success: false, error: message });
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return router;
|
|
69
|
-
}
|
|
1
|
+
// Re-export from @pennyfarthing/core (Story 98-17)
|
|
2
|
+
export * from '@pennyfarthing/core/dist/server/api/dead-code.js';
|
|
70
3
|
//# sourceMappingURL=dead-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dead-code.js","sourceRoot":"","sources":["../../src/api/dead-code.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"dead-code.js","sourceRoot":"","sources":["../../src/api/dead-code.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,kDAAkD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/api/dependencies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/api/dependencies.ts"],"names":[],"mappings":"AACA,cAAc,qDAAqD,CAAC"}
|
package/dist/api/dependencies.js
CHANGED
|
@@ -1,43 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
export function createDependenciesRouter(getProjectDir) {
|
|
5
|
-
const router = Router();
|
|
6
|
-
router.get('/', (req, res) => {
|
|
7
|
-
const projectDir = getProjectDir();
|
|
8
|
-
const args = [
|
|
9
|
-
'-m', 'pennyfarthing_scripts.dependencies',
|
|
10
|
-
'analyze',
|
|
11
|
-
'--format', 'json',
|
|
12
|
-
'--path', projectDir,
|
|
13
|
-
];
|
|
14
|
-
const pythonPath = join(projectDir, 'pennyfarthing');
|
|
15
|
-
execFile('python3', args, {
|
|
16
|
-
cwd: pythonPath,
|
|
17
|
-
env: { ...process.env, PYTHONPATH: pythonPath },
|
|
18
|
-
timeout: 30000,
|
|
19
|
-
}, (err, stdout, stderr) => {
|
|
20
|
-
if (err) {
|
|
21
|
-
console.error('[Dependencies] Analysis failed:', stderr || err.message);
|
|
22
|
-
res.status(500).json({
|
|
23
|
-
success: false,
|
|
24
|
-
error: stderr || err.message,
|
|
25
|
-
});
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
const data = JSON.parse(stdout);
|
|
30
|
-
res.json(data);
|
|
31
|
-
}
|
|
32
|
-
catch (parseErr) {
|
|
33
|
-
console.error('[Dependencies] JSON parse failed:', parseErr);
|
|
34
|
-
res.status(500).json({
|
|
35
|
-
success: false,
|
|
36
|
-
error: 'Failed to parse dependencies analysis output',
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
return router;
|
|
42
|
-
}
|
|
1
|
+
// Re-export from @pennyfarthing/core (Story 98-17)
|
|
2
|
+
export * from '@pennyfarthing/core/dist/server/api/dependencies.js';
|
|
43
3
|
//# sourceMappingURL=dependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/api/dependencies.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/api/dependencies.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,qDAAqD,CAAC"}
|
package/dist/api/evaluation.d.ts
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Evaluation API Router - Story 19-9
|
|
3
|
-
*
|
|
4
|
-
* REST API for agent evaluation data. Exposes metrics aggregated by
|
|
5
|
-
* agent role, persona/theme, and task type with regression detection.
|
|
6
|
-
*/
|
|
7
|
-
import { Router } from 'express';
|
|
8
|
-
/**
|
|
9
|
-
* Create evaluation API router
|
|
10
|
-
*
|
|
11
|
-
* Endpoints:
|
|
12
|
-
* - GET /agents - All agent metrics
|
|
13
|
-
* - GET /agents/:role - Specific agent metrics
|
|
14
|
-
* - GET /personas - All persona metrics
|
|
15
|
-
* - GET /tasks - Task type breakdown
|
|
16
|
-
* - GET /regression - Regression alerts and trends
|
|
17
|
-
* - GET /recommendations - Generated recommendations
|
|
18
|
-
*/
|
|
19
|
-
export declare function createEvaluationRouter(): Router;
|
|
1
|
+
export * from '@pennyfarthing/core/dist/server/api/evaluation.js';
|
|
20
2
|
//# sourceMappingURL=evaluation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../src/api/evaluation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../src/api/evaluation.ts"],"names":[],"mappings":"AACA,cAAc,mDAAmD,CAAC"}
|
package/dist/api/evaluation.js
CHANGED
|
@@ -1,128 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* REST API for agent evaluation data. Exposes metrics aggregated by
|
|
5
|
-
* agent role, persona/theme, and task type with regression detection.
|
|
6
|
-
*/
|
|
7
|
-
import { Router } from 'express';
|
|
8
|
-
import { getEvaluation, detectTrend, generateRecommendations, } from '../agent-evaluation.js';
|
|
9
|
-
/**
|
|
10
|
-
* Create evaluation API router
|
|
11
|
-
*
|
|
12
|
-
* Endpoints:
|
|
13
|
-
* - GET /agents - All agent metrics
|
|
14
|
-
* - GET /agents/:role - Specific agent metrics
|
|
15
|
-
* - GET /personas - All persona metrics
|
|
16
|
-
* - GET /tasks - Task type breakdown
|
|
17
|
-
* - GET /regression - Regression alerts and trends
|
|
18
|
-
* - GET /recommendations - Generated recommendations
|
|
19
|
-
*/
|
|
20
|
-
export function createEvaluationRouter() {
|
|
21
|
-
const router = Router();
|
|
22
|
-
/**
|
|
23
|
-
* GET /api/evaluation/agents
|
|
24
|
-
*
|
|
25
|
-
* Returns metrics for all agents.
|
|
26
|
-
*
|
|
27
|
-
* Response 200: Record<string, AgentMetrics>
|
|
28
|
-
* Response 404: { error: 'No evaluation data available' }
|
|
29
|
-
*/
|
|
30
|
-
router.get('/agents', (_req, res) => {
|
|
31
|
-
const evaluation = getEvaluation();
|
|
32
|
-
if (!evaluation) {
|
|
33
|
-
return res.status(404).json({ error: 'No evaluation data available' });
|
|
34
|
-
}
|
|
35
|
-
res.json(evaluation.agentMetrics);
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* GET /api/evaluation/agents/:role
|
|
39
|
-
*
|
|
40
|
-
* Returns metrics for a specific agent role.
|
|
41
|
-
*
|
|
42
|
-
* Response 200: AgentMetrics
|
|
43
|
-
* Response 404: { error: 'No evaluation data available' } or { error: 'Agent not found: X' }
|
|
44
|
-
*/
|
|
45
|
-
router.get('/agents/:role', (req, res) => {
|
|
46
|
-
const evaluation = getEvaluation();
|
|
47
|
-
if (!evaluation) {
|
|
48
|
-
return res.status(404).json({ error: 'No evaluation data available' });
|
|
49
|
-
}
|
|
50
|
-
const role = req.params.role.toLowerCase();
|
|
51
|
-
const metrics = evaluation.agentMetrics[role];
|
|
52
|
-
if (!metrics) {
|
|
53
|
-
return res.status(404).json({ error: `Agent not found: ${req.params.role}` });
|
|
54
|
-
}
|
|
55
|
-
res.json(metrics);
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* GET /api/evaluation/personas
|
|
59
|
-
*
|
|
60
|
-
* Returns metrics for all personas/themes.
|
|
61
|
-
*
|
|
62
|
-
* Response 200: Record<string, PersonaMetrics>
|
|
63
|
-
* Response 404: { error: 'No evaluation data available' }
|
|
64
|
-
*/
|
|
65
|
-
router.get('/personas', (_req, res) => {
|
|
66
|
-
const evaluation = getEvaluation();
|
|
67
|
-
if (!evaluation) {
|
|
68
|
-
return res.status(404).json({ error: 'No evaluation data available' });
|
|
69
|
-
}
|
|
70
|
-
res.json(evaluation.personaMetrics);
|
|
71
|
-
});
|
|
72
|
-
/**
|
|
73
|
-
* GET /api/evaluation/tasks
|
|
74
|
-
*
|
|
75
|
-
* Returns metrics broken down by task type.
|
|
76
|
-
*
|
|
77
|
-
* Response 200: Record<string, TaskMetrics>
|
|
78
|
-
* Response 404: { error: 'No evaluation data available' }
|
|
79
|
-
*/
|
|
80
|
-
router.get('/tasks', (_req, res) => {
|
|
81
|
-
const evaluation = getEvaluation();
|
|
82
|
-
if (!evaluation) {
|
|
83
|
-
return res.status(404).json({ error: 'No evaluation data available' });
|
|
84
|
-
}
|
|
85
|
-
res.json(evaluation.taskTypeMetrics);
|
|
86
|
-
});
|
|
87
|
-
/**
|
|
88
|
-
* GET /api/evaluation/regression
|
|
89
|
-
*
|
|
90
|
-
* Returns regression alerts and trend information.
|
|
91
|
-
*
|
|
92
|
-
* Response 200: { alerts: RegressionAlert[], trends: Record<string, TrendDirection> }
|
|
93
|
-
* Response 404: { error: 'No evaluation data available' }
|
|
94
|
-
*/
|
|
95
|
-
router.get('/regression', (_req, res) => {
|
|
96
|
-
const evaluation = getEvaluation();
|
|
97
|
-
if (!evaluation) {
|
|
98
|
-
return res.status(404).json({ error: 'No evaluation data available' });
|
|
99
|
-
}
|
|
100
|
-
// Calculate trends for each agent
|
|
101
|
-
const trends = {};
|
|
102
|
-
for (const role of Object.keys(evaluation.agentMetrics)) {
|
|
103
|
-
trends[role] = detectTrend(role);
|
|
104
|
-
}
|
|
105
|
-
res.json({
|
|
106
|
-
alerts: evaluation.regressionAlerts,
|
|
107
|
-
trends,
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
/**
|
|
111
|
-
* GET /api/evaluation/recommendations
|
|
112
|
-
*
|
|
113
|
-
* Returns generated recommendations based on current evaluation.
|
|
114
|
-
*
|
|
115
|
-
* Response 200: string[]
|
|
116
|
-
* Response 404: { error: 'No evaluation data available' }
|
|
117
|
-
*/
|
|
118
|
-
router.get('/recommendations', (_req, res) => {
|
|
119
|
-
const evaluation = getEvaluation();
|
|
120
|
-
if (!evaluation) {
|
|
121
|
-
return res.status(404).json({ error: 'No evaluation data available' });
|
|
122
|
-
}
|
|
123
|
-
const recommendations = generateRecommendations(evaluation);
|
|
124
|
-
res.json(recommendations);
|
|
125
|
-
});
|
|
126
|
-
return router;
|
|
127
|
-
}
|
|
1
|
+
// Re-export from @pennyfarthing/core (Story 98-17)
|
|
2
|
+
export * from '@pennyfarthing/core/dist/server/api/evaluation.js';
|
|
128
3
|
//# sourceMappingURL=evaluation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../src/api/evaluation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../src/api/evaluation.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,mDAAmD,CAAC"}
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* File Browser API Router
|
|
3
|
-
*
|
|
4
|
-
* REST endpoints for file browser functionality in web mode.
|
|
5
|
-
* Mirrors the IPC handlers from main.ts for browser compatibility.
|
|
6
|
-
*/
|
|
7
|
-
import { Router } from 'express';
|
|
8
|
-
export declare function createFileBrowserRouter(getProjectDir: () => string): Router;
|
|
1
|
+
export * from '@pennyfarthing/core/dist/server/api/file-browser.js';
|
|
9
2
|
//# sourceMappingURL=file-browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-browser.d.ts","sourceRoot":"","sources":["../../src/api/file-browser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-browser.d.ts","sourceRoot":"","sources":["../../src/api/file-browser.ts"],"names":[],"mappings":"AACA,cAAc,qDAAqD,CAAC"}
|