@rivus/gateway 0.17.0 → 0.18.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.
|
@@ -152,7 +152,7 @@ function createTerminalSessionBridge(options) {
|
|
|
152
152
|
return yield* options.sessions.prompt(binding.agent, text).pipe(Effect.as(detail(message, {
|
|
153
153
|
...current,
|
|
154
154
|
ready: false
|
|
155
|
-
}, handle, "指令已提交一次;尚未确认 agent 已处理或完成,请查看输出。")), Effect.
|
|
155
|
+
}, handle, "指令已提交一次;尚未确认 agent 已处理或完成,请查看输出。")), Effect.catch(() => Effect.succeed(detail(message, {
|
|
156
156
|
...current,
|
|
157
157
|
ready: false
|
|
158
158
|
}, handle, "提交结果不确定(uncertain),不会自动重试。请先查看输出,确认后再发送新指令。"))));
|
|
@@ -179,7 +179,7 @@ function createTerminalSessionBridge(options) {
|
|
|
179
179
|
const age = options.now() - message.sentAt;
|
|
180
180
|
if (!Number.isFinite(age) || age < -3e4 || age > 12e4) return null;
|
|
181
181
|
if (!(yield* options.claim(message))) return null;
|
|
182
|
-
return yield* execute(message).pipe(Effect.
|
|
182
|
+
return yield* execute(message).pipe(Effect.catch(() => Effect.succeed(recovery(message))));
|
|
183
183
|
}),
|
|
184
184
|
tick: () => Effect.gen(function* () {
|
|
185
185
|
const results = [];
|
|
@@ -188,7 +188,7 @@ function createTerminalSessionBridge(options) {
|
|
|
188
188
|
watches.delete(key);
|
|
189
189
|
continue;
|
|
190
190
|
}
|
|
191
|
-
const current = yield* options.sessions.inspect(watch.binding.agent).pipe(Effect.map((agent) => agent.status), Effect.
|
|
191
|
+
const current = yield* options.sessions.inspect(watch.binding.agent).pipe(Effect.map((agent) => agent.status), Effect.catch(() => Effect.succeed("unavailable")));
|
|
192
192
|
if (current === watch.status) continue;
|
|
193
193
|
const handle = bind(watch, watch.binding.agent);
|
|
194
194
|
results.push({
|
|
@@ -298,7 +298,7 @@ function createHerdrSocketClient(sessions, timeoutMs = 5e3, discoverSessionsIn)
|
|
|
298
298
|
list: () => refresh().pipe(Effect.flatMap((names) => Effect.all(names.map((name) => listSession(name).pipe(Effect.map((agents) => ({
|
|
299
299
|
agents,
|
|
300
300
|
unavailableSessions: []
|
|
301
|
-
})), Effect.
|
|
301
|
+
})), Effect.catch(() => Effect.succeed({
|
|
302
302
|
agents: [],
|
|
303
303
|
unavailableSessions: [name]
|
|
304
304
|
})))), { concurrency: 4 })), Effect.map((results) => ({
|
|
@@ -733,22 +733,19 @@ function createFeishuTerminalDelivery(client) {
|
|
|
733
733
|
//#endregion
|
|
734
734
|
//#region src/bootstrap/herdr-feishu.ts
|
|
735
735
|
const configSchema = Schema.Struct({
|
|
736
|
-
appId: Schema.
|
|
737
|
-
appSecret: Schema.
|
|
736
|
+
appId: Schema.Trimmed.check(Schema.isNonEmpty()),
|
|
737
|
+
appSecret: Schema.Trimmed.check(Schema.isNonEmpty()),
|
|
738
738
|
sessions: Schema.optional(Schema.Array(Schema.Struct({
|
|
739
|
-
name: Schema.
|
|
740
|
-
socketPath: Schema.String.
|
|
739
|
+
name: Schema.Trimmed.check(Schema.isNonEmpty()),
|
|
740
|
+
socketPath: Schema.String.check(Schema.makeFilter(isAbsolute))
|
|
741
741
|
}))),
|
|
742
|
-
discoverSessionsIn: Schema.optional(Schema.String.
|
|
743
|
-
allowedActors: Schema.NonEmptyArray(Schema.
|
|
744
|
-
allowedChats: Schema.NonEmptyArray(Schema.
|
|
745
|
-
menuChats: Schema.optional(Schema.Record(
|
|
746
|
-
|
|
747
|
-
value: Schema.NonEmptyTrimmedString
|
|
748
|
-
})),
|
|
749
|
-
stateDirectory: Schema.String.pipe(Schema.filter(isAbsolute)),
|
|
742
|
+
discoverSessionsIn: Schema.optional(Schema.String.check(Schema.makeFilter(isAbsolute))),
|
|
743
|
+
allowedActors: Schema.NonEmptyArray(Schema.Trimmed.check(Schema.isNonEmpty())),
|
|
744
|
+
allowedChats: Schema.NonEmptyArray(Schema.Trimmed.check(Schema.isNonEmpty())),
|
|
745
|
+
menuChats: Schema.optional(Schema.Record(Schema.String, Schema.Trimmed.check(Schema.isNonEmpty()))),
|
|
746
|
+
stateDirectory: Schema.String.check(Schema.makeFilter(isAbsolute)),
|
|
750
747
|
writable: Schema.optional(Schema.Boolean),
|
|
751
|
-
fontFiles: Schema.optional(Schema.Array(Schema.String.
|
|
748
|
+
fontFiles: Schema.optional(Schema.Array(Schema.String.check(Schema.makeFilter(isAbsolute))))
|
|
752
749
|
});
|
|
753
750
|
function configuredSessions(options) {
|
|
754
751
|
if (!Schema.is(configSchema)(options)) throw new Error("Invalid bridge configuration: check credentials, nonempty actor/chat lists, absolute paths and option types");
|