Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(assistant): let the assistant list the artifact library

wizardchen8d87d5e70cb1
diff --git a/docs/docs.go b/docs/docs.go
index d06173c8f..c1ec5bac8 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -1130,24 +1130,33 @@ const docTemplate = `{
"parameters": [
{
"type": "string",
+ "x-agent": true,
"description": "按文件名过滤",
"name": "keyword",
"in": "query"
},
{
"type": "string",
+ "x-agent": true,
"description": "逗号分隔的扩展名,如 .pdf,.pptx",
"name": "file_types",
"in": "query"
},
{
+ "minimum": 1,
"type": "integer",
+ "x-agent": true,
+ "x-agent-maximum": "10000",
"description": "页码",
"name": "page",
"in": "query"
},
{
+ "maximum": 100,
+ "minimum": 1,
"type": "integer",
+ "x-agent": true,
+ "x-agent-maximum": "20",
"description": "每页数量(最大 100)",
"name": "page_size",
"in": "query"
@@ -1157,11 +1166,15 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/internal_handler_session.artifactLibraryResponse"
}
}
- }
+ },
+ "x-agent": {
+ "id": "artifact.list",
+ "risk": "read"
+ },
+ "x-agent-hint": "Files generated by agents across the user's conversations, newest first. This is the Artifacts library, not the current chat's sandbox. keyword matches file names; file_types is a comma-separated list of extensions such as .pdf,.pptx,.md. Each item has file_name, created_at, session_title and session_id. Do not use generated-file or sandbox tools to answer what is on this page."
},
"delete": {
"security": [
@@ -2114,6 +2127,58 @@ const docTemplate = `{
"x-agent-hint": "Creates an automation the WeKnora assistant runs as the user. If work requires other agents, name them and their assignments in the instruction so the assistant can delegate. Turn the user's wording into a cron expression (five fields, minute first) and an IANA timezone, and check it with automation.validate_trigger first, telling the user the next run times it returns. Runs are unattended: write the instruction as a complete task, since nobody can answer questions during a run. access_level defaults to confirm, where each change waits for the user's approval; only set auto_write when the user asks for it."
}
},
+ "/automations/by-session/{session_id}": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "返回这次会话所属的自动化,供会话页跳回",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "自动化"
+ ],
+ "summary": "按会话查找自动化",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "会话 ID",
+ "name": "session_id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "自动化",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/internal_handler.DataResponse"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Automation"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "404": {
+ "description": "不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ }
+ }
+ }
+ },
"/automations/validate-trigger": {
"post": {
"security": [
@@ -17551,6 +17616,110 @@ const docTemplate = `{
}
}
},
+ "/sandbox-configs/{id}/user-sandboxes": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "List the config's shared user machines with live session counts and the empty-retention clock.",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "SandboxConfig"
+ ],
+ "summary": "List shared user sandboxes",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Sandbox config ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Shared user sandboxes",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ }
+ }
+ }
+ },
+ "/sandbox-configs/{id}/user-sandboxes/{digest}/release": {
+ "post": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Delete one shared user machine now; each session gets a fresh machine on next use. Refused while busy.",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "SandboxConfig"
+ ],
+ "summary": "Release a shared user sandbox",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Sandbox config ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "User machine digest",
+ "name": "digest",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Released",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "409": {
+ "description": "User sandbox is busy",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ }
+ }
+ }
+ },
"/sessions": {
"get": {
"security": [
@@ -24159,6 +24328,10 @@ const docTemplate = `{
"unverifiable": {
"description": "Unverifiable reports that SandboxCount is unknown rather than zero\nbecause the provider could not be reached. The management page must say\nso instead of rendering a reassuring \"0 sandboxes\".",
"type": "boolean"
+ },
+ "user_sandbox_count": {
+ "description": "UserSandboxCount is how many of SandboxCount are shared user machines.\nThey carry no session id, so SessionIDs alone under-reports what a\ncredential change would affect.",
+ "type": "integer"
}
}
},
@@ -25750,6 +25923,20 @@ const docTemplate = `{
"github_com_Tencent_WeKnora_internal_types.AgentStep": {
"type": "object",
"properties": {
+ "background_injections": {
+ "description": "BackgroundInjections are background-work messages delivered before this\nmodel response, after the step's steered messages, in delivery order.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.BackgroundInjection"
+ }
+ },
+ "background_seen_ids": {
+ "description": "BackgroundSeenIDs are finished background items whose results this\nstep's tool calls (work_wait, work_cancel) returned to the model.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"intermediate_answer": {
"description": "IntermediateAnswer preserves a plain answer followed by a loop-end steer.\nThe canonical final answer is still stored in Message.Content.",
"type": "boolean"
@@ -25911,6 +26098,54 @@ const docTemplate = `{
"AnswerStrategyRandom"
]
},
+ "github_com_Tencent_WeKnora_internal_types.ArtifactLibraryItem": {
+ "type": "object",
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "x-agent": true
+ },
+ "file_name": {
+ "type": "string",
+ "x-agent": true
+ },
+ "file_size": {
+ "type": "integer",
+ "x-agent": true
+ },
+ "file_type": {
+ "type": "string",
+ "x-agent": true
+ },
+ "handle": {
+ "type": "string",
+ "x-agent": true
+ },
+ "index": {
+ "type": "integer",
+ "x-agent": true
+ },
+ "message_id": {
+ "type": "string",
+ "x-agent": true
+ },
+ "session_id": {
+ "type": "string",
+ "x-agent": true
+ },
+ "session_title": {
+ "type": "string",
+ "x-agent": true
+ },
+ "source_path": {
+ "type": "string"
+ },
+ "version_count": {
+ "type": "integer",
+ "x-agent": true
+ }
+ }
+ },
"github_com_Tencent_WeKnora_internal_types.AssistantAccessLevel": {
"type": "string",
"enum": [
@@ -25941,6 +26176,17 @@ const docTemplate = `{
}
}
},
+ "github_com_Tencent_WeKnora_internal_types.AttrInject": {
+ "type": "string",
+ "enum": [
+ "always",
+ "on_demand"
+ ],
+ "x-enum-varnames": [
+ "AttrInjectAlways",
+ "AttrInjectOnDemand"
+ ]
+ },
"github_com_Tencent_WeKnora_internal_types.AttrSpec": {
"type": "object",
"properties": {
@@ -25955,6 +26201,18 @@ const docTemplate = `{
"description": "one line explaining what the attribute measures",
"type": "string"
},
+ "inject": {
+ "description": "Inject says whether this attribute is always part of the describe round's\nstanding questions, or only asked when something is going to act on it.\nAn empty value means AttrInjectAlways, so attributes registered before\nthis field existed keep their behaviour.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AttrInject"
+ }
+ ]
+ },
+ "internal": {
+ "description": "Internal marks an attribute that steers this pipeline's own scheduling\nrather than describing what the image holds. Such attributes are still\nobserved and persisted — the values are what justify a scheduling\ndecision after the fact — but they are kept out of the gallery's filter\nsurface, where they would only add noise: no operator wants to filter a\nlibrary by \"how much margin is left around the text\".",
+ "type": "boolean"
+ },
"label": {
"description": "human-readable name for the settings panel",
"type": "string"
@@ -26267,6 +26525,12 @@ const docTemplate = `{
],
"x-agent": true
},
+ "active_run_status": {
+ "description": "ActiveRunStatus is projected from live runs and is not persisted.",
+ "type": "string",
+ "x-agent": true,
+ "x-agent-response": true
+ },
"approval_timeout_minutes": {
"description": "ApprovalTimeoutMinutes is how long a run waits for an approval before\nit fails.",
"type": "integer",
@@ -26574,7 +26838,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"at": {
- "description": "At is when a once trigger fires.",
+ "description": "At is when a once trigger fires, RFC3339 or a wall-clock time in\nTimezone, such as \"2006-01-02T15:04:05\" or \"2006-01-02 15:04\".",
"type": "string",
"x-agent": true
},
@@ -26595,6 +26859,20 @@ const docTemplate = `{
}
}
},
+ "github_com_Tencent_WeKnora_internal_types.BackgroundInjection": {
+ "type": "object",
+ "properties": {
+ "ack_ids": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "content": {
+ "type": "string"
+ }
+ }
+ },
"github_com_Tencent_WeKnora_internal_types.COSEngineConfig": {
"type": "object",
"properties": {
@@ -29081,10 +29359,6 @@ const docTemplate = `{
"items": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageAttrCondition"
}
- },
- "on_unobserved": {
- "description": "OnUnobserved is the OCR decision used when the observation does not\nanswer for one of the attributes the policy reads — the attribute is\nabsent because the model skipped the line, or because the value it wrote\nwas not one of the allowed ones. The default is true: an incomplete\nobservation keeps extracting, so a missed block of text costs one extra\ncall instead of being lost. Turn it off only with a model reliable enough\nto answer every attribute line.",
- "type": "boolean"
}
}
},
@@ -29107,7 +29381,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"image_actions": {
- "description": "ImageActions overrides the built-in attribute→work table (see\nDefaultImageActions). A nil value keeps the conservative default: run OCR\nfor block text, data visuals, and unobserved images.",
+ "description": "ImageActions overrides the built-in attribute→work table (see\nDefaultImageActions). A nil value keeps the conservative default: run OCR\nfor block text and data visuals. What to do about an image whose\nattributes were NOT observed is deliberately not part of this table — it\nis a scheduling decision, so it belongs to the pipeline that observes\n(` + "`" + `ocr_on_unobserved` + "`" + ` in that pipeline's slot).",
"allOf": [
{
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageActionsConfig"
@@ -33505,6 +33779,10 @@ const docTemplate = `{
"github_com_Tencent_WeKnora_internal_types.SandboxCheckpoint": {
"type": "object",
"properties": {
+ "background_active": {
+ "description": "BackgroundActive marks a commit taken while background work was live in\nthe session. The work may have been mid-write, so fork and rewind never\nroll a workspace back to it.",
+ "type": "boolean"
+ },
"commit_sha": {
"type": "string"
},
@@ -33862,6 +34140,10 @@ const docTemplate = `{
}
]
},
+ "owner_auth_source": {
+ "description": "OwnerAuthSource records, server-side, how UserID was authenticated when\nthe session was created or its owner first bound (AuthSource*).\nPer-user sandbox allocation reads it; client input never sets it\n(CreateSession overwrites). Empty on rows created before the column\nexisted, which means \"unknown\".",
+ "type": "string"
+ },
"parent_session_id": {
"description": "ParentSessionID names the session this one was forked from. Empty for\nordinary sessions. Deliberately not a foreign key: the parent may be\ndeleted while the branch lives on, and a branch must not cascade away\nwith it. A dangling value simply renders as an ordinary session.",
"type": "string"
@@ -34019,6 +34301,10 @@ const docTemplate = `{
}
]
},
+ "owner_auth_source": {
+ "description": "OwnerAuthSource records, server-side, how UserID was authenticated when\nthe session was created or its owner first bound (AuthSource*).\nPer-user sandbox allocation reads it; client input never sets it\n(CreateSession overwrites). Empty on rows created before the column\nexisted, which means \"unknown\".",
+ "type": "string"
+ },
"parent_session_id": {
"description": "ParentSessionID names the session this one was forked from. Empty for\nordinary sessions. Deliberately not a foreign key: the parent may be\ndeleted while the branch lives on, and a branch must not cascade away\nwith it. A dangling value simply renders as an ordinary session.",
"type": "string"
@@ -35115,6 +35401,10 @@ const docTemplate = `{
"github_com_Tencent_WeKnora_internal_types.TenantSandboxConfig": {
"type": "object",
"properties": {
+ "allocation_mode": {
+ "description": "AllocationMode decides how a session that has not yet used a sandbox\nof this config is placed: \"session\" (default) gives it a machine of its\nown, \"user\" lets one verified owner's sessions share a machine. A\nsession never changes mode after its first use; see\ninternal/sandbox/allocation.",
+ "type": "string"
+ },
"allow_private_endpoints": {
"description": "AllowPrivateEndpoints permits this workspace config to reach RFC1918 or\nloopback cluster endpoints. Link-local/cloud-metadata addresses remain\nblocked. It is explicit in the UI instead of hidden in process env.",
"type": "boolean"
@@ -35164,13 +35454,17 @@ const docTemplate = `{
]
},
"skill_rollout": {
- "description": "SkillRollout decides whether sessions that already hold a sandbox of\nthis config rebuild after a skill install or removal. Empty and\nSkillRolloutNextTurn rebuild on the next chat turn. SkillRolloutNewSession\nleaves those sandboxes on the previous image; only sessions that start\nafterwards boot the new snapshot.",
+ "description": "SkillRollout decides whether sessions that already hold a sandbox of\nthis config rebuild after a skill install or removal. Empty and\nSkillRolloutNextTurn rebuild on the next chat turn. SkillRolloutNewSession\nleaves those sandboxes on the previous image; only sessions that start\nafterwards boot the new snapshot.\nUser allocation always keeps existing shared machines, regardless of this setting.",
"type": "string"
},
"terminal_idle_disconnect_sec": {
"description": "TerminalIdleDisconnectSec is how long an interactive terminal or\ndesktop may go without user activity before WeKnora closes the\nconnection so the sandbox can pause on its provider TTL. Terminal\ncounts keystrokes and PTY output; desktop counts mouse and keyboard.\n0 uses the built-in default (15 minutes). Not an identity field.",
"type": "integer"
},
+ "user_sandbox_empty_retention_days": {
+ "description": "UserSandboxEmptyRetentionDays is how long a user machine with no live\nsession is kept before the reclaim job deletes it. 0 means the default\n(7); values above 90 are rejected.",
+ "type": "integer"
+ },
"volume_mount": {
"description": "VolumeMount configures an optional shared volume mounted into every\nsandbox created for this tenant. Currently used for tenant-installed\nskills, but the configuration itself is skill-agnostic and can serve\nany volume-mount use case (shared datasets, pre-installed toolchains,\netc.).",
"allOf": [
@@ -42437,6 +42731,32 @@ const docTemplate = `{
}
}
},
+ "internal_handler_session.artifactLibraryResponse": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ArtifactLibraryItem"
+ }
+ },
+ "page": {
+ "type": "integer",
+ "x-agent": true
+ },
+ "page_size": {
+ "type": "integer",
+ "x-agent": true
+ },
+ "success": {
+ "type": "boolean"
+ },
+ "total": {
+ "type": "integer",
+ "x-agent": true
+ }
+ }
+ },
"internal_handler_session.batchDeleteRequest": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 992b55186..210aa56ea 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -1123,24 +1123,33 @@
"parameters": [
{
"type": "string",
+ "x-agent": true,
"description": "按文件名过滤",
"name": "keyword",
"in": "query"
},
{
"type": "string",
+ "x-agent": true,
"description": "逗号分隔的扩展名,如 .pdf,.pptx",
"name": "file_types",
"in": "query"
},
{
+ "minimum": 1,
"type": "integer",
+ "x-agent": true,
+ "x-agent-maximum": "10000",
"description": "页码",
"name": "page",
"in": "query"
},
{
+ "maximum": 100,
+ "minimum": 1,
"type": "integer",
+ "x-agent": true,
+ "x-agent-maximum": "20",
"description": "每页数量(最大 100)",
"name": "page_size",
"in": "query"
@@ -1150,11 +1159,15 @@
"200": {
"description": "OK",
"schema": {
- "type": "object",
- "additionalProperties": true
+ "$ref": "#/definitions/internal_handler_session.artifactLibraryResponse"
}
}
- }
+ },
+ "x-agent": {
+ "id": "artifact.list",
+ "risk": "read"
+ },
+ "x-agent-hint": "Files generated by agents across the user's conversations, newest first. This is the Artifacts library, not the current chat's sandbox. keyword matches file names; file_types is a comma-separated list of extensions such as .pdf,.pptx,.md. Each item has file_name, created_at, session_title and session_id. Do not use generated-file or sandbox tools to answer what is on this page."
},
"delete": {
"security": [
@@ -2107,6 +2120,58 @@
"x-agent-hint": "Creates an automation the WeKnora assistant runs as the user. If work requires other agents, name them and their assignments in the instruction so the assistant can delegate. Turn the user's wording into a cron expression (five fields, minute first) and an IANA timezone, and check it with automation.validate_trigger first, telling the user the next run times it returns. Runs are unattended: write the instruction as a complete task, since nobody can answer questions during a run. access_level defaults to confirm, where each change waits for the user's approval; only set auto_write when the user asks for it."
}
},
+ "/automations/by-session/{session_id}": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "description": "返回这次会话所属的自动化,供会话页跳回",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "自动化"
+ ],
+ "summary": "按会话查找自动化",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "会话 ID",
+ "name": "session_id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "自动化",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/internal_handler.DataResponse"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Automation"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "404": {
+ "description": "不存在",
+ "schema": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
+ }
+ }
+ }
+ }
+ },
"/automations/validate-trigger": {
"post": {
"security": [
@@ -17544,6 +17609,110 @@
}
}
},
+ "/sandbox-configs/{id}/user-sandboxes": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "List the config's shared user machines with live session counts and the empty-retention clock.",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "SandboxConfig"
+ ],
+ "summary": "List shared user sandboxes",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Sandbox config ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Shared user sandboxes",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ }
+ }
+ }
+ },
+ "/sandbox-configs/{id}/user-sandboxes/{digest}/release": {
+ "post": {
+ "security": [
+ {
+ "Bearer": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "Delete one shared user machine now; each session gets a fresh machine on next use. Refused while busy.",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "SandboxConfig"
+ ],
+ "summary": "Release a shared user sandbox",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Sandbox config ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "User machine digest",
+ "name": "digest",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Released",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "409": {
+ "description": "User sandbox is busy",
+ "schema": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ }
+ }
+ }
+ },
"/sessions": {
"get": {
"security": [
@@ -24152,6 +24321,10 @@
"unverifiable": {
"description": "Unverifiable reports that SandboxCount is unknown rather than zero\nbecause the provider could not be reached. The management page must say\nso instead of rendering a reassuring \"0 sandboxes\".",
"type": "boolean"
+ },
+ "user_sandbox_count": {
+ "description": "UserSandboxCount is how many of SandboxCount are shared user machines.\nThey carry no session id, so SessionIDs alone under-reports what a\ncredential change would affect.",
+ "type": "integer"
}
}
},
@@ -25743,6 +25916,20 @@
"github_com_Tencent_WeKnora_internal_types.AgentStep": {
"type": "object",
"properties": {
+ "background_injections": {
+ "description": "BackgroundInjections are background-work messages delivered before this\nmodel response, after the step's steered messages, in delivery order.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.BackgroundInjection"
+ }
+ },
+ "background_seen_ids": {
+ "description": "BackgroundSeenIDs are finished background items whose results this\nstep's tool calls (work_wait, work_cancel) returned to the model.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
"intermediate_answer": {
"description": "IntermediateAnswer preserves a plain answer followed by a loop-end steer.\nThe canonical final answer is still stored in Message.Content.",
"type": "boolean"
@@ -25904,6 +26091,54 @@
"AnswerStrategyRandom"
]
},
+ "github_com_Tencent_WeKnora_internal_types.ArtifactLibraryItem": {
+ "type": "object",
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "x-agent": true
+ },
+ "file_name": {
+ "type": "string",
+ "x-agent": true
+ },
+ "file_size": {
+ "type": "integer",
+ "x-agent": true
+ },
+ "file_type": {
+ "type": "string",
+ "x-agent": true
+ },
+ "handle": {
+ "type": "string",
+ "x-agent": true
+ },
+ "index": {
+ "type": "integer",
+ "x-agent": true
+ },
+ "message_id": {
+ "type": "string",
+ "x-agent": true
+ },
+ "session_id": {
+ "type": "string",
+ "x-agent": true
+ },
+ "session_title": {
+ "type": "string",
+ "x-agent": true
+ },
+ "source_path": {
+ "type": "string"
+ },
+ "version_count": {
+ "type": "integer",
+ "x-agent": true
+ }
+ }
+ },
"github_com_Tencent_WeKnora_internal_types.AssistantAccessLevel": {
"type": "string",
"enum": [
@@ -25934,6 +26169,17 @@
}
}
},
+ "github_com_Tencent_WeKnora_internal_types.AttrInject": {
+ "type": "string",
+ "enum": [
+ "always",
+ "on_demand"
+ ],
+ "x-enum-varnames": [
+ "AttrInjectAlways",
+ "AttrInjectOnDemand"
+ ]
+ },
"github_com_Tencent_WeKnora_internal_types.AttrSpec": {
"type": "object",
"properties": {
@@ -25948,6 +26194,18 @@
"description": "one line explaining what the attribute measures",
"type": "string"
},
+ "inject": {
+ "description": "Inject says whether this attribute is always part of the describe round's\nstanding questions, or only asked when something is going to act on it.\nAn empty value means AttrInjectAlways, so attributes registered before\nthis field existed keep their behaviour.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.AttrInject"
+ }
+ ]
+ },
+ "internal": {
+ "description": "Internal marks an attribute that steers this pipeline's own scheduling\nrather than describing what the image holds. Such attributes are still\nobserved and persisted — the values are what justify a scheduling\ndecision after the fact — but they are kept out of the gallery's filter\nsurface, where they would only add noise: no operator wants to filter a\nlibrary by \"how much margin is left around the text\".",
+ "type": "boolean"
+ },
"label": {
"description": "human-readable name for the settings panel",
"type": "string"
@@ -26260,6 +26518,12 @@
],
"x-agent": true
},
+ "active_run_status": {
+ "description": "ActiveRunStatus is projected from live runs and is not persisted.",
+ "type": "string",
+ "x-agent": true,
+ "x-agent-response": true
+ },
"approval_timeout_minutes": {
"description": "ApprovalTimeoutMinutes is how long a run waits for an approval before\nit fails.",
"type": "integer",
@@ -26567,7 +26831,7 @@
"type": "object",
"properties": {
"at": {
- "description": "At is when a once trigger fires.",
+ "description": "At is when a once trigger fires, RFC3339 or a wall-clock time in\nTimezone, such as \"2006-01-02T15:04:05\" or \"2006-01-02 15:04\".",
"type": "string",
"x-agent": true
},
@@ -26588,6 +26852,20 @@
}
}
},
+ "github_com_Tencent_WeKnora_internal_types.BackgroundInjection": {
+ "type": "object",
+ "properties": {
+ "ack_ids": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "content": {
+ "type": "string"
+ }
+ }
+ },
"github_com_Tencent_WeKnora_internal_types.COSEngineConfig": {
"type": "object",
"properties": {
@@ -29074,10 +29352,6 @@
"items": {
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageAttrCondition"
}
- },
- "on_unobserved": {
- "description": "OnUnobserved is the OCR decision used when the observation does not\nanswer for one of the attributes the policy reads — the attribute is\nabsent because the model skipped the line, or because the value it wrote\nwas not one of the allowed ones. The default is true: an incomplete\nobservation keeps extracting, so a missed block of text costs one extra\ncall instead of being lost. Turn it off only with a model reliable enough\nto answer every attribute line.",
- "type": "boolean"
}
}
},
@@ -29100,7 +29374,7 @@
"type": "object",
"properties": {
"image_actions": {
- "description": "ImageActions overrides the built-in attribute→work table (see\nDefaultImageActions). A nil value keeps the conservative default: run OCR\nfor block text, data visuals, and unobserved images.",
+ "description": "ImageActions overrides the built-in attribute→work table (see\nDefaultImageActions). A nil value keeps the conservative default: run OCR\nfor block text and data visuals. What to do about an image whose\nattributes were NOT observed is deliberately not part of this table — it\nis a scheduling decision, so it belongs to the pipeline that observes\n(`ocr_on_unobserved` in that pipeline's slot).",
"allOf": [
{
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ImageActionsConfig"
@@ -33498,6 +33772,10 @@
"github_com_Tencent_WeKnora_internal_types.SandboxCheckpoint": {
"type": "object",
"properties": {
+ "background_active": {
+ "description": "BackgroundActive marks a commit taken while background work was live in\nthe session. The work may have been mid-write, so fork and rewind never\nroll a workspace back to it.",
+ "type": "boolean"
+ },
"commit_sha": {
"type": "string"
},
@@ -33855,6 +34133,10 @@
}
]
},
+ "owner_auth_source": {
+ "description": "OwnerAuthSource records, server-side, how UserID was authenticated when\nthe session was created or its owner first bound (AuthSource*).\nPer-user sandbox allocation reads it; client input never sets it\n(CreateSession overwrites). Empty on rows created before the column\nexisted, which means \"unknown\".",
+ "type": "string"
+ },
"parent_session_id": {
"description": "ParentSessionID names the session this one was forked from. Empty for\nordinary sessions. Deliberately not a foreign key: the parent may be\ndeleted while the branch lives on, and a branch must not cascade away\nwith it. A dangling value simply renders as an ordinary session.",
"type": "string"
@@ -34012,6 +34294,10 @@
}
]
},
+ "owner_auth_source": {
+ "description": "OwnerAuthSource records, server-side, how UserID was authenticated when\nthe session was created or its owner first bound (AuthSource*).\nPer-user sandbox allocation reads it; client input never sets it\n(CreateSession overwrites). Empty on rows created before the column\nexisted, which means \"unknown\".",
+ "type": "string"
+ },
"parent_session_id": {
"description": "ParentSessionID names the session this one was forked from. Empty for\nordinary sessions. Deliberately not a foreign key: the parent may be\ndeleted while the branch lives on, and a branch must not cascade away\nwith it. A dangling value simply renders as an ordinary session.",
"type": "string"
@@ -35108,6 +35394,10 @@
"github_com_Tencent_WeKnora_internal_types.TenantSandboxConfig": {
"type": "object",
"properties": {
+ "allocation_mode": {
+ "description": "AllocationMode decides how a session that has not yet used a sandbox\nof this config is placed: \"session\" (default) gives it a machine of its\nown, \"user\" lets one verified owner's sessions share a machine. A\nsession never changes mode after its first use; see\ninternal/sandbox/allocation.",
+ "type": "string"
+ },
"allow_private_endpoints": {
"description": "AllowPrivateEndpoints permits this workspace config to reach RFC1918 or\nloopback cluster endpoints. Link-local/cloud-metadata addresses remain\nblocked. It is explicit in the UI instead of hidden in process env.",
"type": "boolean"
@@ -35157,13 +35447,17 @@
]
},
"skill_rollout": {
- "description": "SkillRollout decides whether sessions that already hold a sandbox of\nthis config rebuild after a skill install or removal. Empty and\nSkillRolloutNextTurn rebuild on the next chat turn. SkillRolloutNewSession\nleaves those sandboxes on the previous image; only sessions that start\nafterwards boot the new snapshot.",
+ "description": "SkillRollout decides whether sessions that already hold a sandbox of\nthis config rebuild after a skill install or removal. Empty and\nSkillRolloutNextTurn rebuild on the next chat turn. SkillRolloutNewSession\nleaves those sandboxes on the previous image; only sessions that start\nafterwards boot the new snapshot.\nUser allocation always keeps existing shared machines, regardless of this setting.",
"type": "string"
},
"terminal_idle_disconnect_sec": {
"description": "TerminalIdleDisconnectSec is how long an interactive terminal or\ndesktop may go without user activity before WeKnora closes the\nconnection so the sandbox can pause on its provider TTL. Terminal\ncounts keystrokes and PTY output; desktop counts mouse and keyboard.\n0 uses the built-in default (15 minutes). Not an identity field.",
"type": "integer"
},
+ "user_sandbox_empty_retention_days": {
+ "description": "UserSandboxEmptyRetentionDays is how long a user machine with no live\nsession is kept before the reclaim job deletes it. 0 means the default\n(7); values above 90 are rejected.",
+ "type": "integer"
+ },
"volume_mount": {
"description": "VolumeMount configures an optional shared volume mounted into every\nsandbox created for this tenant. Currently used for tenant-installed\nskills, but the configuration itself is skill-agnostic and can serve\nany volume-mount use case (shared datasets, pre-installed toolchains,\netc.).",
"allOf": [
@@ -42430,6 +42724,32 @@
}
}
},
+ "internal_handler_session.artifactLibraryResponse": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ArtifactLibraryItem"
+ }
+ },
+ "page": {
+ "type": "integer",
+ "x-agent": true
+ },
+ "page_size": {
+ "type": "integer",
+ "x-agent": true
+ },
+ "success": {
+ "type": "boolean"
+ },
+ "total": {
+ "type": "integer",
+ "x-agent": true
+ }
+ }
+ },
"internal_handler_session.batchDeleteRequest": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index f7a9939c7..1b7c38757 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -200,6 +200,12 @@ definitions:
because the provider could not be reached. The management page must say
so instead of rendering a reassuring "0 sandboxes".
type: boolean
+ user_sandbox_count:
+ description: |-
+ UserSandboxCount is how many of SandboxCount are shared user machines.
+ They carry no session id, so SessionIDs alone under-reports what a
+ credential change would affect.
+ type: integer
type: object
github_com_Tencent_WeKnora_internal_application_service.SkillCatalogInstallView:
properties:
@@ -1336,6 +1342,20 @@ definitions:
type: object
github_com_Tencent_WeKnora_internal_types.AgentStep:
properties:
+ background_injections:
+ description: |-
+ BackgroundInjections are background-work messages delivered before this
+ model response, after the step's steered messages, in delivery order.
+ items:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.BackgroundInjection'
+ type: array
+ background_seen_ids:
+ description: |-
+ BackgroundSeenIDs are finished background items whose results this
+ step's tool calls (work_wait, work_cancel) returned to the model.
+ items:
+ type: string
+ type: array
intermediate_answer:
description: |-
IntermediateAnswer preserves a plain answer followed by a loop-end steer.
@@ -1466,6 +1486,41 @@ definitions:
x-enum-varnames:
- AnswerStrategyAll
- AnswerStrategyRandom
+ github_com_Tencent_WeKnora_internal_types.ArtifactLibraryItem:
+ properties:
+ created_at:
+ type: string
+ x-agent: true
+ file_name:
+ type: string
+ x-agent: true
+ file_size:
+ type: integer
+ x-agent: true
+ file_type:
+ type: string
+ x-agent: true
+ handle:
+ type: string
+ x-agent: true
+ index:
+ type: integer
+ x-agent: true
+ message_id:
+ type: string
+ x-agent: true
+ session_id:
+ type: string
+ x-agent: true
+ session_title:
+ type: string
+ x-agent: true
+ source_path:
+ type: string
+ version_count:
+ type: integer
+ x-agent: true
+ type: object
github_com_Tencent_WeKnora_internal_types.AssistantAccessLevel:
enum:
- read_only
@@ -1490,6 +1545,14 @@ definitions:
MaxAccessLevel is the highest level a member may pick; empty means
AssistantAccessConfirm.
type: object
+ github_com_Tencent_WeKnora_internal_types.AttrInject:
+ enum:
+ - always
+ - on_demand
+ type: string
+ x-enum-varnames:
+ - AttrInjectAlways
+ - AttrInjectOnDemand
github_com_Tencent_WeKnora_internal_types.AttrSpec:
properties:
consumers:
@@ -1500,6 +1563,23 @@ definitions:
description:
description: one line explaining what the attribute measures
type: string
+ inject:
+ allOf:
+ - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.AttrInject'
+ description: |-
+ Inject says whether this attribute is always part of the describe round's
+ standing questions, or only asked when something is going to act on it.
+ An empty value means AttrInjectAlways, so attributes registered before
+ this field existed keep their behaviour.
+ internal:
+ description: |-
+ Internal marks an attribute that steers this pipeline's own scheduling
+ rather than describing what the image holds. Such attributes are still
+ observed and persisted — the values are what justify a scheduling
+ decision after the fact — but they are kept out of the gallery's filter
+ surface, where they would only add noise: no operator wants to filter a
+ library by "how much margin is left around the text".
+ type: boolean
label:
description: human-readable name for the settings panel
type: string
@@ -1759,6 +1839,11 @@ definitions:
AccessLevel is how far runs may change data without asking, capped by
the workspace's assistant ceiling.
x-agent: true
+ active_run_status:
+ description: ActiveRunStatus is projected from live runs and is not persisted.
+ type: string
+ x-agent: true
+ x-agent-response: true
approval_timeout_minutes:
description: |-
ApprovalTimeoutMinutes is how long a run waits for an approval before
@@ -2006,7 +2091,9 @@ definitions:
github_com_Tencent_WeKnora_internal_types.AutomationTrigger:
properties:
at:
- description: At is when a once trigger fires.
+ description: |-
+ At is when a once trigger fires, RFC3339 or a wall-clock time in
+ Timezone, such as "2006-01-02T15:04:05" or "2006-01-02 15:04".
type: string
x-agent: true
expr:
@@ -2024,6 +2111,15 @@ definitions:
type: string
x-agent: true
type: object
+ github_com_Tencent_WeKnora_internal_types.BackgroundInjection:
+ properties:
+ ack_ids:
+ items:
+ type: string
+ type: array
+ content:
+ type: string
+ type: object
github_com_Tencent_WeKnora_internal_types.COSEngineConfig:
properties:
app_id:
@@ -4041,16 +4137,6 @@ definitions:
items:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ImageAttrCondition'
type: array
- on_unobserved:
- description: |-
- OnUnobserved is the OCR decision used when the observation does not
- answer for one of the attributes the policy reads — the attribute is
- absent because the model skipped the line, or because the value it wrote
- was not one of the allowed ones. The default is true: an incomplete
- observation keeps extracting, so a missed block of text costs one extra
- call instead of being lost. Turn it off only with a model reliable enough
- to answer every attribute line.
- type: boolean
type: object
github_com_Tencent_WeKnora_internal_types.ImagePipelineID:
enum:
@@ -4072,7 +4158,10 @@ definitions:
description: |-
ImageActions overrides the built-in attribute→work table (see
DefaultImageActions). A nil value keeps the conservative default: run OCR
- for block text, data visuals, and unobserved images.
+ for block text and data visuals. What to do about an image whose
+ attributes were NOT observed is deliberately not part of this table — it
+ is a scheduling decision, so it belongs to the pipeline that observes
+ (`ocr_on_unobserved` in that pipeline's slot).
image_attrs_enabled:
description: |-
ImageAttrsEnabled turns the attribute-observed image pipeline on for this
@@ -7524,6 +7613,12 @@ definitions:
type: object
github_com_Tencent_WeKnora_internal_types.SandboxCheckpoint:
properties:
+ background_active:
+ description: |-
+ BackgroundActive marks a commit taken while background work was live in
+ the session. The work may have been mid-write, so fork and rewind never
+ roll a workspace back to it.
+ type: boolean
commit_sha:
type: string
committed_at:
@@ -7843,6 +7938,14 @@ definitions:
that reopening the session can restore the original request context to
the chat UI. Stored in the legacy sessions.agent_config JSONB column to
avoid a new migration; the shape used today is `SessionLastRequestState`.
+ owner_auth_source:
+ description: |-
+ OwnerAuthSource records, server-side, how UserID was authenticated when
+ the session was created or its owner first bound (AuthSource*).
+ Per-user sandbox allocation reads it; client input never sets it
+ (CreateSession overwrites). Empty on rows created before the column
+ existed, which means "unknown".
+ type: string
parent_session_id:
description: |-
ParentSessionID names the session this one was forked from. Empty for
@@ -7985,6 +8088,14 @@ definitions:
that reopening the session can restore the original request context to
the chat UI. Stored in the legacy sessions.agent_config JSONB column to
avoid a new migration; the shape used today is `SessionLastRequestState`.
+ owner_auth_source:
+ description: |-
+ OwnerAuthSource records, server-side, how UserID was authenticated when
+ the session was created or its owner first bound (AuthSource*).
+ Per-user sandbox allocation reads it; client input never sets it
+ (CreateSession overwrites). Empty on rows created before the column
+ existed, which means "unknown".
+ type: string
parent_session_id:
description: |-
ParentSessionID names the session this one was forked from. Empty for
@@ -8815,6 +8926,14 @@ definitions:
- TenantRoleViewer
github_com_Tencent_WeKnora_internal_types.TenantSandboxConfig:
properties:
+ allocation_mode:
+ description: |-
+ AllocationMode decides how a session that has not yet used a sandbox
+ of this config is placed: "session" (default) gives it a machine of its
+ own, "user" lets one verified owner's sessions share a machine. A
+ session never changes mode after its first use; see
+ internal/sandbox/allocation.
+ type: string
allow_private_endpoints:
description: |-
AllowPrivateEndpoints permits this workspace config to reach RFC1918 or
@@ -8875,6 +8994,7 @@ definitions:
SkillRolloutNextTurn rebuild on the next chat turn. SkillRolloutNewSession
leaves those sandboxes on the previous image; only sessions that start
afterwards boot the new snapshot.
+ User allocation always keeps existing shared machines, regardless of this setting.
type: string
terminal_idle_disconnect_sec:
description: |-
@@ -8884,6 +9004,12 @@ definitions:
counts keystrokes and PTY output; desktop counts mouse and keyboard.
0 uses the built-in default (15 minutes). Not an identity field.
type: integer
+ user_sandbox_empty_retention_days:
+ description: |-
+ UserSandboxEmptyRetentionDays is how long a user machine with no live
+ session is kept before the reclaim job deletes it. 0 means the default
+ (7); values above 90 are rejected.
+ type: integer
volume_mount:
allOf:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.VolumeMountConfig'
@@ -14286,6 +14412,24 @@ definitions:
required:
- message_id
type: object
+ internal_handler_session.artifactLibraryResponse:
+ properties:
+ data:
+ items:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ArtifactLibraryItem'
+ type: array
+ page:
+ type: integer
+ x-agent: true
+ page_size:
+ type: integer
+ x-agent: true
+ success:
+ type: boolean
+ total:
+ type: integer
+ x-agent: true
+ type: object
internal_handler_session.batchDeleteRequest:
properties:
delete_all:
@@ -15071,32 +15215,49 @@ paths:
in: query
name: keyword
type: string
+ x-agent: true
- description: 逗号分隔的扩展名,如 .pdf,.pptx
in: query
name: file_types
type: string
+ x-agent: true
- description: 页码
in: query
+ minimum: 1
name: page
type: integer
+ x-agent: true
+ x-agent-maximum: "10000"
- description: 每页数量(最大 100)
in: query
+ maximum: 100
+ minimum: 1
name: page_size
type: integer
+ x-agent: true
+ x-agent-maximum: "20"
produces:
- application/json
responses:
"200":
description: OK
schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/internal_handler_session.artifactLibraryResponse'
security:
- Bearer: []
- ApiKeyAuth: []
summary: 列出我的产物
tags:
- 会话
+ x-agent:
+ id: artifact.list
+ risk: read
+ x-agent-hint: Files generated by agents across the user's conversations, newest
+ first. This is the Artifacts library, not the current chat's sandbox. keyword
+ matches file names; file_types is a comma-separated list of extensions such
+ as .pdf,.pptx,.md. Each item has file_name, created_at, session_title and
+ session_id. Do not use generated-file or sandbox tools to answer what is on
+ this page.
/auth/auto-setup:
post:
consumes:
@@ -16013,6 +16174,36 @@ paths:
risk: read
x-agent-hint: Lists an automation's runs, newest first, with status, error and
the start of the answer.
+ /automations/by-session/{session_id}:
+ get:
+ description: 返回这次会话所属的自动化,供会话页跳回
+ parameters:
+ - description: 会话 ID
+ in: path
+ name: session_id
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 自动化
+ schema:
+ allOf:
+ - $ref: '#/definitions/internal_handler.DataResponse'
+ - properties:
+ data:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.Automation'
+ type: object
+ "404":
+ description: 不存在
+ schema:
+ $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
+ security:
+ - Bearer: []
+ summary: 按会话查找自动化
+ tags:
+ - 自动化
/automations/validate-trigger:
post:
consumes:
@@ -25635,6 +25826,74 @@ paths:
summary: Follow an install's agent transcript
tags:
- SandboxConfig
+ /sandbox-configs/{id}/user-sandboxes:
+ get:
+ description: List the config's shared user machines with live session counts
+ and the empty-retention clock.
+ parameters:
+ - description: Sandbox config ID
+ in: path
+ name: id
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: Shared user sandboxes
+ schema:
+ additionalProperties: true
+ type: object
+ "401":
+ description: Unauthorized
+ schema:
+ additionalProperties: true
+ type: object
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: List shared user sandboxes
+ tags:
+ - SandboxConfig
+ /sandbox-configs/{id}/user-sandboxes/{digest}/release:
+ post:
+ description: Delete one shared user machine now; each session gets a fresh machine
+ on next use. Refused while busy.
+ parameters:
+ - description: Sandbox config ID
+ in: path
+ name: id
+ required: true
+ type: string
+ - description: User machine digest
+ in: path
+ name: digest
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: Released
+ schema:
+ additionalProperties: true
+ type: object
+ "401":
+ description: Unauthorized
+ schema:
+ additionalProperties: true
+ type: object
+ "409":
+ description: User sandbox is busy
+ schema:
+ additionalProperties: true
+ type: object
+ security:
+ - Bearer: []
+ - ApiKeyAuth: []
+ summary: Release a shared user sandbox
+ tags:
+ - SandboxConfig
/sessions:
get:
consumes:
diff --git a/frontend/src/utils/pageSnapshot.ts b/frontend/src/utils/pageSnapshot.ts
index c69138940..56a37af2c 100644
--- a/frontend/src/utils/pageSnapshot.ts
+++ b/frontend/src/utils/pageSnapshot.ts
@@ -389,8 +389,13 @@ function roleOf(el: HTMLElement): string {
}
}
+// aria-label is an explicit name. Visible text comes next: a title tooltip
+// such as "预览" must not hide the file name printed inside the control.
+// title is only the name when the control has no text of its own.
function nameOf(el: HTMLElement): string {
- return collapse(el.getAttribute('aria-label') || el.getAttribute('title')) || textOf(el)
+ const aria = collapse(el.getAttribute('aria-label'))
+ if (aria) return aria
+ return textOf(el) || collapse(el.getAttribute('title'))
}
function isPageTab(el: HTMLElement): boolean {
diff --git a/internal/agent/operations/artifacts_test.go b/internal/agent/operations/artifacts_test.go
new file mode 100644
index 000000000..1d0f253b2
--- /dev/null
+++ b/internal/agent/operations/artifacts_test.go
@@ -0,0 +1,46 @@
+package operations
+
+import (
+ "encoding/json"
+ "net/http"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+func TestBuiltinArtifactOperationsAreReadOnly(t *testing.T) {
+ for _, op := range Builtin().All() {
+ if op.Domain() != "artifact" {
+ continue
+ }
+ assert.False(t, op.Risk.Mutates(), op.ID)
+ }
+}
+
+func TestBuiltinArtifactList(t *testing.T) {
+ op, ok := Builtin().Get("artifact.list")
+ require.True(t, ok)
+ assert.Equal(t, RiskRead, op.Risk)
+ assert.Equal(t, "/api/v1/artifacts", op.Route)
+ assert.ElementsMatch(t, []string{"keyword", "file_types", "page", "page_size"}, paramNames(op))
+ size, _ := op.Param("page_size")
+ assert.Equal(t, 20, size.Maximum)
+
+ call, err := op.Build(map[string]json.RawMessage{
+ "keyword": json.RawMessage(`"报告"`), "page_size": json.RawMessage(`10`),
+ })
+ require.NoError(t, err)
+ assert.Equal(t, http.MethodGet, call.Method)
+ assert.Contains(t, call.URI(), "page_size=10")
+
+ assert.JSONEq(t, `{"data":[{"file_name":"报告.docx","file_type":".docx","file_size":1024,
+ "created_at":"2026-10-19T08:00:00Z","session_id":"s1","session_title":"周报",
+ "message_id":"m1","index":0,"version_count":2,"handle":"resource://abc"}],
+ "meta":{"total":1,"page":1,"page_size":10}}`,
+ projectJSON(t, op, `{"success":true,"total":1,"page":1,"page_size":10,"data":[{
+ "file_name":"报告.docx","file_type":".docx","file_size":1024,
+ "created_at":"2026-10-19T08:00:00Z","session_id":"s1","session_title":"周报",
+ "message_id":"m1","index":0,"version_count":2,"handle":"resource://abc",
+ "source_path":"/workspace/output/report.docx"}]}`))
+}
diff --git a/internal/agent/operations/catalog.go b/internal/agent/operations/catalog.go
index 8bd9f0f86..e908d6b68 100644
--- a/internal/agent/operations/catalog.go
+++ b/internal/agent/operations/catalog.go
@@ -314,7 +314,8 @@ var (
// allowedRouteAreas are the first path segments under /api/v1 an operation
// may live in: the user's knowledge content, their agents, the models and
-// MCP services an agent can be bound to, and their own conversations. Every
+// MCP services an agent can be bound to, their conversations, and the
+// files those conversations generated. Every
// other area is refused,
// so an API added later (credentials, integrations, identity, the agent's
// own approval and prompt endpoints) stays unreachable until it is listed
@@ -344,8 +345,9 @@ var allowedRouteAreas = map[string]bool{
// Sandbox configs hold provider credentials; see sandboxSkillsRoute.
"sandbox-configs": true,
// The caller's own conversations, read-only; see readOnlyRouteAreas.
- "sessions": true,
- "messages": true,
+ "sessions": true,
+ "messages": true,
+ "artifacts": true,
}
// readOnlyRouteAreas admit only operations that change nothing. Deleting,
@@ -353,9 +355,10 @@ var allowedRouteAreas = map[string]bool{
// chat itself, and content the assistant reads (documents, past answers)
// must never be able to talk it into erasing history.
var readOnlyRouteAreas = map[string]bool{
- "sessions": true,
- "messages": true,
- "system": true, // Only info and parser-engines are reachable; see parseRoute.
+ "sessions": true,
+ "messages": true,
+ "artifacts": true,
+ "system": true, // Only info and parser-engines are reachable; see parseRoute.
}
// forbiddenRouteSegments are refused anywhere inside an allowed area:
diff --git a/internal/agent/operations/catalog_test.go b/internal/agent/operations/catalog_test.go
index 00dc6d950..3575307e6 100644
--- a/internal/agent/operations/catalog_test.go
+++ b/internal/agent/operations/catalog_test.go
@@ -105,11 +105,17 @@ func TestNewCatalogRejectsUnsafeDeclarations(t *testing.T) {
Params: routeParams("/api/v1/messages/:session_id/:id"),
Target: &Target{Operation: "session.get", Label: "title"},
},
+ "delete an artifact": {
+ ID: "artifact.delete", Summary: "s", Risk: RiskDestructive, Method: http.MethodDelete,
+ Route: "/api/v1/artifacts",
+ Target: &Target{Operation: "artifact.list", Label: "file_name"},
+ },
}
reasons := map[string]string{
- "delete a session": "may only read",
- "stop a session": "may only read",
- "delete a message": "may only read",
+ "delete a session": "may only read",
+ "stop a session": "may only read",
+ "delete a message": "may only read",
+ "delete an artifact": "may only read",
}
// A sandbox config is reachable only for its installed skills, and never
// the installer conversation a user is watching.
diff --git a/internal/agent/tools/operations_test.go b/internal/agent/tools/operations_test.go
index 7b7819e9f..7b1678c9e 100644
--- a/internal/agent/tools/operations_test.go
+++ b/internal/agent/tools/operations_test.go
@@ -669,6 +669,13 @@ func TestFindOperationsDescribesMatches(t *testing.T) {
res, _ = tool.Execute(context.Background(), json.RawMessage(`{"query":"zzz-unmatched"}`))
assert.Contains(t, res.Output, "hint")
+
+ res, err = tool.Execute(context.Background(), json.RawMessage(`{"query":"generated files","domain":"artifact"}`))
+ require.NoError(t, err)
+ require.True(t, res.Success)
+ require.NoError(t, json.Unmarshal([]byte(res.Output), &out))
+ require.Len(t, out.Operations, 1)
+ assert.Equal(t, "artifact.list", out.Operations[0].ID)
}
func TestRunOperationAgentSkillsApproval(t *testing.T) {
diff --git a/internal/handler/session/artifact_library.go b/internal/handler/session/artifact_library.go
index 4f5e71873..117c7db25 100644
--- a/internal/handler/session/artifact_library.go
+++ b/internal/handler/session/artifact_library.go
@@ -10,18 +10,29 @@ import (
"github.com/gin-gonic/gin"
)
+// artifactLibraryResponse is the body of ListArtifactLibrary.
+type artifactLibraryResponse struct {
+ Success bool `json:"success"`
+ Data []*types.ArtifactLibraryItem `json:"data"`
+ Total int64 `json:"total" extensions:"x-agent"`
+ Page int `json:"page" extensions:"x-agent"`
+ PageSize int `json:"page_size" extensions:"x-agent"`
+}
+
// ListArtifactLibrary godoc
// @Summary 列出我的产物
// @Description 跨会话列出当前用户可见会话中技能生成的文件,每个文件只返回最新版本(不含存储 URL)
// @Tags 会话
// @Produce json
-// @Param keyword query string false "按文件名过滤"
-// @Param file_types query string false "逗号分隔的扩展名,如 .pdf,.pptx"
-// @Param page query int false "页码"
-// @Param page_size query int false "每页数量(最大 100)"
-// @Success 200 {object} map[string]interface{}
+// @Param keyword query string false "按文件名过滤" extensions(x-agent)
+// @Param file_types query string false "逗号分隔的扩展名,如 .pdf,.pptx" extensions(x-agent)
+// @Param page query int false "页码" minimum(1) extensions(x-agent,x-agent-maximum=10000)
+// @Param page_size query int false "每页数量(最大 100)" minimum(1) maximum(100) extensions(x-agent,x-agent-maximum=20)
+// @Success 200 {object} artifactLibraryResponse
// @Security Bearer
// @Security ApiKeyAuth
+// @x-agent {"id":"artifact.list","risk":"read"}
+// @x-agent-hint "Files generated by agents across the user's conversations, newest first. This is the Artifacts library, not the current chat's sandbox. keyword matches file names; file_types is a comma-separated list of extensions such as .pdf,.pptx,.md. Each item has file_name, created_at, session_title and session_id. Do not use generated-file or sandbox tools to answer what is on this page."
// @Router /artifacts [get]
//
// Items carry session_id, message_id and index so the client downloads
diff --git a/internal/types/message_artifact.go b/internal/types/message_artifact.go
index d4a1f01d1..f4a89c617 100644
--- a/internal/types/message_artifact.go
+++ b/internal/types/message_artifact.go
@@ -125,18 +125,18 @@ type ArtifactLibraryQuery struct {
// Versions are the artifacts that share a session and sandbox source path:
// regenerating report.pptx three times is one item with VersionCount 3.
type ArtifactLibraryItem struct {
- SessionID string `json:"session_id" gorm:"column:session_id"`
- SessionTitle string `json:"session_title" gorm:"column:session_title"`
- MessageID string `json:"message_id" gorm:"column:message_id"`
- Index int `json:"index" gorm:"column:position"`
+ SessionID string `json:"session_id" gorm:"column:session_id" extensions:"x-agent"`
+ SessionTitle string `json:"session_title" gorm:"column:session_title" extensions:"x-agent"`
+ MessageID string `json:"message_id" gorm:"column:message_id" extensions:"x-agent"`
+ Index int `json:"index" gorm:"column:position" extensions:"x-agent"`
URL string `json:"-" gorm:"column:url"`
- Handle string `json:"handle,omitempty" gorm:"-"`
- FileName string `json:"file_name" gorm:"column:file_name"`
- FileType string `json:"file_type" gorm:"column:file_type"`
- FileSize int64 `json:"file_size" gorm:"column:file_size"`
+ Handle string `json:"handle,omitempty" gorm:"-" extensions:"x-agent"`
+ FileName string `json:"file_name" gorm:"column:file_name" extensions:"x-agent"`
+ FileType string `json:"file_type" gorm:"column:file_type" extensions:"x-agent"`
+ FileSize int64 `json:"file_size" gorm:"column:file_size" extensions:"x-agent"`
SourcePath string `json:"source_path" gorm:"column:source_path"`
- CreatedAt time.Time `json:"created_at" gorm:"column:created_at"`
- VersionCount int `json:"version_count" gorm:"column:version_count"`
+ CreatedAt time.Time `json:"created_at" gorm:"column:created_at" extensions:"x-agent"`
+ VersionCount int `json:"version_count" gorm:"column:version_count" extensions:"x-agent"`
}
// ArtifactRef addresses one artifact row by its business key. The primary key