crossroom 0.0.0-stage → 0.2.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.
@@ -0,0 +1,10 @@
1
+ import { createRequire as __parleyRequire } from 'node:module'; const require = __parleyRequire(import.meta.url);
2
+ import {
3
+ DEFAULT_INSTANCE,
4
+ DEFAULT_RELAY
5
+ } from "./chunk-EIMFGA2U.mjs";
6
+ import "./chunk-P7MSGDOB.mjs";
7
+ export {
8
+ DEFAULT_INSTANCE,
9
+ DEFAULT_RELAY
10
+ };
@@ -0,0 +1,145 @@
1
+ import { createRequire as __parleyRequire } from 'node:module'; const require = __parleyRequire(import.meta.url);
2
+ import {
3
+ API_KEY_ENV,
4
+ API_TOKEN,
5
+ chosenInstance,
6
+ credentialFor,
7
+ realFetch,
8
+ relayOrigin
9
+ } from "./chunk-IX24JXWC.mjs";
10
+ import "./chunk-IU22ASGZ.mjs";
11
+ import {
12
+ DEFAULT_RELAY
13
+ } from "./chunk-EIMFGA2U.mjs";
14
+ import {
15
+ savedRooms
16
+ } from "./chunk-27AE3JXP.mjs";
17
+ import "./chunk-B22BPJRW.mjs";
18
+ import "./chunk-P7MSGDOB.mjs";
19
+
20
+ // src/commands/keep-in-account.ts
21
+ var KEEP_ENV = "CROSSROOM_KEEP";
22
+ var KEEP_MAX = 50;
23
+ var KEEP_TIMEOUT_MS = 8e3;
24
+ function keepingOff(args, env = process.env) {
25
+ if (args.flags["no-keep"] === true) return true;
26
+ return /^(0|off|no|false)$/i.test(env[KEEP_ENV]?.trim() ?? "");
27
+ }
28
+ var hostOf = (origin) => {
29
+ try {
30
+ return new URL(origin).host;
31
+ } catch {
32
+ return origin;
33
+ }
34
+ };
35
+ function credentialForInstance(args, base, env = process.env) {
36
+ let origin;
37
+ try {
38
+ origin = relayOrigin(base);
39
+ } catch {
40
+ return null;
41
+ }
42
+ const key = env[API_KEY_ENV]?.trim();
43
+ if (key) {
44
+ if (!API_TOKEN.test(key)) return null;
45
+ let named;
46
+ try {
47
+ named = chosenInstance(args, DEFAULT_RELAY, env);
48
+ } catch {
49
+ return null;
50
+ }
51
+ return named === origin ? { token: key, via: "env" } : null;
52
+ }
53
+ try {
54
+ const held = credentialFor(origin);
55
+ return held ? { token: held.token, via: "login" } : null;
56
+ } catch {
57
+ return null;
58
+ }
59
+ }
60
+ async function keepRooms(base, token, rooms, fetchImpl = realFetch) {
61
+ const added = [];
62
+ for (let i = 0; i < rooms.length; i += KEEP_MAX) {
63
+ const chunk = rooms.slice(i, i + KEEP_MAX).map((r) => ({ id: r.id, owner: r.owner }));
64
+ let res;
65
+ try {
66
+ res = await fetchImpl(`${base}/api/account/rooms`, {
67
+ method: "POST",
68
+ headers: { accept: "application/json", "content-type": "application/json", authorization: `Bearer ${token}` },
69
+ body: JSON.stringify({ rooms: chunk }),
70
+ redirect: "error",
71
+ signal: AbortSignal.timeout(KEEP_TIMEOUT_MS)
72
+ });
73
+ } catch (e) {
74
+ return { ok: false, why: e?.name === "TimeoutError" ? `${hostOf(base)} did not answer in time` : `${hostOf(base)} could not be reached` };
75
+ }
76
+ const body = await res.json().catch(() => null);
77
+ if (!res.ok) {
78
+ const why = res.status === 401 ? `${hostOf(base)} no longer knows this sign-in` : res.status === 429 ? `${hostOf(base)} asked to slow down` : `${hostOf(base)} refused (${typeof body?.error === "string" ? body.error.slice(0, 120) : `HTTP ${res.status}`})`;
79
+ return added.length ? { ok: true, added } : { ok: false, why };
80
+ }
81
+ for (const id of Array.isArray(body?.added) ? body.added : []) if (typeof id === "string") added.push(id);
82
+ }
83
+ return { ok: true, added };
84
+ }
85
+ async function keepOpened(args, rooms, say, o = {}) {
86
+ const env = o.env ?? process.env;
87
+ if (!rooms.length || keepingOff(args, env)) return;
88
+ for (const [base, group] of byInstance(rooms)) {
89
+ const cred = credentialForInstance(args, base, env);
90
+ if (!cred) continue;
91
+ const r = await keepRooms(base, cred.token, group, o.fetchImpl);
92
+ const host = hostOf(base);
93
+ const one = group.length === 1;
94
+ if (r.ok && r.added.length === group.length)
95
+ say(`Kept in your account on ${host}: ${one ? "it shows" : "they show"} in Rooms in any browser signed in there. (--no-keep keeps a room here only.)`);
96
+ else if (r.ok)
97
+ say(`Kept ${r.added.length} of ${group.length} rooms in your account on ${host}; the rest are on this computer only. \`crossroom rooms --keep\` tries again.`);
98
+ else say(`Not kept in your account (${r.why}); the room is on this computer only. \`crossroom rooms --keep\` tries again.`);
99
+ }
100
+ }
101
+ function byInstance(rooms) {
102
+ const out = /* @__PURE__ */ new Map();
103
+ for (const r of rooms) {
104
+ let base;
105
+ try {
106
+ base = relayOrigin(r.base);
107
+ } catch {
108
+ continue;
109
+ }
110
+ out.set(base, [...out.get(base) ?? [], r]);
111
+ }
112
+ return out;
113
+ }
114
+ async function keepSaved(args, o = {}) {
115
+ const env = o.env ?? process.env;
116
+ const rooms = (o.rooms ?? savedRooms()).filter((r) => r.pool !== "crew-device");
117
+ if (!rooms.length) return ["This computer keeps no rooms."];
118
+ const lines = [];
119
+ for (const [base, group] of byInstance(rooms)) {
120
+ const host = hostOf(base);
121
+ const cred = credentialForInstance(args, base, env);
122
+ const n = `${group.length} room${group.length === 1 ? "" : "s"}`;
123
+ if (!cred) {
124
+ lines.push(`${n} on ${host}: this computer is not signed in there. Run \`crossroom login --relay ${base}\`, then this again.`);
125
+ continue;
126
+ }
127
+ const r = await keepRooms(base, cred.token, group, o.fetchImpl);
128
+ if (!r.ok) lines.push(`${n} on ${host}: not kept (${r.why}).`);
129
+ else {
130
+ const gone = group.length - r.added.length;
131
+ lines.push(
132
+ `${r.added.length} of ${n} on ${host} kept in your account.${gone ? ` ${gone} could not be: deleted since, or no longer opened by the key kept here.` : ""}`
133
+ );
134
+ }
135
+ }
136
+ return lines;
137
+ }
138
+ export {
139
+ KEEP_ENV,
140
+ credentialForInstance,
141
+ keepOpened,
142
+ keepRooms,
143
+ keepSaved,
144
+ keepingOff
145
+ };
@@ -0,0 +1,18 @@
1
+ import { createRequire as __parleyRequire } from 'node:module'; const require = __parleyRequire(import.meta.url);
2
+ import {
3
+ agentLogPath,
4
+ checkConfinement,
5
+ joinArgs,
6
+ shellArg,
7
+ startLocalAgent
8
+ } from "./chunk-7TMIKS73.mjs";
9
+ import "./chunk-27AE3JXP.mjs";
10
+ import "./chunk-B22BPJRW.mjs";
11
+ import "./chunk-P7MSGDOB.mjs";
12
+ export {
13
+ agentLogPath,
14
+ checkConfinement,
15
+ joinArgs,
16
+ shellArg,
17
+ startLocalAgent
18
+ };
@@ -0,0 +1,55 @@
1
+ import { createRequire as __parleyRequire } from 'node:module'; const require = __parleyRequire(import.meta.url);
2
+ import {
3
+ MEMORY_KEPT,
4
+ RECALL_AUTO_ROOMS,
5
+ RECALL_MAX,
6
+ RECALL_TITLE,
7
+ RecallError,
8
+ SEARCH_SHOWN,
9
+ findNote,
10
+ forgetNote,
11
+ forgottenIds,
12
+ memoryDir,
13
+ noteDigest,
14
+ noteFile,
15
+ noteText,
16
+ overlaps,
17
+ postRecall,
18
+ readIndex,
19
+ readNote,
20
+ recallNotes,
21
+ recallText,
22
+ relatedNotes,
23
+ rememberRoom,
24
+ searchNotes,
25
+ syncMemory
26
+ } from "./chunk-KYENX3H2.mjs";
27
+ import "./chunk-27AE3JXP.mjs";
28
+ import "./chunk-5TLKYAI3.mjs";
29
+ import "./chunk-B22BPJRW.mjs";
30
+ import "./chunk-P7MSGDOB.mjs";
31
+ export {
32
+ MEMORY_KEPT,
33
+ RECALL_AUTO_ROOMS,
34
+ RECALL_MAX,
35
+ RECALL_TITLE,
36
+ RecallError,
37
+ SEARCH_SHOWN,
38
+ findNote,
39
+ forgetNote,
40
+ forgottenIds,
41
+ memoryDir,
42
+ noteDigest,
43
+ noteFile,
44
+ noteText,
45
+ overlaps,
46
+ postRecall,
47
+ readIndex,
48
+ readNote,
49
+ recallNotes,
50
+ recallText,
51
+ relatedNotes,
52
+ rememberRoom,
53
+ searchNotes,
54
+ syncMemory
55
+ };
@@ -0,0 +1,32 @@
1
+ import { createRequire as __parleyRequire } from 'node:module'; const require = __parleyRequire(import.meta.url);
2
+ import {
3
+ API_KEY_ENV,
4
+ RelayRefused,
5
+ URL_ENV,
6
+ accountCredential,
7
+ call,
8
+ callText,
9
+ chosenInstance,
10
+ credentialWhere,
11
+ instanceFromEnv,
12
+ realFetch,
13
+ signedIn
14
+ } from "./chunk-IX24JXWC.mjs";
15
+ import "./chunk-IU22ASGZ.mjs";
16
+ import "./chunk-EIMFGA2U.mjs";
17
+ import "./chunk-27AE3JXP.mjs";
18
+ import "./chunk-B22BPJRW.mjs";
19
+ import "./chunk-P7MSGDOB.mjs";
20
+ export {
21
+ API_KEY_ENV,
22
+ RelayRefused,
23
+ URL_ENV,
24
+ accountCredential,
25
+ call,
26
+ callText,
27
+ chosenInstance,
28
+ credentialWhere,
29
+ instanceFromEnv,
30
+ realFetch,
31
+ signedIn
32
+ };
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "crossroom",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Your AI agents in one room, from the terminal, editor or browser: they share knowledge, coordinate repositories and hand work over. Crossroom keeps the recap.",
5
+ "license": "Apache-2.0",
6
+ "keywords": [
7
+ "ai-agents",
8
+ "multi-agent",
9
+ "mcp",
10
+ "claude-code",
11
+ "codex",
12
+ "agents",
13
+ "knowledge-transfer"
14
+ ],
15
+ "homepage": "https://crossroom.dev",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/jagritvats/crossroom-cli.git",
19
+ "directory": "packages/cli"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/jagritvats/crossroom-cli/issues"
23
+ },
24
+ "mcpName": "io.github.jagritvats/crossroom",
25
+ "type": "module",
26
+ "bin": {
27
+ "crossroom": "dist/crossroom.mjs"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "README.md"
32
+ ],
33
+ "engines": {
34
+ "node": ">=22.13"
35
+ },
36
+ "scripts": {
37
+ "build": "node build.mjs",
38
+ "typecheck": "tsc --noEmit",
39
+ "prepublishOnly": "node build.mjs"
40
+ },
41
+ "devDependencies": {
42
+ "@modelcontextprotocol/sdk": "^1.32.1",
43
+ "@parley/shared": "workspace:*",
44
+ "@types/node": "^22.0.0",
45
+ "esbuild": "^0.28.2",
46
+ "typescript": "^5.9.0",
47
+ "yaml": "2.9.1",
48
+ "zod": "^4.6.1"
49
+ }
50
+ }