@howaboua/pi-shepherdr 0.2.22 → 0.2.24
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 +16 -18
- package/README.md +79 -58
- package/biome.json +1 -1
- package/index.ts +7 -3
- package/package.json +14 -9
- package/src/agents-discovery.ts +42 -27
- package/src/agents-focus.ts +2 -2
- package/src/agents-reply.ts +1 -1
- package/src/agents-spawn.ts +143 -137
- package/src/agents-tool.ts +3 -3
- package/src/agents-work.ts +33 -9
- package/src/attachment-notes.ts +14 -2
- package/src/attachment-protocol.ts +21 -4
- package/src/attachment-routing.ts +1 -1
- package/src/attachment-target.ts +5 -2
- package/src/attachment.ts +2 -3
- package/src/board/host.ts +2 -2
- package/src/board/membership.ts +1 -1
- package/src/{control-panel-actions.ts → control-panel/actions.ts} +2 -2
- package/src/{control-panel.ts → control-panel/index.ts} +4 -4
- package/src/{control-panel-items.ts → control-panel/items.ts} +3 -3
- package/src/{control-panel-view.ts → control-panel/view.ts} +3 -3
- package/src/controller.ts +6 -3
- package/src/fleet/index.ts +384 -0
- package/src/fleet/inspection.ts +141 -0
- package/src/fleet/machine.ts +52 -0
- package/src/fleet/monitor.ts +71 -0
- package/src/fleet/persistence.ts +42 -0
- package/src/fleet/reconnect.ts +75 -0
- package/src/fleet/setup.ts +92 -0
- package/src/launch.ts +14 -2
- package/src/messages/attachments.ts +39 -0
- package/src/messages/attribution.ts +75 -0
- package/src/messages/event-details.ts +69 -0
- package/src/messages/events.ts +189 -0
- package/src/messages/focus.ts +38 -0
- package/src/messages/guidance.ts +83 -0
- package/src/messages/render.ts +89 -0
- package/src/messages/voice-announcements.ts +79 -0
- package/src/monitor-extension-messages.ts +14 -1
- package/src/monitor.ts +4 -2
- package/src/peer-inbox.ts +2 -2
- package/src/profile-prompt.ts +32 -0
- package/src/profiles.ts +5 -25
- package/src/remote/client.ts +127 -0
- package/src/remote/context-relay.ts +84 -0
- package/src/remote/deployment.ts +179 -0
- package/src/remote/focus-channels.ts +89 -0
- package/src/remote/transport.ts +369 -0
- package/src/settlement/collector.ts +122 -0
- package/src/settlement/delivery.ts +144 -0
- package/src/{settlement.ts → settlement/index.ts} +23 -233
- package/src/shared-context-host.ts +33 -11
- package/src/shared-context.ts +10 -4
- package/src/spawn-context.ts +20 -17
- package/src/voice-handoff.ts +1 -1
- package/src/worker-role.ts +83 -0
- package/src/worker-service.ts +74 -89
- package/src/fleet.ts +0 -702
- package/src/messages.ts +0 -629
- package/src/remote-client.ts +0 -751
package/src/agents-reply.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
settlementResult,
|
|
6
6
|
toolResult,
|
|
7
7
|
} from "./agents-work.js";
|
|
8
|
-
import type { ConnectedMachine } from "./fleet.js";
|
|
8
|
+
import type { ConnectedMachine } from "./fleet/index.js";
|
|
9
9
|
import type { PaneInfo } from "./types.js";
|
|
10
10
|
|
|
11
11
|
export async function replyAgent(
|
package/src/agents-spawn.ts
CHANGED
|
@@ -8,21 +8,21 @@ import {
|
|
|
8
8
|
shouldBlockAgentSpawn,
|
|
9
9
|
} from "./agents-contract.js";
|
|
10
10
|
import {
|
|
11
|
-
allocateAgentName,
|
|
12
11
|
dispatchAgentWork,
|
|
13
12
|
reportProgress,
|
|
13
|
+
reserveAgentName,
|
|
14
14
|
settlementResult,
|
|
15
15
|
toolResult,
|
|
16
16
|
} from "./agents-work.js";
|
|
17
17
|
import type { AgentBoard } from "./board/host.js";
|
|
18
|
-
import type { AgentFleet, ConnectedMachine } from "./fleet.js";
|
|
18
|
+
import type { AgentFleet, ConnectedMachine } from "./fleet/index.js";
|
|
19
19
|
import { isDispatchRejected } from "./herdr-client.js";
|
|
20
20
|
import {
|
|
21
21
|
resolvePreparationDirectory,
|
|
22
22
|
rollbackStartedAgent,
|
|
23
23
|
startAgent,
|
|
24
24
|
} from "./launch.js";
|
|
25
|
-
import { attributeAgentPrompt } from "./messages.js";
|
|
25
|
+
import { attributeAgentPrompt } from "./messages/attribution.js";
|
|
26
26
|
import {
|
|
27
27
|
loadAgentProfiles,
|
|
28
28
|
prepareProfileMessage,
|
|
@@ -65,147 +65,153 @@ export async function spawnAgent(
|
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
const label = required(params.label, "label");
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
params.placement ??
|
|
71
|
-
(runtime.local && process.env["HERDR_WORKSPACE_ID"]
|
|
72
|
-
? "new_tab"
|
|
73
|
-
: "new_workspace");
|
|
74
|
-
const workspace =
|
|
75
|
-
params.workspace ??
|
|
76
|
-
(placement === "new_tab" && runtime.local
|
|
77
|
-
? process.env["HERDR_WORKSPACE_ID"]
|
|
78
|
-
: undefined);
|
|
79
|
-
const startParams = {
|
|
80
|
-
name,
|
|
81
|
-
label,
|
|
82
|
-
placement,
|
|
83
|
-
...(workspace ? { workspace } : {}),
|
|
84
|
-
...(params.pane ? { pane: params.pane } : {}),
|
|
85
|
-
...(params.cwd ? { cwd: params.cwd } : {}),
|
|
86
|
-
};
|
|
87
|
-
const cwd = await resolvePreparationDirectory(
|
|
88
|
-
runtime.client,
|
|
89
|
-
startParams,
|
|
90
|
-
runtime.fallbackCwd,
|
|
91
|
-
runtime.resolveDirectory,
|
|
92
|
-
);
|
|
93
|
-
const input = required(params.message, "message");
|
|
94
|
-
const message = await prepareProfileMessage(
|
|
95
|
-
profile,
|
|
96
|
-
{
|
|
97
|
-
cwd,
|
|
98
|
-
message: input,
|
|
99
|
-
...(params.base ? { base: params.base } : {}),
|
|
100
|
-
},
|
|
101
|
-
{ targetLocal: runtime.local },
|
|
102
|
-
);
|
|
103
|
-
const attributedMessage = await attributeAgentPrompt(
|
|
104
|
-
fleet.connected().client,
|
|
105
|
-
input.startsWith("/") ? input : message,
|
|
106
|
-
"task",
|
|
107
|
-
);
|
|
108
|
-
if (input.startsWith("/") && message !== input)
|
|
109
|
-
attributedMessage.context = [attributedMessage.context, message]
|
|
110
|
-
.filter(Boolean)
|
|
111
|
-
.join("\n\n");
|
|
112
|
-
if (boardThreadId !== undefined)
|
|
113
|
-
attributedMessage.context = [
|
|
114
|
-
attributedMessage.context,
|
|
115
|
-
`Read shared board thread with board({action:"read_thread",thread_id:${JSON.stringify(boardThreadId)}}) for task context`,
|
|
116
|
-
]
|
|
117
|
-
.filter(Boolean)
|
|
118
|
-
.join("\n\n");
|
|
119
|
-
reportProgress(onUpdate, `Spawning ${label}`, {
|
|
120
|
-
machine: runtime.machine,
|
|
121
|
-
name,
|
|
122
|
-
profile: profile.name,
|
|
123
|
-
status: "starting",
|
|
124
|
-
});
|
|
125
|
-
const agentArgs = profileAgentArgs(profile, { targetLocal: runtime.local });
|
|
126
|
-
const relationship = sharedContext.spawns.prepareRelationship(
|
|
127
|
-
ctx,
|
|
128
|
-
runtime,
|
|
129
|
-
agentArgs,
|
|
130
|
-
);
|
|
131
|
-
const sharing =
|
|
132
|
-
profile.shareContext === false
|
|
133
|
-
? undefined
|
|
134
|
-
: await sharedContext.spawns.prepare(ctx, runtime, name, agentArgs);
|
|
135
|
-
const boardBinding = await board.prepare(ctx, runtime, name, agentArgs);
|
|
136
|
-
const started = await startAgent(
|
|
137
|
-
runtime.client,
|
|
138
|
-
startParams,
|
|
139
|
-
runtime.fallbackCwd,
|
|
140
|
-
runtime.resolveDirectory,
|
|
141
|
-
{ agentArgs },
|
|
142
|
-
);
|
|
143
|
-
let promptSubmissionStarted = false;
|
|
144
|
-
let promptAccepted = false;
|
|
145
|
-
let dispatch;
|
|
146
|
-
let shared: { agentName?: string; warning?: string } | undefined;
|
|
147
|
-
let boardAgent: string | undefined;
|
|
148
|
-
let relationshipWarning: string | undefined;
|
|
149
|
-
const blocking = shouldBlockAgentSpawn(profile.blocking, params.blocking);
|
|
68
|
+
const reservation = await reserveAgentName(runtime, label, params.name);
|
|
69
|
+
const { name } = reservation;
|
|
150
70
|
try {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
71
|
+
const placement =
|
|
72
|
+
params.placement ??
|
|
73
|
+
(runtime.local && process.env["HERDR_WORKSPACE_ID"]
|
|
74
|
+
? "new_tab"
|
|
75
|
+
: "new_workspace");
|
|
76
|
+
const workspace =
|
|
77
|
+
params.workspace ??
|
|
78
|
+
(placement === "new_tab" && runtime.local
|
|
79
|
+
? process.env["HERDR_WORKSPACE_ID"]
|
|
80
|
+
: undefined);
|
|
81
|
+
const startParams = {
|
|
82
|
+
name,
|
|
83
|
+
label,
|
|
84
|
+
placement,
|
|
85
|
+
...(workspace ? { workspace } : {}),
|
|
86
|
+
...(params.pane ? { pane: params.pane } : {}),
|
|
87
|
+
...(params.cwd ? { cwd: params.cwd } : {}),
|
|
88
|
+
};
|
|
89
|
+
const cwd = await resolvePreparationDirectory(
|
|
90
|
+
runtime.client,
|
|
91
|
+
startParams,
|
|
92
|
+
runtime.fallbackCwd,
|
|
93
|
+
runtime.resolveDirectory,
|
|
94
|
+
);
|
|
95
|
+
const input = required(params.message, "message");
|
|
96
|
+
const message = await prepareProfileMessage(
|
|
97
|
+
profile,
|
|
98
|
+
{
|
|
99
|
+
cwd,
|
|
100
|
+
message: input,
|
|
101
|
+
...(params.base ? { base: params.base } : {}),
|
|
169
102
|
},
|
|
170
|
-
{
|
|
103
|
+
{ targetLocal: runtime.local },
|
|
104
|
+
);
|
|
105
|
+
const attributedMessage = await attributeAgentPrompt(
|
|
106
|
+
fleet.connected().client,
|
|
107
|
+
input.startsWith("/") ? input : message,
|
|
108
|
+
"task",
|
|
109
|
+
);
|
|
110
|
+
if (input.startsWith("/") && message !== input)
|
|
111
|
+
attributedMessage.context = [attributedMessage.context, message]
|
|
112
|
+
.filter(Boolean)
|
|
113
|
+
.join("\n\n");
|
|
114
|
+
if (boardThreadId !== undefined)
|
|
115
|
+
attributedMessage.context = [
|
|
116
|
+
attributedMessage.context,
|
|
117
|
+
`Read shared board thread with board({action:"read_thread",thread_id:${JSON.stringify(boardThreadId)}}) for task context`,
|
|
118
|
+
]
|
|
119
|
+
.filter(Boolean)
|
|
120
|
+
.join("\n\n");
|
|
121
|
+
reportProgress(onUpdate, `Spawning ${label}`, {
|
|
122
|
+
machine: runtime.machine,
|
|
123
|
+
name,
|
|
124
|
+
profile: profile.name,
|
|
125
|
+
status: "starting",
|
|
126
|
+
});
|
|
127
|
+
const agentArgs = profileAgentArgs(profile);
|
|
128
|
+
const relationship = sharedContext.spawns.prepareRelationship(
|
|
129
|
+
ctx,
|
|
130
|
+
runtime,
|
|
131
|
+
agentArgs,
|
|
132
|
+
);
|
|
133
|
+
const sharing =
|
|
134
|
+
profile.shareContext === false
|
|
135
|
+
? undefined
|
|
136
|
+
: await sharedContext.spawns.prepare(ctx, runtime, name, agentArgs);
|
|
137
|
+
const boardBinding = await board.prepare(ctx, runtime, name, agentArgs);
|
|
138
|
+
const started = await startAgent(
|
|
139
|
+
runtime.client,
|
|
140
|
+
startParams,
|
|
141
|
+
runtime.fallbackCwd,
|
|
142
|
+
runtime.resolveDirectory,
|
|
143
|
+
{ agentArgs },
|
|
171
144
|
);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
145
|
+
let promptSubmissionStarted = false;
|
|
146
|
+
let promptAccepted = false;
|
|
147
|
+
let dispatch;
|
|
148
|
+
let shared: { agentName?: string; warning?: string } | undefined;
|
|
149
|
+
let boardAgent: string | undefined;
|
|
150
|
+
let relationshipWarning: string | undefined;
|
|
151
|
+
const blocking = shouldBlockAgentSpawn(profile.blocking, params.blocking);
|
|
152
|
+
try {
|
|
153
|
+
relationshipWarning = (await relationship?.accept(started.agent))
|
|
154
|
+
?.warning;
|
|
155
|
+
boardAgent = await boardBinding?.accept(started.agent);
|
|
156
|
+
shared = await sharing?.accept(started.agent);
|
|
157
|
+
dispatch = await dispatchAgentWork(
|
|
158
|
+
runtime,
|
|
159
|
+
started.agent,
|
|
160
|
+
message,
|
|
161
|
+
blocking,
|
|
162
|
+
signal,
|
|
163
|
+
onUpdate,
|
|
164
|
+
async () => {
|
|
165
|
+
promptSubmissionStarted = true;
|
|
166
|
+
const receipt = await runtime.client.sendMessage(
|
|
167
|
+
started.agent,
|
|
168
|
+
attributedMessage,
|
|
169
|
+
);
|
|
170
|
+
promptAccepted = true;
|
|
171
|
+
return receipt;
|
|
172
|
+
},
|
|
173
|
+
{ expectUserMessage: true },
|
|
174
|
+
);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
if (
|
|
177
|
+
!promptAccepted &&
|
|
178
|
+
(!promptSubmissionStarted || isDispatchRejected(error))
|
|
179
|
+
) {
|
|
180
|
+
return await rollbackStartedAgent(runtime.client, started, error);
|
|
181
|
+
}
|
|
182
|
+
throw error;
|
|
178
183
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
...(shared?.agentName ? { contextAgent: shared.agentName } : {}),
|
|
185
|
-
...(dispatch.command
|
|
186
|
-
? {
|
|
187
|
-
spawned: true,
|
|
188
|
-
commandSubmitted: true,
|
|
189
|
-
machine: runtime.machine,
|
|
190
|
-
target: started.id,
|
|
191
|
-
name,
|
|
192
|
-
}
|
|
193
|
-
: dispatch.settlement
|
|
184
|
+
return toolResult(
|
|
185
|
+
{
|
|
186
|
+
...(boardAgent ? { boardAgent } : {}),
|
|
187
|
+
...(shared?.agentName ? { contextAgent: shared.agentName } : {}),
|
|
188
|
+
...(dispatch.command
|
|
194
189
|
? {
|
|
195
190
|
spawned: true,
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
: {
|
|
199
|
-
spawned: true,
|
|
191
|
+
commandSubmitted: true,
|
|
200
192
|
machine: runtime.machine,
|
|
201
193
|
target: started.id,
|
|
202
194
|
name,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
}
|
|
196
|
+
: dispatch.settlement
|
|
197
|
+
? {
|
|
198
|
+
spawned: true,
|
|
199
|
+
...settlementResult(runtime.machine, dispatch.settlement),
|
|
200
|
+
}
|
|
201
|
+
: {
|
|
202
|
+
spawned: true,
|
|
203
|
+
machine: runtime.machine,
|
|
204
|
+
target: started.id,
|
|
205
|
+
name,
|
|
206
|
+
status: "working",
|
|
207
|
+
next: "Converse, do other work or reply now; completion/blockage arrives even after you reply. No polling or sleep waits",
|
|
208
|
+
}),
|
|
209
|
+
},
|
|
210
|
+
[dispatch.warning, shared?.warning, relationshipWarning]
|
|
211
|
+
.filter(Boolean)
|
|
212
|
+
.join("\n") || undefined,
|
|
213
|
+
);
|
|
214
|
+
} finally {
|
|
215
|
+
reservation.release();
|
|
216
|
+
}
|
|
211
217
|
}
|
package/src/agents-tool.ts
CHANGED
|
@@ -26,9 +26,9 @@ import {
|
|
|
26
26
|
toolResult,
|
|
27
27
|
} from "./agents-work.js";
|
|
28
28
|
import type { AgentBoard } from "./board/host.js";
|
|
29
|
-
import type { AgentFleet } from "./fleet.js";
|
|
29
|
+
import type { AgentFleet } from "./fleet/index.js";
|
|
30
30
|
import { resolvePiAgent } from "./herdr.js";
|
|
31
|
-
import { attributeAgentPrompt } from "./messages.js";
|
|
31
|
+
import { attributeAgentPrompt } from "./messages/attribution.js";
|
|
32
32
|
import type { createPeerCommands } from "./peer-commands.js";
|
|
33
33
|
import type { SharedAgentContext } from "./shared-context.js";
|
|
34
34
|
|
|
@@ -46,7 +46,7 @@ export function createAgentsTool(
|
|
|
46
46
|
description: "Delegate to persistent agents",
|
|
47
47
|
promptGuidelines: ["Make the first agents discovery call alone"],
|
|
48
48
|
parameters: AgentsParameters,
|
|
49
|
-
executionMode: "
|
|
49
|
+
executionMode: "parallel",
|
|
50
50
|
async execute(_toolCallId, input: AgentsToolParams, signal, onUpdate, ctx) {
|
|
51
51
|
const params = parseAgentsRequest(input);
|
|
52
52
|
const executionSignal = signal ?? new AbortController().signal;
|
package/src/agents-work.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AgentToolUpdateCallback } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { activityTask } from "./activity.js";
|
|
3
|
-
import type { ConnectedMachine } from "./fleet.js";
|
|
3
|
+
import type { ConnectedMachine } from "./fleet/index.js";
|
|
4
4
|
import { getSnapshot } from "./herdr.js";
|
|
5
|
-
import { isDispatchRejected } from "./herdr-client.js";
|
|
6
|
-
import { agentSource } from "./messages.js";
|
|
5
|
+
import { type HerdrConnection, isDispatchRejected } from "./herdr-client.js";
|
|
6
|
+
import { agentSource } from "./messages/attribution.js";
|
|
7
7
|
import type { WorkAttempt } from "./monitor-state.js";
|
|
8
|
-
import type { ClaimedSettlement } from "./settlement.js";
|
|
8
|
+
import type { ClaimedSettlement } from "./settlement/index.js";
|
|
9
9
|
import type { ExtensionReply, PaneInfo, PeerDelivery } from "./types.js";
|
|
10
10
|
|
|
11
11
|
export function toolResult(value: Record<string, unknown>, warning?: string) {
|
|
@@ -38,14 +38,38 @@ function slugify(value: string): string {
|
|
|
38
38
|
return named.slice(0, 32).replace(/-+$/u, "") || "agent";
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
const startingNames = new WeakMap<HerdrConnection, Set<string>>();
|
|
42
|
+
|
|
43
|
+
export async function reserveAgentName(
|
|
42
44
|
runtime: ConnectedMachine,
|
|
43
45
|
label: string,
|
|
44
|
-
|
|
46
|
+
requested?: string,
|
|
47
|
+
): Promise<{ name: string; release(): void }> {
|
|
45
48
|
const snapshot = await getSnapshot(runtime.client);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
let reserved = startingNames.get(runtime.client);
|
|
50
|
+
if (!reserved) {
|
|
51
|
+
reserved = new Set<string>();
|
|
52
|
+
startingNames.set(runtime.client, reserved);
|
|
53
|
+
}
|
|
54
|
+
const names = new Set([
|
|
55
|
+
...snapshot.agents.flatMap((agent) => (agent.name ? [agent.name] : [])),
|
|
56
|
+
...reserved,
|
|
57
|
+
]);
|
|
58
|
+
const name = requested?.trim() || availableAgentName(names, label);
|
|
59
|
+
if (names.has(name))
|
|
60
|
+
throw new Error(
|
|
61
|
+
`Agent name ${JSON.stringify(name)} is already in use; omit name or choose another`,
|
|
62
|
+
);
|
|
63
|
+
reserved.add(name);
|
|
64
|
+
return {
|
|
65
|
+
name,
|
|
66
|
+
release: () => {
|
|
67
|
+
reserved.delete(name);
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function availableAgentName(names: ReadonlySet<string>, label: string): string {
|
|
49
73
|
const base = slugify(label);
|
|
50
74
|
if (!names.has(base)) return base;
|
|
51
75
|
for (let suffix = 2; suffix < 10_000; suffix += 1) {
|
package/src/attachment-notes.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
ContextSharingService,
|
|
5
5
|
SharedContextRequest,
|
|
6
6
|
SharedContextResult,
|
|
7
|
-
} from "@howaboua/pi-
|
|
7
|
+
} from "@howaboua/pi-notes-compaction/context-sharing";
|
|
8
8
|
|
|
9
9
|
/** Read-only continuity when a live owner disappears. Parsing remains Conversion-owned. */
|
|
10
10
|
export class AttachmentNotes {
|
|
@@ -174,7 +174,19 @@ export class AttachmentNotes {
|
|
|
174
174
|
}),
|
|
175
175
|
};
|
|
176
176
|
return {
|
|
177
|
-
content: [
|
|
177
|
+
content: [
|
|
178
|
+
...result.content,
|
|
179
|
+
{
|
|
180
|
+
type: "text",
|
|
181
|
+
text: `Read-only checkpoints captured ${details.captured_at}.${
|
|
182
|
+
detached
|
|
183
|
+
? " Counterpart detached."
|
|
184
|
+
: unavailable
|
|
185
|
+
? " Live owner and saved updates unavailable; these checkpoints may be stale. Resume the counterpart for current notes."
|
|
186
|
+
: " Live owner unavailable; reading saved checkpoints."
|
|
187
|
+
}`,
|
|
188
|
+
},
|
|
189
|
+
],
|
|
178
190
|
details: { codexHistoryNotes: details },
|
|
179
191
|
};
|
|
180
192
|
}
|
|
@@ -2,7 +2,7 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
2
2
|
import { Type } from "@earendil-works/pi-ai";
|
|
3
3
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import { BindingSchema } from "@howaboua/pi-agent-board/integration";
|
|
5
|
-
import type { SharedContextResult } from "@howaboua/pi-
|
|
5
|
+
import type { SharedContextResult } from "@howaboua/pi-notes-compaction/context-sharing";
|
|
6
6
|
import type { Static, TSchema } from "typebox";
|
|
7
7
|
import { Check } from "typebox/value";
|
|
8
8
|
|
|
@@ -115,8 +115,7 @@ export function remapResult(
|
|
|
115
115
|
typeof result.details.codexHistoryNotes["encrypted_output"] === "string" ||
|
|
116
116
|
("externalNotesResponses" in result.details &&
|
|
117
117
|
Array.isArray(result.details.externalNotesResponses) &&
|
|
118
|
-
result.details.externalNotesResponses.length > 0)
|
|
119
|
-
Object.keys(result.details.codexHistoryNotes).length === 0
|
|
118
|
+
result.details.externalNotesResponses.length > 0)
|
|
120
119
|
) {
|
|
121
120
|
const hint = `Source ${from}, access through ${to}. Use ${to}/notes for note paths and ${to} for history agent_name`;
|
|
122
121
|
// Ciphertext paths cannot be remapped. Preserve host-only provenance on the original details.
|
|
@@ -135,7 +134,25 @@ export function remapResult(
|
|
|
135
134
|
) as Record<string, unknown>;
|
|
136
135
|
return {
|
|
137
136
|
...result,
|
|
138
|
-
|
|
137
|
+
// Remap the public payload, never regenerate it from private receipts.
|
|
138
|
+
content: result.content.map((item) => {
|
|
139
|
+
if (item.type !== "text") return item;
|
|
140
|
+
try {
|
|
141
|
+
return {
|
|
142
|
+
...item,
|
|
143
|
+
text: JSON.stringify(
|
|
144
|
+
JSON.parse(item.text, (key, value: unknown) =>
|
|
145
|
+
(key === "path" || key === "agent_name") &&
|
|
146
|
+
typeof value === "string"
|
|
147
|
+
? remap(value, from, to)
|
|
148
|
+
: value,
|
|
149
|
+
),
|
|
150
|
+
),
|
|
151
|
+
};
|
|
152
|
+
} catch {
|
|
153
|
+
return item;
|
|
154
|
+
}
|
|
155
|
+
}),
|
|
139
156
|
details: { ...result.details, codexHistoryNotes: details },
|
|
140
157
|
};
|
|
141
158
|
}
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
ContextSharingService,
|
|
5
5
|
SharedContextRequest,
|
|
6
6
|
SharedContextResult,
|
|
7
|
-
} from "@howaboua/pi-
|
|
7
|
+
} from "@howaboua/pi-notes-compaction/context-sharing";
|
|
8
8
|
import type { AttachmentNotes } from "./attachment-notes.js";
|
|
9
9
|
import {
|
|
10
10
|
type AttachmentRoute,
|
package/src/attachment-target.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
ExtensionContext,
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { binding } from "@howaboua/pi-agent-board/integration";
|
|
7
|
-
import type { ContextSharingService } from "@howaboua/pi-
|
|
7
|
+
import type { ContextSharingService } from "@howaboua/pi-notes-compaction/context-sharing";
|
|
8
8
|
import type { Static } from "typebox";
|
|
9
9
|
import { Check } from "typebox/value";
|
|
10
10
|
import { AttachmentNotes } from "./attachment-notes.js";
|
|
@@ -21,7 +21,10 @@ import {
|
|
|
21
21
|
} from "./attachment-protocol.js";
|
|
22
22
|
import type { AgentBoard } from "./board/host.js";
|
|
23
23
|
import { sendPolicyMessage } from "./delivery.js";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
attachmentMessage,
|
|
26
|
+
detachmentMessage,
|
|
27
|
+
} from "./messages/attachments.js";
|
|
25
28
|
|
|
26
29
|
/** Validates and commits attachment membership in the settled target session. */
|
|
27
30
|
export class AttachmentTarget {
|
package/src/attachment.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
ExtensionContext,
|
|
6
6
|
} from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import { binding } from "@howaboua/pi-agent-board/integration";
|
|
8
|
-
import type { ContextSharingService } from "@howaboua/pi-
|
|
8
|
+
import type { ContextSharingService } from "@howaboua/pi-notes-compaction/context-sharing";
|
|
9
9
|
import type { Static } from "typebox";
|
|
10
10
|
import { Check } from "typebox/value";
|
|
11
11
|
import type { AgentsParams } from "./agents-contract.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { AttachmentRouting } from "./attachment-routing.js";
|
|
21
21
|
import { AttachmentTarget } from "./attachment-target.js";
|
|
22
22
|
import type { AgentBoard } from "./board/host.js";
|
|
23
|
-
import type { ConnectedMachine } from "./fleet.js";
|
|
23
|
+
import type { ConnectedMachine } from "./fleet/index.js";
|
|
24
24
|
import { sessionPath } from "./herdr.js";
|
|
25
25
|
import { sessionContextPath } from "./remote/shepherdr-context.mjs";
|
|
26
26
|
import type { PaneInfo } from "./types.js";
|
|
@@ -202,7 +202,6 @@ export class AgentAttachment {
|
|
|
202
202
|
...(route.plan.board
|
|
203
203
|
? {
|
|
204
204
|
boardAgent: route.plan.board.desired.agentName,
|
|
205
|
-
previousBoard: route.plan.board.previous.boardId,
|
|
206
205
|
}
|
|
207
206
|
: {}),
|
|
208
207
|
};
|
package/src/board/host.ts
CHANGED
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
type BoardRuntime,
|
|
16
16
|
discoverBoard,
|
|
17
17
|
} from "@howaboua/pi-agent-board/runtime";
|
|
18
|
-
import type { AgentFleet, ConnectedMachine } from "../fleet.js";
|
|
18
|
+
import type { AgentFleet, ConnectedMachine } from "../fleet/index.js";
|
|
19
19
|
import { sessionPath } from "../herdr.js";
|
|
20
|
-
import { boardBriefing, boardMigrationWarning } from "../messages.js";
|
|
20
|
+
import { boardBriefing, boardMigrationWarning } from "../messages/guidance.js";
|
|
21
21
|
import {
|
|
22
22
|
requestContext,
|
|
23
23
|
sessionContextPath,
|
package/src/board/membership.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
saveChild,
|
|
15
15
|
saveMember,
|
|
16
16
|
} from "@howaboua/pi-agent-board/integration";
|
|
17
|
-
import type { ConnectedMachine } from "../fleet.js";
|
|
17
|
+
import type { ConnectedMachine } from "../fleet/index.js";
|
|
18
18
|
|
|
19
19
|
function sameMembership(left: BoardBinding, right: BoardBinding) {
|
|
20
20
|
return isDeepStrictEqual(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
1
|
+
import { type SshSetupDraft, sshSetupArgs } from "../ssh-setup.js";
|
|
2
|
+
import type { PanelOwners } from "./items.js";
|
|
3
3
|
|
|
4
4
|
export interface PanelOptions extends PanelOwners {
|
|
5
5
|
setOrchestration: (enabled: boolean, signal: AbortSignal) => Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { addSshConnection, type SshSetupDraft } from "../ssh-setup.js";
|
|
3
|
+
import { PanelActions, type PanelOptions } from "./actions.js";
|
|
4
|
+
import type { PanelTab as Tab } from "./items.js";
|
|
5
|
+
import { PanelView } from "./view.js";
|
|
6
6
|
|
|
7
7
|
export function controlPanelStatus(options: PanelOptions): string {
|
|
8
8
|
return [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SettingItem } from "@earendil-works/pi-tui";
|
|
2
|
-
import { commandConfigPath } from "
|
|
3
|
-
import type { AgentFleet } from "
|
|
4
|
-
import { type SshSetupDraft, sshSetupItems } from "
|
|
2
|
+
import { commandConfigPath } from "../command-config.js";
|
|
3
|
+
import type { AgentFleet } from "../fleet/index.js";
|
|
4
|
+
import { type SshSetupDraft, sshSetupItems } from "../ssh-setup.js";
|
|
5
5
|
|
|
6
6
|
export const PANEL_TABS = ["Settings", "Status", "Connections"] as const;
|
|
7
7
|
export type PanelTab = (typeof PANEL_TABS)[number];
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
truncateToWidth,
|
|
15
15
|
wrapTextWithAnsi,
|
|
16
16
|
} from "@earendil-works/pi-tui";
|
|
17
|
-
import type {
|
|
17
|
+
import type { SshSetupDraft } from "../ssh-setup.js";
|
|
18
|
+
import type { PanelActions } from "./actions.js";
|
|
18
19
|
import {
|
|
19
20
|
buildPanelItems,
|
|
20
21
|
type PanelOwners,
|
|
21
22
|
type PanelTab,
|
|
22
23
|
PANEL_TABS as TABS,
|
|
23
|
-
} from "./
|
|
24
|
-
import type { SshSetupDraft } from "./ssh-setup.js";
|
|
24
|
+
} from "./items.js";
|
|
25
25
|
|
|
26
26
|
const LIST_ROWS = 8;
|
|
27
27
|
|
package/src/controller.ts
CHANGED
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
recordContextBriefing,
|
|
9
9
|
registerContextBriefing,
|
|
10
10
|
} from "@howaboua/pi-agent-board/integration";
|
|
11
|
-
import { controlPanelStatus, openControlPanel } from "./control-panel.js";
|
|
11
|
+
import { controlPanelStatus, openControlPanel } from "./control-panel/index.js";
|
|
12
12
|
import { sendPolicyMessage } from "./delivery.js";
|
|
13
|
-
import type { AgentFleet } from "./fleet.js";
|
|
14
|
-
import {
|
|
13
|
+
import type { AgentFleet } from "./fleet/index.js";
|
|
14
|
+
import {
|
|
15
|
+
activeAgentsBriefing,
|
|
16
|
+
orchestrationGuidance,
|
|
17
|
+
} from "./messages/guidance.js";
|
|
15
18
|
import type { createPeerCommands } from "./peer-commands.js";
|
|
16
19
|
import { loadAgentProfiles } from "./profiles.js";
|
|
17
20
|
|