@karmaniverous/stan-core 0.9.0 → 0.9.2
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.
- package/README.md +3 -3
- package/dist/mjs/index.js +1 -1
- package/dist/stan.system.md +12 -15
- package/dist/types/index.d.ts +62 -8
- package/package.json +1 -1
package/dist/stan.system.md
CHANGED
|
@@ -570,7 +570,7 @@ Rules
|
|
|
570
570
|
|
|
571
571
|
- Canonical path: `<stanPath>/system/stan.scratch.md`.
|
|
572
572
|
- Base-always: the scratch file is always part of the Base set for archiving:
|
|
573
|
-
- It MUST be present in `archive.
|
|
573
|
+
- It MUST be present in the META archive (written as `archive.tar` under `stan run --context --meta`) and full archives.
|
|
574
574
|
- It MUST appear in the diff whenever it changes.
|
|
575
575
|
- Top-of-thread priority:
|
|
576
576
|
- When scratch exists and is relevant to the current user request, treat it as the highest-priority immediate context for the thread.
|
|
@@ -852,9 +852,8 @@ diff --git a/new/path/to/file/a.ts b/new/path/to/file/a.ts
|
|
|
852
852
|
# Inputs (Source of Truth)
|
|
853
853
|
|
|
854
854
|
- Primary artifacts live under `<stanPath>/output/`:
|
|
855
|
-
- `archive.tar` — full snapshot of files to read.
|
|
856
|
-
- `archive.diff.tar` — only files changed since the previous snapshot (
|
|
857
|
-
- `archive.meta.tar` — meta/system-only thread opener (only when context mode is enabled; excludes dependency state and staged payloads).
|
|
855
|
+
- `archive.tar` — full snapshot of files to read (default). In `stan run --context --meta`, this path is used for the META archive (system + dependency meta + dependency state) and a diff archive is not written.
|
|
856
|
+
- `archive.diff.tar` — only files changed since the previous snapshot. In `stan run --context` (non-meta), this is the DIFF allowlist context archive; the FULL allowlist context archive is also written as `archive.tar`.
|
|
858
857
|
- Script outputs (`test.txt`, `lint.txt`, `typecheck.txt`, `build.txt`) — deterministic stdout/stderr dumps from configured scripts. When `--combine` is used, these outputs are placed inside the archives and removed from disk.
|
|
859
858
|
- When attaching artifacts for chat, prefer attaching `<stanPath>/output/archive.tar` (and `<stanPath>/output/archive.diff.tar` when present). If `--combine` was not used, you may also attach the text outputs individually.
|
|
860
859
|
- Important: Inside any attached archive, contextual files are located in the directory matching the `stanPath` key from `stan.config.*` (default `.stan`). The bootloader resolves this automatically.
|
|
@@ -946,12 +945,11 @@ Dependency artifacts (workspace; gitignored):
|
|
|
946
945
|
|
|
947
946
|
Archive outputs (under `<stanPath>/output/`):
|
|
948
947
|
|
|
949
|
-
- `<stanPath>/output/archive.tar` (full)
|
|
950
|
-
- `<stanPath>/output/archive.diff.tar` (diff)
|
|
951
|
-
-
|
|
952
|
-
-
|
|
953
|
-
-
|
|
954
|
-
- Never includes `dependency.map.json` (host-private; reserved denial).
|
|
948
|
+
- `<stanPath>/output/archive.tar` (full by default; META when `stan run --context --meta`)
|
|
949
|
+
- `<stanPath>/output/archive.diff.tar` (diff; written by `stan run` and by `stan run --context` (non-meta))
|
|
950
|
+
- In `stan run --context --meta`, `archive.diff.tar` is not written.
|
|
951
|
+
- The META archive contains system files + dependency meta + dependency state (the host writes `{ "v": 2, "i": [] }` before archiving so the assistant starts from a clean slate).
|
|
952
|
+
- It excludes staged payloads by omission and never includes `dependency.map.json` (host-private; reserved denial).
|
|
955
953
|
|
|
956
954
|
## Read-only staged imports (baseline rule)
|
|
957
955
|
|
|
@@ -1021,14 +1019,13 @@ Dependency expansion is intended to expand the archive beyond the baseline selec
|
|
|
1021
1019
|
|
|
1022
1020
|
## Meta archive behavior (thread opener)
|
|
1023
1021
|
|
|
1024
|
-
|
|
1022
|
+
In `stan run --context --meta`, tooling produces a META archive at `<stanPath>/output/archive.tar` and does not write a diff archive.
|
|
1025
1023
|
|
|
1026
|
-
The
|
|
1024
|
+
The META archive is intended for the start of a thread:
|
|
1027
1025
|
|
|
1028
|
-
- It contains system docs + dependency
|
|
1029
|
-
- It omits dependency state always (clean slate for selections).
|
|
1026
|
+
- It contains system docs + `dependency.meta.json` + `dependency.state.json` (v2 empty written by the host).
|
|
1030
1027
|
- It excludes staged dependency payloads by omission.
|
|
1031
|
-
-
|
|
1028
|
+
- After the thread is started, `stan run --context` (non-meta) writes BOTH a FULL allowlist context archive (`archive.tar`) and a DIFF allowlist context archive (`archive.diff.tar`) for subsequent turns.
|
|
1032
1029
|
|
|
1033
1030
|
## Assistant guidance (anti-bloat)
|
|
1034
1031
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -129,10 +129,9 @@ type CreateArchiveFromFilesOptions = {
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* Creates a "meta" archive (system docs + dependency meta, plus optional
|
|
133
|
-
* repo-root base files);
|
|
134
|
-
*
|
|
135
|
-
* filesystem IO only.
|
|
132
|
+
* Creates a "meta" archive (system docs + dependency meta/state, plus optional
|
|
133
|
+
* repo-root base files); excludes staged payloads by omission and excludes
|
|
134
|
+
* `<stanPath>/system/.docs.meta.json`; filesystem IO only.
|
|
136
135
|
* @module
|
|
137
136
|
*/
|
|
138
137
|
|
|
@@ -148,7 +147,7 @@ declare function createMetaArchive(cwd: string, stanPath: string, selection?: {
|
|
|
148
147
|
*/
|
|
149
148
|
includeOutputDir?: boolean;
|
|
150
149
|
/**
|
|
151
|
-
* Output file name (default: `archive.
|
|
150
|
+
* Output file name (default: `archive.tar`).
|
|
152
151
|
* Written to `<stanPath>/output/<fileName>`.
|
|
153
152
|
*/
|
|
154
153
|
fileName?: string;
|
|
@@ -243,6 +242,7 @@ type SnapshotUpdateMode = 'never' | 'createIfMissing' | 'replace';
|
|
|
243
242
|
* - stanPath: STAN workspace folder.
|
|
244
243
|
* - includes: Additive allow‑list globs (can re-include gitignored files); excludes still win.
|
|
245
244
|
* - excludes: Deny‑list globs.
|
|
245
|
+
* - snapshotFileName: Optional snapshot file name override under `<stanPath>/diff/`.
|
|
246
246
|
*
|
|
247
247
|
* @example
|
|
248
248
|
* ```ts
|
|
@@ -255,11 +255,12 @@ type SnapshotUpdateMode = 'never' | 'createIfMissing' | 'replace';
|
|
|
255
255
|
* ```
|
|
256
256
|
* @returns Absolute path to the `.archive.snapshot.json` file.
|
|
257
257
|
*/
|
|
258
|
-
declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, }: {
|
|
258
|
+
declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, snapshotFileName, }: {
|
|
259
259
|
cwd: string;
|
|
260
260
|
stanPath: string;
|
|
261
261
|
includes?: string[];
|
|
262
262
|
excludes?: string[];
|
|
263
|
+
snapshotFileName?: string;
|
|
263
264
|
}): Promise<string>;
|
|
264
265
|
/**
|
|
265
266
|
* Create a diff tar at <stanPath>/output/<baseName>.diff.tar.
|
|
@@ -268,6 +269,7 @@ declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, }: {
|
|
|
268
269
|
* - Snapshot update behavior is controlled by updateSnapshot.
|
|
269
270
|
* - When includeOutputDirInDiff === true, also include the entire <stanPath>/output tree
|
|
270
271
|
* (excluding <stanPath>/diff and the two archive files) regardless of change list length.
|
|
272
|
+
* - Snapshot location can be overridden via snapshotFileName (defaults to `.archive.snapshot.json`).
|
|
271
273
|
*
|
|
272
274
|
* @param args - Object with:
|
|
273
275
|
* - cwd: Repo root.
|
|
@@ -276,6 +278,7 @@ declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, }: {
|
|
|
276
278
|
* - includes: Additive allow‑list globs (can re-include gitignored files); excludes still win.
|
|
277
279
|
* - excludes: Deny‑list globs (hard denials; take precedence over includes).
|
|
278
280
|
* - updateSnapshot: Controls when the snapshot file is replaced.
|
|
281
|
+
* - snapshotFileName: Optional snapshot file name override under `<stanPath>/diff/`.
|
|
279
282
|
* - includeOutputDirInDiff: When true, include `stanPath/output` in the diff.
|
|
280
283
|
* @returns `{ diffPath }` absolute path to the diff archive.
|
|
281
284
|
*
|
|
@@ -291,13 +294,63 @@ declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, }: {
|
|
|
291
294
|
* });
|
|
292
295
|
* ```
|
|
293
296
|
*/
|
|
294
|
-
declare function createArchiveDiff({ cwd, stanPath, baseName, includes, excludes, updateSnapshot, includeOutputDirInDiff, onArchiveWarnings, onSelectionReport, }: {
|
|
297
|
+
declare function createArchiveDiff({ cwd, stanPath, baseName, includes, excludes, updateSnapshot, snapshotFileName, includeOutputDirInDiff, onArchiveWarnings, onSelectionReport, }: {
|
|
295
298
|
cwd: string;
|
|
296
299
|
stanPath: string;
|
|
297
300
|
baseName: string;
|
|
298
301
|
includes?: string[];
|
|
299
302
|
excludes?: string[];
|
|
300
303
|
updateSnapshot?: SnapshotUpdateMode;
|
|
304
|
+
snapshotFileName?: string;
|
|
305
|
+
includeOutputDirInDiff?: boolean;
|
|
306
|
+
onArchiveWarnings?: (text: string) => void;
|
|
307
|
+
onSelectionReport?: (report: SelectionReport) => void;
|
|
308
|
+
}): Promise<{
|
|
309
|
+
diffPath: string;
|
|
310
|
+
}>;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Creates diff archives from an explicit allowlist of repo-relative files and
|
|
314
|
+
* manages snapshot state; excludes binaries via classifier; filesystem IO only;
|
|
315
|
+
* no console output.
|
|
316
|
+
* @module
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Write a snapshot file under `<stanPath>/diff/` for an explicit allowlist.
|
|
321
|
+
*
|
|
322
|
+
* This allows callers (e.g., CLI) to maintain distinct snapshot baselines for
|
|
323
|
+
* different selection universes (denylist vs allowlist/context) by using
|
|
324
|
+
* different snapshot file names.
|
|
325
|
+
*
|
|
326
|
+
* @param args - Inputs including repo root, stanPath, allowlist files, and an
|
|
327
|
+
* optional snapshot file name override.
|
|
328
|
+
* @returns Absolute path to the written snapshot file.
|
|
329
|
+
*/
|
|
330
|
+
declare function writeArchiveSnapshotFromFiles(args: {
|
|
331
|
+
cwd: string;
|
|
332
|
+
stanPath: string;
|
|
333
|
+
relFiles: string[];
|
|
334
|
+
snapshotFileName?: string;
|
|
335
|
+
}): Promise<string>;
|
|
336
|
+
/**
|
|
337
|
+
* Create a diff tar at <stanPath>/output/<baseName>.diff.tar from an explicit
|
|
338
|
+
* allowlist of repo-relative files.
|
|
339
|
+
*
|
|
340
|
+
* Snapshot semantics:
|
|
341
|
+
* - Snapshot path: <stanPath>/diff/.archive.snapshot.json
|
|
342
|
+
* - When snapshot exists: include only changed files (within allowlist).
|
|
343
|
+
* - When snapshot missing: include full allowlist (diff equals full selection).
|
|
344
|
+
* - No-changes case: write <stanPath>/diff/.stan_no_changes and include it.
|
|
345
|
+
* - Snapshot location can be overridden via snapshotFileName (defaults to `.archive.snapshot.json`).
|
|
346
|
+
*/
|
|
347
|
+
declare function createArchiveDiffFromFiles(args: {
|
|
348
|
+
cwd: string;
|
|
349
|
+
stanPath: string;
|
|
350
|
+
baseName: string;
|
|
351
|
+
relFiles: string[];
|
|
352
|
+
updateSnapshot?: SnapshotUpdateMode;
|
|
353
|
+
snapshotFileName?: string;
|
|
301
354
|
includeOutputDirInDiff?: boolean;
|
|
302
355
|
onArchiveWarnings?: (text: string) => void;
|
|
303
356
|
onSelectionReport?: (report: SelectionReport) => void;
|
|
@@ -815,6 +868,7 @@ declare const createContextArchiveDiffWithDependencyContext: (args: {
|
|
|
815
868
|
diff: {
|
|
816
869
|
baseName: string;
|
|
817
870
|
updateSnapshot?: SnapshotUpdateMode;
|
|
871
|
+
snapshotFileName?: string;
|
|
818
872
|
includeOutputDirInDiff?: boolean;
|
|
819
873
|
onArchiveWarnings?: (text: string) => void;
|
|
820
874
|
};
|
|
@@ -941,5 +995,5 @@ declare const assembleSystemMonolith: (cwd: string, stanPath: string) => Promise
|
|
|
941
995
|
|
|
942
996
|
declare const CORE_VERSION: string;
|
|
943
997
|
|
|
944
|
-
export { CORE_VERSION, DEFAULT_OPEN_COMMAND, DEFAULT_STAN_PATH, applyPatchPipeline, applyWithJsDiff, assembleSystemMonolith, buildDependencyMeta, computeContextAllowlistPlan, computeSelectedNodeIds, createArchive, createArchiveDiff, createArchiveDiffWithDependencyContext, createArchiveWithDependencyContext, createContextArchiveDiffWithDependencyContext, createContextArchiveWithDependencyContext, createMetaArchive, dependencyMapFileSchema, dependencyMapNodeSchema, dependencyMetaFileSchema, dependencyMetaNodeSchema, dependencyStateEntrySchema, dependencyStateFileSchema, detectAndCleanPatch, ensureOutputDir, executeFileOps, expandEntry, findConfigPathSync, getPackagedSystemPromptPath, loadConfig, loadConfigSync, makeGlobMatcher, parseDependencyStateFile, parseFileOpsBlock, prepareDependencyContext, prepareImports, resolveStanPath, resolveStanPathSync, stageDependencyContext, stagePreparedDependencyContext, summarizeContextAllowlistBudget, validateDependencySelection, validateDependencySelectionOrThrow, writeArchiveSnapshot, writeDependencyMapFile, writeDependencyMetaFile };
|
|
998
|
+
export { CORE_VERSION, DEFAULT_OPEN_COMMAND, DEFAULT_STAN_PATH, applyPatchPipeline, applyWithJsDiff, assembleSystemMonolith, buildDependencyMeta, computeContextAllowlistPlan, computeSelectedNodeIds, createArchive, createArchiveDiff, createArchiveDiffFromFiles, createArchiveDiffWithDependencyContext, createArchiveWithDependencyContext, createContextArchiveDiffWithDependencyContext, createContextArchiveWithDependencyContext, createMetaArchive, dependencyMapFileSchema, dependencyMapNodeSchema, dependencyMetaFileSchema, dependencyMetaNodeSchema, dependencyStateEntrySchema, dependencyStateFileSchema, detectAndCleanPatch, ensureOutputDir, executeFileOps, expandEntry, findConfigPathSync, getPackagedSystemPromptPath, loadConfig, loadConfigSync, makeGlobMatcher, parseDependencyStateFile, parseFileOpsBlock, prepareDependencyContext, prepareImports, resolveStanPath, resolveStanPathSync, stageDependencyContext, stagePreparedDependencyContext, summarizeContextAllowlistBudget, validateDependencySelection, validateDependencySelectionOrThrow, writeArchiveSnapshot, writeArchiveSnapshotFromFiles, writeDependencyMapFile, writeDependencyMetaFile };
|
|
945
999
|
export type { ApplyResult, AssembleResult, AttemptCapture, BudgetEntry, BudgetSource, BuildDependencyMetaArgs, BuildDependencyMetaResult, ContextAllowlistBudget, ContextAllowlistPlan, ContextConfig, ContextModeSelection, CreateArchiveDiffWithDependencyContextResult, CreateArchiveFromFilesOptions, CreateArchiveOptions, CreateArchiveWithDependencyContextResult, CreateContextArchiveDiffResult, CreateContextArchiveOptions, CreateContextArchiveResult, DependencyContextInputs, DependencyMapFile, DependencyMapNode, DependencyMetaFile, DependencyMetaNode, DependencyStateEntry, DependencyStateFile, DependencyValidationMismatch, FileOp, FileOpsPlan, ImportsMap, JsDiffOutcome, NodeSource, NormalizedDependencyStateEntry, OpResult, PipelineOutcome, PrepareDependencyContextResult, SelectionReport, SelectionReportCounts, SnapshotUpdateMode, StageDependencyContextArgs, StageDependencyContextResult, StagePreparedDependencyContextResult, StagedEntry, ValidateDependencySelectionResult };
|
package/package.json
CHANGED