@timurproko/a1 0.1.8-dev.9a04818 → 0.1.8-dev.ade9b77

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.
@@ -5,7 +5,7 @@
5
5
  "platform": "darwin",
6
6
  "architecture": "arm64",
7
7
  "capability": "unsupported",
8
- "builtAt": "2026-08-25T07:10:19.265Z",
8
+ "builtAt": "2026-08-25T06:52:40.013Z",
9
9
  "artifact": {
10
10
  "filename": "process-guardian",
11
11
  "sha256": "7524bf568992517f50ed53196c861c5edeba0d7275633bb4735ab45bd5963a28",
@@ -5,7 +5,7 @@
5
5
  "platform": "linux",
6
6
  "architecture": "x64",
7
7
  "capability": "supported",
8
- "builtAt": "2026-08-25T07:10:17.791Z",
8
+ "builtAt": "2026-08-25T06:52:58.359Z",
9
9
  "artifact": {
10
10
  "filename": "process-guardian",
11
11
  "sha256": "29e22fe29de2828982bc67ef418c4adcaab1490281477b7bea592ec6fe621bcd",
@@ -5,10 +5,10 @@
5
5
  "platform": "win32",
6
6
  "architecture": "x64",
7
7
  "capability": "supported",
8
- "builtAt": "2026-08-25T07:11:29.829Z",
8
+ "builtAt": "2026-08-25T06:54:04.992Z",
9
9
  "artifact": {
10
10
  "filename": "process-guardian.exe",
11
- "sha256": "2c1bb33c431cec4d90f29ff5fdf6575a62e19f868a8d1dd4bc09f097d60d5550",
11
+ "sha256": "b8b0c81f275bd95b0cf4a63dd19f734a845947e47feded1d85a7a3562cf072db",
12
12
  "size": 172544
13
13
  },
14
14
  "provenance": {
@@ -11,12 +11,6 @@ import { createPiRuntimeIntegration } from "./runtime-integration.js";
11
11
  import { PiSessionCommandIntegration } from "./session-integration.js";
12
12
  import { PiSettingsIntegration } from "./settings-integration.js";
13
13
  const execFileAsync = promisify(execFile);
14
- /**
15
- * Engine events delivered before the queue hands the event loop a turn. Small enough
16
- * that a streaming burst never holds input, large enough that an ordinary turn is one
17
- * batch.
18
- */
19
- const EVENT_DELIVERY_BATCH = 16;
20
14
  const DEFAULT_SURFACE = {
21
15
  columns: 100,
22
16
  rows: 32,
@@ -67,8 +61,6 @@ export class PiEngineAdapter {
67
61
  #eventQueue = [];
68
62
  #eventQueueProcessing;
69
63
  #droppedEventCount = 0;
70
- #agentRunActive = false;
71
- #statusKind = null;
72
64
  #sessionCommands;
73
65
  #gitBranch = null;
74
66
  #extensionUi;
@@ -1359,8 +1351,6 @@ export class PiEngineAdapter {
1359
1351
  submitEnabled: true,
1360
1352
  };
1361
1353
  this.#status = { ...this.#status, workingMessage: null, badges: [] };
1362
- this.#statusKind = null;
1363
- this.#agentRunActive = false;
1364
1354
  this.#activeModel = readModel(session.model);
1365
1355
  this.#reconcileActiveModelAvailability();
1366
1356
  this.#thinkingLevel = readThinkingLevel(session.thinkingLevel);
@@ -1413,45 +1403,15 @@ export class PiEngineAdapter {
1413
1403
  this.#emitView();
1414
1404
  }
1415
1405
  }
1416
- /** Shows the state named by `kind`, which becomes the state a later end can clear. */
1417
- #enterWorkState(kind, message) {
1418
- const wasBusy = this.#lifecycle === "busy";
1419
- this.#statusKind = kind;
1420
- this.#lifecycle = "busy";
1421
- this.#status = { ...this.#status, workingMessage: message };
1422
- if (!wasBusy)
1423
- this.#emitEvent({ type: "session-lifecycle", lifecycle: "busy", reason: null });
1424
- this.#emitEvent({ type: "status", status: this.#status });
1425
- }
1426
- /**
1427
- * Ends one named state. A state the shell is not in is left alone, so a finished
1428
- * compaction or retry cannot clear the working state it never replaced. While the run
1429
- * continues, ending either of those returns to working rather than to idle.
1430
- */
1431
- #endWorkState(kind) {
1432
- if (this.#statusKind !== kind)
1433
- return;
1434
- if (this.#agentRunActive) {
1435
- this.#enterWorkState("working", "Working...");
1436
- return;
1437
- }
1438
- this.#leaveWorkStates();
1439
- }
1440
- /** Leaves every work state and reports the session idle. */
1441
- #leaveWorkStates() {
1442
- this.#statusKind = null;
1443
- this.#lifecycle = "ready";
1444
- this.#status = { ...this.#status, workingMessage: null };
1445
- this.#emitEvent({ type: "session-lifecycle", lifecycle: "ready", reason: null });
1446
- this.#emitEvent({ type: "status", status: this.#status });
1447
- }
1448
1406
  #handlePiEvent(event) {
1449
1407
  if (!isRecord(event) || typeof event.type !== "string")
1450
1408
  return;
1451
1409
  switch (event.type) {
1452
1410
  case "agent_start":
1453
- this.#agentRunActive = true;
1454
- this.#enterWorkState("working", "Working...");
1411
+ this.#lifecycle = "busy";
1412
+ this.#status = { ...this.#status, workingMessage: "Working..." };
1413
+ this.#emitEvent({ type: "session-lifecycle", lifecycle: "busy", reason: null });
1414
+ this.#emitEvent({ type: "status", status: this.#status });
1455
1415
  return;
1456
1416
  case "message_start":
1457
1417
  this.#upsertMessageBlock(event.message, "live");
@@ -1494,17 +1454,10 @@ export class PiEngineAdapter {
1494
1454
  this.#rebuildTranscript(finalMessages, "finalized");
1495
1455
  else
1496
1456
  this.#transcript = this.#transcript.map(block => block.status === "live" ? { ...block, status: "finalized" } : block);
1497
- // Ending a turn leaves the working state, as the recorded pinned baseline does, but
1498
- // it leaves only that state: a compaction or retry being shown outlives the turn
1499
- // that ended under it. Settlement ends the run, and with it every state — the
1500
- // engine ends a turn for each continuation it makes and settles once.
1501
- if (event.type === "agent_settled") {
1502
- this.#agentRunActive = false;
1503
- this.#leaveWorkStates();
1504
- }
1505
- else if (this.#statusKind === null || this.#statusKind === "working") {
1506
- this.#leaveWorkStates();
1507
- }
1457
+ this.#lifecycle = "ready";
1458
+ this.#status = { ...this.#status, workingMessage: null };
1459
+ this.#emitEvent({ type: "session-lifecycle", lifecycle: "ready", reason: null });
1460
+ this.#emitEvent({ type: "status", status: this.#status });
1508
1461
  this.#emitView();
1509
1462
  return;
1510
1463
  }
@@ -1520,16 +1473,20 @@ export class PiEngineAdapter {
1520
1473
  return;
1521
1474
  }
1522
1475
  case "auto_retry_start":
1523
- this.#enterWorkState("retry", "Retrying…");
1476
+ this.#lifecycle = "busy";
1477
+ this.#status = { ...this.#status, workingMessage: "Retrying…" };
1478
+ this.#emitEvent({ type: "status", status: this.#status });
1524
1479
  return;
1525
1480
  case "auto_retry_end":
1526
- this.#endWorkState("retry");
1481
+ case "compaction_end":
1482
+ this.#lifecycle = "ready";
1483
+ this.#status = { ...this.#status, workingMessage: null };
1484
+ this.#emitEvent({ type: "status", status: this.#status });
1527
1485
  return;
1528
1486
  case "compaction_start":
1529
- this.#enterWorkState("compaction", "Compacting…");
1530
- return;
1531
- case "compaction_end":
1532
- this.#endWorkState("compaction");
1487
+ this.#lifecycle = "busy";
1488
+ this.#status = { ...this.#status, workingMessage: "Compacting…" };
1489
+ this.#emitEvent({ type: "status", status: this.#status });
1533
1490
  return;
1534
1491
  case "thinking_level_changed":
1535
1492
  this.#thinkingLevel = readThinkingLevel(event.level);
@@ -1891,7 +1848,6 @@ export class PiEngineAdapter {
1891
1848
  }
1892
1849
  async #processEventQueue() {
1893
1850
  try {
1894
- let deliveredSinceYield = 0;
1895
1851
  while (this.#eventQueue.length > 0) {
1896
1852
  const event = this.#eventQueue.shift();
1897
1853
  if (!event)
@@ -1904,14 +1860,6 @@ export class PiEngineAdapter {
1904
1860
  this.#recordDiagnostic("warning", "event-listener", error instanceof Error ? error.message : String(error), true);
1905
1861
  }
1906
1862
  }
1907
- deliveredSinceYield += 1;
1908
- // A microtask chain runs to exhaustion before the loop turns, so a streaming
1909
- // burst would hold typed input, pointer reports, and timed indicators until it
1910
- // drained. Yielding on a macrotask hands those their turn between batches.
1911
- if (deliveredSinceYield >= EVENT_DELIVERY_BATCH && this.#eventQueue.length > 0) {
1912
- deliveredSinceYield = 0;
1913
- await new Promise(resolve => { setImmediate(resolve); });
1914
- }
1915
1863
  }
1916
1864
  }
1917
1865
  finally {
@@ -638,10 +638,8 @@ export class OwnedUiSessionShell {
638
638
  });
639
639
  this.root.editor.setAutocompleteCommands(this.backend.workflowAutocompleteCommands());
640
640
  this.#unsubscribe = this.backend.onEvent(event => {
641
- // One view read per event: the model is built by the backend, and building it
642
- // twice per streamed chunk is what made a long session cost more per chunk.
643
- const view = this.#syncView();
644
- if (view.lifecycle === "ready" && this.#compactionQueue.length > 0)
641
+ this.#syncView();
642
+ if (this.view().lifecycle === "ready" && this.#compactionQueue.length > 0)
645
643
  void this.#flushCompactionQueue();
646
644
  if (event.type === "session-lifecycle" && event.lifecycle === "stopped")
647
645
  this.#resolveStopped?.();
@@ -1259,7 +1257,6 @@ export class OwnedUiSessionShell {
1259
1257
  this.runtime.requestRender();
1260
1258
  for (const listener of this.#listeners)
1261
1259
  listener(view);
1262
- return view;
1263
1260
  }
1264
1261
  #openOwnedRoute(route) {
1265
1262
  const surface = this.#routeHost?.open(route) ?? null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timurproko/a1",
3
- "version": "0.1.8-dev.9a04818",
3
+ "version": "0.1.8-dev.ade9b77",
4
4
  "description": "Standalone terminal workspace for supervised native and managed agents",
5
5
  "type": "module",
6
6
  "packageManager": "npm@11.13.0",