@digital-lake/lognexus 1.3.7 → 1.4.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/LICENSE +2 -2
- package/NOTICE.md +2 -2
- package/README.md +61 -36
- package/dist/audit/audit.d.ts +37 -2
- package/dist/audit/audit.d.ts.map +1 -1
- package/dist/audit/audit.js +483 -57
- package/dist/audit/audit.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +292 -32
- package/dist/cli.js.map +1 -1
- package/dist/commit.d.ts +6 -0
- package/dist/commit.d.ts.map +1 -1
- package/dist/commit.js +61 -23
- package/dist/commit.js.map +1 -1
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +31 -8
- package/dist/doctor.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/prompts.d.ts.map +1 -1
- package/dist/mcp/prompts.js +12 -8
- package/dist/mcp/prompts.js.map +1 -1
- package/dist/notes/attach.d.ts +11 -0
- package/dist/notes/attach.d.ts.map +1 -1
- package/dist/notes/attach.js +22 -5
- package/dist/notes/attach.js.map +1 -1
- package/dist/routing/profile.d.ts +44 -0
- package/dist/routing/profile.d.ts.map +1 -0
- package/dist/routing/profile.js +256 -0
- package/dist/routing/profile.js.map +1 -0
- package/dist/scaffold.d.ts +2 -2
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +22 -17
- package/dist/scaffold.js.map +1 -1
- package/dist/state/handoff.d.ts +18 -0
- package/dist/state/handoff.d.ts.map +1 -1
- package/dist/state/handoff.js +60 -10
- package/dist/state/handoff.js.map +1 -1
- package/dist/state/manager.d.ts.map +1 -1
- package/dist/state/manager.js +60 -1
- package/dist/state/manager.js.map +1 -1
- package/dist/state/schema.d.ts +38 -0
- package/dist/state/schema.d.ts.map +1 -1
- package/dist/state/schema.js +9 -0
- package/dist/state/schema.js.map +1 -1
- package/dist/status.d.ts +10 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +167 -42
- package/dist/status.js.map +1 -1
- package/dist/telemetry/benchmark.d.ts +51 -0
- package/dist/telemetry/benchmark.d.ts.map +1 -0
- package/dist/telemetry/benchmark.js +541 -0
- package/dist/telemetry/benchmark.js.map +1 -0
- package/dist/telemetry/collector.d.ts +109 -3
- package/dist/telemetry/collector.d.ts.map +1 -1
- package/dist/telemetry/collector.js +737 -178
- package/dist/telemetry/collector.js.map +1 -1
- package/dist/telemetry/consent-prompt.d.ts +35 -0
- package/dist/telemetry/consent-prompt.d.ts.map +1 -0
- package/dist/telemetry/consent-prompt.js +213 -0
- package/dist/telemetry/consent-prompt.js.map +1 -0
- package/dist/telemetry/detector.d.ts +16 -1
- package/dist/telemetry/detector.d.ts.map +1 -1
- package/dist/telemetry/detector.js +261 -31
- package/dist/telemetry/detector.js.map +1 -1
- package/dist/telemetry/index.d.ts +5 -4
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +5 -4
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/report.d.ts +3 -2
- package/dist/telemetry/report.d.ts.map +1 -1
- package/dist/telemetry/report.js +66 -14
- package/dist/telemetry/report.js.map +1 -1
- package/dist/telemetry/schema.d.ts +305 -2
- package/dist/telemetry/schema.d.ts.map +1 -1
- package/dist/telemetry/schema.js +142 -4
- package/dist/telemetry/schema.js.map +1 -1
- package/dist/update/gate.d.ts +1 -1
- package/dist/update/gate.d.ts.map +1 -1
- package/dist/update/gate.js +2 -0
- package/dist/update/gate.js.map +1 -1
- package/package.json +2 -2
- package/server.json +3 -3
|
@@ -1,10 +1,60 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AnonymousDiagnosticPayload, type DiffCategory, type TelemetryMode, type TelemetryStore } from "./schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* Restricts a telemetry recomputation to a single issue, date range or branch.
|
|
4
|
+
*
|
|
5
|
+
* A scoped recomputation is returned in memory only: it never rewrites the local store,
|
|
6
|
+
* so ad-hoc reporting can never corrupt the persisted aggregates.
|
|
7
|
+
*/
|
|
8
|
+
export interface ScopedTelemetryFilter {
|
|
9
|
+
issue?: string | number;
|
|
10
|
+
since?: string;
|
|
11
|
+
branch?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Economic profile of one routing tier.
|
|
15
|
+
*
|
|
16
|
+
* `base*` charges the fixed reasoning overhead of a single commit and `per*Loc*` charges
|
|
17
|
+
* every changed line, so a 400-line subtask costs far more than a 3-line typo fix while
|
|
18
|
+
* documentation churn stays cheap at every tier.
|
|
19
|
+
*/
|
|
20
|
+
export interface TierPricingProfile {
|
|
21
|
+
baseUsd: number;
|
|
22
|
+
perSourceLocUsd: number;
|
|
23
|
+
perDocsLocUsd: number;
|
|
24
|
+
baseInputTokens: number;
|
|
25
|
+
inputTokensPerLoc: number;
|
|
26
|
+
outputTokensPerLoc: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const TIER_PRICING_PROFILES: Record<"tier-1" | "tier-2" | "tier-3", TierPricingProfile>;
|
|
29
|
+
export type PricingTierKey = keyof typeof TIER_PRICING_PROFILES;
|
|
30
|
+
/**
|
|
31
|
+
* Loc-weighted token and cost model of one commit: `sourceLoc` prices source and test
|
|
32
|
+
* lines (same authoring effort), `docsLoc` prices documentation and configuration lines.
|
|
33
|
+
*/
|
|
34
|
+
export interface LocPricing {
|
|
35
|
+
sourceLoc: number;
|
|
36
|
+
docsLoc: number;
|
|
37
|
+
inputTokens: number;
|
|
38
|
+
outputTokens: number;
|
|
39
|
+
costUsd: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Prices a commit from its diff categories alone.
|
|
43
|
+
*
|
|
44
|
+
* Test lines are billed as source because they carry the same authoring effort, which is
|
|
45
|
+
* what makes a large refactor with a matching test suite visibly more expensive than a
|
|
46
|
+
* prose-only change. Rounding happens on the per-commit total so summing thousands of
|
|
47
|
+
* commits cannot drift.
|
|
48
|
+
*/
|
|
49
|
+
export declare function estimateCommitPricing(authorOrTier: string | null | undefined, linesByCategory: Partial<Record<DiffCategory, number>>): LocPricing;
|
|
2
50
|
export declare const LOCAL_ONLY_TELEMETRY_ERROR = "Community telemetry dispatch has been retired in favor of strict local-only telemetry. Run 'lognexus telemetry enable' for local performance metrics (zero network calls).";
|
|
3
51
|
export declare function isTelemetryGloballyDisabled(): boolean;
|
|
4
52
|
export declare function getTelemetryPath(targetDir?: string): string;
|
|
53
|
+
export type TelemetryConsentState = "accepted" | "declined" | "outdated" | "unanswered";
|
|
5
54
|
export declare function createDefaultTelemetryStore(targetDir?: string): TelemetryStore;
|
|
6
55
|
export declare function loadTelemetry(targetDir?: string): TelemetryStore;
|
|
7
56
|
export declare function saveTelemetry(store: TelemetryStore, targetDir?: string): void;
|
|
57
|
+
export declare function getTelemetryConsentState(targetDir?: string): TelemetryConsentState;
|
|
8
58
|
export declare function isTelemetryActive(targetDir?: string): boolean;
|
|
9
59
|
export declare function enableTelemetry(options: {
|
|
10
60
|
share?: boolean;
|
|
@@ -14,11 +64,20 @@ export declare function enableTelemetry(options: {
|
|
|
14
64
|
mode: TelemetryMode;
|
|
15
65
|
anonymousProjectId: string;
|
|
16
66
|
};
|
|
67
|
+
export declare function declineTelemetry(targetDir?: string): void;
|
|
17
68
|
export declare function disableTelemetry(targetDir?: string): void;
|
|
18
69
|
export declare function clearTelemetry(targetDir?: string): void;
|
|
19
70
|
export declare function recordTaskStart(taskId: string, targetDir?: string): void;
|
|
20
71
|
export declare function recordTaskFinish(taskId: string, targetDir?: string): number;
|
|
21
72
|
export declare function recordReviewGateBlock(targetDir?: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Recomputes the cost/token roll-up from the per-model buckets.
|
|
75
|
+
*
|
|
76
|
+
* The baseline prices every commit as if a frontier orchestrator had authored it alone,
|
|
77
|
+
* from LOC-weighted profiles rather than a flat per-commit rate, so a heavy refactor is
|
|
78
|
+
* never under-priced. Totals are re-derived from `store.models`, which keeps the call
|
|
79
|
+
* idempotent and lets a partially-backfilled store converge after one pass.
|
|
80
|
+
*/
|
|
22
81
|
export declare function updateCostSavingsEstimate(store: TelemetryStore): void;
|
|
23
82
|
export declare function recordCommitTelemetry(options: {
|
|
24
83
|
sha: string;
|
|
@@ -26,6 +85,47 @@ export declare function recordCommitTelemetry(options: {
|
|
|
26
85
|
tier?: string;
|
|
27
86
|
targetDir?: string;
|
|
28
87
|
}): void;
|
|
88
|
+
/**
|
|
89
|
+
* Normalizes an issue filter into a bare identifier: `58`, `"58"`, `"#58"` and `"#058"`
|
|
90
|
+
* all collapse to `"58"`, while alphanumeric tickets such as `"SLM-201"` are upper-cased.
|
|
91
|
+
*/
|
|
92
|
+
export declare function normalizeIssueFilter(issue: string | number): string;
|
|
93
|
+
interface ParsedNote {
|
|
94
|
+
$schema?: unknown;
|
|
95
|
+
issue?: {
|
|
96
|
+
id?: unknown;
|
|
97
|
+
tier?: unknown;
|
|
98
|
+
} | null;
|
|
99
|
+
subtask?: {
|
|
100
|
+
id?: unknown;
|
|
101
|
+
contract?: {
|
|
102
|
+
allowedFiles?: unknown;
|
|
103
|
+
isolation?: unknown;
|
|
104
|
+
swarmWorkers?: unknown;
|
|
105
|
+
swarmPosts?: unknown;
|
|
106
|
+
} | null;
|
|
107
|
+
} | null;
|
|
108
|
+
tier?: unknown;
|
|
109
|
+
escalated?: unknown;
|
|
110
|
+
swarm?: {
|
|
111
|
+
workers?: unknown;
|
|
112
|
+
posts?: unknown;
|
|
113
|
+
} | null;
|
|
114
|
+
}
|
|
115
|
+
export declare function extractNoteSwarmMetrics(parsedNote: ParsedNote | null): {
|
|
116
|
+
isSwarm: boolean;
|
|
117
|
+
workers: number;
|
|
118
|
+
posts: number;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Resolves the routing tier of a noted commit.
|
|
122
|
+
*
|
|
123
|
+
* Modern notes (carrying `$schema`) honour explicit `--tier` overrides: `inferredTier`
|
|
124
|
+
* overrides `noteTier` only when `noteTier` merely inherited `issue.tier`, while legacy
|
|
125
|
+
* notes without `$schema` still upgrade the historical `tier-3` default when an author
|
|
126
|
+
* identity resolves.
|
|
127
|
+
*/
|
|
128
|
+
export declare function resolveCommitTier(parsedNote: ParsedNote | null, inferredTier: string | null): PricingTierKey;
|
|
29
129
|
/**
|
|
30
130
|
* Rebuilds the commit aggregates from `refs/notes/lognexus`.
|
|
31
131
|
*
|
|
@@ -33,7 +133,13 @@ export declare function recordCommitTelemetry(options: {
|
|
|
33
133
|
* run where the store was rewritten — still leaves a Git note behind. The notes are the
|
|
34
134
|
* authoritative record: this reads them and recomputes the aggregates from scratch,
|
|
35
135
|
* which makes the reconciliation idempotent and keeps it entirely offline.
|
|
136
|
+
*
|
|
137
|
+
* A scoped call (`filter` set) is a read-only projection: it is returned in memory and
|
|
138
|
+
* never persisted, so an ad-hoc `issue`/`since`/`branch` report can never shrink the
|
|
139
|
+
* aggregates a user accumulated over months.
|
|
36
140
|
*/
|
|
37
|
-
export declare function syncTelemetryFromGitNotes(targetDir?: string): TelemetryStore;
|
|
38
|
-
export declare function
|
|
141
|
+
export declare function syncTelemetryFromGitNotes(targetDir?: string, filter?: ScopedTelemetryFilter): TelemetryStore;
|
|
142
|
+
export declare function buildAnonymousDiagnosticPayload(store: TelemetryStore, filter?: ScopedTelemetryFilter): AnonymousDiagnosticPayload;
|
|
143
|
+
export declare const buildAnonymousCommunityPayload: typeof buildAnonymousDiagnosticPayload;
|
|
144
|
+
export {};
|
|
39
145
|
//# sourceMappingURL=collector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/telemetry/collector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/telemetry/collector.ts"],"names":[],"mappings":"AAeA,OAA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