@holon-run/uxc-daemon-client 0.13.3 → 0.15.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/dist/index.cjs +48 -59
- package/dist/index.d.cts +95 -71
- package/dist/index.d.ts +95 -71
- package/dist/index.js +48 -59
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -73,6 +73,9 @@ var UxcDaemonClient = class {
|
|
|
73
73
|
async daemonSessions() {
|
|
74
74
|
return this.request("daemon.sessions");
|
|
75
75
|
}
|
|
76
|
+
async daemonSessionKill(sessionKey) {
|
|
77
|
+
return this.request("daemon.session.kill", { session_key: sessionKey });
|
|
78
|
+
}
|
|
76
79
|
async call(args) {
|
|
77
80
|
return this.request("runtime.invoke", {
|
|
78
81
|
request_id: requestId("call"),
|
|
@@ -107,72 +110,58 @@ var UxcDaemonClient = class {
|
|
|
107
110
|
});
|
|
108
111
|
return generateTypeScriptClient(schema, args.emitter);
|
|
109
112
|
}
|
|
110
|
-
async
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
resource_uri: args.resourceUri ?? null,
|
|
125
|
-
read_resource: args.readResource ?? false,
|
|
126
|
-
transport_hint: args.transportHint ?? null,
|
|
127
|
-
subprotocols: [],
|
|
128
|
-
initial_text_frames: [],
|
|
129
|
-
mode,
|
|
130
|
-
poll_config: args.pollConfig ?? null,
|
|
131
|
-
ephemeral: args.ephemeral ?? (args.sink ?? "memory:") === "memory:",
|
|
132
|
-
options: normalizeOptions(args.options)
|
|
113
|
+
async sourceEnsure(args) {
|
|
114
|
+
return this.request("source.ensure", {
|
|
115
|
+
namespace: args.namespace,
|
|
116
|
+
source_key: args.sourceKey,
|
|
117
|
+
spec: {
|
|
118
|
+
...args.spec,
|
|
119
|
+
resource_uri: args.spec.resource_uri ?? null,
|
|
120
|
+
read_resource: args.spec.read_resource ?? false,
|
|
121
|
+
transport_hint: args.spec.transport_hint ?? null,
|
|
122
|
+
subprotocols: args.spec.subprotocols ?? [],
|
|
123
|
+
initial_text_frames: args.spec.initial_text_frames ?? [],
|
|
124
|
+
poll_config: args.spec.poll_config ?? null,
|
|
125
|
+
options: normalizeOptions(args.spec.options)
|
|
126
|
+
}
|
|
133
127
|
});
|
|
134
128
|
}
|
|
135
|
-
async
|
|
136
|
-
return this.request("
|
|
129
|
+
async sourceStatus(namespace, sourceKey) {
|
|
130
|
+
return this.request("source.status", {
|
|
131
|
+
namespace,
|
|
132
|
+
source_key: sourceKey
|
|
133
|
+
});
|
|
137
134
|
}
|
|
138
|
-
async
|
|
139
|
-
return this.request("
|
|
135
|
+
async sourceList() {
|
|
136
|
+
return this.request("source.list");
|
|
140
137
|
}
|
|
141
|
-
async
|
|
142
|
-
return this.request("
|
|
138
|
+
async sourceStop(namespace, sourceKey) {
|
|
139
|
+
return this.request("source.stop", {
|
|
140
|
+
namespace,
|
|
141
|
+
source_key: sourceKey
|
|
142
|
+
});
|
|
143
143
|
}
|
|
144
|
-
async
|
|
145
|
-
return this.request("
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
limit: args.limit ?? 100,
|
|
149
|
-
wait_ms: args.waitMs ?? 15e3
|
|
144
|
+
async sourceDelete(namespace, sourceKey) {
|
|
145
|
+
return this.request("source.delete", {
|
|
146
|
+
namespace,
|
|
147
|
+
source_key: sourceKey
|
|
150
148
|
});
|
|
151
149
|
}
|
|
152
|
-
async
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
if (batch.status !== "running" && batch.events.length === 0) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (batch.events.length === 0 && batch.status === "running") {
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
afterSeq = batch.next_after_seq;
|
|
175
|
-
}
|
|
150
|
+
async streamRead(args) {
|
|
151
|
+
return this.request("stream.read", {
|
|
152
|
+
stream_id: args.streamId,
|
|
153
|
+
after_offset: args.afterOffset ?? 0,
|
|
154
|
+
limit: args.limit ?? 100
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
async streamInfo(streamId) {
|
|
158
|
+
return this.request("stream.info", { stream_id: streamId });
|
|
159
|
+
}
|
|
160
|
+
async streamTrim(streamId, beforeOffset) {
|
|
161
|
+
return this.request("stream.trim", {
|
|
162
|
+
stream_id: streamId,
|
|
163
|
+
before_offset: beforeOffset
|
|
164
|
+
});
|
|
176
165
|
}
|
|
177
166
|
async request(method, params) {
|
|
178
167
|
await this.ensureDaemon();
|
package/dist/index.d.cts
CHANGED
|
@@ -74,51 +74,86 @@ type RuntimeResult<TData = unknown, TMeta = Record<string, unknown>> = Omit<Runt
|
|
|
74
74
|
data: TData;
|
|
75
75
|
meta: TMeta;
|
|
76
76
|
};
|
|
77
|
-
interface
|
|
78
|
-
version: string;
|
|
79
|
-
job_id: string;
|
|
80
|
-
seq: number;
|
|
81
|
-
timestamp_unix: number;
|
|
82
|
-
protocol: string;
|
|
83
|
-
source_kind: string;
|
|
84
|
-
event_kind: string;
|
|
85
|
-
data?: unknown;
|
|
86
|
-
meta?: unknown;
|
|
87
|
-
}
|
|
88
|
-
interface SubscribeStartResponse {
|
|
89
|
-
job_id: string;
|
|
90
|
-
mode: "stream" | "poll";
|
|
91
|
-
protocol: string;
|
|
77
|
+
interface ManagedSourceSpec {
|
|
92
78
|
endpoint: string;
|
|
93
|
-
|
|
79
|
+
operation_id?: string | null;
|
|
80
|
+
args?: Record<string, unknown> | null;
|
|
94
81
|
resource_uri?: string | null;
|
|
95
|
-
|
|
82
|
+
read_resource?: boolean;
|
|
83
|
+
transport_hint?: "websocket" | "discord_gateway" | "slack_socket_mode" | "feishu_long_connection" | null;
|
|
84
|
+
subprotocols?: string[];
|
|
85
|
+
initial_text_frames?: string[];
|
|
86
|
+
mode: "stream" | "poll";
|
|
87
|
+
poll_config?: PollSubscriptionConfig | null;
|
|
88
|
+
options?: RuntimeInvokeOptions;
|
|
96
89
|
}
|
|
97
|
-
interface
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
interface ManagedSourceEnsureResponse {
|
|
91
|
+
namespace: string;
|
|
92
|
+
source_key: string;
|
|
93
|
+
run_id: string;
|
|
94
|
+
stream_id: string;
|
|
95
|
+
status: string;
|
|
96
|
+
reused: boolean;
|
|
97
|
+
replaced_previous: boolean;
|
|
100
98
|
}
|
|
101
|
-
interface
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
resource_uri?: string | null;
|
|
99
|
+
interface ManagedSourceView {
|
|
100
|
+
namespace: string;
|
|
101
|
+
source_key: string;
|
|
102
|
+
run_id: string;
|
|
103
|
+
stream_id: string;
|
|
104
|
+
spec_key: string;
|
|
108
105
|
status: string;
|
|
109
|
-
durable: boolean;
|
|
110
|
-
auto_resume: boolean;
|
|
111
|
-
resume_strategy: string;
|
|
112
106
|
created_at_unix: number;
|
|
107
|
+
updated_at_unix: number;
|
|
113
108
|
started_at_unix?: number | null;
|
|
114
109
|
stopped_at_unix?: number | null;
|
|
115
|
-
last_event_at_unix?: number | null;
|
|
116
110
|
last_error?: string | null;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
}
|
|
112
|
+
interface ManagedSourceListEntry {
|
|
113
|
+
namespace: string;
|
|
114
|
+
source_key: string;
|
|
115
|
+
status: string;
|
|
116
|
+
run_id: string;
|
|
117
|
+
stream_id: string;
|
|
118
|
+
updated_at_unix: number;
|
|
119
|
+
last_error?: string | null;
|
|
120
|
+
}
|
|
121
|
+
interface ManagedSourceStopResponse {
|
|
122
|
+
namespace: string;
|
|
123
|
+
source_key: string;
|
|
124
|
+
stopped: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface ManagedSourceDeleteResponse {
|
|
127
|
+
namespace: string;
|
|
128
|
+
source_key: string;
|
|
129
|
+
deleted: boolean;
|
|
130
|
+
}
|
|
131
|
+
interface ManagedStreamEvent {
|
|
132
|
+
stream_id: string;
|
|
133
|
+
offset: number;
|
|
134
|
+
ingested_at_unix: number;
|
|
135
|
+
raw_payload: unknown;
|
|
136
|
+
}
|
|
137
|
+
interface ManagedStreamReadResponse {
|
|
138
|
+
stream_id: string;
|
|
139
|
+
events: ManagedStreamEvent[];
|
|
140
|
+
next_after_offset: number;
|
|
141
|
+
has_more: boolean;
|
|
142
|
+
}
|
|
143
|
+
interface ManagedStreamInfo {
|
|
144
|
+
stream_id: string;
|
|
145
|
+
namespace: string;
|
|
146
|
+
source_key: string;
|
|
147
|
+
created_at_unix: number;
|
|
148
|
+
earliest_offset?: number | null;
|
|
149
|
+
latest_offset?: number | null;
|
|
150
|
+
event_count: number;
|
|
151
|
+
retention_max_rows: number;
|
|
152
|
+
retention_max_age_secs: number;
|
|
153
|
+
}
|
|
154
|
+
interface ManagedStreamTrimResponse {
|
|
155
|
+
stream_id: string;
|
|
156
|
+
trimmed: number;
|
|
122
157
|
}
|
|
123
158
|
interface DaemonStatus {
|
|
124
159
|
running: boolean;
|
|
@@ -130,14 +165,15 @@ interface DaemonStatus {
|
|
|
130
165
|
mcp_stdio_sessions: number;
|
|
131
166
|
mcp_http_sessions: number;
|
|
132
167
|
mcp_reuse_hits: number;
|
|
168
|
+
managed_sources: number;
|
|
169
|
+
managed_sources_running: number;
|
|
170
|
+
managed_streams: number;
|
|
133
171
|
log_file?: string | null;
|
|
134
172
|
}
|
|
135
|
-
interface
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
next_after_seq: number;
|
|
140
|
-
has_more: boolean;
|
|
173
|
+
interface DaemonSessionKillResponse {
|
|
174
|
+
session_key: string;
|
|
175
|
+
child_pid: number | null;
|
|
176
|
+
killed: boolean;
|
|
141
177
|
}
|
|
142
178
|
interface UxcDaemonClientOptions {
|
|
143
179
|
socketPath?: string;
|
|
@@ -152,19 +188,6 @@ interface GenerateTypeScriptClientOptions {
|
|
|
152
188
|
packageImport?: string;
|
|
153
189
|
includeSchemaJson?: boolean;
|
|
154
190
|
}
|
|
155
|
-
interface SubscribeStartArgs {
|
|
156
|
-
endpoint: string;
|
|
157
|
-
resourceUri?: string;
|
|
158
|
-
operationId?: string;
|
|
159
|
-
args?: Record<string, unknown>;
|
|
160
|
-
mode?: "stream" | "poll";
|
|
161
|
-
pollConfig?: PollSubscriptionConfig;
|
|
162
|
-
options?: RuntimeInvokeOptions;
|
|
163
|
-
sink?: `file:${string}` | "memory:";
|
|
164
|
-
ephemeral?: boolean;
|
|
165
|
-
readResource?: boolean;
|
|
166
|
-
transportHint?: "websocket" | "discord_gateway" | "slack_socket_mode" | "feishu_long_connection";
|
|
167
|
-
}
|
|
168
191
|
interface PollSubscriptionConfig {
|
|
169
192
|
interval_secs: number;
|
|
170
193
|
extract_items_pointer: string;
|
|
@@ -205,6 +228,7 @@ declare class UxcDaemonClient {
|
|
|
205
228
|
constructor(options?: UxcDaemonClientOptions);
|
|
206
229
|
daemonStatus(): Promise<DaemonStatus>;
|
|
207
230
|
daemonSessions(): Promise<unknown[]>;
|
|
231
|
+
daemonSessionKill(sessionKey: string): Promise<DaemonSessionKillResponse>;
|
|
208
232
|
call(args: {
|
|
209
233
|
endpoint: string;
|
|
210
234
|
operation: string;
|
|
@@ -220,26 +244,26 @@ declare class UxcDaemonClient {
|
|
|
220
244
|
options?: RuntimeInvokeOptions;
|
|
221
245
|
emitter?: GenerateTypeScriptClientOptions;
|
|
222
246
|
}): Promise<string>;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
247
|
+
sourceEnsure(args: {
|
|
248
|
+
namespace: string;
|
|
249
|
+
sourceKey: string;
|
|
250
|
+
spec: ManagedSourceSpec;
|
|
251
|
+
}): Promise<ManagedSourceEnsureResponse>;
|
|
252
|
+
sourceStatus(namespace: string, sourceKey: string): Promise<ManagedSourceView>;
|
|
253
|
+
sourceList(): Promise<ManagedSourceListEntry[]>;
|
|
254
|
+
sourceStop(namespace: string, sourceKey: string): Promise<ManagedSourceStopResponse>;
|
|
255
|
+
sourceDelete(namespace: string, sourceKey: string): Promise<ManagedSourceDeleteResponse>;
|
|
256
|
+
streamRead(args: {
|
|
257
|
+
streamId: string;
|
|
258
|
+
afterOffset?: number;
|
|
235
259
|
limit?: number;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
260
|
+
}): Promise<ManagedStreamReadResponse>;
|
|
261
|
+
streamInfo(streamId: string): Promise<ManagedStreamInfo>;
|
|
262
|
+
streamTrim(streamId: string, beforeOffset: number): Promise<ManagedStreamTrimResponse>;
|
|
239
263
|
request<T>(method: string, params?: unknown): Promise<T>;
|
|
240
264
|
private ensureDaemon;
|
|
241
265
|
private requestOnce;
|
|
242
266
|
}
|
|
243
267
|
declare function generateTypeScriptClient(schema: CodegenHostSchemaV1, options?: GenerateTypeScriptClientOptions): string;
|
|
244
268
|
|
|
245
|
-
export { type CodegenHostSchemaV1, type CodegenOperationV1, DaemonRpcError, type DaemonStatus, type GenerateTypeScriptClientOptions, type
|
|
269
|
+
export { type CodegenHostSchemaV1, type CodegenOperationV1, DaemonRpcError, type DaemonSessionKillResponse, type DaemonStatus, type GenerateTypeScriptClientOptions, type ManagedSourceDeleteResponse, type ManagedSourceEnsureResponse, type ManagedSourceListEntry, type ManagedSourceSpec, type ManagedSourceStopResponse, type ManagedSourceView, type ManagedStreamEvent, type ManagedStreamInfo, type ManagedStreamReadResponse, type ManagedStreamTrimResponse, type PollSubscriptionConfig, type RuntimeInvokeOptions, type RuntimeInvokeResponse, type RuntimeMeta, type RuntimeResult, UxcDaemonClient, type UxcDaemonClientOptions, generateTypeScriptClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -74,51 +74,86 @@ type RuntimeResult<TData = unknown, TMeta = Record<string, unknown>> = Omit<Runt
|
|
|
74
74
|
data: TData;
|
|
75
75
|
meta: TMeta;
|
|
76
76
|
};
|
|
77
|
-
interface
|
|
78
|
-
version: string;
|
|
79
|
-
job_id: string;
|
|
80
|
-
seq: number;
|
|
81
|
-
timestamp_unix: number;
|
|
82
|
-
protocol: string;
|
|
83
|
-
source_kind: string;
|
|
84
|
-
event_kind: string;
|
|
85
|
-
data?: unknown;
|
|
86
|
-
meta?: unknown;
|
|
87
|
-
}
|
|
88
|
-
interface SubscribeStartResponse {
|
|
89
|
-
job_id: string;
|
|
90
|
-
mode: "stream" | "poll";
|
|
91
|
-
protocol: string;
|
|
77
|
+
interface ManagedSourceSpec {
|
|
92
78
|
endpoint: string;
|
|
93
|
-
|
|
79
|
+
operation_id?: string | null;
|
|
80
|
+
args?: Record<string, unknown> | null;
|
|
94
81
|
resource_uri?: string | null;
|
|
95
|
-
|
|
82
|
+
read_resource?: boolean;
|
|
83
|
+
transport_hint?: "websocket" | "discord_gateway" | "slack_socket_mode" | "feishu_long_connection" | null;
|
|
84
|
+
subprotocols?: string[];
|
|
85
|
+
initial_text_frames?: string[];
|
|
86
|
+
mode: "stream" | "poll";
|
|
87
|
+
poll_config?: PollSubscriptionConfig | null;
|
|
88
|
+
options?: RuntimeInvokeOptions;
|
|
96
89
|
}
|
|
97
|
-
interface
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
interface ManagedSourceEnsureResponse {
|
|
91
|
+
namespace: string;
|
|
92
|
+
source_key: string;
|
|
93
|
+
run_id: string;
|
|
94
|
+
stream_id: string;
|
|
95
|
+
status: string;
|
|
96
|
+
reused: boolean;
|
|
97
|
+
replaced_previous: boolean;
|
|
100
98
|
}
|
|
101
|
-
interface
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
resource_uri?: string | null;
|
|
99
|
+
interface ManagedSourceView {
|
|
100
|
+
namespace: string;
|
|
101
|
+
source_key: string;
|
|
102
|
+
run_id: string;
|
|
103
|
+
stream_id: string;
|
|
104
|
+
spec_key: string;
|
|
108
105
|
status: string;
|
|
109
|
-
durable: boolean;
|
|
110
|
-
auto_resume: boolean;
|
|
111
|
-
resume_strategy: string;
|
|
112
106
|
created_at_unix: number;
|
|
107
|
+
updated_at_unix: number;
|
|
113
108
|
started_at_unix?: number | null;
|
|
114
109
|
stopped_at_unix?: number | null;
|
|
115
|
-
last_event_at_unix?: number | null;
|
|
116
110
|
last_error?: string | null;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
}
|
|
112
|
+
interface ManagedSourceListEntry {
|
|
113
|
+
namespace: string;
|
|
114
|
+
source_key: string;
|
|
115
|
+
status: string;
|
|
116
|
+
run_id: string;
|
|
117
|
+
stream_id: string;
|
|
118
|
+
updated_at_unix: number;
|
|
119
|
+
last_error?: string | null;
|
|
120
|
+
}
|
|
121
|
+
interface ManagedSourceStopResponse {
|
|
122
|
+
namespace: string;
|
|
123
|
+
source_key: string;
|
|
124
|
+
stopped: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface ManagedSourceDeleteResponse {
|
|
127
|
+
namespace: string;
|
|
128
|
+
source_key: string;
|
|
129
|
+
deleted: boolean;
|
|
130
|
+
}
|
|
131
|
+
interface ManagedStreamEvent {
|
|
132
|
+
stream_id: string;
|
|
133
|
+
offset: number;
|
|
134
|
+
ingested_at_unix: number;
|
|
135
|
+
raw_payload: unknown;
|
|
136
|
+
}
|
|
137
|
+
interface ManagedStreamReadResponse {
|
|
138
|
+
stream_id: string;
|
|
139
|
+
events: ManagedStreamEvent[];
|
|
140
|
+
next_after_offset: number;
|
|
141
|
+
has_more: boolean;
|
|
142
|
+
}
|
|
143
|
+
interface ManagedStreamInfo {
|
|
144
|
+
stream_id: string;
|
|
145
|
+
namespace: string;
|
|
146
|
+
source_key: string;
|
|
147
|
+
created_at_unix: number;
|
|
148
|
+
earliest_offset?: number | null;
|
|
149
|
+
latest_offset?: number | null;
|
|
150
|
+
event_count: number;
|
|
151
|
+
retention_max_rows: number;
|
|
152
|
+
retention_max_age_secs: number;
|
|
153
|
+
}
|
|
154
|
+
interface ManagedStreamTrimResponse {
|
|
155
|
+
stream_id: string;
|
|
156
|
+
trimmed: number;
|
|
122
157
|
}
|
|
123
158
|
interface DaemonStatus {
|
|
124
159
|
running: boolean;
|
|
@@ -130,14 +165,15 @@ interface DaemonStatus {
|
|
|
130
165
|
mcp_stdio_sessions: number;
|
|
131
166
|
mcp_http_sessions: number;
|
|
132
167
|
mcp_reuse_hits: number;
|
|
168
|
+
managed_sources: number;
|
|
169
|
+
managed_sources_running: number;
|
|
170
|
+
managed_streams: number;
|
|
133
171
|
log_file?: string | null;
|
|
134
172
|
}
|
|
135
|
-
interface
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
next_after_seq: number;
|
|
140
|
-
has_more: boolean;
|
|
173
|
+
interface DaemonSessionKillResponse {
|
|
174
|
+
session_key: string;
|
|
175
|
+
child_pid: number | null;
|
|
176
|
+
killed: boolean;
|
|
141
177
|
}
|
|
142
178
|
interface UxcDaemonClientOptions {
|
|
143
179
|
socketPath?: string;
|
|
@@ -152,19 +188,6 @@ interface GenerateTypeScriptClientOptions {
|
|
|
152
188
|
packageImport?: string;
|
|
153
189
|
includeSchemaJson?: boolean;
|
|
154
190
|
}
|
|
155
|
-
interface SubscribeStartArgs {
|
|
156
|
-
endpoint: string;
|
|
157
|
-
resourceUri?: string;
|
|
158
|
-
operationId?: string;
|
|
159
|
-
args?: Record<string, unknown>;
|
|
160
|
-
mode?: "stream" | "poll";
|
|
161
|
-
pollConfig?: PollSubscriptionConfig;
|
|
162
|
-
options?: RuntimeInvokeOptions;
|
|
163
|
-
sink?: `file:${string}` | "memory:";
|
|
164
|
-
ephemeral?: boolean;
|
|
165
|
-
readResource?: boolean;
|
|
166
|
-
transportHint?: "websocket" | "discord_gateway" | "slack_socket_mode" | "feishu_long_connection";
|
|
167
|
-
}
|
|
168
191
|
interface PollSubscriptionConfig {
|
|
169
192
|
interval_secs: number;
|
|
170
193
|
extract_items_pointer: string;
|
|
@@ -205,6 +228,7 @@ declare class UxcDaemonClient {
|
|
|
205
228
|
constructor(options?: UxcDaemonClientOptions);
|
|
206
229
|
daemonStatus(): Promise<DaemonStatus>;
|
|
207
230
|
daemonSessions(): Promise<unknown[]>;
|
|
231
|
+
daemonSessionKill(sessionKey: string): Promise<DaemonSessionKillResponse>;
|
|
208
232
|
call(args: {
|
|
209
233
|
endpoint: string;
|
|
210
234
|
operation: string;
|
|
@@ -220,26 +244,26 @@ declare class UxcDaemonClient {
|
|
|
220
244
|
options?: RuntimeInvokeOptions;
|
|
221
245
|
emitter?: GenerateTypeScriptClientOptions;
|
|
222
246
|
}): Promise<string>;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
247
|
+
sourceEnsure(args: {
|
|
248
|
+
namespace: string;
|
|
249
|
+
sourceKey: string;
|
|
250
|
+
spec: ManagedSourceSpec;
|
|
251
|
+
}): Promise<ManagedSourceEnsureResponse>;
|
|
252
|
+
sourceStatus(namespace: string, sourceKey: string): Promise<ManagedSourceView>;
|
|
253
|
+
sourceList(): Promise<ManagedSourceListEntry[]>;
|
|
254
|
+
sourceStop(namespace: string, sourceKey: string): Promise<ManagedSourceStopResponse>;
|
|
255
|
+
sourceDelete(namespace: string, sourceKey: string): Promise<ManagedSourceDeleteResponse>;
|
|
256
|
+
streamRead(args: {
|
|
257
|
+
streamId: string;
|
|
258
|
+
afterOffset?: number;
|
|
235
259
|
limit?: number;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
260
|
+
}): Promise<ManagedStreamReadResponse>;
|
|
261
|
+
streamInfo(streamId: string): Promise<ManagedStreamInfo>;
|
|
262
|
+
streamTrim(streamId: string, beforeOffset: number): Promise<ManagedStreamTrimResponse>;
|
|
239
263
|
request<T>(method: string, params?: unknown): Promise<T>;
|
|
240
264
|
private ensureDaemon;
|
|
241
265
|
private requestOnce;
|
|
242
266
|
}
|
|
243
267
|
declare function generateTypeScriptClient(schema: CodegenHostSchemaV1, options?: GenerateTypeScriptClientOptions): string;
|
|
244
268
|
|
|
245
|
-
export { type CodegenHostSchemaV1, type CodegenOperationV1, DaemonRpcError, type DaemonStatus, type GenerateTypeScriptClientOptions, type
|
|
269
|
+
export { type CodegenHostSchemaV1, type CodegenOperationV1, DaemonRpcError, type DaemonSessionKillResponse, type DaemonStatus, type GenerateTypeScriptClientOptions, type ManagedSourceDeleteResponse, type ManagedSourceEnsureResponse, type ManagedSourceListEntry, type ManagedSourceSpec, type ManagedSourceStopResponse, type ManagedSourceView, type ManagedStreamEvent, type ManagedStreamInfo, type ManagedStreamReadResponse, type ManagedStreamTrimResponse, type PollSubscriptionConfig, type RuntimeInvokeOptions, type RuntimeInvokeResponse, type RuntimeMeta, type RuntimeResult, UxcDaemonClient, type UxcDaemonClientOptions, generateTypeScriptClient };
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,9 @@ var UxcDaemonClient = class {
|
|
|
37
37
|
async daemonSessions() {
|
|
38
38
|
return this.request("daemon.sessions");
|
|
39
39
|
}
|
|
40
|
+
async daemonSessionKill(sessionKey) {
|
|
41
|
+
return this.request("daemon.session.kill", { session_key: sessionKey });
|
|
42
|
+
}
|
|
40
43
|
async call(args) {
|
|
41
44
|
return this.request("runtime.invoke", {
|
|
42
45
|
request_id: requestId("call"),
|
|
@@ -71,72 +74,58 @@ var UxcDaemonClient = class {
|
|
|
71
74
|
});
|
|
72
75
|
return generateTypeScriptClient(schema, args.emitter);
|
|
73
76
|
}
|
|
74
|
-
async
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
resource_uri: args.resourceUri ?? null,
|
|
89
|
-
read_resource: args.readResource ?? false,
|
|
90
|
-
transport_hint: args.transportHint ?? null,
|
|
91
|
-
subprotocols: [],
|
|
92
|
-
initial_text_frames: [],
|
|
93
|
-
mode,
|
|
94
|
-
poll_config: args.pollConfig ?? null,
|
|
95
|
-
ephemeral: args.ephemeral ?? (args.sink ?? "memory:") === "memory:",
|
|
96
|
-
options: normalizeOptions(args.options)
|
|
77
|
+
async sourceEnsure(args) {
|
|
78
|
+
return this.request("source.ensure", {
|
|
79
|
+
namespace: args.namespace,
|
|
80
|
+
source_key: args.sourceKey,
|
|
81
|
+
spec: {
|
|
82
|
+
...args.spec,
|
|
83
|
+
resource_uri: args.spec.resource_uri ?? null,
|
|
84
|
+
read_resource: args.spec.read_resource ?? false,
|
|
85
|
+
transport_hint: args.spec.transport_hint ?? null,
|
|
86
|
+
subprotocols: args.spec.subprotocols ?? [],
|
|
87
|
+
initial_text_frames: args.spec.initial_text_frames ?? [],
|
|
88
|
+
poll_config: args.spec.poll_config ?? null,
|
|
89
|
+
options: normalizeOptions(args.spec.options)
|
|
90
|
+
}
|
|
97
91
|
});
|
|
98
92
|
}
|
|
99
|
-
async
|
|
100
|
-
return this.request("
|
|
93
|
+
async sourceStatus(namespace, sourceKey) {
|
|
94
|
+
return this.request("source.status", {
|
|
95
|
+
namespace,
|
|
96
|
+
source_key: sourceKey
|
|
97
|
+
});
|
|
101
98
|
}
|
|
102
|
-
async
|
|
103
|
-
return this.request("
|
|
99
|
+
async sourceList() {
|
|
100
|
+
return this.request("source.list");
|
|
104
101
|
}
|
|
105
|
-
async
|
|
106
|
-
return this.request("
|
|
102
|
+
async sourceStop(namespace, sourceKey) {
|
|
103
|
+
return this.request("source.stop", {
|
|
104
|
+
namespace,
|
|
105
|
+
source_key: sourceKey
|
|
106
|
+
});
|
|
107
107
|
}
|
|
108
|
-
async
|
|
109
|
-
return this.request("
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
limit: args.limit ?? 100,
|
|
113
|
-
wait_ms: args.waitMs ?? 15e3
|
|
108
|
+
async sourceDelete(namespace, sourceKey) {
|
|
109
|
+
return this.request("source.delete", {
|
|
110
|
+
namespace,
|
|
111
|
+
source_key: sourceKey
|
|
114
112
|
});
|
|
115
113
|
}
|
|
116
|
-
async
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
if (batch.status !== "running" && batch.events.length === 0) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (batch.events.length === 0 && batch.status === "running") {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
afterSeq = batch.next_after_seq;
|
|
139
|
-
}
|
|
114
|
+
async streamRead(args) {
|
|
115
|
+
return this.request("stream.read", {
|
|
116
|
+
stream_id: args.streamId,
|
|
117
|
+
after_offset: args.afterOffset ?? 0,
|
|
118
|
+
limit: args.limit ?? 100
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async streamInfo(streamId) {
|
|
122
|
+
return this.request("stream.info", { stream_id: streamId });
|
|
123
|
+
}
|
|
124
|
+
async streamTrim(streamId, beforeOffset) {
|
|
125
|
+
return this.request("stream.trim", {
|
|
126
|
+
stream_id: streamId,
|
|
127
|
+
before_offset: beforeOffset
|
|
128
|
+
});
|
|
140
129
|
}
|
|
141
130
|
async request(method, params) {
|
|
142
131
|
await this.ensureDaemon();
|