cyber-agentkit 1.1.0 → 2.0.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/dist/index.d.ts CHANGED
@@ -1,27 +1,97 @@
1
1
  import { n as harnessIds, t as HarnessId } from "./harness-id-BgKL-x6C.js";
2
- import { A as FoundSkill, C as defaultLayer, D as ReferenceCode, E as userReferencesDir, M as skillsIn, N as Platform, O as ReferenceWarning, S as SkillDefaults, T as referenceLayers, _ as ReferenceLayer, a as ReferenceTrace, b as ReferencePlugin, c as ReferenceTraceSection, d as referenceNames, f as resolveReference, g as SectionSource, h as MergeOperation, i as ReferenceStatus, j as skillName, k as ReferenceWarningCode, l as ResolveOptions, m as parseReferenceName, n as ExtendsStep, o as ReferenceTraceContribution, p as ReferenceName, r as OperationSource, s as ReferenceTraceLayer, t as AmbiguousCause, u as ResolvedReference, v as ReferenceLayerOptions, w as projectReferencesDir, x as ReferenceTier, y as ReferenceLayers } from "./resolve-reference-D62VJZc0.js";
3
- //#region src/references/load-reference.d.ts
4
- /** `referenceLayers`' options, with the machine's own home directory, platform, and environment by default. */
5
- type LoadReferenceOptions = Omit<ReferenceLayerOptions, 'home' | 'platform' | 'folder'> & {
6
- home?: string | undefined;
7
- platform?: Platform | undefined;
2
+ import { A as referenceLayers, B as ReferenceCode, C as ReferenceLayer, D as ReferenceTier, E as ReferencePlugin, F as ReferenceSourcePlugin, G as ReferenceWarning, H as ReferenceErrorCode, I as ReferenceTraceSource, J as referenceCodes, K as ReferenceWarningCode, L as ProjectFolder, M as userReferencesDir, N as GeneratedRecord, O as SkillDefaults, P as ReferenceSource, Q as AssetLayerOptions, R as ProjectFolderCache, S as PluginOrigin, T as ReferenceLayers, U as ReferenceNoticeCode, V as ReferenceCodeKind, W as ReferenceStatusCode, X as skillName, Y as FoundSkill, Z as skillsIn, _ as ResolvedProjectSection, a as AmbiguousCause, b as MergeOperation, c as ReferenceTrace, d as ReferenceTraceSection, et as AssetTier, f as ResolveOptions, g as ReferenceTraceProjectSection, h as resolveReference, i as whereReference, j as repoReferencesDir, k as defaultLayer, l as ReferenceTraceContribution, m as referenceNames, n as ReferenceWhereReport, nt as Platform, o as OperationSource, p as ResolvedReference, q as referenceCodeExit, r as WhereOptions, s as ReferenceStatus, t as ReferenceWhereFile, tt as AssetWarning, u as ReferenceTraceLayer, v as ReferenceName, w as ReferenceLayerOptions, x as SectionSource, y as parseReferenceName, z as ProjectFolders } from "./reference-where-BsBpwLyg.js";
3
+ //#region src/references/reference-stack.d.ts
4
+ /** One `sections` entry of a step: a top-level heading, and the operation it applies with when one is written. */
5
+ type StepSection = {
6
+ heading: string;
7
+ merge?: MergeOperation;
8
8
  };
9
9
  /**
10
- * Resolves one reference for `root` the way `reference show` does, returning the full record: every
11
- * field `show` prints with `--metadata` and `--trace`. A name that is not a reference name comes back
12
- * `invalid`, and one no contribution answers `missing`; neither throws.
10
+ * One `extends` entry: a plugin or `default`, with the keys to use for it in place of its own. With
11
+ * `sections`, it contributes only those top-level sections (R52).
13
12
  */
14
- export declare function loadReference(name: string, options: LoadReferenceOptions & {
15
- folder?: ReferenceLayerOptions['folder'];
16
- }): Promise<ResolvedReference>;
13
+ type ExtendsStep = {
14
+ target: string;
15
+ merge?: MergeOperation;
16
+ extends?: ExtendsStep[];
17
+ sections?: StepSection[];
18
+ };
19
+ //#endregion
20
+ //#region src/assets/asset-name.d.ts
21
+ type AssetFormat = 'markdown' | 'json' | 'yaml' | 'toml' | 'txt';
22
+ //#endregion
23
+ //#region src/assets/resolve-asset.d.ts
24
+ type AssetStatus = 'found' | 'missing' | 'ambiguous' | 'invalid';
25
+ /** One layer checked, as the trace reports it. */
26
+ type AssetTraceLayer = {
27
+ tier: AssetTier;
28
+ plugin?: string;
29
+ skill?: string;
30
+ /** The file matched, or the folder checked when none matched. */
31
+ path: string;
32
+ /** The file that answered, relative to the folder: `<name>.<ext>`. */
33
+ file?: string;
34
+ operation?: 'replace';
35
+ operationFrom?: 'default' | 'contribution';
36
+ /** `used`; `shadowed by ...`; `not used (...)`; `not read (...)`; `ambiguous`; or `missing`. */
37
+ outcome: string;
38
+ /** A file with nothing in it. */
39
+ empty?: boolean;
40
+ };
41
+ type AssetTraceContribution = {
42
+ tier: AssetTier;
43
+ plugin?: string;
44
+ skill?: string;
45
+ path: string;
46
+ operation: 'replace';
47
+ };
48
+ type AssetTrace = {
49
+ /** The plugins and `default` the name builds on, bottom first. */
50
+ stack: string[];
51
+ /** What decided the stack: `selection`, `qualified name`, or `none`. */
52
+ builtBy: string;
53
+ /** The contributions whose text the answer holds, bottom first. */
54
+ contributions: AssetTraceContribution[];
55
+ /** Always empty: an asset is never composed. Kept so the trace has the shape a reference trace has. */
56
+ sections: never[];
57
+ /** Every layer checked, highest first. */
58
+ layers: AssetTraceLayer[];
59
+ /** The harnesses detected, whose managed folders and enabled plugins were read. */
60
+ harnesses: string[];
61
+ };
62
+ /** A name resolved, with every field: the command prints a subset. A bad name is a status, never thrown. */
63
+ type ResolvedAsset = {
64
+ name: string;
65
+ status: AssetStatus;
66
+ /** Set when not `found`. */
67
+ code?: 'reference-missing' | 'reference-ambiguous' | 'reference-invalid';
68
+ /** Why it is not `found`, for a person. */
69
+ message?: string;
70
+ /** The file as written. */
71
+ content?: string;
72
+ /** Set when `found`: `markdown`, or the format of the data file that answered. */
73
+ format?: AssetFormat;
74
+ /** Always empty: an asset has no frontmatter that composes. */
75
+ metadata?: Record<string, unknown>;
76
+ /** When `ambiguous`: each `<plugin>/<name>`, and `default` when the skill has one. */
77
+ options?: string[];
78
+ cause?: 'unordered';
79
+ warnings: AssetWarning[];
80
+ trace: AssetTrace;
81
+ };
17
82
  //#endregion
18
83
  //#region src/assets/load-asset.d.ts
84
+ /** `assetLayers`' options, with the machine's own home directory, platform, and environment by default. */
85
+ type LoadAssetOptions = Omit<AssetLayerOptions, 'home' | 'platform'> & {
86
+ home?: string | undefined;
87
+ platform?: Platform | undefined;
88
+ };
19
89
  /**
20
- * Resolves one asset by name the way `asset load` does: the reference engine, reading `assets/` where
21
- * it reads `references/`. A data file answers whole from the highest tier holding the name; the skill's
22
- * own `assets/<name>.<ext>` (`defaultSkill`) is the lowest.
90
+ * Resolves one asset by name the way `asset load` does, reading `assets/` folders through the tiers.
91
+ * A data file answers whole from the highest tier holding the name; the skill's own
92
+ * `assets/<name>.<ext>` (`defaultSkill`) is the lowest.
23
93
  */
24
- export declare function loadAsset(name: string, options: LoadReferenceOptions): Promise<ResolvedReference>;
94
+ export declare function loadAsset(name: string, options: LoadAssetOptions): Promise<ResolvedAsset>;
25
95
  //#endregion
26
96
  //#region src/harness/harness-environment.d.ts
27
97
  /**
@@ -426,6 +496,111 @@ interface PluginStorage {
426
496
  */
427
497
  export declare function pluginStorage(harness: HarnessId, environment?: HarnessEnvironment): PluginStorage;
428
498
  //#endregion
499
+ //#region src/prose-update/split-sentences.d.ts
500
+ type SentenceKind = 'text' | 'heading' | 'item' | 'row' | 'fence' | 'quote';
501
+ /** The unit prose-update compares: see K4 in the prose-update spec. */
502
+ type Sentence = {
503
+ text: string;
504
+ kind: SentenceKind;
505
+ /** What separated this sentence from the one before it: nothing, a space, a newline, or a blank line. */
506
+ gap: '' | ' ' | '\n' | '\n\n';
507
+ };
508
+ //#endregion
509
+ //#region src/prose-update/merge.d.ts
510
+ /** A place where the owner and the offered wording each changed the same base sentences differently. */
511
+ type Collision = {
512
+ base: Sentence[];
513
+ found: Sentence[];
514
+ offered: Sentence[];
515
+ };
516
+ //#endregion
517
+ //#region src/prose-update/classify.d.ts
518
+ type Outcome = 'up-to-date' | 'update' | 'conflict' | 'owners' | 'undetermined';
519
+ type Reason = 'no-history' | 'empty-section' | 'tied-base' | 'no-base';
520
+ /** The retired wording a found text descends from: its place in the history (0 is the newest) and its date. */
521
+ type BaseRef = {
522
+ index: number;
523
+ date?: string | undefined;
524
+ };
525
+ type PartResult = {
526
+ path: string[];
527
+ key: string;
528
+ outcome: Outcome;
529
+ reason?: Reason;
530
+ /** Set with `tied-base`: the places in the history of the wordings that tied. */
531
+ tied?: number[];
532
+ base?: BaseRef;
533
+ /** Sentences the found part shares with the base part (K10), and the base part's sentence count. */
534
+ shared?: number;
535
+ baseSentences?: number;
536
+ revision?: 'append' | 'rewrite';
537
+ /** The part's text: as found for `up-to-date` and `owners`, merged for `update` (empty when the part is removed). */
538
+ text?: string;
539
+ collisions?: Collision[];
540
+ };
541
+ type Classification = {
542
+ outcome: Outcome;
543
+ reason?: Reason;
544
+ base?: BaseRef;
545
+ parts: PartResult[];
546
+ /** The found text for every outcome but `update` and `conflict`; the merged text otherwise. */
547
+ text: string;
548
+ };
549
+ type ClassifyInput = {
550
+ found: string;
551
+ offered: string;
552
+ /** A history text (parsed by `parseHistory`), or retired wordings, newest first. */
553
+ history: string | readonly string[];
554
+ };
555
+ /** The offered wording is empty, so nothing can be classified (R33). */
556
+ export declare class ProseUpdateError extends Error {
557
+ readonly code: 'empty-offered';
558
+ constructor(code: 'empty-offered', message: string);
559
+ }
560
+ /** Classifies each part of the found text against the offered wording and the history, and merges where it can. */
561
+ export declare function classify(input: ClassifyInput): Classification;
562
+ //#endregion
563
+ //#region src/prose-update/history.d.ts
564
+ type RetiredWording = {
565
+ wording: string;
566
+ date: string;
567
+ reason: string;
568
+ };
569
+ /** An entry that did not parse: its place among the `Superseded` headings (from 0), its line (from 1), and its heading. */
570
+ type InvalidEntry = {
571
+ position: number;
572
+ line: number;
573
+ heading: string;
574
+ };
575
+ type ParsedHistory = {
576
+ entries: RetiredWording[];
577
+ invalid: InvalidEntry[];
578
+ };
579
+ /**
580
+ * Reads the retired wordings of a history text, newest first. Each entry is a `## Superseded <date> — <reason>`
581
+ * heading followed by the wording in a fence. An entry that does not parse is returned in `invalid`.
582
+ */
583
+ export declare function parseHistory(text: string): ParsedHistory;
584
+ /**
585
+ * Returns the history text with the outgoing wording added as its newest entry and every other byte unchanged.
586
+ * The wording equal to the newest retired one changes nothing.
587
+ */
588
+ export declare function retire(history: string, wording: string, date: string, reason: string): string;
589
+ //#endregion
590
+ //#region src/references/load-reference.d.ts
591
+ /** `referenceLayers`' options, with the machine's own home directory, platform, and environment by default. */
592
+ type LoadReferenceOptions = Omit<ReferenceLayerOptions, 'home' | 'platform'> & {
593
+ home?: string | undefined;
594
+ platform?: Platform | undefined;
595
+ };
596
+ /**
597
+ * Resolves one reference for the root the way `reference load` does, returning the full record: every
598
+ * field `load` prints with `--metadata` and `--trace`. A name that is not a reference name comes back
599
+ * `invalid`, and one no contribution answers `missing`; neither throws. An empty name throws
600
+ * `ReferenceFailure` with `name-missing`, and a `root` that does not exist with `root-missing`.
601
+ */
602
+ export declare function loadReference(name: string, options: LoadReferenceOptions): Promise<ResolvedReference>;
603
+ //#endregion
429
604
  //#region src/references/reference-catalog.d.ts
430
605
  /** One row per name. */
431
606
  type ReferenceListRow = {
@@ -433,9 +608,12 @@ type ReferenceListRow = {
433
608
  name: string;
434
609
  description: string;
435
610
  status: ReferenceStatus;
611
+ /** Set when not `found`. */
612
+ code?: ReferenceStatusCode;
436
613
  /** When `ambiguous`: each `<plugin>/<name>`, and each skill's default as `default of <skill>`. */
437
614
  options?: string[];
438
615
  };
616
+ type ReferenceListRowKind = 'selection' | 'generated' | 'project-section';
439
617
  /** One row per name per layer holding it, with the outcome that contribution gets. */
440
618
  type ReferenceListLayerRow = {
441
619
  name: string;
@@ -445,8 +623,10 @@ type ReferenceListLayerRow = {
445
623
  path: string;
446
624
  description: string;
447
625
  outcome: string;
448
- /** A contribution with `extends` and no body. */
449
- selection?: boolean;
626
+ /** What the row is, when it is one: a contribution with `extends` and no body, a generated document, or a project section. */
627
+ kind?: ReferenceListRowKind;
628
+ /** A project section's folder, relative to the root. */
629
+ folder?: string;
450
630
  /** A skill's default: the `default` step reaches it when this skill loads the name. */
451
631
  reachedBy?: string;
452
632
  };
@@ -479,6 +659,8 @@ type SearchMatch = {
479
659
  skill?: string;
480
660
  /** A match found as this skill loads the name, its default joined. */
481
661
  loadedBy?: string;
662
+ /** A match in a project section: its folder, relative to the root. */
663
+ folder?: string;
482
664
  };
483
665
  type ReferenceSearch = {
484
666
  matches: SearchMatch[];
@@ -486,8 +668,8 @@ type ReferenceSearch = {
486
668
  defaults?: string;
487
669
  };
488
670
  /**
489
- * Every name resolves the way `show` would, and each skill's default as its skill loads it; a name
490
- * no extends orders is searched once per plugin, as the qualified name `show` would need, and a name
671
+ * Every name resolves the way `load` would, and each skill's default as its skill loads it; a name
672
+ * no extends orders is searched once per plugin, as the qualified name `load` would need, and a name
491
673
  * a `remove` turned off is left out.
492
674
  */
493
675
  export declare function searchReferences(query: string, source: Source$2, options?: ResolveOptions): ReferenceSearch;
@@ -495,6 +677,14 @@ export declare function searchReferences(query: string, source: Source$2, option
495
677
  //#region src/references/reference-interface.d.ts
496
678
  /** `one`: the implementation is named `<id>`. `many`: each is named `<id>.<key>`. */
497
679
  type InterfaceCardinality = 'one' | 'many';
680
+ /** One section an implementation holds, as the interface lists it (R63, C7). Heading text is API. */
681
+ type InterfaceSection = {
682
+ heading: string;
683
+ /** A required section left out or marked `**Unsupported.**` fails the `required` check (R64). */
684
+ required: boolean;
685
+ /** One line saying what it holds: an implementation's stub states it (R28). It is never checked. */
686
+ holds?: string;
687
+ };
498
688
  /** The machine-readable part of an interface document, read from its `interface:` frontmatter. */
499
689
  type ReferenceInterface = {
500
690
  id: string;
@@ -502,15 +692,16 @@ type ReferenceInterface = {
502
692
  version: number;
503
693
  /** The versions the owner's consumers accept; `[version]` when the document names none. */
504
694
  versions: number[];
505
- /** The implementation's top-level sections, in order. Every one is optional. Heading text is API. */
506
- sections: string[];
695
+ /** The implementation's top-level sections, in order. */
696
+ sections: InterfaceSection[];
507
697
  };
508
698
  /** One `implements:` value, `<id>@<version>`. */
509
699
  type ImplementsEntry = {
510
700
  id: string;
511
701
  version: number;
512
702
  };
513
- type InterfaceCheck = 'interface found' | 'version' | 'name' | 'order' | 'interface' | 'compose';
703
+ /** The checks `check` runs, each named in kebab-case (UC6). */
704
+ type InterfaceCheck = 'interface-found' | 'version' | 'name' | 'order' | 'required' | 'interface' | 'compose';
514
705
  type InterfaceCheckFailure = {
515
706
  check: InterfaceCheck;
516
707
  /** The interface id the failure is about, when the document names one. */
@@ -522,7 +713,7 @@ type InterfaceCheckFailure = {
522
713
  type ReferenceCheckKind = 'interface' | 'implementation' | 'none';
523
714
  /** A failed check, named by the check; a name not `found` fails with its status code. */
524
715
  type ReferenceCheckFailure = {
525
- check: InterfaceCheck | ReferenceCode;
716
+ check: InterfaceCheck | ReferenceStatusCode;
526
717
  /** The interface id the failure is about, when the document names one. */
527
718
  interface?: string;
528
719
  message: string;
@@ -530,35 +721,229 @@ type ReferenceCheckFailure = {
530
721
  type ReferenceCheckEntry = {
531
722
  name: string;
532
723
  kind: ReferenceCheckKind;
533
- /** `passed` and `failed` are about the composed document; the others mean none was composed. */
724
+ /**
725
+ * `passed` and `failed` are about the composed document; the others mean none was composed. A name
726
+ * a `remove` turned off is `missing` with no failures: it is off on purpose (R117).
727
+ */
534
728
  status: 'passed' | 'failed' | 'missing' | 'ambiguous' | 'invalid';
729
+ /** Empty when the entry passes. */
535
730
  failures: ReferenceCheckFailure[];
536
- /** For an implementation: the listed sections it marks `**Unsupported.**` or leaves out. */
731
+ /** For an implementation: the optional listed sections it marks `**Unsupported.**` or leaves out. */
537
732
  unsupported: string[];
733
+ /**
734
+ * What is passed on and never fails a check: a warning composing raised that depends on what is
735
+ * installed or chosen (UC6.8), every warning a project section raised (R118), an interface's older
736
+ * id (R96), a moved base (R86), a hidden file (R112).
737
+ */
738
+ warnings: ReferenceWarning[];
538
739
  /** Checked as this skill loads the name, its default joined. */
539
740
  loadedBy?: string;
540
741
  };
541
742
  type CheckOptions = ResolveOptions & {
542
- /** The references to check; every interface document and implementation found when omitted. */
743
+ /** The references to check; every name found when omitted. */
543
744
  names?: readonly string[] | undefined;
544
745
  };
545
746
  type Source$1 = ReferenceLayers | readonly ReferenceLayer[];
546
747
  /**
547
- * Checks each named reference, or, with no names, every interface document and implementation found.
548
- * A name several plugins hold is also checked as each `<plugin>/<name>`, so each author sees their own
549
- * result, and each skill's default as its skill loads it.
748
+ * Checks each named reference, or, with no names, every name found, reporting every warning `load`
749
+ * raises for each (R116). A name several plugins hold is also checked as each `<plugin>/<name>`, so
750
+ * each author sees their own result, and each skill's default as its skill loads it. Beside what
751
+ * `load` raises, a hidden `repo`, `user`, or project-section file (J2, R112) and a plugin's or
752
+ * default's file whose base moved (R86) are passed on. A warning never fails a check.
550
753
  */
551
754
  export declare function checkReferences(source: Source$1, options?: CheckOptions): ReferenceCheckEntry[];
552
755
  //#endregion
756
+ //#region src/references/reference-write-target.d.ts
757
+ /**
758
+ * Where a write lands: the repo or user tier, a folder's project section, or a plugin's or a skill's
759
+ * source folder in the repository.
760
+ */
761
+ type WriteScope = 'repo' | 'user' | 'project' | 'plugin' | 'default';
762
+ //#endregion
763
+ //#region src/references/reference-base.d.ts
764
+ /** What the generator reads for a target (R84): the interface's stub when one is named, then the main document. */
765
+ type GeneratorBase = {
766
+ /** The stub, then the main document built for the target; empty when neither is there. */
767
+ content: string;
768
+ /** For a folder target: the project sections of the folders above it, then the package plugins' for its own, in path order. */
769
+ projectSections: ResolvedProjectSection[];
770
+ /** The interface's stub, when one is named. */
771
+ stub?: string;
772
+ /** The main document built for the target, which a request records the sources of. */
773
+ resolved: ResolvedReference;
774
+ };
775
+ //#endregion
776
+ //#region src/references/reference-write.d.ts
777
+ type CreateResult = {
778
+ name: string;
779
+ scope: WriteScope;
780
+ path: string;
781
+ /** A project section's folder, relative to the root. */
782
+ folder?: string;
783
+ content: string;
784
+ dryRun: boolean;
785
+ /** Things to know that are not faults, such as a missing `description`. */
786
+ hints: string[];
787
+ /** Faults that did not stop the write, such as a contribution above that hides the file (R26). */
788
+ warnings: ReferenceWarning[];
789
+ /** The name resolved again after the write, when the file is a layer the stack reads or a project section. */
790
+ after?: ResolvedReference;
791
+ };
792
+ type DeleteResult = {
793
+ name: string;
794
+ scope: WriteScope;
795
+ /** The file deleted, or the one looked for when there was none. */
796
+ path: string;
797
+ /** A project section's folder, relative to the root. */
798
+ folder?: string;
799
+ /** The metadata file (K31) that went with a non-Markdown file (R95). */
800
+ metadataFile?: string;
801
+ dryRun: boolean;
802
+ /** The file held a selection (`extends`), which went with it. */
803
+ selection?: string[];
804
+ /** Set on a no-op: no file there to delete. */
805
+ code?: 'no-file';
806
+ /** What the notice says, for a person. */
807
+ message?: string;
808
+ /** What answers the name once the file is gone. */
809
+ after: ResolvedReference;
810
+ };
811
+ //#endregion
812
+ //#region src/references/write-reference.d.ts
813
+ /** Where a write goes; a folder is relative to `cwd`. Pass at most one of `scope`, `in`, `pluginFolder`, and `default`. */
814
+ type PlaceOptions = {
815
+ /** `repo` (default) or `user`. */
816
+ scope?: string | undefined;
817
+ /** A folder strictly below the root, which must exist and not be git-ignored: its project section. */
818
+ in?: string | undefined;
819
+ /** A plugin's source folder in the repository: its `references/<name>.md`. */
820
+ pluginFolder?: string | undefined;
821
+ /** A skill's source folder in the repository: its `references/<name>.default.md`. It also joins as the `default` tier. */
822
+ default?: string | undefined;
823
+ /** Report what would be written or deleted, and change nothing. */
824
+ dryRun?: boolean | undefined;
825
+ };
826
+ type CreateReferenceOptions = LoadReferenceOptions & PlaceOptions & {
827
+ /** `replace`, `patch` (default in the `repo` and `user` tiers), `combine`, or `remove`. */
828
+ merge?: string | undefined;
829
+ /** A file whose text is written as it is, frontmatter included. */
830
+ template?: string | undefined;
831
+ /** An interface id: its sections are written as `##` headings, each stubbed `**Unsupported.**`. */
832
+ implements?: string | undefined;
833
+ };
834
+ type DeleteReferenceOptions = LoadReferenceOptions & PlaceOptions;
835
+ /**
836
+ * Starts a contribution the way `reference create` does and returns its record: the path, the
837
+ * content, its warnings (such as `reference-hidden` for a file a contribution above hides, which is
838
+ * written all the same), and the name resolved after the write. A refused write throws
839
+ * `ReferenceError` with its code, marked `usage` for a wrong call.
840
+ */
841
+ export declare function createReference(name: string, options: CreateReferenceOptions): Promise<CreateResult>;
842
+ /**
843
+ * Deletes the file answering a name at one place the way `reference delete` does, with a non-Markdown
844
+ * file's metadata file, and returns what answers the name afterwards. With no file there it is a
845
+ * no-op whose record carries the `no-file` code. A refused delete throws `ReferenceError`.
846
+ */
847
+ export declare function deleteReference(name: string, options: DeleteReferenceOptions): Promise<DeleteResult>;
848
+ //#endregion
849
+ //#region src/references/reference-customize.d.ts
850
+ /**
851
+ * What `customize` did: printed the generator's input (`base`), wrote picks (`selection`), wrote a
852
+ * generated body (`generated`), or removed the picks (`cleared`).
853
+ */
854
+ type CustomizeAction = 'base' | 'selection' | 'generated' | 'cleared';
855
+ type CustomizeResult = {
856
+ name: string;
857
+ scope: WriteScope;
858
+ action: CustomizeAction;
859
+ /** The file written, removed, or that would be: the Markdown file, a data file, or a metadata file holding picks. */
860
+ path: string;
861
+ /** A project section's folder, relative to the root. */
862
+ folder?: string;
863
+ /** The text written to `path`; none when the file was deleted. */
864
+ content?: string;
865
+ /** A non-Markdown name's metadata file (K31), which holds the generated record (R92). */
866
+ metadataFile?: string;
867
+ metadataContent?: string;
868
+ /** The picks written, as `extends` holds them. */
869
+ extends?: unknown[];
870
+ /** `--extends none` left the file with nothing in it, so it was deleted. */
871
+ deleted?: boolean;
872
+ /** Set on a no-op: `--extends none` with no selection there. */
873
+ code?: 'no-selection';
874
+ /** What the notice says, for a person. */
875
+ message?: string;
876
+ dryRun: boolean;
877
+ /** Things to know that are not faults, such as a generated body written against the old stack (R83). */
878
+ hints: string[];
879
+ /** Faults that did not stop the write: a contribution above that hides it (R26), or a managed `extends` deciding the stack (R109). */
880
+ warnings: ReferenceWarning[];
881
+ /** `base`: what the generator reads for the target. */
882
+ base?: GeneratorBase;
883
+ /** The name resolved again after the write. */
884
+ after?: ResolvedReference;
885
+ };
886
+ type CustomizeReferenceOptions = LoadReferenceOptions & Omit<PlaceOptions, 'pluginFolder'> & {
887
+ /** The picks, bottom first: each `<plugin>`, `<plugin>:<merge>`, or `default`; `['none']` removes them. */
888
+ extends?: readonly string[] | undefined;
889
+ /** A YAML file holding the whole `extends` list. */
890
+ extendsFile?: string | undefined;
891
+ /** The file holding the customizer's request; pass it with `body`. */
892
+ request?: string | undefined;
893
+ /** The file holding the body to write; pass it with `request`. */
894
+ body?: string | undefined;
895
+ /** How a generated body applies over what is below: `patch` (default), `combine`, `replace`, or `remove`. */
896
+ merge?: string | undefined;
897
+ /** An interface id: the body is a whole implementation of it. */
898
+ implements?: string | undefined;
899
+ /** Return the generator's input (R84) and write nothing. */
900
+ base?: boolean | undefined;
901
+ };
902
+ /**
903
+ * Customizes a name the way `reference customize` does and returns its record: what was written,
904
+ * its warnings (such as `reference-hidden`), and the name resolved after; with `base`, the
905
+ * generator's input. A refused customization throws `ReferenceError` with its code, marked `usage`
906
+ * for a wrong call.
907
+ */
908
+ export declare function customizeReference(name: string, options: CustomizeReferenceOptions): Promise<CustomizeResult>;
909
+ //#endregion
910
+ //#region src/references/reference-error.d.ts
911
+ type ReferenceErrorOptions = {
912
+ /** Fields an agent can act on, such as the path refused. Each value a scalar or a list of scalars. */
913
+ details?: Record<string, string | number | boolean | null | readonly (string | number | boolean | null)[]> | undefined;
914
+ /** What to do about it, such as the command that fixes it. */
915
+ help?: string | readonly string[] | undefined;
916
+ };
917
+ /**
918
+ * A request a reference function cannot complete, or one called wrongly, thrown by a library
919
+ * function and by a write (R48). The `code` is stable and in `referenceCodes`; `usage` marks a wrong
920
+ * invocation, which a command exits 2 on, rather than a refusal, which it exits 1 on. A name that is
921
+ * not `found` is a status in its record, never this error.
922
+ *
923
+ * The package exports it as `ReferenceError` (C9); inside the source it keeps this name, so no module
924
+ * shadows the global `ReferenceError`.
925
+ */
926
+ declare class ReferenceFailure extends Error {
927
+ readonly name = "ReferenceError";
928
+ readonly code: ReferenceCode;
929
+ readonly usage: boolean;
930
+ readonly details: NonNullable<ReferenceErrorOptions['details']>;
931
+ readonly help: string[];
932
+ constructor(code: ReferenceCode, message: string, { details, help }?: ReferenceErrorOptions);
933
+ }
934
+ //#endregion
553
935
  //#region src/references/reference-implementations.d.ts
554
936
  type ReferenceImplementation = {
555
- /** What a consumer loads: the name as it resolved, `<plugin>/<name>` when no extends orders the plugins holding it. */
937
+ /**
938
+ * What a consumer loads: a plugin's implementation by its qualified name, `<plugin>/<name>`; a
939
+ * `repo` or `user` implementation of a `many` interface by its bare name (R35).
940
+ */
556
941
  pin: string;
557
942
  description: string;
558
- /** The listed sections it marks `**Unsupported.**` or leaves out, in the interface's order. */
943
+ /** The optional listed sections it marks `**Unsupported.**` or leaves out, in the interface's order. */
559
944
  unsupported: string[];
560
945
  name: string;
561
- /** The tier of the highest contribution whose text it holds. */
946
+ /** `plugin`, or the `repo` or `user` tier of a bare-name implementation. */
562
947
  tier: ReferenceTier;
563
948
  version: number;
564
949
  };
@@ -582,45 +967,16 @@ type ImplementationsOptions = ResolveOptions & {
582
967
  type Source = ReferenceLayers | readonly ReferenceLayer[];
583
968
  /**
584
969
  * The implementations of interface `id` a consumer may load, each checked as `check` would on its
585
- * composed document, and every candidate left out with why. A candidate is a name in the interface's
586
- * namespace (`<id>` or `<id>.<key>`) or a reference that declares `implements: <id>@<n>`. A skill's
587
- * default is never listed: it has no qualified name to pin. An unknown interface throws.
970
+ * composed document, and every candidate left out with why (R35). A candidate is a name in the
971
+ * interface's namespace (`<id>` or `<id>.<key>`) or a reference that declares `implements: <id>@<n>`:
972
+ * a plugin's, pinned by its qualified name, or, for a `many` interface, a `repo` or `user` one,
973
+ * pinned by its bare name. When a `repo` or `user` implementation answers the bare name, a plugin's
974
+ * of that name is left out (C1, J3), since loading the bare name returns the other. Plugins holding
975
+ * a name no `extends` orders are all left out until a customizer picks one (R87). A skill's default
976
+ * is never listed: it has no qualified name to pin. An unknown interface throws.
588
977
  */
589
978
  export declare function referenceImplementations(id: string, source: Source, options?: ImplementationsOptions): ReferenceImplementations;
590
979
  //#endregion
591
- //#region src/references/reference-where.d.ts
592
- /** A file a customization or a selection of the name is written to. */
593
- type ReferenceWherePlace = {
594
- scope: 'project' | 'user';
595
- /** The project path is relative to the root; the user path is shown as the command displays it. */
596
- path: string;
597
- reaches: string;
598
- /** `used`, `shadowed by ...`, or `not used (...)` when the file exists; `empty` when it does not. */
599
- status: string;
600
- /** The heading paths of the document below it, which a section operation can target. */
601
- sections: string[];
602
- };
603
- type ReferenceWhereReport = {
604
- name: string;
605
- status: ReferenceStatus;
606
- places: ReferenceWherePlace[];
607
- /** When `ambiguous`: the options a selection written to a place chooses between. */
608
- options?: string[];
609
- /** Every layer checked, highest first; a plugin's or a default contribution is read-only. */
610
- layers: ReferenceTraceLayer[];
611
- warnings: ReferenceWarning[];
612
- };
613
- type WhereOptions = {
614
- /** Absolute; a project write goes to its `.agents/references/`, and a project path is shown relative to it. */
615
- root: string;
616
- /** How a path outside the project is shown, such as with the home directory collapsed to `~`. */
617
- display?: ((path: string) => string) | undefined;
618
- /** An assets call: the project write goes to `.agents/assets/`. */
619
- assets?: boolean | undefined;
620
- };
621
- /** The project and user files a customization of `name` is written to, with the document below each. */
622
- export declare function whereReference(input: string | ReferenceName, source: ReferenceLayers | readonly ReferenceLayer[], { root, display, assets }: WhereOptions): ReferenceWhereReport;
623
- //#endregion
624
980
  //#region src/skills/harness-skill-folders.d.ts
625
981
  /**
626
982
  * The harnesses whose skill folders are verified: project, user, machine-wide admin, and plugin
@@ -734,4 +1090,4 @@ interface SkillsDirectories {
734
1090
  */
735
1091
  export declare function skillsDirectories(harness: HarnessId): SkillsDirectories | undefined;
736
1092
  //#endregion
737
- export { type AmbiguousCause, type CheckOptions, type CheckPluginDependenciesOptions, type CheckedDependency, type DependencyState, type DetectHarnessOptions, type EnabledPluginSource, type EnabledPluginsOptions, type EnabledPluginsResult, type ExcludedImplementation, type ExtendsStep, type FoundSkill, type HarnessDetectionResult, type HarnessEnvironment, type HarnessEvidence, type HarnessId, type HeadlessCommand, type HeadlessCommandOptions, type HeadlessExitCode, type HeadlessInvocation, type HeadlessMode, type HeadlessOutputFormat, type HeadlessPermission, type HeadlessTranscript, type HeadlessUnavailable, type HeadlessUsage, type ImplementationsOptions, type ImplementsEntry, type InstalledPlugin, type InstalledPluginSource, type InstalledPluginsResult, type InterfaceCardinality, type InterfaceCheck, type InterfaceCheckFailure, type ListOptions, type LoadReferenceOptions, type ManagedPolicyKind, type ManagedPolicyLocation, type ManagedPolicyOptions, type MatchKind, type MergeOperation, type OperationSource, type Platform, type PluginDependenciesRead, type PluginDependency, type PluginDependencyCheck, type PluginEnablement, type PluginScope, type PluginSkill, type PluginStorage, type PluginStorageKind, type PluginStorageLocation, type ReferenceCheckEntry, type ReferenceCheckFailure, type ReferenceCheckKind, type ReferenceCode, type ReferenceImplementation, type ReferenceImplementations, type ReferenceInterface, type ReferenceLayer, type ReferenceLayerOptions, type ReferenceLayers, type ReferenceListLayerRow, type ReferenceListRow, type ReferenceListing, type ReferenceName, type ReferencePlugin, type ReferenceSearch, type ReferenceStatus, type ReferenceTier, type ReferenceTrace, type ReferenceTraceContribution, type ReferenceTraceLayer, type ReferenceTraceSection, type ReferenceWarning, type ReferenceWarningCode, type ReferenceWherePlace, type ReferenceWhereReport, type ResolveOptions, type ResolvedReference, type SearchMatch, type SectionSource, type SkillDefaults, type SkillFolderOptions, type SkillInvocation, type SkillsDirectories, type WhereOptions, defaultLayer, harnessIds, parseReferenceName, projectReferencesDir, referenceLayers, referenceNames, resolveReference, skillName, skillsIn, userReferencesDir };
1093
+ export { type AmbiguousCause, type BaseRef, type CheckOptions, type CheckPluginDependenciesOptions, type CheckedDependency, type Classification, type ClassifyInput, type Collision, type CreateReferenceOptions, type CreateResult, type CustomizeAction, type CustomizeReferenceOptions, type CustomizeResult, type DeleteReferenceOptions, type DeleteResult, type DependencyState, type DetectHarnessOptions, type EnabledPluginSource, type EnabledPluginsOptions, type EnabledPluginsResult, type ExcludedImplementation, type ExtendsStep, type FoundSkill, type GeneratedRecord, type GeneratorBase, type HarnessDetectionResult, type HarnessEnvironment, type HarnessEvidence, type HarnessId, type HeadlessCommand, type HeadlessCommandOptions, type HeadlessExitCode, type HeadlessInvocation, type HeadlessMode, type HeadlessOutputFormat, type HeadlessPermission, type HeadlessTranscript, type HeadlessUnavailable, type HeadlessUsage, type ImplementationsOptions, type ImplementsEntry, type InstalledPlugin, type InstalledPluginSource, type InstalledPluginsResult, type InterfaceCardinality, type InterfaceCheck, type InterfaceCheckFailure, type InterfaceSection, type InvalidEntry, type ListOptions, type LoadAssetOptions, type LoadReferenceOptions, type ManagedPolicyKind, type ManagedPolicyLocation, type ManagedPolicyOptions, type MatchKind, type MergeOperation, type OperationSource, type Outcome, type ParsedHistory, type PartResult, type Platform, type PluginDependenciesRead, type PluginDependency, type PluginDependencyCheck, type PluginEnablement, type PluginOrigin, type PluginScope, type PluginSkill, type PluginStorage, type PluginStorageKind, type PluginStorageLocation, type ProjectFolder, type ProjectFolderCache, type ProjectFolders, type Reason, type ReferenceCheckEntry, type ReferenceCheckFailure, type ReferenceCheckKind, type ReferenceCode, type ReferenceCodeKind, ReferenceFailure as ReferenceError, type ReferenceErrorCode, type ReferenceErrorOptions, type ReferenceImplementation, type ReferenceImplementations, type ReferenceInterface, type ReferenceLayer, type ReferenceLayerOptions, type ReferenceLayers, type ReferenceListLayerRow, type ReferenceListRow, type ReferenceListRowKind, type ReferenceListing, type ReferenceName, type ReferenceNoticeCode, type ReferencePlugin, type ReferenceSearch, type ReferenceSource, type ReferenceSourcePlugin, type ReferenceStatus, type ReferenceStatusCode, type ReferenceTier, type ReferenceTrace, type ReferenceTraceContribution, type ReferenceTraceLayer, type ReferenceTraceProjectSection, type ReferenceTraceSection, type ReferenceTraceSource, type ReferenceWarning, type ReferenceWarningCode, type ReferenceWhereFile, type ReferenceWhereReport, type ResolveOptions, type ResolvedAsset, type ResolvedProjectSection, type ResolvedReference, type RetiredWording, type SearchMatch, type SectionSource, type SkillDefaults, type SkillFolderOptions, type SkillInvocation, type SkillsDirectories, type WhereOptions, type WriteScope, defaultLayer, harnessIds, parseReferenceName, referenceCodeExit, referenceCodes, referenceLayers, referenceNames, repoReferencesDir, resolveReference, skillName, skillsIn, userReferencesDir, whereReference };