2026-08-04 17:44:18 +08:00
|
|
|
/**
|
|
|
|
|
* 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'
|
2026-08-05 12:15:03 +08:00
|
|
|
import { contextForm, contextProvenance } from '../src/client/sessions/context-provenance.ts'
|
2026-08-04 17:44:18 +08:00
|
|
|
|
|
|
|
|
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: '. |