unfairly 0.8.2 → 0.8.4
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/CHANGELOG.md +10 -0
- package/LICENSE +15 -0
- package/README.md +3 -1
- package/dist/auth/browser-flow.d.ts +0 -1
- package/dist/auth/browser-flow.js +5 -81
- package/dist/cmd/connect.d.ts +0 -1
- package/dist/cmd/connect.js +1 -164
- package/dist/cmd/init.d.ts +0 -1
- package/dist/cmd/init.js +2 -138
- package/dist/cmd/invite.d.ts +0 -1
- package/dist/cmd/invite.js +4 -73
- package/dist/cmd/join.d.ts +0 -1
- package/dist/cmd/join.js +1 -91
- package/dist/cmd/login.d.ts +0 -1
- package/dist/cmd/login.js +3 -41
- package/dist/cmd/mcp.d.ts +0 -1
- package/dist/cmd/mcp.js +2 -86
- package/dist/cmd/pace.d.ts +23 -2
- package/dist/cmd/pace.js +4 -393
- package/dist/cmd/parse-share-input.d.ts +0 -1
- package/dist/cmd/parse-share-input.js +1 -56
- package/dist/cmd/pull.d.ts +0 -1
- package/dist/cmd/pull.js +7 -143
- package/dist/cmd/push.d.ts +0 -1
- package/dist/cmd/push.js +1 -85
- package/dist/cmd/resolve.d.ts +0 -1
- package/dist/cmd/resolve.js +1 -35
- package/dist/cmd/setup.d.ts +0 -1
- package/dist/cmd/setup.js +2 -345
- package/dist/cmd/status-card.d.ts +0 -1
- package/dist/cmd/status-card.js +2 -156
- package/dist/cmd/status.d.ts +0 -1
- package/dist/cmd/status.js +3 -29
- package/dist/cmd/watch.d.ts +0 -1
- package/dist/cmd/watch.js +1 -26
- package/dist/hosts/claude-code.d.ts +0 -1
- package/dist/hosts/claude-code.js +3 -180
- package/dist/hosts/claude-desktop.d.ts +0 -1
- package/dist/hosts/claude-desktop.js +3 -222
- package/dist/hosts/codex.d.ts +0 -1
- package/dist/hosts/codex.js +20 -234
- package/dist/hosts/shell-env.d.ts +0 -1
- package/dist/hosts/shell-env.js +9 -81
- package/dist/index.d.ts +0 -1
- package/dist/index.js +14 -206
- package/dist/lib/client.d.ts +0 -1
- package/dist/lib/client.js +1 -58
- package/dist/lib/events/emit.d.ts +0 -1
- package/dist/lib/events/emit.js +1 -28
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.js +1 -11
- package/dist/lib/transport.d.ts +0 -1
- package/dist/lib/transport.js +1 -85
- package/dist/lib/types/index.d.ts +0 -1
- package/dist/lib/types/index.js +1 -50
- package/dist/lib/vault/checkpoint.d.ts +0 -1
- package/dist/lib/vault/checkpoint.js +1 -18
- package/dist/lib/vault/read.d.ts +0 -1
- package/dist/lib/vault/read.js +1 -9
- package/dist/lib/vault/search.d.ts +0 -1
- package/dist/lib/vault/search.js +1 -10
- package/dist/pace/device.d.ts +3 -1
- package/dist/pace/device.js +2 -148
- package/dist/pace/enroll.d.ts +79 -0
- package/dist/pace/enroll.js +2 -0
- package/dist/pace/identity.d.ts +0 -1
- package/dist/pace/identity.js +1 -17
- package/dist/pace/install.d.ts +0 -1
- package/dist/pace/install.js +4 -127
- package/dist/pace/local-evidence.d.ts +0 -1
- package/dist/pace/local-evidence.js +2 -228
- package/dist/pace/local-sessions.d.ts +0 -1
- package/dist/pace/local-sessions.js +1 -254
- package/dist/pace/managed-config.d.ts +0 -1
- package/dist/pace/managed-config.js +8 -102
- package/dist/pace/normalize.d.ts +0 -1
- package/dist/pace/normalize.js +1 -293
- package/dist/pace/repository.d.ts +0 -1
- package/dist/pace/repository.js +2 -120
- package/dist/pace/schema.d.ts +0 -1
- package/dist/pace/schema.js +1 -134
- package/dist/pace/session-summary.d.ts +0 -1
- package/dist/pace/session-summary.js +2 -140
- package/dist/pace/spool.d.ts +0 -1
- package/dist/pace/spool.js +8 -87
- package/dist/pace-runtime.d.ts +1 -0
- package/dist/pace-runtime.js +2 -0
- package/dist/sync/api.d.ts +0 -1
- package/dist/sync/api.js +1 -55
- package/dist/sync/autoloader.d.ts +0 -1
- package/dist/sync/autoloader.js +5 -127
- package/dist/sync/conflict.d.ts +0 -1
- package/dist/sync/conflict.js +5 -15
- package/dist/sync/credentials.d.ts +0 -1
- package/dist/sync/credentials.js +1 -51
- package/dist/sync/files.d.ts +0 -1
- package/dist/sync/files.js +1 -71
- package/dist/sync/manifest.d.ts +0 -1
- package/dist/sync/manifest.js +1 -37
- package/dist/sync/repo-root.d.ts +0 -1
- package/dist/sync/repo-root.js +1 -24
- package/dist/sync/stitch-claude-md.d.ts +0 -1
- package/dist/sync/stitch-claude-md.js +8 -48
- package/dist/ui/colors.d.ts +0 -1
- package/dist/ui/colors.js +1 -28
- package/dist/ui/screens.d.ts +0 -1
- package/dist/ui/screens.js +5 -135
- package/package.json +8 -14
- package/plugin/.cursor-plugin/plugin.json +0 -2
- package/plugin/.mcp.json +1 -1
- package/plugin/LICENSE +15 -0
- package/plugin/README.md +3 -7
- package/plugin/gemini/gemini-extension.json +1 -1
- package/plugin/mcp.json +1 -1
- package/plugin/plugin.json +0 -2
- package/plugin/runtime/unfairly-intelligence.mjs +15 -0
- package/plugin/scripts/capture.cjs +30 -8
- package/plugin/skills/find-company-playbook/SKILL.md +1 -1
- package/dist/auth/browser-flow.d.ts.map +0 -1
- package/dist/auth/browser-flow.js.map +0 -1
- package/dist/cmd/connect.d.ts.map +0 -1
- package/dist/cmd/connect.js.map +0 -1
- package/dist/cmd/init.d.ts.map +0 -1
- package/dist/cmd/init.js.map +0 -1
- package/dist/cmd/invite.d.ts.map +0 -1
- package/dist/cmd/invite.js.map +0 -1
- package/dist/cmd/join.d.ts.map +0 -1
- package/dist/cmd/join.js.map +0 -1
- package/dist/cmd/login.d.ts.map +0 -1
- package/dist/cmd/login.js.map +0 -1
- package/dist/cmd/mcp.d.ts.map +0 -1
- package/dist/cmd/mcp.js.map +0 -1
- package/dist/cmd/pace.d.ts.map +0 -1
- package/dist/cmd/pace.js.map +0 -1
- package/dist/cmd/parse-share-input.d.ts.map +0 -1
- package/dist/cmd/parse-share-input.js.map +0 -1
- package/dist/cmd/pull.d.ts.map +0 -1
- package/dist/cmd/pull.js.map +0 -1
- package/dist/cmd/push.d.ts.map +0 -1
- package/dist/cmd/push.js.map +0 -1
- package/dist/cmd/resolve.d.ts.map +0 -1
- package/dist/cmd/resolve.js.map +0 -1
- package/dist/cmd/setup.d.ts.map +0 -1
- package/dist/cmd/setup.js.map +0 -1
- package/dist/cmd/status-card.d.ts.map +0 -1
- package/dist/cmd/status-card.js.map +0 -1
- package/dist/cmd/status.d.ts.map +0 -1
- package/dist/cmd/status.js.map +0 -1
- package/dist/cmd/watch.d.ts.map +0 -1
- package/dist/cmd/watch.js.map +0 -1
- package/dist/hosts/claude-code.d.ts.map +0 -1
- package/dist/hosts/claude-code.js.map +0 -1
- package/dist/hosts/claude-desktop.d.ts.map +0 -1
- package/dist/hosts/claude-desktop.js.map +0 -1
- package/dist/hosts/codex.d.ts.map +0 -1
- package/dist/hosts/codex.js.map +0 -1
- package/dist/hosts/shell-env.d.ts.map +0 -1
- package/dist/hosts/shell-env.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/client.d.ts.map +0 -1
- package/dist/lib/client.js.map +0 -1
- package/dist/lib/events/emit.d.ts.map +0 -1
- package/dist/lib/events/emit.js.map +0 -1
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/transport.d.ts.map +0 -1
- package/dist/lib/transport.js.map +0 -1
- package/dist/lib/types/index.d.ts.map +0 -1
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/vault/checkpoint.d.ts.map +0 -1
- package/dist/lib/vault/checkpoint.js.map +0 -1
- package/dist/lib/vault/read.d.ts.map +0 -1
- package/dist/lib/vault/read.js.map +0 -1
- package/dist/lib/vault/search.d.ts.map +0 -1
- package/dist/lib/vault/search.js.map +0 -1
- package/dist/pace/device.d.ts.map +0 -1
- package/dist/pace/device.js.map +0 -1
- package/dist/pace/identity.d.ts.map +0 -1
- package/dist/pace/identity.js.map +0 -1
- package/dist/pace/install.d.ts.map +0 -1
- package/dist/pace/install.js.map +0 -1
- package/dist/pace/local-evidence.d.ts.map +0 -1
- package/dist/pace/local-evidence.js.map +0 -1
- package/dist/pace/local-sessions.d.ts.map +0 -1
- package/dist/pace/local-sessions.js.map +0 -1
- package/dist/pace/managed-config.d.ts.map +0 -1
- package/dist/pace/managed-config.js.map +0 -1
- package/dist/pace/normalize.d.ts.map +0 -1
- package/dist/pace/normalize.js.map +0 -1
- package/dist/pace/repository.d.ts.map +0 -1
- package/dist/pace/repository.js.map +0 -1
- package/dist/pace/schema.d.ts.map +0 -1
- package/dist/pace/schema.js.map +0 -1
- package/dist/pace/session-summary.d.ts.map +0 -1
- package/dist/pace/session-summary.js.map +0 -1
- package/dist/pace/spool.d.ts.map +0 -1
- package/dist/pace/spool.js.map +0 -1
- package/dist/sync/api.d.ts.map +0 -1
- package/dist/sync/api.js.map +0 -1
- package/dist/sync/autoloader.d.ts.map +0 -1
- package/dist/sync/autoloader.js.map +0 -1
- package/dist/sync/conflict.d.ts.map +0 -1
- package/dist/sync/conflict.js.map +0 -1
- package/dist/sync/credentials.d.ts.map +0 -1
- package/dist/sync/credentials.js.map +0 -1
- package/dist/sync/files.d.ts.map +0 -1
- package/dist/sync/files.js.map +0 -1
- package/dist/sync/manifest.d.ts.map +0 -1
- package/dist/sync/manifest.js.map +0 -1
- package/dist/sync/repo-root.d.ts.map +0 -1
- package/dist/sync/repo-root.js.map +0 -1
- package/dist/sync/stitch-claude-md.d.ts.map +0 -1
- package/dist/sync/stitch-claude-md.js.map +0 -1
- package/dist/ui/colors.d.ts.map +0 -1
- package/dist/ui/colors.js.map +0 -1
- package/dist/ui/screens.d.ts.map +0 -1
- package/dist/ui/screens.js.map +0 -1
package/dist/cmd/join.js
CHANGED
|
@@ -1,91 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { openBrowser } from "../auth/browser-flow.js";
|
|
3
|
-
import { setToken } from "../sync/credentials.js";
|
|
4
|
-
const API_DEFAULT = "https://app.unfairly.ai";
|
|
5
|
-
export const joinCommand = {
|
|
6
|
-
command: "join <token>",
|
|
7
|
-
describe: "Join an Unfairly org via a persona-tagged invite token",
|
|
8
|
-
builder: (yargs) => yargs
|
|
9
|
-
.positional("token", { type: "string", demandOption: true })
|
|
10
|
-
.option("api", { type: "string", default: API_DEFAULT })
|
|
11
|
-
.option("host", {
|
|
12
|
-
type: "string",
|
|
13
|
-
choices: ["claude-code", "codex", "cowork"],
|
|
14
|
-
describe: "Force a specific host (default: pick by persona)",
|
|
15
|
-
}),
|
|
16
|
-
handler: async (args) => {
|
|
17
|
-
// 1. Init session
|
|
18
|
-
console.log("✦ Initializing join session…");
|
|
19
|
-
const initRes = await fetch(`${args.api}/api/cli/join/init`, {
|
|
20
|
-
method: "POST",
|
|
21
|
-
headers: { "Content-Type": "application/json" },
|
|
22
|
-
body: JSON.stringify({ token: args.token }),
|
|
23
|
-
});
|
|
24
|
-
if (!initRes.ok) {
|
|
25
|
-
const err = await initRes.text();
|
|
26
|
-
console.error(`Failed to init: ${initRes.status} ${err}`);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
const init = await initRes.json();
|
|
30
|
-
// 2. Open browser
|
|
31
|
-
console.log(`✓ Opening browser to authorize…`);
|
|
32
|
-
console.log(` (if it doesn't open: ${init.auth_url})`);
|
|
33
|
-
openBrowser(init.auth_url);
|
|
34
|
-
// 3. Poll for completion
|
|
35
|
-
let waited = 0;
|
|
36
|
-
let interval = init.poll_interval_seconds * 1000;
|
|
37
|
-
let result = null;
|
|
38
|
-
while (waited < init.ttl_seconds * 1000) {
|
|
39
|
-
await sleep(interval);
|
|
40
|
-
waited += interval;
|
|
41
|
-
const pollRes = await fetch(init.poll_url);
|
|
42
|
-
if (!pollRes.ok) {
|
|
43
|
-
console.error(`Poll error: ${pollRes.status}`);
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
const poll = await pollRes.json();
|
|
47
|
-
if (poll.status === "completed") {
|
|
48
|
-
result = poll;
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
if (poll.status === "expired") {
|
|
52
|
-
console.error("Session expired. Re-run the command.");
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
if (waited > init.poll_backoff_after_seconds * 1000) {
|
|
56
|
-
interval = init.poll_backoff_interval_seconds * 1000;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (!result) {
|
|
60
|
-
console.error("Timed out waiting for browser auth. Re-run the command.");
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
console.log(`✓ You're in. Joining as: ${result.display_name} (${result.persona_surface}/${result.persona_workflow ?? "—"})`);
|
|
64
|
-
// 4. Pick host (default by persona surface)
|
|
65
|
-
const host = args.host ??
|
|
66
|
-
(result.persona_surface === "oracle-cowork" ? "cowork" : "claude-code");
|
|
67
|
-
// 5. Persist the join JWT via existing credential store + configure host.
|
|
68
|
-
// Existing host writers take a single `apiUrl: string` arg and read
|
|
69
|
-
// the token from credentials.
|
|
70
|
-
await setToken(result.jwt);
|
|
71
|
-
console.log(`✓ Configuring ${host}…`);
|
|
72
|
-
if (host === "claude-code") {
|
|
73
|
-
const { configureClaudeCode } = await import("../hosts/claude-code.js");
|
|
74
|
-
await configureClaudeCode(args.api, result.jwt);
|
|
75
|
-
}
|
|
76
|
-
else if (host === "codex") {
|
|
77
|
-
const { configureCodex } = await import("../hosts/codex.js");
|
|
78
|
-
await configureCodex(args.api);
|
|
79
|
-
}
|
|
80
|
-
else if (host === "cowork") {
|
|
81
|
-
const { configureClaudeDesktop } = await import("../hosts/claude-desktop.js");
|
|
82
|
-
await configureClaudeDesktop(args.api, result.jwt);
|
|
83
|
-
console.log("⚠ Quit and relaunch Claude Desktop to load the new MCP server.");
|
|
84
|
-
}
|
|
85
|
-
// 6. Print persona-shaped welcome
|
|
86
|
-
const welcomeRes = await fetch(`${args.api}/api/cli/welcome?persona=${result.persona_surface}&workflow=${result.persona_workflow ?? ""}`);
|
|
87
|
-
const welcome = await welcomeRes.text();
|
|
88
|
-
console.log(welcome);
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
//# sourceMappingURL=join.js.map
|
|
1
|
+
import{setTimeout as p}from"node:timers/promises";import{openBrowser as d}from"../auth/browser-flow.js";import{setToken as w}from"../sync/credentials.js";const f="https://app.unfairly.ai",_={command:"join <token>",describe:"Join an Unfairly org via a persona-tagged invite token",builder:t=>t.positional("token",{type:"string",demandOption:!0}).option("api",{type:"string",default:f}).option("host",{type:"string",choices:["claude-code","codex","cowork"],describe:"Force a specific host (default: pick by persona)"}),handler:async t=>{console.log("\u2726 Initializing join session\u2026");const n=await fetch(`${t.api}/api/cli/join/init`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.token})});if(!n.ok){const e=await n.text();console.error(`Failed to init: ${n.status} ${e}`),process.exit(1)}const i=await n.json();console.log("\u2713 Opening browser to authorize\u2026"),console.log(` (if it doesn't open: ${i.auth_url})`),d(i.auth_url);let s=0,r=i.poll_interval_seconds*1e3,o=null;for(;s<i.ttl_seconds*1e3;){await p(r),s+=r;const e=await fetch(i.poll_url);e.ok||(console.error(`Poll error: ${e.status}`),process.exit(1));const l=await e.json();if(l.status==="completed"){o=l;break}l.status==="expired"&&(console.error("Session expired. Re-run the command."),process.exit(1)),s>i.poll_backoff_after_seconds*1e3&&(r=i.poll_backoff_interval_seconds*1e3)}o||(console.error("Timed out waiting for browser auth. Re-run the command."),process.exit(1)),console.log(`\u2713 You're in. Joining as: ${o.display_name} (${o.persona_surface}/${o.persona_workflow??"\u2014"})`);const a=t.host??(o.persona_surface==="oracle-cowork"?"cowork":"claude-code");if(await w(o.jwt),console.log(`\u2713 Configuring ${a}\u2026`),a==="claude-code"){const{configureClaudeCode:e}=await import("../hosts/claude-code.js");await e(t.api,o.jwt)}else if(a==="codex"){const{configureCodex:e}=await import("../hosts/codex.js");await e(t.api)}else if(a==="cowork"){const{configureClaudeDesktop:e}=await import("../hosts/claude-desktop.js");await e(t.api,o.jwt),console.log("\u26A0 Quit and relaunch Claude Desktop to load the new MCP server.")}const c=await(await fetch(`${t.api}/api/cli/welcome?persona=${o.persona_surface}&workflow=${o.persona_workflow??""}`)).text();console.log(c)}};export{_ as joinCommand};
|
package/dist/cmd/login.d.ts
CHANGED
package/dist/cmd/login.js
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `unfairly login` — runs the OAuth handoff and prints a shell snippet
|
|
6
|
-
* the user can paste into their shell config. Useful for setting up
|
|
7
|
-
* Codex CLI's UNFAIRLY_MCP_TOKEN env var without copy-pasting tokens.
|
|
8
|
-
*
|
|
9
|
-
* For most users `unfairly setup` is the better path — it handles env +
|
|
10
|
-
* agent host config in one shot. `login` is preserved for scripting use
|
|
11
|
-
* cases where you want just the export line on stdout.
|
|
12
|
-
*
|
|
13
|
-
* Stdout = the export line (only). Stderr = friendly hints.
|
|
14
|
-
*
|
|
15
|
-
* NOTE: do NOT pipe `unfairly login >> ~/.zshenv` via npx — npx's first-run
|
|
16
|
-
* "Ok to proceed?" confirmation goes to stdout and corrupts the file.
|
|
17
|
-
* Install globally first (`npm i -g unfairly`) or use `unfairly setup`.
|
|
18
|
-
*/
|
|
19
|
-
export async function runLogin(opts = {}) {
|
|
20
|
-
const apiUrl = process.env.UNFAIRLY_API_URL ?? DEFAULT_API;
|
|
21
|
-
const token = await browserAuthFlow(apiUrl, { tokenName: "unfairly login" });
|
|
22
|
-
if (!token) {
|
|
23
|
-
console.error("Login failed — browser flow timed out or was cancelled.");
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
await setToken(token);
|
|
27
|
-
if (!opts.quiet) {
|
|
28
|
-
console.error("Authorized.");
|
|
29
|
-
console.error("");
|
|
30
|
-
console.error("Add this line to your shell config (~/.zshenv on macOS / Linux):");
|
|
31
|
-
console.error("");
|
|
32
|
-
}
|
|
33
|
-
// The export line goes to STDOUT so it can be piped.
|
|
34
|
-
process.stdout.write(`export UNFAIRLY_MCP_TOKEN=${token}\n`);
|
|
35
|
-
process.stdout.write(`export UNFAIRLY_TOKEN=${token}\n`);
|
|
36
|
-
if (!opts.quiet) {
|
|
37
|
-
console.error("");
|
|
38
|
-
console.error("Tip: `unfairly setup` handles this AND patches your Codex / Claude Code config in one shot.");
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=login.js.map
|
|
1
|
+
import{browserAuthFlow as n}from"../auth/browser-flow.js";import{setToken as t}from"../sync/credentials.js";const s="https://app.unfairly.ai";async function l(e={}){const r=process.env.UNFAIRLY_API_URL??s,o=await n(r,{tokenName:"unfairly login"});o||(console.error("Login failed \u2014 browser flow timed out or was cancelled."),process.exit(1)),await t(o),e.quiet||(console.error("Authorized."),console.error(""),console.error("Add this line to your shell config (~/.zshenv on macOS / Linux):"),console.error("")),process.stdout.write(`export UNFAIRLY_MCP_TOKEN=${o}
|
|
2
|
+
`),process.stdout.write(`export UNFAIRLY_TOKEN=${o}
|
|
3
|
+
`),e.quiet||(console.error(""),console.error("Tip: `unfairly setup` handles this AND patches your Codex / Claude Code config in one shot."))}export{l as runLogin};
|
package/dist/cmd/mcp.d.ts
CHANGED
package/dist/cmd/mcp.js
CHANGED
|
@@ -1,86 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { runPull } from "./pull.js";
|
|
6
|
-
import { runPush } from "./push.js";
|
|
7
|
-
import { runStatus } from "./status.js";
|
|
8
|
-
const PullSchema = z.object({ room: z.string().optional() }).strict();
|
|
9
|
-
const PushSchema = z.object({ room: z.string().optional() }).strict();
|
|
10
|
-
const StatusSchema = z.object({}).strict();
|
|
11
|
-
export async function runMcp() {
|
|
12
|
-
const server = new Server({ name: "unfairly-sync", version: "0.1.0" }, { capabilities: { tools: {} } });
|
|
13
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
14
|
-
tools: [
|
|
15
|
-
{
|
|
16
|
-
name: "pull_vault",
|
|
17
|
-
description: "Sync local .unfairly/ from cloud. Pass `room` to scope to one vault, omit for all accessible vaults. Reports docs added/updated/deleted.",
|
|
18
|
-
inputSchema: {
|
|
19
|
-
type: "object",
|
|
20
|
-
properties: {
|
|
21
|
-
room: {
|
|
22
|
-
type: "string",
|
|
23
|
-
description: "Vault slug to scope to (optional)",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: "push_vault",
|
|
30
|
-
description: "Push locally-modified markdown to cloud. Stale-check via expected_updated_at. Returns 409s for conflicts; CLI rewrites those files with merge markers.",
|
|
31
|
-
inputSchema: {
|
|
32
|
-
type: "object",
|
|
33
|
-
properties: {
|
|
34
|
-
room: {
|
|
35
|
-
type: "string",
|
|
36
|
-
description: "Vault slug to scope to (optional)",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: "sync_status",
|
|
43
|
-
description: "Show local sync status: per-vault last-pulled timestamp + modified-locally count.",
|
|
44
|
-
inputSchema: { type: "object", properties: {} },
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
}));
|
|
48
|
-
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
49
|
-
const { name, arguments: args } = req.params;
|
|
50
|
-
const captured = [];
|
|
51
|
-
const origLog = console.log;
|
|
52
|
-
const origWarn = console.warn;
|
|
53
|
-
const origError = console.error;
|
|
54
|
-
console.log = (...a) => captured.push(a.map(String).join(" "));
|
|
55
|
-
console.warn = (...a) => captured.push("! " + a.map(String).join(" "));
|
|
56
|
-
console.error = (...a) => captured.push("ERR " + a.map(String).join(" "));
|
|
57
|
-
try {
|
|
58
|
-
if (name === "pull_vault") {
|
|
59
|
-
const { room } = PullSchema.parse(args ?? {});
|
|
60
|
-
await runPull(room);
|
|
61
|
-
}
|
|
62
|
-
else if (name === "push_vault") {
|
|
63
|
-
const { room } = PushSchema.parse(args ?? {});
|
|
64
|
-
await runPush(room);
|
|
65
|
-
}
|
|
66
|
-
else if (name === "sync_status") {
|
|
67
|
-
StatusSchema.parse(args ?? {});
|
|
68
|
-
await runStatus();
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
throw new Error(`unknown tool: ${name}`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
finally {
|
|
75
|
-
console.log = origLog;
|
|
76
|
-
console.warn = origWarn;
|
|
77
|
-
console.error = origError;
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
content: [{ type: "text", text: captured.join("\n") || "ok" }],
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
const transport = new StdioServerTransport();
|
|
84
|
-
await server.connect(transport);
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=mcp.js.map
|
|
1
|
+
import{Server as u}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as m}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as d,ListToolsRequestSchema as f}from"@modelcontextprotocol/sdk/types.js";import{z as t}from"zod";import{runPull as h}from"./pull.js";import{runPush as y}from"./push.js";import{runStatus as g}from"./status.js";const S=t.object({room:t.string().optional()}).strict(),w=t.object({room:t.string().optional()}).strict(),v=t.object({}).strict();async function x(){const s=new u({name:"unfairly-sync",version:"0.1.0"},{capabilities:{tools:{}}});s.setRequestHandler(f,async()=>({tools:[{name:"pull_vault",description:"Sync local .unfairly/ from cloud. Pass `room` to scope to one vault, omit for all accessible vaults. Reports docs added/updated/deleted.",inputSchema:{type:"object",properties:{room:{type:"string",description:"Vault slug to scope to (optional)"}}}},{name:"push_vault",description:"Push locally-modified markdown to cloud. Stale-check via expected_updated_at. Returns 409s for conflicts; CLI rewrites those files with merge markers.",inputSchema:{type:"object",properties:{room:{type:"string",description:"Vault slug to scope to (optional)"}}}},{name:"sync_status",description:"Show local sync status: per-vault last-pulled timestamp + modified-locally count.",inputSchema:{type:"object",properties:{}}}]})),s.setRequestHandler(d,async c=>{const{name:e,arguments:n}=c.params,r=[],l=console.log,i=console.warn,p=console.error;console.log=(...o)=>r.push(o.map(String).join(" ")),console.warn=(...o)=>r.push("! "+o.map(String).join(" ")),console.error=(...o)=>r.push("ERR "+o.map(String).join(" "));try{if(e==="pull_vault"){const{room:o}=S.parse(n??{});await h(o)}else if(e==="push_vault"){const{room:o}=w.parse(n??{});await y(o)}else if(e==="sync_status")v.parse(n??{}),await g();else throw new Error(`unknown tool: ${e}`)}finally{console.log=l,console.warn=i,console.error=p}return{content:[{type:"text",text:r.join(`
|
|
2
|
+
`)||"ok"}]}});const a=new m;await s.connect(a)}export{x as runMcp};
|
package/dist/cmd/pace.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { detectPaceClients } from "../pace/device.js";
|
|
2
|
-
export declare const RUNTIME_VERSION = "0.8.
|
|
2
|
+
export declare const RUNTIME_VERSION = "0.8.4";
|
|
3
3
|
export declare const INTELLIGENCE_POLICY: {
|
|
4
4
|
version: "metadata-v3";
|
|
5
5
|
mode: "metadata_only";
|
|
@@ -7,6 +7,21 @@ export declare const INTELLIGENCE_POLICY: {
|
|
|
7
7
|
prohibited_content: string[];
|
|
8
8
|
};
|
|
9
9
|
export declare function runPaceCapture(source: string, hookEvent: string): Promise<void>;
|
|
10
|
+
/** How far back the first sync after connecting reads local transcripts. Matches the report's window. */
|
|
11
|
+
export declare const HISTORY_BACKFILL_DAYS = 90;
|
|
12
|
+
/**
|
|
13
|
+
* Summarizes local sessions and uploads them. Does nothing until this machine
|
|
14
|
+
* is connected: before that there is nowhere to send summaries and no
|
|
15
|
+
* approved-repository list, and a session summarized without that list would
|
|
16
|
+
* lose its commits for good. The first sync after connecting reads the last
|
|
17
|
+
* {@link HISTORY_BACKFILL_DAYS} days so the report has history from day one.
|
|
18
|
+
*/
|
|
19
|
+
export declare function runPaceSync(options?: {
|
|
20
|
+
flush?: boolean;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
summarized: number;
|
|
23
|
+
backfilled: boolean;
|
|
24
|
+
} | null>;
|
|
10
25
|
/** Summarizes local sessions changed since the last sweep and queues them for upload. */
|
|
11
26
|
export declare function runPaceSweep(options?: {
|
|
12
27
|
sinceMs?: number;
|
|
@@ -15,11 +30,18 @@ export declare function runPaceSweep(options?: {
|
|
|
15
30
|
summarized: number;
|
|
16
31
|
queued: number;
|
|
17
32
|
}>;
|
|
33
|
+
/**
|
|
34
|
+
* The Authorization header for Intelligence uploads: this installation's own
|
|
35
|
+
* collector credential (plugin install path) or, failing that, the signed-in
|
|
36
|
+
* CLI token.
|
|
37
|
+
*/
|
|
38
|
+
export declare function paceAuthorization(): Promise<string | null>;
|
|
18
39
|
/** Pulls the organization's approved repositories so sessions can carry repository IDs and commit SHAs. */
|
|
19
40
|
export declare function refreshRepositoryPolicy(options?: {
|
|
20
41
|
force?: boolean;
|
|
21
42
|
}): Promise<{
|
|
22
43
|
repositories: number;
|
|
44
|
+
changed: boolean;
|
|
23
45
|
} | null>;
|
|
24
46
|
/** Summarizes and uploads the last `days` of local sessions so Intelligence has history from day one. */
|
|
25
47
|
export declare function runPaceBackfill(days: number): Promise<{
|
|
@@ -77,4 +99,3 @@ export declare function runPacePlaybookUse(playbookId: string, playbookVersion:
|
|
|
77
99
|
workflow_id: string;
|
|
78
100
|
queued: number;
|
|
79
101
|
}>;
|
|
80
|
-
//# sourceMappingURL=pace.d.ts.map
|