@perstack/core 0.0.42 → 0.0.44

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 CHANGED
@@ -48,63 +48,30 @@ export const apiExpertSchema = expertSchema.omit({
48
48
 
49
49
  2. **Domain Common Types**: Types that represent core domain concepts used throughout the system, for example:
50
50
  - `Job` - Top-level execution unit containing Runs
51
- - `Run` - Single Expert execution within a Job
51
+ - `RunParams` - Single Expert execution within a Job (setting + optional checkpoint)
52
52
  - `Checkpoint` - Execution state snapshots
53
53
  - `Usage` - Resource usage tracking
54
54
  - `ProviderConfig` - LLM provider configurations
55
55
 
56
56
  3. **Configuration Schemas**: System-wide configuration structures, for example:
57
- - `PerstackToml` - Project configuration file schema
58
- - `JobSetting` - Job execution parameters
57
+ - `PerstackConfig` - Project configuration file schema
59
58
  - `RunSetting` - Run execution parameters
60
59
 
61
- 4. **Adapter Abstractions**: Runtime adapter interfaces and base classes:
62
- - `RuntimeAdapter` - Interface for runtime adapters
63
- - `BaseAdapter` - Abstract base class for CLI-based adapters
64
- - `AdapterRunParams`, `AdapterRunResult` - Adapter execution types
65
- - Event creators for normalized checkpoint/event handling
66
-
67
- 5. **Storage Abstractions**: Abstract interface for data persistence:
68
- - `Storage` - Interface for storage backends (filesystem, S3, R2)
69
- - `EventMeta` - Metadata type for event listings
60
+ 4. **Event Creators**: Utility functions for creating normalized events:
61
+ - `createNormalizedCheckpoint` - Create checkpoint objects
62
+ - `createStartRunEvent`, `createCompleteRunEvent` - Run lifecycle events
63
+ - `createCallToolsEvent`, `createResolveToolResultsEvent` - Tool execution events
70
64
 
71
65
  ### Execution Hierarchy
72
66
 
73
67
  | Schema | Description |
74
68
  | ------------ | -------------------------------------------- |
75
69
  | `Job` | Top-level execution unit. Contains all Runs. |
76
- | `Run` | Single Expert execution within a Job. |
70
+ | `RunParams` | Single Expert execution within a Job. |
77
71
  | `Checkpoint` | Snapshot at step end within a Run. |
78
72
 
79
73
  For the full hierarchy and execution model, see [State Management](https://github.com/perstack-ai/perstack/blob/main/docs/using-experts/state-management.md).
80
74
 
81
- ### Storage Interface
82
-
83
- The `Storage` interface provides an abstraction for persisting Perstack data:
84
-
85
- ```typescript
86
- import type { Storage, EventMeta } from "@perstack/core"
87
-
88
- interface Storage {
89
- storeCheckpoint(checkpoint: Checkpoint): Promise<void>
90
- retrieveCheckpoint(jobId: string, checkpointId: string): Promise<Checkpoint>
91
- getCheckpointsByJobId(jobId: string): Promise<Checkpoint[]>
92
- storeEvent(event: RunEvent): Promise<void>
93
- getEventsByRun(jobId: string, runId: string): Promise<EventMeta[]>
94
- getEventContents(jobId: string, runId: string, maxStep?: number): Promise<RunEvent[]>
95
- storeJob(job: Job): Promise<void>
96
- retrieveJob(jobId: string): Promise<Job | undefined>
97
- getAllJobs(): Promise<Job[]>
98
- storeRunSetting(setting: RunSetting): Promise<void>
99
- getAllRuns(): Promise<RunSetting[]>
100
- }
101
- ```
102
-
103
- Available implementations:
104
- - `@perstack/filesystem-storage` - Local filesystem storage (default)
105
- - `@perstack/s3-storage` - AWS S3 storage
106
- - `@perstack/r2-storage` - Cloudflare R2 storage
107
-
108
75
  ### What Core Should NOT Contain
109
76
 
110
77
  1. **Package-Internal Types**: Implementation details that don't cross package boundaries should remain in their respective packages.
@@ -471,15 +471,6 @@ declare const messageSchema: z.ZodUnion<readonly [z.ZodObject<{
471
471
  cache: z.ZodOptional<z.ZodBoolean>;
472
472
  }, z.core.$strip>]>;
473
473
 
474
- type RuntimeName = "local" | "cursor" | "claude-code" | "gemini" | "docker";
475
- declare const runtimeNameSchema: z.ZodEnum<{
476
- local: "local";
477
- cursor: "cursor";
478
- "claude-code": "claude-code";
479
- gemini: "gemini";
480
- docker: "docker";
481
- }>;
482
-
483
474
  /** A tool call made by an Expert during execution */
484
475
  interface ToolCall {
485
476
  /** Unique identifier for this tool call */
@@ -604,7 +595,7 @@ declare const usageSchema: z.ZodObject<{
604
595
  }, z.core.$strip>;
605
596
 
606
597
  /** Status of a checkpoint in the execution lifecycle */
607
- type CheckpointStatus = "init" | "proceeding" | "completed" | "stoppedByInteractiveTool" | "stoppedByDelegate" | "stoppedByExceededMaxSteps" | "stoppedByError";
598
+ type CheckpointStatus = "init" | "proceeding" | "completed" | "stoppedByInteractiveTool" | "stoppedByDelegate" | "stoppedByExceededMaxSteps" | "stoppedByError" | "stoppedByCancellation";
608
599
  declare const checkpointStatusSchema: z.ZodEnum<{
609
600
  init: "init";
610
601
  proceeding: "proceeding";
@@ -613,6 +604,7 @@ declare const checkpointStatusSchema: z.ZodEnum<{
613
604
  stoppedByDelegate: "stoppedByDelegate";
614
605
  stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
615
606
  stoppedByError: "stoppedByError";
607
+ stoppedByCancellation: "stoppedByCancellation";
616
608
  }>;
617
609
  /** Information about a delegation target */
618
610
  interface DelegationTarget {
@@ -680,11 +672,8 @@ interface Checkpoint {
680
672
  pendingToolCalls?: ToolCall[];
681
673
  /** Partial tool results collected before stopping (for resume) */
682
674
  partialToolResults?: ToolResult[];
683
- /** Optional metadata for runtime-specific information */
675
+ /** Optional metadata */
684
676
  metadata?: {
685
- /** Runtime that executed this checkpoint */
686
- runtime?: RuntimeName;
687
- /** Additional runtime-specific data */
688
677
  [key: string]: unknown;
689
678
  };
690
679
  /** Error information when status is stoppedByError */
@@ -719,6 +708,7 @@ declare const checkpointSchema: z.ZodObject<{
719
708
  stoppedByDelegate: "stoppedByDelegate";
720
709
  stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
721
710
  stoppedByError: "stoppedByError";
711
+ stoppedByCancellation: "stoppedByCancellation";
722
712
  }>;
723
713
  stepNumber: z.ZodNumber;
724
714
  messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
@@ -929,15 +919,7 @@ declare const checkpointSchema: z.ZodObject<{
929
919
  signature: z.ZodOptional<z.ZodString>;
930
920
  }, z.core.$strip>], "type">>;
931
921
  }, z.core.$strip>>>;
932
- metadata: z.ZodOptional<z.ZodObject<{
933
- runtime: z.ZodOptional<z.ZodEnum<{
934
- local: "local";
935
- cursor: "cursor";
936
- "claude-code": "claude-code";
937
- gemini: "gemini";
938
- docker: "docker";
939
- }>>;
940
- }, z.core.$loose>>;
922
+ metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
941
923
  error: z.ZodOptional<z.ZodObject<{
942
924
  name: z.ZodString;
943
925
  message: z.ZodString;
@@ -1038,13 +1020,11 @@ declare const providerToolOptionsSchema: z.ZodOptional<z.ZodObject<{
1038
1020
  }, z.core.$strip>>;
1039
1021
  }, z.core.$strip>>;
1040
1022
  type ProviderToolOptions = z.infer<typeof providerToolOptionsSchema>;
1041
- declare function hasCustomProviderSkills(skills?: AnthropicProviderSkill[]): boolean;
1042
1023
 
1043
- type RuntimeVersion = "v1.0";
1044
- declare const runtimeVersionSchema: z.ZodEnum<{
1045
- "v1.0": "v1.0";
1046
- }>;
1024
+ type RuntimeVersion = `v${number}.${number}`;
1025
+ declare const runtimeVersionSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`v${number}.${number}`, string>>;
1047
1026
 
1027
+ declare function isPrivateOrLocalIP(hostname: string): boolean;
1048
1028
  /** MCP skill using stdio transport */
1049
1029
  interface McpStdioSkill {
1050
1030
  type: "mcpStdioSkill";
@@ -1331,9 +1311,7 @@ declare const expertSchema: z.ZodObject<{
1331
1311
  }>>>;
1332
1312
  delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1333
1313
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1334
- minRuntimeVersion: z.ZodDefault<z.ZodEnum<{
1335
- "v1.0": "v1.0";
1336
- }>>;
1314
+ minRuntimeVersion: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<`v${number}.${number}`, string>>>;
1337
1315
  providerTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1338
1316
  providerSkills: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1339
1317
  type: z.ZodLiteral<"builtin">;
@@ -1579,8 +1557,6 @@ interface PerstackConfig {
1579
1557
  model?: string;
1580
1558
  /** Reasoning budget for native LLM reasoning (extended thinking) */
1581
1559
  reasoningBudget?: ReasoningBudget;
1582
- /** Default execution runtime */
1583
- runtime?: RuntimeName;
1584
1560
  /** Maximum steps per run */
1585
1561
  maxSteps?: number;
1586
1562
  /** Maximum retries on generation failure */
@@ -1661,21 +1637,12 @@ declare const perstackConfigSchema: z.ZodObject<{
1661
1637
  medium: "medium";
1662
1638
  high: "high";
1663
1639
  }>, z.ZodNumber]>>;
1664
- runtime: z.ZodOptional<z.ZodEnum<{
1665
- local: "local";
1666
- cursor: "cursor";
1667
- "claude-code": "claude-code";
1668
- gemini: "gemini";
1669
- docker: "docker";
1670
- }>>;
1671
1640
  maxSteps: z.ZodOptional<z.ZodNumber>;
1672
1641
  maxRetries: z.ZodOptional<z.ZodNumber>;
1673
1642
  timeout: z.ZodOptional<z.ZodNumber>;
1674
1643
  experts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1675
1644
  version: z.ZodOptional<z.ZodString>;
1676
- minRuntimeVersion: z.ZodOptional<z.ZodEnum<{
1677
- "v1.0": "v1.0";
1678
- }>>;
1645
+ minRuntimeVersion: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`v${number}.${number}`, string>>>;
1679
1646
  description: z.ZodOptional<z.ZodString>;
1680
1647
  instruction: z.ZodString;
1681
1648
  skills: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -2593,9 +2560,7 @@ declare const runSettingSchema: z.ZodObject<{
2593
2560
  }>>>;
2594
2561
  delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2595
2562
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2596
- minRuntimeVersion: z.ZodDefault<z.ZodEnum<{
2597
- "v1.0": "v1.0";
2598
- }>>;
2563
+ minRuntimeVersion: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<`v${number}.${number}`, string>>>;
2599
2564
  providerTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
2600
2565
  providerSkills: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2601
2566
  type: z.ZodLiteral<"builtin">;
@@ -2825,9 +2790,7 @@ declare const runParamsSchema: z.ZodObject<{
2825
2790
  }>>>;
2826
2791
  delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2827
2792
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
2828
- minRuntimeVersion: z.ZodDefault<z.ZodEnum<{
2829
- "v1.0": "v1.0";
2830
- }>>;
2793
+ minRuntimeVersion: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<`v${number}.${number}`, string>>>;
2831
2794
  providerTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
2832
2795
  providerSkills: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2833
2796
  type: z.ZodLiteral<"builtin">;
@@ -2885,7 +2848,7 @@ declare const runParamsSchema: z.ZodObject<{
2885
2848
  };
2886
2849
  delegates: string[];
2887
2850
  tags: string[];
2888
- minRuntimeVersion: "v1.0";
2851
+ minRuntimeVersion: `v${number}.${number}`;
2889
2852
  description?: string | undefined;
2890
2853
  providerTools?: string[] | undefined;
2891
2854
  providerSkills?: ({
@@ -2951,7 +2914,7 @@ declare const runParamsSchema: z.ZodObject<{
2951
2914
  };
2952
2915
  delegates: string[];
2953
2916
  tags: string[];
2954
- minRuntimeVersion: "v1.0";
2917
+ minRuntimeVersion: `v${number}.${number}`;
2955
2918
  description?: string | undefined;
2956
2919
  providerToolOptions?: {
2957
2920
  webSearch?: {
@@ -3007,6 +2970,7 @@ declare const runParamsSchema: z.ZodObject<{
3007
2970
  stoppedByDelegate: "stoppedByDelegate";
3008
2971
  stoppedByExceededMaxSteps: "stoppedByExceededMaxSteps";
3009
2972
  stoppedByError: "stoppedByError";
2973
+ stoppedByCancellation: "stoppedByCancellation";
3010
2974
  }>;
3011
2975
  stepNumber: z.ZodNumber;
3012
2976
  messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
@@ -3217,15 +3181,7 @@ declare const runParamsSchema: z.ZodObject<{
3217
3181
  signature: z.ZodOptional<z.ZodString>;
3218
3182
  }, z.core.$strip>], "type">>;
3219
3183
  }, z.core.$strip>>>;
3220
- metadata: z.ZodOptional<z.ZodObject<{
3221
- runtime: z.ZodOptional<z.ZodEnum<{
3222
- local: "local";
3223
- cursor: "cursor";
3224
- "claude-code": "claude-code";
3225
- gemini: "gemini";
3226
- docker: "docker";
3227
- }>>;
3228
- }, z.core.$loose>>;
3184
+ metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
3229
3185
  error: z.ZodOptional<z.ZodObject<{
3230
3186
  name: z.ZodString;
3231
3187
  message: z.ZodString;
@@ -3237,7 +3193,7 @@ declare const runParamsSchema: z.ZodObject<{
3237
3193
  }, z.core.$strip>;
3238
3194
  /**
3239
3195
  * Expert state events - state machine transitions during execution.
3240
- * All events contain deeply serializable properties for checkpoint storage.
3196
+ * All events contain deeply serializable properties for checkpoint persistence.
3241
3197
  */
3242
3198
  type ExpertStatePayloads = {
3243
3199
  startRun: {
@@ -3622,7 +3578,6 @@ interface BaseRuntimeEvent {
3622
3578
  type RuntimeEventPayloads = {
3623
3579
  initializeRuntime: {
3624
3580
  runtimeVersion: string;
3625
- runtime?: string;
3626
3581
  expertName: string;
3627
3582
  experts: string[];
3628
3583
  model: string;
@@ -3660,26 +3615,6 @@ type RuntimeEventPayloads = {
3660
3615
  skillDisconnected: {
3661
3616
  skillName: string;
3662
3617
  };
3663
- /** Docker build progress event */
3664
- dockerBuildProgress: {
3665
- stage: "pulling" | "building" | "complete" | "error";
3666
- service: string;
3667
- message: string;
3668
- progress?: number;
3669
- };
3670
- /** Docker container status event */
3671
- dockerContainerStatus: {
3672
- status: "starting" | "running" | "healthy" | "unhealthy" | "stopped" | "error";
3673
- service: string;
3674
- message?: string;
3675
- };
3676
- /** Proxy access event (allow/block) */
3677
- proxyAccess: {
3678
- action: "allowed" | "blocked";
3679
- domain: string;
3680
- port: number;
3681
- reason?: string;
3682
- };
3683
3618
  };
3684
3619
  /** All runtime event types */
3685
3620
  type RuntimeEventType = keyof RuntimeEventPayloads;
@@ -3713,100 +3648,26 @@ type CreateCheckpointParams = {
3713
3648
  version: string;
3714
3649
  };
3715
3650
  output: string;
3716
- runtime: RuntimeName;
3717
3651
  };
3718
3652
  declare function createNormalizedCheckpoint(params: CreateCheckpointParams): Checkpoint;
3719
3653
  declare function createStartRunEvent(jobId: string, runId: string, expertKey: string, checkpoint: Checkpoint): RunEvent;
3720
- declare function createRuntimeInitEvent(jobId: string, runId: string, expertName: string, runtime: RuntimeName, version: string, query?: string): RuntimeEvent;
3654
+ declare function createRuntimeInitEvent(jobId: string, runId: string, expertName: string, version: string, query?: string): RuntimeEvent;
3721
3655
  declare function createCompleteRunEvent(jobId: string, runId: string, expertKey: string, checkpoint: Checkpoint, output: string, startedAt?: number): RunEvent;
3722
3656
  declare function createCallToolsEvent(jobId: string, runId: string, expertKey: string, stepNumber: number, toolCalls: ToolCall[], _checkpoint: Checkpoint): RunEvent;
3723
3657
  declare function createResolveToolResultsEvent(jobId: string, runId: string, expertKey: string, stepNumber: number, toolResults: ToolResult[]): RunEvent;
3724
3658
  declare function createToolMessage(toolCallId: string, toolName: string, resultText: string): ToolMessage;
3725
3659
 
3726
- /** Setting type for adapter run - external input with required jobId and runId added by dispatcher */
3727
- type AdapterRunSetting = RunParamsInput["setting"] & {
3728
- jobId: string;
3729
- runId: string;
3730
- };
3731
- type AdapterRunParams = {
3732
- setting: AdapterRunSetting;
3733
- config?: PerstackConfig;
3734
- checkpoint?: Checkpoint;
3735
- eventListener?: (event: RunEvent | RuntimeEvent) => void;
3736
- storeCheckpoint?: (checkpoint: Checkpoint) => Promise<void>;
3737
- storeEvent?: (event: RunEvent) => Promise<void>;
3738
- retrieveCheckpoint?: (jobId: string, checkpointId: string) => Promise<Checkpoint>;
3739
- workspace?: string;
3740
- /** Additional environment variable names to pass to Docker runtime */
3741
- additionalEnvKeys?: string[];
3742
- /** Additional volume mounts for Docker runtime (format: "hostPath:containerPath:mode") */
3743
- additionalVolumes?: string[];
3744
- };
3745
- type AdapterRunResult = {
3746
- checkpoint: Checkpoint;
3747
- events: (RunEvent | RuntimeEvent)[];
3748
- };
3749
- interface RuntimeAdapter {
3750
- readonly name: string;
3751
- checkPrerequisites(): Promise<PrerequisiteResult>;
3752
- convertExpert(expert: Expert): RuntimeExpertConfig;
3753
- run(params: AdapterRunParams): Promise<AdapterRunResult>;
3754
- }
3755
- type PrerequisiteResult = {
3756
- ok: true;
3757
- } | {
3758
- ok: false;
3759
- error: PrerequisiteError;
3760
- };
3761
- type PrerequisiteError = {
3762
- type: "cli-not-found" | "auth-missing" | "version-mismatch";
3763
- message: string;
3764
- helpUrl?: string;
3765
- };
3766
- type RuntimeExpertConfig = {
3767
- instruction: string;
3768
- };
3769
-
3770
- declare function registerAdapter(runtime: RuntimeName, factory: () => RuntimeAdapter): void;
3771
- declare function getAdapter(runtime: RuntimeName): RuntimeAdapter;
3772
- declare function isAdapterAvailable(runtime: RuntimeName): boolean;
3773
- declare function getRegisteredRuntimes(): RuntimeName[];
3774
-
3775
3660
  declare const defaultPerstackApiBaseUrl = "https://api.perstack.ai";
3776
- declare const organizationNameRegex: RegExp;
3777
- declare const maxOrganizationNameLength = 128;
3778
- declare const maxApplicationNameLength = 255;
3779
3661
  declare const expertKeyRegex: RegExp;
3780
3662
  declare const expertNameRegex: RegExp;
3781
3663
  declare const expertVersionRegex: RegExp;
3782
3664
  declare const tagNameRegex: RegExp;
3783
3665
  declare const maxExpertNameLength = 255;
3784
- declare const maxExpertVersionTagLength = 255;
3785
- declare const maxExpertKeyLength = 511;
3786
- declare const maxExpertDescriptionLength: number;
3787
- declare const maxExpertInstructionLength: number;
3788
- declare const maxExpertSkillItems = 255;
3789
- declare const maxExpertDelegateItems = 255;
3790
- declare const maxExpertTagItems = 8;
3791
3666
  declare const defaultMaxSteps = 100;
3792
3667
  declare const defaultMaxRetries = 5;
3793
3668
  declare const defaultTimeout: number;
3794
- declare const maxExpertJobQueryLength: number;
3795
- declare const maxExpertJobFileNameLength: number;
3796
- declare const packageWithVersionRegex: RegExp;
3797
- declare const urlSafeRegex: RegExp;
3798
3669
  declare const maxSkillNameLength = 255;
3799
- declare const maxSkillDescriptionLength: number;
3800
- declare const maxSkillRuleLength: number;
3801
- declare const maxSkillPickOmitItems = 255;
3802
- declare const maxSkillRequiredEnvItems = 255;
3803
3670
  declare const maxSkillToolNameLength = 255;
3804
- declare const maxSkillEndpointLength: number;
3805
- declare const maxSkillInputJsonSchemaLength: number;
3806
- declare const maxSkillToolItems = 255;
3807
- declare const maxCheckpointToolCallIdLength = 255;
3808
- declare const envNameRegex: RegExp;
3809
- declare const maxEnvNameLength = 255;
3810
3671
 
3811
3672
  declare const knownModels: {
3812
3673
  provider: string;
@@ -6255,11 +6116,12 @@ declare const activityOrGroupSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnio
6255
6116
  }, z.core.$strip>], "type">>;
6256
6117
  }, z.core.$strip>]>;
6257
6118
 
6258
- type JobStatus = "running" | "completed" | "stoppedByMaxSteps" | "stoppedByInteractiveTool" | "stoppedByError";
6119
+ type JobStatus = "running" | "completed" | "stoppedByMaxSteps" | "stoppedByInteractiveTool" | "stoppedByError" | "stoppedByCancellation";
6259
6120
  declare const jobStatusSchema: z.ZodEnum<{
6260
6121
  completed: "completed";
6261
6122
  stoppedByInteractiveTool: "stoppedByInteractiveTool";
6262
6123
  stoppedByError: "stoppedByError";
6124
+ stoppedByCancellation: "stoppedByCancellation";
6263
6125
  running: "running";
6264
6126
  stoppedByMaxSteps: "stoppedByMaxSteps";
6265
6127
  }>;
@@ -6280,13 +6142,12 @@ declare const jobSchema: z.ZodObject<{
6280
6142
  completed: "completed";
6281
6143
  stoppedByInteractiveTool: "stoppedByInteractiveTool";
6282
6144
  stoppedByError: "stoppedByError";
6145
+ stoppedByCancellation: "stoppedByCancellation";
6283
6146
  running: "running";
6284
6147
  stoppedByMaxSteps: "stoppedByMaxSteps";
6285
6148
  }>;
6286
6149
  coordinatorExpertKey: z.ZodString;
6287
- runtimeVersion: z.ZodEnum<{
6288
- "v1.0": "v1.0";
6289
- }>;
6150
+ runtimeVersion: z.ZodPipe<z.ZodString, z.ZodTransform<`v${number}.${number}`, string>>;
6290
6151
  totalSteps: z.ZodNumber;
6291
6152
  maxSteps: z.ZodOptional<z.ZodNumber>;
6292
6153
  usage: z.ZodObject<{
@@ -6465,8 +6326,6 @@ interface CommandOptions {
6465
6326
  runId?: string;
6466
6327
  /** Paths to .env files */
6467
6328
  envPath?: string[];
6468
- /** Environment variable names to pass to Docker runtime */
6469
- env?: string[];
6470
6329
  /** Enable verbose logging */
6471
6330
  verbose?: boolean;
6472
6331
  /** Continue most recent job */
@@ -6477,12 +6336,6 @@ interface CommandOptions {
6477
6336
  resumeFrom?: string;
6478
6337
  /** Query is interactive tool call result */
6479
6338
  interactiveToolCallResult?: boolean;
6480
- /** Execution runtime */
6481
- runtime?: RuntimeName;
6482
- /** Workspace directory for Docker runtime */
6483
- workspace?: string;
6484
- /** Additional volume mounts for Docker runtime (format: hostPath:containerPath:mode) */
6485
- volume?: string[];
6486
6339
  /** Event types to filter (e.g., completeRun,stopRunByError) */
6487
6340
  filter?: string[];
6488
6341
  }
@@ -6524,21 +6377,11 @@ declare const runCommandInputSchema: z.ZodObject<{
6524
6377
  jobId: z.ZodOptional<z.ZodString>;
6525
6378
  runId: z.ZodOptional<z.ZodString>;
6526
6379
  envPath: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodTransform<string[] | undefined, string[] | undefined>>;
6527
- env: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodTransform<string[] | undefined, string[] | undefined>>;
6528
6380
  verbose: z.ZodOptional<z.ZodBoolean>;
6529
6381
  continue: z.ZodOptional<z.ZodBoolean>;
6530
6382
  continueJob: z.ZodOptional<z.ZodString>;
6531
6383
  resumeFrom: z.ZodOptional<z.ZodString>;
6532
6384
  interactiveToolCallResult: z.ZodOptional<z.ZodBoolean>;
6533
- runtime: z.ZodOptional<z.ZodEnum<{
6534
- local: "local";
6535
- cursor: "cursor";
6536
- "claude-code": "claude-code";
6537
- gemini: "gemini";
6538
- docker: "docker";
6539
- }>>;
6540
- workspace: z.ZodOptional<z.ZodString>;
6541
- volume: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodTransform<string[] | undefined, string[] | undefined>>;
6542
6385
  filter: z.ZodPipe<z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string[] | undefined, string | undefined>>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
6543
6386
  }, z.core.$strip>;
6544
6387
  }, z.core.$strip>;
@@ -6580,21 +6423,11 @@ declare const startCommandInputSchema: z.ZodObject<{
6580
6423
  jobId: z.ZodOptional<z.ZodString>;
6581
6424
  runId: z.ZodOptional<z.ZodString>;
6582
6425
  envPath: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodTransform<string[] | undefined, string[] | undefined>>;
6583
- env: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodTransform<string[] | undefined, string[] | undefined>>;
6584
6426
  verbose: z.ZodOptional<z.ZodBoolean>;
6585
6427
  continue: z.ZodOptional<z.ZodBoolean>;
6586
6428
  continueJob: z.ZodOptional<z.ZodString>;
6587
6429
  resumeFrom: z.ZodOptional<z.ZodString>;
6588
6430
  interactiveToolCallResult: z.ZodOptional<z.ZodBoolean>;
6589
- runtime: z.ZodOptional<z.ZodEnum<{
6590
- local: "local";
6591
- cursor: "cursor";
6592
- "claude-code": "claude-code";
6593
- gemini: "gemini";
6594
- docker: "docker";
6595
- }>>;
6596
- workspace: z.ZodOptional<z.ZodString>;
6597
- volume: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodTransform<string[] | undefined, string[] | undefined>>;
6598
6431
  filter: z.ZodPipe<z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string[] | undefined, string | undefined>>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
6599
6432
  }, z.core.$strip>;
6600
6433
  }, z.core.$strip>;
@@ -6661,71 +6494,6 @@ type Resource = {
6661
6494
  blob?: string;
6662
6495
  };
6663
6496
 
6664
- /**
6665
- * Metadata for an event, used for listing events without loading full content.
6666
- */
6667
- type EventMeta = {
6668
- timestamp: number;
6669
- stepNumber: number;
6670
- type: string;
6671
- };
6672
- /**
6673
- * Abstract storage interface for persisting Perstack data.
6674
- *
6675
- * Implementations include:
6676
- * - FileSystemStorage: Local filesystem storage (default)
6677
- * - S3Storage: AWS S3 storage
6678
- * - R2Storage: Cloudflare R2 storage
6679
- */
6680
- interface Storage {
6681
- /**
6682
- * Store a checkpoint.
6683
- */
6684
- storeCheckpoint(checkpoint: Checkpoint): Promise<void>;
6685
- /**
6686
- * Retrieve a checkpoint by job ID and checkpoint ID.
6687
- * @throws Error if checkpoint not found
6688
- */
6689
- retrieveCheckpoint(jobId: string, checkpointId: string): Promise<Checkpoint>;
6690
- /**
6691
- * Get all checkpoints for a job, sorted by step number.
6692
- */
6693
- getCheckpointsByJobId(jobId: string): Promise<Checkpoint[]>;
6694
- /**
6695
- * Store an event.
6696
- */
6697
- storeEvent(event: RunEvent): Promise<void>;
6698
- /**
6699
- * Get event metadata for a run, sorted by step number.
6700
- */
6701
- getEventsByRun(jobId: string, runId: string): Promise<EventMeta[]>;
6702
- /**
6703
- * Get full event contents for a run, optionally filtered by max step.
6704
- */
6705
- getEventContents(jobId: string, runId: string, maxStep?: number): Promise<RunEvent[]>;
6706
- /**
6707
- * Store a job.
6708
- */
6709
- storeJob(job: Job): Promise<void>;
6710
- /**
6711
- * Retrieve a job by ID.
6712
- * @returns Job or undefined if not found
6713
- */
6714
- retrieveJob(jobId: string): Promise<Job | undefined>;
6715
- /**
6716
- * Get all jobs, sorted by start time (newest first).
6717
- */
6718
- getAllJobs(): Promise<Job[]>;
6719
- /**
6720
- * Store a run setting. Updates updatedAt if run already exists.
6721
- */
6722
- storeRunSetting(setting: RunSetting): Promise<void>;
6723
- /**
6724
- * Get all run settings, sorted by updated time (newest first).
6725
- */
6726
- getAllRuns(): Promise<RunSetting[]>;
6727
- }
6728
-
6729
6497
  declare const BASE_SKILL_PREFIX = "@perstack/base";
6730
6498
  type GetActivitiesParams = {
6731
6499
  checkpoint: Checkpoint;
@@ -6762,4 +6530,4 @@ declare function createFilteredEventListener(listener: (event: PerstackEvent) =>
6762
6530
  declare function formatZodError(error: ZodError): string;
6763
6531
  declare function parseWithFriendlyError<T>(schema: ZodSchema<T>, data: unknown, context?: string): T;
6764
6532
 
6765
- export { type Activity, type ActivityOrGroup, type ActivityType, type AdapterRunParams, type AdapterRunResult, type AmazonBedrockProviderConfig, type AnthropicProviderConfig, type AnthropicProviderSkill, type AnthropicProviderToolName, type AppendTextFileActivity, type AttemptCompletionActivity, type AzureOpenAIProviderToolName, type AzureOpenAiProviderConfig, BASE_SKILL_PREFIX, type BaseEvent, type BasePart, type BuiltinAnthropicSkill, type CallToolResultContent, type Checkpoint, type CheckpointStatus, type ClearTodoActivity, type CommandOptions, type CompleteActivity, type CreateCheckpointParams, type CreateDirectoryActivity, type CustomAnthropicSkill, type DeepseekProviderConfig, type DelegateActivity, type DelegateSkillManagerParams, type DelegationCompleteActivity, type DelegationTarget, type DeleteDirectoryActivity, type DeleteFileActivity, type EditTextFileActivity, type ErrorActivity, type EventForType, type EventMeta, type EventType, type ExecActivity, type Expert, type ExpertMessage, type ExpertStateEvent, type ExpertStateEventType, type FileBinaryPart, type FileInlinePart, type FileUrlPart, type GeneralToolActivity, type GetActivitiesParams, type GetFileInfoActivity, type GoogleGenerativeAiProviderConfig, type GoogleProviderToolName, type GoogleVertexProviderConfig, type Headers, type ImageBinaryPart, type ImageInlinePart, type ImageUrlPart, type InstructionMessage, type InteractiveSkill, type InteractiveSkillManagerParams, type InteractiveTool, type InteractiveToolActivity, type Job, type JobStatus, type ListDirectoryActivity, type Lockfile, type LockfileExpert, type LockfileToolDefinition, type McpSkillManagerParams, type McpSseSkill, type McpStdioSkill, type Message, type MessagePart, type MoveFileActivity, type OllamaProviderConfig, type OpenAIProviderToolName, type OpenAiProviderConfig, type ParallelActivitiesGroup, type PerstackConfig, type PerstackConfigExpert, type PerstackConfigSkill, type PerstackEvent, type PrerequisiteError, type PrerequisiteResult, type ProviderConfig, type ProviderName, type ProviderTable, type ProviderToolOptions, type QueryActivity, type ReadImageFileActivity, type ReadPdfFileActivity, type ReadTextFileActivity, type ReasoningBudget, type Resource, type RetryActivity, type RunCommandInput, type RunEvent, type RunInput, type RunParams, type RunParamsInput, type RunSetting, type RuntimeAdapter, type RuntimeEvent, type RuntimeEventForType, type RuntimeEventType, type RuntimeExpertConfig, type RuntimeName, type RuntimeVersion, SAFE_ENV_VARS, type Skill, type SkillManagerParams, type SkillType, type StartCommandInput, type Step, type Storage, type StreamingEvent, type StreamingEventType, type TextPart, type ThinkingPart, type TodoActivity, type ToolCall, type ToolCallPart, type ToolDefinition, type ToolMessage, type ToolResult, type ToolResultPart, type Usage, type UserMessage, type VertexProviderToolName, type WriteTextFileActivity, activityOrGroupSchema, activitySchema, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, anthropicProviderSkillSchema, anthropicProviderToolNameSchema, appendTextFileActivitySchema, attemptCompletion, attemptCompletionActivitySchema, azureOpenAIProviderToolNameSchema, azureOpenAiProviderConfigSchema, basePartSchema, builtinAnthropicSkillSchema, callTools, checkpointSchema, checkpointStatusSchema, clearTodoActivitySchema, completeActivitySchema, completeRun, continueToNextStep, createBaseToolActivity, createCallToolsEvent, createCompleteRunEvent, createDirectoryActivitySchema, createEmptyUsage, createEvent, createFilteredEventListener, createGeneralToolActivity, createNormalizedCheckpoint, createResolveToolResultsEvent, createRuntimeEvent, createRuntimeInitEvent, createStartRunEvent, createStreamingEvent, createToolMessage, customAnthropicSkillSchema, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultReasoningBudget, defaultTimeout, delegateActivitySchema, delegationCompleteActivitySchema, delegationTargetSchema, deleteDirectoryActivitySchema, deleteFileActivitySchema, domainPatternSchema, editTextFileActivitySchema, envNameRegex, errorActivitySchema, execActivitySchema, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileSearchOptionsSchema, fileUrlPartSchema, finishMcpTools, finishToolCall, formatZodError, generalToolActivitySchema, getActivities, getAdapter, getFileInfoActivitySchema, getFilteredEnv, getRegisteredRuntimes, googleGenerativeAiProviderConfigSchema, googleProviderToolNameSchema, googleVertexProviderConfigSchema, hasCustomProviderSkills, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolActivitySchema, interactiveToolSchema, isAdapterAvailable, isValidEventType, isValidRuntimeEventType, jobSchema, jobStatusSchema, knownModels, listDirectoryActivitySchema, lockfileExpertSchema, lockfileSchema, lockfileToolDefinitionSchema, maxApplicationNameLength, maxCheckpointToolCallIdLength, maxEnvNameLength, maxExpertDelegateItems, maxExpertDescriptionLength, maxExpertInstructionLength, maxExpertJobFileNameLength, maxExpertJobQueryLength, maxExpertKeyLength, maxExpertNameLength, maxExpertSkillItems, maxExpertTagItems, maxExpertVersionTagLength, maxOrganizationNameLength, maxSkillDescriptionLength, maxSkillEndpointLength, maxSkillInputJsonSchemaLength, maxSkillNameLength, maxSkillPickOmitItems, maxSkillRequiredEnvItems, maxSkillRuleLength, maxSkillToolItems, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, moveFileActivitySchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, openaiProviderToolNameSchema, organizationNameRegex, packageWithVersionRegex, parallelActivitiesGroupSchema, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, proceedToInteractiveTools, providerConfigSchema, providerNameSchema, providerTableSchema, providerToolOptionsSchema, queryActivitySchema, readImageFileActivitySchema, readPdfFileActivitySchema, readTextFileActivitySchema, reasoningBudgetSchema, registerAdapter, resolveToolResults, resumeFromStop, resumeToolCalls, retry, retryActivitySchema, runCommandInputSchema, runParamsSchema, runSettingSchema, runtimeNameSchema, runtimeVersionSchema, skillSchema, skipDelegates, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByError, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, thinkingPartSchema, todoActivitySchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema, validateEventFilter, vertexProviderToolNameSchema, webFetchOptionsSchema, webSearchOptionsSchema, writeTextFileActivitySchema };
6533
+ export { type Activity, type ActivityOrGroup, type ActivityType, type AmazonBedrockProviderConfig, type AnthropicProviderConfig, type AnthropicProviderSkill, type AnthropicProviderToolName, type AppendTextFileActivity, type AttemptCompletionActivity, type AzureOpenAIProviderToolName, type AzureOpenAiProviderConfig, BASE_SKILL_PREFIX, type BaseEvent, type BasePart, type BuiltinAnthropicSkill, type CallToolResultContent, type Checkpoint, type CheckpointStatus, type ClearTodoActivity, type CommandOptions, type CompleteActivity, type CreateCheckpointParams, type CreateDirectoryActivity, type CustomAnthropicSkill, type DeepseekProviderConfig, type DelegateActivity, type DelegateSkillManagerParams, type DelegationCompleteActivity, type DelegationTarget, type DeleteDirectoryActivity, type DeleteFileActivity, type EditTextFileActivity, type ErrorActivity, type EventForType, type EventType, type ExecActivity, type Expert, type ExpertMessage, type ExpertStateEvent, type ExpertStateEventType, type FileBinaryPart, type FileInlinePart, type FileUrlPart, type GeneralToolActivity, type GetActivitiesParams, type GetFileInfoActivity, type GoogleGenerativeAiProviderConfig, type GoogleProviderToolName, type GoogleVertexProviderConfig, type Headers, type ImageBinaryPart, type ImageInlinePart, type ImageUrlPart, type InstructionMessage, type InteractiveSkill, type InteractiveSkillManagerParams, type InteractiveTool, type InteractiveToolActivity, type Job, type JobStatus, type ListDirectoryActivity, type Lockfile, type LockfileExpert, type LockfileToolDefinition, type McpSkillManagerParams, type McpSseSkill, type McpStdioSkill, type Message, type MessagePart, type MoveFileActivity, type OllamaProviderConfig, type OpenAIProviderToolName, type OpenAiProviderConfig, type ParallelActivitiesGroup, type PerstackConfig, type PerstackConfigExpert, type PerstackConfigSkill, type PerstackEvent, type ProviderConfig, type ProviderName, type ProviderTable, type ProviderToolOptions, type QueryActivity, type ReadImageFileActivity, type ReadPdfFileActivity, type ReadTextFileActivity, type ReasoningBudget, type Resource, type RetryActivity, type RunCommandInput, type RunEvent, type RunInput, type RunParams, type RunParamsInput, type RunSetting, type RuntimeEvent, type RuntimeEventForType, type RuntimeEventType, type RuntimeVersion, SAFE_ENV_VARS, type Skill, type SkillManagerParams, type SkillType, type StartCommandInput, type Step, type StreamingEvent, type StreamingEventType, type TextPart, type ThinkingPart, type TodoActivity, type ToolCall, type ToolCallPart, type ToolDefinition, type ToolMessage, type ToolResult, type ToolResultPart, type Usage, type UserMessage, type VertexProviderToolName, type WriteTextFileActivity, activityOrGroupSchema, activitySchema, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, anthropicProviderSkillSchema, anthropicProviderToolNameSchema, appendTextFileActivitySchema, attemptCompletion, attemptCompletionActivitySchema, azureOpenAIProviderToolNameSchema, azureOpenAiProviderConfigSchema, basePartSchema, builtinAnthropicSkillSchema, callTools, checkpointSchema, checkpointStatusSchema, clearTodoActivitySchema, completeActivitySchema, completeRun, continueToNextStep, createBaseToolActivity, createCallToolsEvent, createCompleteRunEvent, createDirectoryActivitySchema, createEmptyUsage, createEvent, createFilteredEventListener, createGeneralToolActivity, createNormalizedCheckpoint, createResolveToolResultsEvent, createRuntimeEvent, createRuntimeInitEvent, createStartRunEvent, createStreamingEvent, createToolMessage, customAnthropicSkillSchema, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultReasoningBudget, defaultTimeout, delegateActivitySchema, delegationCompleteActivitySchema, delegationTargetSchema, deleteDirectoryActivitySchema, deleteFileActivitySchema, domainPatternSchema, editTextFileActivitySchema, errorActivitySchema, execActivitySchema, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileSearchOptionsSchema, fileUrlPartSchema, finishMcpTools, finishToolCall, formatZodError, generalToolActivitySchema, getActivities, getFileInfoActivitySchema, getFilteredEnv, googleGenerativeAiProviderConfigSchema, googleProviderToolNameSchema, googleVertexProviderConfigSchema, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolActivitySchema, interactiveToolSchema, isPrivateOrLocalIP, isValidEventType, isValidRuntimeEventType, jobSchema, jobStatusSchema, knownModels, listDirectoryActivitySchema, lockfileExpertSchema, lockfileSchema, lockfileToolDefinitionSchema, maxExpertNameLength, maxSkillNameLength, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, moveFileActivitySchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, openaiProviderToolNameSchema, parallelActivitiesGroupSchema, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, proceedToInteractiveTools, providerConfigSchema, providerNameSchema, providerTableSchema, providerToolOptionsSchema, queryActivitySchema, readImageFileActivitySchema, readPdfFileActivitySchema, readTextFileActivitySchema, reasoningBudgetSchema, resolveToolResults, resumeFromStop, resumeToolCalls, retry, retryActivitySchema, runCommandInputSchema, runParamsSchema, runSettingSchema, runtimeVersionSchema, skillSchema, skipDelegates, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByError, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, thinkingPartSchema, todoActivitySchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, usageSchema, userMessageSchema, validateEventFilter, vertexProviderToolNameSchema, webFetchOptionsSchema, webSearchOptionsSchema, writeTextFileActivitySchema };