agent-relay 4.0.19 → 4.0.21
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 +1407 -537
- package/dist/src/cli/commands/messaging.d.ts +44 -0
- package/dist/src/cli/commands/messaging.d.ts.map +1 -1
- package/dist/src/cli/commands/messaging.js +195 -8
- package/dist/src/cli/commands/messaging.js.map +1 -1
- package/dist/src/cli/commands/setup.d.ts +30 -1
- package/dist/src/cli/commands/setup.d.ts.map +1 -1
- package/dist/src/cli/commands/setup.js +102 -85
- package/dist/src/cli/commands/setup.js.map +1 -1
- package/node_modules/@agent-relay/cloud/dist/auth.d.ts +2 -2
- package/node_modules/@agent-relay/cloud/dist/auth.d.ts.map +1 -1
- package/node_modules/@agent-relay/cloud/dist/auth.js +108 -62
- package/node_modules/@agent-relay/cloud/dist/auth.js.map +1 -1
- package/node_modules/@agent-relay/cloud/package.json +2 -2
- package/node_modules/@agent-relay/config/package.json +1 -1
- package/node_modules/@agent-relay/hooks/package.json +4 -4
- package/node_modules/@agent-relay/sdk/dist/workflows/trajectory.d.ts +5 -35
- package/node_modules/@agent-relay/sdk/dist/workflows/trajectory.d.ts.map +1 -1
- package/node_modules/@agent-relay/sdk/dist/workflows/trajectory.js +158 -292
- package/node_modules/@agent-relay/sdk/dist/workflows/trajectory.js.map +1 -1
- package/node_modules/@agent-relay/sdk/package.json +3 -2
- package/node_modules/@agent-relay/telemetry/package.json +1 -1
- package/node_modules/@agent-relay/trajectory/package.json +2 -2
- package/node_modules/@agent-relay/user-directory/package.json +2 -2
- package/node_modules/@agent-relay/utils/package.json +2 -2
- package/node_modules/@clack/core/CHANGELOG.md +200 -0
- package/node_modules/@clack/core/LICENSE +9 -0
- package/node_modules/@clack/core/README.md +22 -0
- package/node_modules/@clack/core/dist/index.cjs +15 -0
- package/node_modules/@clack/core/dist/index.cjs.map +1 -0
- package/node_modules/@clack/core/dist/index.d.cts +151 -0
- package/node_modules/@clack/core/dist/index.d.mts +151 -0
- package/node_modules/@clack/core/dist/index.d.ts +151 -0
- package/node_modules/@clack/core/dist/index.mjs +15 -0
- package/node_modules/@clack/core/dist/index.mjs.map +1 -0
- package/node_modules/@clack/core/package.json +62 -0
- package/node_modules/@clack/prompts/CHANGELOG.md +256 -0
- package/node_modules/@clack/prompts/LICENSE +23 -0
- package/node_modules/@clack/prompts/README.md +158 -0
- package/node_modules/@clack/prompts/dist/index.cjs +77 -0
- package/node_modules/@clack/prompts/dist/index.d.ts +106 -0
- package/node_modules/@clack/prompts/dist/index.mjs +77 -0
- package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.d.ts +12 -0
- package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.js +17 -0
- package/node_modules/@clack/prompts/node_modules/is-unicode-supported/license +9 -0
- package/node_modules/@clack/prompts/node_modules/is-unicode-supported/package.json +43 -0
- package/node_modules/@clack/prompts/node_modules/is-unicode-supported/readme.md +35 -0
- package/node_modules/@clack/prompts/package.json +65 -0
- package/node_modules/@smithy/config-resolver/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-endpoints/dist-cjs/index.js +154 -61
- package/node_modules/@smithy/util-endpoints/dist-es/bdd/BinaryDecisionDiagram.js +15 -0
- package/node_modules/@smithy/util-endpoints/dist-es/decideEndpoint.js +41 -0
- package/node_modules/@smithy/util-endpoints/dist-es/index.js +2 -0
- package/node_modules/@smithy/util-endpoints/dist-es/lib/coalesce.js +8 -0
- package/node_modules/@smithy/util-endpoints/dist-es/lib/index.js +3 -0
- package/node_modules/@smithy/util-endpoints/dist-es/lib/ite.js +3 -0
- package/node_modules/@smithy/util-endpoints/dist-es/lib/split.js +13 -0
- package/node_modules/@smithy/util-endpoints/dist-es/lib/substring.js +1 -1
- package/node_modules/@smithy/util-endpoints/dist-es/utils/endpointFunctions.js +4 -1
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js +20 -5
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTemplate.js +3 -6
- package/node_modules/@smithy/util-endpoints/dist-es/utils/getReferenceValue.js +1 -5
- package/node_modules/@smithy/util-endpoints/dist-types/bdd/BinaryDecisionDiagram.d.ts +22 -0
- package/node_modules/@smithy/util-endpoints/dist-types/decideEndpoint.d.ts +7 -0
- package/node_modules/@smithy/util-endpoints/dist-types/index.d.ts +2 -0
- package/node_modules/@smithy/util-endpoints/dist-types/lib/coalesce.d.ts +7 -0
- package/node_modules/@smithy/util-endpoints/dist-types/lib/index.d.ts +3 -0
- package/node_modules/@smithy/util-endpoints/dist-types/lib/ite.d.ts +6 -0
- package/node_modules/@smithy/util-endpoints/dist-types/lib/split.d.ts +11 -0
- package/node_modules/@smithy/util-endpoints/dist-types/utils/endpointFunctions.d.ts +4 -0
- package/node_modules/@smithy/util-endpoints/dist-types/utils/getReferenceValue.d.ts +3 -1
- package/node_modules/@smithy/util-endpoints/package.json +1 -1
- package/node_modules/agent-trajectories/README.md +562 -0
- package/node_modules/agent-trajectories/dist/chunk-W222QB6V.js +2036 -0
- package/node_modules/agent-trajectories/dist/chunk-W222QB6V.js.map +1 -0
- package/node_modules/agent-trajectories/dist/cli/index.d.ts +2 -0
- package/node_modules/agent-trajectories/dist/cli/index.js +4592 -0
- package/node_modules/agent-trajectories/dist/cli/index.js.map +1 -0
- package/node_modules/agent-trajectories/dist/index-7tzw_CMS.d.ts +1777 -0
- package/node_modules/agent-trajectories/dist/index.d.ts +90 -0
- package/node_modules/agent-trajectories/dist/index.js +73 -0
- package/node_modules/agent-trajectories/dist/index.js.map +1 -0
- package/node_modules/agent-trajectories/dist/sdk/index.d.ts +2 -0
- package/node_modules/agent-trajectories/dist/sdk/index.js +39 -0
- package/node_modules/agent-trajectories/dist/sdk/index.js.map +1 -0
- package/node_modules/agent-trajectories/package.json +72 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1157 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +24 -0
- package/node_modules/commander/lib/argument.js +149 -0
- package/node_modules/commander/lib/command.js +2509 -0
- package/node_modules/commander/lib/error.js +39 -0
- package/node_modules/commander/lib/help.js +520 -0
- package/node_modules/commander/lib/option.js +330 -0
- package/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +84 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +969 -0
- package/node_modules/picocolors/LICENSE +15 -0
- package/node_modules/picocolors/README.md +21 -0
- package/node_modules/picocolors/package.json +25 -0
- package/node_modules/picocolors/picocolors.browser.js +4 -0
- package/node_modules/picocolors/picocolors.d.ts +5 -0
- package/node_modules/picocolors/picocolors.js +75 -0
- package/node_modules/picocolors/types.d.ts +51 -0
- package/node_modules/sisteransi/license +21 -0
- package/node_modules/sisteransi/package.json +34 -0
- package/node_modules/sisteransi/readme.md +113 -0
- package/node_modules/sisteransi/src/index.js +58 -0
- package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
- package/package.json +10 -10
- package/packages/cloud/dist/auth.d.ts +2 -2
- package/packages/cloud/dist/auth.d.ts.map +1 -1
- package/packages/cloud/dist/auth.js +108 -62
- package/packages/cloud/dist/auth.js.map +1 -1
- package/packages/cloud/package.json +2 -2
- package/packages/config/package.json +1 -1
- package/packages/hooks/package.json +4 -4
- package/packages/sdk/dist/workflows/trajectory.d.ts +5 -35
- package/packages/sdk/dist/workflows/trajectory.d.ts.map +1 -1
- package/packages/sdk/dist/workflows/trajectory.js +158 -292
- package/packages/sdk/dist/workflows/trajectory.js.map +1 -1
- package/packages/sdk/package.json +3 -2
- package/packages/telemetry/package.json +1 -1
- package/packages/trajectory/package.json +2 -2
- package/packages/user-directory/package.json +2 -2
- package/packages/utils/package.json +2 -2
|
@@ -0,0 +1,1777 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Core type definitions for Agent Trajectories
|
|
5
|
+
*
|
|
6
|
+
* These types define the shape of all trajectory data.
|
|
7
|
+
* They are used for TypeScript type checking and documentation.
|
|
8
|
+
* Runtime validation is handled by Zod schemas in schema.ts.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Supported task source systems
|
|
12
|
+
*/
|
|
13
|
+
type TaskSourceSystem = "beads" | "github" | "linear" | "jira" | "plain" | string;
|
|
14
|
+
/**
|
|
15
|
+
* Reference to an external task/issue
|
|
16
|
+
*/
|
|
17
|
+
interface TaskSource {
|
|
18
|
+
/** The task management system (e.g., 'github', 'linear') */
|
|
19
|
+
system: TaskSourceSystem;
|
|
20
|
+
/** The external ID (e.g., 'GH#123', 'ENG-456') */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Optional URL to the external task */
|
|
23
|
+
url?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Task reference - either standalone or linked to external system
|
|
27
|
+
*/
|
|
28
|
+
interface TaskReference {
|
|
29
|
+
/** Human-readable task title */
|
|
30
|
+
title: string;
|
|
31
|
+
/** Optional description */
|
|
32
|
+
description?: string;
|
|
33
|
+
/** Optional link to external task system */
|
|
34
|
+
source?: TaskSource;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Trajectory status
|
|
38
|
+
*/
|
|
39
|
+
type TrajectoryStatus = "active" | "completed" | "abandoned";
|
|
40
|
+
/**
|
|
41
|
+
* Event types that can be recorded in a trajectory
|
|
42
|
+
*/
|
|
43
|
+
type TrajectoryEventType = "prompt" | "thinking" | "tool_call" | "tool_result" | "message_sent" | "message_received" | "decision" | "finding" | "reflection" | "note" | "error" | (string & {});
|
|
44
|
+
/**
|
|
45
|
+
* Significance level for events
|
|
46
|
+
*/
|
|
47
|
+
type EventSignificance = "low" | "medium" | "high" | "critical";
|
|
48
|
+
/**
|
|
49
|
+
* A single event in the trajectory timeline
|
|
50
|
+
*/
|
|
51
|
+
interface TrajectoryEvent {
|
|
52
|
+
/** Unix timestamp in milliseconds */
|
|
53
|
+
ts: number;
|
|
54
|
+
/** Type of event */
|
|
55
|
+
type: TrajectoryEventType;
|
|
56
|
+
/** Human-readable summary of the event */
|
|
57
|
+
content: string;
|
|
58
|
+
/** Full raw data (optional, for debugging) */
|
|
59
|
+
raw?: unknown;
|
|
60
|
+
/** Importance level */
|
|
61
|
+
significance?: EventSignificance;
|
|
62
|
+
/** Confidence level for this event (0-1) */
|
|
63
|
+
confidence?: number;
|
|
64
|
+
/** User-defined tags */
|
|
65
|
+
tags?: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An alternative option that was considered
|
|
69
|
+
*/
|
|
70
|
+
interface Alternative {
|
|
71
|
+
/** The alternative option */
|
|
72
|
+
option: string;
|
|
73
|
+
/** Why this alternative was not chosen */
|
|
74
|
+
reason?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A structured decision record
|
|
78
|
+
*/
|
|
79
|
+
interface Decision {
|
|
80
|
+
/** What was the choice/question? */
|
|
81
|
+
question: string;
|
|
82
|
+
/** What was chosen */
|
|
83
|
+
chosen: string;
|
|
84
|
+
/** What alternatives were considered */
|
|
85
|
+
alternatives: Alternative[];
|
|
86
|
+
/** Why this choice was made */
|
|
87
|
+
reasoning: string;
|
|
88
|
+
/** Confidence in this decision (0-1) */
|
|
89
|
+
confidence?: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Finding category types
|
|
93
|
+
*/
|
|
94
|
+
type FindingCategory = "bug" | "pattern" | "optimization" | "security" | "documentation" | "dependency" | "other";
|
|
95
|
+
/**
|
|
96
|
+
* A structured finding record - captures discoveries made during exploration
|
|
97
|
+
*/
|
|
98
|
+
interface Finding {
|
|
99
|
+
/** What was found */
|
|
100
|
+
what: string;
|
|
101
|
+
/** Where it was found (file path, component, etc.) */
|
|
102
|
+
where: string;
|
|
103
|
+
/** Why this finding is significant */
|
|
104
|
+
significance: string;
|
|
105
|
+
/** Category of the finding */
|
|
106
|
+
category: FindingCategory;
|
|
107
|
+
/** Suggested action or follow-up */
|
|
108
|
+
suggestedAction?: string;
|
|
109
|
+
/** Confidence in this finding (0-1) */
|
|
110
|
+
confidence?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Agent participation record
|
|
114
|
+
*/
|
|
115
|
+
interface AgentParticipation {
|
|
116
|
+
/** Agent identifier */
|
|
117
|
+
name: string;
|
|
118
|
+
/**
|
|
119
|
+
* Role in the trajectory. Common values are "lead", "contributor",
|
|
120
|
+
* "reviewer", but this is intentionally open-ended — the workforce
|
|
121
|
+
* workflow runner emits domain-specific roles like "workflow-runner"
|
|
122
|
+
* and "specialist" that we want to read without rejecting.
|
|
123
|
+
*/
|
|
124
|
+
role: string;
|
|
125
|
+
/** When the agent joined */
|
|
126
|
+
joinedAt: string;
|
|
127
|
+
/** When the agent left (if applicable) */
|
|
128
|
+
leftAt?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A chapter represents a logical phase of work
|
|
132
|
+
*/
|
|
133
|
+
interface Chapter {
|
|
134
|
+
/** Unique chapter ID */
|
|
135
|
+
id: string;
|
|
136
|
+
/** Chapter title (e.g., "Initial exploration", "Implementation") */
|
|
137
|
+
title: string;
|
|
138
|
+
/** Which agent is working in this chapter */
|
|
139
|
+
agentName: string;
|
|
140
|
+
/** When the chapter started (ISO timestamp) */
|
|
141
|
+
startedAt: string;
|
|
142
|
+
/** When the chapter ended (ISO timestamp, undefined if current) */
|
|
143
|
+
endedAt?: string;
|
|
144
|
+
/** Events that occurred in this chapter */
|
|
145
|
+
events: TrajectoryEvent[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Retrospective reflection on the completed work
|
|
149
|
+
*/
|
|
150
|
+
interface Retrospective {
|
|
151
|
+
/** Brief summary of what was accomplished */
|
|
152
|
+
summary: string;
|
|
153
|
+
/** How the work was approached */
|
|
154
|
+
approach: string;
|
|
155
|
+
/** Key decisions made during the work */
|
|
156
|
+
decisions?: Decision[];
|
|
157
|
+
/** What was unexpectedly difficult */
|
|
158
|
+
challenges?: string[];
|
|
159
|
+
/** What was learned */
|
|
160
|
+
learnings?: string[];
|
|
161
|
+
/** Suggestions for improvement */
|
|
162
|
+
suggestions?: string[];
|
|
163
|
+
/** Agent's confidence in the solution (0-1) */
|
|
164
|
+
confidence: number;
|
|
165
|
+
/** Total time spent (human-readable) */
|
|
166
|
+
timeSpent?: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The main Trajectory type - represents the complete record of work on a task
|
|
170
|
+
*/
|
|
171
|
+
interface Trajectory {
|
|
172
|
+
/** Unique trajectory ID (format: traj_xxxxxxxxxxxx) */
|
|
173
|
+
id: string;
|
|
174
|
+
/** Schema version for forward compatibility */
|
|
175
|
+
version: 1;
|
|
176
|
+
/** The task being worked on */
|
|
177
|
+
task: TaskReference;
|
|
178
|
+
/** Current status */
|
|
179
|
+
status: TrajectoryStatus;
|
|
180
|
+
/** When work started (ISO timestamp) */
|
|
181
|
+
startedAt: string;
|
|
182
|
+
/** When work completed (ISO timestamp) */
|
|
183
|
+
completedAt?: string;
|
|
184
|
+
/** Agents who participated */
|
|
185
|
+
agents: AgentParticipation[];
|
|
186
|
+
/** Logical phases of work */
|
|
187
|
+
chapters: Chapter[];
|
|
188
|
+
/** Final reflection (only on completion) */
|
|
189
|
+
retrospective?: Retrospective;
|
|
190
|
+
/** Git commits produced */
|
|
191
|
+
commits: string[];
|
|
192
|
+
/** Files that were modified */
|
|
193
|
+
filesChanged: string[];
|
|
194
|
+
/** Project identifier. Optional — legacy trajectories may omit it. */
|
|
195
|
+
projectId?: string;
|
|
196
|
+
/** Opaque id set by the workflow runner via TRAJECTORIES_WORKFLOW_ID env var. Lets trail compact --workflow <id> collate all trajectories from a single workflow run. */
|
|
197
|
+
workflowId?: string;
|
|
198
|
+
/** User-defined tags */
|
|
199
|
+
tags: string[];
|
|
200
|
+
/** Trace information for code attribution */
|
|
201
|
+
_trace?: TrajectoryTraceRef;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Summary of a trajectory for listing/indexing
|
|
205
|
+
*/
|
|
206
|
+
interface TrajectorySummary {
|
|
207
|
+
id: string;
|
|
208
|
+
title: string;
|
|
209
|
+
status: TrajectoryStatus;
|
|
210
|
+
startedAt: string;
|
|
211
|
+
completedAt?: string;
|
|
212
|
+
confidence?: number;
|
|
213
|
+
chapterCount: number;
|
|
214
|
+
decisionCount: number;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Input for creating a new trajectory
|
|
218
|
+
*/
|
|
219
|
+
interface CreateTrajectoryInput {
|
|
220
|
+
/** Task title */
|
|
221
|
+
title: string;
|
|
222
|
+
/** Optional task description */
|
|
223
|
+
description?: string;
|
|
224
|
+
/** Optional external task reference */
|
|
225
|
+
source?: TaskSource;
|
|
226
|
+
/** Optional project ID (defaults to cwd) */
|
|
227
|
+
projectId?: string;
|
|
228
|
+
/** Opaque id set by the workflow runner via TRAJECTORIES_WORKFLOW_ID env var. Lets trail compact --workflow <id> collate all trajectories from a single workflow run. */
|
|
229
|
+
workflowId?: string;
|
|
230
|
+
/** Optional initial tags */
|
|
231
|
+
tags?: string[];
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Input for adding a chapter
|
|
235
|
+
*/
|
|
236
|
+
interface AddChapterInput {
|
|
237
|
+
/** Chapter title */
|
|
238
|
+
title: string;
|
|
239
|
+
/** Agent name */
|
|
240
|
+
agentName: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Input for adding an event
|
|
244
|
+
*/
|
|
245
|
+
interface AddEventInput {
|
|
246
|
+
/** Event type */
|
|
247
|
+
type: TrajectoryEventType;
|
|
248
|
+
/** Human-readable content */
|
|
249
|
+
content: string;
|
|
250
|
+
/** Optional raw data */
|
|
251
|
+
raw?: unknown;
|
|
252
|
+
/** Optional significance */
|
|
253
|
+
significance?: EventSignificance;
|
|
254
|
+
/** Optional tags */
|
|
255
|
+
tags?: string[];
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Input for completing a trajectory
|
|
259
|
+
*/
|
|
260
|
+
interface CompleteTrajectoryInput {
|
|
261
|
+
summary: string;
|
|
262
|
+
approach: string;
|
|
263
|
+
decisions?: Decision[];
|
|
264
|
+
challenges?: string[];
|
|
265
|
+
learnings?: string[];
|
|
266
|
+
suggestions?: string[];
|
|
267
|
+
confidence: number;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Query options for listing trajectories
|
|
271
|
+
*/
|
|
272
|
+
interface TrajectoryQuery {
|
|
273
|
+
/** Filter by status */
|
|
274
|
+
status?: TrajectoryStatus;
|
|
275
|
+
/** Filter by date range */
|
|
276
|
+
since?: string;
|
|
277
|
+
until?: string;
|
|
278
|
+
/** Maximum results */
|
|
279
|
+
limit?: number;
|
|
280
|
+
/** Offset for pagination */
|
|
281
|
+
offset?: number;
|
|
282
|
+
/** Sort field */
|
|
283
|
+
sortBy?: "startedAt" | "completedAt" | "title";
|
|
284
|
+
/** Sort direction */
|
|
285
|
+
sortOrder?: "asc" | "desc";
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Reference to trace information within a trajectory
|
|
289
|
+
*/
|
|
290
|
+
interface TrajectoryTraceRef {
|
|
291
|
+
/** Git ref (commit hash) when trace started */
|
|
292
|
+
startRef: string;
|
|
293
|
+
/** Git ref (commit hash) when trace ended */
|
|
294
|
+
endRef?: string;
|
|
295
|
+
/** ID of the associated trace record */
|
|
296
|
+
traceId?: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Storage adapter interface for trajectory persistence
|
|
301
|
+
*
|
|
302
|
+
* This interface defines the contract for storage backends.
|
|
303
|
+
* Implementations include FileStorage (default) and SQLiteStorage (optional).
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Storage configuration options
|
|
308
|
+
*/
|
|
309
|
+
interface StorageConfig {
|
|
310
|
+
/** Base directory for file storage */
|
|
311
|
+
baseDir?: string;
|
|
312
|
+
/** SQLite database path (for SQLite adapter) */
|
|
313
|
+
dbPath?: string;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Abstract storage adapter interface
|
|
317
|
+
*
|
|
318
|
+
* All storage implementations must implement this interface.
|
|
319
|
+
* This allows swapping storage backends without changing business logic.
|
|
320
|
+
*/
|
|
321
|
+
interface StorageAdapter {
|
|
322
|
+
/**
|
|
323
|
+
* Initialize the storage backend
|
|
324
|
+
* Creates necessary directories, tables, etc.
|
|
325
|
+
*/
|
|
326
|
+
initialize(): Promise<void>;
|
|
327
|
+
/**
|
|
328
|
+
* Save a trajectory
|
|
329
|
+
* Creates if new, updates if exists
|
|
330
|
+
* Moves to completed directory if status is completed
|
|
331
|
+
* @param trajectory - The trajectory to save
|
|
332
|
+
*/
|
|
333
|
+
save(trajectory: Trajectory): Promise<void>;
|
|
334
|
+
/**
|
|
335
|
+
* Get a trajectory by ID
|
|
336
|
+
* @param id - Trajectory ID
|
|
337
|
+
* @returns The trajectory or null if not found
|
|
338
|
+
*/
|
|
339
|
+
get(id: string): Promise<Trajectory | null>;
|
|
340
|
+
/**
|
|
341
|
+
* Get the currently active trajectory
|
|
342
|
+
* @returns The active trajectory or null if none
|
|
343
|
+
*/
|
|
344
|
+
getActive(): Promise<Trajectory | null>;
|
|
345
|
+
/**
|
|
346
|
+
* List trajectories with optional filtering
|
|
347
|
+
* @param query - Query options
|
|
348
|
+
* @returns Array of trajectory summaries
|
|
349
|
+
*/
|
|
350
|
+
list(query: TrajectoryQuery): Promise<TrajectorySummary[]>;
|
|
351
|
+
/**
|
|
352
|
+
* Delete a trajectory
|
|
353
|
+
* @param id - Trajectory ID to delete
|
|
354
|
+
*/
|
|
355
|
+
delete(id: string): Promise<void>;
|
|
356
|
+
/**
|
|
357
|
+
* Search trajectories by text
|
|
358
|
+
* @param text - Search query
|
|
359
|
+
* @param options - Search options
|
|
360
|
+
* @returns Matching trajectory summaries
|
|
361
|
+
*/
|
|
362
|
+
search(text: string, options?: {
|
|
363
|
+
limit?: number;
|
|
364
|
+
}): Promise<TrajectorySummary[]>;
|
|
365
|
+
/**
|
|
366
|
+
* Close the storage connection
|
|
367
|
+
* Clean up resources
|
|
368
|
+
*/
|
|
369
|
+
close(): Promise<void>;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Export the StorageAdapter type for use in tests
|
|
373
|
+
*/
|
|
374
|
+
declare const StorageAdapter: StorageAdapter;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Trajectory SDK Client
|
|
378
|
+
*
|
|
379
|
+
* High-level client for programmatically creating and managing trajectories.
|
|
380
|
+
* Provides a clean, developer-friendly API with automatic storage management.
|
|
381
|
+
*/
|
|
382
|
+
|
|
383
|
+
declare function compactWorkflow(workflowId: string, options?: {
|
|
384
|
+
markdown?: boolean;
|
|
385
|
+
mechanical?: boolean;
|
|
386
|
+
cwd?: string;
|
|
387
|
+
}): Promise<{
|
|
388
|
+
compactedPath: string;
|
|
389
|
+
markdownPath?: string;
|
|
390
|
+
}>;
|
|
391
|
+
/**
|
|
392
|
+
* Options for configuring the TrajectoryClient
|
|
393
|
+
*/
|
|
394
|
+
interface TrajectoryClientOptions {
|
|
395
|
+
/** Storage adapter to use. Defaults to FileStorage. */
|
|
396
|
+
storage?: StorageAdapter;
|
|
397
|
+
/** Base directory for file storage. Defaults to .trajectories */
|
|
398
|
+
dataDir?: string;
|
|
399
|
+
/** Default agent name to use when not specified */
|
|
400
|
+
defaultAgent?: string;
|
|
401
|
+
/** Default project ID. Defaults to current working directory */
|
|
402
|
+
projectId?: string;
|
|
403
|
+
/** Whether to auto-save after each operation. Defaults to true */
|
|
404
|
+
autoSave?: boolean;
|
|
405
|
+
/**
|
|
406
|
+
* When set, session.complete() and session.done() automatically run compactWorkflow() against the trajectory's workflowId. Default false. Pass an object to control the flags passed to the CLI — e.g. { mechanical: true } skips the LLM for deterministic compaction, { markdown: false } skips the .md companion.
|
|
407
|
+
*/
|
|
408
|
+
autoCompact?: boolean | {
|
|
409
|
+
mechanical?: boolean;
|
|
410
|
+
markdown?: boolean;
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Active trajectory session for chainable operations
|
|
415
|
+
*/
|
|
416
|
+
declare class TrajectorySession {
|
|
417
|
+
private trajectory;
|
|
418
|
+
private client;
|
|
419
|
+
private autoSave;
|
|
420
|
+
constructor(trajectory: Trajectory, client: TrajectoryClient, autoSave: boolean);
|
|
421
|
+
/**
|
|
422
|
+
* Get the current trajectory data
|
|
423
|
+
*/
|
|
424
|
+
get data(): Trajectory;
|
|
425
|
+
/**
|
|
426
|
+
* Get the trajectory ID
|
|
427
|
+
*/
|
|
428
|
+
get id(): string;
|
|
429
|
+
private autoCompactIfConfigured;
|
|
430
|
+
/**
|
|
431
|
+
* Start a new chapter
|
|
432
|
+
* @param title - Chapter title
|
|
433
|
+
* @param agentName - Agent name (uses default if not specified)
|
|
434
|
+
*/
|
|
435
|
+
chapter(title: string, agentName?: string): Promise<TrajectorySession>;
|
|
436
|
+
/**
|
|
437
|
+
* Record an event
|
|
438
|
+
* @param type - Event type
|
|
439
|
+
* @param content - Human-readable content
|
|
440
|
+
* @param options - Additional event options
|
|
441
|
+
*/
|
|
442
|
+
event(type: TrajectoryEventType, content: string, options?: {
|
|
443
|
+
raw?: unknown;
|
|
444
|
+
significance?: EventSignificance;
|
|
445
|
+
tags?: string[];
|
|
446
|
+
}): Promise<TrajectorySession>;
|
|
447
|
+
/**
|
|
448
|
+
* Record a note
|
|
449
|
+
*/
|
|
450
|
+
note(content: string, significance?: EventSignificance): Promise<TrajectorySession>;
|
|
451
|
+
/**
|
|
452
|
+
* Record a finding
|
|
453
|
+
*/
|
|
454
|
+
finding(content: string, significance?: EventSignificance): Promise<TrajectorySession>;
|
|
455
|
+
/**
|
|
456
|
+
* Record a reflection — a higher-level synthesis of recent observations.
|
|
457
|
+
* Used by workflow orchestrators and lead agents to periodically
|
|
458
|
+
* synthesize worker progress and course-correct.
|
|
459
|
+
*/
|
|
460
|
+
reflect(content: string, confidence?: number): Promise<TrajectorySession>;
|
|
461
|
+
/**
|
|
462
|
+
* Record an error
|
|
463
|
+
*/
|
|
464
|
+
error(content: string): Promise<TrajectorySession>;
|
|
465
|
+
/**
|
|
466
|
+
* Record a decision
|
|
467
|
+
* @param decision - Structured decision record
|
|
468
|
+
*/
|
|
469
|
+
decision(decision: Decision): Promise<TrajectorySession>;
|
|
470
|
+
/**
|
|
471
|
+
* Quick decision helper for simple choices
|
|
472
|
+
* @param question - What was the question/choice?
|
|
473
|
+
* @param chosen - What was chosen
|
|
474
|
+
* @param reasoning - Why this choice was made
|
|
475
|
+
* @param alternatives - Optional list of alternatives considered
|
|
476
|
+
*/
|
|
477
|
+
decide(question: string, chosen: string, reasoning: string, alternatives?: Array<{
|
|
478
|
+
option: string;
|
|
479
|
+
reason?: string;
|
|
480
|
+
}>): Promise<TrajectorySession>;
|
|
481
|
+
/**
|
|
482
|
+
* Add a tag to the trajectory
|
|
483
|
+
*/
|
|
484
|
+
tag(tag: string): Promise<TrajectorySession>;
|
|
485
|
+
/**
|
|
486
|
+
* Complete the trajectory with a retrospective
|
|
487
|
+
* @param input - Retrospective details
|
|
488
|
+
*/
|
|
489
|
+
complete(input: CompleteTrajectoryInput): Promise<Trajectory>;
|
|
490
|
+
/**
|
|
491
|
+
* Quick complete with minimal required fields
|
|
492
|
+
* @param summary - What was accomplished
|
|
493
|
+
* @param confidence - Confidence level (0-1)
|
|
494
|
+
* @param options - Additional optional fields
|
|
495
|
+
*/
|
|
496
|
+
done(summary: string, confidence: number, options?: Partial<Omit<CompleteTrajectoryInput, "summary" | "confidence">>): Promise<Trajectory>;
|
|
497
|
+
/**
|
|
498
|
+
* Abandon the trajectory
|
|
499
|
+
* @param reason - Reason for abandonment
|
|
500
|
+
*/
|
|
501
|
+
abandon(reason?: string): Promise<Trajectory>;
|
|
502
|
+
/**
|
|
503
|
+
* Force save the current state
|
|
504
|
+
*/
|
|
505
|
+
save(): Promise<void>;
|
|
506
|
+
/**
|
|
507
|
+
* Export to markdown
|
|
508
|
+
*/
|
|
509
|
+
toMarkdown(): string;
|
|
510
|
+
/**
|
|
511
|
+
* Export to JSON
|
|
512
|
+
*/
|
|
513
|
+
toJSON(compact?: boolean): string;
|
|
514
|
+
/**
|
|
515
|
+
* Export to timeline format
|
|
516
|
+
*/
|
|
517
|
+
toTimeline(): string;
|
|
518
|
+
/**
|
|
519
|
+
* Export to PR summary format
|
|
520
|
+
*/
|
|
521
|
+
toPRSummary(): string;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Main SDK client for trajectory management
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```typescript
|
|
528
|
+
* import { TrajectoryClient } from 'agent-trajectories/sdk';
|
|
529
|
+
*
|
|
530
|
+
* const client = new TrajectoryClient({ defaultAgent: 'my-agent' });
|
|
531
|
+
* await client.init();
|
|
532
|
+
*
|
|
533
|
+
* // Start a new trajectory
|
|
534
|
+
* const session = await client.start('Implement feature X');
|
|
535
|
+
*
|
|
536
|
+
* // Record work
|
|
537
|
+
* await session
|
|
538
|
+
* .chapter('Research')
|
|
539
|
+
* .note('Found relevant documentation')
|
|
540
|
+
* .decide('Use library A vs B', 'Library A', 'Better TypeScript support');
|
|
541
|
+
*
|
|
542
|
+
* // Complete with retrospective
|
|
543
|
+
* await session.done('Successfully implemented feature X', 0.9);
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
546
|
+
declare class TrajectoryClient {
|
|
547
|
+
private storage;
|
|
548
|
+
private initialized;
|
|
549
|
+
readonly defaultAgent?: string;
|
|
550
|
+
private projectId?;
|
|
551
|
+
private autoSave;
|
|
552
|
+
private readonly autoCompactCwd?;
|
|
553
|
+
private readonly autoCompact;
|
|
554
|
+
constructor(options?: TrajectoryClientOptions);
|
|
555
|
+
getAutoCompactOptions(): false | {
|
|
556
|
+
mechanical: boolean;
|
|
557
|
+
markdown: boolean;
|
|
558
|
+
};
|
|
559
|
+
getAutoCompactCwd(): string | undefined;
|
|
560
|
+
/**
|
|
561
|
+
* Initialize the client (creates storage directories, etc.)
|
|
562
|
+
* Must be called before using other methods.
|
|
563
|
+
*/
|
|
564
|
+
init(): Promise<void>;
|
|
565
|
+
/**
|
|
566
|
+
* Ensure the client is initialized
|
|
567
|
+
*/
|
|
568
|
+
private ensureInitialized;
|
|
569
|
+
/**
|
|
570
|
+
* Start a new trajectory
|
|
571
|
+
* @param title - Task title
|
|
572
|
+
* @param options - Additional creation options
|
|
573
|
+
* @returns A session for the new trajectory
|
|
574
|
+
*/
|
|
575
|
+
start(title: string, options?: Omit<CreateTrajectoryInput, "title">): Promise<TrajectorySession>;
|
|
576
|
+
/**
|
|
577
|
+
* Resume the currently active trajectory
|
|
578
|
+
* @returns Session for active trajectory, or null if none active
|
|
579
|
+
*/
|
|
580
|
+
resume(): Promise<TrajectorySession | null>;
|
|
581
|
+
/**
|
|
582
|
+
* Get the active trajectory (without creating a session)
|
|
583
|
+
*/
|
|
584
|
+
getActive(): Promise<Trajectory | null>;
|
|
585
|
+
/**
|
|
586
|
+
* Get a trajectory by ID
|
|
587
|
+
* @param id - Trajectory ID
|
|
588
|
+
*/
|
|
589
|
+
get(id: string): Promise<Trajectory | null>;
|
|
590
|
+
/**
|
|
591
|
+
* Open a trajectory session by ID
|
|
592
|
+
* @param id - Trajectory ID
|
|
593
|
+
*/
|
|
594
|
+
open(id: string): Promise<TrajectorySession | null>;
|
|
595
|
+
/**
|
|
596
|
+
* List trajectories with optional filtering
|
|
597
|
+
* @param query - Query options
|
|
598
|
+
*/
|
|
599
|
+
list(query?: TrajectoryQuery): Promise<TrajectorySummary[]>;
|
|
600
|
+
/**
|
|
601
|
+
* Search trajectories by text
|
|
602
|
+
* @param text - Search text
|
|
603
|
+
* @param limit - Maximum results
|
|
604
|
+
*/
|
|
605
|
+
search(text: string, limit?: number): Promise<TrajectorySummary[]>;
|
|
606
|
+
/**
|
|
607
|
+
* Delete a trajectory
|
|
608
|
+
* @param id - Trajectory ID
|
|
609
|
+
*/
|
|
610
|
+
delete(id: string): Promise<void>;
|
|
611
|
+
/**
|
|
612
|
+
* Save a trajectory to storage
|
|
613
|
+
* @param trajectory - Trajectory to save
|
|
614
|
+
*/
|
|
615
|
+
save(trajectory: Trajectory): Promise<void>;
|
|
616
|
+
/**
|
|
617
|
+
* Close the client and release resources
|
|
618
|
+
*/
|
|
619
|
+
close(): Promise<void>;
|
|
620
|
+
/**
|
|
621
|
+
* Export a trajectory to markdown
|
|
622
|
+
* @param id - Trajectory ID
|
|
623
|
+
*/
|
|
624
|
+
exportMarkdown(id: string): Promise<string | null>;
|
|
625
|
+
/**
|
|
626
|
+
* Export a trajectory to JSON
|
|
627
|
+
* @param id - Trajectory ID
|
|
628
|
+
* @param compact - Whether to use compact format
|
|
629
|
+
*/
|
|
630
|
+
exportJSON(id: string, compact?: boolean): Promise<string | null>;
|
|
631
|
+
/**
|
|
632
|
+
* Export a trajectory to timeline format
|
|
633
|
+
* @param id - Trajectory ID
|
|
634
|
+
*/
|
|
635
|
+
exportTimeline(id: string): Promise<string | null>;
|
|
636
|
+
/**
|
|
637
|
+
* Export a trajectory to PR summary format
|
|
638
|
+
* @param id - Trajectory ID
|
|
639
|
+
*/
|
|
640
|
+
exportPRSummary(id: string): Promise<string | null>;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Trajectory Builder
|
|
645
|
+
*
|
|
646
|
+
* Fluent builder pattern for creating trajectories without storage.
|
|
647
|
+
* Useful for programmatically constructing trajectories in memory.
|
|
648
|
+
*/
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Fluent builder for creating trajectories in memory
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* ```typescript
|
|
655
|
+
* import { TrajectoryBuilder } from 'agent-trajectories/sdk';
|
|
656
|
+
*
|
|
657
|
+
* const trajectory = TrajectoryBuilder
|
|
658
|
+
* .create('Implement feature X')
|
|
659
|
+
* .withDescription('Add new authentication flow')
|
|
660
|
+
* .withSource({ system: 'github', id: 'GH#123' })
|
|
661
|
+
* .chapter('Research', 'claude')
|
|
662
|
+
* .note('Found existing auth patterns')
|
|
663
|
+
* .finding('Current implementation uses JWT')
|
|
664
|
+
* .chapter('Implementation', 'claude')
|
|
665
|
+
* .decide('JWT vs Session', 'JWT', 'Better for API clients')
|
|
666
|
+
* .note('Implemented token refresh')
|
|
667
|
+
* .complete({
|
|
668
|
+
* summary: 'Added JWT-based authentication',
|
|
669
|
+
* approach: 'Extended existing auth module',
|
|
670
|
+
* confidence: 0.95
|
|
671
|
+
* });
|
|
672
|
+
*
|
|
673
|
+
* console.log(trajectory.toMarkdown());
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
declare class TrajectoryBuilder {
|
|
677
|
+
private trajectory;
|
|
678
|
+
private constructor();
|
|
679
|
+
/**
|
|
680
|
+
* Create a new trajectory builder
|
|
681
|
+
* @param title - Task title
|
|
682
|
+
*/
|
|
683
|
+
static create(title: string): TrajectoryBuilder;
|
|
684
|
+
/**
|
|
685
|
+
* Set the task description
|
|
686
|
+
*/
|
|
687
|
+
withDescription(description: string): TrajectoryBuilder;
|
|
688
|
+
/**
|
|
689
|
+
* Set the external task source
|
|
690
|
+
*/
|
|
691
|
+
withSource(source: TaskSource): TrajectoryBuilder;
|
|
692
|
+
/**
|
|
693
|
+
* Set the project ID
|
|
694
|
+
*/
|
|
695
|
+
withProject(projectId: string): TrajectoryBuilder;
|
|
696
|
+
/**
|
|
697
|
+
* Add tags
|
|
698
|
+
*/
|
|
699
|
+
withTags(...tags: string[]): TrajectoryBuilder;
|
|
700
|
+
/**
|
|
701
|
+
* Add a single tag
|
|
702
|
+
*/
|
|
703
|
+
tag(tag: string): TrajectoryBuilder;
|
|
704
|
+
/**
|
|
705
|
+
* Start a new chapter
|
|
706
|
+
* @param title - Chapter title
|
|
707
|
+
* @param agentName - Agent name
|
|
708
|
+
*/
|
|
709
|
+
chapter(title: string, agentName: string): TrajectoryBuilder;
|
|
710
|
+
/**
|
|
711
|
+
* Add a generic event
|
|
712
|
+
*/
|
|
713
|
+
event(type: TrajectoryEventType, content: string, options?: {
|
|
714
|
+
raw?: unknown;
|
|
715
|
+
significance?: EventSignificance;
|
|
716
|
+
tags?: string[];
|
|
717
|
+
}): TrajectoryBuilder;
|
|
718
|
+
/**
|
|
719
|
+
* Add a note event
|
|
720
|
+
*/
|
|
721
|
+
note(content: string, significance?: EventSignificance): TrajectoryBuilder;
|
|
722
|
+
/**
|
|
723
|
+
* Add a finding event
|
|
724
|
+
*/
|
|
725
|
+
finding(content: string, significance?: EventSignificance): TrajectoryBuilder;
|
|
726
|
+
/**
|
|
727
|
+
* Add a reflection event — a higher-level synthesis of recent observations.
|
|
728
|
+
* Reflections are always high significance since they represent
|
|
729
|
+
* periodic course-correction insights.
|
|
730
|
+
*/
|
|
731
|
+
reflect(content: string, confidence?: number): TrajectoryBuilder;
|
|
732
|
+
/**
|
|
733
|
+
* Add an error event
|
|
734
|
+
*/
|
|
735
|
+
error(content: string): TrajectoryBuilder;
|
|
736
|
+
/**
|
|
737
|
+
* Add a thinking event
|
|
738
|
+
*/
|
|
739
|
+
thinking(content: string): TrajectoryBuilder;
|
|
740
|
+
/**
|
|
741
|
+
* Add a tool call event
|
|
742
|
+
*/
|
|
743
|
+
toolCall(content: string, raw?: unknown): TrajectoryBuilder;
|
|
744
|
+
/**
|
|
745
|
+
* Add a tool result event
|
|
746
|
+
*/
|
|
747
|
+
toolResult(content: string, raw?: unknown): TrajectoryBuilder;
|
|
748
|
+
/**
|
|
749
|
+
* Add a prompt event
|
|
750
|
+
*/
|
|
751
|
+
prompt(content: string): TrajectoryBuilder;
|
|
752
|
+
/**
|
|
753
|
+
* Add a message sent event
|
|
754
|
+
*/
|
|
755
|
+
messageSent(content: string): TrajectoryBuilder;
|
|
756
|
+
/**
|
|
757
|
+
* Add a message received event
|
|
758
|
+
*/
|
|
759
|
+
messageReceived(content: string): TrajectoryBuilder;
|
|
760
|
+
/**
|
|
761
|
+
* Add a structured decision
|
|
762
|
+
*/
|
|
763
|
+
decision(decision: Decision): TrajectoryBuilder;
|
|
764
|
+
/**
|
|
765
|
+
* Quick decision helper
|
|
766
|
+
*/
|
|
767
|
+
decide(question: string, chosen: string, reasoning: string, alternatives?: Array<{
|
|
768
|
+
option: string;
|
|
769
|
+
reason?: string;
|
|
770
|
+
}>): TrajectoryBuilder;
|
|
771
|
+
/**
|
|
772
|
+
* Record git commits
|
|
773
|
+
*/
|
|
774
|
+
commits(...hashes: string[]): TrajectoryBuilder;
|
|
775
|
+
/**
|
|
776
|
+
* Record files changed
|
|
777
|
+
*/
|
|
778
|
+
filesChanged(...paths: string[]): TrajectoryBuilder;
|
|
779
|
+
/**
|
|
780
|
+
* Complete the trajectory with a retrospective
|
|
781
|
+
* @param input - Retrospective details
|
|
782
|
+
* @returns The completed trajectory
|
|
783
|
+
*/
|
|
784
|
+
complete(input: CompleteTrajectoryInput): Trajectory;
|
|
785
|
+
/**
|
|
786
|
+
* Quick complete with minimal fields
|
|
787
|
+
*/
|
|
788
|
+
done(summary: string, confidence: number, approach?: string): Trajectory;
|
|
789
|
+
/**
|
|
790
|
+
* Abandon the trajectory
|
|
791
|
+
*/
|
|
792
|
+
abandon(reason?: string): Trajectory;
|
|
793
|
+
/**
|
|
794
|
+
* Get the current trajectory (without completing)
|
|
795
|
+
*/
|
|
796
|
+
build(): Trajectory;
|
|
797
|
+
/**
|
|
798
|
+
* Export to markdown
|
|
799
|
+
*/
|
|
800
|
+
toMarkdown(): string;
|
|
801
|
+
/**
|
|
802
|
+
* Export to JSON
|
|
803
|
+
*/
|
|
804
|
+
toJSON(compact?: boolean): string;
|
|
805
|
+
/**
|
|
806
|
+
* Export to timeline format
|
|
807
|
+
*/
|
|
808
|
+
toTimeline(): string;
|
|
809
|
+
/**
|
|
810
|
+
* Export to PR summary format
|
|
811
|
+
*/
|
|
812
|
+
toPRSummary(): string;
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Shorthand function to create a trajectory builder
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```typescript
|
|
819
|
+
* import { trajectory } from 'agent-trajectories/sdk';
|
|
820
|
+
*
|
|
821
|
+
* const result = trajectory('Fix bug in auth')
|
|
822
|
+
* .chapter('Investigation', 'claude')
|
|
823
|
+
* .finding('Found null pointer in login handler')
|
|
824
|
+
* .done('Fixed null pointer exception', 0.95);
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
827
|
+
declare function trajectory(title: string): TrajectoryBuilder;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Trajectory operations
|
|
831
|
+
*
|
|
832
|
+
* Pure functions for creating and manipulating trajectories.
|
|
833
|
+
* These functions return new trajectory objects (immutable updates).
|
|
834
|
+
*/
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Custom error class for trajectory operations
|
|
838
|
+
*/
|
|
839
|
+
declare class TrajectoryError extends Error {
|
|
840
|
+
code: string;
|
|
841
|
+
suggestion?: string | undefined;
|
|
842
|
+
constructor(message: string, code: string, suggestion?: string | undefined);
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Create a new trajectory
|
|
846
|
+
* @param input - Trajectory creation input
|
|
847
|
+
* @returns New trajectory object
|
|
848
|
+
* @throws TrajectoryError if validation fails
|
|
849
|
+
*/
|
|
850
|
+
declare function createTrajectory(input: CreateTrajectoryInput): Trajectory;
|
|
851
|
+
/**
|
|
852
|
+
* Add a chapter to a trajectory
|
|
853
|
+
* @param trajectory - The trajectory to update
|
|
854
|
+
* @param input - Chapter creation input
|
|
855
|
+
* @returns Updated trajectory with new chapter
|
|
856
|
+
* @throws TrajectoryError if trajectory is completed
|
|
857
|
+
*/
|
|
858
|
+
declare function addChapter(trajectory: Trajectory, input: AddChapterInput): Trajectory;
|
|
859
|
+
/**
|
|
860
|
+
* Add an event to the current chapter
|
|
861
|
+
* Auto-creates a chapter if none exists
|
|
862
|
+
* @param trajectory - The trajectory to update
|
|
863
|
+
* @param input - Event creation input
|
|
864
|
+
* @returns Updated trajectory with new event
|
|
865
|
+
*/
|
|
866
|
+
declare function addEvent(trajectory: Trajectory, input: AddEventInput): Trajectory;
|
|
867
|
+
/**
|
|
868
|
+
* Add a structured decision to the trajectory
|
|
869
|
+
* @param trajectory - The trajectory to update
|
|
870
|
+
* @param decision - Decision details
|
|
871
|
+
* @returns Updated trajectory with decision event
|
|
872
|
+
*/
|
|
873
|
+
declare function addDecision(trajectory: Trajectory, decision: Decision): Trajectory;
|
|
874
|
+
/**
|
|
875
|
+
* Complete a trajectory with retrospective
|
|
876
|
+
* @param trajectory - The trajectory to complete
|
|
877
|
+
* @param input - Retrospective input
|
|
878
|
+
* @returns Completed trajectory
|
|
879
|
+
* @throws TrajectoryError if already completed or validation fails
|
|
880
|
+
*/
|
|
881
|
+
declare function completeTrajectory(trajectory: Trajectory, input: CompleteTrajectoryInput): Trajectory;
|
|
882
|
+
/**
|
|
883
|
+
* Abandon a trajectory without completing
|
|
884
|
+
* @param trajectory - The trajectory to abandon
|
|
885
|
+
* @param reason - Reason for abandonment
|
|
886
|
+
* @returns Abandoned trajectory
|
|
887
|
+
*/
|
|
888
|
+
declare function abandonTrajectory(trajectory: Trajectory, reason?: string): Trajectory;
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* File system storage adapter for trajectories
|
|
892
|
+
*
|
|
893
|
+
* Stores trajectories as JSON files in a .trajectories directory.
|
|
894
|
+
* Active trajectories go in active/, completed in completed/YYYY-MM/.
|
|
895
|
+
*/
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Aggregated counts emitted by reconcileIndex for observability. Exposed
|
|
899
|
+
* on the return value so tests and callers can assert on counts without
|
|
900
|
+
* parsing log output.
|
|
901
|
+
*/
|
|
902
|
+
interface ReconcileSummary {
|
|
903
|
+
scanned: number;
|
|
904
|
+
added: number;
|
|
905
|
+
alreadyIndexed: number;
|
|
906
|
+
skippedMalformedJson: number;
|
|
907
|
+
skippedSchemaViolation: number;
|
|
908
|
+
skippedIoError: number;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* File system storage adapter
|
|
912
|
+
*/
|
|
913
|
+
declare class FileStorage implements StorageAdapter {
|
|
914
|
+
private baseDir;
|
|
915
|
+
private trajectoriesDir;
|
|
916
|
+
private activeDir;
|
|
917
|
+
private completedDir;
|
|
918
|
+
private indexPath;
|
|
919
|
+
constructor(baseDir?: string);
|
|
920
|
+
/**
|
|
921
|
+
* Initialize storage directories
|
|
922
|
+
*/
|
|
923
|
+
initialize(): Promise<void>;
|
|
924
|
+
/**
|
|
925
|
+
* Scan active/ and completed/ recursively and add any trajectory files
|
|
926
|
+
* missing from the index. Existing entries are preserved — reconcile
|
|
927
|
+
* only adds, never removes.
|
|
928
|
+
*
|
|
929
|
+
* Handles three on-disk layouts in completed/:
|
|
930
|
+
* - flat: completed/{id}.json (legacy workforce data)
|
|
931
|
+
* - monthly: completed/YYYY-MM/{id}.json (current save() writes)
|
|
932
|
+
* - nested: completed/.../{id}.json (defensive — any depth)
|
|
933
|
+
*
|
|
934
|
+
* Returns a ReconcileSummary so tests and CLI wrappers can observe
|
|
935
|
+
* outcomes without parsing logs. Only writes the index if anything was
|
|
936
|
+
* added.
|
|
937
|
+
*/
|
|
938
|
+
reconcileIndex(): Promise<ReconcileSummary>;
|
|
939
|
+
/**
|
|
940
|
+
* Recursively collect all .json file paths under `dir` into `out`.
|
|
941
|
+
* Silently treats a missing directory as empty.
|
|
942
|
+
*/
|
|
943
|
+
private walkJsonFilesInto;
|
|
944
|
+
/**
|
|
945
|
+
* Save a trajectory.
|
|
946
|
+
*
|
|
947
|
+
* Validates the input against the trajectory schema before touching
|
|
948
|
+
* disk. Closes the historical read/write asymmetry where save() would
|
|
949
|
+
* happily write data that the reader then rejected, producing files
|
|
950
|
+
* that could never be loaded back.
|
|
951
|
+
*/
|
|
952
|
+
save(input: Trajectory): Promise<void>;
|
|
953
|
+
/**
|
|
954
|
+
* Get a trajectory by ID
|
|
955
|
+
*/
|
|
956
|
+
get(id: string): Promise<Trajectory | null>;
|
|
957
|
+
/**
|
|
958
|
+
* Get the currently active trajectory
|
|
959
|
+
*/
|
|
960
|
+
getActive(): Promise<Trajectory | null>;
|
|
961
|
+
/**
|
|
962
|
+
* List trajectories with optional filtering
|
|
963
|
+
*/
|
|
964
|
+
list(query: TrajectoryQuery): Promise<TrajectorySummary[]>;
|
|
965
|
+
/**
|
|
966
|
+
* Delete a trajectory
|
|
967
|
+
*/
|
|
968
|
+
delete(id: string): Promise<void>;
|
|
969
|
+
/**
|
|
970
|
+
* Search trajectories by text
|
|
971
|
+
*/
|
|
972
|
+
search(text: string, options?: {
|
|
973
|
+
limit?: number;
|
|
974
|
+
}): Promise<TrajectorySummary[]>;
|
|
975
|
+
/**
|
|
976
|
+
* Close storage (no-op for file storage)
|
|
977
|
+
*/
|
|
978
|
+
close(): Promise<void>;
|
|
979
|
+
/**
|
|
980
|
+
* Read a trajectory file and return a tagged result so callers can
|
|
981
|
+
* distinguish missing files, malformed JSON, and schema violations.
|
|
982
|
+
*
|
|
983
|
+
* Does NOT log. Callers choose whether to warn, swallow, or throw.
|
|
984
|
+
*/
|
|
985
|
+
private readTrajectoryFile;
|
|
986
|
+
/**
|
|
987
|
+
* Convenience wrapper for callers that only care whether they got a
|
|
988
|
+
* trajectory. Returns null for any failure and writes nothing to the
|
|
989
|
+
* console — so nothing leaks into test output or the CLI spinner.
|
|
990
|
+
*/
|
|
991
|
+
private readTrajectoryOrNull;
|
|
992
|
+
private loadIndex;
|
|
993
|
+
private saveIndex;
|
|
994
|
+
private updateIndex;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Zod schemas for runtime validation of trajectory data
|
|
999
|
+
*
|
|
1000
|
+
* These schemas validate input at system boundaries and ensure
|
|
1001
|
+
* data integrity when reading from storage.
|
|
1002
|
+
*/
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Decision schema
|
|
1006
|
+
* Note: alternatives supports both string[] (legacy) and Alternative[] (new)
|
|
1007
|
+
*/
|
|
1008
|
+
declare const DecisionSchema: z.ZodObject<{
|
|
1009
|
+
question: z.ZodString;
|
|
1010
|
+
chosen: z.ZodString;
|
|
1011
|
+
alternatives: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
1012
|
+
option: z.ZodString;
|
|
1013
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1014
|
+
}, "strip", z.ZodTypeAny, {
|
|
1015
|
+
option: string;
|
|
1016
|
+
reason?: string | undefined;
|
|
1017
|
+
}, {
|
|
1018
|
+
option: string;
|
|
1019
|
+
reason?: string | undefined;
|
|
1020
|
+
}>]>, "many">;
|
|
1021
|
+
reasoning: z.ZodString;
|
|
1022
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
1023
|
+
}, "strip", z.ZodTypeAny, {
|
|
1024
|
+
question: string;
|
|
1025
|
+
chosen: string;
|
|
1026
|
+
alternatives: (string | {
|
|
1027
|
+
option: string;
|
|
1028
|
+
reason?: string | undefined;
|
|
1029
|
+
})[];
|
|
1030
|
+
reasoning: string;
|
|
1031
|
+
confidence?: number | undefined;
|
|
1032
|
+
}, {
|
|
1033
|
+
question: string;
|
|
1034
|
+
chosen: string;
|
|
1035
|
+
alternatives: (string | {
|
|
1036
|
+
option: string;
|
|
1037
|
+
reason?: string | undefined;
|
|
1038
|
+
})[];
|
|
1039
|
+
reasoning: string;
|
|
1040
|
+
confidence?: number | undefined;
|
|
1041
|
+
}>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Full trajectory schema
|
|
1044
|
+
*/
|
|
1045
|
+
declare const TrajectorySchema: z.ZodObject<{
|
|
1046
|
+
id: z.ZodString;
|
|
1047
|
+
version: z.ZodLiteral<1>;
|
|
1048
|
+
task: z.ZodObject<{
|
|
1049
|
+
title: z.ZodString;
|
|
1050
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1051
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
1052
|
+
system: z.ZodUnion<[z.ZodLiteral<"beads">, z.ZodLiteral<"github">, z.ZodLiteral<"linear">, z.ZodLiteral<"jira">, z.ZodLiteral<"plain">, z.ZodString]>;
|
|
1053
|
+
id: z.ZodString;
|
|
1054
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1055
|
+
}, "strip", z.ZodTypeAny, {
|
|
1056
|
+
system: string;
|
|
1057
|
+
id: string;
|
|
1058
|
+
url?: string | undefined;
|
|
1059
|
+
}, {
|
|
1060
|
+
system: string;
|
|
1061
|
+
id: string;
|
|
1062
|
+
url?: string | undefined;
|
|
1063
|
+
}>>;
|
|
1064
|
+
}, "strip", z.ZodTypeAny, {
|
|
1065
|
+
title: string;
|
|
1066
|
+
description?: string | undefined;
|
|
1067
|
+
source?: {
|
|
1068
|
+
system: string;
|
|
1069
|
+
id: string;
|
|
1070
|
+
url?: string | undefined;
|
|
1071
|
+
} | undefined;
|
|
1072
|
+
}, {
|
|
1073
|
+
title: string;
|
|
1074
|
+
description?: string | undefined;
|
|
1075
|
+
source?: {
|
|
1076
|
+
system: string;
|
|
1077
|
+
id: string;
|
|
1078
|
+
url?: string | undefined;
|
|
1079
|
+
} | undefined;
|
|
1080
|
+
}>;
|
|
1081
|
+
status: z.ZodEnum<["active", "completed", "abandoned"]>;
|
|
1082
|
+
startedAt: z.ZodString;
|
|
1083
|
+
completedAt: z.ZodOptional<z.ZodString>;
|
|
1084
|
+
agents: z.ZodArray<z.ZodObject<{
|
|
1085
|
+
name: z.ZodString;
|
|
1086
|
+
role: z.ZodString;
|
|
1087
|
+
joinedAt: z.ZodString;
|
|
1088
|
+
leftAt: z.ZodOptional<z.ZodString>;
|
|
1089
|
+
}, "strip", z.ZodTypeAny, {
|
|
1090
|
+
name: string;
|
|
1091
|
+
role: string;
|
|
1092
|
+
joinedAt: string;
|
|
1093
|
+
leftAt?: string | undefined;
|
|
1094
|
+
}, {
|
|
1095
|
+
name: string;
|
|
1096
|
+
role: string;
|
|
1097
|
+
joinedAt: string;
|
|
1098
|
+
leftAt?: string | undefined;
|
|
1099
|
+
}>, "many">;
|
|
1100
|
+
chapters: z.ZodArray<z.ZodObject<{
|
|
1101
|
+
id: z.ZodString;
|
|
1102
|
+
title: z.ZodString;
|
|
1103
|
+
agentName: z.ZodString;
|
|
1104
|
+
startedAt: z.ZodString;
|
|
1105
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
1106
|
+
events: z.ZodArray<z.ZodObject<{
|
|
1107
|
+
ts: z.ZodNumber;
|
|
1108
|
+
type: z.ZodUnion<[z.ZodLiteral<"prompt">, z.ZodLiteral<"thinking">, z.ZodLiteral<"tool_call">, z.ZodLiteral<"tool_result">, z.ZodLiteral<"message_sent">, z.ZodLiteral<"message_received">, z.ZodLiteral<"decision">, z.ZodLiteral<"finding">, z.ZodLiteral<"reflection">, z.ZodLiteral<"note">, z.ZodLiteral<"error">, z.ZodString]>;
|
|
1109
|
+
content: z.ZodString;
|
|
1110
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
1111
|
+
significance: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
1112
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1113
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
1114
|
+
}, "strip", z.ZodTypeAny, {
|
|
1115
|
+
type: string;
|
|
1116
|
+
ts: number;
|
|
1117
|
+
content: string;
|
|
1118
|
+
raw?: unknown;
|
|
1119
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1120
|
+
tags?: string[] | undefined;
|
|
1121
|
+
confidence?: number | undefined;
|
|
1122
|
+
}, {
|
|
1123
|
+
type: string;
|
|
1124
|
+
ts: number;
|
|
1125
|
+
content: string;
|
|
1126
|
+
raw?: unknown;
|
|
1127
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1128
|
+
tags?: string[] | undefined;
|
|
1129
|
+
confidence?: number | undefined;
|
|
1130
|
+
}>, "many">;
|
|
1131
|
+
}, "strip", z.ZodTypeAny, {
|
|
1132
|
+
id: string;
|
|
1133
|
+
title: string;
|
|
1134
|
+
agentName: string;
|
|
1135
|
+
startedAt: string;
|
|
1136
|
+
events: {
|
|
1137
|
+
type: string;
|
|
1138
|
+
ts: number;
|
|
1139
|
+
content: string;
|
|
1140
|
+
raw?: unknown;
|
|
1141
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1142
|
+
tags?: string[] | undefined;
|
|
1143
|
+
confidence?: number | undefined;
|
|
1144
|
+
}[];
|
|
1145
|
+
endedAt?: string | undefined;
|
|
1146
|
+
}, {
|
|
1147
|
+
id: string;
|
|
1148
|
+
title: string;
|
|
1149
|
+
agentName: string;
|
|
1150
|
+
startedAt: string;
|
|
1151
|
+
events: {
|
|
1152
|
+
type: string;
|
|
1153
|
+
ts: number;
|
|
1154
|
+
content: string;
|
|
1155
|
+
raw?: unknown;
|
|
1156
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1157
|
+
tags?: string[] | undefined;
|
|
1158
|
+
confidence?: number | undefined;
|
|
1159
|
+
}[];
|
|
1160
|
+
endedAt?: string | undefined;
|
|
1161
|
+
}>, "many">;
|
|
1162
|
+
retrospective: z.ZodOptional<z.ZodObject<{
|
|
1163
|
+
summary: z.ZodString;
|
|
1164
|
+
approach: z.ZodString;
|
|
1165
|
+
decisions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1166
|
+
question: z.ZodString;
|
|
1167
|
+
chosen: z.ZodString;
|
|
1168
|
+
alternatives: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
1169
|
+
option: z.ZodString;
|
|
1170
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1171
|
+
}, "strip", z.ZodTypeAny, {
|
|
1172
|
+
option: string;
|
|
1173
|
+
reason?: string | undefined;
|
|
1174
|
+
}, {
|
|
1175
|
+
option: string;
|
|
1176
|
+
reason?: string | undefined;
|
|
1177
|
+
}>]>, "many">;
|
|
1178
|
+
reasoning: z.ZodString;
|
|
1179
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
1180
|
+
}, "strip", z.ZodTypeAny, {
|
|
1181
|
+
question: string;
|
|
1182
|
+
chosen: string;
|
|
1183
|
+
alternatives: (string | {
|
|
1184
|
+
option: string;
|
|
1185
|
+
reason?: string | undefined;
|
|
1186
|
+
})[];
|
|
1187
|
+
reasoning: string;
|
|
1188
|
+
confidence?: number | undefined;
|
|
1189
|
+
}, {
|
|
1190
|
+
question: string;
|
|
1191
|
+
chosen: string;
|
|
1192
|
+
alternatives: (string | {
|
|
1193
|
+
option: string;
|
|
1194
|
+
reason?: string | undefined;
|
|
1195
|
+
})[];
|
|
1196
|
+
reasoning: string;
|
|
1197
|
+
confidence?: number | undefined;
|
|
1198
|
+
}>, "many">>;
|
|
1199
|
+
challenges: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1200
|
+
learnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1201
|
+
suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1202
|
+
confidence: z.ZodNumber;
|
|
1203
|
+
timeSpent: z.ZodOptional<z.ZodString>;
|
|
1204
|
+
}, "strip", z.ZodTypeAny, {
|
|
1205
|
+
confidence: number;
|
|
1206
|
+
summary: string;
|
|
1207
|
+
approach: string;
|
|
1208
|
+
decisions?: {
|
|
1209
|
+
question: string;
|
|
1210
|
+
chosen: string;
|
|
1211
|
+
alternatives: (string | {
|
|
1212
|
+
option: string;
|
|
1213
|
+
reason?: string | undefined;
|
|
1214
|
+
})[];
|
|
1215
|
+
reasoning: string;
|
|
1216
|
+
confidence?: number | undefined;
|
|
1217
|
+
}[] | undefined;
|
|
1218
|
+
challenges?: string[] | undefined;
|
|
1219
|
+
learnings?: string[] | undefined;
|
|
1220
|
+
suggestions?: string[] | undefined;
|
|
1221
|
+
timeSpent?: string | undefined;
|
|
1222
|
+
}, {
|
|
1223
|
+
confidence: number;
|
|
1224
|
+
summary: string;
|
|
1225
|
+
approach: string;
|
|
1226
|
+
decisions?: {
|
|
1227
|
+
question: string;
|
|
1228
|
+
chosen: string;
|
|
1229
|
+
alternatives: (string | {
|
|
1230
|
+
option: string;
|
|
1231
|
+
reason?: string | undefined;
|
|
1232
|
+
})[];
|
|
1233
|
+
reasoning: string;
|
|
1234
|
+
confidence?: number | undefined;
|
|
1235
|
+
}[] | undefined;
|
|
1236
|
+
challenges?: string[] | undefined;
|
|
1237
|
+
learnings?: string[] | undefined;
|
|
1238
|
+
suggestions?: string[] | undefined;
|
|
1239
|
+
timeSpent?: string | undefined;
|
|
1240
|
+
}>>;
|
|
1241
|
+
commits: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1242
|
+
filesChanged: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1243
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
1244
|
+
workflowId: z.ZodOptional<z.ZodString>;
|
|
1245
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1246
|
+
_trace: z.ZodOptional<z.ZodObject<{
|
|
1247
|
+
startRef: z.ZodString;
|
|
1248
|
+
endRef: z.ZodOptional<z.ZodString>;
|
|
1249
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
1250
|
+
}, "strip", z.ZodTypeAny, {
|
|
1251
|
+
startRef: string;
|
|
1252
|
+
endRef?: string | undefined;
|
|
1253
|
+
traceId?: string | undefined;
|
|
1254
|
+
}, {
|
|
1255
|
+
startRef: string;
|
|
1256
|
+
endRef?: string | undefined;
|
|
1257
|
+
traceId?: string | undefined;
|
|
1258
|
+
}>>;
|
|
1259
|
+
}, "strip", z.ZodTypeAny, {
|
|
1260
|
+
status: "active" | "completed" | "abandoned";
|
|
1261
|
+
id: string;
|
|
1262
|
+
tags: string[];
|
|
1263
|
+
startedAt: string;
|
|
1264
|
+
version: 1;
|
|
1265
|
+
task: {
|
|
1266
|
+
title: string;
|
|
1267
|
+
description?: string | undefined;
|
|
1268
|
+
source?: {
|
|
1269
|
+
system: string;
|
|
1270
|
+
id: string;
|
|
1271
|
+
url?: string | undefined;
|
|
1272
|
+
} | undefined;
|
|
1273
|
+
};
|
|
1274
|
+
agents: {
|
|
1275
|
+
name: string;
|
|
1276
|
+
role: string;
|
|
1277
|
+
joinedAt: string;
|
|
1278
|
+
leftAt?: string | undefined;
|
|
1279
|
+
}[];
|
|
1280
|
+
chapters: {
|
|
1281
|
+
id: string;
|
|
1282
|
+
title: string;
|
|
1283
|
+
agentName: string;
|
|
1284
|
+
startedAt: string;
|
|
1285
|
+
events: {
|
|
1286
|
+
type: string;
|
|
1287
|
+
ts: number;
|
|
1288
|
+
content: string;
|
|
1289
|
+
raw?: unknown;
|
|
1290
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1291
|
+
tags?: string[] | undefined;
|
|
1292
|
+
confidence?: number | undefined;
|
|
1293
|
+
}[];
|
|
1294
|
+
endedAt?: string | undefined;
|
|
1295
|
+
}[];
|
|
1296
|
+
commits: string[];
|
|
1297
|
+
filesChanged: string[];
|
|
1298
|
+
completedAt?: string | undefined;
|
|
1299
|
+
retrospective?: {
|
|
1300
|
+
confidence: number;
|
|
1301
|
+
summary: string;
|
|
1302
|
+
approach: string;
|
|
1303
|
+
decisions?: {
|
|
1304
|
+
question: string;
|
|
1305
|
+
chosen: string;
|
|
1306
|
+
alternatives: (string | {
|
|
1307
|
+
option: string;
|
|
1308
|
+
reason?: string | undefined;
|
|
1309
|
+
})[];
|
|
1310
|
+
reasoning: string;
|
|
1311
|
+
confidence?: number | undefined;
|
|
1312
|
+
}[] | undefined;
|
|
1313
|
+
challenges?: string[] | undefined;
|
|
1314
|
+
learnings?: string[] | undefined;
|
|
1315
|
+
suggestions?: string[] | undefined;
|
|
1316
|
+
timeSpent?: string | undefined;
|
|
1317
|
+
} | undefined;
|
|
1318
|
+
projectId?: string | undefined;
|
|
1319
|
+
workflowId?: string | undefined;
|
|
1320
|
+
_trace?: {
|
|
1321
|
+
startRef: string;
|
|
1322
|
+
endRef?: string | undefined;
|
|
1323
|
+
traceId?: string | undefined;
|
|
1324
|
+
} | undefined;
|
|
1325
|
+
}, {
|
|
1326
|
+
status: "active" | "completed" | "abandoned";
|
|
1327
|
+
id: string;
|
|
1328
|
+
startedAt: string;
|
|
1329
|
+
version: 1;
|
|
1330
|
+
task: {
|
|
1331
|
+
title: string;
|
|
1332
|
+
description?: string | undefined;
|
|
1333
|
+
source?: {
|
|
1334
|
+
system: string;
|
|
1335
|
+
id: string;
|
|
1336
|
+
url?: string | undefined;
|
|
1337
|
+
} | undefined;
|
|
1338
|
+
};
|
|
1339
|
+
agents: {
|
|
1340
|
+
name: string;
|
|
1341
|
+
role: string;
|
|
1342
|
+
joinedAt: string;
|
|
1343
|
+
leftAt?: string | undefined;
|
|
1344
|
+
}[];
|
|
1345
|
+
chapters: {
|
|
1346
|
+
id: string;
|
|
1347
|
+
title: string;
|
|
1348
|
+
agentName: string;
|
|
1349
|
+
startedAt: string;
|
|
1350
|
+
events: {
|
|
1351
|
+
type: string;
|
|
1352
|
+
ts: number;
|
|
1353
|
+
content: string;
|
|
1354
|
+
raw?: unknown;
|
|
1355
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1356
|
+
tags?: string[] | undefined;
|
|
1357
|
+
confidence?: number | undefined;
|
|
1358
|
+
}[];
|
|
1359
|
+
endedAt?: string | undefined;
|
|
1360
|
+
}[];
|
|
1361
|
+
tags?: string[] | undefined;
|
|
1362
|
+
completedAt?: string | undefined;
|
|
1363
|
+
retrospective?: {
|
|
1364
|
+
confidence: number;
|
|
1365
|
+
summary: string;
|
|
1366
|
+
approach: string;
|
|
1367
|
+
decisions?: {
|
|
1368
|
+
question: string;
|
|
1369
|
+
chosen: string;
|
|
1370
|
+
alternatives: (string | {
|
|
1371
|
+
option: string;
|
|
1372
|
+
reason?: string | undefined;
|
|
1373
|
+
})[];
|
|
1374
|
+
reasoning: string;
|
|
1375
|
+
confidence?: number | undefined;
|
|
1376
|
+
}[] | undefined;
|
|
1377
|
+
challenges?: string[] | undefined;
|
|
1378
|
+
learnings?: string[] | undefined;
|
|
1379
|
+
suggestions?: string[] | undefined;
|
|
1380
|
+
timeSpent?: string | undefined;
|
|
1381
|
+
} | undefined;
|
|
1382
|
+
commits?: string[] | undefined;
|
|
1383
|
+
filesChanged?: string[] | undefined;
|
|
1384
|
+
projectId?: string | undefined;
|
|
1385
|
+
workflowId?: string | undefined;
|
|
1386
|
+
_trace?: {
|
|
1387
|
+
startRef: string;
|
|
1388
|
+
endRef?: string | undefined;
|
|
1389
|
+
traceId?: string | undefined;
|
|
1390
|
+
} | undefined;
|
|
1391
|
+
}>;
|
|
1392
|
+
/**
|
|
1393
|
+
* Create trajectory input schema
|
|
1394
|
+
*/
|
|
1395
|
+
declare const CreateTrajectoryInputSchema: z.ZodObject<{
|
|
1396
|
+
title: z.ZodString;
|
|
1397
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1398
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
1399
|
+
system: z.ZodUnion<[z.ZodLiteral<"beads">, z.ZodLiteral<"github">, z.ZodLiteral<"linear">, z.ZodLiteral<"jira">, z.ZodLiteral<"plain">, z.ZodString]>;
|
|
1400
|
+
id: z.ZodString;
|
|
1401
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1402
|
+
}, "strip", z.ZodTypeAny, {
|
|
1403
|
+
system: string;
|
|
1404
|
+
id: string;
|
|
1405
|
+
url?: string | undefined;
|
|
1406
|
+
}, {
|
|
1407
|
+
system: string;
|
|
1408
|
+
id: string;
|
|
1409
|
+
url?: string | undefined;
|
|
1410
|
+
}>>;
|
|
1411
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
1412
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1413
|
+
}, "strip", z.ZodTypeAny, {
|
|
1414
|
+
title: string;
|
|
1415
|
+
description?: string | undefined;
|
|
1416
|
+
source?: {
|
|
1417
|
+
system: string;
|
|
1418
|
+
id: string;
|
|
1419
|
+
url?: string | undefined;
|
|
1420
|
+
} | undefined;
|
|
1421
|
+
tags?: string[] | undefined;
|
|
1422
|
+
projectId?: string | undefined;
|
|
1423
|
+
}, {
|
|
1424
|
+
title: string;
|
|
1425
|
+
description?: string | undefined;
|
|
1426
|
+
source?: {
|
|
1427
|
+
system: string;
|
|
1428
|
+
id: string;
|
|
1429
|
+
url?: string | undefined;
|
|
1430
|
+
} | undefined;
|
|
1431
|
+
tags?: string[] | undefined;
|
|
1432
|
+
projectId?: string | undefined;
|
|
1433
|
+
}>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Complete trajectory input schema
|
|
1436
|
+
*/
|
|
1437
|
+
declare const CompleteTrajectoryInputSchema: z.ZodObject<{
|
|
1438
|
+
summary: z.ZodString;
|
|
1439
|
+
approach: z.ZodString;
|
|
1440
|
+
decisions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1441
|
+
question: z.ZodString;
|
|
1442
|
+
chosen: z.ZodString;
|
|
1443
|
+
alternatives: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
1444
|
+
option: z.ZodString;
|
|
1445
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1446
|
+
}, "strip", z.ZodTypeAny, {
|
|
1447
|
+
option: string;
|
|
1448
|
+
reason?: string | undefined;
|
|
1449
|
+
}, {
|
|
1450
|
+
option: string;
|
|
1451
|
+
reason?: string | undefined;
|
|
1452
|
+
}>]>, "many">;
|
|
1453
|
+
reasoning: z.ZodString;
|
|
1454
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
1455
|
+
}, "strip", z.ZodTypeAny, {
|
|
1456
|
+
question: string;
|
|
1457
|
+
chosen: string;
|
|
1458
|
+
alternatives: (string | {
|
|
1459
|
+
option: string;
|
|
1460
|
+
reason?: string | undefined;
|
|
1461
|
+
})[];
|
|
1462
|
+
reasoning: string;
|
|
1463
|
+
confidence?: number | undefined;
|
|
1464
|
+
}, {
|
|
1465
|
+
question: string;
|
|
1466
|
+
chosen: string;
|
|
1467
|
+
alternatives: (string | {
|
|
1468
|
+
option: string;
|
|
1469
|
+
reason?: string | undefined;
|
|
1470
|
+
})[];
|
|
1471
|
+
reasoning: string;
|
|
1472
|
+
confidence?: number | undefined;
|
|
1473
|
+
}>, "many">>;
|
|
1474
|
+
challenges: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1475
|
+
learnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1476
|
+
suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1477
|
+
confidence: z.ZodNumber;
|
|
1478
|
+
}, "strip", z.ZodTypeAny, {
|
|
1479
|
+
confidence: number;
|
|
1480
|
+
summary: string;
|
|
1481
|
+
approach: string;
|
|
1482
|
+
decisions?: {
|
|
1483
|
+
question: string;
|
|
1484
|
+
chosen: string;
|
|
1485
|
+
alternatives: (string | {
|
|
1486
|
+
option: string;
|
|
1487
|
+
reason?: string | undefined;
|
|
1488
|
+
})[];
|
|
1489
|
+
reasoning: string;
|
|
1490
|
+
confidence?: number | undefined;
|
|
1491
|
+
}[] | undefined;
|
|
1492
|
+
challenges?: string[] | undefined;
|
|
1493
|
+
learnings?: string[] | undefined;
|
|
1494
|
+
suggestions?: string[] | undefined;
|
|
1495
|
+
}, {
|
|
1496
|
+
confidence: number;
|
|
1497
|
+
summary: string;
|
|
1498
|
+
approach: string;
|
|
1499
|
+
decisions?: {
|
|
1500
|
+
question: string;
|
|
1501
|
+
chosen: string;
|
|
1502
|
+
alternatives: (string | {
|
|
1503
|
+
option: string;
|
|
1504
|
+
reason?: string | undefined;
|
|
1505
|
+
})[];
|
|
1506
|
+
reasoning: string;
|
|
1507
|
+
confidence?: number | undefined;
|
|
1508
|
+
}[] | undefined;
|
|
1509
|
+
challenges?: string[] | undefined;
|
|
1510
|
+
learnings?: string[] | undefined;
|
|
1511
|
+
suggestions?: string[] | undefined;
|
|
1512
|
+
}>;
|
|
1513
|
+
/**
|
|
1514
|
+
* Validate a trajectory object
|
|
1515
|
+
* @param data - The data to validate
|
|
1516
|
+
* @returns Validation result with success flag and errors
|
|
1517
|
+
*/
|
|
1518
|
+
declare function validateTrajectory(data: unknown): {
|
|
1519
|
+
success: boolean;
|
|
1520
|
+
data?: z.infer<typeof TrajectorySchema>;
|
|
1521
|
+
errors?: z.ZodError;
|
|
1522
|
+
};
|
|
1523
|
+
/**
|
|
1524
|
+
* Validate create trajectory input
|
|
1525
|
+
*/
|
|
1526
|
+
declare function validateCreateInput(data: unknown): {
|
|
1527
|
+
success: boolean;
|
|
1528
|
+
data?: z.infer<typeof CreateTrajectoryInputSchema>;
|
|
1529
|
+
errors?: z.ZodError;
|
|
1530
|
+
};
|
|
1531
|
+
/**
|
|
1532
|
+
* Validate complete trajectory input
|
|
1533
|
+
*/
|
|
1534
|
+
declare function validateCompleteInput(data: unknown): {
|
|
1535
|
+
success: boolean;
|
|
1536
|
+
data?: z.infer<typeof CompleteTrajectoryInputSchema>;
|
|
1537
|
+
errors?: z.ZodError;
|
|
1538
|
+
};
|
|
1539
|
+
/**
|
|
1540
|
+
* Trajectory event schema
|
|
1541
|
+
*/
|
|
1542
|
+
declare const TrajectoryEventSchema: z.ZodObject<{
|
|
1543
|
+
ts: z.ZodNumber;
|
|
1544
|
+
type: z.ZodUnion<[z.ZodLiteral<"prompt">, z.ZodLiteral<"thinking">, z.ZodLiteral<"tool_call">, z.ZodLiteral<"tool_result">, z.ZodLiteral<"message_sent">, z.ZodLiteral<"message_received">, z.ZodLiteral<"decision">, z.ZodLiteral<"finding">, z.ZodLiteral<"reflection">, z.ZodLiteral<"note">, z.ZodLiteral<"error">, z.ZodString]>;
|
|
1545
|
+
content: z.ZodString;
|
|
1546
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
1547
|
+
significance: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
1548
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1549
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
1550
|
+
}, "strip", z.ZodTypeAny, {
|
|
1551
|
+
type: string;
|
|
1552
|
+
ts: number;
|
|
1553
|
+
content: string;
|
|
1554
|
+
raw?: unknown;
|
|
1555
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1556
|
+
tags?: string[] | undefined;
|
|
1557
|
+
confidence?: number | undefined;
|
|
1558
|
+
}, {
|
|
1559
|
+
type: string;
|
|
1560
|
+
ts: number;
|
|
1561
|
+
content: string;
|
|
1562
|
+
raw?: unknown;
|
|
1563
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1564
|
+
tags?: string[] | undefined;
|
|
1565
|
+
confidence?: number | undefined;
|
|
1566
|
+
}>;
|
|
1567
|
+
type TrajectoryEventSchema = z.infer<typeof TrajectoryEventSchema>;
|
|
1568
|
+
/**
|
|
1569
|
+
* Chapter schema
|
|
1570
|
+
*/
|
|
1571
|
+
declare const ChapterSchema: z.ZodObject<{
|
|
1572
|
+
id: z.ZodString;
|
|
1573
|
+
title: z.ZodString;
|
|
1574
|
+
agentName: z.ZodString;
|
|
1575
|
+
startedAt: z.ZodString;
|
|
1576
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
1577
|
+
events: z.ZodArray<z.ZodObject<{
|
|
1578
|
+
ts: z.ZodNumber;
|
|
1579
|
+
type: z.ZodUnion<[z.ZodLiteral<"prompt">, z.ZodLiteral<"thinking">, z.ZodLiteral<"tool_call">, z.ZodLiteral<"tool_result">, z.ZodLiteral<"message_sent">, z.ZodLiteral<"message_received">, z.ZodLiteral<"decision">, z.ZodLiteral<"finding">, z.ZodLiteral<"reflection">, z.ZodLiteral<"note">, z.ZodLiteral<"error">, z.ZodString]>;
|
|
1580
|
+
content: z.ZodString;
|
|
1581
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
1582
|
+
significance: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
1583
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1584
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
1585
|
+
}, "strip", z.ZodTypeAny, {
|
|
1586
|
+
type: string;
|
|
1587
|
+
ts: number;
|
|
1588
|
+
content: string;
|
|
1589
|
+
raw?: unknown;
|
|
1590
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1591
|
+
tags?: string[] | undefined;
|
|
1592
|
+
confidence?: number | undefined;
|
|
1593
|
+
}, {
|
|
1594
|
+
type: string;
|
|
1595
|
+
ts: number;
|
|
1596
|
+
content: string;
|
|
1597
|
+
raw?: unknown;
|
|
1598
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1599
|
+
tags?: string[] | undefined;
|
|
1600
|
+
confidence?: number | undefined;
|
|
1601
|
+
}>, "many">;
|
|
1602
|
+
}, "strip", z.ZodTypeAny, {
|
|
1603
|
+
id: string;
|
|
1604
|
+
title: string;
|
|
1605
|
+
agentName: string;
|
|
1606
|
+
startedAt: string;
|
|
1607
|
+
events: {
|
|
1608
|
+
type: string;
|
|
1609
|
+
ts: number;
|
|
1610
|
+
content: string;
|
|
1611
|
+
raw?: unknown;
|
|
1612
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1613
|
+
tags?: string[] | undefined;
|
|
1614
|
+
confidence?: number | undefined;
|
|
1615
|
+
}[];
|
|
1616
|
+
endedAt?: string | undefined;
|
|
1617
|
+
}, {
|
|
1618
|
+
id: string;
|
|
1619
|
+
title: string;
|
|
1620
|
+
agentName: string;
|
|
1621
|
+
startedAt: string;
|
|
1622
|
+
events: {
|
|
1623
|
+
type: string;
|
|
1624
|
+
ts: number;
|
|
1625
|
+
content: string;
|
|
1626
|
+
raw?: unknown;
|
|
1627
|
+
significance?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1628
|
+
tags?: string[] | undefined;
|
|
1629
|
+
confidence?: number | undefined;
|
|
1630
|
+
}[];
|
|
1631
|
+
endedAt?: string | undefined;
|
|
1632
|
+
}>;
|
|
1633
|
+
type ChapterSchema = z.infer<typeof ChapterSchema>;
|
|
1634
|
+
/**
|
|
1635
|
+
* Retrospective schema
|
|
1636
|
+
*/
|
|
1637
|
+
declare const RetrospectiveSchema: z.ZodObject<{
|
|
1638
|
+
summary: z.ZodString;
|
|
1639
|
+
approach: z.ZodString;
|
|
1640
|
+
decisions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1641
|
+
question: z.ZodString;
|
|
1642
|
+
chosen: z.ZodString;
|
|
1643
|
+
alternatives: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
1644
|
+
option: z.ZodString;
|
|
1645
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1646
|
+
}, "strip", z.ZodTypeAny, {
|
|
1647
|
+
option: string;
|
|
1648
|
+
reason?: string | undefined;
|
|
1649
|
+
}, {
|
|
1650
|
+
option: string;
|
|
1651
|
+
reason?: string | undefined;
|
|
1652
|
+
}>]>, "many">;
|
|
1653
|
+
reasoning: z.ZodString;
|
|
1654
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
1655
|
+
}, "strip", z.ZodTypeAny, {
|
|
1656
|
+
question: string;
|
|
1657
|
+
chosen: string;
|
|
1658
|
+
alternatives: (string | {
|
|
1659
|
+
option: string;
|
|
1660
|
+
reason?: string | undefined;
|
|
1661
|
+
})[];
|
|
1662
|
+
reasoning: string;
|
|
1663
|
+
confidence?: number | undefined;
|
|
1664
|
+
}, {
|
|
1665
|
+
question: string;
|
|
1666
|
+
chosen: string;
|
|
1667
|
+
alternatives: (string | {
|
|
1668
|
+
option: string;
|
|
1669
|
+
reason?: string | undefined;
|
|
1670
|
+
})[];
|
|
1671
|
+
reasoning: string;
|
|
1672
|
+
confidence?: number | undefined;
|
|
1673
|
+
}>, "many">>;
|
|
1674
|
+
challenges: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1675
|
+
learnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1676
|
+
suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1677
|
+
confidence: z.ZodNumber;
|
|
1678
|
+
timeSpent: z.ZodOptional<z.ZodString>;
|
|
1679
|
+
}, "strip", z.ZodTypeAny, {
|
|
1680
|
+
confidence: number;
|
|
1681
|
+
summary: string;
|
|
1682
|
+
approach: string;
|
|
1683
|
+
decisions?: {
|
|
1684
|
+
question: string;
|
|
1685
|
+
chosen: string;
|
|
1686
|
+
alternatives: (string | {
|
|
1687
|
+
option: string;
|
|
1688
|
+
reason?: string | undefined;
|
|
1689
|
+
})[];
|
|
1690
|
+
reasoning: string;
|
|
1691
|
+
confidence?: number | undefined;
|
|
1692
|
+
}[] | undefined;
|
|
1693
|
+
challenges?: string[] | undefined;
|
|
1694
|
+
learnings?: string[] | undefined;
|
|
1695
|
+
suggestions?: string[] | undefined;
|
|
1696
|
+
timeSpent?: string | undefined;
|
|
1697
|
+
}, {
|
|
1698
|
+
confidence: number;
|
|
1699
|
+
summary: string;
|
|
1700
|
+
approach: string;
|
|
1701
|
+
decisions?: {
|
|
1702
|
+
question: string;
|
|
1703
|
+
chosen: string;
|
|
1704
|
+
alternatives: (string | {
|
|
1705
|
+
option: string;
|
|
1706
|
+
reason?: string | undefined;
|
|
1707
|
+
})[];
|
|
1708
|
+
reasoning: string;
|
|
1709
|
+
confidence?: number | undefined;
|
|
1710
|
+
}[] | undefined;
|
|
1711
|
+
challenges?: string[] | undefined;
|
|
1712
|
+
learnings?: string[] | undefined;
|
|
1713
|
+
suggestions?: string[] | undefined;
|
|
1714
|
+
timeSpent?: string | undefined;
|
|
1715
|
+
}>;
|
|
1716
|
+
type RetrospectiveSchema = z.infer<typeof RetrospectiveSchema>;
|
|
1717
|
+
|
|
1718
|
+
/**
|
|
1719
|
+
* Git trailer utilities for linking commits to trajectories
|
|
1720
|
+
*
|
|
1721
|
+
* Appends structured metadata to commit messages using git's trailer convention:
|
|
1722
|
+
* Trajectory: traj_xxxxxxxxxxxx
|
|
1723
|
+
*
|
|
1724
|
+
* This creates a bidirectional link: trajectories reference commits,
|
|
1725
|
+
* and commits reference trajectories.
|
|
1726
|
+
*/
|
|
1727
|
+
/** Trailer key for trajectory ID */
|
|
1728
|
+
declare const TRAJECTORY_TRAILER_KEY = "Trajectory";
|
|
1729
|
+
/**
|
|
1730
|
+
* Format a trajectory trailer for appending to a commit message
|
|
1731
|
+
* @param trajectoryId - The trajectory ID to link
|
|
1732
|
+
* @returns Formatted trailer string (e.g., "Trajectory: traj_abc123")
|
|
1733
|
+
*/
|
|
1734
|
+
declare function formatTrailer(trajectoryId: string): string;
|
|
1735
|
+
/**
|
|
1736
|
+
* Parse trajectory ID from a commit message's trailers
|
|
1737
|
+
* @param commitMessage - Full commit message text
|
|
1738
|
+
* @returns The trajectory ID if found, null otherwise
|
|
1739
|
+
*/
|
|
1740
|
+
declare function parseTrajectoryFromMessage(commitMessage: string): string | null;
|
|
1741
|
+
/**
|
|
1742
|
+
* Get the trajectory ID linked to a specific commit
|
|
1743
|
+
* @param commitHash - Git commit hash
|
|
1744
|
+
* @returns The trajectory ID if found, null otherwise
|
|
1745
|
+
*/
|
|
1746
|
+
declare function getTrajectoryFromCommit(commitHash: string): string | null;
|
|
1747
|
+
/**
|
|
1748
|
+
* Commit info returned by getCommitsBetween
|
|
1749
|
+
*/
|
|
1750
|
+
interface CommitInfo {
|
|
1751
|
+
/** Short commit hash */
|
|
1752
|
+
hash: string;
|
|
1753
|
+
/** Full commit hash */
|
|
1754
|
+
fullHash: string;
|
|
1755
|
+
/** Commit subject line */
|
|
1756
|
+
subject: string;
|
|
1757
|
+
/** Commit author */
|
|
1758
|
+
author: string;
|
|
1759
|
+
/** Commit timestamp (ISO) */
|
|
1760
|
+
date: string;
|
|
1761
|
+
}
|
|
1762
|
+
/**
|
|
1763
|
+
* Get all commits between two git refs
|
|
1764
|
+
* @param startRef - Starting commit (exclusive)
|
|
1765
|
+
* @param endRef - Ending commit (inclusive, defaults to HEAD)
|
|
1766
|
+
* @returns Array of commit info objects
|
|
1767
|
+
*/
|
|
1768
|
+
declare function getCommitsBetween(startRef: string, endRef?: string): CommitInfo[];
|
|
1769
|
+
/**
|
|
1770
|
+
* Get file paths changed between two git refs
|
|
1771
|
+
* @param startRef - Starting commit (exclusive)
|
|
1772
|
+
* @param endRef - Ending commit (inclusive, defaults to HEAD)
|
|
1773
|
+
* @returns Array of changed file paths
|
|
1774
|
+
*/
|
|
1775
|
+
declare function getFilesChangedBetween(startRef: string, endRef?: string): string[];
|
|
1776
|
+
|
|
1777
|
+
export { type AddChapterInput as A, addDecision as B, type Chapter as C, type Decision as D, type EventSignificance as E, FileStorage as F, addEvent as G, completeTrajectory as H, createTrajectory as I, formatTrailer as J, getCommitsBetween as K, getFilesChangedBetween as L, getTrajectoryFromCommit as M, parseTrajectoryFromMessage as N, trajectory as O, validateCompleteInput as P, validateCreateInput as Q, type Retrospective as R, StorageAdapter as S, type Trajectory as T, validateTrajectory as U, type Alternative as V, type Finding as W, type FindingCategory as X, compactWorkflow as Y, type AddEventInput as a, type AgentParticipation as b, ChapterSchema as c, type CommitInfo as d, type CompleteTrajectoryInput as e, type CreateTrajectoryInput as f, DecisionSchema as g, RetrospectiveSchema as h, type StorageConfig as i, TRAJECTORY_TRAILER_KEY as j, type TaskReference as k, type TaskSource as l, TrajectoryBuilder as m, TrajectoryClient as n, type TrajectoryClientOptions as o, TrajectoryError as p, type TrajectoryEvent as q, TrajectoryEventSchema as r, type TrajectoryEventType as s, type TrajectoryQuery as t, TrajectorySchema as u, TrajectorySession as v, type TrajectoryStatus as w, type TrajectorySummary as x, abandonTrajectory as y, addChapter as z };
|