@crouton-kit/humanloop 0.3.10 → 0.3.12
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/dist/cli.js +4 -3
- package/dist/render/termrender.d.ts +0 -2
- package/dist/render/termrender.js +2 -3
- package/dist/surfaces/display.js +2 -2
- package/dist/types.d.ts +2 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -657,7 +657,9 @@ viewCmd
|
|
|
657
657
|
.command('show')
|
|
658
658
|
.description('Render a file live in a tmux pane — passive, no result.\n' +
|
|
659
659
|
'\n' +
|
|
660
|
-
'
|
|
660
|
+
'The pane always watches the file and live-updates on every save.\n' +
|
|
661
|
+
'\n' +
|
|
662
|
+
'stdin { path: string (required), window?: "split"|"new"="split" }\n' +
|
|
661
663
|
'stdout { pane_id: string|null, reason: string|null }\n' +
|
|
662
664
|
'exit 0 always (not-in-tmux / renderer-unavailable is NOT an error)\n')
|
|
663
665
|
.helpOption('-h, --help', 'Show help')
|
|
@@ -667,9 +669,8 @@ viewCmd
|
|
|
667
669
|
emitError({ error: 'bad_input', message: 'path is required', field: 'path', next: 'Provide: {"path": "/abs/path/file.md"}' });
|
|
668
670
|
}
|
|
669
671
|
const absPath = resolve(input.path);
|
|
670
|
-
const watch = input.watch !== false;
|
|
671
672
|
const window = input.window === 'new' ? 'new' : 'split';
|
|
672
|
-
const res = display(absPath, {
|
|
673
|
+
const res = display(absPath, { window });
|
|
673
674
|
if (res.paneId) {
|
|
674
675
|
process.stdout.write(JSON.stringify({ pane_id: res.paneId, reason: null }) + '\n');
|
|
675
676
|
}
|
|
@@ -21,8 +21,6 @@ export declare function checkMarkdown(md: string): {
|
|
|
21
21
|
error: string;
|
|
22
22
|
};
|
|
23
23
|
export interface DisplayInPaneOpts {
|
|
24
|
-
/** Pass watch so the pane live-updates on file edits. Default true. */
|
|
25
|
-
watch?: boolean;
|
|
26
24
|
/** Open in a new tmux window instead of splitting the current one. */
|
|
27
25
|
newWindow?: boolean;
|
|
28
26
|
}
|
|
@@ -263,9 +263,8 @@ export function displayInPane(path, opts = {}) {
|
|
|
263
263
|
ensureRenderer();
|
|
264
264
|
if (rendererState !== 'ready')
|
|
265
265
|
return {};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
args.push('--watch');
|
|
266
|
+
// Always watch: a displayed pane is a live view of the file by definition.
|
|
267
|
+
const args = ['pane', 'open', path, '--watch'];
|
|
269
268
|
args.push('--window', opts.newWindow ? 'new' : 'split');
|
|
270
269
|
const result = spawnSync(VENV_BIN, args, {
|
|
271
270
|
encoding: 'utf-8',
|
package/dist/surfaces/display.js
CHANGED
|
@@ -10,10 +10,10 @@ export function countPanesInCurrentWindow() {
|
|
|
10
10
|
return result.stdout.split('\n').filter((line) => line.trim() !== '').length;
|
|
11
11
|
}
|
|
12
12
|
export function display(path, opts) {
|
|
13
|
-
const watch = opts?.watch !== false;
|
|
14
13
|
const window = (opts?.window === 'split' || opts?.window === 'new') ? opts.window : 'auto';
|
|
15
14
|
const maxPanes = (opts?.maxPanes !== undefined && opts.maxPanes > 0) ? opts.maxPanes : 3;
|
|
16
15
|
const newWindow = window === 'new' ||
|
|
17
16
|
(window === 'auto' && countPanesInCurrentWindow() >= maxPanes);
|
|
18
|
-
|
|
17
|
+
// The pane always watches the file — displayed docs are live by definition.
|
|
18
|
+
return displayInPane(path, { newWindow });
|
|
19
19
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -146,10 +146,9 @@ export interface InboxItem {
|
|
|
146
146
|
blockedSince: string;
|
|
147
147
|
source?: DeckSource;
|
|
148
148
|
}
|
|
149
|
-
/** Options for `display()` — the live-watch tmux pane surface.
|
|
149
|
+
/** Options for `display()` — the live-watch tmux pane surface. The pane always
|
|
150
|
+
* watches the file and live-updates on edits; there is no non-watched mode. */
|
|
150
151
|
export interface DisplayOpts {
|
|
151
|
-
/** Pass `--watch` so the pane live-updates on edits. Default true. */
|
|
152
|
-
watch?: boolean;
|
|
153
152
|
/** `'auto'` (default) splits until the pane budget, then opens a new window. */
|
|
154
153
|
window?: 'auto' | 'split' | 'new';
|
|
155
154
|
/** Pane budget per window before `'auto'` opens a new window. Default 3. */
|