@lota-sdk/ui 0.1.9 → 0.1.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lota-sdk/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"registry": "https://registry.npmjs.org/"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@lota-sdk/shared": "0.1.
|
|
43
|
+
"@lota-sdk/shared": "0.1.9",
|
|
44
44
|
"ai": "^6.0.116"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SerializablePlanNode } from '@lota-sdk/shared/schemas/execution-plan'
|
|
2
2
|
import type { ExecutionPlanToolResultData } from '@lota-sdk/shared/schemas/tools'
|
|
3
3
|
|
|
4
4
|
export function getLatestExecutionPlanResult(output: unknown): ExecutionPlanToolResultData | null {
|
|
@@ -17,42 +17,43 @@ export function getLatestExecutionPlanResult(output: unknown): ExecutionPlanTool
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function getExecutionPlanActionLabel(action: string, isRunning: boolean): string {
|
|
20
|
-
if (isRunning) return 'Updating execution
|
|
20
|
+
if (isRunning) return 'Updating execution run'
|
|
21
21
|
|
|
22
22
|
switch (action) {
|
|
23
23
|
case 'created':
|
|
24
24
|
return 'Execution plan created'
|
|
25
25
|
case 'replaced':
|
|
26
26
|
return 'Execution plan replaced'
|
|
27
|
-
case '
|
|
28
|
-
return 'Execution
|
|
29
|
-
case '
|
|
30
|
-
return 'Execution
|
|
27
|
+
case 'node-result-submitted':
|
|
28
|
+
return 'Execution node updated'
|
|
29
|
+
case 'run-resumed':
|
|
30
|
+
return 'Execution run resumed'
|
|
31
31
|
case 'loaded':
|
|
32
|
-
return 'Execution
|
|
32
|
+
return 'Execution run loaded'
|
|
33
33
|
default:
|
|
34
|
-
return 'Execution
|
|
34
|
+
return 'Execution run'
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export function getExecutionPlanStatusLabel(status: string | null | undefined): string {
|
|
39
|
-
if (status === '
|
|
40
|
-
if (status === '
|
|
39
|
+
if (status === 'running') return 'Running'
|
|
40
|
+
if (status === 'awaiting-human') return 'Awaiting Human'
|
|
41
41
|
if (status === 'blocked') return 'Blocked'
|
|
42
42
|
if (status === 'completed') return 'Completed'
|
|
43
|
+
if (status === 'failed') return 'Failed'
|
|
43
44
|
if (status === 'aborted') return 'Aborted'
|
|
44
45
|
return 'Idle'
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export function getExecutionPlanOwnerLabel(
|
|
48
|
-
|
|
49
|
+
node: SerializablePlanNode,
|
|
49
50
|
displayNameByOwnerRef: Record<string, string> = {},
|
|
50
51
|
): string {
|
|
51
|
-
if (
|
|
52
|
-
return displayNameByOwnerRef[
|
|
52
|
+
if (node.owner.executorType === 'agent' && node.owner.ref in displayNameByOwnerRef) {
|
|
53
|
+
return displayNameByOwnerRef[node.owner.ref]
|
|
53
54
|
}
|
|
54
|
-
if (
|
|
55
|
-
return
|
|
55
|
+
if (node.owner.executorType === 'user') return 'User'
|
|
56
|
+
return node.owner.ref
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export function buildExecutionPlanToolViewModel(params: { input: unknown; isRunning: boolean; output: unknown }) {
|
|
@@ -65,14 +66,15 @@ export function buildExecutionPlanToolViewModel(params: { input: unknown; isRunn
|
|
|
65
66
|
typeof params.input.title === 'string'
|
|
66
67
|
? params.input.title.trim()
|
|
67
68
|
: ''
|
|
68
|
-
const title = plan && plan.title.trim() ? plan.title.trim() : inputTitle || 'Execution
|
|
69
|
+
const title = plan && plan.title.trim() ? plan.title.trim() : inputTitle || 'Execution run'
|
|
70
|
+
const completedCount = plan ? plan.progress.completed + plan.progress.partial : 0
|
|
69
71
|
|
|
70
72
|
return {
|
|
71
73
|
actionLabel: getExecutionPlanActionLabel(result?.action ?? 'none', params.isRunning),
|
|
72
74
|
hasPlan: plan !== null,
|
|
73
75
|
latestEvent: plan ? plan.recentEvents.at(-1)?.message.trim() : undefined,
|
|
74
76
|
plan,
|
|
75
|
-
progressSummary: plan ? `${
|
|
77
|
+
progressSummary: plan ? `${completedCount}/${plan.progress.total} complete` : 'No active execution run',
|
|
76
78
|
result,
|
|
77
79
|
statusLabel: getExecutionPlanStatusLabel(result?.status ?? plan?.status),
|
|
78
80
|
title,
|