open-research 0.1.6 → 0.1.8
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/dist/cli.js +51 -38
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -810,6 +810,12 @@ function formatDateTime(value) {
|
|
|
810
810
|
return new Date(value).toLocaleString();
|
|
811
811
|
}
|
|
812
812
|
|
|
813
|
+
// src/lib/cli/version.ts
|
|
814
|
+
var PACKAGE_VERSION = "0.1.8";
|
|
815
|
+
function getPackageVersion() {
|
|
816
|
+
return PACKAGE_VERSION;
|
|
817
|
+
}
|
|
818
|
+
|
|
813
819
|
// src/lib/config/store.ts
|
|
814
820
|
import { z } from "zod";
|
|
815
821
|
var themeValues = ["dark", "light"];
|
|
@@ -1520,10 +1526,28 @@ var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
1520
1526
|
".yml",
|
|
1521
1527
|
".csv"
|
|
1522
1528
|
]);
|
|
1529
|
+
var IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
1530
|
+
".open-research",
|
|
1531
|
+
"node_modules",
|
|
1532
|
+
".git",
|
|
1533
|
+
"dist",
|
|
1534
|
+
"build",
|
|
1535
|
+
".next",
|
|
1536
|
+
"__pycache__",
|
|
1537
|
+
".venv",
|
|
1538
|
+
"venv",
|
|
1539
|
+
".cache",
|
|
1540
|
+
"target",
|
|
1541
|
+
".tox",
|
|
1542
|
+
"coverage",
|
|
1543
|
+
".nyc_output",
|
|
1544
|
+
".parcel-cache",
|
|
1545
|
+
".turbo"
|
|
1546
|
+
]);
|
|
1523
1547
|
async function walkDir(rootDir, currentDir, out) {
|
|
1524
1548
|
const entries = await fs8.readdir(currentDir, { withFileTypes: true });
|
|
1525
1549
|
for (const entry of entries) {
|
|
1526
|
-
if (entry.name
|
|
1550
|
+
if (IGNORED_DIRS.has(entry.name)) {
|
|
1527
1551
|
continue;
|
|
1528
1552
|
}
|
|
1529
1553
|
const fullPath = path7.join(currentDir, entry.name);
|
|
@@ -1705,7 +1729,7 @@ function createOpenAIAuthProvider(credentials, onTokenRefresh, onValidationChang
|
|
|
1705
1729
|
Authorization: `Bearer ${token}`,
|
|
1706
1730
|
"Content-Type": "application/json",
|
|
1707
1731
|
originator: "open-research",
|
|
1708
|
-
"User-Agent": `open-research/${
|
|
1732
|
+
"User-Agent": `open-research/${getPackageVersion()} (${process.platform} ${process.arch})`,
|
|
1709
1733
|
session_id: sessionId
|
|
1710
1734
|
};
|
|
1711
1735
|
if (creds.accountId) {
|
|
@@ -2280,9 +2304,6 @@ function getToolsForMode(mode) {
|
|
|
2280
2304
|
|
|
2281
2305
|
// src/lib/agent/prompts/planning.ts
|
|
2282
2306
|
function buildPlanningSystemPrompt(ctx, activeSkills) {
|
|
2283
|
-
const workspaceMap = ctx.availableKeys.map(
|
|
2284
|
-
(key) => `- ${key}${ctx.fileLabels?.[key] ? ` \u2014 ${ctx.fileLabels[key]}` : ""}`
|
|
2285
|
-
).join("\n");
|
|
2286
2307
|
const skillText = activeSkills.map((skill) => `## Active Skill: ${skill.name}
|
|
2287
2308
|
${skill.prompt}`).join("\n\n");
|
|
2288
2309
|
return [
|
|
@@ -2348,8 +2369,9 @@ ${skill.prompt}`).join("\n\n");
|
|
|
2348
2369
|
"- If the user's intent is already crystal clear, you can produce the charter after just 1 question or even immediately.",
|
|
2349
2370
|
"- Ground your proposed steps in what you've learned from the workspace and external search results.",
|
|
2350
2371
|
"",
|
|
2351
|
-
|
|
2352
|
-
${
|
|
2372
|
+
`## Workspace
|
|
2373
|
+
Root: ${process.cwd()}
|
|
2374
|
+
Use list_directory to explore. Use search_workspace or read_file to read content.`,
|
|
2353
2375
|
skillText
|
|
2354
2376
|
].filter(Boolean).join("\n");
|
|
2355
2377
|
}
|
|
@@ -4942,7 +4964,6 @@ function describeToolCall(name, args) {
|
|
|
4942
4964
|
return fn ? fn(args) : `Running ${name}`;
|
|
4943
4965
|
}
|
|
4944
4966
|
function buildSystemPrompt(ctx, activeSkills) {
|
|
4945
|
-
const workspaceMap = ctx.availableKeys.map((key) => `- ${key}${ctx.fileLabels?.[key] ? ` \u2014 ${ctx.fileLabels[key]}` : ""}`).join("\n");
|
|
4946
4967
|
const skillText = activeSkills.map((skill) => `## Active Skill: ${skill.name}
|
|
4947
4968
|
${skill.prompt}`).join("\n\n");
|
|
4948
4969
|
return [
|
|
@@ -4950,8 +4971,9 @@ ${skill.prompt}`).join("\n\n");
|
|
|
4950
4971
|
"",
|
|
4951
4972
|
"## Capabilities",
|
|
4952
4973
|
"You have full access to the local filesystem and shell. You can:",
|
|
4953
|
-
"- Read any file on disk with read_file
|
|
4954
|
-
"- List directories with list_directory to explore
|
|
4974
|
+
"- Read any file on disk with read_file",
|
|
4975
|
+
"- List directories with list_directory to explore the workspace and discover files",
|
|
4976
|
+
"- Search file contents with search_workspace",
|
|
4955
4977
|
"- Run shell commands with run_command (python, R, node, LaTeX, curl, git, etc.)",
|
|
4956
4978
|
"- Write new workspace files or edit existing ones",
|
|
4957
4979
|
"- Search academic papers across OpenAlex, Semantic Scholar, and arXiv",
|
|
@@ -4960,15 +4982,17 @@ ${skill.prompt}`).join("\n\n");
|
|
|
4960
4982
|
"- Activate research skills for specialized workflows",
|
|
4961
4983
|
"",
|
|
4962
4984
|
"## Principles",
|
|
4963
|
-
"-
|
|
4985
|
+
"- Start by exploring. Use list_directory and search_workspace to understand the workspace before acting.",
|
|
4986
|
+
"- Read before writing. Understand existing files before making changes.",
|
|
4964
4987
|
"- Ground claims in sources. Cite papers and data, not assumptions.",
|
|
4965
4988
|
"- Run code to verify. When you write a script, run it and check the output.",
|
|
4966
4989
|
"- Be transparent. Show the user what you're doing and why.",
|
|
4967
4990
|
"- When unsure, ask. Use ask_user rather than guessing.",
|
|
4968
4991
|
"- For large outputs, redirect to a file and read selectively.",
|
|
4969
4992
|
"",
|
|
4970
|
-
|
|
4971
|
-
${
|
|
4993
|
+
`## Workspace
|
|
4994
|
+
Root: ${process.cwd()}
|
|
4995
|
+
Use list_directory to explore. Use search_workspace or read_file to read content.`,
|
|
4972
4996
|
skillText
|
|
4973
4997
|
].filter(Boolean).join("\n");
|
|
4974
4998
|
}
|
|
@@ -5355,9 +5379,14 @@ var STATE_FILE = path16.join(os4.homedir(), ".open-research", "update-check.json
|
|
|
5355
5379
|
async function readState() {
|
|
5356
5380
|
try {
|
|
5357
5381
|
const raw = await fs17.readFile(STATE_FILE, "utf8");
|
|
5358
|
-
|
|
5382
|
+
const parsed = JSON.parse(raw);
|
|
5383
|
+
return {
|
|
5384
|
+
lastCheck: typeof parsed.lastCheck === "number" ? parsed.lastCheck : 0,
|
|
5385
|
+
latestVersion: typeof parsed.latestVersion === "string" ? parsed.latestVersion : null,
|
|
5386
|
+
checkedFromVersion: typeof parsed.checkedFromVersion === "string" ? parsed.checkedFromVersion : null
|
|
5387
|
+
};
|
|
5359
5388
|
} catch {
|
|
5360
|
-
return { lastCheck: 0, latestVersion: null };
|
|
5389
|
+
return { lastCheck: 0, latestVersion: null, checkedFromVersion: null };
|
|
5361
5390
|
}
|
|
5362
5391
|
}
|
|
5363
5392
|
async function writeState(state) {
|
|
@@ -5365,22 +5394,7 @@ async function writeState(state) {
|
|
|
5365
5394
|
await fs17.writeFile(STATE_FILE, JSON.stringify(state), "utf8");
|
|
5366
5395
|
}
|
|
5367
5396
|
function getCurrentVersion() {
|
|
5368
|
-
|
|
5369
|
-
try {
|
|
5370
|
-
const fs19 = __require("fs");
|
|
5371
|
-
const path20 = __require("path");
|
|
5372
|
-
let dir = __dirname || path20.dirname(new URL(import.meta.url).pathname);
|
|
5373
|
-
for (let i = 0; i < 5; i++) {
|
|
5374
|
-
const pkgFile = path20.join(dir, "package.json");
|
|
5375
|
-
if (fs19.existsSync(pkgFile)) {
|
|
5376
|
-
const pkg = JSON.parse(fs19.readFileSync(pkgFile, "utf8"));
|
|
5377
|
-
if (pkg.name === "open-research" && pkg.version) return pkg.version;
|
|
5378
|
-
}
|
|
5379
|
-
dir = path20.dirname(dir);
|
|
5380
|
-
}
|
|
5381
|
-
} catch {
|
|
5382
|
-
}
|
|
5383
|
-
return "0.0.0";
|
|
5397
|
+
return getPackageVersion();
|
|
5384
5398
|
}
|
|
5385
5399
|
async function fetchLatestVersion() {
|
|
5386
5400
|
try {
|
|
@@ -5410,17 +5424,16 @@ async function checkForUpdate() {
|
|
|
5410
5424
|
try {
|
|
5411
5425
|
const state = await readState();
|
|
5412
5426
|
const now = Date.now();
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
if (isNewer(state.latestVersion,
|
|
5416
|
-
return `Update available: ${
|
|
5427
|
+
const current = getCurrentVersion();
|
|
5428
|
+
if (now - state.lastCheck < CHECK_INTERVAL_MS && state.latestVersion && state.checkedFromVersion === current) {
|
|
5429
|
+
if (isNewer(state.latestVersion, current)) {
|
|
5430
|
+
return `Update available: ${current} \u2192 ${state.latestVersion}. Run: npm update -g open-research`;
|
|
5417
5431
|
}
|
|
5418
5432
|
return null;
|
|
5419
5433
|
}
|
|
5420
5434
|
const latest = await fetchLatestVersion();
|
|
5421
|
-
await writeState({ lastCheck: now, latestVersion: latest });
|
|
5435
|
+
await writeState({ lastCheck: now, latestVersion: latest, checkedFromVersion: current });
|
|
5422
5436
|
if (!latest) return null;
|
|
5423
|
-
const current = getCurrentVersion();
|
|
5424
5437
|
if (isNewer(latest, current)) {
|
|
5425
5438
|
return `Update available: ${current} \u2192 ${latest}. Run: npm update -g open-research`;
|
|
5426
5439
|
}
|
|
@@ -7475,7 +7488,7 @@ ${msg.text}
|
|
|
7475
7488
|
|
|
7476
7489
|
// src/cli.ts
|
|
7477
7490
|
var program = new Command();
|
|
7478
|
-
program.name("open-research").description("Local-first research CLI powered by ChatGPT/Codex auth.").argument("[workspacePath]", "Optional workspace path to open").action(async (workspacePath) => {
|
|
7491
|
+
program.name("open-research").version(getPackageVersion()).description("Local-first research CLI powered by ChatGPT/Codex auth.").argument("[workspacePath]", "Optional workspace path to open").action(async (workspacePath) => {
|
|
7479
7492
|
await ensureOpenResearchConfig();
|
|
7480
7493
|
const target = workspacePath ? path19.resolve(workspacePath) : process.cwd();
|
|
7481
7494
|
const project = await loadWorkspaceProject(target);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-research",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Local-first research CLI agent — discover papers, synthesize notes, run analysis, and draft artifacts from your terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"dev": "tsx src/cli.ts",
|
|
16
|
-
"build": "tsup
|
|
16
|
+
"build": "tsup --config tsup.config.ts",
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"test:watch": "vitest",
|
|
19
19
|
"prepublishOnly": "npm run build"
|