@ericsanchezok/meta-synergy 0.0.0-dev-202603260728

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 (48) hide show
  1. package/.turbo/turbo-typecheck.log +1 -0
  2. package/dist/meta-protocol/src/bash.d.ts +89 -0
  3. package/dist/meta-protocol/src/bash.js +40 -0
  4. package/dist/meta-protocol/src/client.d.ts +9 -0
  5. package/dist/meta-protocol/src/client.js +1 -0
  6. package/dist/meta-protocol/src/env.d.ts +16 -0
  7. package/dist/meta-protocol/src/env.js +17 -0
  8. package/dist/meta-protocol/src/envelope.d.ts +50 -0
  9. package/dist/meta-protocol/src/envelope.js +23 -0
  10. package/dist/meta-protocol/src/error.d.ts +39 -0
  11. package/dist/meta-protocol/src/error.js +24 -0
  12. package/dist/meta-protocol/src/host.d.ts +90 -0
  13. package/dist/meta-protocol/src/host.js +27 -0
  14. package/dist/meta-protocol/src/index.d.ts +7 -0
  15. package/dist/meta-protocol/src/index.js +7 -0
  16. package/dist/meta-protocol/src/process.d.ts +274 -0
  17. package/dist/meta-protocol/src/process.js +89 -0
  18. package/dist/meta-synergy/src/client/holos-client.d.ts +15 -0
  19. package/dist/meta-synergy/src/client/holos-client.js +35 -0
  20. package/dist/meta-synergy/src/exec/bash-runner.d.ts +7 -0
  21. package/dist/meta-synergy/src/exec/bash-runner.js +9 -0
  22. package/dist/meta-synergy/src/exec/process-registry.d.ts +11 -0
  23. package/dist/meta-synergy/src/exec/process-registry.js +597 -0
  24. package/dist/meta-synergy/src/host.d.ts +32 -0
  25. package/dist/meta-synergy/src/host.js +27 -0
  26. package/dist/meta-synergy/src/index.d.ts +8 -0
  27. package/dist/meta-synergy/src/index.js +8 -0
  28. package/dist/meta-synergy/src/platform.d.ts +25 -0
  29. package/dist/meta-synergy/src/platform.js +230 -0
  30. package/dist/meta-synergy/src/rpc/handler.d.ts +66 -0
  31. package/dist/meta-synergy/src/rpc/handler.js +60 -0
  32. package/dist/meta-synergy/src/rpc/schema.d.ts +163 -0
  33. package/dist/meta-synergy/src/rpc/schema.js +11 -0
  34. package/dist/meta-synergy/src/types.d.ts +14 -0
  35. package/dist/meta-synergy/src/types.js +1 -0
  36. package/package.json +30 -0
  37. package/script/publish.ts +32 -0
  38. package/src/client/holos-client.ts +49 -0
  39. package/src/exec/bash-runner.ts +10 -0
  40. package/src/exec/process-registry.ts +728 -0
  41. package/src/host.ts +39 -0
  42. package/src/index.ts +8 -0
  43. package/src/platform.ts +227 -0
  44. package/src/rpc/handler.ts +76 -0
  45. package/src/rpc/schema.ts +16 -0
  46. package/src/types.ts +17 -0
  47. package/test/rpc-handler.test.ts +76 -0
  48. package/tsconfig.json +23 -0
@@ -0,0 +1,274 @@
1
+ import z from "zod";
2
+ export declare namespace MetaProtocolProcess {
3
+ const Action: z.ZodEnum<{
4
+ list: "list";
5
+ poll: "poll";
6
+ log: "log";
7
+ write: "write";
8
+ "send-keys": "send-keys";
9
+ kill: "kill";
10
+ clear: "clear";
11
+ remove: "remove";
12
+ }>;
13
+ type Action = z.infer<typeof Action>;
14
+ const ProcessState: z.ZodEnum<{
15
+ running: "running";
16
+ completed: "completed";
17
+ failed: "failed";
18
+ killed: "killed";
19
+ }>;
20
+ type ProcessState = z.infer<typeof ProcessState>;
21
+ const ActionStatus: z.ZodEnum<{
22
+ error: "error";
23
+ running: "running";
24
+ completed: "completed";
25
+ failed: "failed";
26
+ killed: "killed";
27
+ not_found: "not_found";
28
+ cleared: "cleared";
29
+ removed: "removed";
30
+ }>;
31
+ type ActionStatus = z.infer<typeof ActionStatus>;
32
+ const ProcessInfo: z.ZodObject<{
33
+ processId: z.ZodString;
34
+ status: z.ZodEnum<{
35
+ running: "running";
36
+ completed: "completed";
37
+ failed: "failed";
38
+ killed: "killed";
39
+ }>;
40
+ command: z.ZodString;
41
+ description: z.ZodOptional<z.ZodString>;
42
+ runtimeMs: z.ZodNumber;
43
+ }, z.core.$strip>;
44
+ type ProcessInfo = z.infer<typeof ProcessInfo>;
45
+ const ExecutePayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ action: z.ZodLiteral<"list">;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ action: z.ZodLiteral<"poll">;
49
+ processId: z.ZodString;
50
+ block: z.ZodOptional<z.ZodBoolean>;
51
+ timeout: z.ZodOptional<z.ZodNumber>;
52
+ }, z.core.$strip>, z.ZodObject<{
53
+ action: z.ZodLiteral<"log">;
54
+ processId: z.ZodString;
55
+ offset: z.ZodOptional<z.ZodNumber>;
56
+ limit: z.ZodOptional<z.ZodNumber>;
57
+ }, z.core.$strip>, z.ZodObject<{
58
+ action: z.ZodLiteral<"write">;
59
+ processId: z.ZodString;
60
+ data: z.ZodString;
61
+ }, z.core.$strip>, z.ZodObject<{
62
+ action: z.ZodLiteral<"send-keys">;
63
+ processId: z.ZodString;
64
+ keys: z.ZodArray<z.ZodString>;
65
+ }, z.core.$strip>, z.ZodObject<{
66
+ action: z.ZodLiteral<"kill">;
67
+ processId: z.ZodString;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ action: z.ZodLiteral<"clear">;
70
+ processId: z.ZodString;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ action: z.ZodLiteral<"remove">;
73
+ processId: z.ZodString;
74
+ }, z.core.$strip>], "action">;
75
+ type ExecutePayload = z.infer<typeof ExecutePayload>;
76
+ const ResultMetadata: z.ZodObject<{
77
+ action: z.ZodEnum<{
78
+ list: "list";
79
+ poll: "poll";
80
+ log: "log";
81
+ write: "write";
82
+ "send-keys": "send-keys";
83
+ kill: "kill";
84
+ clear: "clear";
85
+ remove: "remove";
86
+ }>;
87
+ processId: z.ZodOptional<z.ZodString>;
88
+ status: z.ZodOptional<z.ZodEnum<{
89
+ error: "error";
90
+ running: "running";
91
+ completed: "completed";
92
+ failed: "failed";
93
+ killed: "killed";
94
+ not_found: "not_found";
95
+ cleared: "cleared";
96
+ removed: "removed";
97
+ }>>;
98
+ exitCode: z.ZodOptional<z.ZodNumber>;
99
+ command: z.ZodOptional<z.ZodString>;
100
+ description: z.ZodOptional<z.ZodString>;
101
+ nextOffset: z.ZodOptional<z.ZodNumber>;
102
+ hostSessionID: z.ZodOptional<z.ZodString>;
103
+ envID: z.ZodOptional<z.ZodString>;
104
+ backend: z.ZodOptional<z.ZodEnum<{
105
+ local: "local";
106
+ remote: "remote";
107
+ }>>;
108
+ processes: z.ZodOptional<z.ZodArray<z.ZodObject<{
109
+ processId: z.ZodString;
110
+ status: z.ZodEnum<{
111
+ running: "running";
112
+ completed: "completed";
113
+ failed: "failed";
114
+ killed: "killed";
115
+ }>;
116
+ command: z.ZodString;
117
+ description: z.ZodOptional<z.ZodString>;
118
+ runtimeMs: z.ZodNumber;
119
+ }, z.core.$strip>>>;
120
+ }, z.core.$strip>;
121
+ type ResultMetadata = z.infer<typeof ResultMetadata>;
122
+ const Result: z.ZodObject<{
123
+ title: z.ZodString;
124
+ metadata: z.ZodObject<{
125
+ action: z.ZodEnum<{
126
+ list: "list";
127
+ poll: "poll";
128
+ log: "log";
129
+ write: "write";
130
+ "send-keys": "send-keys";
131
+ kill: "kill";
132
+ clear: "clear";
133
+ remove: "remove";
134
+ }>;
135
+ processId: z.ZodOptional<z.ZodString>;
136
+ status: z.ZodOptional<z.ZodEnum<{
137
+ error: "error";
138
+ running: "running";
139
+ completed: "completed";
140
+ failed: "failed";
141
+ killed: "killed";
142
+ not_found: "not_found";
143
+ cleared: "cleared";
144
+ removed: "removed";
145
+ }>>;
146
+ exitCode: z.ZodOptional<z.ZodNumber>;
147
+ command: z.ZodOptional<z.ZodString>;
148
+ description: z.ZodOptional<z.ZodString>;
149
+ nextOffset: z.ZodOptional<z.ZodNumber>;
150
+ hostSessionID: z.ZodOptional<z.ZodString>;
151
+ envID: z.ZodOptional<z.ZodString>;
152
+ backend: z.ZodOptional<z.ZodEnum<{
153
+ local: "local";
154
+ remote: "remote";
155
+ }>>;
156
+ processes: z.ZodOptional<z.ZodArray<z.ZodObject<{
157
+ processId: z.ZodString;
158
+ status: z.ZodEnum<{
159
+ running: "running";
160
+ completed: "completed";
161
+ failed: "failed";
162
+ killed: "killed";
163
+ }>;
164
+ command: z.ZodString;
165
+ description: z.ZodOptional<z.ZodString>;
166
+ runtimeMs: z.ZodNumber;
167
+ }, z.core.$strip>>>;
168
+ }, z.core.$strip>;
169
+ output: z.ZodString;
170
+ }, z.core.$strip>;
171
+ type Result = z.infer<typeof Result>;
172
+ const ExecuteRequest: z.ZodObject<{
173
+ version: z.ZodLiteral<1>;
174
+ requestID: z.ZodString;
175
+ envID: z.ZodString;
176
+ tool: z.ZodLiteral<"process">;
177
+ action: z.ZodEnum<{
178
+ list: "list";
179
+ poll: "poll";
180
+ log: "log";
181
+ write: "write";
182
+ "send-keys": "send-keys";
183
+ kill: "kill";
184
+ clear: "clear";
185
+ remove: "remove";
186
+ }>;
187
+ payload: z.ZodDiscriminatedUnion<[z.ZodObject<{
188
+ action: z.ZodLiteral<"list">;
189
+ }, z.core.$strip>, z.ZodObject<{
190
+ action: z.ZodLiteral<"poll">;
191
+ processId: z.ZodString;
192
+ block: z.ZodOptional<z.ZodBoolean>;
193
+ timeout: z.ZodOptional<z.ZodNumber>;
194
+ }, z.core.$strip>, z.ZodObject<{
195
+ action: z.ZodLiteral<"log">;
196
+ processId: z.ZodString;
197
+ offset: z.ZodOptional<z.ZodNumber>;
198
+ limit: z.ZodOptional<z.ZodNumber>;
199
+ }, z.core.$strip>, z.ZodObject<{
200
+ action: z.ZodLiteral<"write">;
201
+ processId: z.ZodString;
202
+ data: z.ZodString;
203
+ }, z.core.$strip>, z.ZodObject<{
204
+ action: z.ZodLiteral<"send-keys">;
205
+ processId: z.ZodString;
206
+ keys: z.ZodArray<z.ZodString>;
207
+ }, z.core.$strip>, z.ZodObject<{
208
+ action: z.ZodLiteral<"kill">;
209
+ processId: z.ZodString;
210
+ }, z.core.$strip>, z.ZodObject<{
211
+ action: z.ZodLiteral<"clear">;
212
+ processId: z.ZodString;
213
+ }, z.core.$strip>, z.ZodObject<{
214
+ action: z.ZodLiteral<"remove">;
215
+ processId: z.ZodString;
216
+ }, z.core.$strip>], "action">;
217
+ }, z.core.$strip>;
218
+ type ExecuteRequest = z.infer<typeof ExecuteRequest>;
219
+ const ExecuteResult: z.ZodObject<{
220
+ version: z.ZodLiteral<1>;
221
+ requestID: z.ZodString;
222
+ ok: z.ZodLiteral<true>;
223
+ result: z.ZodObject<{
224
+ title: z.ZodString;
225
+ metadata: z.ZodObject<{
226
+ action: z.ZodEnum<{
227
+ list: "list";
228
+ poll: "poll";
229
+ log: "log";
230
+ write: "write";
231
+ "send-keys": "send-keys";
232
+ kill: "kill";
233
+ clear: "clear";
234
+ remove: "remove";
235
+ }>;
236
+ processId: z.ZodOptional<z.ZodString>;
237
+ status: z.ZodOptional<z.ZodEnum<{
238
+ error: "error";
239
+ running: "running";
240
+ completed: "completed";
241
+ failed: "failed";
242
+ killed: "killed";
243
+ not_found: "not_found";
244
+ cleared: "cleared";
245
+ removed: "removed";
246
+ }>>;
247
+ exitCode: z.ZodOptional<z.ZodNumber>;
248
+ command: z.ZodOptional<z.ZodString>;
249
+ description: z.ZodOptional<z.ZodString>;
250
+ nextOffset: z.ZodOptional<z.ZodNumber>;
251
+ hostSessionID: z.ZodOptional<z.ZodString>;
252
+ envID: z.ZodOptional<z.ZodString>;
253
+ backend: z.ZodOptional<z.ZodEnum<{
254
+ local: "local";
255
+ remote: "remote";
256
+ }>>;
257
+ processes: z.ZodOptional<z.ZodArray<z.ZodObject<{
258
+ processId: z.ZodString;
259
+ status: z.ZodEnum<{
260
+ running: "running";
261
+ completed: "completed";
262
+ failed: "failed";
263
+ killed: "killed";
264
+ }>;
265
+ command: z.ZodString;
266
+ description: z.ZodOptional<z.ZodString>;
267
+ runtimeMs: z.ZodNumber;
268
+ }, z.core.$strip>>>;
269
+ }, z.core.$strip>;
270
+ output: z.ZodString;
271
+ }, z.core.$strip>;
272
+ }, z.core.$strip>;
273
+ type ExecuteResult = z.infer<typeof ExecuteResult>;
274
+ }
@@ -0,0 +1,89 @@
1
+ import z from "zod";
2
+ import { MetaProtocolEnvelope } from "./envelope";
3
+ import { MetaProtocolEnv } from "./env";
4
+ export var MetaProtocolProcess;
5
+ (function (MetaProtocolProcess) {
6
+ MetaProtocolProcess.Action = z.enum(["list", "poll", "log", "write", "send-keys", "kill", "clear", "remove"]);
7
+ MetaProtocolProcess.ProcessState = z.enum(["running", "completed", "failed", "killed"]);
8
+ MetaProtocolProcess.ActionStatus = z.enum([
9
+ "running",
10
+ "completed",
11
+ "failed",
12
+ "killed",
13
+ "not_found",
14
+ "error",
15
+ "cleared",
16
+ "removed",
17
+ ]);
18
+ MetaProtocolProcess.ProcessInfo = z.object({
19
+ processId: MetaProtocolEnv.ProcessID,
20
+ status: MetaProtocolProcess.ProcessState,
21
+ command: z.string(),
22
+ description: z.string().optional(),
23
+ runtimeMs: z.number(),
24
+ });
25
+ MetaProtocolProcess.ExecutePayload = z.discriminatedUnion("action", [
26
+ z.object({ action: z.literal("list") }),
27
+ z.object({
28
+ action: z.literal("poll"),
29
+ processId: MetaProtocolEnv.ProcessID,
30
+ block: z.boolean().optional(),
31
+ timeout: z.number().optional(),
32
+ }),
33
+ z.object({
34
+ action: z.literal("log"),
35
+ processId: MetaProtocolEnv.ProcessID,
36
+ offset: z.number().optional(),
37
+ limit: z.number().optional(),
38
+ }),
39
+ z.object({
40
+ action: z.literal("write"),
41
+ processId: MetaProtocolEnv.ProcessID,
42
+ data: z.string(),
43
+ }),
44
+ z.object({
45
+ action: z.literal("send-keys"),
46
+ processId: MetaProtocolEnv.ProcessID,
47
+ keys: z.array(z.string()),
48
+ }),
49
+ z.object({
50
+ action: z.literal("kill"),
51
+ processId: MetaProtocolEnv.ProcessID,
52
+ }),
53
+ z.object({
54
+ action: z.literal("clear"),
55
+ processId: MetaProtocolEnv.ProcessID,
56
+ }),
57
+ z.object({
58
+ action: z.literal("remove"),
59
+ processId: MetaProtocolEnv.ProcessID,
60
+ }),
61
+ ]);
62
+ MetaProtocolProcess.ResultMetadata = z.object({
63
+ action: MetaProtocolProcess.Action,
64
+ processId: MetaProtocolEnv.ProcessID.optional(),
65
+ status: MetaProtocolProcess.ActionStatus.optional(),
66
+ exitCode: z.number().optional(),
67
+ command: z.string().optional(),
68
+ description: z.string().optional(),
69
+ nextOffset: z.number().optional(),
70
+ hostSessionID: MetaProtocolEnv.HostSessionID.optional(),
71
+ envID: MetaProtocolEnv.EnvID.optional(),
72
+ backend: z.enum(["local", "remote"]).optional(),
73
+ processes: z.array(MetaProtocolProcess.ProcessInfo).optional(),
74
+ });
75
+ MetaProtocolProcess.Result = z.object({
76
+ title: z.string(),
77
+ metadata: MetaProtocolProcess.ResultMetadata,
78
+ output: z.string(),
79
+ });
80
+ MetaProtocolProcess.ExecuteRequest = MetaProtocolEnvelope.RequestBase.extend({
81
+ tool: z.literal("process"),
82
+ action: MetaProtocolProcess.Action,
83
+ payload: MetaProtocolProcess.ExecutePayload,
84
+ });
85
+ MetaProtocolProcess.ExecuteResult = MetaProtocolEnvelope.ResultBase.extend({
86
+ ok: z.literal(true),
87
+ result: MetaProtocolProcess.Result,
88
+ });
89
+ })(MetaProtocolProcess || (MetaProtocolProcess = {}));
@@ -0,0 +1,15 @@
1
+ import { MetaSynergyHost, type MetaSynergyHostOptions } from "../host";
2
+ import type { HostTransport, RemoteHostIdentity } from "../types";
3
+ export interface HolosClientOptions extends MetaSynergyHostOptions {
4
+ transport?: HostTransport;
5
+ label?: string;
6
+ }
7
+ export declare class HolosClient {
8
+ readonly host: MetaSynergyHost;
9
+ readonly transport?: HostTransport;
10
+ readonly label?: string;
11
+ constructor(options?: HolosClientOptions);
12
+ identity(): RemoteHostIdentity;
13
+ connect(): Promise<void>;
14
+ disconnect(): Promise<void>;
15
+ }
@@ -0,0 +1,35 @@
1
+ import { MetaSynergyHost } from "../host";
2
+ export class HolosClient {
3
+ host;
4
+ transport;
5
+ label;
6
+ constructor(options = {}) {
7
+ this.host = new MetaSynergyHost(options);
8
+ this.transport = options.transport;
9
+ this.label = options.label;
10
+ }
11
+ identity() {
12
+ if (!this.host.envID) {
13
+ throw new Error("HolosClient requires envID to build identity");
14
+ }
15
+ return {
16
+ envID: this.host.envID,
17
+ hostSessionID: this.host.hostSessionID,
18
+ capabilities: this.host.capabilities,
19
+ label: this.label,
20
+ };
21
+ }
22
+ async connect() {
23
+ if (!this.transport) {
24
+ return;
25
+ }
26
+ await this.transport.connect();
27
+ await this.transport.send(this.host.hello());
28
+ }
29
+ async disconnect() {
30
+ if (!this.transport) {
31
+ return;
32
+ }
33
+ await this.transport.disconnect();
34
+ }
35
+ }
@@ -0,0 +1,7 @@
1
+ import type { MetaProtocolBash } from "@ericsanchezok/meta-protocol";
2
+ import { ProcessRegistry } from "./process-registry";
3
+ export declare class BashRunner {
4
+ private readonly processes;
5
+ constructor(processes: ProcessRegistry);
6
+ run(request: MetaProtocolBash.ExecutePayload, envID: string): Promise<MetaProtocolBash.Result>;
7
+ }
@@ -0,0 +1,9 @@
1
+ export class BashRunner {
2
+ processes;
3
+ constructor(processes) {
4
+ this.processes = processes;
5
+ }
6
+ async run(request, envID) {
7
+ return this.processes.executeBash(request, envID);
8
+ }
9
+ }
@@ -0,0 +1,11 @@
1
+ import { MetaProtocolBash, MetaProtocolProcess } from "@ericsanchezok/meta-protocol";
2
+ import { MetaSynergyHost } from "../host";
3
+ export declare class ProcessRegistry {
4
+ #private;
5
+ constructor(host: MetaSynergyHost, options?: {
6
+ ttlMs?: number;
7
+ });
8
+ executeBash(request: MetaProtocolBash.ExecutePayload, envID: string): Promise<MetaProtocolBash.Result>;
9
+ execute(request: MetaProtocolProcess.ExecutePayload, envID: string): Promise<MetaProtocolProcess.Result>;
10
+ reset(): void;
11
+ }