bareloop 0.46.1 → 0.47.1
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/CHANGELOG.md +26 -0
- package/README.md +2 -0
- package/bareloop.context.md +31 -12
- package/package.json +1 -1
- package/src/cli.js +29 -45
- package/src/launcher.js +477 -0
- package/src/learn.js +24 -16
- package/src/learnstore.js +9 -17
- package/src/opener.js +30 -0
- package/src/panel/authorroutes.js +1 -1
- package/src/panel/index.html +18 -9
- package/src/panel/server.js +55 -7
- package/src/panel/settingsroutes.js +3 -17
- package/src/tty-colour.js +27 -0
- package/src/userrun.js +2 -2
- package/types/cli.d.ts +2 -1
- package/types/launcher.d.ts +257 -0
- package/types/learn.d.ts +8 -7
- package/types/learnstore.d.ts +4 -5
- package/types/opener.d.ts +12 -0
- package/types/panel/authorroutes.d.ts +1 -0
- package/types/panel/server.d.ts +26 -1
- package/types/tty-colour.d.ts +33 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} target a folder path or a URL
|
|
3
|
+
* @param {{ platform?: string, spawnFn?: ((cmd: string, args: string[], o: object) => any)|null, underTest?: boolean }} [opts]
|
|
4
|
+
* `spawnFn: null` = no opener at all (resolves false); undefined = the real spawn, unless `underTest`, which spawns nothing
|
|
5
|
+
* unless a test injected one
|
|
6
|
+
* @returns {Promise<boolean>} true once the opener process has started
|
|
7
|
+
*/
|
|
8
|
+
export function openInOs(target: string, opts?: {
|
|
9
|
+
platform?: string;
|
|
10
|
+
spawnFn?: ((cmd: string, args: string[], o: object) => any) | null;
|
|
11
|
+
underTest?: boolean;
|
|
12
|
+
}): Promise<boolean>;
|
|
@@ -87,6 +87,7 @@ export function createAuthorRoutes(opts: {
|
|
|
87
87
|
handle: (req: import("node:http").IncomingMessage, res: import("node:http").ServerResponse, pathname: string, body: any) => boolean;
|
|
88
88
|
sessions: Map<string, any>;
|
|
89
89
|
headless: Map<string, any>;
|
|
90
|
+
openDrafts: () => number;
|
|
90
91
|
startSession: (card: any, reuse: {
|
|
91
92
|
spec: any;
|
|
92
93
|
workflowKey: string;
|
package/types/panel/server.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/** bareloop's own version, from its package.json (read once when the panel starts); 'unknown' if it cannot be read, never a guess
|
|
2
|
+
* @param {string} [file] test seam: another package.json
|
|
3
|
+
* @returns {string} */
|
|
4
|
+
export function packageVersion(file?: string): string;
|
|
1
5
|
/**
|
|
2
6
|
* `[✓]`/`[✗]`/`[■]`/`[▶]` — the ONLY vocabulary a result is ever rendered in
|
|
3
7
|
* (auto-memory `ui-verdict-words.md`: never the words green/red/soft-green
|
|
@@ -288,6 +292,20 @@ export function runsListPayload(opts?: {
|
|
|
288
292
|
needsYouDays: 7;
|
|
289
293
|
}>;
|
|
290
294
|
};
|
|
295
|
+
/**
|
|
296
|
+
* The runs list as the panel builds it, for a caller with no panel running (the launcher header): the same `runsListPayload` over a
|
|
297
|
+
* schedule door built read-only (no scheduler, no timer), so Needs you = the rows tagged `needs` + the schedules that gave up, ONE owner.
|
|
298
|
+
* @param {{ home?: string, now?: number, env?: Record<string, string|undefined> }} [opts]
|
|
299
|
+
* @returns {{ runs: any[], gaveUp: any[] }}
|
|
300
|
+
*/
|
|
301
|
+
export function runsListForCount(opts?: {
|
|
302
|
+
home?: string;
|
|
303
|
+
now?: number;
|
|
304
|
+
env?: Record<string, string | undefined>;
|
|
305
|
+
}): {
|
|
306
|
+
runs: any[];
|
|
307
|
+
gaveUp: any[];
|
|
308
|
+
};
|
|
291
309
|
/**
|
|
292
310
|
* T Part 8 — what the Accept route needs: the run's row, whether its runner is alive, whether it waits at its review door
|
|
293
311
|
* ({@link doorWaiting}), and the signed spec it was judged by (the file and hash `run-u --door --approve` takes).
|
|
@@ -764,11 +782,12 @@ export function getStartFromImport(id: string, opts?: {
|
|
|
764
782
|
* only `createPanelServer` below always supplies one.
|
|
765
783
|
* @param {import('node:http').IncomingMessage} req
|
|
766
784
|
* @param {import('node:http').ServerResponse} res
|
|
767
|
-
* @param {{ home?: string, sessionsRoot?: string, packageJsonPath?: string, port: number, token?: string, authorRoutes?: ReturnType<typeof createAuthorRoutes>, settingsRoutes?: ReturnType<typeof createSettingsRoutes>, runRoutes?: ReturnType<typeof createRunRoutes>, importRoutes?: ReturnType<typeof createImportRoutes>, schedules?: ReturnType<typeof createScheduleDoor> }} opts
|
|
785
|
+
* @param {{ home?: string, sessionsRoot?: string, version?: string, packageJsonPath?: string, port: number, token?: string, authorRoutes?: ReturnType<typeof createAuthorRoutes>, settingsRoutes?: ReturnType<typeof createSettingsRoutes>, runRoutes?: ReturnType<typeof createRunRoutes>, importRoutes?: ReturnType<typeof createImportRoutes>, schedules?: ReturnType<typeof createScheduleDoor> }} opts
|
|
768
786
|
*/
|
|
769
787
|
export function handleRequest(req: import("node:http").IncomingMessage, res: import("node:http").ServerResponse, opts: {
|
|
770
788
|
home?: string;
|
|
771
789
|
sessionsRoot?: string;
|
|
790
|
+
version?: string;
|
|
772
791
|
packageJsonPath?: string;
|
|
773
792
|
port: number;
|
|
774
793
|
token?: string;
|
|
@@ -778,6 +797,12 @@ export function handleRequest(req: import("node:http").IncomingMessage, res: imp
|
|
|
778
797
|
importRoutes?: ReturnType<typeof createImportRoutes>;
|
|
779
798
|
schedules?: ReturnType<typeof createScheduleDoor>;
|
|
780
799
|
}): void;
|
|
800
|
+
/**
|
|
801
|
+
* The ONE spelling of the panel's own address (the launcher prints and opens it too).
|
|
802
|
+
* @param {number} boundPort
|
|
803
|
+
* @returns {string}
|
|
804
|
+
*/
|
|
805
|
+
export function panelUrl(boundPort: number): string;
|
|
781
806
|
/**
|
|
782
807
|
* Start the panel server. Binds `127.0.0.1` ONLY. A taken port is a LOUD,
|
|
783
808
|
* non-zero-exit failure — this never falls back to another port (see file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} Paint
|
|
3
|
+
* @property {boolean} on
|
|
4
|
+
* @property {(s: string) => string} grey @property {(s: string) => string} green @property {(s: string) => string} yellow
|
|
5
|
+
* @property {(s: string) => string} red @property {(s: string) => string} cyan @property {(s: string) => string} boldCyan
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Colour is on only for a terminal: the stream says it is a TTY, `NO_COLOR` is empty/unset, and `TERM` is not `dumb`.
|
|
9
|
+
* @param {{isTTY?: boolean}|undefined} stream the output stream (process.stdout)
|
|
10
|
+
* @param {Record<string, string|undefined>} [env]
|
|
11
|
+
* @returns {Paint}
|
|
12
|
+
*/
|
|
13
|
+
export function makePaint(stream: {
|
|
14
|
+
isTTY?: boolean;
|
|
15
|
+
} | undefined, env?: Record<string, string | undefined>): Paint;
|
|
16
|
+
export namespace PLAIN {
|
|
17
|
+
let on: boolean;
|
|
18
|
+
let grey: (s: string) => string;
|
|
19
|
+
let green: (s: string) => string;
|
|
20
|
+
let yellow: (s: string) => string;
|
|
21
|
+
let red: (s: string) => string;
|
|
22
|
+
let cyan: (s: string) => string;
|
|
23
|
+
let boldCyan: (s: string) => string;
|
|
24
|
+
}
|
|
25
|
+
export type Paint = {
|
|
26
|
+
on: boolean;
|
|
27
|
+
grey: (s: string) => string;
|
|
28
|
+
green: (s: string) => string;
|
|
29
|
+
yellow: (s: string) => string;
|
|
30
|
+
red: (s: string) => string;
|
|
31
|
+
cyan: (s: string) => string;
|
|
32
|
+
boldCyan: (s: string) => string;
|
|
33
|
+
};
|