Commit Graph

57 Commits

Author SHA1 Message Date
Simon
4690aefec5 refactor(core): decouple run settling from terminal status transition
Resolve #running before the terminal statuschange so the settle signal can
never be lost to re-entrant listeners. Hooks keep middleware semantics:
a throwing hook fails the run; integrations that don't want this should
suppress errors in their own hooks. Also make suppress() async-aware so
rejected promises (e.g. showMask) are actually caught.
2026-06-11 17:21:11 +08:00
Simon
8f9a637bdb refactor(core): suppress mask/highlight errors instead of failing the run
Visual feedback failures (showMask, hideMask, cleanUpHighlights) are
non-critical; log them instead of aborting the task or masking the
original error during teardown.
2026-06-11 16:26:42 +08:00
Simon
c2d6a864f8 refactor(core): settle terminal status only after run cleanup completes
Defer the terminal statuschange to the outer finally via settleRun, closing
the window where a listener could re-enter execute() during teardown. Also
check abort at step start so aborts during stepDelay settle as `stopped`.
2026-06-11 16:26:05 +08:00
Simon
1deaa2147e fix: mke sure taskResult and onAfterStep wont get lost 2026-06-11 15:39:35 +08:00
Simon
052a302a08 refactor(core)!: rework agent run lifecycle and status semantics
BREAKING CHANGE: stop() is now async and resolves after the run fully
settles; status decouples from task outcome (new 'stopped' state, LLM
self-reported failure now ends as 'completed'). Lifecycle hooks re-throw
instead of being folded into the result; agent errors go to history.
Adds agent.lastResult.
2026-06-11 14:33:12 +08:00
Simon
552987eb56 fix(core): prevent concurrent execute() calls 2026-06-08 21:58:16 +08:00
Simon
4445bec08a fix: abort may affect onAfterTask; clean up while loop 2026-06-08 19:46:19 +08:00
Simon
6530f0ef40 chore: cleanup; rm get abortSignal 2026-06-08 17:40:44 +08:00
Simon
f8676a5cc2 fix: throw unhonored AbortError & rm detection code for it 2026-06-08 17:27:05 +08:00
Simon
78b6e2ad3c feat: all sync tools should respect aborting 2026-06-05 21:23:18 +08:00
Simon
fd12fb9f1b refactor(llms): split AbortError out of InvokeError 2026-06-03 23:00:33 +08:00
Simon
fb8de08c39 fix(llms): fix abort handling and clean up retry logic 2026-06-03 22:44:54 +08:00
Simon
e7b93efda0 chore: typo
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 20:20:37 +08:00
Simon
f303ed5fc5 Merge branch 'main' of https://github.com/alibaba/page-agent 2026-03-16 19:45:29 +08:00
Simon
6dbc33efd9 docs: limitation; readme; attribution 2026-03-16 19:45:14 +08:00
Simon
2aae34d74a Merge pull request #250 from linked-danis/pr2-step-delay 2026-03-16 17:50:50 +08:00
linked-danis
b0bcba2922 feat: add stepDelay config option
Add configurable delay between agent steps.
Previously hardcoded to 0.4s.

Changes:
- Add stepDelay?: number to AgentConfig
- Use config value with 0.4s default
2026-03-13 14:22:37 +01:00
Wen
11d3ca3d6e fix: typos and grammar in system prompts and source code 2026-03-13 01:32:34 +00:00
Simon
7a97de2a37 feat(ext): expose more config 2026-03-05 20:34:55 +08:00
Simon
598b144d06 feat: change maxSteps to 40 2026-03-05 19:26:56 +08:00
Simon
53db2069ce feat: zod support v3/4 2026-03-05 19:13:18 +08:00
Simon
e5437b445a fix(core): Core and PageAgent use different config types; improve code structure 2026-03-04 20:05:48 +08:00
Simon
09bdf9ddaf feat(core): experimental support for llms.txt (#157)
* feat(core): experimental support for llms.txt

* docs: experimentalLlmsTxt
2026-03-04 18:53:24 +08:00
Simon
06280c2ba5 chore(core): add wait time between steps for the page to react 2026-03-03 21:51:10 +08:00
Simon
cbe223dac5 fix(core): auto-wrap primitive action input in normalizeResponse
Small models sometimes output single-field tool args as primitives
(e.g. {"click_element_by_index": 2} instead of {"index": 2}).
normalizeResponse now accepts an optional tools map and wraps
such values using the tool schema. Renamed invoke tools to macroTool.
2026-02-25 17:01:45 +08:00
Simon
22fe448d95 refactor: unify zod imports 2026-02-25 16:18:56 +08:00
Simon
b89228693d feat(ext): add lang setting 2026-02-14 16:10:46 +08:00
Simon
dffcb53db9 feat!: Refine lifecycle hooks; fix abortSignal
- add `stop` method. agent can be reused after stopped
- agent can not be reused after disposed
- extension DO NOT exposes `dispose` anymore. only `stop`.
- update panel for new `stop` method
- fix MultiPageAgent dispose event
- better handling abortSignal
2026-02-13 17:57:12 +08:00
Simon
fcb9ec4e57 chore: clean up 2026-02-11 19:27:14 +08:00
Simon
1fcf931685 feat(core): add a observe phase in a step; improve abortSignal 2026-02-10 22:20:42 +08:00
Simon
6f0655478a fix(core): remove trimLines to fix indentation lost 2026-02-10 16:30:03 +08:00
Simon
7d5449967b feat(core): improve observation logic; mark states as private 2026-02-10 16:28:25 +08:00
Simon
fd47888d1b chore(core): tidy up PageAgentCore members 2026-02-10 15:45:04 +08:00
Simon
10f470ce7d chore: improve package.json 2026-02-10 15:28:50 +08:00
Simon
840162df8c feat: change observation timing 2026-02-09 21:05:29 +08:00
Simon
1517bc4868 feat: prune prompts 2026-02-09 21:04:39 +08:00
Simon
6f0ff1fd33 refactor: zod tree-shaking; better error handling in agent steps 2026-02-09 17:49:10 +08:00
Simon
4459026297 feat: set default lang to english; fix ext lang setting 2026-02-02 19:17:15 +08:00
Simon
8a03391c95 fix(core): change emitActivity to #emitActivity 2026-01-29 21:15:24 +08:00
Simon
ff75aebc20 feat(core): remove unused .disposed 2026-01-28 19:17:23 +08:00
Simon
94ae80ff6a chore: move title line from Agent to PageController 2026-01-28 15:38:05 +08:00
Simon
501411b254 feat: improve date format and error message for llm 2026-01-28 15:24:08 +08:00
Simon
f6394a04b1 feat(core): add rawRequest in history for debug 2026-01-28 14:30:04 +08:00
Simon
60b401d86c Merge branch 'main' into feat/ext 2026-01-22 20:22:01 +08:00
Simon
dad837e173 fix: don't retry or show AbortError; remove reason from dispose; don't clean history in dispose 2026-01-22 20:19:51 +08:00
Simon
efe1f33144 feat: add custom system prompt configuration 2026-01-22 17:21:10 +08:00
Simon
391e70dca4 feat: update historical event types 2026-01-22 15:16:15 +08:00
Simon
3ffcd6482d refactor: rename AgentStep to AgentStepEventErrorEvent to AgentErrorEvent 2026-01-22 14:59:35 +08:00
Simon
23ec4602c2 feat: export types from './types' in PageAgentCore 2026-01-21 17:26:31 +08:00
Simon
81807e17ca feat: add stepIndex to history events 2026-01-21 16:59:22 +08:00