@nightloom/isy 1.0.4 → 1.0.6-next.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/README.md +18 -2
- package/dist/agents/claude.js +3 -2
- package/dist/agents/claude.js.map +1 -1
- package/dist/agents/codex.js +14 -5
- package/dist/agents/codex.js.map +1 -1
- package/dist/agents/index.d.ts +14 -10
- package/dist/agents/index.js +65 -15
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/kimi.js +26 -8
- package/dist/agents/kimi.js.map +1 -1
- package/dist/agents/types.d.ts +12 -3
- package/dist/api.d.ts +1 -0
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/commands/commit.d.ts +6 -0
- package/dist/commands/commit.js +326 -16
- package/dist/commands/commit.js.map +1 -1
- package/dist/commands/health.js +1 -1
- package/dist/commands/health.js.map +1 -1
- package/dist/commands/init.js +40 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +7 -4
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/upload.d.ts +8 -1
- package/dist/commands/upload.js +65 -48
- package/dist/commands/upload.js.map +1 -1
- package/dist/detectors.d.ts +32 -0
- package/dist/detectors.js +279 -72
- package/dist/detectors.js.map +1 -1
- package/dist/git.d.ts +52 -0
- package/dist/git.js +166 -9
- package/dist/git.js.map +1 -1
- package/dist/githook.d.ts +18 -7
- package/dist/githook.js +147 -17
- package/dist/githook.js.map +1 -1
- package/dist/hook.d.ts +22 -2
- package/dist/hook.js +28 -3
- package/dist/hook.js.map +1 -1
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/dist/mask-paths.d.ts +4 -3
- package/dist/mask-paths.js +4 -3
- package/dist/mask-paths.js.map +1 -1
- package/dist/parser.d.ts +58 -9
- package/dist/parser.js +337 -58
- package/dist/parser.js.map +1 -1
- package/dist/paths.d.ts +19 -1
- package/dist/paths.js +28 -3
- package/dist/paths.js.map +1 -1
- package/dist/redact.d.ts +2 -0
- package/dist/redact.js +987 -95
- package/dist/redact.js.map +1 -1
- package/dist/stage0.js +27 -8
- package/dist/stage0.js.map +1 -1
- package/dist/state.d.ts +15 -0
- package/dist/state.js +8 -0
- package/dist/state.js.map +1 -1
- package/dist/test/check.test.js +1 -1
- package/dist/test/check.test.js.map +1 -1
- package/dist/test/cli.test.js +11 -1
- package/dist/test/cli.test.js.map +1 -1
- package/dist/test/codex.test.js +27 -4
- package/dist/test/codex.test.js.map +1 -1
- package/dist/test/commit.test.js +1466 -6
- package/dist/test/commit.test.js.map +1 -1
- package/dist/test/e2e-harness.test.d.ts +1 -0
- package/dist/test/e2e-harness.test.js +53 -0
- package/dist/test/e2e-harness.test.js.map +1 -0
- package/dist/test/git.test.js +72 -2
- package/dist/test/git.test.js.map +1 -1
- package/dist/test/hook.test.js +138 -3
- package/dist/test/hook.test.js.map +1 -1
- package/dist/test/init.test.js +61 -2
- package/dist/test/init.test.js.map +1 -1
- package/dist/test/kimi-config.test.js +27 -5
- package/dist/test/kimi-config.test.js.map +1 -1
- package/dist/test/kimi-hook.test.js +1 -1
- package/dist/test/kimi-hook.test.js.map +1 -1
- package/dist/test/kimi-listing.test.js +42 -2
- package/dist/test/kimi-listing.test.js.map +1 -1
- package/dist/test/kimi.test.js +26 -2
- package/dist/test/kimi.test.js.map +1 -1
- package/dist/test/parser.test.js +527 -1
- package/dist/test/parser.test.js.map +1 -1
- package/dist/test/redact.test.js +2472 -14
- package/dist/test/redact.test.js.map +1 -1
- package/dist/test/stage0.test.js +617 -1
- package/dist/test/stage0.test.js.map +1 -1
- package/dist/test/sweep.test.js +110 -7
- package/dist/test/sweep.test.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/claude.ts +3 -2
- package/src/agents/codex.ts +14 -5
- package/src/agents/index.ts +71 -16
- package/src/agents/kimi.ts +28 -8
- package/src/agents/types.ts +12 -3
- package/src/api.ts +4 -2
- package/src/commands/commit.ts +354 -18
- package/src/commands/health.ts +1 -1
- package/src/commands/init.ts +45 -10
- package/src/commands/status.ts +9 -4
- package/src/commands/upload.ts +73 -63
- package/src/detectors.ts +284 -75
- package/src/git.ts +175 -9
- package/src/githook.ts +151 -19
- package/src/hook.ts +30 -3
- package/src/index.ts +25 -7
- package/src/mask-paths.ts +5 -4
- package/src/parser.ts +355 -51
- package/src/paths.ts +30 -3
- package/src/redact.ts +991 -98
- package/src/stage0.ts +28 -8
- package/src/state.ts +18 -0
package/src/stage0.ts
CHANGED
|
@@ -48,27 +48,47 @@ function order(a: Candidate, b: Candidate): number {
|
|
|
48
48
|
* script — has nothing to say to a pull request. Masking decides it the way the
|
|
49
49
|
* upload does: under the session's directory a path turns relative, under the
|
|
50
50
|
* home it turns `~/…`, and only what stays absolute lies outside both. The
|
|
51
|
-
* server reads transcripts already masked, `cwd` included (it reads `.`
|
|
52
|
-
* there the paths are judged as they are.
|
|
51
|
+
* server reads transcripts already masked, `cwd` included (it reads `.` or a
|
|
52
|
+
* subdirectory), so there the paths are judged as they are.
|
|
53
53
|
*
|
|
54
|
-
* ponytail: a
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* ponytail: a transcript masked with no repository to root at — by `isy
|
|
55
|
+
* analyze`, or by a client older than that rooting — from a session started in
|
|
56
|
+
* a subdirectory of a repository outside the home, loses findings on sibling
|
|
57
|
+
* directories. Pass `git.ts:maskRootsFor` to `isy analyze` if that shows up.
|
|
57
58
|
*/
|
|
58
59
|
function inTree(candidate: Candidate, cwd: string | undefined): boolean {
|
|
59
60
|
if (candidate.filePath === undefined || cwd === undefined) return true;
|
|
60
61
|
return !looksAbsolute(maskPath(candidate.filePath, looksAbsolute(cwd) ? { cwd } : {}));
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
/**
|
|
65
|
+
* What stage 0 may hold up to each other, past which it finds nothing. Its detectors
|
|
66
|
+
* take each edit to each other edit, call, file read and record, which is seconds
|
|
67
|
+
* here and hours at what 50 MB can hold, on the thread that serves requests. Length
|
|
68
|
+
* alone costs nothing: the largest real session, with its subagents, has 100 million
|
|
69
|
+
* pairs, and the next has 36 million from 20 thousand calls and 72 file edits.
|
|
70
|
+
*
|
|
71
|
+
* ponytail: the session goes on with no findings. Make the detectors linear if real
|
|
72
|
+
* sessions come near this.
|
|
73
|
+
*/
|
|
74
|
+
const MOST_PAIRS = 500_000_000;
|
|
75
|
+
|
|
76
|
+
function tooManyPairs(session: ParsedSession): boolean {
|
|
77
|
+
// An edit call that records no edit is still looked up against what was read.
|
|
78
|
+
let edits = session.meta.editToolUses;
|
|
79
|
+
for (const recorded of session.fileEdits.values()) edits += recorded.length;
|
|
80
|
+
return edits * (edits + session.toolUses.length + session.filesRead.size + session.records.length) > MOST_PAIRS;
|
|
81
|
+
}
|
|
82
|
+
|
|
63
83
|
export function runStage0(session: ParsedSession): Stage0Result {
|
|
64
84
|
const thinkingBlocks = session.meta.thinkingBlocks;
|
|
65
85
|
const reason = eligibility(session);
|
|
66
86
|
|
|
67
|
-
if (reason) {
|
|
87
|
+
if (reason || tooManyPairs(session)) {
|
|
68
88
|
return {
|
|
69
89
|
sessionId: session.sessionId,
|
|
70
|
-
eligible:
|
|
71
|
-
reason,
|
|
90
|
+
eligible: reason === undefined,
|
|
91
|
+
...(reason && { reason }),
|
|
72
92
|
thinkingBlocks,
|
|
73
93
|
knownGapReachable: thinkingBlocks > 0,
|
|
74
94
|
candidates: [],
|
package/src/state.ts
CHANGED
|
@@ -47,6 +47,15 @@ export interface SessionState {
|
|
|
47
47
|
shown?: string[];
|
|
48
48
|
/** Record count at each commit, oldest first: maps a record index to a commit. */
|
|
49
49
|
commits?: CommitMark[];
|
|
50
|
+
/**
|
|
51
|
+
* The branch this session belongs to, for telling its commits from someone
|
|
52
|
+
* else's: the one its transcript names at its first upload, then where its
|
|
53
|
+
* latest mark landed. The checkout only stands in where the transcript names
|
|
54
|
+
* none, as with Codex and Kimi: an upload runs from wherever a push was made.
|
|
55
|
+
* Not simply the last branch it was seen on, because a resume that only reads
|
|
56
|
+
* moves nothing.
|
|
57
|
+
*/
|
|
58
|
+
branch?: string;
|
|
50
59
|
/** Last write to this entry, for pruning. */
|
|
51
60
|
touchedMs?: number;
|
|
52
61
|
}
|
|
@@ -197,6 +206,15 @@ function keyWithIndex(candidate: Candidate): string {
|
|
|
197
206
|
].join("\x00");
|
|
198
207
|
}
|
|
199
208
|
|
|
209
|
+
/**
|
|
210
|
+
* The first of these that names a branch, for `SessionState.branch`. A detached
|
|
211
|
+
* HEAD names none: stored, it read as no branch known (`commit.ts:isItsCommit`),
|
|
212
|
+
* and every commit made anywhere after it passed as the session's.
|
|
213
|
+
*/
|
|
214
|
+
export function namedBranch(...candidates: (string | undefined)[]): string | undefined {
|
|
215
|
+
return candidates.find((name) => name !== undefined && name !== "HEAD");
|
|
216
|
+
}
|
|
217
|
+
|
|
200
218
|
/** Candidates this session has not printed before. */
|
|
201
219
|
export function unseen(state: SessionState, candidates: readonly Candidate[]): Candidate[] {
|
|
202
220
|
const shown = new Set(state.shown ?? []);
|