pupt-lib 1.3.5 → 1.3.7
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 +24 -345
- package/dist/components/structural/Prompt.d.ts.map +1 -1
- package/dist/components/structural/Role.d.ts.map +1 -1
- package/dist/index.js +889 -194
- package/dist/src/api.d.ts +13 -1
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/services/module-loader.d.ts +73 -25
- package/dist/src/services/module-loader.d.ts.map +1 -1
- package/dist/src/services/prompt-sources/github-prompt-source.d.ts +38 -0
- package/dist/src/services/prompt-sources/github-prompt-source.d.ts.map +1 -0
- package/dist/src/services/prompt-sources/index.d.ts +8 -0
- package/dist/src/services/prompt-sources/index.d.ts.map +1 -0
- package/dist/src/services/prompt-sources/local-prompt-source.d.ts +30 -0
- package/dist/src/services/prompt-sources/local-prompt-source.d.ts.map +1 -0
- package/dist/src/services/prompt-sources/npm-local-prompt-source.d.ts +27 -0
- package/dist/src/services/prompt-sources/npm-local-prompt-source.d.ts.map +1 -0
- package/dist/src/services/prompt-sources/npm-registry-prompt-source.d.ts +36 -0
- package/dist/src/services/prompt-sources/npm-registry-prompt-source.d.ts.map +1 -0
- package/dist/src/services/prompt-sources/tar-utils.d.ts +30 -0
- package/dist/src/services/prompt-sources/tar-utils.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +5 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +34 -1
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/prompt-source.d.ts +12 -0
- package/dist/src/types/prompt-source.d.ts.map +1 -0
- package/dist/src/types/render.d.ts +11 -1
- package/dist/src/types/render.d.ts.map +1 -1
- package/package.json +8 -2
package/dist/src/api.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { InputIterator } from './services/input-iterator';
|
|
|
4
4
|
* A discovered prompt with render and input iterator capabilities
|
|
5
5
|
*/
|
|
6
6
|
export interface DiscoveredPromptWithMethods {
|
|
7
|
+
id: string;
|
|
7
8
|
name: string;
|
|
8
9
|
description: string;
|
|
9
10
|
tags: string[];
|
|
@@ -20,6 +21,7 @@ export declare class Pupt {
|
|
|
20
21
|
private moduleLoader;
|
|
21
22
|
private searchEngine;
|
|
22
23
|
private prompts;
|
|
24
|
+
private warnings;
|
|
23
25
|
private initialized;
|
|
24
26
|
constructor(config: PuptInitConfig);
|
|
25
27
|
init(): Promise<void>;
|
|
@@ -27,11 +29,21 @@ export declare class Pupt {
|
|
|
27
29
|
tags?: string[];
|
|
28
30
|
}): DiscoveredPromptWithMethods[];
|
|
29
31
|
getPrompt(name: string): DiscoveredPromptWithMethods | undefined;
|
|
32
|
+
getPromptById(id: string): DiscoveredPromptWithMethods | undefined;
|
|
30
33
|
searchPrompts(query: string, options?: Partial<SearchOptions>): SearchResult[];
|
|
31
34
|
getTags(): string[];
|
|
32
35
|
getPromptsByTag(tag: string): DiscoveredPromptWithMethods[];
|
|
36
|
+
getWarnings(): string[];
|
|
33
37
|
private discoverPrompts;
|
|
34
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Get a deduplication key for a module entry.
|
|
40
|
+
* Returns null for PromptSource instances (cannot be deduplicated).
|
|
41
|
+
*/
|
|
42
|
+
private getEntryDedupKey;
|
|
43
|
+
/**
|
|
44
|
+
* Get a human-readable display name for a module entry (used in error messages).
|
|
45
|
+
*/
|
|
46
|
+
private getEntryDisplayName;
|
|
35
47
|
private isPromptElement;
|
|
36
48
|
private createDiscoveredPrompt;
|
|
37
49
|
}
|
package/dist/src/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WA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AAO,IAAI,MAAM,EAAE;IAInB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,2BAA2B,EAAE;IAI3D,WAAW,IAAI,MAAM,EAAE;YAIT,eAAe;IAwC7B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAmBxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,sBAAsB;CAgC/B"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare const VERSION = "0.0.0-development";
|
|
2
2
|
export { TYPE, PROPS, CHILDREN, DEFERRED_REF } from './types/symbols';
|
|
3
3
|
export { isPuptElement, isDeferredRef } from './types/element';
|
|
4
|
-
export type { PuptNode, PuptElement, ComponentType, DeferredRef, LlmConfig, LlmProvider, OutputConfig, CodeConfig, UserConfig, RuntimeConfig, PromptConfig, EnvironmentContext, RenderContext, RenderOptions, RenderResult, RenderSuccess, RenderFailure, RenderError, PostExecutionAction, ReviewFileAction, OpenUrlAction, RunCommandAction, InputRequirement, ValidationResult, ValidationError, SearchablePrompt, SearchOptions, SearchResult, SearchResultMatch, SearchEngineConfig, PuptConfig, PuptLibrary, DiscoveredPrompt, LibraryLoadResult, PuptInitConfig, } from './types';
|
|
5
|
-
export {
|
|
4
|
+
export type { PuptNode, PuptElement, ComponentType, DeferredRef, LlmConfig, LlmProvider, OutputConfig, CodeConfig, UserConfig, RuntimeConfig, PromptConfig, EnvironmentContext, RenderContext, RenderOptions, RenderResult, RenderSuccess, RenderFailure, RenderError, PostExecutionAction, ReviewFileAction, OpenUrlAction, RunCommandAction, InputRequirement, ValidationResult, ValidationError, SearchablePrompt, SearchOptions, SearchResult, SearchResultMatch, SearchEngineConfig, ModuleEntry, PuptConfig, PuptLibrary, DiscoveredPrompt, LibraryLoadResult, PuptInitConfig, DiscoveredPromptFile, PromptSource, } from './types';
|
|
5
|
+
export { isPromptSource } from './types';
|
|
6
|
+
export { LLM_PROVIDERS, inferProviderFromModel, DEFAULT_ENVIRONMENT, createEnvironment, createRuntimeConfig, ensureRuntimeCacheReady, isWarningCode, } from './types';
|
|
6
7
|
export { Component, isComponentClass, COMPONENT_MARKER } from './component';
|
|
7
8
|
export { render } from './render';
|
|
8
9
|
export { wrapWithDelimiter } from './utils/delimiter';
|
|
@@ -23,7 +24,9 @@ export { preprocessSource, isPromptFile } from './services/preprocessor';
|
|
|
23
24
|
export type { PreprocessOptions } from './services/preprocessor';
|
|
24
25
|
export { getBuiltinComponents, getAskComponents, getAskShorthand, getStructuralComponents, } from './services/component-discovery';
|
|
25
26
|
export { ModuleLoader } from './services/module-loader';
|
|
26
|
-
export type {
|
|
27
|
+
export type { LoadedLibrary, CompiledPrompt, ParsedPackageSource } from './services/module-loader';
|
|
28
|
+
export { LocalPromptSource, NpmLocalPromptSource, GitHubPromptSource, parseGitHubSource, NpmRegistryPromptSource } from './services/prompt-sources';
|
|
29
|
+
export type { GitHubPromptSourceOptions } from './services/prompt-sources';
|
|
27
30
|
export { resolveCdn, generateImportMap, serializeImportMap, generateImportMapScript, generatePuptLibImportMap, generatePuptLibImportMapScript, } from './services/browser-support';
|
|
28
31
|
export type { CdnProvider, CdnOptions, Dependency, ImportMap, PuptLibImportMapOptions, } from './services/browser-support';
|
|
29
32
|
export * from '../components';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAG3C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG/D,YAAY,EACV,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,sBAAsB,CAAC;AAG3C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG/D,YAAY,EACV,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,E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":"render.d.ts","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,YAAY,EAAE,aAAa,EAAmD,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,YAAY,EAAE,aAAa,EAAmD,MAAM,SAAS,CAAC;AAwInI;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CA2EvB"}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { ComponentType, PuptElement } from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ComponentType, PuptElement, ModuleEntry, ResolvedModuleEntry } from '../types';
|
|
2
|
+
import { PromptSource } from '../types/prompt-source';
|
|
3
|
+
/** A compiled prompt from a discovered .prompt file */
|
|
4
|
+
export interface CompiledPrompt {
|
|
5
|
+
element: PuptElement;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
tags: string[];
|
|
10
|
+
version?: string;
|
|
11
|
+
}
|
|
6
12
|
/**
|
|
7
|
-
* Represents a loaded library with its components
|
|
13
|
+
* Represents a loaded library with its components and prompts
|
|
8
14
|
*/
|
|
9
15
|
export interface LoadedLibrary {
|
|
10
16
|
name: string;
|
|
11
17
|
components: Record<string, ComponentType>;
|
|
18
|
+
prompts: Record<string, CompiledPrompt>;
|
|
12
19
|
dependencies: string[];
|
|
13
20
|
}
|
|
14
21
|
/**
|
|
@@ -27,18 +34,34 @@ export declare class ModuleLoader {
|
|
|
27
34
|
private loading;
|
|
28
35
|
private versions;
|
|
29
36
|
/**
|
|
30
|
-
*
|
|
37
|
+
* Parse a package source string into name and version.
|
|
38
|
+
* Handles scoped packages (@scope/name@version) and regular packages (name@version).
|
|
31
39
|
*/
|
|
32
|
-
|
|
40
|
+
parsePackageSource(source: string): ParsedPackageSource;
|
|
33
41
|
/**
|
|
34
|
-
*
|
|
42
|
+
* Load a module entry (ResolvedModuleEntry, PromptSource, or package reference).
|
|
43
|
+
* Dispatches to the appropriate loading strategy based on entry type.
|
|
35
44
|
*/
|
|
36
|
-
|
|
45
|
+
loadEntry(entry: ModuleEntry): Promise<LoadedLibrary>;
|
|
37
46
|
/**
|
|
38
|
-
* Load a module from
|
|
39
|
-
*
|
|
47
|
+
* Load a module from a ResolvedModuleEntry.
|
|
48
|
+
* Uses the explicit `type` field for routing and passes `promptDirs` through
|
|
49
|
+
* to the appropriate prompt source.
|
|
40
50
|
*/
|
|
41
|
-
|
|
51
|
+
loadResolvedEntry(entry: ResolvedModuleEntry): Promise<LoadedLibrary>;
|
|
52
|
+
/**
|
|
53
|
+
* Load prompts from a PromptSource instance.
|
|
54
|
+
*/
|
|
55
|
+
loadPromptSource(source: PromptSource, name?: string): Promise<LoadedLibrary>;
|
|
56
|
+
/**
|
|
57
|
+
* Load prompts from a dynamic package reference.
|
|
58
|
+
* Imports the source module, instantiates its default export with the config,
|
|
59
|
+
* and calls getPrompts() on it.
|
|
60
|
+
*/
|
|
61
|
+
loadPackageReference(ref: {
|
|
62
|
+
source: string;
|
|
63
|
+
config: Record<string, unknown>;
|
|
64
|
+
}): Promise<LoadedLibrary>;
|
|
42
65
|
/**
|
|
43
66
|
* Detect Component classes in module exports
|
|
44
67
|
*/
|
|
@@ -47,17 +70,34 @@ export declare class ModuleLoader {
|
|
|
47
70
|
* Detect Prompt elements in module exports
|
|
48
71
|
*/
|
|
49
72
|
detectPrompts(exports: Record<string, unknown>): Record<string, PuptElement>;
|
|
73
|
+
/**
|
|
74
|
+
* Normalize a source string for consistent deduplication.
|
|
75
|
+
* Resolves relative paths to absolute, normalizes package names to lowercase.
|
|
76
|
+
*/
|
|
77
|
+
normalizeSource(source: string, type: ResolvedModuleEntry['type']): string;
|
|
78
|
+
/**
|
|
79
|
+
* Discover and compile .prompt files from a PromptSource.
|
|
80
|
+
* Each file is compiled through createPromptFromSource() and metadata extracted.
|
|
81
|
+
*/
|
|
82
|
+
discoverAndCompilePrompts(source: PromptSource): Promise<Record<string, CompiledPrompt>>;
|
|
83
|
+
/**
|
|
84
|
+
* Clear all loaded modules (useful for testing)
|
|
85
|
+
*/
|
|
86
|
+
clear(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Convert detected PuptElement prompts from JS exports into CompiledPrompt records.
|
|
89
|
+
*/
|
|
90
|
+
private convertDetectedPrompts;
|
|
50
91
|
/**
|
|
51
92
|
* Check if a value is a PuptElement with a name prop (indicates a Prompt)
|
|
52
93
|
*/
|
|
53
94
|
private isPromptElement;
|
|
54
95
|
/**
|
|
55
|
-
*
|
|
96
|
+
* Compile an array of discovered prompt files into CompiledPrompt records.
|
|
56
97
|
*/
|
|
57
|
-
private
|
|
98
|
+
private compilePromptFiles;
|
|
58
99
|
/**
|
|
59
|
-
*
|
|
60
|
-
* This is the internal implementation that can be mocked in tests.
|
|
100
|
+
* Internal load dispatch using explicit type and passing promptDirs to prompt sources.
|
|
61
101
|
*/
|
|
62
102
|
private doLoad;
|
|
63
103
|
/**
|
|
@@ -65,17 +105,29 @@ export declare class ModuleLoader {
|
|
|
65
105
|
*/
|
|
66
106
|
private loadLocal;
|
|
67
107
|
/**
|
|
68
|
-
* Load an npm package
|
|
108
|
+
* Load an npm package.
|
|
109
|
+
* Tries to import as a JS module and additionally discovers .prompt files.
|
|
69
110
|
*/
|
|
70
111
|
private loadNpm;
|
|
71
112
|
/**
|
|
72
|
-
*
|
|
113
|
+
* Check if a URL looks like an npm tarball or CDN package URL.
|
|
114
|
+
*/
|
|
115
|
+
private isTarballOrCdnUrl;
|
|
116
|
+
/**
|
|
117
|
+
* Load a module from a URL.
|
|
118
|
+
* Routes tarball/CDN URLs to NpmRegistryPromptSource for prompt discovery.
|
|
119
|
+
* Other URLs are loaded as JS modules via dynamic import.
|
|
73
120
|
*/
|
|
74
121
|
private loadUrl;
|
|
75
122
|
/**
|
|
76
|
-
* Load a
|
|
123
|
+
* Load prompts from a tarball or CDN URL via NpmRegistryPromptSource.
|
|
124
|
+
*/
|
|
125
|
+
private loadUrlAsPromptSource;
|
|
126
|
+
/**
|
|
127
|
+
* Load a module from a Git source (GitHub URL).
|
|
128
|
+
* Extracts owner/repo from the URL, tries JS import and .prompt file discovery.
|
|
77
129
|
*/
|
|
78
|
-
private
|
|
130
|
+
private loadGit;
|
|
79
131
|
/**
|
|
80
132
|
* Extract a module name from a file path
|
|
81
133
|
*/
|
|
@@ -84,9 +136,5 @@ export declare class ModuleLoader {
|
|
|
84
136
|
* Extract a module name from a URL
|
|
85
137
|
*/
|
|
86
138
|
private extractNameFromUrl;
|
|
87
|
-
/**
|
|
88
|
-
* Clear all loaded modules (useful for testing)
|
|
89
|
-
*/
|
|
90
|
-
clear(): void;
|
|
91
139
|
}
|
|
92
140
|
//# sourceMappingURL=module-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../../src/services/module-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../../src/services/module-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAwB,MAAM,wBAAwB,CAAC;AAwBjF,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,WAAW,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IAC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MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;IAY5E;;;OAGG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,MAAM;IAqB1E;;;OAGG;IACG,yBAAyB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAK9F;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAmB9B;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;OAEG;YACW,kBAAkB;IAoBhC;;OAEG;YACW,MAAM;IAmBpB;;OAEG;YACW,SAAS;IA6CvB;;;OAGG;YACW,OAAO;IA+CrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiBzB;;;;OAIG;YACW,OAAO;IAuBrB;;OAEG;YACW,qBAAqB;IAanC;;;OAGG;YACW,OAAO;IAoDrB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAK3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAU3B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PromptSource, DiscoveredPromptFile } from '../../types/prompt-source';
|
|
2
|
+
/** Configuration options for GitHubPromptSource */
|
|
3
|
+
export interface GitHubPromptSourceOptions {
|
|
4
|
+
/** Git ref (branch, tag, or commit SHA). Defaults to 'main'. */
|
|
5
|
+
ref?: string;
|
|
6
|
+
/** GitHub personal access token for private repos or to avoid rate limiting. */
|
|
7
|
+
token?: string;
|
|
8
|
+
/** Explicit prompt directories to scan (relative to repo root). Overrides default 'prompts/'. */
|
|
9
|
+
promptDirs?: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse a "owner/repo" string into its parts.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseGitHubSource(source: string): {
|
|
15
|
+
owner: string;
|
|
16
|
+
repo: string;
|
|
17
|
+
ref?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Discovers .prompt files from a GitHub repository using the Git Trees API.
|
|
21
|
+
*
|
|
22
|
+
* Fetches the repository tree and filters for files matching `prompts/*.prompt`,
|
|
23
|
+
* then fetches each file's content from raw.githubusercontent.com.
|
|
24
|
+
*/
|
|
25
|
+
export declare class GitHubPromptSource implements PromptSource {
|
|
26
|
+
private owner;
|
|
27
|
+
private repo;
|
|
28
|
+
private ref;
|
|
29
|
+
private token?;
|
|
30
|
+
private promptDirs?;
|
|
31
|
+
constructor(ownerRepo: string, options?: GitHubPromptSourceOptions);
|
|
32
|
+
getPrompts(): Promise<DiscoveredPromptFile[]>;
|
|
33
|
+
private fetchTree;
|
|
34
|
+
private filterPromptFiles;
|
|
35
|
+
private fetchFileContent;
|
|
36
|
+
private getHeaders;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=github-prompt-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-prompt-source.d.ts","sourceRoot":"","sources":["../../../../src/services/prompt-sources/github-prompt-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,mDAAmD;AACnD,MAAM,WAAW,yBAAyB;IACxC,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAeD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAqB/F;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,OAAO,CAAC,UAAU,CAAC,CAAW;gBAElB,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAS5D,UAAU,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;YAkBrC,SAAS;IA8BvB,OAAO,CAAC,iBAAiB;YAYX,gBAAgB;IAqB9B,OAAO,CAAC,UAAU;CAWnB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { LocalPromptSource } from './local-prompt-source';
|
|
2
|
+
export { NpmLocalPromptSource } from './npm-local-prompt-source';
|
|
3
|
+
export { GitHubPromptSource } from './github-prompt-source';
|
|
4
|
+
export type { GitHubPromptSourceOptions } from './github-prompt-source';
|
|
5
|
+
export { parseGitHubSource } from './github-prompt-source';
|
|
6
|
+
export { NpmRegistryPromptSource } from './npm-registry-prompt-source';
|
|
7
|
+
export { extractPromptFiles, decompressGzip, parseTar } from './tar-utils';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/prompt-sources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PromptSource, DiscoveredPromptFile } from '../../types/prompt-source';
|
|
2
|
+
/** Options for LocalPromptSource */
|
|
3
|
+
export interface LocalPromptSourceOptions {
|
|
4
|
+
/** Explicit prompt directories to scan (relative to dirPath). Overrides default discovery. */
|
|
5
|
+
promptDirs?: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Discovers .prompt files from a local filesystem directory.
|
|
9
|
+
*
|
|
10
|
+
* Accepts either a direct path to a directory containing .prompt files,
|
|
11
|
+
* or a package root path that has a `prompts/` subdirectory.
|
|
12
|
+
*
|
|
13
|
+
* When `promptDirs` is provided, scans those specific subdirectories
|
|
14
|
+
* instead of using the default discovery heuristic.
|
|
15
|
+
*/
|
|
16
|
+
export declare class LocalPromptSource implements PromptSource {
|
|
17
|
+
private dirPath;
|
|
18
|
+
private promptDirs?;
|
|
19
|
+
constructor(dirPath: string, options?: LocalPromptSourceOptions);
|
|
20
|
+
getPrompts(): Promise<DiscoveredPromptFile[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Scan explicit prompt directories relative to the base path.
|
|
23
|
+
*/
|
|
24
|
+
private scanPromptDirs;
|
|
25
|
+
/**
|
|
26
|
+
* Scan a single directory for .prompt files.
|
|
27
|
+
*/
|
|
28
|
+
private scanDirectory;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=local-prompt-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-prompt-source.d.ts","sourceRoot":"","sources":["../../../../src/services/prompt-sources/local-prompt-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,oCAAoC;AACpC,MAAM,WAAW,wBAAwB;IACvC,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IACpD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAC,CAAW;gBAElB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAKzD,UAAU,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAwCnD;;OAEG;YACW,cAAc;IAmB5B;;OAEG;YACW,aAAa;CAgB5B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PromptSource, DiscoveredPromptFile } from '../../types/prompt-source';
|
|
2
|
+
/** Options for NpmLocalPromptSource */
|
|
3
|
+
export interface NpmLocalPromptSourceOptions {
|
|
4
|
+
/** Explicit prompt directories to scan (relative to package root). Overrides default 'prompts/'. */
|
|
5
|
+
promptDirs?: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Discovers .prompt files from locally installed npm packages.
|
|
9
|
+
*
|
|
10
|
+
* Resolves the package to its location in node_modules/,
|
|
11
|
+
* then looks for a `prompts/` subdirectory containing .prompt files.
|
|
12
|
+
*
|
|
13
|
+
* When `promptDirs` is provided, scans those specific subdirectories
|
|
14
|
+
* instead of the default `prompts/`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class NpmLocalPromptSource implements PromptSource {
|
|
17
|
+
private packageName;
|
|
18
|
+
private promptDirs?;
|
|
19
|
+
constructor(packageName: string, options?: NpmLocalPromptSourceOptions);
|
|
20
|
+
getPrompts(): Promise<DiscoveredPromptFile[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a bare package name to its directory path in node_modules.
|
|
23
|
+
* Uses import.meta.resolve() when available, with createRequire fallback.
|
|
24
|
+
*/
|
|
25
|
+
resolvePackagePath(packageName: string): Promise<string>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=npm-local-prompt-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-local-prompt-source.d.ts","sourceRoot":"","sources":["../../../../src/services/prompt-sources/npm-local-prompt-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,uCAAuC;AACvC,MAAM,WAAW,2BAA2B;IAC1C,oGAAoG;IACpG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAC,CAAW;gBAElB,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B;IAKhE,UAAU,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAiCnD;;;OAGG;IACG,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA8B/D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PromptSource, DiscoveredPromptFile } from '../../types/prompt-source';
|
|
2
|
+
/**
|
|
3
|
+
* Discovers .prompt files from npm packages by fetching tarballs from the registry.
|
|
4
|
+
*
|
|
5
|
+
* Supports:
|
|
6
|
+
* - Package specifiers: "package-name" or "package-name@version"
|
|
7
|
+
* - Direct tarball URLs: "https://registry.npmjs.org/pkg/-/pkg-1.0.0.tgz"
|
|
8
|
+
* - Custom registry URLs for enterprise registries
|
|
9
|
+
*/
|
|
10
|
+
export declare class NpmRegistryPromptSource implements PromptSource {
|
|
11
|
+
private packageName?;
|
|
12
|
+
private version?;
|
|
13
|
+
private tarballUrl?;
|
|
14
|
+
private registryUrl;
|
|
15
|
+
constructor(specifier: string, options?: {
|
|
16
|
+
registryUrl?: string;
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Create an NpmRegistryPromptSource from a direct tarball URL.
|
|
20
|
+
*/
|
|
21
|
+
static fromUrl(url: string): NpmRegistryPromptSource;
|
|
22
|
+
getPrompts(): Promise<DiscoveredPromptFile[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Parse a package specifier into name and optional version.
|
|
25
|
+
*/
|
|
26
|
+
private parseSpecifier;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the tarball URL by fetching package metadata from the registry.
|
|
29
|
+
*/
|
|
30
|
+
private resolveTarballUrl;
|
|
31
|
+
/**
|
|
32
|
+
* Download a tarball from the given URL.
|
|
33
|
+
*/
|
|
34
|
+
private downloadTarball;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=npm-registry-prompt-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-registry-prompt-source.d.ts","sourceRoot":"","sources":["../../../../src/services/prompt-sources/npm-registry-prompt-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGpF;;;;;;;GAOG;AACH,qBAAa,uBAAwB,YAAW,YAAY;IAC1D,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;gBAEhB,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;IAcjE;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB;IAI9C,UAAU,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAMnD;;OAEG;IACH,OAAO,CAAC,cAAc;IAyBtB;;OAEG;YACW,iBAAiB;IA6B/B;;OAEG;YACW,eAAe;CAiB9B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DiscoveredPromptFile } from '../../types/prompt-source';
|
|
2
|
+
/**
|
|
3
|
+
* Decompress a gzipped ArrayBuffer using the native DecompressionStream API.
|
|
4
|
+
* Available in Node.js 18+ and all modern browsers.
|
|
5
|
+
*/
|
|
6
|
+
export declare function decompressGzip(compressed: ArrayBuffer): Promise<ArrayBuffer>;
|
|
7
|
+
/**
|
|
8
|
+
* Minimal tar parser for read-only extraction of file entries.
|
|
9
|
+
*
|
|
10
|
+
* The tar format uses 512-byte header blocks followed by file data
|
|
11
|
+
* aligned to 512-byte boundaries. We only need to iterate entries
|
|
12
|
+
* and extract their content.
|
|
13
|
+
*/
|
|
14
|
+
export interface TarEntry {
|
|
15
|
+
name: string;
|
|
16
|
+
size: number;
|
|
17
|
+
content: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parse a tar archive (uncompressed) and yield file entries.
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseTar(buffer: ArrayBuffer): TarEntry[];
|
|
23
|
+
/**
|
|
24
|
+
* Extract .prompt files from a gzipped tarball (e.g., from npm registry).
|
|
25
|
+
*
|
|
26
|
+
* Looks for files matching `package/prompts/*.prompt` or `prompts/*.prompt`
|
|
27
|
+
* within the tar archive.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractPromptFiles(tarballBuffer: ArrayBuffer): Promise<DiscoveredPromptFile[]>;
|
|
30
|
+
//# sourceMappingURL=tar-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tar-utils.d.ts","sourceRoot":"","sources":["../../../../src/services/prompt-sources/tar-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;GAGG;AACH,wBAAsB,cAAc,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAyBlF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,UAAU,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,CAoCxD;AAaD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAmBpG"}
|
|
@@ -4,7 +4,11 @@ export { isPuptElement, isDeferredRef } from './element';
|
|
|
4
4
|
export type { LlmConfig, LlmProvider, OutputConfig, CodeConfig, UserConfig, RuntimeConfig, PromptConfig, EnvironmentContext, RenderContext, } from './context';
|
|
5
5
|
export { LLM_PROVIDERS, inferProviderFromModel, DEFAULT_ENVIRONMENT, createEnvironment, createRuntimeConfig, ensureRuntimeCacheReady, llmConfigSchema, outputConfigSchema, codeConfigSchema, userConfigSchema, runtimeConfigSchema, promptConfigSchema, environmentContextSchema, } from './context';
|
|
6
6
|
export type { RenderOptions, RenderResult, RenderSuccess, RenderFailure, RenderError, PostExecutionAction, ReviewFileAction, OpenUrlAction, RunCommandAction, } from './render';
|
|
7
|
+
export { isWarningCode } from './render';
|
|
7
8
|
export type { InputRequirement, ValidationResult, ValidationError, } from './input';
|
|
8
9
|
export type { SearchablePrompt, SearchOptions, SearchResult, SearchResultMatch, SearchEngineConfig, } from './search';
|
|
9
|
-
export type { PuptConfig, PuptLibrary, DiscoveredPrompt, LibraryLoadResult, PuptInitConfig, } from './module';
|
|
10
|
+
export type { ModuleEntry, ResolvedModuleEntry, PuptConfig, PuptLibrary, DiscoveredPrompt, LibraryLoadResult, PuptInitConfig, } from './module';
|
|
11
|
+
export { isResolvedModuleEntry } from './module';
|
|
12
|
+
export type { DiscoveredPromptFile, PromptSource, } from './prompt-source';
|
|
13
|
+
export { isPromptSource } from './prompt-source';
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGhE,YAAY,EACV,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGzD,YAAY,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,aAAa,GACd,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EAEvB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGhE,YAAY,EACV,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGzD,YAAY,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,aAAa,GACd,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EAEvB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGjD,YAAY,EACV,oBAAoB,EACpB,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
import { ComponentType } from './element';
|
|
2
|
+
import { PromptSource } from './prompt-source';
|
|
3
|
+
/**
|
|
4
|
+
* A resolved module entry with explicit type and metadata.
|
|
5
|
+
* This is the richer format that tools like `pupt` can produce after
|
|
6
|
+
* installing/tracking libraries, providing explicit source type,
|
|
7
|
+
* version, and prompt directory information.
|
|
8
|
+
*/
|
|
9
|
+
export interface ResolvedModuleEntry {
|
|
10
|
+
/** Display name for the module */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Explicit source type — avoids heuristic string parsing */
|
|
13
|
+
type: 'git' | 'npm' | 'local' | 'url';
|
|
14
|
+
/** The source identifier (git URL, npm package name, local path, or URL) */
|
|
15
|
+
source: string;
|
|
16
|
+
/** Relative paths to prompt directories within the module (overrides default 'prompts/') */
|
|
17
|
+
promptDirs?: string[];
|
|
18
|
+
/** Version string (semver for npm, commit hash for git, etc.) */
|
|
19
|
+
version?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Type guard for ResolvedModuleEntry
|
|
23
|
+
*/
|
|
24
|
+
export declare function isResolvedModuleEntry(value: unknown): value is ResolvedModuleEntry;
|
|
25
|
+
/**
|
|
26
|
+
* A module entry can be:
|
|
27
|
+
* - A ResolvedModuleEntry with explicit type, source, and metadata
|
|
28
|
+
* - A PromptSource instance (self-resolving prompt discovery)
|
|
29
|
+
* - A package reference with dynamic source loader and config
|
|
30
|
+
*/
|
|
31
|
+
export type ModuleEntry = ResolvedModuleEntry | PromptSource | {
|
|
32
|
+
source: string;
|
|
33
|
+
config: Record<string, unknown>;
|
|
34
|
+
};
|
|
2
35
|
/**
|
|
3
36
|
* Configuration for a pupt library
|
|
4
37
|
*/
|
|
@@ -45,7 +78,7 @@ export interface LibraryLoadResult {
|
|
|
45
78
|
* Configuration for initializing the Pupt class
|
|
46
79
|
*/
|
|
47
80
|
export interface PuptInitConfig {
|
|
48
|
-
modules?:
|
|
81
|
+
modules?: ModuleEntry[];
|
|
49
82
|
searchConfig?: {
|
|
50
83
|
threshold?: number;
|
|
51
84
|
weights?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/types/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/types/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,I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CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;QACF,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A raw .prompt file discovered from a source */
|
|
2
|
+
export interface DiscoveredPromptFile {
|
|
3
|
+
filename: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
/** Interface for all prompt discovery backends */
|
|
7
|
+
export interface PromptSource {
|
|
8
|
+
getPrompts(): Promise<DiscoveredPromptFile[]>;
|
|
9
|
+
}
|
|
10
|
+
/** Type guard to check if a value implements the PromptSource interface */
|
|
11
|
+
export declare function isPromptSource(value: unknown): value is PromptSource;
|
|
12
|
+
//# sourceMappingURL=prompt-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-source.d.ts","sourceRoot":"","sources":["../../../src/types/prompt-source.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,kDAAkD;AAClD,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;CAC/C;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAOpE"}
|
|
@@ -6,6 +6,10 @@ export interface RenderOptions {
|
|
|
6
6
|
trim?: boolean;
|
|
7
7
|
inputs?: Map<string, unknown> | Record<string, unknown>;
|
|
8
8
|
env?: EnvironmentContext;
|
|
9
|
+
/** When true, warnings (codes matching `warn_*`) are promoted to hard errors, causing `ok: false` */
|
|
10
|
+
throwOnWarnings?: boolean;
|
|
11
|
+
/** Warning codes to suppress entirely (e.g. `['warn_missing_task']`) */
|
|
12
|
+
ignoreWarnings?: string[];
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
15
|
* A validation or runtime error encountered during rendering
|
|
@@ -32,7 +36,7 @@ export interface RenderError {
|
|
|
32
36
|
export interface RenderSuccess {
|
|
33
37
|
ok: true;
|
|
34
38
|
text: string;
|
|
35
|
-
/** Non-fatal validation warnings (
|
|
39
|
+
/** Non-fatal validation warnings (codes starting with `warn_` or legacy `validation_warning`) */
|
|
36
40
|
errors?: RenderError[];
|
|
37
41
|
postExecution: PostExecutionAction[];
|
|
38
42
|
}
|
|
@@ -79,4 +83,10 @@ export interface RunCommandAction {
|
|
|
79
83
|
cwd?: string;
|
|
80
84
|
env?: Record<string, string>;
|
|
81
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Check whether a RenderError code represents a warning rather than a hard error.
|
|
88
|
+
* Warning codes use the `warn_` prefix by convention, with `validation_warning`
|
|
89
|
+
* supported as a legacy alias.
|
|
90
|
+
*/
|
|
91
|
+
export declare function isWarningCode(code: string): boolean;
|
|
82
92
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/types/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxD,GAAG,CAAC,EAAE,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/types/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxD,GAAG,CAAC,EAAE,kBAAkB,CAAC;IACzB,qGAAqG;IACrG,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1B,kCAAkC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,Q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