summaryrefslogtreecommitdiff
path: root/pi/agent/extensions/agent-plan-mode/utils.ts
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-27 12:26:57 +0200
committerPaul Buetow <paul@buetow.org>2026-03-27 12:26:57 +0200
commitadfbfb32a40489a1bc4df38e42e8054d135a058d (patch)
treec7b486ed5459f225bfe98f6cd1e0574a1e50ec9f /pi/agent/extensions/agent-plan-mode/utils.ts
parent6dccecb7a46c78c62283d88c5e0715f5eb0be050 (diff)
agent: use ask ids in task extensionsmain
Diffstat (limited to 'pi/agent/extensions/agent-plan-mode/utils.ts')
-rw-r--r--pi/agent/extensions/agent-plan-mode/utils.ts23
1 files changed, 14 insertions, 9 deletions
diff --git a/pi/agent/extensions/agent-plan-mode/utils.ts b/pi/agent/extensions/agent-plan-mode/utils.ts
index c7f66de..062da2f 100644
--- a/pi/agent/extensions/agent-plan-mode/utils.ts
+++ b/pi/agent/extensions/agent-plan-mode/utils.ts
@@ -1,7 +1,7 @@
export interface PlanItem {
step: number;
text: string;
- uuid?: string;
+ id?: string;
}
export interface AgentAnnotation {
@@ -10,8 +10,7 @@ export interface AgentAnnotation {
}
export interface AgentTask {
- id?: number;
- uuid: string;
+ id?: string;
description: string;
status?: string;
priority?: string;
@@ -210,7 +209,7 @@ export function dedupePlanItems(items: PlanItem[]): PlanItem[] {
deduped.push({
step: deduped.length + 1,
text: item.text,
- uuid: item.uuid,
+ id: item.id,
});
}
@@ -223,9 +222,16 @@ export function parseUuidList(text: string): string[] {
?.map((value) => value.toLowerCase()) ?? [];
}
-export function parseCreatedTaskUuid(text: string): string | undefined {
- const uuid = stripAnsi(text).match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i)?.[0];
- return uuid?.toLowerCase();
+export function parseCreatedTaskId(text: string): string | undefined {
+ const cleaned = stripAnsi(text);
+ for (const rawLine of cleaned.split(/\r?\n/)) {
+ const line = rawLine.trim();
+ if (line.startsWith("created task ")) {
+ const id = line.slice("created task ".length).trim();
+ if (id) return id;
+ }
+ }
+ return undefined;
}
export function formatTaskLine(task: AgentTask): string {
@@ -243,7 +249,7 @@ export function formatTaskDetails(task: AgentTask): string {
.join("\n");
const lines = [
- `UUID: ${task.uuid}`,
+ `ID: ${task.id ?? "?"}`,
`Description: ${task.description}`,
task.priority ? `Priority: ${task.priority}` : undefined,
task.status ? `Status: ${task.status}` : undefined,
@@ -253,4 +259,3 @@ export function formatTaskDetails(task: AgentTask): string {
return lines.filter(Boolean).join("\n");
}
-