pi-cockpit 0.3.0 → 0.5.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/package.json +70 -70
- package/src/agents-store.ts +81 -10
- package/src/config.ts +5 -2
- package/src/footer.ts +1 -0
- package/src/index.ts +155 -5
- package/src/quiet-tools.ts +310 -0
- package/src/render.ts +2 -1
- package/src/settings-view.ts +166 -129
- package/src/stack-widget.ts +142 -111
- package/src/thinking-fold.ts +86 -0
- package/src/thinking-timer.ts +224 -0
- package/src/types.ts +134 -114
package/src/types.ts
CHANGED
|
@@ -1,114 +1,134 @@
|
|
|
1
|
-
// Cross-extension event names broadcast by pi-maestro-teammate.
|
|
2
|
-
// Hard-coded strings (stable contract; see pi-maestro-teammate/src/shared/types.ts:184-186)
|
|
3
|
-
// so this package needs no import path into the teammate package.
|
|
4
|
-
export const TEAMMATE_STARTED_EVENT = "teammate:started";
|
|
5
|
-
export const TEAMMATE_MESSAGE_EVENT = "teammate:message";
|
|
6
|
-
export const TEAMMATE_COMPLETE_EVENT = "teammate:complete";
|
|
7
|
-
export const COCKPIT_UI_OWNERSHIP_EVENT = "cockpit:ui-ownership";
|
|
8
|
-
export const COCKPIT_TODO_TOGGLE_EVENT = "cockpit:toggle-todo";
|
|
9
|
-
export const BASH_BG_UPDATE_EVENT = "bash-bg:update";
|
|
10
|
-
export const BASH_BG_QUERY_EVENT = "bash-bg:query";
|
|
11
|
-
export const WORKFLOW_STATUS_KEY = "maestro-workflow";
|
|
12
|
-
|
|
13
|
-
// Widget keys owned by pi-cockpit. Native Flow/teammate widgets yield through
|
|
14
|
-
// COCKPIT_UI_OWNERSHIP_EVENT instead of being cleared across extension boundaries.
|
|
15
|
-
export const STACK_WIDGET_KEY = "cockpit-stack";
|
|
16
|
-
export const AGENT_WIDGET_KEY = "cockpit-agents";
|
|
17
|
-
|
|
18
|
-
// todo tool name registered by pi-maestro-flow (src/extension/index.ts:594).
|
|
19
|
-
export const TODO_TOOL_NAME = "todo";
|
|
20
|
-
// appendEntry customType the todo tool persists after every mutation (tools/todo.ts:145).
|
|
21
|
-
export const TODO_STATE_ENTRY_TYPE = "todo-state";
|
|
22
|
-
|
|
23
|
-
export type AgentStatus = "pending" | "running" | "retrying" | "sleeping" | "done" | "failed";
|
|
24
|
-
|
|
25
|
-
export interface AgentRow {
|
|
26
|
-
correlationId: string;
|
|
27
|
-
parentCorrelationId?: string;
|
|
28
|
-
agent: string;
|
|
29
|
-
name: string | undefined;
|
|
30
|
-
role: string;
|
|
31
|
-
task: string;
|
|
32
|
-
status: AgentStatus;
|
|
33
|
-
tail: string;
|
|
34
|
-
startedAt: number;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
export
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
export type
|
|
91
|
-
|
|
92
|
-
export
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
1
|
+
// Cross-extension event names broadcast by pi-maestro-teammate.
|
|
2
|
+
// Hard-coded strings (stable contract; see pi-maestro-teammate/src/shared/types.ts:184-186)
|
|
3
|
+
// so this package needs no import path into the teammate package.
|
|
4
|
+
export const TEAMMATE_STARTED_EVENT = "teammate:started";
|
|
5
|
+
export const TEAMMATE_MESSAGE_EVENT = "teammate:message";
|
|
6
|
+
export const TEAMMATE_COMPLETE_EVENT = "teammate:complete";
|
|
7
|
+
export const COCKPIT_UI_OWNERSHIP_EVENT = "cockpit:ui-ownership";
|
|
8
|
+
export const COCKPIT_TODO_TOGGLE_EVENT = "cockpit:toggle-todo";
|
|
9
|
+
export const BASH_BG_UPDATE_EVENT = "bash-bg:update";
|
|
10
|
+
export const BASH_BG_QUERY_EVENT = "bash-bg:query";
|
|
11
|
+
export const WORKFLOW_STATUS_KEY = "maestro-workflow";
|
|
12
|
+
|
|
13
|
+
// Widget keys owned by pi-cockpit. Native Flow/teammate widgets yield through
|
|
14
|
+
// COCKPIT_UI_OWNERSHIP_EVENT instead of being cleared across extension boundaries.
|
|
15
|
+
export const STACK_WIDGET_KEY = "cockpit-stack";
|
|
16
|
+
export const AGENT_WIDGET_KEY = "cockpit-agents";
|
|
17
|
+
|
|
18
|
+
// todo tool name registered by pi-maestro-flow (src/extension/index.ts:594).
|
|
19
|
+
export const TODO_TOOL_NAME = "todo";
|
|
20
|
+
// appendEntry customType the todo tool persists after every mutation (tools/todo.ts:145).
|
|
21
|
+
export const TODO_STATE_ENTRY_TYPE = "todo-state";
|
|
22
|
+
|
|
23
|
+
export type AgentStatus = "pending" | "running" | "retrying" | "sleeping" | "done" | "failed";
|
|
24
|
+
|
|
25
|
+
export interface AgentRow {
|
|
26
|
+
correlationId: string;
|
|
27
|
+
parentCorrelationId?: string;
|
|
28
|
+
agent: string;
|
|
29
|
+
name: string | undefined;
|
|
30
|
+
role: string;
|
|
31
|
+
task: string;
|
|
32
|
+
status: AgentStatus;
|
|
33
|
+
tail: string;
|
|
34
|
+
startedAt: number;
|
|
35
|
+
/** Terminal wall-clock used to freeze elapsed time for completed/failed rows. */
|
|
36
|
+
finishedAt?: number;
|
|
37
|
+
lastActivityAt: number;
|
|
38
|
+
toolCount?: number;
|
|
39
|
+
tokens?: number;
|
|
40
|
+
inputTokens?: number;
|
|
41
|
+
outputTokens?: number;
|
|
42
|
+
taskStatus?: string;
|
|
43
|
+
activeTool?: string;
|
|
44
|
+
taskIndex?: number;
|
|
45
|
+
dependencies?: number[];
|
|
46
|
+
/** Set only on a failed row that outlived its completion, so it can be pruned. */
|
|
47
|
+
failedAt?: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type BashBgStatus = "running" | "stopping" | "completed" | "failed" | "killed";
|
|
51
|
+
|
|
52
|
+
export interface BashBgJob {
|
|
53
|
+
id: string;
|
|
54
|
+
command: string;
|
|
55
|
+
cwd: string;
|
|
56
|
+
pid: number;
|
|
57
|
+
status: BashBgStatus;
|
|
58
|
+
startedAt: number;
|
|
59
|
+
updatedAt: number;
|
|
60
|
+
finishedAt?: number;
|
|
61
|
+
exitCode: number | null;
|
|
62
|
+
outputTail: string;
|
|
63
|
+
outputBytes: number;
|
|
64
|
+
logPath: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type TodoState = "pending" | "in_progress" | "completed" | "blocked";
|
|
68
|
+
|
|
69
|
+
export interface TodoItem {
|
|
70
|
+
id: string;
|
|
71
|
+
subject: string;
|
|
72
|
+
status: TodoState;
|
|
73
|
+
blockedBy: string[];
|
|
74
|
+
createdBy?: TodoActor;
|
|
75
|
+
assignee?: TodoActor;
|
|
76
|
+
skills: TodoSkill[];
|
|
77
|
+
updatedAt?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface TodoActor {
|
|
81
|
+
id: string;
|
|
82
|
+
label: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface TodoSkill {
|
|
86
|
+
name: string;
|
|
87
|
+
role?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type ViewMode = "list" | "compact";
|
|
91
|
+
|
|
92
|
+
export type QuietSymbolMode = "check" | "dot";
|
|
93
|
+
|
|
94
|
+
export type IconMode = "auto" | "nerd" | "ascii";
|
|
95
|
+
|
|
96
|
+
export interface CockpitConfig {
|
|
97
|
+
enabled: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Quiet mode: compress built-in tool calls to one-line lifecycle summaries and
|
|
100
|
+
* fold thinking blocks. The lifecycle glyph set is selected by quietSymbols.
|
|
101
|
+
* The fold drives pi's native thinking toggle, so pi owns and persists the
|
|
102
|
+
* visibility; turning quiet off leaves thinking as the user last set it
|
|
103
|
+
* (Ctrl+T or the panel's thinking row). The footer and the Todo widget render
|
|
104
|
+
* exactly as they do with quiet mode off; the Agents widget stays expanded
|
|
105
|
+
* but hides its live streaming tail (the per-message text), keeping
|
|
106
|
+
* role/task/state/telemetry. Symbol changes apply live. Turning Quiet off
|
|
107
|
+
* still requires /reload or a new session to restore native tool renderers.
|
|
108
|
+
*/
|
|
109
|
+
quietMode: boolean;
|
|
110
|
+
/** Lifecycle glyph set used by compact Quiet tool rows. */
|
|
111
|
+
quietSymbols: QuietSymbolMode;
|
|
112
|
+
agentsMode: ViewMode;
|
|
113
|
+
todoMode: ViewMode;
|
|
114
|
+
todoExpanded: boolean;
|
|
115
|
+
hideNativeAgents: boolean;
|
|
116
|
+
icons: { mode: IconMode };
|
|
117
|
+
/**
|
|
118
|
+
* Theme to apply at session start. Empty means "leave whatever pi is using",
|
|
119
|
+
* so cockpit never overrides a theme the user picked elsewhere.
|
|
120
|
+
*/
|
|
121
|
+
theme: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const DEFAULT_CONFIG: CockpitConfig = {
|
|
125
|
+
enabled: true,
|
|
126
|
+
quietMode: false,
|
|
127
|
+
quietSymbols: "check",
|
|
128
|
+
agentsMode: "list",
|
|
129
|
+
todoMode: "list",
|
|
130
|
+
todoExpanded: false,
|
|
131
|
+
hideNativeAgents: true,
|
|
132
|
+
icons: { mode: "auto" },
|
|
133
|
+
theme: "",
|
|
134
|
+
};
|