@codebolt/narrative 1.11.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/dist/api/command.api.d.ts +12 -0
- package/dist/api/command.api.js +27 -0
- package/dist/api/fs.api.d.ts +13 -0
- package/dist/api/fs.api.js +30 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +17 -0
- package/dist/api/narrative.api.d.ts +11 -0
- package/dist/api/narrative.api.js +24 -0
- package/dist/api/queue.api.d.ts +9 -0
- package/dist/api/queue.api.js +18 -0
- package/dist/api/snapshot.api.d.ts +18 -0
- package/dist/api/snapshot.api.js +45 -0
- package/dist/api/timeline.api.d.ts +11 -0
- package/dist/api/timeline.api.js +24 -0
- package/dist/api/trace.api.d.ts +12 -0
- package/dist/api/trace.api.js +27 -0
- package/dist/binary.d.ts +10 -0
- package/dist/binary.js +88 -0
- package/dist/client.d.ts +74 -0
- package/dist/client.js +127 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.js +68 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +69 -0
- package/dist/transport.d.ts +42 -0
- package/dist/transport.js +184 -0
- package/dist/types/command.d.ts +59 -0
- package/dist/types/command.js +2 -0
- package/dist/types/common.d.ts +10 -0
- package/dist/types/common.js +2 -0
- package/dist/types/fs.d.ts +69 -0
- package/dist/types/fs.js +2 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +26 -0
- package/dist/types/jsonrpc.d.ts +22 -0
- package/dist/types/jsonrpc.js +2 -0
- package/dist/types/narrative.d.ts +67 -0
- package/dist/types/narrative.js +2 -0
- package/dist/types/notifications.d.ts +23 -0
- package/dist/types/notifications.js +2 -0
- package/dist/types/queue.d.ts +38 -0
- package/dist/types/queue.js +2 -0
- package/dist/types/snapshot.d.ts +128 -0
- package/dist/types/snapshot.js +3 -0
- package/dist/types/timeline.d.ts +64 -0
- package/dist/types/timeline.js +2 -0
- package/dist/types/trace.d.ts +105 -0
- package/dist/types/trace.js +3 -0
- package/package.json +26 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ExecutionStartedEvent {
|
|
2
|
+
session_id: string;
|
|
3
|
+
pid: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ExecutionPtyDataEvent {
|
|
6
|
+
session_id: string;
|
|
7
|
+
data: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ExecutionExitEvent {
|
|
10
|
+
session_id: string;
|
|
11
|
+
exit_code: number | null;
|
|
12
|
+
signal: number | null;
|
|
13
|
+
}
|
|
14
|
+
export interface ExecutionErrorEvent {
|
|
15
|
+
session_id: string;
|
|
16
|
+
error: string;
|
|
17
|
+
}
|
|
18
|
+
export interface NarrativeNotificationMap {
|
|
19
|
+
'execution.started': ExecutionStartedEvent;
|
|
20
|
+
'execution.pty_data': ExecutionPtyDataEvent;
|
|
21
|
+
'execution.exit': ExecutionExitEvent;
|
|
22
|
+
'execution.error': ExecutionErrorEvent;
|
|
23
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface SlotHolder {
|
|
2
|
+
execution_id: string;
|
|
3
|
+
agent_run_id: string;
|
|
4
|
+
held_for_ms: number;
|
|
5
|
+
}
|
|
6
|
+
export interface MutationSlotInfo {
|
|
7
|
+
is_held: boolean;
|
|
8
|
+
is_timed_out: boolean;
|
|
9
|
+
holder: SlotHolder | null;
|
|
10
|
+
max_hold_ms: number;
|
|
11
|
+
}
|
|
12
|
+
export interface RunningTask {
|
|
13
|
+
id: string;
|
|
14
|
+
task_type: string;
|
|
15
|
+
command: string;
|
|
16
|
+
started_at: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface QueueStatusResult {
|
|
19
|
+
pending: number;
|
|
20
|
+
running: number;
|
|
21
|
+
running_tasks: RunningTask[];
|
|
22
|
+
mutation_slot: MutationSlotInfo;
|
|
23
|
+
}
|
|
24
|
+
export interface ForceReleaseParams {
|
|
25
|
+
reason?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ForceReleaseResult {
|
|
28
|
+
success: boolean;
|
|
29
|
+
was_held: boolean;
|
|
30
|
+
previous_holder: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface CancelTaskParams {
|
|
33
|
+
task_id: string;
|
|
34
|
+
}
|
|
35
|
+
export interface CancelTaskResult {
|
|
36
|
+
success: boolean;
|
|
37
|
+
task_id: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export interface CreateSnapshotParams {
|
|
2
|
+
agent_run_id: string;
|
|
3
|
+
thread_id?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
tags?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface CreateSnapshotResult {
|
|
8
|
+
snapshot_id: string;
|
|
9
|
+
tree_hash: string;
|
|
10
|
+
ref_name: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SnapshotIdParam {
|
|
13
|
+
snapshot_id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CreateArchiveResult {
|
|
16
|
+
archive_path: string;
|
|
17
|
+
file_count: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ImportArchiveParams {
|
|
20
|
+
archive_path: string;
|
|
21
|
+
thread_id: string;
|
|
22
|
+
remote_snapshot_ref_id?: string;
|
|
23
|
+
remote_environment_id?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ImportArchiveResult {
|
|
26
|
+
snapshot_id: string;
|
|
27
|
+
tree_hash: string;
|
|
28
|
+
previous_snapshot_id: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ExportBundleParams {
|
|
31
|
+
snapshot_id: string;
|
|
32
|
+
incremental?: boolean;
|
|
33
|
+
base_snapshot_id?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ExportBundleResult {
|
|
36
|
+
bundle_path: string;
|
|
37
|
+
}
|
|
38
|
+
export interface AddBundleParams {
|
|
39
|
+
bundle_path: string;
|
|
40
|
+
}
|
|
41
|
+
export interface AddBundleResult {
|
|
42
|
+
imported_refs: [string, string][];
|
|
43
|
+
snapshot_ids: string[];
|
|
44
|
+
}
|
|
45
|
+
export type BrowseCommand = {
|
|
46
|
+
type: 'readFile';
|
|
47
|
+
path: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'listDirectory';
|
|
50
|
+
path?: string;
|
|
51
|
+
};
|
|
52
|
+
export interface BrowseSnapshotParams {
|
|
53
|
+
snapshot_id: string;
|
|
54
|
+
command: BrowseCommand;
|
|
55
|
+
}
|
|
56
|
+
export type BrowseResult = {
|
|
57
|
+
type: 'fileContent';
|
|
58
|
+
path: string;
|
|
59
|
+
content: string;
|
|
60
|
+
} | {
|
|
61
|
+
type: 'directoryListing';
|
|
62
|
+
entries: [string, boolean][];
|
|
63
|
+
};
|
|
64
|
+
export type MergeStrategy = {
|
|
65
|
+
type: 'toCurrentCode';
|
|
66
|
+
base_snapshot_id: string;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'withBaseSnapshot';
|
|
69
|
+
other_snapshot_id: string;
|
|
70
|
+
base_snapshot_id: string;
|
|
71
|
+
};
|
|
72
|
+
export interface MergeSnapshotParams {
|
|
73
|
+
snapshot_id: string;
|
|
74
|
+
strategy: MergeStrategy;
|
|
75
|
+
}
|
|
76
|
+
export interface MergeSnapshotResult {
|
|
77
|
+
merged_tree_hash: string;
|
|
78
|
+
is_clean: boolean;
|
|
79
|
+
conflicts: string[];
|
|
80
|
+
applied_to_workspace: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface AddCommitParams {
|
|
83
|
+
thread_id: string;
|
|
84
|
+
message: string;
|
|
85
|
+
snapshot_ids: string[];
|
|
86
|
+
notes?: string;
|
|
87
|
+
commit_to_main_repo?: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface AddCommitResult {
|
|
90
|
+
commit_hash: string;
|
|
91
|
+
main_repo_commit_hash: string | null;
|
|
92
|
+
}
|
|
93
|
+
export interface CheckRecoveryParams {
|
|
94
|
+
snapshot_id: string;
|
|
95
|
+
thread_id: string;
|
|
96
|
+
}
|
|
97
|
+
export interface RecoveryCheck {
|
|
98
|
+
recoverable: boolean;
|
|
99
|
+
recoverable_files: string[];
|
|
100
|
+
other_thread_changes: string[];
|
|
101
|
+
total_changes: number;
|
|
102
|
+
}
|
|
103
|
+
export type CheckoutStrategy = {
|
|
104
|
+
type: 'revert';
|
|
105
|
+
} | {
|
|
106
|
+
type: 'replace';
|
|
107
|
+
thread_id: string;
|
|
108
|
+
};
|
|
109
|
+
export interface CheckoutSnapshotParams {
|
|
110
|
+
snapshot_id: string;
|
|
111
|
+
strategy: CheckoutStrategy;
|
|
112
|
+
}
|
|
113
|
+
export interface CheckoutResult {
|
|
114
|
+
restored_tree_hash: string;
|
|
115
|
+
safety_snapshot_id: string | null;
|
|
116
|
+
}
|
|
117
|
+
export interface DeleteResult {
|
|
118
|
+
deleted: boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface PruneSnapshotsParams {
|
|
121
|
+
thread_id?: string;
|
|
122
|
+
max_age_hours?: number;
|
|
123
|
+
keep_count?: number;
|
|
124
|
+
}
|
|
125
|
+
export interface PruneResult {
|
|
126
|
+
pruned_count: number;
|
|
127
|
+
pruned_ids: string[];
|
|
128
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { NarrativeContext } from './common';
|
|
2
|
+
export interface GetTimelineParams {
|
|
3
|
+
limit?: number;
|
|
4
|
+
offset?: number;
|
|
5
|
+
agent_run_id?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TimelineSnapshot {
|
|
8
|
+
id: string;
|
|
9
|
+
tree_hash: string;
|
|
10
|
+
created_at: string;
|
|
11
|
+
agent_run_id: string | null;
|
|
12
|
+
description: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface GetTimelineResult {
|
|
15
|
+
snapshots: TimelineSnapshot[];
|
|
16
|
+
count: number;
|
|
17
|
+
}
|
|
18
|
+
export interface RestoreSnapshotParams {
|
|
19
|
+
tree_hash: string;
|
|
20
|
+
context: NarrativeContext;
|
|
21
|
+
}
|
|
22
|
+
export interface RestoreSnapshotResult {
|
|
23
|
+
success: boolean;
|
|
24
|
+
restored_to: string;
|
|
25
|
+
current_snapshot: string;
|
|
26
|
+
}
|
|
27
|
+
export interface GetSnapshotParams {
|
|
28
|
+
id?: string;
|
|
29
|
+
tree_hash?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface GetSnapshotResult {
|
|
32
|
+
id: string;
|
|
33
|
+
tree_hash: string;
|
|
34
|
+
created_at: string;
|
|
35
|
+
agent_run_id: string | null;
|
|
36
|
+
description: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface DiffSnapshotsParams {
|
|
39
|
+
from_hash?: string;
|
|
40
|
+
to_hash?: string;
|
|
41
|
+
from_snapshot?: string;
|
|
42
|
+
to_snapshot?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface SnapshotDiff {
|
|
45
|
+
from_hash: string;
|
|
46
|
+
to_hash: string;
|
|
47
|
+
added: string[];
|
|
48
|
+
modified: string[];
|
|
49
|
+
deleted: string[];
|
|
50
|
+
diffs: unknown;
|
|
51
|
+
has_changes: boolean;
|
|
52
|
+
total_changes: number;
|
|
53
|
+
}
|
|
54
|
+
export interface GetFileAtSnapshotParams {
|
|
55
|
+
tree_hash: string;
|
|
56
|
+
file_path: string;
|
|
57
|
+
encoding?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface GetFileAtSnapshotResult {
|
|
60
|
+
content: string;
|
|
61
|
+
encoding: string;
|
|
62
|
+
file_path: string;
|
|
63
|
+
tree_hash: string;
|
|
64
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export interface TraceRecordParam {
|
|
2
|
+
operation_type: string;
|
|
3
|
+
details: unknown;
|
|
4
|
+
file_path?: string;
|
|
5
|
+
tree_hash_before?: string;
|
|
6
|
+
tree_hash_after?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ChangesetFileChange {
|
|
9
|
+
path: string;
|
|
10
|
+
content: string;
|
|
11
|
+
operation: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ChangesetParam {
|
|
14
|
+
base_tree_hash: string;
|
|
15
|
+
file_changes: ChangesetFileChange[];
|
|
16
|
+
deleted_files: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface AnchorParam {
|
|
19
|
+
tree_hash: string;
|
|
20
|
+
thread_id: string;
|
|
21
|
+
environment_id: string;
|
|
22
|
+
}
|
|
23
|
+
export interface CheckpointParam {
|
|
24
|
+
tree_hash: string;
|
|
25
|
+
base_anchor_id: string;
|
|
26
|
+
source_environment_id: string;
|
|
27
|
+
sequence: number;
|
|
28
|
+
}
|
|
29
|
+
export interface IngestTraceParams {
|
|
30
|
+
execution_id: string;
|
|
31
|
+
thread_id: string;
|
|
32
|
+
environment_id: string;
|
|
33
|
+
records: TraceRecordParam[];
|
|
34
|
+
changeset: ChangesetParam;
|
|
35
|
+
base_anchor: AnchorParam;
|
|
36
|
+
checkpoint: CheckpointParam;
|
|
37
|
+
ingested_by?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface IngestTraceResult {
|
|
40
|
+
ingestion_id: string;
|
|
41
|
+
execution_trace_id: string;
|
|
42
|
+
checkpoint_id: string;
|
|
43
|
+
base_anchor_id: string;
|
|
44
|
+
source_environment_id: string;
|
|
45
|
+
files_added: number;
|
|
46
|
+
files_modified: number;
|
|
47
|
+
files_deleted: number;
|
|
48
|
+
}
|
|
49
|
+
export interface GetExecutionTraceParams {
|
|
50
|
+
execution_id: string;
|
|
51
|
+
}
|
|
52
|
+
export interface TraceRecordResult {
|
|
53
|
+
id: string;
|
|
54
|
+
operation_type: string;
|
|
55
|
+
timestamp: string;
|
|
56
|
+
file_path: string | null;
|
|
57
|
+
details: unknown;
|
|
58
|
+
}
|
|
59
|
+
export interface ExecutionTraceResult {
|
|
60
|
+
execution_id: string;
|
|
61
|
+
thread_id: string;
|
|
62
|
+
environment_id: string;
|
|
63
|
+
record_count: number;
|
|
64
|
+
started_at: string;
|
|
65
|
+
ended_at: string | null;
|
|
66
|
+
records: TraceRecordResult[];
|
|
67
|
+
}
|
|
68
|
+
export interface GetThreadTraceParams {
|
|
69
|
+
thread_id: string;
|
|
70
|
+
}
|
|
71
|
+
export interface TraceSummaryResult {
|
|
72
|
+
execution_id: string;
|
|
73
|
+
thread_id: string;
|
|
74
|
+
environment_id: string;
|
|
75
|
+
started_at: string;
|
|
76
|
+
ended_at: string | null;
|
|
77
|
+
status: string;
|
|
78
|
+
record_count: number;
|
|
79
|
+
}
|
|
80
|
+
export interface GetFileTraceParams {
|
|
81
|
+
file_path: string;
|
|
82
|
+
}
|
|
83
|
+
export interface FileChangeResult {
|
|
84
|
+
record_id: string;
|
|
85
|
+
execution_id: string;
|
|
86
|
+
operation_type: string;
|
|
87
|
+
timestamp: string;
|
|
88
|
+
tree_hash_before: string | null;
|
|
89
|
+
tree_hash_after: string | null;
|
|
90
|
+
details: unknown;
|
|
91
|
+
}
|
|
92
|
+
export interface GetRecentTracesParams {
|
|
93
|
+
limit?: number;
|
|
94
|
+
}
|
|
95
|
+
export interface IngestionSummaryResult {
|
|
96
|
+
ingestion_id: string;
|
|
97
|
+
execution_trace_id: string;
|
|
98
|
+
checkpoint_id: string;
|
|
99
|
+
base_anchor_id: string;
|
|
100
|
+
source_environment_id: string;
|
|
101
|
+
ingested_at: string;
|
|
102
|
+
files_added: number;
|
|
103
|
+
files_modified: number;
|
|
104
|
+
files_deleted: number;
|
|
105
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codebolt/narrative",
|
|
3
|
+
"version": "1.11.0",
|
|
4
|
+
"description": "TypeScript client for the Codebolt Narrative Engine",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"build:native": "node ../codeboltNarrative/scripts/build-platform-pkg.js",
|
|
10
|
+
"clean": "rm -rf dist"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=16.0.0"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/**/*"
|
|
17
|
+
],
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@codebolt/narrative-darwin-arm64": "1.11.0",
|
|
20
|
+
"@codebolt/narrative-darwin-x64": "1.11.0",
|
|
21
|
+
"@codebolt/narrative-linux-x64": "1.11.0",
|
|
22
|
+
"@codebolt/narrative-linux-arm64": "1.11.0",
|
|
23
|
+
"@codebolt/narrative-win32-x64": "1.11.0"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT"
|
|
26
|
+
}
|