@prompd/core 0.5.0-beta.15 → 0.5.0-beta.17
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 +107 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -37
- package/dist/index.d.ts +51 -37
- package/dist/index.js +107 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -22,9 +22,11 @@ interface IFileSystem {
|
|
|
22
22
|
/**
|
|
23
23
|
* Extract a `.pdpkg` (ZIP) buffer to a flat map of entry-relative path -> UTF-8
|
|
24
24
|
* content. The SINGLE ZIP-extraction primitive shared by package ingestion
|
|
25
|
-
* (MemoryFileSystem.addPackage) and skill install — so hosts never
|
|
26
|
-
* own jszip pass. Directories and binary assets are skipped (the
|
|
27
|
-
* text only).
|
|
25
|
+
* (MemoryFileSystem.addPackage), the installer, and skill install — so hosts never
|
|
26
|
+
* hand-roll their own jszip pass. Directories and binary assets are skipped (the
|
|
27
|
+
* consumers store text only). Enforces the same archive-security checks as the CLI:
|
|
28
|
+
* rejects null bytes, path traversal, symlinks, and oversized / decompression-bomb
|
|
29
|
+
* archives.
|
|
28
30
|
*/
|
|
29
31
|
declare function extractPdpkg(buffer: Uint8Array): Promise<Map<string, string>>;
|
|
30
32
|
/**
|
|
@@ -670,6 +672,13 @@ declare class MemoryPackageResolver implements IPackageResolver {
|
|
|
670
672
|
resolvePackage(packageRef: string, options: ResolvePackageOptions): Promise<string>;
|
|
671
673
|
}
|
|
672
674
|
|
|
675
|
+
/** Deploy an installed skill into a tool-native dir (e.g. ~/.claude/skills). Host-only
|
|
676
|
+
* (Node fs); the browser omits it. Injected so core stays Node-free. */
|
|
677
|
+
type ToolDeployHook = (opts: {
|
|
678
|
+
installedPath: string;
|
|
679
|
+
name: string;
|
|
680
|
+
tool: string;
|
|
681
|
+
}) => void | Promise<void>;
|
|
673
682
|
/**
|
|
674
683
|
* A writable sink the host injects so installPackage stays FS-/Node-agnostic.
|
|
675
684
|
* Browser: an adapter over the workspace FileService; CLI/sidecar: over Node fs.
|
|
@@ -677,30 +686,34 @@ declare class MemoryPackageResolver implements IPackageResolver {
|
|
|
677
686
|
interface PackageStore {
|
|
678
687
|
/** Write a UTF-8 file, creating parent directories as needed. */
|
|
679
688
|
writeFile(path: string, content: string): void | Promise<void>;
|
|
680
|
-
/**
|
|
689
|
+
/** Write raw bytes — required for node-templates (stored as the raw .pdpkg). */
|
|
690
|
+
writeBytes?(path: string, bytes: Uint8Array): void | Promise<void>;
|
|
691
|
+
/** Remove a directory and its contents if present. */
|
|
681
692
|
removeDir?(path: string): void | Promise<void>;
|
|
682
|
-
/**
|
|
683
|
-
|
|
693
|
+
/** Remove a single file if present (node-template .pdpkg uninstall). */
|
|
694
|
+
removeFile?(path: string): void | Promise<void>;
|
|
695
|
+
/** Read a UTF-8 file, or null if absent — used to merge the workspace prompd.json. */
|
|
684
696
|
readFile?(path: string): Promise<string | null> | string | null;
|
|
697
|
+
/** List a directory's entry names — used to find a node-template .pdpkg to uninstall. */
|
|
698
|
+
readdir?(path: string): Promise<string[]> | string[];
|
|
685
699
|
}
|
|
686
700
|
interface InstallPackageOptions {
|
|
687
701
|
/** "@scope/name@version" or "@scope/name" (defaults to latest). */
|
|
688
702
|
ref: string;
|
|
689
|
-
/**
|
|
690
|
-
type
|
|
691
|
-
/**
|
|
692
|
-
* Install root the caller chose: the open workspace folder (browser/local) or the
|
|
693
|
-
* home dir for a global install (sidecar/CLI). installPackage NEVER computes '~'
|
|
694
|
-
* itself — core stays Node-free.
|
|
695
|
-
*/
|
|
703
|
+
/** Type HINT. The package's own manifest `type` wins; this is the fallback. */
|
|
704
|
+
type?: PackageType;
|
|
705
|
+
/** Install root: the open workspace (local) or the home dir (global). */
|
|
696
706
|
root: string;
|
|
697
707
|
/** Writable sink for the chosen host. */
|
|
698
708
|
store: PackageStore;
|
|
699
|
-
/**
|
|
700
|
-
* Fetch the .pdpkg bytes for a (name, version). Injected: the registry client in
|
|
701
|
-
* the browser, a Node fetch in the CLI. May resolve 'latest' to a concrete version.
|
|
702
|
-
*/
|
|
709
|
+
/** Fetch the .pdpkg bytes for a (name, version). May resolve 'latest'. */
|
|
703
710
|
download: PackageDownloader;
|
|
711
|
+
/** Global install — skips the workspace prompd.json dependency record (CLI parity). */
|
|
712
|
+
global?: boolean;
|
|
713
|
+
/** Deploy the installed skill to these tools (skills only), via deployTool. */
|
|
714
|
+
tools?: string[];
|
|
715
|
+
/** Host hook performing the per-tool deploy. Required when `tools` is set. */
|
|
716
|
+
deployTool?: ToolDeployHook;
|
|
704
717
|
}
|
|
705
718
|
interface InstalledPackage {
|
|
706
719
|
/** Full scoped name (manifest-authoritative when present), e.g. "@prompd/core". */
|
|
@@ -708,41 +721,42 @@ interface InstalledPackage {
|
|
|
708
721
|
/** Resolved version (from the package manifest when present). */
|
|
709
722
|
version: string;
|
|
710
723
|
scope?: string;
|
|
711
|
-
/**
|
|
724
|
+
/** Resolved type (from the package manifest when present). */
|
|
725
|
+
type: PackageType;
|
|
726
|
+
/** Where it was written: the version dir, or the .pdpkg path for node-templates. */
|
|
712
727
|
installedPath: string;
|
|
713
|
-
/** Entry-relative paths written
|
|
728
|
+
/** Entry-relative paths written (empty for node-templates). */
|
|
714
729
|
files: string[];
|
|
715
730
|
}
|
|
716
731
|
/**
|
|
717
|
-
* Install a registry artifact
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
732
|
+
* Install a registry artifact, matching the CLI. Resolves the type from the package's
|
|
733
|
+
* own manifest (the `type` option is only a fallback). Standard types extract to
|
|
734
|
+
* <root>/.prompd/<typeDir>/<name>/<version>/ with a `.prmdmeta`; node-templates are
|
|
735
|
+
* stored as the raw .pdpkg. Installs the package's own dependencies recursively,
|
|
736
|
+
* records the dependency in the workspace prompd.json (local installs only), and
|
|
737
|
+
* deploys to any requested tools. Idempotent per version.
|
|
723
738
|
*/
|
|
724
739
|
declare function installPackage(opts: InstallPackageOptions): Promise<InstalledPackage>;
|
|
725
740
|
interface UninstallPackageOptions {
|
|
726
|
-
/** "@scope/name" (a version suffix is accepted but ignored
|
|
741
|
+
/** "@scope/name" (a version suffix is accepted but ignored). */
|
|
727
742
|
ref: string;
|
|
728
|
-
/**
|
|
729
|
-
type: PackageType;
|
|
730
|
-
/** Install root the caller chose (the open workspace, or '~' for a global install). */
|
|
743
|
+
/** Install root the caller chose. */
|
|
731
744
|
root: string;
|
|
732
|
-
/** Writable sink for the chosen host
|
|
745
|
+
/** Writable sink for the chosen host. */
|
|
733
746
|
store: PackageStore;
|
|
747
|
+
/** Global uninstall — skips the workspace prompd.json dependency removal. */
|
|
748
|
+
global?: boolean;
|
|
734
749
|
}
|
|
735
750
|
interface UninstalledPackage {
|
|
736
751
|
name: string;
|
|
737
752
|
scope?: string;
|
|
738
|
-
/**
|
|
739
|
-
|
|
753
|
+
/** Dirs/files removed. */
|
|
754
|
+
removed: string[];
|
|
740
755
|
}
|
|
741
756
|
/**
|
|
742
|
-
* Uninstall
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
* removeDir should swallow not-found). Throws if the store can't remove directories.
|
|
757
|
+
* Uninstall by name, matching the CLI: scan EVERY type dir under <root>/.prompd/ and
|
|
758
|
+
* remove the package's dir (all versions); for node-templates, find the .pdpkg whose
|
|
759
|
+
* manifest name matches and remove it. Drops the prompd.json dependency. Idempotent.
|
|
746
760
|
*/
|
|
747
761
|
declare function uninstallPackage(opts: UninstallPackageOptions): Promise<UninstalledPackage>;
|
|
748
762
|
|
|
@@ -3039,4 +3053,4 @@ declare function validateWorkflow(workflow: WorkflowFile): ValidationResult;
|
|
|
3039
3053
|
*/
|
|
3040
3054
|
declare function validateWorkflowQuick(workflow: WorkflowFile): Pick<ValidationResult, 'isValid'>;
|
|
3041
3055
|
|
|
3042
|
-
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 UninstallPackageOptions, type UninstalledPackage, 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, uninstallPackage, validateWorkflow, validateWorkflowQuick };
|
|
3056
|
+
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 ToolDeployHook, type ToolNodeData, type TransformerNodeData, type TriggerNodeData, type UninstallPackageOptions, type UninstalledPackage, 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, uninstallPackage, validateWorkflow, validateWorkflowQuick };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,9 +22,11 @@ interface IFileSystem {
|
|
|
22
22
|
/**
|
|
23
23
|
* Extract a `.pdpkg` (ZIP) buffer to a flat map of entry-relative path -> UTF-8
|
|
24
24
|
* content. The SINGLE ZIP-extraction primitive shared by package ingestion
|
|
25
|
-
* (MemoryFileSystem.addPackage) and skill install — so hosts never
|
|
26
|
-
* own jszip pass. Directories and binary assets are skipped (the
|
|
27
|
-
* text only).
|
|
25
|
+
* (MemoryFileSystem.addPackage), the installer, and skill install — so hosts never
|
|
26
|
+
* hand-roll their own jszip pass. Directories and binary assets are skipped (the
|
|
27
|
+
* consumers store text only). Enforces the same archive-security checks as the CLI:
|
|
28
|
+
* rejects null bytes, path traversal, symlinks, and oversized / decompression-bomb
|
|
29
|
+
* archives.
|
|
28
30
|
*/
|
|
29
31
|
declare function extractPdpkg(buffer: Uint8Array): Promise<Map<string, string>>;
|
|
30
32
|
/**
|
|
@@ -670,6 +672,13 @@ declare class MemoryPackageResolver implements IPackageResolver {
|
|
|
670
672
|
resolvePackage(packageRef: string, options: ResolvePackageOptions): Promise<string>;
|
|
671
673
|
}
|
|
672
674
|
|
|
675
|
+
/** Deploy an installed skill into a tool-native dir (e.g. ~/.claude/skills). Host-only
|
|
676
|
+
* (Node fs); the browser omits it. Injected so core stays Node-free. */
|
|
677
|
+
type ToolDeployHook = (opts: {
|
|
678
|
+
installedPath: string;
|
|
679
|
+
name: string;
|
|
680
|
+
tool: string;
|
|
681
|
+
}) => void | Promise<void>;
|
|
673
682
|
/**
|
|
674
683
|
* A writable sink the host injects so installPackage stays FS-/Node-agnostic.
|
|
675
684
|
* Browser: an adapter over the workspace FileService; CLI/sidecar: over Node fs.
|
|
@@ -677,30 +686,34 @@ declare class MemoryPackageResolver implements IPackageResolver {
|
|
|
677
686
|
interface PackageStore {
|
|
678
687
|
/** Write a UTF-8 file, creating parent directories as needed. */
|
|
679
688
|
writeFile(path: string, content: string): void | Promise<void>;
|
|
680
|
-
/**
|
|
689
|
+
/** Write raw bytes — required for node-templates (stored as the raw .pdpkg). */
|
|
690
|
+
writeBytes?(path: string, bytes: Uint8Array): void | Promise<void>;
|
|
691
|
+
/** Remove a directory and its contents if present. */
|
|
681
692
|
removeDir?(path: string): void | Promise<void>;
|
|
682
|
-
/**
|
|
683
|
-
|
|
693
|
+
/** Remove a single file if present (node-template .pdpkg uninstall). */
|
|
694
|
+
removeFile?(path: string): void | Promise<void>;
|
|
695
|
+
/** Read a UTF-8 file, or null if absent — used to merge the workspace prompd.json. */
|
|
684
696
|
readFile?(path: string): Promise<string | null> | string | null;
|
|
697
|
+
/** List a directory's entry names — used to find a node-template .pdpkg to uninstall. */
|
|
698
|
+
readdir?(path: string): Promise<string[]> | string[];
|
|
685
699
|
}
|
|
686
700
|
interface InstallPackageOptions {
|
|
687
701
|
/** "@scope/name@version" or "@scope/name" (defaults to latest). */
|
|
688
702
|
ref: string;
|
|
689
|
-
/**
|
|
690
|
-
type
|
|
691
|
-
/**
|
|
692
|
-
* Install root the caller chose: the open workspace folder (browser/local) or the
|
|
693
|
-
* home dir for a global install (sidecar/CLI). installPackage NEVER computes '~'
|
|
694
|
-
* itself — core stays Node-free.
|
|
695
|
-
*/
|
|
703
|
+
/** Type HINT. The package's own manifest `type` wins; this is the fallback. */
|
|
704
|
+
type?: PackageType;
|
|
705
|
+
/** Install root: the open workspace (local) or the home dir (global). */
|
|
696
706
|
root: string;
|
|
697
707
|
/** Writable sink for the chosen host. */
|
|
698
708
|
store: PackageStore;
|
|
699
|
-
/**
|
|
700
|
-
* Fetch the .pdpkg bytes for a (name, version). Injected: the registry client in
|
|
701
|
-
* the browser, a Node fetch in the CLI. May resolve 'latest' to a concrete version.
|
|
702
|
-
*/
|
|
709
|
+
/** Fetch the .pdpkg bytes for a (name, version). May resolve 'latest'. */
|
|
703
710
|
download: PackageDownloader;
|
|
711
|
+
/** Global install — skips the workspace prompd.json dependency record (CLI parity). */
|
|
712
|
+
global?: boolean;
|
|
713
|
+
/** Deploy the installed skill to these tools (skills only), via deployTool. */
|
|
714
|
+
tools?: string[];
|
|
715
|
+
/** Host hook performing the per-tool deploy. Required when `tools` is set. */
|
|
716
|
+
deployTool?: ToolDeployHook;
|
|
704
717
|
}
|
|
705
718
|
interface InstalledPackage {
|
|
706
719
|
/** Full scoped name (manifest-authoritative when present), e.g. "@prompd/core". */
|
|
@@ -708,41 +721,42 @@ interface InstalledPackage {
|
|
|
708
721
|
/** Resolved version (from the package manifest when present). */
|
|
709
722
|
version: string;
|
|
710
723
|
scope?: string;
|
|
711
|
-
/**
|
|
724
|
+
/** Resolved type (from the package manifest when present). */
|
|
725
|
+
type: PackageType;
|
|
726
|
+
/** Where it was written: the version dir, or the .pdpkg path for node-templates. */
|
|
712
727
|
installedPath: string;
|
|
713
|
-
/** Entry-relative paths written
|
|
728
|
+
/** Entry-relative paths written (empty for node-templates). */
|
|
714
729
|
files: string[];
|
|
715
730
|
}
|
|
716
731
|
/**
|
|
717
|
-
* Install a registry artifact
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
732
|
+
* Install a registry artifact, matching the CLI. Resolves the type from the package's
|
|
733
|
+
* own manifest (the `type` option is only a fallback). Standard types extract to
|
|
734
|
+
* <root>/.prompd/<typeDir>/<name>/<version>/ with a `.prmdmeta`; node-templates are
|
|
735
|
+
* stored as the raw .pdpkg. Installs the package's own dependencies recursively,
|
|
736
|
+
* records the dependency in the workspace prompd.json (local installs only), and
|
|
737
|
+
* deploys to any requested tools. Idempotent per version.
|
|
723
738
|
*/
|
|
724
739
|
declare function installPackage(opts: InstallPackageOptions): Promise<InstalledPackage>;
|
|
725
740
|
interface UninstallPackageOptions {
|
|
726
|
-
/** "@scope/name" (a version suffix is accepted but ignored
|
|
741
|
+
/** "@scope/name" (a version suffix is accepted but ignored). */
|
|
727
742
|
ref: string;
|
|
728
|
-
/**
|
|
729
|
-
type: PackageType;
|
|
730
|
-
/** Install root the caller chose (the open workspace, or '~' for a global install). */
|
|
743
|
+
/** Install root the caller chose. */
|
|
731
744
|
root: string;
|
|
732
|
-
/** Writable sink for the chosen host
|
|
745
|
+
/** Writable sink for the chosen host. */
|
|
733
746
|
store: PackageStore;
|
|
747
|
+
/** Global uninstall — skips the workspace prompd.json dependency removal. */
|
|
748
|
+
global?: boolean;
|
|
734
749
|
}
|
|
735
750
|
interface UninstalledPackage {
|
|
736
751
|
name: string;
|
|
737
752
|
scope?: string;
|
|
738
|
-
/**
|
|
739
|
-
|
|
753
|
+
/** Dirs/files removed. */
|
|
754
|
+
removed: string[];
|
|
740
755
|
}
|
|
741
756
|
/**
|
|
742
|
-
* Uninstall
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
* removeDir should swallow not-found). Throws if the store can't remove directories.
|
|
757
|
+
* Uninstall by name, matching the CLI: scan EVERY type dir under <root>/.prompd/ and
|
|
758
|
+
* remove the package's dir (all versions); for node-templates, find the .pdpkg whose
|
|
759
|
+
* manifest name matches and remove it. Drops the prompd.json dependency. Idempotent.
|
|
746
760
|
*/
|
|
747
761
|
declare function uninstallPackage(opts: UninstallPackageOptions): Promise<UninstalledPackage>;
|
|
748
762
|
|
|
@@ -3039,4 +3053,4 @@ declare function validateWorkflow(workflow: WorkflowFile): ValidationResult;
|
|
|
3039
3053
|
*/
|
|
3040
3054
|
declare function validateWorkflowQuick(workflow: WorkflowFile): Pick<ValidationResult, 'isValid'>;
|
|
3041
3055
|
|
|
3042
|
-
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 UninstallPackageOptions, type UninstalledPackage, 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, uninstallPackage, validateWorkflow, validateWorkflowQuick };
|
|
3056
|
+
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 ToolDeployHook, type ToolNodeData, type TransformerNodeData, type TriggerNodeData, type UninstallPackageOptions, type UninstalledPackage, 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, uninstallPackage, validateWorkflow, validateWorkflowQuick };
|
package/dist/index.js
CHANGED
|
@@ -3109,12 +3109,35 @@ function isBinaryAsset(name) {
|
|
|
3109
3109
|
const dot = name.lastIndexOf(".");
|
|
3110
3110
|
return dot >= 0 && BINARY_ASSET_EXT.has(name.slice(dot + 1).toLowerCase());
|
|
3111
3111
|
}
|
|
3112
|
+
var MAX_FILE_SIZE_IN_ZIP = 10 * 1024 * 1024;
|
|
3113
|
+
var MAX_TOTAL_EXTRACTED_SIZE = 500 * 1024 * 1024;
|
|
3114
|
+
function isSymlinkEntry(perms) {
|
|
3115
|
+
return typeof perms === "number" && (perms & 61440) === 40960;
|
|
3116
|
+
}
|
|
3112
3117
|
async function extractPdpkg(buffer) {
|
|
3113
3118
|
const zip = await JSZip.loadAsync(buffer);
|
|
3114
3119
|
const out = /* @__PURE__ */ new Map();
|
|
3120
|
+
let total = 0;
|
|
3115
3121
|
for (const entry of Object.values(zip.files)) {
|
|
3122
|
+
if (entry.name.includes("\0")) {
|
|
3123
|
+
throw new Error(`Security violation: null byte in entry name: ${entry.name}`);
|
|
3124
|
+
}
|
|
3125
|
+
if (entry.name.startsWith("/") || /(^|\/)\.\.(\/|$)/.test(entry.name)) {
|
|
3126
|
+
throw new Error(`Security violation: path traversal in entry: ${entry.name}`);
|
|
3127
|
+
}
|
|
3128
|
+
if (isSymlinkEntry(entry.unixPermissions)) {
|
|
3129
|
+
throw new Error(`Security violation: symlink entry in archive: ${entry.name}`);
|
|
3130
|
+
}
|
|
3116
3131
|
if (entry.dir || isBinaryAsset(entry.name)) continue;
|
|
3117
|
-
|
|
3132
|
+
const bytes = await entry.async("uint8array");
|
|
3133
|
+
if (bytes.length > MAX_FILE_SIZE_IN_ZIP) {
|
|
3134
|
+
throw new Error(`File too large in package: ${entry.name} (${bytes.length} bytes, max ${MAX_FILE_SIZE_IN_ZIP})`);
|
|
3135
|
+
}
|
|
3136
|
+
total += bytes.length;
|
|
3137
|
+
if (total > MAX_TOTAL_EXTRACTED_SIZE) {
|
|
3138
|
+
throw new Error(`Package total decompressed size exceeds limit (${MAX_TOTAL_EXTRACTED_SIZE} bytes). Possible decompression bomb.`);
|
|
3139
|
+
}
|
|
3140
|
+
out.set(entry.name, new TextDecoder().decode(bytes));
|
|
3118
3141
|
}
|
|
3119
3142
|
return out;
|
|
3120
3143
|
}
|
|
@@ -3357,9 +3380,15 @@ function normalizeSegments(p) {
|
|
|
3357
3380
|
}
|
|
3358
3381
|
return out.join("/");
|
|
3359
3382
|
}
|
|
3360
|
-
function
|
|
3383
|
+
function slugify(name) {
|
|
3384
|
+
return name.toLowerCase().replace(/[@/]+/g, "-").replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3385
|
+
}
|
|
3386
|
+
function resolvePackageDir(root, type, name) {
|
|
3361
3387
|
return joinPosix3(root, ".prompd", getInstallDirForType(type), name);
|
|
3362
3388
|
}
|
|
3389
|
+
function resolveInstallDir(root, type, name, version) {
|
|
3390
|
+
return joinPosix3(resolvePackageDir(root, type, name), version);
|
|
3391
|
+
}
|
|
3363
3392
|
async function addWorkspaceDependency(store, root, name, version) {
|
|
3364
3393
|
if (!store.readFile) return;
|
|
3365
3394
|
const manifestPath = joinPosix3(root, "prompd.json");
|
|
@@ -3386,8 +3415,20 @@ async function removeWorkspaceDependency(store, root, name) {
|
|
|
3386
3415
|
} catch {
|
|
3387
3416
|
}
|
|
3388
3417
|
}
|
|
3418
|
+
function readManifest(files) {
|
|
3419
|
+
const raw = files.get("manifest.json") ?? files.get("prompd.json");
|
|
3420
|
+
if (!raw) return {};
|
|
3421
|
+
try {
|
|
3422
|
+
return JSON.parse(raw);
|
|
3423
|
+
} catch {
|
|
3424
|
+
return {};
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3389
3427
|
async function installPackage(opts) {
|
|
3390
|
-
|
|
3428
|
+
return installInternal(opts, /* @__PURE__ */ new Set());
|
|
3429
|
+
}
|
|
3430
|
+
async function installInternal(opts, visited) {
|
|
3431
|
+
const { ref, root, store, download, global, tools, deployTool } = opts;
|
|
3391
3432
|
const parsed = parsePackageReference(ref);
|
|
3392
3433
|
const bytes = await download(parsed.name, parsed.version);
|
|
3393
3434
|
if (bytes.length > MAX_PACKAGE_SIZE) {
|
|
@@ -3397,43 +3438,77 @@ async function installPackage(opts) {
|
|
|
3397
3438
|
if (files.size === 0) {
|
|
3398
3439
|
throw new Error(`Package "${parsed.name}" contains no installable files.`);
|
|
3399
3440
|
}
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
const
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
if (
|
|
3408
|
-
|
|
3441
|
+
const m = readManifest(files);
|
|
3442
|
+
const name = typeof m.name === "string" && m.name ? m.name : parsed.name;
|
|
3443
|
+
const version = typeof m.version === "string" && m.version ? m.version : parsed.version;
|
|
3444
|
+
const type = typeof m.type === "string" && isValidPackageType(m.type) ? m.type : opts.type && isValidPackageType(opts.type) ? opts.type : "package";
|
|
3445
|
+
visited.add(name);
|
|
3446
|
+
if (m.dependencies && typeof m.dependencies === "object") {
|
|
3447
|
+
for (const [depName, depVersion] of Object.entries(m.dependencies)) {
|
|
3448
|
+
if (depName === name || visited.has(depName)) continue;
|
|
3449
|
+
await installInternal({ ...opts, ref: `${depName}@${depVersion}`, type: void 0 }, visited);
|
|
3409
3450
|
}
|
|
3410
3451
|
}
|
|
3411
|
-
|
|
3412
|
-
const baseSegments = normalizeSegments(installedPath);
|
|
3413
|
-
await store.removeDir?.(installedPath);
|
|
3452
|
+
let installedPath;
|
|
3414
3453
|
const written = [];
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3454
|
+
if (type === "node-template") {
|
|
3455
|
+
if (!store.writeBytes) {
|
|
3456
|
+
throw new Error("Installing a node-template requires a PackageStore with writeBytes (binary). This host does not support it.");
|
|
3457
|
+
}
|
|
3458
|
+
const dir = joinPosix3(root, ".prompd", getInstallDirForType("node-template"));
|
|
3459
|
+
installedPath = joinPosix3(dir, `${slugify(name)}-${version}.pdpkg`);
|
|
3460
|
+
await store.writeBytes(installedPath, bytes);
|
|
3461
|
+
} else {
|
|
3462
|
+
installedPath = resolveInstallDir(root, type, name, version);
|
|
3463
|
+
const base = normalizeSegments(installedPath);
|
|
3464
|
+
await store.removeDir?.(installedPath);
|
|
3465
|
+
for (const [rel, content] of files) {
|
|
3466
|
+
const dest = joinPosix3(installedPath, rel);
|
|
3467
|
+
if (normalizeSegments(dest) !== base && !normalizeSegments(dest).startsWith(base + "/")) {
|
|
3468
|
+
throw new Error(`Security violation: extracted path escapes install directory: ${rel}`);
|
|
3469
|
+
}
|
|
3470
|
+
await store.writeFile(dest, content);
|
|
3471
|
+
written.push(rel);
|
|
3472
|
+
}
|
|
3473
|
+
await store.writeFile(joinPosix3(installedPath, ".prmdmeta"), JSON.stringify(m, null, 2) + "\n");
|
|
3474
|
+
if (tools && tools.length > 0) {
|
|
3475
|
+
if (type !== "skill") throw new Error(`Tool deploy is only valid for skills, but '${name}' is a ${type}.`);
|
|
3476
|
+
if (!deployTool) throw new Error("tools were requested but no deployTool hook was provided.");
|
|
3477
|
+
for (const tool of tools) await deployTool({ installedPath, name, tool });
|
|
3420
3478
|
}
|
|
3421
|
-
await store.writeFile(dest, content);
|
|
3422
|
-
written.push(rel);
|
|
3423
3479
|
}
|
|
3424
|
-
await addWorkspaceDependency(store, root, name, version);
|
|
3425
|
-
return { name, version, scope: parsed.scope, installedPath, files: written };
|
|
3480
|
+
if (!global) await addWorkspaceDependency(store, root, name, version);
|
|
3481
|
+
return { name, version, scope: parsed.scope, type, installedPath, files: written };
|
|
3426
3482
|
}
|
|
3427
3483
|
async function uninstallPackage(opts) {
|
|
3428
|
-
const {
|
|
3429
|
-
if (!store.removeDir)
|
|
3430
|
-
|
|
3484
|
+
const { root, store, global } = opts;
|
|
3485
|
+
if (!store.removeDir) throw new Error("Uninstall requires a PackageStore with removeDir.");
|
|
3486
|
+
const parsed = parsePackageReference(opts.ref);
|
|
3487
|
+
const name = parsed.name;
|
|
3488
|
+
const removed = [];
|
|
3489
|
+
for (const type of ["package", "workflow", "skill", "node-template"]) {
|
|
3490
|
+
if (type === "node-template") {
|
|
3491
|
+
const dir = joinPosix3(root, ".prompd", getInstallDirForType("node-template"));
|
|
3492
|
+
if (!store.readdir || !store.removeFile) continue;
|
|
3493
|
+
try {
|
|
3494
|
+
const prefix = `${slugify(name)}-`;
|
|
3495
|
+
for (const entry of await store.readdir(dir)) {
|
|
3496
|
+
if (entry.startsWith(prefix) && entry.endsWith(".pdpkg")) {
|
|
3497
|
+
const p = joinPosix3(dir, entry);
|
|
3498
|
+
await store.removeFile(p);
|
|
3499
|
+
removed.push(p);
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
} catch {
|
|
3503
|
+
}
|
|
3504
|
+
} else {
|
|
3505
|
+
const dir = resolvePackageDir(root, type, name);
|
|
3506
|
+
await store.removeDir(dir);
|
|
3507
|
+
removed.push(dir);
|
|
3508
|
+
}
|
|
3431
3509
|
}
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
await store.removeDir(installedPath);
|
|
3435
|
-
await removeWorkspaceDependency(store, root, parsed.name);
|
|
3436
|
-
return { name: parsed.name, scope: parsed.scope, installedPath };
|
|
3510
|
+
if (!global) await removeWorkspaceDependency(store, root, name);
|
|
3511
|
+
return { name, scope: parsed.scope, removed };
|
|
3437
3512
|
}
|
|
3438
3513
|
|
|
3439
3514
|
// src/lib/compiler/index.ts
|