runwork 0.16.0 → 0.16.1

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 (2) hide show
  1. package/dist/index.js +116 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7381,7 +7381,7 @@ function createKeyboardListener() {
7381
7381
  }
7382
7382
 
7383
7383
  // src/generated/version.ts
7384
- var VERSION = "0.16.0";
7384
+ var VERSION = "0.16.1";
7385
7385
 
7386
7386
  // src/commands/dev.ts
7387
7387
  var exports_dev = {};
@@ -10989,6 +10989,92 @@ function extractCodexRolloutSession(raw, agentSlug) {
10989
10989
  digest.project = "codex";
10990
10990
  return digest;
10991
10991
  }
10992
+ function extractCursorSessions(composerRows, bubbleRows, sinceISO) {
10993
+ const composerCreatedAt = new Map;
10994
+ for (const line of composerRows.split(`
10995
+ `)) {
10996
+ if (!line.trim())
10997
+ continue;
10998
+ try {
10999
+ const o = JSON.parse(line);
11000
+ if (o.id)
11001
+ composerCreatedAt.set(o.id, typeof o.createdAt === "number" ? o.createdAt : 0);
11002
+ } catch {}
11003
+ }
11004
+ const byComposer = new Map;
11005
+ for (const line of bubbleRows.split(`
11006
+ `)) {
11007
+ if (!line.trim())
11008
+ continue;
11009
+ let o;
11010
+ try {
11011
+ o = JSON.parse(line);
11012
+ } catch {
11013
+ continue;
11014
+ }
11015
+ const parts = (o.k ?? "").split(":");
11016
+ if (parts.length < 3)
11017
+ continue;
11018
+ const cid = parts[1];
11019
+ const list = byComposer.get(cid) ?? [];
11020
+ list.push({ type: o.type ?? null, text: o.text ?? null, ts: o.ts ?? null, tool: o.tool ?? null, status: o.status ?? null });
11021
+ byComposer.set(cid, list);
11022
+ }
11023
+ const digests = [];
11024
+ for (const [cid, bubbles] of byComposer) {
11025
+ bubbles.sort((a, b) => (a.ts ?? "").localeCompare(b.ts ?? ""));
11026
+ const digest = {
11027
+ agentSlug: "cursor",
11028
+ project: "cursor",
11029
+ start: null,
11030
+ end: null,
11031
+ userMessages: [],
11032
+ droppedUserMessages: 0,
11033
+ toolCounts: {},
11034
+ skillInvocations: [],
11035
+ errorCount: 0,
11036
+ assistantTurns: 0
11037
+ };
11038
+ for (const b of bubbles) {
11039
+ if (b.ts) {
11040
+ if (!digest.start)
11041
+ digest.start = b.ts;
11042
+ digest.end = b.ts;
11043
+ }
11044
+ if (b.tool) {
11045
+ digest.toolCounts[b.tool] = (digest.toolCounts[b.tool] ?? 0) + 1;
11046
+ if (b.status === "error")
11047
+ digest.errorCount++;
11048
+ } else if (b.type === 2) {
11049
+ digest.assistantTurns++;
11050
+ }
11051
+ if (b.type === 1 && typeof b.text === "string") {
11052
+ const trimmed = b.text.trim();
11053
+ if (!trimmed || SKIP_PREFIXES.some((p) => trimmed.startsWith(p)))
11054
+ continue;
11055
+ if (digest.userMessages.length >= MAX_MSGS_PER_SESSION) {
11056
+ digest.droppedUserMessages++;
11057
+ continue;
11058
+ }
11059
+ digest.userMessages.push(trimmed.length > MAX_MSG_CHARS ? trimmed.slice(0, MAX_MSG_CHARS) + " [...]" : trimmed);
11060
+ }
11061
+ }
11062
+ if (!digest.start) {
11063
+ const ms = composerCreatedAt.get(cid);
11064
+ if (ms) {
11065
+ const iso = new Date(ms).toISOString();
11066
+ digest.start = iso;
11067
+ digest.end = iso;
11068
+ }
11069
+ }
11070
+ if (digest.userMessages.length === 0)
11071
+ continue;
11072
+ if (sinceISO && digest.end && digest.end < sinceISO)
11073
+ continue;
11074
+ digests.push(digest);
11075
+ }
11076
+ return digests;
11077
+ }
10992
11078
  function formatCombinedDigest(sessions, opts = { days: 7 }) {
10993
11079
  const sorted = [...sessions].sort((a, b) => (a.start ?? "").localeCompare(b.start ?? ""));
10994
11080
  const lines = [];
@@ -12780,6 +12866,9 @@ async function loadAdapter() {
12780
12866
  return null;
12781
12867
  }
12782
12868
  adapter = await loadAdapter();
12869
+ function sqliteAvailable() {
12870
+ return adapter !== null;
12871
+ }
12783
12872
  var BUSY_TIMEOUT_MS = 5000;
12784
12873
  function setBusyTimeout(db) {
12785
12874
  try {
@@ -12898,15 +12987,7 @@ ${instructions}`;
12898
12987
  if (config.networkAllowlist?.length) {
12899
12988
  this.mergeSandboxAllowlist(config.networkAllowlist);
12900
12989
  }
12901
- const os2 = platform4();
12902
- let globalDbPath;
12903
- if (os2 === "darwin") {
12904
- globalDbPath = join24(homedir7(), "Library", "Application Support", "Cursor", "User", "globalStorage", "state.vscdb");
12905
- } else if (os2 === "win32") {
12906
- globalDbPath = join24(process.env.APPDATA || join24(homedir7(), "AppData", "Roaming"), "Cursor", "User", "globalStorage", "state.vscdb");
12907
- } else {
12908
- globalDbPath = join24(homedir7(), ".config", "Cursor", "User", "globalStorage", "state.vscdb");
12909
- }
12990
+ const globalDbPath = this.globalStorageDbPath();
12910
12991
  if (!existsSync30(globalDbPath))
12911
12992
  return;
12912
12993
  const db = openWritableSqlite(globalDbPath);
@@ -12986,15 +13067,7 @@ ${instructions}`;
12986
13067
  async readUsageStats(lastSyncAt) {
12987
13068
  try {
12988
13069
  const sinceMs = lastSyncAt ? new Date(lastSyncAt).getTime() : 0;
12989
- const os2 = platform4();
12990
- let globalDbPath;
12991
- if (os2 === "darwin") {
12992
- globalDbPath = join24(homedir7(), "Library", "Application Support", "Cursor", "User", "globalStorage", "state.vscdb");
12993
- } else if (os2 === "win32") {
12994
- globalDbPath = join24(process.env.APPDATA || join24(homedir7(), "AppData", "Roaming"), "Cursor", "User", "globalStorage", "state.vscdb");
12995
- } else {
12996
- globalDbPath = join24(homedir7(), ".config", "Cursor", "User", "globalStorage", "state.vscdb");
12997
- }
13070
+ const globalDbPath = this.globalStorageDbPath();
12998
13071
  let sessionCount = 0;
12999
13072
  let totalLinesAdded = 0;
13000
13073
  let totalLinesRemoved = 0;
@@ -13069,6 +13142,30 @@ ${instructions}`;
13069
13142
  return null;
13070
13143
  }
13071
13144
  }
13145
+ globalStorageDbPath() {
13146
+ const os2 = platform4();
13147
+ if (os2 === "darwin") {
13148
+ return join24(homedir7(), "Library", "Application Support", "Cursor", "User", "globalStorage", "state.vscdb");
13149
+ }
13150
+ if (os2 === "win32") {
13151
+ return join24(process.env.APPDATA || join24(homedir7(), "AppData", "Roaming"), "Cursor", "User", "globalStorage", "state.vscdb");
13152
+ }
13153
+ return join24(homedir7(), ".config", "Cursor", "User", "globalStorage", "state.vscdb");
13154
+ }
13155
+ async readSessionDigests(sinceISO) {
13156
+ try {
13157
+ const dbPath = this.globalStorageDbPath();
13158
+ if (!existsSync30(dbPath) || !sqliteAvailable())
13159
+ return null;
13160
+ const composerRows = queryReadonlySqlite(dbPath, `SELECT json_object('id', json_extract(value,'$.composerId'), 'createdAt', json_extract(value,'$.createdAt')) FROM cursorDiskKV WHERE key LIKE 'composerData:%'`);
13161
+ const bubbleRows = queryReadonlySqlite(dbPath, `SELECT json_object('k', key, 'type', json_extract(value,'$.type'), 'text', substr(json_extract(value,'$.text'),1,2000), 'ts', json_extract(value,'$.createdAt'), 'tool', json_extract(value,'$.toolFormerData.name'), 'status', json_extract(value,'$.toolFormerData.status')) FROM cursorDiskKV WHERE key LIKE 'bubbleId:%'`);
13162
+ if (!bubbleRows.trim())
13163
+ return [];
13164
+ return extractCursorSessions(composerRows, bubbleRows, sinceISO);
13165
+ } catch {
13166
+ return null;
13167
+ }
13168
+ }
13072
13169
  }
13073
13170
 
13074
13171
  // src/agents/windsurf.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runwork",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "CLI for Runwork: develop, preview, and deploy Runwork apps from your local machine.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Runwork <info@runwork.ai> (https://www.runwork.ai)",