@tea-agent/loop-agent 0.39.1 → 0.39.2

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.
@@ -1222,6 +1222,13 @@ body.is-resizing-dag-graph {
1222
1222
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
1223
1223
  overflow-wrap: anywhere;
1224
1224
  }
1225
+ .dag-inspector-purpose {
1226
+ margin: 0;
1227
+ color: var(--muted);
1228
+ font-size: 12px;
1229
+ line-height: 1.45;
1230
+ overflow-wrap: anywhere;
1231
+ }
1225
1232
  .dag-inspector-controls {
1226
1233
  display: inline-flex;
1227
1234
  align-items: center;
@@ -3570,83 +3577,386 @@ button.copy-command:focus-visible {
3570
3577
  }
3571
3578
 
3572
3579
  /* Experimental prompt-override rerun tab (only rendered with the mutation token). */
3580
+ #dag-inspector-panel-prompt-restart {
3581
+ display: flex;
3582
+ flex-direction: column;
3583
+ min-height: 0;
3584
+ }
3585
+ #dag-inspector-panel-prompt-restart:has(.prompt-restart-panel.is-readonly) {
3586
+ overflow: hidden;
3587
+ }
3588
+ .prompt-restart-panel,
3573
3589
  .prompt-restart-box {
3574
3590
  display: flex;
3575
3591
  flex-direction: column;
3576
- gap: 0.75rem;
3577
- padding: 0.5rem 0.25rem;
3592
+ gap: var(--space-3);
3593
+ min-width: 0;
3594
+ flex: 1;
3595
+ }
3596
+ .prompt-restart-panel.is-readonly {
3597
+ min-height: 0;
3598
+ overflow: hidden;
3599
+ }
3600
+ .prompt-restart-panel.is-readonly .prompt-restart-prompt-card {
3601
+ flex: 1 1 auto;
3602
+ min-height: 12rem;
3603
+ }
3604
+ .prompt-restart-toolbar {
3605
+ display: grid;
3606
+ grid-template-columns: minmax(0, 1fr) auto;
3607
+ gap: var(--space-3);
3608
+ align-items: start;
3609
+ }
3610
+ .prompt-restart-mode-field {
3611
+ min-width: 12.5rem;
3612
+ }
3613
+ .prompt-restart-banner {
3614
+ display: flex;
3615
+ flex-wrap: wrap;
3616
+ align-items: center;
3617
+ gap: 6px 10px;
3618
+ padding: 10px 12px;
3619
+ border: 1px solid var(--hairline);
3620
+ border-radius: var(--radius-lg);
3621
+ background: var(--canvas-soft);
3622
+ }
3623
+ .prompt-restart-banner.is-edit {
3624
+ border-color: color-mix(in srgb, var(--orange) 28%, var(--hairline));
3625
+ background: color-mix(in srgb, var(--orange-soft) 55%, var(--surface));
3626
+ }
3627
+ .prompt-restart-banner-kicker {
3628
+ width: fit-content;
3629
+ padding: 2px 8px;
3630
+ border-radius: var(--radius-pill);
3631
+ background: var(--surface-muted);
3632
+ color: var(--muted);
3633
+ font-size: 11px;
3634
+ font-weight: 700;
3635
+ letter-spacing: 0.02em;
3636
+ }
3637
+ .prompt-restart-banner.is-edit .prompt-restart-banner-kicker {
3638
+ background: var(--orange-soft);
3639
+ color: var(--orange-active);
3640
+ }
3641
+ .prompt-restart-banner-title,
3642
+ .prompt-restart-banner-body {
3643
+ margin: 0;
3644
+ }
3645
+ .prompt-restart-banner-title {
3646
+ color: var(--ink);
3647
+ font-size: 13px;
3648
+ font-weight: 700;
3649
+ line-height: 1.35;
3650
+ }
3651
+ .prompt-restart-banner-body {
3652
+ flex-basis: 100%;
3653
+ color: var(--body);
3654
+ font-size: 12px;
3655
+ line-height: 1.5;
3578
3656
  }
3579
3657
  .prompt-restart-field {
3580
3658
  display: flex;
3581
3659
  flex-direction: column;
3582
- gap: 0.35rem;
3660
+ gap: 6px;
3661
+ min-width: 0;
3662
+ }
3663
+ .prompt-restart-field.is-hidden,
3664
+ .prompt-restart-prompt-card.is-hidden {
3665
+ display: none;
3666
+ }
3667
+ .prompt-restart-label {
3668
+ color: var(--ink);
3669
+ font-size: 12px;
3670
+ font-weight: 700;
3671
+ letter-spacing: 0.01em;
3672
+ }
3673
+ .prompt-restart-hint {
3674
+ margin: 0;
3675
+ color: var(--muted);
3676
+ font-size: 12px;
3677
+ line-height: 1.45;
3678
+ }
3679
+ .prompt-restart-candidate-select {
3680
+ display: block;
3681
+ width: 100%;
3682
+ min-width: 0;
3683
+ }
3684
+ .prompt-restart-candidate-select .custom-select-trigger {
3685
+ width: 100%;
3686
+ }
3687
+ .prompt-restart-candidate-select .custom-select-menu {
3688
+ z-index: 6;
3689
+ }
3690
+ .prompt-restart-mode-switch {
3691
+ display: flex;
3692
+ width: fit-content;
3693
+ max-width: 100%;
3694
+ gap: 4px;
3695
+ padding: 4px;
3696
+ border: 1px solid var(--hairline);
3697
+ border-radius: var(--radius-pill);
3698
+ background: var(--surface);
3699
+ }
3700
+ #dag-inspector-panel-prompt-restart button.prompt-restart-mode-option,
3701
+ .prompt-restart-mode-option {
3702
+ appearance: none;
3703
+ display: inline-flex;
3704
+ align-items: center;
3705
+ justify-content: center;
3706
+ flex: 0 0 auto;
3707
+ width: auto;
3708
+ min-height: 30px;
3709
+ height: 30px;
3710
+ padding: 0 12px;
3711
+ border: 1px solid transparent;
3712
+ border-radius: var(--radius-pill);
3713
+ background: transparent;
3714
+ color: var(--muted);
3715
+ font-size: 12px;
3716
+ font-weight: 700;
3717
+ line-height: 1;
3718
+ letter-spacing: 0;
3719
+ white-space: nowrap;
3720
+ box-shadow: none;
3721
+ transform: none;
3722
+ cursor: pointer;
3723
+ }
3724
+ #dag-inspector-panel-prompt-restart button.prompt-restart-mode-option:hover,
3725
+ #dag-inspector-panel-prompt-restart button.prompt-restart-mode-option:focus-visible,
3726
+ .prompt-restart-mode-option:hover,
3727
+ .prompt-restart-mode-option:focus-visible {
3728
+ color: var(--ink);
3729
+ background: var(--surface-muted);
3730
+ border-color: transparent;
3731
+ outline: none;
3732
+ box-shadow: none;
3733
+ transform: none;
3734
+ }
3735
+ #dag-inspector-panel-prompt-restart button.prompt-restart-mode-option.is-selected,
3736
+ .prompt-restart-mode-option.is-selected {
3737
+ background: var(--ink);
3738
+ color: #fff;
3739
+ border-color: transparent;
3583
3740
  }
3584
3741
  .prompt-restart-prompt-card {
3585
- position: relative;
3742
+ display: flex;
3743
+ flex-direction: column;
3744
+ min-width: 0;
3745
+ overflow: hidden;
3746
+ border: 1px solid var(--hairline);
3747
+ border-radius: var(--radius-lg);
3748
+ background: var(--surface);
3586
3749
  }
3587
3750
  .prompt-restart-prompt-head {
3588
3751
  display: flex;
3589
- align-items: center;
3752
+ align-items: flex-start;
3590
3753
  justify-content: space-between;
3591
- gap: 0.5rem;
3754
+ gap: var(--space-3);
3755
+ padding: 10px 12px;
3756
+ border-bottom: 1px solid var(--hairline);
3757
+ background: var(--canvas-soft);
3758
+ }
3759
+ .prompt-restart-prompt-titles {
3760
+ display: flex;
3761
+ flex-wrap: wrap;
3762
+ align-items: center;
3763
+ gap: 6px 8px;
3764
+ min-width: 0;
3765
+ }
3766
+ .prompt-restart-prompt-title {
3767
+ color: var(--ink);
3768
+ font-size: 13px;
3769
+ font-weight: 700;
3770
+ line-height: 1.3;
3771
+ }
3772
+ .prompt-restart-prompt-badge {
3773
+ padding: 2px 8px;
3774
+ border-radius: var(--radius-pill);
3775
+ background: var(--surface-muted);
3776
+ color: var(--muted);
3777
+ font-size: 11px;
3778
+ font-weight: 700;
3779
+ }
3780
+ .prompt-restart-prompt-meta {
3781
+ flex-basis: 100%;
3782
+ color: var(--muted);
3783
+ font-size: 11px;
3784
+ line-height: 1.3;
3592
3785
  }
3593
3786
  .prompt-restart-copy-icon {
3594
3787
  flex: 0 0 auto;
3788
+ margin-top: 1px;
3789
+ }
3790
+ .prompt-restart-prompt-actions {
3791
+ display: flex;
3792
+ align-items: center;
3793
+ gap: 6px;
3794
+ flex: 0 0 auto;
3795
+ }
3796
+ #dag-inspector-panel-prompt-restart button.prompt-restart-prompt-fold,
3797
+ .prompt-restart-prompt-fold {
3798
+ appearance: none;
3799
+ display: inline-flex;
3800
+ align-items: center;
3801
+ justify-content: center;
3802
+ min-height: 30px;
3803
+ height: 30px;
3804
+ padding: 0 10px;
3805
+ border: 1px solid var(--hairline);
3806
+ border-radius: var(--radius-pill);
3807
+ background: var(--surface);
3808
+ color: var(--body);
3809
+ font-size: 12px;
3810
+ font-weight: 700;
3811
+ line-height: 1;
3812
+ box-shadow: none;
3813
+ transform: none;
3814
+ cursor: pointer;
3815
+ }
3816
+ #dag-inspector-panel-prompt-restart button.prompt-restart-prompt-fold:hover,
3817
+ .prompt-restart-prompt-fold:hover {
3818
+ border-color: var(--hairline-strong);
3819
+ background: var(--surface-muted);
3820
+ color: var(--ink);
3821
+ transform: none;
3822
+ }
3823
+ .prompt-restart-prompt-card.is-collapsed .prompt-restart-readonly {
3824
+ display: none;
3825
+ }
3826
+ .prompt-restart-readonly {
3827
+ margin: 0;
3828
+ padding: 14px 16px;
3829
+ overflow: auto;
3830
+ background: var(--canvas-soft);
3831
+ color: var(--ink);
3832
+ font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
3833
+ font-size: 12px;
3834
+ line-height: 1.65;
3835
+ white-space: pre-wrap;
3836
+ overflow-wrap: anywhere;
3837
+ tab-size: 2;
3838
+ }
3839
+ .prompt-restart-panel.is-readonly .prompt-restart-readonly {
3840
+ flex: 1 1 auto;
3841
+ min-height: 0;
3842
+ max-height: none;
3843
+ }
3844
+ .prompt-restart-panel.is-edit .prompt-restart-readonly {
3845
+ max-height: min(36vh, 18rem);
3595
3846
  }
3596
3847
  .prompt-restart-textarea {
3597
3848
  width: 100%;
3598
3849
  min-height: 8rem;
3599
3850
  resize: vertical;
3600
3851
  box-sizing: border-box;
3601
- font-family: var(--mono-font, ui-monospace, SFMono-Regular, Menlo, monospace);
3602
- font-size: 12.5px;
3603
- line-height: 1.5;
3604
- white-space: pre;
3605
- overflow-wrap: normal;
3852
+ padding: 12px 14px;
3853
+ border: 1px solid var(--hairline);
3854
+ border-radius: var(--radius-lg);
3855
+ background: var(--canvas-soft);
3856
+ color: var(--ink);
3857
+ font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
3858
+ font-size: 12px;
3859
+ line-height: 1.65;
3860
+ white-space: pre-wrap;
3861
+ overflow-wrap: anywhere;
3606
3862
  overflow-x: auto;
3607
3863
  }
3608
- .prompt-restart-actions {
3864
+ .prompt-restart-textarea-work {
3865
+ min-height: 10rem;
3866
+ }
3867
+ .prompt-restart-textarea:hover {
3868
+ border-color: var(--hairline-strong);
3869
+ }
3870
+ .prompt-restart-textarea:focus-visible {
3871
+ outline: 2px solid color-mix(in srgb, var(--orange) 55%, transparent);
3872
+ outline-offset: 1px;
3873
+ border-color: color-mix(in srgb, var(--orange) 35%, var(--hairline));
3874
+ }
3875
+ .prompt-restart-textarea-compact {
3876
+ min-height: 4.5rem;
3877
+ }
3878
+ .prompt-restart-actions,
3879
+ .prompt-restart-footer {
3609
3880
  display: flex;
3610
- gap: 0.5rem;
3881
+ flex-wrap: wrap;
3882
+ gap: var(--space-2);
3611
3883
  align-items: center;
3884
+ justify-content: flex-end;
3885
+ }
3886
+ .prompt-restart-footer {
3887
+ position: sticky;
3888
+ bottom: calc(-1 * var(--space-4));
3889
+ z-index: 2;
3890
+ margin-top: auto;
3891
+ padding: 10px 0 2px;
3892
+ border-top: 1px solid var(--hairline);
3893
+ background: var(--surface);
3612
3894
  }
3895
+ .prompt-restart-footer .prompt-restart-status {
3896
+ flex: 1 1 12rem;
3897
+ min-width: 0;
3898
+ margin-right: auto;
3899
+ }
3900
+ #dag-inspector-panel-prompt-restart button.prompt-restart-submit,
3613
3901
  .prompt-restart-submit {
3614
- padding: 0.35rem 0.9rem;
3615
- font-size: 13.5px;
3902
+ appearance: none;
3903
+ display: inline-flex;
3904
+ align-items: center;
3905
+ justify-content: center;
3906
+ min-height: 34px;
3907
+ height: 34px;
3908
+ padding: 0 16px;
3909
+ border: 1px solid var(--orange);
3910
+ border-radius: var(--radius-pill);
3911
+ background: var(--orange);
3912
+ color: #fff;
3913
+ font-size: 13px;
3914
+ font-weight: 700;
3915
+ line-height: 1;
3916
+ letter-spacing: 0.01em;
3917
+ box-shadow: none;
3918
+ transform: none;
3616
3919
  cursor: pointer;
3617
3920
  }
3921
+ #dag-inspector-panel-prompt-restart button.prompt-restart-submit:hover,
3922
+ #dag-inspector-panel-prompt-restart button.prompt-restart-submit:focus-visible,
3923
+ .prompt-restart-submit:hover,
3924
+ .prompt-restart-submit:focus-visible {
3925
+ background: var(--orange-active);
3926
+ border-color: var(--orange-active);
3927
+ color: #fff;
3928
+ outline: none;
3929
+ box-shadow: none;
3930
+ transform: none;
3931
+ }
3932
+ #dag-inspector-panel-prompt-restart button.prompt-restart-submit.is-secondary,
3933
+ .prompt-restart-submit.is-secondary {
3934
+ border-color: var(--hairline);
3935
+ background: var(--surface);
3936
+ color: var(--ink);
3937
+ }
3938
+ #dag-inspector-panel-prompt-restart button.prompt-restart-submit.is-secondary:hover,
3939
+ #dag-inspector-panel-prompt-restart button.prompt-restart-submit.is-secondary:focus-visible,
3940
+ .prompt-restart-submit.is-secondary:hover,
3941
+ .prompt-restart-submit.is-secondary:focus-visible {
3942
+ border-color: var(--orange);
3943
+ background: var(--orange-soft);
3944
+ color: var(--orange-active);
3945
+ }
3946
+ #dag-inspector-panel-prompt-restart button.prompt-restart-submit:disabled,
3618
3947
  .prompt-restart-submit:disabled {
3619
3948
  opacity: 0.55;
3620
3949
  cursor: wait;
3950
+ transform: none;
3621
3951
  }
3622
3952
  .prompt-restart-status {
3623
3953
  margin: 0;
3624
- font-size: 13px;
3625
3954
  min-height: 1.2em;
3955
+ color: var(--body);
3956
+ font-size: 13px;
3626
3957
  white-space: pre-wrap;
3627
3958
  word-break: break-word;
3628
3959
  }
3629
3960
  .prompt-restart-status.prompt-restart-error {
3630
- color: var(--red, #c0392b);
3631
- }
3632
- .prompt-restart-readonly {
3633
- margin: 0;
3634
- padding: 0.5rem 0.6rem;
3635
- font-family: var(--mono-font, ui-monospace, SFMono-Regular, Menlo, monospace);
3636
- font-size: 12.5px;
3637
- line-height: 1.5;
3638
- white-space: pre;
3639
- overflow: auto;
3640
- border: 1px solid var(--border-color, rgba(125, 125, 125, 0.35));
3641
- border-radius: 6px;
3642
- max-height: 60vh;
3643
- }
3644
- .prompt-restart-mode {
3645
- display: flex;
3646
- align-items: center;
3647
- gap: 0.5rem;
3648
- }
3649
- .prompt-restart-mode-select {
3650
- max-width: 100%;
3651
- font-size: 13px;
3961
+ color: var(--red);
3652
3962
  }
@@ -22,6 +22,7 @@ import {
22
22
  setDagGraphViewMode,
23
23
  currentDagGraphViewMode,
24
24
  } from "../state.js";
25
+ import { describeDagNodePurpose } from "../dag-node-purpose.js";
25
26
  import { selectDagNode } from "./dag-inspector.js";
26
27
  import { renderTrajectoryStoryboard } from "./dag-trajectory.js";
27
28
 
@@ -335,12 +336,13 @@ export function renderDagGraph(dag, dagRunId, existingWrap = null) {
335
336
  const statusLine = `${statusSymbol(status)} ${statusLabel(node.status)} · ${formatMs(node.durationMs)}`;
336
337
  // 节点宽 216、左右 padding≈14:按显示列宽截断(CJK 双宽)。
337
338
  const maxDisplayWidth = Math.max(10, Math.floor((position.width - 28) / 7));
339
+ const purpose = describeDagNodePurpose(node.nodeId, node);
338
340
  const group = svgEl("g", {
339
341
  transform: `translate(${position.x} ${position.y})`,
340
342
  class: `dag-graph-node status-${status}${node.nodeId === uiState.selectedDagNodeId ? " selected" : ""}${uiState.selectedDagNodeId && !related.has(node.nodeId) ? " dag-dimmed" : ""}`,
341
343
  tabindex: 0,
342
344
  role: "button",
343
- "aria-label": `${node.nodeId},状态 ${status}${historyLabel ? `,执行历史 ${historyLabel}` : ""}`,
345
+ "aria-label": `${node.nodeId},${purpose ? `${purpose},` : ""}状态 ${status}${historyLabel ? `,执行历史 ${historyLabel}` : ""}`,
344
346
  });
345
347
  group.appendChild(
346
348
  svgEl("rect", { width: position.width, height: position.height, rx: 10 }),
@@ -352,7 +354,7 @@ export function renderDagGraph(dag, dagRunId, existingWrap = null) {
352
354
  : "";
353
355
  const attemptHint =
354
356
  node.attemptCount > 0 ? `\nattempts: ${node.attemptCount}` : "";
355
- title.textContent = `${node.nodeId}\n${node.executor ?? "未知执行器"}\n${status}${historyLabel ? `\n执行历史:${historyLabel}` : ""}${passHint}${attemptHint}`;
357
+ title.textContent = `${node.nodeId}${purpose ? `\n${purpose}` : ""}\n${node.executor ?? "未知执行器"}\n${status}${historyLabel ? `\n执行历史:${historyLabel}` : ""}${passHint}${attemptHint}`;
356
358
  group.appendChild(title);
357
359
  const label = svgEl("text", {
358
360
  x: 14,