@poncho-ai/cli 0.19.1 → 0.20.0

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @poncho-ai/cli@0.19.1 build /home/runner/work/poncho-ai/poncho-ai/packages/cli
2
+ > @poncho-ai/cli@0.20.0 build /home/runner/work/poncho-ai/poncho-ai/packages/cli
3
3
  > tsup src/index.ts src/cli.ts --format esm --dts
4
4
 
5
5
  CLI Building entry: src/cli.ts, src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
10
  ESM dist/cli.js 94.00 B
11
- ESM dist/run-interactive-ink-4KVVPMR3.js 55.30 KB
12
- ESM dist/chunk-7P53QSP5.js 381.82 KB
13
11
  ESM dist/index.js 857.00 B
14
- ESM ⚡️ Build success in 60ms
12
+ ESM dist/run-interactive-ink-6OB3RT32.js 55.30 KB
13
+ ESM dist/chunk-RWLTBPVI.js 382.88 KB
14
+ ESM ⚡️ Build success in 65ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3716ms
16
+ DTS ⚡️ Build success in 3728ms
17
17
  DTS dist/cli.d.ts 20.00 B
18
18
  DTS dist/index.d.ts 3.59 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @poncho-ai/cli
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5df6b5f`](https://github.com/cesr/poncho-ai/commit/5df6b5fcdc98e0445bea504dc9d077f02d1e954f) Thanks [@cesr](https://github.com/cesr)! - Add polling fallback for web UI on serverless deployments: when the SSE event stream is unavailable (different instance from the webhook handler), the UI polls the conversation every 2 seconds until the run completes. Conversations now track a persisted `runStatus` field.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`5df6b5f`](https://github.com/cesr/poncho-ai/commit/5df6b5fcdc98e0445bea504dc9d077f02d1e954f)]:
12
+ - @poncho-ai/harness@0.20.0
13
+
3
14
  ## 0.19.1
4
15
 
5
16
  ### Patch Changes
@@ -2493,8 +2493,7 @@ var getWebUiClientScript = (markedSource2) => `
2493
2493
  setStreaming(true);
2494
2494
  streamConversationEvents(conversationId, { liveOnly: true }).finally(() => {
2495
2495
  if (state.activeConversationId === conversationId) {
2496
- setStreaming(false);
2497
- renderMessages(state.activeMessages, false);
2496
+ pollUntilRunIdle(conversationId);
2498
2497
  }
2499
2498
  });
2500
2499
  }
@@ -2561,6 +2560,30 @@ var getWebUiClientScript = (markedSource2) => `
2561
2560
  });
2562
2561
  };
2563
2562
 
2563
+ const pollUntilRunIdle = (conversationId) => {
2564
+ const poll = async () => {
2565
+ if (state.activeConversationId !== conversationId) return;
2566
+ try {
2567
+ var payload = await api("/api/conversations/" + encodeURIComponent(conversationId));
2568
+ if (state.activeConversationId !== conversationId) return;
2569
+ if (payload.conversation) {
2570
+ state.activeMessages = payload.conversation.messages || [];
2571
+ renderMessages(state.activeMessages, payload.hasActiveRun);
2572
+ }
2573
+ if (payload.hasActiveRun) {
2574
+ setTimeout(poll, 2000);
2575
+ } else {
2576
+ setStreaming(false);
2577
+ renderMessages(state.activeMessages, false);
2578
+ }
2579
+ } catch {
2580
+ setStreaming(false);
2581
+ renderMessages(state.activeMessages, false);
2582
+ }
2583
+ };
2584
+ setTimeout(poll, 1500);
2585
+ };
2586
+
2564
2587
  const streamConversationEvents = (conversationId, options) => {
2565
2588
  const liveOnly = options && options.liveOnly;
2566
2589
  return new Promise((resolve) => {
@@ -7922,6 +7945,7 @@ var createRequestHandler = async (options) => {
7922
7945
  };
7923
7946
  await updateConversation((c) => {
7924
7947
  c.messages = [...historyMessages, { role: "user", content: userContent }];
7948
+ c.runStatus = "running";
7925
7949
  });
7926
7950
  let latestRunId = "";
7927
7951
  let assistantResponse = "";
@@ -8072,9 +8096,14 @@ var createRequestHandler = async (options) => {
8072
8096
  c.messages = buildMessages();
8073
8097
  c.runtimeRunId = latestRunId || c.runtimeRunId;
8074
8098
  c.pendingApprovals = [];
8099
+ c.runStatus = "idle";
8075
8100
  if (runContextTokens > 0) c.contextTokens = runContextTokens;
8076
8101
  if (runContextWindow > 0) c.contextWindow = runContextWindow;
8077
8102
  });
8103
+ } else {
8104
+ await updateConversation((c) => {
8105
+ c.runStatus = "idle";
8106
+ });
8078
8107
  }
8079
8108
  finishConversationStream(conversationId);
8080
8109
  if (latestRunId) {
@@ -8697,7 +8726,7 @@ data: ${JSON.stringify(data)}
8697
8726
  }
8698
8727
  }
8699
8728
  const activeStream = conversationEventStreams.get(conversationId);
8700
- const hasActiveRun = !!activeStream && !activeStream.finished;
8729
+ const hasActiveRun = !!activeStream && !activeStream.finished || conversation.runStatus === "running";
8701
8730
  writeJson(response, 200, {
8702
8731
  conversation: {
8703
8732
  ...conversation,
@@ -9620,7 +9649,7 @@ var runInteractive = async (workingDir, params) => {
9620
9649
  await harness.initialize();
9621
9650
  const identity = await ensureAgentIdentity2(workingDir);
9622
9651
  try {
9623
- const { runInteractiveInk } = await import("./run-interactive-ink-4KVVPMR3.js");
9652
+ const { runInteractiveInk } = await import("./run-interactive-ink-6OB3RT32.js");
9624
9653
  await runInteractiveInk({
9625
9654
  harness,
9626
9655
  params,
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "./chunk-7P53QSP5.js";
4
+ } from "./chunk-RWLTBPVI.js";
5
5
 
6
6
  // src/cli.ts
7
7
  void main();
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  runTests,
24
24
  startDevServer,
25
25
  updateAgentGuidance
26
- } from "./chunk-7P53QSP5.js";
26
+ } from "./chunk-RWLTBPVI.js";
27
27
  export {
28
28
  addSkill,
29
29
  buildCli,
@@ -2,7 +2,7 @@ import {
2
2
  consumeFirstRunIntro,
3
3
  inferConversationTitle,
4
4
  resolveHarnessEnvironment
5
- } from "./chunk-7P53QSP5.js";
5
+ } from "./chunk-RWLTBPVI.js";
6
6
 
7
7
  // src/run-interactive-ink.ts
8
8
  import * as readline from "readline";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/cli",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
4
4
  "description": "CLI for building and deploying AI agents",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  "react": "^19.2.4",
28
28
  "react-devtools-core": "^6.1.5",
29
29
  "yaml": "^2.8.1",
30
- "@poncho-ai/harness": "0.19.1",
31
- "@poncho-ai/sdk": "1.4.0",
32
- "@poncho-ai/messaging": "0.2.7"
30
+ "@poncho-ai/harness": "0.20.0",
31
+ "@poncho-ai/messaging": "0.2.7",
32
+ "@poncho-ai/sdk": "1.4.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/busboy": "^1.5.4",
package/src/index.ts CHANGED
@@ -2148,9 +2148,10 @@ export const createRequestHandler = async (options?: {
2148
2148
  await conversationStore.update(fresh);
2149
2149
  };
2150
2150
 
2151
- // Persist user turn immediately so the web UI shows it while the agent runs.
2151
+ // Persist user turn and mark the run as active so the web UI can detect it.
2152
2152
  await updateConversation((c) => {
2153
2153
  c.messages = [...historyMessages, { role: "user" as const, content: userContent }];
2154
+ c.runStatus = "running";
2154
2155
  });
2155
2156
 
2156
2157
  let latestRunId = "";
@@ -2317,9 +2318,14 @@ export const createRequestHandler = async (options?: {
2317
2318
  c.messages = buildMessages();
2318
2319
  c.runtimeRunId = latestRunId || c.runtimeRunId;
2319
2320
  c.pendingApprovals = [];
2321
+ c.runStatus = "idle";
2320
2322
  if (runContextTokens > 0) c.contextTokens = runContextTokens;
2321
2323
  if (runContextWindow > 0) c.contextWindow = runContextWindow;
2322
2324
  });
2325
+ } else {
2326
+ await updateConversation((c) => {
2327
+ c.runStatus = "idle";
2328
+ });
2323
2329
  }
2324
2330
  finishConversationStream(conversationId);
2325
2331
  if (latestRunId) {
@@ -3057,7 +3063,7 @@ export const createRequestHandler = async (options?: {
3057
3063
  }
3058
3064
  }
3059
3065
  const activeStream = conversationEventStreams.get(conversationId);
3060
- const hasActiveRun = !!activeStream && !activeStream.finished;
3066
+ const hasActiveRun = (!!activeStream && !activeStream.finished) || conversation.runStatus === "running";
3061
3067
  writeJson(response, 200, {
3062
3068
  conversation: {
3063
3069
  ...conversation,
@@ -962,8 +962,7 @@ export const getWebUiClientScript = (markedSource: string): string => `
962
962
  setStreaming(true);
963
963
  streamConversationEvents(conversationId, { liveOnly: true }).finally(() => {
964
964
  if (state.activeConversationId === conversationId) {
965
- setStreaming(false);
966
- renderMessages(state.activeMessages, false);
965
+ pollUntilRunIdle(conversationId);
967
966
  }
968
967
  });
969
968
  }
@@ -1030,6 +1029,30 @@ export const getWebUiClientScript = (markedSource: string): string => `
1030
1029
  });
1031
1030
  };
1032
1031
 
1032
+ const pollUntilRunIdle = (conversationId) => {
1033
+ const poll = async () => {
1034
+ if (state.activeConversationId !== conversationId) return;
1035
+ try {
1036
+ var payload = await api("/api/conversations/" + encodeURIComponent(conversationId));
1037
+ if (state.activeConversationId !== conversationId) return;
1038
+ if (payload.conversation) {
1039
+ state.activeMessages = payload.conversation.messages || [];
1040
+ renderMessages(state.activeMessages, payload.hasActiveRun);
1041
+ }
1042
+ if (payload.hasActiveRun) {
1043
+ setTimeout(poll, 2000);
1044
+ } else {
1045
+ setStreaming(false);
1046
+ renderMessages(state.activeMessages, false);
1047
+ }
1048
+ } catch {
1049
+ setStreaming(false);
1050
+ renderMessages(state.activeMessages, false);
1051
+ }
1052
+ };
1053
+ setTimeout(poll, 1500);
1054
+ };
1055
+
1033
1056
  const streamConversationEvents = (conversationId, options) => {
1034
1057
  const liveOnly = options && options.liveOnly;
1035
1058
  return new Promise((resolve) => {