scream-code 0.9.1 → 0.9.2
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/{app-CwKaEg7v.mjs → app-Ir0w8ElF.mjs} +100 -14
- package/dist/main.mjs +1 -1
- package/package.json +1 -1
|
@@ -62700,7 +62700,7 @@ async function resolveSkillRoots(options) {
|
|
|
62700
62700
|
const roots = [];
|
|
62701
62701
|
const mergeAllAvailableSkills = options.mergeAllAvailableSkills ?? true;
|
|
62702
62702
|
const { userHomeDir, workDir } = options.paths;
|
|
62703
|
-
const projectRoot = await findProjectRoot$
|
|
62703
|
+
const projectRoot = await findProjectRoot$2(workDir);
|
|
62704
62704
|
if (options.explicitDirs !== void 0 && options.explicitDirs.length > 0) await pushConfiguredDirs(roots, options.explicitDirs, projectRoot, userHomeDir, "user", isDir, realpath);
|
|
62705
62705
|
else {
|
|
62706
62706
|
await pushBrandGroup(roots, PROJECT_BRAND_DIRS, projectRoot, "project", mergeAllAvailableSkills, isDir, realpath);
|
|
@@ -62885,7 +62885,7 @@ async function defaultIsFile(p) {
|
|
|
62885
62885
|
return false;
|
|
62886
62886
|
}
|
|
62887
62887
|
}
|
|
62888
|
-
async function findProjectRoot$
|
|
62888
|
+
async function findProjectRoot$2(workDir) {
|
|
62889
62889
|
const start = resolve$1(workDir);
|
|
62890
62890
|
let current = start;
|
|
62891
62891
|
while (true) {
|
|
@@ -81883,7 +81883,7 @@ async function loadRoleAdditional(_jian) {
|
|
|
81883
81883
|
}
|
|
81884
81884
|
async function loadAgentsMd(jian) {
|
|
81885
81885
|
const workDir = jian.getcwd();
|
|
81886
|
-
const dirs = dirsRootToLeaf(jian, workDir, await findProjectRoot(jian, workDir));
|
|
81886
|
+
const dirs = dirsRootToLeaf(jian, workDir, await findProjectRoot$1(jian, workDir));
|
|
81887
81887
|
const discovered = [];
|
|
81888
81888
|
const seen = /* @__PURE__ */ new Set();
|
|
81889
81889
|
const collect = async (path) => {
|
|
@@ -81905,7 +81905,7 @@ async function loadAgentsMd(jian) {
|
|
|
81905
81905
|
}
|
|
81906
81906
|
return renderAgentFiles(discovered);
|
|
81907
81907
|
}
|
|
81908
|
-
async function findProjectRoot(jian, workDir) {
|
|
81908
|
+
async function findProjectRoot$1(jian, workDir) {
|
|
81909
81909
|
const initial = jian.normpath(workDir);
|
|
81910
81910
|
let current = initial;
|
|
81911
81911
|
while (true) {
|
|
@@ -96954,7 +96954,7 @@ var coder_default = "extends: agent\nname: coder\npromptVars:\n roleAdditional:
|
|
|
96954
96954
|
var explore_default = "extends: agent\nname: explore\npromptVars:\n roleAdditional: |\n You are now running as a subagent. All the `user` messages are sent by the main agent. The main agent cannot see your context, it can only see your last message when you finish the task. You must treat the parent agent as your caller. Do not directly ask the end user questions. If something is unclear, explain the ambiguity in your final summary to the parent agent.\n\n You are a codebase exploration specialist. Your role is EXCLUSIVELY to search, read, and analyze existing code and resources. You do NOT have access to file editing tools.\n\n Your strengths:\n - Rapidly finding files using glob patterns\n - Searching code and text with powerful regex patterns\n - Reading and analyzing file contents\n - Running read-only shell commands (git log, git diff, ls, find, etc.)\n\n Guidelines:\n - Use Glob for broad file pattern matching. Patterns MUST contain a literal anchor (extension or subdirectory); pure wildcards like `*` or `**/*` are rejected by the tool.\n - Use Grep for searching file contents with regex\n - Use Read when you know the specific file path\n - Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find)\n - NEVER use Bash for any file creation or modification commands\n - Adapt your search depth based on the thoroughness level specified by the caller\n - Wherever possible, spawn multiple parallel tool calls for grepping and reading files to maximize speed\n - If a search returns empty results, you MUST try at least one alternate strategy (different pattern, broader path, or alternate naming convention) before concluding the target doesn't exist\n\n If the prompt includes a <git-context> block, use it to orient yourself about the repository state before starting your investigation.\n\n You are meant to be a fast agent. Complete the search request efficiently and report your findings clearly in a structured format.\nwhenToUse: |\n Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (e.g. \"src/**/*.yaml\"), search code for keywords (e.g. \"database connection\"), or answer questions about the codebase (e.g. \"how does the auth module work?\"). When calling this agent, specify the desired thoroughness level: \"quick\" for basic searches, \"medium\" for moderate exploration, or \"thorough\" for comprehensive analysis across multiple locations and naming conventions. Use this agent for any read-only exploration that will clearly require more than 3 search queries. Prefer launching multiple explore agents concurrently when investigating independent questions.\ntools:\n - Bash\n - Read\n - ReadMediaFile\n - Glob\n - Grep\n - WebSearch\n - MemoryLookup\n - MemoryConsolidatePlan\n - MemoryConsolidateApply\n - FetchURL\n";
|
|
96955
96955
|
//#endregion
|
|
96956
96956
|
//#region ../../packages/agent-core/src/profile/default/init.md
|
|
96957
|
-
var init_default = "You are a software engineering expert with many years of programming experience.
|
|
96957
|
+
var init_default = "You are a software engineering expert with many years of programming experience. The user wants to generate an `AGENTS.md` file for their project.\n\nThe `AGENTS.md` file MUST be written to `<TARGET_DIR>/AGENTS.md`. <SCOPE_HINT>\n\nTask requirements:\n1. Analyze the project structure and identify key configuration files (such as pyproject.toml, package.json, Cargo.toml, etc.).\n2. Understand the project's technology stack, build process and runtime architecture.\n3. Identify how the code is organized and main module divisions.\n4. Discover project-specific development conventions, testing strategies, and deployment processes.\n\nAfter the exploration, you should do a thorough summary of your findings and overwrite it into `AGENTS.md` file in <TARGET_DIR>. You need to refer to what is already in the file when you do so.\n\nFor your information, `AGENTS.md` is a file intended to be read by AI coding agents. Expect the reader of this file know nothing about the project.\n\nYou should compose this file according to the actual project content. Do not make any assumptions or generalizations. Ensure the information is accurate and useful. You must use the natural language that is mainly used in the project's comments and documentation.\n\nPopular sections that people usually write in `AGENTS.md` are:\n\n- Project overview\n- Build and test commands\n- Code style guidelines\n- Testing instructions\n- Security considerations\n";
|
|
96958
96958
|
//#endregion
|
|
96959
96959
|
//#region ../../packages/agent-core/src/profile/default.ts
|
|
96960
96960
|
const PROFILE_SOURCES = {
|
|
@@ -104132,13 +104132,16 @@ var Session$1 = class {
|
|
|
104132
104132
|
const context = await prepareSystemPromptContext(agent.jian);
|
|
104133
104133
|
agent.useProfile(profile, context);
|
|
104134
104134
|
}
|
|
104135
|
-
async generateAgentsMd() {
|
|
104135
|
+
async generateAgentsMd(targetDir) {
|
|
104136
104136
|
await this.skillsReady;
|
|
104137
104137
|
const mainAgent = this.requireMainAgent();
|
|
104138
104138
|
try {
|
|
104139
|
+
const workDir = mainAgent.jian.getcwd();
|
|
104140
|
+
const scopeHint = targetDir !== void 0 && resolve(targetDir) === resolve(workDir) ? "Strictly analyze only <TARGET_DIR>. Do NOT explore any parent directories or sibling directories outside <TARGET_DIR>." : "You may explore from the current working directory upward to <TARGET_DIR> as needed to understand the whole project.";
|
|
104141
|
+
const prompt = DEFAULT_INIT_PROMPT.replaceAll("<TARGET_DIR>", targetDir ?? "the project root").replaceAll("<SCOPE_HINT>", scopeHint);
|
|
104139
104142
|
await (await mainAgent.subagentHost.spawn("coder", {
|
|
104140
104143
|
parentToolCallId: "generate-agents-md",
|
|
104141
|
-
prompt
|
|
104144
|
+
prompt,
|
|
104142
104145
|
description: "Initialize AGENTS.md",
|
|
104143
104146
|
runInBackground: false,
|
|
104144
104147
|
origin: {
|
|
@@ -118957,8 +118960,8 @@ var SessionAPIImpl = class {
|
|
|
118957
118960
|
async removeMcpServer(payload) {
|
|
118958
118961
|
await this.session.mcp.removeServer(payload.name);
|
|
118959
118962
|
}
|
|
118960
|
-
generateAgentsMd(
|
|
118961
|
-
return this.session.generateAgentsMd();
|
|
118963
|
+
generateAgentsMd(payload) {
|
|
118964
|
+
return this.session.generateAgentsMd(payload.targetDir);
|
|
118962
118965
|
}
|
|
118963
118966
|
async prompt({ agentId, ...payload }) {
|
|
118964
118967
|
if (agentId === "main") await this.updatePromptMetadata(promptMetadataTextFromPayload(payload));
|
|
@@ -121461,6 +121464,13 @@ const dictionaries = {
|
|
|
121461
121464
|
"knowledge.menu_title": "SAG知识库管理",
|
|
121462
121465
|
"knowledge.menu_hint": "选择操作(esc 退出)",
|
|
121463
121466
|
"knowledge.op_failed": "操作失败: {msg}",
|
|
121467
|
+
"init.select_title": "选择 AGENTS.md 生成位置",
|
|
121468
|
+
"init.select_hint": "当前目录:{currentDir} · 项目根目录:{projectRoot}",
|
|
121469
|
+
"init.current_dir": "当前目录",
|
|
121470
|
+
"init.current_dir_desc": "仅在当前目录生成并分析",
|
|
121471
|
+
"init.project_root": "项目根目录",
|
|
121472
|
+
"init.project_root_desc": "基于当前目录,允许 AI 自行向上探索后生成",
|
|
121473
|
+
"init.cancelled": "已取消初始化",
|
|
121464
121474
|
"loop.permission_auto": "权限已切到 auto(循环期间不再弹审批)。",
|
|
121465
121475
|
"loop.disabled": "循环模式已关闭。",
|
|
121466
121476
|
"loop.prompt_updated": "循环提示词已更新。",
|
|
@@ -122530,6 +122540,13 @@ const dictionaries = {
|
|
|
122530
122540
|
"knowledge.menu_title": "SAG Knowledge Base",
|
|
122531
122541
|
"knowledge.menu_hint": "Select an action (Esc to exit)",
|
|
122532
122542
|
"knowledge.op_failed": "Operation failed: {msg}",
|
|
122543
|
+
"init.select_title": "Select AGENTS.md location",
|
|
122544
|
+
"init.select_hint": "Current: {currentDir} · Project root: {projectRoot}",
|
|
122545
|
+
"init.current_dir": "Current directory",
|
|
122546
|
+
"init.current_dir_desc": "Generate and analyze current directory only",
|
|
122547
|
+
"init.project_root": "Project root",
|
|
122548
|
+
"init.project_root_desc": "Start from current directory, let AI explore upward to find root",
|
|
122549
|
+
"init.cancelled": "Initialization cancelled",
|
|
122533
122550
|
"loop.permission_auto": "Permissions switched to auto (no approvals during loop).",
|
|
122534
122551
|
"loop.disabled": "Loop mode disabled.",
|
|
122535
122552
|
"loop.prompt_updated": "Loop prompt updated.",
|
|
@@ -123549,7 +123566,10 @@ var SDKRpcClient = class {
|
|
|
123549
123566
|
});
|
|
123550
123567
|
}
|
|
123551
123568
|
async generateAgentsMd(input) {
|
|
123552
|
-
return (await this.getRpc()).generateAgentsMd({
|
|
123569
|
+
return (await this.getRpc()).generateAgentsMd({
|
|
123570
|
+
sessionId: input.sessionId,
|
|
123571
|
+
targetDir: input.targetDir
|
|
123572
|
+
});
|
|
123553
123573
|
}
|
|
123554
123574
|
async cancel(input) {
|
|
123555
123575
|
return (await this.getRpc()).cancel({
|
|
@@ -124030,9 +124050,12 @@ var Session = class {
|
|
|
124030
124050
|
input: normalizePromptInput(input)
|
|
124031
124051
|
});
|
|
124032
124052
|
}
|
|
124033
|
-
async init() {
|
|
124053
|
+
async init(targetDir) {
|
|
124034
124054
|
this.ensureOpen();
|
|
124035
|
-
await this.rpc.generateAgentsMd({
|
|
124055
|
+
await this.rpc.generateAgentsMd({
|
|
124056
|
+
sessionId: this.id,
|
|
124057
|
+
targetDir
|
|
124058
|
+
});
|
|
124036
124059
|
}
|
|
124037
124060
|
async cancel() {
|
|
124038
124061
|
this.ensureOpen();
|
|
@@ -124851,7 +124874,7 @@ function optionalBuildString(value) {
|
|
|
124851
124874
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
124852
124875
|
}
|
|
124853
124876
|
const SCREAM_BUILD_INFO = {
|
|
124854
|
-
version: optionalBuildString("0.9.
|
|
124877
|
+
version: optionalBuildString("0.9.2"),
|
|
124855
124878
|
channel: optionalBuildString(""),
|
|
124856
124879
|
commit: optionalBuildString(""),
|
|
124857
124880
|
buildTarget: optionalBuildString("darwin-arm64")
|
|
@@ -129910,10 +129933,17 @@ async function handleInitCommand(host) {
|
|
|
129910
129933
|
host.showError(getLlmNotSetMessage());
|
|
129911
129934
|
return;
|
|
129912
129935
|
}
|
|
129936
|
+
const workDir = host.state.appState.workDir;
|
|
129937
|
+
const projectRoot = findProjectRoot(workDir);
|
|
129938
|
+
const targetDir = projectRoot === void 0 || projectRoot === workDir ? workDir : await selectInitTargetDir(host, workDir, projectRoot);
|
|
129939
|
+
if (targetDir === void 0) {
|
|
129940
|
+
host.showStatus(t("init.cancelled"));
|
|
129941
|
+
return;
|
|
129942
|
+
}
|
|
129913
129943
|
host.deferUserMessages = true;
|
|
129914
129944
|
host.beginSessionRequest();
|
|
129915
129945
|
try {
|
|
129916
|
-
await session.init();
|
|
129946
|
+
await session.init(targetDir);
|
|
129917
129947
|
host.streamingUI.finalizeTurn((item) => {
|
|
129918
129948
|
host.sendQueuedMessage(session, item);
|
|
129919
129949
|
});
|
|
@@ -129929,6 +129959,62 @@ async function handleInitCommand(host) {
|
|
|
129929
129959
|
host.deferUserMessages = false;
|
|
129930
129960
|
}
|
|
129931
129961
|
}
|
|
129962
|
+
const PROJECT_ROOT_MARKERS = [
|
|
129963
|
+
"package.json",
|
|
129964
|
+
"Cargo.toml",
|
|
129965
|
+
"pyproject.toml",
|
|
129966
|
+
"go.mod",
|
|
129967
|
+
"pom.xml",
|
|
129968
|
+
"tsconfig.json"
|
|
129969
|
+
];
|
|
129970
|
+
function findProjectRoot(startDir) {
|
|
129971
|
+
let dir = resolve(startDir);
|
|
129972
|
+
let markerDir;
|
|
129973
|
+
while (true) {
|
|
129974
|
+
if (existsSync(resolve(dir, ".git"))) return dir;
|
|
129975
|
+
if (markerDir === void 0) {
|
|
129976
|
+
for (const marker of PROJECT_ROOT_MARKERS) if (existsSync(resolve(dir, marker))) {
|
|
129977
|
+
markerDir = dir;
|
|
129978
|
+
break;
|
|
129979
|
+
}
|
|
129980
|
+
}
|
|
129981
|
+
const parent = dirname$1(dir);
|
|
129982
|
+
if (parent === dir) break;
|
|
129983
|
+
dir = parent;
|
|
129984
|
+
}
|
|
129985
|
+
return markerDir;
|
|
129986
|
+
}
|
|
129987
|
+
function selectInitTargetDir(host, workDir, projectRoot) {
|
|
129988
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
129989
|
+
const options = [{
|
|
129990
|
+
value: workDir,
|
|
129991
|
+
label: t("init.current_dir"),
|
|
129992
|
+
description: t("init.current_dir_desc")
|
|
129993
|
+
}, {
|
|
129994
|
+
value: projectRoot,
|
|
129995
|
+
label: t("init.project_root"),
|
|
129996
|
+
description: t("init.project_root_desc")
|
|
129997
|
+
}];
|
|
129998
|
+
const picker = new ChoicePickerComponent({
|
|
129999
|
+
title: t("init.select_title"),
|
|
130000
|
+
hint: t("init.select_hint", {
|
|
130001
|
+
currentDir: workDir,
|
|
130002
|
+
projectRoot
|
|
130003
|
+
}),
|
|
130004
|
+
options,
|
|
130005
|
+
colors: host.state.theme.colors,
|
|
130006
|
+
onSelect: (value) => {
|
|
130007
|
+
host.restoreEditor();
|
|
130008
|
+
resolve(value);
|
|
130009
|
+
},
|
|
130010
|
+
onCancel: () => {
|
|
130011
|
+
host.restoreEditor();
|
|
130012
|
+
resolve(void 0);
|
|
130013
|
+
}
|
|
130014
|
+
});
|
|
130015
|
+
host.mountEditorReplacement(picker);
|
|
130016
|
+
return promise;
|
|
130017
|
+
}
|
|
129932
130018
|
//#endregion
|
|
129933
130019
|
//#region src/tui/components/messages/goal-panel.ts
|
|
129934
130020
|
const WRAP_WIDTH = 72;
|
package/dist/main.mjs
CHANGED
|
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
|
|
|
6
6
|
import "./suppress-sqlite-warning-C2VB0doZ.mjs";
|
|
7
7
|
//#region src/main.ts
|
|
8
8
|
try {
|
|
9
|
-
(await import("./app-
|
|
9
|
+
(await import("./app-Ir0w8ElF.mjs")).main();
|
|
10
10
|
} catch (error) {
|
|
11
11
|
process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
|
|
12
12
|
process.exit(1);
|