@rivus/gateway 0.22.3 → 0.24.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/README.md +3 -3
- package/assets/audio-transcriber/THIRD_PARTY_NOTICES.md +1 -3
- package/assets/audio-transcriber/fetch-model.mjs +29 -21
- package/assets/audio-transcriber/npm-shrinkwrap.json +5 -63
- package/assets/audio-transcriber/package.json +1 -1
- package/assets/installation-policy.json +9 -4
- package/dist/bootstrap/feishu.d.ts +42 -3
- package/dist/bootstrap/feishu.js +11964 -12401
- package/dist/bootstrap/herdr-feishu.d.ts +8 -1
- package/dist/bootstrap/herdr-feishu.js +2 -2
- package/dist/chunks/dist.js +10371 -0
- package/dist/chunks/errors.js +13 -0
- package/dist/chunks/herdr-feishu-runtime.js +128 -395
- package/dist/chunks/herdr-socket-client.js +496 -0
- package/dist/chunks/public.d.ts +93 -63
- package/dist/chunks/public2.d.ts +0 -7
- package/dist/chunks/rivus-deployment-cli-process.d.ts +136 -353
- package/dist/chunks/rivus-node-entrypoint.js +1543 -1579
- package/dist/chunks/superagent-worker-programs.js +7240 -0
- package/dist/chunks/superagent-worker-wire.js +233 -0
- package/dist/index.d.ts +12 -25
- package/dist/index.js +2 -1
- package/dist/mcp.js +109 -24
- package/dist/superagent.d.ts +301 -0
- package/dist/superagent.js +2 -0
- package/package.json +25 -11
- package/dist/chunks/automation-presentation.js +0 -263
- package/dist/chunks/feishu-receive-message.js +0 -113
- package/dist/chunks/rivus-home-deployment-env.js +0 -1916
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Result, Schema, SchemaIssue } from "effect";
|
|
2
|
-
//#region src/lib/schema-issue-path.ts
|
|
3
|
-
/**
|
|
4
|
-
* Format an issue path with the repository's existing semantics: a dotted key, or an indexed bracket for a numeric
|
|
5
|
-
* segment. This is the path formatter shared by Feishu entry diagnostics and Automation presentation validation; it
|
|
6
|
-
* intentionally does not use Effect's internal `Formatter.formatPath`, which wraps every segment in brackets and would
|
|
7
|
-
* change the original error texts.
|
|
8
|
-
*/
|
|
9
|
-
function formatSchemaIssuePath(issue) {
|
|
10
|
-
return (issue.path ?? []).map((segment) => {
|
|
11
|
-
const key = typeof segment === "object" ? segment.key : segment;
|
|
12
|
-
return typeof key === "number" ? `[${key}]` : `.${String(key)}`;
|
|
13
|
-
}).join("");
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/feishu/domain/message/adapters/feishu-receive-message.ts
|
|
17
|
-
/** Match the durable codec's non-blank check without changing the stored identifier text. */
|
|
18
|
-
const filledText = Schema.String.check(Schema.makeFilter((value) => value.trim().length > 0));
|
|
19
|
-
const storedMessageFields = {
|
|
20
|
-
chat_id: filledText,
|
|
21
|
-
content: Schema.String,
|
|
22
|
-
message_id: filledText,
|
|
23
|
-
message_type: filledText
|
|
24
|
-
};
|
|
25
|
-
/** The four fields a stored inbound-delivery payload must have; the storage accept set is fixed and shares this. */
|
|
26
|
-
const storedFeishuReceiveMessageSchema = Schema.Struct({ event: Schema.Struct({ message: Schema.Struct(storedMessageFields) }) });
|
|
27
|
-
/**
|
|
28
|
-
* Tolerance: a declared field that is present but has the wrong type (including `null`) rejects the whole payload;
|
|
29
|
-
* undeclared wire fields stay on the returned object and are never read. The required message fields are non-blank
|
|
30
|
-
* because the durable inbound-delivery codec accepts only non-blank ids.
|
|
31
|
-
*/
|
|
32
|
-
const messageFields = {
|
|
33
|
-
...storedMessageFields,
|
|
34
|
-
chat_type: Schema.optional(Schema.String),
|
|
35
|
-
create_time: Schema.optional(Schema.String),
|
|
36
|
-
mentions: Schema.optional(Schema.Array(Schema.Struct({
|
|
37
|
-
id: Schema.optional(Schema.Struct({ open_id: Schema.optional(Schema.String) })),
|
|
38
|
-
key: Schema.optional(Schema.String),
|
|
39
|
-
name: Schema.optional(Schema.String)
|
|
40
|
-
}))),
|
|
41
|
-
parent_id: Schema.optional(Schema.String),
|
|
42
|
-
root_id: Schema.optional(Schema.String),
|
|
43
|
-
thread_id: Schema.optional(Schema.String)
|
|
44
|
-
};
|
|
45
|
-
const wireMessageSchema = Schema.Struct(messageFields);
|
|
46
|
-
const senderSchema = Schema.Struct({
|
|
47
|
-
sender_id: Schema.optional(Schema.Struct({ open_id: Schema.optional(Schema.String) })),
|
|
48
|
-
sender_type: Schema.optional(Schema.String),
|
|
49
|
-
tenant_key: Schema.optional(Schema.String)
|
|
50
|
-
});
|
|
51
|
-
/** The Lark event envelope: `header`/`event` wrapping the message. */
|
|
52
|
-
const envelopeWireSchema = Schema.Struct({
|
|
53
|
-
header: Schema.optional(Schema.Struct({ tenant_key: Schema.optional(Schema.String) })),
|
|
54
|
-
event: Schema.Struct({
|
|
55
|
-
message: wireMessageSchema,
|
|
56
|
-
sender: Schema.optional(senderSchema)
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
/** The SDK dispatcher's flat shape: `tenant_key`, `message` and `sender` at the payload root. A payload that
|
|
60
|
-
* carries an `event` key is never a flat shape, even when that value is `undefined`; it is decoded as an envelope
|
|
61
|
-
* or refused by the shared union. */
|
|
62
|
-
const sdkFlatWireSchema = Schema.Struct({
|
|
63
|
-
message: wireMessageSchema,
|
|
64
|
-
sender: Schema.optional(senderSchema),
|
|
65
|
-
tenant_key: Schema.optional(Schema.String),
|
|
66
|
-
event: Schema.optionalKey(Schema.Never)
|
|
67
|
-
});
|
|
68
|
-
const wireSchema = Schema.Union([envelopeWireSchema, sdkFlatWireSchema]);
|
|
69
|
-
var UndecodableFeishuReceiveMessage = class extends Error {
|
|
70
|
-
reason;
|
|
71
|
-
name = "UndecodableFeishuReceiveMessage";
|
|
72
|
-
_tag = "UndecodableFeishuReceiveMessage";
|
|
73
|
-
constructor(reason) {
|
|
74
|
-
super(reason);
|
|
75
|
-
this.reason = reason;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
function describeIssue(issue) {
|
|
79
|
-
const formatted = SchemaIssue.makeFormatterStandardSchemaV1()(issue).issues[0];
|
|
80
|
-
if (formatted === void 0) return "Feishu receive-message payload does not match the envelope or SDK-flat wire shape";
|
|
81
|
-
return `Feishu receive-message payload${formatSchemaIssuePath(formatted) || " value"}: ${formatted.message}`;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Decode the inbound message event once. The Lark dispatcher hands over the envelope or its flat SDK shape; one
|
|
85
|
-
* union Schema validates both, and the decoded branch decides how the value is returned:
|
|
86
|
-
*
|
|
87
|
-
* - envelope: the original payload object, so unknown wire fields survive the durable store round-trip;
|
|
88
|
-
* - flat: `{ header?, event: { message, sender? } }` built from the original nested objects, with the tenant key
|
|
89
|
-
* moved to `header` and the remaining root wire fields dropped as the previous normalizer did.
|
|
90
|
-
*
|
|
91
|
-
* The failure reason names the field path and expected type only; it never echoes a field value.
|
|
92
|
-
*/
|
|
93
|
-
function decodeFeishuReceiveMessage(raw) {
|
|
94
|
-
const decoded = Schema.decodeUnknownResult(wireSchema)(raw);
|
|
95
|
-
if (Result.isFailure(decoded)) throw new UndecodableFeishuReceiveMessage(describeIssue(decoded.failure.issue));
|
|
96
|
-
if (!("message" in decoded.success)) return raw;
|
|
97
|
-
const flat = raw;
|
|
98
|
-
return {
|
|
99
|
-
...flat.tenant_key ? { header: { tenant_key: flat.tenant_key } } : {},
|
|
100
|
-
event: {
|
|
101
|
-
message: flat.message,
|
|
102
|
-
...flat.sender ? { sender: flat.sender } : {}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/** The tenant key is resolved at read time, sender first. Decoding only moves a flat shape's root `tenant_key`
|
|
107
|
-
* into `header`; it does not resolve or merge the two carriers. */
|
|
108
|
-
function readTenantKey(payload) {
|
|
109
|
-
return payload.event.sender?.tenant_key ?? payload.header?.tenant_key ?? "";
|
|
110
|
-
}
|
|
111
|
-
//#endregion
|
|
112
|
-
export { formatSchemaIssuePath as i, readTenantKey as n, storedFeishuReceiveMessageSchema as r, decodeFeishuReceiveMessage as t };
|
|
113
|
-
|