@fugood/buttress-server 2.25.6 → 2.25.7
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/lib/agent/session-fs.d.ts +3 -42
- package/lib/agent/sessions.d.ts +4 -2
- package/lib/index.mjs +64 -67
- package/package.json +4 -4
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Minimal FileSystem implementation for the jsonl session repo, over node:fs.
|
|
5
|
-
*
|
|
6
|
-
* pi's NodeExecutionEnv classifies fs failures with `error instanceof Error`,
|
|
7
|
-
* which breaks in vm-realm hosts (jest runs test code in a vm context, so
|
|
8
|
-
* node-core errors come from another realm and ENOENT stops mapping to
|
|
9
|
-
* not_found). This implementation reads `error.code` structurally — and also
|
|
10
|
-
* skips pulling the exec-capable execution env into the server for what is
|
|
11
|
-
* purely file storage.
|
|
12
|
-
*/
|
|
13
|
-
type FileResult<T> = Promise<Result<T, FileError>>;
|
|
14
|
-
declare const toFileInfo: (target: string, stats: import('node:fs').Stats) => {
|
|
15
|
-
name: string;
|
|
16
|
-
path: string;
|
|
17
|
-
kind: "directory" | "file" | "symlink";
|
|
18
|
-
size: number;
|
|
19
|
-
mtimeMs: number;
|
|
20
|
-
};
|
|
21
|
-
/** The `Pick<FileSystem, …>` surface JsonlSessionRepo requires. */
|
|
22
|
-
export declare const createSessionFs: (rootDir: string) => {
|
|
23
|
-
absolutePath: (target: string) => FileResult<string>;
|
|
24
|
-
joinPath: (parts: string[]) => FileResult<string>;
|
|
25
|
-
readTextFile: (target: string) => FileResult<string>;
|
|
26
|
-
readTextLines: (target: string, options?: {
|
|
27
|
-
maxLines?: number;
|
|
28
|
-
}) => FileResult<string[]>;
|
|
29
|
-
writeFile: (target: string, content: string | Uint8Array) => FileResult<void>;
|
|
30
|
-
appendFile: (target: string, content: string | Uint8Array) => FileResult<void>;
|
|
31
|
-
renameFile: (source: string, destination: string) => FileResult<void>;
|
|
32
|
-
fileInfo: (target: string) => FileResult<ReturnType<typeof toFileInfo>>;
|
|
33
|
-
listDir: (target: string) => FileResult<ReturnType<typeof toFileInfo>[]>;
|
|
34
|
-
exists: (target: string) => FileResult<boolean>;
|
|
35
|
-
createDir: (target: string, options?: {
|
|
36
|
-
recursive?: boolean;
|
|
37
|
-
}) => FileResult<void>;
|
|
38
|
-
remove: (target: string, options?: {
|
|
39
|
-
recursive?: boolean;
|
|
40
|
-
}) => FileResult<void>;
|
|
41
|
-
};
|
|
42
|
-
export {};
|
|
1
|
+
import type { FileSystem } from '@earendil-works/pi-agent-core';
|
|
2
|
+
/** File storage for agent sessions that classifies errors structurally across vm realms. */
|
|
3
|
+
export declare const createSessionFs: (rootDir: string) => FileSystem;
|
package/lib/agent/sessions.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { Session } from '@earendil-works/pi-agent-core';
|
|
2
|
-
import type { AgentMessage } from '@earendil-works/pi-agent-core';
|
|
1
|
+
import type { AgentMessage, Session } from '@earendil-works/pi-agent-core';
|
|
3
2
|
import type { AgentSessionSummary, AgentsConfig } from './types';
|
|
4
3
|
export type AgentSessionStore = {
|
|
5
4
|
create: (agentName: string) => Promise<Session<any>>;
|
|
6
5
|
/** Throws when the id is unknown within the agent's scope. */
|
|
7
6
|
open: (agentName: string, sessionId: string) => Promise<Session<any>>;
|
|
8
7
|
fork: (agentName: string, sessionId: string) => Promise<Session<any>>;
|
|
8
|
+
append: (session: Session<any>, message: AgentMessage) => Promise<string>;
|
|
9
|
+
close: (session: Session<any>) => Promise<void>;
|
|
9
10
|
list: (agentName: string, limit?: number) => Promise<AgentSessionSummary[]>;
|
|
10
11
|
/** Reconstruct the pi message history for continuing a session. */
|
|
11
12
|
messages: (session: Session<any>) => Promise<AgentMessage[]>;
|
|
12
13
|
/** Retention sweep across every configured agent scope. */
|
|
13
14
|
sweep: (agentNames: string[]) => Promise<number>;
|
|
15
|
+
dispose: () => Promise<void>;
|
|
14
16
|
};
|
|
15
17
|
export declare const createAgentSessionStore: (config: AgentsConfig) => AgentSessionStore;
|