@anhlp/alp-protocol 0.0.0-stage → 0.0.1-beta.4
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 +7 -0
- package/README.md +16 -2
- package/conformance/cases.json +951 -0
- package/conformance/run.d.mts +32 -0
- package/conformance/run.mjs +403 -0
- package/dist/connection.d.ts +13 -0
- package/dist/connection.js +0 -0
- package/dist/contract-v1.d.ts +8783 -0
- package/dist/contract-v1.js +5 -0
- package/dist/contract.d.ts +25 -0
- package/dist/contract.js +28 -0
- package/dist/dto.d.ts +104 -0
- package/dist/dto.js +0 -0
- package/dist/events.d.ts +354 -0
- package/dist/events.js +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2 -0
- package/dist/public.d.ts +1 -0
- package/dist/public.js +2 -0
- package/dist/rpc.d.ts +1210 -0
- package/dist/rpc.js +0 -0
- package/dist/schedule.d.ts +43 -0
- package/dist/schedule.js +0 -0
- package/dist/session.d.ts +285 -0
- package/dist/session.js +0 -0
- package/dist/validate.d.ts +12 -0
- package/dist/validate.js +151 -0
- package/dist/wire.d.ts +192 -0
- package/dist/wire.js +137 -0
- package/fixtures/ipc-v1.jsonl +4 -0
- package/fixtures/v1/cases.json +7166 -0
- package/package.json +127 -4
- package/schema/ipc-v1.json +3271 -0
- package/schema/methods-v1.json +8678 -0
- package/src/connection.ts +13 -0
- package/src/contract-v1.js +2 -0
- package/src/contract.js +44 -0
- package/src/dto.ts +78 -0
- package/src/events.ts +207 -0
- package/src/index.ts +7 -0
- package/src/public.js +2 -0
- package/src/rpc.ts +272 -0
- package/src/schedule.ts +43 -0
- package/src/session.ts +213 -0
- package/src/validate.js +115 -0
- package/src/wire.js +213 -0
package/dist/dto.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export type RuntimeKind = 'codex' | 'claude' | 'acp' | 'antigravity';
|
|
2
|
+
export type MailKind = 'question' | 'answer' | 'note' | 'steer' | 'result' | 'stalled' | 'board' | 'checkin';
|
|
3
|
+
export type MailEvent = {
|
|
4
|
+
id: string;
|
|
5
|
+
kind: MailKind;
|
|
6
|
+
from: string;
|
|
7
|
+
assignment: string;
|
|
8
|
+
body?: string;
|
|
9
|
+
replyTo?: string;
|
|
10
|
+
result?: Record<string, unknown>;
|
|
11
|
+
redelivered?: boolean;
|
|
12
|
+
/** Informational; never steers or wakes a session by itself. */
|
|
13
|
+
passive?: boolean;
|
|
14
|
+
/** Delivered between turns, never steered into a running one or taken by alp_wait. */
|
|
15
|
+
defer?: boolean;
|
|
16
|
+
/** Turn that received the event; acknowledged when that turn completes. */
|
|
17
|
+
deliveredTurn?: string;
|
|
18
|
+
};
|
|
19
|
+
export type PinKind = 'claim' | 'decision' | 'finding';
|
|
20
|
+
export type Pin = {
|
|
21
|
+
id: string;
|
|
22
|
+
/** The project root the board belongs to. */
|
|
23
|
+
project: string;
|
|
24
|
+
kind: PinKind;
|
|
25
|
+
body: string;
|
|
26
|
+
/** Project-relative files or directories, or absolute paths in an external write root; required for claims. */
|
|
27
|
+
paths?: string[];
|
|
28
|
+
agent: string;
|
|
29
|
+
sessionId: string;
|
|
30
|
+
rootId: string;
|
|
31
|
+
at: string;
|
|
32
|
+
/** When a claim ended, or any pin was taken down. */
|
|
33
|
+
released?: string;
|
|
34
|
+
/** The task the claiming assignment works on. */
|
|
35
|
+
task?: string;
|
|
36
|
+
};
|
|
37
|
+
/** A project's task as task screens show it (schema/methods-v1.json `taskRow`). */
|
|
38
|
+
export type TaskRow = {
|
|
39
|
+
id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
type: string;
|
|
42
|
+
priority: number;
|
|
43
|
+
status: 'open' | 'in_progress' | 'review' | 'closed';
|
|
44
|
+
/** Changes with every write; task.update and task.gate.resolve refuse an older one given as `ifRev`. */
|
|
45
|
+
rev: number;
|
|
46
|
+
parent?: string;
|
|
47
|
+
assignee?: string;
|
|
48
|
+
ready: boolean;
|
|
49
|
+
blockedBy?: string[];
|
|
50
|
+
waits?: string[];
|
|
51
|
+
approvals?: Array<{
|
|
52
|
+
gate: string;
|
|
53
|
+
note: string;
|
|
54
|
+
}>;
|
|
55
|
+
handoff?: {
|
|
56
|
+
outcome: string;
|
|
57
|
+
summary: string;
|
|
58
|
+
agent?: string;
|
|
59
|
+
};
|
|
60
|
+
closed?: {
|
|
61
|
+
reason: string;
|
|
62
|
+
summary?: string;
|
|
63
|
+
at: string;
|
|
64
|
+
};
|
|
65
|
+
description?: string;
|
|
66
|
+
labels?: string[];
|
|
67
|
+
paths?: string[];
|
|
68
|
+
progress?: {
|
|
69
|
+
done: number;
|
|
70
|
+
total: number;
|
|
71
|
+
};
|
|
72
|
+
createdAt?: string;
|
|
73
|
+
updatedAt: string;
|
|
74
|
+
};
|
|
75
|
+
export type LibraryKind = 'agents' | 'skills' | 'mcp' | 'hooks' | 'teams' | 'providers';
|
|
76
|
+
export type LibraryScope = 'library' | 'project';
|
|
77
|
+
export type LibrarySource = 'builtin' | 'library' | 'project';
|
|
78
|
+
/** Letters, digits, '.', '_' or '-', not '.' or '..'. */
|
|
79
|
+
export type EntryName = string;
|
|
80
|
+
export type LibraryEntryRow = {
|
|
81
|
+
name: string;
|
|
82
|
+
source: LibrarySource;
|
|
83
|
+
overrides?: LibrarySource;
|
|
84
|
+
description?: string;
|
|
85
|
+
usedBy?: string[];
|
|
86
|
+
};
|
|
87
|
+
export type TeamRow = {
|
|
88
|
+
id: string;
|
|
89
|
+
label?: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
source: LibrarySource;
|
|
92
|
+
overrides?: LibrarySource;
|
|
93
|
+
error?: string;
|
|
94
|
+
};
|
|
95
|
+
/** language null: unset, so `default` applies. */
|
|
96
|
+
export type LanguageSetting = {
|
|
97
|
+
language: string | null;
|
|
98
|
+
applies: string;
|
|
99
|
+
default: string;
|
|
100
|
+
};
|
|
101
|
+
/** Stands for a stored secret in library.get content; sent back in library.save it keeps the stored value. */
|
|
102
|
+
export type SecretMarker = {
|
|
103
|
+
$secret: 'keep';
|
|
104
|
+
};
|
package/dist/dto.js
ADDED
|
File without changes
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import type { RuntimeKind, MailEvent, Pin } from './dto.js';
|
|
2
|
+
/** Provider-neutral session events (plans/reference/ALPD.md §4). Viewers project them; the runtime never imports a viewer. */
|
|
3
|
+
/** `code: 'outcome_unknown'` when the provider may or may not have received the request (ALPD §66). */
|
|
4
|
+
export type AlpError = {
|
|
5
|
+
message: string;
|
|
6
|
+
code?: string;
|
|
7
|
+
};
|
|
8
|
+
export type TimelineItem = {
|
|
9
|
+
kind: 'user_message';
|
|
10
|
+
id: string;
|
|
11
|
+
text: string;
|
|
12
|
+
clientMessageId?: string; /** How many images the message carried; their data is not replayed. */
|
|
13
|
+
images?: number;
|
|
14
|
+
/** Files attached to the message (capability `attachments`, §12.6): ids, display names, types and sizes, never a host path. */
|
|
15
|
+
attachments?: Array<{
|
|
16
|
+
attachmentId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
mimeType: string;
|
|
19
|
+
size: number;
|
|
20
|
+
}>;
|
|
21
|
+
/** Who wrote it: the user, or ALP itself (mail, a brief, a resume); absent when the runtime cannot tell. Only the user's words name a root (ALPD §15). */
|
|
22
|
+
origin?: TurnOrigin;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'assistant_message';
|
|
25
|
+
id: string;
|
|
26
|
+
text: string;
|
|
27
|
+
}
|
|
28
|
+
/** Something about ALP as a whole the user should see, such as a usage limit or a pause (ALPD §29). */
|
|
29
|
+
| {
|
|
30
|
+
kind: 'notice';
|
|
31
|
+
id: string;
|
|
32
|
+
level: 'info' | 'warning' | 'error';
|
|
33
|
+
text: string;
|
|
34
|
+
}
|
|
35
|
+
/** The runtime compacting the session's context (ALPD §57). */
|
|
36
|
+
| {
|
|
37
|
+
kind: 'compaction';
|
|
38
|
+
id: string;
|
|
39
|
+
status: 'running' | 'completed' | 'failed';
|
|
40
|
+
trigger?: 'auto' | 'manual';
|
|
41
|
+
preTokens?: number;
|
|
42
|
+
postTokens?: number;
|
|
43
|
+
}
|
|
44
|
+
/** The tasks a root's tree created or worked on (plans/reference/ALPD.md §21). */
|
|
45
|
+
| {
|
|
46
|
+
kind: 'todo';
|
|
47
|
+
id: string;
|
|
48
|
+
items: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
text: string;
|
|
51
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
52
|
+
}>;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'tool_call';
|
|
55
|
+
id: string;
|
|
56
|
+
callId: string;
|
|
57
|
+
name: string;
|
|
58
|
+
status: 'running' | 'completed' | 'failed';
|
|
59
|
+
error?: string;
|
|
60
|
+
detail: ToolCallDetail;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* What a tool call did, typed by kind (ALPD §4.2), in the shapes of Paseo's ToolCallDetail.
|
|
64
|
+
* `shell` is a command; `unknown` the fallback with the tool's raw input and output. The typed
|
|
65
|
+
* kinds between come from the runtime's own tools; filePath is the path the runtime reported.
|
|
66
|
+
* The runtime clips each string field of a typed detail (not shell, not unknown) to 65,536
|
|
67
|
+
* characters, filePaths to 200 entries and webResults to 50. A receiver shows a detail whose
|
|
68
|
+
* type it does not know as unknown: new types may be added within v1.
|
|
69
|
+
*/
|
|
70
|
+
export type ToolCallDetail = {
|
|
71
|
+
type: 'shell';
|
|
72
|
+
command: string;
|
|
73
|
+
cwd?: string;
|
|
74
|
+
output: string;
|
|
75
|
+
exitCode?: number | null;
|
|
76
|
+
} | {
|
|
77
|
+
type: 'read';
|
|
78
|
+
filePath: string;
|
|
79
|
+
content?: string;
|
|
80
|
+
offset?: number;
|
|
81
|
+
limit?: number;
|
|
82
|
+
} | {
|
|
83
|
+
type: 'edit';
|
|
84
|
+
filePath: string;
|
|
85
|
+
oldString?: string;
|
|
86
|
+
newString?: string;
|
|
87
|
+
unifiedDiff?: string;
|
|
88
|
+
} | {
|
|
89
|
+
type: 'write';
|
|
90
|
+
filePath: string;
|
|
91
|
+
content?: string;
|
|
92
|
+
} | {
|
|
93
|
+
type: 'search';
|
|
94
|
+
query: string;
|
|
95
|
+
toolName?: 'search' | 'grep' | 'glob' | 'web_search';
|
|
96
|
+
content?: string;
|
|
97
|
+
filePaths?: string[];
|
|
98
|
+
webResults?: Array<{
|
|
99
|
+
title: string;
|
|
100
|
+
url: string;
|
|
101
|
+
}>;
|
|
102
|
+
numFiles?: number;
|
|
103
|
+
numMatches?: number;
|
|
104
|
+
truncated?: boolean;
|
|
105
|
+
} | {
|
|
106
|
+
type: 'fetch';
|
|
107
|
+
url: string;
|
|
108
|
+
prompt?: string;
|
|
109
|
+
result?: string;
|
|
110
|
+
code?: number;
|
|
111
|
+
} | {
|
|
112
|
+
type: 'sub_agent';
|
|
113
|
+
subAgentType?: string;
|
|
114
|
+
description?: string;
|
|
115
|
+
log?: string;
|
|
116
|
+
} | {
|
|
117
|
+
type: 'plan';
|
|
118
|
+
text: string;
|
|
119
|
+
} | {
|
|
120
|
+
type: 'plain_text';
|
|
121
|
+
label?: string;
|
|
122
|
+
text?: string;
|
|
123
|
+
} | {
|
|
124
|
+
type: 'unknown';
|
|
125
|
+
input: unknown;
|
|
126
|
+
output: unknown;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* How much a session has used, from its runtime's latest token report (ALPD §57), as Paseo's
|
|
130
|
+
* AgentUsage: the context window's fill, the latest model response's tokens, and the session's
|
|
131
|
+
* cost when the runtime says it. A field the runtime does not report is absent; a later report
|
|
132
|
+
* replaces the fields it carries and keeps the others.
|
|
133
|
+
*/
|
|
134
|
+
export type SessionUsage = {
|
|
135
|
+
/** Tokens the context holds now: the latest model call's input and output. */
|
|
136
|
+
contextWindowUsedTokens?: number;
|
|
137
|
+
/** The context window, once the runtime has said what it is. */
|
|
138
|
+
contextWindowMaxTokens?: number;
|
|
139
|
+
/** The latest model response's input tokens, of which cachedInputTokens came from cache, and output tokens. */
|
|
140
|
+
inputTokens?: number;
|
|
141
|
+
cachedInputTokens?: number;
|
|
142
|
+
outputTokens?: number;
|
|
143
|
+
/** The session's cost in US dollars so far, as the runtime counts it (Claude, or ACP in USD). */
|
|
144
|
+
totalCostUsd?: number;
|
|
145
|
+
};
|
|
146
|
+
export type SessionSnapshot = {
|
|
147
|
+
id: string;
|
|
148
|
+
projectRoot: string;
|
|
149
|
+
agent: string;
|
|
150
|
+
runtime: RuntimeKind;
|
|
151
|
+
model: string;
|
|
152
|
+
mode: string;
|
|
153
|
+
thinking: string;
|
|
154
|
+
workflow: {
|
|
155
|
+
mode: string;
|
|
156
|
+
maxPeers: number;
|
|
157
|
+
supervisor: boolean;
|
|
158
|
+
};
|
|
159
|
+
/** The label of the session's team, such as Phở (ALPD §42); absent for a custom graph. */
|
|
160
|
+
teamLabel?: string;
|
|
161
|
+
threadId: string;
|
|
162
|
+
/** The native thread is kept and the session can be resumed. */
|
|
163
|
+
persistent: boolean;
|
|
164
|
+
parentId?: string;
|
|
165
|
+
/** The requester's tool call that started this assignment. */
|
|
166
|
+
toolCallId?: string;
|
|
167
|
+
activeTurnId?: string;
|
|
168
|
+
/** A turn, an assignment, a child, or undelivered mail keeps the session working. */
|
|
169
|
+
busy: boolean;
|
|
170
|
+
/** Why a usage limit or a pause parked this assignment (ALPD §29). */
|
|
171
|
+
parked?: string;
|
|
172
|
+
/** A digest of the instructions the session runs with (ALPD §34). */
|
|
173
|
+
instructionsSha?: string;
|
|
174
|
+
/** The session's runtime takes images in session.prompt (capability `prompt.images`); absent means it does not. */
|
|
175
|
+
promptImages?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* How the session's runtime can use files attached in session.prompt (§12.6): `file.path` (its tools
|
|
178
|
+
* read a staged read-only copy), `document.native`, `text.extract`. Absent: it takes no attachment parts.
|
|
179
|
+
*/
|
|
180
|
+
promptAttachments?: Array<'file.path' | 'document.native' | 'text.extract'>;
|
|
181
|
+
/** The latest usage the session's runtime reported (ALPD §57); absent before its first report. */
|
|
182
|
+
usage?: SessionUsage;
|
|
183
|
+
};
|
|
184
|
+
export type AssignmentSnapshot = {
|
|
185
|
+
id: string;
|
|
186
|
+
agent: string;
|
|
187
|
+
mode: string;
|
|
188
|
+
status: string;
|
|
189
|
+
startedAt: string;
|
|
190
|
+
/** An isolated assignment's branch and working directory. */
|
|
191
|
+
worktree?: {
|
|
192
|
+
branch: string;
|
|
193
|
+
path: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
/** runtime: a turn the native runtime started by itself, such as Claude after a background task ended. */
|
|
197
|
+
export type TurnOrigin = 'user' | 'wake' | 'assignment' | 'runtime';
|
|
198
|
+
/**
|
|
199
|
+
* A root's turn that ended while nobody looked (Paseo's attention): `finished` for a completed turn,
|
|
200
|
+
* `error` for a failed one. alpd keeps it for every client until one acknowledges it or the root
|
|
201
|
+
* starts another turn (docs/protocol/alp-json-rpc-v1.md §12.2).
|
|
202
|
+
*/
|
|
203
|
+
export type TurnAttention = {
|
|
204
|
+
reason: 'finished' | 'error';
|
|
205
|
+
at: string;
|
|
206
|
+
turnId?: string;
|
|
207
|
+
message?: string;
|
|
208
|
+
};
|
|
209
|
+
/** A question an agent asked the user with alp_ask to: "user". */
|
|
210
|
+
export type UserQuestion = {
|
|
211
|
+
id: string;
|
|
212
|
+
sessionId: string;
|
|
213
|
+
rootId: string;
|
|
214
|
+
agent: string;
|
|
215
|
+
body: string;
|
|
216
|
+
options?: string[];
|
|
217
|
+
askedAt: string;
|
|
218
|
+
};
|
|
219
|
+
export type SessionState = 'running' | 'waiting' | 'waiting_parent' | 'waiting_user' | 'idle';
|
|
220
|
+
/** A live tree at one moment, for dashboards (plans/reference/ALPD.md §17). */
|
|
221
|
+
export type TreeStatus = {
|
|
222
|
+
rootId: string;
|
|
223
|
+
sessions: Array<SessionSnapshot & {
|
|
224
|
+
state: SessionState;
|
|
225
|
+
idleMs: number;
|
|
226
|
+
workdir: string;
|
|
227
|
+
unreadMail: number;
|
|
228
|
+
}>;
|
|
229
|
+
assignments: Array<AssignmentSnapshot & {
|
|
230
|
+
requester: string;
|
|
231
|
+
isolation: 'shared' | 'worktree';
|
|
232
|
+
idleMs: number;
|
|
233
|
+
}>;
|
|
234
|
+
questions: UserQuestion[];
|
|
235
|
+
/** Finished worktree assignments waiting for alp_merge or alp_discard. */
|
|
236
|
+
worktrees: Array<{
|
|
237
|
+
assignmentId: string;
|
|
238
|
+
requester: string;
|
|
239
|
+
agent: string;
|
|
240
|
+
branch: string;
|
|
241
|
+
files: string[];
|
|
242
|
+
stat: string;
|
|
243
|
+
}>;
|
|
244
|
+
leases: Array<{
|
|
245
|
+
checkout: string;
|
|
246
|
+
assignmentId: string;
|
|
247
|
+
agent: string;
|
|
248
|
+
}>;
|
|
249
|
+
/** Live claims on the project board held by this tree's sessions. */
|
|
250
|
+
claims: Pin[];
|
|
251
|
+
};
|
|
252
|
+
export type AlpEvent = {
|
|
253
|
+
type: 'session.opened';
|
|
254
|
+
session: SessionSnapshot;
|
|
255
|
+
cwd: string;
|
|
256
|
+
effective: {
|
|
257
|
+
model: string;
|
|
258
|
+
thinking: string;
|
|
259
|
+
};
|
|
260
|
+
} | {
|
|
261
|
+
type: 'session.ready';
|
|
262
|
+
}
|
|
263
|
+
/** `title` comes with alpd's announcement of a root's name (its first prompt, or `session.rename`). */
|
|
264
|
+
| {
|
|
265
|
+
type: 'session.updated';
|
|
266
|
+
session: SessionSnapshot & {
|
|
267
|
+
title?: string;
|
|
268
|
+
};
|
|
269
|
+
} | {
|
|
270
|
+
type: 'session.closed';
|
|
271
|
+
} | {
|
|
272
|
+
type: 'session.failed';
|
|
273
|
+
error: AlpError;
|
|
274
|
+
} | {
|
|
275
|
+
type: 'prompt.accepted';
|
|
276
|
+
clientMessageId: string;
|
|
277
|
+
result: 'turn' | 'steer';
|
|
278
|
+
turnId: string;
|
|
279
|
+
} | {
|
|
280
|
+
type: 'prompt.failed';
|
|
281
|
+
clientMessageId: string;
|
|
282
|
+
error: AlpError;
|
|
283
|
+
} | {
|
|
284
|
+
type: 'turn.started';
|
|
285
|
+
turnId: string;
|
|
286
|
+
origin: TurnOrigin;
|
|
287
|
+
} | {
|
|
288
|
+
type: 'turn.ended';
|
|
289
|
+
turnId: string;
|
|
290
|
+
state: 'completed' | 'failed' | 'canceled';
|
|
291
|
+
error?: AlpError;
|
|
292
|
+
} | {
|
|
293
|
+
type: 'item';
|
|
294
|
+
item: TimelineItem;
|
|
295
|
+
}
|
|
296
|
+
/** The session's usage changed: the whole latest SessionUsage, not a delta (ALPD §57). */
|
|
297
|
+
| {
|
|
298
|
+
type: 'usage';
|
|
299
|
+
usage: SessionUsage;
|
|
300
|
+
} | {
|
|
301
|
+
type: 'mail';
|
|
302
|
+
mail: Omit<MailEvent, 'passive' | 'deliveredTurn'>;
|
|
303
|
+
} | {
|
|
304
|
+
type: 'assignment';
|
|
305
|
+
assignment: AssignmentSnapshot;
|
|
306
|
+
} | {
|
|
307
|
+
type: 'question';
|
|
308
|
+
question: UserQuestion;
|
|
309
|
+
} | {
|
|
310
|
+
type: 'question.resolved';
|
|
311
|
+
questionId: string;
|
|
312
|
+
outcome: 'answered' | 'dismissed' | 'timeout' | 'canceled';
|
|
313
|
+
answer?: string;
|
|
314
|
+
}
|
|
315
|
+
/** Emitted on the session that pinned it (plans/reference/ALPD.md §18). */
|
|
316
|
+
| {
|
|
317
|
+
type: 'pin';
|
|
318
|
+
pin: Pin;
|
|
319
|
+
} | {
|
|
320
|
+
type: 'unpin';
|
|
321
|
+
pinId: string;
|
|
322
|
+
reason: 'unpinned' | 'session_ended';
|
|
323
|
+
}
|
|
324
|
+
/** A root's attention set, or cleared when absent: sent only to `question.watch { attention: true }` connections, never kept. */
|
|
325
|
+
| {
|
|
326
|
+
type: 'attention';
|
|
327
|
+
attention?: TurnAttention;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The root's conversation was rewound (capability `session.rewind`, §12.7): history pages and cursors of
|
|
331
|
+
* the earlier generation are stale. Sent to attached connections only, never kept: drop the cached
|
|
332
|
+
* history, fetch a new tail and attach again with this generation.
|
|
333
|
+
*/
|
|
334
|
+
| {
|
|
335
|
+
type: 'history.reset';
|
|
336
|
+
generation: string;
|
|
337
|
+
reason: 'rewind';
|
|
338
|
+
branchId: string;
|
|
339
|
+
};
|
|
340
|
+
export type Envelope = {
|
|
341
|
+
sessionId: string;
|
|
342
|
+
/** Random per runtime instance; a cursor from another epoch is stale. */
|
|
343
|
+
epoch: string;
|
|
344
|
+
/** Strictly increasing per session. */
|
|
345
|
+
seq: number;
|
|
346
|
+
/**
|
|
347
|
+
* Position in its tree's stored timeline, set by alpd on the events it keeps: strictly
|
|
348
|
+
* increasing per root across restarts, so `session.attach { after }` replays only what
|
|
349
|
+
* a reconnecting client missed (ALPD §66).
|
|
350
|
+
*/
|
|
351
|
+
cursor?: number;
|
|
352
|
+
ts: string;
|
|
353
|
+
event: AlpEvent;
|
|
354
|
+
};
|
package/dist/events.js
ADDED
|
File without changes
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/public.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./wire.js";
|
package/dist/public.js
ADDED