Commit Graph

2947 Commits (384fbcf7ede8568d5038d2edbd6de1fd7fb02ec6)

Author SHA1 Message Date
MidoriKurage 384fbcf7ed fix(frontend): project create-user HTTP status onto a 'created' flag
createSystemUser now returns 'created' derived from $httpStatus
(201 create / 200 idempotent retry).
2026-09-07 17:30:47 +08:00
coderdailyone 9e8673816e fix(wiki): keep folder names that look like page-type labels when placing pages
A folder named 概念/实体/Concepts was stripped from category_path as model noise, so a page moved into it kept depth 0 and a root-level wiki_path and rendered at the root of the directory tree. Folder paths are authoritative and now map to category_path verbatim; the model-label cleaner still applies to pages without a folder.

Fixes #3053

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFSMrLZZ3oq1dKmJFAofz6
2026-09-07 17:23:19 +08:00
lyingbug 5be8d13fc6
feat(integrations): add CLI setup page (#3081)
* feat(integrations): add CLI setup page

* fix(settings): include all integrations in sidebar groups
2026-09-07 17:11:40 +08:00
wizardchen 5f98eaadaa fix(preview): lazy-load markdown images without dropping data URIs
Eager remote images freeze large Markdown previews, but a scheme-based
allowlist also hid data:image URLs that document parsers emit. Keep lazy
loading on a preview-only sanitizer that matches DOMPurify's URI policy.
2026-09-07 16:58:30 +08:00
wizardchen 02c1759044 fix(knowledge): confirm document deletion before reporting success 2026-09-07 15:43:28 +08:00
Fei.Chen 86136b25e3
fix(session): serve org-shared KB images through the message file proxy (#3069)
* fix(session): serve org-shared KB images through the message file proxy

The message-scoped file proxy only authorized resources whose tenant
matched the message's agent tenant, so replies produced by an agent of
the caller's own workspace over an org-shared knowledge base rendered
text but lost every image with 403 (#3022).

Fall back to the org-share relation for exactly that case: the
message's persisted retrieval references must contain the resource
handle (chunk evidence — an unrelated handle from the owner tenant
cannot ride along), the reference's knowledge base must belong to the
resource's tenant, and that KB must still be shared to the caller with
at least viewer permission. Messages written before agent_tenant_id
existed get the same fallback before the shared-agent relation is
demanded; the shared-agent path itself is unchanged.

* fix(session): prove shared-KB images from agent steps and image_info

Smart-reasoning turns never persist KnowledgeReferences, and OCR hits often
keep the resource handle only in image_info. Collect tool retrieval onto the
message and accept that evidence in the message-file proxy so org-shared KB
images stop 403ing.

* fix(session): keep shared-KB image evidence in the message-file proxy

Drop the agent-engine KnowledgeRefs collector so pre-push does not lint the
whole agent package. AgentSteps already persist knowledge_search hits, which
is enough for the proxy to authorize org-shared images.

---------

Co-authored-by: vicfei <vicfei@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-07 15:43:09 +08:00
Binks Riverton 5fa50711e2 fix(ui): prevent invite registration form header overlap 2026-09-07 14:55:19 +08:00
LuckVd 25fcbb9401 fix(wiki): treat rate-limit-shaped 403 responses as transient
Wiki ingest makes several independent LLM calls per document and already
retries transient failures (408/429/5xx, timeouts, connection resets) with
exponential backoff, but some gateways report QPM/QPS throttling as HTTP
403 instead of 429 (e.g. DeepSeek MaaS: code 0x04030020, message
"调用频率(qpm)超限"). Those 403s were classified as permanent caller
errors and the wiki span failed immediately with EXTRACT_FAILED /
SUMMARY_FAILED, so a QPM burst aborted generation for the whole batch
(issue #2688).

isTransientLLMError now also matches "status 403" errors whose embedded
response body carries rate-limit wording (qpm/qps, rate limit, too many
requests, throttled, 调用频率/频率超限/请求过于频繁/繁忙, try again
later, slow down). Authorization-shaped 403s (invalid key, forbidden,
permission denied) and unrelated bodies stay permanent, so the change
cannot turn authz failures into retry loops.

Tests: 14-case table covering rate-limit 403 acceptance and
authorization-shaped 403 rejection, all existing isTransientLLMError
cases unchanged and passing.
2026-09-07 14:41:48 +08:00
十三分之五六七 2544fedcd3 fix: report embedding dimension mismatches 2026-09-07 14:41:28 +08:00
十三分之五六七 f7cc5969e3 feat(mcp): add manual knowledge update tool 2026-09-07 14:40:33 +08:00
dzc-bit 25a930b9a0 fix(preview): stop routing legacy .doc/.ppt to the OOXML previewers 2026-09-07 14:28:41 +08:00
linhongyu510 01377b686c fix: persist cleared IM knowledge bases 2026-09-07 14:24:41 +08:00
Roovelrz 91a24fc376
fix: sanitize qdrant string payloads (#2997)
* fix: sanitize qdrant string payloads

* perf: avoid unnecessary qdrant payload sanitization
2026-09-07 14:22:25 +08:00
MidoriKurage fee252e936
refactor(system): extract reset-password popup into ResetPasswordDialog (#3047)
* refactor(system): extract reset-password popup into ResetPasswordDialog

* fix(system): preserve pending password resets across tab changes

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-07 13:26:59 +08:00
MidoriKurage 6f5a9c8c31 feat(frontend): expose HTTP status on API responses via $httpStatus 2026-09-07 13:12:30 +08:00
Lathan 7d5c13ba8e fix(organization): 修正成员权限说明中编辑角色的共享知识库权限
权限说明弹窗将编辑(editor)角色的「共享知识库到共享空间」标记为不可用,
与后端行为不符:ShareKnowledgeBase 仅要求共享人的组织角色为 editor+
(kbshare.go: HasPermission(types.OrgRoleEditor),admin=3/editor=2/viewer=1),
智能体共享同理(agent_share.go),且前端无角色级拦截,编辑实际可共享。
将两个弹窗(权限卡与紧凑矩阵)中编辑角色该条目改为可用,与代码保持一致。
2026-09-07 13:07:26 +08:00
nullptr-error 524deeaad5
feat(sandbox): run sandboxed execs as root by default (#3067)
* feat(sandbox): run sandboxed execs as root by default

Every chat session owns its own sandbox, so the in-container account is
not a tenant boundary and root is the least surprising default for an
agent that installs packages and writes wherever it needs. Host and
cross-tenant isolation stay at the container boundary.

DefaultSandboxExecUser becomes "root" (remote_client.go) and the sandbox
image ends with USER root. The three backends keep naming the account
explicitly on every exec so the account a call lands on does not depend
on which backend a workspace selected; the adapter default, the file
operations and the artifact-directory bootstrap all follow the constant.
The template still provisions a uid 1000 "user" account for interop with
E2B/Cube tooling that addresses it by name.

Root also makes the skill-install flow's account hand-over pointless, so
it goes: verification no longer runs after a chown/chmod lock-down and a
repair round no longer reopens the tree (normalizeSkillPermissions and
reopenSkillDirForRepair are gone), and the prepare and scratch commands
stop chowning. The scratch wipe now also clears /tmp, and the cache
budget guard sizes only root's caches, since no second account can grow
one. Verification is asserted to stay on the ordinary executor (no
AsRoot, no AllowSkillsRoot) rather than on which account it ran as.

* refactor(skills): install chat-time extras into the skill's own env

PYTHONPATH / NODE_PATH pointed at a per-session overlay
(/workspace/.skill-packages/<skill>) because the skill tree was frozen
after install: root-owned, mode 555, and often built by `uv venv` with no
pip, so `pip install --target` somewhere else was the only way a chat
session could add a package.

None of that holds now. The lock-down is gone and execs run as root, so a
missing package goes straight into the skill's own environment, and the
write is already session-local: a chat sandbox is built from the config's
image and its filesystem dies with the session, so nothing reaches the
image other sessions start from. The overlay bought nothing over that
while splitting one skill's packages across two locations.

SessionSkillPackageDir goes, and applySessionPackagePath becomes
applySkillNodePath: it appends the skill's own node_modules after
whatever the caller supplied, replacing a `+=` that prepended a bare
separator once the overlay stopped seeding the variable. No PYTHONPATH is
injected at all. Python dependencies are reached through the skill's venv
interpreter, which the shell wrapper already puts first on PATH; the
overlay-era value named the venv root, which is not an importable path.
PYTHONPATH stays on the injected-name blacklist so a stored value cannot
shadow the venv.

The runtime hints and every prompt that described the overlay now name
`<skillDir>/.venv/bin/python -m pip install` and `npm install` in the
skill directory. frozenSkillTreeGuidance / isFrozenSkillVenvFailure are
renamed for what they detect now that nothing is frozen.

* docs(prompts): reserve /workspace/output for finished deliverables

/workspace/output is the one directory an artifact collector reads, so
everything written there is offered to the user as a deliverable. The
prompts described it as the place for "deliverables" or "downloadable
artifacts" without saying it is exclusively that, which reads as "the
directory you write results to" — and a model doing multi-step work has
results at every step. Drafts, intermediate renders and debug dumps land
next to the finished file and the user is handed all of them.

The four places that describe the workspace now say the same thing: the
collector reads only /workspace/output, so finished deliverables go there
and everything in progress goes anywhere else under /workspace. The
attachment block gains the matching half for the other direction —
/workspace/input holds the user's own files and is not ours to write to,
which it previously implied by calling the paths "read-only inputs" while
the tools that enforce it say so plainly.

Only the /workspace/input half is enforced (write_sandbox_file refuses
that tree). Whether a file is finished is a judgement no tool can make,
so the output half stays guidance and is stated wherever the model is
already reading about the workspace rather than in one place it might
not see.

* fix(skills): restore executable bundles and package recovery

* style(sandbox): wrap prompt text for repository lint checks

* fix(sandbox): guard recovery paths and document root execution

---------

Co-authored-by: hailongzhao <hailongzhao@tencent.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-07 13:03:35 +08:00
yushangcan 84f2345641 fix(frontend): finish knowledge base tour without creating a knowledge base 2026-09-07 11:56:00 +08:00
po-et 160c806b94 feat(datasource): keep the source document's last-modified time through ingestion
Connectors already fill FetchedItem.UpdatedAt (Feishu from the real edit
time), but ingestItem dropped it: the persisted metadata only carried
external_id, source_resource_id and datasource_id, and the knowledge
row's own UpdatedAt moves on every re-parse, so nothing downstream could
tell how old a document is.

Write it into metadata as source_updated_at (RFC3339, UTC) when the
connector supplied one, and leave the key out otherwise so an absent
time stays distinguishable from a zero one.

Refs #3016
2026-09-07 11:52:56 +08:00
Max Freedom Pollard 801005f736 fix(knowledge): keep long non-ASCII folder names valid UTF-8
NormalizeKnowledgeFolderPath capped a directory name with
segment[:MaxKnowledgeFolderSegmentLength] (internal/types/knowledge_folder.go:51).
That is a raw byte index, so a name longer than 128 bytes was cut wherever
byte 128 landed. For a Chinese folder name that is inside the 43rd character,
and the leading bytes of the half-cut character stay in the string.

The result is an invalid UTF-8 folder_path. json.Marshal replaces the broken
bytes with U+FFFD, so the path the client reads back is not the path stored in
the row, and RenameKnowledgeFolder (internal/application/service/knowledge.go:611)
normalizes that returned value and matches nothing.

The cut now backs off to the nearest rune start. The cap stays a byte budget,
so a 60-character Chinese name keeps its first 42 characters (126 bytes)
instead of 128 bytes ending in half a character. ASCII names are unchanged.
2026-09-07 11:50:32 +08:00
LuckVd 4fb0b08719 fix(initialization): pass stored ExtraConfig to model connection test
fillSecretsFromStoredModel only copied APIKey/AppSecret from the stored
model into the test request, so the temporary test model built by
buildTestModel always had a nil ExtraConfig. Any provider-specific
setting (thinking_control, api_version, remote_model_name, ...) was
silently dropped from POST /initialization/remote/check, making the
'Test Connection' button validate a bare model instead of the stored
configuration — and masking fixes that depend on extra_config.

Request-provided values keep precedence: extraConfig is only filled
when the request does not carry one, matching the existing secret
semantics ('non-empty request values are always preferred').

Fixes #3057
2026-09-07 11:43:44 +08:00
LuckVd b037e26260
fix(chat): keep OCR/caption text of scanned-page image hits in merge (#3064)
* fix(chat): keep OCR/caption text of scanned-page image hits in merge

When pdf_force_scanned is enabled, the recognized page text lives only
in image_ocr/image_caption child chunks, while the parent markdown is
cut from image placeholders alone. The merge stage's image_parent_resolve
overwrote the hit content with the pruned parent markdown, so the OCR
text never reached the LLM context and answers degraded to placeholders.

Save the hit chunk's own body before the parent expansion and re-attach
it via JoinChunkContent, which collapses duplicates, so normal multimodal
hits (whose text is already covered by the surrounding content) are not
duplicated.

Fixes #3052

* fix(chat): avoid duplicating scanned OCR after parent merge

Re-attaching the image hit body into Content would be injected again
from ImageInfo during chat enrichment. Clear the matching OCR/caption
field so the model sees one copy, and cover caption plus pruned-placeholder paths.

* style(chat): wrap long merge parent-resolve test fixture

---------

Co-authored-by: LuckVd <LuckVd@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-07 11:38:47 +08:00
wizardchen 316db899d8 fix(security): reject traversal in local prefixes, task IDs, and wiki sort
Local storage prefixes now join under the base directory instead of
filepath.Join, FAQ import rejects client task IDs that can leak into
object names, and wiki list ORDER BY uses quoted identifiers instead of
sprintf.
2026-09-07 11:23:45 +08:00
lyingbug 3d3bb7f6d1
fix(system): keep one-time create-user passwords and copy full account details (#3039)
* fix(system): keep one-time create-user passwords from being discarded

Escape leaked to the Settings modal, and a double submit could replace a
201 reveal with an idempotent 200. Show the password in plaintext and
distinguish create vs retry via an idempotent body flag.

* i18n(system): update copy button and success message for account details

Changed the labels for the copy button and success message across multiple languages in the localization files to reflect the new terminology for copying account details instead of just passwords. This update enhances clarity for users when interacting with the Create User dialog.
2026-09-06 00:35:08 +08:00
MidoriKurage dcc89d4b2d
feat(system): add admin UI for creating users (#3034)
* i18n(system): add createUser strings for SystemAdmin dialog

* ui(system): add Create user dialog to the Access settings tab

Wire the unused createSystemUser API to a third row in the SystemAdmin
Access section. The dialog (CreateUserDialog.vue) has two views:

- Form: username, email, and an auto-generate toggle that reveals
  new/confirm password fields when off.
- Reveal: one-time generated password the admin must acknowledge;
  overlay click, Esc, and the close button are disabled until then.

Also:
- The idempotent 200 OK path (no generated_password) closes with its
  own success toast.
- The teleported dialog shell is shared via systemAdminDialog.less.
- Password policy comes from upstream's @/utils/passwordPolicy
  (complex-password aware) rather than a local shared module.

* i18n(audit): register system.user_created for the SystemAuditLog
2026-09-06 00:10:04 +08:00
wizardchen 816bb3c982 feat(session): show in-progress status in the sidebar
Keep a spinner on chats that are still generating, including after you
leave the thread, so background replies stay visible in the session list.
2026-09-05 23:32:13 +08:00
ninesun 1e36e071ec
feat(mcp): add per-tool enable toggle (#2989)
* feat(mcp): add per-tool enable toggle

* style: format migration test

* fix(mcp): keep enable and approval updates from overwriting each other

Partial policy writes now touch only the supplied columns, and a missing
tenant fails closed so a disabled tool cannot slip through.

---------

Co-authored-by: myysophia <myysophia@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-05 17:19:20 +08:00
linhongyu510 df7e84eb30 fix(message): log why chat history indexing was skipped
IndexMessageToKB returned silently when getChatHistoryConfig yielded nil,
so an operator who enabled message indexing in the UI could see
"indexed messages: 0" with nothing in the logs to explain it.

The two paths disagree on what "enabled" means:

  GetChatHistoryKBStats  -> cfg != nil && cfg.Enabled
  IndexMessageToKB       -> cfg.IsConfigured(), which also requires
                            EmbeddingModelID != "" && KnowledgeBaseID != ""

So Enabled=true with either field empty reports the feature as on while
every message is skipped, and the skip emitted no log line at all.

Log the specific missing precondition instead. Behaviour is unchanged -
this only makes an existing silent path attributable.
2026-09-05 16:52:27 +08:00
Zhaowei Li e847114d19 fix(feishu): preserve images embedded in post messages 2026-09-05 16:48:16 +08:00
lyingbug d5cb842580
feat(agent): unify sandbox tools and drop host preloaded skills (#3033)
* feat(agent): unify sandbox tools and drop host preloaded skills

Read workspace and skill files through read_file, and run installed or staged skills through shell_exec(skill_name). Remove the unused skills/preloaded tree and keep generated-file previews stable across re-renders.

* fix(frontend): do not assume classList in markdown sanitize hooks

Node unit tests stub anchors without a DOM classList. Detect download cards from class/download attributes instead.
2026-09-05 16:45:59 +08:00
Anky 2834e6dcf6
fix: widen audit log drawer (#3001)
* fix: widen audit log drawer

* style: remove audit drawer comment

* feat: make audit log drawer resizable
2026-09-05 16:35:31 +08:00
Haibing Ou 7c4b5f1bfe feat(miniprogram): add zh/en i18n, tab icons, and base library compatibility
Fix blank knowledge page caused by unsupported ?? / ?. syntax, flatten
i18n bindings for WXML, and add settings language switch with tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 17:35:25 +08:00
asmh1989 5b057af467 fix(agent): web_fetch 兼容 LLM 双重序列化的 items 参数 2026-09-04 17:34:24 +08:00
FincherYuan 2d6b84cb23 feat(session): show owner badge for API sessions in sidebar
Sessions owned by synthetic principals (api_external_user:<tenant>:<id>,
api_tenant_key:<tenant>:<keyID>) have no real account row to display, so
the sidebar previously showed nothing about who created them. Render a
small badge next to the title: the readable sub for external-user
sessions, a generic "API" tag for key-scoped sessions. Regular
account/web sessions stay unchanged (no badge).

user_id already flows through mapSessionRow -> bucket items ->
SessionSidebarRow; only the render was missing.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-04 17:32:00 +08:00
wizardchen 1edcd54b43 docs: refresh v0.8.0 showcase screenshots and drop star-history
Lead the README gallery with real skill-sandbox conversation shots, and remove the star-history embed while GitHub star data is unavailable.
2026-09-03 14:46:44 +08:00
wizardchen d75cf72fc6 chore: prepare v0.8.0 release notes and version bump
Bump VERSION, frontend, and Helm to 0.8.0; document sandbox, skill catalog, long-term memory, and related API/client changes.
2026-09-03 14:46:44 +08:00
hailongzhao 4d56f64a0b fix(sandbox): always require inbound credentials
Ignore and clear allow_public_inbound on save so API clients cannot open public inbound.
2026-09-03 13:34:40 +08:00
hailongzhao 52d1551165 fix(sandbox): hide inbound controls and let Cube L7 rules be reordered
The editor no longer exposes inbound access; saves omit
allow_public_inbound so the zero value (require credentials) is stored.
Cube L7 rules can be moved so first-match-wins order is explicit.
2026-09-03 13:34:40 +08:00
hailongzhao efb7e2aea2 fix(sandbox): drop the unused volume-capability warning from the check result
Skills do not use shared volumes yet, so telling the admin a backend
cannot mount them is noise after a connectivity check.
2026-09-03 13:34:40 +08:00
nullptr-error e39277a75e
feat(sandbox): add tenant-configurable network policy (#2995)
* feat(sandbox): add the tenant network policy with its secrets and validation

Administrators need control over sandbox network access, so a named sandbox
config gains a network policy block. It lives inside the existing config JSONB,
so there is no schema change and old rows read back as the zero value.

Both booleans are phrased so that the zero value IS the intended default --
outbound open, inbound closed. That makes "no network block" and "explicitly
saved defaults" provably the same thing, and avoids a tri-state pointer where
nil would have to mean "allowed" for egress and "closed" for ingress.

Injected header values are credentials, so they ride the encrypt-at-rest and
mask-on-read path EnvVars already uses instead of a parallel mechanism. One
CloneWithSecrets traversal serves encrypt, decrypt and mask so the three
directions cannot disagree about which fields are secret.

Validation runs at save time because the alternative is failing at
sandbox-create time, where the admin no longer has the form in front of them.
It rejects both what a provider would refuse and what a provider would accept
without doing what the admin meant -- a domain allowlist with no deny-all
fallback still leaves every unresolved destination reachable.

* feat(sandbox): apply the network policy on both providers, persist the inbound token

Resolve the stored policy into one fully specified provider-neutral policy so
that nothing downstream re-derives a default. Both booleans come out non-nil on
every path, including the nil-tenant one, because a partially specified policy
would let the adapters fall back to their providers' more permissive defaults.
The three inversions (deny-egress to allow-internet, public-inbound, rule-deny
to rule-allow) happen in exactly one place.

Every sandbox-creating path carries it, so sessions, skill installs and the
deep connectivity check all run under the same config's policy rather than
each wiring its own.

Inbound access defaults to CLOSED, deliberately stricter than either
provider's own default: a sandbox URL reachable by anyone who learns the ID is
not a reasonable default for a tenant's workspace. Closing it makes the
provider issue a per-sandbox traffic token, and only at create time -- so the
token is stored with the session binding and replayed through Connect on every
reconnect. Without that, a sandbox that was paused on TTL or rebound after a
restart would answer 403 on every exec and file read, and 403 classifies as an
authentication error rather than NotFound, so the binding would never be
replaced and the session would stay wedged.

Connect therefore takes a request struct instead of a bare ID, which gives the
token a single documented way in rather than implicit state inside an adapter.

Metadata-based recovery is the one reconnect path with no binding to read the
token from. Rather than adopt a sandbox that would be permanently 403, it is
deleted and replaced -- but only for providers that have the credential at
all, since Docker has no inbound token and its containers are still adoptable.

go-e2b keeps the token and never sends it, so for E2B the data-plane
RoundTripper attaches the header from a process-local registry. Cube's SDK
already does this itself.

* fix(sandbox): classify data-plane traffic by authority shape, not the configured domain

isDataPlane suffix-matched the configured sandbox domain, which was wrong in
both directions. Both required a configured proxy_url, so E2B Cloud's default
usage was unaffected; the affected deployments are exactly the self-hosted and
E2B-compatible ones the gateway exists for.

A configured gateway could be silently ignored. sandbox_domain is optional for
E2B -- MissingRequiredFields asks only for api_key and template_id -- and with
it empty the check returned false for everything. The general form is worse
than the empty case: go-e2b's envdBaseURL prefers the domain the control plane
reported over the client-wide one, so the authority actually dialled need not
appear in the config at all. The failure is quiet whenever public DNS happens
to resolve the sandbox domain, and the operator believes traffic is passing
through a gateway that never sees it.

Control-plane calls could be sent to the gateway. E2B's own defaults put the
API host under the sandbox domain (api.e2b.app beneath e2b.app), so the suffix
match classified every Create, Connect and List as data-plane traffic. That
is loud where the gateway does not serve the API, but where it proxies both
planes it succeeds while downgrading an X-API-Key request to plaintext for an
http:// gateway. Cube was immune to the first problem, since it requires both
fields, but not to this one.

Classify on the "<port>-<sandboxID>.<domain>" shape both SDKs generate, using
the SandboxIDFromDataPlaneHost helper that token injection on the very same
request already relies on -- so routing and injection now agree by
construction instead of applying two different rules. That helper exists
precisely because the configured domain is unreliable here; it was simply
never used for the routing half.

The control host stays as an explicit exclusion. The shape test already
rejects api.<domain>, so this only covers an API host that itself wears the
shape, such as 8080-api.example.com.

One existing assertion was replaced rather than kept: the E2B pool test proved
that the Cube fields were ignored by asserting a cube.app authority was not
data-plane traffic, which tested the domain matching rather than the field
selection. It now asserts the transport dials the E2B gateway address and not
the Cube one.

* feat(sandbox): add the network policy editor to the sandbox config drawer

The policy sits in the runtime step, directly under the settings it
constrains, rather than in a step of its own. The existing execution timeouts
were compressed into a two-column grid to make room, keeping each field's own
label and its own tip -- the reason they were one per row was that three
unlabelled numbers sharing a footnote gave no clue which one you were editing,
and two columns with per-field tips does not regress that.

Provider-specific sections are shown only for the backend that has them: the
Cube L7 rule cards, E2B's per-host header transforms, and for Docker just the
bridge/none selector, since Docker can only express the overall switch.

Injected header values are write-only. A stored one shows as configured and is
preserved when the input is left blank, which is how env-var secrets already
behave. Renaming a rule or a header is the case worth care: the merge indexes
credentials on the rule-and-header pair, so a rename means the old value can no
longer be recovered. One helper decides both the placeholder text and whether
the payload re-attaches the value, so the form cannot claim a credential is
kept while the save blanks it.

The add buttons use keys of their own instead of reusing the env-var table's
"add variable", which read wrongly under a list of network destinations and
which the i18n key check cannot catch, since the key exists in every bundle.

* docs(sandbox): document the network policy and its inbound default change

The existing network bullet described the pre-feature state -- both providers
open by default, tunable only through the neutral policy at create time --
which is no longer true of the defaults or of the admin-facing surface.

Three things needed writing down rather than restating.

The inbound default flips from publicly reachable to credential-required. A
deployment that relies on a browser or an external service reaching a sandbox
port directly, rather than going through WeKnora, has to opt back in on that
config.

The binding store now holds a bearer credential in plaintext. Leaving it
unencrypted was a deliberate trade -- per-reconnect crypto on the hot path
against Redis's own access control -- and the trade is only sound if the
requirement is actually stated, along with the code-side constraint it depends
on: a binding or a handle is never logged whole, only the sandbox ID and
whether a credential is present.

On binding loss, a closed-inbound Cube or E2B config no longer adopts its old
sandbox by metadata. The token went with the binding and the provider will not
reissue it, so adoption would produce a session that answers 403 on every
data-plane call with no way back. The sandbox is deleted and rebuilt, which
costs the /workspace scratch. Docker has no such credential and still adopts.

* fix(sandbox): fail closed when a closed-inbound create has no traffic token

A Cube/E2B sandbox created without the inbound token would be bound anyway,
then 403 on every data-plane call as an unreplaceable authentication error.
Refuse the create, destroy the sandbox, and stop Docker from persisting
inbound/egress radios it cannot honour. Canonicalize IPv4 /0 deny-all onto
0.0.0.0/0 and reject CR/LF in injected header names and values.

* fix(sandbox): satisfy pre-push lint on the network policy files

Unexport the data-plane host parser, drop file-level package docs that
revive rejected, and lowercase error-string prefixes that staticcheck
ST1005 treats as capitalized English.

* fix(sandbox): persist rotated inbound tokens and stop misreporting restricted egress

Connect can reissue the traffic token after pause/resume; write it back onto
the binding so a restart does not restore a stale credential that 403s and
cannot be replaced. Restore the volume-support i18n key, map Docker
network_mode=none onto deny-egress, inject the E2B inbound header without a
gateway pool, and fold header names when merging redacted secrets.

---------

Co-authored-by: hailongzhao <hailongzhao@tencent.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-03 10:49:46 +08:00
wizardchen 22489ba663 feat(chat): keep prompt prefixes stable and send provider cache markers
Provider prefix caches only hit when system/tools stay byte-stable and
cache routing is actually on the request. Stop rewriting those prefixes
mid-turn, attach prompt_cache_key / cache_control, and log hit rate
instead of showing it in the conversation tree.
2026-09-03 00:45:52 +08:00
wizardchen b747cdb3f6 feat(agent): stream live +/- progress for sandbox write and edit
Large write/edit calls used to sit on a spinner until the full JSON
arrived. Emit path and running line counts from partial arguments so
the UI can update in place, without putting file bodies on the SSE wire.
2026-09-02 23:36:58 +08:00
wizardchen 4c0d42c4cb feat(agent): keep long sandbox turns from truncating, overflowing, or rewriting files
Refuse truncated tool calls, compact-and-retry once on overflow, and let
sandbox files be appended, paged, and batch-edited instead of rewritten.
Models can set context_window (default 200K) so compaction sizes itself
from the real window; agent max_iterations of -1 means unlimited.
2026-09-02 22:09:09 +08:00
leon4z 988cbb0330
fix(models): show usage details when deletion is blocked (#2975)
* fix(models): show usage details when deletion is blocked

* fix(models): open the matching agent section and cap usage lists

Agent "open configuration" now lands on the tab that owns the binding
(VLM/ASR vs follow-ups), and delete failures keep the server message when
structured details cannot be parsed. Listed KB/agent rows are capped at 50
while totals still drive the deletion guard and dialog headings.

---------

Co-authored-by: Leon <leon_hfut@foxmail.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-02 17:20:37 +08:00
wizardchen 3d40ee0aff fix(skills): install ClawHub skills.sh catalog pages via the install resolver
Those /skills-sh/owner/repo/slug listings are federated, not native
@owner/slug pages, and the GitHub folder is often deeper than the URL
slug. Resolve them through ClawHub so the commit-pinned handoff names
the real skill path.
2026-09-02 16:22:55 +08:00
wizardchen 79995b996f fix(agent): scope the sandbox tools to the workspace they actually serve
Three inconsistencies in how the sandbox tools are granted and bounded.

Tool checkboxes that decide nothing. list/read/write/edit_sandbox_file,
shell_exec, read_skill and execute_skill_script were offered in the settings
UI, but registerSandboxFileTools, registerSandboxShellIfAllowed and
initializeSkillsManager all register from the capability (a sandbox with a
session filesystem, SkillsEnabled, install mode) and never consult
AllowedTools. Clearing a checkbox changed nothing. Drop them from
AvailableToolDefinitions the way search_memory and web_search already are,
so the switch that decides is the only thing shown.

Readers narrower than writers. write_sandbox_file accepts anything under
/workspace except the attachment tree, while list/read stopped at the
artifact output dir, so the agent could not read back the scratch script it
had just written and had to detour through `shell_exec cat`. Since
shell_exec reaches those files anyway the narrowing bought no safety; the
inspectable roots now cover /workspace, still ordered so a reported root
names the artifact or attachment tree when the path is inside one.

Two answers for one directory. A WEKNORA_SKILL_OUTPUT_DIR override was
validated on the execution path (falling back to /workspace/output) but
taken as-is from the host environment by the tools and ArtifactCollector, so
an override outside /workspace pointed the readers at a directory no skill
could write. Both now go through sandbox.ValidatedSessionOutputDir.
2026-09-02 16:16:52 +08:00
wizardchen 439443e1e1 feat(agent): tell session agents which workspace they are working in
The installer agent was recently given its working directory up front and
stopped prefixing `cd <skill-dir> &&` onto every command. Session agents
never got the same treatment: shell_exec only mentioned /workspace as the
work_dir default, so the model could not tell it was already there, and
execute_skill_script never said scripts run with /workspace as their cwd —
a relative path inside a skill script silently resolves outside the skill.

Describe the workspace once, where each tool is described: shell_exec gains
a Working Directory section (already in /workspace, relative paths, no `cd`
prefix, and each call starts there again so a `cd` does not carry over),
execute_skill_script states its cwd and points at $WEKNORA_SKILL_DIR, and
the skills prompt gains a Workspace section covering input, output and the
per-session package overlay.

Also drop the installer prompt's paragraph about write_sandbox_file and
friends: those tools are not registered in install mode, so the model never
sees them in its schema and the note only spent tokens describing — and
misdescribing — a scope it could not reach.
2026-09-02 16:16:52 +08:00
养乐多 13abc41b0d fix(skill): 解析 stringified JSON 数组形式的 args
部分模型供应商把 execute_skill_script 的 args(schema 为 []string)
emit 成 JSON 字符串,内容本身是个 JSON 数组("[\"--project-name\",\"X\"]")。
原 UnmarshalJSON 兜底用 strings.Fields 拆这种字符串,把方括号/引号拆成
垃圾 token,脚本 argv 全是乱码,argparse 永远报参数缺失,模型无论如何
调整格式都失败。改为先把字符串内容当 JSON 数组解析,成功即用;否则再
退回 strings.Fields。补 UnmarshalJSON 各形态单测。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-02 15:37:14 +08:00
wizardchen a2328f0470 fix(frontend): include nginx-api-proxy.conf in the UI image build
.dockerignore was still excluding the snippet after Dockerfile started copying it, so the weknora-ui buildx job failed with a missing cache key.
2026-09-02 15:32:33 +08:00
养乐多 53ba549dbb fix(skill): @mention 不再收窄技能白名单
applyPerRequestSkillScope 原把 @mention 实现为收窄 AllowedSkills,
导致用户提及技能 A 后,智能体提示词要求调用未提及的技能 B 时
read_skill(B) 返回 "skill not allowed"。改为 @mention 只生成
<must_use> pin 提示,不动门控:智能体配置的全部技能始终可用,
pin 仅记录被提及且当前允许的技能(空 AllowedSkills 视为全允许,
与 Manager.isSkillAllowed 一致)。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-02 15:32:20 +08:00