pi-cowboy 0.3.1 → 0.3.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.
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import fs from "node:fs";
10
10
  import path from "node:path";
11
+ import { SettingsManager, } from "@earendil-works/pi-coding-agent";
11
12
  import { errorMessage } from "../utils.js";
12
13
  import { agentDir } from "../paths.js";
13
14
  import { getStore, subagentResultDirFor, subagentResultFileFor, subagentSystemFileFor, subagentTaskFileFor, subagentTokenFor, } from "../shell.js";
@@ -146,8 +147,6 @@ export async function buildLaunchPlan(pi, ctx, type, prompt, options) {
146
147
  }
147
148
  else {
148
149
  try {
149
- // Deferred: keeps pi's barrel off the boot-time import graph.
150
- const { SettingsManager } = await import("@earendil-works/pi-coding-agent");
151
150
  const settingsManager = SettingsManager.create(effectiveCwd, agentDir(), { projectTrusted: options.projectTrusted !== false });
152
151
  extMode = {
153
152
  kind: "paths",
@@ -1,7 +1,7 @@
1
+ /** pi-settings.ts — pi's `defaultThinkingLevel` setting. `agentDir` is injectable for tests. */
2
+ import { SettingsManager } from "@earendil-works/pi-coding-agent";
1
3
  import { agentDir as resolveAgentDir } from "./paths.js";
2
4
  /** pi's `defaultThinkingLevel` for `cwd` (project over global). `agentDir` is injectable for tests. */
3
5
  export async function getPiDefaultThinkingLevel(cwd, agentDir) {
4
- // Deferred value import: keeps the barrel off the boot-time import graph.
5
- const { SettingsManager } = await import("@earendil-works/pi-coding-agent");
6
6
  return SettingsManager.create(cwd, agentDir ?? resolveAgentDir()).getDefaultThinkingLevel();
7
7
  }
@@ -1,4 +1,5 @@
1
1
  /** prompts.ts — System prompt builder for agents. Every agent gets a fresh context — no inherited parent identity. */
2
+ import { formatSkillsForPrompt, } from "@earendil-works/pi-coding-agent";
2
3
  /** Strip pi scaffolding (<project_context>, skills block, date/cwd lines) from a parent prompt. Inherit mode re-adds these from the subagent's own config. */
3
4
  function stripScaffolding(prompt) {
4
5
  let result = prompt;
@@ -40,8 +41,6 @@ export async function buildAgentPrompt(config, cwd, env, extras, mode = "replace
40
41
  sourceInfo: {},
41
42
  disableModelInvocation: m.disableModelInvocation,
42
43
  }));
43
- // Deferred import keeps pi's barrel off the boot-time import graph.
44
- const { formatSkillsForPrompt } = await import("@earendil-works/pi-coding-agent");
45
44
  const formatted = formatSkillsForPrompt(piSkills);
46
45
  const skillElements = formatted.match(/<skill>[\s\S]*?<\/skill>/g);
47
46
  if (skillElements)
@@ -14,11 +14,10 @@
14
14
  import { existsSync, readFileSync, realpathSync } from "node:fs";
15
15
  import { homedir } from "node:os";
16
16
  import { join, resolve } from "node:path";
17
+ import { loadSkills, loadSkillsFromDir, } from "@earendil-works/pi-coding-agent";
17
18
  import { isUnsafeName } from "../utils.js";
18
- async function loadAllSkills(cwd) {
19
+ function loadAllSkills(cwd) {
19
20
  const resolvedCwd = resolve(cwd);
20
- // Deferred import keeps pi's barrel off the boot-time graph.
21
- const { loadSkills, loadSkillsFromDir } = await import("@earendil-works/pi-coding-agent");
22
21
  const ancestorsSkills = loadAncestorAgentsSkills(resolvedCwd, loadSkillsFromDir);
23
22
  const homeAgentsResult = loadSkillsFromDir({
24
23
  dir: join(homedir(), ".agents", "skills"),
@@ -98,7 +97,7 @@ function canonicalizePath(filePath) {
98
97
  }
99
98
  }
100
99
  export async function inlineSkills(skillNames, cwd) {
101
- const skills = await loadAllSkills(cwd);
100
+ const skills = loadAllSkills(cwd);
102
101
  return skillNames.map((name) => {
103
102
  if (isUnsafeName(name)) {
104
103
  return {
@@ -133,7 +132,7 @@ export async function inlineSkills(skillNames, cwd) {
133
132
  }
134
133
  /** Skill metadata only (no content), for the whitelist — the agent reads full content on demand. */
135
134
  export async function loadSkillMeta(skillNames, cwd) {
136
- const skills = await loadAllSkills(cwd);
135
+ const skills = loadAllSkills(cwd);
137
136
  return skillNames.map((name) => {
138
137
  const match = skills.find((s) => s.name === name);
139
138
  if (!match) {
@@ -8,6 +8,7 @@
8
8
  * shell state and unit-tests with fakes.
9
9
  */
10
10
  import fs from "node:fs";
11
+ import { loadProjectContextFiles, } from "@earendil-works/pi-coding-agent";
11
12
  import { errorMessage, GIT_EXEC_TIMEOUT_MS } from "../utils.js";
12
13
  import { agentDir } from "../paths.js";
13
14
  import { customPromptPath } from "../config/config-io.js";
@@ -74,8 +75,6 @@ async function resolveSystemPromptSources(ctx, cwd, notify, agentConfig, mode, g
74
75
  }
75
76
  if (includeContextFiles) {
76
77
  try {
77
- // Deferred import keeps pi's barrel off the boot-time import graph.
78
- const { loadProjectContextFiles } = await import("@earendil-works/pi-coding-agent");
79
78
  extras.contextFiles = loadProjectContextFiles({
80
79
  cwd,
81
80
  agentDir: agentDir(),
@@ -9,6 +9,7 @@
9
9
  * The ModelRuntime hides behind ctx.modelRegistry's private `runtime` field; when unreachable,
10
10
  * the picker falls back to SearchableSelectDialog.
11
11
  */
12
+ import { ModelSelectorComponent, } from "@earendil-works/pi-coding-agent";
12
13
  import { fuzzyFilter } from "@earendil-works/pi-tui";
13
14
  import { getSessionCtx, getStore } from "../../shell.js";
14
15
  import { findModelInRegistry } from "../../utils.js";
@@ -46,8 +47,6 @@ export async function openSubagentModelPicker(ctx, opts) {
46
47
  const store = getStore();
47
48
  const runtime = sessionModelRuntime(ctx);
48
49
  const scoped = ctx.scopedModels;
49
- // Value import deferred so the barrel stays off the module graph.
50
- const { ModelSelectorComponent } = await import("@earendil-works/pi-coding-agent");
51
50
  await new ScreenHost(ctx).open(({ tui, theme, close }) => {
52
51
  const current = currentSubagentModel(ctx);
53
52
  if (!runtime) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cowboy",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@12.9.1",
6
6
  "description": "Agent orchestrator for pi: each subagent runs as its own pi process in a background Herdr pane, isolated by a copy-on-write git worktree.",