@sgtbeatdown/pi-tasks 0.1.0
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 +514 -0
- package/package.json +52 -0
- package/skills/wolfpack-pi-task-delegation/SKILL.md +75 -0
- package/src/auto-notify.ts +24 -0
- package/src/extension.ts +308 -0
- package/src/protocol.ts +73 -0
- package/src/store.ts +494 -0
- package/src/stores/filesystem.ts +40 -0
- package/src/task-communication.ts +68 -0
- package/src/transports/wolfpack.ts +29 -0
- package/src/types.ts +114 -0
- package/tsconfig.json +30 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export const TASK_PROTOCOL_VERSION = "pi.agentTask.v1";
|
|
2
|
+
export const TASK_ASSIGNMENT_TYPE = "pi.task.assignment.v1";
|
|
3
|
+
export const DEFAULT_TIMEOUT_MS = 30 * 60 * 1000;
|
|
4
|
+
export const MIN_TIMEOUT_MS = 1000;
|
|
5
|
+
export const MAX_TIMEOUT_MS = 24 * 60 * 60 * 1000;
|
|
6
|
+
export const SUMMARY_MAX_CHARS = 1200;
|
|
7
|
+
export const PROGRESS_MAX_CHARS = 4000;
|
|
8
|
+
|
|
9
|
+
export type TaskStatus =
|
|
10
|
+
| "pending"
|
|
11
|
+
| "dispatched"
|
|
12
|
+
| "running"
|
|
13
|
+
| "completed"
|
|
14
|
+
| "failed"
|
|
15
|
+
| "cancelled"
|
|
16
|
+
| "timed_out"
|
|
17
|
+
| "rejected";
|
|
18
|
+
|
|
19
|
+
export type TerminalTaskStatus = "completed" | "failed" | "cancelled" | "timed_out" | "rejected";
|
|
20
|
+
|
|
21
|
+
export type TaskEventType =
|
|
22
|
+
| "task.created"
|
|
23
|
+
| "task.dispatched"
|
|
24
|
+
| "task.running"
|
|
25
|
+
| "task.progress"
|
|
26
|
+
| "task.completed"
|
|
27
|
+
| "task.failed"
|
|
28
|
+
| "task.cancel_requested"
|
|
29
|
+
| "task.cancelled"
|
|
30
|
+
| "task.timed_out"
|
|
31
|
+
| "task.rejected"
|
|
32
|
+
| "task.acknowledged";
|
|
33
|
+
|
|
34
|
+
export interface TaskError {
|
|
35
|
+
readonly code: string;
|
|
36
|
+
readonly message: string;
|
|
37
|
+
readonly retryable: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface AgentTaskRecord {
|
|
41
|
+
readonly schemaVersion: 1;
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly projectDir: string;
|
|
44
|
+
readonly parentSession: string;
|
|
45
|
+
readonly targetSession: string;
|
|
46
|
+
readonly taskText: string;
|
|
47
|
+
readonly status: TaskStatus;
|
|
48
|
+
readonly createdAt: string;
|
|
49
|
+
readonly updatedAt: string;
|
|
50
|
+
readonly dispatchedAt: string | undefined;
|
|
51
|
+
readonly runningAt: string | undefined;
|
|
52
|
+
readonly completedAt: string | undefined;
|
|
53
|
+
readonly timeoutAt: string;
|
|
54
|
+
readonly timeoutMs: number;
|
|
55
|
+
readonly idempotencyKey: string | undefined;
|
|
56
|
+
readonly assignmentRef: string | undefined;
|
|
57
|
+
readonly resultRef: string | undefined;
|
|
58
|
+
readonly parentAckAt: string | undefined;
|
|
59
|
+
readonly targetTaskProtocol: typeof TASK_PROTOCOL_VERSION | undefined;
|
|
60
|
+
readonly error: TaskError | undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface TaskEvent {
|
|
64
|
+
readonly schemaVersion: 1;
|
|
65
|
+
readonly seq: number;
|
|
66
|
+
readonly taskId: string;
|
|
67
|
+
readonly type: TaskEventType;
|
|
68
|
+
readonly createdAt: string;
|
|
69
|
+
readonly source: "store" | "parent-tool" | "target-tool";
|
|
70
|
+
readonly payload: unknown;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface TaskResultPayload {
|
|
74
|
+
readonly summary: string;
|
|
75
|
+
readonly result?: Record<string, unknown>;
|
|
76
|
+
readonly error?: TaskError;
|
|
77
|
+
readonly artifacts?: readonly TaskArtifact[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface TaskArtifact {
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly path?: string;
|
|
83
|
+
readonly mimeType?: string;
|
|
84
|
+
readonly description?: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface StoredTaskResult extends TaskResultPayload {
|
|
88
|
+
readonly schemaVersion: 1;
|
|
89
|
+
readonly taskId: string;
|
|
90
|
+
readonly status: TerminalTaskStatus;
|
|
91
|
+
readonly completedAt: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface CreateDispatchedTaskInput {
|
|
95
|
+
readonly projectDir: string;
|
|
96
|
+
readonly parentSession: string;
|
|
97
|
+
readonly targetSession: string;
|
|
98
|
+
readonly taskText: string;
|
|
99
|
+
readonly assignment: unknown | ((taskId: string) => unknown);
|
|
100
|
+
readonly timeoutMs: number;
|
|
101
|
+
readonly idempotencyKey?: string;
|
|
102
|
+
readonly targetTaskProtocol?: typeof TASK_PROTOCOL_VERSION;
|
|
103
|
+
readonly tasksDir?: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface ListInboxOptions {
|
|
107
|
+
readonly includeAcknowledged: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface WaitForTaskOptions {
|
|
111
|
+
readonly timeoutMs: number;
|
|
112
|
+
readonly pollMs: number;
|
|
113
|
+
readonly ackParentSession?: string;
|
|
114
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"types": ["bun"],
|
|
6
|
+
"target": "ESNext",
|
|
7
|
+
"module": "Preserve",
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
|
|
12
|
+
// Bundler mode
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"allowImportingTsExtensions": true,
|
|
15
|
+
"verbatimModuleSyntax": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
|
|
18
|
+
// Best practices
|
|
19
|
+
"strict": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"noUncheckedIndexedAccess": true,
|
|
23
|
+
"noImplicitOverride": true,
|
|
24
|
+
|
|
25
|
+
// Some stricter flags (disabled by default)
|
|
26
|
+
"noUnusedLocals": false,
|
|
27
|
+
"noUnusedParameters": false,
|
|
28
|
+
"noPropertyAccessFromIndexSignature": false
|
|
29
|
+
}
|
|
30
|
+
}
|