@mrclrchtr/supi-code-intelligence 2.0.6 → 2.2.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.
- package/README.md +88 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +32 -23
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +55 -27
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +72 -285
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +27 -5
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-core/README.md +32 -23
- package/node_modules/@mrclrchtr/supi-core/package.json +2 -1
- package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
- package/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +55 -27
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +72 -285
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-core/src/settings.ts +27 -5
- package/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +32 -23
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +55 -27
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +72 -285
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +27 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +32 -23
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +55 -27
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +72 -285
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings.ts +27 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +32 -23
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +55 -27
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +72 -285
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +27 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +32 -23
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +2 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +55 -27
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +72 -285
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings.ts +27 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/package.json +5 -5
- package/src/analysis/evidence.ts +13 -0
- package/src/analysis/instruction-files.ts +194 -0
- package/src/analysis/search/pattern.ts +24 -13
- package/src/analysis/search/ripgrep.ts +92 -7
- package/src/app/app.ts +6 -1
- package/src/config.ts +42 -0
- package/src/extension.ts +9 -1
- package/src/session/capability-adapter.ts +218 -0
- package/src/session/session.ts +106 -1
- package/src/session/target-workflow.ts +430 -0
- package/src/substrate/lsp/diagnostic-injection.ts +0 -15
- package/src/substrate/lsp/settings.ts +101 -175
- package/src/tool/find/execute.ts +23 -10
- package/src/tool/find/orchestrate.ts +67 -54
- package/src/tool/find/semantic-search.ts +30 -16
- package/src/tool/graph/collect-relation.ts +2 -1
- package/src/tool/graph/execute.ts +40 -12
- package/src/tool/graph/markdown-base.ts +5 -37
- package/src/tool/graph/orchestrate.ts +9 -35
- package/src/tool/graph/tui.ts +2 -0
- package/src/tool/guidance.ts +27 -38
- package/src/tool/health/markdown.ts +12 -70
- package/src/tool/health/orchestrate.ts +5 -13
- package/src/tool/impact/analysis.ts +0 -27
- package/src/tool/impact/change-set-impact.ts +3 -2
- package/src/tool/impact/execute.ts +27 -0
- package/src/tool/impact/file-level-impact.ts +3 -2
- package/src/tool/impact/result.ts +2 -21
- package/src/tool/impact/single-impact.ts +3 -2
- package/src/tool/infra/error-results.ts +18 -196
- package/src/tool/infra/pipeline.ts +24 -1
- package/src/tool/inspect/markdown.ts +4 -41
- package/src/tool/inspect/orchestrate.ts +27 -28
- package/src/tool/orientation/mode.ts +53 -2
- package/src/tool/orientation/orchestrate.ts +5 -8
- package/src/tool/orientation/precise-target.ts +65 -69
- package/src/tool/refactor-apply/orchestrate.ts +2 -7
- package/src/tool/refactor-plan/orchestrate.ts +31 -39
- package/src/tool/resolve/markdown.ts +5 -6
- package/src/tool/resolve/orchestrate.ts +7 -103
- package/src/tool/result/errors.ts +199 -0
- package/src/tool/result/find.ts +29 -0
- package/src/tool/result/graph.ts +93 -0
- package/src/tool/result/health.ts +94 -0
- package/src/tool/result/impact.ts +50 -0
- package/src/tool/result/inspect.ts +60 -0
- package/src/tool/result/orientation.ts +30 -0
- package/src/tool/result/refactor.ts +35 -0
- package/src/tool/result/resolve.ts +114 -0
- package/src/tool/result/types.ts +191 -0
- package/src/tool/schemas.ts +39 -28
- package/src/types/details.ts +17 -185
- package/src/ui/tui/common.ts +45 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -188
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -188
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -188
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -188
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -188
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -188
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability adapter — injected dependency for WorkspaceCodeIntelligenceSession.
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates provider access and readiness so the session target
|
|
5
|
+
* workflow can be tested with an in-memory adapter. Two adapters
|
|
6
|
+
* (production and test) justify the seam.
|
|
7
|
+
*
|
|
8
|
+
* @mrclrchtr/supi-code-intelligence — internal, not exported via api.ts
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { SemanticProvider, StructuralProvider } from "@mrclrchtr/supi-code-runtime/api";
|
|
12
|
+
import { getDefaultWorkspaceRuntime } from "@mrclrchtr/supi-code-runtime/api";
|
|
13
|
+
import type { SessionLspServiceState } from "@mrclrchtr/supi-lsp/api";
|
|
14
|
+
import {
|
|
15
|
+
type CodeProvider,
|
|
16
|
+
type CodeProviderState,
|
|
17
|
+
getCodeProviderState,
|
|
18
|
+
} from "../analysis/provider.ts";
|
|
19
|
+
import { ensureSemanticReadiness } from "../analysis/readiness.ts";
|
|
20
|
+
|
|
21
|
+
// ── Interface ─────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Readiness scope for semantic provider gating.
|
|
25
|
+
* `workspace` waits for all servers; `file` waits for a specific file's server.
|
|
26
|
+
*/
|
|
27
|
+
export type ReadinessScope = { kind: "workspace" } | { kind: "file"; file: string };
|
|
28
|
+
|
|
29
|
+
/** Outcome of a readiness wait. */
|
|
30
|
+
export type ReadinessOutcome =
|
|
31
|
+
| { kind: "ready" }
|
|
32
|
+
| { kind: "timeout" }
|
|
33
|
+
| { kind: "unavailable"; reason: string };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Injected capability adapter.
|
|
37
|
+
*
|
|
38
|
+
* Production adapter reads the global workspace runtime. Test adapter
|
|
39
|
+
* provides semantic/structural providers in memory without global state.
|
|
40
|
+
*/
|
|
41
|
+
export interface CapabilityAdapter {
|
|
42
|
+
/** Get the composite code provider state for a workspace. */
|
|
43
|
+
getProviderState(cwd: string): CodeProviderState;
|
|
44
|
+
|
|
45
|
+
/** Convenience: get the ready composite provider, or null. */
|
|
46
|
+
getProvider(cwd: string): CodeProvider | null;
|
|
47
|
+
|
|
48
|
+
/** Get the raw semantic provider, or null. */
|
|
49
|
+
getSemanticProvider(cwd: string): SemanticProvider | null;
|
|
50
|
+
|
|
51
|
+
/** Get the raw structural provider, or null. */
|
|
52
|
+
getStructuralProvider(cwd: string): StructuralProvider | null;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Wait for semantic (LSP) readiness. Returns a typed outcome so
|
|
56
|
+
* the target workflow can decide whether to proceed, return a
|
|
57
|
+
* timeout note, or return an unavailable result.
|
|
58
|
+
*/
|
|
59
|
+
ensureSemanticReadiness(cwd: string, scope: ReadinessScope): Promise<ReadinessOutcome>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ── Production adapter ────────────────────────────────────────────────
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Production capability adapter that reads from the global workspace
|
|
66
|
+
* runtime. Used in the real pi session.
|
|
67
|
+
*/
|
|
68
|
+
export class WorkspaceCapabilityAdapter implements CapabilityAdapter {
|
|
69
|
+
getProviderState(cwd: string): CodeProviderState {
|
|
70
|
+
return getCodeProviderState(cwd);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getProvider(cwd: string): CodeProvider | null {
|
|
74
|
+
const state = this.getProviderState(cwd);
|
|
75
|
+
return state.kind === "ready" ? state.provider : null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getSemanticProvider(cwd: string): SemanticProvider | null {
|
|
79
|
+
const runtime = getDefaultWorkspaceRuntime();
|
|
80
|
+
const ws = runtime.getWorkspace(cwd);
|
|
81
|
+
if (
|
|
82
|
+
(ws.semantic.state.kind === "ready" || ws.semantic.state.kind === "pending") &&
|
|
83
|
+
ws.semantic.provider !== null
|
|
84
|
+
) {
|
|
85
|
+
return ws.semantic.provider as SemanticProvider;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getStructuralProvider(cwd: string): StructuralProvider | null {
|
|
91
|
+
const runtime = getDefaultWorkspaceRuntime();
|
|
92
|
+
const ws = runtime.getWorkspace(cwd);
|
|
93
|
+
if (ws.structural.state.kind === "ready" && ws.structural.provider !== null) {
|
|
94
|
+
return ws.structural.provider as StructuralProvider;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async ensureSemanticReadiness(cwd: string, scope: ReadinessScope): Promise<ReadinessOutcome> {
|
|
100
|
+
const result = await ensureSemanticReadiness(cwd, scope);
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Convenience: LSP service state for impact/health consumers still using it directly. */
|
|
105
|
+
getLspService(cwd: string): SessionLspServiceState {
|
|
106
|
+
const state = this.getProviderState(cwd);
|
|
107
|
+
return state.kind === "ready"
|
|
108
|
+
? state.lspService
|
|
109
|
+
: { kind: "unavailable" as const, reason: "No provider" };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── Test adapter ──────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* In-memory capability adapter for tests.
|
|
117
|
+
*
|
|
118
|
+
* Pass explicit providers and readiness outcomes without touching
|
|
119
|
+
* the global workspace runtime.
|
|
120
|
+
*/
|
|
121
|
+
export class TestCapabilityAdapter implements CapabilityAdapter {
|
|
122
|
+
readonly #semantic: SemanticProvider | null;
|
|
123
|
+
readonly #structural: StructuralProvider | null;
|
|
124
|
+
readonly #readiness: ReadinessOutcome;
|
|
125
|
+
readonly #lspService: SessionLspServiceState;
|
|
126
|
+
|
|
127
|
+
constructor(options: {
|
|
128
|
+
semantic?: SemanticProvider | null;
|
|
129
|
+
structural?: StructuralProvider | null;
|
|
130
|
+
readiness?: ReadinessOutcome;
|
|
131
|
+
lspService?: SessionLspServiceState;
|
|
132
|
+
}) {
|
|
133
|
+
this.#semantic = options.semantic ?? null;
|
|
134
|
+
this.#structural = options.structural ?? null;
|
|
135
|
+
this.#readiness = options.readiness ?? { kind: "ready" };
|
|
136
|
+
this.#lspService = options.lspService ?? {
|
|
137
|
+
kind: "unavailable" as const,
|
|
138
|
+
reason: "no test LSP",
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
getProviderState(_cwd: string): CodeProviderState {
|
|
143
|
+
if (!this.#semantic && !this.#structural) {
|
|
144
|
+
return { kind: "unavailable", reason: "No providers in test adapter" };
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
kind: "ready",
|
|
148
|
+
provider: this.getProvider(_cwd) as CodeProvider,
|
|
149
|
+
lspService: this.#lspService,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: adapter maps many provider methods; splitting would degrade readability
|
|
154
|
+
getProvider(_cwd: string): CodeProvider | null {
|
|
155
|
+
if (!this.#semantic && !this.#structural) return null;
|
|
156
|
+
return {
|
|
157
|
+
// Semantic pass-through
|
|
158
|
+
references: this.#semantic?.references
|
|
159
|
+
? (...args: Parameters<SemanticProvider["references"]>) =>
|
|
160
|
+
this.#semantic?.references?.(...args)
|
|
161
|
+
: async () => null,
|
|
162
|
+
implementation: this.#semantic?.implementation
|
|
163
|
+
? (...args) => this.#semantic?.implementation?.(...args)
|
|
164
|
+
: async () => null,
|
|
165
|
+
documentSymbols: this.#semantic?.documentSymbols
|
|
166
|
+
? (...args) => this.#semantic?.documentSymbols?.(...args)
|
|
167
|
+
: async () => [],
|
|
168
|
+
workspaceSymbols: this.#semantic?.workspaceSymbols
|
|
169
|
+
? (...args) => this.#semantic?.workspaceSymbols?.(...args)
|
|
170
|
+
: async () => [],
|
|
171
|
+
hover: this.#semantic?.hover ? (...args) => this.#semantic?.hover?.(...args) : undefined,
|
|
172
|
+
definition: this.#semantic?.definition
|
|
173
|
+
? (...args) => this.#semantic?.definition?.(...args)
|
|
174
|
+
: undefined,
|
|
175
|
+
codeActions: this.#semantic?.codeActions
|
|
176
|
+
? (...args) => this.#semantic?.codeActions?.(...args)
|
|
177
|
+
: undefined,
|
|
178
|
+
codeActionTitles: this.#semantic?.codeActionTitles
|
|
179
|
+
? (...args) => this.#semantic?.codeActionTitles?.(...args)
|
|
180
|
+
: undefined,
|
|
181
|
+
rename: this.#semantic?.rename ? (...args) => this.#semantic?.rename?.(...args) : undefined,
|
|
182
|
+
refactor: this.#semantic?.refactor
|
|
183
|
+
? (...args) => this.#semantic?.refactor?.(...args)
|
|
184
|
+
: undefined,
|
|
185
|
+
// Structural pass-through
|
|
186
|
+
calleesAt: this.#structural?.calleesAt
|
|
187
|
+
? (...args) => this.#structural?.calleesAt?.(...args)
|
|
188
|
+
: async () => ({ kind: "unavailable" as const, message: "no test structural" }),
|
|
189
|
+
exports: this.#structural?.exports
|
|
190
|
+
? (...args) => this.#structural?.exports?.(...args)
|
|
191
|
+
: async () => ({ kind: "unavailable" as const, message: "no test structural" }),
|
|
192
|
+
outline: this.#structural?.outline
|
|
193
|
+
? (...args) => this.#structural?.outline?.(...args)
|
|
194
|
+
: async () => ({ kind: "unavailable" as const, message: "no test structural" }),
|
|
195
|
+
imports: this.#structural?.imports
|
|
196
|
+
? (...args) => this.#structural?.imports?.(...args)
|
|
197
|
+
: async () => ({ kind: "unavailable" as const, message: "no test structural" }),
|
|
198
|
+
nodeAt: this.#structural?.nodeAt
|
|
199
|
+
? (...args) => this.#structural?.nodeAt?.(...args)
|
|
200
|
+
: async () => ({ kind: "unavailable" as const, message: "no test structural" }),
|
|
201
|
+
callSites: this.#structural?.callSites
|
|
202
|
+
? (...args) => this.#structural?.callSites?.(...args)
|
|
203
|
+
: async () => ({ kind: "unavailable" as const, message: "no test structural" }),
|
|
204
|
+
} as CodeProvider;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
getSemanticProvider(_cwd: string): SemanticProvider | null {
|
|
208
|
+
return this.#semantic;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
getStructuralProvider(_cwd: string): StructuralProvider | null {
|
|
212
|
+
return this.#structural;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async ensureSemanticReadiness(_cwd: string, _scope: ReadinessScope): Promise<ReadinessOutcome> {
|
|
216
|
+
return this.#readiness;
|
|
217
|
+
}
|
|
218
|
+
}
|
package/src/session/session.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* @mrclrchtr/supi-code-intelligence — internal, not exported via api.ts
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import type { SessionEntry } from "@earendil-works/pi-coding-agent";
|
|
18
20
|
import {
|
|
19
21
|
getDefaultWorkspaceRuntime,
|
|
20
22
|
type SemanticProvider,
|
|
@@ -24,6 +26,7 @@ import type { LspRuntimeController } from "@mrclrchtr/supi-lsp/api";
|
|
|
24
26
|
import { CoverageWarningState } from "../analysis/coverage/coverage-warnings.ts";
|
|
25
27
|
import type { CodeProvider } from "../analysis/provider.ts";
|
|
26
28
|
import { getCodeProvider } from "../analysis/provider.ts";
|
|
29
|
+
import { type CapabilityAdapter, WorkspaceCapabilityAdapter } from "./capability-adapter.ts";
|
|
27
30
|
import { getPlan, type RefactorPlan, removePlan, storePlan } from "./refactor-plans.ts";
|
|
28
31
|
import {
|
|
29
32
|
getWorkflowTarget,
|
|
@@ -33,11 +36,18 @@ import {
|
|
|
33
36
|
type TargetRegistrationOutput,
|
|
34
37
|
type TargetStoreEntry,
|
|
35
38
|
} from "./target-store.ts";
|
|
39
|
+
import {
|
|
40
|
+
resolveTargetWorkflow,
|
|
41
|
+
type TargetWorkflowInput,
|
|
42
|
+
type TargetWorkflowOutcome,
|
|
43
|
+
type TargetWorkflowPolicy,
|
|
44
|
+
} from "./target-workflow.ts";
|
|
36
45
|
|
|
37
46
|
// ── Re-export types consumed by callers ───────────────────────────────
|
|
38
47
|
|
|
39
48
|
export type { CoverageWarningState } from "../analysis/coverage/coverage-warnings.ts";
|
|
40
49
|
export type { CodeProvider, CodeProviderState } from "../analysis/provider.ts";
|
|
50
|
+
export type { CapabilityAdapter } from "./capability-adapter.ts";
|
|
41
51
|
export type { RefactorPlan } from "./refactor-plans.ts";
|
|
42
52
|
export type {
|
|
43
53
|
TargetLookupResult,
|
|
@@ -45,6 +55,11 @@ export type {
|
|
|
45
55
|
TargetRegistrationOutput,
|
|
46
56
|
TargetStoreEntry,
|
|
47
57
|
} from "./target-store.ts";
|
|
58
|
+
export type {
|
|
59
|
+
TargetWorkflowInput,
|
|
60
|
+
TargetWorkflowOutcome,
|
|
61
|
+
TargetWorkflowPolicy,
|
|
62
|
+
} from "./target-workflow.ts";
|
|
48
63
|
|
|
49
64
|
// ── Target ID expansion result ────────────────────────────────────────
|
|
50
65
|
|
|
@@ -74,6 +89,9 @@ export class WorkspaceCodeIntelligenceSession {
|
|
|
74
89
|
/** Canonical workspace directory for this session. */
|
|
75
90
|
readonly cwd: string;
|
|
76
91
|
|
|
92
|
+
/** Injected capability adapter — two adapters (production/test) justify the seam. */
|
|
93
|
+
readonly #capability: CapabilityAdapter;
|
|
94
|
+
|
|
77
95
|
/** Whether the hidden architecture overview has been injected. */
|
|
78
96
|
hasInjectedOverview = false;
|
|
79
97
|
|
|
@@ -88,6 +106,12 @@ export class WorkspaceCodeIntelligenceSession {
|
|
|
88
106
|
*/
|
|
89
107
|
readonly coverageWarningState = new CoverageWarningState();
|
|
90
108
|
|
|
109
|
+
/** Absolute instruction files already loaded by PI's native context-file mechanism. */
|
|
110
|
+
readonly nativeInstructionPaths = new Set<string>();
|
|
111
|
+
|
|
112
|
+
/** Absolute directories whose instruction files were already surfaced by code_orientation. */
|
|
113
|
+
readonly surfacedInstructionDirs = new Set<string>();
|
|
114
|
+
|
|
91
115
|
/**
|
|
92
116
|
* Optional LSP controller reference — attached by LSP lifecycle module
|
|
93
117
|
* for coverage evaluation and server management.
|
|
@@ -100,8 +124,62 @@ export class WorkspaceCodeIntelligenceSession {
|
|
|
100
124
|
*/
|
|
101
125
|
tsController: import("@mrclrchtr/supi-tree-sitter/api").TreeSitterRuntimeController | null = null;
|
|
102
126
|
|
|
103
|
-
constructor(cwd: string) {
|
|
127
|
+
constructor(cwd: string, capability?: CapabilityAdapter) {
|
|
104
128
|
this.cwd = cwd;
|
|
129
|
+
this.#capability = capability ?? new WorkspaceCapabilityAdapter();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ── Target workflow (deep seam) ───────────────────────────────────
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Resolve target input into an immutable resolved target.
|
|
136
|
+
*
|
|
137
|
+
* This is the deep module interface. Tool executors call this instead
|
|
138
|
+
* of `expandTargetId` or direct `resolveTarget`/`resolveAnchoredSymbolTarget`
|
|
139
|
+
* calls. Returns typed outcomes — no markdown, no mutated params.
|
|
140
|
+
*/
|
|
141
|
+
async resolveTarget(
|
|
142
|
+
input: TargetWorkflowInput,
|
|
143
|
+
policy: TargetWorkflowPolicy,
|
|
144
|
+
): Promise<TargetWorkflowOutcome> {
|
|
145
|
+
return resolveTargetWorkflow(input, policy, {
|
|
146
|
+
cwd: this.cwd,
|
|
147
|
+
capability: this.#capability,
|
|
148
|
+
lookupTargetId: (id) => this.lookupTargetId(id),
|
|
149
|
+
registerTarget: (inp) => this.registerTarget(inp),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ── Instruction-file state ───────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
/** Remember instruction/context file paths already loaded by PI natively. */
|
|
156
|
+
captureNativeInstructionPaths(files: Array<{ path: string }>): void {
|
|
157
|
+
for (const file of files) {
|
|
158
|
+
this.nativeInstructionPaths.add(path.resolve(this.cwd, file.path));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Mark directory-local instruction files as surfaced after a successful orientation render. */
|
|
163
|
+
markInstructionDirsSurfaced(directories: string[]): void {
|
|
164
|
+
for (const directory of directories) {
|
|
165
|
+
this.surfacedInstructionDirs.add(path.resolve(this.cwd, directory));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Clear instruction-file dedup state after compaction. */
|
|
170
|
+
resetSurfacedInstructionDirs(): void {
|
|
171
|
+
this.surfacedInstructionDirs.clear();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Reconstruct surfaced instruction directories from branch tool-result details after compaction. */
|
|
175
|
+
reconstructInstructionState(branch: SessionEntry[]): void {
|
|
176
|
+
this.surfacedInstructionDirs.clear();
|
|
177
|
+
const entries = entriesAfterLatestCompaction(branch);
|
|
178
|
+
for (const entry of entries) {
|
|
179
|
+
for (const directory of extractInstructionDirectories(entry)) {
|
|
180
|
+
this.surfacedInstructionDirs.add(path.resolve(this.cwd, directory));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
105
183
|
}
|
|
106
184
|
|
|
107
185
|
// ── Provider access ───────────────────────────────────────────────
|
|
@@ -252,9 +330,36 @@ export class WorkspaceCodeIntelligenceSession {
|
|
|
252
330
|
clearStores(): void {
|
|
253
331
|
this.#refactorPlans.clear();
|
|
254
332
|
this.#workflowTargets.clear();
|
|
333
|
+
this.surfacedInstructionDirs.clear();
|
|
334
|
+
this.nativeInstructionPaths.clear();
|
|
255
335
|
}
|
|
256
336
|
}
|
|
257
337
|
|
|
338
|
+
function entriesAfterLatestCompaction(branch: SessionEntry[]): SessionEntry[] {
|
|
339
|
+
let start = 0;
|
|
340
|
+
for (let i = 0; i < branch.length; i++) {
|
|
341
|
+
if (branch[i]?.type === "compaction") start = i + 1;
|
|
342
|
+
}
|
|
343
|
+
return branch.slice(start);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function extractInstructionDirectories(entry: SessionEntry): string[] {
|
|
347
|
+
if (entry.type !== "message" || entry.message.role !== "toolResult") return [];
|
|
348
|
+
if (entry.message.toolName !== "code_orientation") return [];
|
|
349
|
+
|
|
350
|
+
const details = entry.message.details as
|
|
351
|
+
| { type?: string; data?: { instructions?: { files?: Array<{ directory?: unknown }> } } }
|
|
352
|
+
| undefined;
|
|
353
|
+
if (details?.type !== "context") return [];
|
|
354
|
+
|
|
355
|
+
const files = details.data?.instructions?.files;
|
|
356
|
+
if (!Array.isArray(files)) return [];
|
|
357
|
+
|
|
358
|
+
return files
|
|
359
|
+
.map((file) => file.directory)
|
|
360
|
+
.filter((directory): directory is string => typeof directory === "string");
|
|
361
|
+
}
|
|
362
|
+
|
|
258
363
|
// ── Standalone target-id expansion helper ─────────────────────────────
|
|
259
364
|
|
|
260
365
|
/**
|