@arcbridge/core 0.1.0 → 0.1.2

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/index.d.ts CHANGED
@@ -78,6 +78,13 @@ declare const ArcBridgeConfigSchema: z.ZodObject<{
78
78
  }, {
79
79
  ignore_paths?: string[] | undefined;
80
80
  }>>;
81
+ metrics: z.ZodDefault<z.ZodObject<{
82
+ auto_record: z.ZodDefault<z.ZodBoolean>;
83
+ }, "strip", z.ZodTypeAny, {
84
+ auto_record: boolean;
85
+ }, {
86
+ auto_record?: boolean | undefined;
87
+ }>>;
81
88
  sync: z.ZodDefault<z.ZodObject<{
82
89
  auto_detect_drift: z.ZodDefault<z.ZodBoolean>;
83
90
  drift_severity_threshold: z.ZodDefault<z.ZodEnum<["info", "warning", "error"]>>;
@@ -117,6 +124,9 @@ declare const ArcBridgeConfigSchema: z.ZodObject<{
117
124
  drift: {
118
125
  ignore_paths: string[];
119
126
  };
127
+ metrics: {
128
+ auto_record: boolean;
129
+ };
120
130
  sync: {
121
131
  auto_detect_drift: boolean;
122
132
  drift_severity_threshold: "info" | "warning" | "error";
@@ -148,6 +158,9 @@ declare const ArcBridgeConfigSchema: z.ZodObject<{
148
158
  drift?: {
149
159
  ignore_paths?: string[] | undefined;
150
160
  } | undefined;
161
+ metrics?: {
162
+ auto_record?: boolean | undefined;
163
+ } | undefined;
151
164
  sync?: {
152
165
  auto_detect_drift?: boolean | undefined;
153
166
  drift_severity_threshold?: "info" | "warning" | "error" | undefined;
@@ -710,7 +723,7 @@ type AgentRole = z.infer<typeof AgentRoleSchema>;
710
723
  declare function openDatabase(dbPath: string): Database.Database;
711
724
  declare function openMemoryDatabase(): Database.Database;
712
725
 
713
- declare const CURRENT_SCHEMA_VERSION = 1;
726
+ declare const CURRENT_SCHEMA_VERSION = 2;
714
727
  declare function initializeSchema(db: Database.Database): void;
715
728
 
716
729
  declare function migrate(db: Database.Database): void;
@@ -894,6 +907,102 @@ declare function syncScenarioToYaml(projectRoot: string, scenarioId: string, sta
894
907
  */
895
908
  declare function generateSyncFiles(targetDir: string, config: ArcBridgeConfig): string[];
896
909
 
910
+ interface InsertActivityParams {
911
+ toolName: string;
912
+ action?: string;
913
+ model?: string;
914
+ agentRole?: string;
915
+ taskId?: string;
916
+ phaseId?: string;
917
+ inputTokens?: number;
918
+ outputTokens?: number;
919
+ totalTokens?: number;
920
+ costUsd?: number;
921
+ durationMs?: number;
922
+ driftCount?: number;
923
+ driftErrors?: number;
924
+ testPassCount?: number;
925
+ testFailCount?: number;
926
+ lintClean?: boolean;
927
+ typecheckClean?: boolean;
928
+ notes?: string;
929
+ metadata?: Record<string, unknown>;
930
+ }
931
+ interface QueryMetricsParams {
932
+ taskId?: string;
933
+ phaseId?: string;
934
+ model?: string;
935
+ agentRole?: string;
936
+ toolName?: string;
937
+ since?: string;
938
+ until?: string;
939
+ groupBy: "model" | "task" | "phase" | "tool" | "day" | "none";
940
+ limit: number;
941
+ }
942
+ interface ActivityRow {
943
+ id: number;
944
+ tool_name: string;
945
+ action: string | null;
946
+ model: string | null;
947
+ agent_role: string | null;
948
+ task_id: string | null;
949
+ phase_id: string | null;
950
+ input_tokens: number | null;
951
+ output_tokens: number | null;
952
+ total_tokens: number | null;
953
+ cost_usd: number | null;
954
+ duration_ms: number | null;
955
+ drift_count: number | null;
956
+ drift_errors: number | null;
957
+ test_pass_count: number | null;
958
+ test_fail_count: number | null;
959
+ lint_clean: number | null;
960
+ typecheck_clean: number | null;
961
+ notes: string | null;
962
+ metadata: string;
963
+ recorded_at: string;
964
+ }
965
+ interface AggregatedRow {
966
+ groupKey: string;
967
+ activityCount: number;
968
+ sumTokens: number | null;
969
+ avgTokens: number | null;
970
+ sumCost: number | null;
971
+ avgDuration: number | null;
972
+ firstActivity: string;
973
+ lastActivity: string;
974
+ }
975
+ interface LatestQualitySnapshot {
976
+ driftCount: number | null;
977
+ driftErrors: number | null;
978
+ testPassCount: number | null;
979
+ testFailCount: number | null;
980
+ lintClean: boolean | null;
981
+ typecheckClean: boolean | null;
982
+ capturedAt: string | null;
983
+ }
984
+ interface SessionTotals {
985
+ totalCost: number;
986
+ totalTokens: number;
987
+ activityCount: number;
988
+ }
989
+ interface MetricsResult {
990
+ rows: ActivityRow[] | AggregatedRow[];
991
+ grouped: boolean;
992
+ qualitySnapshot: LatestQualitySnapshot;
993
+ totals: SessionTotals;
994
+ timeSpan: {
995
+ first: string;
996
+ last: string;
997
+ } | null;
998
+ }
999
+ type ExportFormat = "json" | "csv" | "markdown";
1000
+
1001
+ declare function insertActivity(db: Database.Database, params: InsertActivityParams): number;
1002
+ declare function getSessionTotals(db: Database.Database, since?: string, model?: string): SessionTotals;
1003
+ declare function queryMetrics(db: Database.Database, params: QueryMetricsParams): MetricsResult;
1004
+ declare function exportMetrics(db: Database.Database, projectRoot: string, format: ExportFormat, params: Omit<QueryMetricsParams, "groupBy" | "limit">, maxRows?: number): string;
1005
+
897
1006
  interface ChangedFile {
898
1007
  status: "added" | "modified" | "deleted" | "renamed";
899
1008
  path: string;
@@ -988,4 +1097,4 @@ declare function loadConfig(projectRoot: string): {
988
1097
  error: string | null;
989
1098
  };
990
1099
 
991
- export { type AdrFrontmatter, AdrFrontmatterSchema, type AgentRole, AgentRoleSchema, type ArcBridgeConfig, ArcBridgeConfigSchema, type BuildingBlock, BuildingBlockSchema, type BuildingBlocksFrontmatter, BuildingBlocksFrontmatterSchema, CURRENT_SCHEMA_VERSION, type ChangedFile, type DotnetProjectInfo, type DriftEntry, type DriftKind, type DriftOptions, type DriftSeverity, type ExtractedSymbol, type GenerateDatabaseResult, type GitRef, type IndexResult, type IndexerOptions, type InitProjectInput, type LoadRolesResult, type Phase, PhaseSchema, type PhasesFile, PhasesFileSchema, type ProjectLanguage, QualityCategorySchema, QualityPrioritySchema, type QualityScenario, QualityScenarioSchema, QualityScenarioStatusSchema, type QualityScenariosFile, QualityScenariosFileSchema, type ScenarioTestResult, type Service, type SymbolKind, type Task, type TaskFile, TaskFileSchema, type TaskInferenceResult, TaskSchema, type TestOutcome, type VerifyResult, addTaskToYaml, applyInferences, detectDrift, detectProjectLanguage, discoverDotnetServices, generateAgentRoles, generateArc42, generateConfig, generateDatabase, generatePlan, generateSyncFiles, getChangedFiles, getHeadSha, getUncommittedChanges, indexPackageDependencies, indexProject, inferTaskStatuses, initializeSchema, loadConfig, loadRole, loadRoles, migrate, openDatabase, openMemoryDatabase, refreshFromDocs, resolveRef, setSyncCommit, syncPhaseToYaml, syncScenarioToYaml, syncTaskToYaml, verifyScenarios, writeDriftLog };
1100
+ export { type ActivityRow, type AdrFrontmatter, AdrFrontmatterSchema, type AgentRole, AgentRoleSchema, type AggregatedRow, type ArcBridgeConfig, ArcBridgeConfigSchema, type BuildingBlock, BuildingBlockSchema, type BuildingBlocksFrontmatter, BuildingBlocksFrontmatterSchema, CURRENT_SCHEMA_VERSION, type ChangedFile, type DotnetProjectInfo, type DriftEntry, type DriftKind, type DriftOptions, type DriftSeverity, type ExportFormat, type ExtractedSymbol, type GenerateDatabaseResult, type GitRef, type IndexResult, type IndexerOptions, type InitProjectInput, type InsertActivityParams, type LatestQualitySnapshot, type LoadRolesResult, type MetricsResult, type Phase, PhaseSchema, type PhasesFile, PhasesFileSchema, type ProjectLanguage, QualityCategorySchema, QualityPrioritySchema, type QualityScenario, QualityScenarioSchema, QualityScenarioStatusSchema, type QualityScenariosFile, QualityScenariosFileSchema, type QueryMetricsParams, type ScenarioTestResult, type Service, type SessionTotals, type SymbolKind, type Task, type TaskFile, TaskFileSchema, type TaskInferenceResult, TaskSchema, type TestOutcome, type VerifyResult, addTaskToYaml, applyInferences, detectDrift, detectProjectLanguage, discoverDotnetServices, exportMetrics, generateAgentRoles, generateArc42, generateConfig, generateDatabase, generatePlan, generateSyncFiles, getChangedFiles, getHeadSha, getSessionTotals, getUncommittedChanges, indexPackageDependencies, indexProject, inferTaskStatuses, initializeSchema, insertActivity, loadConfig, loadRole, loadRoles, migrate, openDatabase, openMemoryDatabase, queryMetrics, refreshFromDocs, resolveRef, setSyncCommit, syncPhaseToYaml, syncScenarioToYaml, syncTaskToYaml, verifyScenarios, writeDriftLog };