@trailstep/authoring 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +65 -19
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -25,19 +25,52 @@ Use this package to author continuation workflows with:
25
25
 
26
26
  Keep workflow entrypoints small and put step logic in separate files as workflows grow.
27
27
 
28
+ ```ts
29
+ // workflows/feature-summary.schema.ts
30
+ import { shape } from "@trailstep/authoring";
31
+
32
+ export type FeatureSummaryInput = {
33
+ readonly request: string;
34
+ };
35
+
36
+ export type FeatureSummaryOutput = {
37
+ readonly summary: string;
38
+ readonly nextStep: string;
39
+ };
40
+
41
+ export const featureSummaryInput = shape<FeatureSummaryInput>({
42
+ request: "string",
43
+ });
44
+
45
+ export const featureSummaryOutput = shape<FeatureSummaryOutput>({
46
+ summary: "string",
47
+ nextStep: "string",
48
+ });
49
+ ```
50
+
28
51
  ```ts
29
52
  // workflows/feature-summary.workflow.ts
30
- import { defineWorkflow, shape } from "@trailstep/authoring";
53
+ import { defineWorkflow } from "@trailstep/authoring";
54
+ import {
55
+ type FeatureSummaryInput,
56
+ type FeatureSummaryOutput,
57
+ featureSummaryInput,
58
+ featureSummaryOutput,
59
+ } from "./feature-summary.schema.js";
31
60
  import { summarizeRequestStep } from "./steps/summarize-request.step.js";
32
61
 
33
- type FeatureSummaryInput = { request: string };
34
- type FeatureSummaryOutput = { summary: string; nextStep: string };
35
-
36
62
  export const featureSummary = defineWorkflow<FeatureSummaryInput, FeatureSummaryOutput>({
37
63
  id: "feature-summary",
38
64
  description: "Summarize a feature request and suggest one next step.",
39
- inputShape: shape<FeatureSummaryInput>({ request: "string" }),
40
- outputShape: shape<FeatureSummaryOutput>({ summary: "string", nextStep: "string" }),
65
+ inputShape: featureSummaryInput,
66
+ outputShape: featureSummaryOutput,
67
+ agents: {
68
+ summarizer: {
69
+ size: "medium",
70
+ thinking: "medium",
71
+ description: "Summarizes feature requests for planning.",
72
+ },
73
+ },
41
74
  start(input) {
42
75
  return summarizeRequestStep(input);
43
76
  },
@@ -46,20 +79,33 @@ export const featureSummary = defineWorkflow<FeatureSummaryInput, FeatureSummary
46
79
 
47
80
  ```ts
48
81
  // workflows/steps/summarize-request.step.ts
49
- import { done, shape, step } from "@trailstep/authoring";
50
-
51
- type FeatureSummaryInput = { request: string };
52
- type FeatureSummaryOutput = { summary: string; nextStep: string };
53
-
54
- export function summarizeRequestStep(input: FeatureSummaryInput) {
55
- return step({ id: "summarize-request" })
56
- .prompt<FeatureSummaryInput, FeatureSummaryOutput>(
57
- ({ input: stepInput }) =>
58
- `Summarize this feature request and recommend one next step:\n\n${stepInput.request}`,
59
- { output: shape<FeatureSummaryOutput>({ summary: "string", nextStep: "string" }) },
60
- )
61
- .do((output) => done(output))(input);
82
+ import { done, promptSections, section, step } from "@trailstep/authoring";
83
+ import {
84
+ type FeatureSummaryInput,
85
+ type FeatureSummaryOutput,
86
+ featureSummaryOutput,
87
+ } from "../feature-summary.schema.js";
88
+
89
+ function summarizeRequestPrompt({
90
+ input,
91
+ }: {
92
+ readonly input: FeatureSummaryInput;
93
+ }): string {
94
+ return promptSections(
95
+ section("Feature request", input.request),
96
+ section(
97
+ "Task",
98
+ "Summarize the request in two or three sentences, then recommend exactly one next step.",
99
+ ),
100
+ );
62
101
  }
102
+
103
+ export const summarizeRequestStep = step({ id: "summarize-request" })
104
+ .prompt<FeatureSummaryInput, FeatureSummaryOutput>(summarizeRequestPrompt, {
105
+ agent: "summarizer",
106
+ output: featureSummaryOutput,
107
+ })
108
+ .do((output) => done(output));
63
109
  ```
64
110
 
65
111
  Run direct refs while developing:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trailstep/authoring",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "TypeScript authoring helpers for TrailStep workflows.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  "@trailstep/core": "^0.1.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@biomejs/biome": "^2.1.1",
39
- "@types/node": "^26.1.1",
38
+ "@biomejs/biome": "^2.5.8",
39
+ "@types/node": "^26.2.0",
40
40
  "tsup": "^8.5.0",
41
41
  "typescript": "^5.8.3",
42
42
  "vitest": "^3.2.4"