obsidian-agent-fleet 0.4.4 → 0.4.5
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 +1 -1
- package/plugin/main.js +60 -12
- package/plugin/styles.css +1 -1
package/package.json
CHANGED
package/plugin/main.js
CHANGED
|
@@ -26197,7 +26197,7 @@ function channelStatusPillColor(status) {
|
|
|
26197
26197
|
|
|
26198
26198
|
// src/views/agentChatView.ts
|
|
26199
26199
|
var import_obsidian13 = require("obsidian");
|
|
26200
|
-
var AgentChatView = class extends import_obsidian13.ItemView {
|
|
26200
|
+
var AgentChatView = class _AgentChatView extends import_obsidian13.ItemView {
|
|
26201
26201
|
constructor(leaf, plugin) {
|
|
26202
26202
|
super(leaf);
|
|
26203
26203
|
this.plugin = plugin;
|
|
@@ -26225,11 +26225,20 @@ var AgentChatView = class extends import_obsidian13.ItemView {
|
|
|
26225
26225
|
return VIEW_TYPE_CHAT;
|
|
26226
26226
|
}
|
|
26227
26227
|
getDisplayText() {
|
|
26228
|
-
return "Agent Chat";
|
|
26228
|
+
return this.selectedAgentName ? `Chat: ${this.selectedAgentName}` : "Agent Chat";
|
|
26229
26229
|
}
|
|
26230
26230
|
getIcon() {
|
|
26231
26231
|
return "message-circle";
|
|
26232
26232
|
}
|
|
26233
|
+
getState() {
|
|
26234
|
+
return { agentName: this.selectedAgentName ?? null };
|
|
26235
|
+
}
|
|
26236
|
+
async setState(state, result) {
|
|
26237
|
+
await super.setState(state, result);
|
|
26238
|
+
if (state?.agentName && typeof state.agentName === "string") {
|
|
26239
|
+
this.selectAgent(state.agentName);
|
|
26240
|
+
}
|
|
26241
|
+
}
|
|
26233
26242
|
async onOpen() {
|
|
26234
26243
|
this.plugin.subscribeView(this);
|
|
26235
26244
|
this.buildShell();
|
|
@@ -26244,10 +26253,18 @@ var AgentChatView = class extends import_obsidian13.ItemView {
|
|
|
26244
26253
|
}
|
|
26245
26254
|
/** Called externally to switch to a specific agent */
|
|
26246
26255
|
selectAgent(agentName) {
|
|
26256
|
+
const leaves = this.plugin.app.workspace.getLeavesOfType(VIEW_TYPE_CHAT);
|
|
26257
|
+
for (const leaf of leaves) {
|
|
26258
|
+
if (leaf.view !== this && leaf.view instanceof _AgentChatView && leaf.view.selectedAgentName === agentName) {
|
|
26259
|
+
this.plugin.app.workspace.revealLeaf(leaf);
|
|
26260
|
+
return;
|
|
26261
|
+
}
|
|
26262
|
+
}
|
|
26247
26263
|
this.selectedAgentName = agentName;
|
|
26248
26264
|
if (this.agentSelect) {
|
|
26249
26265
|
this.agentSelect.value = agentName;
|
|
26250
26266
|
}
|
|
26267
|
+
this.leaf.updateHeader();
|
|
26251
26268
|
void this.switchToAgent(agentName);
|
|
26252
26269
|
}
|
|
26253
26270
|
/** Build the static shell (header, messages area, input). Only runs once. */
|
|
@@ -26267,6 +26284,14 @@ var AgentChatView = class extends import_obsidian13.ItemView {
|
|
|
26267
26284
|
this.agentSelect.onchange = () => {
|
|
26268
26285
|
const val = this.agentSelect.value;
|
|
26269
26286
|
if (val) {
|
|
26287
|
+
const leaves = this.plugin.app.workspace.getLeavesOfType(VIEW_TYPE_CHAT);
|
|
26288
|
+
for (const leaf of leaves) {
|
|
26289
|
+
if (leaf.view !== this && leaf.view instanceof _AgentChatView && leaf.view.selectedAgentName === val) {
|
|
26290
|
+
this.plugin.app.workspace.revealLeaf(leaf);
|
|
26291
|
+
this.agentSelect.value = this.selectedAgentName ?? "";
|
|
26292
|
+
return;
|
|
26293
|
+
}
|
|
26294
|
+
}
|
|
26270
26295
|
this.textarea.disabled = false;
|
|
26271
26296
|
this.textarea.placeholder = "Message the agent\u2026 (Ctrl+Enter to send)";
|
|
26272
26297
|
void this.switchToAgent(val);
|
|
@@ -26390,13 +26415,16 @@ var AgentChatView = class extends import_obsidian13.ItemView {
|
|
|
26390
26415
|
this.textarea.disabled = false;
|
|
26391
26416
|
} else {
|
|
26392
26417
|
this.selectedAgentName = null;
|
|
26418
|
+
this.leaf.updateHeader();
|
|
26393
26419
|
this.textarea.disabled = true;
|
|
26394
26420
|
this.textarea.placeholder = "Select an agent to start chatting\u2026";
|
|
26395
26421
|
this.showEmptyState();
|
|
26396
26422
|
return;
|
|
26397
26423
|
}
|
|
26424
|
+
this.leaf.updateHeader();
|
|
26398
26425
|
this.textarea.placeholder = "Message the agent\u2026 (Ctrl+Enter to send)";
|
|
26399
|
-
|
|
26426
|
+
const hasMessages = this.messagesInner.querySelector(".af-chat-bubble") !== null;
|
|
26427
|
+
if (this.selectedAgentName && !hasMessages) {
|
|
26400
26428
|
void this.switchToAgent(this.selectedAgentName);
|
|
26401
26429
|
}
|
|
26402
26430
|
}
|
|
@@ -26423,6 +26451,7 @@ var AgentChatView = class extends import_obsidian13.ItemView {
|
|
|
26423
26451
|
const agent = agents.find((a) => a.name === agentName);
|
|
26424
26452
|
if (!agent) return;
|
|
26425
26453
|
this.selectedAgentName = agentName;
|
|
26454
|
+
this.leaf.updateHeader();
|
|
26426
26455
|
this.activityEl = null;
|
|
26427
26456
|
this.streamingDot = null;
|
|
26428
26457
|
this.messagesInner.empty();
|
|
@@ -26898,7 +26927,14 @@ var AgentFleetPlugin = class extends import_obsidian14.Plugin {
|
|
|
26898
26927
|
await this.runtime.initialize();
|
|
26899
26928
|
await this.verifyClaudeCli(false);
|
|
26900
26929
|
this.addRibbonIcon("bot", "Agent Fleet Dashboard", () => void this.activateDashboardView());
|
|
26901
|
-
this.addRibbonIcon("message-circle", "Agent Chat", () =>
|
|
26930
|
+
this.addRibbonIcon("message-circle", "Agent Chat", () => {
|
|
26931
|
+
const existing = this.app.workspace.getLeavesOfType(VIEW_TYPE_CHAT);
|
|
26932
|
+
if (existing.length > 0) {
|
|
26933
|
+
this.app.workspace.revealLeaf(existing[0]);
|
|
26934
|
+
} else {
|
|
26935
|
+
void this.openChatView();
|
|
26936
|
+
}
|
|
26937
|
+
});
|
|
26902
26938
|
this.addCommands();
|
|
26903
26939
|
this.registerVaultHandlers();
|
|
26904
26940
|
this.registerRuntimeListeners();
|
|
@@ -27005,17 +27041,17 @@ ${output}`
|
|
|
27005
27041
|
this.app.workspace.revealLeaf(leaf);
|
|
27006
27042
|
}
|
|
27007
27043
|
async openChatView(agentName) {
|
|
27008
|
-
|
|
27009
|
-
|
|
27010
|
-
const leaf2
|
|
27011
|
-
|
|
27012
|
-
|
|
27013
|
-
|
|
27044
|
+
if (agentName) {
|
|
27045
|
+
const existing = this.app.workspace.getLeavesOfType(VIEW_TYPE_CHAT);
|
|
27046
|
+
for (const leaf2 of existing) {
|
|
27047
|
+
if (leaf2.view instanceof AgentChatView && leaf2.view.selectedAgentName === agentName) {
|
|
27048
|
+
this.app.workspace.revealLeaf(leaf2);
|
|
27049
|
+
return;
|
|
27050
|
+
}
|
|
27014
27051
|
}
|
|
27015
|
-
return;
|
|
27016
27052
|
}
|
|
27017
27053
|
const leaf = this.app.workspace.getRightLeaf(false) ?? this.app.workspace.getLeaf(true);
|
|
27018
|
-
await leaf.setViewState({ type: VIEW_TYPE_CHAT, active: true });
|
|
27054
|
+
await leaf.setViewState({ type: VIEW_TYPE_CHAT, active: true, state: agentName ? { agentName } : {} });
|
|
27019
27055
|
this.app.workspace.revealLeaf(leaf);
|
|
27020
27056
|
if (agentName && leaf.view instanceof AgentChatView) {
|
|
27021
27057
|
leaf.view.selectAgent(agentName);
|
|
@@ -27163,6 +27199,18 @@ ${output}`
|
|
|
27163
27199
|
this.addCommand({
|
|
27164
27200
|
id: "open-chat",
|
|
27165
27201
|
name: "Open Agent Chat",
|
|
27202
|
+
callback: () => {
|
|
27203
|
+
const existing = this.app.workspace.getLeavesOfType(VIEW_TYPE_CHAT);
|
|
27204
|
+
if (existing.length > 0) {
|
|
27205
|
+
this.app.workspace.revealLeaf(existing[0]);
|
|
27206
|
+
} else {
|
|
27207
|
+
void this.openChatView();
|
|
27208
|
+
}
|
|
27209
|
+
}
|
|
27210
|
+
});
|
|
27211
|
+
this.addCommand({
|
|
27212
|
+
id: "new-chat-tab",
|
|
27213
|
+
name: "New Chat Tab",
|
|
27166
27214
|
callback: () => void this.openChatView()
|
|
27167
27215
|
});
|
|
27168
27216
|
this.addCommand({
|