Commit graph

80 commits

Author SHA1 Message Date
9d4dced4e4 Skip overlapping scheduled runs and surface playbook status in job lists.
Due ticks no longer stack on an active run (WA skip notice + stale clear); schedule_list/admin/gateway now show playbook, steps_n, and last_run signals without dumping full recipes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 00:07:42 +08:00
51eef09801 Synthesize playbooks from structured prompts and inject prior-run context.
Legacy jobs with empty recipes (e.g. dying-gasp algorithms in prompt_text) now compile into durable playbooks on create/enqueue, and each run gets a short previous-run summary for continuity.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:59:27 +08:00
4898adf7d0 Productize scheduled success delivery, close WA pending, and clarify SQL scope grants.
Wrap successful scheduled jobs with a short WA header (+ attachment count), expire stale access pending and DM requesters on admin approve/deny, and add concrete next_steps for insufficient_scope:sql:query.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:52:41 +08:00
f31ebeb30e Prefer multi-NE execManagedNe batch and parallelize read MCP tools.
Guide ops to use ne_ids/ume_ne_ids for sweeps, raise exec wall-clock for batches, and mark inventory/list MCP tools read_only so consecutive queries can run in parallel.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:34:23 +08:00
9d447b1c51 Cap run_command spam and force a usable finalize after tool-round limits.
Budget shell calls like CLI, and when rounds are exhausted inject a no-more-tools system nudge plus any user_facing_hint constraints into the final synthesis pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:26:54 +08:00
d8bc08ee0d Stop shell Excel builds, default write_file paths, and cap short-intent tool rounds.
Refuse openpyxl/pandas-to_excel via run_command, auto-write content-only files under tmp/, and limit WhatsApp ops short intents to 8 tool rounds by default.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:21:23 +08:00
a5ebabbaae Document bandwidth_congestion_daily in schedule_create tool help.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:19:12 +08:00
54cb8af8b0 Block non-retryable tool re-calls and add congestion ops recipes.
After insufficient_scope/retry_forbidden, refuse the same tool for the rest of the turn (even with new args), emit pre-call WA progress from ToolExecutor, TTL-cache findTopologyPaths, and add bandwidth congestion short-intent + schedule template.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:19:03 +08:00
e91e4fe773 Isolate WhatsApp group turns by speaker and clarify SQL scope denials.
Always tag group senders, inject group-focus system hints, label queued follow-ups by speaker, and mark insufficient_scope failures as non-retryable with a user-facing hint.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:11:41 +08:00
d2693d1c63 Cut WA alarm re-query loops, auto-deliver xlsx, and add ops schedule templates.
TTL-cache UME alarm/diagnostics MCP calls, mark write_xlsx deliverable on WhatsApp unless explicitly false, and expose built-in recipe_template_id playbooks for daily tally / critical xlsx / license checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:08:05 +08:00
7373e516f0 Classify tool failures and block identical blind retries in-turn.
Stamp failure_class for schema/timeout/runtime analytics, refuse same tool+args after a failure in the turn, and add a license short-intent recipe for WhatsApp ops.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 23:03:15 +08:00
d3f621b58b Cache inventory MCP lists and accept YES as WhatsApp confirm.
Extend short TTL reuse to listManagedNe/queryUmeNeInventory to cut list self-loops, and treat short YES/continue as confirmation when a token is pending.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 22:56:50 +08:00
f1d025ed60 Steer WhatsApp ops short intents and clarify busy/CLI failures.
Inject English recipe hints for fiber/offline/excel/continue, ack the first queued follow-up, localize gate copy, and classify execManagedNe errors so agents stop blind retries.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 22:53:35 +08:00
47fd83597e Make WhatsApp ops English-first for field deployments.
Default progress, quote wrappers, tool-error copy, and playbook recipes to English unless lang is explicitly zh.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 22:51:25 +08:00
d245e463c0 Make tool failures actionable with suggestions and scope hints.
Unregistered tools now suggest close matches; MCP insufficient_scope is rewritten with fallbacks so ops agents stop blind-retrying SQL without sql:query.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 22:42:37 +08:00
229e8b1368 Raise MCP exec timeouts and cache listCliTargets for WhatsApp ops.
Production logs showed execManagedNe glued to 30s wall-clock kills; override long tools, TTL-cache CLI target lists, and return schema examples on invalid args.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 22:40:17 +08:00
e03c90fb35 Add one-shot UME alarm Excel delivery for WhatsApp ops.
Collapse query+xlsx+deliverable into ume_alarm_xlsx_report, allow write_xlsx(deliverable=true), and accept run_command aliases to cut multi-tool loops.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 22:36:14 +08:00
aff11c1eae Reduce WhatsApp ops tool friction with looser xlsx/file schemas and short-intent playbooks.
Production usage showed schema mismatches and multi-tool loops; accept common arg aliases and route agents to <=3-call alarm recipes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 22:32:44 +08:00
557b675fe8 docs(ops): align netx exec limits and CLI allowlist with server
Mirror NETX_NE_EXEC_MAX_COMMANDS and updated show/ping/traceroute/pipe rules in builtin tool and playbook.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 10:57:55 +08:00
0cf6aafa30 Add background jobs with Chat UI so long agent scripts can run for hours safely.
start_job/get_job/sleep replace blocked run_command for multi-hour work; Chat shows a live count badge and allows manual kill, with a reaper reclaiming timed-out or stale processes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 01:02:57 +08:00
dbba8cafbf Add write_xlsx tool so agents export Excel via structured data instead of fragile openpyxl scripts.
Generation returns attachment_id only; channel delivery still requires save_deliverable_attachment.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-22 23:54:16 +08:00
f3152acb88 fix(scheduler): clarify interval units in schedule tools
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 17:14:19 +08:00
62ac04c40d fix(scheduler): isolate scheduled runs and @mention job creator on WhatsApp
Use a fresh execution session per run while keeping source_session_id for delivery only; filter bot JIDs and default scheduled @mentions to the job creator.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 14:49:31 +08:00
30202dd291 feat(scheduler): confirm before deleting scheduled jobs
Require preview confirmation for schedule_delete, extra confirm_foreign for others' jobs in groups, and mirror the same flow in chat slash commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-14 10:11:04 +08:00
d036190195 feat(scheduler): workflow recipes with confirm-before-create
Store self-contained playbook recipes on scheduled jobs, add schedule_propose draft gate, and run playbook instructions at fire time instead of only short reminders.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-14 09:58:39 +08:00
ad5d1db3c6 feat(whatsapp): real group @mentions and cleaner inbound text
Wire mention JIDs/names through scheduled delivery and immediate replies (including attachment captions), sanitize group message text for the model, and surface channel-derived sessions in admin Chat.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-13 20:05:43 +08:00
cbe68a54cd feat(channel): unify deliverable outbound and WeChat attachments
Require deliverable:true for all channel attachments including images; extend save_deliverable_attachment with attachment_id; add WeChat proactive attachment delivery; inject channel file rules via system prompt instead of repeating on every user message.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-13 15:56:50 +08:00
19f4d285ce feat(channel): deliver generated files on WhatsApp and honor user tool policy
Add save_deliverable_attachment for explicit document outbound, pass channel user_id into tool risk gating so write_file/run_command respect per-user allow_high settings, and document the workflow in channel-file-delivery skill.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-13 10:10:51 +08:00
a8d3d2d5ec fix(scheduler): default scheduled job timezone to system timezone
Replace hardcoded Asia/Shanghai with host IANA timezone detection for new scheduled jobs across tools, admin API, gateway cron, and store layer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 17:31:21 +08:00
ad052daaf0 feat(tools): expose schedule tools to all specialists
Move schedule_* tool factories into the public registry so ops/generalist both can create and manage scheduled jobs, and add an English schedule shortcut.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 15:42:06 +08:00
261e9bc72e docs(netx): update listManagedNe filter requirement and paging limits
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 11:07:47 +08:00
47813f6a94 feat(scheduler): add scheduled jobs with channel-aware delivery
Introduce persisted cron/interval jobs, gateway scheduler loop, worker turns,
and admin CRUD/edit UI. Route proactive reminders via the originating chat
channel (WhatsApp vs WeChat), harden Weixin outbound with durable queue and
PG-compatible polling, and fix chat UI to show each scheduled reminder separately.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 15:56:10 +08:00
35a66dcc44 docs(netx): allow ping/ping6 in execManagedNe CLI policy
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-05 16:15:00 +08:00
959cd8227c docs(netx): state execManagedNe allows show/display commands only
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 20:51:07 +08:00
4610989d72 fix(mcp): preflight python module check and surface install errors
- Verify python -m module import in preflight with fix hints

- Pass env_schema defaults in health/sync; catch JSON install exceptions in UI

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 23:42:44 +08:00
a0a3f4b65f feat(mcp): integrate netx via netx_mcp and improve MCP install
- Gate builtin netx tools; ops docs/skills use mcp__netx__*

- Import Cursor mcpServers JSON; pass env_schema defaults to subprocess

- Allow source_type=local; UTF-8 MCP stdio on Windows

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 15:44:34 +08:00
bbd7b0300f feat(ops): add netx managed NE query and exec tools
Add ops specialist tools to list/get managed NEs and execute read-only CLI via netx.
Document the new managed-NE workflow in role prompts, env example, and a dedicated ops skill with tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-28 22:12:57 +08:00
6f754ee5ea ops: use host_name as primary key for alarm NE display
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 00:04:33 +08:00
1366459ee0 feat(ops): enforce English-only replies and localize netx protocol labels
Append english_output_guard when lang=en, strengthen ops/generalist EN role prompts,
pass NETX_TOOL_LANG into netx tools, and map Chinese protocol buckets to English.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 23:35:46 +08:00
f1626195f7 fix(chat): honor ui_lang on WebSocket turns; ops NE display by host_name
Resolve runtime language from ui_lang and chat.send lang instead of hardcoding zh.
Align generalist/ops prompts with user language and require host_name (not ne_id) in ops outputs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 22:14:44 +08:00
acfb2cf73b fix(chat): compress-history on PostgreSQL dict rows
- Normalize select id,content rows from dict_row vs sqlite Row in history_tool_result_compact.

- Expand memory_wiki_search ToolSpec to match wiki_search parameters; add schema regression test.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 19:22:45 +08:00
d14e9d3596 feat(persistence): PostgreSQL assistant store, chat persist fixes, gateway scripts
- Add SQLAlchemy Core repos, pg adapter/compat, assistant_store factory, Alembic bootstrap and migration/cutover scripts.

- Harden chat_message writes (NUL scrub for PG), turn_uuid on attempt failure, WS turn_runner fallbacks and gateway executed_turn_uuid init.

- start_gateway: log paths, PS7 stderr handling via cmd, background stdout/stderr redirect; runtime assistant_runtime_log_dir export.

- Ops: clear_all_chat_sessions with PG-only --postgresql and env-gated wipe; clear_postgres_chat_sessions.ps1.

- Tests: SA repos, pg compat, persist fallback, smoke env isolation; CI and docs touch-ups.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-14 09:33:50 +08:00
2b32d11f43 feat(tools): add grep and workspace profile, fix write path
- Add grep_tool: ripgrep with Python fallback; avoid --json with -l/-c.
- Add workspace_profile_tool: scan, languages, tests, packages, git, CI hints; tests.
- write_file: resolve relative paths via workspace root (no data/workspace prefix).
- Update path guard and local public tool tests for new write behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 23:02:52 +08:00
420abac9f1 refactor: root-package imports (svc/runtime/interfaces) and fix PYTHONPATH
- Rename platform/ to svc/ to avoid shadowing stdlib platform.
- Replace from oclaw.* with from svc/runtime/interfaces; update -m CLI paths.
- tests/conftest: prepend repo root to sys.path (no parent-folder package name).
- CI: paths and offline_eval script under repo root.
- Ops scripts: PYTHONPATH must be repo root for python -m runtime.* (fixes gateway/WhatsApp sidecar startup).
- Fix default oclaw.json path in tabular/file attachment limits; stabilize attachment test config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 14:51:17 +08:00
5b2f182ae4 fix(admin): run_command toggle GET matches DB absent; add disabled hint
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 19:17:13 +08:00
274a9b8ddd feat(mcp): pass all mcp_local.env keys to subprocess; allowlist supplements host-only
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 18:51:07 +08:00
f367779ad1 Docs: UME NE keyword matches host_name (netx-side)
Align ops playbook and netx_query_ume_ne_inventory description with netx API.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 17:27:26 +08:00
1c90a3570e Add netx UME NE inventory tools for ops
Expose netx_query_ume_ne_inventory and netx_get_ume_ne (GET /v1/ume/inventory/ne and /ne/{id}). Update ops playbook, ROLE_SYSTEM, env example comment, and unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 17:24:57 +08:00
df30b5902f feat: 路径约定体系 & 自优化管道落地 2026-05-10 23:28:41 +08:00
75a3038f33 fix(run_command): decode subprocess output as UTF-8 on Windows
GBK default decoding failed on curl/wttr.in UTF-8 output, leaving stdout empty
with exit 0; use utf-8 + replace.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-10 12:08:42 +08:00