skydive-cli 0.1.0-beta.351 → 0.1.0-beta.353

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/js/bin.mjs CHANGED
@@ -16,7 +16,7 @@ import zlib from "node:zlib";
16
16
  import os from "node:os";
17
17
 
18
18
  //#region package.json
19
- var version$1 = "0.1.0-beta.351";
19
+ var version$1 = "0.1.0-beta.353";
20
20
 
21
21
  //#endregion
22
22
  //#region src/types.ts
@@ -1033,15 +1033,6 @@ function createRestClient({ appUrl, sessionToken }) {
1033
1033
  ...input,
1034
1034
  clientSurface
1035
1035
  }, sendResultSchema),
1036
- activeRun: async ({ conversationId }) => {
1037
- const { run } = await get(`/api/v1/chat/active-run?${new URLSearchParams({ conversationId }).toString()}`, activeRunResponseSchema);
1038
- if (!run) return null;
1039
- return {
1040
- runId: run.runId,
1041
- agentId: run.agentId ?? "",
1042
- agentName: run.agentName ?? ""
1043
- };
1044
- },
1045
1036
  cancelRun: async ({ runId }) => {
1046
1037
  await post(`/api/v1/chat/runs/${encodeURIComponent(runId)}/cancel`, {}, z.object({ ok: z.boolean() }));
1047
1038
  },
@@ -1236,11 +1227,6 @@ const finalizeResponseSchema = z.object({
1236
1227
  mediaType: z.string(),
1237
1228
  sizeBytes: z.number().nullable().optional()
1238
1229
  });
1239
- const activeRunResponseSchema = z.object({ run: z.object({
1240
- runId: z.string(),
1241
- agentId: z.string().nullish(),
1242
- agentName: z.string().nullish()
1243
- }).nullable() });
1244
1230
  const oauthConnectResponseSchema = z.object({ connectLink: z.string() }).passthrough();
1245
1231
  const externalOauthConnectResponseSchema = z.object({ authorizationUrl: z.string().optional() }).passthrough();
1246
1232
  const runStreamEventSchema = z.union([z.object({
@@ -1252,11 +1238,14 @@ const runStreamEventSchema = z.union([z.object({
1252
1238
  error: z.string().nullish()
1253
1239
  })]);
1254
1240
  const streamErrorSchema = z.object({ error: z.string() });
1255
- const conversationStreamEventSchema = z.object({
1241
+ const conversationStreamEventSchema = z.discriminatedUnion("kind", [z.object({
1256
1242
  kind: z.literal("conversation"),
1257
1243
  id: z.string(),
1258
1244
  title: z.string().nullable()
1259
- });
1245
+ }), z.object({
1246
+ kind: z.literal("run"),
1247
+ runId: z.string()
1248
+ })]);
1260
1249
 
1261
1250
  //#endregion
1262
1251
  //#region src/commands/session.ts
@@ -2622,7 +2611,7 @@ const chatCommand = {
2622
2611
  printError(`Unknown theme "${themeId}". Valid themes: ${themes.map((t) => t.id).join(", ")}`);
2623
2612
  process.exit(1);
2624
2613
  }
2625
- const { runChat } = await import("./boot-C2plQe9S.mjs");
2614
+ const { runChat } = await import("./boot-DLHvjtxn.mjs");
2626
2615
  await runChat({
2627
2616
  appUrl,
2628
2617
  sessionToken: session.value.sessionToken,
@@ -3416,7 +3405,7 @@ const switchCommand = {
3416
3405
  printError("The workspace picker needs the Bun runtime and it could not be set up automatically. Pass a workspace slug instead, or install Bun and retry.");
3417
3406
  process.exit(1);
3418
3407
  }
3419
- const { runWorkspacePicker } = await import("./boot-C2plQe9S.mjs");
3408
+ const { runWorkspacePicker } = await import("./boot-DLHvjtxn.mjs");
3420
3409
  await runWorkspacePicker(session);
3421
3410
  return;
3422
3411
  }
@@ -5648,6 +5648,7 @@ function ChatScreen({ agent, conversation }) {
5648
5648
  inputRef.current = input;
5649
5649
  const credPromptRef = useRef(credPrompt);
5650
5650
  credPromptRef.current = credPrompt;
5651
+ const seenRunsRef = useRef(/* @__PURE__ */ new Set());
5651
5652
  const shellSessionRef = useRef(null);
5652
5653
  const hostState = grantPrompt || credPrompt ? "blocked" : run.kind === "idle" ? "idle" : "working";
5653
5654
  useEffect(() => {
@@ -5721,6 +5722,7 @@ function ChatScreen({ agent, conversation }) {
5721
5722
  }, [rest, initialConversationId]);
5722
5723
  const attachToRun = useCallback((runId, runAgentName) => {
5723
5724
  if (!rest) return;
5725
+ seenRunsRef.current.add(runId);
5724
5726
  const abort = new AbortController();
5725
5727
  const responsePreview = createResponsePreview();
5726
5728
  const streamAgentName = runAgentName ?? agent.name;
@@ -5781,6 +5783,12 @@ function ChatScreen({ agent, conversation }) {
5781
5783
  conversationId,
5782
5784
  signal: abort.signal,
5783
5785
  onEvent: (event) => {
5786
+ if (event.kind === "run") {
5787
+ if (seenRunsRef.current.has(event.runId)) return;
5788
+ if (runRef.current.kind !== "idle") return;
5789
+ attachToRun(event.runId);
5790
+ return;
5791
+ }
5784
5792
  if (event.title) setChatTitle(event.title);
5785
5793
  }
5786
5794
  }).catch(() => {});
@@ -5788,22 +5796,9 @@ function ChatScreen({ agent, conversation }) {
5788
5796
  }, [
5789
5797
  rest,
5790
5798
  conversationId,
5791
- setChatTitle
5799
+ setChatTitle,
5800
+ attachToRun
5792
5801
  ]);
5793
- useEffect(() => {
5794
- if (!rest || !conversationId) return;
5795
- let cancelled = false;
5796
- (async () => {
5797
- try {
5798
- const active = await rest.activeRun({ conversationId });
5799
- if (cancelled || !active) return;
5800
- attachToRun(active.runId, active.agentName || null);
5801
- } catch (_error) {}
5802
- })();
5803
- return () => {
5804
- cancelled = true;
5805
- };
5806
- }, []);
5807
5802
  const sendContent = useCallback(async (content, staged, opts) => {
5808
5803
  if (!rest) return;
5809
5804
  const trimmed = content.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skydive-cli",
3
- "version": "0.1.0-beta.351",
3
+ "version": "0.1.0-beta.353",
4
4
  "description": "Skydive CLI — manage AI agents from the command line",
5
5
  "homepage": "https://skydive.com",
6
6
  "license": "MIT",