@friendlyrobot/discord-pi-agent 0.17.0 → 0.17.1
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/index.js +4 -4
- package/dist/session-registry.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -557,11 +557,11 @@ class AgentService {
|
|
|
557
557
|
import path2 from "node:path";
|
|
558
558
|
import dotenv from "dotenv";
|
|
559
559
|
function resolveConfig(config) {
|
|
560
|
-
const discordAllowedUserId =
|
|
560
|
+
const discordAllowedUserId = requireNonEmptyConfigValue("discordAllowedUserId", config.discordAllowedUserId);
|
|
561
561
|
return {
|
|
562
|
-
discordBotToken:
|
|
562
|
+
discordBotToken: requireNonEmptyConfigValue("discordBotToken", config.discordBotToken),
|
|
563
563
|
discordAllowedUserId,
|
|
564
|
-
cwd:
|
|
564
|
+
cwd: requireNonEmptyConfigValue("cwd", config.cwd),
|
|
565
565
|
agentDir: config.agentDir?.trim() || path2.join(config.cwd, ".pi-agent"),
|
|
566
566
|
modelProvider: config.modelProvider?.trim() || "openrouter",
|
|
567
567
|
modelId: config.modelId?.trim() || "anthropic/claude-3.5-haiku",
|
|
@@ -596,7 +596,7 @@ function loadDiscordGatewayConfigFromEnv(overrides = {}) {
|
|
|
596
596
|
discordAllowedUserIds: overrides.discordAllowedUserIds ?? parseStringArrayFromEnv("DISCORD_ALLOWED_USER_IDS")
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function requireNonEmptyConfigValue(name, value) {
|
|
600
600
|
const trimmedValue = value.trim();
|
|
601
601
|
if (!trimmedValue) {
|
|
602
602
|
throw new Error(`Missing required config value: ${name}`);
|
|
@@ -2,7 +2,7 @@ import type { AgentSession } from "@earendil-works/pi-coding-agent";
|
|
|
2
2
|
import type { AgentService } from "./agent-service";
|
|
3
3
|
import { PromptQueue } from "./prompt-queue";
|
|
4
4
|
export type SessionScope = string;
|
|
5
|
-
export type
|
|
5
|
+
export type ScopedSessionEntry = {
|
|
6
6
|
session: AgentSession;
|
|
7
7
|
promptQueue: PromptQueue;
|
|
8
8
|
createdAt: Date;
|
|
@@ -19,11 +19,11 @@ export declare class SessionRegistry {
|
|
|
19
19
|
private readonly agentService;
|
|
20
20
|
constructor(agentService: AgentService);
|
|
21
21
|
getOrCreate(scope: SessionScope): Promise<{
|
|
22
|
-
entry:
|
|
22
|
+
entry: ScopedSessionEntry;
|
|
23
23
|
created: boolean;
|
|
24
24
|
}>;
|
|
25
25
|
remove(scope: SessionScope): Promise<void>;
|
|
26
|
-
get(scope: SessionScope):
|
|
26
|
+
get(scope: SessionScope): ScopedSessionEntry | undefined;
|
|
27
27
|
getScopes(): SessionScope[];
|
|
28
28
|
shutdownAll(): Promise<void>;
|
|
29
29
|
}
|