@sagentlab/navarch-runtime 0.1.90 → 0.1.91
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/git-worktree.cjs +12 -0
- package/dist/prompt.cjs +10 -2
- package/dist/session.cjs +1 -0
- package/package.json +1 -1
package/dist/git-worktree.cjs
CHANGED
|
@@ -40,6 +40,7 @@ class GitWorktree {
|
|
|
40
40
|
checkpointRoot;
|
|
41
41
|
cloneUrl;
|
|
42
42
|
githubToken;
|
|
43
|
+
workingBranch;
|
|
43
44
|
repoLocalGithubToken;
|
|
44
45
|
prContinuation;
|
|
45
46
|
taskBranchSuffix;
|
|
@@ -78,6 +79,7 @@ class GitWorktree {
|
|
|
78
79
|
this.sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
79
80
|
this.cloneUrl = options.cloneUrl;
|
|
80
81
|
this.githubToken = options.githubToken;
|
|
82
|
+
this.workingBranch = options.workingBranch?.trim() || null;
|
|
81
83
|
this.repoLocalGithubToken = options.repoLocalGithubToken;
|
|
82
84
|
this.prContinuation = options.prContinuation ?? false;
|
|
83
85
|
this.hostedCheckpointRef = options.restoreHostedCheckpoint ? hostedCheckpointRef(options.taskId) : null;
|
|
@@ -517,6 +519,16 @@ class GitWorktree {
|
|
|
517
519
|
* when the remote has no branches at all (a freshly provisioned empty repo).
|
|
518
520
|
*/
|
|
519
521
|
async resolveStartRef() {
|
|
522
|
+
// The claim already merged the integration branch into the working branch,
|
|
523
|
+
// so it is the start (and delivery) base. A missing ref falls through to
|
|
524
|
+
// the default branch rather than starting the task on nothing.
|
|
525
|
+
if (this.workingBranch) {
|
|
526
|
+
const ref = `refs/remotes/origin/${this.workingBranch}`;
|
|
527
|
+
const found = await this.runGit(["--git-dir", this.repositoryPath, "rev-parse", "--verify", "--quiet", ref], false)
|
|
528
|
+
.then(() => true, () => false);
|
|
529
|
+
if (found)
|
|
530
|
+
return ref;
|
|
531
|
+
}
|
|
520
532
|
const remoteHead = await this.runGit(["--git-dir", this.repositoryPath, "ls-remote", "--symref", "origin", "HEAD"], true);
|
|
521
533
|
const defaultBranch = parseRemoteHead(remoteHead.stdout);
|
|
522
534
|
if (defaultBranch)
|
package/dist/prompt.cjs
CHANGED
|
@@ -5,6 +5,12 @@ exports.renderGuidanceCorrectionPrompt = renderGuidanceCorrectionPrompt;
|
|
|
5
5
|
exports.renderHostedCheckpointNote = renderHostedCheckpointNote;
|
|
6
6
|
const CODE_GRAPH_GUIDANCE = "For JS/TS dependency inspection, the runtime provides `navarch-runtime code-graph --query <symbol-or-file> --mode search|callers|callees|impact --commit HEAD`. If the runtime is not on PATH, use its installed entry point; do not install another copy mid-task. Results describe committed source and include commit/freshness warnings; inspect current files for uncommitted changes and unresolved dependencies.";
|
|
7
7
|
const PROCESS_GUIDANCE = "Process management: this host may run other agent sessions. Keep the PID or tool handle of each preview server you start and stop only that owned process. Never use broad process-name or command-line matching (pkill, killall) to clean up servers: the agent launcher carries the task prompt in its arguments and can match those patterns, terminating your own session. Use a different port when a port is occupied by a process you do not own. Keep scratch files in the current worktree; paths in previous transcripts belong to earlier sessions.";
|
|
8
|
+
/** Overrides the playbooks' "default branch" PR base when the project sets a working branch. */
|
|
9
|
+
function workingBranchNote(workingBranch) {
|
|
10
|
+
if (!workingBranch)
|
|
11
|
+
return "";
|
|
12
|
+
return `\nWorking branch: \`${workingBranch}\`. Your branch already starts from it. Open the pull request with \`--base ${workingBranch}\` instead of the default branch, and rebase onto \`origin/${workingBranch}\` when you need the latest base.`;
|
|
13
|
+
}
|
|
8
14
|
/**
|
|
9
15
|
* Renders the four-layer context bundle (project-plan.md §3.8: steering docs,
|
|
10
16
|
* task itself, task-type playbook, depends_on reports) into the single prompt
|
|
@@ -15,7 +21,8 @@ const PROCESS_GUIDANCE = "Process management: this host may run other agent sess
|
|
|
15
21
|
function renderPrompt(task, bundle) {
|
|
16
22
|
if (bundle.task_context) {
|
|
17
23
|
const repositoryContext = bundle.repository
|
|
18
|
-
? `Repository: ${bundle.repository.full_name} (${bundle.repository.url})\nLocal checkout: this session's isolated git worktree (current working directory).`
|
|
24
|
+
? `Repository: ${bundle.repository.full_name} (${bundle.repository.url})\nLocal checkout: this session's isolated git worktree (current working directory).` +
|
|
25
|
+
workingBranchNote(bundle.repository.working_branch)
|
|
19
26
|
: null;
|
|
20
27
|
return [repositoryContext, PROCESS_GUIDANCE, bundle.task_context.trim(), CODE_GRAPH_GUIDANCE, bundle.retry_context?.trim()]
|
|
21
28
|
.filter((section) => Boolean(section))
|
|
@@ -26,7 +33,8 @@ function renderPrompt(task, bundle) {
|
|
|
26
33
|
sections.push(`Type: ${task.task_type} | Repo: ${task.repo} | Environment: ${task.environment_scope}`);
|
|
27
34
|
sections.push(PROCESS_GUIDANCE);
|
|
28
35
|
if (bundle.repository) {
|
|
29
|
-
sections.push(`Repository URL: ${bundle.repository.url}\nLocal checkout: this session's isolated git worktree (current working directory).`
|
|
36
|
+
sections.push(`Repository URL: ${bundle.repository.url}\nLocal checkout: this session's isolated git worktree (current working directory).` +
|
|
37
|
+
workingBranchNote(bundle.repository.working_branch));
|
|
30
38
|
}
|
|
31
39
|
if (task.github_issue_url) {
|
|
32
40
|
sections.push(`GitHub issue: ${task.github_issue_url}`);
|
package/dist/session.cjs
CHANGED
|
@@ -208,6 +208,7 @@ async function runClaimedSession(deps, claimed, sessionId, lifecycle) {
|
|
|
208
208
|
sessionId,
|
|
209
209
|
cloneUrl,
|
|
210
210
|
githubToken,
|
|
211
|
+
workingBranch: bundle.repository?.working_branch,
|
|
211
212
|
repoLocalGithubToken: secrets["github-pat"],
|
|
212
213
|
// Hosted runs skip checkpoints for verify tasks, which deliver a verdict.
|
|
213
214
|
restoreHostedCheckpoint: !allowBranchRename && task.task_type !== "verify",
|
package/package.json
CHANGED