- Deterministic scoring.py (quant 60 / qual 40 / flags -15, profitability heaviest) - Per-company JSON ledger with forecast-target chaining deck N-1 -> N - Single-shot sandbox agent with guided-JSON fallback ladder (no tool loop) - Portfolio dashboard with sparklines, KPI hit rates, BDEF category bars - 48 unit tests green; endpoints smoke-tested; npm check+build green Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { startSdk } from '@start9labs/start-sdk'
|
|
import { sdk } from '../sdk'
|
|
|
|
/**
|
|
* Returns the latest scorecard as a copyable result, so you can read it straight
|
|
* from the StartOS service page without opening the dashboard. The job runner
|
|
* saves the most recent scorecard to /data/reports/latest-scorecard.md (with
|
|
* /data/reports/latest.md as the legacy fallback) on the StartOS host — no
|
|
* Spark round-trip.
|
|
*/
|
|
export const latestScorecard = sdk.Action.withoutInput(
|
|
'latest-scorecard',
|
|
|
|
async ({ effects }) => ({
|
|
name: 'View Latest Scorecard',
|
|
description: 'Show the most recent deck scorecard produced by the grading panel.',
|
|
warning: null,
|
|
allowedStatuses: 'any',
|
|
group: null,
|
|
visibility: 'enabled',
|
|
}),
|
|
|
|
async ({ effects }) => {
|
|
const mounts = sdk.Mounts.of().mountVolume({
|
|
volumeId: 'main',
|
|
mountpoint: '/data',
|
|
subpath: null,
|
|
readonly: true,
|
|
})
|
|
|
|
let report: string
|
|
try {
|
|
const { stdout } = await startSdk.runCommand<typeof sdk.manifest>(
|
|
effects,
|
|
{ imageId: 'main' },
|
|
[
|
|
'sh',
|
|
'-c',
|
|
'cat /data/reports/latest-scorecard.md 2>/dev/null || ' +
|
|
'cat /data/reports/latest.md 2>/dev/null || ' +
|
|
'echo "(no scorecard yet — drop decks into inbox/<company-slug>/ and run Grade Decks)"',
|
|
],
|
|
{ mounts, env: { BM_DATA_DIR: '/data' } },
|
|
'latest-scorecard',
|
|
)
|
|
report = (stdout?.toString() || '').trim() || '(no scorecard yet)'
|
|
} catch (e: any) {
|
|
report = 'Could not read scorecard: ' + (e?.message || String(e))
|
|
}
|
|
|
|
return {
|
|
version: '1',
|
|
title: 'Latest Scorecard',
|
|
message: 'The panel\'s most recent deck scorecard.',
|
|
result: { type: 'single', value: report, copyable: true, qr: false, masked: false },
|
|
}
|
|
},
|
|
)
|