memhouse 0.18.12 → 0.20.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.
- package/AGENTS.md +22 -151
- package/CHANGELOG.md +263 -29
- package/LICENSE +202 -22
- package/LICENSES/agentlytics-MIT.txt +21 -0
- package/LICENSES/memhouse-MIT-until-0.18.11.txt +22 -0
- package/LICENSES/models.dev-MIT.txt +22 -0
- package/NOTICE +28 -0
- package/README.md +42 -20
- package/SECURITY.md +21 -8
- package/bin/memhouse.js +2223 -311
- package/docs/README.md +11 -9
- package/docs/guides/admin-password.md +37 -10
- package/docs/guides/configuration.md +13 -6
- package/docs/guides/daemons.md +64 -3
- package/docs/guides/import-claude-ai.md +204 -0
- package/docs/guides/install.md +11 -6
- package/docs/guides/invite.md +21 -7
- package/docs/guides/operate.md +114 -7
- package/docs/guides/search-and-resume.md +72 -3
- package/docs/guides/share.md +91 -52
- package/docs/guides/storage.md +44 -4
- package/docs/guides/troubleshooting.md +121 -14
- package/docs/guides/uninstall.md +4 -3
- package/docs/guides/update.md +16 -0
- package/docs/guides/upgrade-to-0.20.md +188 -0
- package/docs/releases/README.md +2 -1
- package/docs/releases/v0.18.10.md +5 -5
- package/docs/releases/v0.18.11.md +3 -3
- package/docs/releases/v0.20.0.md +627 -0
- package/docs/releases/v0.20.1.md +114 -0
- package/docs/tutorials/01-first-house.md +10 -7
- package/docs/tutorials/02-join-a-house.md +24 -15
- package/docs/tutorials/03-share-your-memory.md +40 -31
- package/editors/antigravity.js +1 -80
- package/editors/base.js +463 -9
- package/editors/bridge.js +119 -0
- package/editors/claude.js +273 -105
- package/editors/codex.js +278 -52
- package/editors/copilot.js +1 -70
- package/editors/cursor.js +1 -75
- package/editors/derive-fingerprints.json +18 -0
- package/editors/harness-paths.js +69 -0
- package/editors/index.js +1 -20
- package/editors/normalise/agy.js +910 -0
- package/editors/normalise/copilot-cli.js +321 -0
- package/editors/normalise/cursor-agent.js +852 -0
- package/editors/normalise/cursor.js +474 -0
- package/editors/normalise/devin.js +575 -0
- package/editors/normalise/gemini-cli.js +602 -0
- package/editors/normalise/goose.js +673 -0
- package/editors/normalise/opencode.js +633 -0
- package/editors/normalise/vscode.js +549 -0
- package/editors/normalise/zed.js +473 -0
- package/editors/opencode-v4.js +119 -0
- package/editors/scope.js +14 -3
- package/editors/sessions-log.js +349 -0
- package/editors/sqlite.js +28 -1
- package/editors/vscode.js +1 -72
- package/editors/windsurf.js +1 -143
- package/examples/01-local-one-machine/README.md +24 -19
- package/examples/01-local-one-machine/run.sh +1 -1
- package/examples/02-existing-clickhouse/README.md +30 -22
- package/examples/02-existing-clickhouse/run.sh +5 -4
- package/examples/03-team-house/README.md +44 -37
- package/examples/03-team-house/run.sh +35 -18
- package/examples/04-self-hosted-team/README.md +29 -14
- package/examples/04-self-hosted-team/compose.yml +5 -2
- package/examples/04-self-hosted-team/smoke.sh +26 -12
- package/examples/README.md +8 -4
- package/examples/fixtures/README.md +4 -1
- package/examples/fixtures/make-sessions.js +8 -5
- package/memhouse/admin-secret.js +89 -24
- package/memhouse/argv-secrets.js +64 -0
- package/memhouse/channel.js +49 -9
- package/memhouse/codex-plugin.js +194 -0
- package/memhouse/delivery/AGENT-INSTALL-PROMPT.md +2 -1
- package/memhouse/delivery/AGENT-INSTALL.md +22 -11
- package/memhouse/delivery/INVITATION.md.tpl +44 -45
- package/memhouse/delivery/PROMPT.md +53 -5
- package/memhouse/delivery/UPGRADE.md.tpl +1 -1
- package/memhouse/delivery/codex/AGENTS-BLOCK.md +11 -0
- package/memhouse/delivery/codex/SKILL.md +50 -0
- package/memhouse/delivery/kernel-install.md +17 -9
- package/memhouse/delivery/plugin/.claude-plugin/plugin.json +2 -2
- package/memhouse/delivery/plugin/reference/HOUSE.md +168 -41
- package/memhouse/delivery/plugin/skills/access/SKILL.md +13 -5
- package/memhouse/delivery/plugin/skills/admin/SKILL.md +14 -6
- package/memhouse/delivery/plugin/skills/house/SKILL.md +25 -8
- package/memhouse/delivery/plugin/skills/recall/SKILL.md +66 -8
- package/memhouse/delivery/plugin/skills/sql/SKILL.md +66 -7
- package/memhouse/deploy.js +1 -1
- package/memhouse/flags.js +35 -18
- package/memhouse/help.js +37 -0
- package/memhouse/host.js +82 -2
- package/memhouse/house/HOUSE.md +2 -2
- package/memhouse/house/convert-profile.js +638 -0
- package/memhouse/house/convert-v3.js +742 -0
- package/memhouse/house/doctor-v3.js +324 -0
- package/memhouse/house/host-alias.js +85 -0
- package/memhouse/house/house.js +3 -3
- package/memhouse/house/migrate.js +2 -2
- package/memhouse/house/profile-dedupe.js +183 -0
- package/memhouse/house/profile-edges.js +554 -0
- package/memhouse/house/profile-house.js +430 -0
- package/memhouse/house/profile-rollup.js +190 -0
- package/memhouse/house/q-cli.js +863 -0
- package/memhouse/house/queries-v3.js +1013 -0
- package/memhouse/house/reconcile-v3.js +192 -0
- package/memhouse/house/records-to-profile.js +174 -0
- package/memhouse/house/records-to-rows.js +169 -0
- package/memhouse/house/relocate.js +2 -1
- package/memhouse/house/schema-choice.js +121 -0
- package/memhouse/house/schema-profile.js +290 -0
- package/memhouse/house/schema-profile.sql.tpl +398 -0
- package/memhouse/house/schema-v3.js +267 -0
- package/memhouse/house/schema-v3.sql.tpl +213 -0
- package/memhouse/import/claude-ai.js +420 -0
- package/memhouse/import/import.js +372 -0
- package/memhouse/import/pyjson.js +206 -0
- package/memhouse/import/records.js +64 -0
- package/memhouse/import/writer-profile.js +192 -0
- package/memhouse/import/writer-v3.js +240 -0
- package/memhouse/import/zip.js +112 -0
- package/memhouse/invitation.js +102 -0
- package/memhouse/invitefile.js +5 -2
- package/memhouse/plugin-copies.js +176 -0
- package/memhouse/provision.js +7 -2
- package/memhouse/release-hint.js +24 -0
- package/memhouse/resume.js +4 -4
- package/memhouse/server/api-v3.js +632 -0
- package/memhouse/server/dashboard-auth.js +181 -0
- package/memhouse/server/dashboard-port.js +91 -0
- package/memhouse/server/queries.js +30 -0
- package/memhouse/server/server.js +118 -20
- package/memhouse/service.js +1 -1
- package/memhouse/share.js +687 -1
- package/memhouse/shipper/adapter-capture.js +756 -0
- package/memhouse/shipper/capture.js +2571 -0
- package/memhouse/shipper/dedupe-profile.js +237 -0
- package/memhouse/shipper/dedupe-v3.js +1027 -0
- package/memhouse/shipper/forks.js +233 -0
- package/memhouse/shipper/log-adapter.js +219 -0
- package/memhouse/shipper/maintenance.js +49 -0
- package/memhouse/shipper/normalise-run.js +148 -0
- package/memhouse/shipper/passlog.js +68 -5
- package/memhouse/shipper/profile-capture.js +903 -0
- package/memhouse/shipper/ship.js +91 -8
- package/memhouse/shipper/snapshots.js +193 -0
- package/memhouse/shipper/source-roots.js +111 -0
- package/memhouse/version-notice.js +66 -0
- package/package.json +14 -7
- package/public/THIRD_PARTY_NOTICES.txt +2 -2
- package/public/assets/index-CcNnhfM3.js +78 -0
- package/public/index.html +1 -1
- package/ui/package-lock.json +56 -37
- package/ui/package.json +1 -0
- package/ui/src/App.jsx +29 -14
- package/ui/src/components/ChatSidebar.jsx +69 -12
- package/ui/src/lib/api.js +76 -0
- package/ui/src/lib/dashboard-token.js +41 -0
- package/ui/src/main.jsx +22 -5
- package/ui/src/pages/Dashboard.jsx +22 -36
- package/ui/third-party-notices.js +119 -0
- package/ui/vite.config.js +5 -1
- package/docs/releases/v0.18.12.md +0 -59
- package/memhouse/COMPETITION.md +0 -221
- package/memhouse/DESIGN.md +0 -222
- package/memhouse/RESUME-AND-UPDATE.md +0 -182
- package/public/assets/index-CnWzrjF3.js +0 -78
package/editors/codex.js
CHANGED
|
@@ -455,62 +455,288 @@ function safeParseJson(value) {
|
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
//
|
|
459
|
-
//
|
|
460
|
-
//
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
458
|
+
// <derive> ====================================================================================
|
|
459
|
+
// Capture (schema v3) — docs/design/source-identity.md draft 5, §2 and §5. Fingerprinted by
|
|
460
|
+
// misc/capture-test.js: change anything in this region and bump CODEX_DERIVE_VERSION.
|
|
461
|
+
//
|
|
462
|
+
// message_id payload.id when the item has one, else '@<byte offset>' — never an index of
|
|
463
|
+
// emitted rows (rollouts are append-only, so the offset is stable)
|
|
464
|
+
// ts the record `timestamp`
|
|
465
|
+
// tokens a TURN is the billing unit and the open unit: Σ last_token_usage of its
|
|
466
|
+
// token_count events (a repeated running total is skipped) on the turn's first
|
|
467
|
+
// assistant row, or on a kind = 'usage' row when the turn has none
|
|
468
|
+
// turns one turn_id is one unit, however many turn_context records it writes (newer
|
|
469
|
+
// rollouts write several) and whatever the user types before it completes
|
|
470
|
+
// model turn_context.model; effort turn_context.effort
|
|
471
|
+
// Version 3: layout 3.2 (part_id/part_ord, harness_path, full tool output). Version 4: no derive change: comment wording in the shared capture region.
|
|
472
|
+
const CODEX_DERIVE_VERSION = 4;
|
|
473
|
+
|
|
474
|
+
const X_ASSISTANT_ITEMS = new Set(['reasoning', 'function_call', 'custom_tool_call', 'local_shell_call', 'web_search_call']);
|
|
475
|
+
function xIsTurnMarker(o) { return o.type === 'turn_context' || (o.type === 'event_msg' && !!o.payload && o.payload.type === 'task_started'); }
|
|
476
|
+
function xIsUserMsg(o) { return o.type === 'response_item' && !!o.payload && o.payload.type === 'message' && o.payload.role === 'user'; }
|
|
477
|
+
function xIsTurnEnd(o) { return o.type === 'event_msg' && !!o.payload && (o.payload.type === 'task_complete' || o.payload.type === 'turn_aborted'); }
|
|
478
|
+
function xTurnId(o) { const p = o.payload; return p && typeof p.turn_id === 'string' && p.turn_id ? p.turn_id : null; }
|
|
479
|
+
function xIsActivity(o) {
|
|
480
|
+
if (o.type === 'response_item' && o.payload) {
|
|
481
|
+
return o.payload.type === 'message' ? o.payload.role === 'assistant' : X_ASSISTANT_ITEMS.has(o.payload.type);
|
|
482
|
+
}
|
|
483
|
+
return o.type === 'event_msg' && !!o.payload && o.payload.type === 'token_count' && !!o.payload.info;
|
|
467
484
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
const parts = token.split('.');
|
|
473
|
-
if (parts.length < 2) return null;
|
|
474
|
-
let payload = parts[1];
|
|
475
|
-
// Fix base64url padding
|
|
476
|
-
payload += '='.repeat((4 - payload.length % 4) % 4);
|
|
477
|
-
const decoded = Buffer.from(payload, 'base64').toString('utf-8');
|
|
478
|
-
return JSON.parse(decoded);
|
|
479
|
-
} catch { return null; }
|
|
485
|
+
function xIsBoot(text) {
|
|
486
|
+
const t = String(text || '').trim();
|
|
487
|
+
return t.startsWith('<user_instructions>') || t.startsWith('<environment_context>')
|
|
488
|
+
|| t.startsWith('# AGENTS.md instructions') || t.startsWith('<INSTRUCTIONS>');
|
|
480
489
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
const
|
|
484
|
-
if (!isSubscriptionAccessAllowed()) return null;
|
|
485
|
-
const auth = getCodexAuth();
|
|
486
|
-
if (!auth || !auth.tokens) return null;
|
|
487
|
-
|
|
488
|
-
const idPayload = decodeJwtPayload(auth.tokens.id_token);
|
|
489
|
-
const accessPayload = decodeJwtPayload(auth.tokens.access_token);
|
|
490
|
-
|
|
491
|
-
const authClaims = idPayload?.['https://api.openai.com/auth'] || accessPayload?.['https://api.openai.com/auth'] || {};
|
|
492
|
-
const profileClaims = idPayload?.['https://api.openai.com/profile'] || accessPayload?.['https://api.openai.com/profile'] || {};
|
|
493
|
-
|
|
494
|
-
const planType = authClaims.chatgpt_plan_type || null;
|
|
495
|
-
const email = profileClaims.email || null;
|
|
496
|
-
const subscriptionStart = authClaims.chatgpt_subscription_active_start || null;
|
|
497
|
-
const subscriptionEnd = authClaims.chatgpt_subscription_active_until || null;
|
|
498
|
-
|
|
499
|
-
if (!planType && !email) return null;
|
|
500
|
-
|
|
490
|
+
function xRaw(v) {
|
|
491
|
+
if (!v || typeof v !== 'object') return null;
|
|
492
|
+
const n = (x) => (typeof x === 'number' && Number.isFinite(x) && x > 0 ? Math.trunc(x) : 0);
|
|
501
493
|
return {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
subscriptionStart,
|
|
506
|
-
subscriptionEnd,
|
|
507
|
-
},
|
|
508
|
-
user: {
|
|
509
|
-
email,
|
|
510
|
-
},
|
|
511
|
-
authMode: auth.auth_mode || null,
|
|
494
|
+
input: n(v.input_tokens), cached: n(v.cached_input_tokens != null ? v.cached_input_tokens : v.cache_read_input_tokens),
|
|
495
|
+
output: n(v.output_tokens), reasoning: n(v.reasoning_output_tokens), total: n(v.total_tokens),
|
|
496
|
+
cache_write: n(v.cache_write_input_tokens),
|
|
512
497
|
};
|
|
513
498
|
}
|
|
499
|
+
const X_FIELDS = ['input', 'cached', 'output', 'reasoning', 'total', 'cache_write'];
|
|
500
|
+
function xSame(a, b) { return !!a && !!b && X_FIELDS.every((k) => a[k] === b[k]); }
|
|
501
|
+
function xSub(a, b) {
|
|
502
|
+
const out = {};
|
|
503
|
+
for (const k of X_FIELDS) out[k] = Math.max(a[k] - (b ? b[k] : 0), 0);
|
|
504
|
+
return out;
|
|
505
|
+
}
|
|
506
|
+
function xTokFields(t) {
|
|
507
|
+
return { input_tokens: t.input_tokens, output_tokens: t.output_tokens, cache_read_tokens: t.cache_read_tokens, cache_write_tokens: t.cache_write_tokens, reasoning_tokens: t.reasoning_tokens };
|
|
508
|
+
}
|
|
509
|
+
function xNonZero(t) { return t.input_tokens + t.output_tokens + t.cache_read_tokens + t.cache_write_tokens + t.reasoning_tokens > 0; }
|
|
510
|
+
function xOutputText(output) {
|
|
511
|
+
if (output == null) return '';
|
|
512
|
+
if (typeof output === 'string') {
|
|
513
|
+
try { const j = JSON.parse(output); if (j && typeof j === 'object' && typeof j.output === 'string') return j.output; } catch { /* plain text */ }
|
|
514
|
+
return output;
|
|
515
|
+
}
|
|
516
|
+
if (typeof output === 'object' && typeof output.content === 'string') return output.content;
|
|
517
|
+
return JSON.stringify(output);
|
|
518
|
+
}
|
|
519
|
+
function xOutputError(output) {
|
|
520
|
+
let j = output;
|
|
521
|
+
if (typeof output === 'string') { try { j = JSON.parse(output); } catch { return false; } }
|
|
522
|
+
if (!j || typeof j !== 'object') return false;
|
|
523
|
+
if (j.success === false) return true;
|
|
524
|
+
const code = j.metadata && j.metadata.exit_code;
|
|
525
|
+
return typeof code === 'number' && code !== 0;
|
|
526
|
+
}
|
|
527
|
+
function xParseTs(v) { return typeof v === 'string' && v ? Date.parse(v) : (typeof v === 'number' ? v : NaN); }
|
|
528
|
+
|
|
529
|
+
const codexDeriveAdapter = {
|
|
530
|
+
harness: 'codex',
|
|
531
|
+
deriveVersion: CODEX_DERIVE_VERSION,
|
|
532
|
+
initState() { return { u: { open: false, fresh: false, active: false, turnId: null, done: false }, model: '', effort: '', version: '', folder: '', prev: null, turn: null }; },
|
|
533
|
+
// A turn starts at turn_context / task_started — unless it carries the open turn's own turn_id,
|
|
534
|
+
// or the open turn has seen nothing yet — or at a user message once the open turn has assistant
|
|
535
|
+
// activity and has completed (or never had an id: rollouts without turn_context).
|
|
536
|
+
unitStart(rec, u) {
|
|
537
|
+
const o = rec.obj;
|
|
538
|
+
if (!o) return false;
|
|
539
|
+
if (xIsTurnMarker(o)) {
|
|
540
|
+
if (!u.open) return true;
|
|
541
|
+
const id = xTurnId(o);
|
|
542
|
+
if (id && u.turnId) return id !== u.turnId;
|
|
543
|
+
return !u.fresh;
|
|
544
|
+
}
|
|
545
|
+
if (xIsUserMsg(o)) {
|
|
546
|
+
if (!u.open) return true;
|
|
547
|
+
if (u.turnId && !u.done) return false; // steering inside a turn that has not completed
|
|
548
|
+
return u.active;
|
|
549
|
+
}
|
|
550
|
+
return false;
|
|
551
|
+
},
|
|
552
|
+
track(rec, u) {
|
|
553
|
+
const o = rec.obj;
|
|
554
|
+
if (!o) return;
|
|
555
|
+
if (codexDeriveAdapter.unitStart(rec, u)) { u.open = true; u.fresh = true; u.active = false; u.turnId = null; u.done = false; }
|
|
556
|
+
if (xIsTurnMarker(o)) { if (!u.turnId) u.turnId = xTurnId(o); return; }
|
|
557
|
+
if (xIsTurnEnd(o)) { u.done = true; return; }
|
|
558
|
+
if (xIsUserMsg(o)) return;
|
|
559
|
+
if (xIsActivity(o)) { u.active = true; u.fresh = false; return; }
|
|
560
|
+
if (o.type === 'response_item' || o.type === 'compacted') u.fresh = false;
|
|
561
|
+
},
|
|
562
|
+
closeUnit(d) {
|
|
563
|
+
if (d.a.turn) codexDeriveAdapter.usageRowIfNeeded(d, d.a.turn);
|
|
564
|
+
d.a.turn = null;
|
|
565
|
+
},
|
|
566
|
+
openUnit(d, rec) {
|
|
567
|
+
const p = rec.obj.payload || {};
|
|
568
|
+
d.a.turn = {
|
|
569
|
+
id: typeof p.turn_id === 'string' && p.turn_id ? p.turn_id : `@${rec.pos}`,
|
|
570
|
+
anchor: null, tok: { input_tokens: 0, output_tokens: 0, cache_read_tokens: 0, cache_write_tokens: 0, reasoning_tokens: 0 },
|
|
571
|
+
firstTok: null, firstTokTs: null, firstTokAt: null, lastTok: null,
|
|
572
|
+
};
|
|
573
|
+
},
|
|
574
|
+
endReplay(d) { if (d.a.turn) codexDeriveAdapter.usageRowIfNeeded(d, d.a.turn); },
|
|
575
|
+
usageRowIfNeeded(d, t) {
|
|
576
|
+
if (t.anchor || t.firstTok === null || !xNonZero(t.tok)) return;
|
|
577
|
+
const row = d.turn({ pos: t.firstTok, capturedAt: t.firstTokAt }, {
|
|
578
|
+
message_id: `@${t.firstTok}`, part: 0, role: 'assistant', kind: 'usage', text: '', ts: t.firstTokTs,
|
|
579
|
+
response_id: t.id, model: d.a.model, effort: d.a.effort,
|
|
580
|
+
});
|
|
581
|
+
t.anchor = d.revise(row, xTokFields(t.tok), { pos: t.lastTok });
|
|
582
|
+
},
|
|
583
|
+
// The turn's first assistant row carries the turn's tokens.
|
|
584
|
+
assistantRow(d, row, rec) {
|
|
585
|
+
const t = d.a.turn;
|
|
586
|
+
if (!t || t.anchor) return;
|
|
587
|
+
t.anchor = xNonZero(t.tok) ? d.revise(row, xTokFields(t.tok), { pos: Math.max(rec.pos, t.lastTok || 0) }) : row;
|
|
588
|
+
},
|
|
589
|
+
|
|
590
|
+
process(d, rec) {
|
|
591
|
+
const o = rec.obj;
|
|
592
|
+
const p = (o.payload && typeof o.payload === 'object') ? o.payload : {};
|
|
593
|
+
const a = d.a;
|
|
594
|
+
const ts = d.tsOf(rec, xParseTs(o.timestamp));
|
|
595
|
+
const t = a.turn;
|
|
596
|
+
const asst = { response_id: t ? t.id : '', model: a.model, effort: a.effort };
|
|
597
|
+
|
|
598
|
+
if (o.type === 'session_meta') {
|
|
599
|
+
if (typeof p.id === 'string') d.c.meta.session_id = p.id;
|
|
600
|
+
if (typeof p.cwd === 'string' && p.cwd) { a.folder = p.cwd; if (!d.c.meta.folder) d.c.meta.folder = p.cwd; }
|
|
601
|
+
if (p.git && typeof p.git.branch === 'string') d.c.meta.git_branch = p.git.branch;
|
|
602
|
+
if (typeof p.cli_version === 'string') { a.version = p.cli_version; d.c.meta.version = p.cli_version; }
|
|
603
|
+
if (typeof p.originator === 'string') d.c.meta.originator = p.originator;
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
if (o.type === 'turn_context') {
|
|
607
|
+
if (typeof p.cwd === 'string' && p.cwd) { a.folder = p.cwd; if (!d.c.meta.folder) d.c.meta.folder = p.cwd; }
|
|
608
|
+
if (typeof p.model === 'string' && p.model) a.model = p.model;
|
|
609
|
+
const effort = typeof p.effort === 'string' ? p.effort : (typeof p.reasoning_effort === 'string' ? p.reasoning_effort : null);
|
|
610
|
+
if (effort !== null) a.effort = effort;
|
|
611
|
+
if (t && !t.anchor && t.id.startsWith('@') && typeof p.turn_id === 'string' && p.turn_id) t.id = p.turn_id;
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
if (o.type === 'compacted') {
|
|
615
|
+
d.turn(rec, { message_id: `@${rec.pos}`, part: 0, role: 'system', kind: 'summary', text: typeof p.message === 'string' ? p.message : '', ts });
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
if (o.type === 'event_msg') {
|
|
619
|
+
if (p.type === 'task_started' && t && !t.anchor && t.id.startsWith('@') && typeof p.turn_id === 'string' && p.turn_id) t.id = p.turn_id;
|
|
620
|
+
if (p.type === 'token_count') codexDeriveAdapter.tokens(d, rec, p, ts);
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
if (o.type !== 'response_item') return;
|
|
624
|
+
const mid = typeof p.id === 'string' && p.id ? p.id : `@${rec.pos}`;
|
|
625
|
+
|
|
626
|
+
if (p.type === 'message') {
|
|
627
|
+
const items = Array.isArray(p.content) ? p.content : (typeof p.content === 'string' ? [{ type: 'text', text: p.content }] : []);
|
|
628
|
+
items.forEach((it, i) => {
|
|
629
|
+
if (!it || typeof it.text !== 'string' || i > 255) return;
|
|
630
|
+
if (p.role === 'user') {
|
|
631
|
+
const boot = xIsBoot(it.text);
|
|
632
|
+
d.turn(rec, { message_id: mid, part: i, role: 'user', kind: boot ? 'context' : 'text', text: it.text, ts });
|
|
633
|
+
if (!boot && !d.c.meta.first_prompt && it.text.trim()) d.c.meta.first_prompt = it.text.slice(0, 2000);
|
|
634
|
+
} else if (p.role === 'assistant') {
|
|
635
|
+
const row = d.turn(rec, { ...asst, message_id: mid, part: i, role: 'assistant', kind: 'text', text: it.text, ts });
|
|
636
|
+
codexDeriveAdapter.assistantRow(d, row, rec);
|
|
637
|
+
} else {
|
|
638
|
+
d.turn(rec, { message_id: mid, part: i, role: 'system', kind: 'context', text: it.text, ts });
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (p.type === 'reasoning') {
|
|
644
|
+
let parts = (Array.isArray(p.summary) ? p.summary : []).filter((x) => x && typeof x.text === 'string');
|
|
645
|
+
if (!parts.length) parts = (Array.isArray(p.content) ? p.content : []).filter((x) => x && typeof x.text === 'string');
|
|
646
|
+
if (!parts.length) parts = [{ text: '' }];
|
|
647
|
+
parts.forEach((x, i) => {
|
|
648
|
+
if (i > 255) return;
|
|
649
|
+
const row = d.turn(rec, { ...asst, message_id: mid, part: i, role: 'assistant', kind: 'thinking', text: x.text, ts });
|
|
650
|
+
codexDeriveAdapter.assistantRow(d, row, rec);
|
|
651
|
+
});
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
if (X_ASSISTANT_ITEMS.has(p.type)) {
|
|
655
|
+
let name = p.name || 'tool';
|
|
656
|
+
let args;
|
|
657
|
+
if (p.type === 'function_call') args = typeof p.arguments === 'string' ? p.arguments : JSON.stringify(p.arguments ?? {});
|
|
658
|
+
else if (p.type === 'custom_tool_call') args = JSON.stringify({ input: p.input ?? '' });
|
|
659
|
+
else if (p.type === 'local_shell_call') { name = 'local_shell'; args = JSON.stringify(p.action ?? {}); }
|
|
660
|
+
else { name = 'web_search'; args = JSON.stringify(p.action ?? {}); }
|
|
661
|
+
const callId = p.call_id || p.id || `@${rec.pos}`;
|
|
662
|
+
const row = d.turn(rec, { ...asst, message_id: mid, part: 0, role: 'assistant', kind: 'tool_call', text: `${name}(${args})`, ts, extra: { call_id: String(callId) } });
|
|
663
|
+
codexDeriveAdapter.assistantRow(d, row, rec);
|
|
664
|
+
d.call(rec, { call_id: callId, message_id: mid, ts, tool_name: name, args, model: a.model });
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
if (p.type === 'function_call_output' || p.type === 'custom_tool_call_output') {
|
|
668
|
+
const text = xOutputText(p.output);
|
|
669
|
+
d.turn(rec, { message_id: mid, part: 0, role: 'tool', kind: 'tool_result', text, ts, response_id: asst.response_id, extra: { call_id: String(p.call_id || '') } });
|
|
670
|
+
d.result(rec, p.call_id, { ts, is_error: xOutputError(p.output), result_len: text.length });
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
|
|
674
|
+
tokens(d, rec, p, ts) {
|
|
675
|
+
const info = p.info;
|
|
676
|
+
if (!info || typeof info !== 'object') return;
|
|
677
|
+
const a = d.a;
|
|
678
|
+
const total = xRaw(info.total_token_usage);
|
|
679
|
+
const last = xRaw(info.last_token_usage);
|
|
680
|
+
if (total && a.prev && xSame(total, a.prev)) return; // the same running total again: nothing new
|
|
681
|
+
let delta = last;
|
|
682
|
+
if (!delta && total) delta = xSub(total, a.prev);
|
|
683
|
+
if (total) a.prev = total;
|
|
684
|
+
if (!delta) return;
|
|
685
|
+
const cached = Math.min(delta.cached, delta.input);
|
|
686
|
+
const add = { input_tokens: Math.max(delta.input - cached, 0), cache_read_tokens: cached, cache_write_tokens: delta.cache_write, output_tokens: delta.output, reasoning_tokens: delta.reasoning };
|
|
687
|
+
if (!xNonZero(add)) return;
|
|
688
|
+
const t = a.turn;
|
|
689
|
+
if (!t) { d.c.meta.orphan_token_events = (d.c.meta.orphan_token_events || 0) + 1; return; }
|
|
690
|
+
for (const k of Object.keys(add)) t.tok[k] += add[k];
|
|
691
|
+
t.lastTok = rec.pos;
|
|
692
|
+
if (t.firstTok === null) { t.firstTok = rec.pos; t.firstTokTs = ts; t.firstTokAt = rec.capturedAt; }
|
|
693
|
+
if (t.anchor) t.anchor = d.revise(t.anchor, xTokFields(t.tok), rec);
|
|
694
|
+
},
|
|
695
|
+
};
|
|
696
|
+
// </derive> ===================================================================================
|
|
697
|
+
|
|
698
|
+
// Discovery under one source root: a Codex `sessions/` (or `archived_sessions/`) directory.
|
|
699
|
+
const X_ROLLOUT_ID = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i;
|
|
700
|
+
function captureSessions(root) {
|
|
701
|
+
const bySession = new Map();
|
|
702
|
+
for (const file of walkJsonlFiles(root.dir)) {
|
|
703
|
+
if (!path.basename(file).startsWith('rollout-')) continue;
|
|
704
|
+
let id = (X_ROLLOUT_ID.exec(path.basename(file)) || [])[1];
|
|
705
|
+
if (!id) {
|
|
706
|
+
const first = safeParseJson((readFirstLine(file) || ''));
|
|
707
|
+
id = (first && first.type === 'session_meta' && first.payload && first.payload.id) || path.basename(file, '.jsonl');
|
|
708
|
+
}
|
|
709
|
+
if (!bySession.has(id)) bySession.set(id, { harness: 'codex', session_id: id, root: root.name, paths: [] });
|
|
710
|
+
bySession.get(id).paths.push(file);
|
|
711
|
+
}
|
|
712
|
+
return [...bySession.values()];
|
|
713
|
+
}
|
|
714
|
+
function captureSourceFiles(session) {
|
|
715
|
+
return session.paths.map((p) => ({ file_key: path.basename(p), path: p, agent_id: '', role: 'main' }));
|
|
716
|
+
}
|
|
717
|
+
function readFirstLine(file) {
|
|
718
|
+
try {
|
|
719
|
+
const fd = fs.openSync(file, 'r');
|
|
720
|
+
try {
|
|
721
|
+
const buf = Buffer.alloc(65536);
|
|
722
|
+
const n = fs.readSync(fd, buf, 0, buf.length, 0);
|
|
723
|
+
const s = buf.subarray(0, n).toString('utf-8');
|
|
724
|
+
const nl = s.indexOf('\n');
|
|
725
|
+
return nl === -1 ? null : s.slice(0, nl);
|
|
726
|
+
} finally { fs.closeSync(fd); }
|
|
727
|
+
} catch { return null; }
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
const capture = {
|
|
731
|
+
harness: 'codex',
|
|
732
|
+
deriveVersion: CODEX_DERIVE_VERSION,
|
|
733
|
+
sessions: captureSessions,
|
|
734
|
+
sourceFiles: captureSourceFiles,
|
|
735
|
+
attribution: () => ({ agent_type: '', agent_desc: '' }),
|
|
736
|
+
tsless: (o) => !o || typeof o.timestamp !== 'string', // dated by first sighting (§2.1)
|
|
737
|
+
derive: (input) => require('./base').capture.runDerive(codexDeriveAdapter, input),
|
|
738
|
+
adapter: codexDeriveAdapter,
|
|
739
|
+
};
|
|
514
740
|
|
|
515
741
|
const labels = { 'codex': 'Codex' };
|
|
516
742
|
|
|
@@ -535,6 +761,6 @@ module.exports = {
|
|
|
535
761
|
getArtifacts,
|
|
536
762
|
getChats,
|
|
537
763
|
getMessages,
|
|
538
|
-
getUsage,
|
|
539
764
|
getMCPServers,
|
|
765
|
+
capture,
|
|
540
766
|
};
|
package/editors/copilot.js
CHANGED
|
@@ -172,75 +172,6 @@ function safeParse(str) {
|
|
|
172
172
|
try { return JSON.parse(str); } catch { return {}; }
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
// ============================================================
|
|
176
|
-
// Usage / quota data from GitHub Copilot internal API
|
|
177
|
-
// ============================================================
|
|
178
|
-
|
|
179
|
-
function getCopilotToken() {
|
|
180
|
-
// GitHub Copilot stores its OAuth token in ~/.config/github-copilot/apps.json
|
|
181
|
-
const appsPath = path.join(os.homedir(), '.config', 'github-copilot', 'apps.json');
|
|
182
|
-
try {
|
|
183
|
-
if (!fs.existsSync(appsPath)) return null;
|
|
184
|
-
const data = JSON.parse(fs.readFileSync(appsPath, 'utf-8'));
|
|
185
|
-
for (const entry of Object.values(data)) {
|
|
186
|
-
if (entry.oauth_token) return { token: entry.oauth_token, user: entry.user || null };
|
|
187
|
-
}
|
|
188
|
-
} catch {}
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function fetchCopilotStatus(token) {
|
|
193
|
-
return new Promise((resolve) => {
|
|
194
|
-
const https = require('https');
|
|
195
|
-
const req = https.get('https://api.github.com/copilot_internal/v2/token', {
|
|
196
|
-
headers: {
|
|
197
|
-
'Authorization': `token ${token}`,
|
|
198
|
-
'Accept': 'application/json',
|
|
199
|
-
'User-Agent': 'agentlytics/1.0',
|
|
200
|
-
},
|
|
201
|
-
timeout: 10000,
|
|
202
|
-
}, (res) => {
|
|
203
|
-
let data = '';
|
|
204
|
-
res.on('data', (chunk) => { data += chunk; });
|
|
205
|
-
res.on('end', () => {
|
|
206
|
-
try { resolve(JSON.parse(data)); } catch { resolve(null); }
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
req.on('error', () => resolve(null));
|
|
210
|
-
req.on('timeout', () => { req.destroy(); resolve(null); });
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
async function getUsage() {
|
|
215
|
-
const { isSubscriptionAccessAllowed } = require('./base');
|
|
216
|
-
if (!isSubscriptionAccessAllowed()) return null;
|
|
217
|
-
const creds = getCopilotToken();
|
|
218
|
-
if (!creds) return null;
|
|
219
|
-
|
|
220
|
-
const status = await fetchCopilotStatus(creds.token);
|
|
221
|
-
if (!status || status.message) return null;
|
|
222
|
-
|
|
223
|
-
return {
|
|
224
|
-
source: 'copilot-cli',
|
|
225
|
-
plan: {
|
|
226
|
-
name: status.sku || null,
|
|
227
|
-
individual: status.individual || false,
|
|
228
|
-
},
|
|
229
|
-
features: {
|
|
230
|
-
chat: status.chat_enabled || false,
|
|
231
|
-
codeReview: status.code_review_enabled || false,
|
|
232
|
-
agentMode: status.agent_mode_auto_approval || false,
|
|
233
|
-
},
|
|
234
|
-
limits: {
|
|
235
|
-
quotas: status.limited_user_quotas || null,
|
|
236
|
-
resetDate: status.limited_user_reset_date || null,
|
|
237
|
-
},
|
|
238
|
-
user: {
|
|
239
|
-
login: creds.user || null,
|
|
240
|
-
},
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
|
|
244
175
|
const labels = { 'copilot-cli': 'GitHub Copilot' };
|
|
245
176
|
|
|
246
177
|
function getArtifacts(folder) {
|
|
@@ -258,4 +189,4 @@ function getMCPServers() {
|
|
|
258
189
|
return [];
|
|
259
190
|
}
|
|
260
191
|
|
|
261
|
-
module.exports = { name, labels, getChats, getMessages,
|
|
192
|
+
module.exports = { name, labels, getChats, getMessages, getArtifacts, getMCPServers };
|
package/editors/cursor.js
CHANGED
|
@@ -406,80 +406,6 @@ function getMessages(chat) {
|
|
|
406
406
|
return msgs;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
// ============================================================
|
|
410
|
-
// Usage / quota data from Cursor REST API
|
|
411
|
-
// ============================================================
|
|
412
|
-
|
|
413
|
-
function getCursorAccessToken() {
|
|
414
|
-
try {
|
|
415
|
-
const db = openReadOnly(GLOBAL_STORAGE_DB);
|
|
416
|
-
const row = db.prepare("SELECT value FROM ItemTable WHERE key = 'cursorAuth/accessToken'").get();
|
|
417
|
-
db.close();
|
|
418
|
-
return row ? textOf(row.value) : null;
|
|
419
|
-
} catch { return null; }
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
function cursorApiFetch(endpoint, token) {
|
|
423
|
-
return new Promise((resolve) => {
|
|
424
|
-
const https = require('https');
|
|
425
|
-
const url = `https://api2.cursor.sh/auth/${endpoint}`;
|
|
426
|
-
const req = https.get(url, {
|
|
427
|
-
headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
428
|
-
timeout: 10000,
|
|
429
|
-
}, (res) => {
|
|
430
|
-
let data = '';
|
|
431
|
-
res.on('data', (chunk) => { data += chunk; });
|
|
432
|
-
res.on('end', () => {
|
|
433
|
-
try { resolve(JSON.parse(data)); } catch { resolve(null); }
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
req.on('error', () => resolve(null));
|
|
437
|
-
req.on('timeout', () => { req.destroy(); resolve(null); });
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
async function getUsage() {
|
|
442
|
-
const { isSubscriptionAccessAllowed } = require('./base');
|
|
443
|
-
if (!isSubscriptionAccessAllowed()) return null;
|
|
444
|
-
const token = getCursorAccessToken();
|
|
445
|
-
if (!token) return null;
|
|
446
|
-
|
|
447
|
-
const [profile, usage] = await Promise.all([
|
|
448
|
-
cursorApiFetch('full_stripe_profile', token),
|
|
449
|
-
cursorApiFetch('usage', token),
|
|
450
|
-
]);
|
|
451
|
-
|
|
452
|
-
if (!profile && !usage) return null;
|
|
453
|
-
|
|
454
|
-
const result = {
|
|
455
|
-
source: 'cursor',
|
|
456
|
-
plan: {
|
|
457
|
-
name: profile?.individualMembershipType || profile?.membershipType || null,
|
|
458
|
-
status: profile?.subscriptionStatus || null,
|
|
459
|
-
isTeamMember: profile?.isTeamMember || false,
|
|
460
|
-
isYearlyPlan: profile?.isYearlyPlan || false,
|
|
461
|
-
},
|
|
462
|
-
usage: {},
|
|
463
|
-
startOfMonth: usage?.startOfMonth || null,
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
// Parse per-model usage from the usage endpoint
|
|
467
|
-
if (usage) {
|
|
468
|
-
for (const [model, data] of Object.entries(usage)) {
|
|
469
|
-
if (model === 'startOfMonth') continue;
|
|
470
|
-
result.usage[model] = {
|
|
471
|
-
numRequests: data.numRequests || 0,
|
|
472
|
-
numRequestsTotal: data.numRequestsTotal || 0,
|
|
473
|
-
numTokens: data.numTokens || 0,
|
|
474
|
-
maxRequestUsage: data.maxRequestUsage || null,
|
|
475
|
-
maxTokenUsage: data.maxTokenUsage || null,
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
return result;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
409
|
const labels = { 'cursor': 'Cursor' };
|
|
484
410
|
|
|
485
411
|
function getArtifacts(folder) {
|
|
@@ -500,4 +426,4 @@ function getMCPServers() {
|
|
|
500
426
|
];
|
|
501
427
|
}
|
|
502
428
|
|
|
503
|
-
module.exports = { name, labels, getChats, getMessages,
|
|
429
|
+
module.exports = { name, labels, getChats, getMessages, getArtifacts, getMCPServers };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claude-code": {
|
|
3
|
+
"version": 3,
|
|
4
|
+
"sha256": "1e4b51cbc0e401bee37ea6f46dead4a939f4b2bf5490f6cac6871ec7e5f4cd89"
|
|
5
|
+
},
|
|
6
|
+
"codex": {
|
|
7
|
+
"version": 4,
|
|
8
|
+
"sha256": "c6267057918a20b5b7de7de1334ff6aacf488ba5a85d28525fca24da0e934b13"
|
|
9
|
+
},
|
|
10
|
+
"bridge": {
|
|
11
|
+
"version": 3,
|
|
12
|
+
"sha256": "401ac8a8c832e129f821dba6ffa38b1db8be09ece1dcfdf36b465ff63505ace8"
|
|
13
|
+
},
|
|
14
|
+
"log": {
|
|
15
|
+
"version": 1006,
|
|
16
|
+
"sha256": "0e62e44493dc53bd40f67ec4c9411664ebb7d257f37dc60dda86d1a91c018f31"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Each harness's data folder: the `harness_path` that keys its sessions (sessions-model §1, layout
|
|
3
|
+
// 3.2). One table, used by the 0.18 bridge and by the v4 normalisers alike, so a harness that
|
|
4
|
+
// switches from the bridge to its normaliser keeps the same store key.
|
|
5
|
+
//
|
|
6
|
+
// The contract's rule: absolute, symlink-resolved, the on-disk case from the native resolver, no
|
|
7
|
+
// trailing slash. A folder that does not exist (yet) resolves to its absolute path.
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const os = require('os');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
|
|
13
|
+
function resolveNative(p) {
|
|
14
|
+
try { return fs.realpathSync.native(p); } catch { return path.resolve(p); }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The default data folder of a harness on this platform, before resolution. Where the harness
|
|
19
|
+
* itself honours an override (cursor-agent: CURSOR_CONFIG_DIR, then XDG_CONFIG_HOME/cursor;
|
|
20
|
+
* opencode: XDG_DATA_HOME; goose: GOOSE_PATH_ROOT/data, then XDG_DATA_HOME; gemini-cli:
|
|
21
|
+
* GEMINI_CLI_HOME/.gemini; copilot-cli: COPILOT_HOME; the Electron editors: APPDATA,
|
|
22
|
+
* XDG_CONFIG_HOME), so does this, so the bridge and the normaliser name the same store.
|
|
23
|
+
*/
|
|
24
|
+
function defaultFolder(harness, { home = os.homedir(), platform = process.platform, env = process.env } = {}) {
|
|
25
|
+
const mac = platform === 'darwin';
|
|
26
|
+
// The per-user app data folder, as the Electron editors resolve it: Application Support on macOS,
|
|
27
|
+
// APPDATA on Windows, XDG_CONFIG_HOME (else ~/.config) elsewhere.
|
|
28
|
+
const appSupport = (name) => {
|
|
29
|
+
if (mac) return path.join(home, 'Library', 'Application Support', name);
|
|
30
|
+
if (platform === 'win32') return path.join(env.APPDATA ? path.resolve(env.APPDATA) : path.join(home, 'AppData', 'Roaming'), name);
|
|
31
|
+
return path.join(env.XDG_CONFIG_HOME ? path.resolve(env.XDG_CONFIG_HOME) : path.join(home, '.config'), name);
|
|
32
|
+
};
|
|
33
|
+
switch (harness) {
|
|
34
|
+
case 'claude-code': return path.join(home, '.claude');
|
|
35
|
+
case 'codex': return path.join(home, '.codex');
|
|
36
|
+
case 'gemini-cli': return path.join(env.GEMINI_CLI_HOME ? path.resolve(env.GEMINI_CLI_HOME) : home, '.gemini');
|
|
37
|
+
// XDG data dirs on every platform, as both tools resolve them; Goose's own root wins over XDG.
|
|
38
|
+
case 'opencode': return path.join(env.XDG_DATA_HOME ? path.resolve(env.XDG_DATA_HOME) : path.join(home, '.local', 'share'), 'opencode');
|
|
39
|
+
case 'goose':
|
|
40
|
+
if (env.GOOSE_PATH_ROOT) return path.join(path.resolve(env.GOOSE_PATH_ROOT), 'data');
|
|
41
|
+
return path.join(env.XDG_DATA_HOME ? path.resolve(env.XDG_DATA_HOME) : path.join(home, '.local', 'share'), 'goose');
|
|
42
|
+
case 'zed': return mac ? path.join(home, 'Library', 'Application Support', 'Zed') : path.join(home, '.local', 'share', 'zed');
|
|
43
|
+
case 'cursor': return appSupport('Cursor');
|
|
44
|
+
case 'cursor-agent':
|
|
45
|
+
if (env.CURSOR_CONFIG_DIR) return path.resolve(env.CURSOR_CONFIG_DIR);
|
|
46
|
+
if (env.XDG_CONFIG_HOME) return path.join(env.XDG_CONFIG_HOME, 'cursor');
|
|
47
|
+
return path.join(home, '.cursor');
|
|
48
|
+
case 'vscode': return appSupport('Code');
|
|
49
|
+
case 'copilot-cli': return env.COPILOT_HOME ? path.resolve(env.COPILOT_HOME) : path.join(home, '.copilot');
|
|
50
|
+
case 'copilot-jetbrains': return path.join(home, '.copilot', 'jb');
|
|
51
|
+
case 'kiro': return appSupport('Kiro');
|
|
52
|
+
// Devin Desktop (the Windsurf app, read by the 0.18 reader over its language server). Devin
|
|
53
|
+
// Local keeps its sessions elsewhere (~/.local/share/devin/cli): another store of this harness.
|
|
54
|
+
case 'devin': return appSupport('Windsurf');
|
|
55
|
+
case 'antigravity': return appSupport('Antigravity');
|
|
56
|
+
case 'agy': return path.join(home, '.gemini', 'antigravity-cli');
|
|
57
|
+
case 'commandcode': return path.join(home, '.commandcode');
|
|
58
|
+
case 'droid': return path.join(home, '.factory');
|
|
59
|
+
default: return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The harness_path for a harness's default data folder (or `fallback` for an unknown harness). */
|
|
64
|
+
function dataFolder(harness, opts = {}) {
|
|
65
|
+
const d = defaultFolder(harness, opts);
|
|
66
|
+
return d ? resolveNative(d) : (opts.fallback ? resolveNative(opts.fallback) : '');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = { dataFolder, defaultFolder, resolveNative };
|
package/editors/index.js
CHANGED
|
@@ -118,25 +118,6 @@ function resetCaches() {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
/**
|
|
122
|
-
* Get usage / quota data from all editors that support it.
|
|
123
|
-
* Returns an array of usage objects, one per editor/variant.
|
|
124
|
-
*/
|
|
125
|
-
async function getAllUsage() {
|
|
126
|
-
const results = [];
|
|
127
|
-
for (const editor of editors) {
|
|
128
|
-
if (typeof editor.getUsage !== 'function') continue;
|
|
129
|
-
try {
|
|
130
|
-
const usage = await editor.getUsage();
|
|
131
|
-
if (!usage) continue;
|
|
132
|
-
// Devin returns an array (one per variant), Cursor returns a single object
|
|
133
|
-
if (Array.isArray(usage)) results.push(...usage);
|
|
134
|
-
else results.push(usage);
|
|
135
|
-
} catch { /* skip broken adapters */ }
|
|
136
|
-
}
|
|
137
|
-
return results;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
121
|
/**
|
|
141
122
|
* Get all artifacts for a given project folder from all editors.
|
|
142
123
|
* Also scans for general/shared artifact files (plan.md, etc.).
|
|
@@ -227,4 +208,4 @@ function getAllMCPServers(projectFolders = []) {
|
|
|
227
208
|
return Array.from(seen.values());
|
|
228
209
|
}
|
|
229
210
|
|
|
230
|
-
module.exports = { getAllChats, getAdapterErrors, getMessages, editors, editorLabels, resetCaches,
|
|
211
|
+
module.exports = { getAllChats, getAdapterErrors, getMessages, editors, editorLabels, resetCaches, getAllArtifacts, getAllMCPServers };
|