open-research 0.1.9 → 0.1.10
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 +74 -57
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -811,7 +811,7 @@ function formatDateTime(value) {
|
|
|
811
811
|
}
|
|
812
812
|
|
|
813
813
|
// src/lib/cli/version.ts
|
|
814
|
-
var PACKAGE_VERSION = "0.1.
|
|
814
|
+
var PACKAGE_VERSION = "0.1.10";
|
|
815
815
|
function getPackageVersion() {
|
|
816
816
|
return PACKAGE_VERSION;
|
|
817
817
|
}
|
|
@@ -5562,7 +5562,8 @@ var INTERESTING_FILES = /* @__PURE__ */ new Set([
|
|
|
5562
5562
|
".env.example",
|
|
5563
5563
|
"tsconfig.json",
|
|
5564
5564
|
"vitest.config.ts",
|
|
5565
|
-
"jest.config.js"
|
|
5565
|
+
"jest.config.js",
|
|
5566
|
+
"AGENTS.md"
|
|
5566
5567
|
]);
|
|
5567
5568
|
async function scanDirectoryShallow(dir, maxDepth = 2, depth = 0) {
|
|
5568
5569
|
const results = [];
|
|
@@ -5573,7 +5574,7 @@ async function scanDirectoryShallow(dir, maxDepth = 2, depth = 0) {
|
|
|
5573
5574
|
if (IGNORED_DIRS2.has(entry.name)) continue;
|
|
5574
5575
|
if (entry.name.startsWith(".") && depth === 0 && entry.isDirectory()) continue;
|
|
5575
5576
|
const fullPath = path18.join(dir, entry.name);
|
|
5576
|
-
const relativePath = path18.relative(
|
|
5577
|
+
const relativePath = path18.relative(dir, fullPath);
|
|
5577
5578
|
if (entry.isDirectory()) {
|
|
5578
5579
|
results.push({ path: relativePath + "/", size: 0, isDir: true });
|
|
5579
5580
|
const children = await scanDirectoryShallow(fullPath, maxDepth, depth + 1);
|
|
@@ -5590,40 +5591,46 @@ async function scanDirectoryShallow(dir, maxDepth = 2, depth = 0) {
|
|
|
5590
5591
|
async function readKeyFiles(dir) {
|
|
5591
5592
|
const contents = {};
|
|
5592
5593
|
for (const name of INTERESTING_FILES) {
|
|
5593
|
-
const filePath = path18.join(dir, name);
|
|
5594
5594
|
try {
|
|
5595
|
-
const content = await fs19.readFile(
|
|
5595
|
+
const content = await fs19.readFile(path18.join(dir, name), "utf8");
|
|
5596
5596
|
contents[name] = content.slice(0, 2e3);
|
|
5597
5597
|
} catch {
|
|
5598
5598
|
}
|
|
5599
5599
|
}
|
|
5600
5600
|
return contents;
|
|
5601
5601
|
}
|
|
5602
|
-
var
|
|
5602
|
+
var CREATE_PROMPT = `You are creating an AGENTS.md file for a research workspace. This file is injected into an AI research agent's system prompt every session to give it instant project context.
|
|
5603
5603
|
|
|
5604
|
-
|
|
5604
|
+
Write a concise AGENTS.md covering:
|
|
5605
|
+
## Project Overview \u2014 What is this project? What research?
|
|
5606
|
+
## Structure \u2014 Key directories and their purpose (only important ones)
|
|
5607
|
+
## Key Files \u2014 Notable files and what they do
|
|
5608
|
+
## Research Context \u2014 What research is in progress?
|
|
5609
|
+
## Development \u2014 How to build/run/test (if applicable)
|
|
5605
5610
|
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
##
|
|
5610
|
-
|
|
5611
|
+
Rules:
|
|
5612
|
+
- Under 1500 characters. This goes into every system prompt.
|
|
5613
|
+
- Specific to THIS project. No generic advice.
|
|
5614
|
+
- Markdown with ## headings.`;
|
|
5615
|
+
var UPDATE_PROMPT = `You are updating an existing AGENTS.md file for a research workspace. This file is injected into an AI research agent's system prompt every session.
|
|
5611
5616
|
|
|
5612
|
-
|
|
5613
|
-
|
|
5617
|
+
You have:
|
|
5618
|
+
1. The CURRENT AGENTS.md content
|
|
5619
|
+
2. A fresh scan of the workspace directory and key files
|
|
5614
5620
|
|
|
5615
|
-
|
|
5616
|
-
|
|
5621
|
+
Your job: compare the current AGENTS.md against the actual workspace state. Update it to reflect reality:
|
|
5622
|
+
- Add new directories/files that appeared
|
|
5623
|
+
- Remove references to things that no longer exist
|
|
5624
|
+
- Update descriptions that are now outdated
|
|
5625
|
+
- Preserve any manually-added notes or context the user wrote
|
|
5626
|
+
- Keep the same ## heading structure
|
|
5617
5627
|
|
|
5618
|
-
|
|
5619
|
-
How to build/run/test (if applicable, based on package.json or similar).
|
|
5628
|
+
If AGENTS.md is already accurate, output it unchanged.
|
|
5620
5629
|
|
|
5621
5630
|
Rules:
|
|
5622
|
-
-
|
|
5623
|
-
-
|
|
5624
|
-
-
|
|
5625
|
-
- Use markdown with ## headings
|
|
5626
|
-
- Don't include obvious things ("node_modules contains npm packages")`;
|
|
5631
|
+
- Under 1500 characters. This goes into every system prompt.
|
|
5632
|
+
- Output the FULL updated AGENTS.md content, not a diff.
|
|
5633
|
+
- Markdown with ## headings.`;
|
|
5627
5634
|
async function generateInitialAgentsMd(input2) {
|
|
5628
5635
|
const dir = input2.workspaceDir;
|
|
5629
5636
|
const files = await scanDirectoryShallow(dir);
|
|
@@ -5633,17 +5640,32 @@ async function generateInitialAgentsMd(input2) {
|
|
|
5633
5640
|
\`\`\`
|
|
5634
5641
|
${content2}
|
|
5635
5642
|
\`\`\``).join("\n\n");
|
|
5636
|
-
const
|
|
5643
|
+
const scanData = `Directory: ${dir}
|
|
5637
5644
|
|
|
5638
5645
|
File tree:
|
|
5639
5646
|
${tree}
|
|
5640
5647
|
|
|
5641
|
-
${keyFileText
|
|
5642
|
-
|
|
5648
|
+
${keyFileText || "No recognizable key files found."}`;
|
|
5649
|
+
const existing = await readAgentsMd(dir);
|
|
5650
|
+
let systemPrompt;
|
|
5651
|
+
let userMessage;
|
|
5652
|
+
if (existing) {
|
|
5653
|
+
systemPrompt = UPDATE_PROMPT;
|
|
5654
|
+
userMessage = `Current AGENTS.md:
|
|
5655
|
+
---
|
|
5656
|
+
${existing}
|
|
5657
|
+
---
|
|
5658
|
+
|
|
5659
|
+
Fresh workspace scan:
|
|
5660
|
+
${scanData.slice(0, 25e3)}`;
|
|
5661
|
+
} else {
|
|
5662
|
+
systemPrompt = CREATE_PROMPT;
|
|
5663
|
+
userMessage = scanData.slice(0, 25e3);
|
|
5664
|
+
}
|
|
5643
5665
|
const response = await input2.provider.callLLM({
|
|
5644
5666
|
messages: [
|
|
5645
|
-
{ role: "system", content:
|
|
5646
|
-
{ role: "user", content: userMessage
|
|
5667
|
+
{ role: "system", content: systemPrompt },
|
|
5668
|
+
{ role: "user", content: userMessage }
|
|
5647
5669
|
],
|
|
5648
5670
|
model: input2.model ?? "gpt-5.4-mini",
|
|
5649
5671
|
maxTokens: 2048,
|
|
@@ -6683,37 +6705,32 @@ function App({
|
|
|
6683
6705
|
}
|
|
6684
6706
|
case "init": {
|
|
6685
6707
|
const target = process.cwd();
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6708
|
+
setBusy(true);
|
|
6709
|
+
try {
|
|
6710
|
+
const existing = await loadWorkspaceProject(target);
|
|
6711
|
+
if (!existing) {
|
|
6712
|
+
await initWorkspace({ workspaceDir: target });
|
|
6713
|
+
addSystemMessage(`Workspace initialized at ${target}`);
|
|
6714
|
+
}
|
|
6689
6715
|
setWorkspacePath(target);
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
const project = await initWorkspace({ workspaceDir: target });
|
|
6694
|
-
setWorkspacePath(target);
|
|
6695
|
-
addSystemMessage(`Initialized workspace "${project.title}" at ${target}`);
|
|
6696
|
-
const scanned = await scanWorkspace(target);
|
|
6697
|
-
startTransition(() => setWorkspaceFiles(scanned.files));
|
|
6698
|
-
if (hasAuth) {
|
|
6699
|
-
addSystemMessage("Generating AGENTS.md...");
|
|
6700
|
-
try {
|
|
6701
|
-
const provider = await createProviderFromStoredAuth({ homeDir });
|
|
6702
|
-
await generateInitialAgentsMd({
|
|
6703
|
-
workspaceDir: target,
|
|
6704
|
-
provider,
|
|
6705
|
-
model: "gpt-5.4-mini"
|
|
6706
|
-
});
|
|
6707
|
-
addSystemMessage("AGENTS.md created \u2014 project context will be loaded on every session.");
|
|
6708
|
-
} catch {
|
|
6709
|
-
addSystemMessage("AGENTS.md generation skipped (connect auth first).");
|
|
6710
|
-
}
|
|
6711
|
-
}
|
|
6712
|
-
} catch (err) {
|
|
6713
|
-
addSystemMessage(`Init failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
6714
|
-
} finally {
|
|
6715
|
-
setBusy(false);
|
|
6716
|
+
if (!hasAuth) {
|
|
6717
|
+
addSystemMessage("Run /auth first \u2014 AGENTS.md generation requires auth.");
|
|
6718
|
+
break;
|
|
6716
6719
|
}
|
|
6720
|
+
addSystemMessage("Scanning workspace and updating AGENTS.md...");
|
|
6721
|
+
const provider = await createProviderFromStoredAuth({ homeDir });
|
|
6722
|
+
const result = await generateInitialAgentsMd({
|
|
6723
|
+
workspaceDir: target,
|
|
6724
|
+
provider,
|
|
6725
|
+
model: "gpt-5.4-mini"
|
|
6726
|
+
});
|
|
6727
|
+
addSystemMessage("AGENTS.md ready. Project context will load on every session.");
|
|
6728
|
+
const scanned = await scanWorkspace(target);
|
|
6729
|
+
startTransition(() => setWorkspaceFiles(scanned.files));
|
|
6730
|
+
} catch (err) {
|
|
6731
|
+
addSystemMessage(`Init failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
6732
|
+
} finally {
|
|
6733
|
+
setBusy(false);
|
|
6717
6734
|
}
|
|
6718
6735
|
break;
|
|
6719
6736
|
}
|
package/package.json
CHANGED