agentsofmine 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +297 -2
- package/dist/adapters/adapter.d.ts +14 -0
- package/dist/adapters/adapter.js +2 -0
- package/dist/adapters/claude-code/accumulator.d.ts +34 -0
- package/dist/adapters/claude-code/accumulator.js +129 -0
- package/dist/adapters/claude-code/content-blocks.d.ts +40 -0
- package/dist/adapters/claude-code/content-blocks.js +93 -0
- package/dist/adapters/claude-code/index.d.ts +20 -0
- package/dist/adapters/claude-code/index.js +92 -0
- package/dist/adapters/claude-code/jsonl-reader.d.ts +14 -0
- package/dist/adapters/claude-code/jsonl-reader.js +31 -0
- package/dist/adapters/claude-code/mapper.d.ts +6 -0
- package/dist/adapters/claude-code/mapper.js +23 -0
- package/dist/adapters/codex/index.d.ts +8 -0
- package/dist/adapters/codex/index.js +42 -0
- package/dist/adapters/codex/log-reader.d.ts +14 -0
- package/dist/adapters/codex/log-reader.js +182 -0
- package/dist/adapters/codex/shell-parser.d.ts +6 -0
- package/dist/adapters/codex/shell-parser.js +72 -0
- package/dist/adapters/opencode/file-changes.d.ts +8 -0
- package/dist/adapters/opencode/file-changes.js +38 -0
- package/dist/adapters/opencode/index.d.ts +13 -0
- package/dist/adapters/opencode/index.js +58 -0
- package/dist/adapters/opencode/mapper.d.ts +4 -0
- package/dist/adapters/opencode/mapper.js +56 -0
- package/dist/adapters/opencode/sqlite-reader.d.ts +19 -0
- package/dist/adapters/opencode/sqlite-reader.js +109 -0
- package/dist/adapters/pi/index.d.ts +8 -0
- package/dist/adapters/pi/index.js +76 -0
- package/dist/adapters/pi/jsonl-reader.d.ts +2 -0
- package/dist/adapters/pi/jsonl-reader.js +2 -0
- package/dist/adapters/pi/mapper.d.ts +22 -0
- package/dist/adapters/pi/mapper.js +230 -0
- package/dist/api/pairing-client.d.ts +41 -0
- package/dist/api/pairing-client.js +77 -0
- package/dist/bin/aom.d.ts +13 -0
- package/dist/bin/aom.js +73 -0
- package/dist/cli/pair.d.ts +28 -0
- package/dist/cli/pair.js +114 -0
- package/dist/cli/start.d.ts +22 -0
- package/dist/cli/start.js +78 -0
- package/dist/cli/status.d.ts +19 -0
- package/dist/cli/status.js +108 -0
- package/dist/cli/sync.d.ts +16 -0
- package/dist/cli/sync.js +50 -0
- package/dist/cli/unpair.d.ts +18 -0
- package/dist/cli/unpair.js +49 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +33 -0
- package/dist/core/canonical.d.ts +957 -0
- package/dist/core/canonical.js +80 -0
- package/dist/core/cursor-store.d.ts +18 -0
- package/dist/core/cursor-store.js +50 -0
- package/dist/core/debug-log.d.ts +12 -0
- package/dist/core/debug-log.js +17 -0
- package/dist/core/git-identity.d.ts +23 -0
- package/dist/core/git-identity.js +127 -0
- package/dist/core/http-client.d.ts +7 -0
- package/dist/core/http-client.js +63 -0
- package/dist/core/last-sync-store.d.ts +9 -0
- package/dist/core/last-sync-store.js +31 -0
- package/dist/core/message-truncation.d.ts +10 -0
- package/dist/core/message-truncation.js +13 -0
- package/dist/core/perform-sync.d.ts +23 -0
- package/dist/core/perform-sync.js +57 -0
- package/dist/core/project-identity.d.ts +40 -0
- package/dist/core/project-identity.js +67 -0
- package/dist/core/providers.d.ts +26 -0
- package/dist/core/providers.js +25 -0
- package/dist/core/providers.json +4 -0
- package/dist/core/redact.d.ts +44 -0
- package/dist/core/redact.js +177 -0
- package/dist/core/safe-json.d.ts +7 -0
- package/dist/core/safe-json.js +14 -0
- package/dist/core/sync-engine.d.ts +17 -0
- package/dist/core/sync-engine.js +64 -0
- package/dist/daemon/state.d.ts +22 -0
- package/dist/daemon/state.js +32 -0
- package/dist/daemon/sync-runner.d.ts +52 -0
- package/dist/daemon/sync-runner.js +104 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +68 -0
- package/dist/infrastructure/config-repository.d.ts +34 -0
- package/dist/infrastructure/config-repository.js +102 -0
- package/dist/keychain/index.d.ts +31 -0
- package/dist/keychain/index.js +62 -0
- package/dist/mcp/json-rpc.d.ts +39 -0
- package/dist/mcp/json-rpc.js +46 -0
- package/dist/mcp/server.d.ts +33 -0
- package/dist/mcp/server.js +110 -0
- package/dist/mcp-tools/status.d.ts +17 -0
- package/dist/mcp-tools/status.js +24 -0
- package/dist/mcp-tools/sync-now.d.ts +9 -0
- package/dist/mcp-tools/sync-now.js +8 -0
- package/dist/services/pairing-service.d.ts +58 -0
- package/dist/services/pairing-service.js +102 -0
- package/dist/watchers/directory-watcher.d.ts +26 -0
- package/dist/watchers/directory-watcher.js +47 -0
- package/dist/watchers/opencode.d.ts +27 -0
- package/dist/watchers/opencode.js +58 -0
- package/package.json +64 -4
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic recursive directory watcher.
|
|
3
|
+
*
|
|
4
|
+
* Claude Code and Codex persist sessions as files under a directory tree
|
|
5
|
+
* (JSONL files for Claude, session logs for Codex), unlike OpenCode's single
|
|
6
|
+
* SQLite DB. This watcher signals the shared SyncRunner whenever anything
|
|
7
|
+
* under the watched directory changes. It does not parse anything — the
|
|
8
|
+
* adapters (driven by performSync) do the incremental read from the cursor.
|
|
9
|
+
*/
|
|
10
|
+
import type { DaemonState } from "../daemon/state.js";
|
|
11
|
+
import type { SyncRunner } from "../daemon/sync-runner.js";
|
|
12
|
+
export declare class DirectoryWatcher {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
private readonly dir;
|
|
15
|
+
private readonly state;
|
|
16
|
+
private readonly syncRunner;
|
|
17
|
+
/** Only react to files matching this predicate (default: all). */
|
|
18
|
+
private readonly matches;
|
|
19
|
+
private watcher;
|
|
20
|
+
constructor(name: string, dir: string, state: DaemonState, syncRunner: SyncRunner,
|
|
21
|
+
/** Only react to files matching this predicate (default: all). */
|
|
22
|
+
matches?: (filename: string) => boolean);
|
|
23
|
+
start(): Promise<void>;
|
|
24
|
+
stop(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=directory-watcher.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic recursive directory watcher.
|
|
3
|
+
*
|
|
4
|
+
* Claude Code and Codex persist sessions as files under a directory tree
|
|
5
|
+
* (JSONL files for Claude, session logs for Codex), unlike OpenCode's single
|
|
6
|
+
* SQLite DB. This watcher signals the shared SyncRunner whenever anything
|
|
7
|
+
* under the watched directory changes. It does not parse anything — the
|
|
8
|
+
* adapters (driven by performSync) do the incremental read from the cursor.
|
|
9
|
+
*/
|
|
10
|
+
import { watch, existsSync } from "node:fs";
|
|
11
|
+
export class DirectoryWatcher {
|
|
12
|
+
name;
|
|
13
|
+
dir;
|
|
14
|
+
state;
|
|
15
|
+
syncRunner;
|
|
16
|
+
matches;
|
|
17
|
+
watcher = null;
|
|
18
|
+
constructor(name, dir, state, syncRunner,
|
|
19
|
+
/** Only react to files matching this predicate (default: all). */
|
|
20
|
+
matches = () => true) {
|
|
21
|
+
this.name = name;
|
|
22
|
+
this.dir = dir;
|
|
23
|
+
this.state = state;
|
|
24
|
+
this.syncRunner = syncRunner;
|
|
25
|
+
this.matches = matches;
|
|
26
|
+
}
|
|
27
|
+
async start() {
|
|
28
|
+
if (!existsSync(this.dir)) {
|
|
29
|
+
this.state.log(`${this.name} watcher: ${this.dir} does not exist yet — not watching`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.watcher = watch(this.dir, { recursive: true }, (_event, filename) => {
|
|
33
|
+
if (!filename)
|
|
34
|
+
return;
|
|
35
|
+
if (!this.matches(filename))
|
|
36
|
+
return;
|
|
37
|
+
this.syncRunner.trigger(`${this.name} change: ${filename}`);
|
|
38
|
+
});
|
|
39
|
+
this.state.log(`${this.name} watcher: watching ${this.dir}`);
|
|
40
|
+
}
|
|
41
|
+
async stop() {
|
|
42
|
+
this.watcher?.close();
|
|
43
|
+
this.watcher = null;
|
|
44
|
+
this.state.log(`${this.name} watcher: stopped`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=directory-watcher.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode session watcher.
|
|
3
|
+
*
|
|
4
|
+
* OpenCode persists sessions to a SQLite database at
|
|
5
|
+
* ~/.local/share/opencode/opencode.db. This watcher detects writes to that
|
|
6
|
+
* database (and its WAL sidecar) and asks the shared SyncRunner to sync.
|
|
7
|
+
*
|
|
8
|
+
* It deliberately watches the *real* data source — the SQLite DB — not the
|
|
9
|
+
* legacy ~/.opencode/sessions/ directory, which OpenCode no longer uses.
|
|
10
|
+
*
|
|
11
|
+
* The watcher does not parse anything itself: it only signals "something
|
|
12
|
+
* changed". The OpenCodeAdapter (driven by performSync) does the actual
|
|
13
|
+
* incremental read from the cursor.
|
|
14
|
+
*/
|
|
15
|
+
import type { DaemonState } from "../daemon/state.js";
|
|
16
|
+
import type { SyncRunner } from "../daemon/sync-runner.js";
|
|
17
|
+
export declare class OpenCodeWatcher {
|
|
18
|
+
private readonly state;
|
|
19
|
+
private readonly syncRunner;
|
|
20
|
+
private readonly dbPath;
|
|
21
|
+
readonly name = "opencode";
|
|
22
|
+
private watcher;
|
|
23
|
+
constructor(state: DaemonState, syncRunner: SyncRunner, dbPath?: string);
|
|
24
|
+
start(): Promise<void>;
|
|
25
|
+
stop(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=opencode.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode session watcher.
|
|
3
|
+
*
|
|
4
|
+
* OpenCode persists sessions to a SQLite database at
|
|
5
|
+
* ~/.local/share/opencode/opencode.db. This watcher detects writes to that
|
|
6
|
+
* database (and its WAL sidecar) and asks the shared SyncRunner to sync.
|
|
7
|
+
*
|
|
8
|
+
* It deliberately watches the *real* data source — the SQLite DB — not the
|
|
9
|
+
* legacy ~/.opencode/sessions/ directory, which OpenCode no longer uses.
|
|
10
|
+
*
|
|
11
|
+
* The watcher does not parse anything itself: it only signals "something
|
|
12
|
+
* changed". The OpenCodeAdapter (driven by performSync) does the actual
|
|
13
|
+
* incremental read from the cursor.
|
|
14
|
+
*/
|
|
15
|
+
import { watch, existsSync } from "node:fs";
|
|
16
|
+
import { homedir } from "node:os";
|
|
17
|
+
import { join, dirname, basename } from "node:path";
|
|
18
|
+
const OPENCODE_DB_PATH = join(homedir(), ".local", "share", "opencode", "opencode.db");
|
|
19
|
+
export class OpenCodeWatcher {
|
|
20
|
+
state;
|
|
21
|
+
syncRunner;
|
|
22
|
+
dbPath;
|
|
23
|
+
name = "opencode";
|
|
24
|
+
watcher = null;
|
|
25
|
+
constructor(state, syncRunner, dbPath = OPENCODE_DB_PATH) {
|
|
26
|
+
this.state = state;
|
|
27
|
+
this.syncRunner = syncRunner;
|
|
28
|
+
this.dbPath = dbPath;
|
|
29
|
+
}
|
|
30
|
+
async start() {
|
|
31
|
+
const dir = dirname(this.dbPath);
|
|
32
|
+
if (!existsSync(dir)) {
|
|
33
|
+
// OpenCode hasn't run on this machine yet. Nothing to watch; the daemon
|
|
34
|
+
// stays up and a future `aom start` (or restart) will pick it up.
|
|
35
|
+
this.state.log(`OpenCode watcher: ${dir} does not exist yet — not watching`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const dbName = basename(this.dbPath);
|
|
39
|
+
// Watch the containing directory rather than the DB file directly: SQLite
|
|
40
|
+
// WAL mode writes to `<db>-wal` / `<db>-shm` sidecars and atomic renames
|
|
41
|
+
// can break a file-level watch. Directory watch catches all of it.
|
|
42
|
+
this.watcher = watch(dir, (_event, filename) => {
|
|
43
|
+
if (!filename)
|
|
44
|
+
return;
|
|
45
|
+
// Only react to the opencode DB family (db, db-wal, db-shm).
|
|
46
|
+
if (!filename.startsWith(dbName))
|
|
47
|
+
return;
|
|
48
|
+
this.syncRunner.trigger(`opencode db change: ${filename}`);
|
|
49
|
+
});
|
|
50
|
+
this.state.log(`OpenCode watcher: watching ${this.dbPath}`);
|
|
51
|
+
}
|
|
52
|
+
async stop() {
|
|
53
|
+
this.watcher?.close();
|
|
54
|
+
this.watcher = null;
|
|
55
|
+
this.state.log("OpenCode watcher: stopped");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=opencode.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentsofmine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local MCP server that reads AI coding agent sessions and syncs to AgentsOfMine backend",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://agentsofmine.io",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/AgentsOfMine/collector.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/AgentsOfMine/collector/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ai-coding",
|
|
16
|
+
"claude-code",
|
|
17
|
+
"opencode",
|
|
18
|
+
"codex",
|
|
19
|
+
"mcp",
|
|
20
|
+
"session-sync",
|
|
21
|
+
"cli"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "dist/index.js",
|
|
25
|
+
"bin": {
|
|
26
|
+
"aom": "./dist/bin/aom.js"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"!dist/**/*.map"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=20"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"dev": "tsx src/index.ts",
|
|
39
|
+
"lint": "eslint src test",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"check": "npm run build && npm run lint && npm test",
|
|
42
|
+
"prepare": "tsc",
|
|
43
|
+
"prepublishOnly": "npm run build && npm test"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
47
|
+
"better-sqlite3": "^12.0.0",
|
|
48
|
+
"commander": "^15.0.0",
|
|
49
|
+
"keytar": "^7.9.0",
|
|
50
|
+
"open": "^11.0.0",
|
|
51
|
+
"qrcode-terminal": "^0.12.0",
|
|
52
|
+
"zod": "^3.23.8"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@eslint/js": "^9.39.4",
|
|
56
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
57
|
+
"@types/node": "^20.14.0",
|
|
58
|
+
"@types/qrcode-terminal": "^0.12.2",
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^8.61.0",
|
|
60
|
+
"@typescript-eslint/parser": "^8.61.0",
|
|
61
|
+
"eslint": "^9.39.4",
|
|
62
|
+
"tsx": "^4.15.7",
|
|
63
|
+
"typescript": "^5.5.2",
|
|
64
|
+
"vitest": "^1.6.0"
|
|
65
|
+
}
|
|
66
|
+
}
|