opencode-self-improvement 0.15.4 → 0.15.5
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 +2 -2
- package/src/capture/candidates.ts +110 -0
- package/src/capture/lag.ts +18 -0
- package/src/capture/prompt.ts +50 -0
- package/src/capture/transcript.ts +59 -0
- package/src/{triggers.ts → capture/triggers.ts} +6 -5
- package/src/{command.ts → command/ensure.ts} +2 -2
- package/src/{consolidate.ts → consolidate/propose.ts} +7 -30
- package/src/consolidate/render.ts +30 -0
- package/src/core/cmp-ts.ts +16 -0
- package/src/core/config/budgets.ts +28 -0
- package/src/{config.ts → core/config/paths.ts} +1 -30
- package/src/core/logfmt/format.ts +82 -0
- package/src/{logfmt.ts → core/logfmt/publish.ts} +3 -92
- package/src/core/logfmt/read.ts +15 -0
- package/src/{state.ts → core/state.ts} +1 -1
- package/src/core/time.ts +6 -0
- package/src/{evidence.ts → evidence/record.ts} +7 -5
- package/src/{gates.ts → gate/gate.ts} +19 -21
- package/src/{resolver.ts → gate/resolver.ts} +1 -1
- package/src/{hits.ts → hits/ledger.ts} +8 -6
- package/src/index.ts +64 -943
- package/src/init/detect.ts +144 -0
- package/src/init/format.ts +25 -0
- package/src/init/run.ts +188 -0
- package/src/inject/anchor.ts +43 -0
- package/src/{attribution.ts → inject/attribution.ts} +2 -2
- package/src/inject/budget.ts +78 -0
- package/src/inject/digest.ts +89 -0
- package/src/{injection-epochs.ts → inject/epochs.ts} +15 -14
- package/src/inject/format.ts +32 -0
- package/src/inject/pull.ts +52 -0
- package/src/inject/version.ts +31 -0
- package/src/portable/decay.ts +20 -0
- package/src/portable/export.ts +194 -0
- package/src/portable/import.ts +173 -0
- package/src/recall/relevant.ts +72 -0
- package/src/recall/score.ts +106 -0
- package/src/recall/shared-terms.ts +15 -0
- package/src/status/format.ts +58 -0
- package/src/status/metrics.ts +65 -0
- package/src/status/payload.ts +143 -0
- package/src/status/report.ts +202 -0
- package/src/status/write.ts +102 -0
- package/src/{blocklist.ts → store/blocklist.ts} +4 -2
- package/src/store/files/append.ts +176 -0
- package/src/store/files/deletions.ts +31 -0
- package/src/store/files/load.ts +106 -0
- package/src/store/files/prune.ts +81 -0
- package/src/store/files/snapshots.ts +88 -0
- package/src/store/files/supersede.ts +123 -0
- package/src/store/files/target.ts +36 -0
- package/src/{lock.ts → store/lock.ts} +1 -1
- package/src/store/model/memory.ts +91 -0
- package/src/store/model/predicates.ts +12 -0
- package/src/store/model/visibility.ts +140 -0
- package/src/{prune.ts → store/prune.ts} +4 -3
- package/src/store/quarantine/release.ts +24 -0
- package/src/store/tombstones/rejection.ts +93 -0
- package/src/{tombstones.ts → store/tombstones/tombstone.ts} +12 -97
- package/src/{undo.ts → store/undo.ts} +6 -3
- package/src/tools/consolidate.ts +42 -0
- package/src/tools/decay.ts +83 -0
- package/src/tools/deps.ts +27 -0
- package/src/tools/evidence.ts +48 -0
- package/src/tools/export.ts +27 -0
- package/src/tools/forget.ts +23 -0
- package/src/tools/import.ts +57 -0
- package/src/tools/init.ts +30 -0
- package/src/tools/list.ts +36 -0
- package/src/tools/merge-review.ts +138 -0
- package/src/tools/recall.ts +72 -0
- package/src/tools/registry.ts +40 -0
- package/src/tools/remember.ts +49 -0
- package/src/{schema.ts → tools/schema.ts} +3 -3
- package/src/tools/status-tool.ts +59 -0
- package/src/tools/undo.ts +57 -0
- package/src/tools/update.ts +342 -0
- package/src/{tui.tsx → tui/panel.tsx} +7 -17
- package/src/viewer/mutate.ts +15 -15
- package/src/viewer/server.ts +10 -8
- package/tui.ts +1 -1
- package/src/capture.ts +0 -222
- package/src/init.ts +0 -333
- package/src/inject.ts +0 -471
- package/src/memory.ts +0 -851
- package/src/portable.ts +0 -379
- package/src/status.ts +0 -536
- /package/src/{sessions.ts → core/lru.ts} +0 -0
- /package/src/{runtime.ts → core/runtime.ts} +0 -0
- /package/src/{tokenize.ts → core/tokenize.ts} +0 -0
- /package/src/{types.ts → core/types.ts} +0 -0
- /package/src/{host.ts → identity/host-events.ts} +0 -0
- /package/src/{repokey.ts → identity/repokey.ts} +0 -0
- /package/src/{containment.ts → store/containment.ts} +0 -0
- /package/src/{quarantine.ts → store/quarantine/quarantine.ts} +0 -0
- /package/src/{sanitize.ts → store/sanitize.ts} +0 -0
- /package/src/{secrets.ts → store/secrets.ts} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// read — split from src/logfmt.ts (#168 domain restructure). Declaration bodies are unchanged.
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
export async function readLines(file: string): Promise<string[]> {
|
|
5
|
+
// BunFile.exists() and .size cache the size; a later text() can crop a larger
|
|
6
|
+
// atomic replacement. Read metadata and bytes through one handle instead.
|
|
7
|
+
let text: string;
|
|
8
|
+
try {
|
|
9
|
+
text = await readFile(file, "utf8");
|
|
10
|
+
} catch (err) {
|
|
11
|
+
if ((err as NodeJS.ErrnoException).code === "ENOENT") return [];
|
|
12
|
+
throw err;
|
|
13
|
+
}
|
|
14
|
+
return text.split("\n").filter((l) => l.trim().length > 0);
|
|
15
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Per-session in-memory state shared by the hooks and the gate pipeline.
|
|
2
2
|
// Deterministic: only tool results and tool invocations mutate it, never the
|
|
3
3
|
// model. Reset between scenario runs with resetState().
|
|
4
|
-
import { SESSION_CAP, SessionLru } from "./
|
|
4
|
+
import { SESSION_CAP, SessionLru } from "./lru.ts";
|
|
5
5
|
|
|
6
6
|
export interface ToolResult {
|
|
7
7
|
call: string;
|
package/src/core/time.ts
ADDED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
import { existsSync, realpathSync } from "node:fs";
|
|
5
5
|
import { dirname, join, resolve } from "node:path";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { evidenceDir } from "../core/config/paths.ts"
|
|
8
|
+
import { dateStr } from "../core/time.ts";
|
|
9
|
+
import { formatLine } from "../core/logfmt/format.ts"
|
|
10
|
+
import { appendLog } from "../core/logfmt/publish.ts";
|
|
11
|
+
import { repoScope, sessionScope, type RepoScope } from "../identity/repokey.ts";
|
|
12
|
+
import { getCurrent } from "../core/state.ts";
|
|
13
|
+
import { redactSecrets } from "../store/secrets.ts";
|
|
12
14
|
|
|
13
15
|
export type EvidenceEvent = string;
|
|
14
16
|
|
|
@@ -2,25 +2,23 @@
|
|
|
2
2
|
// canonical-graph correctness, GATE-2 stale-ref scan + supersession, GATE-3
|
|
3
3
|
// dedup, GATE-4 promotion/block. Every step emits an ordered evidence line.
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import { isQuarantined, quarantineReasons } from "
|
|
6
|
-
import {
|
|
7
|
-
import { bracketList, parseLine
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from "
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { readerFromSid, UnresolvedWriterError, type Reader } from "./memory.ts";
|
|
23
|
-
import { writeTarget, type WriteTarget } from "./repokey.ts";
|
|
5
|
+
import { isQuarantined, quarantineReasons } from "../store/quarantine/quarantine.ts";
|
|
6
|
+
import { canonicalFile, memoryRoot } from "../core/config/paths.ts";
|
|
7
|
+
import { bracketList, parseLine } from "../core/logfmt/format.ts"
|
|
8
|
+
import { readLines } from "../core/logfmt/read.ts";
|
|
9
|
+
import { appendMemory } from "../store/files/append.ts"
|
|
10
|
+
import { loadScope } from "../store/files/load.ts"
|
|
11
|
+
import { snapshotFiles } from "../store/files/snapshots.ts"
|
|
12
|
+
import { markManySupersededReport, type SupersedeFields } from "../store/files/supersede.ts"
|
|
13
|
+
import { MAX_CONTENT_CHARS, type Memory } from "../store/model/memory.ts";
|
|
14
|
+
import { captureEvidenceContext, type EvidenceContext, chainId, contentHash, record, recordWriteBlocked } from "../evidence/record.ts";
|
|
15
|
+
import { getCurrent, noteAuthored } from "../core/state.ts";
|
|
16
|
+
import { MAX_WRITE_EVIDENCE_REFS } from "../capture/triggers.ts";
|
|
17
|
+
import { flattenMemoryText } from "../store/sanitize.ts";
|
|
18
|
+
import { containsSecret, redactSecrets } from "../store/secrets.ts";
|
|
19
|
+
import { UnresolvedWriterError } from "../store/files/append.ts"
|
|
20
|
+
import { readerFromSid, type Reader } from "../store/model/visibility.ts";
|
|
21
|
+
import { writeTarget, type WriteTarget } from "../identity/repokey.ts";
|
|
24
22
|
import {
|
|
25
23
|
displayCall,
|
|
26
24
|
extractCallForms,
|
|
@@ -31,8 +29,8 @@ import {
|
|
|
31
29
|
type DriftInfo,
|
|
32
30
|
type LazyTree,
|
|
33
31
|
} from "./resolver.ts";
|
|
34
|
-
import { STOPWORDS, jaccard, rawTokens, tokens } from "
|
|
35
|
-
import { probeRejection } from "
|
|
32
|
+
import { STOPWORDS, jaccard, rawTokens, tokens } from "../core/tokenize.ts";
|
|
33
|
+
import { probeRejection } from "../store/tombstones/rejection.ts";
|
|
36
34
|
|
|
37
35
|
export interface WriteCandidate {
|
|
38
36
|
type: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// regex + balanced-paren scanning, no model involvement.
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { opendir } from "node:fs/promises";
|
|
7
|
-
import { type Memory } from "
|
|
7
|
+
import { type Memory } from "../store/model/memory.ts";
|
|
8
8
|
|
|
9
9
|
export interface CallForm {
|
|
10
10
|
symbol: string;
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
// already exists inside that row.
|
|
17
17
|
import { readFile, stat } from "node:fs/promises";
|
|
18
18
|
import { join } from "node:path";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
import type {
|
|
24
|
-
import
|
|
19
|
+
import { HITS_FILENAME, memoryRoot } from "../core/config/paths.ts";
|
|
20
|
+
import { bracketList, formatLine, parseLine } from "../core/logfmt/format.ts"
|
|
21
|
+
import { appendLog, fileIdentity, writeAtomic } from "../core/logfmt/publish.ts"
|
|
22
|
+
import { readLines } from "../core/logfmt/read.ts";
|
|
23
|
+
import type { UseSignals } from "../recall/relevant.ts";
|
|
24
|
+
import { withStoreLock, LOCK_WRITE } from "../store/lock.ts";
|
|
25
|
+
import type { Memory } from "../store/model/memory.ts";
|
|
26
|
+
import type { ReadSet } from "../consolidate/propose.ts";
|
|
25
27
|
|
|
26
28
|
export type HitSource = "inject" | "pull" | "recall";
|
|
27
29
|
|