跳到主要内容

公共数据结构设计

# 公共数据结构设计

修订记录

版本日期修订说明
v0.12026-05-01建立当前设计基线;延续 kunora-wiki 作为 llm-wiki 方案的既有产品封板和工程设计,不推倒重来。

1. 文档目标

本文定义 kunora-wiki 自研模块共享的数据结构字段、必填性、语义和兼容规则。

本文基于:

本文只定义公共数据结构。模块内部临时对象应放在对应模块设计文档中,不进入 common。

2. 通用字段规则

字段类型必填说明
schemaVersionstring持久化和 public contract 必填语义版本或日期版本,MVP 默认 1.0
createdAtstring持久化对象建议必填UTC ISO-8601。
updatedAtstring可选UTC ISO-8601。
runIdRunIdworkflow/report 类对象必填关联一次运行。
requestIdRequestIdAPI response/audit 必填关联一次请求。
errorsErrorObject[]可选标准错误对象,详见后续错误模型文档。

兼容规则:

  • consumer 必须忽略未知可选字段。
  • producer 不得删除已发布 contract 的必填字段,除非版本升级。
  • 枚举新增值是兼容变更,但 consumer 必须有 unknown fallback。
  • 字段名使用 lower camel case。
  • 路径、hash、ID 类型必须复用 05-path-hash-and-id.md

3. 基础类型

类型运行时表示规则
NormalizedPathstring使用 /,无绝对路径,无 ..,具体规则见路径文档。
ContentHashstringsha256:<hex>
DocumentIdstringdoc:<sha256(normalized publishPath)>
RunIdstringrun:<kind>:<yyyyMMddTHHmmssZ>:<short-random>
RequestIdstringreq:<yyyyMMddTHHmmssZ>:<random>
PublishRunIdstringpub:<yyyyMMddTHHmmssZ>:<gitShortSha>:<short-random>
AuditIdstringaudit:<yyyyMMddTHHmmssZ>:<random>
TaskIdstringtask:<source>:<external-or-hash>
DedupeKeystringdedupe:<eventType>:<sha256(canonical payload)>
IdempotencyKeystringidem:<callerId>:<sha256(canonical request payload)>
SiteUrlstring站点相对 URL,以 / 开头。
Anchorstring页面内锚点,可选。

4. 配置结构

4.1 SourceConfig

Owner:ConfigManager。

持久化路径:config/sources.yaml

字段类型必填说明
schemaVersionstring配置 schema 版本。
sourcesSourceEntry[]来源项目列表。

SourceEntry

字段类型必填说明
idstringsource 唯一 ID。
repostringGitHub repo,例如 owner/name
refstring来源 ref,默认建议 docs-publish
sourcePathNormalizedPath来源仓库内文档目录或 glob 根。
publishPathNormalizedPath目标目录,必须位于 publish/**
includestring[]include glob。
excludestring[]exclude glob。
deletePolicyenumsync-if-unmodifiedreport-onlynever
conflictPolicyenumMVP 默认 report-only
enabledboolean默认 true。

校验规则:

  • id 唯一。
  • publishPath 唯一。
  • 不同 publishPath 不能互为父子目录。
  • publishPath 必须以 publish/ 开头。
  • sourcePath 不能指向仓库根目录,除非显式允许。

4.2 PublishConfig

Owner:ConfigManager。

持久化路径:config/publish.yaml

字段类型必填说明
schemaVersionstring配置 schema 版本。
backendenumMVP 为 docusaurus
sitePublishSiteConfig展示站 URL、baseUrl 和路由配置。
managedPathNormalizedPath通常为 publish/
websitePathNormalizedPathDocusaurus 项目路径,MVP 默认 website/
generatedDocsPathNormalizedPathpublish/** 生成的 Docusaurus docs 输入目录,MVP 默认 website/docs/
buildOutputPathNormalizedPath展示构建产物目录,MVP 默认 website/build/
editUrlBasestringGitHub 编辑或 PR 入口基础 URL,不得包含 secret。
cacheWindowSecondsnumber删除页面缓存窗口。

PublishSiteConfig

字段类型必填说明
urlstring展示站正式域名,例如 https://docs.example.com
baseUrlstring站点路径前缀,例如 //wiki/
routeBasePathstringDocusaurus docs 路由根,例如 //docs/

兼容规则:

  • site.url + site.baseUrl + PageManifestEntry.url 必须能组成稳定页面 URL。
  • generatedDocsPath 不得等于 managedPath,避免 Docusaurus 输入目录成为内容事实源。
  • managedPath 必须位于 publish/** 或等于 publish/
  • 旧版顶层 baseUrl 不再作为首选字段;实现阶段如需兼容,只能映射到 site.baseUrl,不得与 site.baseUrl 冲突。

4.3 IndexConfig

Owner:ConfigManager。

持久化路径:config/index.yaml

字段类型必填说明
schemaVersionstring配置 schema 版本。
targetsIndexTargetConfig[]索引目标。

IndexTargetConfig

字段类型必填说明
idstring例如 ragflow-approvedmeilisearch
typeenumragflowmeilisearch
enabledboolean默认 true。
datasetstring条件必填RAGFlow dataset。
indexNamestring条件必填Meilisearch index。
includeQualityStatusstring[]可索引页面状态。

4.4 RagflowConfig

Owner:ConfigManager。

持久化路径:config/ragflow.yaml

字段类型必填说明
schemaVersionstring配置 schema 版本。
endpointRefstringRAGFlow endpoint 引用,不保存明文 secret。
datasetsRagflowDatasetConfig[]可用 dataset。
timeoutSecondsnumber调用超时。
retryobject重试策略引用。

RagflowDatasetConfig

字段类型必填说明
idstring内部 dataset ID。
externalDatasetIdstringRAGFlow dataset ID 或引用。
purposeenumqaindexiterationworking
enabledboolean默认 true。

4.5 ModelPolicy

Owner:ConfigManager。

持久化路径:config/model-policy.yaml

字段类型必填说明
schemaVersionstring配置 schema 版本。
policiesModelPolicyEntry[]按用途定义模型策略。

ModelPolicyEntry

字段类型必填说明
purposeenumansweriterationsummaryclassification
providerstring模型供应商或 adapter ID。
modelstring模型名。
fallbackModelsstring[]降级模型列表。
maxTokensnumber输出 token 上限。
temperaturenumber采样温度。

4.6 AgentAccessConfig

Owner:ConfigManager。

持久化路径:config/agent-access.yaml

字段类型必填说明
schemaVersionstring配置 schema 版本。
agentsAgentPolicy[]agent policy 列表。

AgentPolicy

字段类型必填说明
agentIdstringagent identity。
allowedToolsstring[]允许工具集合。
allowedPathsNormalizedPath[]允许访问路径前缀。
allowedDatasetsstring[]允许 dataset。
writePermissionsstring[]例如 create_feedbackcreate_improvement_task
includeWorkingDocsboolean默认 false。

4.7 ConfigBundle

Owner:ConfigManager。

运行时对象,不直接持久化。

字段类型必填说明
schemaVersionstringbundle schema 版本。
sourcesSourceEntry[]已校验来源配置。
publishPublishConfig已校验发布配置。
indexIndexConfig已校验索引配置。
ragflowRagflowConfig已校验 RAGFlow dataset 和连接引用。
agentAccessAgentAccessConfig已校验 agent access 配置。
modelPolicyModelPolicy已校验模型策略。
configHashContentHashcanonical bundle hash。
warningsstring[]非阻塞配置警告。

4.8 ConfigImpactReport

Owner:ConfigManager。

字段类型必填说明
schemaVersionstringschema 版本。
reportIdRunIdreport run id。
baseConfigHashContentHash变更前配置 hash。
headConfigHashContentHash变更后配置 hash。
impactLevelenumnonelowmediumhighblocking
changedFilesNormalizedPath[]变更配置文件。
changedKeysstring[]变更配置键。
requiresManualReviewboolean是否需要人工确认。
warningsstring[]非阻断警告。
errorsErrorObject[]阻断错误。

5. 工作区结构

5.1 DocumentRecord

Owner:WorkspaceStore。

字段类型必填说明
documentIdDocumentId基于 publishPath 生成。
publishPathNormalizedPathpublish/** 文件路径。
contentHashContentHash规范化 Markdown hash。
titlestring从 frontmatter 或 H1 提取。
frontmatterobject解析后的 frontmatter。
sourceIdstring来源 ID。
sourceProjectstring产品侧展示名或来源项目名。
sourcePathNormalizedPath来源仓库内路径。
sourceRefstring来源 ref。
sourceCommitstring来源 commit。
siteUrlSiteUrl展示 URL。
qualityStatusenum默认 unknown
qaVisibleboolean是否进入正式问答。
indexableboolean是否进入索引。
feedbackOpennumber未关闭反馈数量。
hasSourceConflictboolean是否存在来源同步冲突。
indexStatusenumnot-indexedindexedpartialfailedstale
lastApprovedAtstring最近审批时间,UTC ISO-8601。
relatedIssuesnumber[]关联 GitHub issue。
relatedPullRequestsnumber[]关联 GitHub PR。

qualityStatus MVP 枚举:

  • approved
  • needs-review
  • stale
  • conflict
  • feedback-open
  • unknown

6. 同步结构

6.1 SourceLock

Owner:SyncEngine。

持久化路径:state/source-lock.json

字段类型必填说明
schemaVersionstringschema 版本。
updatedAtstringUTC ISO-8601。
sourcesmap<string, SourceLockEntry>key 为 sourceId。

SourceLockEntry

字段类型必填说明
repostring来源 repo。
refstring来源 ref。
commitstring上次成功同步 commit。
filesmap<NormalizedPath, SourceFileLock>key 为 source repo path。

SourceFileLock

字段类型必填说明
sourceHashContentHash来源文件 hash。
sourcePathNormalizedPath来源文件路径。
publishPathNormalizedPath目标路径。
lastSyncedAtstringUTC ISO-8601。
deletedbooleantombstone 标记。

6.2 SyncChange

Owner:SyncEngine。

字段类型必填说明
sourceIdstring来源 ID。
sourcePathNormalizedPath来源文件路径。
publishPathNormalizedPath目标路径。
actionenum同步动作。
reasonstring机器可读原因。
baseHashContentHashA hash。
sourceHashContentHashB hash。
publishHashContentHashC hash。
conflictTypeenum条件必填action 为 conflict 时必填。
messagestring人类可读说明。

action 枚举:

  • add
  • update
  • delete
  • unchanged
  • keep
  • conflict
  • delete_conflict
  • keep_local
  • report_delete

6.3 SourceChanges

Owner:SyncEngine。

持久化路径:state/source-changes.json

字段类型必填说明
schemaVersionstringschema 版本。
runIdRunIdsync run id。
createdAtstringUTC ISO-8601。
sourcesSourceChangeSet[]按 source 分组。
summarySyncSummary汇总数量。
errorsErrorObject[]同步错误。

SourceChangeSet

字段类型必填说明
sourceIdstring来源 ID。
changesSyncChange[]变更列表。
conflictsSyncChange[]冲突列表,可从 changes 派生但允许冗余。

7. Manifest 结构

7.1 PageManifest

Owner:WorkspaceStore / DisplayBackend Adapter。

持久化路径:state/page-manifest.json

字段类型必填说明
schemaVersionstringschema 版本。
generatedAtstringUTC ISO-8601。
gitCommitstring生成时 Git commit。
pagesPageManifestEntry[]页面列表。

PageManifestEntry

字段类型必填说明
documentIdDocumentId文档 ID。
pathNormalizedPathpublishPath。
urlSiteUrl展示 URL。
titlestring页面标题。
contentHashContentHashMarkdown 内容 hash。
sourceIdstring来源 ID。
sourceProjectstring产品侧展示名或来源项目名。
sourceRefstring来源 ref。
sourceCommitstring来源 commit。
qualityStatusenum页面质量状态。
qaVisibleboolean是否可问答。
indexableboolean是否可索引。
feedbackOpennumber未关闭反馈数量。
hasSourceConflictboolean是否存在来源同步冲突。
indexStatusenumnot-indexedindexedpartialfailedstale
lastApprovedAtstring最近审批时间,UTC ISO-8601。
relatedIssuesnumber[]关联 GitHub issue。
relatedPullRequestsnumber[]关联 GitHub PR。
editContextEditContext编辑入口上下文。

7.2 PublishImpactReport

Owner:DisplayBackend Adapter / ReviewBridge。

字段类型必填说明
schemaVersionstringschema 版本。
reportIdRunIdreport run id。
publishRunIdPublishRunId发布 run id,PR dry-run 时可为空。
baseRefstringbase ref。
headRefstringhead ref。
changedPagesChangedPage[]影响页面。
buildBuildSummary构建 dry-run 结果。
errorsErrorObject[]错误列表。

ChangedPage

字段类型必填说明
pathNormalizedPath页面路径。
actionenumaddupdatedeleterename
urlSiteUrl页面 URL。
sourceProjectstring来源项目。
affectedIndexesstring[]受影响索引。
relatedIssuesnumber[]关联 issue。

7.3 EditContext

Owner:WorkspaceStore / DisplayBackend Adapter。

EditContext 是 Docusaurus 编辑入口、Issue 创建和 PR 模板使用的页面上下文。它不是内容事实源,只从 Git、PageManifest、Issue/PR 关系和配置派生。

字段类型必填说明
pagePathNormalizedPath页面路径。
editUrlstringGitHub 编辑或 PR 入口 URL。
sourceProjectstring来源项目展示名。
sourceRefstring来源 ref。
sourceCommitstring来源 commit。
lastApprovedCommitstring最近审批 commit。
relatedPagesPageRef[]相关页面。
relatedIssuesnumber[]关联 issue。
relatedPullRequestsnumber[]关联 PR。
qualityStatusenum页面质量状态。
expectedChangeIntentenumfixaddrestructureupdate-version

7.4 PublishManifest

Owner:DisplayBackend Adapter。

持久化路径:state/publish-manifest.json

字段类型必填说明
schemaVersionstringschema 版本。
publishRunIdPublishRunId发布 run id。
publishedAtstringUTC ISO-8601。
gitCommitstring发布读取的 commit。
pagesPublishPage[]发布页面。

PublishPage

字段类型必填说明
documentIdDocumentId文档 ID。
pathNormalizedPathpublishPath。
contentHashContentHashMarkdown 内容 hash。
urlSiteUrl展示 URL。
qualityStatusenum页面质量状态。
qaVisibleboolean是否可问答。
indexableboolean是否可索引。

7.5 SiteManifest

Owner:DisplayBackend Adapter。

持久化路径:state/site-manifest.json

字段类型必填说明
schemaVersionstringschema 版本。
publishRunIdPublishRunId发布 run id。
publishedAtstringUTC ISO-8601。
gitCommitstring构建来源 commit。
pagesSitePage[]站点页面。

SitePage

字段类型必填说明
documentIdDocumentId文档 ID。
pathNormalizedPathpublishPath。
urlSiteUrl展示 URL。
sourceHashContentHash对应 publish contentHash。
renderedHashContentHash渲染产物 hash。
statusenumpublishedmissingredirectedfailed
httpStatusnumberHTTP 状态。
expectedStatusnumber期望 HTTP 状态。
redirectTargetSiteUrl受控重定向目标。
cacheValidUntilstringUTC ISO-8601。

7.6 IndexManifest

Owner:Index Adapter。

持久化路径:state/index-manifest.json

字段类型必填说明
schemaVersionstringschema 版本。
publishRunIdPublishRunId发布 run id。
indexedAtstringUTC ISO-8601。
gitCommitstring索引来源 commit。
targetsmap<string, IndexTargetStatus>索引目标状态。

IndexTargetStatus

字段类型必填说明
statusenumpassedfailedpartialskipped
documentsnumber成功处理文档数。
failedDocumentsnumber失败文档数。
documentIdsDocumentId[]成功处理的文档 ID。
failedDocumentIdsDocumentId[]失败文档 ID。
attemptnumber第几次尝试。
startedAtstringUTC ISO-8601。
finishedAtstringUTC ISO-8601。
errorErrorObject失败原因。
errorsErrorObject[]target 错误列表。

8. Review 结构

8.1 ReviewReport

Owner:ReviewBridge。

字段类型必填说明
schemaVersionstringschema 版本。
runIdRunIdreview run id。
reviewTypeenumsyncreleaseagentconfig
titlestringreview 标题。
summarystring人类可读摘要。
statusenumpassedfailedpartialskipped
blockingItemsReviewItem[]阻断项。
warningsReviewItem[]警告项。
linksLinkRef[]PR、workflow、artifact 链接。
errorsErrorObject[]错误列表。

8.2 CheckReport

Owner:ReviewBridge。

字段类型必填说明
schemaVersionstringschema 版本。
runIdRunIdcheck run id。
namestringcheck 名称。
statusenumpassedfailedpartialskipped
summarystringcheck 摘要。
blockingItemsReviewItem[]阻断项。
warningsReviewItem[]警告项。
sourceReportsLinkRef[]上游报告链接。
linksLinkRef[]外部链接。
errorsErrorObject[]错误列表。

ReviewItem

字段类型必填说明
codestring机器可读 item code。
messagestring人类可读说明。
pathNormalizedPath关联路径。
severityenuminfowarningerrorfatal

LinkRef

字段类型必填说明
labelstring链接标签。
urlstringURL。
kindenumprworkflowartifactissuedoc

9. 索引结构

9.1 IndexDocument

Owner:Index Adapter。

字段类型必填说明
documentIdDocumentId稳定文档 ID。
pathNormalizedPathpublishPath。
urlSiteUrl展示 URL。
titlestring标题。
contentstring可索引正文。
contentHashContentHash内容 hash。
sourceIdstring来源 ID。
qualityStatusenum页面质量状态。
tagsstring[]标签。
metadataobjectadapter 可消费的扩展元数据。

9.2 SearchResult

Owner:Index Adapter / SearchIndexClient。

字段类型必填说明
documentIdDocumentId文档 ID。
pathNormalizedPathpublishPath。
urlSiteUrl展示 URL。
titlestring标题。
snippetstring命中片段。
scorenumber搜索得分。
sourceenummeilisearchragflowworkspace

10. 访问结构

10.1 Caller

字段类型必填说明
typeenumhumanagentsystem
idstring调用者 ID,匿名用户可使用稳定匿名 ID。
purposestring调用目的。

10.2 Scope

字段类型必填说明
projectsstring[]项目范围。
pathsNormalizedPath[]路径范围。
versionenum/stringmainworking 或具体版本。
includeWorkingDocsboolean默认 false。
datasetsstring[]允许 dataset。

规则:调用方声明的 scope 只是请求,授权事实来自服务端 policy。

10.3 Citation

字段类型必填说明
documentIdDocumentId推荐提供。
pathNormalizedPath引用页面路径。
urlSiteUrl回跳 URL。
titlestring页面标题。
anchorAnchor页面锚点。
chunkIdstring自研 chunk ID。
externalChunkIdstringRAGFlow 等外部 chunk ID。
sourceProjectstring来源项目。
versionstring引用版本。

PageRef

字段类型必填说明
documentIdDocumentId文档 ID。
pathNormalizedPath页面路径。
urlSiteUrl展示 URL。
titlestring页面标题。
contentHashContentHash页面内容 hash。

SuggestedAction

字段类型必填说明
typeenumcreate_feedbackcreate_improvement_taskretry_laternarrow_scope
labelstring面向用户或 agent 的动作说明。
payloadobject可用于后续受控调用的输入草案。

QualitySignal

字段类型必填说明
pathNormalizedPath关联页面路径。
signalstring质量信号名称。
severityenuminfowarningerror
messagestring人类可读说明。

10.4 AnswerRequest

Owner:Answer API。

字段类型必填说明
schemaVersionstringschema 版本。
requestIdRequestId可由客户端传入;服务端可生成。
callerCaller调用者。
scopeScope请求范围。
questionstring问题。
requireCitationsboolean默认 true。
sessionIdstring多轮会话 ID。

10.5 AnswerResult

Owner:Answer API。

字段类型必填说明
schemaVersionstringschema 版本。
requestIdRequestId请求 ID。
answerstring答案正文。
summarystring简短摘要。
citationsCitation[]引用列表,可为空但无答案时必须说明原因。
confidenceenumhighmediumlow
noAnswerReasonstring无答案原因。
relatedPagesPageRef[]相关页面。
actionsSuggestedAction[]反馈或改进动作。
auditAuditRef审计摘要。
errorsErrorObject[]错误列表。

10.6 AnswerSession

Owner:Answer API。

字段类型必填说明
schemaVersionstringschema 版本。
sessionIdstring会话 ID。
sessionTokenHashstringsession token 的 hash,不保存明文 token。
callerCaller会话创建者。
scopeScope会话授权 scope,不能被后续请求扩大。
createdAtstringUTC ISO-8601。
expiresAtstringUTC ISO-8601。
turnsAnswerTurn[]会话轮次。
limitsAnswerSessionLimits会话限制。
summarystring会话历史摘要。

AnswerTurn

字段类型必填说明
requestIdRequestId本轮请求 ID。
questionstring本轮问题。
answerstring本轮答案。
citationsCitation[]本轮引用,可为空但必须有无答案原因。
confidenceenumhighmediumlow
noAnswerReasonstring无答案原因。
createdAtstringUTC ISO-8601。

AnswerSessionLimits

字段类型必填说明
maxTurnsnumber最大轮次。
maxContextTokensnumber最大上下文 token。

10.7 AgentToolRequest

Owner:Agent Access API。

字段类型必填说明
schemaVersionstringschema 版本。
requestIdRequestId可选客户端传入。
toolenumsearchaskget_pageget_contextcreate_feedbackcreate_improvement_task
callerCaller必须为 agent 或 system。
scopeScope请求 scope。
inputobject工具输入,按 tool 类型校验。
idempotencyKeyIdempotencyKey写入工具建议必填请求级幂等键。

10.8 AgentToolResult

Owner:Agent Access API。

字段类型必填说明
schemaVersionstringschema 版本。
requestIdRequestId请求 ID。
toolstring工具名。
statusenumpassedfailedpartial
resultobject工具结果。
auditAuditRef审计摘要。
errorsErrorObject[]错误列表。

10.9 ContextPack

Owner:Agent Access API。

字段类型必填说明
schemaVersionstringschema 版本。
requestIdRequestId请求 ID。
scopeScope实际授权后的 scope。
pagesPageRef[]页面引用。
citationsCitation[]片段引用。
qualitySignalsQualitySignal[]质量信号。
limitsobjecttoken、页面数量等限制。

11. 反馈与任务结构

11.1 FeedbackRequest

Owner:Agent Access API。

字段类型必填说明
schemaVersionstringschema 版本。
eventTypeenumqa_no_answerqa_low_confidencesearch_no_resultpage_feedback 等。
dedupeKeyDedupeKey去重键。
idempotencyKeyIdempotencyKey请求级幂等。
callerCaller反馈来源。
scopeScope反馈范围。
questionstring原问题。
messagestring反馈说明。
citationsCitation[]相关引用。

11.2 ImprovementTaskRequest

Owner:Agent Access API。

字段类型必填说明
schemaVersionstringschema 版本。
dedupeKeyDedupeKey改进任务去重键。
callerCaller创建者。
scopeScope任务范围。
goalstring改进目标。
evidenceCitation[]证据引用。
relatedFeedbackDedupeKey[]关联反馈。

12. 迭代结构

12.1 IterationTask

Owner:AgentBridge。

字段类型必填说明
schemaVersionstringschema 版本。
taskIdTaskId任务 ID。
triggerenumissuemanualquality-event
goalstring任务目标。
scopeScope任务授权范围。
baseIterationBase任务基线。
constraintsIterationConstraints约束。
relatedIssuenumberGitHub issue number。

IterationBase

字段类型必填说明
gitCommitstring创建任务时 commit。
filesmap<NormalizedPath, ContentHash>文件基线 hash。

IterationConstraints

字段类型必填说明
allowedActionsstring[]addupdatedelete
requireCitationsboolean是否要求证据。
allowDeleteboolean是否允许删除。

12.2 RagflowIterationResult

Owner:AgentBridge。

字段类型必填说明
summarystring输出摘要。
changesIterationChange[]建议变更。
riskenumlowmediumhigh
requiresHumanReviewboolean必须为 true,MVP 不自动发布。

IterationChange

字段类型必填说明
pathNormalizedPath目标路径。
actionenumaddupdatedelete
baseHashContentHash条件必填update/delete 必填。
reasonstring修改原因。
evidenceCitation[]条件必填requireCitations 时必填。
modeenumpatchwhole-file
draftContentstring条件必填whole-file 或 add 必填。
patchstring条件必填patch 模式必填。
overwriteboolean默认 false。

12.3 AgentBridgeReport

Owner:AgentBridge。

字段类型必填说明
schemaVersionstringschema 版本。
taskIdTaskId任务 ID。
runIdRunIdagent run id。
statusenumpassedfailedpartial
branchstringRelease 分支。
pullRequestnumberPR number。
validatedChangesnumber通过校验数量。
rejectedChangesRejectedChange[]被拒绝的 change。
errorsErrorObject[]错误列表。

RejectedChange

字段类型必填说明
pathNormalizedPath被拒绝变更路径。
actionenum原始 action。
reasonstring拒绝原因。
errorErrorObject标准错误。
baseHashContentHash任务基线 hash。
currentHashContentHash当前 hash。

13. 审计与错误引用结构

13.1 AuditRef

字段类型必填说明
requestIdRequestId条件必填API 调用必填。
runIdRunId条件必填workflow 必填。
callerstringcaller id。
scopestring简化 scope 表示。

13.2 AuditEvent

字段类型必填说明
auditIdAuditId审计事件 ID。
requestIdRequestIdAPI 请求 ID。
runIdRunIdworkflow run ID。
callerCaller调用者。
scopeScope调用范围。
actionstring操作。
resultenumpassedfaileddeniedpartial
timestampstringUTC ISO-8601。
errorErrorObject错误。

13.3 ErrorObject

完整错误码和状态模型由 04-error-and-status-model.md 定义。本文先固定最小结构。

字段类型必填说明
codestring机器可读错误码。
messagestring人类可读说明。
retryableboolean是否可重试。
detailsobject结构化上下文。

14. 结构变更规则

  • 新增可选字段:兼容。
  • 新增必填字段:破坏性变更,必须升级 schemaVersion。
  • 删除字段:破坏性变更,必须先 deprecated。
  • 枚举新增值:兼容,但 consumer 必须有 unknown fallback。
  • 枚举删除或重命名:破坏性变更。
  • 字段语义变化:破坏性变更,即使字段名不变。

15. 当前状态

本文已覆盖 contract map 中首版需要稳定的公共数据结构。后续进入实现前,应为本文的 Public Contract、持久化 Internal Contract 和 Adapter Contract 建立 schema、fixture 和 contract tests。

对此页面有疑问?

问答功能将在后续接入 Answer API。当前可通过页面底部的反馈链接提交问题。

页面来源草稿
来源项目kunora-wiki
分支docs-publish
路径technology/components/kunora-wiki/development/common/03-data-structures.md