pi-agent-browser-native 0.2.33 → 0.2.34

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.
@@ -4,6 +4,7 @@
4
4
  * Scope: Presentation shaping only; upstream stdout parsing and snapshot compaction internals live in separate modules.
5
5
  */
6
6
 
7
+ import type { CompiledAgentBrowserSemanticAction } from "../input-modes/types.js";
7
8
  import { isRecord } from "../parsing.js";
8
9
  import type { CommandInfo } from "../runtime.js";
9
10
  import type { PersistentSessionArtifactStore } from "../temp.js";
@@ -43,6 +44,7 @@ import { buildErrorPresentation } from "./presentation/errors.js";
43
44
  import { compactLargePresentationOutput } from "./presentation/large-output.js";
44
45
  import { buildPageChangeSummary } from "./presentation/navigation.js";
45
46
  import { formatPresentationContentText, formatPresentationSummary } from "./presentation/registry.js";
47
+ import { resolvePresentationCommandInfo } from "./presentation/semantic-action.js";
46
48
 
47
49
  function sanitizeModelFacingPresentation(presentation: ToolPresentation): ToolPresentation {
48
50
  presentation.content = presentation.content.map((item) => {
@@ -65,6 +67,7 @@ export async function buildToolPresentation(options: {
65
67
  artifactRequest?: ArtifactRequestContext;
66
68
  batchArtifactRequests?: Array<ArtifactRequestContext | undefined>;
67
69
  commandInfo: CommandInfo;
70
+ compiledSemanticAction?: CompiledAgentBrowserSemanticAction;
68
71
  cwd: string;
69
72
  envelope?: AgentBrowserEnvelope;
70
73
  errorText?: string;
@@ -76,12 +79,14 @@ export async function buildToolPresentation(options: {
76
79
  artifactManifest,
77
80
  artifactRequest,
78
81
  commandInfo,
82
+ compiledSemanticAction,
79
83
  cwd,
80
84
  envelope,
81
85
  errorText,
82
86
  persistentArtifactStore,
83
87
  sessionName,
84
88
  } = options;
89
+ const presentationCommandInfo = resolvePresentationCommandInfo(commandInfo, compiledSemanticAction);
85
90
 
86
91
  if (errorText) {
87
92
  return buildErrorPresentation({ args, commandInfo, errorText, sessionName });
@@ -89,10 +94,10 @@ export async function buildToolPresentation(options: {
89
94
 
90
95
  const data = enrichStreamStatusData(commandInfo, envelope?.data);
91
96
  const presentationData = redactPresentationData(commandInfo, data);
92
- const artifacts = await extractFileArtifacts({ artifactRequest, commandInfo, cwd, data, sessionName });
97
+ const artifacts = await extractFileArtifacts({ artifactRequest, commandInfo: presentationCommandInfo, cwd, data, sessionName });
93
98
  const artifactVerification = buildArtifactVerificationSummary(artifacts);
94
99
  const artifactSummary = formatArtifactSummary(artifacts);
95
- const summary = artifactSummary ?? formatPresentationSummary(commandInfo, data);
100
+ const summary = artifactSummary ?? formatPresentationSummary(commandInfo, data, compiledSemanticAction);
96
101
  const artifactText = artifacts.length > 0 ? formatArtifactMetadataLines(artifacts).join("\n") : undefined;
97
102
 
98
103
  let presentation: ToolPresentation;
@@ -113,7 +118,7 @@ export async function buildToolPresentation(options: {
113
118
  presentation = {
114
119
  artifactVerification,
115
120
  artifacts: artifacts.length > 0 ? artifacts : undefined,
116
- content: [{ type: "text", text: artifactText ?? formatPresentationContentText(commandInfo, data) }],
121
+ content: [{ type: "text", text: artifactText ?? formatPresentationContentText(commandInfo, data, compiledSemanticAction) }],
117
122
  data: presentationData,
118
123
  summary,
119
124
  };
@@ -159,7 +164,7 @@ export async function buildToolPresentation(options: {
159
164
  if (!presentationWithManifest.resultCategory) {
160
165
  const categoryDetails = buildAgentBrowserResultCategoryDetails({
161
166
  artifacts: presentationWithManifest.artifacts,
162
- command: commandInfo.command,
167
+ command: presentationCommandInfo.command,
163
168
  confirmationRequired: confirmationRequired !== undefined,
164
169
  errorText: envelope?.success === false ? presentationWithManifest.summary : undefined,
165
170
  savedFile: presentationWithManifest.savedFile,
@@ -186,7 +191,7 @@ export async function buildToolPresentation(options: {
186
191
  const genericNextActions = presentationWithManifest.nextActions ? undefined : buildAgentBrowserNextActions({
187
192
  artifacts: presentationWithManifest.artifacts,
188
193
  args,
189
- command: commandInfo.command,
194
+ command: presentationCommandInfo.command,
190
195
  confirmationId: confirmationRequired?.id,
191
196
  failureCategory: presentationWithManifest.failureCategory,
192
197
  resultCategory: presentationWithManifest.resultCategory ?? "success",
@@ -203,7 +208,7 @@ export async function buildToolPresentation(options: {
203
208
  );
204
209
  presentationWithManifest.pageChangeSummary = presentationWithManifest.pageChangeSummary ?? buildPageChangeSummary({
205
210
  artifacts: presentationWithManifest.artifacts,
206
- commandInfo,
211
+ commandInfo: presentationCommandInfo,
207
212
  data,
208
213
  nextActions: presentationWithManifest.nextActions,
209
214
  savedFilePath: presentationWithManifest.savedFilePath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-browser-native",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
4
4
  "description": "pi extension that exposes agent-browser as a native tool for browser automation",
5
5
  "type": "module",
6
6
  "author": "Mitch Fultz (https://github.com/fitchmultz)",