@anhlp/alp-paseo 0.0.0-beta.1 → 0.0.0-beta.2

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.
Files changed (77) hide show
  1. package/README.md +15 -4
  2. package/client/task-pills.ts +5 -1
  3. package/package.json +6 -12
  4. package/server/dist/alpd.js +1867 -741
  5. package/server/dist/index.js +1954 -800
  6. package/server/dist/library.js +4 -2
  7. package/server/dist/main.js +36 -5
  8. package/server/dist/mapping.js +25 -16
  9. package/server/dist/panel/library.js +4 -2
  10. package/server/dist/panel/mapping.js +25 -16
  11. package/server/dist/panel/tasks.js +4 -2
  12. package/server/dist/panel/usage.js +4 -2
  13. package/server/dist/paseo/agents.js +47 -17
  14. package/server/dist/paseo/index.js +34 -4
  15. package/server/dist/paseo/plugins.js +4 -2
  16. package/server/dist/paseo/timeline-items.js +25 -2
  17. package/server/dist/provider-core.js +23 -1
  18. package/server/dist/provider.js +1804 -656
  19. package/server/dist/remote/index.js +27 -3
  20. package/server/dist/remote/link.js +4 -2
  21. package/server/dist/remote/panels.js +4 -2
  22. package/server/dist/remote/provider.js +27 -3
  23. package/server/dist/tasks.js +4 -2
  24. package/server/dist/tool-detail.js +26 -0
  25. package/server/dist/usage.js +4 -2
  26. package/server/dist/web-app/_expo/static/js/web/{index-185bf24e94a45852b2cfa53666d1cb86.js → index-c01174e6924afca25f226efae0b2a3ae.js} +2 -2
  27. package/server/dist/web-app/_expo/static/js/web/{index-185bf24e94a45852b2cfa53666d1cb86.js.br → index-c01174e6924afca25f226efae0b2a3ae.js.br} +0 -0
  28. package/server/dist/web-app/_expo/static/js/web/{index-185bf24e94a45852b2cfa53666d1cb86.js.gz → index-c01174e6924afca25f226efae0b2a3ae.js.gz} +0 -0
  29. package/server/dist/web-app/alp-web-app.json +2 -1
  30. package/server/dist/web-app/index.html +1 -1
  31. package/server/dist/web-app/index.html.br +0 -0
  32. package/server/dist/web-app/index.html.gz +0 -0
  33. package/server/dist/web.js +4 -2
  34. package/server/dist/alp-templates.d.ts +0 -9
  35. package/server/dist/compat.d.ts +0 -3
  36. package/server/dist/index.d.ts +0 -10
  37. package/server/dist/library.d.ts +0 -1
  38. package/server/dist/main.d.ts +0 -2
  39. package/server/dist/mapping-wire.d.ts +0 -58
  40. package/server/dist/mapping.d.ts +0 -99
  41. package/server/dist/panel/compat.d.ts +0 -3
  42. package/server/dist/panel/library.d.ts +0 -6
  43. package/server/dist/panel/mapping.d.ts +0 -1
  44. package/server/dist/panel/session-tasks.d.ts +0 -6
  45. package/server/dist/panel/tasks.d.ts +0 -8
  46. package/server/dist/panel/usage.d.ts +0 -3
  47. package/server/dist/paseo/agents.d.ts +0 -65
  48. package/server/dist/paseo/chat-search.d.ts +0 -18
  49. package/server/dist/paseo/checkout.d.ts +0 -71
  50. package/server/dist/paseo/files.d.ts +0 -19
  51. package/server/dist/paseo/gateway.d.ts +0 -61
  52. package/server/dist/paseo/git.d.ts +0 -21
  53. package/server/dist/paseo/index.d.ts +0 -56
  54. package/server/dist/paseo/plugins.d.ts +0 -17
  55. package/server/dist/paseo/providers.d.ts +0 -19
  56. package/server/dist/paseo/quiet.d.ts +0 -2
  57. package/server/dist/paseo/relay-transport.d.ts +0 -43
  58. package/server/dist/paseo/relay.d.ts +0 -84
  59. package/server/dist/paseo/timeline-items.d.ts +0 -13
  60. package/server/dist/paseo/timeline-projection.d.ts +0 -96
  61. package/server/dist/paseo/timeline-store.d.ts +0 -60
  62. package/server/dist/paseo/usage.d.ts +0 -12
  63. package/server/dist/paseo/workspaces.d.ts +0 -58
  64. package/server/dist/provider-core.d.ts +0 -68
  65. package/server/dist/provider.d.ts +0 -28
  66. package/server/dist/remote/index.d.ts +0 -10
  67. package/server/dist/remote/link.d.ts +0 -58
  68. package/server/dist/remote/panels.d.ts +0 -29
  69. package/server/dist/remote/provider.d.ts +0 -25
  70. package/server/dist/session-tasks.d.ts +0 -1
  71. package/server/dist/shared/library.d.ts +0 -258
  72. package/server/dist/shared/tasks.d.ts +0 -128
  73. package/server/dist/shared/team-models.d.ts +0 -14
  74. package/server/dist/shared/usage.d.ts +0 -27
  75. package/server/dist/tasks.d.ts +0 -1
  76. package/server/dist/usage.d.ts +0 -1
  77. package/server/dist/web.d.ts +0 -42
@@ -1,65 +0,0 @@
1
- import type { SessionOutboundMessage } from '@getpaseo/protocol/messages';
2
- import type { DaemonConnection } from '@anhlp/alp-protocol';
3
- import type { SessionSummary } from '@anhlp/alp-protocol/session';
4
- import type { Handler } from './gateway.js';
5
- import type { AgentsView, Placement } from './workspaces.js';
6
- /**
7
- * ALP's roots as Paseo's agents (D31 step 3, ALPD §62). Each root session is one agent of the
8
- * provider "alp"; its team is the agent's model and its permission mode the agent's mode. The
9
- * timeline is the root's own events, kept in Paseo's timeline store; live changes go to every
10
- * client as agent_update and agent_stream, as a Paseo daemon does for clients without owned
11
- * subscriptions. What ALP asks the user (alp_ask, a permission, a trust or approval prompt) is
12
- * a question card on the root it belongs to (step 4). Each root sits in one of the workspaces
13
- * the bridge keeps (step 6, workspaces.ts). The team members a root's tree runs are its
14
- * provider subagents, each with its own timeline (step 7).
15
- */
16
- /** Where the agents' workspaces are kept (workspaces.ts). */
17
- export type Directory = {
18
- load(): Promise<void>;
19
- workspaceIdFor(session: SessionSummary): string;
20
- placement(session: SessionSummary): Placement;
21
- assign(sessionId: string, workspaceId: string): void;
22
- changed(): void;
23
- };
24
- export declare const PROVIDER = "alp";
25
- type Outbound = SessionOutboundMessage;
26
- export declare function createAgents({ clientFactory, home, broadcast, directory, log }: {
27
- clientFactory?: (onEvent: (envelope: any) => void) => Promise<DaemonConnection>;
28
- home?: string;
29
- broadcast(message: Outbound): void;
30
- directory: Directory;
31
- log?: (message: string) => void;
32
- }): {
33
- handlers: Record<string, Handler>;
34
- view: AgentsView;
35
- /** ALP itself as the app lists providers: its teams are the models (ALPD §62 step 3). */
36
- providerEntry(cwd?: string): Promise<{
37
- provider: string;
38
- status: "ready";
39
- enabled: boolean;
40
- source: "builtin";
41
- label: string;
42
- description: string;
43
- models: {
44
- isDefault: boolean;
45
- description?: string | undefined;
46
- provider: string;
47
- id: string;
48
- label: string;
49
- }[];
50
- modes: {
51
- id: string;
52
- label: string;
53
- }[];
54
- defaultModeId: string;
55
- }>;
56
- features: {
57
- providersSnapshot: boolean;
58
- providerSubagents: boolean;
59
- projectedSubagentTimeline: boolean;
60
- providerSubagentNesting: boolean;
61
- };
62
- start(): Promise<void>;
63
- close(): void;
64
- };
65
- export {};
@@ -1,18 +0,0 @@
1
- import type { ProjectedTimelineRow } from './timeline-projection.js';
2
- export type SearchLocation = {
3
- seq: number;
4
- role: 'user' | 'assistant';
5
- count: number;
6
- };
7
- /** The user and assistant messages after `cursor` that match, up to a page of them. */
8
- export declare function searchTimeline({ rows, query, cursor }: {
9
- rows: readonly ProjectedTimelineRow[];
10
- query: string;
11
- cursor?: number;
12
- }): {
13
- locations: SearchLocation[];
14
- nextCursor: null;
15
- } | {
16
- locations: SearchLocation[];
17
- nextCursor: number;
18
- };
@@ -1,71 +0,0 @@
1
- import type { SessionInboundMessage, SessionOutboundMessage } from '@getpaseo/protocol/messages';
2
- import type { ClientContext, Handler } from './gateway.js';
3
- /**
4
- * A checkout's git state and changes for the app (D31 step 8, ALPD §62): the branch, base and how
5
- * far apart they are for the header, and the Changes panel's diff, uncommitted or against the
6
- * base branch, pushed again when the checkout changes. Read-only: committing, pushing, pulling,
7
- * merging and switching branches answer "in development". The unified-diff parser is ported from
8
- * Paseo's daemon (packages/server/src/server/utils/diff-highlighter.ts, Copyright (c)
9
- * 2025-present Mohamed Boudra, Apache License 2.0), without its syntax highlighting.
10
- */
11
- type Inbound<T extends SessionInboundMessage['type']> = Extract<SessionInboundMessage, {
12
- type: T;
13
- }>;
14
- type Outbound = SessionOutboundMessage;
15
- type StatusPayload = Extract<Outbound, {
16
- type: 'checkout_status_response';
17
- }>['payload'];
18
- /** A status without its request id, each of the union's shapes kept apart. */
19
- type Status = StatusPayload extends infer P ? P extends unknown ? Omit<P, 'requestId'> : never : never;
20
- type DiffFile = Extract<Outbound, {
21
- type: 'checkout_diff_update';
22
- }>['payload']['files'][number];
23
- type Compare = Inbound<'subscribe_checkout_diff_request'>['compare'];
24
- export declare function parseDiff(diffText: string): DiffFile[];
25
- export declare function checkoutStatus(cwd: string): Promise<Status>;
26
- /** The checkout's changes as Paseo's Changes panel shows them, with paths from the repository's root. */
27
- export declare function checkoutDiff(cwd: string, compare: Compare): Promise<{
28
- files: DiffFile[];
29
- error: {
30
- code: "NOT_GIT_REPO";
31
- message: string;
32
- };
33
- } | {
34
- files: {
35
- path: string;
36
- isNew: boolean;
37
- isDeleted: boolean;
38
- additions: number;
39
- deletions: number;
40
- hunks: {
41
- oldStart: number;
42
- oldCount: number;
43
- newStart: number;
44
- newCount: number;
45
- lines: {
46
- type: "add" | "remove" | "context" | "header";
47
- content: string;
48
- tokens?: {
49
- text: string;
50
- style: string | null;
51
- }[] | undefined;
52
- }[];
53
- }[];
54
- oldPath?: string | undefined;
55
- status?: "binary" | "ok" | "too_large" | undefined;
56
- }[];
57
- error: null;
58
- }>;
59
- export declare function createCheckouts({ broadcast, log }: {
60
- broadcast(message: Outbound): void;
61
- log?: (message: string) => void;
62
- }): {
63
- handlers: Record<string, Handler>;
64
- features: {
65
- checkoutRefresh: boolean;
66
- };
67
- /** A client left: its subscriptions go. */
68
- drop(client: ClientContext): void;
69
- close(): void;
70
- };
71
- export {};
@@ -1,19 +0,0 @@
1
- import type { SessionInboundMessage, SessionOutboundMessage } from '@getpaseo/protocol/messages';
2
- /**
3
- * Finding directories and files for the app (D31 step 6, ALPD §62): the folder to add as a
4
- * project, typed as a path or a name under home, and a workspace's files for `@` mentions, the
5
- * command center and file links, as Paseo's daemon answers `directory_suggestions`; and the
6
- * read-only Files panel (step 8).
7
- */
8
- type Inbound<T extends SessionInboundMessage['type']> = Extract<SessionInboundMessage, {
9
- type: T;
10
- }>;
11
- type Outbound = SessionOutboundMessage;
12
- export declare function directorySuggestions(message: Inbound<'directory_suggestions_request'>): Promise<Outbound>;
13
- /**
14
- * The Files panel, read-only (D31 step 8): a directory's entries, links that stay inside included,
15
- * and a file's content as text, an image, or only its size for anything binary. Editing, and new,
16
- * renamed or deleted files, answer "in development".
17
- */
18
- export declare function fileExplorer(message: Inbound<'file_explorer_request'>): Promise<Outbound>;
19
- export {};
@@ -1,61 +0,0 @@
1
- /**
2
- * A socket carrying Paseo's frames: the browser's WebSocket, or a device's decrypted relay socket
3
- * (ALPD §64), whose send may return a promise.
4
- */
5
- export interface FrameSocket {
6
- readonly readyState: number;
7
- send(data: string): unknown;
8
- close(code?: number, reason?: string): void;
9
- on(event: 'message' | 'close' | 'error', listener: (...args: any[]) => void): unknown;
10
- }
11
- /**
12
- * The ALP web app is Paseo's app (D31, ALPD §62), so alpd speaks Paseo's daemon protocol to it
13
- * on the page's own origin: a `hello` with the token as its password (or the `paseo.bearer.*`
14
- * subprotocol), then `server_info`, then session messages. ALP answers what it has and refuses the
15
- * rest with `rpc_error` code `not_implemented`, whose text the app shows as it is ("Tính năng đang
16
- * phát triển" in the user's language), so no request waits out the client's timeout.
17
- */
18
- /** Paseo's protocol version and close codes (packages/server/src/server/websocket-server.ts there). */
19
- export declare const PASEO_PROTOCOL_VERSION = 1;
20
- export declare const NOT_IMPLEMENTED = "not_implemented";
21
- export declare const BEARER_PREFIX = "paseo.bearer.";
22
- export type SessionMessage = {
23
- type: string;
24
- requestId?: string;
25
- [key: string]: unknown;
26
- };
27
- export type Outbound = {
28
- type: string;
29
- payload?: unknown;
30
- [key: string]: unknown;
31
- };
32
- export type ClientContext = {
33
- clientId: string;
34
- /** Sends one session message to this client. */
35
- emit(message: Outbound): void;
36
- };
37
- /** A request handler: returns the reply, or emits by itself and returns nothing. */
38
- export type Handler = (message: any, client: ClientContext) => Outbound | void | Promise<Outbound | void>;
39
- export type GatewayOptions = {
40
- token: () => string;
41
- serverId: () => string;
42
- version: string;
43
- handlers: Record<string, Handler>;
44
- /** What the app may light up; anything absent stays hidden or answers "in development". */
45
- features: Record<string, boolean>;
46
- onClient?(client: ClientContext): () => void;
47
- /** The text of a not_implemented answer, in the user's language. */
48
- inDevelopment?: () => string | Promise<string>;
49
- log?: (message: string) => void;
50
- };
51
- /** The subprotocol a browser offers to carry its password; alpd answers with the same one. */
52
- export declare function bearerOf(protocols: Iterable<string>): string | undefined;
53
- export declare function createPaseoGateway(options: GatewayOptions): {
54
- attach: (ws: FrameSocket, { bearer }?: {
55
- bearer?: string;
56
- }) => void;
57
- /** Sends a session message to every connected client. */
58
- broadcast(message: Outbound): void;
59
- readonly clients: number;
60
- };
61
- export type PaseoGateway = ReturnType<typeof createPaseoGateway>;
@@ -1,21 +0,0 @@
1
- export declare function git(cwd: string, args: string[], { maxBuffer, okCodes }?: {
2
- maxBuffer?: number;
3
- okCodes?: number[];
4
- }): Promise<string>;
5
- export type CheckoutFacts = {
6
- isGit: false;
7
- } | {
8
- isGit: true;
9
- repoRoot: string;
10
- currentBranch: string | null;
11
- remoteUrl: string | null;
12
- isDirty: boolean;
13
- };
14
- export declare function checkoutFacts(cwd: string): Promise<CheckoutFacts>;
15
- /** Checkout facts kept for a while, so a poll does not run git for every directory each time. */
16
- export declare function checkoutCache(ttlMs?: number): {
17
- /** The last facts known, or undefined before the first read. */
18
- peek: (cwd: string) => CheckoutFacts | undefined;
19
- /** Fresh facts when the kept ones are older than the TTL (or `force`). */
20
- read(cwd: string, force?: boolean): Promise<CheckoutFacts>;
21
- };
@@ -1,56 +0,0 @@
1
- import type { DaemonConnection } from '@anhlp/alp-protocol';
2
- import { type RelaySettings } from './relay.js';
3
- export { createPaseoGateway, NOT_IMPLEMENTED, PASEO_PROTOCOL_VERSION } from './gateway.js';
4
- export type { PaseoGateway } from './gateway.js';
5
- /** Where the built app sits: beside alpd.js (dist/web-app), unless settings or the environment say. */
6
- export declare function webAppDir(alpdFile: string, configured?: string): string | undefined;
7
- /**
8
- * The daemon side of the ALP web app (ALPD §62): Paseo's protocol over alpd. The handlers and the
9
- * features they light up grow step by step (D31); everything else answers "in development".
10
- * ALP's state is read on the first client's hello, not at alpd's start.
11
- */
12
- export declare function createPaseoBridge({ clientFactory, version, token, serverId, home, relay: relaySettings, listen, log }: {
13
- /** Injected client for the ALP daemon socket; defaults to connecting through the lock. */
14
- clientFactory?: (onEvent: (envelope: any) => void) => Promise<DaemonConnection>;
15
- /** The user's web.relay setting (ALPD §64). */
16
- relay?: RelaySettings;
17
- /** Where the web app listens, as daemon.get_status reports it. */
18
- listen?: () => string | null;
19
- /** ALP's home, whose settings name the user's language. */
20
- home?: string;
21
- version: string;
22
- token: () => string;
23
- serverId: () => string;
24
- log?: (message: string) => void;
25
- }): {
26
- attach: (ws: import("./gateway.js").FrameSocket, { bearer }?: {
27
- bearer?: string;
28
- }) => void;
29
- broadcast(message: import("./gateway.js").Outbound): void;
30
- readonly clients: number;
31
- } & {
32
- relay: {
33
- start: () => Promise<void>;
34
- stop: () => Promise<void>;
35
- readonly connected: boolean;
36
- config(): {
37
- enabled: boolean;
38
- endpoint: string;
39
- publicEndpoint: string;
40
- useTls: boolean;
41
- publicUseTls: boolean;
42
- };
43
- setEnabled(enabled: boolean): Promise<void>;
44
- offer(): Promise<{
45
- url: null;
46
- relayEnabled: boolean;
47
- } | {
48
- url: string;
49
- relayEnabled: boolean;
50
- }>;
51
- };
52
- close: () => Promise<void>;
53
- scripts: {
54
- '/alp-plugins.js': string;
55
- };
56
- };
@@ -1,17 +0,0 @@
1
- import type { Handler } from './gateway.js';
2
- /** The script the page loads before the app: each plugin's factory by id. */
3
- export declare const pluginScript: string;
4
- export declare function createPlugins({ log, usage, home, projectDirectories }?: {
5
- home?: string;
6
- projectDirectories?: () => Promise<string[]>;
7
- log?: (message: string) => void;
8
- usage?: (refresh?: boolean) => Promise<any>;
9
- }): {
10
- handlers: Record<string, Handler>;
11
- features: {
12
- plugins: boolean;
13
- pluginSettings: boolean;
14
- pluginManagement: boolean;
15
- };
16
- script: string;
17
- };
@@ -1,19 +0,0 @@
1
- import type { Handler, Outbound } from './gateway.js';
2
- type Entry = Record<string, unknown>;
3
- export declare function createProviders({ home, broadcast, alpEntry, log }: {
4
- home?: string;
5
- broadcast: (message: Outbound) => void;
6
- /** ALP's own entry for a folder (agents.ts). */
7
- alpEntry: (cwd?: string) => Promise<Entry>;
8
- log?: (message: string) => void;
9
- }): {
10
- handlers: Record<string, Handler>;
11
- features: {
12
- providerRemoval: boolean;
13
- };
14
- config: () => Promise<Record<string, Entry>>;
15
- apply: (patch?: Record<string, Record<string, unknown>>, remove?: string[]) => Promise<void>;
16
- push: () => Promise<void>;
17
- };
18
- export type Providers = ReturnType<typeof createProviders>;
19
- export {};
@@ -1,2 +0,0 @@
1
- import type { Handler } from './gateway.js';
2
- export declare const quietHandlers: Record<string, Handler>;
@@ -1,43 +0,0 @@
1
- import { type KeyPair } from '@getpaseo/relay/e2ee';
2
- /** What the gateway is given for each paired device: a socket carrying Paseo's frames, decrypted. */
3
- export interface RelaySocketLike {
4
- readonly readyState: number;
5
- readonly bufferedAmount?: number;
6
- send: (data: string | Uint8Array | ArrayBuffer, callback?: (error?: Error) => void) => void | Promise<void>;
7
- close: (code?: number, reason?: string) => void;
8
- terminate?: () => void;
9
- on: (event: 'message' | 'close' | 'error', listener: (...args: any[]) => void) => void;
10
- once: (event: 'close' | 'error', listener: (...args: any[]) => void) => void;
11
- }
12
- interface RelayWebSocketLike {
13
- readyState: number;
14
- bufferedAmount: number;
15
- send: (data: string | ArrayBuffer | Uint8Array, callback?: (error?: Error) => void) => void;
16
- close: (code?: number, reason?: string) => void;
17
- terminate: () => void;
18
- ping: () => void;
19
- on: (event: 'open' | 'message' | 'close' | 'error' | 'pong', listener: (...args: any[]) => void) => void;
20
- }
21
- export type RelayWebSocketFactory = (url: string) => RelayWebSocketLike;
22
- /**
23
- * Keeps a control socket open to the relay as this server, and opens a data socket for each
24
- * device the relay says is connected. Each data socket is end-to-end encrypted with the daemon's
25
- * key pair and handed to `attachSocket` once the device's handshake is done.
26
- */
27
- export declare function startRelayTransport({ log, attachSocket, relayEndpoint, relayUseTls, serverId, daemonKeyPair, createWebSocket }: {
28
- log: (message: string) => void;
29
- attachSocket: (socket: RelaySocketLike) => void;
30
- /** "host:port" */
31
- relayEndpoint: string;
32
- relayUseTls: boolean;
33
- serverId: string;
34
- daemonKeyPair: KeyPair;
35
- createWebSocket?: RelayWebSocketFactory;
36
- }): {
37
- /** Whether the relay acknowledged this server's control socket. */
38
- readonly connected: boolean;
39
- onConnected(listener: (connected: boolean) => void): () => boolean;
40
- stop(): Promise<void>;
41
- };
42
- export type RelayTransportController = ReturnType<typeof startRelayTransport>;
43
- export {};
@@ -1,84 +0,0 @@
1
- import { type KeyPair } from '@getpaseo/relay/e2ee';
2
- import { type Handler, type Outbound } from './gateway.js';
3
- import { type RelaySocketLike, type RelayWebSocketFactory } from './relay-transport.js';
4
- /**
5
- * Paseo's relay for alpd (D32, ALPD §64): with it on, alpd keeps a socket open to the relay, and
6
- * Paseo's app on another device, paired by a link or QR code carrying alpd's public key, reaches
7
- * alpd through it, end to end encrypted. Each device still signs in with alpd's token, which the
8
- * pairing link does not carry. Off until the user turns it on.
9
- */
10
- export declare const DEFAULT_RELAY_ENDPOINT = "relay.paseo.sh:443";
11
- export type RelaySettings = {
12
- enabled?: boolean;
13
- endpoint?: string;
14
- useTls?: boolean;
15
- };
16
- /** alpd's relay key pair, made once and kept beside its token; a new one unpairs every device. */
17
- export declare function relayKeyPair(home: string): Promise<{
18
- keyPair: KeyPair;
19
- publicKeyB64: string;
20
- }>;
21
- /** The link Paseo's app pairs with: `#offer=` and the offer, base64url JSON (Paseo's ConnectionOfferV2). */
22
- export declare function pairingUrl(offer: {
23
- serverId: string;
24
- daemonPublicKeyB64: string;
25
- endpoint: string;
26
- useTls: boolean;
27
- }): string;
28
- export declare function createRelay({ home, serverId, attach, initial, log, createWebSocket }: {
29
- home?: string;
30
- serverId: () => string;
31
- /** Hands a device's decrypted socket to the gateway, which asks it for the token like any other. */
32
- attach: (socket: RelaySocketLike) => void;
33
- initial?: RelaySettings;
34
- log?: (message: string) => void;
35
- createWebSocket?: RelayWebSocketFactory;
36
- }): {
37
- start: () => Promise<void>;
38
- stop: () => Promise<void>;
39
- readonly connected: boolean;
40
- /** As Paseo's daemon.get_status and config report it. */
41
- config(): {
42
- enabled: boolean;
43
- endpoint: string;
44
- publicEndpoint: string;
45
- useTls: boolean;
46
- publicUseTls: boolean;
47
- };
48
- /** Turns the relay on or off now, and keeps the choice in settings.json. */
49
- setEnabled(enabled: boolean): Promise<void>;
50
- /** The pairing link, or none while the relay is off. */
51
- offer(): Promise<{
52
- url: null;
53
- relayEnabled: boolean;
54
- } | {
55
- url: string;
56
- relayEnabled: boolean;
57
- }>;
58
- };
59
- export type Relay = ReturnType<typeof createRelay>;
60
- /**
61
- * The daemon's config and status as Paseo's app reads and changes them: the relay is ALP's; the
62
- * rest are Paseo's defaults (no Paseo MCP tools, no browser tools; ALP's own plugin runs). A change
63
- * to anything but the relay answers "in development".
64
- */
65
- export declare function createDaemonConfig({ relay, providers, serverId, broadcast, inDevelopment, version, listen, startedAt }: {
66
- relay: Relay;
67
- /** The library's ACP providers (providers.ts, ALPD §65). */
68
- providers?: {
69
- config(): Promise<Record<string, unknown>>;
70
- apply(patch?: Record<string, Record<string, unknown>>, remove?: string[]): Promise<void>;
71
- };
72
- serverId: () => string;
73
- broadcast: (message: Outbound) => void;
74
- inDevelopment: () => Promise<string>;
75
- version: string;
76
- listen: () => string | null;
77
- startedAt: string;
78
- }): {
79
- handlers: Record<string, Handler>;
80
- features: {
81
- daemonStatusRpc: boolean;
82
- relayConfig: boolean;
83
- };
84
- };
@@ -1,13 +0,0 @@
1
- import type { AgentTimelineItem } from '@getpaseo/protocol/agent-types';
2
- import type { TimelineItem } from '@anhlp/alp-protocol';
3
- /**
4
- * ALP's timeline items are snapshots by id (ALPD §4.2); Paseo's timeline is a log where text
5
- * grows by deltas and a tool call is the same call seen again (ALPD §62). This keeps the last
6
- * snapshot of each item and turns the next one into what Paseo appends, as Paseo does for
7
- * plugin providers (mapTimelineItem in packages/server/src/server/agent/plugin-provider.ts there).
8
- */
9
- export declare class TimelineDeltas {
10
- private readonly last;
11
- /** What to append for this snapshot, or nothing when it adds nothing. */
12
- next(item: TimelineItem): AgentTimelineItem | null;
13
- }
@@ -1,96 +0,0 @@
1
- import type { AgentTimelineItem } from "@getpaseo/protocol/agent-types";
2
- export interface AgentTimelineRow {
3
- seq: number;
4
- timestamp: string;
5
- item: AgentTimelineItem;
6
- readonly turnId?: string;
7
- readonly providerMessageId?: string;
8
- }
9
- export type TimelineProjectionMode = "canonical" | "projected";
10
- export interface TimelineSeqRange {
11
- startSeq: number;
12
- endSeq: number;
13
- }
14
- export type TimelineProjectionKind = "assistant_merge" | "reasoning_merge" | "tool_lifecycle" | "identity";
15
- export type TimelineLimitDirection = "tail" | "before" | "after";
16
- export interface TimelineProjectionEntry {
17
- item: AgentTimelineItem;
18
- turnId?: string;
19
- providerMessageId?: string;
20
- timestamp: string;
21
- seqStart: number;
22
- seqEnd: number;
23
- sourceSeqRanges: TimelineSeqRange[];
24
- collapsed: TimelineProjectionKind[];
25
- }
26
- interface ProjectedWindowSelection {
27
- projectedEntries: TimelineProjectionEntry[];
28
- selectedRows: AgentTimelineRow[];
29
- minSeq: number | null;
30
- maxSeq: number | null;
31
- }
32
- export interface ProjectedTimelinePageSelection {
33
- entries: TimelineProjectionEntry[];
34
- startSeq: number | null;
35
- endSeq: number | null;
36
- hasOlder: boolean;
37
- hasNewer: boolean;
38
- }
39
- /** Fold a later update for the same tool call into the one it follows. */
40
- export declare function mergeToolCallItems(existing: Extract<AgentTimelineItem, {
41
- type: "tool_call";
42
- }>, incoming: Extract<AgentTimelineItem, {
43
- type: "tool_call";
44
- }>): Extract<AgentTimelineItem, {
45
- type: "tool_call";
46
- }>;
47
- /** A retained item. `seq` is its latest source event, not its display anchor. */
48
- export type ProjectedTimelineRow = AgentTimelineRow & TimelineProjectionEntry;
49
- /** Owns projected state; source events are consumed, never retained. */
50
- export declare class TimelineProjection {
51
- private readonly rows;
52
- private readonly identities;
53
- append(row: AgentTimelineRow): void;
54
- getRows(): ProjectedTimelineRow[];
55
- enrichSubmittedUserMessage(clientMessageId: string, providerMessageId: string): ProjectedTimelineRow | null;
56
- }
57
- export declare function projectTimelineRows(input: {
58
- rows: readonly AgentTimelineRow[];
59
- mode: TimelineProjectionMode;
60
- }): TimelineProjectionEntry[];
61
- /**
62
- * Select a timeline window based on projected-entry count, then map it back to
63
- * contiguous canonical rows. This avoids cutting through merged assistant
64
- * chunks when callers request canonical rows with a bounded limit.
65
- */
66
- export declare function selectTimelineWindowByProjectedLimit(input: {
67
- rows: readonly AgentTimelineRow[];
68
- direction: TimelineLimitDirection;
69
- limit: number;
70
- }): ProjectedWindowSelection;
71
- export declare function selectProjectedTimelinePage(input: {
72
- rows: readonly AgentTimelineRow[];
73
- bounds?: {
74
- minSeq: number;
75
- maxSeq: number;
76
- };
77
- direction: TimelineLimitDirection;
78
- cursorSeq?: number;
79
- limit?: number;
80
- }): ProjectedTimelinePageSelection;
81
- /**
82
- * Apply a projected-count limit to a flat AgentTimelineItem[] without seq metadata.
83
- * Used by callers that only have items in hand (e.g. MCP tools reading
84
- * `agentManager.getTimeline`). Index position is treated as canonical seq.
85
- */
86
- export interface ProjectedItemSelection {
87
- items: AgentTimelineItem[];
88
- totalProjected: number;
89
- shownProjected: number;
90
- }
91
- export declare function selectItemsByProjectedLimit(input: {
92
- items: readonly AgentTimelineItem[];
93
- direction: TimelineLimitDirection;
94
- limit: number;
95
- }): ProjectedItemSelection;
96
- export {};
@@ -1,60 +0,0 @@
1
- import { type ProjectedTimelineRow } from "./timeline-projection.js";
2
- import type { AgentTimelineItem } from "@getpaseo/protocol/agent-types";
3
- import type { AgentTimelineRow } from "./timeline-projection.js";
4
- export interface AgentTimelineCursor {
5
- epoch: string;
6
- seq: number;
7
- }
8
- export type AgentTimelineFetchDirection = "tail" | "before" | "after";
9
- export interface AgentTimelineFetchOptions {
10
- direction?: AgentTimelineFetchDirection;
11
- cursor?: AgentTimelineCursor;
12
- /** Number of projected items to return; 0 means all rows in the selected window. */
13
- limit?: number;
14
- }
15
- export interface AgentTimelineWindow {
16
- minSeq: number;
17
- maxSeq: number;
18
- nextSeq: number;
19
- }
20
- export interface AgentTimelineFetchResult {
21
- epoch: string;
22
- direction: AgentTimelineFetchDirection;
23
- reset: boolean;
24
- staleCursor: boolean;
25
- gap: boolean;
26
- window: AgentTimelineWindow;
27
- hasOlder: boolean;
28
- hasNewer: boolean;
29
- startSeq: number | null;
30
- endSeq: number | null;
31
- rows: ProjectedTimelineRow[];
32
- }
33
- export interface SeedAgentTimelineOptions {
34
- items?: readonly AgentTimelineItem[];
35
- rows?: readonly AgentTimelineRow[];
36
- epoch?: string;
37
- nextSeq?: number;
38
- timestamp?: string;
39
- }
40
- export declare class InMemoryAgentTimelineStore {
41
- private readonly states;
42
- has(agentId: string): boolean;
43
- initialize(agentId: string, options?: SeedAgentTimelineOptions): void;
44
- delete(agentId: string): void;
45
- getItems(agentId: string): AgentTimelineItem[];
46
- getRows(agentId: string): ProjectedTimelineRow[];
47
- getSubmittedUserMessage(agentId: string, clientMessageId: string): AgentTimelineRow | null;
48
- enrichSubmittedUserMessage(agentId: string, clientMessageId: string, providerMessageId: string): AgentTimelineRow | null;
49
- getEpoch(agentId: string): string;
50
- fetch(agentId: string, options?: AgentTimelineFetchOptions): AgentTimelineFetchResult;
51
- append(agentId: string, item: AgentTimelineItem, options?: {
52
- timestamp?: string;
53
- providerMessageId?: string;
54
- turnId?: string;
55
- }): AgentTimelineRow;
56
- getLastItem(agentId: string): AgentTimelineItem | null;
57
- getLastAssistantMessage(agentId: string): string | null;
58
- private requireState;
59
- private buildRowsFromItems;
60
- }
@@ -1,12 +0,0 @@
1
- import type { AlpRuntime } from '@anhlp/alp-runtime/runtime';
2
- import type { Handler } from './gateway.js';
3
- type Snapshot = Awaited<ReturnType<AlpRuntime['usage']>>;
4
- /** Both generations of Paseo's Usage drawer read the same ALP snapshot as its panel. */
5
- export declare function createUsage(read: (refresh?: boolean) => Promise<Snapshot>): {
6
- handlers: Record<string, Handler>;
7
- features: {
8
- providerUsageList: boolean;
9
- usageSources: boolean;
10
- };
11
- };
12
- export {};