@friendlyrobot/discord-pi-agent 0.16.0 → 0.16.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/README.md +0 -2
- package/dist/agent-service.d.ts +0 -1
- package/dist/index.js +3 -19
- package/dist/reply-buffer.d.ts +0 -1
- package/dist/types.d.ts +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -132,7 +132,6 @@ Pretty console logs use:
|
|
|
132
132
|
|
|
133
133
|
- `discordAllowedForumChannelIds` — string array of forum channel IDs to respond in
|
|
134
134
|
- `discordAllowedUserIds` — string array of allowed user IDs (defaults to `[discordAllowedUserId]`)
|
|
135
|
-
- `sessionIdleTimeoutMs` — auto-shutdown idle thread sessions (null = never)
|
|
136
135
|
|
|
137
136
|
## Env helpers
|
|
138
137
|
|
|
@@ -149,7 +148,6 @@ Pretty console logs use:
|
|
|
149
148
|
- `DISCORD_STARTUP_MESSAGE`
|
|
150
149
|
- `DISCORD_FORUM_CHANNEL_IDS` — comma-separated forum channel IDs
|
|
151
150
|
- `DISCORD_ALLOWED_USER_IDS` — comma-separated allowed user IDs
|
|
152
|
-
- `DISCORD_SESSION_IDLE_TIMEOUT_MS` — idle timeout in ms
|
|
153
151
|
|
|
154
152
|
If `PI_AGENT_CWD` is missing it falls back to `process.cwd()`.
|
|
155
153
|
Set `DISCORD_STARTUP_MESSAGE=false` to disable the startup DM.
|
package/dist/agent-service.d.ts
CHANGED
|
@@ -33,7 +33,6 @@ export declare class AgentService {
|
|
|
33
33
|
private ensureConfiguredModel;
|
|
34
34
|
private ensureModelForSession;
|
|
35
35
|
private requireSession;
|
|
36
|
-
private applyConfiguredThinkingLevel;
|
|
37
36
|
private applyConfiguredThinkingLevelForSession;
|
|
38
37
|
listModels(session?: AgentSession | null): Promise<string>;
|
|
39
38
|
switchModel(provider: string, modelId: string, session?: AgentSession | null): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -278,9 +278,7 @@ class AgentService {
|
|
|
278
278
|
async prompt(text) {
|
|
279
279
|
const session = this.requireSession();
|
|
280
280
|
const transformedPrompt = await this.config.promptTransform(text);
|
|
281
|
-
return runPromptAndCollectReply(session, transformedPrompt
|
|
282
|
-
logPrefix: `[agent:${session.sessionId}]`
|
|
283
|
-
});
|
|
281
|
+
return runPromptAndCollectReply(session, transformedPrompt);
|
|
284
282
|
}
|
|
285
283
|
getSkillsSummary() {
|
|
286
284
|
const result = this.resourceLoader.getSkills();
|
|
@@ -429,9 +427,6 @@ class AgentService {
|
|
|
429
427
|
}
|
|
430
428
|
return this.session;
|
|
431
429
|
}
|
|
432
|
-
async applyConfiguredThinkingLevel() {
|
|
433
|
-
await this.applyConfiguredThinkingLevelForSession(this.requireSession());
|
|
434
|
-
}
|
|
435
430
|
async applyConfiguredThinkingLevelForSession(session) {
|
|
436
431
|
if (session.supportsThinking()) {
|
|
437
432
|
const available = session.getAvailableThinkingLevels();
|
|
@@ -547,8 +542,7 @@ function resolveConfig(config) {
|
|
|
547
542
|
shutdownOnSignals: config.shutdownOnSignals ?? true,
|
|
548
543
|
visionModelId: config.visionModelId?.trim() || null,
|
|
549
544
|
discordAllowedForumChannelIds: config.discordAllowedForumChannelIds ?? [],
|
|
550
|
-
discordAllowedUserIds: config.discordAllowedUserIds ?? [discordAllowedUserId]
|
|
551
|
-
sessionIdleTimeoutMs: config.sessionIdleTimeoutMs ?? null
|
|
545
|
+
discordAllowedUserIds: config.discordAllowedUserIds ?? [discordAllowedUserId]
|
|
552
546
|
};
|
|
553
547
|
}
|
|
554
548
|
function loadDiscordGatewayConfigFromEnv(overrides = {}) {
|
|
@@ -568,8 +562,7 @@ function loadDiscordGatewayConfigFromEnv(overrides = {}) {
|
|
|
568
562
|
shutdownOnSignals: overrides.shutdownOnSignals,
|
|
569
563
|
visionModelId: overrides.visionModelId ?? process.env.PI_VISION_MODEL_ID,
|
|
570
564
|
discordAllowedForumChannelIds: overrides.discordAllowedForumChannelIds ?? parseStringArrayFromEnv("DISCORD_FORUM_CHANNEL_IDS") ?? [],
|
|
571
|
-
discordAllowedUserIds: overrides.discordAllowedUserIds ?? parseStringArrayFromEnv("DISCORD_ALLOWED_USER_IDS")
|
|
572
|
-
sessionIdleTimeoutMs: overrides.sessionIdleTimeoutMs ?? parseOptionalIntFromEnv("DISCORD_SESSION_IDLE_TIMEOUT_MS") ?? undefined
|
|
565
|
+
discordAllowedUserIds: overrides.discordAllowedUserIds ?? parseStringArrayFromEnv("DISCORD_ALLOWED_USER_IDS")
|
|
573
566
|
});
|
|
574
567
|
}
|
|
575
568
|
function readRequiredValue(name, value) {
|
|
@@ -618,14 +611,6 @@ function parseStringArrayFromEnv(key) {
|
|
|
618
611
|
}
|
|
619
612
|
return value.split(",").map((id) => id.trim()).filter(Boolean);
|
|
620
613
|
}
|
|
621
|
-
function parseOptionalIntFromEnv(key) {
|
|
622
|
-
const value = process.env[key];
|
|
623
|
-
if (!value) {
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
const parsed = parseInt(value, 10);
|
|
627
|
-
return Number.isNaN(parsed) ? undefined : parsed;
|
|
628
|
-
}
|
|
629
614
|
|
|
630
615
|
// src/discord-gateway-client.ts
|
|
631
616
|
import {
|
|
@@ -1582,7 +1567,6 @@ ${attachment.content}`;
|
|
|
1582
1567
|
const wrappedContent = buildDiscordPromptContent(message, scope, promptContent, config);
|
|
1583
1568
|
const transformedPrompt = await config.promptTransform(wrappedContent);
|
|
1584
1569
|
return runPromptAndCollectReply(session, transformedPrompt, {
|
|
1585
|
-
logPrefix: `[agent:${session.sessionId}]`,
|
|
1586
1570
|
images: promptImages
|
|
1587
1571
|
});
|
|
1588
1572
|
});
|
package/dist/reply-buffer.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AgentSession } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type { ImageContent } from "@earendil-works/pi-ai";
|
|
3
3
|
type CollectReplyOptions = {
|
|
4
|
-
logPrefix?: string;
|
|
5
4
|
images?: ImageContent[];
|
|
6
5
|
};
|
|
7
6
|
export declare function runPromptAndCollectReply(session: AgentSession, prompt: string, options?: CollectReplyOptions): Promise<string>;
|
package/dist/types.d.ts
CHANGED
|
@@ -25,8 +25,6 @@ export type DiscordGatewayConfig = {
|
|
|
25
25
|
discordAllowedForumChannelIds?: string[];
|
|
26
26
|
/** Which users can interact in forum threads (defaults to [discordAllowedUserId]). */
|
|
27
27
|
discordAllowedUserIds?: string[];
|
|
28
|
-
/** Auto-shutdown idle thread sessions after this many ms. */
|
|
29
|
-
sessionIdleTimeoutMs?: number;
|
|
30
28
|
};
|
|
31
29
|
export type ResolvedDiscordGatewayConfig = {
|
|
32
30
|
discordBotToken: string;
|
|
@@ -45,7 +43,6 @@ export type ResolvedDiscordGatewayConfig = {
|
|
|
45
43
|
visionModelId: string | null;
|
|
46
44
|
discordAllowedForumChannelIds: string[];
|
|
47
45
|
discordAllowedUserIds: string[];
|
|
48
|
-
sessionIdleTimeoutMs: number | null;
|
|
49
46
|
};
|
|
50
47
|
export type ContextUsageStatus = {
|
|
51
48
|
tokens: number | null;
|