pi-gentic 0.1.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 +499 -0
- package/dist/commands.d.ts +93 -0
- package/dist/commands.js +422 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.js +407 -0
- package/dist/core.d.ts +19 -0
- package/dist/core.js +125 -0
- package/dist/extension.d.ts +2 -0
- package/dist/extension.js +476 -0
- package/dist/orchestrator.d.ts +277 -0
- package/dist/orchestrator.js +633 -0
- package/dist/policy.d.ts +43 -0
- package/dist/policy.js +136 -0
- package/dist/prompt.d.ts +12 -0
- package/dist/prompt.js +226 -0
- package/dist/runs.d.ts +99 -0
- package/dist/runs.js +540 -0
- package/dist/runtime.d.ts +127 -0
- package/dist/runtime.js +360 -0
- package/dist/sessions.d.ts +56 -0
- package/dist/sessions.js +487 -0
- package/dist/ui.d.ts +108 -0
- package/dist/ui.js +957 -0
- package/dist/worktrees.d.ts +1 -0
- package/dist/worktrees.js +86 -0
- package/docs/assets/error-card.png +0 -0
- package/docs/assets/load-agent.png +0 -0
- package/docs/assets/orchestration-tree.png +0 -0
- package/docs/assets/send-background.png +0 -0
- package/docs/assets/send-foreground.png +0 -0
- package/package.json +58 -0
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime integration with Pi.
|
|
3
|
+
*
|
|
4
|
+
* This module owns live session hosts, background runtime lookup, recursive
|
|
5
|
+
* abort wiring, and the prototype bridges needed to resume live sessions.
|
|
6
|
+
*/
|
|
7
|
+
import { homedir } from "node:os";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
10
|
+
import { defaultAgentDir } from "./config.js";
|
|
11
|
+
let peerModule;
|
|
12
|
+
/** Resolves Pi peer APIs from tests, local installs, or Pi managed installs. */
|
|
13
|
+
async function piCodingAgent() {
|
|
14
|
+
const managedCli = path.join(homedir(), "AppData", "Local", "pi-managed", "node_modules", "@earendil-works", "pi-coding-agent", "dist", "cli.js");
|
|
15
|
+
const indexFiles = [process.env.PI_CLI, process.argv[1], managedCli]
|
|
16
|
+
.filter(Boolean)
|
|
17
|
+
.map((file) => path.join(path.dirname(String(file)), "index.js"));
|
|
18
|
+
peerModule ??= importFirst([
|
|
19
|
+
"@earendil-works/pi-coding-agent",
|
|
20
|
+
...indexFiles.map((file) => pathToFileURL(file).href),
|
|
21
|
+
]);
|
|
22
|
+
return peerModule;
|
|
23
|
+
}
|
|
24
|
+
async function importFirst(specifiers) {
|
|
25
|
+
for (const specifier of specifiers) {
|
|
26
|
+
try {
|
|
27
|
+
return (await import(specifier));
|
|
28
|
+
}
|
|
29
|
+
catch { }
|
|
30
|
+
}
|
|
31
|
+
return (await import("@earendil-works/pi-coding-agent"));
|
|
32
|
+
}
|
|
33
|
+
const LIVE_RUNTIME_STATE_KEY = Symbol.for("pi-gentic.live-runtime-state");
|
|
34
|
+
export function getLiveRuntimeState() {
|
|
35
|
+
return (globalThis[LIVE_RUNTIME_STATE_KEY] ??= {
|
|
36
|
+
liveRuntimes: new Map(),
|
|
37
|
+
hostSwitchSession: undefined,
|
|
38
|
+
hostAbortSession: undefined,
|
|
39
|
+
hostSetupKeyHandlers: undefined,
|
|
40
|
+
activeContext: undefined,
|
|
41
|
+
activeSession: undefined,
|
|
42
|
+
bridgeInstalled: false,
|
|
43
|
+
abortBridgeInstalled: false,
|
|
44
|
+
escapeBridgeInstalled: false,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const activeCalls = new Map();
|
|
48
|
+
let nextCallId = 0;
|
|
49
|
+
export function registerAgentCall(call) {
|
|
50
|
+
const id = call.id ?? `agent-call:${++nextCallId}`;
|
|
51
|
+
activeCalls.set(id, { ...call, id, startedAt: Date.now() });
|
|
52
|
+
return {
|
|
53
|
+
id,
|
|
54
|
+
unregister: () => activeCalls.delete(id),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function hasAgentCallsForSession(sessionId) {
|
|
58
|
+
return activeCallsForSession(sessionId).length > 0;
|
|
59
|
+
}
|
|
60
|
+
export async function abortAgentCall(callId, options = {}) {
|
|
61
|
+
return abortCalls([activeCalls.get(callId)].filter(Boolean), options);
|
|
62
|
+
}
|
|
63
|
+
export async function abortAgentCallsForSession(sessionId, options = {}) {
|
|
64
|
+
return abortCalls(activeCallsForSession(sessionId), options);
|
|
65
|
+
}
|
|
66
|
+
function activeCallsForSession(sessionId) {
|
|
67
|
+
return [...activeCalls.values()].filter((call) => call.callerSessionId === sessionId);
|
|
68
|
+
}
|
|
69
|
+
async function abortCalls(calls, options = {}) {
|
|
70
|
+
const state = isAbortState(options.state)
|
|
71
|
+
? options.state
|
|
72
|
+
: { sessions: new Set(), calls: new Set() };
|
|
73
|
+
let aborted = 0;
|
|
74
|
+
for (const call of calls) {
|
|
75
|
+
if (!call || state.calls.has(call.id))
|
|
76
|
+
continue;
|
|
77
|
+
state.calls.add(call.id);
|
|
78
|
+
if (call.targetSessionId && !state.sessions.has(call.targetSessionId)) {
|
|
79
|
+
state.sessions.add(call.targetSessionId);
|
|
80
|
+
aborted += await abortAgentCallsForSession(call.targetSessionId, {
|
|
81
|
+
...options,
|
|
82
|
+
state,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (typeof call.abort === "function") {
|
|
86
|
+
await call.abort(options);
|
|
87
|
+
aborted += 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return aborted;
|
|
91
|
+
}
|
|
92
|
+
function isAbortState(value) {
|
|
93
|
+
return (typeof value === "object" &&
|
|
94
|
+
value !== null &&
|
|
95
|
+
value.sessions instanceof Set &&
|
|
96
|
+
value.calls instanceof Set);
|
|
97
|
+
}
|
|
98
|
+
export const LIVE_SESSION_PREFIX = "pi-gentic-live:";
|
|
99
|
+
/** Installs bridge hooks once so live background sessions can be resumed in Pi. */
|
|
100
|
+
export function installLiveSessionBridge() {
|
|
101
|
+
const state = getLiveRuntimeState();
|
|
102
|
+
void piCodingAgent().then((peer) => {
|
|
103
|
+
installRuntimeSwitchBridge(state, peer);
|
|
104
|
+
installSessionAbortBridge(state, peer);
|
|
105
|
+
installInteractiveEscapeBridge(state, peer);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function installRuntimeSwitchBridge(state, { AgentSessionRuntime }) {
|
|
109
|
+
if (state.bridgeInstalled)
|
|
110
|
+
return;
|
|
111
|
+
state.bridgeInstalled = true;
|
|
112
|
+
state.hostSwitchSession = AgentSessionRuntime.prototype.switchSession;
|
|
113
|
+
AgentSessionRuntime.prototype.switchSession =
|
|
114
|
+
async function switchSessionWithLiveRuntime(sessionPath, options) {
|
|
115
|
+
const switchOptions = withVisibleContextTracking(state, this, options);
|
|
116
|
+
if (typeof sessionPath !== "string" ||
|
|
117
|
+
!sessionPath.startsWith(LIVE_SESSION_PREFIX)) {
|
|
118
|
+
const restore = parkCurrentLiveRuntimeForSwitch(state, this);
|
|
119
|
+
try {
|
|
120
|
+
return await state.hostSwitchSession?.call(this, sessionPath, switchOptions);
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
restore();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const sessionId = sessionPath.slice(LIVE_SESSION_PREFIX.length);
|
|
127
|
+
const live = state.liveRuntimes.get(sessionId);
|
|
128
|
+
if (!live)
|
|
129
|
+
throw new Error(`No live pi-gentic session ${sessionId} is available.`);
|
|
130
|
+
const targetSessionFile = live.runtime.session.sessionFile;
|
|
131
|
+
const beforeResult = await this.emitBeforeSwitch("resume", targetSessionFile);
|
|
132
|
+
if (beforeResult.cancelled)
|
|
133
|
+
return beforeResult;
|
|
134
|
+
const restore = parkCurrentLiveRuntimeForSwitch(state, this);
|
|
135
|
+
try {
|
|
136
|
+
await this.teardownCurrent("resume", targetSessionFile);
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
restore();
|
|
140
|
+
}
|
|
141
|
+
this.apply({
|
|
142
|
+
session: live.runtime.session,
|
|
143
|
+
services: live.runtime.services,
|
|
144
|
+
diagnostics: live.runtime.diagnostics,
|
|
145
|
+
modelFallbackMessage: live.runtime.modelFallbackMessage,
|
|
146
|
+
});
|
|
147
|
+
await this.finishSessionReplacement(switchOptions.withSession);
|
|
148
|
+
return { cancelled: false };
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function withVisibleContextTracking(state, runtimeHost, options = {}) {
|
|
152
|
+
const originalWithSession = options.withSession;
|
|
153
|
+
return {
|
|
154
|
+
...options,
|
|
155
|
+
async withSession(nextCtx) {
|
|
156
|
+
state.activeContext = nextCtx;
|
|
157
|
+
state.activeSession = runtimeHost.session;
|
|
158
|
+
if (typeof originalWithSession === "function")
|
|
159
|
+
await originalWithSession(nextCtx);
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
export function activeVisibleContext() {
|
|
164
|
+
return getLiveRuntimeState().activeContext;
|
|
165
|
+
}
|
|
166
|
+
export function activeVisibleSession() {
|
|
167
|
+
return getLiveRuntimeState().activeSession;
|
|
168
|
+
}
|
|
169
|
+
export function parkCurrentLiveRuntimeForSwitch(state, runtimeHost) {
|
|
170
|
+
const session = runtimeHost?.session;
|
|
171
|
+
const sessionId = session?.sessionManager?.getSessionId?.();
|
|
172
|
+
const tracked = sessionId ? getRuntimeSession(sessionId) : undefined;
|
|
173
|
+
const liveRuntime = tracked?.runtimeHost;
|
|
174
|
+
if (!sessionId ||
|
|
175
|
+
session?.isStreaming !== true ||
|
|
176
|
+
!liveRuntime ||
|
|
177
|
+
liveRuntime.session !== session ||
|
|
178
|
+
typeof session.dispose !== "function")
|
|
179
|
+
return () => { };
|
|
180
|
+
const originalDispose = session.dispose;
|
|
181
|
+
const parkedDispose = () => { };
|
|
182
|
+
state.liveRuntimes.set(sessionId, {
|
|
183
|
+
runtime: liveRuntime,
|
|
184
|
+
metadata: { agentName: tracked.agentName },
|
|
185
|
+
});
|
|
186
|
+
session.dispose = parkedDispose;
|
|
187
|
+
return () => {
|
|
188
|
+
if (session.dispose !== parkedDispose)
|
|
189
|
+
return;
|
|
190
|
+
session.dispose = originalDispose;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function installSessionAbortBridge(state, { AgentSession }) {
|
|
194
|
+
if (state.abortBridgeInstalled)
|
|
195
|
+
return;
|
|
196
|
+
state.abortBridgeInstalled = true;
|
|
197
|
+
state.hostAbortSession =
|
|
198
|
+
AgentSession.prototype.abort;
|
|
199
|
+
AgentSession.prototype.abort = async function abortWithPiGenticTargets(...args) {
|
|
200
|
+
await abortAgentCallsForSession(this.sessionManager.getSessionId?.(), {
|
|
201
|
+
actor: "aborted session",
|
|
202
|
+
});
|
|
203
|
+
return state.hostAbortSession?.apply(this, args);
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function installInteractiveEscapeBridge(state, { InteractiveMode }) {
|
|
207
|
+
if (state.escapeBridgeInstalled ||
|
|
208
|
+
!InteractiveMode?.prototype?.setupKeyHandlers)
|
|
209
|
+
return;
|
|
210
|
+
state.escapeBridgeInstalled = true;
|
|
211
|
+
state.hostSetupKeyHandlers = InteractiveMode.prototype.setupKeyHandlers;
|
|
212
|
+
InteractiveMode.prototype.setupKeyHandlers =
|
|
213
|
+
function setupKeyHandlersWithPiGenticAbort(...args) {
|
|
214
|
+
const result = state.hostSetupKeyHandlers?.apply(this, args);
|
|
215
|
+
const nativeEscape = this.defaultEditor?.onEscape;
|
|
216
|
+
if (typeof nativeEscape !== "function")
|
|
217
|
+
return result;
|
|
218
|
+
this.defaultEditor.onEscape = () => {
|
|
219
|
+
const sessionId = this.session?.sessionManager?.getSessionId?.();
|
|
220
|
+
if (sessionId &&
|
|
221
|
+
!this.session?.isStreaming &&
|
|
222
|
+
hasAgentCallsForSession(sessionId)) {
|
|
223
|
+
void abortAgentCallsForSession(sessionId, {
|
|
224
|
+
actor: "caller session",
|
|
225
|
+
});
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
return nativeEscape();
|
|
229
|
+
};
|
|
230
|
+
return result;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
export function livePath(sessionId) {
|
|
234
|
+
return `${LIVE_SESSION_PREFIX}${sessionId}`;
|
|
235
|
+
}
|
|
236
|
+
const state = getLiveRuntimeState();
|
|
237
|
+
/** Creates a Pi AgentSessionRuntime for a background or reopened session. */
|
|
238
|
+
export async function createLiveRuntime({ cwd, sessionManager, }) {
|
|
239
|
+
const { createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, } = await piCodingAgent();
|
|
240
|
+
const agentDir = defaultAgentDir();
|
|
241
|
+
const createRuntime = async (options) => {
|
|
242
|
+
const services = await createAgentSessionServices({
|
|
243
|
+
cwd: options.cwd,
|
|
244
|
+
agentDir: options.agentDir,
|
|
245
|
+
});
|
|
246
|
+
const result = await createAgentSessionFromServices({
|
|
247
|
+
services,
|
|
248
|
+
sessionManager: options.sessionManager,
|
|
249
|
+
sessionStartEvent: options.sessionStartEvent,
|
|
250
|
+
});
|
|
251
|
+
return {
|
|
252
|
+
session: result.session,
|
|
253
|
+
services,
|
|
254
|
+
diagnostics: services.diagnostics,
|
|
255
|
+
modelFallbackMessage: result.modelFallbackMessage,
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
const runtime = await createAgentSessionRuntime(createRuntime, {
|
|
259
|
+
cwd,
|
|
260
|
+
agentDir,
|
|
261
|
+
sessionManager,
|
|
262
|
+
});
|
|
263
|
+
registerLiveRuntime(runtime);
|
|
264
|
+
return runtime;
|
|
265
|
+
}
|
|
266
|
+
export function registerLiveRuntime(runtime, metadata = {}) {
|
|
267
|
+
const sessionId = runtime.session.sessionManager.getSessionId();
|
|
268
|
+
state.liveRuntimes.set(sessionId, { runtime, metadata });
|
|
269
|
+
return livePath(sessionId);
|
|
270
|
+
}
|
|
271
|
+
export function unregisterLiveRuntime(sessionId) {
|
|
272
|
+
state.liveRuntimes.delete(sessionId);
|
|
273
|
+
}
|
|
274
|
+
export function getLiveRuntime(sessionId) {
|
|
275
|
+
return state.liveRuntimes.get(sessionId);
|
|
276
|
+
}
|
|
277
|
+
export function listLiveRuntimes() {
|
|
278
|
+
return [...state.liveRuntimes.entries()].map(([sessionId, value]) => ({
|
|
279
|
+
sessionId,
|
|
280
|
+
...value,
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
283
|
+
const runtimeSessions = new Map();
|
|
284
|
+
export function getRuntimeSession(sessionId) {
|
|
285
|
+
return runtimeSessions.get(sessionId);
|
|
286
|
+
}
|
|
287
|
+
export function findRuntimeSession(predicate) {
|
|
288
|
+
return [...runtimeSessions.values()].find(predicate);
|
|
289
|
+
}
|
|
290
|
+
/** Registers the latest known runtime state for session discovery and status. */
|
|
291
|
+
export function setRuntimeSession(sessionId, runtime) {
|
|
292
|
+
const existing = runtimeSessions.get(sessionId);
|
|
293
|
+
const next = existing ?? runtime;
|
|
294
|
+
Object.assign(next, runtime, { lastSeenAt: Date.now() });
|
|
295
|
+
runtimeSessions.set(sessionId, next);
|
|
296
|
+
pruneRuntimeSessions();
|
|
297
|
+
return next;
|
|
298
|
+
}
|
|
299
|
+
export function updateRuntimeSession(sessionId, patch) {
|
|
300
|
+
const existing = runtimeSessions.get(sessionId);
|
|
301
|
+
if (!existing)
|
|
302
|
+
return undefined;
|
|
303
|
+
return setRuntimeSession(sessionId, { ...existing, ...patch });
|
|
304
|
+
}
|
|
305
|
+
export function listRuntimeSessions() {
|
|
306
|
+
return [...runtimeSessions.values()];
|
|
307
|
+
}
|
|
308
|
+
export function deleteRuntimeSession(sessionId) {
|
|
309
|
+
runtimeSessions.delete(sessionId);
|
|
310
|
+
}
|
|
311
|
+
export function pruneRuntimeSessions({ maxEntries = 100, maxIdleMs = 12 * 60 * 60_000, } = {}) {
|
|
312
|
+
const now = Date.now();
|
|
313
|
+
for (const [sessionId, runtime] of runtimeSessions) {
|
|
314
|
+
const running = runtime.session?.isStreaming === true;
|
|
315
|
+
const lastSeenAt = Number(runtime.lastSeenAt ?? 0);
|
|
316
|
+
if (!running && lastSeenAt && now - lastSeenAt > maxIdleMs)
|
|
317
|
+
runtimeSessions.delete(sessionId);
|
|
318
|
+
}
|
|
319
|
+
const entries = [...runtimeSessions.entries()];
|
|
320
|
+
if (entries.length <= maxEntries)
|
|
321
|
+
return;
|
|
322
|
+
const removable = entries
|
|
323
|
+
.filter(([, runtime]) => runtime.session?.isStreaming !== true)
|
|
324
|
+
.sort(([, a], [, b]) => Number(a.lastSeenAt ?? 0) - Number(b.lastSeenAt ?? 0));
|
|
325
|
+
for (const [sessionId] of removable.slice(0, Math.max(0, entries.length - maxEntries)))
|
|
326
|
+
runtimeSessions.delete(sessionId);
|
|
327
|
+
}
|
|
328
|
+
export function persistSessionImmediately(sessionManager) {
|
|
329
|
+
if (typeof sessionManager._rewriteFile === "function")
|
|
330
|
+
sessionManager._rewriteFile();
|
|
331
|
+
sessionManager.flushed = true;
|
|
332
|
+
}
|
|
333
|
+
export function resolveModelFromRegistry(modelRegistry, modelName) {
|
|
334
|
+
const available = modelRegistry.getAvailable();
|
|
335
|
+
if (modelName.includes("/")) {
|
|
336
|
+
const [provider, id] = modelName.split("/", 2);
|
|
337
|
+
return modelRegistry.find(provider, id);
|
|
338
|
+
}
|
|
339
|
+
return (available.find((model) => model.id === modelName) ??
|
|
340
|
+
available.find((model) => model.id.toLowerCase().includes(modelName.toLowerCase())));
|
|
341
|
+
}
|
|
342
|
+
export function inheritedModelForPolicy(policy, inheritedModel) {
|
|
343
|
+
if (policy?.model || !inheritedModel?.provider || !inheritedModel?.id)
|
|
344
|
+
return undefined;
|
|
345
|
+
return { provider: inheritedModel.provider, id: inheritedModel.id };
|
|
346
|
+
}
|
|
347
|
+
export async function applyInheritedModel(session, policy, inheritedModel) {
|
|
348
|
+
const modelRef = inheritedModelForPolicy(policy, inheritedModel);
|
|
349
|
+
if (!modelRef)
|
|
350
|
+
return undefined;
|
|
351
|
+
const model = session.modelRegistry.find(modelRef.provider, modelRef.id) ??
|
|
352
|
+
inheritedModel;
|
|
353
|
+
if (modelsEqual(session.model, model))
|
|
354
|
+
return model;
|
|
355
|
+
await session.setModel(model);
|
|
356
|
+
return model;
|
|
357
|
+
}
|
|
358
|
+
function modelsEqual(a, b) {
|
|
359
|
+
return a?.provider === b?.provider && a?.id === b?.id;
|
|
360
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Resolves a full id, short id, prefix, substring, or path to one session. */
|
|
2
|
+
export declare function resolveSessionReference(sessions: any, reference: any): any;
|
|
3
|
+
export declare function listSessionSummariesFast(sessionDir: string | undefined): AnyRecord[];
|
|
4
|
+
export declare function cachedPersistedSessions(key: string, load: () => Promise<AnyRecord[]>, maxAgeMs?: number): Promise<any>;
|
|
5
|
+
export declare function warmPersistedSessions(key: string, load: () => Promise<AnyRecord[]>): void;
|
|
6
|
+
export declare function summarizeSession(session: any, options?: AnyRecord): {
|
|
7
|
+
id: any;
|
|
8
|
+
sessionId: any;
|
|
9
|
+
shortId: string;
|
|
10
|
+
path: any;
|
|
11
|
+
parentSessionPath: any;
|
|
12
|
+
name: any;
|
|
13
|
+
firstMessage: any;
|
|
14
|
+
lastMessage: any;
|
|
15
|
+
modified: any;
|
|
16
|
+
agentName: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function enrichSessionSummary(session: any): any;
|
|
19
|
+
export declare function enrichSessionSummaries(sessions: AnyRecord[], limit?: number): any[];
|
|
20
|
+
/** Orders sessions so every child appears directly under its parent. */
|
|
21
|
+
export declare function orderSessionTree(sessions: any): any[];
|
|
22
|
+
export declare function treeSwitchPath(session: any): any;
|
|
23
|
+
export declare function sessionDiscoveryScope(sessions: AnyRecord[], currentSession: AnyRecord, options?: AnyRecord): any;
|
|
24
|
+
export declare function buildSessionTree(currentSession: AnyRecord | undefined, persistedSessions: AnyRecord[], runtimeSessions?: PiRuntimeSession[], options?: AnyRecord): any[];
|
|
25
|
+
export declare function sessionCompletionScope(sessions: AnyRecord[], currentSession: AnyRecord | undefined, options?: AnyRecord): any[];
|
|
26
|
+
export declare function findSessionSummary(sessions: AnyRecord[], identity?: AnyRecord): AnyRecord;
|
|
27
|
+
/** Keeps the current session plus nearby siblings and branch relatives. */
|
|
28
|
+
export declare function filterSessionNeighborhood(sessions: any, currentSession: any, { rx, ry }?: {
|
|
29
|
+
rx?: number;
|
|
30
|
+
ry?: number;
|
|
31
|
+
}): any;
|
|
32
|
+
export declare function orderSessionCompletions(sessions: AnyRecord[], currentSession: AnyRecord | undefined): any[];
|
|
33
|
+
export declare function mergeSessionSummaries(sessions: any): any[];
|
|
34
|
+
export declare function currentSessionSummary(ctx: any): {
|
|
35
|
+
id: any;
|
|
36
|
+
sessionId: any;
|
|
37
|
+
shortId: string;
|
|
38
|
+
path: any;
|
|
39
|
+
parentSessionPath: any;
|
|
40
|
+
agentName: any;
|
|
41
|
+
lastMessage: any;
|
|
42
|
+
modified: string;
|
|
43
|
+
};
|
|
44
|
+
export declare function runtimeSessionSummary(runtime: any): {
|
|
45
|
+
id: any;
|
|
46
|
+
sessionId: any;
|
|
47
|
+
shortId: string;
|
|
48
|
+
path: any;
|
|
49
|
+
parentSessionPath: any;
|
|
50
|
+
agentName: any;
|
|
51
|
+
lastMessage: any;
|
|
52
|
+
modified: any;
|
|
53
|
+
};
|
|
54
|
+
/** Adds live runtime details without changing persisted session summaries. */
|
|
55
|
+
export declare function withRuntimeState(session: any): any;
|
|
56
|
+
export declare function assignTreeDepths(sessions: any): any;
|