@elaraai/e3-ui-cli 1.0.71 → 1.0.73
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 +46 -21
- package/dist/app/assets/{engine-BKZbmXkC-hslJZfFw.js → engine-Bm-cIDd_-DwUdGcTZ.js} +1 -1
- package/dist/app/assets/{index-8USNHP31.js → index-mj-YVVN1.js} +92 -92
- package/dist/app/index.html +1 -1
- package/dist/cli.js +36 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/tui.d.ts +84 -0
- package/dist/commands/tui.d.ts.map +1 -0
- package/dist/commands/tui.js +86 -0
- package/dist/commands/tui.js.map +1 -0
- package/dist/tui/api.d.ts +108 -0
- package/dist/tui/api.d.ts.map +1 -0
- package/dist/tui/api.js +130 -0
- package/dist/tui/api.js.map +1 -0
- package/dist/tui/app.d.ts +23 -0
- package/dist/tui/app.d.ts.map +1 -0
- package/dist/tui/app.js +241 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/controller.d.ts +116 -0
- package/dist/tui/controller.d.ts.map +1 -0
- package/dist/tui/controller.js +620 -0
- package/dist/tui/controller.js.map +1 -0
- package/dist/tui/data/dataflow.d.ts +68 -0
- package/dist/tui/data/dataflow.d.ts.map +1 -0
- package/dist/tui/data/dataflow.js +137 -0
- package/dist/tui/data/dataflow.js.map +1 -0
- package/dist/tui/data/dataset.d.ts +80 -0
- package/dist/tui/data/dataset.d.ts.map +1 -0
- package/dist/tui/data/dataset.js +297 -0
- package/dist/tui/data/dataset.js.map +1 -0
- package/dist/tui/data/edit-buffer.d.ts +74 -0
- package/dist/tui/data/edit-buffer.d.ts.map +1 -0
- package/dist/tui/data/edit-buffer.js +120 -0
- package/dist/tui/data/edit-buffer.js.map +1 -0
- package/dist/tui/data/feeds.d.ts +45 -0
- package/dist/tui/data/feeds.d.ts.map +1 -0
- package/dist/tui/data/feeds.js +318 -0
- package/dist/tui/data/feeds.js.map +1 -0
- package/dist/tui/data/logs.d.ts +68 -0
- package/dist/tui/data/logs.d.ts.map +1 -0
- package/dist/tui/data/logs.js +134 -0
- package/dist/tui/data/logs.js.map +1 -0
- package/dist/tui/input/commands.d.ts +159 -0
- package/dist/tui/input/commands.d.ts.map +1 -0
- package/dist/tui/input/commands.js +259 -0
- package/dist/tui/input/commands.js.map +1 -0
- package/dist/tui/input/completion.d.ts +63 -0
- package/dist/tui/input/completion.d.ts.map +1 -0
- package/dist/tui/input/completion.js +128 -0
- package/dist/tui/input/completion.js.map +1 -0
- package/dist/tui/input/keymap.d.ts +153 -0
- package/dist/tui/input/keymap.d.ts.map +1 -0
- package/dist/tui/input/keymap.js +206 -0
- package/dist/tui/input/keymap.js.map +1 -0
- package/dist/tui/input/mouse.d.ts +52 -0
- package/dist/tui/input/mouse.d.ts.map +1 -0
- package/dist/tui/input/mouse.js +55 -0
- package/dist/tui/input/mouse.js.map +1 -0
- package/dist/tui/lifecycle.d.ts +61 -0
- package/dist/tui/lifecycle.d.ts.map +1 -0
- package/dist/tui/lifecycle.js +99 -0
- package/dist/tui/lifecycle.js.map +1 -0
- package/dist/tui/model/catalogue.d.ts +28 -0
- package/dist/tui/model/catalogue.d.ts.map +1 -0
- package/dist/tui/model/catalogue.js +94 -0
- package/dist/tui/model/catalogue.js.map +1 -0
- package/dist/tui/model/help.d.ts +37 -0
- package/dist/tui/model/help.d.ts.map +1 -0
- package/dist/tui/model/help.js +210 -0
- package/dist/tui/model/help.js.map +1 -0
- package/dist/tui/model/index.d.ts +42 -0
- package/dist/tui/model/index.d.ts.map +1 -0
- package/dist/tui/model/index.js +50 -0
- package/dist/tui/model/index.js.map +1 -0
- package/dist/tui/model/status.d.ts +88 -0
- package/dist/tui/model/status.d.ts.map +1 -0
- package/dist/tui/model/status.js +137 -0
- package/dist/tui/model/status.js.map +1 -0
- package/dist/tui/model/tree.d.ts +112 -0
- package/dist/tui/model/tree.d.ts.map +1 -0
- package/dist/tui/model/tree.js +178 -0
- package/dist/tui/model/tree.js.map +1 -0
- package/dist/tui/model/types.d.ts +21 -0
- package/dist/tui/model/types.d.ts.map +1 -0
- package/dist/tui/model/types.js +46 -0
- package/dist/tui/model/types.js.map +1 -0
- package/dist/tui/render/glyphs.d.ts +122 -0
- package/dist/tui/render/glyphs.d.ts.map +1 -0
- package/dist/tui/render/glyphs.js +122 -0
- package/dist/tui/render/glyphs.js.map +1 -0
- package/dist/tui/render/layout.d.ts +145 -0
- package/dist/tui/render/layout.d.ts.map +1 -0
- package/dist/tui/render/layout.js +209 -0
- package/dist/tui/render/layout.js.map +1 -0
- package/dist/tui/render/text.d.ts +149 -0
- package/dist/tui/render/text.d.ts.map +1 -0
- package/dist/tui/render/text.js +288 -0
- package/dist/tui/render/text.js.map +1 -0
- package/dist/tui/render/theme.d.ts +88 -0
- package/dist/tui/render/theme.d.ts.map +1 -0
- package/dist/tui/render/theme.js +145 -0
- package/dist/tui/render/theme.js.map +1 -0
- package/dist/tui/session.d.ts +78 -0
- package/dist/tui/session.d.ts.map +1 -0
- package/dist/tui/session.js +237 -0
- package/dist/tui/session.js.map +1 -0
- package/dist/tui/state/actions.d.ts +584 -0
- package/dist/tui/state/actions.d.ts.map +1 -0
- package/dist/tui/state/actions.js +62 -0
- package/dist/tui/state/actions.js.map +1 -0
- package/dist/tui/state/persist.d.ts +114 -0
- package/dist/tui/state/persist.d.ts.map +1 -0
- package/dist/tui/state/persist.js +187 -0
- package/dist/tui/state/persist.js.map +1 -0
- package/dist/tui/state/poll.d.ts +99 -0
- package/dist/tui/state/poll.d.ts.map +1 -0
- package/dist/tui/state/poll.js +160 -0
- package/dist/tui/state/poll.js.map +1 -0
- package/dist/tui/state/reducer.d.ts +16 -0
- package/dist/tui/state/reducer.d.ts.map +1 -0
- package/dist/tui/state/reducer.js +363 -0
- package/dist/tui/state/reducer.js.map +1 -0
- package/dist/tui/state/store.d.ts +37 -0
- package/dist/tui/state/store.d.ts.map +1 -0
- package/dist/tui/state/store.js +84 -0
- package/dist/tui/state/store.js.map +1 -0
- package/dist/tui/suspend.d.ts +17 -0
- package/dist/tui/suspend.d.ts.map +1 -0
- package/dist/tui/suspend.js +33 -0
- package/dist/tui/suspend.js.map +1 -0
- package/dist/tui/ui/App.d.ts +41 -0
- package/dist/tui/ui/App.d.ts.map +1 -0
- package/dist/tui/ui/App.js +92 -0
- package/dist/tui/ui/App.js.map +1 -0
- package/dist/tui/ui/frame.d.ts +86 -0
- package/dist/tui/ui/frame.d.ts.map +1 -0
- package/dist/tui/ui/frame.js +42 -0
- package/dist/tui/ui/frame.js.map +1 -0
- package/dist/tui/ui/lines.d.ts +92 -0
- package/dist/tui/ui/lines.d.ts.map +1 -0
- package/dist/tui/ui/lines.js +94 -0
- package/dist/tui/ui/lines.js.map +1 -0
- package/dist/tui/ui/shell/chrome.d.ts +61 -0
- package/dist/tui/ui/shell/chrome.d.ts.map +1 -0
- package/dist/tui/ui/shell/chrome.js +272 -0
- package/dist/tui/ui/shell/chrome.js.map +1 -0
- package/dist/tui/ui/shell/widgets.d.ts +75 -0
- package/dist/tui/ui/shell/widgets.d.ts.map +1 -0
- package/dist/tui/ui/shell/widgets.js +160 -0
- package/dist/tui/ui/shell/widgets.js.map +1 -0
- package/dist/tui/ui/views/about.d.ts +20 -0
- package/dist/tui/ui/views/about.d.ts.map +1 -0
- package/dist/tui/ui/views/about.js +40 -0
- package/dist/tui/ui/views/about.js.map +1 -0
- package/dist/tui/ui/views/all.d.ts +17 -0
- package/dist/tui/ui/views/all.d.ts.map +1 -0
- package/dist/tui/ui/views/all.js +17 -0
- package/dist/tui/ui/views/all.js.map +1 -0
- package/dist/tui/ui/views/dashboard.d.ts +156 -0
- package/dist/tui/ui/views/dashboard.d.ts.map +1 -0
- package/dist/tui/ui/views/dashboard.js +599 -0
- package/dist/tui/ui/views/dashboard.js.map +1 -0
- package/dist/tui/ui/views/help.d.ts +17 -0
- package/dist/tui/ui/views/help.d.ts.map +1 -0
- package/dist/tui/ui/views/help.js +65 -0
- package/dist/tui/ui/views/help.js.map +1 -0
- package/dist/tui/ui/views/index.d.ts +42 -0
- package/dist/tui/ui/views/index.d.ts.map +1 -0
- package/dist/tui/ui/views/index.js +42 -0
- package/dist/tui/ui/views/index.js.map +1 -0
- package/dist/tui/ui/views/input.d.ts +6 -0
- package/dist/tui/ui/views/input.d.ts.map +1 -0
- package/dist/tui/ui/views/input.js +494 -0
- package/dist/tui/ui/views/input.js.map +1 -0
- package/dist/tui/ui/views/launch.d.ts +16 -0
- package/dist/tui/ui/views/launch.d.ts.map +1 -0
- package/dist/tui/ui/views/launch.js +43 -0
- package/dist/tui/ui/views/launch.js.map +1 -0
- package/dist/tui/ui/views/refusal.d.ts +20 -0
- package/dist/tui/ui/views/refusal.d.ts.map +1 -0
- package/dist/tui/ui/views/refusal.js +47 -0
- package/dist/tui/ui/views/refusal.js.map +1 -0
- package/dist/tui/ui/views/repos.d.ts +10 -0
- package/dist/tui/ui/views/repos.d.ts.map +1 -0
- package/dist/tui/ui/views/repos.js +93 -0
- package/dist/tui/ui/views/repos.js.map +1 -0
- package/dist/tui/ui/views/task.d.ts +17 -0
- package/dist/tui/ui/views/task.d.ts.map +1 -0
- package/dist/tui/ui/views/task.js +309 -0
- package/dist/tui/ui/views/task.js.map +1 -0
- package/dist/tui/ui/views/wordmark.d.ts +15 -0
- package/dist/tui/ui/views/wordmark.d.ts.map +1 -0
- package/dist/tui/ui/views/wordmark.js +50 -0
- package/dist/tui/ui/views/wordmark.js.map +1 -0
- package/dist/tui/ui/views/workspaces.d.ts +17 -0
- package/dist/tui/ui/views/workspaces.d.ts.map +1 -0
- package/dist/tui/ui/views/workspaces.js +127 -0
- package/dist/tui/ui/views/workspaces.js.map +1 -0
- package/dist/tui/ui/widgets/leaf-editor.d.ts +58 -0
- package/dist/tui/ui/widgets/leaf-editor.d.ts.map +1 -0
- package/dist/tui/ui/widgets/leaf-editor.js +119 -0
- package/dist/tui/ui/widgets/leaf-editor.js.map +1 -0
- package/dist/tui/ui/widgets/logs.d.ts +99 -0
- package/dist/tui/ui/widgets/logs.d.ts.map +1 -0
- package/dist/tui/ui/widgets/logs.js +291 -0
- package/dist/tui/ui/widgets/logs.js.map +1 -0
- package/dist/tui/ui/widgets/reads.d.ts +62 -0
- package/dist/tui/ui/widgets/reads.d.ts.map +1 -0
- package/dist/tui/ui/widgets/reads.js +122 -0
- package/dist/tui/ui/widgets/reads.js.map +1 -0
- package/dist/tui/ui/widgets/runs.d.ts +51 -0
- package/dist/tui/ui/widgets/runs.d.ts.map +1 -0
- package/dist/tui/ui/widgets/runs.js +86 -0
- package/dist/tui/ui/widgets/runs.js.map +1 -0
- package/dist/tui/ui/widgets/tree.d.ts +149 -0
- package/dist/tui/ui/widgets/tree.d.ts.map +1 -0
- package/dist/tui/ui/widgets/tree.js +584 -0
- package/dist/tui/ui/widgets/tree.js.map +1 -0
- package/package.json +22 -12
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The edit buffer of an input — an ordered list of ops (`edit | insert |
|
|
7
|
+
* remove | tag`) applied through `ValueTree.applyEdit` to a *draft* of the
|
|
8
|
+
* base value; the tree renders the draft (re-materialized after every op)
|
|
9
|
+
* with `┆` on the rows the ops touched. `apply` encodes the draft with
|
|
10
|
+
* `encodeDatasetBlob` (collections stay segmented and pageable) and
|
|
11
|
+
* `datasetSet`s it; `replay` re-applies the ops onto a newer base after a
|
|
12
|
+
* conflict, reporting the ops that no longer apply.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
import type { EastTypeValue } from '@elaraai/east';
|
|
17
|
+
import type { EditOp, EditState } from '../state/actions.js';
|
|
18
|
+
/**
|
|
19
|
+
* The row id an op marks as changed: the edited / tagged row itself, or
|
|
20
|
+
* the container an insert or remove touched.
|
|
21
|
+
*
|
|
22
|
+
* @param op - The op
|
|
23
|
+
* @returns The row id (`pathKey` of the path)
|
|
24
|
+
*/
|
|
25
|
+
export declare function markOf(op: EditOp): string;
|
|
26
|
+
/**
|
|
27
|
+
* Starts a buffer over a base value.
|
|
28
|
+
*
|
|
29
|
+
* @param ws - The workspace
|
|
30
|
+
* @param path - The dataset path
|
|
31
|
+
* @param type - The value's type
|
|
32
|
+
* @param base - The decoded base value
|
|
33
|
+
* @param baseHash - Its content hash
|
|
34
|
+
* @returns A clean buffer
|
|
35
|
+
*/
|
|
36
|
+
export declare function startEdit(ws: string, path: string, type: EastTypeValue, base: unknown, baseHash: string): EditState;
|
|
37
|
+
/**
|
|
38
|
+
* Appends an op and re-materializes the draft.
|
|
39
|
+
*
|
|
40
|
+
* @param edit - The buffer
|
|
41
|
+
* @param op - The op
|
|
42
|
+
* @returns The buffer with the op applied
|
|
43
|
+
* @throws {Error} When the op does not apply (an unknown dict key, a bad path)
|
|
44
|
+
*/
|
|
45
|
+
export declare function pushOp(edit: EditState, op: EditOp): EditState;
|
|
46
|
+
/**
|
|
47
|
+
* Re-applies the ops onto a newer base (after a conflict); ops that no
|
|
48
|
+
* longer apply are dropped and reported.
|
|
49
|
+
*
|
|
50
|
+
* @param edit - The buffer
|
|
51
|
+
* @param base - The new base value
|
|
52
|
+
* @param baseHash - Its content hash
|
|
53
|
+
* @returns The rebased buffer and the dropped ops
|
|
54
|
+
*/
|
|
55
|
+
export declare function replay(edit: EditState, base: unknown, baseHash: string): {
|
|
56
|
+
edit: EditState;
|
|
57
|
+
dropped: EditOp[];
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* A one-line description of an op (`edit .smoothing`).
|
|
61
|
+
*
|
|
62
|
+
* @param op - The op
|
|
63
|
+
* @returns The text
|
|
64
|
+
*/
|
|
65
|
+
export declare function describeOp(op: EditOp): string;
|
|
66
|
+
/**
|
|
67
|
+
* The changed rows' short names for the commit bar (`smoothing ·
|
|
68
|
+
* min_confidence`).
|
|
69
|
+
*
|
|
70
|
+
* @param edit - The buffer
|
|
71
|
+
* @returns The names
|
|
72
|
+
*/
|
|
73
|
+
export declare function changedNames(edit: EditState): string[];
|
|
74
|
+
//# sourceMappingURL=edit-buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-buffer.d.ts","sourceRoot":"","sources":["../../../src/tui/data/edit-buffer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAY7D;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAEnH;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,CAU7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAW/G;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQ7C;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,CAYtD"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { ValueTree } from '@elaraai/east-ui';
|
|
6
|
+
import { pathKey } from '@elaraai/east-ui/internal';
|
|
7
|
+
/** The op as `ValueTree.applyEdit` takes it. */
|
|
8
|
+
function treeOp(op) {
|
|
9
|
+
switch (op.kind) {
|
|
10
|
+
case 'edit': return { kind: 'edit', leaf: op.leaf };
|
|
11
|
+
case 'insert': return { kind: 'insert' };
|
|
12
|
+
case 'remove': return { kind: 'remove' };
|
|
13
|
+
case 'tag': return { kind: 'tag', tag: op.tag };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The row id an op marks as changed: the edited / tagged row itself, or
|
|
18
|
+
* the container an insert or remove touched.
|
|
19
|
+
*
|
|
20
|
+
* @param op - The op
|
|
21
|
+
* @returns The row id (`pathKey` of the path)
|
|
22
|
+
*/
|
|
23
|
+
export function markOf(op) {
|
|
24
|
+
if (op.kind === 'edit' || op.kind === 'tag')
|
|
25
|
+
return pathKey(op.path);
|
|
26
|
+
return pathKey(op.path.slice(0, -1));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Starts a buffer over a base value.
|
|
30
|
+
*
|
|
31
|
+
* @param ws - The workspace
|
|
32
|
+
* @param path - The dataset path
|
|
33
|
+
* @param type - The value's type
|
|
34
|
+
* @param base - The decoded base value
|
|
35
|
+
* @param baseHash - Its content hash
|
|
36
|
+
* @returns A clean buffer
|
|
37
|
+
*/
|
|
38
|
+
export function startEdit(ws, path, type, base, baseHash) {
|
|
39
|
+
return { ws, path, type, base, baseHash, ops: [], draft: base, root: ValueTree.materialize(type, base), changed: [], conflict: null, applying: false };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Appends an op and re-materializes the draft.
|
|
43
|
+
*
|
|
44
|
+
* @param edit - The buffer
|
|
45
|
+
* @param op - The op
|
|
46
|
+
* @returns The buffer with the op applied
|
|
47
|
+
* @throws {Error} When the op does not apply (an unknown dict key, a bad path)
|
|
48
|
+
*/
|
|
49
|
+
export function pushOp(edit, op) {
|
|
50
|
+
const draft = ValueTree.applyEdit(edit.type, edit.draft, op.path, treeOp(op));
|
|
51
|
+
const mark = markOf(op);
|
|
52
|
+
return {
|
|
53
|
+
...edit,
|
|
54
|
+
ops: [...edit.ops, op],
|
|
55
|
+
draft,
|
|
56
|
+
root: ValueTree.materialize(edit.type, draft),
|
|
57
|
+
changed: edit.changed.includes(mark) ? edit.changed : [...edit.changed, mark],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Re-applies the ops onto a newer base (after a conflict); ops that no
|
|
62
|
+
* longer apply are dropped and reported.
|
|
63
|
+
*
|
|
64
|
+
* @param edit - The buffer
|
|
65
|
+
* @param base - The new base value
|
|
66
|
+
* @param baseHash - Its content hash
|
|
67
|
+
* @returns The rebased buffer and the dropped ops
|
|
68
|
+
*/
|
|
69
|
+
export function replay(edit, base, baseHash) {
|
|
70
|
+
let next = startEdit(edit.ws, edit.path, edit.type, base, baseHash);
|
|
71
|
+
const dropped = [];
|
|
72
|
+
for (const op of edit.ops) {
|
|
73
|
+
try {
|
|
74
|
+
next = pushOp(next, op);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
dropped.push(op);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { edit: next, dropped };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A one-line description of an op (`edit .smoothing`).
|
|
84
|
+
*
|
|
85
|
+
* @param op - The op
|
|
86
|
+
* @returns The text
|
|
87
|
+
*/
|
|
88
|
+
export function describeOp(op) {
|
|
89
|
+
const where = pathKey(op.path);
|
|
90
|
+
switch (op.kind) {
|
|
91
|
+
case 'edit': return `edit ${where}`;
|
|
92
|
+
case 'insert': return `add ${where}`;
|
|
93
|
+
case 'remove': return `remove ${where}`;
|
|
94
|
+
case 'tag': return `tag ${where} ${op.tag}`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The changed rows' short names for the commit bar (`smoothing ·
|
|
99
|
+
* min_confidence`).
|
|
100
|
+
*
|
|
101
|
+
* @param edit - The buffer
|
|
102
|
+
* @returns The names
|
|
103
|
+
*/
|
|
104
|
+
export function changedNames(edit) {
|
|
105
|
+
return edit.changed.map(id => {
|
|
106
|
+
if (id === '$')
|
|
107
|
+
return 'value';
|
|
108
|
+
// The last field or key segment; indices, `?` and `!` name nothing.
|
|
109
|
+
const parts = id.match(/\.[^.[{?!]+|\[[^\]]*\]|\{[^}]*\}|\?|!/g) ?? [];
|
|
110
|
+
for (let i = parts.length - 1; i >= 0; i--) {
|
|
111
|
+
const part = parts[i];
|
|
112
|
+
if (part.startsWith('.'))
|
|
113
|
+
return part.slice(1);
|
|
114
|
+
if (part.startsWith('{'))
|
|
115
|
+
return part.slice(1, -1);
|
|
116
|
+
}
|
|
117
|
+
return id;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=edit-buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-buffer.js","sourceRoot":"","sources":["../../../src/tui/data/edit-buffer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,gDAAgD;AAChD,SAAS,MAAM,CAAC,EAAU;IACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QACd,KAAK,MAAM,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAa,EAAE,CAAC;QAC7D,KAAK,QAAQ,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACzC,KAAK,QAAQ,CAAC,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C,OAAO,OAAO,KAAK,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC;IAChD,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAe;IACxC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACzB,IAAI,EAAE,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC;QAC/B,oEAAoE;QACpE,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,wCAAwC,CAAC,IAAI,EAAE,CAAC;QACvE,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;YACvB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import type { Api } from '../api.js';
|
|
6
|
+
import { type DatasetLoader } from './dataset.js';
|
|
7
|
+
import { type TuiState } from '../state/actions.js';
|
|
8
|
+
import { type PollClock, type Poller } from '../state/poll.js';
|
|
9
|
+
import type { Store } from '../state/store.js';
|
|
10
|
+
/** The running feeds. */
|
|
11
|
+
export interface Feeds {
|
|
12
|
+
/** Starts deriving feeds from the store. */
|
|
13
|
+
start(): void;
|
|
14
|
+
/** Stops every poller and the derivation. */
|
|
15
|
+
stop(): void;
|
|
16
|
+
/** Fires every running poller now (`/refresh`, `R`). */
|
|
17
|
+
refresh(): void;
|
|
18
|
+
/** Fires one poller now, by key (`execution:<ws>` after a launch); unknown keys are ignored. */
|
|
19
|
+
fire(key: string): void;
|
|
20
|
+
/** The running pollers (for the connection pill and tests). */
|
|
21
|
+
pollers(): Poller[];
|
|
22
|
+
/** Re-derives the feed set now (after a session change). */
|
|
23
|
+
sync(): void;
|
|
24
|
+
/** The dataset loader behind the value tree (pages, key search, saves). */
|
|
25
|
+
datasets: DatasetLoader;
|
|
26
|
+
}
|
|
27
|
+
/** What {@link createFeeds} needs. */
|
|
28
|
+
export interface FeedsDeps {
|
|
29
|
+
store: Store;
|
|
30
|
+
/** The API of the current session (may change when `/repo` rebinds). */
|
|
31
|
+
api: () => Api | null;
|
|
32
|
+
clock?: PollClock | undefined;
|
|
33
|
+
/** A logger for feed failures (the debug log). */
|
|
34
|
+
log?: ((line: string) => void) | undefined;
|
|
35
|
+
}
|
|
36
|
+
/** The workspace a view is about, if any. */
|
|
37
|
+
export declare function viewWorkspace(state: TuiState): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Creates the feed manager.
|
|
40
|
+
*
|
|
41
|
+
* @param deps - The store, the API accessor, timers
|
|
42
|
+
* @returns The feeds (not started)
|
|
43
|
+
*/
|
|
44
|
+
export declare function createFeeds(deps: FeedsDeps): Feeds;
|
|
45
|
+
//# sourceMappingURL=feeds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeds.d.ts","sourceRoot":"","sources":["../../../src/tui/data/feeds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAoC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAiC,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS/C,yBAAyB;AACzB,MAAM,WAAW,KAAK;IAClB,4CAA4C;IAC5C,KAAK,IAAI,IAAI,CAAC;IACd,6CAA6C;IAC7C,IAAI,IAAI,IAAI,CAAC;IACb,wDAAwD;IACxD,OAAO,IAAI,IAAI,CAAC;IAChB,gGAAgG;IAChG,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,+DAA+D;IAC/D,OAAO,IAAI,MAAM,EAAE,CAAC;IACpB,4DAA4D;IAC5D,IAAI,IAAI,IAAI,CAAC;IACb,2EAA2E;IAC3E,QAAQ,EAAE,aAAa,CAAC;CAC3B;AAED,sCAAsC;AACtC,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,wEAAwE;IACxE,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,kDAAkD;IAClD,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9C;AAED,6CAA6C;AAC7C,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAI5D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,CAsRlD"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { describeError, isApiCode } from '../api.js';
|
|
6
|
+
import { createDatasetLoader, viewDataset } from './dataset.js';
|
|
7
|
+
import { createLogsLoader } from './logs.js';
|
|
8
|
+
import { isLogTab } from '../state/actions.js';
|
|
9
|
+
import { connectionState, createPoller } from '../state/poll.js';
|
|
10
|
+
/** The workspace a view is about, if any. */
|
|
11
|
+
export function viewWorkspace(state) {
|
|
12
|
+
const v = state.view;
|
|
13
|
+
if (v.kind === 'dashboard' || v.kind === 'task' || v.kind === 'input')
|
|
14
|
+
return v.ws;
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates the feed manager.
|
|
19
|
+
*
|
|
20
|
+
* @param deps - The store, the API accessor, timers
|
|
21
|
+
* @returns The feeds (not started)
|
|
22
|
+
*/
|
|
23
|
+
export function createFeeds(deps) {
|
|
24
|
+
const { store } = deps;
|
|
25
|
+
const running = new Map();
|
|
26
|
+
let unsubscribe = null;
|
|
27
|
+
let lastSignature = '';
|
|
28
|
+
const executionCursor = new Map();
|
|
29
|
+
const repoStatusRequested = new Set();
|
|
30
|
+
const datasets = createDatasetLoader({ store, api: deps.api, log: deps.log });
|
|
31
|
+
const logs = createLogsLoader({ store, api: deps.api, log: deps.log });
|
|
32
|
+
/** A repository's counts and its latest deployment (the repositories view's lazy columns). */
|
|
33
|
+
const repoFacts = async (api, name) => {
|
|
34
|
+
const status = await api.repoStatus(name);
|
|
35
|
+
store.dispatch({ type: 'data/repoStatus', repo: name, status });
|
|
36
|
+
const bound = api.withRepo(name);
|
|
37
|
+
let latest = null;
|
|
38
|
+
try {
|
|
39
|
+
const workspaces = await bound.workspaceList();
|
|
40
|
+
for (const ws of workspaces) {
|
|
41
|
+
if (!ws.deployed)
|
|
42
|
+
continue;
|
|
43
|
+
const wsState = await bound.workspaceGet(ws.name);
|
|
44
|
+
if (wsState === null)
|
|
45
|
+
continue;
|
|
46
|
+
if (latest === null || wsState.deployedAt.getTime() > latest.deployedAt.getTime()) {
|
|
47
|
+
latest = { workspace: ws.name, packageName: wsState.packageName, packageVersion: wsState.packageVersion, deployedAt: wsState.deployedAt };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
deps.log?.(`repo ${name} facts failed: ${describeError(err)}`);
|
|
53
|
+
}
|
|
54
|
+
store.dispatch({ type: 'data/repoDeploy', repo: name, deploy: latest });
|
|
55
|
+
};
|
|
56
|
+
const dispatchConnection = () => {
|
|
57
|
+
store.dispatch({ type: 'connection', connection: connectionState([...running.values()]) });
|
|
58
|
+
};
|
|
59
|
+
const specs = (state, api) => {
|
|
60
|
+
const out = [];
|
|
61
|
+
const session = state.session;
|
|
62
|
+
if (session === null)
|
|
63
|
+
return out;
|
|
64
|
+
const view = state.view;
|
|
65
|
+
if (session.kind === 'origin' || view.kind === 'repos') {
|
|
66
|
+
out.push({
|
|
67
|
+
key: 'repos',
|
|
68
|
+
intervalMs: 5_000,
|
|
69
|
+
run: async () => {
|
|
70
|
+
const names = await api.repoList();
|
|
71
|
+
store.dispatch({ type: 'data/repos', names });
|
|
72
|
+
for (const name of names) {
|
|
73
|
+
if (repoStatusRequested.has(name))
|
|
74
|
+
continue;
|
|
75
|
+
repoStatusRequested.add(name);
|
|
76
|
+
void repoFacts(api, name)
|
|
77
|
+
.catch(() => repoStatusRequested.delete(name));
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (session.repo === null)
|
|
83
|
+
return out;
|
|
84
|
+
out.push({
|
|
85
|
+
key: 'workspaces',
|
|
86
|
+
intervalMs: 5_000,
|
|
87
|
+
run: async () => {
|
|
88
|
+
const workspaces = await api.workspaceList();
|
|
89
|
+
store.dispatch({ type: 'data/workspaces', workspaces });
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
if (view.kind === 'workspaces') {
|
|
93
|
+
out.push({
|
|
94
|
+
key: 'workspaces:summaries',
|
|
95
|
+
intervalMs: 5_000,
|
|
96
|
+
run: async (signal) => {
|
|
97
|
+
let workspaces = store.getState().data.workspaces;
|
|
98
|
+
if (workspaces === null) {
|
|
99
|
+
workspaces = await api.workspaceList();
|
|
100
|
+
if (signal.aborted)
|
|
101
|
+
return;
|
|
102
|
+
store.dispatch({ type: 'data/workspaces', workspaces });
|
|
103
|
+
}
|
|
104
|
+
for (const ws of workspaces.map(w => w.name)) {
|
|
105
|
+
if (signal.aborted)
|
|
106
|
+
return;
|
|
107
|
+
try {
|
|
108
|
+
const [result, wsState] = await Promise.all([api.workspaceStatus(ws), api.workspaceGet(ws)]);
|
|
109
|
+
if (signal.aborted)
|
|
110
|
+
return;
|
|
111
|
+
store.dispatch({ type: 'data/status', ws, result, at: (deps.clock?.now ?? Date.now)() });
|
|
112
|
+
store.dispatch({ type: 'data/workspaceState', ws, state: wsState });
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
if (isApiCode(err, 'workspace_not_deployed')) {
|
|
116
|
+
store.dispatch({ type: 'data/workspaceState', ws, state: null });
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
121
|
+
// The last run, for the LAST RUN column (never run is not an error).
|
|
122
|
+
try {
|
|
123
|
+
const execution = await api.dataflowExecutePoll(ws, 0);
|
|
124
|
+
if (signal.aborted)
|
|
125
|
+
return;
|
|
126
|
+
executionCursor.set(ws, { startedAt: execution.startedAt, events: [...execution.events] });
|
|
127
|
+
store.dispatch({ type: 'data/execution', ws, state: execution, events: [...execution.events], startedAt: execution.startedAt });
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
if (!isApiCode(err, 'execution_not_found'))
|
|
131
|
+
throw err;
|
|
132
|
+
store.dispatch({ type: 'data/execution', ws, state: null, events: [], startedAt: null });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const ws = viewWorkspace(state);
|
|
139
|
+
if (ws !== null) {
|
|
140
|
+
out.push({
|
|
141
|
+
key: `status:${ws}`,
|
|
142
|
+
intervalMs: 1_000,
|
|
143
|
+
run: async () => {
|
|
144
|
+
try {
|
|
145
|
+
const result = await api.workspaceStatus(ws);
|
|
146
|
+
store.dispatch({ type: 'data/status', ws, result, at: (deps.clock?.now ?? Date.now)() });
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
store.dispatch({ type: 'data/statusError', ws, error: describeError(err) });
|
|
150
|
+
throw err;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
const execution = state.data.execution[ws];
|
|
155
|
+
const active = execution?.state?.status.type === 'running' || execution?.settling === true || execution?.stopping === true;
|
|
156
|
+
out.push({
|
|
157
|
+
key: `execution:${ws}`,
|
|
158
|
+
intervalMs: active ? 1_000 : 5_000,
|
|
159
|
+
run: async () => {
|
|
160
|
+
const cursor = executionCursor.get(ws) ?? { startedAt: null, events: [] };
|
|
161
|
+
let result;
|
|
162
|
+
try {
|
|
163
|
+
result = await api.dataflowExecutePoll(ws, cursor.events.length);
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
if (isApiCode(err, 'execution_not_found')) {
|
|
167
|
+
executionCursor.set(ws, { startedAt: null, events: [] });
|
|
168
|
+
store.dispatch({ type: 'data/execution', ws, state: null, events: [], startedAt: null });
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
173
|
+
let events = cursor.events;
|
|
174
|
+
if (result.startedAt !== cursor.startedAt) {
|
|
175
|
+
// A new execution: its events restart at 0.
|
|
176
|
+
const fresh = cursor.events.length === 0 ? result : await api.dataflowExecutePoll(ws, 0);
|
|
177
|
+
events = [...fresh.events];
|
|
178
|
+
result = fresh;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
events = [...cursor.events, ...result.events];
|
|
182
|
+
}
|
|
183
|
+
executionCursor.set(ws, { startedAt: result.startedAt, events });
|
|
184
|
+
store.dispatch({ type: 'data/execution', ws, state: result, events, startedAt: result.startedAt });
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
out.push({
|
|
188
|
+
key: `datasets:${ws}`,
|
|
189
|
+
intervalMs: 5_000,
|
|
190
|
+
run: async () => {
|
|
191
|
+
const entries = await api.datasetList(ws);
|
|
192
|
+
store.dispatch({ type: 'data/datasets', ws, entries });
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
out.push({
|
|
196
|
+
key: `taskList:${ws}`,
|
|
197
|
+
intervalMs: 30_000,
|
|
198
|
+
run: async () => {
|
|
199
|
+
const tasks = await api.taskList(ws);
|
|
200
|
+
store.dispatch({ type: 'data/taskList', ws, tasks });
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
out.push({
|
|
204
|
+
key: `workspaceState:${ws}`,
|
|
205
|
+
intervalMs: 30_000,
|
|
206
|
+
run: async () => {
|
|
207
|
+
const wsState = await api.workspaceGet(ws);
|
|
208
|
+
store.dispatch({ type: 'data/workspaceState', ws, state: wsState });
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const shown = viewDataset(state);
|
|
213
|
+
if (shown !== null) {
|
|
214
|
+
out.push({
|
|
215
|
+
key: `dataset:${shown.ws}:${shown.path}`,
|
|
216
|
+
intervalMs: 5_000,
|
|
217
|
+
run: () => datasets.tick(shown.ws, shown.path),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
if (view.kind === 'task') {
|
|
221
|
+
const { task } = view;
|
|
222
|
+
out.push({
|
|
223
|
+
key: `taskDetails:${ws}/${task}`,
|
|
224
|
+
intervalMs: 60_000,
|
|
225
|
+
run: async () => {
|
|
226
|
+
const details = await api.taskGet(view.ws, task);
|
|
227
|
+
store.dispatch({ type: 'data/taskDetails', ws: view.ws, task, details });
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
// The runs tab lists them; the title line's inputs hash reads the newest on every tab.
|
|
231
|
+
out.push({
|
|
232
|
+
key: `executions:${ws}/${task}`,
|
|
233
|
+
intervalMs: view.tab === 'runs' ? 5_000 : 30_000,
|
|
234
|
+
run: async () => {
|
|
235
|
+
const executions = await api.taskExecutionList(view.ws, task);
|
|
236
|
+
store.dispatch({ type: 'data/executions', ws: view.ws, task, executions });
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
// The shown stream every second; stderr every five seconds on every tab, so the
|
|
240
|
+
// Stderr tab's line count is there before the tab is visited.
|
|
241
|
+
const logTab = isLogTab(view.tab) ? view.tab : null;
|
|
242
|
+
for (const stream of ['stdout', 'stderr']) {
|
|
243
|
+
if (stream !== logTab && stream === 'stdout')
|
|
244
|
+
continue;
|
|
245
|
+
out.push({ key: `logs:${ws}/${task}/${stream}`, intervalMs: stream === logTab ? 1_000 : 5_000, run: () => logs.tick(view.ws, task, stream) });
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return out;
|
|
249
|
+
};
|
|
250
|
+
const sync = () => {
|
|
251
|
+
const state = store.getState();
|
|
252
|
+
const api = deps.api();
|
|
253
|
+
const wanted = api === null ? [] : specs(state, api);
|
|
254
|
+
const signature = wanted.map(s => `${s.key}@${s.intervalMs}`).join('|');
|
|
255
|
+
if (signature === lastSignature)
|
|
256
|
+
return;
|
|
257
|
+
lastSignature = signature;
|
|
258
|
+
const wantedKeys = new Set(wanted.map(s => s.key));
|
|
259
|
+
for (const [key, poller] of running) {
|
|
260
|
+
if (!wantedKeys.has(key)) {
|
|
261
|
+
poller.stop();
|
|
262
|
+
running.delete(key);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
for (const spec of wanted) {
|
|
266
|
+
const existing = running.get(spec.key);
|
|
267
|
+
if (existing !== undefined) {
|
|
268
|
+
existing.setInterval(spec.intervalMs);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const poller = createPoller({
|
|
272
|
+
key: spec.key,
|
|
273
|
+
intervalMs: spec.intervalMs,
|
|
274
|
+
clock: deps.clock,
|
|
275
|
+
run: spec.run,
|
|
276
|
+
onResult: () => dispatchConnection(),
|
|
277
|
+
onError: (error, failures) => {
|
|
278
|
+
deps.log?.(`feed ${spec.key} failed (${failures}): ${describeError(error)}`);
|
|
279
|
+
dispatchConnection();
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
running.set(spec.key, poller);
|
|
283
|
+
poller.start();
|
|
284
|
+
}
|
|
285
|
+
dispatchConnection();
|
|
286
|
+
};
|
|
287
|
+
return {
|
|
288
|
+
start() {
|
|
289
|
+
if (unsubscribe !== null)
|
|
290
|
+
return;
|
|
291
|
+
unsubscribe = store.subscribe(sync);
|
|
292
|
+
sync();
|
|
293
|
+
},
|
|
294
|
+
stop() {
|
|
295
|
+
unsubscribe?.();
|
|
296
|
+
unsubscribe = null;
|
|
297
|
+
for (const poller of running.values())
|
|
298
|
+
poller.stop();
|
|
299
|
+
running.clear();
|
|
300
|
+
lastSignature = '';
|
|
301
|
+
executionCursor.clear();
|
|
302
|
+
repoStatusRequested.clear();
|
|
303
|
+
datasets.reset();
|
|
304
|
+
logs.reset();
|
|
305
|
+
},
|
|
306
|
+
refresh() {
|
|
307
|
+
for (const poller of running.values())
|
|
308
|
+
poller.fireNow();
|
|
309
|
+
},
|
|
310
|
+
fire(key) {
|
|
311
|
+
running.get(key)?.fireNow();
|
|
312
|
+
},
|
|
313
|
+
pollers: () => [...running.values()],
|
|
314
|
+
sync,
|
|
315
|
+
datasets,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
//# sourceMappingURL=feeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeds.js","sourceRoot":"","sources":["../../../src/tui/data/feeds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAsB,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OA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
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Task logs — `taskLogs` in 64 KB chunks (`offset += size`) up to a 10 MB
|
|
7
|
+
* cap, polled every second for the stream on screen (and every five for
|
|
8
|
+
* stderr on every task tab, for the Stderr tab's line count). A stream that has
|
|
9
|
+
* no run yet reads as empty with `execution_not_found` noted; a chunk
|
|
10
|
+
* failure keeps what was fetched and notes the error.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import { type Api } from '../api.js';
|
|
15
|
+
import type { LogsData } from '../state/actions.js';
|
|
16
|
+
import type { Store } from '../state/store.js';
|
|
17
|
+
/** Bytes fetched per request. */
|
|
18
|
+
export declare const LOG_CHUNK: number;
|
|
19
|
+
/** Bytes kept per stream at most. */
|
|
20
|
+
export declare const LOG_CAP: number;
|
|
21
|
+
/** A stream name. */
|
|
22
|
+
export type LogStream = 'stdout' | 'stderr';
|
|
23
|
+
/** An empty stream record. */
|
|
24
|
+
export declare function emptyLogs(): LogsData;
|
|
25
|
+
/** What the loader needs. */
|
|
26
|
+
export interface LogsLoaderDeps {
|
|
27
|
+
store: Store;
|
|
28
|
+
api: () => Api | null;
|
|
29
|
+
log?: ((line: string) => void) | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** The logs loader. */
|
|
32
|
+
export interface LogsLoader {
|
|
33
|
+
/** Fetches the next chunks of a stream (up to a few per tick) and appends them. */
|
|
34
|
+
tick(ws: string, task: string, stream: LogStream): Promise<void>;
|
|
35
|
+
/** Drops the in-flight bookkeeping. */
|
|
36
|
+
reset(): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates the loader.
|
|
40
|
+
*
|
|
41
|
+
* @param deps - The store, the API accessor, the log
|
|
42
|
+
* @returns The loader
|
|
43
|
+
*/
|
|
44
|
+
export declare function createLogsLoader(deps: LogsLoaderDeps): LogsLoader;
|
|
45
|
+
/**
|
|
46
|
+
* The lines of a stream's text (a trailing newline does not add an empty line).
|
|
47
|
+
*
|
|
48
|
+
* @param text - The text
|
|
49
|
+
* @returns The lines
|
|
50
|
+
*/
|
|
51
|
+
export declare function logLines(text: string): string[];
|
|
52
|
+
/**
|
|
53
|
+
* The number of lines in a stream's text, as {@link logLines} counts them,
|
|
54
|
+
* without splitting it (the Stderr tab's badge, every frame).
|
|
55
|
+
*
|
|
56
|
+
* @param text - The text
|
|
57
|
+
* @returns The line count
|
|
58
|
+
*/
|
|
59
|
+
export declare function countLines(text: string): number;
|
|
60
|
+
/**
|
|
61
|
+
* The line indices containing `needle` (case-insensitive).
|
|
62
|
+
*
|
|
63
|
+
* @param lines - The lines
|
|
64
|
+
* @param needle - The search text
|
|
65
|
+
* @returns The matching line indices
|
|
66
|
+
*/
|
|
67
|
+
export declare function findInLines(lines: readonly string[], needle: string): number[];
|
|
68
|
+
//# sourceMappingURL=logs.d.ts.map
|