@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.9",
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.7",
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 { SerializableExecutionPlanTask } from '@lota-sdk/shared/schemas/execution-plan'
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 plan'
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 'task-status-updated':
28
- return 'Execution plan updated'
29
- case 'task-restarted':
30
- return 'Execution task restarted'
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 plan loaded'
32
+ return 'Execution run loaded'
33
33
  default:
34
- return 'Execution plan'
34
+ return 'Execution run'
35
35
  }
36
36
  }
37
37
 
38
38
  export function getExecutionPlanStatusLabel(status: string | null | undefined): string {
39
- if (status === 'draft') return 'Draft'
40
- if (status === 'executing') return 'Executing'
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
- task: SerializableExecutionPlanTask,
49
+ node: SerializablePlanNode,
49
50
  displayNameByOwnerRef: Record<string, string> = {},
50
51
  ): string {
51
- if (task.ownerType === 'agent' && task.ownerRef in displayNameByOwnerRef) {
52
- return displayNameByOwnerRef[task.ownerRef]
52
+ if (node.owner.executorType === 'agent' && node.owner.ref in displayNameByOwnerRef) {
53
+ return displayNameByOwnerRef[node.owner.ref]
53
54
  }
54
- if (task.ownerType === 'user') return 'User'
55
- return task.ownerRef
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 plan'
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 ? `${plan.progress.completed}/${plan.progress.total} complete` : 'No active 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,
@@ -27,7 +27,7 @@ export function formatUserQuestionsAnswerText(
27
27
  }
28
28
 
29
29
  if (answer.customText.trim()) {
30
- parts.push(`custom: "${answer.customText.trim()}"`)
30
+ parts.push(answer.customText.trim())
31
31
  }
32
32
  }
33
33