4runr-os 1.0.14 → 1.0.21
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/animations.d.ts +26 -0
- package/dist/animations.d.ts.map +1 -0
- package/dist/animations.js +111 -0
- package/dist/animations.js.map +1 -0
- package/dist/copy.d.ts +62 -0
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +70 -0
- package/dist/copy.js.map +1 -0
- package/dist/index.js +697 -279
- package/dist/index.js.map +1 -1
- package/dist/state.d.ts +28 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +87 -0
- package/dist/state.js.map +1 -0
- package/dist/store.d.ts +69 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +86 -0
- package/dist/store.js.map +1 -0
- package/dist/theme.d.ts +21 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +31 -0
- package/dist/theme.js.map +1 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/home-view.d.ts +27 -0
- package/dist/ui/home-view.d.ts.map +1 -0
- package/dist/ui/home-view.js +127 -0
- package/dist/ui/home-view.js.map +1 -0
- package/dist/ui-primitives.d.ts +53 -0
- package/dist/ui-primitives.d.ts.map +1 -0
- package/dist/ui-primitives.js +156 -0
- package/dist/ui-primitives.js.map +1 -0
- package/dist/utils.d.ts +17 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +35 -0
- package/dist/utils.js.map +1 -0
- package/package.json +1 -1
package/dist/store.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 4Runr OS State Store
|
|
3
|
+
*
|
|
4
|
+
* Central state management - single source of truth
|
|
5
|
+
* All runtime state lives here, not scattered across modules
|
|
6
|
+
*
|
|
7
|
+
* ARCHITECTURE:
|
|
8
|
+
* - This is the runtime state store (in-memory)
|
|
9
|
+
* - For persistent state (last agent, last run, etc.), see state.ts
|
|
10
|
+
*
|
|
11
|
+
* USAGE:
|
|
12
|
+
* - Read state: const state = getState()
|
|
13
|
+
* - Update state: updateAppState({ field: value })
|
|
14
|
+
* - Never mutate state directly - always use updateAppState()
|
|
15
|
+
*
|
|
16
|
+
* EXTENSION:
|
|
17
|
+
* - To add new state, add it to AppState interface
|
|
18
|
+
* - Update syncStateToStore() in index.ts if needed (during migration)
|
|
19
|
+
* - See CONTRIBUTING-CLI.md for full extension recipe
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Global state store
|
|
23
|
+
* Access via getState() and updateState()
|
|
24
|
+
*/
|
|
25
|
+
let appState = {
|
|
26
|
+
systemReady: false,
|
|
27
|
+
currentView: 'BOOT',
|
|
28
|
+
gatewayClient: null,
|
|
29
|
+
gatewayConnected: false,
|
|
30
|
+
gatewayUrl: null,
|
|
31
|
+
localMode: false,
|
|
32
|
+
currentUser: null,
|
|
33
|
+
sessionCheckInterval: null,
|
|
34
|
+
customAgents: new Map(),
|
|
35
|
+
runHistory: [],
|
|
36
|
+
currentRun: {
|
|
37
|
+
runId: null,
|
|
38
|
+
agentName: null,
|
|
39
|
+
startedAt: null,
|
|
40
|
+
},
|
|
41
|
+
firstRunCompleted: false,
|
|
42
|
+
chatMode: false,
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Get current state (read-only)
|
|
46
|
+
* Use this to read state in UI renderers and commands
|
|
47
|
+
*/
|
|
48
|
+
export function getState() {
|
|
49
|
+
return appState;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Update app state (immutable update)
|
|
53
|
+
* Returns new state object, doesn't mutate original
|
|
54
|
+
*
|
|
55
|
+
* NOTE: This is for runtime state. For persistent state (last agent, etc.),
|
|
56
|
+
* use updateState from state.ts
|
|
57
|
+
*/
|
|
58
|
+
export function updateAppState(updates) {
|
|
59
|
+
appState = { ...appState, ...updates };
|
|
60
|
+
return appState;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Reset state (for testing or fresh start)
|
|
64
|
+
*/
|
|
65
|
+
export function resetState() {
|
|
66
|
+
appState = {
|
|
67
|
+
systemReady: false,
|
|
68
|
+
currentView: 'BOOT',
|
|
69
|
+
gatewayClient: null,
|
|
70
|
+
gatewayConnected: false,
|
|
71
|
+
gatewayUrl: null,
|
|
72
|
+
localMode: false,
|
|
73
|
+
currentUser: null,
|
|
74
|
+
sessionCheckInterval: null,
|
|
75
|
+
customAgents: new Map(),
|
|
76
|
+
runHistory: [],
|
|
77
|
+
currentRun: {
|
|
78
|
+
runId: null,
|
|
79
|
+
agentName: null,
|
|
80
|
+
startedAt: null,
|
|
81
|
+
},
|
|
82
|
+
firstRunCompleted: false,
|
|
83
|
+
chatMode: false,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA8CH;;;GAGG;AACH,IAAI,QAAQ,GAAa;IACvB,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,MAAM;IACnB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,KAAK;IACvB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,IAAI;IACjB,oBAAoB,EAAE,IAAI;IAC1B,YAAY,EAAE,IAAI,GAAG,EAAE;IACvB,UAAU,EAAE,EAAE;IACd,UAAU,EAAE;QACV,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;KAChB;IACD,iBAAiB,EAAE,KAAK;IACxB,QAAQ,EAAE,KAAK;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAA0B;IACvD,QAAQ,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;IACvC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,QAAQ,GAAG;QACT,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,MAAM;QACnB,aAAa,EAAE,IAAI;QACnB,gBAAgB,EAAE,KAAK;QACvB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,IAAI;QACjB,oBAAoB,EAAE,IAAI;QAC1B,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,UAAU,EAAE,EAAE;QACd,UAAU,EAAE;YACV,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,IAAI;SAChB;QACD,iBAAiB,EAAE,KAAK;QACxB,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC"}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 4Runr OS Theme Tokens
|
|
3
|
+
* Central color system - never hardcode colors in views
|
|
4
|
+
*/
|
|
5
|
+
export declare const C_BRAND = "\u001B[38;2;110;86;207m";
|
|
6
|
+
export declare const C_ACCENT = "\u001B[38;2;6;182;212m";
|
|
7
|
+
export declare const C_TEXT = "\u001B[37m";
|
|
8
|
+
export declare const C_MUTED = "\u001B[90m";
|
|
9
|
+
export declare const C_SUCCESS = "\u001B[32m";
|
|
10
|
+
export declare const C_WARN = "\u001B[33m";
|
|
11
|
+
export declare const C_ERROR = "\u001B[31m";
|
|
12
|
+
export declare const C_DIM = "\u001B[2m\u001B[90m";
|
|
13
|
+
export declare const C_LINK = "\u001B[38;2;6;182;212m";
|
|
14
|
+
export declare const C_BRAND_BRIGHT = "\u001B[1m\u001B[38;2;110;86;207m";
|
|
15
|
+
export declare const C_ACCENT_BRIGHT = "\u001B[1m\u001B[38;2;6;182;212m";
|
|
16
|
+
export declare const C_TEXT_BRIGHT = "\u001B[1m\u001B[37m";
|
|
17
|
+
export declare const C_SUCCESS_BRIGHT = "\u001B[1m\u001B[32m";
|
|
18
|
+
export declare const RESET = "\u001B[0m";
|
|
19
|
+
export declare const BOLD = "\u001B[1m";
|
|
20
|
+
export declare const DIM = "\u001B[2m";
|
|
21
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,OAAO,4BAA0B,CAAC;AAC/C,eAAO,MAAM,QAAQ,2BAAyB,CAAC;AAC/C,eAAO,MAAM,MAAM,eAAa,CAAC;AACjC,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,SAAS,eAAa,CAAC;AACpC,eAAO,MAAM,MAAM,eAAa,CAAC;AACjC,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,KAAK,wBAAoB,CAAC;AACvC,eAAO,MAAM,MAAM,2BAAyB,CAAC;AAG7C,eAAO,MAAM,cAAc,qCAAiC,CAAC;AAC7D,eAAO,MAAM,eAAe,oCAAgC,CAAC;AAC7D,eAAO,MAAM,aAAa,wBAAoB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,wBAAoB,CAAC;AAGlD,eAAO,MAAM,KAAK,cAAY,CAAC;AAG/B,eAAO,MAAM,IAAI,cAAY,CAAC;AAC9B,eAAO,MAAM,GAAG,cAAY,CAAC"}
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 4Runr OS Theme Tokens
|
|
3
|
+
* Central color system - never hardcode colors in views
|
|
4
|
+
*/
|
|
5
|
+
// Color tokens (exact names as per spec)
|
|
6
|
+
export const C_BRAND = '\x1b[38;2;110;86;207m'; // Primary purple (brand anchor)
|
|
7
|
+
export const C_ACCENT = '\x1b[38;2;6;182;212m'; // Electric blue (interactive/highlights)
|
|
8
|
+
export const C_TEXT = '\x1b[37m'; // Standard white (default text)
|
|
9
|
+
export const C_MUTED = '\x1b[90m'; // Muted grey (secondary labels, hints)
|
|
10
|
+
export const C_SUCCESS = '\x1b[32m'; // Success green (OK, READY, PASSED)
|
|
11
|
+
export const C_WARN = '\x1b[33m'; // Warning amber/yellow (DEGRADED, CAUTION)
|
|
12
|
+
export const C_ERROR = '\x1b[31m'; // Error red (FAILED, DENIED)
|
|
13
|
+
export const C_DIM = '\x1b[2m\x1b[90m'; // Extra-dim grey (borders, separators)
|
|
14
|
+
export const C_LINK = '\x1b[38;2;6;182;212m'; // Same as accent (commands shown to user)
|
|
15
|
+
// Bright variants
|
|
16
|
+
export const C_BRAND_BRIGHT = '\x1b[1m\x1b[38;2;110;86;207m';
|
|
17
|
+
export const C_ACCENT_BRIGHT = '\x1b[1m\x1b[38;2;6;182;212m';
|
|
18
|
+
export const C_TEXT_BRIGHT = '\x1b[1m\x1b[37m';
|
|
19
|
+
export const C_SUCCESS_BRIGHT = '\x1b[1m\x1b[32m';
|
|
20
|
+
// Reset
|
|
21
|
+
export const RESET = '\x1b[0m';
|
|
22
|
+
// Typography helpers
|
|
23
|
+
export const BOLD = '\x1b[1m';
|
|
24
|
+
export const DIM = '\x1b[2m';
|
|
25
|
+
// Usage rules:
|
|
26
|
+
// - C_BRAND: headers, borders, "4Runr", major UI separators
|
|
27
|
+
// - C_ACCENT: commands user can type, selected items, focus indicators
|
|
28
|
+
// - C_MUTED: labels, hints, minor metadata (timestamps, ids)
|
|
29
|
+
// - C_TEXT: content values
|
|
30
|
+
// - C_SUCCESS/C_WARN/C_ERROR: status-only (don't overuse)
|
|
31
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;GAGG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CustomAgent {
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
baseAgent: string;
|
|
9
|
+
systemPrompt?: string;
|
|
10
|
+
temperature?: number;
|
|
11
|
+
maxTokens?: number;
|
|
12
|
+
useLocalModel?: boolean;
|
|
13
|
+
localModelProvider?: 'ollama' | 'lm-studio' | 'custom';
|
|
14
|
+
localModelName?: string;
|
|
15
|
+
localModelUrl?: string;
|
|
16
|
+
topP?: number;
|
|
17
|
+
frequencyPenalty?: number;
|
|
18
|
+
presencePenalty?: number;
|
|
19
|
+
tools?: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface CustomTool {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
code: string;
|
|
25
|
+
parameters?: Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
required?: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
version?: string;
|
|
32
|
+
author?: string;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HOME View Renderer
|
|
3
|
+
*
|
|
4
|
+
* EXTENSION EXAMPLE: This is the pattern all view renderers should follow
|
|
5
|
+
*
|
|
6
|
+
* Rules:
|
|
7
|
+
* - Pure function: receives state → returns rendered string
|
|
8
|
+
* - No side effects, no console.log, no state mutations
|
|
9
|
+
* - Use UI primitives (Section, Table, Alert, etc.)
|
|
10
|
+
* - Import types with `import type` (not regular import)
|
|
11
|
+
*
|
|
12
|
+
* To create a new view:
|
|
13
|
+
* 1. Create file: src/ui/my-view.ts
|
|
14
|
+
* 2. Export function: renderMyView(state: AppState): string
|
|
15
|
+
* 3. Use UI primitives to build output
|
|
16
|
+
* 4. Return joined string (ready for console.log)
|
|
17
|
+
*
|
|
18
|
+
* See CONTRIBUTING-CLI.md for full extension recipe
|
|
19
|
+
*/
|
|
20
|
+
import type { AppState } from '../store.js';
|
|
21
|
+
/**
|
|
22
|
+
* Render HOME view
|
|
23
|
+
* @param state - Current application state
|
|
24
|
+
* @returns Rendered view as string (ready to console.log)
|
|
25
|
+
*/
|
|
26
|
+
export declare function renderHomeView(state: AppState): string;
|
|
27
|
+
//# sourceMappingURL=home-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home-view.d.ts","sourceRoot":"","sources":["../../src/ui/home-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAM5C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CA8GtD"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HOME View Renderer
|
|
3
|
+
*
|
|
4
|
+
* EXTENSION EXAMPLE: This is the pattern all view renderers should follow
|
|
5
|
+
*
|
|
6
|
+
* Rules:
|
|
7
|
+
* - Pure function: receives state → returns rendered string
|
|
8
|
+
* - No side effects, no console.log, no state mutations
|
|
9
|
+
* - Use UI primitives (Section, Table, Alert, etc.)
|
|
10
|
+
* - Import types with `import type` (not regular import)
|
|
11
|
+
*
|
|
12
|
+
* To create a new view:
|
|
13
|
+
* 1. Create file: src/ui/my-view.ts
|
|
14
|
+
* 2. Export function: renderMyView(state: AppState): string
|
|
15
|
+
* 3. Use UI primitives to build output
|
|
16
|
+
* 4. Return joined string (ready for console.log)
|
|
17
|
+
*
|
|
18
|
+
* See CONTRIBUTING-CLI.md for full extension recipe
|
|
19
|
+
*/
|
|
20
|
+
import { Section, Table, StatusBar, truncateText } from '../ui-primitives.js';
|
|
21
|
+
import { C_ACCENT, C_SUCCESS, C_WARN, C_MUTED, C_LINK, RESET } from '../theme.js';
|
|
22
|
+
import { isZeroState } from '../state.js';
|
|
23
|
+
import { formatRelativeTime, truncateId } from '../utils.js';
|
|
24
|
+
/**
|
|
25
|
+
* Render HOME view
|
|
26
|
+
* @param state - Current application state
|
|
27
|
+
* @returns Rendered view as string (ready to console.log)
|
|
28
|
+
*/
|
|
29
|
+
export function renderHomeView(state) {
|
|
30
|
+
const lines = [];
|
|
31
|
+
// Check for zero state (first-time experience)
|
|
32
|
+
const zeroState = isZeroState() && state.customAgents.size === 0;
|
|
33
|
+
if (zeroState) {
|
|
34
|
+
// Zero state: calm message, clear status, 3 primary actions
|
|
35
|
+
const statusLines = [];
|
|
36
|
+
statusLines.push(`MODE: ${state.localMode ? C_SUCCESS + 'LOCAL' : C_WARN + 'NOT CONNECTED' + RESET}`);
|
|
37
|
+
statusLines.push(`CONNECTION: ${state.gatewayConnected ? C_SUCCESS + 'Connected' : C_WARN + 'Not Connected' + RESET}`);
|
|
38
|
+
statusLines.push(`AGENTS: ${C_ACCENT}0${RESET}`);
|
|
39
|
+
lines.push(Section('SYSTEM STATUS', statusLines));
|
|
40
|
+
lines.push('');
|
|
41
|
+
lines.push('Welcome to 4Runr OS');
|
|
42
|
+
lines.push('Get started with one of the actions below');
|
|
43
|
+
lines.push('');
|
|
44
|
+
const actionLines = [];
|
|
45
|
+
actionLines.push(`${C_LINK}connect${RESET} ${C_MUTED}Attach gateway / remote${RESET}`);
|
|
46
|
+
actionLines.push(`${C_LINK}start${RESET} ${C_MUTED}Begin doing useful work${RESET}`);
|
|
47
|
+
actionLines.push(`${C_LINK}help${RESET} ${C_MUTED}Explain system${RESET}`);
|
|
48
|
+
lines.push(Section('GET STARTED', actionLines));
|
|
49
|
+
lines.push('');
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Normal state: full mission control
|
|
53
|
+
// 1. SESSION
|
|
54
|
+
const sessionLines = [];
|
|
55
|
+
const mode = state.localMode ? 'LOCAL' : (state.gatewayConnected ? 'REMOTE' : 'OFFLINE');
|
|
56
|
+
sessionLines.push(`Mode: ${C_ACCENT}${mode}${RESET}`);
|
|
57
|
+
const workspace = state.currentUser?.username || 'default';
|
|
58
|
+
sessionLines.push(`Workspace: ${C_ACCENT}${workspace}${RESET}`);
|
|
59
|
+
const connectionStatus = state.gatewayConnected ? `${C_SUCCESS}CONNECTED${RESET}` : `${C_WARN}DISCONNECTED${RESET}`;
|
|
60
|
+
const target = state.gatewayConnected ? truncateText(state.gatewayUrl || '', 30) : 'none';
|
|
61
|
+
sessionLines.push(`Connection: ${connectionStatus} Target: ${C_MUTED}${target}${RESET}`);
|
|
62
|
+
// Uptime would be calculated from boot time in state
|
|
63
|
+
sessionLines.push(`Uptime: ${C_MUTED}0m${RESET}`);
|
|
64
|
+
lines.push(Section('SESSION', sessionLines));
|
|
65
|
+
lines.push('');
|
|
66
|
+
// 2. AGENTS
|
|
67
|
+
const agentCount = state.customAgents.size;
|
|
68
|
+
const agentRows = [];
|
|
69
|
+
if (agentCount > 0) {
|
|
70
|
+
const topAgents = Array.from(state.customAgents.values()).slice(0, 3);
|
|
71
|
+
topAgents.forEach(agent => {
|
|
72
|
+
agentRows.push([
|
|
73
|
+
truncateText(agent.name, 20),
|
|
74
|
+
truncateText(agent.baseAgent, 15),
|
|
75
|
+
'IDLE'
|
|
76
|
+
]);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const agentTable = agentCount > 0
|
|
80
|
+
? Table(['NAME', 'MODEL', 'STATUS'], agentRows, 3)
|
|
81
|
+
: `${C_MUTED} No agents configured${RESET}`;
|
|
82
|
+
lines.push(Section('AGENTS', [`Total count: ${C_ACCENT}${agentCount}${RESET}`, agentTable]));
|
|
83
|
+
lines.push('');
|
|
84
|
+
// 3. RECENT RUNS
|
|
85
|
+
const recentRuns = state.runHistory.slice(-3).reverse();
|
|
86
|
+
const runRows = [];
|
|
87
|
+
if (recentRuns.length > 0) {
|
|
88
|
+
recentRuns.forEach(run => {
|
|
89
|
+
runRows.push([
|
|
90
|
+
truncateId(run.runId, 8),
|
|
91
|
+
truncateText(run.agentName, 15),
|
|
92
|
+
run.status === 'SUCCESS' ? `${C_SUCCESS}SUCCESS${RESET}` :
|
|
93
|
+
run.status === 'FAILED' ? `${C_WARN}FAILED${RESET}` :
|
|
94
|
+
`${C_ACCENT}RUNNING${RESET}`,
|
|
95
|
+
formatRelativeTime(run.timestamp)
|
|
96
|
+
]);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const runTable = recentRuns.length > 0
|
|
100
|
+
? Table(['ID', 'AGENT', 'STATUS', 'TIMESTAMP'], runRows, 3)
|
|
101
|
+
: `${C_MUTED} No runs yet${RESET}`;
|
|
102
|
+
lines.push(Section('RECENT RUNS', [runTable]));
|
|
103
|
+
lines.push('');
|
|
104
|
+
// 4. QUICK ACTIONS (Footer)
|
|
105
|
+
const quickActionLines = [];
|
|
106
|
+
quickActionLines.push(`${C_LINK}start${RESET} ${C_MUTED}Begin execution${RESET}`);
|
|
107
|
+
quickActionLines.push(`${C_LINK}build${RESET} ${C_MUTED}Create or edit agent${RESET}`);
|
|
108
|
+
quickActionLines.push(`${C_LINK}metrics${RESET} ${C_MUTED}View performance${RESET}`);
|
|
109
|
+
quickActionLines.push(`${C_LINK}system${RESET} ${C_MUTED}Infrastructure status${RESET}`);
|
|
110
|
+
quickActionLines.push(`${C_LINK}help${RESET} ${C_MUTED}Show available commands${RESET}`);
|
|
111
|
+
lines.push(Section('QUICK ACTIONS', quickActionLines));
|
|
112
|
+
lines.push('');
|
|
113
|
+
}
|
|
114
|
+
// StatusBar
|
|
115
|
+
const mode = state.localMode ? 'LOCAL' : (state.gatewayConnected ? 'REMOTE' : 'OFFLINE');
|
|
116
|
+
const statusBar = StatusBar({
|
|
117
|
+
mode: mode,
|
|
118
|
+
connected: state.gatewayConnected,
|
|
119
|
+
target: state.gatewayUrl ? truncateText(state.gatewayUrl, 30) : undefined,
|
|
120
|
+
workspace: state.currentUser?.username,
|
|
121
|
+
lastAction: 'home',
|
|
122
|
+
});
|
|
123
|
+
lines.push(statusBar);
|
|
124
|
+
lines.push('');
|
|
125
|
+
return lines.join('\n');
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=home-view.js.map
|
|
@@ -0,0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AAQ;QACtC,UAAU,EAAE,MAAM;KACnB,CAAC,CAAC;IACH,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 4Runr OS UI Primitives
|
|
3
|
+
* Building blocks for all views - compose these, don't print raw strings
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Header: consistent brand bar at top
|
|
7
|
+
* Format: 4Runr | AI AGENT OPERATING SYSTEM | vX.Y.Z | [MODE]
|
|
8
|
+
*/
|
|
9
|
+
export declare function Header(version: string, mode?: 'LOCAL' | 'REMOTE'): string;
|
|
10
|
+
/**
|
|
11
|
+
* StatusBar: 1-2 line HUD after each command
|
|
12
|
+
* Shows: MODE, CONNECTION, WORKSPACE, LAST ACTION
|
|
13
|
+
*/
|
|
14
|
+
export declare function StatusBar(params: {
|
|
15
|
+
mode: 'LOCAL' | 'REMOTE' | 'OFFLINE';
|
|
16
|
+
connected: boolean;
|
|
17
|
+
target?: string;
|
|
18
|
+
workspace?: string;
|
|
19
|
+
lastAction?: string;
|
|
20
|
+
}): string;
|
|
21
|
+
/**
|
|
22
|
+
* Section: clean blocks with separators
|
|
23
|
+
* Structure: Title (caps) | Separator | Lines (indented)
|
|
24
|
+
*/
|
|
25
|
+
export declare function Section(title: string, lines: string[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Table: aligned columns for lists
|
|
28
|
+
* Handles truncation: IDs (8 chars), names (with ...), max 10 rows default
|
|
29
|
+
*/
|
|
30
|
+
export declare function Table(headers: string[], rows: string[][], maxRows?: number): string;
|
|
31
|
+
/**
|
|
32
|
+
* Alert: consistent success/warn/error output
|
|
33
|
+
* Format: [OK|WARN|ERROR|INFO] Title | Detail | NEXT: command
|
|
34
|
+
*/
|
|
35
|
+
export declare function Alert(type: 'success' | 'warn' | 'error' | 'info', title: string, message?: string, hintCommand?: string): string;
|
|
36
|
+
export declare function Progress(label: string, mode?: 'spinner' | 'line'): {
|
|
37
|
+
start: () => void;
|
|
38
|
+
stop: (success: boolean, message?: string) => void;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Prompt: consistent input line
|
|
42
|
+
* Format: 4runr> or 4runr:view>
|
|
43
|
+
*/
|
|
44
|
+
export declare function Prompt(view?: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Helper: truncate ID to 8 chars
|
|
47
|
+
*/
|
|
48
|
+
export declare function truncateId(id: string, length?: number): string;
|
|
49
|
+
/**
|
|
50
|
+
* Helper: truncate text with ellipsis
|
|
51
|
+
*/
|
|
52
|
+
export declare function truncateText(text: string, maxLength: number): string;
|
|
53
|
+
//# sourceMappingURL=ui-primitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-primitives.d.ts","sourceRoot":"","sources":["../src/ui-primitives.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH;;;GAGG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAKzE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE;IAChC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CAYT;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9D;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,GAAE,MAAW,GAAG,MAAM,CAuCvF;AAED;;;GAGG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAC3C,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAcR;AASD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,SAAS,GAAG,MAAe,GAAG;IAC1E,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD,CAmCA;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGpE"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 4Runr OS UI Primitives
|
|
3
|
+
* Building blocks for all views - compose these, don't print raw strings
|
|
4
|
+
*/
|
|
5
|
+
import { C_BRAND, C_ACCENT, C_TEXT, C_MUTED, C_SUCCESS, C_WARN, C_ERROR, C_DIM, C_BRAND_BRIGHT, RESET, } from './theme';
|
|
6
|
+
/**
|
|
7
|
+
* Header: consistent brand bar at top
|
|
8
|
+
* Format: 4Runr | AI AGENT OPERATING SYSTEM | vX.Y.Z | [MODE]
|
|
9
|
+
*/
|
|
10
|
+
export function Header(version, mode) {
|
|
11
|
+
const modeText = mode ? ` | ${mode}` : '';
|
|
12
|
+
return `${C_BRAND}╔═══════════════════════════════════════════════════════════════════════════╗${RESET}\n` +
|
|
13
|
+
`${C_BRAND}║${RESET} ${C_BRAND_BRIGHT}4Runr${RESET} ${C_TEXT}AI AGENT OPERATING SYSTEM${RESET} ${C_MUTED}v${version}${RESET}${modeText} ${C_BRAND}║${RESET}\n` +
|
|
14
|
+
`${C_BRAND}╚═══════════════════════════════════════════════════════════════════════════╝${RESET}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* StatusBar: 1-2 line HUD after each command
|
|
18
|
+
* Shows: MODE, CONNECTION, WORKSPACE, LAST ACTION
|
|
19
|
+
*/
|
|
20
|
+
export function StatusBar(params) {
|
|
21
|
+
const { mode, connected, target, workspace, lastAction } = params;
|
|
22
|
+
const modeText = `MODE: ${mode}`;
|
|
23
|
+
const connText = connected
|
|
24
|
+
? `CONNECTION: ${C_SUCCESS}Connected${RESET}${target ? ` ${C_MUTED}(${target})${RESET}` : ''}`
|
|
25
|
+
: `CONNECTION: ${C_WARN}Not Connected${RESET}`;
|
|
26
|
+
const workspaceText = workspace ? `WORKSPACE: ${C_TEXT}${workspace}${RESET}` : '';
|
|
27
|
+
const lastText = lastAction ? `LAST: ${lastAction}` : '';
|
|
28
|
+
const parts = [modeText, connText, workspaceText, lastText].filter(Boolean);
|
|
29
|
+
return `${C_DIM}${parts.join(' ')}${RESET}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Section: clean blocks with separators
|
|
33
|
+
* Structure: Title (caps) | Separator | Lines (indented)
|
|
34
|
+
*/
|
|
35
|
+
export function Section(title, lines) {
|
|
36
|
+
const titleLine = `${C_MUTED}${title.toUpperCase()}${RESET}`;
|
|
37
|
+
const separator = `${C_DIM}────────────────────────────────────────────────────────────────────────${RESET}`;
|
|
38
|
+
const content = lines.map(line => ` ${line}`).join('\n');
|
|
39
|
+
return `${titleLine}\n${separator}\n${content}`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Table: aligned columns for lists
|
|
43
|
+
* Handles truncation: IDs (8 chars), names (with ...), max 10 rows default
|
|
44
|
+
*/
|
|
45
|
+
export function Table(headers, rows, maxRows = 10) {
|
|
46
|
+
if (rows.length === 0) {
|
|
47
|
+
return `${C_MUTED} (empty)${RESET}`;
|
|
48
|
+
}
|
|
49
|
+
const displayRows = rows.slice(0, maxRows);
|
|
50
|
+
// Calculate column widths
|
|
51
|
+
const widths = headers.map((header, i) => {
|
|
52
|
+
const headerWidth = header.length;
|
|
53
|
+
const maxContentWidth = Math.max(...displayRows.map(row => (row[i] || '').length));
|
|
54
|
+
return Math.max(headerWidth, maxContentWidth, 8);
|
|
55
|
+
});
|
|
56
|
+
// Build header
|
|
57
|
+
const headerLine = headers
|
|
58
|
+
.map((header, i) => header.padEnd(widths[i]))
|
|
59
|
+
.join(' ');
|
|
60
|
+
// Build rows
|
|
61
|
+
const rowLines = displayRows.map(row => {
|
|
62
|
+
return row
|
|
63
|
+
.map((cell, i) => {
|
|
64
|
+
const width = widths[i];
|
|
65
|
+
// Truncate if needed
|
|
66
|
+
if (cell.length > width) {
|
|
67
|
+
return cell.substring(0, width - 3) + '...';
|
|
68
|
+
}
|
|
69
|
+
return cell.padEnd(width);
|
|
70
|
+
})
|
|
71
|
+
.join(' ');
|
|
72
|
+
});
|
|
73
|
+
const headerText = `${C_MUTED}${headerLine}${RESET}`;
|
|
74
|
+
const rowText = rowLines.map(line => ` ${line}`).join('\n');
|
|
75
|
+
return `${headerText}\n${rowText}${rows.length > maxRows ? `\n${C_MUTED} ... ${rows.length - maxRows} more${RESET}` : ''}`;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Alert: consistent success/warn/error output
|
|
79
|
+
* Format: [OK|WARN|ERROR|INFO] Title | Detail | NEXT: command
|
|
80
|
+
*/
|
|
81
|
+
export function Alert(type, title, message, hintCommand) {
|
|
82
|
+
const typeMap = {
|
|
83
|
+
success: { label: 'OK', color: C_SUCCESS },
|
|
84
|
+
warn: { label: 'WARN', color: C_WARN },
|
|
85
|
+
error: { label: 'ERROR', color: C_ERROR },
|
|
86
|
+
info: { label: 'INFO', color: C_ACCENT },
|
|
87
|
+
};
|
|
88
|
+
const { label, color } = typeMap[type];
|
|
89
|
+
const titleLine = `${color}${label}${RESET} ${title}`;
|
|
90
|
+
const messageLine = message ? `\n ${C_MUTED}${message}${RESET}` : '';
|
|
91
|
+
const hintLine = hintCommand ? `\n ${C_ACCENT}NEXT: ${hintCommand}${RESET}` : '';
|
|
92
|
+
return `${titleLine}${messageLine}${hintLine}`;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Progress: show work is happening
|
|
96
|
+
* Modes: spinner (if supported) or fallback line
|
|
97
|
+
*/
|
|
98
|
+
let progressActive = false;
|
|
99
|
+
let progressInterval = null;
|
|
100
|
+
export function Progress(label, mode = 'line') {
|
|
101
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
102
|
+
let frameIndex = 0;
|
|
103
|
+
return {
|
|
104
|
+
start: () => {
|
|
105
|
+
if (progressActive)
|
|
106
|
+
return;
|
|
107
|
+
progressActive = true;
|
|
108
|
+
if (mode === 'spinner' && process.stdout.isTTY) {
|
|
109
|
+
process.stdout.write(`${C_ACCENT}${label}${RESET} `);
|
|
110
|
+
progressInterval = setInterval(() => {
|
|
111
|
+
process.stdout.write(`\r${C_ACCENT}${label}${RESET} ${frames[frameIndex % frames.length]}`);
|
|
112
|
+
frameIndex++;
|
|
113
|
+
}, 100);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
process.stdout.write(`${C_ACCENT}${label}${RESET} ${C_MUTED}WORKING...${RESET}`);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
stop: (success, message) => {
|
|
120
|
+
if (progressInterval) {
|
|
121
|
+
clearInterval(progressInterval);
|
|
122
|
+
progressInterval = null;
|
|
123
|
+
}
|
|
124
|
+
progressActive = false;
|
|
125
|
+
if (mode === 'spinner' && process.stdout.isTTY) {
|
|
126
|
+
process.stdout.write(`\r${' '.repeat(50)}\r`); // Clear line
|
|
127
|
+
}
|
|
128
|
+
const status = success ? `${C_SUCCESS}OK${RESET}` : `${C_ERROR}ERROR${RESET}`;
|
|
129
|
+
const msg = message ? ` ${message}` : '';
|
|
130
|
+
console.log(`${C_ACCENT}${label}${RESET} ${status}${msg}`);
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Prompt: consistent input line
|
|
136
|
+
* Format: 4runr> or 4runr:view>
|
|
137
|
+
*/
|
|
138
|
+
export function Prompt(view) {
|
|
139
|
+
const viewSuffix = view ? `:${view}` : '';
|
|
140
|
+
return `${C_ACCENT}4runr${viewSuffix}>${RESET} `;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Helper: truncate ID to 8 chars
|
|
144
|
+
*/
|
|
145
|
+
export function truncateId(id, length = 8) {
|
|
146
|
+
return id.length > length ? id.substring(0, length) : id;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Helper: truncate text with ellipsis
|
|
150
|
+
*/
|
|
151
|
+
export function truncateText(text, maxLength) {
|
|
152
|
+
if (text.length <= maxLength)
|
|
153
|
+
return text;
|
|
154
|
+
return text.substring(0, maxLength - 3) + '...';
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=ui-primitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-primitives.js","sourceRoot":"","sources":["../src/ui-primitives.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,KAAK,EAEL,cAAc,EAEd,KAAK,GAEN,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,OAAe,EAAE,IAAyB;IAC/D,M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C,CAAC;QAC7D,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,IAAa;IAClC,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,OAAO,GAAG,QAAQ,QAAQ,UAAU,IAAI,KAAK,GAAG,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,SAAiB,CAAC;IACvD,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,SAAiB;IAC1D,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AAClD,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for formatting and helpers
|
|
3
|
+
* Pure functions, no side effects
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Format uptime since boot
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatUptime(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Format relative time (e.g., "5m ago")
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatRelativeTime(timestamp: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Truncate ID to specified length
|
|
15
|
+
*/
|
|
16
|
+
export declare function truncateId(id: string, length?: number): string;
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAW5D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAEjE"}
|