ensemble-review 1.0.35 → 1.0.36
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/package.json +5 -2
- package/dist/ai/check-tool.js +0 -6
- package/dist/api/routes/auth.js +0 -194
- package/dist/api/routes/billing.js +0 -209
- package/dist/api/routes/claude-review.js +0 -522
- package/dist/api/routes/contact.js +0 -318
- package/dist/api/routes/feed.js +0 -21
- package/dist/api/routes/inbox.js +0 -45
- package/dist/api/routes/mentions.js +0 -22
- package/dist/api/routes/teams.js +0 -150
- package/dist/api/routes/webhooks.js +0 -181
- package/dist/coding/activity.js +0 -80
- package/dist/coding/agent.js +0 -147
- package/dist/coding/ai-fix/checks-preview.js +0 -58
- package/dist/coding/ai-fix/comment-seed.js +0 -519
- package/dist/coding/ai-fix/prompts.js +0 -283
- package/dist/coding/ai-resolve/prompt.js +0 -161
- package/dist/coding/ai-resolve/routes.js +0 -97
- package/dist/coding/ai-resolve/run.js +0 -343
- package/dist/coding/ai-resolve/schema.js +0 -26
- package/dist/coding/ai-resolve/validate.js +0 -136
- package/dist/coding/checks/deny-scan.js +0 -75
- package/dist/coding/checks/discover.js +0 -541
- package/dist/coding/checks/docker.js +0 -38
- package/dist/coding/checks/env.js +0 -88
- package/dist/coding/checks/hooks.js +0 -91
- package/dist/coding/checks/index.js +0 -8
- package/dist/coding/checks/local.js +0 -40
- package/dist/coding/checks/sandbox.js +0 -206
- package/dist/coding/checks/session.js +0 -518
- package/dist/coding/checks/spawn.js +0 -123
- package/dist/coding/checks/spec.js +0 -140
- package/dist/coding/checks/types.js +0 -6
- package/dist/coding/partial-spend.js +0 -19
- package/dist/coding/safe-path.js +0 -75
- package/dist/coding/story-build/build-prompts.js +0 -178
- package/dist/coding/story-build/build.js +0 -332
- package/dist/coding/story-build/checkouts.js +0 -66
- package/dist/coding/story-build/docs-runner.js +0 -178
- package/dist/coding/story-build/docs.js +0 -334
- package/dist/coding/story-build/manager.js +0 -999
- package/dist/coding/story-build/plan-agent.js +0 -190
- package/dist/coding/story-build/plan.js +0 -338
- package/dist/coding/story-build/prompts.js +0 -147
- package/dist/coding/story-build/routes-docs.js +0 -113
- package/dist/coding/story-build/routes.js +0 -295
- package/dist/coding/story-build/schema.js +0 -53
- package/dist/db/automation-output.js +0 -349
- package/dist/db/credits.js +0 -79
- package/dist/db/schema.js +0 -321
- package/dist/db/schema.pg.js +0 -2197
- package/dist/db/sprint-repo-suggest.js +0 -257
- package/dist/db/sprint-stories.js +0 -42
- package/dist/db/sprint-story.js +0 -505
- package/dist/db/sprint-ticket-repos.js +0 -195
- package/dist/db/story-selection.js +0 -270
- package/dist/db/team-comparison.js +0 -124
- package/dist/db/workspace-comparison.js +0 -98
- package/dist/feed/fyi-provider.js +0 -10
- package/dist/github/local-user.js +0 -92
- package/dist/github/repo-files.js +0 -26
- package/dist/ml/worker.js +0 -31
- package/dist/platform/advisor/discovery/tier2.js +0 -88
- package/dist/platform/advisor/discovery/tier3.js +0 -57
- package/dist/platform/advisor/emitters/adapter.js +0 -5
- package/dist/platform/advisor/emitters/coderabbit.js +0 -175
- package/dist/platform/advisor/emitters/copilot-prose.js +0 -118
- package/dist/platform/advisor/emitters/greptile.js +0 -176
- package/dist/platform/advisor/emitters/lint.js +0 -37
- package/dist/platform/advisor/emitters/manifest.js +0 -239
- package/dist/platform/advisor/emitters/prose.js +0 -183
- package/dist/platform/advisor/emitters/registry.js +0 -20
- package/dist/platform/advisor/emitters/yaml-doc.js +0 -95
- package/dist/platform/advisor/evidence.js +0 -79
- package/dist/platform/advisor/findings.js +0 -15
- package/dist/platform/advisor/intents.js +0 -269
- package/dist/platform/advisor/measure/effect.js +0 -18
- package/dist/platform/advisor/outputs/brief.js +0 -68
- package/dist/platform/advisor/outputs/config-pr.js +0 -156
- package/dist/platform/advisor/refine/diff-guard.js +0 -38
- package/dist/platform/advisor/refine/refine.js +0 -35
- package/dist/platform/advisor/retro-check.js +0 -98
- package/dist/platform/advisor/routes.js +0 -648
- package/dist/platform/advisor/store.js +0 -321
- package/dist/platform/advisor/taxonomy.js +0 -67
- package/dist/platform/annotations/prompts.js +0 -84
- package/dist/platform/annotations/routes.js +0 -86
- package/dist/platform/annotations/runner.js +0 -234
- package/dist/platform/annotations/targets.js +0 -203
- package/dist/platform/insights/grounded-figures.js +0 -162
- package/dist/platform/insights/period-questions.js +0 -235
- package/dist/platform/work-plan/hash.js +0 -99
- package/dist/platform/work-plan/prompt.js +0 -209
- package/dist/platform/work-plan/routes.js +0 -350
- package/dist/pro/bind.js +0 -309
- package/dist/pro/contract.js +0 -36
- package/dist/pro/event-hooks.js +0 -37
- package/dist/pro/migrate.js +0 -64
- package/dist/review/events.js +0 -24
- package/dist/review/local-settings.js +0 -78
- package/dist/review/memory/capture.js +0 -0
- package/dist/review/memory/retrieval.js +0 -272
- package/dist/review/memory/routes.js +0 -78
- package/dist/review/persist.js +0 -203
- package/dist/review/plugin-providers.js +0 -12
- package/dist/review/prompt.js +0 -264
- package/dist/review/review-manager.js +0 -259
- package/dist/review/routing.js +0 -164
- package/dist/review/sprint-assess/agent.js +0 -145
- package/dist/review/sprint-assess/manager.js +0 -382
- package/dist/review/sprint-assess/prompts.js +0 -99
- package/dist/review/sprint-assess/routes.js +0 -109
- package/dist/review/sprint-assess/schema.js +0 -70
- package/dist/review/sprint-assess/validate.js +0 -180
- package/dist/review/sprint-story/manager.js +0 -98
- package/dist/review/sprint-story/prompt.js +0 -45
- package/dist/review/sprint-story/validate.js +0 -127
- package/dist/review/story-docs/build-prompts.js +0 -153
- package/dist/review/story-docs/build-validate.js +0 -162
- package/dist/review/story-report/agent.js +0 -203
- package/dist/review/story-report/fingerprint.js +0 -45
- package/dist/review/story-report/manager.js +0 -287
- package/dist/review/story-report/routes.js +0 -154
- package/dist/review/story-report/story-detail.js +0 -148
- package/dist/review/story-report/validate.js +0 -105
- package/dist/review/ticket-review/sweep-waits.js +0 -20
- package/dist/review/write-deny.js +0 -170
- package/dist/shared/conflict-ai.js +0 -24
- package/dist/sync/benchmark-rollup.js +0 -50
package/dist/pro/bind.js
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { dirname, join, resolve } from 'node:path';
|
|
3
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
|
-
import { config } from '../config.js';
|
|
5
|
-
import { accountIdOf } from '../api/plugins/auth.js';
|
|
6
|
-
import { db, schema, runTransaction, isPg } from '../db/client.js';
|
|
7
|
-
import * as hostQueries from '../db/queries.js';
|
|
8
|
-
// Period-over-period reporting (apiVersion 20). The metric vector and the coverage rule live in
|
|
9
|
-
// their own core module — window-pure SQL that deliberately shares nothing with queries.ts's
|
|
10
|
-
// "as of now" getters — and the forecast estimator is pure maths with no db import at all.
|
|
11
|
-
import { getPeriodMetrics, getPeriodCoverage, getPeriodLanes, getPeriodMetricsForWorkspaces, } from '../db/period-metrics.js';
|
|
12
|
-
// The synthesis input assembly (P2.1) — its own module for the same reason period-metrics is:
|
|
13
|
-
// §8.3's one-predicate rule is the whole feature, and the module header names which drill-down
|
|
14
|
-
// query each kind reads.
|
|
15
|
-
import { getSynthesisInput } from '../db/synthesis-input.js';
|
|
16
|
-
// The daily-brief fold (P3.1) — its own module: the counts strip's five surface-fold reuses +
|
|
17
|
-
// the narrow anomaly slice + the 5-min TTL cache live together, documented at the source.
|
|
18
|
-
import { getDailyBriefCounts } from '../db/daily-brief.js';
|
|
19
|
-
// The 1:1-prep person vector (P4.2) — its own module: the global-users admission probe, the
|
|
20
|
-
// lane check and the one-fold first-review reuse live together, documented at the source.
|
|
21
|
-
import { getPersonPeriod } from '../db/person-period.js';
|
|
22
|
-
// The work-plan fold — its own core module for the same reason daily-brief.ts is: the ranking is
|
|
23
|
-
// the feature, and the alignment contract (it folds the SAME /api/attention cards the brief
|
|
24
|
-
// counts) only survives if both live where the next reader can see them together.
|
|
25
|
-
import { getWorkPlan } from '../db/work-plan.js';
|
|
26
|
-
import { getFlowPointerEvidence } from '../db/flow-pointers.js';
|
|
27
|
-
import { getBlastSignalsForPr } from '../db/blast-radius-query.js';
|
|
28
|
-
import { dormantBotUserIds } from '../db/bot-dormancy.js';
|
|
29
|
-
import { getPendingBoardSnapshot } from '../db/pending-tabs.js';
|
|
30
|
-
import { forecastNext } from '../db/forecast.js';
|
|
31
|
-
import { recordAiUsage, getAiUsageSummary } from '../db/usage.js';
|
|
32
|
-
import { aiCreditStatus } from '../db/credits.js';
|
|
33
|
-
import { makeConflictSeam } from '../conflict/seam.js';
|
|
34
|
-
import { registerScheduledJob } from '../sync/scheduled-jobs.js';
|
|
35
|
-
import { cheapComplete } from '../review/llm.js';
|
|
36
|
-
import { detectClaudeAuth } from '../review/auth.js';
|
|
37
|
-
import { getAccessToken, getAccountById } from '../auth/account.js';
|
|
38
|
-
import { createIssue, createPullRequest, fetchPrHeadInfo, fetchPrUnifiedDiff, } from '../github/mutations.js';
|
|
39
|
-
import { ghRestGetContentDir, ghRestGetContentRaw } from '../github/client.js';
|
|
40
|
-
import { fetchCompareDiff } from '../github/compare.js';
|
|
41
|
-
import { fetchReviewCommentHunks } from '../sync/hydrate-detail.js';
|
|
42
|
-
import { fetchActionsJobLog } from '../github/actions-logs.js';
|
|
43
|
-
import { commitFilesAndOpenPr } from '../coding/git-ops.js';
|
|
44
|
-
import { registerRetentionHandler } from '../db/retention.js';
|
|
45
|
-
import { registerAccountErasureHandler } from '../db/erase-account.js';
|
|
46
|
-
import { registerReportingWindowResolver } from '../db/reporting-window.js';
|
|
47
|
-
import { runPluginMigrations } from './migrate.js';
|
|
48
|
-
import { entitledProCapabilities, setProCapabilities } from './contract.js';
|
|
49
|
-
import { registerProEventHooks } from './event-hooks.js';
|
|
50
|
-
// Boot binding for the optional @pierre/pro plugin. The plugin lives in a PRIVATE
|
|
51
|
-
// git submodule at packages/pro (often absent — a pure-OSS checkout never has it).
|
|
52
|
-
// It is deliberately NOT a declared dependency, so `pnpm install` succeeds without
|
|
53
|
-
// it; we resolve it by FILESYSTEM PATH rather than a bare specifier (no package.json
|
|
54
|
-
// coupling). Submodule absent → no entry file on disk → clean OSS no-op.
|
|
55
|
-
export async function bindProPlugin(app) {
|
|
56
|
-
if (!config.proEnabled)
|
|
57
|
-
return; // master gate (Pro is local-only for now)
|
|
58
|
-
// here = apps/backend/{src|dist}/pro/bind.{ts|js} → repo root is four levels up.
|
|
59
|
-
const here = fileURLToPath(import.meta.url);
|
|
60
|
-
const repoRoot = resolve(dirname(here), '../../../..');
|
|
61
|
-
// PRO_PLUGIN_PATH is an explicit entry-file override, tried FIRST. The cloud Docker image
|
|
62
|
-
// flattens the release layout (backend runs from /app/dist/…), so the repo-relative
|
|
63
|
-
// packages/pro paths below don't exist there — the image sets PRO_PLUGIN_PATH=/app/pro/index.js
|
|
64
|
-
// to point straight at the copied-in built plugin. It reveals nothing about Pro (just a path).
|
|
65
|
-
//
|
|
66
|
-
// The dist/src ORDER flips by environment, and that matters: `packages/pro/dist` is built only
|
|
67
|
-
// for the --with-pro release image, is gitignored, and nothing in the dev loop refreshes it.
|
|
68
|
-
// A leftover dist therefore used to SHADOW the source under `pnpm dev` and freeze the plugin at
|
|
69
|
-
// whenever it was last built — every route added afterwards 404s, with the plugin otherwise
|
|
70
|
-
// looking healthy (capabilities on, older routes serving). Dev prefers source; production, where
|
|
71
|
-
// no .ts loader exists, prefers the build.
|
|
72
|
-
const distEntry = join(repoRoot, 'packages/pro/dist/index.js'); // built plugin (node)
|
|
73
|
-
const srcEntry = join(repoRoot, 'packages/pro/src/index.ts'); // source (tsx dev)
|
|
74
|
-
const entry = [
|
|
75
|
-
process.env.PRO_PLUGIN_PATH, // explicit override (cloud/Docker image)
|
|
76
|
-
...(process.env.NODE_ENV === 'production' ? [distEntry, srcEntry] : [srcEntry, distEntry]),
|
|
77
|
-
]
|
|
78
|
-
.filter((p) => Boolean(p))
|
|
79
|
-
.find(existsSync);
|
|
80
|
-
if (!entry) {
|
|
81
|
-
app.log.debug('pro plugin submodule absent — OSS mode');
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
// Which entry bound is the first thing you need when a Pro route unexpectedly 404s.
|
|
85
|
-
app.log.info({ entry }, 'pro plugin entry resolved');
|
|
86
|
-
const mod = await import(pathToFileURL(entry).href).catch((err) => {
|
|
87
|
-
app.log.warn({ err }, 'pro plugin present but failed to load — OSS mode');
|
|
88
|
-
return null;
|
|
89
|
-
});
|
|
90
|
-
if (!mod)
|
|
91
|
-
return;
|
|
92
|
-
const plugin = (mod.default ?? mod);
|
|
93
|
-
// ⚠ THE RUNTIME GATE. This literal is the twin of `ProPlugin['apiVersion']` in contract.ts —
|
|
94
|
-
// bump them together. A half-bump here silently degrades a CORRECT plugin to OSS mode (the warn
|
|
95
|
-
// below is the only trace; capabilities go dark and every /api/pro/* route 404s).
|
|
96
|
-
if (plugin?.apiVersion !== 23 || typeof plugin.register !== 'function') {
|
|
97
|
-
app.log.warn({ apiVersion: plugin?.apiVersion }, 'pro contract mismatch — skipped');
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const ctx = {
|
|
101
|
-
log: app.log,
|
|
102
|
-
host: {
|
|
103
|
-
version: process.env.npm_package_version ?? '0.0.0',
|
|
104
|
-
deploymentMode: config.deploymentMode,
|
|
105
|
-
isCloud: config.isCloud,
|
|
106
|
-
// The ONE spelling of the SPA's BROWSER-FACING base (config.ts `appWebUrl`). Passed across
|
|
107
|
-
// the seam so the plugin never re-derives it from the environment — see the contract's note.
|
|
108
|
-
//
|
|
109
|
-
// ⚠ `appWebUrl`, NOT `appBaseUrl`. Under `pnpm dev` this server is :4000 and serves no SPA;
|
|
110
|
-
// Vite serves it on :5173. Handing the plugin `appBaseUrl` here is what made the Slack
|
|
111
|
-
// digest's deep links 404 locally.
|
|
112
|
-
appWebUrl: config.appWebUrl,
|
|
113
|
-
// (No `sealSecret` / `openSecret` since apiVersion 23: their only user, the per-workspace Jira
|
|
114
|
-
// token, moved to core with the tracker — tracker/runtime.ts wires auth/crypto.ts directly.)
|
|
115
|
-
},
|
|
116
|
-
accountIdOf,
|
|
117
|
-
db,
|
|
118
|
-
schema,
|
|
119
|
-
runTransaction,
|
|
120
|
-
isPg,
|
|
121
|
-
registerMigrations: (sqliteFolder, pgFolder) => runPluginMigrations(sqliteFolder, pgFolder),
|
|
122
|
-
registerRetention: (handler) => registerRetentionHandler(handler),
|
|
123
|
-
registerAccountErasure: (handler) => registerAccountErasureHandler(handler),
|
|
124
|
-
// The plugin's comparison-window resolver becomes core's reporting window (db/reporting-window.ts).
|
|
125
|
-
registerReportingWindow: (resolver) => registerReportingWindowResolver(resolver),
|
|
126
|
-
// Host → plugin event hooks (pro/event-hooks.ts): a succeeded Claude Review run, a PR seen
|
|
127
|
-
// merging live. Fire-and-forget on the host side.
|
|
128
|
-
registerEventHooks: (hooks) => registerProEventHooks(hooks, app.log),
|
|
129
|
-
// The per-account entitlement view (/api/me's), for crons and event hooks that carry no
|
|
130
|
-
// request for the /api/pro/* 402 gate to see. A missing account is never entitled.
|
|
131
|
-
accountEntitled: async (accountId, capability) => {
|
|
132
|
-
const account = await getAccountById(accountId);
|
|
133
|
-
if (!account)
|
|
134
|
-
return false;
|
|
135
|
-
return entitledProCapabilities(account)[capability] === true;
|
|
136
|
-
},
|
|
137
|
-
llm: {
|
|
138
|
-
complete: cheapComplete,
|
|
139
|
-
detectAuth: () => {
|
|
140
|
-
const r = detectClaudeAuth();
|
|
141
|
-
return r.status === 'ok'
|
|
142
|
-
? { status: 'ok' }
|
|
143
|
-
: { status: 'none', message: r.message };
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
queries: {
|
|
147
|
-
getInsights: (accountId, repoIds) => hostQueries.getInsights({ accountId, repoIds: repoIds ?? null }),
|
|
148
|
-
getRepoAnalytics: (accountId, repoId) => hostQueries.getRepoAnalytics(accountId, repoId),
|
|
149
|
-
getOpenPrs: (args) => hostQueries.getOpenPrs({
|
|
150
|
-
accountId: args.accountId,
|
|
151
|
-
repoIds: args.repoIds ?? null,
|
|
152
|
-
userIds: null,
|
|
153
|
-
}),
|
|
154
|
-
// The scope-bearing getters pass `scope` straight through: BotScopeWire is structurally the
|
|
155
|
-
// host's BotScope, and the plugin only ever holds one the host produced (per-request via
|
|
156
|
-
// resolveWorkspaceScope, or workspaceScopeForRepo / defaultWorkspaceId below).
|
|
157
|
-
getActivity: (accountId, scope) => hostQueries.getActivity(accountId, scope),
|
|
158
|
-
getWorkspaceInsights: (accountId, window, scope) => hostQueries.getWorkspaceInsights(accountId, window, scope),
|
|
159
|
-
getWorkspaceMetricsDetail: (accountId, window, repoIds) => hostQueries.getWorkspaceMetricsDetail(accountId, window, repoIds),
|
|
160
|
-
workspaceScopeForRepo: (accountId, repoId) => hostQueries.workspaceScopeForRepo(accountId, repoId),
|
|
161
|
-
// The account's Default workspace, for the two account-wide crons (no request → no
|
|
162
|
-
// `?workspace=`). ensureDefaultWorkspace creates the row if it is missing, so a cron can
|
|
163
|
-
// never fail on an account that has somehow never been through a scoped request.
|
|
164
|
-
defaultWorkspaceId: (accountId) => hostQueries.ensureDefaultWorkspace(accountId),
|
|
165
|
-
getAiUsage: (accountId, sinceMs) => getAiUsageSummary(accountId, sinceMs),
|
|
166
|
-
getBotAnalytics: (accountId, window, scope) => hostQueries.getBotAnalytics(accountId, window, scope),
|
|
167
|
-
getBotReviewComments: (accountId, window, scope) => hostQueries.getBotReviewComments(accountId, window, scope),
|
|
168
|
-
getHumanReviewComments: (accountId, window, scope) => hostQueries.getHumanReviewComments(accountId, window, scope),
|
|
169
|
-
getAdvisorFindings: (accountId, window, scope) => hostQueries.getAdvisorFindings(accountId, window, scope),
|
|
170
|
-
getBotEffectPanel: (accountId, scope, botUserId, anchorMs) => hostQueries.getBotEffectPanel(accountId, scope, botUserId, anchorMs),
|
|
171
|
-
// Period reporting (apiVersion 20). The scope passes straight through, exactly like the
|
|
172
|
-
// getters above: `workspaceId` decides who counts as an automated reviewer, `repoIds`
|
|
173
|
-
// narrows what is measured — and the plugin only ever holds a host-produced scope.
|
|
174
|
-
getPeriodMetrics: (accountId, scope, window) => getPeriodMetrics(accountId, scope, window),
|
|
175
|
-
getPeriodCoverage: (accountId, repoIds, atMs) => getPeriodCoverage(accountId, repoIds, atMs),
|
|
176
|
-
// PURE maths — no db, no I/O, nothing to await. It is crossed as async only to match the
|
|
177
|
-
// shape of every other member of this seam; do NOT read the `async` as a hint that this
|
|
178
|
-
// one touches the database.
|
|
179
|
-
computePeriodForecast: async (values, opts) => forecastNext(values, opts ?? {}),
|
|
180
|
-
getPeriodLanes: (accountId, scope, window) => getPeriodLanes(accountId, scope, window),
|
|
181
|
-
// Phase-0 seams (apiVersion 21) — inert until their consuming phases. The behaviour
|
|
182
|
-
// rollup is the existing CORE compute; `botUserId` slices the result to one bot for the
|
|
183
|
-
// per-bot drill-down tab (the fetch must not compute 15 bots' heatmaps to render one).
|
|
184
|
-
getBotBehaviour: (accountId, window, scope, botUserId) => hostQueries.getBotBehaviourAnalytics(accountId, window, scope, botUserId),
|
|
185
|
-
// Per-workspace period vectors (the Reports "By workspace" axis). Window-pure — a loop
|
|
186
|
-
// of getPeriodMetrics over the account's workspaces; carries no cost fields.
|
|
187
|
-
getPeriodMetricsForWorkspaces: (accountId, window) => getPeriodMetricsForWorkspaces(accountId, window),
|
|
188
|
-
// The synthesis input assembly (P2.1 — LIVE as of the P2.1 train; the declared-inert throw
|
|
189
|
-
// is swapped for db/synthesis-input.ts, which routes every kind through the drill-down's
|
|
190
|
-
// own fold per §8.3). No contract change — exactly the swap D2's single bump paid for.
|
|
191
|
-
getSynthesisInput: (accountId, scope) => getSynthesisInput(accountId, scope),
|
|
192
|
-
// The daily-brief fold (P3.1 — LIVE: the declared-inert throw swapped for core
|
|
193
|
-
// db/daily-brief.ts, which reuses each strip line's OWN surface fold behind a 5-min TTL
|
|
194
|
-
// cache). No contract change — exactly the swap D2's single bump paid for.
|
|
195
|
-
getDailyBriefCounts: (accountId, workspaceId) => getDailyBriefCounts(accountId, workspaceId),
|
|
196
|
-
// The 1:1-prep person vector (P4.2 — LIVE: the declared-inert throw swapped for core
|
|
197
|
-
// db/person-period.ts, exactly the swap D2's single bump paid for — no contract change).
|
|
198
|
-
// The fold resolves the workspace scope itself (resolveWorkspaceScope — a foreign id
|
|
199
|
-
// degrades to Default), admits the subject only via the workspace activity probe, and
|
|
200
|
-
// returns null for bots and strangers alike. `opts.evidence` (the People report) rides
|
|
201
|
-
// through unchanged — an older plugin passes nothing and gets the vector alone.
|
|
202
|
-
getPersonPeriod: (accountId, workspaceId, userId, window, opts) => getPersonPeriod(accountId, workspaceId, userId, window, opts),
|
|
203
|
-
// The work-plan fold (core db/work-plan.ts). The scope passes straight through like every
|
|
204
|
-
// other scope-bearing getter above: `workspaceId` is the judgement grain, `repoIds` narrows
|
|
205
|
-
// the data, and the plugin only ever holds a scope the host's resolver produced.
|
|
206
|
-
// The seam member is OPTIONAL (see contract.ts) so an older host degrades this ONE feature
|
|
207
|
-
// rather than the plugin; THIS host implements it, so it is always present here.
|
|
208
|
-
getWorkPlan: (accountId, scope) => getWorkPlan(accountId, scope),
|
|
209
|
-
// Chronology's pointer evidence (core db/flow-pointers.ts) — deterministic, person-free.
|
|
210
|
-
// Optional on the contract; THIS host implements it, so it is always present here.
|
|
211
|
-
getFlowPointerEvidence: (accountId, scope, windowDays, opts) => getFlowPointerEvidence(accountId, scope, windowDays, opts),
|
|
212
|
-
// Blast radius for one PR — the deterministic evidence the `impact` annotation narrates.
|
|
213
|
-
getBlastSignals: (accountId, prId) => getBlastSignalsForPr(accountId, prId),
|
|
214
|
-
// The workspace's derived human seat count — the ONE multiplier a `per_seat` price is read
|
|
215
|
-
// through, shared with `effectiveMonthlyUsd` and the ROI table's effective `costMonthlyUsd`
|
|
216
|
-
// so the Benchmark tab cannot quote a different monthly figure for the same bot than the
|
|
217
|
-
// Bots tab does. Takes a workspaceId and NOT a scope on purpose: the count keys on workspace
|
|
218
|
-
// MEMBERSHIP, never on a repoIds narrowing (a per-seat invoice does not shrink because the
|
|
219
|
-
// reader filtered a chart). The seam member is OPTIONAL (see contract.ts); THIS host
|
|
220
|
-
// implements it, so it is always present here.
|
|
221
|
-
workspaceHumanSeatCount: (accountId, workspaceId) => hostQueries.workspaceHumanSeatCount(accountId, workspaceId),
|
|
222
|
-
// Which of the plugin's OWN candidate reviewers said nothing anywhere in this workspace over
|
|
223
|
-
// the fixed 30-day dormancy window (core db/bot-dormancy.ts). The Benchmark hides those cards
|
|
224
|
-
// through this; the Advisor hides them inside `getAdvisorFindings`, off the same predicate,
|
|
225
|
-
// so the two paid surfaces cannot disagree about whether a bot is running. Takes a
|
|
226
|
-
// workspaceId and NOT a scope on purpose: dormancy keys on workspace MEMBERSHIP, never on a
|
|
227
|
-
// repoIds narrowing. The seam member is OPTIONAL (see contract.ts); THIS host implements it.
|
|
228
|
-
dormantBotUserIds: (accountId, workspaceId, candidateUserIds) => dormantBotUserIds(accountId, workspaceId, candidateUserIds),
|
|
229
|
-
// The configuring account's Pending board for the Slack digest — the /api/attention fold
|
|
230
|
-
// (`buildPendingBoard`) without its live extras. Optional on the contract; always present here.
|
|
231
|
-
getPendingBoard: (accountId, workspaceId) => getPendingBoardSnapshot(accountId, workspaceId),
|
|
232
|
-
// Auto Claude review's candidate PRs (core db/queries.ts). Optional on the contract; always
|
|
233
|
-
// present here. The workspace-aware human test lives in core, beside the resolver it reuses.
|
|
234
|
-
getAutoReviewCandidates: (accountId, workspaceId, opts) => hostQueries.getAutoReviewCandidates(accountId, workspaceId, opts),
|
|
235
|
-
},
|
|
236
|
-
recordAiUsage: (row) => recordAiUsage(row),
|
|
237
|
-
aiCredits: {
|
|
238
|
-
check: async (accountId) => {
|
|
239
|
-
const account = await getAccountById(accountId);
|
|
240
|
-
// Fail closed on a missing account (should never happen for a live request): block
|
|
241
|
-
// BOTH seams rather than risk unmetered generation.
|
|
242
|
-
if (!account)
|
|
243
|
-
return {
|
|
244
|
-
summaryTurnsUsed: 0,
|
|
245
|
-
summaryTurnLimit: 0,
|
|
246
|
-
summaryTurnsRemaining: 0,
|
|
247
|
-
summaryBlocked: true,
|
|
248
|
-
agentCreditsUsed: 0,
|
|
249
|
-
agentAllowanceCredits: 0,
|
|
250
|
-
agentCreditsRemaining: 0,
|
|
251
|
-
agentBlocked: true,
|
|
252
|
-
blocked: true,
|
|
253
|
-
};
|
|
254
|
-
return aiCreditStatus(account, Date.now());
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
registerScheduledJob,
|
|
258
|
-
// AI Fix infra (per-account, cloud-ready). The host owns the security-sensitive
|
|
259
|
-
// clone/agent/push machinery; the plugin only drives it with prompts/model.
|
|
260
|
-
github: {
|
|
261
|
-
fetchPrDiff: async (accountId, owner, name, number) => fetchPrUnifiedDiff(await getAccessToken(accountId), owner, name, number),
|
|
262
|
-
fetchPrHeadInfo: async (accountId, owner, name, number) => fetchPrHeadInfo(await getAccessToken(accountId), owner, name, number),
|
|
263
|
-
fetchCheckLogs: async (accountId, owner, name, jobId, tail) => fetchActionsJobLog(await getAccessToken(accountId), owner, name, jobId, tail),
|
|
264
|
-
openPullRequest: async (accountId, prArgs) => createPullRequest(await getAccessToken(accountId), prArgs),
|
|
265
|
-
// Advisor repo-file reads: status-returning, never throwing (a 404 is the ordinary
|
|
266
|
-
// "no config yet"). `ref` rides the contents-API query string.
|
|
267
|
-
readRepoFile: async (accountId, a) => ghRestGetContentRaw(await getAccessToken(accountId), `/repos/${a.owner}/${a.name}/contents/${a.path}`, a.ref),
|
|
268
|
-
listRepoDir: async (accountId, a) => ghRestGetContentDir(await getAccessToken(accountId), `/repos/${a.owner}/${a.name}/contents/${a.path}`, a.ref),
|
|
269
|
-
openIssue: async (accountId, a) => createIssue(await getAccessToken(accountId), a.owner, a.name, a.title, a.body),
|
|
270
|
-
// Two-sha compare (apiVersion 16). `accountId` is passed THROUGH so a rate-limited
|
|
271
|
-
// compare feeds that account's budget — the same discipline sync/commit-files.ts uses.
|
|
272
|
-
// Never throws; see github/compare.ts.
|
|
273
|
-
fetchCompareDiff: async (accountId, a) => fetchCompareDiff(await getAccessToken(accountId), { ...a, accountId }),
|
|
274
|
-
// Review-comment anchor hunks (apiVersion 17). Takes `accountId`, NOT a token, and
|
|
275
|
-
// deliberately does NOT `await getAccessToken(accountId)` in this arrow the way the
|
|
276
|
-
// compare above does: that call THROWS on a missing account or a missing stored token,
|
|
277
|
-
// which would make a "never throws" seam rejectable anyway. `fetchGhPrTextUncached`
|
|
278
|
-
// already resolves the token inside its own try, so routing through it makes the
|
|
279
|
-
// contract structurally true instead of a convention the caller has to defend against.
|
|
280
|
-
fetchReviewCommentHunks: (accountId, a) => fetchReviewCommentHunks(accountId, a.owner, a.name, a.prNumber, {
|
|
281
|
-
maxHunkChars: a.maxHunkChars,
|
|
282
|
-
}),
|
|
283
|
-
},
|
|
284
|
-
coding: {
|
|
285
|
-
// The advisor's config-PR primitive. (generateFix / applyAndPush left with the agentic
|
|
286
|
-
// fixer at apiVersion 22 — core reaches them through review/agent-context.ts.)
|
|
287
|
-
commitFilesAndOpenPr: (prArgs) => commitFilesAndOpenPr(prArgs),
|
|
288
|
-
},
|
|
289
|
-
// (No `review` seam since apiVersion 22: Claude Review is core — review/agent-context.ts.)
|
|
290
|
-
// The merge-conflict resolver's per-hunk seam — still LOCAL ONLY, but ⚠ NO LONGER FOR THE
|
|
291
|
-
// REASON IT WAS. The original argument was that cloud had no session to address, because the
|
|
292
|
-
// six core resolver routes were registered behind `!config.isCloud`. They are now registered
|
|
293
|
-
// UNCONDITIONALLY and cloud sessions are real, so that argument is retired: this is now an
|
|
294
|
-
// OPEN PRODUCT DECISION about a paid AI route, not a structural impossibility. Enabling it in
|
|
295
|
-
// cloud means a per-hunk LLM call billed per tenant, so it wants the same deliberate gating
|
|
296
|
-
// the other advanced-AI surfaces get — decide it there, not by deleting this line.
|
|
297
|
-
// (The plugin's per-hunk conflict suggestion that read this seam is REMOVED; the optional
|
|
298
|
-
// seam stays on the contract, unread, so `apiVersion` did not move.)
|
|
299
|
-
conflicts: config.isCloud ? undefined : makeConflictSeam(),
|
|
300
|
-
};
|
|
301
|
-
try {
|
|
302
|
-
setProCapabilities(await plugin.register(app, ctx));
|
|
303
|
-
app.log.info('pro plugin active');
|
|
304
|
-
}
|
|
305
|
-
catch (err) {
|
|
306
|
-
app.log.warn({ err }, 'pro register() failed — OSS mode');
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
//# sourceMappingURL=bind.js.map
|
package/dist/pro/contract.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// The live capability singleton, mirrored to the frontend via /api/me exactly
|
|
2
|
-
// like claudeReviewEnabled. All-false in OSS mode (no plugin ever calls the
|
|
3
|
-
// setter).
|
|
4
|
-
export const EMPTY_CAPABILITIES = {
|
|
5
|
-
activityDigest: false,
|
|
6
|
-
prSummary: false,
|
|
7
|
-
workspaceInsights: false,
|
|
8
|
-
slackDigest: false,
|
|
9
|
-
botTriage: false,
|
|
10
|
-
botAdvisor: false,
|
|
11
|
-
periodReports: false,
|
|
12
|
-
botDepth: false,
|
|
13
|
-
workPlan: false,
|
|
14
|
-
};
|
|
15
|
-
let active = EMPTY_CAPABILITIES;
|
|
16
|
-
export function setProCapabilities(c) {
|
|
17
|
-
active = c;
|
|
18
|
-
}
|
|
19
|
-
export function getProCapabilities() {
|
|
20
|
-
return active;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The per-account ENTITLEMENT view of the capability singleton (the billing
|
|
24
|
-
* seam). The singleton says what the loaded plugin CAN do; this intersects it
|
|
25
|
-
* with what the account has PAID for: local accounts are always fully entitled
|
|
26
|
-
* (today's behavior, exactly), a cloud account is entitled once its plan is
|
|
27
|
-
* anything but 'free' (set by the Stripe webhook). Used by /api/me (the SPA
|
|
28
|
-
* honors the all-false shape as the plain OSS render path) and mirrored by the
|
|
29
|
-
* /api/pro/* 402 gate in api/plugins/auth.ts.
|
|
30
|
-
*/
|
|
31
|
-
export function entitledProCapabilities(account) {
|
|
32
|
-
return account.isLocal || account.plan !== 'free'
|
|
33
|
-
? getProCapabilities()
|
|
34
|
-
: EMPTY_CAPABILITIES;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=contract.js.map
|
package/dist/pro/event-hooks.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// ── HOST → PLUGIN EVENT HOOKS (`ProContext.registerEventHooks`, optional, no apiVersion bump) ─────
|
|
2
|
-
//
|
|
3
|
-
// Core announces two committed facts to the Pro plugin, which owns everything done with them
|
|
4
|
-
// (today: the Slack event signals, packages/pro/src/slack/signals.ts):
|
|
5
|
-
// • a Claude Review run SUCCEEDED — review/claude-review/manager.ts, after the run is stored;
|
|
6
|
-
// • a PR was SEEN merging live — sync/upsert.ts `persistPr`, AFTER its transaction commits.
|
|
7
|
-
//
|
|
8
|
-
// ⚠ FIRE-AND-FORGET, ALWAYS. Each emit returns void, never awaits the hook, and logs a failure: a
|
|
9
|
-
// Slack outage must never fail a review or a sync. The hooks receive ids only.
|
|
10
|
-
// ⚠ Inert in OSS (no plugin, nothing registered) — every emit is then a no-op.
|
|
11
|
-
let hooks = null;
|
|
12
|
-
let log = null;
|
|
13
|
-
export function registerProEventHooks(next, logger) {
|
|
14
|
-
hooks = next;
|
|
15
|
-
if (logger)
|
|
16
|
-
log = logger;
|
|
17
|
-
}
|
|
18
|
-
function fire(label, run) {
|
|
19
|
-
void Promise.resolve()
|
|
20
|
-
.then(run)
|
|
21
|
-
.catch((err) => {
|
|
22
|
-
log?.warn({ err }, `pro event hook ${label} failed`);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
export function emitClaudeReviewCompleted(e) {
|
|
26
|
-
const h = hooks?.onClaudeReviewCompleted;
|
|
27
|
-
if (h == null)
|
|
28
|
-
return;
|
|
29
|
-
fire('onClaudeReviewCompleted', () => h(e));
|
|
30
|
-
}
|
|
31
|
-
export function emitPullRequestMerged(e) {
|
|
32
|
-
const h = hooks?.onPullRequestMerged;
|
|
33
|
-
if (h == null)
|
|
34
|
-
return;
|
|
35
|
-
fire('onPullRequestMerged', () => h(e));
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=event-hooks.js.map
|
package/dist/pro/migrate.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { readdirSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { db, isPg } from '../db/client.js';
|
|
4
|
-
// Plugin migration runner (core-owned). The optional @pierre/pro plugin ships its
|
|
5
|
-
// OWN dual-dialect *.sql migrations and calls ctx.registerMigrations(sqliteFolder,
|
|
6
|
-
// pgFolder); core executes them here against the live connection.
|
|
7
|
-
//
|
|
8
|
-
// ⚠ THIS IS THE ONLY PLACE the raw DB driver / non-portable terminals are used,
|
|
9
|
-
// and it is strictly DDL + bookkeeping (CREATE TABLE / INSERT into pro_migrations)
|
|
10
|
-
// — never a data query. Everything else in the codebase MUST go through the
|
|
11
|
-
// portable async drizzle surface (.execute()/.returning().execute()).
|
|
12
|
-
export async function runPluginMigrations(sqliteFolder, pgFolder) {
|
|
13
|
-
const folder = isPg ? pgFolder : sqliteFolder;
|
|
14
|
-
// The raw driver behind drizzle: a node-postgres Pool (pg) or a better-sqlite3
|
|
15
|
-
// Database (sqlite). drizzle exposes it as `$client`.
|
|
16
|
-
const client = db.$client;
|
|
17
|
-
// Run a raw SQL string (possibly several statements). pg's Pool.query and
|
|
18
|
-
// better-sqlite3's Database.exec both accept multiple semicolon-separated
|
|
19
|
-
// statements in a single call.
|
|
20
|
-
const execRaw = async (sqlText) => {
|
|
21
|
-
if (isPg)
|
|
22
|
-
await client.query(sqlText);
|
|
23
|
-
else
|
|
24
|
-
client.exec(sqlText);
|
|
25
|
-
};
|
|
26
|
-
// Bookkeeping table — which plugin migrations have been applied.
|
|
27
|
-
await execRaw('CREATE TABLE IF NOT EXISTS pro_migrations (name text PRIMARY KEY, applied_at ' +
|
|
28
|
-
(isPg ? 'timestamptz' : 'integer') +
|
|
29
|
-
' NOT NULL)');
|
|
30
|
-
const files = readdirSync(folder)
|
|
31
|
-
.filter((f) => f.endsWith('.sql'))
|
|
32
|
-
.sort();
|
|
33
|
-
for (const name of files) {
|
|
34
|
-
try {
|
|
35
|
-
let applied;
|
|
36
|
-
if (isPg) {
|
|
37
|
-
const r = await client.query('SELECT 1 FROM pro_migrations WHERE name=$1', [name]);
|
|
38
|
-
applied = r.rowCount > 0;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const row = client
|
|
42
|
-
.prepare('SELECT 1 FROM pro_migrations WHERE name=?')
|
|
43
|
-
.get(name);
|
|
44
|
-
applied = !!row;
|
|
45
|
-
}
|
|
46
|
-
if (applied)
|
|
47
|
-
continue;
|
|
48
|
-
const text = readFileSync(join(folder, name), 'utf8');
|
|
49
|
-
await execRaw(text);
|
|
50
|
-
if (isPg) {
|
|
51
|
-
await client.query('INSERT INTO pro_migrations(name,applied_at) VALUES($1,$2)', [name, new Date()]);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
client
|
|
55
|
-
.prepare('INSERT INTO pro_migrations(name,applied_at) VALUES(?,?)')
|
|
56
|
-
.run(name, Date.now());
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
catch (err) {
|
|
60
|
-
throw new Error(`pro migration '${name}' failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=migrate.js.map
|
package/dist/review/events.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const listeners = new Set();
|
|
2
|
-
export const reviewEvents = {
|
|
3
|
-
on(listener) {
|
|
4
|
-
listeners.add(listener);
|
|
5
|
-
return () => {
|
|
6
|
-
listeners.delete(listener);
|
|
7
|
-
};
|
|
8
|
-
},
|
|
9
|
-
emit(e) {
|
|
10
|
-
// A subscriber error must NEVER break the review route that emitted, so each
|
|
11
|
-
// call is isolated; we deliberately swallow (log nothing) rather than throw.
|
|
12
|
-
for (const listener of listeners) {
|
|
13
|
-
try {
|
|
14
|
-
listener(e);
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
/* a subscriber failure must not surface to the emitter */
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
// (The learnings-provider registry that lived here is gone: Claude Review's memory is core since
|
|
23
|
-
// apiVersion 22, so the manager calls review/memory/retrieval.ts `buildLearningsContext` directly.)
|
|
24
|
-
//# sourceMappingURL=events.js.map
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, } from 'node:fs';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { config } from '../config.js';
|
|
4
|
-
// Local-only settings store for the Claude Review feature, persisted to
|
|
5
|
-
// ~/.limn/config.json (mode 0600; `config.dataDir`). NEVER read or written in cloud mode
|
|
6
|
-
// — the file lives on the user's machine.
|
|
7
|
-
//
|
|
8
|
-
// ⚠ IT NO LONGER HOLDS A CREDENTIAL. The BYO Anthropic key this file existed for is
|
|
9
|
-
// RETIRED: local Claude Review resolves auth from an ambient Claude session first (so a
|
|
10
|
-
// subscription pays rather than a meter) and otherwise leaves the environment's
|
|
11
|
-
// ANTHROPIC_API_KEY in place — two rungs, in review/auth.ts. There is no reader, no
|
|
12
|
-
// writer, no route and no form.
|
|
13
|
-
//
|
|
14
|
-
// ⚠ AN ALREADY-STORED `anthropicApiKey` IS LEFT ON DISK, UNTOUCHED. The decision was to
|
|
15
|
-
// stop READING it, not to destroy somebody's file — and `write()` below rewrites the whole
|
|
16
|
-
// object it read, so the field round-trips through a budget save rather than being dropped.
|
|
17
|
-
// `LocalSettings` deliberately does NOT declare it: an undeclared field is never read and
|
|
18
|
-
// never assigned, which is exactly what "retired" means here (the same treatment the plugin
|
|
19
|
-
// gives a dormant column). Do not re-add a reader, and do not add an eraser — an eraser is a
|
|
20
|
-
// write path back.
|
|
21
|
-
//
|
|
22
|
-
// What is still LIVE is `maxReviewBudgetUsd`, below: the per-review USD ceiling behind
|
|
23
|
-
// ReviewBudgetPanel, PUT /api/claude-review/budget and getEffectiveReviewBudget().
|
|
24
|
-
const FILE = join(config.dataDir, 'config.json');
|
|
25
|
-
// Bounds on the user-set per-review budget cap. The MAX is the hard product ceiling the
|
|
26
|
-
// user can never exceed; the MIN keeps them from setting a value so low that every review
|
|
27
|
-
// trips `error_max_budget_usd` and fails-yet-still-bills (see config.reviewBudgetUsd docs).
|
|
28
|
-
export const MIN_REVIEW_BUDGET_USD = 0.5;
|
|
29
|
-
export const MAX_REVIEW_BUDGET_USD = 5;
|
|
30
|
-
function read() {
|
|
31
|
-
try {
|
|
32
|
-
if (!existsSync(FILE))
|
|
33
|
-
return {};
|
|
34
|
-
return JSON.parse(readFileSync(FILE, 'utf8'));
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function write(settings) {
|
|
41
|
-
mkdirSync(dirname(FILE), { recursive: true });
|
|
42
|
-
writeFileSync(FILE, JSON.stringify(settings, null, 2) + '\n', { mode: 0o600 });
|
|
43
|
-
}
|
|
44
|
-
const clampBudget = (n) => Math.min(Math.max(n, MIN_REVIEW_BUDGET_USD), MAX_REVIEW_BUDGET_USD);
|
|
45
|
-
// The user's personal per-review budget cap, or null if unset (local mode only). Clamped
|
|
46
|
-
// defensively on read too, in case the config file was hand-edited out of range.
|
|
47
|
-
export function getUserReviewBudget() {
|
|
48
|
-
if (config.isCloud)
|
|
49
|
-
return null;
|
|
50
|
-
const v = read().maxReviewBudgetUsd;
|
|
51
|
-
if (typeof v !== 'number' || !Number.isFinite(v) || v <= 0)
|
|
52
|
-
return null;
|
|
53
|
-
return clampBudget(v);
|
|
54
|
-
}
|
|
55
|
-
// The budget actually handed to a review run: the user's cap if set, else the operator
|
|
56
|
-
// default. (Only the user's cap is bounded to [MIN, MAX]; an operator who raised
|
|
57
|
-
// REVIEW_BUDGET_USD past MAX via env keeps that value when the user hasn't overridden it.)
|
|
58
|
-
export function getEffectiveReviewBudget() {
|
|
59
|
-
return getUserReviewBudget() ?? config.reviewBudgetUsd;
|
|
60
|
-
}
|
|
61
|
-
// Set (a positive number, clamped to [MIN, MAX]) or clear (null / non-positive) the cap.
|
|
62
|
-
export function setUserReviewBudget(usd) {
|
|
63
|
-
if (config.isCloud)
|
|
64
|
-
return;
|
|
65
|
-
const settings = read();
|
|
66
|
-
if (usd != null && Number.isFinite(usd) && usd > 0) {
|
|
67
|
-
settings.maxReviewBudgetUsd = clampBudget(usd);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
delete settings.maxReviewBudgetUsd;
|
|
71
|
-
}
|
|
72
|
-
write(settings);
|
|
73
|
-
}
|
|
74
|
-
// NOTE: the per-run env handling for Claude Review lives in review/auth.ts as
|
|
75
|
-
// `applyClaudeReviewAuth` (it implements the prefer-ambient policy and needs the
|
|
76
|
-
// ambient-session probe). With the stored key retired, that ladder is two rungs and this
|
|
77
|
-
// module holds no credential at all — only the budget.
|
|
78
|
-
//# sourceMappingURL=local-settings.js.map
|
|
Binary file
|