@hao-gd/page-agent-ui 1.10.7 → 1.11.0
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/dist/lib/index.d.ts +380 -2
- package/dist/lib/page-agent-ui.js +3465 -440
- package/dist/lib/page-agent-ui.js.map +1 -1
- package/package.json +3 -2
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
/** Outcome of a gate request. */
|
|
2
|
+
export declare type ActionGateDecision = 'allow' | 'block' | 'deny';
|
|
3
|
+
|
|
4
|
+
/** Action descriptor handed to the Panel by the runtime gate. */
|
|
5
|
+
export declare interface ActionGateInfo {
|
|
6
|
+
tool: string;
|
|
7
|
+
input: unknown;
|
|
8
|
+
step: number;
|
|
9
|
+
risk: ActionRisk;
|
|
10
|
+
/** 0..1 locator confidence; low values escalate the gate. */
|
|
11
|
+
confidence?: number;
|
|
12
|
+
/** Human readable target (element label, selector, ...). */
|
|
13
|
+
target?: string;
|
|
14
|
+
/** The model's stated reasoning for this action (the "why"). */
|
|
15
|
+
reflection?: {
|
|
16
|
+
evaluation_previous_goal?: string;
|
|
17
|
+
memory?: string;
|
|
18
|
+
next_goal?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Resolved risk metadata for an action awaiting approval. */
|
|
23
|
+
export declare interface ActionRisk {
|
|
24
|
+
level: RiskLevel;
|
|
25
|
+
isSideEffectFree: boolean;
|
|
26
|
+
reason?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
1
29
|
/**
|
|
2
30
|
* Derived active LLM configuration from the currently selected provider + model.
|
|
3
31
|
*/
|
|
@@ -141,9 +169,80 @@ declare const enUS: {
|
|
|
141
169
|
readonly waitingPlaceholder: "Waiting for task to start...";
|
|
142
170
|
readonly stop: "Stop";
|
|
143
171
|
readonly close: "Close";
|
|
172
|
+
readonly send: "Send";
|
|
144
173
|
readonly expand: "Expand history";
|
|
145
174
|
readonly history: "History";
|
|
146
175
|
readonly step: "Step {{number}}";
|
|
176
|
+
readonly you: "You";
|
|
177
|
+
readonly agent: "Page Agent";
|
|
178
|
+
readonly tokens: "tokens";
|
|
179
|
+
readonly thinkingPhase: "Thinking";
|
|
180
|
+
readonly sameAsPrevious: "Same as previous step";
|
|
181
|
+
readonly thinkingSameAsPrevious: "Thinking unchanged from the previous step";
|
|
182
|
+
readonly repeatedStep: "Repeat";
|
|
183
|
+
readonly copy: "Copy";
|
|
184
|
+
readonly copied: "Copied";
|
|
185
|
+
readonly expandStep: "Expand step";
|
|
186
|
+
readonly collapseStep: "Collapse step";
|
|
187
|
+
readonly activityIdle: "Waiting for you";
|
|
188
|
+
readonly interactionMode: "Interaction mode";
|
|
189
|
+
readonly autopilot: "Autopilot";
|
|
190
|
+
readonly collaborative: "Step-by-step";
|
|
191
|
+
readonly autopilotHint: "Runs everything automatically, blocking only irreversible actions";
|
|
192
|
+
readonly collaborativeHint: "Pauses before each step for your approval";
|
|
193
|
+
readonly copilot: "Co-pilot";
|
|
194
|
+
readonly copilotHint: "Reads and draft edits run freely, committed changes ask first";
|
|
195
|
+
readonly stepMode: "Step-by-step";
|
|
196
|
+
readonly stepModeHint: "Pauses before every action with its tool, target and rationale";
|
|
197
|
+
readonly approvalTitle: "Your approval is needed";
|
|
198
|
+
readonly waitingApproval: "Waiting for approval";
|
|
199
|
+
readonly approvalBody: "The agent is ready for the next step. Review it, then continue or switch to autopilot.";
|
|
200
|
+
readonly approvalContinue: "Continue";
|
|
201
|
+
readonly approvalBlock: "Reject this action";
|
|
202
|
+
readonly approvalAuto: "Run automatically";
|
|
203
|
+
readonly approvalStop: "Stop task";
|
|
204
|
+
readonly approvalStep: "Step {{number}}";
|
|
205
|
+
readonly gateTitle: "Confirm this action";
|
|
206
|
+
readonly gateBody: "This action changes state outside the agent. Review the details below.";
|
|
207
|
+
readonly gateTarget: "Element #{{index}}";
|
|
208
|
+
readonly gateValue: "Value";
|
|
209
|
+
readonly gateWhy: "Why";
|
|
210
|
+
readonly gateOutcome: "Last step";
|
|
211
|
+
readonly approvalBatch: "Always allow {{action}}";
|
|
212
|
+
readonly approvalShortcut: "Enter allows · Esc rejects this action";
|
|
213
|
+
readonly actionRejected: "Action rejected — the agent is re-planning";
|
|
214
|
+
readonly risk: {
|
|
215
|
+
readonly L0: "Read-only";
|
|
216
|
+
readonly L1: "Reversible";
|
|
217
|
+
readonly L2: "Committed change";
|
|
218
|
+
readonly L3: "Irreversible";
|
|
219
|
+
};
|
|
220
|
+
readonly riskHint: {
|
|
221
|
+
readonly destructive: "This can delete, pay or otherwise do something that cannot be undone.";
|
|
222
|
+
readonly commit: "This changes data outside the agent.";
|
|
223
|
+
readonly lowConfidence: "The target element is ambiguous, so confirmation is required.";
|
|
224
|
+
readonly generic: "This action changes state and needs your confirmation.";
|
|
225
|
+
readonly stepMode: "Step-by-step mode pauses on every action so you can verify them one by one.";
|
|
226
|
+
readonly done: "This finishes the task and returns the result above.";
|
|
227
|
+
};
|
|
228
|
+
readonly undo: "Undo";
|
|
229
|
+
readonly undoHint: "Filled automatically — you can undo this";
|
|
230
|
+
readonly resumeTitle: "Task interrupted";
|
|
231
|
+
readonly resumeHint: "Continue from where it stopped — the previous steps are kept";
|
|
232
|
+
readonly resumeAction: "Resume";
|
|
233
|
+
readonly taskAborted: "Task stopped";
|
|
234
|
+
readonly tool: {
|
|
235
|
+
readonly click_element_by_index: "Click element";
|
|
236
|
+
readonly input_text: "Type into field";
|
|
237
|
+
readonly select_dropdown_option: "Select option";
|
|
238
|
+
readonly execute_javascript: "Run JavaScript";
|
|
239
|
+
readonly scroll: "Scroll page";
|
|
240
|
+
readonly read_page_content: "Read page";
|
|
241
|
+
readonly save_data: "Save data";
|
|
242
|
+
readonly wait: "Wait";
|
|
243
|
+
readonly done: "Finish task";
|
|
244
|
+
readonly ask_user: "Ask you a question";
|
|
245
|
+
};
|
|
147
246
|
readonly newConversation: "New Conversation";
|
|
148
247
|
readonly conversations: "Conversations";
|
|
149
248
|
readonly noConversations: "No conversations";
|
|
@@ -156,6 +255,15 @@ declare const enUS: {
|
|
|
156
255
|
};
|
|
157
256
|
readonly settings: {
|
|
158
257
|
readonly title: "Settings";
|
|
258
|
+
readonly subtitle: "Models, agent behaviour and skills";
|
|
259
|
+
readonly navProviders: "Models";
|
|
260
|
+
readonly navAgent: "Agent";
|
|
261
|
+
readonly navSkills: "Skills";
|
|
262
|
+
readonly navSafety: "Approval";
|
|
263
|
+
readonly autoSave: "Changes are saved automatically";
|
|
264
|
+
readonly done: "Done";
|
|
265
|
+
readonly quickStart: "Quick start";
|
|
266
|
+
readonly quickStartHint: "Pick a provider preset, then paste your API key.";
|
|
159
267
|
readonly modelTab: "Model Config";
|
|
160
268
|
readonly providersTab: "Providers";
|
|
161
269
|
readonly generalTab: "General";
|
|
@@ -172,6 +280,16 @@ declare const enUS: {
|
|
|
172
280
|
readonly temperature: "Temperature";
|
|
173
281
|
readonly maxSteps: "Max Steps";
|
|
174
282
|
readonly maxStepsHint: "Maximum agent loop iterations (5-200)";
|
|
283
|
+
readonly safetyPolicy: "Authorization policy";
|
|
284
|
+
readonly safetyPolicyHint: "Choose how far the agent may go without asking you first.";
|
|
285
|
+
readonly safetyRemember: "Remember per-action approval";
|
|
286
|
+
readonly safetyRememberHint: "Adds an \"always allow this action type\" button to confirmation cards. Scoped to the current task.";
|
|
287
|
+
readonly safetyMatrix: "Risk tiers";
|
|
288
|
+
readonly riskL0Desc: "Page reads, DOM queries and waiting — never asked.";
|
|
289
|
+
readonly riskL1Desc: "Field fills and dropdown picks — automatic, with undo.";
|
|
290
|
+
readonly riskL2Desc: "Submits, saves and script execution — asked in Co-pilot mode.";
|
|
291
|
+
readonly riskL3Desc: "Deletes, payments and other irreversible actions — always asked.";
|
|
292
|
+
readonly safetyNote: "Low-confidence element matches are escalated to a confirmation even for low-risk actions.";
|
|
175
293
|
readonly save: "Save";
|
|
176
294
|
readonly cancel: "Cancel";
|
|
177
295
|
readonly saved: "Settings saved. Restart agent for changes to take effect.";
|
|
@@ -181,6 +299,7 @@ declare const enUS: {
|
|
|
181
299
|
readonly providerName: "Provider Name";
|
|
182
300
|
readonly providerNameHint: "Display name (e.g. OpenAI, Anthropic)";
|
|
183
301
|
readonly models: "Models";
|
|
302
|
+
readonly modelsCount: "{{n}} models";
|
|
184
303
|
readonly addModel: "+ Add Model";
|
|
185
304
|
readonly addProvider: "+ Add Provider";
|
|
186
305
|
readonly currentModel: "Current";
|
|
@@ -204,6 +323,9 @@ declare const enUS: {
|
|
|
204
323
|
readonly selecting: "Selecting option \"{{text}}\"...";
|
|
205
324
|
readonly scrolling: "Scrolling page...";
|
|
206
325
|
readonly waiting: "Waiting {{seconds}} seconds...";
|
|
326
|
+
readonly element: "Element";
|
|
327
|
+
readonly scrollPage: "Whole page";
|
|
328
|
+
readonly readWholePage: "Full page text";
|
|
207
329
|
readonly askingUser: "Asking user...";
|
|
208
330
|
readonly done: "Task done";
|
|
209
331
|
readonly executing: "Executing {{toolName}}...";
|
|
@@ -253,6 +375,14 @@ export declare class I18n {
|
|
|
253
375
|
getLanguage(): SupportedLanguage;
|
|
254
376
|
}
|
|
255
377
|
|
|
378
|
+
/**
|
|
379
|
+
* How the agent advances between steps.
|
|
380
|
+
* - `autopilot`: runs autonomously; only L3 (irreversible) actions block.
|
|
381
|
+
* - `copilot`: L2+ actions block, reads and draft edits flow through.
|
|
382
|
+
* - `step`: debug mode — every step pauses for confirmation.
|
|
383
|
+
*/
|
|
384
|
+
export declare type InteractionMode = 'autopilot' | 'copilot' | 'step';
|
|
385
|
+
|
|
256
386
|
declare const locales: {
|
|
257
387
|
readonly 'en-US': {
|
|
258
388
|
readonly ui: {
|
|
@@ -266,9 +396,80 @@ declare const locales: {
|
|
|
266
396
|
readonly waitingPlaceholder: "Waiting for task to start...";
|
|
267
397
|
readonly stop: "Stop";
|
|
268
398
|
readonly close: "Close";
|
|
399
|
+
readonly send: "Send";
|
|
269
400
|
readonly expand: "Expand history";
|
|
270
401
|
readonly history: "History";
|
|
271
402
|
readonly step: "Step {{number}}";
|
|
403
|
+
readonly you: "You";
|
|
404
|
+
readonly agent: "Page Agent";
|
|
405
|
+
readonly tokens: "tokens";
|
|
406
|
+
readonly thinkingPhase: "Thinking";
|
|
407
|
+
readonly sameAsPrevious: "Same as previous step";
|
|
408
|
+
readonly thinkingSameAsPrevious: "Thinking unchanged from the previous step";
|
|
409
|
+
readonly repeatedStep: "Repeat";
|
|
410
|
+
readonly copy: "Copy";
|
|
411
|
+
readonly copied: "Copied";
|
|
412
|
+
readonly expandStep: "Expand step";
|
|
413
|
+
readonly collapseStep: "Collapse step";
|
|
414
|
+
readonly activityIdle: "Waiting for you";
|
|
415
|
+
readonly interactionMode: "Interaction mode";
|
|
416
|
+
readonly autopilot: "Autopilot";
|
|
417
|
+
readonly collaborative: "Step-by-step";
|
|
418
|
+
readonly autopilotHint: "Runs everything automatically, blocking only irreversible actions";
|
|
419
|
+
readonly collaborativeHint: "Pauses before each step for your approval";
|
|
420
|
+
readonly copilot: "Co-pilot";
|
|
421
|
+
readonly copilotHint: "Reads and draft edits run freely, committed changes ask first";
|
|
422
|
+
readonly stepMode: "Step-by-step";
|
|
423
|
+
readonly stepModeHint: "Pauses before every action with its tool, target and rationale";
|
|
424
|
+
readonly approvalTitle: "Your approval is needed";
|
|
425
|
+
readonly waitingApproval: "Waiting for approval";
|
|
426
|
+
readonly approvalBody: "The agent is ready for the next step. Review it, then continue or switch to autopilot.";
|
|
427
|
+
readonly approvalContinue: "Continue";
|
|
428
|
+
readonly approvalBlock: "Reject this action";
|
|
429
|
+
readonly approvalAuto: "Run automatically";
|
|
430
|
+
readonly approvalStop: "Stop task";
|
|
431
|
+
readonly approvalStep: "Step {{number}}";
|
|
432
|
+
readonly gateTitle: "Confirm this action";
|
|
433
|
+
readonly gateBody: "This action changes state outside the agent. Review the details below.";
|
|
434
|
+
readonly gateTarget: "Element #{{index}}";
|
|
435
|
+
readonly gateValue: "Value";
|
|
436
|
+
readonly gateWhy: "Why";
|
|
437
|
+
readonly gateOutcome: "Last step";
|
|
438
|
+
readonly approvalBatch: "Always allow {{action}}";
|
|
439
|
+
readonly approvalShortcut: "Enter allows · Esc rejects this action";
|
|
440
|
+
readonly actionRejected: "Action rejected — the agent is re-planning";
|
|
441
|
+
readonly risk: {
|
|
442
|
+
readonly L0: "Read-only";
|
|
443
|
+
readonly L1: "Reversible";
|
|
444
|
+
readonly L2: "Committed change";
|
|
445
|
+
readonly L3: "Irreversible";
|
|
446
|
+
};
|
|
447
|
+
readonly riskHint: {
|
|
448
|
+
readonly destructive: "This can delete, pay or otherwise do something that cannot be undone.";
|
|
449
|
+
readonly commit: "This changes data outside the agent.";
|
|
450
|
+
readonly lowConfidence: "The target element is ambiguous, so confirmation is required.";
|
|
451
|
+
readonly generic: "This action changes state and needs your confirmation.";
|
|
452
|
+
readonly stepMode: "Step-by-step mode pauses on every action so you can verify them one by one.";
|
|
453
|
+
readonly done: "This finishes the task and returns the result above.";
|
|
454
|
+
};
|
|
455
|
+
readonly undo: "Undo";
|
|
456
|
+
readonly undoHint: "Filled automatically — you can undo this";
|
|
457
|
+
readonly resumeTitle: "Task interrupted";
|
|
458
|
+
readonly resumeHint: "Continue from where it stopped — the previous steps are kept";
|
|
459
|
+
readonly resumeAction: "Resume";
|
|
460
|
+
readonly taskAborted: "Task stopped";
|
|
461
|
+
readonly tool: {
|
|
462
|
+
readonly click_element_by_index: "Click element";
|
|
463
|
+
readonly input_text: "Type into field";
|
|
464
|
+
readonly select_dropdown_option: "Select option";
|
|
465
|
+
readonly execute_javascript: "Run JavaScript";
|
|
466
|
+
readonly scroll: "Scroll page";
|
|
467
|
+
readonly read_page_content: "Read page";
|
|
468
|
+
readonly save_data: "Save data";
|
|
469
|
+
readonly wait: "Wait";
|
|
470
|
+
readonly done: "Finish task";
|
|
471
|
+
readonly ask_user: "Ask you a question";
|
|
472
|
+
};
|
|
272
473
|
readonly newConversation: "New Conversation";
|
|
273
474
|
readonly conversations: "Conversations";
|
|
274
475
|
readonly noConversations: "No conversations";
|
|
@@ -281,6 +482,15 @@ declare const locales: {
|
|
|
281
482
|
};
|
|
282
483
|
readonly settings: {
|
|
283
484
|
readonly title: "Settings";
|
|
485
|
+
readonly subtitle: "Models, agent behaviour and skills";
|
|
486
|
+
readonly navProviders: "Models";
|
|
487
|
+
readonly navAgent: "Agent";
|
|
488
|
+
readonly navSkills: "Skills";
|
|
489
|
+
readonly navSafety: "Approval";
|
|
490
|
+
readonly autoSave: "Changes are saved automatically";
|
|
491
|
+
readonly done: "Done";
|
|
492
|
+
readonly quickStart: "Quick start";
|
|
493
|
+
readonly quickStartHint: "Pick a provider preset, then paste your API key.";
|
|
284
494
|
readonly modelTab: "Model Config";
|
|
285
495
|
readonly providersTab: "Providers";
|
|
286
496
|
readonly generalTab: "General";
|
|
@@ -297,6 +507,16 @@ declare const locales: {
|
|
|
297
507
|
readonly temperature: "Temperature";
|
|
298
508
|
readonly maxSteps: "Max Steps";
|
|
299
509
|
readonly maxStepsHint: "Maximum agent loop iterations (5-200)";
|
|
510
|
+
readonly safetyPolicy: "Authorization policy";
|
|
511
|
+
readonly safetyPolicyHint: "Choose how far the agent may go without asking you first.";
|
|
512
|
+
readonly safetyRemember: "Remember per-action approval";
|
|
513
|
+
readonly safetyRememberHint: "Adds an \"always allow this action type\" button to confirmation cards. Scoped to the current task.";
|
|
514
|
+
readonly safetyMatrix: "Risk tiers";
|
|
515
|
+
readonly riskL0Desc: "Page reads, DOM queries and waiting — never asked.";
|
|
516
|
+
readonly riskL1Desc: "Field fills and dropdown picks — automatic, with undo.";
|
|
517
|
+
readonly riskL2Desc: "Submits, saves and script execution — asked in Co-pilot mode.";
|
|
518
|
+
readonly riskL3Desc: "Deletes, payments and other irreversible actions — always asked.";
|
|
519
|
+
readonly safetyNote: "Low-confidence element matches are escalated to a confirmation even for low-risk actions.";
|
|
300
520
|
readonly save: "Save";
|
|
301
521
|
readonly cancel: "Cancel";
|
|
302
522
|
readonly saved: "Settings saved. Restart agent for changes to take effect.";
|
|
@@ -306,6 +526,7 @@ declare const locales: {
|
|
|
306
526
|
readonly providerName: "Provider Name";
|
|
307
527
|
readonly providerNameHint: "Display name (e.g. OpenAI, Anthropic)";
|
|
308
528
|
readonly models: "Models";
|
|
529
|
+
readonly modelsCount: "{{n}} models";
|
|
309
530
|
readonly addModel: "+ Add Model";
|
|
310
531
|
readonly addProvider: "+ Add Provider";
|
|
311
532
|
readonly currentModel: "Current";
|
|
@@ -329,6 +550,9 @@ declare const locales: {
|
|
|
329
550
|
readonly selecting: "Selecting option \"{{text}}\"...";
|
|
330
551
|
readonly scrolling: "Scrolling page...";
|
|
331
552
|
readonly waiting: "Waiting {{seconds}} seconds...";
|
|
553
|
+
readonly element: "Element";
|
|
554
|
+
readonly scrollPage: "Whole page";
|
|
555
|
+
readonly readWholePage: "Full page text";
|
|
332
556
|
readonly askingUser: "Asking user...";
|
|
333
557
|
readonly done: "Task done";
|
|
334
558
|
readonly executing: "Executing {{toolName}}...";
|
|
@@ -373,9 +597,80 @@ declare const locales: {
|
|
|
373
597
|
readonly waitingPlaceholder: "等待任务开始...";
|
|
374
598
|
readonly stop: "终止";
|
|
375
599
|
readonly close: "关闭";
|
|
600
|
+
readonly send: "发送";
|
|
376
601
|
readonly expand: "展开历史";
|
|
377
602
|
readonly history: "历史记录";
|
|
378
603
|
readonly step: "步骤 {{number}}";
|
|
604
|
+
readonly you: "你";
|
|
605
|
+
readonly agent: "Page Agent";
|
|
606
|
+
readonly tokens: "字元";
|
|
607
|
+
readonly thinkingPhase: "思考";
|
|
608
|
+
readonly sameAsPrevious: "与上一步相同";
|
|
609
|
+
readonly thinkingSameAsPrevious: "思考内容与上一步相同";
|
|
610
|
+
readonly repeatedStep: "重复";
|
|
611
|
+
readonly copy: "复制";
|
|
612
|
+
readonly copied: "已复制";
|
|
613
|
+
readonly expandStep: "展开步骤";
|
|
614
|
+
readonly collapseStep: "收起步骤";
|
|
615
|
+
readonly activityIdle: "等待你的指令";
|
|
616
|
+
readonly interactionMode: "交互模式";
|
|
617
|
+
readonly autopilot: "自动驾驶";
|
|
618
|
+
readonly collaborative: "分步协同";
|
|
619
|
+
readonly autopilotHint: "全自动执行,仅在不可逆操作前阻断";
|
|
620
|
+
readonly collaborativeHint: "每一步执行前暂停,等待你确认";
|
|
621
|
+
readonly copilot: "协同模式";
|
|
622
|
+
readonly copilotHint: "读取与草稿自动执行,关键变更前向你确认";
|
|
623
|
+
readonly stepMode: "单步调试";
|
|
624
|
+
readonly stepModeHint: "每个动作执行前暂停,显示工具、目标与理由";
|
|
625
|
+
readonly approvalTitle: "等待你的确认";
|
|
626
|
+
readonly waitingApproval: "等待你的确认";
|
|
627
|
+
readonly approvalBody: "Agent 已准备好执行下一步。确认后再继续,或切换为自动驾驶。";
|
|
628
|
+
readonly approvalContinue: "允许执行";
|
|
629
|
+
readonly approvalBlock: "拒绝这一步";
|
|
630
|
+
readonly approvalAuto: "转为自动驾驶";
|
|
631
|
+
readonly approvalStop: "终止任务";
|
|
632
|
+
readonly approvalStep: "步骤 {{number}}";
|
|
633
|
+
readonly gateTitle: "请确认这一步操作";
|
|
634
|
+
readonly gateBody: "该操作会改变外部状态,请先核对下面的细节。";
|
|
635
|
+
readonly gateTarget: "元素 #{{index}}";
|
|
636
|
+
readonly gateValue: "内容";
|
|
637
|
+
readonly gateWhy: "为什么要这样做";
|
|
638
|
+
readonly gateOutcome: "上一步";
|
|
639
|
+
readonly approvalBatch: "本任务内始终允许「{{action}}」";
|
|
640
|
+
readonly approvalShortcut: "Enter 允许 · Esc 拒绝这一步";
|
|
641
|
+
readonly actionRejected: "已拒绝该动作,Agent 正在换个做法";
|
|
642
|
+
readonly risk: {
|
|
643
|
+
readonly L0: "只读";
|
|
644
|
+
readonly L1: "可撤销";
|
|
645
|
+
readonly L2: "关键变更";
|
|
646
|
+
readonly L3: "不可逆";
|
|
647
|
+
};
|
|
648
|
+
readonly riskHint: {
|
|
649
|
+
readonly destructive: "该操作可能删除、付款或产生无法撤销的后果。";
|
|
650
|
+
readonly commit: "该操作会修改 Agent 之外的数据。";
|
|
651
|
+
readonly lowConfidence: "目标元素存在歧义,因此需要你确认。";
|
|
652
|
+
readonly generic: "该操作会改变状态,需要你确认。";
|
|
653
|
+
readonly stepMode: "单步调试模式:每个动作都会暂停,便于你逐条核对。";
|
|
654
|
+
readonly done: "这一步会结束任务,并返回上面的结果。";
|
|
655
|
+
};
|
|
656
|
+
readonly undo: "撤销";
|
|
657
|
+
readonly undoHint: "已自动填入,可撤销";
|
|
658
|
+
readonly resumeTitle: "任务已中断";
|
|
659
|
+
readonly resumeHint: "可从中断处继续,保留之前的思考链路";
|
|
660
|
+
readonly resumeAction: "继续执行";
|
|
661
|
+
readonly taskAborted: "任务已终止";
|
|
662
|
+
readonly tool: {
|
|
663
|
+
readonly click_element_by_index: "点击元素";
|
|
664
|
+
readonly input_text: "填写字段";
|
|
665
|
+
readonly select_dropdown_option: "选择选项";
|
|
666
|
+
readonly execute_javascript: "执行脚本";
|
|
667
|
+
readonly scroll: "滚动页面";
|
|
668
|
+
readonly read_page_content: "读取页面";
|
|
669
|
+
readonly save_data: "保存数据";
|
|
670
|
+
readonly wait: "等待";
|
|
671
|
+
readonly done: "结束任务";
|
|
672
|
+
readonly ask_user: "向你提问";
|
|
673
|
+
};
|
|
379
674
|
readonly newConversation: "新建会话";
|
|
380
675
|
readonly conversations: "会话列表";
|
|
381
676
|
readonly noConversations: "暂无会话";
|
|
@@ -388,6 +683,15 @@ declare const locales: {
|
|
|
388
683
|
};
|
|
389
684
|
readonly settings: {
|
|
390
685
|
readonly title: "设置";
|
|
686
|
+
readonly subtitle: "模型、Agent 行为与技能";
|
|
687
|
+
readonly navProviders: "模型";
|
|
688
|
+
readonly navAgent: "Agent";
|
|
689
|
+
readonly navSkills: "技能";
|
|
690
|
+
readonly navSafety: "授权";
|
|
691
|
+
readonly autoSave: "修改会自动保存";
|
|
692
|
+
readonly done: "完成";
|
|
693
|
+
readonly quickStart: "快速开始";
|
|
694
|
+
readonly quickStartHint: "选择一个供应商预设,然后填入 API 密钥。";
|
|
391
695
|
readonly modelTab: "模型配置";
|
|
392
696
|
readonly providersTab: "供应商";
|
|
393
697
|
readonly generalTab: "通用";
|
|
@@ -404,6 +708,16 @@ declare const locales: {
|
|
|
404
708
|
readonly temperature: "温度参数";
|
|
405
709
|
readonly maxSteps: "最大步数";
|
|
406
710
|
readonly maxStepsHint: "Agent 循环最大迭代次数 (5-200)";
|
|
711
|
+
readonly safetyPolicy: "授权策略";
|
|
712
|
+
readonly safetyPolicyHint: "选择 Agent 可以不经确认走多远。";
|
|
713
|
+
readonly safetyRemember: "记住同类操作的授权";
|
|
714
|
+
readonly safetyRememberHint: "在确认卡片上提供「本任务内始终允许此类操作」按钮,仅在当前任务生效。";
|
|
715
|
+
readonly safetyMatrix: "风险分级";
|
|
716
|
+
readonly riskL0Desc: "读取页面、查询 DOM、等待 —— 不打断你。";
|
|
717
|
+
readonly riskL1Desc: "填写字段、选择选项 —— 自动执行,可撤销。";
|
|
718
|
+
readonly riskL2Desc: "提交、保存、执行脚本 —— 协同模式下询问。";
|
|
719
|
+
readonly riskL3Desc: "删除、支付等不可逆操作 —— 始终询问。";
|
|
720
|
+
readonly safetyNote: "元素定位置信度较低时,即使是低风险操作也会升级为确认。";
|
|
407
721
|
readonly save: "保存";
|
|
408
722
|
readonly cancel: "取消";
|
|
409
723
|
readonly saved: "设置已保存。重新启动 Agent 后生效。";
|
|
@@ -413,6 +727,7 @@ declare const locales: {
|
|
|
413
727
|
readonly providerName: "供应商名称";
|
|
414
728
|
readonly providerNameHint: "显示名称 (例如 OpenAI, Anthropic)";
|
|
415
729
|
readonly models: "模型列表";
|
|
730
|
+
readonly modelsCount: "{{n}} 个模型";
|
|
416
731
|
readonly addModel: "+ 添加模型";
|
|
417
732
|
readonly addProvider: "+ 添加供应商";
|
|
418
733
|
readonly currentModel: "当前使用";
|
|
@@ -436,6 +751,9 @@ declare const locales: {
|
|
|
436
751
|
readonly selecting: "正在选择选项 \"{{text}}\"...";
|
|
437
752
|
readonly scrolling: "正在滚动页面...";
|
|
438
753
|
readonly waiting: "等待 {{seconds}} 秒...";
|
|
754
|
+
readonly element: "元素";
|
|
755
|
+
readonly scrollPage: "整页滚动";
|
|
756
|
+
readonly readWholePage: "整页文本";
|
|
439
757
|
readonly askingUser: "正在询问用户...";
|
|
440
758
|
readonly done: "结束任务";
|
|
441
759
|
readonly executing: "正在执行 {{toolName}}...";
|
|
@@ -521,6 +839,25 @@ export declare class Panel {
|
|
|
521
839
|
* @param config - Optional panel configuration
|
|
522
840
|
*/
|
|
523
841
|
constructor(agent: PanelAgentAdapter, config?: PanelConfig);
|
|
842
|
+
getInteractionMode(): InteractionMode;
|
|
843
|
+
/** Switch authorization policy: autopilot / copilot (balanced) / step. */
|
|
844
|
+
setInteractionMode(mode: InteractionMode): void;
|
|
845
|
+
/**
|
|
846
|
+
* Called by the runtime after the model picked an action.
|
|
847
|
+
*
|
|
848
|
+
* Risk-tiered: L0/L1 flow through silently, the policy threshold decides for
|
|
849
|
+
* L2, and L3 always blocks. Returns `deny` to abort the task.
|
|
850
|
+
*/
|
|
851
|
+
requestActionApproval(info: ActionGateInfo): Promise<ActionGateDecision>;
|
|
852
|
+
/**
|
|
853
|
+
* Legacy pre-planning gate.
|
|
854
|
+
*
|
|
855
|
+
* Kept for API compatibility: gating now happens in
|
|
856
|
+
* {@link requestActionApproval} — i.e. *after* the model has planned — so the
|
|
857
|
+
* user always sees the concrete tool, target, arguments and the model's
|
|
858
|
+
* stated goal instead of an empty "next step?" prompt.
|
|
859
|
+
*/
|
|
860
|
+
waitForStepApproval(_stepIndex: number): Promise<void>;
|
|
524
861
|
show(): void;
|
|
525
862
|
hide(): void;
|
|
526
863
|
reset(): void;
|
|
@@ -575,6 +912,14 @@ declare interface PanelAgentAdapter extends EventTarget {
|
|
|
575
912
|
input: unknown;
|
|
576
913
|
output: string;
|
|
577
914
|
};
|
|
915
|
+
/** For 'step' type — LLM token usage for this step */
|
|
916
|
+
usage?: {
|
|
917
|
+
promptTokens: number;
|
|
918
|
+
completionTokens: number;
|
|
919
|
+
totalTokens: number;
|
|
920
|
+
cachedTokens?: number;
|
|
921
|
+
reasoningTokens?: number;
|
|
922
|
+
};
|
|
578
923
|
/** For 'observation' type */
|
|
579
924
|
content?: string;
|
|
580
925
|
/** For 'retry' type */
|
|
@@ -594,10 +939,24 @@ declare interface PanelAgentAdapter extends EventTarget {
|
|
|
594
939
|
onAskUser?: (question: string, options?: {
|
|
595
940
|
signal: AbortSignal;
|
|
596
941
|
}) => Promise<string>;
|
|
597
|
-
/**
|
|
598
|
-
|
|
942
|
+
/**
|
|
943
|
+
* Execute a task.
|
|
944
|
+
* `resume: true` continues the previous run (keeps history / reasoning chain)
|
|
945
|
+
* instead of starting a brand-new task.
|
|
946
|
+
*/
|
|
947
|
+
execute(task: string, options?: {
|
|
948
|
+
resume?: boolean;
|
|
949
|
+
}): Promise<unknown>;
|
|
599
950
|
/** Stop the current task (agent remains reusable) */
|
|
600
951
|
stop(): Promise<void>;
|
|
952
|
+
/**
|
|
953
|
+
* Revert the most recent reversible action (field fill / option select).
|
|
954
|
+
* Optional: enables the "Undo" affordance for automatically executed edits.
|
|
955
|
+
*/
|
|
956
|
+
undoLastAction?(): Promise<{
|
|
957
|
+
success: boolean;
|
|
958
|
+
message: string;
|
|
959
|
+
}>;
|
|
601
960
|
/** Dispose the agent (terminal, cannot be reused) */
|
|
602
961
|
dispose(): void;
|
|
603
962
|
/**
|
|
@@ -674,6 +1033,17 @@ export declare interface PanelConfig {
|
|
|
674
1033
|
* @default true
|
|
675
1034
|
*/
|
|
676
1035
|
promptForNextTask?: boolean;
|
|
1036
|
+
/**
|
|
1037
|
+
* Authorization policy for agent actions.
|
|
1038
|
+
* - `autopilot`: autonomous, only L3 blocks (default)
|
|
1039
|
+
* - `copilot`: L2+ blocks, reads and draft edits flow through
|
|
1040
|
+
* - `step`: debug mode, every step pauses
|
|
1041
|
+
* - `collaborative`: deprecated alias for `copilot`
|
|
1042
|
+
* @default 'autopilot'
|
|
1043
|
+
*/
|
|
1044
|
+
interactionMode?: InteractionMode | 'collaborative';
|
|
1045
|
+
/** Remember "always allow this action type" choices for the current task. */
|
|
1046
|
+
rememberApprovals?: boolean;
|
|
677
1047
|
/** Default model config values from agent initialization (used as form defaults) */
|
|
678
1048
|
defaults?: {
|
|
679
1049
|
baseURL?: string;
|
|
@@ -725,6 +1095,14 @@ export declare interface ResolvedActiveModel {
|
|
|
725
1095
|
model: ModelConfig;
|
|
726
1096
|
}
|
|
727
1097
|
|
|
1098
|
+
/**
|
|
1099
|
+
* Risk tier of a concrete agent action.
|
|
1100
|
+
*
|
|
1101
|
+
* Mirrors `RiskLevel` from `@hao-gd/page-agent-core` so the Panel stays
|
|
1102
|
+
* decoupled from the core package while still rendering risk-aware gates.
|
|
1103
|
+
*/
|
|
1104
|
+
export declare type RiskLevel = 'L0' | 'L1' | 'L2' | 'L3';
|
|
1105
|
+
|
|
728
1106
|
/**
|
|
729
1107
|
* Static helper for persisting and retrieving Skills via IndexedDB.
|
|
730
1108
|
* Mirrors ConversationStorage from conversations.ts.
|