my-pi 0.1.2 → 0.1.4
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/README.md +7 -0
- package/dist/{api-BVS4nqfD.js → api-BtlxiHyw.js} +20 -38
- package/dist/api-BtlxiHyw.js.map +1 -0
- package/dist/api.js +2 -2
- package/dist/index.js +65 -22
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/extensions/mcp.ts +5 -0
- package/src/extensions/working-indicator-config.test.ts +2 -2
- package/src/extensions/working-indicator-config.ts +3 -14
- package/src/extensions/working-indicator.test.ts +1 -6
- package/src/extensions/working-indicator.ts +5 -51
- package/dist/api-BVS4nqfD.js.map +0 -1
package/README.md
CHANGED
|
@@ -81,6 +81,12 @@ echo "plan a login page" | pnpx my-pi@latest --json
|
|
|
81
81
|
Outputs NDJSON events — one JSON object per line — for programmatic
|
|
82
82
|
consumption by other agents or scripts.
|
|
83
83
|
|
|
84
|
+
In non-interactive modes (`"prompt"`, `-P`, `--json`), my-pi keeps
|
|
85
|
+
headless-capable built-ins like MCP, LSP, chains, prompt presets,
|
|
86
|
+
recall, hooks, and secret filtering enabled, while skipping UI-only
|
|
87
|
+
built-ins like handoff, confirm-destructive, session auto-naming, and
|
|
88
|
+
working-indicator customization.
|
|
89
|
+
|
|
84
90
|
### Local telemetry (SQLite)
|
|
85
91
|
|
|
86
92
|
Telemetry is **disabled by default**. When enabled, my-pi records
|
|
@@ -238,6 +244,7 @@ import { create_my_pi, runPrintMode } from 'my-pi';
|
|
|
238
244
|
const runtime = await create_my_pi({
|
|
239
245
|
agent_dir: './tmp/pi-agent',
|
|
240
246
|
extensions: ['./my-ext.ts'],
|
|
247
|
+
runtime_mode: 'json',
|
|
241
248
|
telemetry: true,
|
|
242
249
|
telemetry_db_path: './tmp/evals.db',
|
|
243
250
|
});
|
|
@@ -2555,6 +2555,7 @@ function count_pending_enabled_servers(servers) {
|
|
|
2555
2555
|
return Array.from(servers.values()).filter((state) => state.enabled && state.status !== "connected").length;
|
|
2556
2556
|
}
|
|
2557
2557
|
function update_mcp_status(ctx, servers) {
|
|
2558
|
+
if (!ctx.hasUI) return;
|
|
2558
2559
|
if (servers.size === 0) {
|
|
2559
2560
|
ctx.ui.setStatus("mcp", void 0);
|
|
2560
2561
|
return;
|
|
@@ -2570,6 +2571,7 @@ function update_mcp_status(ctx, servers) {
|
|
|
2570
2571
|
ctx.ui.setStatus("mcp", ctx.ui.theme.fg("dim", fragments.join(" · ")));
|
|
2571
2572
|
}
|
|
2572
2573
|
function set_connect_feedback(ctx, pending_server_count) {
|
|
2574
|
+
if (!ctx.hasUI) return () => {};
|
|
2573
2575
|
const label = pending_server_count === 1 ? "Connecting 1 MCP server..." : `Connecting ${pending_server_count} MCP servers...`;
|
|
2574
2576
|
ctx.ui.setWorkingMessage(label);
|
|
2575
2577
|
ctx.ui.setWorkingIndicator({
|
|
@@ -5114,7 +5116,7 @@ create_telemetry_extension();
|
|
|
5114
5116
|
//#region src/extensions/working-indicator-config.ts
|
|
5115
5117
|
const DEFAULT_CONFIG = {
|
|
5116
5118
|
version: 1,
|
|
5117
|
-
mode: "
|
|
5119
|
+
mode: "default"
|
|
5118
5120
|
};
|
|
5119
5121
|
function get_working_indicator_config_path() {
|
|
5120
5122
|
return join(getAgentDir(), "working-indicator.json");
|
|
@@ -5144,46 +5146,19 @@ function save_working_indicator_config(config) {
|
|
|
5144
5146
|
renameSync(tmp, path);
|
|
5145
5147
|
}
|
|
5146
5148
|
function is_working_indicator_mode(value) {
|
|
5147
|
-
return value === "default" || value === "dot" || value === "none"
|
|
5149
|
+
return value === "default" || value === "dot" || value === "none";
|
|
5148
5150
|
}
|
|
5149
5151
|
//#endregion
|
|
5150
5152
|
//#region src/extensions/working-indicator.ts
|
|
5151
5153
|
const COMMAND_MODES = [
|
|
5152
5154
|
"dot",
|
|
5153
5155
|
"none",
|
|
5154
|
-
"pulse",
|
|
5155
|
-
"spinner",
|
|
5156
5156
|
"reset"
|
|
5157
5157
|
];
|
|
5158
|
-
const SPINNER_FRAMES = [
|
|
5159
|
-
"⠋",
|
|
5160
|
-
"⠙",
|
|
5161
|
-
"⠹",
|
|
5162
|
-
"⠸",
|
|
5163
|
-
"⠼",
|
|
5164
|
-
"⠴",
|
|
5165
|
-
"⠦",
|
|
5166
|
-
"⠧",
|
|
5167
|
-
"⠇",
|
|
5168
|
-
"⠏"
|
|
5169
|
-
];
|
|
5170
5158
|
function get_working_indicator(ctx, mode) {
|
|
5171
5159
|
switch (mode) {
|
|
5172
5160
|
case "dot": return { frames: [ctx.ui.theme.fg("accent", "●")] };
|
|
5173
5161
|
case "none": return { frames: [] };
|
|
5174
|
-
case "pulse": return {
|
|
5175
|
-
frames: [
|
|
5176
|
-
ctx.ui.theme.fg("dim", "·"),
|
|
5177
|
-
ctx.ui.theme.fg("muted", "•"),
|
|
5178
|
-
ctx.ui.theme.fg("accent", "●"),
|
|
5179
|
-
ctx.ui.theme.fg("muted", "•")
|
|
5180
|
-
],
|
|
5181
|
-
intervalMs: 120
|
|
5182
|
-
};
|
|
5183
|
-
case "spinner": return {
|
|
5184
|
-
frames: SPINNER_FRAMES.map((frame, index) => ctx.ui.theme.fg(index % 2 === 0 ? "accent" : "muted", frame)),
|
|
5185
|
-
intervalMs: 80
|
|
5186
|
-
};
|
|
5187
5162
|
case "default": return;
|
|
5188
5163
|
}
|
|
5189
5164
|
}
|
|
@@ -5191,8 +5166,6 @@ function describe_working_indicator_mode(mode) {
|
|
|
5191
5166
|
switch (mode) {
|
|
5192
5167
|
case "dot": return "static dot";
|
|
5193
5168
|
case "none": return "hidden";
|
|
5194
|
-
case "pulse": return "pulse";
|
|
5195
|
-
case "spinner": return "custom spinner";
|
|
5196
5169
|
case "default": return "pi default spinner";
|
|
5197
5170
|
}
|
|
5198
5171
|
}
|
|
@@ -5200,10 +5173,11 @@ function parse_working_indicator_mode(input) {
|
|
|
5200
5173
|
const normalized = input.trim().toLowerCase();
|
|
5201
5174
|
if (!normalized) return null;
|
|
5202
5175
|
if (normalized === "reset" || normalized === "default") return "default";
|
|
5203
|
-
if (normalized === "dot" || normalized === "none"
|
|
5176
|
+
if (normalized === "dot" || normalized === "none") return normalized;
|
|
5204
5177
|
return null;
|
|
5205
5178
|
}
|
|
5206
5179
|
function apply_working_indicator(ctx, mode) {
|
|
5180
|
+
if (!ctx.hasUI) return;
|
|
5207
5181
|
ctx.ui.setWorkingIndicator(get_working_indicator(ctx, mode));
|
|
5208
5182
|
}
|
|
5209
5183
|
async function working_indicator(pi) {
|
|
@@ -5213,7 +5187,7 @@ async function working_indicator(pi) {
|
|
|
5213
5187
|
apply_working_indicator(ctx, mode);
|
|
5214
5188
|
});
|
|
5215
5189
|
pi.registerCommand("working-indicator", {
|
|
5216
|
-
description: "Set the streaming working indicator: dot,
|
|
5190
|
+
description: "Set the streaming working indicator: dot, none, or reset",
|
|
5217
5191
|
getArgumentCompletions: (prefix) => {
|
|
5218
5192
|
const value = prefix.trim().toLowerCase();
|
|
5219
5193
|
return COMMAND_MODES.filter((entry) => entry.startsWith(value)).map((entry) => ({
|
|
@@ -5228,7 +5202,7 @@ async function working_indicator(pi) {
|
|
|
5228
5202
|
ctx.ui.notify(`Working indicator: ${describe_working_indicator_mode(mode)}`, "info");
|
|
5229
5203
|
return;
|
|
5230
5204
|
}
|
|
5231
|
-
ctx.ui.notify("Usage: /working-indicator [dot|
|
|
5205
|
+
ctx.ui.notify("Usage: /working-indicator [dot|none|reset]", "error");
|
|
5232
5206
|
return;
|
|
5233
5207
|
}
|
|
5234
5208
|
mode = next;
|
|
@@ -5262,6 +5236,12 @@ const PI_AGENT_DIR_ENV = "PI_CODING_AGENT_DIR";
|
|
|
5262
5236
|
function resolve_agent_dir(cwd, agent_dir) {
|
|
5263
5237
|
return agent_dir ? resolve(cwd, agent_dir) : getAgentDir();
|
|
5264
5238
|
}
|
|
5239
|
+
const NON_INTERACTIVE_UI_ONLY_BUILTINS = [
|
|
5240
|
+
"handoff",
|
|
5241
|
+
"session-name",
|
|
5242
|
+
"confirm-destructive",
|
|
5243
|
+
"working-indicator"
|
|
5244
|
+
];
|
|
5265
5245
|
function get_force_disabled_builtins(options) {
|
|
5266
5246
|
const force_disabled = /* @__PURE__ */ new Set();
|
|
5267
5247
|
if (!options.mcp) force_disabled.add("mcp");
|
|
@@ -5276,6 +5256,7 @@ function get_force_disabled_builtins(options) {
|
|
|
5276
5256
|
if (!options.confirm_destructive) force_disabled.add("confirm-destructive");
|
|
5277
5257
|
if (!options.hooks_resolution) force_disabled.add("hooks-resolution");
|
|
5278
5258
|
if (!options.working_indicator) force_disabled.add("working-indicator");
|
|
5259
|
+
if (options.runtime_mode && options.runtime_mode !== "interactive") for (const key of NON_INTERACTIVE_UI_ONLY_BUILTINS) force_disabled.add(key);
|
|
5279
5260
|
return force_disabled;
|
|
5280
5261
|
}
|
|
5281
5262
|
function create_builtin_extension_factory(key, extension, force_disabled) {
|
|
@@ -5297,11 +5278,12 @@ function create_extensions_override(managed_inline_paths) {
|
|
|
5297
5278
|
};
|
|
5298
5279
|
}
|
|
5299
5280
|
async function create_my_pi(options = {}) {
|
|
5300
|
-
const { cwd = process.cwd(), agent_dir, extensions = [], extensionFactories: user_factories = [], mcp = true, skills = true, chain = true, filter_output = true, handoff = true, recall = true, prompt_presets = true, lsp = true, session_name = true, confirm_destructive = true, hooks_resolution = true, working_indicator = true, telemetry, telemetry_db_path, model, system_prompt, append_system_prompt } = options;
|
|
5281
|
+
const { cwd = process.cwd(), agent_dir, extensions = [], extensionFactories: user_factories = [], runtime_mode = "interactive", mcp = true, skills = true, chain = true, filter_output = true, handoff = true, recall = true, prompt_presets = true, lsp = true, session_name = true, confirm_destructive = true, hooks_resolution = true, working_indicator = true, telemetry, telemetry_db_path, model, system_prompt, append_system_prompt } = options;
|
|
5301
5282
|
const effective_agent_dir = resolve_agent_dir(cwd, agent_dir);
|
|
5302
5283
|
if (agent_dir) process.env[PI_AGENT_DIR_ENV] = effective_agent_dir;
|
|
5303
5284
|
const resolved_extensions = extensions.map((p) => resolve(cwd, p));
|
|
5304
5285
|
const force_disabled = get_force_disabled_builtins({
|
|
5286
|
+
runtime_mode,
|
|
5305
5287
|
mcp,
|
|
5306
5288
|
skills,
|
|
5307
5289
|
chain,
|
|
@@ -5339,7 +5321,7 @@ async function create_my_pi(options = {}) {
|
|
|
5339
5321
|
...system_prompt !== void 0 ? { systemPromptOverride: () => system_prompt } : {},
|
|
5340
5322
|
...append_system_prompt !== void 0 ? { appendSystemPromptOverride: (base) => [...base, append_system_prompt] } : {},
|
|
5341
5323
|
additionalExtensionPaths: [...resolved_extensions],
|
|
5342
|
-
additionalThemePaths: [PACKAGE_THEME_DIR],
|
|
5324
|
+
...runtime_mode === "interactive" ? { additionalThemePaths: [PACKAGE_THEME_DIR] } : {},
|
|
5343
5325
|
extensionFactories: [...managed_extension_factories, ...user_factories],
|
|
5344
5326
|
extensionsOverride: create_extensions_override(managed_inline_paths),
|
|
5345
5327
|
skillsOverride: (base) => {
|
|
@@ -5369,6 +5351,6 @@ async function create_my_pi(options = {}) {
|
|
|
5369
5351
|
});
|
|
5370
5352
|
}
|
|
5371
5353
|
//#endregion
|
|
5372
|
-
export { create_my_pi as n,
|
|
5354
|
+
export { runPrintMode$1 as i, create_my_pi as n, get_force_disabled_builtins as r, InteractiveMode$1 as t };
|
|
5373
5355
|
|
|
5374
|
-
//# sourceMappingURL=api-
|
|
5356
|
+
//# sourceMappingURL=api-BtlxiHyw.js.map
|