@mrclrchtr/supi-review 7.4.0 → 8.0.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 (93) hide show
  1. package/node_modules/@mrclrchtr/supi-agent-runtime/README.md +2 -2
  2. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  3. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
  4. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
  5. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
  6. package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +2 -2
  7. package/node_modules/@mrclrchtr/supi-agent-runtime/src/lifecycle-trace.ts +5 -2
  8. package/node_modules/@mrclrchtr/supi-agent-runtime/src/run.ts +89 -17
  9. package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/agent-run-registry-types.ts +1 -1
  10. package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/agent-run-registry.ts +11 -11
  11. package/node_modules/@mrclrchtr/supi-agent-runtime/src/types.ts +8 -4
  12. package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-overlay-data.ts +25 -3
  13. package/node_modules/@mrclrchtr/supi-agent-runtime/src/ui/agents-overlay.ts +5 -7
  14. package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +6 -6
  15. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  16. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
  17. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
  18. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  19. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
  20. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
  21. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
  22. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +29 -6
  23. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  24. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
  25. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
  26. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  27. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
  28. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
  29. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
  30. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  31. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/api.ts +25 -3
  32. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +2 -1
  33. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +5 -2
  34. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +39 -6
  35. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +82 -12
  36. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +28 -5
  37. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +606 -30
  38. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +9 -0
  39. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +69 -8
  40. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +196 -0
  41. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +15 -0
  42. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/types.ts +9 -1
  43. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -0
  44. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +31 -2
  45. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +72 -2
  46. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +9 -43
  47. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +102 -50
  48. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +49 -3
  49. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +78 -18
  50. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +46 -2
  51. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +14 -0
  52. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +30 -4
  53. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  54. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
  55. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
  56. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  57. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
  58. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
  59. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
  60. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  61. package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
  62. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/capability/capability-warnings.ts +64 -25
  63. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/server-status.ts +23 -1
  64. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/signals.ts +1 -0
  65. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan.ts +42 -8
  66. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/pattern.ts +4 -0
  67. package/node_modules/@mrclrchtr/supi-code-intelligence/src/config.ts +64 -34
  68. package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +29 -10
  69. package/node_modules/@mrclrchtr/supi-code-intelligence/src/headless.ts +1 -0
  70. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-types.ts +2 -1
  71. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-workflow.ts +5 -0
  72. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-types.ts +3 -0
  73. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-workflow.ts +10 -1
  74. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/session.ts +34 -2
  75. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/lifecycle.ts +2 -0
  76. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/recovery.ts +3 -3
  77. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/settings.ts +191 -108
  78. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/workspace-provider-host.ts +50 -12
  79. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/markdown.ts +12 -0
  80. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/render.ts +20 -0
  81. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/result.ts +3 -0
  82. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/markdown.ts +3 -0
  83. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/result.ts +3 -1
  84. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/types.ts +3 -1
  85. package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-command.ts +54 -6
  86. package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-overlay.ts +5 -0
  87. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  88. package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
  89. package/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
  90. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
  91. package/package.json +4 -4
  92. package/src/tool/review_run/spec.ts +2 -0
  93. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +0 -22
@@ -37,13 +37,13 @@ Agent Runs share the containing process's permissions and external sandbox; cont
37
37
 
38
38
  A package can add a bounded same-session continuation for a required structured result. The caller supplies declarative steps through `continuation.resolveNext()`. Each step specifies a prompt, an exact active-tool set, a thinking level, and an optional pre-authorized model. The runtime performs all prompts, model switches, tool changes, usage snapshots, cancellation checks, and final disposal.
39
39
 
40
- Continuation can start only after Pi accepts the initial prompt. It can handle `missing-completion` and an accepted `unexpected-runner-failure`. It does not run after creation, readiness, preflight, cancellation, or timeout failures. `AgentRunSessionView` and `AgentRunHandle` remain control-free. The runtime disposes the owned session one time after the final outcome.
40
+ Pi must report `"started"` for the initial prompt before continuation can start. SuPi fails the Agent Run with `prompt-rejected` if Pi reports `"handled"` or `"queued"`, if the prompt rejects before `"started"`, or if it resolves without a disposition. This code means that the Agent Run did not start. It does not mean that Pi rejected input that it handled or queued. SuPi does not call the completion resolver or start continuation after one of these failures. A continuation step is settled only when Pi reports `"started"`. SuPi does not call the completion resolver for another disposition, a rejection, or a missing disposition. Continuation can handle `missing-completion` and an accepted `unexpected-runner-failure`. `AgentRunSessionView` and `AgentRunHandle` do not expose session controls. The runtime disposes the session once after the final outcome.
41
41
 
42
42
  ## Shared `/agents` viewer
43
43
 
44
44
  Agent and Review call `registerAgentsCommand(pi)` from the public API. The helper finds one shared registry for the containing Pi runtime through `pi.events`. Bundled runtime copies use the same registry and register one `/agents` command for that runtime. The runtime package does not register itself as a Pi extension.
45
45
 
46
- The runtime owns temporary human-only transcripts for registered runs until the containing session ends. This retention is separate from Review audit settings. Agent can supply optional Profile and Profile Diagnostics pages; the runtime does not own Agent Profile policy. Steering is available only while the initial prompt is active. Stop affects only the selected run.
46
+ The runtime owns temporary human-only transcripts for registered runs until the containing session ends. This retention is separate from Review audit settings. Agent can supply optional Profile and Profile Diagnostics pages; the runtime does not own Agent Profile policy. Steering is available only while the initial prompt is active. The handle and registry preserve Pi's `"queued"` or `"handled"` result. The viewer reports each result, and it records only queued input as steering. Stop affects only the selected run.
47
47
 
48
48
  In Conversation or Details, Alt+Left and Alt+Right cycle through the filtered runs in the current Agents or Reviews section. The viewer keeps the current view. Esc returns to the run list.
49
49
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "7.4.0",
3
+ "version": "8.0.0",
4
4
  "description": "Shared settings, configuration, reporting, and session infrastructure",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -70,6 +70,116 @@ export interface SupiConfigOptions {
70
70
  homeDir?: string;
71
71
  }
72
72
 
73
+ /** Options for loading automatic code-intelligence exclusions. */
74
+ export interface AutomaticExclusionOptions extends SupiConfigOptions {
75
+ /** Whether the project config is trusted and can apply. Defaults to true. */
76
+ projectTrusted?: boolean;
77
+ }
78
+
79
+ /**
80
+ * Load the one configured exclusion list shared by automatic LSP work and
81
+ * broad AST searches.
82
+ *
83
+ * Project values replace global values. An explicit empty project list clears
84
+ * the global list. The old `lsp.exclude` key is rejected in every applicable
85
+ * scope so automatic work cannot start without its former protection.
86
+ */
87
+ export function loadAutomaticExclusionPatterns(
88
+ cwd: string,
89
+ options: AutomaticExclusionOptions = {},
90
+ ): readonly string[] {
91
+ const projectTrusted = options.projectTrusted !== false;
92
+ const globalCodeIntelligence = loadSupiConfigSectionForScope("code-intelligence", cwd, {
93
+ scope: "global",
94
+ homeDir: options.homeDir,
95
+ });
96
+ const projectCodeIntelligence = projectTrusted
97
+ ? loadSupiConfigSectionForScope("code-intelligence", cwd, { scope: "project" })
98
+ : null;
99
+ const globalLsp = loadSupiConfigSectionForScope("lsp", cwd, {
100
+ scope: "global",
101
+ homeDir: options.homeDir,
102
+ });
103
+ const projectLsp = projectTrusted
104
+ ? loadSupiConfigSectionForScope("lsp", cwd, { scope: "project" })
105
+ : null;
106
+
107
+ const legacyPath = findLegacyExclusionPath(cwd, options, globalLsp, projectLsp);
108
+ if (legacyPath) {
109
+ throw new Error(
110
+ `Unsupported ${legacyPath.scope} configuration at ${legacyPath.path}: "lsp.exclude" was removed. Move its value to "code-intelligence.exclude". Automatic LSP and broad AST work did not start; reload after migration.`,
111
+ );
112
+ }
113
+
114
+ const source = findExclusionSource(cwd, options, {
115
+ projectTrusted,
116
+ globalCodeIntelligence,
117
+ projectCodeIntelligence,
118
+ });
119
+ return validateExclusionSource(source);
120
+ }
121
+
122
+ interface ExclusionSource {
123
+ value: unknown;
124
+ path: string;
125
+ }
126
+
127
+ interface LegacyExclusionPath {
128
+ scope: "global" | "project";
129
+ path: string;
130
+ }
131
+
132
+ function findLegacyExclusionPath(
133
+ cwd: string,
134
+ options: AutomaticExclusionOptions,
135
+ globalLsp: Record<string, unknown> | null,
136
+ projectLsp: Record<string, unknown> | null,
137
+ ): LegacyExclusionPath | null {
138
+ if (globalLsp && Object.hasOwn(globalLsp, "exclude")) {
139
+ return { scope: "global", path: getSupiConfigPath("global", cwd, options) };
140
+ }
141
+ if (projectLsp && Object.hasOwn(projectLsp, "exclude")) {
142
+ return { scope: "project", path: getSupiConfigPath("project", cwd) };
143
+ }
144
+ return null;
145
+ }
146
+
147
+ function findExclusionSource(
148
+ cwd: string,
149
+ options: AutomaticExclusionOptions,
150
+ sections: {
151
+ projectTrusted: boolean;
152
+ globalCodeIntelligence: Record<string, unknown> | null;
153
+ projectCodeIntelligence: Record<string, unknown> | null;
154
+ },
155
+ ): ExclusionSource | null {
156
+ const { projectTrusted, globalCodeIntelligence, projectCodeIntelligence } = sections;
157
+ if (
158
+ projectTrusted &&
159
+ projectCodeIntelligence &&
160
+ Object.hasOwn(projectCodeIntelligence, "exclude")
161
+ ) {
162
+ return { value: projectCodeIntelligence.exclude, path: getSupiConfigPath("project", cwd) };
163
+ }
164
+ if (globalCodeIntelligence && Object.hasOwn(globalCodeIntelligence, "exclude")) {
165
+ return {
166
+ value: globalCodeIntelligence.exclude,
167
+ path: getSupiConfigPath("global", cwd, options),
168
+ };
169
+ }
170
+ return null;
171
+ }
172
+
173
+ function validateExclusionSource(source: ExclusionSource | null): readonly string[] {
174
+ if (!source) return Object.freeze([]);
175
+ if (!Array.isArray(source.value) || !source.value.every((entry) => typeof entry === "string")) {
176
+ throw new Error(
177
+ `Invalid "code-intelligence.exclude" in ${source.path}: expected an array of gitignore-style strings. Automatic LSP and broad AST work did not start.`,
178
+ );
179
+ }
180
+ return Object.freeze([...source.value]);
181
+ }
182
+
73
183
  /**
74
184
  * Load and merge config for a given extension section.
75
185
  *
@@ -1,7 +1,12 @@
1
1
  // supi-core config domain — config loading.
2
- export type { SupiConfigLocation, SupiConfigOptions } from "./config/config.ts";
2
+ export type {
3
+ AutomaticExclusionOptions,
4
+ SupiConfigLocation,
5
+ SupiConfigOptions,
6
+ } from "./config/config.ts";
3
7
  export {
4
8
  getSupiConfigPath,
9
+ loadAutomaticExclusionPatterns,
5
10
  loadSupiConfig,
6
11
  loadSupiConfigForScope,
7
12
  loadSupiConfigSectionForScope,
@@ -151,6 +151,7 @@ export interface CustomField extends BaseField {
151
151
  cwd: string,
152
152
  action: SettingsAction,
153
153
  helpers: ConfigHelpers,
154
+ ctx?: ExtensionContext,
154
155
  ) => void | Promise<void>;
155
156
  }
156
157
 
@@ -404,7 +405,7 @@ async function applyConfigAction(
404
405
  const helpers = createConfigHelpers(options.section, scope, cwd, options.homeDir);
405
406
  let storedValue: unknown;
406
407
  if (field.kind === "custom") {
407
- await field.persist(scope, cwd, action, helpers);
408
+ await field.persist(scope, cwd, action, helpers, ctx);
408
409
  storedValue = action.kind === "set" ? action.value : undefined;
409
410
  } else if (action.kind === "set") {
410
411
  storedValue = parseTypedValue(action.value, field);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-agent-runtime",
3
- "version": "7.4.0",
3
+ "version": "8.0.0",
4
4
  "description": "SuPi Agent Run runtime — neutral lifecycle management for in-process pi sessions",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "!__tests__"
29
29
  ],
30
30
  "dependencies": {
31
- "@mrclrchtr/supi-core": "7.4.0"
31
+ "@mrclrchtr/supi-core": "8.0.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@earendil-works/pi-ai": "*",
@@ -72,9 +72,11 @@ export class AgentRunLifecycleTraceCollector {
72
72
  recordHostMarker(marker: AgentRunLifecycleTraceEntry): void {
73
73
  switch (marker.type) {
74
74
  case "timeout_expired":
75
- case "prompt_rejected":
76
75
  this.#push({ type: marker.type });
77
76
  break;
77
+ case "prompt_rejected":
78
+ this.#push({ type: marker.type, reason: marker.reason });
79
+ break;
78
80
  case "abort_requested":
79
81
  this.#push({ type: "abort_requested", reason: marker.reason });
80
82
  break;
@@ -135,8 +137,9 @@ function formatEntry(entry: AgentRunLifecycleTraceEntry): string {
135
137
  case "agent_settled":
136
138
  case "summarization_retry_finished":
137
139
  case "timeout_expired":
138
- case "prompt_rejected":
139
140
  return entry.type;
141
+ case "prompt_rejected":
142
+ return `prompt_rejected(reason=${entry.reason})`;
140
143
  case "agent_end":
141
144
  return `agent_end(willRetry=${entry.willRetry})`;
142
145
  case "compaction_start":
@@ -6,6 +6,7 @@ import type {
6
6
  AgentSessionEvent,
7
7
  AgentSessionRuntime,
8
8
  ExtensionRuntime,
9
+ PromptOptions,
9
10
  } from "@earendil-works/pi-coding-agent";
10
11
  import {
11
12
  createAgentSession,
@@ -40,6 +41,28 @@ import { collectAgentRunUsage } from "./usage.ts";
40
41
  export const AGENT_RUN_ABORT_GRACE_MS = 2_000;
41
42
  /** Maximum wait for initial steering to settle before recovery is skipped. */
42
43
  const INITIAL_STEERING_DRAIN_GRACE_MS = 2_000;
44
+ type PromptDisposition = Parameters<NonNullable<PromptOptions["preflightResult"]>>[0];
45
+ type PromptRejectionReason =
46
+ | "handled"
47
+ | "queued"
48
+ | "threw-before-start"
49
+ | "resolved-without-disposition";
50
+ // Pi can defer a prompt after its first call resolves. Reject a late start.
51
+ const shouldRejectLatePromptStart = (state: {
52
+ disposition: PromptDisposition;
53
+ preflightClosed: boolean;
54
+ promptPromiseSettled: boolean;
55
+ promptFailureRecorded: boolean;
56
+ promptClosed: boolean;
57
+ dispositionObserved: boolean;
58
+ promptAccepted: boolean;
59
+ }): boolean =>
60
+ state.disposition === "started" &&
61
+ (state.preflightClosed ||
62
+ state.promptPromiseSettled ||
63
+ state.promptFailureRecorded ||
64
+ state.promptClosed ||
65
+ (state.dispositionObserved && !state.promptAccepted));
43
66
  /** Grace period for AgentSessionRuntime disposal. */
44
67
  export const AGENT_RUN_SHUTDOWN_GRACE_MS = 2_000;
45
68
  /** Maximum turns accepted from one finite continuation policy. */
@@ -557,18 +580,31 @@ export function startAgentRun<T>(options: StartAgentRunOptions<T>): AgentRunHand
557
580
  activeSession.setThinkingLevel(step.thinkingLevel);
558
581
  const previousAssistant = latestAssistant(activeSession);
559
582
  let accepted = false;
583
+ let dispositionSeen = false;
584
+ let promptCallSettled = false;
560
585
  let promptFailed = false;
561
586
  try {
562
587
  await activeSession.prompt(step.prompt, {
563
- preflightResult: (success) => {
564
- accepted = success;
565
- if (success && (aborting || terminal || finalizing)) {
566
- throw new Error("Agent Run continuation canceled before acceptance");
588
+ preflightResult: (disposition) => {
589
+ if (
590
+ disposition === "started" &&
591
+ (promptCallSettled ||
592
+ aborting ||
593
+ terminal ||
594
+ finalizing ||
595
+ (dispositionSeen && !accepted))
596
+ ) {
597
+ throw new Error("Agent Run continuation prompt started after its preflight closed");
567
598
  }
599
+ if (dispositionSeen) return;
600
+ dispositionSeen = true;
601
+ accepted = disposition === "started";
568
602
  },
569
603
  });
570
604
  } catch {
571
605
  promptFailed = true;
606
+ } finally {
607
+ promptCallSettled = true;
572
608
  }
573
609
  try {
574
610
  await awaitSessionQuiescence(activeSession);
@@ -764,32 +800,68 @@ export function startAgentRun<T>(options: StartAgentRunOptions<T>): AgentRunHand
764
800
  timeoutId = setTimeout(requestTimeout, options.timeoutMs);
765
801
  timeoutId.unref?.();
766
802
  }
803
+ const promptIsClosed = (): boolean =>
804
+ cancelRequested || timeoutRequested || aborting || terminal || finalizing;
767
805
  const publishPromptAcceptance = (): void => {
768
806
  publish();
769
- if (cancelRequested || aborting || terminal || finalizing) {
807
+ if (promptIsClosed()) {
770
808
  throw new Error("Agent Run prompt canceled before acceptance");
771
809
  }
772
810
  };
773
- const onPreflight = (accepted: boolean): void => {
811
+ const rejectBeforePromptStarted = (reason: PromptRejectionReason): void => {
812
+ promptFailureCode ??= "prompt-rejected";
813
+ if (promptIsClosed()) return;
814
+ lifecycle.recordHostMarker({ type: "prompt_rejected", reason });
815
+ };
816
+ let promptDispositionObserved = false;
817
+ // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Check the late-start fence before changing preflight state.
818
+ const onPreflight = (disposition: PromptDisposition): void => {
819
+ const preflightClosed = promptPreflightSettled && !promptDispositionObserved;
820
+ if (
821
+ shouldRejectLatePromptStart({
822
+ disposition,
823
+ preflightClosed,
824
+ promptPromiseSettled,
825
+ promptFailureRecorded: promptFailureCode !== undefined,
826
+ promptClosed: promptIsClosed(),
827
+ dispositionObserved: promptDispositionObserved,
828
+ promptAccepted,
829
+ })
830
+ ) {
831
+ settlePromptPreflight();
832
+ throw new Error("Agent Run prompt started after its preflight closed");
833
+ }
834
+ if (promptDispositionObserved || preflightClosed) return;
835
+ promptDispositionObserved = true;
774
836
  settlePromptPreflight();
775
- if (!accepted) {
837
+ if (disposition !== "started") {
776
838
  promptActive = false;
777
- if (cancelRequested || timeoutRequested || aborting || terminal || finalizing) return;
778
- lifecycle.recordHostMarker({ type: "prompt_rejected" });
779
- promptFailureCode = "prompt-rejected";
839
+ if (promptIsClosed()) return;
840
+ rejectBeforePromptStarted(disposition);
780
841
  return;
781
842
  }
782
- if (cancelRequested || timeoutRequested || aborting || terminal || finalizing) {
843
+ if (promptIsClosed()) {
783
844
  throw new Error("Agent Run prompt canceled before acceptance");
784
845
  }
785
846
  promptAccepted = true;
786
847
  promptActive = true;
787
848
  publishPromptAcceptance();
788
849
  };
850
+ const handlePromptRejection = (): void => {
851
+ if (promptFailureCode) return;
852
+ if (promptAccepted) {
853
+ promptFailureCode = "unexpected-runner-failure";
854
+ } else {
855
+ rejectBeforePromptStarted("threw-before-start");
856
+ }
857
+ };
789
858
  try {
790
859
  const promptPromise = session.prompt(options.prompt, { preflightResult: onPreflight });
791
860
  void Promise.resolve(promptPromise).then(
792
861
  () => {
862
+ if (!promptPreflightSettled && !promptAccepted) {
863
+ rejectBeforePromptStarted("resolved-without-disposition");
864
+ }
793
865
  settlePromptPreflight();
794
866
  promptPromiseSettled = true;
795
867
  promptActive = false;
@@ -802,8 +874,8 @@ export function startAgentRun<T>(options: StartAgentRunOptions<T>): AgentRunHand
802
874
  promptPromiseSettled = true;
803
875
  promptActive = false;
804
876
  publish();
805
- promptFailureCode ??= "unexpected-runner-failure";
806
- startPromptFailureSettlement(promptFailureCode);
877
+ handlePromptRejection();
878
+ startPromptFailureSettlement(promptFailureCode ?? "unexpected-runner-failure");
807
879
  },
808
880
  );
809
881
  } catch {
@@ -811,8 +883,8 @@ export function startAgentRun<T>(options: StartAgentRunOptions<T>): AgentRunHand
811
883
  promptPromiseSettled = true;
812
884
  promptActive = false;
813
885
  publish();
814
- promptFailureCode ??= "unexpected-runner-failure";
815
- startPromptFailureSettlement(promptFailureCode);
886
+ handlePromptRejection();
887
+ startPromptFailureSettlement(promptFailureCode ?? "unexpected-runner-failure");
816
888
  }
817
889
  };
818
890
 
@@ -970,7 +1042,7 @@ export function startAgentRun<T>(options: StartAgentRunOptions<T>): AgentRunHand
970
1042
  const admissionAtStart = admissionGeneration;
971
1043
  const steering = (async (): Promise<AgentRunSteerResult> => {
972
1044
  try {
973
- await activeSession.steer(message);
1045
+ const disposition = await activeSession.steer(message);
974
1046
  if (
975
1047
  !extensionAdmissionOpen ||
976
1048
  admissionGeneration !== admissionAtStart ||
@@ -983,7 +1055,7 @@ export function startAgentRun<T>(options: StartAgentRunOptions<T>): AgentRunHand
983
1055
  }
984
1056
  return "not-running";
985
1057
  }
986
- return "accepted";
1058
+ return disposition;
987
1059
  } catch {
988
1060
  return "not-running";
989
1061
  }
@@ -64,7 +64,7 @@ export interface AgentRunRegistration {
64
64
  readonly transcript?: AgentRunTranscriptCapture;
65
65
  readonly handle: AgentRunHandle<unknown>;
66
66
  readonly getConversation?: (
67
- acceptedSteering: readonly string[],
67
+ queuedSteering: readonly string[],
68
68
  ) => AgentRunDisplayConversation | undefined;
69
69
  readonly getRecentActivity?: () => readonly string[];
70
70
  }
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import type { AgentRunHandle, AgentRunSessionView } from "../types.ts";
2
+ import type { AgentRunHandle, AgentRunSessionView, AgentRunSteerResult } from "../types.ts";
3
3
  import type {
4
4
  AgentRunDisplayConversation,
5
5
  AgentRunDisplayMetadata,
@@ -29,7 +29,7 @@ interface RegisteredRun {
29
29
  readonly generation: number;
30
30
  readonly metadata: AgentRunDisplayMetadata;
31
31
  readonly transcript?: AgentRunTranscriptCapture;
32
- readonly acceptedSteering: string[];
32
+ readonly queuedSteering: string[];
33
33
  live?: LiveRun;
34
34
  status: AgentRunRegistryRun["status"];
35
35
  finishedAt?: number;
@@ -104,7 +104,7 @@ export class AgentRunRegistry {
104
104
  tools: [...registration.metadata.tools],
105
105
  },
106
106
  ...(registration.transcript ? { transcript: registration.transcript } : {}),
107
- acceptedSteering: [],
107
+ queuedSteering: [],
108
108
  live,
109
109
  status: "starting",
110
110
  turns: 0,
@@ -191,7 +191,7 @@ export class AgentRunRegistry {
191
191
  }
192
192
 
193
193
  /** Queue steering only for the selected run during its initial active prompt. */
194
- async steer(runKey: string, message: string): Promise<"accepted" | "not-running"> {
194
+ async steer(runKey: string, message: string): Promise<AgentRunSteerResult> {
195
195
  const run = this.#runs.get(runKey);
196
196
  const handle = run?.live?.handle;
197
197
  if (run?.status !== "running" || !handle?.steeringAvailable) {
@@ -199,20 +199,20 @@ export class AgentRunRegistry {
199
199
  }
200
200
  const result = await handle.steer(message);
201
201
  if (
202
- result === "accepted" &&
202
+ result === "queued" &&
203
203
  this.#isCurrent(run) &&
204
204
  run.status === "running" &&
205
205
  run.live?.handle === handle
206
206
  ) {
207
- run.acceptedSteering.push(message);
207
+ run.queuedSteering.push(message);
208
208
  this.#publish();
209
209
  }
210
210
  return result;
211
211
  }
212
212
 
213
- /** Return the steering messages accepted through the viewer. */
214
- acceptedSteering(runKey: string): readonly string[] {
215
- return [...(this.#runs.get(runKey)?.acceptedSteering ?? [])];
213
+ /** Return steering messages that Pi queued through the viewer. */
214
+ queuedSteering(runKey: string): readonly string[] {
215
+ return [...(this.#runs.get(runKey)?.queuedSteering ?? [])];
216
216
  }
217
217
 
218
218
  /** Stop only the selected active run. */
@@ -326,7 +326,7 @@ export class AgentRunRegistry {
326
326
 
327
327
  #readConversation(run: RegisteredRun): AgentRunDisplayConversation | undefined {
328
328
  try {
329
- const conversation = run.live?.getConversation?.([...run.acceptedSteering]);
329
+ const conversation = run.live?.getConversation?.([...run.queuedSteering]);
330
330
  return conversation ? copyConversation(conversation) : undefined;
331
331
  } catch {
332
332
  return undefined;
@@ -343,7 +343,7 @@ export class AgentRunRegistry {
343
343
  }
344
344
 
345
345
  #releaseLive(run: RegisteredRun): void {
346
- run.acceptedSteering.length = 0;
346
+ run.queuedSteering.length = 0;
347
347
  const live = run.live;
348
348
  if (!live) return;
349
349
  live.unsubscribeProgress?.();
@@ -1,5 +1,6 @@
1
1
  import type { Model, ModelThinkingLevel, Usage } from "@earendil-works/pi-ai";
2
2
  import type {
3
+ AgentSession,
3
4
  AgentSessionEvent,
4
5
  ResourceLoader,
5
6
  SessionStats,
@@ -10,7 +11,7 @@ import type { AgentRunProviderAuthority } from "./provider-authority.ts";
10
11
  import type { AgentRunRegistry } from "./session/agent-run-registry.ts";
11
12
  import type { AgentRunRegistration } from "./session/agent-run-registry-types.ts";
12
13
 
13
- /** The host-owned failure stages of one Agent Run. */
14
+ /** The host-owned failure stages of one Agent Run; `prompt-rejected` means no initial prompt started. */
14
15
  export type AgentRunFailureCode =
15
16
  | "session-creation-failed"
16
17
  | "session-not-ready"
@@ -260,10 +261,13 @@ export type AgentRunLifecycleTraceEntry =
260
261
  | { type: "queue_update"; steeringCount: number; followUpCount: number }
261
262
  | { type: "timeout_expired" }
262
263
  | { type: "abort_requested"; reason: "canceled" | "timeout" }
263
- | { type: "prompt_rejected" };
264
+ | {
265
+ type: "prompt_rejected";
266
+ reason: "handled" | "queued" | "threw-before-start" | "resolved-without-disposition";
267
+ };
264
268
 
265
- /** Result returned by an active-only steering request. */
266
- export type AgentRunSteerResult = "accepted" | "not-running";
269
+ /** Pi's input disposition for an active steering request, or a closed/unavailable run. */
270
+ export type AgentRunSteerResult = Awaited<ReturnType<AgentSession["steer"]>> | "not-running";
267
271
 
268
272
  /** Listener used by the Agent Run Handle progress subscription. */
269
273
  export type AgentRunProgressListener = (progress: AgentRunProgress) => void;
@@ -5,6 +5,7 @@ import type {
5
5
  AgentRunRegistryRun,
6
6
  } from "../session/agent-run-registry-types.ts";
7
7
  import type { AgentRunTranscriptSource } from "../session/transcript-store.ts";
8
+ import type { AgentRunSteerResult } from "../types.ts";
8
9
 
9
10
  /** Shared height limit for the PI overlay and its rendered viewport. */
10
11
  export const AGENTS_OVERLAY_MAX_HEIGHT_PERCENT = 100;
@@ -64,7 +65,28 @@ export interface AgentsOverlayData {
64
65
  }
65
66
 
66
67
  /** Result of one interactive selected-run control. */
67
- export type AgentOverlayControlResult = "accepted" | "not-running" | "canceled";
68
+ export type AgentOverlayControlResult =
69
+ | "accepted"
70
+ | "queued"
71
+ | "handled"
72
+ | "not-running"
73
+ | "canceled";
74
+
75
+ /** Return clear feedback for one Pi or overlay control result. */
76
+ export function agentOverlayControlNotice(result: AgentOverlayControlResult): string {
77
+ switch (result) {
78
+ case "queued":
79
+ return "Steering queued.";
80
+ case "handled":
81
+ return "Pi handled the input; it was not queued as steering.";
82
+ case "accepted":
83
+ return "Control accepted.";
84
+ case "canceled":
85
+ return "Control canceled.";
86
+ case "not-running":
87
+ return "Selected run is not running.";
88
+ }
89
+ }
68
90
 
69
91
  /** Runtime dependencies for the interactive overlay. */
70
92
  export interface AgentsDialogDependencies {
@@ -72,7 +94,7 @@ export interface AgentsDialogDependencies {
72
94
  readonly done: () => void;
73
95
  readonly tui: { requestRender: () => void; terminal: { rows: number } };
74
96
  readonly keybindings?: Pick<KeybindingsManager, "getKeys" | "matches">;
75
- readonly onSteer: (runKey: string, message: string) => Promise<AgentOverlayControlResult>;
76
- readonly onStop: (runKey: string) => Promise<Exclude<AgentOverlayControlResult, "canceled">>;
97
+ readonly onSteer: (runKey: string, message: string) => Promise<AgentRunSteerResult>;
98
+ readonly onStop: (runKey: string) => Promise<"accepted" | "not-running">;
77
99
  readonly subscribe?: (listener: (data: AgentsOverlayData) => void) => () => void;
78
100
  }
@@ -15,7 +15,10 @@ import type {
15
15
  AgentsOverlayData,
16
16
  AgentsOverlayRun,
17
17
  } from "./agents-overlay-data.ts";
18
- import { AGENTS_OVERLAY_MAX_HEIGHT_PERCENT } from "./agents-overlay-data.ts";
18
+ import {
19
+ AGENTS_OVERLAY_MAX_HEIGHT_PERCENT,
20
+ agentOverlayControlNotice,
21
+ } from "./agents-overlay-data.ts";
19
22
  import {
20
23
  centerLegend,
21
24
  renderDiagnosticsSection,
@@ -325,12 +328,7 @@ export class AgentsDialog implements Focusable {
325
328
  this.#changed();
326
329
  void action()
327
330
  .then((result) => {
328
- this.#notice =
329
- result === "accepted"
330
- ? "Control accepted."
331
- : result === "canceled"
332
- ? "Control canceled."
333
- : "Selected run is not running.";
331
+ this.#notice = agentOverlayControlNotice(result);
334
332
  })
335
333
  .catch(() => {
336
334
  this.#notice = "Control failed.";
@@ -121,7 +121,7 @@ Operation support is narrower than grammar support. AST import and export search
121
121
  ### Search and output limits
122
122
 
123
123
  - An AST search has a 5,000 eligible-file limit and a 10-second deadline shared by file enumeration and analysis. These are not tool-call settings.
124
- - Below directory roots, AST search excludes hidden entries, dependency/build/cache directories, symlinks, non-regular files, and files unsupported by the requested operation. It does **not** read `.gitignore`. Explicit roots are resolved and honored, including symlink roots. See the [scan policy](src/analysis/search/ast-scan.ts) for the exact directory list.
124
+ - Below directory roots, AST search excludes hidden entries, dependency/build/cache directories, symlinks, non-regular files, configured `code-intelligence.exclude` paths, and files unsupported by the requested operation. It does **not** read `.gitignore`. Explicit roots are resolved and honored, including excluded paths and symlink roots. See the [scan policy](src/analysis/search/ast-scan.ts) for the exact directory list.
125
125
  - An exact file that does not support the requested AST operation is invalid. Results disclose policy exclusions, interrupted scans, provider limits, and omitted matches. No matches do not mean that unsupported files were searched.
126
126
  - Tool text is truncated at Pi's default 2,000 lines or 50 KB. When this occurs, the full text is written to a temporary file and its path is returned. Result-list limits still apply to that full text.
127
127
 
@@ -148,7 +148,7 @@ Project values override global values, which override defaults. Project configur
148
148
  |---|---|---|
149
149
  | `code-intelligence.overviewEnabled` | `true` | Add the hidden overview; the choice is fixed for the session |
150
150
  | `code-intelligence.instructionFileNames` | `["CLAUDE.md", "AGENTS.md"]` | Ordered plain filenames for directory instruction discovery |
151
- | `lsp.exclude` | `[]` | Gitignore-style patterns for automatic LSP work, not exact-file requests |
151
+ | `code-intelligence.exclude` | `[]` | Gitignore-style patterns for automatic LSP and broad AST work, not exact requests |
152
152
  | `lsp.servers.<language>.enabled` | Enabled unless `false` | Disable a language server |
153
153
 
154
154
  Example `.pi/supi/config.json`:
@@ -157,10 +157,10 @@ Example `.pi/supi/config.json`:
157
157
  {
158
158
  "code-intelligence": {
159
159
  "overviewEnabled": false,
160
- "instructionFileNames": ["AGENTS.md", "CLAUDE.md"]
160
+ "instructionFileNames": ["AGENTS.md", "CLAUDE.md"],
161
+ "exclude": ["generated/**"]
161
162
  },
162
163
  "lsp": {
163
- "exclude": ["generated/**"],
164
164
  "servers": {
165
165
  "python": { "enabled": false }
166
166
  }
@@ -168,13 +168,13 @@ Example `.pi/supi/config.json`:
168
168
  }
169
169
  ```
170
170
 
171
- Use `typescript`, `python`, `rust`, `go`, `c`, `ruby`, `java`, `kotlin`, `bash`, `html`, `sql`, or `r` for built-in server keys (`cpp` aliases `c`). Server command and routing overrides are defined in the [LSP configuration reference](../supi-lsp/README.md#custom-server-configuration). `.pi-lsp.json` is not read. Restart Pi after server configuration changes. Only the boolean `true` enables the overview; non-boolean values do not enable it.
171
+ Use `typescript`, `python`, `rust`, `go`, `c`, `ruby`, `java`, `kotlin`, `bash`, `html`, `sql`, or `r` for built-in server keys (`cpp` aliases `c`). Server command and routing overrides are defined in the [LSP configuration reference](../supi-lsp/README.md#custom-server-configuration). `.pi-lsp.json` is not read. Only the boolean `true` enables the overview; non-boolean values do not enable it. The shared exclusion list uses gitignore syntax and project-over-global replacement. An explicit project `[]` clears configured patterns. `/supi-settings` shows the config path and says to reload or restart Pi after saving. Saved exclusions apply after reload or restart; exact file and explicitly selected directory requests remain available. An old `lsp.exclude` value reports a migration error and is not used.
172
172
 
173
173
  Directory orientation checks the path from the workspace root to the focused directory. It selects the first valid configured instruction file per directory, skips files already loaded by Pi or shown on the active branch, and shows at most 200 lines per file. Resolved instruction paths must stay inside the workspace. These snippets are tool output, not additions to Pi's system prompt.
174
174
 
175
175
  ## Privacy and security
176
176
 
177
- Pi extensions run with your system permissions; this package is not a sandbox. Language servers run as local processes and receive source files. Review server commands and project configuration before trusting a project. `lsp.exclude` and AST scan exclusions are not access controls.
177
+ Pi extensions run with your system permissions; this package is not a sandbox. Language servers run as local processes and receive source files. Review server commands and project configuration before trusting a project. `code-intelligence.exclude` and AST scan exclusions are not access controls.
178
178
 
179
179
  Tool results and the hidden overview enter Pi's model context and can be saved in session history. They can contain source text, paths, manifest data, diagnostics, and instruction-file contents. Truncated tool results and graph display overflow also leave full returned text in local temporary files. These files are not durable session storage and can be removed by system cleanup. “Hidden” means not displayed in the transcript, not hidden from the model.
180
180
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-runtime",
3
- "version": "7.4.0",
3
+ "version": "8.0.0",
4
4
  "description": "Shared workspace context and capability contracts for code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {