* fix: use .js extension for ESM imports of RoutePeerKind
The imports incorrectly used .ts extension which doesn't resolve
with moduleResolution: NodeNext. Changed to .js and added 'type'
import modifier.
* fix tsconfig
* refactor: unify peer kind to ChatType, rename dm to direct
- Replace RoutePeerKind with ChatType throughout codebase
- Change 'dm' literal values to 'direct' in routing/session keys
- Keep backward compat: normalizeChatType accepts 'dm' -> 'direct'
- Add ChatType export to plugin-sdk, deprecate RoutePeerKind
- Update session key parsing to accept both 'dm' and 'direct' markers
- Update all channel monitors and extensions to use ChatType
BREAKING CHANGE: Session keys now use 'direct' instead of 'dm'.
Existing 'dm' keys still work via backward compat layer.
* fix tests
* test: update session key expectations for dmdirect migration
- Fix test expectations to expect :direct: in generated output
- Add explicit backward compat test for normalizeChatType('dm')
- Keep input test data with :dm: keys to verify backward compat
* fix: accept legacy 'dm' in session key parsing for backward compat
getDmHistoryLimitFromSessionKey now accepts both :dm: and :direct:
to ensure old session keys continue to work correctly.
* test: add explicit backward compat tests for dmdirect migration
- session-key.test.ts: verify both :dm: and :direct: keys are valid
- getDmHistoryLimitFromSessionKey: verify both formats work
* feat: backward compat for resetByType.dm config key
* test: skip unix-path Nix tests on Windows
92 lines
2.0 KiB
TypeScript
92 lines
2.0 KiB
TypeScript
import type { ChatType } from "../channels/chat-type.js";
|
|
import type { SessionEntry } from "../config/sessions.js";
|
|
import type { DeliveryContext } from "../utils/delivery-context.js";
|
|
|
|
export type GatewaySessionsDefaults = {
|
|
modelProvider: string | null;
|
|
model: string | null;
|
|
contextTokens: number | null;
|
|
};
|
|
|
|
export type GatewaySessionRow = {
|
|
key: string;
|
|
kind: "direct" | "group" | "global" | "unknown";
|
|
label?: string;
|
|
displayName?: string;
|
|
derivedTitle?: string;
|
|
lastMessagePreview?: string;
|
|
channel?: string;
|
|
subject?: string;
|
|
groupChannel?: string;
|
|
space?: string;
|
|
chatType?: ChatType;
|
|
origin?: SessionEntry["origin"];
|
|
updatedAt: number | null;
|
|
sessionId?: string;
|
|
systemSent?: boolean;
|
|
abortedLastRun?: boolean;
|
|
thinkingLevel?: string;
|
|
verboseLevel?: string;
|
|
reasoningLevel?: string;
|
|
elevatedLevel?: string;
|
|
sendPolicy?: "allow" | "deny";
|
|
inputTokens?: number;
|
|
outputTokens?: number;
|
|
totalTokens?: number;
|
|
responseUsage?: "on" | "off" | "tokens" | "full";
|
|
modelProvider?: string;
|
|
model?: string;
|
|
contextTokens?: number;
|
|
deliveryContext?: DeliveryContext;
|
|
lastChannel?: SessionEntry["lastChannel"];
|
|
lastTo?: string;
|
|
lastAccountId?: string;
|
|
};
|
|
|
|
export type GatewayAgentRow = {
|
|
id: string;
|
|
name?: string;
|
|
identity?: {
|
|
name?: string;
|
|
theme?: string;
|
|
emoji?: string;
|
|
avatar?: string;
|
|
avatarUrl?: string;
|
|
};
|
|
};
|
|
|
|
export type SessionPreviewItem = {
|
|
role: "user" | "assistant" | "tool" | "system" | "other";
|
|
text: string;
|
|
};
|
|
|
|
export type SessionsPreviewEntry = {
|
|
key: string;
|
|
status: "ok" | "empty" | "missing" | "error";
|
|
items: SessionPreviewItem[];
|
|
};
|
|
|
|
export type SessionsPreviewResult = {
|
|
ts: number;
|
|
previews: SessionsPreviewEntry[];
|
|
};
|
|
|
|
export type SessionsListResult = {
|
|
ts: number;
|
|
path: string;
|
|
count: number;
|
|
defaults: GatewaySessionsDefaults;
|
|
sessions: GatewaySessionRow[];
|
|
};
|
|
|
|
export type SessionsPatchResult = {
|
|
ok: true;
|
|
path: string;
|
|
key: string;
|
|
entry: SessionEntry;
|
|
resolved?: {
|
|
modelProvider?: string;
|
|
model?: string;
|
|
};
|
|
};
|