@fickydev/pigent 0.1.22 → 0.1.23
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/CHANGELOG.md +6 -0
- package/TODO.md +1 -0
- package/package.json +1 -1
- package/src/agents/AgentRunner.ts +5 -2
- package/src/agents/BotCommandHandler.ts +6 -4
- package/src/config/skillRefs.ts +6 -0
- package/src/pi/PiAgentRunner.ts +5 -1
package/CHANGELOG.md
CHANGED
package/TODO.md
CHANGED
|
@@ -173,6 +173,7 @@
|
|
|
173
173
|
- [x] Add max task runs per hour rate limit
|
|
174
174
|
- [x] Add `/task status` or similar command
|
|
175
175
|
- [x] Add task management as agent skill + tools (natural language task CRUD)
|
|
176
|
+
- [x] Activate task-management by default for all sessions
|
|
176
177
|
- [x] Improve task-management prompt guidance for reminder/proactive-message refusal
|
|
177
178
|
|
|
178
179
|
## Policy And Safety
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type { InboundMessage } from "../channels/types";
|
|
3
3
|
import type { LoadedAgentConfig } from "../config/schemas";
|
|
4
|
-
import { hasSkillRef, listBuiltInSkills, parseSessionSkills, skillDisplayName, uniqueSkillRefs } from "../config/skillRefs";
|
|
4
|
+
import { defaultActiveSkills, hasSkillRef, listBuiltInSkills, parseSessionSkills, skillDisplayName, uniqueSkillRefs } from "../config/skillRefs";
|
|
5
5
|
import type { Repositories } from "../db/repositories";
|
|
6
6
|
import type { AgentSessionRow } from "../db/schema";
|
|
7
7
|
import { logger } from "../logging/logger";
|
|
@@ -177,6 +177,7 @@ export class AgentRunner {
|
|
|
177
177
|
|
|
178
178
|
private hasSkill(agent: LoadedAgentConfig, session: AgentSessionRow, skillName: string): boolean {
|
|
179
179
|
const allSkills = [
|
|
180
|
+
...defaultActiveSkills(),
|
|
180
181
|
...(agent.profile ? (this.registry.getProfile(agent.profile)?.defaultSkills ?? []) : []),
|
|
181
182
|
...agent.skills,
|
|
182
183
|
...parseSessionSkills(session.sessionSkills),
|
|
@@ -218,11 +219,12 @@ export class AgentRunner {
|
|
|
218
219
|
if (!agent) return "";
|
|
219
220
|
|
|
220
221
|
const profile = this.registry.getProfile(agent.profile);
|
|
222
|
+
const defaultSkills = defaultActiveSkills();
|
|
221
223
|
const profileSkills = profile?.defaultSkills ?? [];
|
|
222
224
|
const agentSkills = agent.skills;
|
|
223
225
|
const sessionSkills = parseSessionSkills(session.sessionSkills);
|
|
224
226
|
const builtInSkills = listBuiltInSkills(import.meta.dir);
|
|
225
|
-
const activeSkills = uniqueSkillRefs([...profileSkills, ...agentSkills, ...sessionSkills]);
|
|
227
|
+
const activeSkills = uniqueSkillRefs([...defaultSkills, ...profileSkills, ...agentSkills, ...sessionSkills]);
|
|
226
228
|
const knownSkills = uniqueSkillRefs([...builtInSkills, ...activeSkills]).sort((a, b) =>
|
|
227
229
|
skillDisplayName(a).localeCompare(skillDisplayName(b)),
|
|
228
230
|
);
|
|
@@ -235,6 +237,7 @@ export class AgentRunner {
|
|
|
235
237
|
const active = hasSkillRef(activeSkills, name);
|
|
236
238
|
const sources = [];
|
|
237
239
|
|
|
240
|
+
if (hasSkillRef(defaultSkills, name)) sources.push("default");
|
|
238
241
|
if (hasSkillRef(profileSkills, name)) sources.push("profile");
|
|
239
242
|
if (hasSkillRef(agentSkills, name)) sources.push("agent");
|
|
240
243
|
if (hasSkillRef(sessionSkills, name)) sources.push("session");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AuthStorage, ModelRegistry } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type { InboundMessage, InlineKeyboardButton } from "../channels/types";
|
|
3
3
|
import type { LoadedAgentConfig, LoadedProfileConfig, ModelChoiceConfig } from "../config/schemas";
|
|
4
|
-
import { hasSkillRef, listBuiltInSkills, parseSessionSkills, skillDisplayName, uniqueSkillRefs } from "../config/skillRefs";
|
|
4
|
+
import { defaultActiveSkills, hasSkillRef, listBuiltInSkills, parseSessionSkills, skillDisplayName, uniqueSkillRefs } from "../config/skillRefs";
|
|
5
5
|
import type { AgentSessionRow } from "../db/schema";
|
|
6
6
|
import type { Repositories } from "../db/repositories";
|
|
7
7
|
import { PiAgentRunner, type PiContextUsage } from "../pi/PiAgentRunner";
|
|
@@ -249,11 +249,12 @@ export class BotCommandHandler {
|
|
|
249
249
|
|
|
250
250
|
const agent = sessionResult.agent;
|
|
251
251
|
const profile = this.registry.getProfile(agent.profile);
|
|
252
|
+
const defaultSkills = defaultActiveSkills();
|
|
252
253
|
const profileSkills = profile?.defaultSkills ?? [];
|
|
253
254
|
const agentSkills = agent.skills;
|
|
254
255
|
const sessionSkills = parseSessionSkills(sessionResult.session.sessionSkills);
|
|
255
256
|
const builtInSkills = listBuiltInSkills(import.meta.dir);
|
|
256
|
-
const activeSkills = uniqueSkillRefs([...profileSkills, ...agentSkills, ...sessionSkills]);
|
|
257
|
+
const activeSkills = uniqueSkillRefs([...defaultSkills, ...profileSkills, ...agentSkills, ...sessionSkills]);
|
|
257
258
|
const knownSkills = uniqueSkillRefs([...builtInSkills, ...activeSkills]).sort((a, b) =>
|
|
258
259
|
skillDisplayName(a).localeCompare(skillDisplayName(b)),
|
|
259
260
|
);
|
|
@@ -265,7 +266,7 @@ export class BotCommandHandler {
|
|
|
265
266
|
"Session: " + sessionResult.session.id,
|
|
266
267
|
"",
|
|
267
268
|
"Available skills:",
|
|
268
|
-
...formatSkillRows(knownSkills, { profileSkills, agentSkills, sessionSkills, builtInSkills }),
|
|
269
|
+
...formatSkillRows(knownSkills, { defaultSkills, profileSkills, agentSkills, sessionSkills, builtInSkills }),
|
|
269
270
|
"",
|
|
270
271
|
"Legend: ✅ active, ⬜ available but inactive",
|
|
271
272
|
"Load on the fly: /skills add <skill>",
|
|
@@ -596,7 +597,7 @@ function formatDuration(ms: number): string {
|
|
|
596
597
|
|
|
597
598
|
function formatSkillRows(
|
|
598
599
|
skills: string[],
|
|
599
|
-
sources: { profileSkills: string[]; agentSkills: string[]; sessionSkills: string[]; builtInSkills: string[] },
|
|
600
|
+
sources: { defaultSkills: string[]; profileSkills: string[]; agentSkills: string[]; sessionSkills: string[]; builtInSkills: string[] },
|
|
600
601
|
): string[] {
|
|
601
602
|
if (skills.length === 0) return ["none"];
|
|
602
603
|
|
|
@@ -604,6 +605,7 @@ function formatSkillRows(
|
|
|
604
605
|
const name = skillDisplayName(skill);
|
|
605
606
|
const sourceLabels = [];
|
|
606
607
|
|
|
608
|
+
if (hasSkillRef(sources.defaultSkills, name)) sourceLabels.push("default");
|
|
607
609
|
if (hasSkillRef(sources.profileSkills, name)) sourceLabels.push("profile");
|
|
608
610
|
if (hasSkillRef(sources.agentSkills, name)) sourceLabels.push("agent");
|
|
609
611
|
if (hasSkillRef(sources.sessionSkills, name)) sourceLabels.push("session");
|
package/src/config/skillRefs.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
|
|
4
|
+
export const DEFAULT_ACTIVE_SKILLS = ["task-management"] as const;
|
|
5
|
+
|
|
6
|
+
export function defaultActiveSkills(): string[] {
|
|
7
|
+
return [...DEFAULT_ACTIVE_SKILLS];
|
|
8
|
+
}
|
|
9
|
+
|
|
4
10
|
export function parseSessionSkills(raw: string | null | undefined): string[] {
|
|
5
11
|
if (!raw) return [];
|
|
6
12
|
|
package/src/pi/PiAgentRunner.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { mkdir } from "node:fs/promises";
|
|
11
11
|
import { resolve } from "node:path";
|
|
12
12
|
import type { LoadedAgentConfig, LoadedProfileConfig } from "../config/schemas";
|
|
13
|
-
import { parseSessionSkills } from "../config/skillRefs";
|
|
13
|
+
import { defaultActiveSkills, parseSessionSkills } from "../config/skillRefs";
|
|
14
14
|
import type { AgentSessionRow } from "../db/schema";
|
|
15
15
|
import { resolveModelSelection } from "./PiModelResolver";
|
|
16
16
|
import { loadOrCreatePiSession } from "./PiSessionFactory";
|
|
@@ -118,6 +118,10 @@ export class PiAgentRunner {
|
|
|
118
118
|
function resolveSkillPaths(agent: LoadedAgentConfig, profile: LoadedProfileConfig | null, session: AgentSessionRow): string[] {
|
|
119
119
|
const paths: string[] = [];
|
|
120
120
|
|
|
121
|
+
for (const s of defaultActiveSkills()) {
|
|
122
|
+
paths.push(resolveSkillPath(s, agent.baseDir));
|
|
123
|
+
}
|
|
124
|
+
|
|
121
125
|
if (profile) {
|
|
122
126
|
for (const s of profile.defaultSkills) {
|
|
123
127
|
paths.push(resolveSkillPath(s, profile.baseDir));
|