chrome-devtools-frontend 1.0.1713292 → 1.0.1715126

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 (115) hide show
  1. package/AUTHORS +1 -0
  2. package/DIR_METADATA +0 -4
  3. package/eslint.config.mjs +1 -0
  4. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +4 -1
  5. package/front_end/core/sdk/DebuggerModel.ts +19 -10
  6. package/front_end/core/sdk/PageFunctions.ts +7 -2
  7. package/front_end/core/sdk/ServerSentEventsProtocol.ts +4 -2
  8. package/front_end/core/sdk/SourceMap.ts +0 -5
  9. package/front_end/core/sdk/SourceMapScopesInfo.ts +0 -11
  10. package/front_end/generated/Deprecation.ts +8 -0
  11. package/front_end/generated/InspectorBackendCommands.ts +2 -1
  12. package/front_end/generated/protocol-mapping.d.ts +10 -0
  13. package/front_end/generated/protocol-proxy-api.d.ts +8 -0
  14. package/front_end/generated/protocol.ts +9 -0
  15. package/front_end/models/ai_assistance/agents/AiAgent.ts +179 -13
  16. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +7 -2
  17. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -0
  18. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +11 -16
  19. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +2 -2
  20. package/front_end/models/ai_assistance/skills/lighthouse.md +2 -1
  21. package/front_end/models/ai_assistance/skills/performance.md +10 -6
  22. package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +1 -1
  23. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +12 -0
  24. package/front_end/models/ai_assistance/tools/RunLighthouse.ts +1 -1
  25. package/front_end/models/ai_assistance/tools/Tool.ts +11 -2
  26. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +4 -0
  27. package/front_end/models/bindings/SourceMapStepping.ts +43 -2
  28. package/front_end/models/comment_manager/CommentManager.ts +8 -0
  29. package/front_end/models/javascript_metadata/NativeFunctions.ts +18 -14
  30. package/front_end/models/trace/LanternComputationData.ts +3 -0
  31. package/front_end/models/trace/ModelImpl.ts +1 -1
  32. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -1
  33. package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +2 -2
  34. package/front_end/models/trace/handlers/Threads.ts +1 -1
  35. package/front_end/models/trace/handlers/helpers.ts +1 -1
  36. package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -1
  37. package/front_end/models/trace/insights/CLSCulprits.ts +2 -2
  38. package/front_end/models/trace/insights/ImageDelivery.ts +3 -2
  39. package/front_end/models/trace/lantern/graph/CPUNode.ts +26 -7
  40. package/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +27 -2
  41. package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +8 -2
  42. package/front_end/models/trace/lantern/types/Lantern.ts +10 -0
  43. package/front_end/models/trace/types/File.ts +3 -3
  44. package/front_end/models/trace/types/TraceEvents.ts +39 -35
  45. package/front_end/models/workspace/IgnoreListManager.ts +38 -6
  46. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +34 -4
  47. package/front_end/panels/ai_assistance/README.md +55 -14
  48. package/front_end/panels/ai_assistance/components/ChatMessage.ts +3 -4
  49. package/front_end/panels/application/ResourcesPanel.ts +3 -4
  50. package/front_end/panels/application/WebMCPView.ts +2 -2
  51. package/front_end/panels/application/preloading/PreloadingView.ts +2 -2
  52. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +5 -2
  53. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +7 -3
  54. package/front_end/panels/comments/CommentsPane.ts +65 -23
  55. package/front_end/panels/comments/commentsPane.css +11 -0
  56. package/front_end/panels/common/CommentThreadWidget.ts +129 -18
  57. package/front_end/panels/common/CommentsOverlayWidget.ts +33 -9
  58. package/front_end/panels/common/CommentsStatusBarPill.ts +8 -39
  59. package/front_end/panels/elements/ElementsTreeElement.ts +6 -3
  60. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +13 -17
  61. package/front_end/panels/linear_memory_inspector/components/LinearMemoryViewer.ts +234 -182
  62. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +2 -2
  63. package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +63 -56
  64. package/front_end/panels/network/RequestPreviewView.ts +2 -6
  65. package/front_end/panels/profiler/HeapDetachedElementsView.ts +5 -2
  66. package/front_end/panels/profiler/HeapSnapshotView.ts +5 -2
  67. package/front_end/panels/profiler/ProfilesPanel.ts +2 -6
  68. package/front_end/panels/protocol_monitor/JSONEditor.ts +10 -3
  69. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -1
  70. package/front_end/panels/recorder/RecordingView.ts +1 -1
  71. package/front_end/panels/recorder/StepView.ts +5 -3
  72. package/front_end/panels/recorder/stepView.css +4 -0
  73. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +36 -19
  74. package/front_end/panels/sources/DebuggerPlugin.ts +4 -1
  75. package/front_end/panels/sources/EditorHistory.ts +172 -0
  76. package/front_end/panels/sources/Plugin.ts +2 -2
  77. package/front_end/panels/sources/SnippetsPlugin.ts +20 -6
  78. package/front_end/panels/sources/SourcesPanel.ts +48 -4
  79. package/front_end/panels/sources/SourcesView.ts +135 -127
  80. package/front_end/panels/sources/TabbedEditorContainer.ts +260 -419
  81. package/front_end/panels/sources/UISourceCodeFrame.ts +5 -5
  82. package/front_end/panels/sources/sources-meta.ts +6 -29
  83. package/front_end/panels/sources/sources.ts +2 -0
  84. package/front_end/panels/sources/tabbedEditorContainer.css +98 -0
  85. package/front_end/panels/timeline/TimelineUIUtils.ts +6 -12
  86. package/front_end/panels/timeline/components/DetailsView.ts +4 -4
  87. package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +5 -8
  88. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +8 -4
  89. package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +9 -0
  90. package/front_end/third_party/chromium/README.chromium +1 -1
  91. package/front_end/third_party/legacy-javascript/README.chromium +2 -2
  92. package/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +337 -161
  93. package/front_end/third_party/legacy-javascript/package.json +1 -1
  94. package/front_end/ui/comments/CommentAnchorResolver.ts +105 -39
  95. package/front_end/ui/comments/CommentOverlayManager.ts +37 -15
  96. package/front_end/ui/components/suggestion_input/SuggestionInput.ts +1 -2
  97. package/front_end/ui/components/text_editor/config.ts +26 -23
  98. package/front_end/ui/legacy/SearchableView.ts +118 -99
  99. package/front_end/ui/legacy/SplitWidget.ts +30 -11
  100. package/front_end/ui/legacy/StackPane.ts +1 -2
  101. package/front_end/ui/legacy/StackedPane.ts +1 -2
  102. package/front_end/ui/legacy/Toolbar.ts +2 -2
  103. package/front_end/ui/legacy/View.ts +5 -5
  104. package/front_end/ui/legacy/ViewManager.ts +8 -14
  105. package/front_end/ui/legacy/components/source_frame/ImageView.ts +98 -65
  106. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +57 -24
  107. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +123 -50
  108. package/front_end/ui/legacy/components/source_frame/imageView.css +27 -25
  109. package/front_end/ui/legacy/components/source_frame/resourceSourceFrame.css +8 -6
  110. package/front_end/ui/legacy/inspectorCommon.css +1 -1
  111. package/front_end/ui/legacy/tabbedPane.css +0 -91
  112. package/front_end/ui/settings/SourcesSettings.ts +41 -0
  113. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  114. package/package.json +1 -1
  115. package/front_end/panels/common/commentsStatusBarPill.css +0 -13
package/AUTHORS CHANGED
@@ -53,6 +53,7 @@ Han Xu <suyanhanx@gmail.com>
53
53
  Helmut Januschka <helmut@januschka.com>
54
54
  Henry Lim <henry@limhenry.xyz>
55
55
  Hojeong Park <parkhj062@gmail.com>
56
+ Hubert Gajewski <hubert@hubertgajewski.com>
56
57
  Ivan Akulov <gxoptg@gmail.com>
57
58
  Jacky Hu <flameddd@gmail.com>
58
59
  Jake Mulhern <mulherje@gmail.com>
package/DIR_METADATA CHANGED
@@ -4,11 +4,9 @@ buganizer_public: {
4
4
  }
5
5
  agentic_review: {
6
6
  capability_groups: {
7
- name: "core-review"
8
7
  review_capability_skills: [".agents/skills/code-review/SKILL.md"]
9
8
  }
10
9
  capability_groups: {
11
- name: "typescript-and-models"
12
10
  path_expression: ["front_end/.*\\.ts", ".*BUILD\\.gn", ".*\\.gni"]
13
11
  path_expression_exclusion: [".*\\.test\\.ts"]
14
12
  review_capability_skills: [
@@ -20,7 +18,6 @@ agentic_review: {
20
18
  ]
21
19
  }
22
20
  capability_groups: {
23
- name: "ui-and-widgets"
24
21
  path_expression: ["front_end/(panels|ui)/.*\\.(ts|css)"]
25
22
  path_expression_exclusion: [".*\\.test\\.ts"]
26
23
  review_capability_skills: [
@@ -29,7 +26,6 @@ agentic_review: {
29
26
  ]
30
27
  }
31
28
  capability_groups: {
32
- name: "tests"
33
29
  path_expression: [".*\\.test\\.ts", "test/.*\\.ts"]
34
30
  review_capability_skills: [
35
31
  ".agents/skills/devtools-testing-guidance/SKILL.md",
package/eslint.config.mjs CHANGED
@@ -375,6 +375,7 @@ export default defineConfig([
375
375
  'error',
376
376
  {
377
377
  argsIgnorePattern: '^_',
378
+ ignoreUsingDeclarations: true,
378
379
  },
379
380
  ],
380
381
 
@@ -85,7 +85,10 @@ export class BaseVariableMatcher extends BaseVariableMatcherBase {
85
85
  return null;
86
86
  }
87
87
  const nameNode = args[0][0];
88
- const fallback = args.length === 2 ? args[1] : undefined;
88
+ // Skip the first comma and closing parenthesis, preserving commas in the fallback.
89
+ const fallback = args.length > 1 ?
90
+ Array.from(ASTUtils.stripComments(ASTUtils.siblings(nameNode.nextSibling))).slice(1, -1) :
91
+ undefined;
89
92
 
90
93
  if (!isVariableNameNode(nameNode, matching.ast)) {
91
94
  return null;
@@ -134,10 +134,14 @@ export const enum StepMode {
134
134
  STEP_OVER = 'StepOver',
135
135
  }
136
136
 
137
- /** A CDP step command. `ranges` is passed as `skipList` to stepInto/stepOver, and ignored for stepOut. */
137
+ /**
138
+ * A CDP step command. `ranges` is passed as `skipList` to stepInto/stepOver, and ignored for stepOut. `enterRanges` is
139
+ * passed as `enterRanges` to stepOver: functions within them are entered as if by stepInto.
140
+ */
138
141
  export interface AutoStep {
139
142
  readonly command: StepMode;
140
143
  readonly ranges: readonly LocationRange[];
144
+ readonly enterRanges?: readonly LocationRange[];
141
145
  }
142
146
 
143
147
  /**
@@ -478,20 +482,25 @@ export class DebuggerModel extends SDKModel<EventTypes> {
478
482
  this.#issueStep(step, breakOnAsyncCall);
479
483
  }
480
484
 
481
- #issueStep({command, ranges}: AutoStep, breakOnAsyncCall = false): void {
482
- const skipList =
483
- sortAndMergeRanges(ranges.map(({start, end}) => ({
484
- scriptId: start.scriptId,
485
- start: {lineNumber: start.lineNumber, columnNumber: start.columnNumber},
486
- end: {lineNumber: end.lineNumber, columnNumber: end.columnNumber},
487
- })));
485
+ #issueStep({command, ranges, enterRanges}: AutoStep, breakOnAsyncCall = false): void {
486
+ const toProtocolRange = ({start, end}: LocationRange): Protocol.Debugger.LocationRange => ({
487
+ scriptId: start.scriptId,
488
+ start: {lineNumber: start.lineNumber, columnNumber: start.columnNumber},
489
+ end: {lineNumber: end.lineNumber, columnNumber: end.columnNumber},
490
+ });
491
+ const skipList = sortAndMergeRanges(ranges.map(toProtocolRange));
488
492
  switch (command) {
489
493
  case StepMode.STEP_INTO:
490
494
  void this.agent.invoke_stepInto({breakOnAsyncCall, skipList});
491
495
  break;
492
- case StepMode.STEP_OVER:
493
- void this.agent.invoke_stepOver({skipList});
496
+ case StepMode.STEP_OVER: {
497
+ const request: Protocol.Debugger.StepOverRequest = {skipList};
498
+ if (enterRanges?.length) {
499
+ request.enterRanges = sortAndMergeRanges(enterRanges.map(toProtocolRange));
500
+ }
501
+ void this.agent.invoke_stepOver(request);
494
502
  break;
503
+ }
495
504
  case StepMode.STEP_OUT:
496
505
  void this.agent.invoke_stepOut();
497
506
  break;
@@ -109,7 +109,12 @@ export function toggleClassAndInjectStyleRule(this: Element, pseudoElementName:
109
109
  const classNamePrefix = '__web-inspector-hide';
110
110
  const classNameSuffix = '-shortcut__';
111
111
  const styleTagId = '__web-inspector-hide-shortcut-style__';
112
- const pseudoElementNameEscaped = pseudoElementName ? pseudoElementName.replace(/[^a-zA-Z0-9_-]/g, '_') : '';
112
+ let pseudoElementNameEscaped = '';
113
+ if (pseudoElementName) {
114
+ pseudoElementNameEscaped = pseudoElementName.replace(/[^a-zA-Z0-9-]/g, function(c) {
115
+ return '_' + c.charCodeAt(0).toString(16) + '_';
116
+ });
117
+ }
113
118
  const className = classNamePrefix + pseudoElementNameEscaped + classNameSuffix;
114
119
  this.classList.toggle(className, hidden);
115
120
 
@@ -117,7 +122,7 @@ export function toggleClassAndInjectStyleRule(this: Element, pseudoElementName:
117
122
  while (localRoot.parentNode) {
118
123
  localRoot = (localRoot.parentNode as Element);
119
124
  }
120
- if (localRoot.nodeType === Node.DOCUMENT_NODE) {
125
+ if (localRoot.nodeType === 9 /* Node.DOCUMENT_NODE */) {
121
126
  localRoot = document.head;
122
127
  }
123
128
 
@@ -95,8 +95,10 @@ export class ServerSentEventsParser {
95
95
  this.#data += '\n';
96
96
  }
97
97
  if (fieldName === 'id') {
98
- // We should do a check here whether the id field contains "\0" and ignore it.
99
- this.#id = this.#line.substring(fieldValueStart);
98
+ const id = this.#line.substring(fieldValueStart);
99
+ if (!id.includes('\0')) {
100
+ this.#id = id;
101
+ }
100
102
  }
101
103
  // Ignore all other fields. Also ignore "retry", we won't forward that to the backend.
102
104
  }
@@ -900,11 +900,6 @@ export class SourceMap {
900
900
  [];
901
901
  }
902
902
 
903
- /** See {@link SourceMapScopesInfo.hasOutlinedFunctions}. False without encoded scopes. */
904
- hasOutlinedFunctions(): boolean {
905
- return this.hasEncodedScopeInfo() && (this.#scopesInfo?.hasOutlinedFunctions() ?? false);
906
- }
907
-
908
903
  /** See {@link SourceMapScopesInfo.outlinedFunctionRanges}. Empty without encoded scopes. */
909
904
  outlinedFunctionRanges(generatedLine: number, generatedColumn: number): PositionRange[] {
910
905
  return this.hasEncodedScopeInfo() ? this.#scopesInfo?.outlinedFunctionRanges(generatedLine, generatedColumn) ?? [] :
@@ -613,17 +613,6 @@ export class SourceMapScopesInfo {
613
613
  return result;
614
614
  }
615
615
 
616
- /**
617
- * @returns true, iff any generated function is outlined, i.e. marked as "hidden" but with a definition (see
618
- * {@link GeneratedFrameKind.OUTLINED}). Hidden functions without a definition are compiler helpers.
619
- */
620
- hasOutlinedFunctions(): boolean {
621
- const hasOutlined = (ranges: ScopesCodec.GeneratedRange[]): boolean =>
622
- ranges.some(range => (range.isStackFrame && range.isHidden && range.originalScope !== undefined) ||
623
- hasOutlined(range.children));
624
- return hasOutlined(this.#generatedRanges);
625
- }
626
-
627
616
  /**
628
617
  * @returns the outlined parts of the authored function at the position: the hidden generated functions whose
629
618
  * original scope lies within that function's original scope (see {@link GeneratedFrameKind.OUTLINED}).
@@ -242,6 +242,10 @@ export const UIStrings = {
242
242
  * @description A deprecation warning shown in the DevTools Issues tab. It's shown when a video conferencing website uses a non-standard API for controlling the crypto method used, but is not having an effect because the desired behavior is already enabled-by-default.
243
243
  */
244
244
  RTCConstraintEnableDtlsSrtpTrue: "The constraint `DtlsSrtpKeyAgreement` is removed. You have specified a `true` value for this constraint, which had no effect, but you can remove this constraint for tidiness.",
245
+ /**
246
+ * @description Warning displayed to developers when the non-standard RTCPeerConnection.createDTMFSender() method is used. Developers should use the standard RTCRtpSender.dtmf attribute instead.
247
+ */
248
+ RTCPeerConnectionCreateDTMFSender: "RTCPeerConnection.createDTMFSender() is deprecated and will be removed. Please use RTCRtpSender.dtmf instead.",
245
249
  /**
246
250
  * @description WebRTC is set of JavaScript APIs for sending and receiving data, audio and video. getStats() is a method used to obtain network and quality metrics. There are two versions of this method, one is being deprecated because it is non-standard.
247
251
  */
@@ -427,6 +431,10 @@ export const DEPRECATIONS_METADATA: Partial<Record<string, DeprecationDescriptor
427
431
  "RTCConstraintEnableDtlsSrtpTrue": {
428
432
  "milestone": 97
429
433
  },
434
+ "RTCPeerConnectionCreateDTMFSender": {
435
+ "chromeStatusFeature": 5160724576993280,
436
+ "milestone": 160
437
+ },
430
438
  "RTCPeerConnectionGetStatsLegacyNonCompliant": {
431
439
  "chromeStatusFeature": 4631626228695040,
432
440
  "milestone": 117
@@ -89,7 +89,7 @@ inspectorBackend.registerEnum("Audits.SharedDictionaryError", {UseErrorCrossOrig
89
89
  inspectorBackend.registerEnum("Audits.SRIMessageSignatureError", {MissingSignatureHeader: "MissingSignatureHeader", MissingSignatureInputHeader: "MissingSignatureInputHeader", InvalidSignatureHeader: "InvalidSignatureHeader", InvalidSignatureInputHeader: "InvalidSignatureInputHeader", SignatureHeaderValueIsNotByteSequence: "SignatureHeaderValueIsNotByteSequence", SignatureHeaderValueIsParameterized: "SignatureHeaderValueIsParameterized", SignatureHeaderValueIsIncorrectLength: "SignatureHeaderValueIsIncorrectLength", SignatureInputHeaderMissingLabel: "SignatureInputHeaderMissingLabel", SignatureInputHeaderValueNotInnerList: "SignatureInputHeaderValueNotInnerList", SignatureInputHeaderValueMissingComponents: "SignatureInputHeaderValueMissingComponents", SignatureInputHeaderInvalidComponentType: "SignatureInputHeaderInvalidComponentType", SignatureInputHeaderInvalidComponentName: "SignatureInputHeaderInvalidComponentName", SignatureInputHeaderInvalidHeaderComponentParameter: "SignatureInputHeaderInvalidHeaderComponentParameter", SignatureInputHeaderInvalidDerivedComponentParameter: "SignatureInputHeaderInvalidDerivedComponentParameter", SignatureInputHeaderKeyIdLength: "SignatureInputHeaderKeyIdLength", SignatureInputHeaderInvalidParameter: "SignatureInputHeaderInvalidParameter", SignatureInputHeaderMissingRequiredParameters: "SignatureInputHeaderMissingRequiredParameters", ValidationFailedSignatureExpired: "ValidationFailedSignatureExpired", ValidationFailedInvalidLength: "ValidationFailedInvalidLength", ValidationFailedSignatureMismatch: "ValidationFailedSignatureMismatch", ValidationFailedIntegrityMismatch: "ValidationFailedIntegrityMismatch", SignatureBaseUnknownDerivedComponent: "SignatureBaseUnknownDerivedComponent", SignatureBaseMissingHeader: "SignatureBaseMissingHeader", SignatureBaseInvalidUnencodedDigest: "SignatureBaseInvalidUnencodedDigest", SignatureBaseUnsupportedComponent: "SignatureBaseUnsupportedComponent"});
90
90
  inspectorBackend.registerEnum("Audits.UnencodedDigestError", {MalformedDictionary: "MalformedDictionary", UnknownAlgorithm: "UnknownAlgorithm", IncorrectDigestType: "IncorrectDigestType", IncorrectDigestLength: "IncorrectDigestLength"});
91
91
  inspectorBackend.registerEnum("Audits.ConnectionAllowlistError", {InvalidHeader: "InvalidHeader", MoreThanOneList: "MoreThanOneList", ItemNotInnerList: "ItemNotInnerList", InvalidAllowlistItemType: "InvalidAllowlistItemType", ReportingEndpointNotToken: "ReportingEndpointNotToken", InvalidUrlPattern: "InvalidUrlPattern", IFrameAttributeLoosensEmbeddingRequirement: "IFrameAttributeLoosensEmbeddingRequirement", InvalidAllowConnectionAllowlistFrom: "InvalidAllowConnectionAllowlistFrom", EmbeddingRequirementNotSatisfied: "EmbeddingRequirementNotSatisfied"});
92
- inspectorBackend.registerEnum("Audits.GenericIssueErrorType", {FormLabelForNameError: "FormLabelForNameError", FormDuplicateIdForInputError: "FormDuplicateIdForInputError", FormInputWithNoLabelError: "FormInputWithNoLabelError", FormAutocompleteAttributeEmptyError: "FormAutocompleteAttributeEmptyError", FormEmptyIdAndNameAttributesForInputError: "FormEmptyIdAndNameAttributesForInputError", FormAriaLabelledByToNonExistingIdError: "FormAriaLabelledByToNonExistingIdError", FormInputAssignedAutocompleteValueToIdOrNameAttributeError: "FormInputAssignedAutocompleteValueToIdOrNameAttributeError", FormLabelHasNeitherForNorNestedInputError: "FormLabelHasNeitherForNorNestedInputError", FormLabelForMatchesNonExistingIdError: "FormLabelForMatchesNonExistingIdError", FormInputHasWrongButWellIntendedAutocompleteValueError: "FormInputHasWrongButWellIntendedAutocompleteValueError", ResponseWasBlockedByORB: "ResponseWasBlockedByORB", NavigationEntryMarkedSkippable: "NavigationEntryMarkedSkippable", BackUINavigationWouldSkipAd: "BackUINavigationWouldSkipAd", AutofillAndManualTextPolicyControlledFeaturesInfo: "AutofillAndManualTextPolicyControlledFeaturesInfo", AutofillPolicyControlledFeatureInfo: "AutofillPolicyControlledFeatureInfo", ManualTextPolicyControlledFeatureInfo: "ManualTextPolicyControlledFeatureInfo", FormModelContextParameterMissingTitleAndDescription: "FormModelContextParameterMissingTitleAndDescription", FormModelContextMissingToolName: "FormModelContextMissingToolName", FormModelContextMissingToolDescription: "FormModelContextMissingToolDescription", FormModelContextRequiredParameterMissingName: "FormModelContextRequiredParameterMissingName", FormModelContextParameterMissingName: "FormModelContextParameterMissingName"});
92
+ inspectorBackend.registerEnum("Audits.GenericIssueErrorType", {FormLabelForNameError: "FormLabelForNameError", FormDuplicateIdForInputError: "FormDuplicateIdForInputError", FormInputWithNoLabelError: "FormInputWithNoLabelError", FormAutocompleteAttributeEmptyError: "FormAutocompleteAttributeEmptyError", FormEmptyIdAndNameAttributesForInputError: "FormEmptyIdAndNameAttributesForInputError", FormAriaLabelledByToNonExistingIdError: "FormAriaLabelledByToNonExistingIdError", FormInputAssignedAutocompleteValueToIdOrNameAttributeError: "FormInputAssignedAutocompleteValueToIdOrNameAttributeError", FormLabelHasNeitherForNorNestedInputError: "FormLabelHasNeitherForNorNestedInputError", FormLabelForMatchesNonExistingIdError: "FormLabelForMatchesNonExistingIdError", FormInputHasWrongButWellIntendedAutocompleteValueError: "FormInputHasWrongButWellIntendedAutocompleteValueError", ResponseWasBlockedByORB: "ResponseWasBlockedByORB", NavigationEntryMarkedSkippable: "NavigationEntryMarkedSkippable", BackUINavigationWouldSkipAd: "BackUINavigationWouldSkipAd", AutofillAndManualTextPolicyControlledFeaturesInfo: "AutofillAndManualTextPolicyControlledFeaturesInfo", AutofillPolicyControlledFeatureInfo: "AutofillPolicyControlledFeatureInfo", ManualTextPolicyControlledFeatureInfo: "ManualTextPolicyControlledFeatureInfo", FormModelContextParameterMissingTitleAndDescription: "FormModelContextParameterMissingTitleAndDescription", FormModelContextMissingToolName: "FormModelContextMissingToolName", FormModelContextMissingToolDescription: "FormModelContextMissingToolDescription", FormModelContextRequiredParameterMissingName: "FormModelContextRequiredParameterMissingName", FormModelContextParameterMissingName: "FormModelContextParameterMissingName", GeolocationPromptWithoutUserGesture: "GeolocationPromptWithoutUserGesture"});
93
93
  inspectorBackend.registerEnum("Audits.ClientHintIssueReason", {MetaTagAllowListInvalidOrigin: "MetaTagAllowListInvalidOrigin", MetaTagModifiedHTML: "MetaTagModifiedHTML"});
94
94
  inspectorBackend.registerEnum("Audits.FederatedAuthRequestIssueReason", {ShouldEmbargo: "ShouldEmbargo", TooManyRequests: "TooManyRequests", WellKnownHttpNotFound: "WellKnownHttpNotFound", WellKnownNoResponse: "WellKnownNoResponse", WellKnownBlockedByConnectionAllowlist: "WellKnownBlockedByConnectionAllowlist", WellKnownInvalidResponse: "WellKnownInvalidResponse", WellKnownListEmpty: "WellKnownListEmpty", WellKnownInvalidContentType: "WellKnownInvalidContentType", ConfigNotInWellKnown: "ConfigNotInWellKnown", WellKnownTooBig: "WellKnownTooBig", ConfigHttpNotFound: "ConfigHttpNotFound", ConfigNoResponse: "ConfigNoResponse", ConfigBlockedByConnectionAllowlist: "ConfigBlockedByConnectionAllowlist", ConfigInvalidResponse: "ConfigInvalidResponse", ConfigInvalidContentType: "ConfigInvalidContentType", IdpNotPotentiallyTrustworthy: "IdpNotPotentiallyTrustworthy", DisabledInSettings: "DisabledInSettings", DisabledInFlags: "DisabledInFlags", ErrorFetchingSignin: "ErrorFetchingSignin", InvalidSigninResponse: "InvalidSigninResponse", AccountsHttpNotFound: "AccountsHttpNotFound", AccountsNoResponse: "AccountsNoResponse", AccountsBlockedByConnectionAllowlist: "AccountsBlockedByConnectionAllowlist", AccountsInvalidResponse: "AccountsInvalidResponse", AccountsListEmpty: "AccountsListEmpty", AccountsInvalidContentType: "AccountsInvalidContentType", IdTokenHttpNotFound: "IdTokenHttpNotFound", IdTokenNoResponse: "IdTokenNoResponse", IdTokenBlockedByConnectionAllowlist: "IdTokenBlockedByConnectionAllowlist", IdTokenInvalidResponse: "IdTokenInvalidResponse", IdTokenIdpErrorResponse: "IdTokenIdpErrorResponse", IdTokenCrossSiteIdpErrorResponse: "IdTokenCrossSiteIdpErrorResponse", IdTokenInvalidRequest: "IdTokenInvalidRequest", IdTokenInvalidContentType: "IdTokenInvalidContentType", ErrorIdToken: "ErrorIdToken", Canceled: "Canceled", RpPageNotVisible: "RpPageNotVisible", SilentMediationFailure: "SilentMediationFailure", NotSignedInWithIdp: "NotSignedInWithIdp", MissingTransientUserActivation: "MissingTransientUserActivation", ReplacedByActiveMode: "ReplacedByActiveMode", RelyingPartyOriginIsOpaque: "RelyingPartyOriginIsOpaque", TypeNotMatching: "TypeNotMatching", UiDismissedNoEmbargo: "UiDismissedNoEmbargo", CorsError: "CorsError", SuppressedBySegmentationPlatform: "SuppressedBySegmentationPlatform", PopupBlockedByConnectionAllowlist: "PopupBlockedByConnectionAllowlist"});
95
95
  inspectorBackend.registerEnum("Audits.FederatedAuthUserInfoRequestIssueReason", {NotSameOrigin: "NotSameOrigin", NotIframe: "NotIframe", NotPotentiallyTrustworthy: "NotPotentiallyTrustworthy", NoAPIPermission: "NoApiPermission", NotSignedInWithIdp: "NotSignedInWithIdp", NoAccountSharingPermission: "NoAccountSharingPermission", InvalidConfigOrWellKnown: "InvalidConfigOrWellKnown", InvalidAccountsResponse: "InvalidAccountsResponse", NoReturningUserFromFetchedAccounts: "NoReturningUserFromFetchedAccounts"});
@@ -1126,6 +1126,7 @@ inspectorBackend.registerCommand("Page.getAppId", [], ["appId", "recommendedId",
1126
1126
  inspectorBackend.registerCommand("Page.getSubApps", [], ["subApps"], "Returns the list of installed child Sub-Apps for the inspected parent app.");
1127
1127
  inspectorBackend.registerCommand("Page.getSiblingSubApps", [], ["subApps"], "Returns the list of sibling Sub-Apps sharing the same parent app if the inspected context is a Sub-App.");
1128
1128
  inspectorBackend.registerCommand("Page.getAdScriptAncestry", [{"name": "frameId", "type": "string", "optional": false, "description": "", "typeRef": "Page.FrameId"}], ["adScriptAncestry"], "");
1129
+ inspectorBackend.registerCommand("Page.getSpellCheckCustomDictionary", [{"name": "frameId", "type": "string", "optional": false, "description": "", "typeRef": "Page.FrameId"}], ["words"], "Returns the words that the frame's document added to its spell check custom dictionary with `document.spellCheckCustomDictionary.addWords()`, sorted. Page script cannot read the dictionary back; this lets developers inspect it.");
1129
1130
  inspectorBackend.registerCommand("Page.getFrameTree", [], ["frameTree"], "Returns present frame tree structure.");
1130
1131
  inspectorBackend.registerCommand("Page.getLayoutMetrics", [], ["layoutViewport", "visualViewport", "contentSize", "cssLayoutViewport", "cssVisualViewport", "cssContentSize"], "Returns metrics relating to the layouting of the page, such as viewport bounds/scale.");
1131
1132
  inspectorBackend.registerCommand("Page.getNavigationHistory", [], ["currentIndex", "entries"], "Returns navigation history for the current page.");
@@ -4228,6 +4228,16 @@ export namespace ProtocolMapping {
4228
4228
  paramsType: [Protocol.Page.GetAdScriptAncestryRequest];
4229
4229
  returnType: Protocol.Page.GetAdScriptAncestryResponse;
4230
4230
  };
4231
+ /**
4232
+ * Returns the words that the frame's document added to its spell check custom
4233
+ * dictionary with `document.spellCheckCustomDictionary.addWords()`, sorted.
4234
+ * Page script cannot read the dictionary back; this lets developers inspect
4235
+ * it.
4236
+ */
4237
+ 'Page.getSpellCheckCustomDictionary': {
4238
+ paramsType: [Protocol.Page.GetSpellCheckCustomDictionaryRequest];
4239
+ returnType: Protocol.Page.GetSpellCheckCustomDictionaryResponse;
4240
+ };
4231
4241
  /**
4232
4242
  * Returns present frame tree structure.
4233
4243
  */
@@ -3422,6 +3422,14 @@ declare namespace ProtocolProxyApi {
3422
3422
 
3423
3423
  invoke_getAdScriptAncestry(params: Protocol.Page.GetAdScriptAncestryRequest): Promise<Protocol.Page.GetAdScriptAncestryResponse>;
3424
3424
 
3425
+ /**
3426
+ * Returns the words that the frame's document added to its spell check custom
3427
+ * dictionary with `document.spellCheckCustomDictionary.addWords()`, sorted.
3428
+ * Page script cannot read the dictionary back; this lets developers inspect
3429
+ * it.
3430
+ */
3431
+ invoke_getSpellCheckCustomDictionary(params: Protocol.Page.GetSpellCheckCustomDictionaryRequest): Promise<Protocol.Page.GetSpellCheckCustomDictionaryResponse>;
3432
+
3425
3433
  /**
3426
3434
  * Returns present frame tree structure.
3427
3435
  */
@@ -1291,6 +1291,7 @@ export namespace Audits {
1291
1291
  FormModelContextMissingToolDescription = 'FormModelContextMissingToolDescription',
1292
1292
  FormModelContextRequiredParameterMissingName = 'FormModelContextRequiredParameterMissingName',
1293
1293
  FormModelContextParameterMissingName = 'FormModelContextParameterMissingName',
1294
+ GeolocationPromptWithoutUserGesture = 'GeolocationPromptWithoutUserGesture',
1294
1295
  }
1295
1296
 
1296
1297
  /**
@@ -16027,6 +16028,14 @@ export namespace Page {
16027
16028
  adScriptAncestry?: Network.AdAncestry;
16028
16029
  }
16029
16030
 
16031
+ export interface GetSpellCheckCustomDictionaryRequest {
16032
+ frameId: FrameId;
16033
+ }
16034
+
16035
+ export interface GetSpellCheckCustomDictionaryResponse extends ProtocolResponseWithError {
16036
+ words: string[];
16037
+ }
16038
+
16030
16039
  export interface GetFrameTreeResponse extends ProtocolResponseWithError {
16031
16040
  /**
16032
16041
  * Present frame tree structure.
@@ -23,6 +23,65 @@ import {
23
23
  type UrlString = Platform.DevToolsPath.UrlString;
24
24
  const MAX_SUGGESTION_LENGTH = 200;
25
25
 
26
+ /**
27
+ * The types of event in the response stream that `AiConversation#run()`
28
+ * yields to the AI assistance panel. The same events, minus a few, are saved
29
+ * as the conversation history and replayed when a saved conversation opens.
30
+ *
31
+ * ## Order of events in one run
32
+ *
33
+ * ```
34
+ * USER_QUERY (AiConversation, first run of a query only)
35
+ * CONTEXT* (agent's handleContextDetails())
36
+ * repeated for each model request, up to MAX_STEPS:
37
+ * QUERYING
38
+ * one of:
39
+ * ANSWER (complete: false)*, ANSWER (complete: true) text-only reply; the run ends
40
+ * [ANSWER (complete: true)], <tool call events> function call, optionally with text
41
+ * ERROR the run ends
42
+ * ```
43
+ *
44
+ * An `ERROR` can also follow the tool call events, for example when the user
45
+ * aborts, the page navigates cross-origin, or the run reaches `MAX_STEPS`.
46
+ *
47
+ * ## Events for one tool call
48
+ *
49
+ * `AiAgent#callFunction()` yields these. All events for one call carry the
50
+ * same `callId`.
51
+ *
52
+ * ```
53
+ * TITLE?, THOUGHT? from the tool's displayInfoFromArgs()
54
+ * if the tool needs approval:
55
+ * ACTION {code} code only, shown above the approval prompt;
56
+ * skipped if displayInfoFromArgs() has no action
57
+ * SIDE_EFFECT the panel shows the prompt and calls confirm()
58
+ * if denied: ACTION {code, output, canceled: true}, and the call ends
59
+ * ACTION {code, output, widgets, toolName} result or error
60
+ * ```
61
+ *
62
+ * If the tool switches context instead of returning a result, there is no
63
+ * result `ACTION`. `AiAgent#run()` yields `CONTEXT_CHANGE` and returns, and
64
+ * `AiConversation` starts a new run with the agent for the new context.
65
+ *
66
+ * ## Saved history
67
+ *
68
+ * `AiConversation` saves every event except `CONTEXT_CHANGE` and partial
69
+ * `ANSWER`s. `AiConversation#serialize()` removes `confirm`, images and
70
+ * widgets, and redacts the `ACTION` output of tools annotated with
71
+ * `REDACT_FROM_HISTORY`. Saved data has no version field, so new fields must
72
+ * be optional.
73
+ *
74
+ * ## How the panel renders events
75
+ *
76
+ * `AiAssistancePanel#consumeResponseStream()` builds one chat message per
77
+ * `USER_QUERY` and one step per tool call:
78
+ * - `QUERYING` starts a new step with a spinner. The panel shows the step only
79
+ * if it is the first part of the message. Otherwise, the step stays hidden
80
+ * until a tool call fills it in.
81
+ * - `TITLE`, `THOUGHT`, `ACTION` and `SIDE_EFFECT` update the step for their
82
+ * `callId`. Events saved before `callId` existed update the current step.
83
+ * - `ANSWER` adds the answer text. `ERROR` sets the message error.
84
+ */
26
85
  export const enum ResponseType {
27
86
  CONTEXT = 'context',
28
87
  TITLE = 'title',
@@ -68,6 +127,10 @@ export interface AnswerResponse {
68
127
  widgets?: AiWidget[];
69
128
  }
70
129
 
130
+ /**
131
+ * No agent yields this event. The panel still handles it by attaching the
132
+ * suggestions to the last answer.
133
+ */
71
134
  export interface SuggestionsResponse {
72
135
  type: ResponseType.SUGGESTIONS;
73
136
  suggestions: [string, ...string[]];
@@ -83,32 +146,79 @@ export interface ContextDetail {
83
146
  text: string;
84
147
  codeLang?: string;
85
148
  }
149
+
150
+ /**
151
+ * Describes the context sent with the user's query, such as the selected
152
+ * element. The agent's `handleContextDetails()` yields it before the first
153
+ * model request. The panel shows it as a completed "Analyzing data" step.
154
+ */
86
155
  export interface ContextResponse {
87
156
  type: ResponseType.CONTEXT;
88
157
  details: [ContextDetail, ...ContextDetail[]];
89
158
  widgets?: AiWidget[];
90
159
  }
91
160
 
92
- export interface TitleResponse {
161
+ /**
162
+ * Identifies the tool call that an event belongs to. `AiAgent#callFunction()`
163
+ * generates one per call and sets it on every event for that call. Only the
164
+ * UI reads it; the agent never sends it to the model.
165
+ *
166
+ * Conversations saved before this field existed do not have it. The panel
167
+ * applies events without a `callId` to the current step.
168
+ */
169
+ interface ToolCallEvent {
170
+ callId?: string;
171
+ }
172
+
173
+ /**
174
+ * The heading of a tool call's step, from `displayInfoFromArgs().title`.
175
+ */
176
+ export interface TitleResponse extends ToolCallEvent {
93
177
  type: ResponseType.TITLE;
94
178
  title: string;
179
+ /**
180
+ * No agent sets this field.
181
+ */
95
182
  rpcId?: Host.AidaClient.RpcGlobalId;
96
183
  }
97
184
 
98
- export interface ThoughtResponse {
185
+ /**
186
+ * Explanation text for a tool call's step, from
187
+ * `displayInfoFromArgs().thought`. The panel marks the step as completed when
188
+ * it receives a thought, even though the tool has not run yet.
189
+ */
190
+ export interface ThoughtResponse extends ToolCallEvent {
99
191
  type: ResponseType.THOUGHT;
100
192
  thought: string;
193
+ /**
194
+ * No agent sets this field.
195
+ */
101
196
  rpcId?: Host.AidaClient.RpcGlobalId;
102
197
  }
103
198
 
104
- export interface SideEffectResponse {
199
+ /**
200
+ * Asks the user to approve a tool call that has side effects. The agent waits
201
+ * until `confirm()` is called. If `displayInfoFromArgs()` returns an
202
+ * `action`, the agent yields it in a code-only `ACTION` just before this
203
+ * event.
204
+ */
205
+ export interface SideEffectResponse extends ToolCallEvent {
105
206
  type: ResponseType.SIDE_EFFECT;
106
207
  description: string|null;
208
+ /**
209
+ * No agent sets this field. The code comes from the preceding `ACTION`.
210
+ */
107
211
  code?: string;
108
212
  confirm: (decision: PermissionDecision) => void;
109
213
  permissionPrompt?: PermissionPrompt;
110
214
  permissionTitle?: string;
111
215
  }
216
+
217
+ /**
218
+ * Yielded when a tool selects a new context, for example a network request.
219
+ * `AiConversation` switches to the agent for that context and starts a new
220
+ * run. `AiConversation` does not save this event in the history.
221
+ */
112
222
  export interface ContextChangeResponse {
113
223
  type: ResponseType.CONTEXT_CHANGE;
114
224
  /**
@@ -123,22 +233,51 @@ export interface ContextChangeResponse {
123
233
 
124
234
  interface SerializedSideEffectResponse extends Omit<SideEffectResponse, 'confirm'> {}
125
235
 
126
- export interface ActionResponse {
236
+ /**
237
+ * The code and result of a tool call. A call yields one or two:
238
+ * - Calls that need approval and have code first yield a code-only `ACTION`
239
+ * (no `output`), so the panel can show the code above the approval prompt.
240
+ * - Every call that runs, fails or is denied ends with an `ACTION` that has
241
+ * an `output`.
242
+ */
243
+ export interface ActionResponse extends ToolCallEvent {
127
244
  type: ResponseType.ACTION;
245
+ /**
246
+ * The text shown in the step's code box, from
247
+ * `displayInfoFromArgs().action`. It is real code only for tools that run
248
+ * code, such as `executeJavaScript`. For other tools it is a readable form of
249
+ * the call.
250
+ */
128
251
  code?: string;
252
+ /**
253
+ * The tool's result, error message, or the denial message. Missing on the
254
+ * code-only `ACTION` that precedes an approval prompt.
255
+ */
129
256
  output?: string;
257
+ /**
258
+ * True if the user denied the call, so the tool did not run.
259
+ */
130
260
  canceled: boolean;
131
261
  widgets?: AiWidget[];
132
262
  /**
133
- * The name of the executed tool. Only populated for AI v2.
263
+ * The name of the tool. Set on the result `ACTION` but not on the code-only
264
+ * or denied `ACTION`. `AiConversation#serialize()` uses it to redact the
265
+ * output of tools annotated with `REDACT_FROM_HISTORY`.
134
266
  */
135
267
  toolName?: string;
136
268
  }
137
269
 
270
+ /**
271
+ * Yielded before each model request. The panel starts a new step for it.
272
+ */
138
273
  export interface QueryingResponse {
139
274
  type: ResponseType.QUERYING;
140
275
  }
141
276
 
277
+ /**
278
+ * The user's query. Yielded by `AiConversation`, not by the agent, before
279
+ * the first run for the query. The panel starts a new chat message for it.
280
+ */
142
281
  export interface UserQuery {
143
282
  type: ResponseType.USER_QUERY;
144
283
  query: string;
@@ -476,7 +615,17 @@ export interface FunctionDeclaration<Args extends Record<string, unknown>, Retur
476
615
  */
477
616
  parameters: Host.AidaClient.FunctionObjectParam<keyof Args>;
478
617
  /**
479
- * Provided a way to give information back to the UI.
618
+ * Returns the text the UI shows for a call to this function. The agent
619
+ * calls it before the handler runs.
620
+ *
621
+ * - `title`: the step heading, sent as `TITLE`.
622
+ * - `thought`: optional explanation shown in the step, sent as `THOUGHT`.
623
+ * - `action`: the text shown in the step's code box, sent as
624
+ * `ACTION.code`. It is real code only for tools that run code, such as
625
+ * `executeJavaScript`. For other tools it is a readable form of the call,
626
+ * for example `getInsightDetails('NAVIGATION_0', 'LCPBreakdown')`, and is
627
+ * never executed.
628
+ * - `suggestions`: `AiAgent` does not use this field.
480
629
  */
481
630
  displayInfoFromArgs?: (
482
631
  args: Args,
@@ -981,6 +1130,17 @@ export abstract class AiAgent<T> {
981
1130
  response: {...result, widgets: undefined},
982
1131
  },
983
1132
  };
1133
+ if (i === MAX_STEPS - 1) {
1134
+ // Normally, the functionResponse is pushed at the start of the next
1135
+ // iteration. Since no further iteration will run, push it here so the
1136
+ // last functionCall is not left unpaired in history.
1137
+ this.#history.push({
1138
+ parts: [query],
1139
+ role: Host.AidaClient.Role.ROLE_UNSPECIFIED,
1140
+ });
1141
+ yield this.#createErrorResponse(ErrorType.MAX_STEPS);
1142
+ break;
1143
+ }
984
1144
  request = this.buildRequest(query, Host.AidaClient.Role.ROLE_UNSPECIFIED);
985
1145
  } catch (err) {
986
1146
  if (err instanceof CrossOriginError) {
@@ -995,11 +1155,6 @@ export abstract class AiAgent<T> {
995
1155
  yield this.#createErrorResponse(ErrorType.UNKNOWN);
996
1156
  break;
997
1157
  }
998
-
999
- if (i === MAX_STEPS - 1) {
1000
- yield this.#createErrorResponse(ErrorType.MAX_STEPS);
1001
- break;
1002
- }
1003
1158
  }
1004
1159
 
1005
1160
  if (isStructuredLogEnabled()) {
@@ -1042,6 +1197,7 @@ export abstract class AiAgent<T> {
1042
1197
  role: Host.AidaClient.Role.MODEL,
1043
1198
  });
1044
1199
 
1200
+ const callId = crypto.randomUUID();
1045
1201
  let code;
1046
1202
  if (call.displayInfoFromArgs) {
1047
1203
  const {title, thought, action: callCode} = call.displayInfoFromArgs(args);
@@ -1049,6 +1205,7 @@ export abstract class AiAgent<T> {
1049
1205
  if (title) {
1050
1206
  yield {
1051
1207
  type: ResponseType.TITLE,
1208
+ callId,
1052
1209
  title,
1053
1210
  };
1054
1211
  }
@@ -1056,6 +1213,7 @@ export abstract class AiAgent<T> {
1056
1213
  if (thought) {
1057
1214
  yield {
1058
1215
  type: ResponseType.THOUGHT,
1216
+ callId,
1059
1217
  thought,
1060
1218
  };
1061
1219
  }
@@ -1078,6 +1236,7 @@ export abstract class AiAgent<T> {
1078
1236
  if (code) {
1079
1237
  yield {
1080
1238
  type: ResponseType.ACTION,
1239
+ callId,
1081
1240
  code,
1082
1241
  canceled: false,
1083
1242
  };
@@ -1104,6 +1263,7 @@ export abstract class AiAgent<T> {
1104
1263
 
1105
1264
  yield {
1106
1265
  type: ResponseType.SIDE_EFFECT,
1266
+ callId,
1107
1267
  confirm: sideEffectConfirmationPromiseWithResolvers.resolve,
1108
1268
  description: result.description,
1109
1269
  permissionPrompt: call.permissionPrompt,
@@ -1119,6 +1279,7 @@ export abstract class AiAgent<T> {
1119
1279
  if (decision === PermissionDecision.REJECT) {
1120
1280
  yield {
1121
1281
  type: ResponseType.ACTION,
1282
+ callId,
1122
1283
  code,
1123
1284
  output: 'Error: User denied code execution with side effects.',
1124
1285
  canceled: true,
@@ -1152,6 +1313,7 @@ export abstract class AiAgent<T> {
1152
1313
  if ('result' in result) {
1153
1314
  yield {
1154
1315
  type: ResponseType.ACTION,
1316
+ callId,
1155
1317
  code,
1156
1318
  output: typeof result.result === 'string' ? result.result : JSON.stringify(result.result),
1157
1319
  widgets: result.widgets,
@@ -1163,6 +1325,7 @@ export abstract class AiAgent<T> {
1163
1325
  if ('error' in result) {
1164
1326
  yield {
1165
1327
  type: ResponseType.ACTION,
1328
+ callId,
1166
1329
  code,
1167
1330
  output: result.error,
1168
1331
  canceled: false,
@@ -1228,8 +1391,11 @@ export abstract class AiAgent<T> {
1228
1391
  }
1229
1392
 
1230
1393
  #createErrorResponse(error: ErrorType): ResponseData {
1231
- this.#removeLastRunParts();
1232
- this.clearCache();
1394
+ // If we hit MAX_STEPS, we still want to keep the call history as this may be relevant for follow-up requests.
1395
+ if (error !== ErrorType.MAX_STEPS) {
1396
+ this.#removeLastRunParts();
1397
+ this.clearCache();
1398
+ }
1233
1399
  if (error !== ErrorType.ABORT) {
1234
1400
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.AiAssistanceError);
1235
1401
  }