@cydm/magic-shell-agent-node 0.1.5 → 0.1.6
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/node.d.ts +1 -0
- package/dist/node.js +7 -0
- package/dist/workbench/index.html +33 -3
- package/dist/workbench/runtime-control.js +2 -0
- package/package.json +2 -2
package/dist/node.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export declare class AgentNode {
|
|
|
84
84
|
private sendControlResult;
|
|
85
85
|
private buildRuntimeSnapshot;
|
|
86
86
|
private buildPrimaryAgentStatus;
|
|
87
|
+
private getAvailableWorkerPluginNames;
|
|
87
88
|
private isProtectedPrimarySession;
|
|
88
89
|
private runSessionTurn;
|
|
89
90
|
private runClaudeWorkerTurn;
|
package/dist/node.js
CHANGED
|
@@ -973,6 +973,7 @@ export class AgentNode {
|
|
|
973
973
|
return {
|
|
974
974
|
pluginName: this.primaryAgent.pluginName,
|
|
975
975
|
preferredWorkerPluginName: this.preferredWorkerPluginName,
|
|
976
|
+
availableWorkerPlugins: this.getAvailableWorkerPluginNames(),
|
|
976
977
|
sessionId: this.primaryAgent.sessionId,
|
|
977
978
|
status: this.primaryAgent.status,
|
|
978
979
|
activityState: this.primaryAgent.activityState,
|
|
@@ -980,6 +981,12 @@ export class AgentNode {
|
|
|
980
981
|
capabilities: this.primaryAgent.capabilities || [],
|
|
981
982
|
};
|
|
982
983
|
}
|
|
984
|
+
getAvailableWorkerPluginNames() {
|
|
985
|
+
return Array.from(this.plugins.values())
|
|
986
|
+
.map((plugin) => plugin.name)
|
|
987
|
+
.filter((name) => name !== this.primaryAgent.pluginName)
|
|
988
|
+
.sort((a, b) => a.localeCompare(b));
|
|
989
|
+
}
|
|
983
990
|
isProtectedPrimarySession(sessionId) {
|
|
984
991
|
return !!sessionId && sessionId === this.primaryAgent.sessionId;
|
|
985
992
|
}
|
|
@@ -2429,18 +2429,45 @@
|
|
|
2429
2429
|
document.cookie = `${name}=${encodeURIComponent(value)}; path=/; max-age=${60 * 60 * 24 * 365}`;
|
|
2430
2430
|
}
|
|
2431
2431
|
|
|
2432
|
+
function getAvailableSpawnPlugins() {
|
|
2433
|
+
const plugins = Array.isArray(primaryAgent?.availableWorkerPlugins) && primaryAgent.availableWorkerPlugins.length
|
|
2434
|
+
? primaryAgent.availableWorkerPlugins
|
|
2435
|
+
: ['pie'];
|
|
2436
|
+
return Array.from(new Set(plugins.filter((item) => typeof item === 'string' && item.length > 0)));
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
function normalizeSpawnPlugin(pluginName) {
|
|
2440
|
+
const available = getAvailableSpawnPlugins();
|
|
2441
|
+
if (pluginName && available.includes(pluginName)) return pluginName;
|
|
2442
|
+
if (available.includes('pie')) return 'pie';
|
|
2443
|
+
return available[0] || 'pie';
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2432
2446
|
function readStoredSpawnPlugin() {
|
|
2433
2447
|
const cookieValue = readCookie('spawnPlugin');
|
|
2434
2448
|
const saved = cookieValue || localStorage.getItem('spawnPlugin') || 'pie';
|
|
2435
|
-
return saved
|
|
2449
|
+
return normalizeSpawnPlugin(saved);
|
|
2436
2450
|
}
|
|
2437
2451
|
|
|
2438
2452
|
function persistSpawnPlugin(pluginName) {
|
|
2439
|
-
selectedSpawnPlugin = pluginName
|
|
2453
|
+
selectedSpawnPlugin = normalizeSpawnPlugin(pluginName);
|
|
2440
2454
|
localStorage.setItem('spawnPlugin', selectedSpawnPlugin);
|
|
2441
2455
|
writeCookie('spawnPlugin', selectedSpawnPlugin);
|
|
2442
2456
|
}
|
|
2443
2457
|
|
|
2458
|
+
function renderSpawnPluginOptions() {
|
|
2459
|
+
const select = document.getElementById('spawnPlugin');
|
|
2460
|
+
if (!select) return;
|
|
2461
|
+
const available = getAvailableSpawnPlugins();
|
|
2462
|
+
const current = normalizeSpawnPlugin(selectedSpawnPlugin);
|
|
2463
|
+
select.innerHTML = available.map((pluginName) => (
|
|
2464
|
+
`<option value="${escapeHtml(pluginName)}">${escapeHtml(getSpawnPluginLabel(pluginName))}</option>`
|
|
2465
|
+
)).join('');
|
|
2466
|
+
selectedSpawnPlugin = current;
|
|
2467
|
+
select.value = current;
|
|
2468
|
+
resetSpawnButton();
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2444
2471
|
function loadRecentCwds() {
|
|
2445
2472
|
try {
|
|
2446
2473
|
const stored = readCookie('recentCwds') || localStorage.getItem('recentCwds') || '[]';
|
|
@@ -2550,7 +2577,7 @@
|
|
|
2550
2577
|
document.getElementById('nodeId').value = localStorage.getItem('nodeId') || '';
|
|
2551
2578
|
document.getElementById('password').value = localStorage.getItem('password') || '';
|
|
2552
2579
|
document.getElementById('spawnCwd').value = defaultSpawnCwd;
|
|
2553
|
-
|
|
2580
|
+
renderSpawnPluginOptions();
|
|
2554
2581
|
document.getElementById('spawnPlugin').addEventListener('change', (event) => {
|
|
2555
2582
|
persistSpawnPlugin(event.target.value || 'pie');
|
|
2556
2583
|
resetSpawnButton();
|
|
@@ -3086,6 +3113,8 @@
|
|
|
3086
3113
|
function getSpawnPluginLabel(pluginName) {
|
|
3087
3114
|
if (pluginName === 'claude-code') return 'CLAUDE';
|
|
3088
3115
|
if (pluginName === 'codex') return 'CODEX';
|
|
3116
|
+
if (pluginName === 'pie-unity') return 'PIE UNITY';
|
|
3117
|
+
if (pluginName === 'echo') return 'ECHO';
|
|
3089
3118
|
return 'PIE';
|
|
3090
3119
|
}
|
|
3091
3120
|
|
|
@@ -3669,6 +3698,7 @@
|
|
|
3669
3698
|
pushNodeTranscript,
|
|
3670
3699
|
renderWorkers,
|
|
3671
3700
|
syncWorkerPluginPreference,
|
|
3701
|
+
renderSpawnPluginOptions,
|
|
3672
3702
|
getSpawnCwd() {
|
|
3673
3703
|
return (document.getElementById('spawnCwd').value || '').trim();
|
|
3674
3704
|
},
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
ctx.runtimeSummary = snapshot.runtime || null;
|
|
20
20
|
ctx.runtimeFocus = snapshot.focus || [];
|
|
21
21
|
ctx.primaryAgent = snapshot.primary || null;
|
|
22
|
+
ctx.renderSpawnPluginOptions?.();
|
|
22
23
|
ctx.syncNodeTranscriptFromServer(snapshot.nodeHistory);
|
|
23
24
|
|
|
24
25
|
const liveSessionIds = new Set(ctx.workers.map((worker) => worker.sessionId));
|
|
@@ -119,6 +120,7 @@
|
|
|
119
120
|
|
|
120
121
|
if (msg.controlKind === "result" && msg.controlName === "get_primary_agent" && msg.payload && msg.payload.primary) {
|
|
121
122
|
ctx.primaryAgent = msg.payload.primary || null;
|
|
123
|
+
ctx.renderSpawnPluginOptions?.();
|
|
122
124
|
ctx.renderNodeHome();
|
|
123
125
|
return true;
|
|
124
126
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cydm/magic-shell-agent-node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Magic Shell Agent Node - Local agent connector",
|
|
5
5
|
"homepage": "https://magicshell.ai",
|
|
6
6
|
"keywords": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"start": "node dist/node.js"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@cydm/magic-shell-protocol": "0.1.
|
|
30
|
+
"@cydm/magic-shell-protocol": "0.1.2",
|
|
31
31
|
"node-pty": "^1.1.0",
|
|
32
32
|
"ws": "^8.18.0"
|
|
33
33
|
},
|