@opengeni/react 0.13.0 → 0.15.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.
Files changed (41) hide show
  1. package/README.md +19 -13
  2. package/dist/chunk-TOJR776I.js +2280 -0
  3. package/dist/chunk-TOJR776I.js.map +1 -0
  4. package/dist/index.d.ts +314 -255
  5. package/dist/index.js +5862 -4404
  6. package/dist/index.js.map +1 -1
  7. package/dist/{machines-CnlMb7E-.d.ts → machines-BpdwuQcD.d.ts} +130 -10
  8. package/dist/machines.d.ts +1 -1
  9. package/dist/machines.js +23 -1
  10. package/package.json +5 -2
  11. package/src/client.ts +10 -1
  12. package/src/components/chat-composer.tsx +309 -57
  13. package/src/components/machine-card.tsx +81 -15
  14. package/src/components/machine-health-pill.tsx +68 -0
  15. package/src/components/machine-metrics.tsx +10 -24
  16. package/src/components/machines/health.ts +146 -0
  17. package/src/components/machines/machine-detail.tsx +220 -0
  18. package/src/components/machines/metric-history-chart.tsx +298 -0
  19. package/src/components/machines/metric-sparkline.tsx +76 -0
  20. package/src/components/machines/series.ts +113 -0
  21. package/src/components/machines-dashboard.tsx +13 -1
  22. package/src/components/queue-surface.tsx +578 -0
  23. package/src/components/sandbox-files.tsx +94 -9
  24. package/src/components/sandbox-workspace.tsx +186 -52
  25. package/src/components/session-status.tsx +0 -6
  26. package/src/components/workbench-changes.tsx +64 -20
  27. package/src/components/workspace-dock.tsx +146 -55
  28. package/src/hooks/use-composer.ts +369 -39
  29. package/src/hooks/use-session-control.ts +6 -7
  30. package/src/hooks/use-session-events.ts +3 -2
  31. package/src/hooks/use-session-lineage.ts +15 -6
  32. package/src/hooks/use-session.ts +10 -2
  33. package/src/hooks/use-turn-queue.ts +175 -47
  34. package/src/index.ts +13 -7
  35. package/src/machines.ts +16 -0
  36. package/src/provider.tsx +192 -5
  37. package/src/timeline/parsers.ts +43 -6
  38. package/src/timeline/projection.ts +24 -2
  39. package/styles/index.css +22 -0
  40. package/dist/chunk-NFYVQWIB.js +0 -1377
  41. package/dist/chunk-NFYVQWIB.js.map +0 -1
@@ -148,17 +148,34 @@ export function v4aToGitFileDiff(op: ApplyPatchOperation): GitFileDiff {
148
148
  // `@@ -0,0 +1,N @@` from the range fields once newLines is counted — a
149
149
  // pre-baked partial header (e.g. `@@ +1 @@`) renders zero lines in a
150
150
  // generic unified-diff parser.
151
- cur = { oldStart: 0, oldLines: 0, newStart: 1, newLines: 0, header: "", lines: [] };
151
+ cur = {
152
+ oldStart: 0,
153
+ oldLines: 0,
154
+ newStart: 1,
155
+ newLines: 0,
156
+ header: "",
157
+ lines: [],
158
+ };
152
159
  hunks.push(cur);
153
160
  oldNo = 0;
154
161
  newNo = 1;
155
162
  }
156
163
  if (raw.startsWith("+")) {
157
- cur.lines.push({ type: "add", oldNo: null, newNo: newNo++, text: raw.slice(1) });
164
+ cur.lines.push({
165
+ type: "add",
166
+ oldNo: null,
167
+ newNo: newNo++,
168
+ text: raw.slice(1),
169
+ });
158
170
  cur.newLines += 1;
159
171
  additions += 1;
160
172
  } else if (raw.startsWith("-")) {
161
- cur.lines.push({ type: "del", oldNo: oldNo++, newNo: null, text: raw.slice(1) });
173
+ cur.lines.push({
174
+ type: "del",
175
+ oldNo: oldNo++,
176
+ newNo: null,
177
+ text: raw.slice(1),
178
+ });
162
179
  cur.oldLines += 1;
163
180
  deletions += 1;
164
181
  } else {
@@ -200,7 +217,10 @@ export function v4aToGitFileDiff(op: ApplyPatchOperation): GitFileDiff {
200
217
  * renderer and the turn-summary facet counter never drift.
201
218
  */
202
219
  export function applyPatchOps(raw: unknown): ApplyPatchOperation[] {
203
- const r = (raw ?? {}) as { operation?: ApplyPatchOperation; operations?: ApplyPatchOperation[] };
220
+ const r = (raw ?? {}) as {
221
+ operation?: ApplyPatchOperation;
222
+ operations?: ApplyPatchOperation[];
223
+ };
204
224
  if (Array.isArray(r.operations)) {
205
225
  return r.operations;
206
226
  }
@@ -264,7 +284,21 @@ export function tailPeek(text: string): string {
264
284
  * into a flat `{ text, isError }`. Non-MCP outputs pass through as their string
265
285
  * form.
266
286
  */
267
- export function unwrapMcpOutput(output: unknown): { text: string; isError: boolean } {
287
+ export function unwrapMcpOutput(output: unknown): {
288
+ text: string;
289
+ isError: boolean;
290
+ } {
291
+ // Managed MCP events persist a normalized single text part as
292
+ // `{ type: "text", text }`; accept it alongside the SDK-native content array.
293
+ if (
294
+ output &&
295
+ typeof output === "object" &&
296
+ (output as { type?: unknown }).type === "text" &&
297
+ typeof (output as { text?: unknown }).text === "string"
298
+ ) {
299
+ const record = output as { text: string; isError?: unknown };
300
+ return { text: record.text, isError: Boolean(record.isError) };
301
+ }
268
302
  if (output && typeof output === "object" && "content" in output) {
269
303
  const record = output as { content?: unknown; isError?: unknown };
270
304
  const isError = Boolean(record.isError);
@@ -273,7 +307,10 @@ export function unwrapMcpOutput(output: unknown): { text: string; isError: boole
273
307
  (part): part is { type: string; text: string } =>
274
308
  !!part && typeof part === "object" && (part as { type?: unknown }).type === "text",
275
309
  );
276
- return { text: textPart ? String(textPart.text) : JSON.stringify(output), isError };
310
+ return {
311
+ text: textPart ? String(textPart.text) : JSON.stringify(output),
312
+ isError,
313
+ };
277
314
  }
278
315
  return { text: JSON.stringify(output), isError };
279
316
  }
@@ -708,13 +708,13 @@ function prescanTurnAnchors(events: SessionEvent[]): TurnAnchorPrescan {
708
708
  cancelledTurnIds.add(turnId);
709
709
  }
710
710
 
711
- if (turnId && event.type !== "turn.queued" && event.type !== "turn.cancelled") {
711
+ if (turnId && isTurnExecutionEvidence(event.type)) {
712
712
  const previous = fallbackSeqByTurn.get(turnId);
713
713
  if (previous === undefined || event.sequence < previous) {
714
714
  fallbackSeqByTurn.set(turnId, event.sequence);
715
715
  }
716
716
  }
717
- if (turnId && isAgentActivityEvent(event.type)) {
717
+ if (turnId && isTurnExecutionEvidence(event.type)) {
718
718
  startedTurnIds.add(turnId);
719
719
  }
720
720
  }
@@ -798,6 +798,28 @@ function isAgentActivityEvent(type: string): boolean {
798
798
  return type.startsWith("agent.") || type.startsWith("sandbox.");
799
799
  }
800
800
 
801
+ /**
802
+ * Evidence that a queued prompt crossed the execution boundary when an older
803
+ * or partially recovered ledger is missing its canonical `turn.started`.
804
+ * Queue/control bookkeeping intentionally does not qualify: moving, editing,
805
+ * steering, or deleting a waiting row must never make its prompt appear in the
806
+ * transcript as though inference had begun.
807
+ */
808
+ function isTurnExecutionEvidence(type: string): boolean {
809
+ return (
810
+ isAgentActivityEvent(type) ||
811
+ type === "turn.completed" ||
812
+ type === "turn.failed" ||
813
+ type === "turn.recovery.requested" ||
814
+ type === "turn.capacity_waiting" ||
815
+ type === "session.requiresAction" ||
816
+ type === "tool.auth_needed" ||
817
+ type.startsWith("rig.setup.") ||
818
+ type === "codex.capacity.waiting" ||
819
+ type === "codex.capacity.resumed"
820
+ );
821
+ }
822
+
801
823
  function turnEndItem(
802
824
  event: SessionEvent,
803
825
  outcome: TurnEndItem["outcome"],
package/styles/index.css CHANGED
@@ -165,6 +165,28 @@
165
165
  }
166
166
  }
167
167
 
168
+ /* Metric-history line draw-in. The chart path carries `pathLength={1}`, so the
169
+ dash math is resolution-independent: one full-length dash whose offset animates
170
+ from 1 (hidden) to 0 (drawn). Degrades to a solid line if animations are off. */
171
+ @keyframes og-mh-draw {
172
+ from {
173
+ stroke-dashoffset: 1;
174
+ }
175
+ to {
176
+ stroke-dashoffset: 0;
177
+ }
178
+ }
179
+ .og-mh-draw {
180
+ stroke-dasharray: 1;
181
+ animation: og-mh-draw 900ms var(--og-ease-out) forwards;
182
+ }
183
+ @media (prefers-reduced-motion: reduce) {
184
+ .og-mh-draw {
185
+ animation: none;
186
+ stroke-dasharray: none;
187
+ }
188
+ }
189
+
168
190
  /* Shimmer helper: gradient text the keyframe scrolls through. */
169
191
  .og-shimmer-text {
170
192
  background: linear-gradient(