agent-relay 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/CHANGELOG.md +11 -0
- package/LICENSE +22 -0
- package/PROTOCOL.md +319 -0
- package/README.md +791 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +1591 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/daemon/connection.d.ts +60 -0
- package/dist/daemon/connection.d.ts.map +1 -0
- package/dist/daemon/connection.js +245 -0
- package/dist/daemon/connection.js.map +1 -0
- package/dist/daemon/index.d.ts +4 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +4 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/router.d.ts +72 -0
- package/dist/daemon/router.d.ts.map +1 -0
- package/dist/daemon/router.js +183 -0
- package/dist/daemon/router.js.map +1 -0
- package/dist/daemon/server.d.ts +52 -0
- package/dist/daemon/server.d.ts.map +1 -0
- package/dist/daemon/server.js +186 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/dashboard/public/index.html +690 -0
- package/dist/dashboard/server.d.ts +2 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.js +220 -0
- package/dist/dashboard/server.js.map +1 -0
- package/dist/games/index.d.ts +2 -0
- package/dist/games/index.d.ts.map +1 -0
- package/dist/games/index.js +2 -0
- package/dist/games/index.js.map +1 -0
- package/dist/games/tictactoe.d.ts +24 -0
- package/dist/games/tictactoe.d.ts.map +1 -0
- package/dist/games/tictactoe.js +160 -0
- package/dist/games/tictactoe.js.map +1 -0
- package/dist/hooks/inbox-check/hook.d.ts +28 -0
- package/dist/hooks/inbox-check/hook.d.ts.map +1 -0
- package/dist/hooks/inbox-check/hook.js +97 -0
- package/dist/hooks/inbox-check/hook.js.map +1 -0
- package/dist/hooks/inbox-check/index.d.ts +8 -0
- package/dist/hooks/inbox-check/index.d.ts.map +1 -0
- package/dist/hooks/inbox-check/index.js +8 -0
- package/dist/hooks/inbox-check/index.js.map +1 -0
- package/dist/hooks/inbox-check/types.d.ts +31 -0
- package/dist/hooks/inbox-check/types.d.ts.map +1 -0
- package/dist/hooks/inbox-check/types.js +5 -0
- package/dist/hooks/inbox-check/types.js.map +1 -0
- package/dist/hooks/inbox-check/utils.d.ts +44 -0
- package/dist/hooks/inbox-check/utils.d.ts.map +1 -0
- package/dist/hooks/inbox-check/utils.js +107 -0
- package/dist/hooks/inbox-check/utils.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol/framing.d.ts +32 -0
- package/dist/protocol/framing.d.ts.map +1 -0
- package/dist/protocol/framing.js +71 -0
- package/dist/protocol/framing.js.map +1 -0
- package/dist/protocol/index.d.ts +3 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +3 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/types.d.ts +104 -0
- package/dist/protocol/types.d.ts.map +1 -0
- package/dist/protocol/types.js +6 -0
- package/dist/protocol/types.js.map +1 -0
- package/dist/state/agent-state.d.ts +40 -0
- package/dist/state/agent-state.d.ts.map +1 -0
- package/dist/state/agent-state.js +120 -0
- package/dist/state/agent-state.js.map +1 -0
- package/dist/storage/adapter.d.ts +29 -0
- package/dist/storage/adapter.d.ts.map +1 -0
- package/dist/storage/adapter.js +2 -0
- package/dist/storage/adapter.js.map +1 -0
- package/dist/storage/sqlite-adapter.d.ts +15 -0
- package/dist/storage/sqlite-adapter.d.ts.map +1 -0
- package/dist/storage/sqlite-adapter.js +116 -0
- package/dist/storage/sqlite-adapter.js.map +1 -0
- package/dist/supervisor/inbox.d.ts +38 -0
- package/dist/supervisor/inbox.d.ts.map +1 -0
- package/dist/supervisor/inbox.js +162 -0
- package/dist/supervisor/inbox.js.map +1 -0
- package/dist/supervisor/index.d.ts +10 -0
- package/dist/supervisor/index.d.ts.map +1 -0
- package/dist/supervisor/index.js +10 -0
- package/dist/supervisor/index.js.map +1 -0
- package/dist/supervisor/spawner.d.ts +54 -0
- package/dist/supervisor/spawner.d.ts.map +1 -0
- package/dist/supervisor/spawner.js +282 -0
- package/dist/supervisor/spawner.js.map +1 -0
- package/dist/supervisor/state.d.ts +132 -0
- package/dist/supervisor/state.d.ts.map +1 -0
- package/dist/supervisor/state.js +465 -0
- package/dist/supervisor/state.js.map +1 -0
- package/dist/supervisor/supervisor.d.ts +67 -0
- package/dist/supervisor/supervisor.d.ts.map +1 -0
- package/dist/supervisor/supervisor.js +263 -0
- package/dist/supervisor/supervisor.js.map +1 -0
- package/dist/supervisor/types.d.ts +139 -0
- package/dist/supervisor/types.d.ts.map +1 -0
- package/dist/supervisor/types.js +12 -0
- package/dist/supervisor/types.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/name-generator.d.ts +17 -0
- package/dist/utils/name-generator.d.ts.map +1 -0
- package/dist/utils/name-generator.js +52 -0
- package/dist/utils/name-generator.js.map +1 -0
- package/dist/webhook/spawner.d.ts +79 -0
- package/dist/webhook/spawner.d.ts.map +1 -0
- package/dist/webhook/spawner.js +288 -0
- package/dist/webhook/spawner.js.map +1 -0
- package/dist/wrapper/client.d.ts +72 -0
- package/dist/wrapper/client.d.ts.map +1 -0
- package/dist/wrapper/client.js +306 -0
- package/dist/wrapper/client.js.map +1 -0
- package/dist/wrapper/inbox.d.ts +37 -0
- package/dist/wrapper/inbox.d.ts.map +1 -0
- package/dist/wrapper/inbox.js +73 -0
- package/dist/wrapper/inbox.js.map +1 -0
- package/dist/wrapper/index.d.ts +4 -0
- package/dist/wrapper/index.d.ts.map +1 -0
- package/dist/wrapper/index.js +7 -0
- package/dist/wrapper/index.js.map +1 -0
- package/dist/wrapper/parser.d.ts +94 -0
- package/dist/wrapper/parser.d.ts.map +1 -0
- package/dist/wrapper/parser.js +360 -0
- package/dist/wrapper/parser.js.map +1 -0
- package/dist/wrapper/pty-wrapper.d.ts +125 -0
- package/dist/wrapper/pty-wrapper.d.ts.map +1 -0
- package/dist/wrapper/pty-wrapper.js +494 -0
- package/dist/wrapper/pty-wrapper.js.map +1 -0
- package/dist/wrapper/tmux-wrapper.d.ts +131 -0
- package/dist/wrapper/tmux-wrapper.d.ts.map +1 -0
- package/dist/wrapper/tmux-wrapper.js +427 -0
- package/dist/wrapper/tmux-wrapper.js.map +1 -0
- package/install.sh +69 -0
- package/package.json +82 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/wrapper/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAOL,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAa1D,MAAM,qBAAqB,GAAiB;IAC1C,UAAU,EAAE,mBAAmB;IAC/B,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,IAAI;IACf,oBAAoB,EAAE,EAAE;IACxB,gBAAgB,EAAE,GAAG;IACrB,mBAAmB,EAAE,KAAK;CAC3B,CAAC;AAEF,MAAM,OAAO,WAAW;IACd,MAAM,CAAe;IACrB,MAAM,CAAc;IACpB,MAAM,CAAc;IAEpB,MAAM,GAAgB,cAAc,CAAC;IACrC,SAAS,CAAU;IACnB,WAAW,CAAU;IACrB,iBAAiB,GAAG,CAAC,CAAC;IACtB,cAAc,CAAS;IACvB,cAAc,CAAkB;IAChC,UAAU,GAAG,KAAK,CAAC;IAE3B,iBAAiB;IACjB,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agent reads itself.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_INBOX_DIR = "/tmp/agent-relay";
|
|
6
|
+
export interface InboxConfig {
|
|
7
|
+
agentName: string;
|
|
8
|
+
inboxDir: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class InboxManager {
|
|
11
|
+
private config;
|
|
12
|
+
private inboxPath;
|
|
13
|
+
constructor(config: Partial<InboxConfig> & {
|
|
14
|
+
agentName: string;
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Initialize inbox directory and file.
|
|
18
|
+
*/
|
|
19
|
+
init(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get the inbox file path (for telling the agent where to read).
|
|
22
|
+
*/
|
|
23
|
+
getInboxPath(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Add a message to the inbox.
|
|
26
|
+
*/
|
|
27
|
+
addMessage(from: string, body: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Clear the inbox.
|
|
30
|
+
*/
|
|
31
|
+
clear(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Check if inbox has messages.
|
|
34
|
+
*/
|
|
35
|
+
hasMessages(): boolean;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=inbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/wrapper/inbox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,iBAAiB,qBAAqB,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;IAQhE;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAwB5C;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,WAAW,IAAI,OAAO;CAKvB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-based Inbox Manager
|
|
3
|
+
* Writes incoming messages to a file that the CLI agent reads itself.
|
|
4
|
+
*/
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
export const DEFAULT_INBOX_DIR = '/tmp/agent-relay';
|
|
8
|
+
export class InboxManager {
|
|
9
|
+
config;
|
|
10
|
+
inboxPath;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = {
|
|
13
|
+
inboxDir: DEFAULT_INBOX_DIR,
|
|
14
|
+
...config,
|
|
15
|
+
};
|
|
16
|
+
this.inboxPath = path.join(this.config.inboxDir, this.config.agentName, 'inbox.md');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Initialize inbox directory and file.
|
|
20
|
+
*/
|
|
21
|
+
init() {
|
|
22
|
+
const dir = path.dirname(this.inboxPath);
|
|
23
|
+
if (!fs.existsSync(dir)) {
|
|
24
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
25
|
+
}
|
|
26
|
+
// Start with empty inbox
|
|
27
|
+
this.clear();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the inbox file path (for telling the agent where to read).
|
|
31
|
+
*/
|
|
32
|
+
getInboxPath() {
|
|
33
|
+
return this.inboxPath;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Add a message to the inbox.
|
|
37
|
+
*/
|
|
38
|
+
addMessage(from, body) {
|
|
39
|
+
const timestamp = new Date().toISOString();
|
|
40
|
+
const entry = `\n## Message from ${from} | ${timestamp}\n${body}\n`;
|
|
41
|
+
// Read existing content
|
|
42
|
+
let content = '';
|
|
43
|
+
if (fs.existsSync(this.inboxPath)) {
|
|
44
|
+
content = fs.readFileSync(this.inboxPath, 'utf-8');
|
|
45
|
+
}
|
|
46
|
+
// If empty, add header
|
|
47
|
+
if (!content.trim()) {
|
|
48
|
+
content = `# 📬 INBOX - CHECK AND RESPOND TO ALL MESSAGES\n`;
|
|
49
|
+
}
|
|
50
|
+
// Append new message
|
|
51
|
+
content += entry;
|
|
52
|
+
// Atomic write (write to temp, then rename)
|
|
53
|
+
const tmpPath = `${this.inboxPath}.tmp`;
|
|
54
|
+
fs.writeFileSync(tmpPath, content, 'utf-8');
|
|
55
|
+
fs.renameSync(tmpPath, this.inboxPath);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Clear the inbox.
|
|
59
|
+
*/
|
|
60
|
+
clear() {
|
|
61
|
+
fs.writeFileSync(this.inboxPath, '', 'utf-8');
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Check if inbox has messages.
|
|
65
|
+
*/
|
|
66
|
+
hasMessages() {
|
|
67
|
+
if (!fs.existsSync(this.inboxPath))
|
|
68
|
+
return false;
|
|
69
|
+
const content = fs.readFileSync(this.inboxPath, 'utf-8');
|
|
70
|
+
return content.includes('## Message from');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=inbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../src/wrapper/inbox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAOpD,MAAM,OAAO,YAAY;IACf,MAAM,CAAc;IACpB,SAAS,CAAS;IAE1B,YAAY,MAAoD;QAC9D,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EA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;QACxC,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5C,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;QACjD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACzD,OAAO,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wrapper/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './parser.js';
|
|
3
|
+
export * from './pty-wrapper.js';
|
|
4
|
+
// Note: tmux-wrapper.ts is intentionally not exported here.
|
|
5
|
+
// It's dynamically imported in CLI only when --tmux2 flag is used,
|
|
6
|
+
// as it has different runtime requirements (tmux must be installed).
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wrapper/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,4DAA4D;AAC5D,mEAAmE;AACnE,qEAAqE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PTY Output Parser
|
|
3
|
+
* Extracts relay commands from agent terminal output.
|
|
4
|
+
*
|
|
5
|
+
* Supports two formats:
|
|
6
|
+
* 1. Inline: @relay:<target> <message> (single line, start of line only)
|
|
7
|
+
* 2. Block: [[RELAY]]{ json }[[/RELAY]] (multi-line, structured)
|
|
8
|
+
*
|
|
9
|
+
* Rules:
|
|
10
|
+
* - Inline only matches at start of line (after whitespace)
|
|
11
|
+
* - Ignores content inside code fences
|
|
12
|
+
* - Escape with \@relay: to output literal
|
|
13
|
+
* - Block format is preferred for structured data
|
|
14
|
+
*/
|
|
15
|
+
import type { PayloadKind } from '../protocol/types.js';
|
|
16
|
+
export interface ParsedCommand {
|
|
17
|
+
to: string;
|
|
18
|
+
kind: PayloadKind;
|
|
19
|
+
body: string;
|
|
20
|
+
data?: Record<string, unknown>;
|
|
21
|
+
raw: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ParserOptions {
|
|
24
|
+
maxBlockBytes?: number;
|
|
25
|
+
enableInline?: boolean;
|
|
26
|
+
enableBlock?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare class OutputParser {
|
|
29
|
+
private options;
|
|
30
|
+
private inCodeFence;
|
|
31
|
+
private inBlock;
|
|
32
|
+
private blockBuffer;
|
|
33
|
+
constructor(options?: ParserOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Push data into the parser and extract commands.
|
|
36
|
+
* Returns array of parsed commands and cleaned output.
|
|
37
|
+
*
|
|
38
|
+
* Design: Pass through data with minimal buffering to preserve terminal rendering.
|
|
39
|
+
* Only buffer content when inside [[RELAY]]...[[/RELAY]] blocks.
|
|
40
|
+
*/
|
|
41
|
+
parse(data: string): {
|
|
42
|
+
commands: ParsedCommand[];
|
|
43
|
+
output: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Find [[RELAY]] that's at the start of a line and not inside a code fence.
|
|
47
|
+
* Returns the index, or -1 if not found.
|
|
48
|
+
*/
|
|
49
|
+
private findBlockStart;
|
|
50
|
+
/**
|
|
51
|
+
* Parse data in pass-through mode - TRUE pass-through for terminal rendering.
|
|
52
|
+
* Output is exactly the input data, minus any relay command lines found in this chunk.
|
|
53
|
+
* No cross-chunk buffering to avoid double-output issues.
|
|
54
|
+
*
|
|
55
|
+
* IMPORTANT: We ONLY parse complete lines (i.e. those terminated by `\n` in the
|
|
56
|
+
* current chunk). The final unterminated line (if any) is passed through without
|
|
57
|
+
* parsing. This intentionally avoids cross-chunk detection when a line is split
|
|
58
|
+
* across chunks.
|
|
59
|
+
*/
|
|
60
|
+
private parsePassThrough;
|
|
61
|
+
/**
|
|
62
|
+
* Parse while inside a [[RELAY]] block - buffer until we see [[/RELAY]].
|
|
63
|
+
*/
|
|
64
|
+
private parseInBlockMode;
|
|
65
|
+
/**
|
|
66
|
+
* Process a single complete line for inline relay commands.
|
|
67
|
+
* Block handling is done at the parse() level, not here.
|
|
68
|
+
*
|
|
69
|
+
* IMPORTANT: We strip ANSI codes for pattern matching, but preserve
|
|
70
|
+
* the original line for output to maintain terminal rendering.
|
|
71
|
+
*/
|
|
72
|
+
private processLine;
|
|
73
|
+
/**
|
|
74
|
+
* Finish processing a block and extract command.
|
|
75
|
+
* Returns the command (if valid) and any remaining content after [[/RELAY]].
|
|
76
|
+
*/
|
|
77
|
+
private finishBlock;
|
|
78
|
+
/**
|
|
79
|
+
* Flush any remaining buffer (call on stream end).
|
|
80
|
+
*/
|
|
81
|
+
flush(): {
|
|
82
|
+
commands: ParsedCommand[];
|
|
83
|
+
output: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Reset parser state.
|
|
87
|
+
*/
|
|
88
|
+
reset(): void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Format a relay command for injection into agent input.
|
|
92
|
+
*/
|
|
93
|
+
export declare function formatIncomingMessage(from: string, body: string, kind?: PayloadKind): string;
|
|
94
|
+
//# sourceMappingUR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;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,WAAuB,GAAG,MAAM,CAGvG"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PTY Output Parser
|
|
3
|
+
* Extracts relay commands from agent terminal output.
|
|
4
|
+
*
|
|
5
|
+
* Supports two formats:
|
|
6
|
+
* 1. Inline: @relay:<target> <message> (single line, start of line only)
|
|
7
|
+
* 2. Block: [[RELAY]]{ json }[[/RELAY]] (multi-line, structured)
|
|
8
|
+
*
|
|
9
|
+
* Rules:
|
|
10
|
+
* - Inline only matches at start of line (after whitespace)
|
|
11
|
+
* - Ignores content inside code fences
|
|
12
|
+
* - Escape with \@relay: to output literal
|
|
13
|
+
* - Block format is preferred for structured data
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_OPTIONS = {
|
|
16
|
+
maxBlockBytes: 1024 * 1024, // 1 MiB
|
|
17
|
+
enableInline: true,
|
|
18
|
+
enableBlock: true,
|
|
19
|
+
};
|
|
20
|
+
// Patterns
|
|
21
|
+
// Allow common input prefixes: >, $, %, #, →, ➜, bullets (●•◦‣⁃-*⏺◆◇○□■), and their variations
|
|
22
|
+
const INLINE_RELAY = /^(?:\s*(?:[>$%#→➜›»●•◦‣⁃\-*⏺◆◇○□■]\s*)*)?@relay:(\S+)\s+(.+)$/;
|
|
23
|
+
const INLINE_THINKING = /^(?:\s*(?:[>$%#→➜›»●•◦‣⁃\-*⏺◆◇○□■]\s*)*)?@thinking:(\S+)\s+(.+)$/;
|
|
24
|
+
const BLOCK_END = /\[\[\/RELAY\]\]/;
|
|
25
|
+
const CODE_FENCE = /^```/;
|
|
26
|
+
const ESCAPE_PREFIX = /^(\s*)\\@(relay|thinking):/;
|
|
27
|
+
// ANSI escape sequence pattern for stripping
|
|
28
|
+
// eslint-disable-next-line no-control-regex
|
|
29
|
+
const ANSI_PATTERN = /\x1b\[[0-9;?]*[a-zA-Z]|\x1b\].*?(?:\x07|\x1b\\)|\r/g;
|
|
30
|
+
/**
|
|
31
|
+
* Strip ANSI escape codes from a string for pattern matching.
|
|
32
|
+
*/
|
|
33
|
+
function stripAnsi(str) {
|
|
34
|
+
return str.replace(ANSI_PATTERN, '');
|
|
35
|
+
}
|
|
36
|
+
export class OutputParser {
|
|
37
|
+
options;
|
|
38
|
+
inCodeFence = false;
|
|
39
|
+
inBlock = false;
|
|
40
|
+
blockBuffer = '';
|
|
41
|
+
constructor(options = {}) {
|
|
42
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Push data into the parser and extract commands.
|
|
46
|
+
* Returns array of parsed commands and cleaned output.
|
|
47
|
+
*
|
|
48
|
+
* Design: Pass through data with minimal buffering to preserve terminal rendering.
|
|
49
|
+
* Only buffer content when inside [[RELAY]]...[[/RELAY]] blocks.
|
|
50
|
+
*/
|
|
51
|
+
parse(data) {
|
|
52
|
+
const commands = [];
|
|
53
|
+
let output = '';
|
|
54
|
+
// If we're inside a block, accumulate until we see the end
|
|
55
|
+
if (this.inBlock) {
|
|
56
|
+
return this.parseInBlockMode(data, commands);
|
|
57
|
+
}
|
|
58
|
+
// Find [[RELAY]] that's at the start of a line (or start of input)
|
|
59
|
+
// and NOT inside a code fence
|
|
60
|
+
const blockStartIdx = this.findBlockStart(data);
|
|
61
|
+
if (this.options.enableBlock && blockStartIdx !== -1) {
|
|
62
|
+
const before = data.substring(0, blockStartIdx);
|
|
63
|
+
const after = data.substring(blockStartIdx + '[[RELAY]]'.length);
|
|
64
|
+
// Output everything before the block start
|
|
65
|
+
if (before) {
|
|
66
|
+
const beforeResult = this.parsePassThrough(before, commands);
|
|
67
|
+
output += beforeResult;
|
|
68
|
+
}
|
|
69
|
+
// Enter block mode
|
|
70
|
+
this.inBlock = true;
|
|
71
|
+
this.blockBuffer = after;
|
|
72
|
+
// Check size limit before processing
|
|
73
|
+
if (this.blockBuffer.length > this.options.maxBlockBytes) {
|
|
74
|
+
console.error('[parser] Block too large, discarding');
|
|
75
|
+
this.inBlock = false;
|
|
76
|
+
this.blockBuffer = '';
|
|
77
|
+
return { commands, output };
|
|
78
|
+
}
|
|
79
|
+
// Check if block ends in same chunk
|
|
80
|
+
if (BLOCK_END.test(this.blockBuffer)) {
|
|
81
|
+
const blockResult = this.finishBlock();
|
|
82
|
+
if (blockResult.command) {
|
|
83
|
+
commands.push(blockResult.command);
|
|
84
|
+
}
|
|
85
|
+
if (blockResult.remaining) {
|
|
86
|
+
// Recursively parse anything after the block
|
|
87
|
+
const afterResult = this.parse(blockResult.remaining);
|
|
88
|
+
commands.push(...afterResult.commands);
|
|
89
|
+
output += afterResult.output;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return { commands, output };
|
|
93
|
+
}
|
|
94
|
+
// Pass-through mode: output data immediately, only parse complete lines for relay commands
|
|
95
|
+
output = this.parsePassThrough(data, commands);
|
|
96
|
+
return { commands, output };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Find [[RELAY]] that's at the start of a line and not inside a code fence.
|
|
100
|
+
* Returns the index, or -1 if not found.
|
|
101
|
+
*/
|
|
102
|
+
findBlockStart(data) {
|
|
103
|
+
// Track code fence state through the data
|
|
104
|
+
let inFence = this.inCodeFence;
|
|
105
|
+
let searchStart = 0;
|
|
106
|
+
while (searchStart < data.length) {
|
|
107
|
+
// Look for next [[RELAY]] or code fence
|
|
108
|
+
const relayIdx = data.indexOf('[[RELAY]]', searchStart);
|
|
109
|
+
const fenceIdx = data.indexOf('```', searchStart);
|
|
110
|
+
// No more [[RELAY]] found
|
|
111
|
+
if (relayIdx === -1) {
|
|
112
|
+
// Still update code fence state for remaining data
|
|
113
|
+
while (fenceIdx !== -1) {
|
|
114
|
+
const nextFence = data.indexOf('```', searchStart);
|
|
115
|
+
if (nextFence === -1)
|
|
116
|
+
break;
|
|
117
|
+
inFence = !inFence;
|
|
118
|
+
searchStart = nextFence + 3;
|
|
119
|
+
}
|
|
120
|
+
return -1;
|
|
121
|
+
}
|
|
122
|
+
// Process any code fences before this [[RELAY]]
|
|
123
|
+
let tempIdx = searchStart;
|
|
124
|
+
while (true) {
|
|
125
|
+
const nextFence = data.indexOf('```', tempIdx);
|
|
126
|
+
if (nextFence === -1 || nextFence >= relayIdx)
|
|
127
|
+
break;
|
|
128
|
+
inFence = !inFence;
|
|
129
|
+
tempIdx = nextFence + 3;
|
|
130
|
+
}
|
|
131
|
+
// If we're inside a code fence, skip this [[RELAY]]
|
|
132
|
+
if (inFence) {
|
|
133
|
+
searchStart = relayIdx + 9; // Skip past [[RELAY]]
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
// Check if [[RELAY]] is at start of a line
|
|
137
|
+
if (relayIdx === 0) {
|
|
138
|
+
return 0; // At very start
|
|
139
|
+
}
|
|
140
|
+
// Look backwards for the start of line
|
|
141
|
+
const beforeRelay = data.substring(0, relayIdx);
|
|
142
|
+
const lastNewline = beforeRelay.lastIndexOf('\n');
|
|
143
|
+
const lineStart = beforeRelay.substring(lastNewline + 1);
|
|
144
|
+
// Must be only whitespace before [[RELAY]] on this line
|
|
145
|
+
if (/^\s*$/.test(lineStart)) {
|
|
146
|
+
return relayIdx;
|
|
147
|
+
}
|
|
148
|
+
// Not at start of line, keep searching
|
|
149
|
+
searchStart = relayIdx + 9;
|
|
150
|
+
}
|
|
151
|
+
return -1;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Parse data in pass-through mode - TRUE pass-through for terminal rendering.
|
|
155
|
+
* Output is exactly the input data, minus any relay command lines found in this chunk.
|
|
156
|
+
* No cross-chunk buffering to avoid double-output issues.
|
|
157
|
+
*
|
|
158
|
+
* IMPORTANT: We ONLY parse complete lines (i.e. those terminated by `\n` in the
|
|
159
|
+
* current chunk). The final unterminated line (if any) is passed through without
|
|
160
|
+
* parsing. This intentionally avoids cross-chunk detection when a line is split
|
|
161
|
+
* across chunks.
|
|
162
|
+
*/
|
|
163
|
+
parsePassThrough(data, commands) {
|
|
164
|
+
// Simple approach: split data, check each line (complete or not), rebuild output
|
|
165
|
+
const lines = data.split('\n');
|
|
166
|
+
const hasTrailingNewline = data.endsWith('\n');
|
|
167
|
+
const outputLines = [];
|
|
168
|
+
let strippedCount = 0;
|
|
169
|
+
for (let i = 0; i < lines.length; i++) {
|
|
170
|
+
const line = lines[i];
|
|
171
|
+
const isLastLine = i === lines.length - 1;
|
|
172
|
+
// Skip the empty string after a trailing newline
|
|
173
|
+
if (isLastLine && hasTrailingNewline && line === '') {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
// If the chunk does NOT end in a newline, the last line is incomplete.
|
|
177
|
+
// Pass it through unmodified and do not attempt to parse it.
|
|
178
|
+
if (isLastLine && !hasTrailingNewline) {
|
|
179
|
+
outputLines.push(line);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (line.length > 0) {
|
|
183
|
+
// Only check complete lines for relay commands.
|
|
184
|
+
const result = this.processLine(line);
|
|
185
|
+
if (result.command) {
|
|
186
|
+
commands.push(result.command);
|
|
187
|
+
}
|
|
188
|
+
if (result.output !== null) {
|
|
189
|
+
outputLines.push(result.output);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
// Line was stripped (relay command)
|
|
193
|
+
strippedCount++;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
// Empty line - preserve it
|
|
198
|
+
outputLines.push('');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Rebuild output
|
|
202
|
+
if (outputLines.length === 0 && strippedCount > 0) {
|
|
203
|
+
// All lines were relay commands - return empty
|
|
204
|
+
return '';
|
|
205
|
+
}
|
|
206
|
+
let output = outputLines.join('\n');
|
|
207
|
+
// Add trailing newline if original had one AND we have content
|
|
208
|
+
if (hasTrailingNewline && outputLines.length > 0) {
|
|
209
|
+
output += '\n';
|
|
210
|
+
}
|
|
211
|
+
return output;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Parse while inside a [[RELAY]] block - buffer until we see [[/RELAY]].
|
|
215
|
+
*/
|
|
216
|
+
parseInBlockMode(data, commands) {
|
|
217
|
+
this.blockBuffer += data;
|
|
218
|
+
// Check size limit
|
|
219
|
+
if (this.blockBuffer.length > this.options.maxBlockBytes) {
|
|
220
|
+
console.error('[parser] Block too large, discarding');
|
|
221
|
+
this.inBlock = false;
|
|
222
|
+
this.blockBuffer = '';
|
|
223
|
+
return { commands, output: '' };
|
|
224
|
+
}
|
|
225
|
+
// Check for block end
|
|
226
|
+
if (BLOCK_END.test(this.blockBuffer)) {
|
|
227
|
+
const result = this.finishBlock();
|
|
228
|
+
if (result.command) {
|
|
229
|
+
commands.push(result.command);
|
|
230
|
+
}
|
|
231
|
+
let output = '';
|
|
232
|
+
if (result.remaining) {
|
|
233
|
+
// Recursively parse anything after the block
|
|
234
|
+
const afterResult = this.parse(result.remaining);
|
|
235
|
+
commands.push(...afterResult.commands);
|
|
236
|
+
output = afterResult.output;
|
|
237
|
+
}
|
|
238
|
+
return { commands, output };
|
|
239
|
+
}
|
|
240
|
+
// Still inside block, no output yet
|
|
241
|
+
return { commands, output: '' };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Process a single complete line for inline relay commands.
|
|
245
|
+
* Block handling is done at the parse() level, not here.
|
|
246
|
+
*
|
|
247
|
+
* IMPORTANT: We strip ANSI codes for pattern matching, but preserve
|
|
248
|
+
* the original line for output to maintain terminal rendering.
|
|
249
|
+
*/
|
|
250
|
+
processLine(line) {
|
|
251
|
+
// Strip ANSI codes for pattern matching
|
|
252
|
+
const stripped = stripAnsi(line);
|
|
253
|
+
// Handle code fences
|
|
254
|
+
if (CODE_FENCE.test(stripped)) {
|
|
255
|
+
this.inCodeFence = !this.inCodeFence;
|
|
256
|
+
return { command: null, output: line };
|
|
257
|
+
}
|
|
258
|
+
// Inside code fence - pass through
|
|
259
|
+
if (this.inCodeFence) {
|
|
260
|
+
return { command: null, output: line };
|
|
261
|
+
}
|
|
262
|
+
// Check for escaped inline (on stripped text)
|
|
263
|
+
const escapeMatch = stripped.match(ESCAPE_PREFIX);
|
|
264
|
+
if (escapeMatch) {
|
|
265
|
+
// Output with escape removed
|
|
266
|
+
const unescaped = line.replace(/\\@/, '@');
|
|
267
|
+
return { command: null, output: unescaped };
|
|
268
|
+
}
|
|
269
|
+
// Check for inline relay (on stripped text)
|
|
270
|
+
if (this.options.enableInline) {
|
|
271
|
+
const relayMatch = stripped.match(INLINE_RELAY);
|
|
272
|
+
if (relayMatch) {
|
|
273
|
+
const [raw, target, body] = relayMatch;
|
|
274
|
+
return {
|
|
275
|
+
command: {
|
|
276
|
+
to: target,
|
|
277
|
+
kind: 'message',
|
|
278
|
+
body,
|
|
279
|
+
raw,
|
|
280
|
+
},
|
|
281
|
+
output: null, // Don't output relay commands
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
const thinkingMatch = stripped.match(INLINE_THINKING);
|
|
285
|
+
if (thinkingMatch) {
|
|
286
|
+
const [raw, target, body] = thinkingMatch;
|
|
287
|
+
return {
|
|
288
|
+
command: {
|
|
289
|
+
to: target,
|
|
290
|
+
kind: 'thinking',
|
|
291
|
+
body,
|
|
292
|
+
raw,
|
|
293
|
+
},
|
|
294
|
+
output: null,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// Regular line
|
|
299
|
+
return { command: null, output: line };
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Finish processing a block and extract command.
|
|
303
|
+
* Returns the command (if valid) and any remaining content after [[/RELAY]].
|
|
304
|
+
*/
|
|
305
|
+
finishBlock() {
|
|
306
|
+
const endIdx = this.blockBuffer.indexOf('[[/RELAY]]');
|
|
307
|
+
const jsonStr = this.blockBuffer.substring(0, endIdx).trim();
|
|
308
|
+
const remaining = this.blockBuffer.substring(endIdx + '[[/RELAY]]'.length) || null;
|
|
309
|
+
this.inBlock = false;
|
|
310
|
+
this.blockBuffer = '';
|
|
311
|
+
try {
|
|
312
|
+
const parsed = JSON.parse(jsonStr);
|
|
313
|
+
// Validate required fields
|
|
314
|
+
if (!parsed.to || !parsed.type) {
|
|
315
|
+
console.error('[parser] Block missing required fields (to, type)');
|
|
316
|
+
return { command: null, remaining };
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
command: {
|
|
320
|
+
to: parsed.to,
|
|
321
|
+
kind: parsed.type,
|
|
322
|
+
body: parsed.body ?? parsed.text ?? '',
|
|
323
|
+
data: parsed.data,
|
|
324
|
+
raw: jsonStr,
|
|
325
|
+
},
|
|
326
|
+
remaining,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
catch (err) {
|
|
330
|
+
console.error('[parser] Invalid JSON in block:', err);
|
|
331
|
+
return { command: null, remaining };
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Flush any remaining buffer (call on stream end).
|
|
336
|
+
*/
|
|
337
|
+
flush() {
|
|
338
|
+
const result = this.parse('\n');
|
|
339
|
+
this.inBlock = false;
|
|
340
|
+
this.blockBuffer = '';
|
|
341
|
+
this.inCodeFence = false;
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Reset parser state.
|
|
346
|
+
*/
|
|
347
|
+
reset() {
|
|
348
|
+
this.inBlock = false;
|
|
349
|
+
this.blockBuffer = '';
|
|
350
|
+
this.inCodeFence = false;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Format a relay command for injection into agent input.
|
|
355
|
+
*/
|
|
356
|
+
export function formatIncomingMessage(from, body, kind = 'message') {
|
|
357
|
+
const prefix = kind === 'thinking' ? '[THINKING]' : '[MSG]';
|
|
358
|
+
return `\n${prefix} from ${from}: ${body}\n`;
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
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