mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Injected context reached the transcript as one anonymous shape whose expanded body was the whole message serialized as inline JSON, so the escaping collapsed the only readable part — the model-facing prose — into a single line. `MessageSource` gains an optional producer-declared `form`, a small semantic vocabulary of information shapes independent of `kind`: kind says who produced the context, form says what shape it is, so several producers may share one presentation. Two values ship. `instructions` (workspace-context) lists the reconciled files above their text and keeps the `<system-reminder>` framing verbatim, because the framing is part of what the model read. `catalog` moves dsh-tool-skill off the shared plugin kind onto a `skill-catalog` source carrying the published name/description entries, and the body lists those instead of re-parsing `<available_skills>` out of the prose. Catalog identity moves with it: the republish digest now covers the durable entries, deleting the text-slicing that recovered them from a logged message. Everything else renders the opaque body — the model-facing text with its real line breaks, then the remaining provenance as fields. That is the documented default, not a leftover: a resumed, forked, or foreign log must render whether or not its producer is mounted here, which is why the classification lives in the durable source rather than a client-side table keyed by producer.
85 lines
4.1 KiB
TypeScript
85 lines
4.1 KiB
TypeScript
/**
|
||
* Context provenance projection: the role and producer name a transcript row
|
||
* shows for one logged non-user message, read from the durable source alone.
|
||
*/
|
||
|
||
import { describe, expect, it } from 'vitest'
|
||
import { contextForm, contextProvenance } from '../src/client/sessions/context-provenance.ts'
|
||
|
||
describe('contextProvenance', () => {
|
||
it('names a plugin producer by its logged plugin id', () => {
|
||
expect(contextProvenance({ kind: 'plugin', plugin: 'dsh-tool-skill' }))
|
||
.toEqual({ role: 'inject', label: 'dsh-tool-skill' })
|
||
})
|
||
|
||
it('names workspace instructions by the files they reconciled, deduplicated in first-seen order', () => {
|
||
expect(contextProvenance({
|
||
kind: 'workspace-instructions',
|
||
baseline: true,
|
||
changes: [
|
||
{ action: 'set', scope: '. |