@nightloom/isy 1.0.5 → 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.
Files changed (108) hide show
  1. package/README.md +17 -2
  2. package/dist/agents/claude.js +3 -2
  3. package/dist/agents/claude.js.map +1 -1
  4. package/dist/agents/codex.js +14 -5
  5. package/dist/agents/codex.js.map +1 -1
  6. package/dist/agents/index.d.ts +14 -10
  7. package/dist/agents/index.js +65 -15
  8. package/dist/agents/index.js.map +1 -1
  9. package/dist/agents/kimi.js +26 -8
  10. package/dist/agents/kimi.js.map +1 -1
  11. package/dist/agents/types.d.ts +12 -3
  12. package/dist/commands/commit.d.ts +6 -0
  13. package/dist/commands/commit.js +326 -16
  14. package/dist/commands/commit.js.map +1 -1
  15. package/dist/commands/health.js +1 -1
  16. package/dist/commands/health.js.map +1 -1
  17. package/dist/commands/init.js +30 -5
  18. package/dist/commands/init.js.map +1 -1
  19. package/dist/commands/status.d.ts +2 -0
  20. package/dist/commands/status.js +7 -4
  21. package/dist/commands/status.js.map +1 -1
  22. package/dist/commands/upload.d.ts +8 -1
  23. package/dist/commands/upload.js +46 -39
  24. package/dist/commands/upload.js.map +1 -1
  25. package/dist/detectors.d.ts +32 -0
  26. package/dist/detectors.js +279 -72
  27. package/dist/detectors.js.map +1 -1
  28. package/dist/git.d.ts +52 -0
  29. package/dist/git.js +166 -9
  30. package/dist/git.js.map +1 -1
  31. package/dist/githook.d.ts +18 -7
  32. package/dist/githook.js +147 -17
  33. package/dist/githook.js.map +1 -1
  34. package/dist/hook.d.ts +22 -2
  35. package/dist/hook.js +28 -3
  36. package/dist/hook.js.map +1 -1
  37. package/dist/index.js +14 -5
  38. package/dist/index.js.map +1 -1
  39. package/dist/mask-paths.d.ts +4 -3
  40. package/dist/mask-paths.js +4 -3
  41. package/dist/mask-paths.js.map +1 -1
  42. package/dist/parser.d.ts +58 -9
  43. package/dist/parser.js +337 -58
  44. package/dist/parser.js.map +1 -1
  45. package/dist/paths.d.ts +19 -1
  46. package/dist/paths.js +28 -3
  47. package/dist/paths.js.map +1 -1
  48. package/dist/redact.d.ts +2 -0
  49. package/dist/redact.js +956 -97
  50. package/dist/redact.js.map +1 -1
  51. package/dist/stage0.js +27 -8
  52. package/dist/stage0.js.map +1 -1
  53. package/dist/state.d.ts +15 -0
  54. package/dist/state.js +8 -0
  55. package/dist/state.js.map +1 -1
  56. package/dist/test/check.test.js +1 -1
  57. package/dist/test/check.test.js.map +1 -1
  58. package/dist/test/codex.test.js +27 -4
  59. package/dist/test/codex.test.js.map +1 -1
  60. package/dist/test/commit.test.js +1466 -6
  61. package/dist/test/commit.test.js.map +1 -1
  62. package/dist/test/e2e-harness.test.d.ts +1 -0
  63. package/dist/test/e2e-harness.test.js +53 -0
  64. package/dist/test/e2e-harness.test.js.map +1 -0
  65. package/dist/test/git.test.js +72 -2
  66. package/dist/test/git.test.js.map +1 -1
  67. package/dist/test/hook.test.js +138 -3
  68. package/dist/test/hook.test.js.map +1 -1
  69. package/dist/test/init.test.js +60 -1
  70. package/dist/test/init.test.js.map +1 -1
  71. package/dist/test/kimi-config.test.js +27 -5
  72. package/dist/test/kimi-config.test.js.map +1 -1
  73. package/dist/test/kimi-hook.test.js +1 -1
  74. package/dist/test/kimi-hook.test.js.map +1 -1
  75. package/dist/test/kimi-listing.test.js +42 -2
  76. package/dist/test/kimi-listing.test.js.map +1 -1
  77. package/dist/test/kimi.test.js +26 -2
  78. package/dist/test/kimi.test.js.map +1 -1
  79. package/dist/test/parser.test.js +527 -1
  80. package/dist/test/parser.test.js.map +1 -1
  81. package/dist/test/redact.test.js +2442 -14
  82. package/dist/test/redact.test.js.map +1 -1
  83. package/dist/test/stage0.test.js +617 -1
  84. package/dist/test/stage0.test.js.map +1 -1
  85. package/dist/test/sweep.test.js +99 -3
  86. package/dist/test/sweep.test.js.map +1 -1
  87. package/package.json +1 -1
  88. package/src/agents/claude.ts +3 -2
  89. package/src/agents/codex.ts +14 -5
  90. package/src/agents/index.ts +71 -16
  91. package/src/agents/kimi.ts +28 -8
  92. package/src/agents/types.ts +12 -3
  93. package/src/commands/commit.ts +354 -18
  94. package/src/commands/health.ts +1 -1
  95. package/src/commands/init.ts +37 -7
  96. package/src/commands/status.ts +9 -4
  97. package/src/commands/upload.ts +54 -54
  98. package/src/detectors.ts +284 -75
  99. package/src/git.ts +175 -9
  100. package/src/githook.ts +151 -19
  101. package/src/hook.ts +30 -3
  102. package/src/index.ts +15 -5
  103. package/src/mask-paths.ts +5 -4
  104. package/src/parser.ts +355 -51
  105. package/src/paths.ts +30 -3
  106. package/src/redact.ts +959 -100
  107. package/src/stage0.ts +28 -8
  108. package/src/state.ts +18 -0
package/dist/parser.d.ts CHANGED
@@ -2,8 +2,9 @@ import type { ParsedSession, SkipStats } from "./types.js";
2
2
  export declare const EDIT_TOOLS: Set<string>;
3
3
  export declare const LOOKUP_TOOLS: Set<string>;
4
4
  /**
5
- * A heredoc opener: `<<EOF`, `<<-EOF`, `<<'PY'`. The delimiter is what ends the
6
- * body, and quoting it changes nothing about where the body stops.
5
+ * A heredoc opener: `<<EOF`, `<<-EOF`, `<<'PY'`, `<<\EOF`. The delimiter is what
6
+ * ends the body, and quoting it changes nothing about where the body stops. `<<<`
7
+ * is a here-string, whose word is the whole of its input, and it has no body.
7
8
  */
8
9
  export declare const HEREDOC: RegExp;
9
10
  /**
@@ -24,9 +25,8 @@ export declare function withoutHeredocs(command: string): string;
24
25
  * inside a search pattern is the commonest way a `|` shows up in a command that
25
26
  * runs nothing at all.
26
27
  *
27
- * ponytail: quotes nest as a single state, and a backslash escape only counts
28
- * inside double quotes, which is what a shell does anyway. Real parsing is a
29
- * dependency, and this is here to stop three regexes from lying.
28
+ * ponytail: quotes nest as a single state. Real parsing is a dependency, and this
29
+ * is here to stop three regexes from lying.
30
30
  */
31
31
  export declare function commandSegments(command: string): string[];
32
32
  /**
@@ -51,6 +51,15 @@ export declare function commandSegments(command: string): string[];
51
51
  * `MCP_WRITE_VERBS`, reads as no edit; add the name when a CLI or server ships one.
52
52
  */
53
53
  export declare function mayWrite(name: string, input: Record<string, unknown>): boolean;
54
+ /**
55
+ * Whether an MCP tool's name says it leaves everything as it found it.
56
+ *
57
+ * ponytail: judged by names, as `mayWrite` is. A tool that opens with none of these
58
+ * reads as one nobody can answer for, a browser's `navigate` included, and its
59
+ * session keeps a commit on another branch. Add the word if one such proves to move
60
+ * sessions to the wrong pull request.
61
+ */
62
+ export declare function mcpOnlyReads(name: string): boolean;
54
63
  /**
55
64
  * Whether a shell command could have changed a file in the repository.
56
65
  *
@@ -67,9 +76,29 @@ export declare function mayWrite(name: string, input: Record<string, unknown>):
67
76
  * covers a tracked file.
68
77
  */
69
78
  export declare function shellWrites(command: string): boolean;
70
- export declare function shellReadPaths(command: string): string[];
71
79
  /**
72
- * The files `sed -i` and `perl -i` rewrite: every argument after the script.
80
+ * The git subcommands a shell command runs, in the order it runs them. By command
81
+ * and not by word: `pytest tests/git/`, `npm --prefix tools/commit run dev` and a
82
+ * message saying "git commit" run none.
83
+ */
84
+ export declare function gitCommands(command: string): string[];
85
+ /**
86
+ * Whether a shell command leaves nothing behind for a commit to hold, apart from
87
+ * what it writes by name (`shellWrites`). Anything not known here reads as no: a
88
+ * formatter, a build, a script write what nobody can say from the command line, and
89
+ * neither can anyone say which files a write through a glob or a variable took.
90
+ */
91
+ export declare function shellOnlyLooks(command: string): boolean;
92
+ /** What is left of a limit that holds over a whole session. */
93
+ export interface Budget {
94
+ left: number;
95
+ }
96
+ /** Whether this much still fits the budget, which pays for it if so. */
97
+ export declare function spend(budget: Budget, amount: number): boolean;
98
+ export declare function shellReadPaths(command: string, budget?: Budget): string[];
99
+ /**
100
+ * The files `sed -i`, `perl -i`, `ruby -i` and `awk -i inplace` rewrite: every
101
+ * argument after the script.
73
102
  * What the edit changed stays unseen — a sed script is a program, not the text
74
103
  * it replaces — but where it landed is on the command line, and without it a
75
104
  * session editing through sed read to the detectors as one that edited nothing.
@@ -84,11 +113,31 @@ export declare function shellReadPaths(command: string): string[];
84
113
  * still names no file to the detectors (`shellWrites` knows only that one was
85
114
  * written); a glob names files this cannot list.
86
115
  */
87
- export declare function shellEditPaths(command: string, cwd?: string): string[];
116
+ export declare function shellEditPaths(command: string, cwd?: string, budget?: Budget): string[];
117
+ /** As `shellEditPaths`, with a glob left in: to say what a command edits, `.env*` is as good as a file. */
118
+ export declare function shellEditWords(command: string, cwd?: string, budget?: Budget): string[];
119
+ /**
120
+ * What one session's objects, arrays, keys and items may come to, counting an object
121
+ * or array as three keys and an item as a third of one. Parsed, the three bytes of
122
+ * `{},` are 56 and with what is kept of the block 200, a key takes 72 in an object of
123
+ * hundreds or of a shape of its own, ten times its line, and the four bytes of `0.5,`
124
+ * in an array are 24. So a small upload that inflates to nothing else outgrows any
125
+ * heap, and it has to be counted before it is parsed.
126
+ *
127
+ * ponytail: one flat count, 14.6 million in the most of 97 real sessions (252 MB), and
128
+ * a colon after a quote or a comma inside a string counts as a key or an item. What
129
+ * comes past it, or past `LINE_CHARS`, reads as a write nobody can name, and is not
130
+ * read. Raise it if sessions of 500 MB as dense as that one turn up, and the heap with
131
+ * it.
132
+ */
133
+ export declare const STRUCTURES = 16000000;
134
+ /** Whether a line of a transcript may be parsed at all, which spends its part of `STRUCTURES` if so. */
135
+ export declare function mayParse(line: string, structures: Budget): boolean;
88
136
  export declare function parseLines(lines: Iterable<string>): ParsedSession;
89
137
  /** `parseLines` for lines that arrive one at a time, as a stream or a generator does. */
90
138
  export declare function parseLineStream(lines: AsyncIterable<string>): Promise<ParsedSession>;
91
139
  export declare function parseTranscriptFile(filePath: string): Promise<ParsedSession>;
92
140
  export declare function onMainPath(session: ParsedSession, uuid: string | undefined): boolean;
93
- export declare function onAbandonedBranch(session: ParsedSession, uuid: string | undefined): boolean;
141
+ /** `walked` holds what is known of records already walked, as all on a way back share what is at its end. */
142
+ export declare function onAbandonedBranch(session: ParsedSession, uuid: string | undefined, walked?: Map<string, boolean>): boolean;
94
143
  export declare function hasSkips(skipped: SkipStats): boolean;