rtrt-agent 0.1.5 → 0.2.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 (29) hide show
  1. package/README.ko.md +45 -10
  2. package/README.md +45 -10
  3. package/THIRD_PARTY_NOTICES/INDEX.md +76 -0
  4. package/THIRD_PARTY_NOTICES/cose-base@2.2.0/LICENSE +21 -0
  5. package/THIRD_PARTY_NOTICES/cytoscape-cola@2.5.1/LICENSE +21 -0
  6. package/THIRD_PARTY_NOTICES/cytoscape-fcose@2.2.0/LICENSE +19 -0
  7. package/THIRD_PARTY_NOTICES/cytoscape@3.30.2/LICENSE +19 -0
  8. package/THIRD_PARTY_NOTICES/layout-base@2.0.1/LICENSE +21 -0
  9. package/THIRD_PARTY_NOTICES/option-ext@0.2.0/LICENSE.txt +373 -0
  10. package/THIRD_PARTY_NOTICES/option-ext@0.2.0/SOURCE.crate +0 -0
  11. package/THIRD_PARTY_NOTICES/ring@0.17.14/LICENSE +9 -0
  12. package/THIRD_PARTY_NOTICES/ring@0.17.14/LICENSE-BoringSSL +272 -0
  13. package/THIRD_PARTY_NOTICES/ring@0.17.14/LICENSE-other-bits +13 -0
  14. package/THIRD_PARTY_NOTICES/ring@0.17.14/src/polyfill/once_cell/LICENSE-APACHE +201 -0
  15. package/THIRD_PARTY_NOTICES/ring@0.17.14/src/polyfill/once_cell/LICENSE-MIT +23 -0
  16. package/THIRD_PARTY_NOTICES/ring@0.17.14/third_party/fiat/LICENSE +15 -0
  17. package/THIRD_PARTY_NOTICES/subtle@2.6.1/LICENSE +29 -0
  18. package/THIRD_PARTY_NOTICES/webcola@3.4.0/LICENSE +21 -0
  19. package/THIRD_PARTY_NOTICES/webpki-roots@0.26.11/LICENSE +61 -0
  20. package/THIRD_PARTY_NOTICES/webpki-roots@1.0.7/LICENSE +61 -0
  21. package/package.json +60 -12
  22. package/server.js +98 -0
  23. package/tui/index.js +1 -0
  24. package/tui/rtrt-statusline-core.d.mts +205 -0
  25. package/tui/rtrt-statusline-core.mjs +1145 -0
  26. package/tui/v2/native-runtime.mjs +81 -0
  27. package/tui/v2/native-state.mjs +66 -0
  28. package/tui/v2/rtrt-statusline.tsx +116 -0
  29. package/v2/permissions.js +119 -0
@@ -0,0 +1,205 @@
1
+ export type StatuslineTone =
2
+ | "accent"
3
+ | "good"
4
+ | "warn"
5
+ | "bad"
6
+ | "muted"
7
+
8
+ export type StatuslineSegment = {
9
+ id: string
10
+ text: string
11
+ compact: string | null
12
+ tone: StatuslineTone
13
+ priority: number
14
+ }
15
+
16
+ export type StatuslinePayload = {
17
+ version: 1
18
+ stale: boolean
19
+ degraded: string[]
20
+ segments: StatuslineSegment[]
21
+ }
22
+ export type StatuslineViewRole = "badge" | "label" | "value" | "separator"
23
+ export type StatuslineViewPart = {
24
+ id: string
25
+ text: string
26
+ role: StatuslineViewRole
27
+ tone: StatuslineTone
28
+ }
29
+ export type StatuslineViewRow = { id: string; parts: StatuslineViewPart[] }
30
+ export type StatuslineViewModel = {
31
+ layout: "wide" | "medium" | "narrow"
32
+ width: number
33
+ rows: StatuslineViewRow[]
34
+ }
35
+ export type StatuslineEconomicsValue = {
36
+ text: string
37
+ tone: StatuslineTone
38
+ used?: number
39
+ limit?: number
40
+ percent?: number
41
+ headroom?: number
42
+ }
43
+ export type StatuslineEconomics = {
44
+ cost: StatuslineEconomicsValue
45
+ context: StatuslineEconomicsValue
46
+ model: StatuslineEconomicsValue
47
+ status: StatuslineEconomicsValue
48
+ week: StatuslineEconomicsValue
49
+ modelRef?: string
50
+ }
51
+ export type StatuslineViewOptions = {
52
+ width?: number
53
+ economics?: StatuslineEconomics
54
+ promptRight?: boolean
55
+ }
56
+ export type StatuslineState = {
57
+ payload: StatuslinePayload
58
+ lastGood: StatuslinePayload | undefined
59
+ stale: boolean
60
+ unavailable: boolean
61
+ }
62
+ export type StatuslineContext = { cwd: string; session: string; width: number; model?: string }
63
+ export type StatuslineRefreshEvent =
64
+ | "server.connected"
65
+ | "project.updated"
66
+ | "session.created"
67
+ | "session.updated"
68
+ | "session.compacted"
69
+ | "session.deleted"
70
+ | "session.diff"
71
+ | "session.error"
72
+ | "session.idle"
73
+ | "session.status"
74
+ export type StatuslineRefreshTarget = { app: boolean; sessionID?: string }
75
+
76
+ export const STATUSLINE_VERSION: 1
77
+ export const STATUSLINE_SEPARATOR: string
78
+ export const STATUSLINE_FALLBACK: string
79
+ export const STATUSLINE_GROUP_SEPARATOR: string
80
+ export const STATUSLINE_WIDE_WIDTH: number
81
+ export const STATUSLINE_MEDIUM_WIDTH: number
82
+ export const DEFAULT_DEBOUNCE_MS: number
83
+ export const DEFAULT_INTERVAL_MS: number
84
+ export const DEFAULT_TIMEOUT_MS: number
85
+ export const STATUSLINE_REFRESH_EVENTS: readonly StatuslineRefreshEvent[]
86
+
87
+ export function parseStatuslineJson(raw: string): StatuslinePayload | undefined
88
+ export function statuslineRefreshTarget(event: unknown, activeSessionID?: string): StatuslineRefreshTarget
89
+ export function statuslineCommandArgs(context: StatuslineContext): string[]
90
+ export function statuslineBinaryCandidates(bin?: unknown, env?: Record<string, string | undefined>): string[]
91
+ export function runStatusline(input: StatuslineContext & {
92
+ bin?: unknown
93
+ env?: Record<string, string | undefined>
94
+ spawnImpl?: (...args: any[]) => any
95
+ timeoutMs?: number
96
+ signal?: AbortSignal
97
+ nowFn?: () => number
98
+ setTimeoutFn?: typeof setTimeout
99
+ clearTimeoutFn?: typeof clearTimeout
100
+ }): Promise<StatuslinePayload | undefined>
101
+ export function createSpawnLimiter(input?: { concurrency?: number }): {
102
+ run<Value>(
103
+ task: (signal: AbortSignal) => Value | Promise<Value>,
104
+ options?: { signal?: AbortSignal; priority?: number },
105
+ ): Promise<Value | undefined>
106
+ activeCount(): number
107
+ queuedCount(): number
108
+ dispose(): void
109
+ }
110
+ export function cellWidth(text: string): number
111
+ export function deriveSessionEconomics(input?: {
112
+ session?: {
113
+ cost?: number
114
+ model?: { id: string; providerID: string }
115
+ }
116
+ messages?: ReadonlyArray<{
117
+ role: string
118
+ providerID?: string
119
+ modelID?: string
120
+ time?: { completed?: number }
121
+ error?: unknown
122
+ tokens?: {
123
+ input?: number
124
+ output?: number
125
+ reasoning?: number
126
+ cache?: { read?: number; write?: number }
127
+ }
128
+ }>
129
+ providers?: ReadonlyArray<{
130
+ id: string
131
+ models: Readonly<Record<string, {
132
+ id: string
133
+ providerID?: string
134
+ name?: string
135
+ limit?: { context?: number }
136
+ }>>
137
+ }>
138
+ status?: { type?: string }
139
+ }): StatuslineEconomics
140
+ export function selectSegments(
141
+ payload: StatuslinePayload,
142
+ options?: { width?: number; compact?: boolean },
143
+ ): StatuslineSegment[]
144
+ export function initialStatuslineState(): StatuslineState
145
+ export function nextStatuslineState(previous: StatuslineState, payload?: StatuslinePayload): StatuslineState
146
+ export function renderSegments(
147
+ state: StatuslineState,
148
+ options?: { width?: number; compact?: boolean },
149
+ ): StatuslineSegment[]
150
+ export function renderStatuslineText(
151
+ state: StatuslineState,
152
+ options?: StatuslineViewOptions & { compact?: boolean },
153
+ ): string
154
+ export function createStatuslineViewModel(
155
+ state: StatuslineState,
156
+ options?: StatuslineViewOptions,
157
+ ): StatuslineViewModel
158
+ export function renderStatuslineViewText(
159
+ state: StatuslineState,
160
+ options?: StatuslineViewOptions,
161
+ ): string
162
+
163
+ export function createRefreshScheduler(input: {
164
+ run: () => void | Promise<void>
165
+ debounceMs?: number
166
+ intervalMs?: number
167
+ setTimeoutFn?: typeof setTimeout
168
+ clearTimeoutFn?: typeof clearTimeout
169
+ setIntervalFn?: typeof setInterval
170
+ clearIntervalFn?: typeof clearInterval
171
+ }): {
172
+ start(): void
173
+ request(immediate?: boolean): void
174
+ flush(): Promise<void>
175
+ dispose(): void
176
+ }
177
+
178
+ export function createStatuslineController(input: {
179
+ load: (
180
+ context: StatuslineContext,
181
+ signal: AbortSignal,
182
+ ) => StatuslinePayload | undefined | Promise<StatuslinePayload | undefined>
183
+ onState?: (state: StatuslineState) => void
184
+ debounceMs?: number
185
+ intervalMs?: number
186
+ timers?: Record<string, unknown>
187
+ }): {
188
+ start(): void
189
+ request(immediate?: boolean): void
190
+ refreshNow(): Promise<void>
191
+ dispose(): void
192
+ setContext(context: Partial<StatuslineContext>): void
193
+ getState(): StatuslineState
194
+ getContext(): StatuslineContext
195
+ }
196
+
197
+ export function createKeyedControllerPool<Key, Value extends { dispose(): void }>(input: {
198
+ create: (key: Key) => Value
199
+ }): {
200
+ acquire(key: Key): { value: Value; release(): void }
201
+ get(key: Key): Value | undefined
202
+ forEach(callback: (value: Value, key: Key) => void): void
203
+ size(): number
204
+ dispose(): void
205
+ }