@elizaos/plugin-inbox 2.0.3-beta.5 → 2.0.3-beta.7
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/actions/inbox.d.ts +69 -0
- package/dist/actions/inbox.d.ts.map +1 -0
- package/dist/actions/inbox.js +345 -0
- package/dist/actions/inbox.js.map +1 -0
- package/dist/components/inbox/InboxSpatialView.d.ts +54 -0
- package/dist/components/inbox/InboxSpatialView.d.ts.map +1 -0
- package/dist/components/inbox/InboxSpatialView.js +171 -0
- package/dist/components/inbox/InboxSpatialView.js.map +1 -0
- package/dist/components/inbox/InboxView.d.ts +64 -0
- package/dist/components/inbox/InboxView.d.ts.map +1 -0
- package/dist/components/inbox/InboxView.js +169 -0
- package/dist/components/inbox/InboxView.js.map +1 -0
- package/dist/components/inbox/inbox-view-bundle.d.ts +2 -0
- package/dist/components/inbox/inbox-view-bundle.d.ts.map +1 -0
- package/dist/components/inbox/inbox-view-bundle.js +5 -0
- package/dist/components/inbox/inbox-view-bundle.js.map +1 -0
- package/dist/db/index.d.ts +3 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +3 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +1729 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +79 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/sql.d.ts +32 -0
- package/dist/db/sql.d.ts.map +1 -0
- package/dist/db/sql.js +130 -0
- package/dist/db/sql.js.map +1 -0
- package/dist/inbox/channel-deep-links.d.ts +7 -0
- package/dist/inbox/channel-deep-links.d.ts.map +1 -0
- package/dist/inbox/channel-deep-links.js +97 -0
- package/dist/inbox/channel-deep-links.js.map +1 -0
- package/dist/inbox/config.d.ts +7 -0
- package/dist/inbox/config.d.ts.map +1 -0
- package/dist/inbox/config.js +61 -0
- package/dist/inbox/config.js.map +1 -0
- package/dist/inbox/email-curation.d.ts +174 -0
- package/dist/inbox/email-curation.d.ts.map +1 -0
- package/dist/inbox/email-curation.js +1056 -0
- package/dist/inbox/email-curation.js.map +1 -0
- package/dist/inbox/email-unsubscribe-types.d.ts +71 -0
- package/dist/inbox/email-unsubscribe-types.d.ts.map +1 -0
- package/dist/inbox/email-unsubscribe-types.js +1 -0
- package/dist/inbox/email-unsubscribe-types.js.map +1 -0
- package/dist/inbox/gmail-normalize.d.ts +99 -0
- package/dist/inbox/gmail-normalize.d.ts.map +1 -0
- package/dist/inbox/gmail-normalize.js +937 -0
- package/dist/inbox/gmail-normalize.js.map +1 -0
- package/dist/inbox/google-gmail-seam.d.ts +52 -0
- package/dist/inbox/google-gmail-seam.d.ts.map +1 -0
- package/dist/inbox/google-gmail-seam.js +263 -0
- package/dist/inbox/google-gmail-seam.js.map +1 -0
- package/dist/inbox/message-fetcher.d.ts +47 -0
- package/dist/inbox/message-fetcher.d.ts.map +1 -0
- package/dist/inbox/message-fetcher.js +461 -0
- package/dist/inbox/message-fetcher.js.map +1 -0
- package/dist/inbox/migration.d.ts +46 -0
- package/dist/inbox/migration.d.ts.map +1 -0
- package/dist/inbox/migration.js +114 -0
- package/dist/inbox/migration.js.map +1 -0
- package/dist/inbox/reflection.d.ts +40 -0
- package/dist/inbox/reflection.d.ts.map +1 -0
- package/dist/inbox/reflection.js +142 -0
- package/dist/inbox/reflection.js.map +1 -0
- package/dist/inbox/repository.d.ts +58 -0
- package/dist/inbox/repository.d.ts.map +1 -0
- package/dist/inbox/repository.js +376 -0
- package/dist/inbox/repository.js.map +1 -0
- package/dist/inbox/service.d.ts +149 -0
- package/dist/inbox/service.d.ts.map +1 -0
- package/dist/inbox/service.js +247 -0
- package/dist/inbox/service.js.map +1 -0
- package/dist/inbox/triage-classifier.d.ts +28 -0
- package/dist/inbox/triage-classifier.d.ts.map +1 -0
- package/dist/inbox/triage-classifier.js +306 -0
- package/dist/inbox/triage-classifier.js.map +1 -0
- package/dist/inbox/types.d.ts +124 -0
- package/dist/inbox/types.d.ts.map +1 -0
- package/dist/inbox/types.js +1 -0
- package/dist/inbox/types.js.map +1 -0
- package/dist/inbox/unsubscribe-repository.d.ts +14 -0
- package/dist/inbox/unsubscribe-repository.d.ts.map +1 -0
- package/dist/inbox/unsubscribe-repository.js +112 -0
- package/dist/inbox/unsubscribe-repository.js.map +1 -0
- package/dist/inbox/unsubscribe-service.d.ts +41 -0
- package/dist/inbox/unsubscribe-service.d.ts.map +1 -0
- package/dist/inbox/unsubscribe-service.js +351 -0
- package/dist/inbox/unsubscribe-service.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +38 -0
- package/dist/plugin.js.map +1 -0
- package/dist/providers/cross-channel-context.d.ts +21 -0
- package/dist/providers/cross-channel-context.d.ts.map +1 -0
- package/dist/providers/cross-channel-context.js +96 -0
- package/dist/providers/cross-channel-context.js.map +1 -0
- package/dist/providers/inbox-triage.d.ts +12 -0
- package/dist/providers/inbox-triage.d.ts.map +1 -0
- package/dist/providers/inbox-triage.js +98 -0
- package/dist/providers/inbox-triage.js.map +1 -0
- package/dist/register-terminal-view.d.ts +15 -0
- package/dist/register-terminal-view.d.ts.map +1 -0
- package/dist/register-terminal-view.js +21 -0
- package/dist/register-terminal-view.js.map +1 -0
- package/dist/register.d.ts +9 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +5 -0
- package/dist/register.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +25 -0
- package/dist/types.js.map +1 -0
- package/dist/views/bundle.js +315 -0
- package/dist/views/bundle.js.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;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@
|
|
|
1
|
+
import { boolean, integer, pgSchema, real, text } from "drizzle-orm/pg-core";
|
|
2
|
+
const inboxSchema = pgSchema("app_inbox");
|
|
3
|
+
const lifeInboxTriageEntries = inboxSchema.table(
|
|
4
|
+
"life_inbox_triage_entries",
|
|
5
|
+
{
|
|
6
|
+
id: text("id").primaryKey(),
|
|
7
|
+
agentId: text("agent_id").notNull(),
|
|
8
|
+
source: text("source").notNull(),
|
|
9
|
+
sourceRoomId: text("source_room_id"),
|
|
10
|
+
sourceEntityId: text("source_entity_id"),
|
|
11
|
+
sourceMessageId: text("source_message_id"),
|
|
12
|
+
channelName: text("channel_name").notNull(),
|
|
13
|
+
channelType: text("channel_type").notNull(),
|
|
14
|
+
deepLink: text("deep_link"),
|
|
15
|
+
classification: text("classification").notNull(),
|
|
16
|
+
urgency: text("urgency").notNull().default("low"),
|
|
17
|
+
confidence: real("confidence").notNull().default(0.5),
|
|
18
|
+
snippet: text("snippet").notNull().default(""),
|
|
19
|
+
senderName: text("sender_name"),
|
|
20
|
+
threadContext: text("thread_context"),
|
|
21
|
+
triageReasoning: text("triage_reasoning"),
|
|
22
|
+
suggestedResponse: text("suggested_response"),
|
|
23
|
+
draftResponse: text("draft_response"),
|
|
24
|
+
autoReplied: boolean("auto_replied").notNull().default(false),
|
|
25
|
+
resolved: boolean("resolved").notNull().default(false),
|
|
26
|
+
resolvedAt: text("resolved_at"),
|
|
27
|
+
createdAt: text("created_at").notNull(),
|
|
28
|
+
updatedAt: text("updated_at").notNull()
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
const lifeInboxTriageExamples = inboxSchema.table(
|
|
32
|
+
"life_inbox_triage_examples",
|
|
33
|
+
{
|
|
34
|
+
id: text("id").primaryKey(),
|
|
35
|
+
agentId: text("agent_id").notNull(),
|
|
36
|
+
source: text("source").notNull(),
|
|
37
|
+
snippet: text("snippet").notNull().default(""),
|
|
38
|
+
classification: text("classification").notNull(),
|
|
39
|
+
ownerAction: text("owner_action").notNull(),
|
|
40
|
+
ownerClassification: text("owner_classification"),
|
|
41
|
+
contextJson: text("context_json").notNull().default("{}"),
|
|
42
|
+
createdAt: text("created_at").notNull()
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
const lifeEmailUnsubscribes = inboxSchema.table(
|
|
46
|
+
"life_email_unsubscribes",
|
|
47
|
+
{
|
|
48
|
+
id: text("id").primaryKey(),
|
|
49
|
+
agentId: text("agent_id").notNull(),
|
|
50
|
+
senderEmail: text("sender_email").notNull(),
|
|
51
|
+
senderDisplay: text("sender_display").notNull().default(""),
|
|
52
|
+
senderDomain: text("sender_domain"),
|
|
53
|
+
listId: text("list_id"),
|
|
54
|
+
method: text("method").notNull().default("manual_only"),
|
|
55
|
+
status: text("status").notNull().default("failed"),
|
|
56
|
+
httpStatusCode: integer("http_status_code"),
|
|
57
|
+
httpFinalUrl: text("http_final_url"),
|
|
58
|
+
filterCreated: boolean("filter_created").notNull().default(false),
|
|
59
|
+
filterId: text("filter_id"),
|
|
60
|
+
threadsTrashed: integer("threads_trashed").notNull().default(0),
|
|
61
|
+
errorMessage: text("error_message"),
|
|
62
|
+
metadataJson: text("metadata_json").notNull().default("{}"),
|
|
63
|
+
createdAt: text("created_at").notNull(),
|
|
64
|
+
updatedAt: text("updated_at").notNull()
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
const inboxDbSchema = {
|
|
68
|
+
lifeInboxTriageEntries,
|
|
69
|
+
lifeInboxTriageExamples,
|
|
70
|
+
lifeEmailUnsubscribes
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
inboxDbSchema,
|
|
74
|
+
inboxSchema,
|
|
75
|
+
lifeEmailUnsubscribes,
|
|
76
|
+
lifeInboxTriageEntries,
|
|
77
|
+
lifeInboxTriageExamples
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/db/schema.ts"],"sourcesContent":["import { boolean, integer, pgSchema, real, text } from \"drizzle-orm/pg-core\";\n\n/**\n * Drizzle schema for plugin-inbox.\n *\n * The inbox-triage tables (`life_inbox_triage_entries`,\n * `life_inbox_triage_examples`, `life_email_unsubscribes`) were carved out of\n * `@elizaos/plugin-personal-assistant`'s `app_lifeops` schema into `app_inbox`,\n * owned by this plugin. Table + column names (and column order) are preserved\n * verbatim so the non-destructive `InboxMigrationService` can copy existing\n * `app_lifeops` rows across on first boot. The runtime registers this schema\n * through `@elizaos/plugin-sql`.\n *\n * Gmail sync/projection tables (`life_gmail_*`, `life_inbox_messages`) are NOT\n * part of the inbox-triage domain — they stay owned by PA in `app_lifeops`.\n */\nexport const inboxSchema = pgSchema(\"app_inbox\");\n\nexport const lifeInboxTriageEntries = inboxSchema.table(\n \"life_inbox_triage_entries\",\n {\n id: text(\"id\").primaryKey(),\n agentId: text(\"agent_id\").notNull(),\n source: text(\"source\").notNull(),\n sourceRoomId: text(\"source_room_id\"),\n sourceEntityId: text(\"source_entity_id\"),\n sourceMessageId: text(\"source_message_id\"),\n channelName: text(\"channel_name\").notNull(),\n channelType: text(\"channel_type\").notNull(),\n deepLink: text(\"deep_link\"),\n classification: text(\"classification\").notNull(),\n urgency: text(\"urgency\").notNull().default(\"low\"),\n confidence: real(\"confidence\").notNull().default(0.5),\n snippet: text(\"snippet\").notNull().default(\"\"),\n senderName: text(\"sender_name\"),\n threadContext: text(\"thread_context\"),\n triageReasoning: text(\"triage_reasoning\"),\n suggestedResponse: text(\"suggested_response\"),\n draftResponse: text(\"draft_response\"),\n autoReplied: boolean(\"auto_replied\").notNull().default(false),\n resolved: boolean(\"resolved\").notNull().default(false),\n resolvedAt: text(\"resolved_at\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n);\n\nexport const lifeInboxTriageExamples = inboxSchema.table(\n \"life_inbox_triage_examples\",\n {\n id: text(\"id\").primaryKey(),\n agentId: text(\"agent_id\").notNull(),\n source: text(\"source\").notNull(),\n snippet: text(\"snippet\").notNull().default(\"\"),\n classification: text(\"classification\").notNull(),\n ownerAction: text(\"owner_action\").notNull(),\n ownerClassification: text(\"owner_classification\"),\n contextJson: text(\"context_json\").notNull().default(\"{}\"),\n createdAt: text(\"created_at\").notNull(),\n },\n);\n\nexport const lifeEmailUnsubscribes = inboxSchema.table(\n \"life_email_unsubscribes\",\n {\n id: text(\"id\").primaryKey(),\n agentId: text(\"agent_id\").notNull(),\n senderEmail: text(\"sender_email\").notNull(),\n senderDisplay: text(\"sender_display\").notNull().default(\"\"),\n senderDomain: text(\"sender_domain\"),\n listId: text(\"list_id\"),\n method: text(\"method\").notNull().default(\"manual_only\"),\n status: text(\"status\").notNull().default(\"failed\"),\n httpStatusCode: integer(\"http_status_code\"),\n httpFinalUrl: text(\"http_final_url\"),\n filterCreated: boolean(\"filter_created\").notNull().default(false),\n filterId: text(\"filter_id\"),\n threadsTrashed: integer(\"threads_trashed\").notNull().default(0),\n errorMessage: text(\"error_message\"),\n metadataJson: text(\"metadata_json\").notNull().default(\"{}\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n);\n\nexport const inboxDbSchema = {\n lifeInboxTriageEntries,\n lifeInboxTriageExamples,\n lifeEmailUnsubscribes,\n} as const;\n\nexport type InboxTriageEntryRow = typeof lifeInboxTriageEntries.$inferSelect;\nexport type InboxTriageExampleRow = typeof lifeInboxTriageExamples.$inferSelect;\nexport type EmailUnsubscribeRow = typeof lifeEmailUnsubscribes.$inferSelect;\n"],"mappings":"AAAA,SAAS,SAAS,SAAS,UAAU,MAAM,YAAY;AAgBhD,MAAM,cAAc,SAAS,WAAW;AAExC,MAAM,yBAAyB,YAAY;AAAA,EAChD;AAAA,EACA;AAAA,IACE,IAAI,KAAK,IAAI,EAAE,WAAW;AAAA,IAC1B,SAAS,KAAK,UAAU,EAAE,QAAQ;AAAA,IAClC,QAAQ,KAAK,QAAQ,EAAE,QAAQ;AAAA,IAC/B,cAAc,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batim from
|
|
4
|
+
* the PA LifeOps sql helpers (renamed error prefixes) so this plugin carries no
|
|
5
|
+
* dependency on `@elizaos/plugin-personal-assistant`. Keep in sync only when a
|
|
6
|
+
* correctness fix applies to both; do not add inbox-specific logic here.
|
|
7
|
+
*/
|
|
8
|
+
export type RawSqlQuery = {
|
|
9
|
+
queryChunks: Array<{
|
|
10
|
+
value?: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export type RuntimeDb = {
|
|
14
|
+
execute: (query: RawSqlQuery) => Promise<unknown>;
|
|
15
|
+
};
|
|
16
|
+
export declare function asObject(value: unknown): Record<string, unknown> | null;
|
|
17
|
+
export declare function toText(value: unknown, fallback?: string): string;
|
|
18
|
+
export declare function toNumber(value: unknown, fallback?: number): number;
|
|
19
|
+
export declare function toBoolean(value: unknown, fallback?: boolean): boolean;
|
|
20
|
+
export declare function parseJsonValue<T>(value: unknown, fallback: T): T;
|
|
21
|
+
export declare function parseJsonRecord(value: unknown): Record<string, unknown>;
|
|
22
|
+
export declare function parseJsonArray<T>(value: unknown): T[];
|
|
23
|
+
export declare function extractRows(result: unknown): Array<Record<string, unknown>>;
|
|
24
|
+
export declare function getRuntimeDb(runtime: IAgentRuntime): RuntimeDb;
|
|
25
|
+
export declare function executeRawSql(runtime: IAgentRuntime, sqlText: string): Promise<Array<Record<string, unknown>>>;
|
|
26
|
+
export declare function sqlQuote(value: string): string;
|
|
27
|
+
export declare function sqlText(value: string | null | undefined): string;
|
|
28
|
+
export declare function sqlInteger(value: number | null | undefined): string;
|
|
29
|
+
export declare function sqlNumber(value: number | null | undefined): string;
|
|
30
|
+
export declare function sqlBoolean(value: boolean): string;
|
|
31
|
+
export declare function sqlJson(value: unknown): string;
|
|
32
|
+
//# sourceMappingURL=sql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../src/db/sql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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,CAAC,CAAC,CAKzC;AAMD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGhE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAInE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIlE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE9C"}
|
package/dist/db/sql.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
let cachedSqlRaw = null;
|
|
2
|
+
function asObject(value) {
|
|
3
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
4
|
+
return value;
|
|
5
|
+
}
|
|
6
|
+
function toText(value, fallback = "") {
|
|
7
|
+
if (typeof value === "string") return value;
|
|
8
|
+
if (value === null || value === void 0) return fallback;
|
|
9
|
+
return String(value);
|
|
10
|
+
}
|
|
11
|
+
function toNumber(value, fallback = 0) {
|
|
12
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
13
|
+
if (typeof value === "string") {
|
|
14
|
+
const parsed = Number(value);
|
|
15
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
16
|
+
}
|
|
17
|
+
return fallback;
|
|
18
|
+
}
|
|
19
|
+
function toBoolean(value, fallback = false) {
|
|
20
|
+
if (typeof value === "boolean") return value;
|
|
21
|
+
if (typeof value === "number") return value !== 0;
|
|
22
|
+
if (typeof value === "string") {
|
|
23
|
+
const normalized = value.trim().toLowerCase();
|
|
24
|
+
if (["1", "true", "yes", "on"].includes(normalized)) return true;
|
|
25
|
+
if (["0", "false", "no", "off"].includes(normalized)) return false;
|
|
26
|
+
}
|
|
27
|
+
return fallback;
|
|
28
|
+
}
|
|
29
|
+
function isMissingJsonValue(value) {
|
|
30
|
+
return value === null || value === void 0 || value === "";
|
|
31
|
+
}
|
|
32
|
+
function parseJsonValue(value, fallback) {
|
|
33
|
+
if (isMissingJsonValue(value)) return fallback;
|
|
34
|
+
if (typeof value !== "string") {
|
|
35
|
+
if (typeof value === "object") return value;
|
|
36
|
+
throw new Error(
|
|
37
|
+
`[InboxSql] Expected JSON string or object, received ${typeof value}`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(value);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
44
|
+
throw new Error(`[InboxSql] Invalid JSON value: ${message}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function parseJsonRecord(value) {
|
|
48
|
+
if (isMissingJsonValue(value)) return {};
|
|
49
|
+
const parsed = parseJsonValue(value, null);
|
|
50
|
+
const object = asObject(parsed);
|
|
51
|
+
if (object) return object;
|
|
52
|
+
throw new Error("[InboxSql] Expected JSON object");
|
|
53
|
+
}
|
|
54
|
+
function parseJsonArray(value) {
|
|
55
|
+
if (isMissingJsonValue(value)) return [];
|
|
56
|
+
const parsed = parseJsonValue(value, null);
|
|
57
|
+
if (Array.isArray(parsed)) return parsed;
|
|
58
|
+
throw new Error("[InboxSql] Expected JSON array");
|
|
59
|
+
}
|
|
60
|
+
function extractRows(result) {
|
|
61
|
+
if (Array.isArray(result)) {
|
|
62
|
+
return result.map((row) => asObject(row)).filter((row) => row !== null);
|
|
63
|
+
}
|
|
64
|
+
const object = asObject(result);
|
|
65
|
+
if (!object) return [];
|
|
66
|
+
const rows = object.rows;
|
|
67
|
+
if (!Array.isArray(rows)) return [];
|
|
68
|
+
return rows.map((row) => asObject(row)).filter((row) => row !== null);
|
|
69
|
+
}
|
|
70
|
+
async function getSqlRaw() {
|
|
71
|
+
if (cachedSqlRaw) return cachedSqlRaw;
|
|
72
|
+
const drizzle = await import("drizzle-orm");
|
|
73
|
+
cachedSqlRaw = drizzle.sql.raw;
|
|
74
|
+
return cachedSqlRaw;
|
|
75
|
+
}
|
|
76
|
+
function getRuntimeDb(runtime) {
|
|
77
|
+
const db = runtime.adapter.db;
|
|
78
|
+
if (!db || typeof db.execute !== "function") {
|
|
79
|
+
throw new Error("runtime database adapter unavailable");
|
|
80
|
+
}
|
|
81
|
+
return db;
|
|
82
|
+
}
|
|
83
|
+
async function executeRawSql(runtime, sqlText2) {
|
|
84
|
+
const raw = await getSqlRaw();
|
|
85
|
+
const db = getRuntimeDb(runtime);
|
|
86
|
+
const result = await db.execute(raw(sqlText2));
|
|
87
|
+
return extractRows(result);
|
|
88
|
+
}
|
|
89
|
+
function sqlQuote(value) {
|
|
90
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
91
|
+
}
|
|
92
|
+
function sqlText(value) {
|
|
93
|
+
if (value === null || value === void 0) return "NULL";
|
|
94
|
+
return sqlQuote(value);
|
|
95
|
+
}
|
|
96
|
+
function sqlInteger(value) {
|
|
97
|
+
if (value === null || value === void 0) return "NULL";
|
|
98
|
+
if (!Number.isFinite(value)) throw new Error("invalid numeric SQL literal");
|
|
99
|
+
return String(Math.trunc(value));
|
|
100
|
+
}
|
|
101
|
+
function sqlNumber(value) {
|
|
102
|
+
if (value === null || value === void 0) return "NULL";
|
|
103
|
+
if (!Number.isFinite(value)) throw new Error("invalid numeric SQL literal");
|
|
104
|
+
return String(value);
|
|
105
|
+
}
|
|
106
|
+
function sqlBoolean(value) {
|
|
107
|
+
return value ? "TRUE" : "FALSE";
|
|
108
|
+
}
|
|
109
|
+
function sqlJson(value) {
|
|
110
|
+
return sqlQuote(JSON.stringify(value ?? null));
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
asObject,
|
|
114
|
+
executeRawSql,
|
|
115
|
+
extractRows,
|
|
116
|
+
getRuntimeDb,
|
|
117
|
+
parseJsonArray,
|
|
118
|
+
parseJsonRecord,
|
|
119
|
+
parseJsonValue,
|
|
120
|
+
sqlBoolean,
|
|
121
|
+
sqlInteger,
|
|
122
|
+
sqlJson,
|
|
123
|
+
sqlNumber,
|
|
124
|
+
sqlQuote,
|
|
125
|
+
sqlText,
|
|
126
|
+
toBoolean,
|
|
127
|
+
toNumber,
|
|
128
|
+
toText
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=sql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/db/sql.ts"],"sourcesContent":["import type { IAgentRuntime } from \"@elizaos/core\";\n\n/**\n * Self-contained raw-SQL helpers for the inbox back-end. Copied verbatim from\n * the PA LifeOps sql helpers (renamed error prefixes) so this plugin carries no\n * dependency on `@elizaos/plugin-personal-assistant`. Keep in sync only when a\n * correctness fix applies to both; do not add inbox-specific logic here.\n */\n\nexport type RawSqlQuery = {\n queryChunks: Array<{ value?: unknown }>;\n};\n\nexport type RuntimeDb = {\n execute: (query: RawSqlQuery) => Promise<unknown>;\n};\n\nlet cachedSqlRaw: ((query: string) => RawSqlQuery) | null = null;\n\nexport function asObject(value: unknown): Record<string, unknown> | null {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n}\n\nexport function toText(value: unknown, fallback = \"\"): string {\n if (typeof value === \"string\") return value;\n if (value === null || value === undefined) return fallback;\n return String(value);\n}\n\nexport function toNumber(value: unknown, fallback = 0): number {\n if (typeof value === \"number\" && Number.isFinite(value)) return value;\n if (typeof value === \"string\") {\n const parsed = Number(value);\n if (Number.isFinite(parsed)) return parsed;\n }\n return fallback;\n}\n\nexport function toBoolean(value: unknown, fallback = false): boolean {\n if (typeof value === \"boolean\") return value;\n if (typeof value === \"number\") return value !== 0;\n if (typeof value === \"string\") {\n const normalized = value.trim().toLowerCase();\n if ([\"1\", \"true\", \"yes\", \"on\"].includes(normalized)) return true;\n if ([\"0\", \"false\", \"no\", \"off\"].includes(normalized)) return false;\n }\n return fallback;\n}\n\nfunction isMissingJsonValue(value: unknown): boolean {\n return value === null || value === undefined || value === \"\";\n}\n\nexport function parseJsonValue<T>(value: unknown, fallback: T): T {\n if (isMissingJsonValue(value)) return fallback;\n if (typeof value !== \"string\") {\n if (typeof value === \"object\") return value as T;\n throw new Error(\n `[InboxSql] Expected JSON string or object, received ${typeof value}`,\n );\n }\n try {\n return JSON.parse(value) as T;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`[InboxSql] Invalid JSON value: ${message}`);\n }\n}\n\nexport function parseJsonRecord(value: unknown): Record<string, unknown> {\n if (isMissingJsonValue(value)) return {};\n const parsed = parseJsonValue<Record<string, unknown> | null>(value, null);\n const object = asObject(parsed);\n if (object) return object;\n throw new Error(\"[InboxSql] Expected JSON object\");\n}\n\nexport function parseJsonArray<T>(value: unknown): T[] {\n if (isMissingJsonValue(value)) return [];\n const parsed = parseJsonValue<T[] | null>(value, null);\n if (Array.isArray(parsed)) return parsed;\n throw new Error(\"[InboxSql] Expected JSON array\");\n}\n\nexport function extractRows(result: unknown): Array<Record<string, unknown>> {\n if (Array.isArray(result)) {\n return result\n .map((row) => asObject(row))\n .filter((row): row is Record<string, unknown> => row !== null);\n }\n const object = asObject(result);\n if (!object) return [];\n const rows = object.rows;\n if (!Array.isArray(rows)) return [];\n return rows\n .map((row) => asObject(row))\n .filter((row): row is Record<string, unknown> => row !== null);\n}\n\nasync function getSqlRaw(): Promise<(query: string) => RawSqlQuery> {\n if (cachedSqlRaw) return cachedSqlRaw;\n const drizzle = (await import(\"drizzle-orm\")) as {\n sql: { raw: (query: string) => RawSqlQuery };\n };\n cachedSqlRaw = drizzle.sql.raw;\n return cachedSqlRaw;\n}\n\nexport function getRuntimeDb(runtime: IAgentRuntime): RuntimeDb {\n const db = runtime.adapter.db as RuntimeDb | undefined;\n if (!db || typeof db.execute !== \"function\") {\n throw new Error(\"runtime database adapter unavailable\");\n }\n return db;\n}\n\nexport async function executeRawSql(\n runtime: IAgentRuntime,\n sqlText: string,\n): Promise<Array<Record<string, unknown>>> {\n const raw = await getSqlRaw();\n const db = getRuntimeDb(runtime);\n const result = await db.execute(raw(sqlText));\n return extractRows(result);\n}\n\n// ---------------------------------------------------------------------------\n// SQL value encoders\n// ---------------------------------------------------------------------------\n\nexport function sqlQuote(value: string): string {\n return `'${value.replace(/'/g, \"''\")}'`;\n}\n\nexport function sqlText(value: string | null | undefined): string {\n if (value === null || value === undefined) return \"NULL\";\n return sqlQuote(value);\n}\n\nexport function sqlInteger(value: number | null | undefined): string {\n if (value === null || value === undefined) return \"NULL\";\n if (!Number.isFinite(value)) throw new Error(\"invalid numeric SQL literal\");\n return String(Math.trunc(value));\n}\n\nexport function sqlNumber(value: number | null | undefined): string {\n if (value === null || value === undefined) return \"NULL\";\n if (!Number.isFinite(value)) throw new Error(\"invalid numeric SQL literal\");\n return String(value);\n}\n\nexport function sqlBoolean(value: boolean): string {\n return value ? \"TRUE\" : \"FALSE\";\n}\n\nexport function sqlJson(value: unknown): string {\n return sqlQuote(JSON.stringify(value ?? null));\n}\n"],"mappings":"AAiBA,IAAI,eAAwD;AAErD,SAAS,SAAS,OAAgD;AACvE,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,EAAG,QAAO;AACxE,SAAO;AACT;AAEO,SAAS,OAAO,OAAgB,WAAW,IAAY;AAC5D,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,SAAO,OAAO,KAAK;AACrB;AAEO,SAAS,SAAS,OAAgB,WAAW,GAAW;AAC7D,MAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,EAAG,QAAO;AAChE,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,SAAS,OAAO,KAAK;AAC3B,QAAI,OAAO,SAAS,MAAM,EAAG,QAAO;AAAA,EACtC;AACA,SAAO;AACT;AAEO,SAAS,UAAU,OAAgB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AAC;AACjC;AAEO,SAAS,UAAU,OAA0C;AAClE,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,OAAM,IAAI,MAAM,6BAA6B;AAC1E,SAAO,OAAO,KAAK;AACrB;AAEO,SAAS,WAAW,OAAwB;AACjD,SAAO,QAAQ,SAAS;AAC1B;AAEO,SAAS,QAAQ,OAAwB;AAC9C,SAAO,SAAS,KAAK,UAAU,SAAS,IAAI,CAAC;AAC/C;","names":["sqlText"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function buildDeepLink(source: string, opts: {
|
|
2
|
+
messageId?: string;
|
|
3
|
+
roomMeta?: Record<string, unknown>;
|
|
4
|
+
worldMeta?: Record<string, unknown>;
|
|
5
|
+
}): string | null;
|
|
6
|
+
export declare function resolveChannelName(source: string, roomName?: string, senderName?: string): string;
|
|
7
|
+
//# sourceMappingURL=channel-deep-links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-deep-links.d.ts","sourceRoot":"","sources":["../../src/inbox/channel-deep-links.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IACJ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,GACA,MAAM,GAAG,IAAI,CAwBf;AAsGD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CAIR"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
function buildDeepLink(source, opts) {
|
|
2
|
+
const meta = opts.roomMeta ?? {};
|
|
3
|
+
const worldMeta = opts.worldMeta ?? {};
|
|
4
|
+
switch (source) {
|
|
5
|
+
case "discord":
|
|
6
|
+
case "discord-local":
|
|
7
|
+
return buildDiscordLink(meta, worldMeta, opts.messageId);
|
|
8
|
+
case "telegram":
|
|
9
|
+
case "telegram-account":
|
|
10
|
+
return buildTelegramLink(meta, opts.messageId);
|
|
11
|
+
case "signal":
|
|
12
|
+
return buildSignalLink(meta);
|
|
13
|
+
case "imessage":
|
|
14
|
+
return buildIMessageLink(meta);
|
|
15
|
+
case "whatsapp":
|
|
16
|
+
return buildWhatsAppLink(meta);
|
|
17
|
+
case "slack":
|
|
18
|
+
return buildSlackLink(meta, worldMeta, opts.messageId);
|
|
19
|
+
case "gmail":
|
|
20
|
+
return buildGmailLink(meta, opts.messageId);
|
|
21
|
+
default:
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function buildDiscordLink(room, world, messageId) {
|
|
26
|
+
const serverId = str(world.serverId) || str(room.serverId);
|
|
27
|
+
const channelId = str(room.channelId);
|
|
28
|
+
if (!channelId) return null;
|
|
29
|
+
const base = serverId ? `https://discord.com/channels/${serverId}/${channelId}` : `https://discord.com/channels/@me/${channelId}`;
|
|
30
|
+
return messageId ? `${base}/${messageId}` : base;
|
|
31
|
+
}
|
|
32
|
+
function buildTelegramLink(room, messageId) {
|
|
33
|
+
const username = str(room.username);
|
|
34
|
+
const chatId = str(room.chatId);
|
|
35
|
+
if (username) {
|
|
36
|
+
return messageId ? `https://t.me/${username}/${messageId}` : `https://t.me/${username}`;
|
|
37
|
+
}
|
|
38
|
+
if (chatId) {
|
|
39
|
+
const normalized = chatId.replace(/^-100/, "");
|
|
40
|
+
return messageId ? `https://t.me/c/${normalized}/${messageId}` : `https://t.me/c/${normalized}`;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
function buildSignalLink(room) {
|
|
45
|
+
const phoneNumber = str(room.phoneNumber) || str(room.identifier);
|
|
46
|
+
if (phoneNumber) {
|
|
47
|
+
return `signal://signal.me/#p/${phoneNumber}`;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function buildIMessageLink(room) {
|
|
52
|
+
const handle = str(room.handle) || str(room.chatIdentifier) || str(room.chat_identifier);
|
|
53
|
+
if (handle) {
|
|
54
|
+
return `imessage://${handle}`;
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
function buildWhatsAppLink(room) {
|
|
59
|
+
const phoneNumber = str(room.phoneNumber) || str(room.jid)?.replace(/@.*$/, "");
|
|
60
|
+
if (phoneNumber) {
|
|
61
|
+
return `https://wa.me/${phoneNumber.replace(/\D/g, "")}`;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
function buildSlackLink(room, world, messageId) {
|
|
66
|
+
const teamId = str(world.teamId) || str(room.teamId);
|
|
67
|
+
const channelId = str(room.channelId);
|
|
68
|
+
if (!teamId || !channelId) return null;
|
|
69
|
+
if (messageId) {
|
|
70
|
+
const ts = messageId.startsWith("p") ? messageId.slice(1) : messageId;
|
|
71
|
+
return `https://app.slack.com/client/${teamId}/${channelId}/thread/${channelId}-${ts}`;
|
|
72
|
+
}
|
|
73
|
+
return `slack://channel?team=${teamId}&id=${channelId}`;
|
|
74
|
+
}
|
|
75
|
+
function buildGmailLink(room, messageId) {
|
|
76
|
+
const gmailId = messageId || str(room.gmailMessageId);
|
|
77
|
+
if (gmailId) {
|
|
78
|
+
const account = str(room.gmailAccountEmail) || str(room.accountEmail) || str(room.email) || "0";
|
|
79
|
+
return `https://mail.google.com/mail/u/${encodeURIComponent(account)}/#inbox/${gmailId}`;
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
function str(value) {
|
|
84
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
85
|
+
if (typeof value === "number") return String(value);
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
function resolveChannelName(source, roomName, senderName) {
|
|
89
|
+
if (roomName) return roomName;
|
|
90
|
+
if (senderName) return `${senderName} (${source})`;
|
|
91
|
+
return source;
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
buildDeepLink,
|
|
95
|
+
resolveChannelName
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=channel-deep-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/inbox/channel-deep-links.ts"],"sourcesContent":["export function buildDeepLink(\n source: string,\n opts: {\n messageId?: string;\n roomMeta?: Record<string, unknown>;\n worldMeta?: Record<string, unknown>;\n },\n): string | null {\n const meta = opts.roomMeta ?? {};\n const worldMeta = opts.worldMeta ?? {};\n\n switch (source) {\n case \"discord\":\n case \"discord-local\":\n return buildDiscordLink(meta, worldMeta, opts.messageId);\n case \"telegram\":\n case \"telegram-account\":\n return buildTelegramLink(meta, opts.messageId);\n case \"signal\":\n return buildSignalLink(meta);\n case \"imessage\":\n return buildIMessageLink(meta);\n case \"whatsapp\":\n return buildWhatsAppLink(meta);\n case \"slack\":\n return buildSlackLink(meta, worldMeta, opts.messageId);\n case \"gmail\":\n return buildGmailLink(meta, opts.messageId);\n default:\n return null;\n }\n}\n\nfunction buildDiscordLink(\n room: Record<string, unknown>,\n world: Record<string, unknown>,\n messageId?: string,\n): string | null {\n const serverId = str(world.serverId) || str(room.serverId);\n const channelId = str(room.channelId);\n if (!channelId) return null;\n\n const base = serverId\n ? `https://discord.com/channels/${serverId}/${channelId}`\n : `https://discord.com/channels/@me/${channelId}`;\n return messageId ? `${base}/${messageId}` : base;\n}\n\nfunction buildTelegramLink(\n room: Record<string, unknown>,\n messageId?: string,\n): string | null {\n const username = str(room.username);\n const chatId = str(room.chatId);\n\n if (username) {\n return messageId\n ? `https://t.me/${username}/${messageId}`\n : `https://t.me/${username}`;\n }\n if (chatId) {\n const normalized = chatId.replace(/^-100/, \"\");\n return messageId\n ? `https://t.me/c/${normalized}/${messageId}`\n : `https://t.me/c/${normalized}`;\n }\n return null;\n}\n\nfunction buildSignalLink(room: Record<string, unknown>): string | null {\n const phoneNumber = str(room.phoneNumber) || str(room.identifier);\n if (phoneNumber) {\n return `signal://signal.me/#p/${phoneNumber}`;\n }\n return null;\n}\n\nfunction buildIMessageLink(room: Record<string, unknown>): string | null {\n const handle =\n str(room.handle) || str(room.chatIdentifier) || str(room.chat_identifier);\n if (handle) {\n return `imessage://${handle}`;\n }\n return null;\n}\n\nfunction buildWhatsAppLink(room: Record<string, unknown>): string | null {\n const phoneNumber =\n str(room.phoneNumber) || str(room.jid)?.replace(/@.*$/, \"\");\n if (phoneNumber) {\n return `https://wa.me/${phoneNumber.replace(/\\D/g, \"\")}`;\n }\n return null;\n}\n\nfunction buildSlackLink(\n room: Record<string, unknown>,\n world: Record<string, unknown>,\n messageId?: string,\n): string | null {\n const teamId = str(world.teamId) || str(room.teamId);\n const channelId = str(room.channelId);\n if (!teamId || !channelId) return null;\n\n if (messageId) {\n const ts = messageId.startsWith(\"p\") ? messageId.slice(1) : messageId;\n return `https://app.slack.com/client/${teamId}/${channelId}/thread/${channelId}-${ts}`;\n }\n return `slack://channel?team=${teamId}&id=${channelId}`;\n}\n\nfunction buildGmailLink(\n room: Record<string, unknown>,\n messageId?: string,\n): string | null {\n const gmailId = messageId || str(room.gmailMessageId);\n if (gmailId) {\n const account =\n str(room.gmailAccountEmail) ||\n str(room.accountEmail) ||\n str(room.email) ||\n \"0\";\n return `https://mail.google.com/mail/u/${encodeURIComponent(account)}/#inbox/${gmailId}`;\n }\n return null;\n}\n\nfunction str(value: unknown): string | null {\n if (typeof value === \"string\" && value.length > 0) return value;\n if (typeof value === \"number\") return String(value);\n return null;\n}\n\nexport function resolveChannelName(\n source: string,\n roomName?: string,\n senderName?: string,\n): string {\n if (roomName) return roomName;\n if (senderName) return `${senderName} (${source})`;\n return source;\n}\n"],"mappings":"AAAO,SAAS,cACd,QACA,MAKe;AACf,QAAM,OAAO,KAAK,YA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O;AACT;AAEO,SAAS,mBACd,QACA,UACA,YACQ;AACR,MAAI,SAAU,QAAO;AACrB,MAAI,WAAY,QAAO,GAAG,UAAU,KAAK,MAAM;AAC/C,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InboxTriageConfig } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Load inbox triage configuration from the agent config file.
|
|
4
|
+
* Falls back to sensible defaults when not configured.
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadInboxTriageConfig(): InboxTriageConfig;
|
|
7
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/inbox/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,iBAAiB,CAazD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { loadElizaConfig } from "@elizaos/agent/config/config";
|
|
2
|
+
function loadInboxTriageConfig() {
|
|
3
|
+
try {
|
|
4
|
+
const cfg = loadElizaConfig();
|
|
5
|
+
const raw = cfg.agents?.defaults?.inboxTriage;
|
|
6
|
+
if (raw && typeof raw === "object") {
|
|
7
|
+
return deepMergeConfig(DEFAULT_CONFIG, raw);
|
|
8
|
+
}
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
return { ...DEFAULT_CONFIG };
|
|
12
|
+
}
|
|
13
|
+
function deepMergeConfig(defaults, overrides) {
|
|
14
|
+
return {
|
|
15
|
+
...defaults,
|
|
16
|
+
...overrides,
|
|
17
|
+
autoReply: {
|
|
18
|
+
...defaults.autoReply,
|
|
19
|
+
...overrides.autoReply ?? {}
|
|
20
|
+
},
|
|
21
|
+
triageRules: {
|
|
22
|
+
...defaults.triageRules,
|
|
23
|
+
...overrides.triageRules ?? {}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const DEFAULT_CONFIG = {
|
|
28
|
+
enabled: false,
|
|
29
|
+
triageCron: "0 * * * *",
|
|
30
|
+
digestCron: "0 8 * * *",
|
|
31
|
+
digestTimezone: void 0,
|
|
32
|
+
channels: [
|
|
33
|
+
"discord",
|
|
34
|
+
"telegram",
|
|
35
|
+
"signal",
|
|
36
|
+
"imessage",
|
|
37
|
+
"whatsapp",
|
|
38
|
+
"gmail",
|
|
39
|
+
"x_dm"
|
|
40
|
+
],
|
|
41
|
+
prioritySenders: [],
|
|
42
|
+
priorityChannels: [],
|
|
43
|
+
autoReply: {
|
|
44
|
+
enabled: false,
|
|
45
|
+
confidenceThreshold: 0.85,
|
|
46
|
+
senderWhitelist: [],
|
|
47
|
+
channelWhitelist: [],
|
|
48
|
+
maxAutoRepliesPerHour: 5
|
|
49
|
+
},
|
|
50
|
+
triageRules: {
|
|
51
|
+
alwaysUrgent: [],
|
|
52
|
+
alwaysIgnore: [],
|
|
53
|
+
alwaysNotify: []
|
|
54
|
+
},
|
|
55
|
+
digestDeliveryChannel: "client_chat",
|
|
56
|
+
retentionDays: 30
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
loadInboxTriageConfig
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/inbox/config.ts"],"sourcesContent":["import { loadElizaConfig } from \"@elizaos/agent/config/config\";\nimport type { InboxTriageConfig } from \"./types.js\";\n\n/**\n * Load inbox triage configuration from the agent config file.\n * Falls back to sensible defaults when not configured.\n */\nexport function loadInboxTriageConfig(): InboxTriageConfig {\n try {\n const cfg = loadElizaConfig();\n const raw = cfg.agents?.defaults?.inboxTriage as\n | Partial<InboxTriageConfig>\n | undefined;\n if (raw && typeof raw === \"object\") {\n return deepMergeConfig(DEFAULT_CONFIG, raw);\n }\n } catch {\n // Config loading failed; use defaults\n }\n return { ...DEFAULT_CONFIG };\n}\n\n/**\n * Deep-merge user overrides onto defaults so nested objects (autoReply,\n * triageRules) keep their default fields when the user only sets a subset.\n */\nfunction deepMergeConfig(\n defaults: InboxTriageConfig,\n overrides: Partial<InboxTriageConfig>,\n): InboxTriageConfig {\n return {\n ...defaults,\n ...overrides,\n autoReply: {\n ...defaults.autoReply,\n ...(overrides.autoReply ?? {}),\n },\n triageRules: {\n ...defaults.triageRules,\n ...(overrides.triageRules ?? {}),\n },\n };\n}\n\nconst DEFAULT_CONFIG: InboxTriageConfig = {\n enabled: false,\n triageCron: \"0 * * * *\",\n digestCron: \"0 8 * * *\",\n digestTimezone: undefined,\n channels: [\n \"discord\",\n \"telegram\",\n \"signal\",\n \"imessage\",\n \"whatsapp\",\n \"gmail\",\n \"x_dm\",\n ],\n prioritySenders: [],\n priorityChannels: [],\n autoReply: {\n enabled: false,\n confidenceThreshold: 0.85,\n senderWhitelist: [],\n channelWhitelist: [],\n maxAutoRepliesPerHour: 5,\n },\n triageRules: {\n alwaysUrgent: [],\n alwaysIgnore: [],\n alwaysNotify: [],\n },\n digestDeliveryChannel: \"client_chat\",\n retentionDays: 30,\n};\n"],"mappings":"AAAA,SAAS,uBAAuB;AAOzB,SAAS,wBAA2C;AACzD,MAAI;AACF,UAAM,MAAM,gBAAgB;AAC5B,UAAM,MAAM,IAAI,QAAQ,UAAU;AAGlC,QAAI,OAAO,OAAO,QAAQ,UAAU;AAClC,aAAO,gBAAgB,gBAAgB,GAAG;AAAA,IAC5C;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO,EAAE,GAAG,eAAe;AAC7B;AAMA,SAAS,gBACP,UACA,WACmB;AACnB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,WAAW;AAAA,MACT,GAAG,SAAS;AAAA,MACZ,GAAI,UAAU,aAAa,CAAC;AAAA,IAC9B;AAAA,IACA,aAAa;AAAA,MACX,GAAG,SAAS;AAAA,MACZ,GAAI,UAAU,eAAe,CAAC;AAAA,IAChC;AAAA,EACF;AACF;AAEA,MAAM,iBAAoC;AAAA,EACxC,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,UAAU;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,iBAAiB,CAAC;AAAA,EAClB,kBAAkB,CAAC;AAAA,EACnB,WAAW;AAAA,IACT,SAAS;AAAA,IACT,qBAAqB;AAAA,IACrB,iBAAiB,CAAC;AAAA,IAClB,kBAAkB,CAAC;AAAA,IACnB,uBAAuB;AAAA,EACzB;AAAA,EACA,aAAa;AAAA,IACX,cAAc,CAAC;AAAA,IACf,cAAc,CAAC;AAAA,IACf,cAAc,CAAC;AAAA,EACjB;AAAA,EACA,uBAAuB;AAAA,EACvB,eAAe;AACjB;","names":[]}
|