pi-advisor-flow 0.5.6 → 0.6.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/index.js +1371 -1128
  3. package/extensions/index.ts +9 -9
  4. package/package.json +3 -1
  5. package/src/{untracked.ts → attachments.ts} +2 -5
  6. package/src/commands/activation-preparation.ts +6 -6
  7. package/src/commands/activation.ts +7 -7
  8. package/src/commands/lifecycle.ts +5 -5
  9. package/src/commands/manual-command.ts +13 -9
  10. package/src/commands/manual-consultation.ts +8 -8
  11. package/src/commands/manual-progress.ts +3 -3
  12. package/src/commands/model-commands.ts +6 -6
  13. package/src/commands/model-options.ts +4 -4
  14. package/src/commands/model-picker.ts +2 -2
  15. package/src/commands/registration.ts +8 -8
  16. package/src/commands/renderers.ts +5 -5
  17. package/src/commands/runtime.ts +8 -8
  18. package/src/commands/settings-commands.ts +8 -8
  19. package/src/commands/settings-persistence.ts +4 -4
  20. package/src/commands/types.ts +5 -13
  21. package/src/commands.ts +2 -2
  22. package/src/config/args.ts +3 -3
  23. package/src/config/defaults.ts +3 -3
  24. package/src/config/schema.ts +322 -0
  25. package/src/config/state.ts +2 -2
  26. package/src/config/storage.ts +20 -117
  27. package/src/config/types.ts +1 -1
  28. package/src/config/validation.ts +61 -181
  29. package/src/config.ts +7 -7
  30. package/src/content-utils.ts +30 -0
  31. package/src/conversation.ts +13 -168
  32. package/src/git.ts +4 -18
  33. package/src/herdr.ts +6 -8
  34. package/src/model-stream.ts +5 -8
  35. package/src/outcomes.ts +2 -5
  36. package/src/pi-settings.ts +59 -0
  37. package/src/preferences.ts +2 -2
  38. package/src/redaction.ts +50 -0
  39. package/src/scout-context.ts +121 -485
  40. package/src/scout-curation.ts +84 -0
  41. package/src/scout-groups.ts +485 -0
  42. package/src/scout-protocol.ts +122 -0
  43. package/src/scout-reconstruct.ts +44 -0
  44. package/src/scout-types.ts +66 -0
  45. package/src/scout.ts +53 -63
  46. package/src/session-state.ts +119 -76
  47. package/src/tool-result-cap.ts +88 -0
  48. package/src/tools/consult-context.ts +155 -0
  49. package/src/tools/consultation.ts +71 -220
  50. package/src/tools/gate-policy.ts +5 -5
  51. package/src/tools/gate-protocol.ts +2 -2
  52. package/src/tools/loop-gate.ts +70 -61
  53. package/src/tools/prompts.ts +4 -7
  54. package/src/tools/register-ask-advisor.ts +9 -14
  55. package/src/tools/register-lifecycle.ts +7 -7
  56. package/src/tools/register-outcome.ts +5 -5
  57. package/src/tools/register-renderers.ts +5 -5
  58. package/src/tools/registration.ts +10 -10
  59. package/src/tools/render-advisor-result.ts +11 -8
  60. package/src/tools/render-common.ts +25 -13
  61. package/src/tools/scout-status.ts +5 -5
  62. package/src/tools/session.ts +1 -1
  63. package/src/tools/types.ts +7 -7
  64. package/src/tools.ts +9 -9
  65. package/src/ui/manual-dialog-render.ts +2 -2
  66. package/src/ui/manual-dialog.ts +4 -9
  67. package/src/ui/model-selector.ts +1 -1
  68. package/src/ui/settings-formatting.ts +2 -2
  69. package/src/ui/settings-items.ts +4 -4
  70. package/src/ui/settings-mutations.ts +2 -2
  71. package/src/ui/settings-selector.ts +5 -5
  72. package/src/ui/text-setting-submenu.ts +1 -1
  73. package/src/ui/types.ts +2 -2
  74. package/src/ui.ts +4 -4
  75. package/src/usage.ts +1 -6
@@ -8,15 +8,15 @@ import {
8
8
  import {
9
9
  rainbowGradient,
10
10
  SIMPLE_MODE_GRADIENT_INTERVAL_MS,
11
- } from "./settings-formatting.js";
12
- import { createSettingsItems } from "./settings-items.js";
13
- import { SettingsListAdapter } from "./settings-list-adapter.js";
14
- import { mutateAdvisorSettings } from "./settings-mutations.js";
11
+ } from "./settings-formatting.ts";
12
+ import { createSettingsItems } from "./settings-items.ts";
13
+ import { SettingsListAdapter } from "./settings-list-adapter.ts";
14
+ import { mutateAdvisorSettings } from "./settings-mutations.ts";
15
15
  import type {
16
16
  AdvisorSettings,
17
17
  AdvisorSettingsSelectorOptions,
18
18
  ContextPreset,
19
- } from "./types.js";
19
+ } from "./types.ts";
20
20
 
21
21
  export class AdvisorSettingsSelector implements Component, Focusable {
22
22
  private readonly options: AdvisorSettingsSelectorOptions;
@@ -4,7 +4,7 @@ import {
4
4
  Input,
5
5
  truncateToWidth,
6
6
  } from "@earendil-works/pi-tui";
7
- import type { TextSettingSubmenuOptions } from "./types.js";
7
+ import type { TextSettingSubmenuOptions } from "./types.ts";
8
8
 
9
9
  /** Small inline editor used by SettingsList for the two free-form settings. */
10
10
  export class TextSettingSubmenu implements Component, Focusable {
package/src/ui/types.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import type { KeybindingsManager, TUI } from "@earendil-works/pi-tui";
3
- import type { GateFailureMode } from "../config/types.js";
4
- import type { GitContextLevel } from "../git.js";
3
+ import type { GateFailureMode } from "../config/types.ts";
4
+ import type { GitContextLevel } from "../git.ts";
5
5
 
6
6
  export interface RenderRequester {
7
7
  requestRender: () => void;
package/src/ui.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // biome-ignore lint/performance/noBarrelFile: this facade intentionally preserves the public UI module contract.
2
- export { ManualAdvisorDialog } from "./ui/manual-dialog.js";
3
- export { SearchableModelSelector } from "./ui/model-selector.js";
4
- export { AdvisorSettingsSelector } from "./ui/settings-selector.js";
2
+ export { ManualAdvisorDialog } from "./ui/manual-dialog.ts";
3
+ export { SearchableModelSelector } from "./ui/model-selector.ts";
4
+ export { AdvisorSettingsSelector } from "./ui/settings-selector.ts";
5
5
  export type {
6
6
  AdvisorSettings,
7
7
  ContextPreset,
8
8
  ManualAdvisorRequest,
9
- } from "./ui/types.js";
9
+ } from "./ui/types.ts";
package/src/usage.ts CHANGED
@@ -10,7 +10,6 @@ export interface AdvisorUsageSnapshot {
10
10
  totalTokens?: number;
11
11
  }
12
12
 
13
- /** Session-local totals for direct Advisor model requests. */
14
13
  export interface AdvisorUsageTotals {
15
14
  cacheRead?: number;
16
15
  cacheWrite?: number;
@@ -31,8 +30,7 @@ const finite = (value: unknown) =>
31
30
  const add = (left: number | undefined, right: number | undefined) =>
32
31
  left === undefined || right === undefined ? (left ?? right) : left + right;
33
32
 
34
- const isRecord = (value: unknown): value is Record<string, unknown> =>
35
- Boolean(value) && typeof value === "object" && !Array.isArray(value);
33
+ import { isRecord } from "./content-utils.ts";
36
34
 
37
35
  const costFields = ["input", "output", "cacheRead", "cacheWrite", "total"];
38
36
 
@@ -165,13 +163,11 @@ const formatUsageFields = (usage: AdvisorUsageSnapshot): string | undefined => {
165
163
  return tokens.join(" · ") || undefined;
166
164
  };
167
165
 
168
- /** Formats one response for an Advisor or Scout result renderer. */
169
166
  export const formatAdvisorUsage = (usage: unknown): string | undefined => {
170
167
  const snapshot = snapshotAdvisorUsage(usage);
171
168
  return snapshot ? formatUsageFields(snapshot) : undefined;
172
169
  };
173
170
 
174
- /** Formats cumulative direct Advisor usage for a footer or session summary. */
175
171
  export const formatAdvisorUsageTotals = (
176
172
  totals: AdvisorUsageTotals
177
173
  ): string => {
@@ -187,7 +183,6 @@ export const formatAdvisorUsageTotals = (
187
183
  );
188
184
  };
189
185
 
190
- /** Formats the current direct Advisor usage status for the Pi footer. */
191
186
  export const formatAdvisorUsageStatus = (
192
187
  totals: AdvisorUsageTotals
193
188
  ): string | undefined => {