@karmaniverous/stan-core 0.9.1 → 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.
@@ -853,7 +853,7 @@ diff --git a/new/path/to/file/a.ts b/new/path/to/file/a.ts
853
853
 
854
854
  - Primary artifacts live under `<stanPath>/output/`:
855
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 only archive written; it may include `dependency.meta.json` and/or `dependency.state.json` when those files change.
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`.
857
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.
858
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.
859
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,7 +946,7 @@ Dependency artifacts (workspace; gitignored):
946
946
  Archive outputs (under `<stanPath>/output/`):
947
947
 
948
948
  - `<stanPath>/output/archive.tar` (full by default; META when `stan run --context --meta`)
949
- - `<stanPath>/output/archive.diff.tar` (diff; only archive produced by `stan run --context` (non-meta))
949
+ - `<stanPath>/output/archive.diff.tar` (diff; written by `stan run` and by `stan run --context` (non-meta))
950
950
  - In `stan run --context --meta`, `archive.diff.tar` is not written.
951
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
952
  - It excludes staged payloads by omission and never includes `dependency.map.json` (host-private; reserved denial).
@@ -1025,7 +1025,7 @@ The META archive is intended for the start of a thread:
1025
1025
 
1026
1026
  - It contains system docs + `dependency.meta.json` + `dependency.state.json` (v2 empty written by the host).
1027
1027
  - It excludes staged dependency payloads by omission.
1028
- - After the thread is started, `stan run --context` (non-meta) should rely on the diff archive (`archive.diff.tar`) for subsequent turns.
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.
1029
1029
 
1030
1030
  ## Assistant guidance (anti-bloat)
1031
1031
 
@@ -242,6 +242,7 @@ type SnapshotUpdateMode = 'never' | 'createIfMissing' | 'replace';
242
242
  * - stanPath: STAN workspace folder.
243
243
  * - includes: Additive allow‑list globs (can re-include gitignored files); excludes still win.
244
244
  * - excludes: Deny‑list globs.
245
+ * - snapshotFileName: Optional snapshot file name override under `<stanPath>/diff/`.
245
246
  *
246
247
  * @example
247
248
  * ```ts
@@ -254,11 +255,12 @@ type SnapshotUpdateMode = 'never' | 'createIfMissing' | 'replace';
254
255
  * ```
255
256
  * @returns Absolute path to the `.archive.snapshot.json` file.
256
257
  */
257
- declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, }: {
258
+ declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, snapshotFileName, }: {
258
259
  cwd: string;
259
260
  stanPath: string;
260
261
  includes?: string[];
261
262
  excludes?: string[];
263
+ snapshotFileName?: string;
262
264
  }): Promise<string>;
263
265
  /**
264
266
  * Create a diff tar at <stanPath>/output/<baseName>.diff.tar.
@@ -267,6 +269,7 @@ declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, }: {
267
269
  * - Snapshot update behavior is controlled by updateSnapshot.
268
270
  * - When includeOutputDirInDiff === true, also include the entire <stanPath>/output tree
269
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`).
270
273
  *
271
274
  * @param args - Object with:
272
275
  * - cwd: Repo root.
@@ -275,6 +278,7 @@ declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, }: {
275
278
  * - includes: Additive allow‑list globs (can re-include gitignored files); excludes still win.
276
279
  * - excludes: Deny‑list globs (hard denials; take precedence over includes).
277
280
  * - updateSnapshot: Controls when the snapshot file is replaced.
281
+ * - snapshotFileName: Optional snapshot file name override under `<stanPath>/diff/`.
278
282
  * - includeOutputDirInDiff: When true, include `stanPath/output` in the diff.
279
283
  * @returns `{ diffPath }` absolute path to the diff archive.
280
284
  *
@@ -290,13 +294,63 @@ declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, }: {
290
294
  * });
291
295
  * ```
292
296
  */
293
- 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, }: {
294
298
  cwd: string;
295
299
  stanPath: string;
296
300
  baseName: string;
297
301
  includes?: string[];
298
302
  excludes?: string[];
299
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;
300
354
  includeOutputDirInDiff?: boolean;
301
355
  onArchiveWarnings?: (text: string) => void;
302
356
  onSelectionReport?: (report: SelectionReport) => void;
@@ -814,6 +868,7 @@ declare const createContextArchiveDiffWithDependencyContext: (args: {
814
868
  diff: {
815
869
  baseName: string;
816
870
  updateSnapshot?: SnapshotUpdateMode;
871
+ snapshotFileName?: string;
817
872
  includeOutputDirInDiff?: boolean;
818
873
  onArchiveWarnings?: (text: string) => void;
819
874
  };
@@ -940,5 +995,5 @@ declare const assembleSystemMonolith: (cwd: string, stanPath: string) => Promise
940
995
 
941
996
  declare const CORE_VERSION: string;
942
997
 
943
- 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 };
944
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
@@ -151,5 +151,5 @@
151
151
  },
152
152
  "type": "module",
153
153
  "types": "dist/types/index.d.ts",
154
- "version": "0.9.1"
154
+ "version": "0.9.2"
155
155
  }