sharedthink 0.1.0 → 0.1.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/README.md CHANGED
@@ -31,7 +31,10 @@ cd <repo> && npx sharedthink init <project>
31
31
  ```
32
32
 
33
33
  `init` writes `.sharedthink.json` (safe to commit) and adds the `sharedthink` MCP server in local scope
34
- (this repo, this machine; the token stays out of the repo). Same token works on all your machines.
34
+ (this repo, this machine; the token stays out of the repo).
35
+
36
+ Your other machines: run `npx sharedthink pair` there, then `sharedthink approve <words>` on a machine
37
+ that is already logged in. No token is copied between machines.
35
38
 
36
39
  Other commands: `read [words]`, `send "<text>" --why .. --source ..`, `inbox`, `merge <id>`, `reject <id> "why"`, `rules`, `log`,
37
40
  `members`, `remove <name>` (owner: access ends at once), `rotate` (new token if yours leaked).
@@ -131,6 +131,30 @@ const commands = {
131
131
  console.log(`next: in the project's repo, run 'sharedthink init ${r.project}'`);
132
132
  },
133
133
 
134
+ // On a NEW machine: log in as yourself. Approve the words from a machine that is already logged in.
135
+ async pair({ flags }) {
136
+ if (flags.url) process.env.SHAREDTHINK_URL = flags.url;
137
+ const r = await api("pair/start", {}, { auth: false });
138
+ console.log(`on a machine where you are logged in, run:\n\n sharedthink approve ${r.words}\n\nwaiting (10 minutes)...`);
139
+ const until = Date.now() + 10 * 60_000;
140
+ while (Date.now() < until) {
141
+ await new Promise((ok) => setTimeout(ok, 3000));
142
+ const p = await api("pair/poll", { secret: r.secret }, { auth: false });
143
+ if (p.status === "approved") {
144
+ saveLogin(p.token);
145
+ return console.log(`this machine is now logged in as ${p.name}. Next: in a repo, run 'sharedthink init <project>'`);
146
+ }
147
+ }
148
+ die("pairing expired: run 'sharedthink pair' again");
149
+ },
150
+
151
+ // On a logged-in machine: let a new machine in as you.
152
+ async approve({ pos }) {
153
+ if (!pos[0]) die("usage: sharedthink approve <words>");
154
+ const r = await api("pair/approve", { words: pos[0] });
155
+ console.log(`approved: that machine is now logged in as ${r.name}`);
156
+ },
157
+
134
158
  async create({ pos }) {
135
159
  if (!pos[0]) die("usage: sharedthink create <project>");
136
160
  const r = await api("create", { project: pos[0] });
@@ -239,6 +263,8 @@ if (!cmd || !commands[cmd]) {
239
263
 
240
264
  join <invite-code> --name <you> join a project (creates your account if new)
241
265
  login --token <token> use an existing token on this machine
266
+ pair on a new machine: log in as you (approve it from another)
267
+ approve <words> let that new machine in
242
268
  create <project> create a project, you are the owner
243
269
  invite [project] make a single-use invite code (owner)
244
270
  init <project> link this repo: .sharedthink.json + MCP for this repo only
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sharedthink",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A team's shared brain for AI agents: one live place your agents read from, send to, and you approve.",
5
5
  "keywords": [
6
6
  "ai",