@karmaniverous/stan-core 0.7.0 → 0.8.0
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 +34 -29
- package/dist/mjs/index.js +1 -1
- package/dist/types/index.d.ts +125 -192
- package/package.json +3 -3
package/dist/types/index.d.ts
CHANGED
|
@@ -130,8 +130,9 @@ type CreateArchiveFromFilesOptions = {
|
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* Creates a "meta" archive (system docs + dependency meta, plus optional
|
|
133
|
-
*
|
|
134
|
-
* omission and excludes `<stanPath>/system/.docs.meta.json`;
|
|
133
|
+
* repo-root base files); omits dependency state (clean slate); excludes staged
|
|
134
|
+
* payloads by omission and excludes `<stanPath>/system/.docs.meta.json`;
|
|
135
|
+
* filesystem IO only.
|
|
135
136
|
* @module
|
|
136
137
|
*/
|
|
137
138
|
|
|
@@ -141,6 +142,11 @@ declare function createMetaArchive(cwd: string, stanPath: string, selection?: {
|
|
|
141
142
|
}, options?: {
|
|
142
143
|
/** Optional callback for a deterministic selection report (engine remains silent by default). */
|
|
143
144
|
onSelectionReport?: (report: SelectionReport) => void;
|
|
145
|
+
/**
|
|
146
|
+
* When true, include `<stanPath>/output/**` contents inside the meta archive
|
|
147
|
+
* (combine mode). Known STAN archive files remain excluded by tar filter.
|
|
148
|
+
*/
|
|
149
|
+
includeOutputDir?: boolean;
|
|
144
150
|
}): Promise<string>;
|
|
145
151
|
|
|
146
152
|
/**
|
|
@@ -448,120 +454,82 @@ declare const prepareImports: (args: {
|
|
|
448
454
|
* Dependency graph mode: on-disk JSON formats for:
|
|
449
455
|
* - .stan/context/dependency.state.json (assistant-authored selection intent)
|
|
450
456
|
* - .stan/context/dependency.meta.json (assistant-facing dependency graph)
|
|
457
|
+
* - .stan/context/dependency.map.json (host-private integrity map)
|
|
451
458
|
*
|
|
452
459
|
* Requirements:
|
|
453
|
-
* - Node IDs are repo-relative POSIX paths.
|
|
454
|
-
* - State entries support string | [nodeId, depth] | [nodeId, depth,
|
|
455
|
-
*
|
|
456
|
-
* - Meta may include locatorAbs ONLY for abs/outside-root nodes.
|
|
460
|
+
* - Node IDs are repo-relative POSIX paths (archive addresses).
|
|
461
|
+
* - State entries support string | [nodeId, depth] | [nodeId, depth, kindMask]
|
|
462
|
+
* - Meta is compact (minified keys).
|
|
457
463
|
* @module
|
|
458
464
|
*/
|
|
459
465
|
|
|
460
|
-
/** Edge kinds recorded in dependency meta and used by dependency state. */
|
|
461
|
-
declare const dependencyEdgeTypeSchema: z.ZodEnum<{
|
|
462
|
-
type: "type";
|
|
463
|
-
runtime: "runtime";
|
|
464
|
-
dynamic: "dynamic";
|
|
465
|
-
}>;
|
|
466
|
-
type DependencyEdgeType = z.infer<typeof dependencyEdgeTypeSchema>;
|
|
467
466
|
/** A raw entry as stored in dependency.state.json. */
|
|
468
|
-
declare const dependencyStateEntrySchema: z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.
|
|
469
|
-
type: "type";
|
|
470
|
-
runtime: "runtime";
|
|
471
|
-
dynamic: "dynamic";
|
|
472
|
-
}>>], null>]>;
|
|
467
|
+
declare const dependencyStateEntrySchema: z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>]>;
|
|
473
468
|
type DependencyStateEntry = z.infer<typeof dependencyStateEntrySchema>;
|
|
474
469
|
/** Normalized internal representation of a state entry (defaults applied). */
|
|
475
470
|
type NormalizedDependencyStateEntry = {
|
|
476
471
|
nodeId: string;
|
|
477
472
|
depth: number;
|
|
478
|
-
|
|
473
|
+
kindMask: number;
|
|
479
474
|
};
|
|
480
475
|
declare const dependencyStateFileSchema: z.ZodObject<{
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
exclude: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodEnum<{
|
|
487
|
-
type: "type";
|
|
488
|
-
runtime: "runtime";
|
|
489
|
-
dynamic: "dynamic";
|
|
490
|
-
}>>], null>]>>>;
|
|
476
|
+
v: z.ZodLiteral<2>;
|
|
477
|
+
include: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>]>>>;
|
|
478
|
+
i: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>]>>>;
|
|
479
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>]>>>;
|
|
480
|
+
x: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>]>>>;
|
|
491
481
|
}, z.core.$strict>;
|
|
492
482
|
type DependencyStateFile = z.infer<typeof dependencyStateFileSchema>;
|
|
493
|
-
/** Parse and normalize state entries (defaults applied
|
|
483
|
+
/** Parse and normalize state entries (defaults applied). */
|
|
494
484
|
declare const parseDependencyStateFile: (raw: unknown) => {
|
|
495
485
|
include: NormalizedDependencyStateEntry[];
|
|
496
486
|
exclude: NormalizedDependencyStateEntry[];
|
|
497
487
|
};
|
|
498
|
-
/**
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
kind: z.ZodEnum<{
|
|
502
|
-
type: "type";
|
|
503
|
-
runtime: "runtime";
|
|
504
|
-
dynamic: "dynamic";
|
|
505
|
-
}>;
|
|
506
|
-
resolution: z.ZodOptional<z.ZodEnum<{
|
|
507
|
-
explicit: "explicit";
|
|
508
|
-
implicit: "implicit";
|
|
509
|
-
}>>;
|
|
510
|
-
}, z.core.$strict>;
|
|
511
|
-
type DependencyMetaEdge = z.infer<typeof dependencyMetaEdgeSchema>;
|
|
512
|
-
/** Dependency meta node (assistant-facing). */
|
|
488
|
+
/**
|
|
489
|
+
* Dependency meta node (v2 compact).
|
|
490
|
+
*/
|
|
513
491
|
declare const dependencyMetaNodeSchema: z.ZodObject<{
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
missing: "missing";
|
|
519
|
-
}>;
|
|
520
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
521
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
522
|
-
hash: z.ZodOptional<z.ZodString>;
|
|
523
|
-
}, z.core.$strict>>;
|
|
524
|
-
description: z.ZodOptional<z.ZodString>;
|
|
525
|
-
locatorAbs: z.ZodOptional<z.ZodString>;
|
|
492
|
+
k: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
|
|
493
|
+
s: z.ZodOptional<z.ZodNumber>;
|
|
494
|
+
d: z.ZodOptional<z.ZodString>;
|
|
495
|
+
e: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>]>>>;
|
|
526
496
|
}, z.core.$strict>;
|
|
527
497
|
type DependencyMetaNode = z.infer<typeof dependencyMetaNodeSchema>;
|
|
528
498
|
/**
|
|
529
|
-
* Dependency meta file (assistant
|
|
530
|
-
*
|
|
531
|
-
* Notes:
|
|
532
|
-
* - node IDs are repo-relative POSIX paths.
|
|
533
|
-
* - edges is a complete map (key exists for every nodeId; empty array OK).
|
|
499
|
+
* Dependency meta file (v2 assistant\-facing).
|
|
500
|
+
* Key is canonical NodeId.
|
|
534
501
|
*/
|
|
535
502
|
declare const dependencyMetaFileSchema: z.ZodObject<{
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
missing: "missing";
|
|
543
|
-
}>;
|
|
544
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
545
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
546
|
-
hash: z.ZodOptional<z.ZodString>;
|
|
547
|
-
}, z.core.$strict>>;
|
|
548
|
-
description: z.ZodOptional<z.ZodString>;
|
|
549
|
-
locatorAbs: z.ZodOptional<z.ZodString>;
|
|
503
|
+
v: z.ZodLiteral<2>;
|
|
504
|
+
n: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
505
|
+
k: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
|
|
506
|
+
s: z.ZodOptional<z.ZodNumber>;
|
|
507
|
+
d: z.ZodOptional<z.ZodString>;
|
|
508
|
+
e: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodTuple<[z.ZodString, z.ZodNumber], null>, z.ZodTuple<[z.ZodString, z.ZodNumber, z.ZodNumber], null>]>>>;
|
|
550
509
|
}, z.core.$strict>>;
|
|
551
|
-
edges: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
552
|
-
target: z.ZodString;
|
|
553
|
-
kind: z.ZodEnum<{
|
|
554
|
-
type: "type";
|
|
555
|
-
runtime: "runtime";
|
|
556
|
-
dynamic: "dynamic";
|
|
557
|
-
}>;
|
|
558
|
-
resolution: z.ZodOptional<z.ZodEnum<{
|
|
559
|
-
explicit: "explicit";
|
|
560
|
-
implicit: "implicit";
|
|
561
|
-
}>>;
|
|
562
|
-
}, z.core.$strict>>>;
|
|
563
510
|
}, z.core.$strict>;
|
|
564
511
|
type DependencyMetaFile = z.infer<typeof dependencyMetaFileSchema>;
|
|
512
|
+
/**
|
|
513
|
+
* Dependency Map (host-private).
|
|
514
|
+
* Used for staging verification.
|
|
515
|
+
*/
|
|
516
|
+
declare const dependencyMapNodeSchema: z.ZodObject<{
|
|
517
|
+
id: z.ZodString;
|
|
518
|
+
locatorAbs: z.ZodString;
|
|
519
|
+
size: z.ZodNumber;
|
|
520
|
+
sha256: z.ZodString;
|
|
521
|
+
}, z.core.$strip>;
|
|
522
|
+
type DependencyMapNode = z.infer<typeof dependencyMapNodeSchema>;
|
|
523
|
+
declare const dependencyMapFileSchema: z.ZodObject<{
|
|
524
|
+
v: z.ZodLiteral<1>;
|
|
525
|
+
nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
526
|
+
id: z.ZodString;
|
|
527
|
+
locatorAbs: z.ZodString;
|
|
528
|
+
size: z.ZodNumber;
|
|
529
|
+
sha256: z.ZodString;
|
|
530
|
+
}, z.core.$strip>>;
|
|
531
|
+
}, z.core.$strip>;
|
|
532
|
+
type DependencyMapFile = z.infer<typeof dependencyMapFileSchema>;
|
|
565
533
|
|
|
566
534
|
/**
|
|
567
535
|
* Computes context-mode allowlist plans (Base + dependency closure), applying
|
|
@@ -604,72 +572,19 @@ type ContextAllowlistPlan = {
|
|
|
604
572
|
declare const computeContextAllowlistPlan: (args: {
|
|
605
573
|
cwd: string;
|
|
606
574
|
stanPath: string;
|
|
607
|
-
meta:
|
|
575
|
+
meta: DependencyMetaFile;
|
|
608
576
|
state?: unknown;
|
|
609
577
|
selection?: ContextModeSelection;
|
|
610
578
|
}) => Promise<ContextAllowlistPlan>;
|
|
611
579
|
|
|
612
|
-
/**
|
|
613
|
-
* Types for dependency graph build and normalization.
|
|
614
|
-
* @module
|
|
615
|
-
*/
|
|
616
|
-
|
|
617
|
-
type BuildDependencyMetaArgs = {
|
|
618
|
-
cwd: string;
|
|
619
|
-
stanPath: string;
|
|
620
|
-
selection?: {
|
|
621
|
-
includes?: string[];
|
|
622
|
-
excludes?: string[];
|
|
623
|
-
};
|
|
624
|
-
nodeDescriptionLimit?: number;
|
|
625
|
-
nodeDescriptionTags?: string[];
|
|
626
|
-
maxErrors?: number;
|
|
627
|
-
/** Host-injected TypeScript compiler API module (passed through to stan-context). */
|
|
628
|
-
typescript?: unknown;
|
|
629
|
-
/** Host-injected absolute path to a CommonJS TypeScript entry module (passed through to stan-context). */
|
|
630
|
-
typescriptPath?: string;
|
|
631
|
-
};
|
|
632
|
-
type NodeSource = {
|
|
633
|
-
kind: 'repo';
|
|
634
|
-
} | {
|
|
635
|
-
kind: 'npm';
|
|
636
|
-
sourceAbs: string;
|
|
637
|
-
pkgName: string;
|
|
638
|
-
pkgVersion: string;
|
|
639
|
-
pathInPackage: string;
|
|
640
|
-
} | {
|
|
641
|
-
kind: 'abs';
|
|
642
|
-
sourceAbs: string;
|
|
643
|
-
locatorAbs: string;
|
|
644
|
-
};
|
|
645
|
-
type BuildDependencyMetaResult = {
|
|
646
|
-
meta: DependencyMetaFile;
|
|
647
|
-
sources: Record<string, NodeSource>;
|
|
648
|
-
warnings: string[];
|
|
649
|
-
stats?: {
|
|
650
|
-
modules: number;
|
|
651
|
-
edges: number;
|
|
652
|
-
dirty: number;
|
|
653
|
-
};
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
declare const buildDependencyMeta: (args: BuildDependencyMetaArgs) => Promise<BuildDependencyMetaResult>;
|
|
657
|
-
|
|
658
580
|
type StageDependencyContextArgs = {
|
|
659
581
|
cwd: string;
|
|
660
582
|
stanPath: string;
|
|
661
|
-
/**
|
|
662
|
-
|
|
663
|
-
nodes: Record<string, DependencyMetaNode | undefined>;
|
|
664
|
-
};
|
|
665
|
-
/**
|
|
666
|
-
* Optional source map (usually from buildDependencyMeta). If absent, abs
|
|
667
|
-
* nodes can still be staged via meta.nodes[nodeId].locatorAbs.
|
|
668
|
-
*/
|
|
669
|
-
sources?: Record<string, NodeSource>;
|
|
583
|
+
/** Host-private dependency map (canonical node -\> locator/hash). */
|
|
584
|
+
map: DependencyMapFile;
|
|
670
585
|
/**
|
|
671
586
|
* Optional subset of nodeIds to stage (e.g., a selection closure).
|
|
672
|
-
* If omitted, stages all nodeIds present in
|
|
587
|
+
* If omitted, stages all nodeIds present in map (filtered to stageable).
|
|
673
588
|
*/
|
|
674
589
|
nodeIds?: string[];
|
|
675
590
|
/**
|
|
@@ -705,22 +620,15 @@ declare const stageDependencyContext: (args: StageDependencyContextArgs) => Prom
|
|
|
705
620
|
* @module
|
|
706
621
|
*/
|
|
707
622
|
|
|
708
|
-
type DependencyContextMeta = Pick<DependencyMetaFile, 'edges'> & {
|
|
709
|
-
nodes: Record<string, DependencyMetaNode | undefined>;
|
|
710
|
-
};
|
|
711
623
|
type DependencyContextInputs = {
|
|
712
|
-
meta:
|
|
624
|
+
meta: DependencyMetaFile;
|
|
625
|
+
map: DependencyMapFile;
|
|
713
626
|
/**
|
|
714
627
|
* Dependency selection state (assistant-authored).
|
|
715
628
|
* When present, used to compute a selected closure and stage only those nodes.
|
|
716
629
|
* When absent, staging falls back to "all stageable nodes in sources".
|
|
717
630
|
*/
|
|
718
631
|
state?: unknown;
|
|
719
|
-
/**
|
|
720
|
-
* Node source locators (produced by buildDependencyMeta).
|
|
721
|
-
* Strongly recommended for npm nodes; abs nodes may also be staged using locatorAbs from meta.
|
|
722
|
-
*/
|
|
723
|
-
sources?: Record<string, NodeSource>;
|
|
724
632
|
};
|
|
725
633
|
type PrepareDependencyContextResult = {
|
|
726
634
|
/** Include globs required to include <stanPath>/context/** even if gitignored. */
|
|
@@ -732,7 +640,7 @@ type PrepareDependencyContextResult = {
|
|
|
732
640
|
};
|
|
733
641
|
declare const prepareDependencyContext: (args: {
|
|
734
642
|
stanPath: string;
|
|
735
|
-
meta:
|
|
643
|
+
meta: DependencyMetaFile;
|
|
736
644
|
state?: unknown;
|
|
737
645
|
/** Optional override when state is omitted (default: stage all stageable nodes in sources). */
|
|
738
646
|
nodeIdsWhenNoState?: string[];
|
|
@@ -743,8 +651,7 @@ type StagePreparedDependencyContextResult = PrepareDependencyContextResult & {
|
|
|
743
651
|
declare const stagePreparedDependencyContext: (args: {
|
|
744
652
|
cwd: string;
|
|
745
653
|
stanPath: string;
|
|
746
|
-
|
|
747
|
-
sources?: Record<string, NodeSource>;
|
|
654
|
+
map: DependencyMapFile;
|
|
748
655
|
plan: PrepareDependencyContextResult;
|
|
749
656
|
clean?: boolean;
|
|
750
657
|
}) => Promise<StagePreparedDependencyContextResult>;
|
|
@@ -834,10 +741,56 @@ declare const summarizeContextAllowlistBudget: (args: {
|
|
|
834
741
|
selectedNodeIds: ReadonlyArray<string>;
|
|
835
742
|
allowlistFiles: ReadonlyArray<string>;
|
|
836
743
|
};
|
|
837
|
-
meta:
|
|
744
|
+
meta: DependencyMetaFile;
|
|
838
745
|
topN?: number;
|
|
839
746
|
}) => Promise<ContextAllowlistBudget>;
|
|
840
747
|
|
|
748
|
+
/**
|
|
749
|
+
* Types for dependency graph build and normalization.
|
|
750
|
+
* @module
|
|
751
|
+
*/
|
|
752
|
+
|
|
753
|
+
type BuildDependencyMetaArgs = {
|
|
754
|
+
cwd: string;
|
|
755
|
+
stanPath: string;
|
|
756
|
+
selection?: {
|
|
757
|
+
includes?: string[];
|
|
758
|
+
excludes?: string[];
|
|
759
|
+
};
|
|
760
|
+
nodeDescriptionLimit?: number;
|
|
761
|
+
nodeDescriptionTags?: string[];
|
|
762
|
+
maxErrors?: number;
|
|
763
|
+
/** Host-injected TypeScript compiler API module (passed through to stan-context). */
|
|
764
|
+
typescript?: unknown;
|
|
765
|
+
/** Host-injected absolute path to a CommonJS TypeScript entry module (passed through to stan-context). */
|
|
766
|
+
typescriptPath?: string;
|
|
767
|
+
};
|
|
768
|
+
type NodeSource = {
|
|
769
|
+
kind: 'repo';
|
|
770
|
+
} | {
|
|
771
|
+
kind: 'npm';
|
|
772
|
+
sourceAbs: string;
|
|
773
|
+
pkgName: string;
|
|
774
|
+
pkgVersion: string;
|
|
775
|
+
pathInPackage: string;
|
|
776
|
+
} | {
|
|
777
|
+
kind: 'abs';
|
|
778
|
+
sourceAbs: string;
|
|
779
|
+
locatorAbs: string;
|
|
780
|
+
};
|
|
781
|
+
type BuildDependencyMetaResult = {
|
|
782
|
+
meta: DependencyMetaFile;
|
|
783
|
+
map: DependencyMapFile;
|
|
784
|
+
warnings: string[];
|
|
785
|
+
stats?: {
|
|
786
|
+
modules: number;
|
|
787
|
+
edges: number;
|
|
788
|
+
dirty: number;
|
|
789
|
+
};
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
declare const buildDependencyMeta: (args: BuildDependencyMetaArgs) => Promise<BuildDependencyMetaResult>;
|
|
793
|
+
|
|
841
794
|
/**
|
|
842
795
|
* Orchestrates context-mode allowlist-only archiving (Base + dependency closure)
|
|
843
796
|
* by staging selected external node bytes under <stanPath>/context/** and then
|
|
@@ -859,9 +812,9 @@ declare const createContextArchiveWithDependencyContext: (args: {
|
|
|
859
812
|
cwd: string;
|
|
860
813
|
stanPath: string;
|
|
861
814
|
dependency: {
|
|
862
|
-
meta:
|
|
815
|
+
meta: DependencyMetaFile;
|
|
816
|
+
map: DependencyMapFile;
|
|
863
817
|
state?: unknown;
|
|
864
|
-
sources?: Record<string, NodeSource>;
|
|
865
818
|
clean?: boolean;
|
|
866
819
|
};
|
|
867
820
|
selection?: ContextModeSelection;
|
|
@@ -876,9 +829,9 @@ declare const createContextArchiveDiffWithDependencyContext: (args: {
|
|
|
876
829
|
cwd: string;
|
|
877
830
|
stanPath: string;
|
|
878
831
|
dependency: {
|
|
879
|
-
meta:
|
|
832
|
+
meta: DependencyMetaFile;
|
|
833
|
+
map: DependencyMapFile;
|
|
880
834
|
state?: unknown;
|
|
881
|
-
sources?: Record<string, NodeSource>;
|
|
882
835
|
clean?: boolean;
|
|
883
836
|
};
|
|
884
837
|
selection?: ContextModeSelection;
|
|
@@ -910,13 +863,13 @@ declare const createContextArchiveDiffWithDependencyContext: (args: {
|
|
|
910
863
|
* Expand a single state entry into a set of nodeIds (node + closure).
|
|
911
864
|
* BFS is used so depth is intuitive and deterministic.
|
|
912
865
|
*/
|
|
913
|
-
declare const expandEntry: (meta:
|
|
866
|
+
declare const expandEntry: (meta: DependencyMetaFile, entry: NormalizedDependencyStateEntry) => Set<string>;
|
|
914
867
|
/**
|
|
915
868
|
* Compute final selected nodeIds from include/exclude entries.
|
|
916
869
|
* Excludes win (subtract after includes).
|
|
917
870
|
*/
|
|
918
871
|
declare const computeSelectedNodeIds: (args: {
|
|
919
|
-
meta:
|
|
872
|
+
meta: DependencyMetaFile;
|
|
920
873
|
include: NormalizedDependencyStateEntry[];
|
|
921
874
|
exclude: NormalizedDependencyStateEntry[];
|
|
922
875
|
}) => string[];
|
|
@@ -928,20 +881,7 @@ declare const computeSelectedNodeIds: (args: {
|
|
|
928
881
|
*/
|
|
929
882
|
type DependencyValidationMismatch = {
|
|
930
883
|
nodeId: string;
|
|
931
|
-
|
|
932
|
-
reason: 'invalid-nodeId' | 'meta-missing' | 'metadata-missing' | 'package-not-found' | 'package-version-mismatch' | 'file-missing' | 'hash-mismatch' | 'size-mismatch';
|
|
933
|
-
pkgName?: string;
|
|
934
|
-
pkgVersion?: string;
|
|
935
|
-
pathInPackage?: string;
|
|
936
|
-
expectedHash?: string;
|
|
937
|
-
actualHash?: string;
|
|
938
|
-
expectedSize?: number;
|
|
939
|
-
actualSize?: number;
|
|
940
|
-
candidates?: string[];
|
|
941
|
-
} | {
|
|
942
|
-
nodeId: string;
|
|
943
|
-
kind: 'abs';
|
|
944
|
-
reason: 'meta-missing' | 'metadata-missing' | 'locator-missing' | 'file-missing' | 'hash-mismatch' | 'size-mismatch';
|
|
884
|
+
reason: 'map-missing' | 'file-missing' | 'hash-mismatch' | 'size-mismatch';
|
|
945
885
|
locatorAbs?: string;
|
|
946
886
|
expectedHash?: string;
|
|
947
887
|
actualHash?: string;
|
|
@@ -951,7 +891,6 @@ type DependencyValidationMismatch = {
|
|
|
951
891
|
type ValidateDependencySelectionResult = {
|
|
952
892
|
ok: boolean;
|
|
953
893
|
selectedNodeIds: string[];
|
|
954
|
-
checkedNodeIds: string[];
|
|
955
894
|
mismatches: DependencyValidationMismatch[];
|
|
956
895
|
};
|
|
957
896
|
|
|
@@ -960,30 +899,24 @@ type ValidateDependencySelectionResult = {
|
|
|
960
899
|
* satisfied by the current environment.
|
|
961
900
|
*
|
|
962
901
|
* - Computes selected node IDs from meta+state closure (excludes win).
|
|
963
|
-
* - Validates external nodes
|
|
964
|
-
* - npm nodes under `<stanPath>/context/npm/**` by locating `<pkgName>\@<pkgVersion>`
|
|
965
|
-
* in the current install and hashing `<pathInPackage>`.
|
|
966
|
-
* - abs nodes under `<stanPath>/context/abs/**` by hashing `locatorAbs`.
|
|
902
|
+
* - Validates external nodes (npm/abs) against `dependency.map.json`.
|
|
967
903
|
*
|
|
968
904
|
* @param args - Validation inputs.
|
|
969
905
|
* @returns Validation result with deterministic mismatches.
|
|
970
906
|
*/
|
|
971
907
|
declare const validateDependencySelection: (args: {
|
|
972
|
-
cwd: string;
|
|
973
908
|
stanPath: string;
|
|
974
|
-
meta:
|
|
909
|
+
meta: DependencyMetaFile;
|
|
910
|
+
map: DependencyMapFile;
|
|
975
911
|
state: unknown;
|
|
976
912
|
}) => Promise<ValidateDependencySelectionResult>;
|
|
977
913
|
/**
|
|
978
914
|
* Validate dependency selection and throw on mismatch (strict undo/redo seam).
|
|
979
|
-
*
|
|
980
|
-
* @param args - Validation inputs.
|
|
981
|
-
* @returns Resolves when validation passes; throws when mismatches exist.
|
|
982
915
|
*/
|
|
983
916
|
declare const validateDependencySelectionOrThrow: (args: {
|
|
984
|
-
cwd: string;
|
|
985
917
|
stanPath: string;
|
|
986
|
-
meta:
|
|
918
|
+
meta: DependencyMetaFile;
|
|
919
|
+
map: DependencyMapFile;
|
|
987
920
|
state: unknown;
|
|
988
921
|
}) => Promise<void>;
|
|
989
922
|
|
|
@@ -1026,5 +959,5 @@ declare const assembleSystemMonolith: (cwd: string, stanPath: string) => Promise
|
|
|
1026
959
|
|
|
1027
960
|
declare const CORE_VERSION: string;
|
|
1028
961
|
|
|
1029
|
-
export { CORE_VERSION, DEFAULT_OPEN_COMMAND, DEFAULT_STAN_PATH, applyPatchPipeline, applyWithJsDiff, assembleSystemMonolith, buildDependencyMeta, computeContextAllowlistPlan, computeSelectedNodeIds, createArchive, createArchiveDiff, createArchiveDiffWithDependencyContext, createArchiveWithDependencyContext, createContextArchiveDiffWithDependencyContext, createContextArchiveWithDependencyContext, createMetaArchive,
|
|
1030
|
-
export type { ApplyResult, AssembleResult, AttemptCapture, Block, BlockKind, BudgetEntry, BudgetSource, BuildDependencyMetaArgs, BuildDependencyMetaResult, ContextAllowlistBudget, ContextAllowlistPlan, ContextConfig, ContextModeSelection, CreateArchiveDiffWithDependencyContextResult, CreateArchiveFromFilesOptions, CreateArchiveOptions, CreateArchiveWithDependencyContextResult, CreateContextArchiveDiffResult, CreateContextArchiveOptions, CreateContextArchiveResult, DependencyContextInputs,
|
|
962
|
+
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, validateOrThrow, validateResponseMessage, writeArchiveSnapshot, writeDependencyMetaFile };
|
|
963
|
+
export type { ApplyResult, AssembleResult, AttemptCapture, Block, BlockKind, 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, ValidateResponseOptions, ValidationResult };
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@dotenvx/dotenvx": "^1.52.0",
|
|
27
27
|
"@eslint/js": "^9.39.2",
|
|
28
|
-
"@karmaniverous/stan-context": "^0.
|
|
28
|
+
"@karmaniverous/stan-context": "^0.6.0",
|
|
29
29
|
"@rollup/plugin-alias": "^6.0.0",
|
|
30
30
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
31
31
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"tslib": "^2.8.1",
|
|
61
61
|
"tsx": "^4.21.0",
|
|
62
62
|
"typedoc": "^0.28.16",
|
|
63
|
-
"typedoc-plugin-mdn-links": "^5.1.
|
|
63
|
+
"typedoc-plugin-mdn-links": "^5.1.1",
|
|
64
64
|
"typedoc-plugin-replace-text": "^4.2.0",
|
|
65
65
|
"typescript": "^5.9.3",
|
|
66
66
|
"typescript-eslint": "^8.53.1",
|
|
@@ -151,5 +151,5 @@
|
|
|
151
151
|
},
|
|
152
152
|
"type": "module",
|
|
153
153
|
"types": "dist/types/index.d.ts",
|
|
154
|
-
"version": "0.
|
|
154
|
+
"version": "0.8.0"
|
|
155
155
|
}
|