hzopc1031/dsh-plugins--packages-dsh-content-evidence ↗★ 0
dsh-content-evidence
Evidence-based content workbench for DeepSeek Harness (in development)
安裝
npx -p @deepseek-ai/dsh dsh plugin --profile web add 'github:hzopc1031/dsh-plugins#40eabb1d4b6f7dc33d7ba94ad7a28821f1cd9995&path:packages/dsh-content-evidence'說明文件
閱讀完整 README ↗dsh-content-evidence
内容证据工作台:从网页侧栏管理主题、材料、实验记录、证据引用、四平台草稿、复核与本地导出,并提供四个本地工具及受限会话工作台。不会自动发布内容。
Evidence-based content workbench with a web sidebar and main panel. Materials, experiments, shared facts, editable four-platform drafts, compliance reports, safe local exports and manual published-link backfill use the same Host Remote API as the four local tools and restricted workbench. Nothing is published automatically.
Requires Node.js >=22 and DSH >=0.2.1-rc.5 while idle, confirm confinement, then ask the model to read the evidence and save all four platform drafts with AI labels and unsourced facts marked 待核实. Use the Host's native tool executor. Run /content-evidence leave when finished and refresh the panel. The UI does not start a session, select a model, visit platforms or offer publish/login actions.
The client is prebuilt and committed as dist/client.js, exported at ./client, and mounts main plus sidebar.panellist through ctx.slots. It mounts the generated Remote contribution before its namespace-dependent view activates. All Host reads/writes go through ctx.remote.contentEvidence; there are no direct HTTP, filesystem or model calls in the client.
Live loading was verified on this Linux box with the installed DSH 0.2.2-rc.1 CLI and source fcc0ad46, using a disposable web profile and headless Chrome/Playwright. Browser acceptance covered capture, inert HTML preview, shared evidence, all four platform editors, review invalidation, local exports, manual-link backfill, reload and a fresh Host process, at ordinary and narrow widths. No live model request was possible in the task 8 check: the Host model catalog was empty, the default deepseek-official/deepseek-flash API-key reference was unconfigured, and the account was signed out. This was checked through Host status APIs that expose no secret values; no credentials were added or requested. Model-assisted rewriting remains an unverified manual confined-session workflow. The prerequisite, confinement confirmation and four-platform save prompt are now visible without expanding help. The final polish smoke also loaded the notice in a disposable installed Host and exported a synthetic topic with both /proc/self/fd and /dev/fd forced unavailable on Linux; this is not a native macOS/Windows run or a live model rewrite.
Data flow / 数据流
UI callers send user-supplied records through DSH Remote; the four tools call the same Host service locally. The store writes workspace.json and copies material bytes into materials/ under $DSH_HOME/content-evidence, or ~/.dsh/content-evidence when DSH_HOME is unset. Config dataDir overrides this root; an absolute path is recommended. Paths inside the installed plugin package are rejected, including resolved symlinks.
Each topic stores its one-line idea, source URLs, material metadata and hashes, commands and terminal output, versions, test conditions, evidence claims, four draft slots (x, xiaohongshu, douyin, weixin-video), review state, export history and manually entered published links. Claims without a reference are marked 待核实; 有来源 means a reference exists, not that its contents were independently verified. Claims may reference a source, material or experiment in the same topic.
材料通过 base64 上传并复制到数据目录,文件名只作展示;不会执行材料、脚本或命令,也不会访问来源链接。内容中的指令仅作为数据保存。插件目前不会调用模型或访问社交平台。
Material uploads use base64 bytes and a display filename, never an arbitrary Host file path. Uploads are limited to 10 MiB each; the JSON workspace is limited to 16 MiB. Source links accept HTTP(S) without embedded credentials. Materials and commands remain inert data; source URLs are not fetched. No model is called by this implementation.
Writes use temporary files, file synchronization, atomic rename and directory synchronization. Changes are serialized across store instances in one process; use one DSH Host process per data directory. Corrupt or unsupported state is refused without overwriting it. An interrupted material capture may leave an unreferenced copy; existing materials are never pruned automatically. Plugin disposal, upgrade and uninstall do not delete user data. Keep a backup of the whole data directory.
Host API / 本地服务
The plugin registers ctx.contentEvidence as a TypertRemoteService, with namespace contentEvidence and these @Remote methods:
| Methods | Behavior |
|---|---|
listTopics, createTopic, readEvidence | List, create and read topic records |
addSource, captureMaterial, readMaterial | Save source links, copy/read inert material bytes |
logExperiment, saveClaim | Save experiment records and source-linked claims |
saveDraft | Save a complete platform shape with selected claims, expected revision and evidence hash; changed copy resets review to pending |
reviewDraft | Check the current revision and store a structured report bound to its content hash |
backfillPublishedLink | Append a manually supplied HTTP(S) URL per platform, with a timestamp, without contacting the platform |
requestExport | Export the saved platform draft and topic evidence to an existing user-chosen absolute directory; return a completed record and relative file list |
Domain failures use RemoteError codes content-evidence/invalid-input, content-evidence/not-found, content-evidence/corrupt-store, content-evidence/conflict and content-evidence/export-unsupported. Other failures use the gateway's standard handling. All Remote methods accept a final carrier AbortSignal.
./typert ships the generated Host contribution for DSH's Typert Loader. ./remote ships the strict client contribution and method types; ./types exports the record vocabulary. The browser client mounts the contribution via ctx.remote.$mount() and its view injects remote and remote.contentEvidence. /content-evidence returns status without recording command arguments.
Tools and restricted workbench / 受限工具
Only these four tools are registered:
| Tool | Behavior |
|---|---|
content_evidence_capture_material | Copy complete base64 material bytes; optional source UUID; no file-path reads or URL fetching |
content_evidence_read_evidence | Return the topic fact base and optional material bytes; text/* material content is also returned verbatim as data |
content_evidence_save_draft | Save a complete platform shape from the shared fact base with revision/evidence checks; changed copy invalidates review |
content_evidence_export_draft | Export Markdown, text, citations, copied materials, or all, inside a new folder in the user-chosen directory |
Create a topic in the web UI or through the Host API, then use /content-evidence workbench in its session before asking the host model to work on it. This command enables confinement without starting a model turn or changing model configuration. /content-evidence leave explicitly ends confinement. Entry and leave require an idle agent; a running task keeps its guard. These commands do not publish anything.
The Host-local exported await enterWorkbench(pluginCtx, agent, topicId, signal) is the Host-local entry point for session orchestration. It validates the topic and idle agent state, then returns an idempotent disposer. Call it before the topic's first model turn, pass the plugin-owned context, and retain confinement until the task has settled. It is not a Remote method and does not accept an agent from material content.
agent.ctx.tools.restrict({ allow: toolNames }) hides inherited capabilities. agent.ctx.tools.guard(...) also denies scope-local and descendant calls outside the four-tool allowlist, rejects names containing post/publish/login/upload-to-platform patterns, and binds calls to the selected topic. Other sessions keep their tools. Leave, agent disposal and plugin disposal remove confinement. No platform publishing, login, arbitrary shell, browser or network-write tool is registered. The guard also denies the run_code transport; use the host's native tool executor for workbench sessions.
Source titles, URLs, commands, output and material text remain inert data. Read results identify evidence as untrusted; the plugin never turns XML/JSON instructions into tool dispatch, deferred instructions or model requests. This does not claim that a future model cannot be influenced by text: confinement must remain active throughout that model task.
Draft saves accept a complete explicit artifact after successful generation or editing, not streaming chunks or failed model output. They use the host model in the already confined session; this plugin does not start a model request or configure a separate model.
Shared drafts and review / 共享事实与复核
readEvidence(topicId) returns the shared topic plus evidenceHash. saveDraft(topicId, target, input) and the save tool now require this structured input; the old plain-text save argument is no longer accepted:
body: one of the platform shapes below.claimIds: existing claim UUIDs from that topic, shared across platform versions.expectedRevision: the draft revision just read, or0for a new slot.evidenceHash: the exact fact-base hash just read.
| Platform | Body shape |
|---|---|
| X single | { kind: 'x-single', post: string } |
| X thread | { kind: 'x-thread', posts: string[] } |
| 小红书 | { kind: 'xiaohongshu', title: string, body: string, cards: string[] } |
| 抖音 | { kind: 'douyin', voiceover: string, shots: string[] } |
| 视频号 | { kind: 'weixin-video', voiceover: string, shots: string[] } |
Copy fields and arrays must be nonempty; each array has at most 100 entries. The store retains both the editable body and rendered content, with a citation section derived only from the selected stored claims. Unreferenced claims remain 待核实 and fail citation review; a draft with no selected facts also remains 待核实. A source, material or experiment reference means evidence was supplied, not independently verified.
Saves reject unknown claim UUIDs, HTTP(S) citation URLs absent from selected claims' stored sources, and digit tokens absent from selected claim text. They never create sources or numbers. This is a conservative literal check: add intended numeric facts to the evidence sheet first, including version numbers and numeric labels. It cannot establish semantic support, verify units, detect written-out numbers, or prove that a paraphrase follows from a source. Human fact checking remains necessary; unrelated facts sharing a number are not proof.
Revision and evidence comparisons run inside the same serialized atomic mutation as the write. A stale completion or retry receives content-evidence/conflict with the current revision and evidence hash. Re-read and reconcile before another save; do not blindly replay old output. Invalid inputs, rejected stale saves and cancellation before snapshot commit preserve the previous artifact. Concurrent saves against the same revision have one winner. complete means a complete saved artifact, not review approval.
Call reviewDraft(topicId, target, expectedRevision) through the Host/Remote API for review. It returns the draft with review.status, contentHash, reviewedAt and findings containing code, location, excerpt and recommended minimum fix. Locations name copy fields/array entries and use zero-based UTF-16 offsets after @. Findings cover:
- Missing explicit AI label (
AI 生成,人工智能生成, orAI-generated): add a clear reminder and manually confirm the publishing platform's label requirements. - Small built-in editorial sensitive-term scan:
翻墙,代开发票,刷单,买粉. - Absolute wording/promises:
百分之百,100%/100%,绝对,保证,包赚,稳赚,零风险,全网第一,永远,最佳,最强; English whole-wordguarantee/guaranteed,always,never,risk-free/risk free,best(case insensitive). - Missing source references, an outdated evidence snapshot, or a legacy unstructured draft.
There is no official sensitive-word corpus in this package. These small patterns are editorial reminders, can produce false positives, and do not certify regulatory compliance. Config extraSensitiveTerms: string[] adds up to 100 literal, case-insensitive terms of at most 100 characters each; terms are escaped and never treated as regex patterns. All findings require a fix before the automated report can pass. Even a passed report re