@trailstep/core 0.1.0 → 0.1.1

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
@@ -2,14 +2,34 @@
2
2
 
3
3
  `@trailstep/core` is the framework-neutral runtime package for TrailStep.
4
4
 
5
+ Most workflow authors should start with [`@trailstep/authoring`](../authoring/README.md), which re-exports common authoring helpers and adds `defineWorkflow(...)`.
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
8
- pnpm add @trailstep/core
10
+ npm install @trailstep/core
9
11
  ```
10
12
 
13
+ Use the equivalent command for your package manager if you use `pnpm`, `yarn`, or `bun`.
14
+
11
15
  ## Public role
12
16
 
13
- Use this package for JSON object input/output validation, `runWorkflow`, continuation runtime primitives, events, retry state, and local run artifact handling.
17
+ Use this package for low-level TrailStep runtime integration:
18
+
19
+ - JSON-object input/output validation
20
+ - continuation runtime primitives
21
+ - `runWorkflow`
22
+ - workflow events
23
+ - retry state
24
+ - provider contracts
25
+ - local run artifact handling
26
+
27
+ TrailStep's key runtime boundary is the step: each step can run as a focused unit of work, receive structured output, persist events, and return the next continuation.
28
+
29
+ Runtime events are appended to `.trailstep/runs/<runName>/events.jsonl` by default. Set `TRAILSTEP_RUNS_ROOT` in CLI runs when you need artifacts somewhere else. Run directories are generated outputs for inspection and replay; do not manually edit them to recover workflow state.
30
+
31
+ ## More docs
14
32
 
15
- Runtime events are appended to `.trailstep/runs/<runName>/events.jsonl`. Run directories are generated outputs for inspection and replay; do not manually edit them to recover workflow state.
33
+ - [Architecture](../../docs/architecture.md)
34
+ - [Authoring workflows](../../docs/authoring-workflows.md)
35
+ - [CLI reference](../../docs/cli-reference.md)
package/dist/index.d.ts CHANGED
@@ -40,10 +40,26 @@ interface ResolveTimeoutPolicyOptions {
40
40
  declare function resolveTimeoutPolicy(options: ResolveTimeoutPolicyOptions): TimeoutPolicy;
41
41
  declare function validateTimeoutPolicy(input: unknown): TimeoutPolicy;
42
42
 
43
+ type TrailStepCustomProviderModelOverrideSupport = {
44
+ readonly supported: true;
45
+ readonly flag?: string;
46
+ } | {
47
+ readonly supported: false;
48
+ };
49
+ type TrailStepCustomProviderThinkingOverrideSupport = {
50
+ readonly supported: true;
51
+ readonly flag?: string;
52
+ readonly levels: readonly WorkflowAgentThinking[];
53
+ } | {
54
+ readonly supported: false;
55
+ readonly levels?: readonly [];
56
+ };
43
57
  interface TrailStepCustomProviderConfig {
44
58
  readonly binary: string;
45
59
  readonly args?: readonly string[];
46
60
  readonly interactiveArgs?: readonly string[];
61
+ readonly model?: TrailStepCustomProviderModelOverrideSupport;
62
+ readonly thinking?: TrailStepCustomProviderThinkingOverrideSupport;
47
63
  readonly cwd?: string;
48
64
  readonly env?: Readonly<Record<string, string>>;
49
65
  }
@@ -517,6 +533,73 @@ interface ProviderWorkingProcessResult {
517
533
  * `stdin` is set. Injectable for tests.
518
534
  */
519
535
  type ProviderWorkingRunner = (request: ProviderWorkingProcessRequest) => ProviderWorkingProcessResult | Promise<ProviderWorkingProcessResult>;
536
+ type ProviderPromptFileReferenceStyle = "at-prefixed-argument";
537
+ type ProviderPromptInputSpec = {
538
+ readonly kind: "prompt-file";
539
+ readonly reference: ProviderPromptFileReferenceStyle;
540
+ } | {
541
+ readonly kind: "inline-prompt";
542
+ };
543
+ type ProviderOutputStyle = "stdout-json-envelope" | "stdout-jsonl-transcript" | "provider-output-file";
544
+ interface ProviderOutputParsingMetadata {
545
+ readonly resultField?: string;
546
+ }
547
+ interface ProviderOutputSpec {
548
+ readonly style: ProviderOutputStyle;
549
+ readonly parsing?: ProviderOutputParsingMetadata;
550
+ }
551
+ type ProviderModelDiscoveryOutputParser = "pi-list-models-table";
552
+ interface ProviderModelDiscoverySpec {
553
+ readonly command: string;
554
+ readonly args: readonly string[];
555
+ readonly outputParser: ProviderModelDiscoveryOutputParser;
556
+ }
557
+ type ProviderModelOverrideSupport = {
558
+ readonly supported: true;
559
+ readonly flag: string;
560
+ readonly discovery?: ProviderModelDiscoverySpec;
561
+ } | {
562
+ readonly supported: false;
563
+ };
564
+ type ProviderThinkingOverrideSupport = {
565
+ readonly supported: true;
566
+ readonly flag: string;
567
+ readonly levels: readonly WorkflowAgentThinking[];
568
+ } | {
569
+ readonly supported: false;
570
+ readonly levels?: readonly [];
571
+ };
572
+ interface ProviderWorkingRepairInvocationSpec {
573
+ readonly supported: boolean;
574
+ readonly resumeFlag?: string;
575
+ readonly promptDelivery?: "stdin" | "prompt-file";
576
+ }
577
+ interface ProviderWorkingInvocationSpec {
578
+ readonly command: string;
579
+ readonly prompt: ProviderPromptInputSpec;
580
+ readonly baseArgs: readonly string[];
581
+ readonly output: ProviderOutputSpec;
582
+ readonly repair?: ProviderWorkingRepairInvocationSpec;
583
+ }
584
+ type ProviderInteractiveInvocationSpec = {
585
+ readonly supported: true;
586
+ readonly command: string;
587
+ readonly requiresSystemPromptFile?: boolean;
588
+ readonly systemPromptFileFlag?: string;
589
+ readonly modelFlag?: string;
590
+ readonly permissionBypassFlag?: string;
591
+ } | {
592
+ readonly supported: false;
593
+ readonly reason?: string;
594
+ };
595
+ interface ProviderSpec {
596
+ readonly id: string;
597
+ readonly displayName: string;
598
+ readonly model: ProviderModelOverrideSupport;
599
+ readonly thinking: ProviderThinkingOverrideSupport;
600
+ readonly working: ProviderWorkingInvocationSpec;
601
+ readonly interactive: ProviderInteractiveInvocationSpec;
602
+ }
520
603
  /** Request shape for a built-in provider's interactive (human-in-the-loop) invocation. */
521
604
  interface ProviderInteractiveRequest {
522
605
  readonly prompt: string;
@@ -558,6 +641,7 @@ interface ProviderWorkingRepairRequest {
558
641
  */
559
642
  interface ProviderAdapter {
560
643
  readonly id: string;
644
+ readonly spec: ProviderSpec;
561
645
  /** Non-interactive invocation: writes `request.outputFile` itself before resolving. */
562
646
  runWorking(request: ProviderWorkingRequest, runner?: ProviderWorkingRunner): Promise<void>;
563
647
  /**
@@ -626,4 +710,4 @@ declare function selectRecentFailedRunSummaries(summaries: readonly RunSummary[]
626
710
  }): RunSummary[];
627
711
  declare function newestFirst(left: RunSummary, right: RunSummary): number;
628
712
 
629
- export { type AgentAdapter, type AgentAdapterObject, type AgentAdapterRequest, type AgentAdapterSelection, type AgentMessage, type AgentModelTarget, type AgentPrompt, type AgentTool, type ContinuationResult, type ContinuationStepConfig, type DeprecationEntry, type DeprecationManifest, type DeprecationStatus, type DeprecationTargetPackage, Document, type DoneNode, type Event, type FailNode, type Failure, type FindDeprecationsAsOfQuery, type InteractiveProcessRequest, type InteractiveProcessResult, type InteractiveProcessRunner, type JsonSchemaObject, type LatestUnresolvedFailure, type PlainObject, type PromptOptions, type PromptTemplateSource, type ProviderAdapter, type ProviderInteractiveRequest, type ProviderRegistryKey, type ProviderWorkingProcessRequest, type ProviderWorkingProcessResult, type ProviderWorkingRequest, type ProviderWorkingRunner, type ResolveAgentTargetsOptions, type ResolveRetryPolicyOptions, type ResolveTimeoutPolicyOptions, type Result, type RetryPolicy, type RetryPolicyInput, type RunSummary, type RunSummaryStatus, type RunWorkflowOptions, type Schema, type ShapeInput, type ShapeObject, type ShapePrimitive, type StepConfig, type StepContinuation, type StepErrorContinuation, type StepFactory, type StepNode, type SubPromptFactory, type SubPromptOptions, type TimeoutPolicy, type TimeoutPolicyInput, type TrailStepAgentMappings, type TrailStepAgentTarget, type TrailStepConfig, type TrailStepCustomProviderConfig, TrailStepFailureError, type TrailStepSettings, type TrailStepWorkflowConfig, type Workflow, type WorkflowAgentRole, type WorkflowAgentSize, type WorkflowAgentThinking, type WorkingAgentProcessRequest, type WorkingAgentProcessResult, type WorkingAgentProcessRunner, defaultRunsRoot, deprecationManifest, document, done, fail, findDeprecationsAsOf, isDoneNode, isFailNode, isStepNode, jsonSchema, list, listRunSummaries, loadFragments, newestFirst, normalizeShape, parseTrailStepConfig, promptSections, promptTemplate, providerRegistry, readRunEvents, readRunState, resolveAgentTargets, resolveRetryPolicy, resolveTimeoutPolicy, runWorkflow, section, selectLatestUnresolvedFailure, selectRecentFailedRunSummaries, shape, state, step, subPrompt, validateRetryPolicy, validateTimeoutPolicy, writeRunState };
713
+ export { type AgentAdapter, type AgentAdapterObject, type AgentAdapterRequest, type AgentAdapterSelection, type AgentMessage, type AgentModelTarget, type AgentPrompt, type AgentTool, type ContinuationResult, type ContinuationStepConfig, type DeprecationEntry, type DeprecationManifest, type DeprecationStatus, type DeprecationTargetPackage, Document, type DoneNode, type Event, type FailNode, type Failure, type FindDeprecationsAsOfQuery, type InteractiveProcessRequest, type InteractiveProcessResult, type InteractiveProcessRunner, type JsonSchemaObject, type LatestUnresolvedFailure, type PlainObject, type PromptOptions, type PromptTemplateSource, type ProviderAdapter, type ProviderInteractiveInvocationSpec, type ProviderInteractiveRequest, type ProviderModelDiscoveryOutputParser, type ProviderModelDiscoverySpec, type ProviderModelOverrideSupport, type ProviderOutputParsingMetadata, type ProviderOutputSpec, type ProviderOutputStyle, type ProviderPromptFileReferenceStyle, type ProviderPromptInputSpec, type ProviderRegistryKey, type ProviderSpec, type ProviderThinkingOverrideSupport, type ProviderWorkingInvocationSpec, type ProviderWorkingProcessRequest, type ProviderWorkingProcessResult, type ProviderWorkingRepairInvocationSpec, type ProviderWorkingRequest, type ProviderWorkingRunner, type ResolveAgentTargetsOptions, type ResolveRetryPolicyOptions, type ResolveTimeoutPolicyOptions, type Result, type RetryPolicy, type RetryPolicyInput, type RunSummary, type RunSummaryStatus, type RunWorkflowOptions, type Schema, type ShapeInput, type ShapeObject, type ShapePrimitive, type StepConfig, type StepContinuation, type StepErrorContinuation, type StepFactory, type StepNode, type SubPromptFactory, type SubPromptOptions, type TimeoutPolicy, type TimeoutPolicyInput, type TrailStepAgentMappings, type TrailStepAgentTarget, type TrailStepConfig, type TrailStepCustomProviderConfig, type TrailStepCustomProviderModelOverrideSupport, type TrailStepCustomProviderThinkingOverrideSupport, TrailStepFailureError, type TrailStepSettings, type TrailStepWorkflowConfig, type Workflow, type WorkflowAgentRole, type WorkflowAgentSize, type WorkflowAgentThinking, type WorkingAgentProcessRequest, type WorkingAgentProcessResult, type WorkingAgentProcessRunner, defaultRunsRoot, deprecationManifest, document, done, fail, findDeprecationsAsOf, isDoneNode, isFailNode, isStepNode, jsonSchema, list, listRunSummaries, loadFragments, newestFirst, normalizeShape, parseTrailStepConfig, promptSections, promptTemplate, providerRegistry, readRunEvents, readRunState, resolveAgentTargets, resolveRetryPolicy, resolveTimeoutPolicy, runWorkflow, section, selectLatestUnresolvedFailure, selectRecentFailedRunSummaries, shape, state, step, subPrompt, validateRetryPolicy, validateTimeoutPolicy, writeRunState };