@langspan/client 0.0.0-stage → 0.18.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/LICENSE +202 -0
- package/NOTICE +25 -0
- package/README.md +39 -2
- package/dist/commands/admission.d.ts +124 -0
- package/dist/commands/admission.js +4 -0
- package/dist/commands/checks.d.ts +115 -0
- package/dist/commands/checks.js +3 -0
- package/dist/commands/graph.d.ts +119 -0
- package/dist/commands/graph.js +4 -0
- package/dist/commands/index.d.ts +25 -0
- package/dist/commands/index.js +125 -0
- package/dist/commands/notes.d.ts +103 -0
- package/dist/commands/notes.js +3 -0
- package/dist/commands/policy.d.ts +49 -0
- package/dist/commands/policy.js +3 -0
- package/dist/commands/reads.d.ts +105 -0
- package/dist/commands/reads.js +4 -0
- package/dist/commands/remote.d.ts +52 -0
- package/dist/commands/remote.js +3 -0
- package/dist/commands/scans.d.ts +39 -0
- package/dist/commands/scans.js +4 -0
- package/dist/commands/sessions.d.ts +63 -0
- package/dist/commands/sessions.js +3 -0
- package/dist/commands/turns.d.ts +67 -0
- package/dist/commands/turns.js +3 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.js +195 -0
- package/dist/node.d.ts +16 -0
- package/dist/node.js +78 -0
- package/dist/outcomes/admission.d.ts +79 -0
- package/dist/outcomes/admission.js +4 -0
- package/dist/outcomes/checks.d.ts +123 -0
- package/dist/outcomes/checks.js +4 -0
- package/dist/outcomes/graph.d.ts +181 -0
- package/dist/outcomes/graph.js +5 -0
- package/dist/outcomes/index.d.ts +21 -0
- package/dist/outcomes/index.js +126 -0
- package/dist/outcomes/log.d.ts +87 -0
- package/dist/outcomes/log.js +4 -0
- package/dist/outcomes/notes.d.ts +140 -0
- package/dist/outcomes/notes.js +4 -0
- package/dist/outcomes/sessions.d.ts +120 -0
- package/dist/outcomes/sessions.js +3 -0
- package/dist/protocol.d.ts +100 -0
- package/dist/protocol.js +167 -0
- package/dist/records.d.ts +250 -0
- package/dist/records.js +6 -0
- package/dist/values.d.ts +330 -0
- package/dist/values.js +7 -0
- package/package.json +43 -4
package/dist/values.d.ts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Rust `u64` that can exceed `Number.MAX_SAFE_INTEGER`, such as a briefing
|
|
3
|
+
* item's key (`item_key` in `briefing.rs`). Decoding gives a `bigint` above
|
|
4
|
+
* 2^53 and a `number` below; encoding writes either exactly.
|
|
5
|
+
*/
|
|
6
|
+
export type U64 = number | bigint;
|
|
7
|
+
/** A process as the hooks identify it (`sessions.rs`). */
|
|
8
|
+
export interface ProcessIdentity {
|
|
9
|
+
pid: number;
|
|
10
|
+
start_token: string;
|
|
11
|
+
}
|
|
12
|
+
export type LivenessStatus = "alive" | "exited" | "unknown";
|
|
13
|
+
/** One tool call, as its host names it (`sessions.rs`). */
|
|
14
|
+
export interface ToolIdentity {
|
|
15
|
+
operation_id: string;
|
|
16
|
+
source: string;
|
|
17
|
+
tool: string;
|
|
18
|
+
input_digest: string;
|
|
19
|
+
}
|
|
20
|
+
export type PresenceKind = "read" | "search" | "shell";
|
|
21
|
+
export type FileKind = "regular" | "symlink";
|
|
22
|
+
/** A file's version on disk: missing, or its SHA-256 (`admission.rs`). */
|
|
23
|
+
export type FileState = {
|
|
24
|
+
type: "missing";
|
|
25
|
+
} | {
|
|
26
|
+
type: "present";
|
|
27
|
+
digest: string;
|
|
28
|
+
kind?: FileKind;
|
|
29
|
+
};
|
|
30
|
+
export interface ObservedFile {
|
|
31
|
+
path: string;
|
|
32
|
+
state: FileState;
|
|
33
|
+
}
|
|
34
|
+
/** Where in a file an edit lands (`admission.rs`, ADR 0012). */
|
|
35
|
+
export type Region = {
|
|
36
|
+
type: "symbol";
|
|
37
|
+
key: string[];
|
|
38
|
+
digest: string;
|
|
39
|
+
start_line: number;
|
|
40
|
+
end_line: number;
|
|
41
|
+
} | {
|
|
42
|
+
type: "lines";
|
|
43
|
+
start_line: number;
|
|
44
|
+
end_line: number;
|
|
45
|
+
};
|
|
46
|
+
/** The regions of one file, located in the version with `digest`. Also in outcomes. */
|
|
47
|
+
export interface PathRegions {
|
|
48
|
+
path: string;
|
|
49
|
+
digest: string;
|
|
50
|
+
regions: Region[];
|
|
51
|
+
}
|
|
52
|
+
/** A coordinated thing: a file, or a definition in it (`keys.rs`, ADR 0043). */
|
|
53
|
+
export type UnitKey = {
|
|
54
|
+
type: "file";
|
|
55
|
+
path: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: "symbol";
|
|
58
|
+
path: string;
|
|
59
|
+
symbol: string[];
|
|
60
|
+
};
|
|
61
|
+
export type ChangeKind = "body_edit" | "signature_change" | "rename" | "add" | "remove" | "replace";
|
|
62
|
+
/** One key of a tool admission. Hashes are SHA-256 in hexadecimal, or `missing`. */
|
|
63
|
+
export interface KeyedWrite {
|
|
64
|
+
key: UnitKey;
|
|
65
|
+
kind: ChangeKind;
|
|
66
|
+
base_version?: number;
|
|
67
|
+
base_hash: string;
|
|
68
|
+
observed_hash: string;
|
|
69
|
+
renamed_to?: string[];
|
|
70
|
+
}
|
|
71
|
+
/** A key's hash after a completed write. */
|
|
72
|
+
export interface KeyHash {
|
|
73
|
+
key: UnitKey;
|
|
74
|
+
hash: string;
|
|
75
|
+
}
|
|
76
|
+
/** One changed key of a completed write, with the keys enclosing it. */
|
|
77
|
+
export interface KeyReport {
|
|
78
|
+
key: UnitKey;
|
|
79
|
+
kind: ChangeKind;
|
|
80
|
+
hash: string;
|
|
81
|
+
renamed_to?: string[];
|
|
82
|
+
enclosing?: KeyHash[];
|
|
83
|
+
}
|
|
84
|
+
/** A key's recorded version and hash: the next write's base. In outcomes. */
|
|
85
|
+
export interface KeyVersion {
|
|
86
|
+
key: UnitKey;
|
|
87
|
+
version: number;
|
|
88
|
+
hash: string;
|
|
89
|
+
}
|
|
90
|
+
/** A written key whose base is not current: what is now recorded. In outcomes. */
|
|
91
|
+
export interface StaleKey {
|
|
92
|
+
key: UnitKey;
|
|
93
|
+
version: number;
|
|
94
|
+
hash: string;
|
|
95
|
+
outside_report?: boolean;
|
|
96
|
+
changed_by?: string;
|
|
97
|
+
change?: ChangeKind;
|
|
98
|
+
intent?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface Rebased {
|
|
101
|
+
key: UnitKey;
|
|
102
|
+
from_version: number;
|
|
103
|
+
to_version: number;
|
|
104
|
+
kind: ChangeKind;
|
|
105
|
+
session_id?: string;
|
|
106
|
+
/** For a rename the write followed: the key the write now names. */
|
|
107
|
+
rekeyed?: UnitKey;
|
|
108
|
+
}
|
|
109
|
+
export interface LineRange {
|
|
110
|
+
start_line: number;
|
|
111
|
+
end_line: number;
|
|
112
|
+
}
|
|
113
|
+
/** Lines another session wrote recently. Also in outcomes. */
|
|
114
|
+
export interface WrittenLines {
|
|
115
|
+
path: string;
|
|
116
|
+
session_id: string;
|
|
117
|
+
lines: LineRange[];
|
|
118
|
+
age_ms: number;
|
|
119
|
+
}
|
|
120
|
+
export type SourceOrigin = "read" | "write" | "refused" | "snapshot";
|
|
121
|
+
export type ToolResult = "succeeded" | "failed" | "interrupted";
|
|
122
|
+
/** One session's work in a teammate's publication (`remote.rs`). */
|
|
123
|
+
export interface RemoteWork {
|
|
124
|
+
host: string;
|
|
125
|
+
session: string;
|
|
126
|
+
branch_ref: string | null;
|
|
127
|
+
summary: string | null;
|
|
128
|
+
editing: string[];
|
|
129
|
+
recent: string[];
|
|
130
|
+
}
|
|
131
|
+
/** What a workspace publishes to its Git remote. Also in outcomes. */
|
|
132
|
+
export interface Publication {
|
|
133
|
+
participant: string;
|
|
134
|
+
name: string;
|
|
135
|
+
sequence: number;
|
|
136
|
+
work: RemoteWork[];
|
|
137
|
+
withdrawn?: boolean;
|
|
138
|
+
messages?: RemoteMessage[];
|
|
139
|
+
}
|
|
140
|
+
/** A teammate's message as it leaves the machine (ADR 0041). Its text is data, never instructions. */
|
|
141
|
+
export interface RemoteMessage {
|
|
142
|
+
message_id: string;
|
|
143
|
+
from?: string;
|
|
144
|
+
to?: string;
|
|
145
|
+
text: string;
|
|
146
|
+
paths?: string[];
|
|
147
|
+
}
|
|
148
|
+
export type CheckResult = {
|
|
149
|
+
type: "passed";
|
|
150
|
+
} | {
|
|
151
|
+
type: "failed";
|
|
152
|
+
exit_code: number;
|
|
153
|
+
} | {
|
|
154
|
+
type: "inconclusive";
|
|
155
|
+
};
|
|
156
|
+
/** How many arguments a definition takes (`notices.rs`). */
|
|
157
|
+
export interface Arity {
|
|
158
|
+
min: number;
|
|
159
|
+
max: number | null;
|
|
160
|
+
receiver: boolean;
|
|
161
|
+
}
|
|
162
|
+
/** One changed definition of an interface notice (`notices.rs`). */
|
|
163
|
+
export interface InterfaceChange {
|
|
164
|
+
name: string;
|
|
165
|
+
kind: string;
|
|
166
|
+
change: string;
|
|
167
|
+
before: string | null;
|
|
168
|
+
after: string | null;
|
|
169
|
+
after_name?: string;
|
|
170
|
+
before_name?: string;
|
|
171
|
+
evidence?: string;
|
|
172
|
+
before_path?: string;
|
|
173
|
+
private?: boolean;
|
|
174
|
+
before_arity?: Arity;
|
|
175
|
+
after_arity?: Arity;
|
|
176
|
+
before_count?: number;
|
|
177
|
+
after_count?: number;
|
|
178
|
+
}
|
|
179
|
+
/** A call the client found in the text it is about to write. */
|
|
180
|
+
export interface CallSite {
|
|
181
|
+
path: string;
|
|
182
|
+
line: number;
|
|
183
|
+
name: string;
|
|
184
|
+
args: number;
|
|
185
|
+
member: boolean;
|
|
186
|
+
}
|
|
187
|
+
/** The interface change that started a wider check (`checks.rs`). */
|
|
188
|
+
export interface InterfaceCause {
|
|
189
|
+
path: string;
|
|
190
|
+
change: InterfaceChange;
|
|
191
|
+
more_changes?: number;
|
|
192
|
+
dependents: string[];
|
|
193
|
+
more_dependents?: number;
|
|
194
|
+
blind_files?: number;
|
|
195
|
+
}
|
|
196
|
+
/** An automatic check's sessions to tell and its output's end. */
|
|
197
|
+
export interface CheckReport {
|
|
198
|
+
session_ids: string[];
|
|
199
|
+
tail: string;
|
|
200
|
+
timed_out_s?: number;
|
|
201
|
+
interface?: InterfaceCause;
|
|
202
|
+
index_incomplete?: boolean;
|
|
203
|
+
dependent_paths?: string[];
|
|
204
|
+
/** Capability `build_errors` (issue #703). */
|
|
205
|
+
errors?: BuildError[];
|
|
206
|
+
}
|
|
207
|
+
/** An error a failing check's output named at a workspace file (`checks/report.rs`). */
|
|
208
|
+
export interface BuildError {
|
|
209
|
+
path: string;
|
|
210
|
+
line: number;
|
|
211
|
+
message: string;
|
|
212
|
+
}
|
|
213
|
+
/** The tests a check's output named (`flaky.rs`). */
|
|
214
|
+
export interface TestResults {
|
|
215
|
+
failed?: string[];
|
|
216
|
+
passed?: string[];
|
|
217
|
+
skipped?: string[];
|
|
218
|
+
all_passed?: boolean;
|
|
219
|
+
more_failed?: boolean;
|
|
220
|
+
}
|
|
221
|
+
export type SymbolFindingKind = "both_changed" | "changed_and_called" | "removed_and_used";
|
|
222
|
+
export interface SymbolFinding {
|
|
223
|
+
finding: SymbolFindingKind;
|
|
224
|
+
name: string;
|
|
225
|
+
branch: string;
|
|
226
|
+
path: string;
|
|
227
|
+
line: number;
|
|
228
|
+
before: string;
|
|
229
|
+
after?: string;
|
|
230
|
+
renamed_to?: string;
|
|
231
|
+
other_branch: string;
|
|
232
|
+
other_path: string;
|
|
233
|
+
other_line: number;
|
|
234
|
+
other_after?: string;
|
|
235
|
+
args?: number;
|
|
236
|
+
takes?: Arity;
|
|
237
|
+
}
|
|
238
|
+
export interface SymbolFindings {
|
|
239
|
+
findings: SymbolFinding[];
|
|
240
|
+
more: number;
|
|
241
|
+
files_indexed: number;
|
|
242
|
+
files_skipped: number;
|
|
243
|
+
note?: string;
|
|
244
|
+
}
|
|
245
|
+
/** The wider check an automatic check runs after an interface change. */
|
|
246
|
+
export interface WiderCheck {
|
|
247
|
+
name: string;
|
|
248
|
+
argv: string[];
|
|
249
|
+
timeout_s: number;
|
|
250
|
+
}
|
|
251
|
+
/** A commit a landing rewrote. */
|
|
252
|
+
export interface Rewritten {
|
|
253
|
+
from: string;
|
|
254
|
+
to: string;
|
|
255
|
+
}
|
|
256
|
+
/** How a landing waits in line for the push turn. */
|
|
257
|
+
export interface TurnQueueing {
|
|
258
|
+
ticket: string;
|
|
259
|
+
wait_ms: number;
|
|
260
|
+
joined: boolean;
|
|
261
|
+
}
|
|
262
|
+
export type LeftQueue = "cancelled" | "timed_out" | "stopped";
|
|
263
|
+
export type AttemptResult = {
|
|
264
|
+
type: "landed";
|
|
265
|
+
} | {
|
|
266
|
+
type: "moved";
|
|
267
|
+
} | {
|
|
268
|
+
type: "refused";
|
|
269
|
+
} | {
|
|
270
|
+
type: "not_ready";
|
|
271
|
+
} | {
|
|
272
|
+
type: "check_failed";
|
|
273
|
+
} | {
|
|
274
|
+
type: "not_combinable";
|
|
275
|
+
} | {
|
|
276
|
+
type: "nothing_to_land";
|
|
277
|
+
} | {
|
|
278
|
+
type: "error";
|
|
279
|
+
} | {
|
|
280
|
+
type: "push_unknown";
|
|
281
|
+
};
|
|
282
|
+
export interface LandingAttempt {
|
|
283
|
+
target_oid: string | null;
|
|
284
|
+
commit_oid: string | null;
|
|
285
|
+
result: AttemptResult;
|
|
286
|
+
}
|
|
287
|
+
/** What a completed scan did not version (`observation.rs`). */
|
|
288
|
+
export interface ScanCoverage {
|
|
289
|
+
omitted?: number;
|
|
290
|
+
too_large?: number;
|
|
291
|
+
too_large_paths?: string[];
|
|
292
|
+
submodules?: number;
|
|
293
|
+
submodule_paths?: string[];
|
|
294
|
+
skip_worktree?: number;
|
|
295
|
+
}
|
|
296
|
+
/** Where a recap's "since" starts (`since.rs`). */
|
|
297
|
+
export type SinceFrom = {
|
|
298
|
+
kind: "seq";
|
|
299
|
+
seq: number;
|
|
300
|
+
} | {
|
|
301
|
+
kind: "away";
|
|
302
|
+
after_ms: number;
|
|
303
|
+
};
|
|
304
|
+
export type RefusalKind = "conflict" | "stale_base" | "unread_lines" | "commit_held" | "landing_held";
|
|
305
|
+
export type PolicyCase = "advisory" | "conflict" | "stale_base" | "unread_lines" | "commit_held" | "landing_not_ready";
|
|
306
|
+
export type Policy = "advisory" | "wait" | "refuse";
|
|
307
|
+
export type WaitResult = "admitted" | "refused_conflict" | "refused_stale" | "refused_unread" | "refused_unreadable";
|
|
308
|
+
/** A file an ended session edited, for its trail (`trail.rs`). */
|
|
309
|
+
export interface TrailFile {
|
|
310
|
+
path: string;
|
|
311
|
+
lines?: LineRange[];
|
|
312
|
+
more_lines?: boolean;
|
|
313
|
+
}
|
|
314
|
+
export interface TrailFacts {
|
|
315
|
+
edited?: TrailFile[];
|
|
316
|
+
uncommitted?: string[];
|
|
317
|
+
no_task?: boolean;
|
|
318
|
+
partial?: boolean;
|
|
319
|
+
}
|
|
320
|
+
/** A message's target name; `files` is what the coordinator's index found it in. */
|
|
321
|
+
export interface ToSymbol {
|
|
322
|
+
name: string;
|
|
323
|
+
files?: string[];
|
|
324
|
+
}
|
|
325
|
+
/** One piece of planned work: its files and the names it will change. */
|
|
326
|
+
export interface PlanUnit {
|
|
327
|
+
id: string;
|
|
328
|
+
paths?: string[];
|
|
329
|
+
symbols?: string[];
|
|
330
|
+
}
|
package/dist/values.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// The structured values commands carry, and outcomes too where noted. Each
|
|
2
|
+
// type has the name of its Rust type in `crates/langspan-core/src`, and
|
|
3
|
+
// test/rust-source.test.ts checks every struct and plain enum here against
|
|
4
|
+
// it, field by field. A field is optional (`?`) when the Rust field has a
|
|
5
|
+
// serde default or is skipped when empty, and takes `null` when it is an
|
|
6
|
+
// `Option` the coordinator writes as `null`.
|
|
7
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langspan/client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.18.0",
|
|
4
|
+
"description": "A TypeScript client for the LangSpan coordination protocol",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://github.com/Langspan/LangSpan.dev/tree/main/clients/typescript",
|
|
7
|
+
"bugs": "https://github.com/Langspan/LangSpan.dev/issues",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"provenance": true
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/Langspan/LangSpan.dev.git",
|
|
15
|
+
"directory": "clients/typescript"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.18"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/node.d.ts",
|
|
24
|
+
"default": "./dist/node.js"
|
|
25
|
+
},
|
|
26
|
+
"./protocol": {
|
|
27
|
+
"types": "./dist/protocol.d.ts",
|
|
28
|
+
"default": "./dist/protocol.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"NOTICE"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -p tsconfig.build.json",
|
|
37
|
+
"prepack": "npm run build && cp ../../LICENSE ../../NOTICE .",
|
|
38
|
+
"test": "node --test \"test/*.test.ts\"",
|
|
39
|
+
"test:package": "node --test \"test/package/*.test.ts\""
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "22.19.19",
|
|
43
|
+
"typescript": "5.9.3"
|
|
44
|
+
}
|
|
45
|
+
}
|