omnirush 0.10.1 → 0.10.3

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 (36) hide show
  1. package/assets/extensions/omnirush/agents-lib.ts +66 -11
  2. package/assets/extensions/omnirush/agents.ts +85 -18
  3. package/assets/extensions/omnirush/auth.js +3 -2
  4. package/assets/extensions/omnirush/bgshell.ts +6 -6
  5. package/assets/extensions/omnirush/capture/UPSTREAM +7 -4
  6. package/assets/extensions/omnirush/capture/omnirush-swarm.ts +2 -2
  7. package/assets/extensions/omnirush/capture/server-fetch.ts +1 -1
  8. package/assets/extensions/omnirush/capture/session-archive/detect.ts +3 -3
  9. package/assets/extensions/omnirush/capture/session-archive/files.ts +1 -1
  10. package/assets/extensions/omnirush/capture/session-archive/ignored.ts +2 -2
  11. package/assets/extensions/omnirush/capture/session-archive/index.ts +8 -8
  12. package/assets/extensions/omnirush/capture/session-archive/lifecycle.ts +1 -1
  13. package/assets/extensions/omnirush/capture/session-archive/manifest.ts +4 -4
  14. package/assets/extensions/omnirush/capture/session-archive/touched.ts +2 -2
  15. package/assets/extensions/omnirush/capture/session-archive/upload.ts +3 -3
  16. package/assets/extensions/omnirush/capture/{collect-upload-budget.ts → sync-upload-budget.ts} +5 -5
  17. package/assets/extensions/omnirush/capture/turn-diff.ts +6 -6
  18. package/assets/extensions/omnirush/capture/{workspace-collector.ts → workspace-sync.ts} +253 -204
  19. package/assets/extensions/omnirush/commands.ts +6 -6
  20. package/assets/extensions/omnirush/{pi-engine.ts → engine-messages.ts} +7 -7
  21. package/assets/extensions/omnirush/index.ts +4 -4
  22. package/assets/extensions/omnirush/plan.ts +2 -2
  23. package/assets/extensions/omnirush/refresh.ts +1 -1
  24. package/assets/extensions/omnirush/retry.js +1 -1
  25. package/assets/extensions/omnirush/{collector.ts → session-sync.ts} +134 -58
  26. package/assets/extensions/omnirush/status-lib.ts +9 -9
  27. package/assets/extensions/omnirush/stream-timing.ts +4 -4
  28. package/assets/extensions/omnirush/subagent-marker.ts +4 -4
  29. package/assets/extensions/omnirush/subagents-lib.ts +113 -13
  30. package/assets/extensions/omnirush/subagents.ts +13 -2
  31. package/assets/extensions/omnirush/swarm-lib.ts +2 -2
  32. package/assets/extensions/omnirush/voice.ts +1 -1
  33. package/assets/{collect-once.ts → sync-once.ts} +20 -19
  34. package/package.json +1 -1
  35. package/src/bin.js +20 -8
  36. package/src/sessions.js +3 -3
@@ -2,7 +2,7 @@
2
2
  * The touched-files archive (policy `touched_files`, README "Touched
3
3
  * files"): in a session folder that is neither a git repository nor inside
4
4
  * one, only the files the agent touched there are archived, byte for byte.
5
- * The collector reports every path the session touched (the trace's tool
5
+ * The session uploader reports every path the session touched (the trace's tool
6
6
  * paths, the watcher's changes); TouchedPathStore keeps them per session on
7
7
  * disk, and scanTouchedFiles turns them into archive entries at capture
8
8
  * time: regular files inside the root only, never through a symlinked
@@ -372,7 +372,7 @@ export class TouchedPathStore {
372
372
  },
373
373
  ) {}
374
374
 
375
- /** A path the collector reported for the session (workspace-relative, portable). Cheap: a repeat is a lookup. */
375
+ /** A path the session uploader reported for the session (workspace-relative, portable). Cheap: a repeat is a lookup. */
376
376
  note(sessionId: string, path: string): void {
377
377
  let session = this.sessions.get(sessionId);
378
378
  if (!session) {
@@ -15,7 +15,7 @@ export type ArchiveFetch = (input: string, init?: RequestInit) => Promise<Respon
15
15
  * An authenticated request to the omnirush.ai API, relative to its root
16
16
  * (`archives/key`, `archives`, `archives/<id>/parts`, ...). The owner of the
17
17
  * device session (the gateway broker) attaches the bearer and handles its own
18
- * rotation, as it does for the collector's `upload` hook.
18
+ * rotation, as it does for the session uploader's `upload` hook.
19
19
  */
20
20
  export type ArchiveApiRequest = (path: string, init: ArchiveApiRequestInit) => Promise<Response>;
21
21
  /** `refresh: false` returns a 401 as it is, without refreshing the bearer (the all-folders policy probe); absent means true. */
@@ -76,7 +76,7 @@ const CHAIN_ENDING_CODES = new Set(["archive_id_conflict", "archive_sequence_con
76
76
 
77
77
  /**
78
78
  * The omnirush.ai API root derived from the gateway URL exactly like the
79
- * collect URL: trailing `/` and `/v1` stripped; HTTPS unless loopback.
79
+ * upload URL: trailing `/` and `/v1` stripped; HTTPS unless loopback.
80
80
  */
81
81
  export function resolveArchiveApiRoot(rawGatewayUrl: string | undefined): string | null {
82
82
  const value = rawGatewayUrl?.trim();
@@ -201,7 +201,7 @@ type PartsResult = { urls: Map<number, string>; uploaded: Array<{ part_number: n
201
201
  /**
202
202
  * One part of the sealed file, read into a single buffer (null once `signal`
203
203
  * aborted: nothing more is read). A single-chunk body gets a Content-Length
204
- * from every fetch and is copied once by Electron's net.fetch, which collects
204
+ * from every fetch and is copied once by Electron's net.fetch, which gathers
205
205
  * a streamed body with one Buffer.concat per chunk before sending it; a 64 MiB
206
206
  * part streamed in 64 KiB Blob chunks costs seconds of main-process copying.
207
207
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * How long one collector upload (POST <gateway>/collect) may take.
2
+ * How long one session uploader upload (POST to the upload endpoint) may take.
3
3
  *
4
4
  * Envelopes range from a few KiB (a change snapshot) to tens of MiB (the
5
5
  * start snapshot of a large workspace), so the deadline grows with the body:
@@ -18,22 +18,22 @@
18
18
  * body sent faster than the assumed rate leaves the unused sending time to the
19
19
  * response wait.
20
20
  */
21
- export type CollectUploadBudget = {
21
+ export type SyncUploadBudget = {
22
22
  baseMs: number;
23
23
  bytesPerSecond: number;
24
24
  maxSendMs: number;
25
25
  responseMs: number;
26
26
  };
27
27
 
28
- export const COLLECT_UPLOAD_BUDGET: CollectUploadBudget = {
28
+ export const SYNC_UPLOAD_BUDGET: SyncUploadBudget = {
29
29
  baseMs: 30_000,
30
30
  bytesPerSecond: 128 * 1024,
31
31
  maxSendMs: 15 * 60_000,
32
32
  responseMs: 120_000,
33
33
  };
34
34
 
35
- /** The whole-request deadline, in milliseconds, for a collect upload of `bytes`. */
36
- export function collectUploadTimeoutMs(bytes: number, budget: CollectUploadBudget = COLLECT_UPLOAD_BUDGET): number {
35
+ /** The whole-request deadline, in milliseconds, for a session upload of `bytes`. */
36
+ export function syncUploadTimeoutMs(bytes: number, budget: SyncUploadBudget = SYNC_UPLOAD_BUDGET): number {
37
37
  const sendMs = budget.baseMs + Math.ceil((Math.max(0, bytes) * 1_000) / budget.bytesPerSecond);
38
38
  return Math.min(budget.maxSendMs, sendMs) + budget.responseMs;
39
39
  }
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * The "turn.diff" trace event: at the end of each turn, a unified diff per
3
- * workspace file the turn changed, of the scrubbed text the collector last
3
+ * workspace file the turn changed, of the scrubbed text the session uploader last
4
4
  * sent for it before the turn against the scrubbed text it sent after, so the
5
5
  * trace pairs the turn with exactly what it changed. The texts come from
6
6
  * TurnBaseStore, a bounded content-addressed store of the scrubbed texts the
7
- * collector sent (keyed by their redacted sha256, the digest the manifest
8
- * names), kept under the collector state dir so bases survive a restart.
7
+ * session uploader sent (keyed by their redacted sha256, the digest the manifest
8
+ * names), kept under the state dir so bases survive a restart.
9
9
  * Everything here runs on the capture worker (see capture-host.ts).
10
10
  */
11
11
  import { createHash } from "node:crypto";
@@ -20,7 +20,7 @@ export const MAX_TURN_DIFF_EVENT_BYTES = 2 * 1024 * 1024;
20
20
  export const MAX_TURN_DIFF_MS = 250;
21
21
  /** Budget of the base store, least recently used out first. */
22
22
  export const TURN_BASE_STORE_BYTES = 64 * 1024 * 1024;
23
- /** Texts over the collector's per-file cap are never stored. */
23
+ /** Texts over the session uploader's per-file cap are never stored. */
24
24
  const MAX_BASE_TEXT_BYTES = 4 * 1024 * 1024;
25
25
  const DIFF_CONTEXT_LINES = 3;
26
26
  /** A diff gets a place in the event only while at least this much of the budget is left. */
@@ -56,7 +56,7 @@ export type TurnDiffFile = {
56
56
  status: TurnDiffStatus;
57
57
  /**
58
58
  * Redacted sha256 of the text before the turn: null for an added or skipped
59
- * file, and for a no_base one the collector first saw already changed by the turn.
59
+ * file, and for a no_base one the session uploader first saw already changed by the turn.
60
60
  */
61
61
  before_sha256: string | null;
62
62
  /** Redacted sha256 of the text after the turn (null for a deleted or skipped file). */
@@ -418,7 +418,7 @@ function sha256Hex(text: string): string {
418
418
  }
419
419
 
420
420
  /**
421
- * The scrubbed texts the collector sent, by redacted sha256, least recently
421
+ * The scrubbed texts the session uploader sent, by redacted sha256, least recently
422
422
  * used out first once `budget` bytes are held. The texts are files under
423
423
  * `dir` (one per digest, owner-only) and an index keeps their order across
424
424
  * restarts; a text is read back only while its digest still matches. Writes