agent-trajectories 0.5.8 → 0.6.0
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 +18 -10
- package/dist/{chunk-WMJRBQB4.js → chunk-ENWKFNUD.js} +522 -267
- package/dist/chunk-ENWKFNUD.js.map +1 -0
- package/dist/cli/index.js +588 -384
- package/dist/cli/index.js.map +1 -1
- package/dist/{index-C9IcYSNQ.d.ts → index-DEr3Rs32.d.ts} +67 -41
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/package.json +3 -1
- package/dist/chunk-WMJRBQB4.js.map +0 -1
|
@@ -410,7 +410,7 @@ declare function compactWorkflow(workflowId: string, options?: {
|
|
|
410
410
|
interface TrajectoryClientOptions {
|
|
411
411
|
/** Storage adapter to use. Defaults to FileStorage. */
|
|
412
412
|
storage?: StorageAdapter;
|
|
413
|
-
/** Base directory for file storage.
|
|
413
|
+
/** Base directory for default file storage. Stores under .agentworkforce/trajectories. */
|
|
414
414
|
dataDir?: string;
|
|
415
415
|
/** Default agent name to use when not specified */
|
|
416
416
|
defaultAgent?: string;
|
|
@@ -908,10 +908,20 @@ declare function abandonTrajectory(trajectory: Trajectory, reason?: string): Tra
|
|
|
908
908
|
/**
|
|
909
909
|
* File system storage adapter for trajectories
|
|
910
910
|
*
|
|
911
|
-
* Stores
|
|
912
|
-
* Active trajectories go in active
|
|
911
|
+
* Stores each trajectory in its own directory under .agentworkforce/trajectories.
|
|
912
|
+
* Active trajectories go in active/<id>/, completed in completed/YYYY-MM/<id>/.
|
|
913
913
|
*/
|
|
914
914
|
|
|
915
|
+
declare const DEFAULT_TRAJECTORY_DATA_DIR: string;
|
|
916
|
+
declare const LEGACY_TRAJECTORY_DATA_DIR = ".trajectories";
|
|
917
|
+
declare function getDefaultTrajectoryDataDir(baseDir?: string): string;
|
|
918
|
+
interface DeleteTrajectorySummary {
|
|
919
|
+
removedTrajectories: number;
|
|
920
|
+
deletedJsonFiles: number;
|
|
921
|
+
deletedMarkdownFiles: number;
|
|
922
|
+
deletedTraceFiles: number;
|
|
923
|
+
deletedCompactionFiles: number;
|
|
924
|
+
}
|
|
915
925
|
/**
|
|
916
926
|
* Reason a single trajectory file was skipped during reconcile.
|
|
917
927
|
*/
|
|
@@ -951,26 +961,26 @@ declare class FileStorage implements StorageAdapter {
|
|
|
951
961
|
private trajectoriesDir;
|
|
952
962
|
private activeDir;
|
|
953
963
|
private completedDir;
|
|
954
|
-
private indexPath;
|
|
955
964
|
private lastReconcileSummary?;
|
|
965
|
+
private shouldMigrateLegacyDefault;
|
|
956
966
|
constructor(baseDir?: string);
|
|
957
967
|
/**
|
|
958
968
|
* Initialize storage directories
|
|
959
969
|
*/
|
|
960
970
|
initialize(): Promise<void>;
|
|
971
|
+
private migrateLegacyDefaultDir;
|
|
961
972
|
/**
|
|
962
|
-
* Scan active/ and completed/ recursively and
|
|
963
|
-
*
|
|
964
|
-
* only adds, never removes.
|
|
973
|
+
* Scan active/ and completed/ recursively and report trajectory files
|
|
974
|
+
* that can be loaded plus files that should be surfaced by doctor.
|
|
965
975
|
*
|
|
966
976
|
* Handles three on-disk layouts in completed/:
|
|
967
977
|
* - flat: completed/{id}.json (legacy workforce data)
|
|
968
|
-
* - monthly: completed/YYYY-MM/{id}.json (
|
|
978
|
+
* - monthly: completed/YYYY-MM/{id}.json (legacy monthly layout)
|
|
979
|
+
* - directory: completed/YYYY-MM/{id}/trajectory.json (current layout)
|
|
969
980
|
* - nested: completed/.../{id}.json (defensive — any depth)
|
|
970
981
|
*
|
|
971
|
-
*
|
|
972
|
-
*
|
|
973
|
-
* added.
|
|
982
|
+
* The method name is kept for callers such as `trail doctor`, but no
|
|
983
|
+
* shared index file is written.
|
|
974
984
|
*/
|
|
975
985
|
reconcileIndex(): Promise<ReconcileSummary>;
|
|
976
986
|
/**
|
|
@@ -980,7 +990,7 @@ declare class FileStorage implements StorageAdapter {
|
|
|
980
990
|
*/
|
|
981
991
|
getLastReconcileSummary(): ReconcileSummary | undefined;
|
|
982
992
|
/**
|
|
983
|
-
* Move trajectory files that fail to load into `.trajectories/invalid/`
|
|
993
|
+
* Move trajectory files that fail to load into `.agentworkforce/trajectories/invalid/`
|
|
984
994
|
* so reconcile no longer scans them. Only quarantines parse and schema
|
|
985
995
|
* failures — transient io_error failures are left in place because the
|
|
986
996
|
* file may load fine on the next attempt.
|
|
@@ -1006,7 +1016,7 @@ declare class FileStorage implements StorageAdapter {
|
|
|
1006
1016
|
*/
|
|
1007
1017
|
private resolveQuarantineDest;
|
|
1008
1018
|
/**
|
|
1009
|
-
* Recursively collect
|
|
1019
|
+
* Recursively collect trajectory JSON file paths under `dir` into `out`.
|
|
1010
1020
|
* Silently treats a missing directory as empty.
|
|
1011
1021
|
*/
|
|
1012
1022
|
private walkJsonFilesInto;
|
|
@@ -1041,10 +1051,53 @@ declare class FileStorage implements StorageAdapter {
|
|
|
1041
1051
|
search(text: string, options?: {
|
|
1042
1052
|
limit?: number;
|
|
1043
1053
|
}): Promise<TrajectorySummary[]>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Mark a trajectory as compacted without writing to a shared index.
|
|
1056
|
+
*/
|
|
1057
|
+
markCompacted(id: string, compactedInto: string): Promise<boolean>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Mark multiple trajectories as compacted with one filesystem scan.
|
|
1060
|
+
*/
|
|
1061
|
+
markCompactedMany(ids: string[], compactedInto: string): Promise<Set<string>>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Return trajectory IDs that have a per-trajectory compaction marker.
|
|
1064
|
+
*/
|
|
1065
|
+
getCompactedTrajectoryIds(): Promise<Set<string>>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Delete a trajectory and return file counts for CLI reporting.
|
|
1068
|
+
*/
|
|
1069
|
+
deleteWithSummary(id: string): Promise<DeleteTrajectorySummary>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Delete multiple trajectories with one filesystem scan.
|
|
1072
|
+
*/
|
|
1073
|
+
deleteManyWithSummary(ids: string[]): Promise<DeleteTrajectorySummary>;
|
|
1044
1074
|
/**
|
|
1045
1075
|
* Close storage (no-op for file storage)
|
|
1046
1076
|
*/
|
|
1047
1077
|
close(): Promise<void>;
|
|
1078
|
+
private getActiveCandidatePaths;
|
|
1079
|
+
private loadAllTrajectories;
|
|
1080
|
+
private listTrajectoryFiles;
|
|
1081
|
+
private collectTrajectoryFiles;
|
|
1082
|
+
private findTrajectoryFilePaths;
|
|
1083
|
+
private findTrajectoryFilePathsForIds;
|
|
1084
|
+
private getTrajectoryIdFromPath;
|
|
1085
|
+
private removeTrajectoryFiles;
|
|
1086
|
+
private removeTrajectoryFile;
|
|
1087
|
+
private countDirectoryTrajectoryFiles;
|
|
1088
|
+
private removeFileIfExists;
|
|
1089
|
+
private countFileIfExists;
|
|
1090
|
+
private incrementDeleteSummary;
|
|
1091
|
+
private emptyDeleteSummary;
|
|
1092
|
+
private listCompactionMarkerFiles;
|
|
1093
|
+
private getCompactionMarkerPath;
|
|
1094
|
+
private getTrajectoryIdFromCompactionMarkerPath;
|
|
1095
|
+
private migrateLegacyIndexCompactionMarkers;
|
|
1096
|
+
private isPathInsideTrajectoriesDir;
|
|
1097
|
+
private walkFilesInto;
|
|
1098
|
+
private getSortValue;
|
|
1099
|
+
private toSummary;
|
|
1100
|
+
private isNewerTrajectory;
|
|
1048
1101
|
/**
|
|
1049
1102
|
* Read a trajectory file and return a tagged result so callers can
|
|
1050
1103
|
* distinguish missing files, malformed JSON, and schema violations.
|
|
@@ -1058,33 +1111,6 @@ declare class FileStorage implements StorageAdapter {
|
|
|
1058
1111
|
* console — so nothing leaks into test output or the CLI spinner.
|
|
1059
1112
|
*/
|
|
1060
1113
|
private readTrajectoryOrNull;
|
|
1061
|
-
/**
|
|
1062
|
-
* Read and parse the on-disk index.
|
|
1063
|
-
*
|
|
1064
|
-
* Tolerances (belt-and-braces against the read/write race):
|
|
1065
|
-
* - ENOENT: first-run, return an empty index silently.
|
|
1066
|
-
* - Empty file: a concurrent writer truncated index.json in "w" mode
|
|
1067
|
-
* right before we read. Return an empty index silently — this is
|
|
1068
|
-
* not a real corruption, just an interleaving the mutex + atomic
|
|
1069
|
-
* rename should already prevent. Logging here would be noise.
|
|
1070
|
-
* - Non-empty but malformed JSON: genuinely corrupted on disk (hand
|
|
1071
|
-
* edit, disk error, etc). Log it and return an empty index so the
|
|
1072
|
-
* caller can recover, but keep the log so the problem is visible.
|
|
1073
|
-
*/
|
|
1074
|
-
private loadIndex;
|
|
1075
|
-
private emptyIndex;
|
|
1076
|
-
/**
|
|
1077
|
-
* Atomic write: stage into a process-unique temp path in the same directory
|
|
1078
|
-
* and then rename over the live file. `rename` is atomic on POSIX, so
|
|
1079
|
-
* concurrent readers in any process either see the old complete file or
|
|
1080
|
-
* the new complete file — never a half-written / zero-byte state.
|
|
1081
|
-
*
|
|
1082
|
-
* Callers MUST hold `withIndexLock(this.indexPath, ...)` so the in-process
|
|
1083
|
-
* read-modify-write cycle stays serialized; the unique temp name also keeps
|
|
1084
|
-
* parallel writers in other processes from colliding on a shared tmp path.
|
|
1085
|
-
*/
|
|
1086
|
-
private saveIndex;
|
|
1087
|
-
private updateIndex;
|
|
1088
1114
|
}
|
|
1089
1115
|
|
|
1090
1116
|
/**
|
|
@@ -1867,4 +1893,4 @@ declare function getCommitsBetween(startRef: string, endRef?: string): CommitInf
|
|
|
1867
1893
|
*/
|
|
1868
1894
|
declare function getFilesChangedBetween(startRef: string, endRef?: string): string[];
|
|
1869
1895
|
|
|
1870
|
-
export { type AddChapterInput as A,
|
|
1896
|
+
export { compactWorkflow as $, type AddChapterInput as A, addChapter as B, type Chapter as C, DEFAULT_TRAJECTORY_DATA_DIR as D, type EventSignificance as E, FileStorage as F, addDecision as G, addEvent as H, completeTrajectory as I, createTrajectory as J, formatTrailer as K, LEGACY_TRAJECTORY_DATA_DIR as L, getCommitsBetween as M, getDefaultTrajectoryDataDir as N, getFilesChangedBetween as O, getTrajectoryFromCommit as P, parseTrajectoryFromMessage as Q, type Retrospective as R, StorageAdapter as S, type Trajectory as T, trajectory as U, validateCompleteInput as V, validateCreateInput as W, validateTrajectory as X, type Alternative as Y, type Finding as Z, type FindingCategory as _, type AddEventInput as a, type AgentParticipation as b, ChapterSchema as c, type CommitInfo as d, type CompleteTrajectoryInput as e, type CreateTrajectoryInput as f, type Decision as g, DecisionSchema as h, RetrospectiveSchema as i, type StorageConfig as j, TRAJECTORY_TRAILER_KEY as k, type TaskReference as l, type TaskSource as m, TrajectoryBuilder as n, TrajectoryClient as o, type TrajectoryClientOptions as p, TrajectoryError as q, type TrajectoryEvent as r, TrajectoryEventSchema as s, type TrajectoryEventType as t, type TrajectoryQuery as u, TrajectorySchema as v, TrajectorySession as w, type TrajectoryStatus as x, type TrajectorySummary as y, abandonTrajectory as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Trajectory } from './index-
|
|
2
|
-
export { A as AddChapterInput, a as AddEventInput, b as AgentParticipation, C as Chapter, c as ChapterSchema, d as CommitInfo, e as CompleteTrajectoryInput, f as CreateTrajectoryInput, D as
|
|
1
|
+
import { T as Trajectory } from './index-DEr3Rs32.js';
|
|
2
|
+
export { A as AddChapterInput, a as AddEventInput, b as AgentParticipation, C as Chapter, c as ChapterSchema, d as CommitInfo, e as CompleteTrajectoryInput, f as CreateTrajectoryInput, D as DEFAULT_TRAJECTORY_DATA_DIR, g as Decision, h as DecisionSchema, E as EventSignificance, F as FileStorage, L as LEGACY_TRAJECTORY_DATA_DIR, R as Retrospective, i as RetrospectiveSchema, S as StorageAdapter, j as StorageConfig, k as TRAJECTORY_TRAILER_KEY, l as TaskReference, m as TaskSource, n as TrajectoryBuilder, o as TrajectoryClient, p as TrajectoryClientOptions, q as TrajectoryError, r as TrajectoryEvent, s as TrajectoryEventSchema, t as TrajectoryEventType, u as TrajectoryQuery, v as TrajectorySchema, w as TrajectorySession, x as TrajectoryStatus, y as TrajectorySummary, z as abandonTrajectory, B as addChapter, G as addDecision, H as addEvent, I as completeTrajectory, J as createTrajectory, K as formatTrailer, M as getCommitsBetween, N as getDefaultTrajectoryDataDir, O as getFilesChangedBetween, P as getTrajectoryFromCommit, Q as parseTrajectoryFromMessage, U as trajectory, V as validateCompleteInput, W as validateCreateInput, X as validateTrajectory } from './index-DEr3Rs32.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChapterSchema,
|
|
3
|
+
DEFAULT_TRAJECTORY_DATA_DIR,
|
|
3
4
|
DecisionSchema,
|
|
4
5
|
FileStorage,
|
|
6
|
+
LEGACY_TRAJECTORY_DATA_DIR,
|
|
5
7
|
RetrospectiveSchema,
|
|
6
8
|
TRAJECTORY_TRAILER_KEY,
|
|
7
9
|
TrajectoryBuilder,
|
|
@@ -24,6 +26,7 @@ import {
|
|
|
24
26
|
generateChapterId,
|
|
25
27
|
generateTrajectoryId,
|
|
26
28
|
getCommitsBetween,
|
|
29
|
+
getDefaultTrajectoryDataDir,
|
|
27
30
|
getFilesChangedBetween,
|
|
28
31
|
getTrajectoryFromCommit,
|
|
29
32
|
isValidChapterId,
|
|
@@ -33,11 +36,13 @@ import {
|
|
|
33
36
|
validateCompleteInput,
|
|
34
37
|
validateCreateInput,
|
|
35
38
|
validateTrajectory
|
|
36
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-ENWKFNUD.js";
|
|
37
40
|
export {
|
|
38
41
|
ChapterSchema,
|
|
42
|
+
DEFAULT_TRAJECTORY_DATA_DIR,
|
|
39
43
|
DecisionSchema,
|
|
40
44
|
FileStorage,
|
|
45
|
+
LEGACY_TRAJECTORY_DATA_DIR,
|
|
41
46
|
RetrospectiveSchema,
|
|
42
47
|
TRAJECTORY_TRAILER_KEY,
|
|
43
48
|
TrajectoryBuilder,
|
|
@@ -60,6 +65,7 @@ export {
|
|
|
60
65
|
generateChapterId,
|
|
61
66
|
generateTrajectoryId,
|
|
62
67
|
getCommitsBetween,
|
|
68
|
+
getDefaultTrajectoryDataDir,
|
|
63
69
|
getFilesChangedBetween,
|
|
64
70
|
getTrajectoryFromCommit,
|
|
65
71
|
isValidChapterId,
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AddChapterInput, a as AddEventInput, b as AgentParticipation,
|
|
1
|
+
export { A as AddChapterInput, a as AddEventInput, b as AgentParticipation, Y as Alternative, C as Chapter, d as CommitInfo, e as CompleteTrajectoryInput, f as CreateTrajectoryInput, g as Decision, E as EventSignificance, F as FileStorage, Z as Finding, _ as FindingCategory, R as Retrospective, S as StorageAdapter, j as StorageConfig, k as TRAJECTORY_TRAILER_KEY, l as TaskReference, m as TaskSource, T as Trajectory, n as TrajectoryBuilder, o as TrajectoryClient, p as TrajectoryClientOptions, q as TrajectoryError, r as TrajectoryEvent, t as TrajectoryEventType, u as TrajectoryQuery, v as TrajectorySchema, w as TrajectorySession, x as TrajectoryStatus, y as TrajectorySummary, $ as compactWorkflow, K as formatTrailer, M as getCommitsBetween, O as getFilesChangedBetween, P as getTrajectoryFromCommit, Q as parseTrajectoryFromMessage, U as trajectory, V as validateCompleteInput, W as validateCreateInput, X as validateTrajectory } from '../index-DEr3Rs32.js';
|
|
2
2
|
import 'zod';
|
package/dist/sdk/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-trajectories",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Capture the complete train of thought of agent work as first-class artifacts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsup",
|
|
25
25
|
"dev": "tsup --watch",
|
|
26
|
+
"trail": "vite-node src/cli/index.ts",
|
|
26
27
|
"test": "vitest",
|
|
27
28
|
"test:run": "vitest run",
|
|
28
29
|
"lint": "biome check .",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"lint-staged": "^16.2.7",
|
|
68
69
|
"tsup": "^8.5.1",
|
|
69
70
|
"typescript": "^5.4.0",
|
|
71
|
+
"vite-node": "^2.1.9",
|
|
70
72
|
"vitest": "^2.0.0"
|
|
71
73
|
},
|
|
72
74
|
"lint-staged": {
|