@stackstackstack/dsh-agent-instructions 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,23 @@
1
+ //#region lib/types/invariant.js
2
+ /**
3
+ * Package-owned invariant companion for `@stackstackstack/dsh-agent-instructions`.
4
+ * @module @stackstackstack/dsh-agent-instructions/invariant
5
+ */
6
+ const PACKAGE_NAME = "@stackstackstack/dsh-agent-instructions";
7
+ /** Cordis companion plugin name. */
8
+ const name = "workspace-context-invariant";
9
+ /** Service required before the companion can reserve package ownership. */
10
+ const inject = ["invariants"];
11
+ /**
12
+ * No runtime invariant: replay intentionally tolerates unknown or malformed workspace sources,
13
+ * while focused pipeline tests own its private pending/cache state transitions.
14
+ */
15
+ const install = () => {};
16
+ /**
17
+ * Register this package's invariant companion.
18
+ * @param ctx - Cordis context carrying the invariant service.
19
+ * @returns the installed registration's disposer after setup succeeds.
20
+ */
21
+ const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
22
+ //#endregion
23
+ export { apply, inject, name };
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Configuration normalization for workspace instruction discovery and rendering.
3
+ *
4
+ * @module @stackstackstack/dsh-agent-instructions/config
5
+ */
6
+ import z from '@deepseek-ai/schemastery';
7
+ /** User-facing workspace instruction loader configuration. */
8
+ export interface Config {
9
+ /** Harness home containing the fixed user-global `AGENTS.md`; defaults to `$DSH_HOME` or `~/.dsh`. */
10
+ dshHome?: string;
11
+ /** Directory entries that identify the project root while walking upward from the session cwd. */
12
+ projectRootMarkers?: string[];
13
+ /** UTF-8 byte cap for one rendered baseline or dynamic batch; non-positive or non-finite disables loading. */
14
+ maxBytes: number;
15
+ /** Maximum UTF-8 bytes read from one instruction file; larger files are ignored. */
16
+ maxSourceBytes?: number;
17
+ /** Maximum UTF-8 bytes read across one baseline or dynamic reconciliation batch. */
18
+ maxTotalSourceBytes?: number;
19
+ /**
20
+ * Ordered same-directory project candidates; every existing file loads, with
21
+ * per-directory trimmed-content duplicates collapsed to the earliest candidate.
22
+ */
23
+ instructionFileCandidates?: string[];
24
+ /**
25
+ * Ordered same-directory local-overlay candidates loaded after the base files
26
+ * under the same per-directory trimmed-content dedup; empty disables the overlay.
27
+ */
28
+ localInstructionFileCandidates?: string[];
29
+ }
30
+ export declare const Config: z<Config>;
31
+ /** Normalized instruction discovery configuration. */
32
+ export interface ResolvedDiscoveryConfig {
33
+ dshHome: string;
34
+ projectRootMarkers: string[];
35
+ instructionFileCandidates: string[];
36
+ localInstructionFileCandidates: string[];
37
+ }
38
+ /** Normalized configuration used by discovery and reconciliation. */
39
+ export interface ResolvedConfig extends ResolvedDiscoveryConfig {
40
+ maxBytes: number;
41
+ maxSourceBytes: number;
42
+ maxTotalSourceBytes: number;
43
+ }
44
+ /**
45
+ * Identify the discovery, precedence, and budget semantics of one baseline.
46
+ * @param config - normalized plugin configuration.
47
+ * @param cwd - absolute session working directory.
48
+ * @param projectRoot - project root selected for the current baseline.
49
+ * @returns stable serialized identity for compatibility checks on resume.
50
+ */
51
+ export declare function workspaceBaselineIdentity(config: ResolvedConfig, cwd: string, projectRoot: string): string;
52
+ /**
53
+ * Resolve defaults, the harness home, and valid same-directory candidates.
54
+ * @param config - user-facing plugin configuration.
55
+ * @returns normalized runtime configuration.
56
+ */
57
+ export declare function resolveConfig(config: Config): ResolvedConfig;
58
+ /**
59
+ * Resolve the subset of configuration used before instruction content is rendered.
60
+ * @param config - optional discovery controls.
61
+ * @returns normalized home, root markers, and instruction candidates.
62
+ */
63
+ export declare function resolveDiscoveryConfig(config: Pick<Config, 'dshHome' | 'projectRootMarkers' | 'instructionFileCandidates' | 'localInstructionFileCandidates'>): ResolvedDiscoveryConfig;
64
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Content identity for workspace instruction duplicate suppression.
3
+ *
4
+ * @module @stackstackstack/dsh-agent-instructions/digest
5
+ */
6
+ /**
7
+ * Compute the content identity used across instruction loading and session state.
8
+ * @param content - exact UTF-8 instruction text.
9
+ * @returns lowercase SHA-1 digest in hexadecimal form.
10
+ */
11
+ export declare function instructionContentSha1(content: string): string;
12
+ /**
13
+ * Compute the whitespace-insensitive identity used for per-directory duplicate
14
+ * suppression. Leading and trailing whitespace is trimmed before hashing so a
15
+ * symlinked or byte-copied sibling that differs only by surrounding whitespace
16
+ * still collapses to a single rendered file.
17
+ * @param content - exact UTF-8 instruction text.
18
+ * @returns SHA-1 digest of the trimmed content.
19
+ */
20
+ export declare function trimmedInstructionDigest(content: string): string;
21
+ //# sourceMappingURL=digest.d.ts.map
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Instruction-file discovery and bounded, abort-aware provider reads.
3
+ *
4
+ * @module @stackstackstack/dsh-agent-instructions/files
5
+ */
6
+ import type { FileSystem, FsTarget, FsVersion } from '@stackstackstack/dsh-fs';
7
+ import { type ResolvedConfig } from './config.ts';
8
+ import { type RenderedWorkspaceContext } from './render.ts';
9
+ /** An instruction candidate identified by absolute and model-facing paths. */
10
+ export interface InstructionFile {
11
+ absolutePath: string;
12
+ displayPath: string;
13
+ }
14
+ /** An instruction file whose UTF-8 content was read successfully. */
15
+ export interface LoadedInstructionFile extends InstructionFile {
16
+ content: string;
17
+ /** Provider freshness token when the file was loaded through `ctx.fs`. */
18
+ version?: FsVersion;
19
+ }
20
+ /** Provider metadata for a probed scope candidate before its content is read. */
21
+ export interface ProbedInstructionFile extends InstructionFile {
22
+ target: FsTarget;
23
+ version: FsVersion;
24
+ size?: number;
25
+ }
26
+ interface DiscoverOptions {
27
+ cwd: string;
28
+ dshHome?: string;
29
+ projectRootMarkers?: string[];
30
+ instructionFileCandidates?: string[];
31
+ localInstructionFileCandidates?: string[];
32
+ projectRoot?: string;
33
+ signal?: AbortSignal;
34
+ }
35
+ interface LoadOptions extends DiscoverOptions {
36
+ maxBytes: number;
37
+ maxSourceBytes?: number;
38
+ maxTotalSourceBytes?: number;
39
+ replacePreviousBaseline?: boolean;
40
+ }
41
+ /** Aggregate UTF-8 source budget shared by one complete load batch. */
42
+ export interface SourceByteBudget {
43
+ readonly maxBytes: number;
44
+ usedBytes: number;
45
+ }
46
+ /** Rendered baseline plus the successfully read and byte-budget-retained files. */
47
+ export interface RenderedInstructionSet {
48
+ rendered: RenderedWorkspaceContext;
49
+ /** Successfully read candidates before content deduplication and byte budgeting. */
50
+ observed: LoadedInstructionFile[];
51
+ /** Candidates retained by content deduplication and byte budgeting. */
52
+ included: LoadedInstructionFile[];
53
+ }
54
+ /** Tri-state scope probe that distinguishes confirmed absence from provider failure. */
55
+ export type ScopeInstructionProbe = {
56
+ kind: 'present';
57
+ file: ProbedInstructionFile;
58
+ } | {
59
+ kind: 'absent';
60
+ } | {
61
+ kind: 'unavailable';
62
+ };
63
+ /**
64
+ * Walk upward to the first directory containing a configured root marker.
65
+ * @param cwd - absolute session working directory where the walk begins.
66
+ * @param markers - child names that identify a project root.
67
+ * @param fileSystem - optional provider used instead of host filesystem probes.
68
+ * @param signal - cancellation for provider and host probes.
69
+ * @returns the discovered project root, or `cwd` when no marker exists.
70
+ */
71
+ export declare function findProjectRoot(cwd: string, markers: readonly string[], fileSystem?: FileSystem, signal?: AbortSignal): Promise<string>;
72
+ /**
73
+ * Build the inclusive root-to-cwd directory chain.
74
+ * @param root - root directory expected to contain or equal `cwd`.
75
+ * @param cwd - most-specific directory in the chain.
76
+ * @returns directories ordered from broadest to most specific.
77
+ */
78
+ export declare function ancestorChain(root: string, cwd: string): string[];
79
+ /**
80
+ * Find descendant directories crossed between a cwd and a touched file.
81
+ * @param root - session cwd that bounds nested discovery.
82
+ * @param touchedPath - absolute path or path relative to `root`.
83
+ * @returns descendant directories from shallowest through the touched file's parent.
84
+ */
85
+ export declare function descendantDirsBetween(root: string, touchedPath: string): string[];
86
+ /**
87
+ * Convert an absolute instruction path to its project-root-relative display form.
88
+ * @param root - project root used as the display base.
89
+ * @param path - absolute path to display.
90
+ * @returns the root-relative path.
91
+ */
92
+ export declare function relativeDisplay(root: string, path: string): string;
93
+ /**
94
+ * Discover host-visible user-global and root-to-cwd instruction candidates.
95
+ * All present candidates in each directory are returned; trimmed-content
96
+ * duplicates are collapsed later, once content is read.
97
+ * @param options - cwd, home, root marker, and candidate configuration.
98
+ * @returns path-deduplicated instruction candidates in model precedence order.
99
+ */
100
+ export declare function discoverBaselineInstructionFiles(options: DiscoverOptions): Promise<InstructionFile[]>;
101
+ /**
102
+ * Drop later candidates whose trimmed content duplicates an earlier sibling in
103
+ * the same directory. Different directories never collapse even when identical;
104
+ * within one directory the earliest candidate in discovery order is kept and its
105
+ * original bytes are rendered. A candidate that symlinks a sibling resolves to
106
+ * the same content and collapses here like any byte-identical real file.
107
+ * @param files - loaded files in discovery order.
108
+ * @returns the retained files in the same order.
109
+ */
110
+ export declare function dedupInstructionFilesByDirectory(files: LoadedInstructionFile[]): LoadedInstructionFile[];
111
+ /**
112
+ * Discover, read, and render the baseline instruction chain.
113
+ * @param options - discovery, source-size, byte-budget, and cancellation configuration.
114
+ * @param fileSystem - optional provider used instead of host filesystem reads.
115
+ * @returns rendered baseline context, or undefined when nothing can be loaded.
116
+ */
117
+ export declare function loadBaselineInstructions(options: LoadOptions, fileSystem?: FileSystem): Promise<RenderedWorkspaceContext | undefined>;
118
+ /**
119
+ * Load a baseline together with the files retained after rendering.
120
+ * @param options - discovery, source-size, byte-budget, and cancellation configuration.
121
+ * @param fileSystem - optional provider used instead of host filesystem reads.
122
+ * @returns rendered context and retained files, an explicit empty replacement set, or undefined when empty or disabled.
123
+ */
124
+ export declare function loadBaselineInstructionSet(options: LoadOptions, fileSystem?: FileSystem): Promise<RenderedInstructionSet | undefined>;
125
+ /**
126
+ * Probe the current provider metadata for one per-candidate instruction scope.
127
+ * @param scope - a {@link candidateScopeKey} identifying a directory and candidate file.
128
+ * @param projectRoot - project root used to resolve and display project scopes.
129
+ * @param resolved - normalized plugin configuration.
130
+ * @param fileSystem - provider used to resolve and stat scope candidates.
131
+ * @param signal - cancellation for provider probes.
132
+ * @returns present metadata, confirmed absence, or temporary unavailability.
133
+ */
134
+ export declare function probeScopeInstruction(scope: string, projectRoot: string, resolved: ResolvedConfig, fileSystem: FileSystem, signal?: AbortSignal): Promise<ScopeInstructionProbe>;
135
+ /**
136
+ * Read one already-probed scope candidate under the configured source cap.
137
+ * @param file - winning provider candidate and its metadata snapshot.
138
+ * @param maxSourceBytes - maximum UTF-8 bytes accepted from the source.
139
+ * @param sourceBudget - aggregate UTF-8 byte budget for the current batch.
140
+ * @param fileSystem - provider used for the streaming read.
141
+ * @param signal - cancellation for provider streaming.
142
+ * @returns loaded content with the probed version, or undefined when unavailable.
143
+ */
144
+ export declare function readScopeInstruction(file: ProbedInstructionFile, maxSourceBytes: number, sourceBudget: SourceByteBudget, fileSystem: FileSystem, signal?: AbortSignal): Promise<LoadedInstructionFile | undefined>;
145
+ export {};
146
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Workspace instruction loader for AGENTS.md-compatible files.
3
+ *
4
+ * Baseline instructions enter durable context before the first request; successful fs
5
+ * tool touches project nested, changed, and removed instructions into the inbox.
6
+ * Plugin lifecycle reads use the optional `ctx.fs` provider, so providerless products
7
+ * mount it as a no-op.
8
+ *
9
+ * @module @stackstackstack/dsh-agent-instructions
10
+ */
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import { Config } from './config.ts';
13
+ import { name } from './state.ts';
14
+ export { Config, name };
15
+ export { discoverBaselineInstructionFiles, loadBaselineInstructions, } from './files.ts';
16
+ export type { InstructionFile, LoadedInstructionFile, } from './files.ts';
17
+ export { renderWorkspaceContext } from './render.ts';
18
+ export type { RenderedWorkspaceContext, TruncatedInstruction } from './render.ts';
19
+ export declare function apply(ctx: Context, config: Config): void;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Package-owned invariant companion for `@stackstackstack/dsh-agent-instructions`.
3
+ * @module @stackstackstack/dsh-agent-instructions/invariant
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "workspace-context-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
16
+ //# sourceMappingURL=invariant.d.ts.map
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Model-facing workspace instruction rendering within an explicit byte budget.
3
+ *
4
+ * @module @stackstackstack/dsh-agent-instructions/render
5
+ */
6
+ import type { InstructionFile, LoadedInstructionFile } from './files.ts';
7
+ /** Byte-accounting record for one truncated instruction file. */
8
+ export interface TruncatedInstruction {
9
+ displayPath: string;
10
+ originalBytes: number;
11
+ includedBytes: number;
12
+ }
13
+ /** Model-facing text plus omitted and truncated source records. */
14
+ export interface RenderedWorkspaceContext {
15
+ text: string;
16
+ omitted: InstructionFile[];
17
+ truncated: TruncatedInstruction[];
18
+ }
19
+ /** Structured dynamic state persisted outside model-visible prompt prose. */
20
+ export interface AgentInstructionChange {
21
+ action: 'set' | 'replace' | 'remove';
22
+ scope: string;
23
+ path: string;
24
+ digest?: string;
25
+ }
26
+ /** One state transition paired with the content used to render it. */
27
+ export interface ChangeRenderItem {
28
+ change: AgentInstructionChange;
29
+ file: LoadedInstructionFile;
30
+ }
31
+ /** Directory component that identifies the single user-global instruction scope. */
32
+ export declare const USER_GLOBAL_DIRECTORY = "user-global";
33
+ /**
34
+ * File name of the single user-global instruction file under `$DSH_HOME`.
35
+ * Discovery (`$DSH_HOME/<name>`) and reconciliation (the user-global scope key's
36
+ * candidate component) both key on this name, so it lives in one place: were the
37
+ * two to disagree, the user-global instruction would load but never reconcile.
38
+ */
39
+ export declare const USER_GLOBAL_FILE = "AGENTS.md";
40
+ /**
41
+ * Derive the logical instruction scope from a model-facing path.
42
+ * @param displayPath - project-relative or user-global instruction path.
43
+ * @returns `user-global`, `.`, or the containing project-relative directory.
44
+ */
45
+ export declare function scopeForDisplayPath(displayPath: string): string;
46
+ /**
47
+ * Compose the reconciliation key for one instruction candidate file.
48
+ * Each loaded candidate is tracked independently, so the key pairs the logical
49
+ * directory with the exact candidate file name behind a NUL separator that no
50
+ * directory path or file name can contain. Distinct candidates in one directory
51
+ * (`AGENTS.md` vs `CLAUDE.md`, a base file vs its `.local` overlay) therefore
52
+ * never collide in the scope-keyed state maps.
53
+ * @param directory - `user-global`, `.`, or a project-relative directory.
54
+ * @param candidateName - instruction file name within that directory.
55
+ * @returns the per-candidate logical scope key.
56
+ */
57
+ export declare function candidateScopeKey(directory: string, candidateName: string): string;
58
+ /**
59
+ * Derive the per-candidate scope key for a loaded instruction file.
60
+ * @param displayPath - project-relative or user-global instruction path.
61
+ * @returns the scope key pairing the file's directory with its name.
62
+ */
63
+ export declare function instructionScopeKey(displayPath: string): string;
64
+ /**
65
+ * Recover the directory and candidate name that {@link candidateScopeKey} encoded.
66
+ * @param scope - a per-candidate scope key.
67
+ * @returns the directory scope and the candidate file name within it.
68
+ */
69
+ export declare function decodeScopeKey(scope: string): {
70
+ directory: string;
71
+ candidateName: string;
72
+ };
73
+ /**
74
+ * Render one reconciliation batch and retain only transitions that fit.
75
+ * @param items - ordered state transitions and current file contents.
76
+ * @param maxBytes - maximum UTF-8 bytes allowed in the rendered batch.
77
+ * @returns bounded prompt text and the transitions actually represented by it.
78
+ */
79
+ export declare function renderInstructionChanges(items: ChangeRenderItem[], maxBytes: number): {
80
+ text: string;
81
+ changes: AgentInstructionChange[];
82
+ };
83
+ /**
84
+ * Render a baseline together with the exact source files semantically represented in it.
85
+ * @param files - loaded files ordered from broadest to most specific.
86
+ * @param options - rendering byte budget and whether this baseline supersedes a visible predecessor.
87
+ * @returns bounded public rendering plus files with surviving content, including genuinely empty files.
88
+ * @internal
89
+ */
90
+ export declare function renderWorkspaceInstructionSet(files: LoadedInstructionFile[], options: {
91
+ maxBytes: number;
92
+ replacePreviousBaseline?: boolean;
93
+ }): {
94
+ rendered: RenderedWorkspaceContext;
95
+ included: LoadedInstructionFile[];
96
+ };
97
+ /**
98
+ * Render the baseline instruction chain with deterministic precedence budgeting.
99
+ * @param files - loaded files ordered from broadest to most specific.
100
+ * @param options - rendering byte budget and whether this baseline supersedes a visible predecessor.
101
+ * @returns bounded baseline prompt text and budget diagnostics.
102
+ */
103
+ export declare function renderWorkspaceContext(files: LoadedInstructionFile[], options: {
104
+ maxBytes: number;
105
+ replacePreviousBaseline?: boolean;
106
+ }): RenderedWorkspaceContext;
107
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Session-visible workspace instruction state and dynamic reconciliation.
3
+ *
4
+ * @module @stackstackstack/dsh-agent-instructions/state
5
+ */
6
+ import type { Agent } from '@stackstackstack/dsh-agent';
7
+ import type { Message } from '@stackstackstack/dsh-llm';
8
+ import type { Session, UserMessage } from '@stackstackstack/dsh-session';
9
+ import type { FileSystem, FsVersion } from '@stackstackstack/dsh-fs';
10
+ import type { ResolvedConfig } from './config.ts';
11
+ import { type LoadedInstructionFile } from './files.ts';
12
+ import { type AgentInstructionChange } from './render.ts';
13
+ export declare const name = "agent-instructions";
14
+ /** Durable producer, file, and reconciliation facts for one workspace context. */
15
+ export interface AgentInstructionSource {
16
+ kind: 'agent-instructions';
17
+ /** Every workspace context carries instructions read out of a file (the `instructions` context form). */
18
+ form: 'instructions';
19
+ /** Marks the complete startup/resume baseline rather than a later delta. */
20
+ baseline?: true;
21
+ /** Discovery, precedence, and budget identity used to validate a resumed baseline. */
22
+ baselineIdentity?: string;
23
+ changes: AgentInstructionChange[];
24
+ }
25
+ declare module '@stackstackstack/dsh-llm' {
26
+ interface MessageSourceMap {
27
+ 'agent-instructions': AgentInstructionSource;
28
+ }
29
+ }
30
+ /** Per-scope metadata cache; instruction prose is deliberately not retained. */
31
+ export interface InstructionVersionState {
32
+ path: string;
33
+ version: FsVersion;
34
+ digest: string;
35
+ /**
36
+ * Trimmed-content identity ({@link trimmedInstructionDigest}) used to suppress
37
+ * per-directory duplicates on the metadata fast path without re-reading a sibling.
38
+ */
39
+ trimmedDigest: string;
40
+ }
41
+ /** Session-isolated fast-path state keyed by logical instruction scope. */
42
+ export type InstructionVersionCache = WeakMap<Session, Map<string, InstructionVersionState>>;
43
+ /** A metadata-cache transition associated with one rendered instruction change. */
44
+ export interface InstructionVersionUpdate {
45
+ change: AgentInstructionChange;
46
+ state?: InstructionVersionState;
47
+ }
48
+ /** Rendered reconciliation plus its metadata-cache transitions. */
49
+ export interface ReconciledInstructionContext {
50
+ context: UserMessage;
51
+ versionUpdates: InstructionVersionUpdate[];
52
+ }
53
+ /**
54
+ * Build the user-role message for a rendered baseline.
55
+ * @param text - complete plugin-owned system-reminder text.
56
+ * @returns a user-role prefix message.
57
+ */
58
+ export declare function workspaceContextMessage(text: string): Message;
59
+ /**
60
+ * Convert retained baseline files into comparison and metadata-cache state.
61
+ * @param files - baseline files that survived rendering.
62
+ * @returns latest baseline changes and provider versions keyed by logical scope.
63
+ */
64
+ export declare function baselineInstructionState(files: LoadedInstructionFile[]): {
65
+ changes: Map<string, AgentInstructionChange>;
66
+ versions: Map<string, InstructionVersionState>;
67
+ };
68
+ /**
69
+ * Keep only cache updates represented by rendered changes.
70
+ * @param updates - proposed updates from one or more reconciliations.
71
+ * @param renderedChanges - transitions retained by the renderer.
72
+ * @returns updates represented by an exact retained transition.
73
+ */
74
+ export declare function retainedInstructionVersionUpdates(updates: readonly InstructionVersionUpdate[], renderedChanges: readonly AgentInstructionChange[]): InstructionVersionUpdate[];
75
+ /**
76
+ * Apply metadata-cache transitions without retaining instruction prose.
77
+ * @param session - owning session.
78
+ * @param updates - ordered set/delete transitions.
79
+ * @param cache - session-isolated metadata cache.
80
+ */
81
+ export declare function applyInstructionVersionUpdates(session: Session, updates: readonly InstructionVersionUpdate[], cache: InstructionVersionCache): void;
82
+ /**
83
+ * Compare visible state with provider-visible files and render transitions.
84
+ * @param agent - session owner whose visible surface supplies durable state.
85
+ * @param resolved - normalized plugin configuration.
86
+ * @param versionCache - per-session scope metadata used to skip unchanged reads.
87
+ * @param fileSystem - provider used for current file probes.
88
+ * @param options - authoritative claimed context, pending scope hints, touched paths, and baseline participation.
89
+ * @returns rendered context plus deferred cache updates, or undefined when unchanged/unavailable.
90
+ */
91
+ export declare function reconcileInstructionContext(agent: Agent, resolved: ResolvedConfig, versionCache: InstructionVersionCache, fileSystem: FileSystem, options: {
92
+ authorityMessages: readonly UserMessage[];
93
+ scopeMessages: readonly UserMessage[];
94
+ touchedPaths: readonly string[];
95
+ includeBaselineScopes: boolean;
96
+ excludedBaselineScopes?: ReadonlySet<string>;
97
+ projectRoot?: string;
98
+ signal?: AbortSignal;
99
+ }): Promise<ReconciledInstructionContext | undefined>;
100
+ //# sourceMappingURL=state.d.ts.map
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@stackstackstack/dsh-agent-instructions",
3
+ "description": "Workspace context loader for AGENTS.md/CLAUDE.md instruction files",
4
+ "version": "0.1.5",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/context/agent-instructions"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./invariant": {
22
+ "types": "./lib/types/invariant.d.ts",
23
+ "default": "./lib/invariant.js"
24
+ },
25
+ "./src/*": "./src/*",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "files": [
29
+ "lib/index.js",
30
+ "lib/invariant.js",
31
+ "lib/types/**/*.d.ts"
32
+ ],
33
+ "license": "MIT",
34
+ "peerDependencies": {
35
+ "@stackstackstack/dsh-agent": "^0.1.5",
36
+ "@stackstackstack/dsh-invariants": "^0.1.5",
37
+ "@stackstackstack/dsh-home-paths": "^0.1.5",
38
+ "@stackstackstack/dsh-llm": "^0.1.5",
39
+ "@stackstackstack/dsh-tools": "^0.1.5",
40
+ "@stackstackstack/dsh-fs": "^0.1.5",
41
+ "@stackstackstack/dsh-session": "^0.1.5",
42
+ "@deepseek-ai/cordis": "^4.0.1"
43
+ },
44
+ "dependencies": {
45
+ "@deepseek-ai/schemastery": "^3.18.1"
46
+ },
47
+ "devDependencies": {
48
+ "@deepseek-ai/cordis-plugin-loader": "^1.0.2",
49
+ "@stackstackstack/dsh-agent": "^0.1.5",
50
+ "@stackstackstack/dsh-agent-loop": "^0.1.5",
51
+ "@stackstackstack/dsh-fs": "^0.1.5",
52
+ "@stackstackstack/dsh-fs-local": "^0.1.5",
53
+ "@stackstackstack/dsh-invariants": "^0.1.5",
54
+ "@stackstackstack/dsh-llm": "^0.1.5",
55
+ "@stackstackstack/dsh-llm-deepseek": "^0.1.5",
56
+ "@stackstackstack/dsh-home-paths": "^0.1.5",
57
+ "@stackstackstack/dsh-session": "^0.1.5",
58
+ "@stackstackstack/dsh-tools": "^0.1.5",
59
+ "@deepseek-ai/cordis": "^4.0.1",
60
+ "@stackstackstack/dsh-system-prompt": "^0.1.5",
61
+ "@stackstackstack/dsh-tool-fs": "^0.1.5"
62
+ }
63
+ }