@agentmeshhq/agent 0.4.18 → 0.4.20
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/dist/__tests__/attach.test.d.ts +1 -0
- package/dist/__tests__/attach.test.js +200 -0
- package/dist/__tests__/attach.test.js.map +1 -0
- package/dist/__tests__/auth-guard.integration.test.js +1 -1
- package/dist/__tests__/auth-guard.integration.test.js.map +1 -1
- package/dist/__tests__/auth-guard.test.js +3 -3
- package/dist/__tests__/auth-guard.test.js.map +1 -1
- package/dist/__tests__/bootstrap.test.js +23 -0
- package/dist/__tests__/bootstrap.test.js.map +1 -1
- package/dist/__tests__/daemon-hub-resilience.test.js +2 -2
- package/dist/__tests__/daemon-hub-resilience.test.js.map +1 -1
- package/dist/__tests__/evicted-cleanup.test.js.map +1 -1
- package/dist/__tests__/injector.test.js +47 -4
- package/dist/__tests__/injector.test.js.map +1 -1
- package/dist/__tests__/list.test.d.ts +1 -0
- package/dist/__tests__/list.test.js +62 -0
- package/dist/__tests__/list.test.js.map +1 -0
- package/dist/__tests__/opencode-serve.test.d.ts +1 -0
- package/dist/__tests__/opencode-serve.test.js +54 -0
- package/dist/__tests__/opencode-serve.test.js.map +1 -0
- package/dist/__tests__/opencode-session-policy.test.d.ts +1 -0
- package/dist/__tests__/opencode-session-policy.test.js +61 -0
- package/dist/__tests__/opencode-session-policy.test.js.map +1 -0
- package/dist/__tests__/opencode-session.test.d.ts +1 -0
- package/dist/__tests__/opencode-session.test.js +178 -0
- package/dist/__tests__/opencode-session.test.js.map +1 -0
- package/dist/__tests__/registry.register.test.js +16 -0
- package/dist/__tests__/registry.register.test.js.map +1 -1
- package/dist/__tests__/relay.test.js +121 -2
- package/dist/__tests__/relay.test.js.map +1 -1
- package/dist/__tests__/shared-resource-guards.test.js +1 -4
- package/dist/__tests__/shared-resource-guards.test.js.map +1 -1
- package/dist/__tests__/start-team-id.test.js +22 -0
- package/dist/__tests__/start-team-id.test.js.map +1 -1
- package/dist/__tests__/token-rejection-recovery.test.js +52 -0
- package/dist/__tests__/token-rejection-recovery.test.js.map +1 -1
- package/dist/__tests__/watcher-queue.test.js +7 -2
- package/dist/__tests__/watcher-queue.test.js.map +1 -1
- package/dist/cli/attach.d.ts +1 -1
- package/dist/cli/attach.js +125 -2
- package/dist/cli/attach.js.map +1 -1
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/index.js +9 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/list.js +26 -2
- package/dist/cli/list.js.map +1 -1
- package/dist/cli/relay.d.ts +3 -0
- package/dist/cli/relay.js +149 -1
- package/dist/cli/relay.js.map +1 -1
- package/dist/cli/start.d.ts +9 -1
- package/dist/cli/start.js +8 -0
- package/dist/cli/start.js.map +1 -1
- package/dist/cli/status.js +21 -8
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/test.js +12 -1
- package/dist/cli/test.js.map +1 -1
- package/dist/config/schema.d.ts +16 -0
- package/dist/core/auth-guard.js +2 -2
- package/dist/core/auth-guard.js.map +1 -1
- package/dist/core/chat-output-parser.d.ts +3 -3
- package/dist/core/chat-output-parser.js +35 -19
- package/dist/core/chat-output-parser.js.map +1 -1
- package/dist/core/chat-output-parser.test.js +21 -0
- package/dist/core/chat-output-parser.test.js.map +1 -1
- package/dist/core/daemon/bootstrap.d.ts +8 -0
- package/dist/core/daemon/bootstrap.js +6 -1
- package/dist/core/daemon/bootstrap.js.map +1 -1
- package/dist/core/daemon/state.d.ts +8 -0
- package/dist/core/daemon/state.js +8 -0
- package/dist/core/daemon/state.js.map +1 -1
- package/dist/core/daemon/tmux-session.d.ts +4 -0
- package/dist/core/daemon/tmux-session.js +9 -1
- package/dist/core/daemon/tmux-session.js.map +1 -1
- package/dist/core/daemon/workspace.js +10 -2
- package/dist/core/daemon/workspace.js.map +1 -1
- package/dist/core/daemon.d.ts +10 -1
- package/dist/core/daemon.js +155 -18
- package/dist/core/daemon.js.map +1 -1
- package/dist/core/handoff-sla.js +1 -1
- package/dist/core/handoff-sla.js.map +1 -1
- package/dist/core/injector.d.ts +2 -0
- package/dist/core/injector.js +107 -49
- package/dist/core/injector.js.map +1 -1
- package/dist/core/opencode-serve.d.ts +26 -0
- package/dist/core/opencode-serve.js +97 -0
- package/dist/core/opencode-serve.js.map +1 -0
- package/dist/core/opencode-session-policy.d.ts +10 -0
- package/dist/core/opencode-session-policy.js +10 -0
- package/dist/core/opencode-session-policy.js.map +1 -0
- package/dist/core/opencode-session.d.ts +12 -0
- package/dist/core/opencode-session.js +165 -0
- package/dist/core/opencode-session.js.map +1 -0
- package/dist/core/registry.d.ts +2 -1
- package/dist/core/registry.js +3 -2
- package/dist/core/registry.js.map +1 -1
- package/dist/core/tmux-runtime.d.ts +1 -0
- package/dist/core/tmux-runtime.js +4 -1
- package/dist/core/tmux-runtime.js.map +1 -1
- package/dist/core/tmux.js +5 -0
- package/dist/core/tmux.js.map +1 -1
- package/dist/runtime/adapters/opencode.d.ts +63 -0
- package/dist/runtime/adapters/opencode.js +358 -0
- package/dist/runtime/adapters/opencode.js.map +1 -0
- package/dist/runtime/adapters/tmux-fallback.d.ts +23 -0
- package/dist/runtime/adapters/tmux-fallback.js +148 -0
- package/dist/runtime/adapters/tmux-fallback.js.map +1 -0
- package/dist/runtime/adapters/tmux-fallback.test.d.ts +4 -0
- package/dist/runtime/adapters/tmux-fallback.test.js +91 -0
- package/dist/runtime/adapters/tmux-fallback.test.js.map +1 -0
- package/dist/runtime/index.d.ts +146 -0
- package/dist/runtime/index.js +191 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/registry.d.ts +53 -0
- package/dist/runtime/registry.js +112 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/runtime/registry.test.d.ts +4 -0
- package/dist/runtime/registry.test.js +69 -0
- package/dist/runtime/registry.test.js.map +1 -0
- package/dist/runtime/types.d.ts +158 -0
- package/dist/runtime/types.js +8 -0
- package/dist/runtime/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime Adapter Types
|
|
3
|
+
*
|
|
4
|
+
* Cross-runner runtime I/O contract for AgentMesh chat/control.
|
|
5
|
+
* Provides normalized event-based output instead of tmux pane scraping.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Output modes for runtime chat responses
|
|
9
|
+
*/
|
|
10
|
+
export type OutputMode = "clean" | "raw" | "structured";
|
|
11
|
+
/**
|
|
12
|
+
* Structured output metadata
|
|
13
|
+
*/
|
|
14
|
+
export interface StructuredOutput {
|
|
15
|
+
/** The cleaned LLM reply text */
|
|
16
|
+
content: string;
|
|
17
|
+
/** Raw captured output (for debugging) */
|
|
18
|
+
rawOutput: string;
|
|
19
|
+
/** Capture metadata */
|
|
20
|
+
metadata: {
|
|
21
|
+
/** ISO timestamp when output was captured */
|
|
22
|
+
capturedAt: string;
|
|
23
|
+
/** Number of lines captured from tmux */
|
|
24
|
+
linesCaptured: number;
|
|
25
|
+
/** Time taken to stabilize in milliseconds */
|
|
26
|
+
stabilizationMs: number;
|
|
27
|
+
/** Whether output was truncated */
|
|
28
|
+
truncated: boolean;
|
|
29
|
+
/** Delivery path: 'opencode-serve:<port>' or 'tmux-fallback' */
|
|
30
|
+
delivery_path?: string;
|
|
31
|
+
};
|
|
32
|
+
/** Parsing metadata */
|
|
33
|
+
parsing: {
|
|
34
|
+
/** Whether the output was successfully parsed */
|
|
35
|
+
success: boolean;
|
|
36
|
+
/** Parser used (e.g., 'tmux-regex', 'ansi-strip', 'json-events') */
|
|
37
|
+
parser: string;
|
|
38
|
+
/** Error message if parsing failed */
|
|
39
|
+
error?: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Runtime event types
|
|
44
|
+
*/
|
|
45
|
+
export type RuntimeEventType = "output.start" | "output.chunk" | "output.complete" | "output.error" | "runner.ready" | "runner.busy" | "tool.start" | "tool.complete" | "message.delta" | "message.complete";
|
|
46
|
+
/**
|
|
47
|
+
* Runtime event from runner
|
|
48
|
+
*/
|
|
49
|
+
export interface RuntimeEvent {
|
|
50
|
+
/** Event type */
|
|
51
|
+
type: RuntimeEventType;
|
|
52
|
+
/** ISO timestamp */
|
|
53
|
+
timestamp: string;
|
|
54
|
+
/** Event payload (type-specific) */
|
|
55
|
+
payload: unknown;
|
|
56
|
+
/** Correlation ID for request/response pairing */
|
|
57
|
+
correlationId?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Chat input request
|
|
61
|
+
*/
|
|
62
|
+
export interface ChatInputRequest {
|
|
63
|
+
/** Message content to inject */
|
|
64
|
+
content: string;
|
|
65
|
+
/** Output mode preference */
|
|
66
|
+
outputMode: OutputMode;
|
|
67
|
+
/** Message ID for correlation */
|
|
68
|
+
messageId: string;
|
|
69
|
+
/** Workspace ID */
|
|
70
|
+
workspace: string;
|
|
71
|
+
/** Agent ID */
|
|
72
|
+
agentId: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Chat output response
|
|
76
|
+
*/
|
|
77
|
+
export type ChatOutputResponse = {
|
|
78
|
+
mode: "clean";
|
|
79
|
+
content: string;
|
|
80
|
+
} | {
|
|
81
|
+
mode: "raw";
|
|
82
|
+
content: string;
|
|
83
|
+
} | {
|
|
84
|
+
mode: "structured";
|
|
85
|
+
data: StructuredOutput;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Runtime adapter interface
|
|
89
|
+
*
|
|
90
|
+
* Implementations provide runner-specific I/O handling.
|
|
91
|
+
*/
|
|
92
|
+
export interface RuntimeAdapter {
|
|
93
|
+
/** Adapter identifier */
|
|
94
|
+
readonly id: string;
|
|
95
|
+
/** Human-readable name */
|
|
96
|
+
readonly displayName: string;
|
|
97
|
+
/** Supported runner types */
|
|
98
|
+
readonly supportedRunners: string[];
|
|
99
|
+
/** Whether this adapter supports structured events */
|
|
100
|
+
readonly supportsStructuredEvents: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Check if this adapter can handle the given session
|
|
103
|
+
*/
|
|
104
|
+
canHandle(sessionName: string): boolean | Promise<boolean>;
|
|
105
|
+
/**
|
|
106
|
+
* Inject chat input into the runtime session
|
|
107
|
+
*/
|
|
108
|
+
injectInput(sessionName: string, request: ChatInputRequest): boolean | Promise<boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* Capture output from the runtime session
|
|
111
|
+
*/
|
|
112
|
+
captureOutput(sessionName: string, request: ChatInputRequest): ChatOutputResponse | Promise<ChatOutputResponse>;
|
|
113
|
+
/**
|
|
114
|
+
* Wait for stable output and return in requested mode
|
|
115
|
+
*/
|
|
116
|
+
waitForOutput(sessionName: string, request: ChatInputRequest, options?: WaitForOutputOptions): Promise<ChatOutputResponse>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Options for waitForOutput
|
|
120
|
+
*/
|
|
121
|
+
export interface WaitForOutputOptions {
|
|
122
|
+
/** Poll interval in milliseconds (default: 2000) */
|
|
123
|
+
pollMs?: number;
|
|
124
|
+
/** Stabilization time in milliseconds (default: 5000) */
|
|
125
|
+
stableMs?: number;
|
|
126
|
+
/** Hard timeout in milliseconds (default: 60000) */
|
|
127
|
+
timeoutMs?: number;
|
|
128
|
+
/** Maximum lines to capture (default: 120) */
|
|
129
|
+
maxLines?: number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Adapter capability flags
|
|
133
|
+
*/
|
|
134
|
+
export interface AdapterCapabilities {
|
|
135
|
+
/** Supports JSON event streaming */
|
|
136
|
+
jsonEvents: boolean;
|
|
137
|
+
/** Supports ANSI stripping */
|
|
138
|
+
ansiStripping: boolean;
|
|
139
|
+
/** Supports prompt detection */
|
|
140
|
+
promptDetection: boolean;
|
|
141
|
+
/** Supports tool execution tracking */
|
|
142
|
+
toolTracking: boolean;
|
|
143
|
+
/** Supports mid-work chat (while tools running) */
|
|
144
|
+
midWorkChat: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Runner detection result
|
|
148
|
+
*/
|
|
149
|
+
export interface RunnerDetectionResult {
|
|
150
|
+
/** Detected runner type */
|
|
151
|
+
runnerType: string;
|
|
152
|
+
/** Detected runner version (if available) */
|
|
153
|
+
version?: string;
|
|
154
|
+
/** Whether structured events are available */
|
|
155
|
+
structuredEventsAvailable: boolean;
|
|
156
|
+
/** Recommended adapter ID */
|
|
157
|
+
recommendedAdapter: string;
|
|
158
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED