@afaik-lab/weigh 0.0.0 → 0.6.1
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/.env.example +49 -0
- package/LICENSE +373 -0
- package/README.md +103 -1
- package/dist/agent.d.ts +83 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +204 -0
- package/dist/agent.js.map +1 -0
- package/dist/ceilings.d.ts +32 -0
- package/dist/ceilings.d.ts.map +1 -0
- package/dist/ceilings.js +61 -0
- package/dist/ceilings.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +530 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-cli.d.ts +15 -0
- package/dist/config-cli.d.ts.map +1 -0
- package/dist/config-cli.js +141 -0
- package/dist/config-cli.js.map +1 -0
- package/dist/config.d.ts +198 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +373 -0
- package/dist/config.js.map +1 -0
- package/dist/context-cli.d.ts +35 -0
- package/dist/context-cli.d.ts.map +1 -0
- package/dist/context-cli.js +251 -0
- package/dist/context-cli.js.map +1 -0
- package/dist/context.d.ts +118 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +159 -0
- package/dist/context.js.map +1 -0
- package/dist/corrections/correction-set.d.ts +67 -0
- package/dist/corrections/correction-set.d.ts.map +1 -0
- package/dist/corrections/correction-set.js +104 -0
- package/dist/corrections/correction-set.js.map +1 -0
- package/dist/corrections/correction.d.ts +74 -0
- package/dist/corrections/correction.d.ts.map +1 -0
- package/dist/corrections/correction.js +154 -0
- package/dist/corrections/correction.js.map +1 -0
- package/dist/corrections/follow-up.d.ts +69 -0
- package/dist/corrections/follow-up.d.ts.map +1 -0
- package/dist/corrections/follow-up.js +217 -0
- package/dist/corrections/follow-up.js.map +1 -0
- package/dist/corrections/index.d.ts +31 -0
- package/dist/corrections/index.d.ts.map +1 -0
- package/dist/corrections/index.js +31 -0
- package/dist/corrections/index.js.map +1 -0
- package/dist/corrections/ledger.d.ts +78 -0
- package/dist/corrections/ledger.d.ts.map +1 -0
- package/dist/corrections/ledger.js +117 -0
- package/dist/corrections/ledger.js.map +1 -0
- package/dist/corrections/promotion.d.ts +119 -0
- package/dist/corrections/promotion.d.ts.map +1 -0
- package/dist/corrections/promotion.js +221 -0
- package/dist/corrections/promotion.js.map +1 -0
- package/dist/corrections/schema.d.ts +125 -0
- package/dist/corrections/schema.d.ts.map +1 -0
- package/dist/corrections/schema.js +100 -0
- package/dist/corrections/schema.js.map +1 -0
- package/dist/corrections-cli.d.ts +28 -0
- package/dist/corrections-cli.d.ts.map +1 -0
- package/dist/corrections-cli.js +157 -0
- package/dist/corrections-cli.js.map +1 -0
- package/dist/diff.d.ts +105 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +202 -0
- package/dist/diff.js.map +1 -0
- package/dist/doctor.d.ts +38 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +197 -0
- package/dist/doctor.js.map +1 -0
- package/dist/events.d.ts +21 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +5 -0
- package/dist/events.js.map +1 -0
- package/dist/findings.d.ts +510 -0
- package/dist/findings.d.ts.map +1 -0
- package/dist/findings.js +645 -0
- package/dist/findings.js.map +1 -0
- package/dist/follow-up-cli.d.ts +88 -0
- package/dist/follow-up-cli.d.ts.map +1 -0
- package/dist/follow-up-cli.js +208 -0
- package/dist/follow-up-cli.js.map +1 -0
- package/dist/harness.d.ts +64 -0
- package/dist/harness.d.ts.map +1 -0
- package/dist/harness.js +71 -0
- package/dist/harness.js.map +1 -0
- package/dist/help/command-help.d.ts +9 -0
- package/dist/help/command-help.d.ts.map +1 -0
- package/dist/help/command-help.js +21 -0
- package/dist/help/command-help.js.map +1 -0
- package/dist/help/commands/answer.d.ts +3 -0
- package/dist/help/commands/answer.d.ts.map +1 -0
- package/dist/help/commands/answer.js +39 -0
- package/dist/help/commands/answer.js.map +1 -0
- package/dist/help/commands/config.d.ts +3 -0
- package/dist/help/commands/config.d.ts.map +1 -0
- package/dist/help/commands/config.js +25 -0
- package/dist/help/commands/config.js.map +1 -0
- package/dist/help/commands/context.d.ts +3 -0
- package/dist/help/commands/context.d.ts.map +1 -0
- package/dist/help/commands/context.js +44 -0
- package/dist/help/commands/context.js.map +1 -0
- package/dist/help/commands/corrections.d.ts +3 -0
- package/dist/help/commands/corrections.d.ts.map +1 -0
- package/dist/help/commands/corrections.js +30 -0
- package/dist/help/commands/corrections.js.map +1 -0
- package/dist/help/commands/doctor.d.ts +3 -0
- package/dist/help/commands/doctor.d.ts.map +1 -0
- package/dist/help/commands/doctor.js +12 -0
- package/dist/help/commands/doctor.js.map +1 -0
- package/dist/help/commands/index.d.ts +4 -0
- package/dist/help/commands/index.d.ts.map +1 -0
- package/dist/help/commands/index.js +27 -0
- package/dist/help/commands/index.js.map +1 -0
- package/dist/help/commands/memory.d.ts +3 -0
- package/dist/help/commands/memory.d.ts.map +1 -0
- package/dist/help/commands/memory.js +33 -0
- package/dist/help/commands/memory.js.map +1 -0
- package/dist/help/commands/models.d.ts +3 -0
- package/dist/help/commands/models.d.ts.map +1 -0
- package/dist/help/commands/models.js +17 -0
- package/dist/help/commands/models.js.map +1 -0
- package/dist/help/commands/options.d.ts +4 -0
- package/dist/help/commands/options.d.ts.map +1 -0
- package/dist/help/commands/options.js +13 -0
- package/dist/help/commands/options.js.map +1 -0
- package/dist/help/commands/review.d.ts +3 -0
- package/dist/help/commands/review.d.ts.map +1 -0
- package/dist/help/commands/review.js +50 -0
- package/dist/help/commands/review.js.map +1 -0
- package/dist/help/commands/sessions.d.ts +3 -0
- package/dist/help/commands/sessions.d.ts.map +1 -0
- package/dist/help/commands/sessions.js +23 -0
- package/dist/help/commands/sessions.js.map +1 -0
- package/dist/help/commands/show.d.ts +3 -0
- package/dist/help/commands/show.d.ts.map +1 -0
- package/dist/help/commands/show.js +18 -0
- package/dist/help/commands/show.js.map +1 -0
- package/dist/help/help.d.ts +16 -0
- package/dist/help/help.d.ts.map +1 -0
- package/dist/help/help.js +68 -0
- package/dist/help/help.js.map +1 -0
- package/dist/help/index.d.ts +4 -0
- package/dist/help/index.d.ts.map +1 -0
- package/dist/help/index.js +7 -0
- package/dist/help/index.js.map +1 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge/block.d.ts +65 -0
- package/dist/knowledge/block.d.ts.map +1 -0
- package/dist/knowledge/block.js +89 -0
- package/dist/knowledge/block.js.map +1 -0
- package/dist/knowledge/claim.d.ts +143 -0
- package/dist/knowledge/claim.d.ts.map +1 -0
- package/dist/knowledge/claim.js +303 -0
- package/dist/knowledge/claim.js.map +1 -0
- package/dist/knowledge/index.d.ts +32 -0
- package/dist/knowledge/index.d.ts.map +1 -0
- package/dist/knowledge/index.js +29 -0
- package/dist/knowledge/index.js.map +1 -0
- package/dist/knowledge/novelty.d.ts +65 -0
- package/dist/knowledge/novelty.d.ts.map +1 -0
- package/dist/knowledge/novelty.js +100 -0
- package/dist/knowledge/novelty.js.map +1 -0
- package/dist/knowledge/recall.d.ts +134 -0
- package/dist/knowledge/recall.d.ts.map +1 -0
- package/dist/knowledge/recall.js +229 -0
- package/dist/knowledge/recall.js.map +1 -0
- package/dist/knowledge/recalled-claim.d.ts +35 -0
- package/dist/knowledge/recalled-claim.d.ts.map +1 -0
- package/dist/knowledge/recalled-claim.js +67 -0
- package/dist/knowledge/recalled-claim.js.map +1 -0
- package/dist/knowledge/recalled.d.ts +70 -0
- package/dist/knowledge/recalled.d.ts.map +1 -0
- package/dist/knowledge/recalled.js +149 -0
- package/dist/knowledge/recalled.js.map +1 -0
- package/dist/knowledge/schema.d.ts +83 -0
- package/dist/knowledge/schema.d.ts.map +1 -0
- package/dist/knowledge/schema.js +96 -0
- package/dist/knowledge/schema.js.map +1 -0
- package/dist/knowledge/staleness.d.ts +48 -0
- package/dist/knowledge/staleness.d.ts.map +1 -0
- package/dist/knowledge/staleness.js +85 -0
- package/dist/knowledge/staleness.js.map +1 -0
- package/dist/knowledge/store.d.ts +100 -0
- package/dist/knowledge/store.d.ts.map +1 -0
- package/dist/knowledge/store.js +184 -0
- package/dist/knowledge/store.js.map +1 -0
- package/dist/memory/compose-file.d.ts +14 -0
- package/dist/memory/compose-file.d.ts.map +1 -0
- package/dist/memory/compose-file.js +25 -0
- package/dist/memory/compose-file.js.map +1 -0
- package/dist/memory/index.d.ts +43 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +119 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/oss.d.ts +62 -0
- package/dist/memory/oss.d.ts.map +1 -0
- package/dist/memory/oss.js +230 -0
- package/dist/memory/oss.js.map +1 -0
- package/dist/memory/platform.d.ts +37 -0
- package/dist/memory/platform.d.ts.map +1 -0
- package/dist/memory/platform.js +131 -0
- package/dist/memory/platform.js.map +1 -0
- package/dist/memory/scope.d.ts +49 -0
- package/dist/memory/scope.d.ts.map +1 -0
- package/dist/memory/scope.js +70 -0
- package/dist/memory/scope.js.map +1 -0
- package/dist/memory/types.d.ts +113 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +18 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/memory-cli.d.ts +17 -0
- package/dist/memory-cli.d.ts.map +1 -0
- package/dist/memory-cli.js +107 -0
- package/dist/memory-cli.js.map +1 -0
- package/dist/models-cli.d.ts +12 -0
- package/dist/models-cli.d.ts.map +1 -0
- package/dist/models-cli.js +54 -0
- package/dist/models-cli.js.map +1 -0
- package/dist/models.d.ts +111 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +228 -0
- package/dist/models.js.map +1 -0
- package/dist/paths.d.ts +35 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +65 -0
- package/dist/paths.js.map +1 -0
- package/dist/profile.d.ts +28 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +154 -0
- package/dist/profile.js.map +1 -0
- package/dist/progress.d.ts +70 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +132 -0
- package/dist/progress.js.map +1 -0
- package/dist/quiet.d.ts +2 -0
- package/dist/quiet.d.ts.map +1 -0
- package/dist/quiet.js +21 -0
- package/dist/quiet.js.map +1 -0
- package/dist/reconcile/continuation.d.ts +132 -0
- package/dist/reconcile/continuation.d.ts.map +1 -0
- package/dist/reconcile/continuation.js +306 -0
- package/dist/reconcile/continuation.js.map +1 -0
- package/dist/reconcile/index.d.ts +26 -0
- package/dist/reconcile/index.d.ts.map +1 -0
- package/dist/reconcile/index.js +28 -0
- package/dist/reconcile/index.js.map +1 -0
- package/dist/reconcile/outcome-set.d.ts +53 -0
- package/dist/reconcile/outcome-set.d.ts.map +1 -0
- package/dist/reconcile/outcome-set.js +124 -0
- package/dist/reconcile/outcome-set.js.map +1 -0
- package/dist/reconcile/outcome.d.ts +56 -0
- package/dist/reconcile/outcome.d.ts.map +1 -0
- package/dist/reconcile/outcome.js +60 -0
- package/dist/reconcile/outcome.js.map +1 -0
- package/dist/reconcile/reconciliation.d.ts +49 -0
- package/dist/reconcile/reconciliation.d.ts.map +1 -0
- package/dist/reconcile/reconciliation.js +88 -0
- package/dist/reconcile/reconciliation.js.map +1 -0
- package/dist/reconcile/schema.d.ts +157 -0
- package/dist/reconcile/schema.d.ts.map +1 -0
- package/dist/reconcile/schema.js +97 -0
- package/dist/reconcile/schema.js.map +1 -0
- package/dist/record/index.d.ts +23 -0
- package/dist/record/index.d.ts.map +1 -0
- package/dist/record/index.js +25 -0
- package/dist/record/index.js.map +1 -0
- package/dist/record/review-record.d.ts +28 -0
- package/dist/record/review-record.d.ts.map +1 -0
- package/dist/record/review-record.js +78 -0
- package/dist/record/review-record.js.map +1 -0
- package/dist/record/schema.d.ts +153 -0
- package/dist/record/schema.d.ts.map +1 -0
- package/dist/record/schema.js +87 -0
- package/dist/record/schema.js.map +1 -0
- package/dist/record/store.d.ts +83 -0
- package/dist/record/store.d.ts.map +1 -0
- package/dist/record/store.js +162 -0
- package/dist/record/store.js.map +1 -0
- package/dist/record/stored-review.d.ts +36 -0
- package/dist/record/stored-review.d.ts.map +1 -0
- package/dist/record/stored-review.js +90 -0
- package/dist/record/stored-review.js.map +1 -0
- package/dist/refute.d.ts +318 -0
- package/dist/refute.d.ts.map +1 -0
- package/dist/refute.js +513 -0
- package/dist/refute.js.map +1 -0
- package/dist/render.d.ts +212 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +544 -0
- package/dist/render.js.map +1 -0
- package/dist/review-cli.d.ts +181 -0
- package/dist/review-cli.d.ts.map +1 -0
- package/dist/review-cli.js +598 -0
- package/dist/review-cli.js.map +1 -0
- package/dist/reviewer.d.ts +297 -0
- package/dist/reviewer.d.ts.map +1 -0
- package/dist/reviewer.js +584 -0
- package/dist/reviewer.js.map +1 -0
- package/dist/session-cli.d.ts +17 -0
- package/dist/session-cli.d.ts.map +1 -0
- package/dist/session-cli.js +62 -0
- package/dist/session-cli.js.map +1 -0
- package/dist/session.d.ts +36 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +105 -0
- package/dist/session.js.map +1 -0
- package/dist/settings.d.ts +68 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +175 -0
- package/dist/settings.js.map +1 -0
- package/dist/show-cli.d.ts +39 -0
- package/dist/show-cli.d.ts.map +1 -0
- package/dist/show-cli.js +56 -0
- package/dist/show-cli.js.map +1 -0
- package/dist/stdout.d.ts +28 -0
- package/dist/stdout.d.ts.map +1 -0
- package/dist/stdout.js +44 -0
- package/dist/stdout.js.map +1 -0
- package/dist/target.d.ts +58 -0
- package/dist/target.d.ts.map +1 -0
- package/dist/target.js +96 -0
- package/dist/target.js.map +1 -0
- package/dist/tools/index.d.ts +93 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +146 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/root.d.ts +62 -0
- package/dist/tools/root.d.ts.map +1 -0
- package/dist/tools/root.js +51 -0
- package/dist/tools/root.js.map +1 -0
- package/dist/usage.d.ts +75 -0
- package/dist/usage.d.ts.map +1 -0
- package/dist/usage.js +100 -0
- package/dist/usage.js.map +1 -0
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +26 -0
- package/dist/version.js.map +1 -0
- package/dist/workspace.d.ts +48 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +126 -0
- package/dist/workspace.js.map +1 -0
- package/docker-compose.yml +61 -0
- package/package.json +72 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
/**
|
|
5
|
+
* Library entry point.
|
|
6
|
+
*
|
|
7
|
+
* import { loadConfig, runAgent } from '@afaik-lab/weigh';
|
|
8
|
+
*
|
|
9
|
+
* const config = loadConfig({ maxSteps: 10 });
|
|
10
|
+
* const { text } = await runAgent(config, 'What is in this repo?');
|
|
11
|
+
*/
|
|
12
|
+
export { runAgent, runAgentWithRetry } from './agent.js';
|
|
13
|
+
export { loadConfig } from './config.js';
|
|
14
|
+
export { paths, weighHome, ensureDir } from './paths.js';
|
|
15
|
+
export { loadWeighEnv, parseEnvFile, loadConfigDetailed } from './config.js';
|
|
16
|
+
export { SETTINGS, OWNED_ENV_KEYS, isOwnedEnvKey } from './settings.js';
|
|
17
|
+
export { runConfigCommand, isConfigVerb } from './config-cli.js';
|
|
18
|
+
export { runDoctor } from './doctor.js';
|
|
19
|
+
export { READ_ONLY_TOOLS, WITHHELD_TOOLS, ToolGuard } from './tools/index.js';
|
|
20
|
+
export { confine, display, describeArgs } from './tools/root.js';
|
|
21
|
+
export { harnessOptions } from './harness.js';
|
|
22
|
+
export { resolveTarget } from './target.js';
|
|
23
|
+
export { MODELS, FLOATING, ModelCatalogue, resolveModel, describeModels, refreshCatalogue, isStale, STALE_AFTER_MS } from './models.js';
|
|
24
|
+
export { runModelsCommand } from './models-cli.js';
|
|
25
|
+
export { SEVERITIES, SEVERITY_ORDER, VERDICTS, Verdict, CATEGORIES, reportedFindingSchema, reviewOutputSchema, DECISIONS, GROUNDS, rulingSchema, refuteOutputSchema, strictJsonSchema, evidenceSchema, CodeAnchor, Finding, FindingSet, WorkspaceFiles, StaticFiles, } from './findings.js';
|
|
26
|
+
export { readProfile } from './profile.js';
|
|
27
|
+
export { buildContext, renderContext } from './context.js';
|
|
28
|
+
export { ReviewCommand, runReviewCommand } from './review-cli.js';
|
|
29
|
+
export { Reviewer, CoverageLedger, ReviewOutputParser } from './reviewer.js';
|
|
30
|
+
export { RECORD_VERSION, ReviewRecord, ReviewStore, StoredReview, reviewRecordSchema } from './record/index.js';
|
|
31
|
+
export { RECONCILED, Outcome, Reconciliation, outcomeSchema, reconciledSchema } from './reconcile/index.js';
|
|
32
|
+
export { RefuteBrief, RefuteOutcome, Refuter, RulingSet } from './refute.js';
|
|
33
|
+
export { Ceilings } from './ceilings.js';
|
|
34
|
+
export { Spend } from './usage.js';
|
|
35
|
+
export { writeOut } from './stdout.js';
|
|
36
|
+
export { Palette, ReviewRenderer, wrap, packSegments, ellipsise } from './render.js';
|
|
37
|
+
export { ProgressReporter } from './progress.js';
|
|
38
|
+
export { collectDiff, defaultBase, workingState } from './diff.js';
|
|
39
|
+
export { createWorkspace } from './workspace.js';
|
|
40
|
+
export { initSessionDir, loadSession, saveMessage, listSessions, newSessionPath, sessionId, summarizeSessions, pruneSessions, } from './session.js';
|
|
41
|
+
export { KINDS, SOURCES, Claim, Knowledge, KnowledgeBlock, Recall, Recalled, RecalledClaim, claimInputSchema, claimMetadataSchema, } from './knowledge/index.js';
|
|
42
|
+
export { isContextVerb, runContextCommand, CONTEXT_VERBS } from './context-cli.js';
|
|
43
|
+
// What a human said about a finding
|
|
44
|
+
export { CORRECTION_LABELS, CORRECTION_VERSION, LABEL_RULES, Correction, CorrectionSet, Corrections, FollowUp, Promotion, correctionSchema, } from './corrections/index.js';
|
|
45
|
+
export { FollowUpCommand, runFollowUpCommand } from './follow-up-cli.js';
|
|
46
|
+
export { isCorrectionVerb, runCorrectionsCommand, CORRECTION_VERBS } from './corrections-cli.js';
|
|
47
|
+
export { repoSlug } from './target.js';
|
|
48
|
+
export { Scope } from './memory/scope.js';
|
|
49
|
+
// Memory
|
|
50
|
+
export { createMemoryStore, resolveScope, recall, capture, formatMemories, NullMemoryStore, PlatformMemoryStore, OssMemoryStore, } from './memory/index.js';
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,c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2
|
+
import { RecalledClaim, type Mechanism } from './recalled-claim.js';
|
|
3
|
+
/**
|
|
4
|
+
* One labelled block of what Weigh knows, and the claims in it.
|
|
5
|
+
*
|
|
6
|
+
* The blocks exist because the facts are different in kind. What a repository
|
|
7
|
+
* is like, what has been said about this change, and how a particular person
|
|
8
|
+
* reviews are three different warrants, and a flat list invites the model to
|
|
9
|
+
* read a personal preference as a repository invariant. Keeping them apart also
|
|
10
|
+
* disposes of a problem that would otherwise need solving: three searches
|
|
11
|
+
* produce three score sets computed over different candidate pools, so nothing
|
|
12
|
+
* here is ever ranked against anything from another block.
|
|
13
|
+
*/
|
|
14
|
+
export declare class KnowledgeBlock {
|
|
15
|
+
/** The heading the model reads. */
|
|
16
|
+
readonly label: string;
|
|
17
|
+
/** One line under it saying what kind of fact this is. */
|
|
18
|
+
readonly note: string;
|
|
19
|
+
/**
|
|
20
|
+
* Which block gets the budget first.
|
|
21
|
+
*
|
|
22
|
+
* Lower goes first. The thread on this change leads, because a correction
|
|
23
|
+
* that does not reach the model is the silent failure this whole loop
|
|
24
|
+
* exists to prevent.
|
|
25
|
+
*/
|
|
26
|
+
readonly priority: number;
|
|
27
|
+
private readonly _found;
|
|
28
|
+
private readonly _seen;
|
|
29
|
+
/** How many entries fit the budget. All of them until `Recalled` says less. */
|
|
30
|
+
private _kept;
|
|
31
|
+
constructor(
|
|
32
|
+
/** The heading the model reads. */
|
|
33
|
+
label: string,
|
|
34
|
+
/** One line under it saying what kind of fact this is. */
|
|
35
|
+
note: string,
|
|
36
|
+
/**
|
|
37
|
+
* Which block gets the budget first.
|
|
38
|
+
*
|
|
39
|
+
* Lower goes first. The thread on this change leads, because a correction
|
|
40
|
+
* that does not reach the model is the silent failure this whole loop
|
|
41
|
+
* exists to prevent.
|
|
42
|
+
*/
|
|
43
|
+
priority: number);
|
|
44
|
+
/**
|
|
45
|
+
* Adds a claim, unless this block already has it.
|
|
46
|
+
*
|
|
47
|
+
* Four mechanisms can find the same claim, and the first one to find it is
|
|
48
|
+
* the one worth printing: "this is a rule of the house" is a better reason
|
|
49
|
+
* than "it scored 0.61 against a hunk".
|
|
50
|
+
*/
|
|
51
|
+
add(claim: Claim, mechanism: Mechanism, because?: string): void;
|
|
52
|
+
has(claim: Claim): boolean;
|
|
53
|
+
get size(): number;
|
|
54
|
+
get isEmpty(): boolean;
|
|
55
|
+
/** Everything found, budget or no budget. What calibration reads. */
|
|
56
|
+
get found(): readonly RecalledClaim[];
|
|
57
|
+
/** The claims that fit. */
|
|
58
|
+
get kept(): readonly RecalledClaim[];
|
|
59
|
+
/** How many were found and left out. Named in the block, never dropped silently. */
|
|
60
|
+
get dropped(): number;
|
|
61
|
+
/** Called once by `Recalled`, which owns the budget. */
|
|
62
|
+
keep(count: number): void;
|
|
63
|
+
toJSON(): Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/knowledge/block.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,qBAAa,cAAc;IAOvB,mCAAmC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAjB3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,+EAA+E;IAC/E,OAAO,CAAC,KAAK,CAAqB;IAElC;IACE,mCAAmC;IAC1B,KAAK,EAAE,MAAM;IACtB,0DAA0D;IACjD,IAAI,EAAE,MAAM;IACrB;;;;;;OAMG;IACM,QAAQ,EAAE,MAAM,EACvB;IAEJ;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAK9D;IAED,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEzB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,qEAAqE;IACrE,IAAI,KAAK,IAAI,SAAS,aAAa,EAAE,CAEpC;IAED,2BAA2B;IAC3B,IAAI,IAAI,IAAI,SAAS,aAAa,EAAE,CAEnC;IAED,oFAAoF;IACpF,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,wDAAwD;IACxD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAExB;IAED,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOhC;CACF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
import { RecalledClaim } from './recalled-claim.js';
|
|
5
|
+
/**
|
|
6
|
+
* One labelled block of what Weigh knows, and the claims in it.
|
|
7
|
+
*
|
|
8
|
+
* The blocks exist because the facts are different in kind. What a repository
|
|
9
|
+
* is like, what has been said about this change, and how a particular person
|
|
10
|
+
* reviews are three different warrants, and a flat list invites the model to
|
|
11
|
+
* read a personal preference as a repository invariant. Keeping them apart also
|
|
12
|
+
* disposes of a problem that would otherwise need solving: three searches
|
|
13
|
+
* produce three score sets computed over different candidate pools, so nothing
|
|
14
|
+
* here is ever ranked against anything from another block.
|
|
15
|
+
*/
|
|
16
|
+
export class KnowledgeBlock {
|
|
17
|
+
label;
|
|
18
|
+
note;
|
|
19
|
+
priority;
|
|
20
|
+
_found = [];
|
|
21
|
+
_seen = new Set();
|
|
22
|
+
/** How many entries fit the budget. All of them until `Recalled` says less. */
|
|
23
|
+
_kept;
|
|
24
|
+
constructor(
|
|
25
|
+
/** The heading the model reads. */
|
|
26
|
+
label,
|
|
27
|
+
/** One line under it saying what kind of fact this is. */
|
|
28
|
+
note,
|
|
29
|
+
/**
|
|
30
|
+
* Which block gets the budget first.
|
|
31
|
+
*
|
|
32
|
+
* Lower goes first. The thread on this change leads, because a correction
|
|
33
|
+
* that does not reach the model is the silent failure this whole loop
|
|
34
|
+
* exists to prevent.
|
|
35
|
+
*/
|
|
36
|
+
priority) {
|
|
37
|
+
this.label = label;
|
|
38
|
+
this.note = note;
|
|
39
|
+
this.priority = priority;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Adds a claim, unless this block already has it.
|
|
43
|
+
*
|
|
44
|
+
* Four mechanisms can find the same claim, and the first one to find it is
|
|
45
|
+
* the one worth printing: "this is a rule of the house" is a better reason
|
|
46
|
+
* than "it scored 0.61 against a hunk".
|
|
47
|
+
*/
|
|
48
|
+
add(claim, mechanism, because) {
|
|
49
|
+
const entry = new RecalledClaim(claim, mechanism, because);
|
|
50
|
+
if (this._seen.has(entry.key))
|
|
51
|
+
return;
|
|
52
|
+
this._seen.add(entry.key);
|
|
53
|
+
this._found.push(entry);
|
|
54
|
+
}
|
|
55
|
+
has(claim) {
|
|
56
|
+
return this._seen.has(claim.id ?? claim.statement);
|
|
57
|
+
}
|
|
58
|
+
get size() {
|
|
59
|
+
return this._found.length;
|
|
60
|
+
}
|
|
61
|
+
get isEmpty() {
|
|
62
|
+
return this._found.length === 0;
|
|
63
|
+
}
|
|
64
|
+
/** Everything found, budget or no budget. What calibration reads. */
|
|
65
|
+
get found() {
|
|
66
|
+
return this._found;
|
|
67
|
+
}
|
|
68
|
+
/** The claims that fit. */
|
|
69
|
+
get kept() {
|
|
70
|
+
return this._found.slice(0, this._kept ?? this._found.length);
|
|
71
|
+
}
|
|
72
|
+
/** How many were found and left out. Named in the block, never dropped silently. */
|
|
73
|
+
get dropped() {
|
|
74
|
+
return this._found.length - this.kept.length;
|
|
75
|
+
}
|
|
76
|
+
/** Called once by `Recalled`, which owns the budget. */
|
|
77
|
+
keep(count) {
|
|
78
|
+
this._kept = Math.max(0, Math.min(count, this._found.length));
|
|
79
|
+
}
|
|
80
|
+
toJSON() {
|
|
81
|
+
return {
|
|
82
|
+
label: this.label,
|
|
83
|
+
claims: this._found.map((entry) => entry.toJSON()),
|
|
84
|
+
kept: this.kept.length,
|
|
85
|
+
dropped: this.dropped,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.js","sourceRoot":"","sources":["../../src/knowledge/block.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAG5D,OAAO,EAAE,aAAa,EAAkB,MAAM,qBAAqB,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,cAAc;IAQd,KAAK;IAEL,IAAI;IAQJ,QAAQ;IAjBF,MAAM,GAAoB,EAAE,CAAC;IAC7B,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAC3C,+EAA+E;IACvE,KAAK,CAAqB;IAElC;IACE,mCAAmC;IAC1B,KAAa;IACtB,0DAA0D;IACjD,IAAY;IACrB;;;;;;OAMG;IACM,QAAgB;qBAVhB,KAAK;oBAEL,IAAI;wBAQJ,QAAQ;IAChB,CAAC;IAEJ;;;;;;OAMG;IACH,GAAG,CAAC,KAAY,EAAE,SAAoB,EAAE,OAAgB;QACtD,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;YAAE,OAAO;QACtC,IAAI,CAAC,KAAK,CAA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,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { MemoryRecord } from '../memory/index.js';
|
|
2
|
+
import { type ClaimMetadata, type ClaimSource, type Kind } from './schema.js';
|
|
3
|
+
/**
|
|
4
|
+
* One thing that is true of a repository.
|
|
5
|
+
*
|
|
6
|
+
* Stored as a memory whose text is what a search has to match against, with
|
|
7
|
+
* everything that makes it checkable in the metadata beside it. The text is
|
|
8
|
+
* therefore built for retrieval rather than for reading: the statement, the
|
|
9
|
+
* kind, and the paths the claim cites, because a change's meaning lives in its
|
|
10
|
+
* code and its files rather than in prose about them. The statement is read
|
|
11
|
+
* back out of the metadata, which leaves the text free to be tuned.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Claim {
|
|
14
|
+
readonly kind: Kind;
|
|
15
|
+
readonly statement: string;
|
|
16
|
+
readonly evidence: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Globs this claim governs, or `['*']` for a rule of the house.
|
|
19
|
+
*
|
|
20
|
+
* Empty is the common case and means "found by similarity alone". The
|
|
21
|
+
* marker is deliberate rather than a default because unglobbed-means-always
|
|
22
|
+
* does not survive a store with a few hundred claims in it — while a writer
|
|
23
|
+
* who forgets the marker still gets found by proximity, which is a claim
|
|
24
|
+
* arriving late rather than a claim going missing.
|
|
25
|
+
*/
|
|
26
|
+
readonly applies: readonly string[];
|
|
27
|
+
readonly confidence: number;
|
|
28
|
+
readonly source: ClaimSource;
|
|
29
|
+
readonly at: string;
|
|
30
|
+
readonly commit: string | undefined;
|
|
31
|
+
/** The store's own id, on a claim that was read back. */
|
|
32
|
+
readonly id: string | undefined;
|
|
33
|
+
/** Relevance, on a claim that came back from a search. */
|
|
34
|
+
readonly score: number | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The scope it was stored under, on a claim that was read back.
|
|
37
|
+
*
|
|
38
|
+
* Absent means it was written with no scope at all — what holds wherever
|
|
39
|
+
* this reviewer is working. Kept because a read at user scope filters on
|
|
40
|
+
* the user and nothing narrower, so it answers with every repository's
|
|
41
|
+
* claims too, and only the record itself says which it is.
|
|
42
|
+
*/
|
|
43
|
+
readonly scope: string | undefined;
|
|
44
|
+
/** When the claim was last found to still hold, and at which commit. */
|
|
45
|
+
readonly verified: {
|
|
46
|
+
commit: string;
|
|
47
|
+
at: string;
|
|
48
|
+
} | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* How close it is in meaning alone, on a claim that came back from a
|
|
51
|
+
* search, when the backend says. `score` may blend in keyword matches and
|
|
52
|
+
* is scaled by what else the search found, so it cannot be held to a fixed
|
|
53
|
+
* floor; this can.
|
|
54
|
+
*/
|
|
55
|
+
readonly similarity: number | undefined;
|
|
56
|
+
/** Compiled `applies` globs, built once per claim and only if asked for. */
|
|
57
|
+
private _globs;
|
|
58
|
+
private constructor();
|
|
59
|
+
/**
|
|
60
|
+
* Validates what a writer supplied and fills in what it left out.
|
|
61
|
+
*
|
|
62
|
+
* Throws rather than coercing: this is the one gate between a priming agent
|
|
63
|
+
* and the store, and a claim that is wrong about its own shape is the kind of
|
|
64
|
+
* thing that is only noticed months later, in a review that reads strangely.
|
|
65
|
+
*
|
|
66
|
+
* `head` is the commit the repository was at when the claim was written,
|
|
67
|
+
* used when the writer names none. It is what tells a claim that went stale
|
|
68
|
+
* from one that never held: the code it cites can be read at that commit.
|
|
69
|
+
*/
|
|
70
|
+
static parse(data: unknown, now?: Date, head?: string): Claim;
|
|
71
|
+
/**
|
|
72
|
+
* A stored memory read back as a claim, or nothing when it is not one.
|
|
73
|
+
*
|
|
74
|
+
* The store holds more than claims — the prompt path has been writing
|
|
75
|
+
* whatever it learned about its user into the same backend — so the metadata
|
|
76
|
+
* carries a marker and anything without it is left alone rather than
|
|
77
|
+
* guessed at.
|
|
78
|
+
*/
|
|
79
|
+
static fromRecord(record: MemoryRecord): Claim | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* This claim, found to still hold at `commit`.
|
|
82
|
+
*
|
|
83
|
+
* What a refresh records about a claim it read again and kept, so the next
|
|
84
|
+
* refresh does not read it again unless its files change after this.
|
|
85
|
+
*/
|
|
86
|
+
verifiedAt(commit: string, now?: Date): Claim;
|
|
87
|
+
/**
|
|
88
|
+
* The commit this claim was last known to hold at: when it was last
|
|
89
|
+
* verified, else when it was written. A change to its files after this is
|
|
90
|
+
* what makes it worth reading again.
|
|
91
|
+
*/
|
|
92
|
+
get knownAt(): string | undefined;
|
|
93
|
+
/** The files the evidence cites, without their line ranges. */
|
|
94
|
+
get cites(): string[];
|
|
95
|
+
/**
|
|
96
|
+
* Whether this claim is about anything under `prefix`, a path relative to
|
|
97
|
+
* the repository root.
|
|
98
|
+
*
|
|
99
|
+
* It is when it cites a file there, or when one of its globs could match a
|
|
100
|
+
* file there. A glob is compared by its literal head, the part before the
|
|
101
|
+
* first wildcard: `src/**` is about `src/knowledge`, and so is a house rule,
|
|
102
|
+
* which is about everything.
|
|
103
|
+
*/
|
|
104
|
+
touches(prefix: string): boolean;
|
|
105
|
+
private static _normalise;
|
|
106
|
+
/** `src/knowledge/**` → `src/knowledge`; `*` → ``. */
|
|
107
|
+
private static _literalHead;
|
|
108
|
+
/**
|
|
109
|
+
* The statement recovered from the stored text, for a record written before
|
|
110
|
+
* the statement was kept in the metadata. Takes the first line and strips the
|
|
111
|
+
* kind prefix; the evidence paths below it are not part of the sentence.
|
|
112
|
+
*/
|
|
113
|
+
private static statementOf;
|
|
114
|
+
/** A rule of the house: in every review of this repository, unsearched. */
|
|
115
|
+
get isHouseRule(): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Whether this claim governs a path.
|
|
118
|
+
*
|
|
119
|
+
* A guarantee rather than a ranking: a claim whose glob names the file under
|
|
120
|
+
* review reaches the review whatever a similarity score would have said
|
|
121
|
+
* about it. A double star crosses directories, a single one and `?` do not,
|
|
122
|
+
* and `{a,b}` is expanded — enough to write a glob over nested TypeScript
|
|
123
|
+
* sources and no more.
|
|
124
|
+
*/
|
|
125
|
+
appliesTo(path: string): boolean;
|
|
126
|
+
/** `a/{b,c}.ts` as the two globs it stands for. */
|
|
127
|
+
private static _expand;
|
|
128
|
+
private static _pattern;
|
|
129
|
+
/**
|
|
130
|
+
* What the store holds as the memory itself, and embeds.
|
|
131
|
+
*
|
|
132
|
+
* The paths are here because this string is the only part of a claim a
|
|
133
|
+
* vector search can see. A claim about an auth service embeds closer to a
|
|
134
|
+
* hunk that touches auth files when the file names travel with the sentence,
|
|
135
|
+
* and nothing is lost by it: the statement is read back from the metadata.
|
|
136
|
+
*/
|
|
137
|
+
text(): string;
|
|
138
|
+
metadata(): ClaimMetadata;
|
|
139
|
+
toJSON(): Record<string, unknown>;
|
|
140
|
+
/** One claim as `weigh context` prints it. */
|
|
141
|
+
describe(): string;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=claim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../src/knowledge/claim.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAyC,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAQrH;;;;;;;;;GASG;AACH,qBAAa,KAAK;IAKd,QAAQ,CAAC,IAAI,EAAE,IAAI;IACnB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE;IACpC;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM;IAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IACnC,yDAAyD;IACzD,QAAQ,CAAC,EAAE,EAAE,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