pi-better-harness 0.2.1 → 0.3.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-goal",
3
- "version": "0.1.22",
3
+ "version": "0.2.0",
4
4
  "description": "Pi extension for goal tracking with background-aware continuation.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,4 +1,5 @@
1
1
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import type { AutocompleteItem } from "@earendil-works/pi-tui";
2
3
  import { Type } from "typebox";
3
4
 
4
5
  import {
@@ -59,6 +60,19 @@ const MAX_NO_PROGRESS_RETRIES = parseRetryLimit(
59
60
  DEFAULT_MAX_NO_PROGRESS_RETRIES,
60
61
  );
61
62
 
63
+ const GOAL_ACTIONS: readonly AutocompleteItem[] = [
64
+ { value: "pause", label: "pause", description: "Pause the active goal" },
65
+ { value: "resume", label: "resume", description: "Resume the paused goal" },
66
+ { value: "clear", label: "clear", description: "Remove the current goal" },
67
+ { value: "complete", label: "complete", description: "Mark the current goal complete" },
68
+ ];
69
+
70
+ export function goalArgumentCompletions(argumentPrefix: string): AutocompleteItem[] | null {
71
+ const prefix = argumentPrefix.trimStart().toLowerCase();
72
+ const matches = GOAL_ACTIONS.filter((action) => action.value.startsWith(prefix));
73
+ return matches.length > 0 ? [...matches] : null;
74
+ }
75
+
62
76
  function parseDurationEnv(raw: string | undefined, fallback: number): number {
63
77
  if (raw === undefined || raw.trim() === "") {
64
78
  return fallback;
@@ -486,6 +500,7 @@ export default function (pi: ExtensionAPI): void {
486
500
 
487
501
  pi.registerCommand("goal", {
488
502
  description: "Create, inspect, pause, resume, clear, or complete the active goal",
503
+ getArgumentCompletions: goalArgumentCompletions,
489
504
  handler: async (args, ctx) => {
490
505
  currentCtx = ctx;
491
506
  const trimmed = args.trim();
@@ -12,6 +12,7 @@
12
12
  */
13
13
 
14
14
  import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
15
+ import type { AutocompleteItem } from "@earendil-works/pi-tui";
15
16
 
16
17
  import {
17
18
  DenyRuleError,
@@ -256,8 +257,22 @@ function announce(ctx: ExtensionCommandContext, change: () => DenyRuleReport): v
256
257
  const SUBCOMMANDS = ["on", "off", "default", "deny", "rules"] as const;
257
258
  const DENY_ACTIONS = ["list", "add", "remove", "reset"] as const;
258
259
 
260
+ const COMPLETION_DESCRIPTIONS: Readonly<Record<string, string>> = {
261
+ on: "Enable confinement for this session",
262
+ off: "Disable confinement for this session",
263
+ default: "Change the persistent activation default",
264
+ "default on": "Enable confinement by default",
265
+ "default off": "Disable confinement by default",
266
+ deny: "Manage write-denied paths",
267
+ "deny list": "Show configured write-denied paths",
268
+ "deny add": "Add a write-denied path",
269
+ "deny remove": "Remove a write-denied path",
270
+ "deny reset": "Restore packaged write-deny defaults",
271
+ rules: "Open the write-deny rule manager",
272
+ };
273
+
259
274
  /** Argument completions for `/sandbox`, including the `deny` actions. */
260
- export function sandboxArgumentCompletions(argumentPrefix: string) {
275
+ export function sandboxArgumentCompletions(argumentPrefix: string): AutocompleteItem[] {
261
276
  const prefix = argumentPrefix.trimStart().toLowerCase();
262
277
  const denyPrefix = /^deny(\s|$)/.test(prefix) ? prefix.replace(/^deny\s*/, "") : undefined;
263
278
  const defaultPrefix = /^default(\s|$)/.test(prefix)
@@ -275,5 +290,12 @@ export function sandboxArgumentCompletions(argumentPrefix: string) {
275
290
  .map((value) => `default ${value}`)
276
291
  : SUBCOMMANDS.filter((value) => value.startsWith(prefix));
277
292
 
278
- return values.map((value) => ({ value, label: value }));
293
+ return values.map((value) => {
294
+ const description = COMPLETION_DESCRIPTIONS[value];
295
+ return {
296
+ value,
297
+ label: value,
298
+ ...(description === undefined ? {} : { description }),
299
+ };
300
+ });
279
301
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-sandbox",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Pi extension that confines foreground shell execution to the project directory with a kernel-enforced write sandbox.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-harness",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Pi extension bundle for an opt-in foreground write sandbox, subagents, durable background tasks, and goal tracking.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "pi-better-background-tasks": "0.2.8",
49
- "pi-better-goal": "0.1.22",
50
- "pi-better-sandbox": "0.2.0",
49
+ "pi-better-goal": "0.2.0",
50
+ "pi-better-sandbox": "0.3.0",
51
51
  "pi-better-subagents": "0.1.23"
52
52
  },
53
53
  "bundledDependencies": [