appostle-installer 0.0.20 → 0.0.21
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/dist/appostle.js +40 -1
- package/dist/appostle.js.map +2 -2
- package/dist/worker.js +147 -4
- package/dist/worker.js.map +2 -2
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -4239,6 +4239,7 @@ var GoogleFontsDownloadResponseSchema = z10.object({
|
|
|
4239
4239
|
});
|
|
4240
4240
|
|
|
4241
4241
|
// ../server/src/shared/messages.ts
|
|
4242
|
+
var InitialAgentSnapshotPageLimit = 200;
|
|
4242
4243
|
var MutableDaemonConfigSchema = z11.object({
|
|
4243
4244
|
mcp: z11.object({
|
|
4244
4245
|
injectIntoAgents: z11.boolean()
|
|
@@ -6731,6 +6732,17 @@ var FetchAgentsResponseMessageSchema = z11.object({
|
|
|
6731
6732
|
})
|
|
6732
6733
|
})
|
|
6733
6734
|
});
|
|
6735
|
+
var InitialAgentSnapshotMessageSchema = z11.object({
|
|
6736
|
+
type: z11.literal("initial_agent_snapshot"),
|
|
6737
|
+
payload: z11.object({
|
|
6738
|
+
entries: z11.array(
|
|
6739
|
+
z11.object({
|
|
6740
|
+
agent: AgentSnapshotPayloadSchema,
|
|
6741
|
+
project: ProjectPlacementPayloadSchema
|
|
6742
|
+
})
|
|
6743
|
+
)
|
|
6744
|
+
})
|
|
6745
|
+
});
|
|
6734
6746
|
var FetchWorkspacesResponseMessageSchema = z11.object({
|
|
6735
6747
|
type: z11.literal("fetch_workspaces_response"),
|
|
6736
6748
|
payload: z11.object({
|
|
@@ -7772,6 +7784,7 @@ var SessionOutboundMessageSchema = z11.discriminatedUnion("type", [
|
|
|
7772
7784
|
AgentStreamMessageSchema,
|
|
7773
7785
|
AgentStatusMessageSchema,
|
|
7774
7786
|
FetchAgentsResponseMessageSchema,
|
|
7787
|
+
InitialAgentSnapshotMessageSchema,
|
|
7775
7788
|
FetchWorkspacesResponseMessageSchema,
|
|
7776
7789
|
OpenProjectResponseMessageSchema,
|
|
7777
7790
|
StartWorkspaceScriptResponseMessageSchema,
|
|
@@ -33602,7 +33615,7 @@ function serializeFrontmatter(input) {
|
|
|
33602
33615
|
|
|
33603
33616
|
// ../server/src/server/agent/handoff-mcp.ts
|
|
33604
33617
|
function buildHandoffMcpServer(callerAgentId, options) {
|
|
33605
|
-
const { agentManager, appostleHome, logger } = options;
|
|
33618
|
+
const { agentManager, appostleHome, logger, agentStorage } = options;
|
|
33606
33619
|
const log = logger.child({ module: "handoff-mcp", callerAgentId });
|
|
33607
33620
|
const handoffTool = tool2(
|
|
33608
33621
|
"handoff",
|
|
@@ -33681,6 +33694,22 @@ function buildHandoffMcpServer(callerAgentId, options) {
|
|
|
33681
33694
|
} catch (err) {
|
|
33682
33695
|
log.error({ err, agentId: snapshot.id }, "handoff: failed to start run");
|
|
33683
33696
|
}
|
|
33697
|
+
if (agentStorage) {
|
|
33698
|
+
try {
|
|
33699
|
+
setupFinishNotification({
|
|
33700
|
+
agentManager,
|
|
33701
|
+
agentStorage,
|
|
33702
|
+
childAgentId: snapshot.id,
|
|
33703
|
+
callerAgentId,
|
|
33704
|
+
logger: log
|
|
33705
|
+
});
|
|
33706
|
+
} catch (err) {
|
|
33707
|
+
log.error(
|
|
33708
|
+
{ err, agentId: snapshot.id },
|
|
33709
|
+
"handoff: failed to wire auto-return notification"
|
|
33710
|
+
);
|
|
33711
|
+
}
|
|
33712
|
+
}
|
|
33684
33713
|
return {
|
|
33685
33714
|
content: [
|
|
33686
33715
|
{
|
|
@@ -33691,11 +33720,97 @@ function buildHandoffMcpServer(callerAgentId, options) {
|
|
|
33691
33720
|
};
|
|
33692
33721
|
}
|
|
33693
33722
|
);
|
|
33723
|
+
const reportTool = tool2(
|
|
33724
|
+
"report",
|
|
33725
|
+
[
|
|
33726
|
+
"Send a curated message from this handoff child session back to its parent.",
|
|
33727
|
+
"Use this when the user types `>report` \u2014 they want to deliver a specific update",
|
|
33728
|
+
"to the parent right now, in their own words.",
|
|
33729
|
+
"",
|
|
33730
|
+
"Independent of the automatic on-finish notification: the parent still receives",
|
|
33731
|
+
"the auto-return when this child eventually finishes. You can call this tool any",
|
|
33732
|
+
"number of times over the lifetime of the handoff \u2014 each call is a separate",
|
|
33733
|
+
"update.",
|
|
33734
|
+
"",
|
|
33735
|
+
"Only works in sessions that were spawned via `handoff`. Errors otherwise."
|
|
33736
|
+
].join("\n"),
|
|
33737
|
+
{
|
|
33738
|
+
message: z33.string().min(1).describe(
|
|
33739
|
+
"The curated report to deliver to the parent session. Self-contained: the parent does not see this conversation's timeline."
|
|
33740
|
+
)
|
|
33741
|
+
},
|
|
33742
|
+
async (args) => {
|
|
33743
|
+
const childAgent = agentManager.getAgent(callerAgentId);
|
|
33744
|
+
if (!childAgent) {
|
|
33745
|
+
return {
|
|
33746
|
+
isError: true,
|
|
33747
|
+
content: [
|
|
33748
|
+
{ type: "text", text: `Caller agent ${callerAgentId} not found in agent manager` }
|
|
33749
|
+
]
|
|
33750
|
+
};
|
|
33751
|
+
}
|
|
33752
|
+
const parentAgentId = childAgent.labels?.["appostle.parent-agent-id"];
|
|
33753
|
+
if (!parentAgentId) {
|
|
33754
|
+
return {
|
|
33755
|
+
isError: true,
|
|
33756
|
+
content: [
|
|
33757
|
+
{
|
|
33758
|
+
type: "text",
|
|
33759
|
+
text: "This session was not spawned via `handoff`, so there is no parent to report to."
|
|
33760
|
+
}
|
|
33761
|
+
]
|
|
33762
|
+
};
|
|
33763
|
+
}
|
|
33764
|
+
const parentAgent = agentManager.getAgent(parentAgentId);
|
|
33765
|
+
if (!parentAgent) {
|
|
33766
|
+
return {
|
|
33767
|
+
isError: true,
|
|
33768
|
+
content: [
|
|
33769
|
+
{
|
|
33770
|
+
type: "text",
|
|
33771
|
+
text: `Parent agent ${parentAgentId} is no longer available.`
|
|
33772
|
+
}
|
|
33773
|
+
]
|
|
33774
|
+
};
|
|
33775
|
+
}
|
|
33776
|
+
const childTitle = childAgent.config?.title ?? callerAgentId;
|
|
33777
|
+
const trimmedMessage = args.message.trim();
|
|
33778
|
+
const prompt = `<appostle-system>
|
|
33779
|
+
Agent ${callerAgentId} (${childTitle}) reported back:
|
|
33780
|
+
|
|
33781
|
+
${trimmedMessage}
|
|
33782
|
+
</appostle-system>`;
|
|
33783
|
+
try {
|
|
33784
|
+
startAgentRun(agentManager, parentAgentId, prompt, log, {
|
|
33785
|
+
replaceRunning: true
|
|
33786
|
+
});
|
|
33787
|
+
} catch (err) {
|
|
33788
|
+
log.error({ err, parentAgentId }, "report: failed to inject prompt into parent");
|
|
33789
|
+
return {
|
|
33790
|
+
isError: true,
|
|
33791
|
+
content: [
|
|
33792
|
+
{
|
|
33793
|
+
type: "text",
|
|
33794
|
+
text: `report failed: could not wake parent \u2014 ${err instanceof Error ? err.message : String(err)}`
|
|
33795
|
+
}
|
|
33796
|
+
]
|
|
33797
|
+
};
|
|
33798
|
+
}
|
|
33799
|
+
return {
|
|
33800
|
+
content: [
|
|
33801
|
+
{
|
|
33802
|
+
type: "text",
|
|
33803
|
+
text: `Reported to parent ${parentAgentId}.`
|
|
33804
|
+
}
|
|
33805
|
+
]
|
|
33806
|
+
};
|
|
33807
|
+
}
|
|
33808
|
+
);
|
|
33694
33809
|
const writePlanTool = buildWritePlanTool(callerAgentId, { agentManager, logger });
|
|
33695
33810
|
const sdkInstance = createSdkMcpServer({
|
|
33696
33811
|
name: "appostle",
|
|
33697
33812
|
version: "0.1.0",
|
|
33698
|
-
tools: [handoffTool, writePlanTool],
|
|
33813
|
+
tools: [handoffTool, reportTool, writePlanTool],
|
|
33699
33814
|
alwaysLoad: true
|
|
33700
33815
|
});
|
|
33701
33816
|
return {
|
|
@@ -34256,7 +34371,8 @@ var AgentManager = class {
|
|
|
34256
34371
|
mcpServers.appostle = buildHandoffMcpServer(agentId, {
|
|
34257
34372
|
agentManager: this,
|
|
34258
34373
|
appostleHome: this.appostleHome,
|
|
34259
|
-
logger: this.logger
|
|
34374
|
+
logger: this.logger,
|
|
34375
|
+
agentStorage: this.registry
|
|
34260
34376
|
});
|
|
34261
34377
|
}
|
|
34262
34378
|
return { ...config, mcpServers };
|
|
@@ -42563,9 +42679,35 @@ var Session = class _Session {
|
|
|
42563
42679
|
this.emit(message);
|
|
42564
42680
|
}
|
|
42565
42681
|
/**
|
|
42566
|
-
*
|
|
42682
|
+
* Push the first page of the agent directory unsolicited right after
|
|
42683
|
+
* `server_info` so the client can paint attention state before its own
|
|
42684
|
+
* paginated `fetch_agents_request` round-trip lands. The regular fetch
|
|
42685
|
+
* still runs in parallel — it establishes the live-update subscription
|
|
42686
|
+
* and paginates beyond the first page. This push exists purely to shave
|
|
42687
|
+
* one relay round-trip from time-to-first-paint.
|
|
42688
|
+
*
|
|
42689
|
+
* Errors are swallowed: a failed push degrades to "wait for the client
|
|
42690
|
+
* to ask," which is still correct.
|
|
42567
42691
|
*/
|
|
42568
42692
|
async sendInitialState() {
|
|
42693
|
+
try {
|
|
42694
|
+
const synthetic = {
|
|
42695
|
+
type: "fetch_agents_request",
|
|
42696
|
+
requestId: "internal:initial-snapshot",
|
|
42697
|
+
filter: { includeArchived: true },
|
|
42698
|
+
page: { limit: InitialAgentSnapshotPageLimit }
|
|
42699
|
+
};
|
|
42700
|
+
const { entries } = await this.listFetchAgentsEntries(synthetic);
|
|
42701
|
+
this.emit({
|
|
42702
|
+
type: "initial_agent_snapshot",
|
|
42703
|
+
payload: { entries }
|
|
42704
|
+
});
|
|
42705
|
+
} catch (error) {
|
|
42706
|
+
this.sessionLogger.warn(
|
|
42707
|
+
{ err: error },
|
|
42708
|
+
"Failed to push initial agent snapshot \u2014 client will fall back to fetch_agents_request"
|
|
42709
|
+
);
|
|
42710
|
+
}
|
|
42569
42711
|
}
|
|
42570
42712
|
/**
|
|
42571
42713
|
* Normalize a user prompt (with optional image metadata) for AgentManager
|
|
@@ -52961,6 +53103,7 @@ var VoiceAssistantWebSocketServer = class {
|
|
|
52961
53103
|
this.sessions.set(ws, connection);
|
|
52962
53104
|
this.externalSessionsByKey.set(clientId, connection);
|
|
52963
53105
|
this.sendToClient(ws, this.createServerInfoMessage());
|
|
53106
|
+
void connection.session.sendInitialState();
|
|
52964
53107
|
connection.connectionLogger.trace(
|
|
52965
53108
|
{
|
|
52966
53109
|
clientId,
|