allye-pi 1.6.1 → 1.6.2
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
CHANGED
|
@@ -87,10 +87,17 @@ function limitText(text: string, maxChars: number): string {
|
|
|
87
87
|
return text.length <= maxChars ? text : `${text.slice(0, maxChars)}\n[context truncated]`;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
type McpBridgeRuntime = typeof globalThis & {
|
|
91
|
+
__piMcpAdapterActiveToolCaller?: ActiveMcpToolCaller | null;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export function describeCapabilities(
|
|
95
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
96
|
+
mcpAvailable = Boolean((globalThis as McpBridgeRuntime).__piMcpAdapterActiveToolCaller),
|
|
97
|
+
): AllyeCapabilities {
|
|
91
98
|
return {
|
|
92
99
|
piSession: true,
|
|
93
|
-
allyeMcp: env.ALLYE_PI_MCP !== "0",
|
|
100
|
+
allyeMcp: env.ALLYE_PI_MCP !== "0" && mcpAvailable,
|
|
94
101
|
filesystem: true,
|
|
95
102
|
subagents: env.ALLYE_PI_SUBAGENTS === "1",
|
|
96
103
|
herdr: env.HERDR_ENV === "1",
|
|
@@ -133,9 +140,7 @@ async function configuredMcpCall(toolName: string, args: Record<string, unknown>
|
|
|
133
140
|
// the in-process runtime. There is no public callMcpTool export in the
|
|
134
141
|
// supported package version, so do not dynamically import its TypeScript
|
|
135
142
|
// source from node_modules. A missing bridge is a hard bootstrap failure.
|
|
136
|
-
const globalBridge = (globalThis as
|
|
137
|
-
__piMcpAdapterActiveToolCaller?: ActiveMcpToolCaller | null;
|
|
138
|
-
}).__piMcpAdapterActiveToolCaller;
|
|
143
|
+
const globalBridge = (globalThis as McpBridgeRuntime).__piMcpAdapterActiveToolCaller;
|
|
139
144
|
if (!globalBridge) throw new Error("pi-mcp-adapter is not initialized; start the configured MCP adapter before using Allye");
|
|
140
145
|
return globalBridge(MCP_SERVER, toolName, args);
|
|
141
146
|
}
|
|
@@ -255,8 +260,8 @@ export function deliverWaitEvent(
|
|
|
255
260
|
|
|
256
261
|
export function invalidStartupContext(message: string): StartupContext {
|
|
257
262
|
return {
|
|
258
|
-
text: `## Allye
|
|
259
|
-
teamSelectionRequired:
|
|
263
|
+
text: `## Allye optional context unavailable\n${message}\nDo not call team-scoped work_items or intelligence operations until Allye connectivity and team context are available. Continue with local, non-team-scoped work when appropriate.`,
|
|
264
|
+
teamSelectionRequired: false,
|
|
260
265
|
allyeUnavailable: true,
|
|
261
266
|
teams: [],
|
|
262
267
|
};
|
|
@@ -266,7 +271,8 @@ export function canUseOwnedPane(state: DelegationState, paneId: string): boolean
|
|
|
266
271
|
return state.panes.some((pane) => pane.paneId === paneId);
|
|
267
272
|
}
|
|
268
273
|
|
|
269
|
-
async function loadStartupContext(): Promise<StartupContext> {
|
|
274
|
+
async function loadStartupContext(allyeMcp = true): Promise<StartupContext> {
|
|
275
|
+
if (!allyeMcp) return invalidStartupContext("Allye/MCP is disabled for this Pi session.");
|
|
270
276
|
const sections: string[] = [];
|
|
271
277
|
try {
|
|
272
278
|
const initialization = await callAllye("allye_initialize", {
|
|
@@ -645,7 +651,7 @@ export default function allyePiAdapter(pi: ExtensionAPI): void {
|
|
|
645
651
|
usingAllyeBootstrap = loadUsingAllyeSkill();
|
|
646
652
|
syncCapabilityTools();
|
|
647
653
|
if (ctx.hasUI) ctx.ui.setStatus("allye-pi", "loading Allye context…");
|
|
648
|
-
if (process.env.ALLYE_PI_NATIVE_BOOTSTRAP !== "0") startupContext = await loadStartupContext();
|
|
654
|
+
if (process.env.ALLYE_PI_NATIVE_BOOTSTRAP !== "0") startupContext = await loadStartupContext(capabilities.allyeMcp);
|
|
649
655
|
if (startupContext.teamSelectionRequired && ctx.hasUI) {
|
|
650
656
|
ctx.ui.notify("Allye has multiple teams and no active team. Use /allye-team <name|prefix|id> before team-scoped work.", "warning");
|
|
651
657
|
}
|