@cloudagentfleet/ui 0.1.3 → 0.1.7

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @cloudagentfleet/ui
2
2
 
3
+ ## 0.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e8300b3`](https://github.com/hirenf14/cloudagentfleet/commit/e8300b3321289b1544c1cd8026c01fb363ab666e) Thanks [@hirenf14](https://github.com/hirenf14)! - Keep Shell (raw CLI) in the agent list and clarify provider CLI labels in Start session.
8
+
9
+ - [`e8300b3`](https://github.com/hirenf14/cloudagentfleet/commit/e8300b3321289b1544c1cd8026c01fb363ab666e) Thanks [@hirenf14](https://github.com/hirenf14)! - Use cloudagentfleet consistently in CLI help and Hub branding (hosted-agents remains a compatibility alias).
10
+
11
+ ## 0.1.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [`c917cb8`](https://github.com/hirenf14/cloudagentfleet/commit/c917cb83c20000d1d42a4a4eeefde5c9935f1a6b) Thanks [@hirenf14](https://github.com/hirenf14)! - Add GitHub repository, homepage, and bugs links to published packages.
16
+
3
17
  ## 0.1.3
4
18
 
5
19
  ### Patch Changes
@@ -753,29 +753,40 @@
753
753
  const readyWorkspaces = (instance?.workspaces || []).filter((workspace) => workspace.health === "ready");
754
754
  const allAgents = instance?.agents || [];
755
755
  const readyAgents = allAgents.filter((agent) => agent.ready);
756
- const [workspaceSource, setWorkspaceSource] = useState("workspace");
756
+ const [workspaceSource, setWorkspaceSource] = useState(
757
+ readyWorkspaces.length ? "workspace" : (instance?.workspacePolicy ? "path" : "workspace"),
758
+ );
757
759
  const [workspaceId, setWorkspaceId] = useState(readyWorkspaces[0]?.id || "");
758
760
  const [workspacePath, setWorkspacePath] = useState("");
759
761
  const [pathSuggestions, setPathSuggestions] = useState([]);
760
762
  const [activeSuggestion, setActiveSuggestion] = useState(-1);
761
763
  const [suggesting, setSuggesting] = useState(false);
762
764
  const [suggestionError, setSuggestionError] = useState("");
763
- const [agentId, setAgentId] = useState(readyAgents[0]?.id || "");
765
+ const [agentId, setAgentId] = useState(preferredAgentId(readyAgents, allAgents));
764
766
  const [title, setTitle] = useState("");
765
767
  const [creating, setCreating] = useState(false);
766
768
 
767
769
  useEffect(() => {
768
770
  const nextWorkspaces = (instance?.workspaces || []).filter((workspace) => workspace.health === "ready");
769
- const nextAgents = (instance?.agents || []).filter((agent) => agent.ready);
770
- setWorkspaceSource("workspace");
771
+ const nextAgents = instance?.agents || [];
772
+ const nextReady = nextAgents.filter((agent) => agent.ready);
773
+ setWorkspaceSource(nextWorkspaces.length ? "workspace" : (instance?.workspacePolicy ? "path" : "workspace"));
771
774
  setWorkspaceId(nextWorkspaces[0]?.id || "");
772
775
  setWorkspacePath("");
773
776
  setPathSuggestions([]);
774
777
  setActiveSuggestion(-1);
775
778
  setSuggestionError("");
776
- setAgentId(nextAgents[0]?.id || "");
779
+ setAgentId(preferredAgentId(nextReady, nextAgents));
777
780
  }, [instanceId]);
778
781
 
782
+ useEffect(() => {
783
+ const nextAgents = instance?.agents || [];
784
+ const nextReady = nextAgents.filter((agent) => agent.ready);
785
+ if (!nextAgents.some((agent) => agent.id === agentId)) {
786
+ setAgentId(preferredAgentId(nextReady, nextAgents));
787
+ }
788
+ }, [instance?.agents, agentId]);
789
+
779
790
  useEffect(() => {
780
791
  if (workspaceSource !== "path" || !instance?.workspacePolicy) {
781
792
  setPathSuggestions([]);
@@ -834,7 +845,14 @@
834
845
  async function createSession(event) {
835
846
  event.preventDefault();
836
847
  const path = workspacePath.trim();
837
- if (!instance || (!workspaceId && workspaceSource === "workspace") || (!path && workspaceSource === "path") || !agentId) return;
848
+ const selectedAgent = allAgents.find((agent) => agent.id === agentId);
849
+ if (
850
+ !instance
851
+ || (!workspaceId && workspaceSource === "workspace")
852
+ || (!path && workspaceSource === "path")
853
+ || !selectedAgent
854
+ || !selectedAgent.ready
855
+ ) return;
838
856
  setCreating(true);
839
857
  try {
840
858
  const result = await api(`/api/instances/${encodeURIComponent(instance.id)}/sessions`, {
@@ -886,7 +904,7 @@
886
904
  h(
887
905
  "select",
888
906
  { value: workspaceSource, onChange: (event) => setWorkspaceSource(event.target.value), required: true },
889
- h("option", { value: "workspace" }, "Known workspace"),
907
+ h("option", { value: "workspace", disabled: readyWorkspaces.length === 0 }, "Known workspace"),
890
908
  h("option", { value: "path", disabled: !instance?.workspacePolicy }, "Enter a path (policy required)"),
891
909
  ),
892
910
  ),
@@ -956,18 +974,30 @@
956
974
  h("span", null, "Agent"),
957
975
  h(
958
976
  "select",
959
- { value: agentId, onChange: (event) => setAgentId(event.target.value), required: true, disabled: readyAgents.length === 0 },
960
- readyAgents.length
977
+ {
978
+ value: agentId,
979
+ onChange: (event) => setAgentId(event.target.value),
980
+ required: true,
981
+ disabled: allAgents.length === 0,
982
+ },
983
+ allAgents.length
961
984
  ? allAgents.map((agent) => h(
962
985
  "option",
963
986
  { value: agent.id, key: agent.id, disabled: !agent.ready },
964
- agent.ready ? agent.name : `${agent.name} (not ready)`,
987
+ formatAgentOption(agent),
965
988
  ))
966
- : h("option", { value: "" }, "No ready agents"),
989
+ : h("option", { value: "" }, "No agents advertised yet"),
990
+ ),
991
+ allAgents.length > 0 && h(
992
+ "small",
993
+ null,
994
+ "Shell (raw CLI) is a bare Codeman terminal. CLI options launch a provider inside that shell.",
967
995
  ),
968
996
  ),
969
997
  !readyAgents.length && allAgents.length > 0
970
- && h("small", null, "Install and authenticate a provider CLI on this Worker before starting a session."),
998
+ && h("small", null, "No ready agents yet — check Worker Codeman mode, or install/authenticate a provider CLI."),
999
+ !allAgents.length
1000
+ && h("small", null, "Run Check health on the instance after the Worker is online."),
971
1001
  h(
972
1002
  "label",
973
1003
  { className: "field" },
@@ -985,7 +1015,7 @@
985
1015
  || !instance
986
1016
  || instance.status !== "online"
987
1017
  || (workspaceSource === "workspace" ? !workspaceId : !workspacePath.trim())
988
- || !agentId,
1018
+ || !readyAgents.some((agent) => agent.id === agentId),
989
1019
  }, creating ? "Starting…" : "Start session"),
990
1020
  ),
991
1021
  ),
@@ -993,5 +1023,21 @@
993
1023
  );
994
1024
  }
995
1025
 
1026
+ function preferredAgentId(readyAgents, allAgents = readyAgents) {
1027
+ const preferred = readyAgents.find((agent) => agent.id === "shell")
1028
+ || readyAgents.find((agent) => agent.mode === "shell")
1029
+ || readyAgents[0]
1030
+ || allAgents[0];
1031
+ return preferred?.id || "";
1032
+ }
1033
+
1034
+ function formatAgentOption(agent) {
1035
+ const base = agent.name || agent.id;
1036
+ const modeNote = agent.mode && agent.mode !== agent.id && !String(base).toLowerCase().includes(agent.mode)
1037
+ ? ` · ${agent.mode}`
1038
+ : "";
1039
+ return agent.ready ? `${base}${modeNote}` : `${base}${modeNote} (not ready)`;
1040
+ }
1041
+
996
1042
  ReactDOM.createRoot(document.getElementById("root")).render(h(App));
997
1043
  })();
@@ -21,7 +21,7 @@
21
21
  "font:13px system-ui,sans-serif",
22
22
  ].join(";");
23
23
  const label = document.createElement("strong");
24
- label.textContent = "Hosted Agents";
24
+ label.textContent = "Cloud Agent Fleet";
25
25
  const select = document.createElement("select");
26
26
  select.setAttribute("aria-label", "Codeman host");
27
27
  select.style.cssText = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudagentfleet/ui",
3
- "version": "0.1.3",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "description": "Cloud Agent Fleet Hub UI assets.",
6
6
  "files": [
@@ -12,6 +12,15 @@
12
12
  "./package.json": "./package.json",
13
13
  "./public/*": "./dist/public/*"
14
14
  },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/hirenf14/cloudagentfleet.git",
18
+ "directory": "apps/dashboard"
19
+ },
20
+ "homepage": "https://github.com/hirenf14/cloudagentfleet/tree/master/apps/dashboard#readme",
21
+ "bugs": {
22
+ "url": "https://github.com/hirenf14/cloudagentfleet/issues"
23
+ },
15
24
  "publishConfig": {
16
25
  "access": "public",
17
26
  "registry": "https://registry.npmjs.org/"