coreblow 1.0.0-rc.7 → 1.0.0-rc.9
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/extensions/telegram/src/bot-native-commands.ts +4 -0
- package/extensions/telegram/src/bot.ts +2 -0
- package/package.json +1 -1
- package/src/cron/isolated-agent/job-fixtures.ts +4 -3
- package/src/stubs/matrix-js-sdk.ts +69 -0
- package/src/types/node-fs-glob.d.ts +11 -0
- package/src/types/node-module.d.ts +12 -0
- package/src/types/node-sqlite.d.ts +57 -0
|
@@ -595,6 +595,7 @@ export const registerTelegramNativeCommands = ({
|
|
|
595
595
|
if (!msg) {
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
|
+
// @ts-expect-error Grammy type mismatch — runtime compatible
|
|
598
599
|
if (shouldSkipUpdate(ctx)) {
|
|
599
600
|
return;
|
|
600
601
|
}
|
|
@@ -738,6 +739,7 @@ export const registerTelegramNativeCommands = ({
|
|
|
738
739
|
? msg.chat.title
|
|
739
740
|
? `${msg.chat.title} id:${chatId}`
|
|
740
741
|
: `group:${chatId}`
|
|
742
|
+
// @ts-expect-error Grammy type mismatch — runtime compatible
|
|
741
743
|
: (buildSenderName(msg) ?? String(senderId || chatId));
|
|
742
744
|
const ctxPayload = finalizeInboundContext({
|
|
743
745
|
Body: prompt,
|
|
@@ -751,6 +753,7 @@ export const registerTelegramNativeCommands = ({
|
|
|
751
753
|
ConversationLabel: conversationLabel,
|
|
752
754
|
GroupSubject: isGroup ? (msg.chat.title ?? undefined) : undefined,
|
|
753
755
|
GroupSystemPrompt: isGroup || (!isGroup && groupConfig) ? groupSystemPrompt : undefined,
|
|
756
|
+
// @ts-expect-error Grammy type mismatch — runtime compatible
|
|
754
757
|
SenderName: buildSenderName(msg),
|
|
755
758
|
SenderId: senderId || undefined,
|
|
756
759
|
SenderUsername: senderUsername || undefined,
|
|
@@ -851,6 +854,7 @@ export const registerTelegramNativeCommands = ({
|
|
|
851
854
|
if (!msg) {
|
|
852
855
|
return;
|
|
853
856
|
}
|
|
857
|
+
// @ts-expect-error Grammy type mismatch — runtime compatible
|
|
854
858
|
if (shouldSkipUpdate(ctx)) {
|
|
855
859
|
return;
|
|
856
860
|
}
|
|
@@ -327,6 +327,7 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
|
|
327
327
|
};
|
|
328
328
|
|
|
329
329
|
bot.use(async (ctx, next) => {
|
|
330
|
+
// @ts-expect-error Grammy type mismatch — runtime compatible
|
|
330
331
|
const updateId = resolveTelegramUpdateId(ctx);
|
|
331
332
|
if (typeof updateId === "number") {
|
|
332
333
|
pendingUpdateIds.add(updateId);
|
|
@@ -344,6 +345,7 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
|
|
344
345
|
}
|
|
345
346
|
});
|
|
346
347
|
|
|
348
|
+
// @ts-expect-error Grammy type mismatch — runtime compatible
|
|
347
349
|
bot.use(botRuntime.sequentialize(getTelegramSequentialKey));
|
|
348
350
|
|
|
349
351
|
const rawUpdateLogger = createSubsystemLogger("gateway/channels/telegram/raw-update");
|
package/package.json
CHANGED
|
@@ -4,14 +4,15 @@ export function makeIsolatedAgentJobFixture(overrides?: LooseRecord) {
|
|
|
4
4
|
return {
|
|
5
5
|
id: "test-job",
|
|
6
6
|
name: "Test Job",
|
|
7
|
-
schedule: { kind: "cron", expr: "0 9 * * *", tz: "UTC" },
|
|
7
|
+
schedule: { kind: "cron" as const, expr: "0 9 * * *", tz: "UTC" },
|
|
8
8
|
sessionTarget: "isolated",
|
|
9
9
|
payload: { kind: "agentTurn", message: "test" },
|
|
10
10
|
...overrides,
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
export function makeIsolatedAgentParamsFixture(overrides?: LooseRecord): any {
|
|
15
16
|
const jobOverrides =
|
|
16
17
|
overrides && "job" in overrides ? (overrides.job as LooseRecord | undefined) : undefined;
|
|
17
18
|
return {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub for matrix-js-sdk — provides empty exports so that vitest
|
|
3
|
+
* contract tests can load the bundled channel entries without
|
|
4
|
+
* requiring the full matrix-js-sdk implementation.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ── Enums / Constants ────────────────────────────────────────────
|
|
8
|
+
export const EventType = {} as Record<string, string>;
|
|
9
|
+
export const RoomEvent = {} as Record<string, string>;
|
|
10
|
+
export const ClientEvent = {} as Record<string, string>;
|
|
11
|
+
export const MatrixEventEvent = {} as Record<string, string>;
|
|
12
|
+
export const RoomMemberEvent = {} as Record<string, string>;
|
|
13
|
+
export const RoomStateEvent = {} as Record<string, string>;
|
|
14
|
+
export const MsgType = {} as Record<string, string>;
|
|
15
|
+
export const Preset = {} as Record<string, string>;
|
|
16
|
+
export const Visibility = {} as Record<string, string>;
|
|
17
|
+
export const VerificationMethod = {} as Record<string, string>;
|
|
18
|
+
export const Category = {} as Record<string, string>;
|
|
19
|
+
export const CryptoEvent = {} as Record<string, string>;
|
|
20
|
+
|
|
21
|
+
// ── Classes ──────────────────────────────────────────────────────
|
|
22
|
+
export class MatrixClient {
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
export class MatrixEvent {
|
|
26
|
+
[k: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
export class Room {
|
|
29
|
+
[k: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
export class RoomMember {
|
|
32
|
+
[k: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
export class MemoryStore {
|
|
35
|
+
[k: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
export class SyncAccumulator {
|
|
38
|
+
[k: string]: unknown;
|
|
39
|
+
constructor(..._args: unknown[]) {}
|
|
40
|
+
getJSON(): unknown { return {}; }
|
|
41
|
+
accumulate(_syncResponse: unknown): void {}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ── Functions ────────────────────────────────────────────────────
|
|
45
|
+
export function createClient(..._args: unknown[]): MatrixClient {
|
|
46
|
+
return new MatrixClient();
|
|
47
|
+
}
|
|
48
|
+
export function decodeRecoveryKey(_key: string): Uint8Array {
|
|
49
|
+
return new Uint8Array();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ── Logger ───────────────────────────────────────────────────────
|
|
53
|
+
export const logger = {
|
|
54
|
+
info: (..._args: unknown[]) => {},
|
|
55
|
+
warn: (..._args: unknown[]) => {},
|
|
56
|
+
error: (..._args: unknown[]) => {},
|
|
57
|
+
debug: (..._args: unknown[]) => {},
|
|
58
|
+
trace: (..._args: unknown[]) => {},
|
|
59
|
+
setLevel: (_level: unknown) => {},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// ── Type stubs ───────────────────────────────────────────────────
|
|
63
|
+
export type ISyncData = unknown;
|
|
64
|
+
export type IRooms = unknown;
|
|
65
|
+
export type ISyncResponse = unknown;
|
|
66
|
+
export type IStoredClientOpts = unknown;
|
|
67
|
+
|
|
68
|
+
// ── Default export ───────────────────────────────────────────────
|
|
69
|
+
export default {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient type augmentation for node:fs/promises.
|
|
3
|
+
* fs.glob is available in Node 22.0+ but @types/node@20.x
|
|
4
|
+
* does not include it.
|
|
5
|
+
*/
|
|
6
|
+
declare module "node:fs/promises" {
|
|
7
|
+
export function glob(
|
|
8
|
+
pattern: string | string[],
|
|
9
|
+
options?: { cwd?: string; exclude?: ((path: string) => boolean) | string[] },
|
|
10
|
+
): AsyncIterable<string>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient type augmentation for node:module.
|
|
3
|
+
* enableCompileCache is available in Node 22.8+ but @types/node@20.x
|
|
4
|
+
* does not include it.
|
|
5
|
+
*/
|
|
6
|
+
declare module "node:module" {
|
|
7
|
+
export function enableCompileCache(cacheDir?: string): {
|
|
8
|
+
status: number;
|
|
9
|
+
message?: string;
|
|
10
|
+
directory: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient type declarations for node:sqlite (experimental).
|
|
3
|
+
* Node 22.5+ ships an experimental SQLite module behind --experimental-sqlite.
|
|
4
|
+
* @types/node@20.x does not include these types, so we declare them here.
|
|
5
|
+
*/
|
|
6
|
+
declare module "node:sqlite" {
|
|
7
|
+
export interface DatabaseSyncOptions {
|
|
8
|
+
open?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
enableForeignKeys?: boolean;
|
|
11
|
+
enableDoubleQuotedStringLiterals?: boolean;
|
|
12
|
+
allowExtension?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface StatementResultingChanges {
|
|
16
|
+
changes: number;
|
|
17
|
+
lastInsertRowid: number | bigint;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class StatementSync {
|
|
21
|
+
run(...params: unknown[]): StatementResultingChanges;
|
|
22
|
+
get(...params: unknown[]): unknown;
|
|
23
|
+
all(...params: unknown[]): unknown[];
|
|
24
|
+
iterate(...params: unknown[]): IterableIterator<unknown>;
|
|
25
|
+
setReadBigInts(enabled: boolean): void;
|
|
26
|
+
setAllowBareNamedParameters(enabled: boolean): void;
|
|
27
|
+
columns(): Array<{
|
|
28
|
+
column: string | null;
|
|
29
|
+
database: string | null;
|
|
30
|
+
name: string;
|
|
31
|
+
origin: string | null;
|
|
32
|
+
table: string | null;
|
|
33
|
+
type: string | null;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class DatabaseSync {
|
|
38
|
+
constructor(location: string, options?: DatabaseSyncOptions);
|
|
39
|
+
close(): void;
|
|
40
|
+
exec(sql: string): void;
|
|
41
|
+
prepare(sql: string): StatementSync;
|
|
42
|
+
open(): void;
|
|
43
|
+
isOpen(): boolean;
|
|
44
|
+
isTransaction: boolean;
|
|
45
|
+
function(
|
|
46
|
+
name: string,
|
|
47
|
+
options: {
|
|
48
|
+
deterministic?: boolean;
|
|
49
|
+
directOnly?: boolean;
|
|
50
|
+
useBigIntArguments?: boolean;
|
|
51
|
+
varargs?: boolean;
|
|
52
|
+
},
|
|
53
|
+
func: (...args: unknown[]) => unknown,
|
|
54
|
+
): void;
|
|
55
|
+
function(name: string, func: (...args: unknown[]) => unknown): void;
|
|
56
|
+
}
|
|
57
|
+
}
|