@prompd/core 0.5.0-beta.11 → 0.5.0-beta.13
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.cjs +57 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.js +57 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
package/dist/index.d.cts
CHANGED
|
@@ -670,6 +670,56 @@ declare class MemoryPackageResolver implements IPackageResolver {
|
|
|
670
670
|
resolvePackage(packageRef: string, options: ResolvePackageOptions): Promise<string>;
|
|
671
671
|
}
|
|
672
672
|
|
|
673
|
+
/**
|
|
674
|
+
* A writable sink the host injects so installPackage stays FS-/Node-agnostic.
|
|
675
|
+
* Browser: an adapter over the workspace FileService; CLI/sidecar: over Node fs.
|
|
676
|
+
*/
|
|
677
|
+
interface PackageStore {
|
|
678
|
+
/** Write a UTF-8 file, creating parent directories as needed. */
|
|
679
|
+
writeFile(path: string, content: string): void | Promise<void>;
|
|
680
|
+
/** Remove a directory and its contents if present, for a clean reinstall. */
|
|
681
|
+
removeDir?(path: string): void | Promise<void>;
|
|
682
|
+
}
|
|
683
|
+
interface InstallPackageOptions {
|
|
684
|
+
/** "@scope/name@version" or "@scope/name" (defaults to latest). */
|
|
685
|
+
ref: string;
|
|
686
|
+
/** Artifact type — selects the .prompd subdir (packages/skills/workflows/templates). */
|
|
687
|
+
type: PackageType;
|
|
688
|
+
/**
|
|
689
|
+
* Install root the caller chose: the open workspace folder (browser/local) or the
|
|
690
|
+
* home dir for a global install (sidecar/CLI). installPackage NEVER computes '~'
|
|
691
|
+
* itself — core stays Node-free.
|
|
692
|
+
*/
|
|
693
|
+
root: string;
|
|
694
|
+
/** Writable sink for the chosen host. */
|
|
695
|
+
store: PackageStore;
|
|
696
|
+
/**
|
|
697
|
+
* Fetch the .pdpkg bytes for a (name, version). Injected: the registry client in
|
|
698
|
+
* the browser, a Node fetch in the CLI. May resolve 'latest' to a concrete version.
|
|
699
|
+
*/
|
|
700
|
+
download: PackageDownloader;
|
|
701
|
+
}
|
|
702
|
+
interface InstalledPackage {
|
|
703
|
+
/** Full scoped name (manifest-authoritative when present), e.g. "@prompd/core". */
|
|
704
|
+
name: string;
|
|
705
|
+
/** Resolved version (from the package manifest when present). */
|
|
706
|
+
version: string;
|
|
707
|
+
scope?: string;
|
|
708
|
+
/** Install dir written to: <root>/.prompd/<typeDir>/<name>. */
|
|
709
|
+
installedPath: string;
|
|
710
|
+
/** Entry-relative paths written under installedPath. */
|
|
711
|
+
files: string[];
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Install a registry artifact into <root>/.prompd/<typeDir>/<name>/, replacing any
|
|
715
|
+
* prior install (idempotent). The host injects the writable `store` and the
|
|
716
|
+
* `download` fetcher, so the same install runs in the browser and the CLI/sidecar.
|
|
717
|
+
* Returns the resolved name/version (manifest-authoritative when present) and the
|
|
718
|
+
* files written. Rejects entries that escape the install directory (zip-slip) and
|
|
719
|
+
* archives over the size cap.
|
|
720
|
+
*/
|
|
721
|
+
declare function installPackage(opts: InstallPackageOptions): Promise<InstalledPackage>;
|
|
722
|
+
|
|
673
723
|
/**
|
|
674
724
|
* Language Mapping Utilities
|
|
675
725
|
*
|
|
@@ -2963,4 +3013,4 @@ declare function validateWorkflow(workflow: WorkflowFile): ValidationResult;
|
|
|
2963
3013
|
*/
|
|
2964
3014
|
declare function validateWorkflowQuick(workflow: WorkflowFile): Pick<ValidationResult, 'isValid'>;
|
|
2965
3015
|
|
|
2966
|
-
export { type AgentCheckpointEvent, type AgentCheckpointEventType, type AgentIterationRecord, type AgentNodeData, type AgentTool, AnthropicFormatter, type ApiNodeData, type AsyncFileBackend, BUILTIN_COMMAND_EXECUTABLES, type BaseNodeData, CODE_EXTENSIONS, CONTENT_TYPES, type CallbackNodeData, type ChatAgentCheckpointConfig, type ChatAgentNodeData, type ClaudeCodeNodeData, CodeGenerationStage, type CodeNodeData, type CommandNodeData, CompilationContext, type CompilationDiagnostic, CompilationError, type CompilationOptions, CompilationStage, type CompiledPrompt, CompilerPipeline, type CompilerStage, type CompleteEventData, type ConditionBranch, type ConditionNodeData, type Config, type CustomCommandConfig, type CustomConnectionConfig, type CustomProvider, DEFAULT_SECURITY_CONFIG, DOCKABLE_HANDLES, DOCKABLE_NODE_TYPES, type DatabaseConnectionConfig, type DatabaseQueryNodeData, DependencyResolutionStage, EXTENSION_TO_LANGUAGE, EXTENSION_TO_LANGUAGE_ALIASES, type ErrorEventData, type ErrorHandlerNodeData, type ErrorHandlingConfig, type ExecuteOptions, type ExecutionConfig, type GitHubConnectionConfig, type GuardrailNodeData, type HttpApiConnectionConfig, HybridFileSystem, type IFileSystem, type IPackageResolver, type IterationEventData, type JsonSchema, type LLMResponse, LexicalAnalysisStage, type LoopNodeData, MEMORY_OPERATIONS_BY_MODE, MarkdownFormatter, type McpServerConnectionConfig, type McpToolNodeData, MemoryFileSystem, type MemoryNodeData, type MemoryOperation, MemoryPackageResolver, type MergeNodeData, type NodeExecutionState, type NodeExecutionStatus, OpenAIFormatter, type OutputFormatter, type OutputNodeData, PACKAGE_TYPE_DIRS, PROMPD_EXTENSIONS, type PackageAlias, type PackageDownloader, type PackageType, type ParallelBranch, type ParallelNodeData, ParseError, type ParsedWorkflow, PrompdCompiler, PrompdError, type PrompdFile, PrompdLoader, type PrompdMetadata, type PrompdParameter, PrompdParser, type PromptNodeData, type ProviderConfig, type ProviderNodeData, type RegistryConfig, type ResolvePackageOptions, type ResolvedPackage, type RetryPolicy, type SSHConnectionConfig, type SectionInfo, SectionOverrideProcessor, type SecurityConfig, SecurityError, SemanticAnalysisStage, type SlackConnectionConfig, TOOL_DEPLOY_DIRS, TemplateProcessingStage, type ThinkingEventData, type ToolCallEventData, type ToolCallParserNodeData, type ToolCallRouterNodeData, type ToolNodeData, type TransformerNodeData, type TriggerNodeData, type UserInputNodeData, type UsingPackage, VALID_PACKAGE_TYPES, ValidationError, type ValidationIssue, type ValidationResult, type WebSearchNodeData, type WebSocketConnectionConfig, type WorkflowConnection, type WorkflowConnectionConfig, type WorkflowConnectionStatus, type WorkflowConnectionType, type WorkflowEdge, type WorkflowExecutionError, type WorkflowExecutionState, type WorkflowExecutionStatus, type WorkflowFile, type WorkflowMetadata, type WorkflowNode, type WorkflowNodeData, type WorkflowNodeType, type WorkflowParameter, type WorkflowResult, type WorkflowValidationError, type WorkflowValidationWarning, type WorkflowVariable, basenamePosix, compile, createCoreStages, createEmptyWorkflow, createPrompdEnvironment, createWorkflowNode, dirnamePosix, extname, extractPdpkg, getContentType, getExecutionOrder, getInstallDirForType, getLanguageAliasesForExtension, getLanguageForExtension, isAbsolutePosix, isPrompdFile, isValidPackageReference, isValidPackageType, joinPosix, needsFrontmatterProtection, normalizePosix, parsePackageReference, parsePackageReferenceWithPath, parseWorkflow, resolvePackageFile, resolvePosix, serializeWorkflow, stripFilePath, validateWorkflow, validateWorkflowQuick };
|
|
3016
|
+
export { type AgentCheckpointEvent, type AgentCheckpointEventType, type AgentIterationRecord, type AgentNodeData, type AgentTool, AnthropicFormatter, type ApiNodeData, type AsyncFileBackend, BUILTIN_COMMAND_EXECUTABLES, type BaseNodeData, CODE_EXTENSIONS, CONTENT_TYPES, type CallbackNodeData, type ChatAgentCheckpointConfig, type ChatAgentNodeData, type ClaudeCodeNodeData, CodeGenerationStage, type CodeNodeData, type CommandNodeData, CompilationContext, type CompilationDiagnostic, CompilationError, type CompilationOptions, CompilationStage, type CompiledPrompt, CompilerPipeline, type CompilerStage, type CompleteEventData, type ConditionBranch, type ConditionNodeData, type Config, type CustomCommandConfig, type CustomConnectionConfig, type CustomProvider, DEFAULT_SECURITY_CONFIG, DOCKABLE_HANDLES, DOCKABLE_NODE_TYPES, type DatabaseConnectionConfig, type DatabaseQueryNodeData, DependencyResolutionStage, EXTENSION_TO_LANGUAGE, EXTENSION_TO_LANGUAGE_ALIASES, type ErrorEventData, type ErrorHandlerNodeData, type ErrorHandlingConfig, type ExecuteOptions, type ExecutionConfig, type GitHubConnectionConfig, type GuardrailNodeData, type HttpApiConnectionConfig, HybridFileSystem, type IFileSystem, type IPackageResolver, type InstallPackageOptions, type InstalledPackage, type IterationEventData, type JsonSchema, type LLMResponse, LexicalAnalysisStage, type LoopNodeData, MEMORY_OPERATIONS_BY_MODE, MarkdownFormatter, type McpServerConnectionConfig, type McpToolNodeData, MemoryFileSystem, type MemoryNodeData, type MemoryOperation, MemoryPackageResolver, type MergeNodeData, type NodeExecutionState, type NodeExecutionStatus, OpenAIFormatter, type OutputFormatter, type OutputNodeData, PACKAGE_TYPE_DIRS, PROMPD_EXTENSIONS, type PackageAlias, type PackageDownloader, type PackageStore, type PackageType, type ParallelBranch, type ParallelNodeData, ParseError, type ParsedWorkflow, PrompdCompiler, PrompdError, type PrompdFile, PrompdLoader, type PrompdMetadata, type PrompdParameter, PrompdParser, type PromptNodeData, type ProviderConfig, type ProviderNodeData, type RegistryConfig, type ResolvePackageOptions, type ResolvedPackage, type RetryPolicy, type SSHConnectionConfig, type SectionInfo, SectionOverrideProcessor, type SecurityConfig, SecurityError, SemanticAnalysisStage, type SlackConnectionConfig, TOOL_DEPLOY_DIRS, TemplateProcessingStage, type ThinkingEventData, type ToolCallEventData, type ToolCallParserNodeData, type ToolCallRouterNodeData, type ToolNodeData, type TransformerNodeData, type TriggerNodeData, type UserInputNodeData, type UsingPackage, VALID_PACKAGE_TYPES, ValidationError, type ValidationIssue, type ValidationResult, type WebSearchNodeData, type WebSocketConnectionConfig, type WorkflowConnection, type WorkflowConnectionConfig, type WorkflowConnectionStatus, type WorkflowConnectionType, type WorkflowEdge, type WorkflowExecutionError, type WorkflowExecutionState, type WorkflowExecutionStatus, type WorkflowFile, type WorkflowMetadata, type WorkflowNode, type WorkflowNodeData, type WorkflowNodeType, type WorkflowParameter, type WorkflowResult, type WorkflowValidationError, type WorkflowValidationWarning, type WorkflowVariable, basenamePosix, compile, createCoreStages, createEmptyWorkflow, createPrompdEnvironment, createWorkflowNode, dirnamePosix, extname, extractPdpkg, getContentType, getExecutionOrder, getInstallDirForType, getLanguageAliasesForExtension, getLanguageForExtension, installPackage, isAbsolutePosix, isPrompdFile, isValidPackageReference, isValidPackageType, joinPosix, needsFrontmatterProtection, normalizePosix, parsePackageReference, parsePackageReferenceWithPath, parseWorkflow, resolvePackageFile, resolvePosix, serializeWorkflow, stripFilePath, validateWorkflow, validateWorkflowQuick };
|
package/dist/index.d.ts
CHANGED
|
@@ -670,6 +670,56 @@ declare class MemoryPackageResolver implements IPackageResolver {
|
|
|
670
670
|
resolvePackage(packageRef: string, options: ResolvePackageOptions): Promise<string>;
|
|
671
671
|
}
|
|
672
672
|
|
|
673
|
+
/**
|
|
674
|
+
* A writable sink the host injects so installPackage stays FS-/Node-agnostic.
|
|
675
|
+
* Browser: an adapter over the workspace FileService; CLI/sidecar: over Node fs.
|
|
676
|
+
*/
|
|
677
|
+
interface PackageStore {
|
|
678
|
+
/** Write a UTF-8 file, creating parent directories as needed. */
|
|
679
|
+
writeFile(path: string, content: string): void | Promise<void>;
|
|
680
|
+
/** Remove a directory and its contents if present, for a clean reinstall. */
|
|
681
|
+
removeDir?(path: string): void | Promise<void>;
|
|
682
|
+
}
|
|
683
|
+
interface InstallPackageOptions {
|
|
684
|
+
/** "@scope/name@version" or "@scope/name" (defaults to latest). */
|
|
685
|
+
ref: string;
|
|
686
|
+
/** Artifact type — selects the .prompd subdir (packages/skills/workflows/templates). */
|
|
687
|
+
type: PackageType;
|
|
688
|
+
/**
|
|
689
|
+
* Install root the caller chose: the open workspace folder (browser/local) or the
|
|
690
|
+
* home dir for a global install (sidecar/CLI). installPackage NEVER computes '~'
|
|
691
|
+
* itself — core stays Node-free.
|
|
692
|
+
*/
|
|
693
|
+
root: string;
|
|
694
|
+
/** Writable sink for the chosen host. */
|
|
695
|
+
store: PackageStore;
|
|
696
|
+
/**
|
|
697
|
+
* Fetch the .pdpkg bytes for a (name, version). Injected: the registry client in
|
|
698
|
+
* the browser, a Node fetch in the CLI. May resolve 'latest' to a concrete version.
|
|
699
|
+
*/
|
|
700
|
+
download: PackageDownloader;
|
|
701
|
+
}
|
|
702
|
+
interface InstalledPackage {
|
|
703
|
+
/** Full scoped name (manifest-authoritative when present), e.g. "@prompd/core". */
|
|
704
|
+
name: string;
|
|
705
|
+
/** Resolved version (from the package manifest when present). */
|
|
706
|
+
version: string;
|
|
707
|
+
scope?: string;
|
|
708
|
+
/** Install dir written to: <root>/.prompd/<typeDir>/<name>. */
|
|
709
|
+
installedPath: string;
|
|
710
|
+
/** Entry-relative paths written under installedPath. */
|
|
711
|
+
files: string[];
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Install a registry artifact into <root>/.prompd/<typeDir>/<name>/, replacing any
|
|
715
|
+
* prior install (idempotent). The host injects the writable `store` and the
|
|
716
|
+
* `download` fetcher, so the same install runs in the browser and the CLI/sidecar.
|
|
717
|
+
* Returns the resolved name/version (manifest-authoritative when present) and the
|
|
718
|
+
* files written. Rejects entries that escape the install directory (zip-slip) and
|
|
719
|
+
* archives over the size cap.
|
|
720
|
+
*/
|
|
721
|
+
declare function installPackage(opts: InstallPackageOptions): Promise<InstalledPackage>;
|
|
722
|
+
|
|
673
723
|
/**
|
|
674
724
|
* Language Mapping Utilities
|
|
675
725
|
*
|
|
@@ -2963,4 +3013,4 @@ declare function validateWorkflow(workflow: WorkflowFile): ValidationResult;
|
|
|
2963
3013
|
*/
|
|
2964
3014
|
declare function validateWorkflowQuick(workflow: WorkflowFile): Pick<ValidationResult, 'isValid'>;
|
|
2965
3015
|
|
|
2966
|
-
export { type AgentCheckpointEvent, type AgentCheckpointEventType, type AgentIterationRecord, type AgentNodeData, type AgentTool, AnthropicFormatter, type ApiNodeData, type AsyncFileBackend, BUILTIN_COMMAND_EXECUTABLES, type BaseNodeData, CODE_EXTENSIONS, CONTENT_TYPES, type CallbackNodeData, type ChatAgentCheckpointConfig, type ChatAgentNodeData, type ClaudeCodeNodeData, CodeGenerationStage, type CodeNodeData, type CommandNodeData, CompilationContext, type CompilationDiagnostic, CompilationError, type CompilationOptions, CompilationStage, type CompiledPrompt, CompilerPipeline, type CompilerStage, type CompleteEventData, type ConditionBranch, type ConditionNodeData, type Config, type CustomCommandConfig, type CustomConnectionConfig, type CustomProvider, DEFAULT_SECURITY_CONFIG, DOCKABLE_HANDLES, DOCKABLE_NODE_TYPES, type DatabaseConnectionConfig, type DatabaseQueryNodeData, DependencyResolutionStage, EXTENSION_TO_LANGUAGE, EXTENSION_TO_LANGUAGE_ALIASES, type ErrorEventData, type ErrorHandlerNodeData, type ErrorHandlingConfig, type ExecuteOptions, type ExecutionConfig, type GitHubConnectionConfig, type GuardrailNodeData, type HttpApiConnectionConfig, HybridFileSystem, type IFileSystem, type IPackageResolver, type IterationEventData, type JsonSchema, type LLMResponse, LexicalAnalysisStage, type LoopNodeData, MEMORY_OPERATIONS_BY_MODE, MarkdownFormatter, type McpServerConnectionConfig, type McpToolNodeData, MemoryFileSystem, type MemoryNodeData, type MemoryOperation, MemoryPackageResolver, type MergeNodeData, type NodeExecutionState, type NodeExecutionStatus, OpenAIFormatter, type OutputFormatter, type OutputNodeData, PACKAGE_TYPE_DIRS, PROMPD_EXTENSIONS, type PackageAlias, type PackageDownloader, type PackageType, type ParallelBranch, type ParallelNodeData, ParseError, type ParsedWorkflow, PrompdCompiler, PrompdError, type PrompdFile, PrompdLoader, type PrompdMetadata, type PrompdParameter, PrompdParser, type PromptNodeData, type ProviderConfig, type ProviderNodeData, type RegistryConfig, type ResolvePackageOptions, type ResolvedPackage, type RetryPolicy, type SSHConnectionConfig, type SectionInfo, SectionOverrideProcessor, type SecurityConfig, SecurityError, SemanticAnalysisStage, type SlackConnectionConfig, TOOL_DEPLOY_DIRS, TemplateProcessingStage, type ThinkingEventData, type ToolCallEventData, type ToolCallParserNodeData, type ToolCallRouterNodeData, type ToolNodeData, type TransformerNodeData, type TriggerNodeData, type UserInputNodeData, type UsingPackage, VALID_PACKAGE_TYPES, ValidationError, type ValidationIssue, type ValidationResult, type WebSearchNodeData, type WebSocketConnectionConfig, type WorkflowConnection, type WorkflowConnectionConfig, type WorkflowConnectionStatus, type WorkflowConnectionType, type WorkflowEdge, type WorkflowExecutionError, type WorkflowExecutionState, type WorkflowExecutionStatus, type WorkflowFile, type WorkflowMetadata, type WorkflowNode, type WorkflowNodeData, type WorkflowNodeType, type WorkflowParameter, type WorkflowResult, type WorkflowValidationError, type WorkflowValidationWarning, type WorkflowVariable, basenamePosix, compile, createCoreStages, createEmptyWorkflow, createPrompdEnvironment, createWorkflowNode, dirnamePosix, extname, extractPdpkg, getContentType, getExecutionOrder, getInstallDirForType, getLanguageAliasesForExtension, getLanguageForExtension, isAbsolutePosix, isPrompdFile, isValidPackageReference, isValidPackageType, joinPosix, needsFrontmatterProtection, normalizePosix, parsePackageReference, parsePackageReferenceWithPath, parseWorkflow, resolvePackageFile, resolvePosix, serializeWorkflow, stripFilePath, validateWorkflow, validateWorkflowQuick };
|
|
3016
|
+
export { type AgentCheckpointEvent, type AgentCheckpointEventType, type AgentIterationRecord, type AgentNodeData, type AgentTool, AnthropicFormatter, type ApiNodeData, type AsyncFileBackend, BUILTIN_COMMAND_EXECUTABLES, type BaseNodeData, CODE_EXTENSIONS, CONTENT_TYPES, type CallbackNodeData, type ChatAgentCheckpointConfig, type ChatAgentNodeData, type ClaudeCodeNodeData, CodeGenerationStage, type CodeNodeData, type CommandNodeData, CompilationContext, type CompilationDiagnostic, CompilationError, type CompilationOptions, CompilationStage, type CompiledPrompt, CompilerPipeline, type CompilerStage, type CompleteEventData, type ConditionBranch, type ConditionNodeData, type Config, type CustomCommandConfig, type CustomConnectionConfig, type CustomProvider, DEFAULT_SECURITY_CONFIG, DOCKABLE_HANDLES, DOCKABLE_NODE_TYPES, type DatabaseConnectionConfig, type DatabaseQueryNodeData, DependencyResolutionStage, EXTENSION_TO_LANGUAGE, EXTENSION_TO_LANGUAGE_ALIASES, type ErrorEventData, type ErrorHandlerNodeData, type ErrorHandlingConfig, type ExecuteOptions, type ExecutionConfig, type GitHubConnectionConfig, type GuardrailNodeData, type HttpApiConnectionConfig, HybridFileSystem, type IFileSystem, type IPackageResolver, type InstallPackageOptions, type InstalledPackage, type IterationEventData, type JsonSchema, type LLMResponse, LexicalAnalysisStage, type LoopNodeData, MEMORY_OPERATIONS_BY_MODE, MarkdownFormatter, type McpServerConnectionConfig, type McpToolNodeData, MemoryFileSystem, type MemoryNodeData, type MemoryOperation, MemoryPackageResolver, type MergeNodeData, type NodeExecutionState, type NodeExecutionStatus, OpenAIFormatter, type OutputFormatter, type OutputNodeData, PACKAGE_TYPE_DIRS, PROMPD_EXTENSIONS, type PackageAlias, type PackageDownloader, type PackageStore, type PackageType, type ParallelBranch, type ParallelNodeData, ParseError, type ParsedWorkflow, PrompdCompiler, PrompdError, type PrompdFile, PrompdLoader, type PrompdMetadata, type PrompdParameter, PrompdParser, type PromptNodeData, type ProviderConfig, type ProviderNodeData, type RegistryConfig, type ResolvePackageOptions, type ResolvedPackage, type RetryPolicy, type SSHConnectionConfig, type SectionInfo, SectionOverrideProcessor, type SecurityConfig, SecurityError, SemanticAnalysisStage, type SlackConnectionConfig, TOOL_DEPLOY_DIRS, TemplateProcessingStage, type ThinkingEventData, type ToolCallEventData, type ToolCallParserNodeData, type ToolCallRouterNodeData, type ToolNodeData, type TransformerNodeData, type TriggerNodeData, type UserInputNodeData, type UsingPackage, VALID_PACKAGE_TYPES, ValidationError, type ValidationIssue, type ValidationResult, type WebSearchNodeData, type WebSocketConnectionConfig, type WorkflowConnection, type WorkflowConnectionConfig, type WorkflowConnectionStatus, type WorkflowConnectionType, type WorkflowEdge, type WorkflowExecutionError, type WorkflowExecutionState, type WorkflowExecutionStatus, type WorkflowFile, type WorkflowMetadata, type WorkflowNode, type WorkflowNodeData, type WorkflowNodeType, type WorkflowParameter, type WorkflowResult, type WorkflowValidationError, type WorkflowValidationWarning, type WorkflowVariable, basenamePosix, compile, createCoreStages, createEmptyWorkflow, createPrompdEnvironment, createWorkflowNode, dirnamePosix, extname, extractPdpkg, getContentType, getExecutionOrder, getInstallDirForType, getLanguageAliasesForExtension, getLanguageForExtension, installPackage, isAbsolutePosix, isPrompdFile, isValidPackageReference, isValidPackageType, joinPosix, needsFrontmatterProtection, normalizePosix, parsePackageReference, parsePackageReferenceWithPath, parseWorkflow, resolvePackageFile, resolvePosix, serializeWorkflow, stripFilePath, validateWorkflow, validateWorkflowQuick };
|
package/dist/index.js
CHANGED
|
@@ -3339,6 +3339,62 @@ var HybridFileSystem = class {
|
|
|
3339
3339
|
}
|
|
3340
3340
|
};
|
|
3341
3341
|
|
|
3342
|
+
// src/lib/compiler/install.ts
|
|
3343
|
+
var MAX_PACKAGE_SIZE = 50 * 1024 * 1024;
|
|
3344
|
+
function joinPosix3(...parts) {
|
|
3345
|
+
const joined = parts.filter((p) => p && p !== ".").join("/").replace(/\/{2,}/g, "/");
|
|
3346
|
+
return joined.replace(/\/+$/, "") || "/";
|
|
3347
|
+
}
|
|
3348
|
+
function normalizeSegments(p) {
|
|
3349
|
+
const out = [];
|
|
3350
|
+
for (const seg of p.split("/")) {
|
|
3351
|
+
if (!seg || seg === ".") continue;
|
|
3352
|
+
if (seg === "..") {
|
|
3353
|
+
out.pop();
|
|
3354
|
+
continue;
|
|
3355
|
+
}
|
|
3356
|
+
out.push(seg);
|
|
3357
|
+
}
|
|
3358
|
+
return out.join("/");
|
|
3359
|
+
}
|
|
3360
|
+
async function installPackage(opts) {
|
|
3361
|
+
const { ref, type, root, store, download } = opts;
|
|
3362
|
+
const parsed = parsePackageReference(ref);
|
|
3363
|
+
const bytes = await download(parsed.name, parsed.version);
|
|
3364
|
+
if (bytes.length > MAX_PACKAGE_SIZE) {
|
|
3365
|
+
throw new Error(`Package too large: ${bytes.length} bytes (max ${MAX_PACKAGE_SIZE})`);
|
|
3366
|
+
}
|
|
3367
|
+
const files = await extractPdpkg(bytes);
|
|
3368
|
+
if (files.size === 0) {
|
|
3369
|
+
throw new Error(`Package "${parsed.name}" contains no installable files.`);
|
|
3370
|
+
}
|
|
3371
|
+
let name = parsed.name;
|
|
3372
|
+
let version = parsed.version;
|
|
3373
|
+
const manifest = files.get("manifest.json") ?? files.get("prompd.json");
|
|
3374
|
+
if (manifest) {
|
|
3375
|
+
try {
|
|
3376
|
+
const m = JSON.parse(manifest);
|
|
3377
|
+
if (typeof m.name === "string" && m.name) name = m.name;
|
|
3378
|
+
if (typeof m.version === "string" && m.version) version = m.version;
|
|
3379
|
+
} catch {
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
const installedPath = joinPosix3(root, ".prompd", getInstallDirForType(type), name);
|
|
3383
|
+
const baseSegments = normalizeSegments(installedPath);
|
|
3384
|
+
await store.removeDir?.(installedPath);
|
|
3385
|
+
const written = [];
|
|
3386
|
+
for (const [rel, content] of files) {
|
|
3387
|
+
const dest = joinPosix3(installedPath, rel);
|
|
3388
|
+
const destSegments = normalizeSegments(dest);
|
|
3389
|
+
if (destSegments !== baseSegments && !destSegments.startsWith(baseSegments + "/")) {
|
|
3390
|
+
throw new Error(`Security violation: extracted path escapes install directory: ${rel}`);
|
|
3391
|
+
}
|
|
3392
|
+
await store.writeFile(dest, content);
|
|
3393
|
+
written.push(rel);
|
|
3394
|
+
}
|
|
3395
|
+
return { name, version, scope: parsed.scope, installedPath, files: written };
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3342
3398
|
// src/lib/compiler/index.ts
|
|
3343
3399
|
function createCoreStages() {
|
|
3344
3400
|
return [
|
|
@@ -4732,6 +4788,6 @@ function getExecutionOrder(workflow) {
|
|
|
4732
4788
|
return order;
|
|
4733
4789
|
}
|
|
4734
4790
|
|
|
4735
|
-
export { AnthropicFormatter, BUILTIN_COMMAND_EXECUTABLES, CODE_EXTENSIONS, CONTENT_TYPES, CodeGenerationStage, CompilationContext, CompilationError, CompilationStage, CompilerPipeline, DEFAULT_SECURITY_CONFIG, DOCKABLE_HANDLES, DOCKABLE_NODE_TYPES, DependencyResolutionStage, EXTENSION_TO_LANGUAGE, EXTENSION_TO_LANGUAGE_ALIASES, HybridFileSystem, LexicalAnalysisStage, MEMORY_OPERATIONS_BY_MODE, MarkdownFormatter, MemoryFileSystem, MemoryPackageResolver, OpenAIFormatter, PACKAGE_TYPE_DIRS, PROMPD_EXTENSIONS, ParseError, PrompdCompiler, PrompdError, PrompdLoader, PrompdParser, SectionOverrideProcessor, SecurityError, SemanticAnalysisStage, TOOL_DEPLOY_DIRS, TemplateProcessingStage, VALID_PACKAGE_TYPES, ValidationError, basenamePosix, compile, createCoreStages, createEmptyWorkflow, createPrompdEnvironment, createWorkflowNode, dirnamePosix, extname, extractPdpkg, getContentType, getExecutionOrder, getInstallDirForType, getLanguageAliasesForExtension, getLanguageForExtension, isAbsolutePosix, isPrompdFile, isValidPackageReference, isValidPackageType, joinPosix, needsFrontmatterProtection, normalizePosix, parsePackageReference, parsePackageReferenceWithPath, parseWorkflow, resolvePackageFile, resolvePosix, serializeWorkflow, stripFilePath, validateWorkflow, validateWorkflowQuick };
|
|
4791
|
+
export { AnthropicFormatter, BUILTIN_COMMAND_EXECUTABLES, CODE_EXTENSIONS, CONTENT_TYPES, CodeGenerationStage, CompilationContext, CompilationError, CompilationStage, CompilerPipeline, DEFAULT_SECURITY_CONFIG, DOCKABLE_HANDLES, DOCKABLE_NODE_TYPES, DependencyResolutionStage, EXTENSION_TO_LANGUAGE, EXTENSION_TO_LANGUAGE_ALIASES, HybridFileSystem, LexicalAnalysisStage, MEMORY_OPERATIONS_BY_MODE, MarkdownFormatter, MemoryFileSystem, MemoryPackageResolver, OpenAIFormatter, PACKAGE_TYPE_DIRS, PROMPD_EXTENSIONS, ParseError, PrompdCompiler, PrompdError, PrompdLoader, PrompdParser, SectionOverrideProcessor, SecurityError, SemanticAnalysisStage, TOOL_DEPLOY_DIRS, TemplateProcessingStage, VALID_PACKAGE_TYPES, ValidationError, basenamePosix, compile, createCoreStages, createEmptyWorkflow, createPrompdEnvironment, createWorkflowNode, dirnamePosix, extname, extractPdpkg, getContentType, getExecutionOrder, getInstallDirForType, getLanguageAliasesForExtension, getLanguageForExtension, installPackage, isAbsolutePosix, isPrompdFile, isValidPackageReference, isValidPackageType, joinPosix, needsFrontmatterProtection, normalizePosix, parsePackageReference, parsePackageReferenceWithPath, parseWorkflow, resolvePackageFile, resolvePosix, serializeWorkflow, stripFilePath, validateWorkflow, validateWorkflowQuick };
|
|
4736
4792
|
//# sourceMappingURL=index.js.map
|
|
4737
4793
|
//# sourceMappingURL=index.js.map
|