flowseeker 0.1.7

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 (82) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/COMPATIBILITY.md +281 -0
  3. package/LICENSE +21 -0
  4. package/README.md +375 -0
  5. package/dist/adapters/frameworkEdges.js +586 -0
  6. package/dist/agent/approvalPolicy.js +81 -0
  7. package/dist/agent/commandRunner.js +166 -0
  8. package/dist/agent/flowCommandRunner.js +124 -0
  9. package/dist/agent/mcpToolRunner.js +167 -0
  10. package/dist/auth/githubAuth.js +71 -0
  11. package/dist/auth/modelList.js +127 -0
  12. package/dist/auth/oauthHandler.js +377 -0
  13. package/dist/chat/nativeChatParticipant.js +616 -0
  14. package/dist/cli/mcpServer.js +383 -0
  15. package/dist/cli/runEvaluation.js +789 -0
  16. package/dist/cli/runReplay.js +481 -0
  17. package/dist/commands/checkHostCompatibility.js +149 -0
  18. package/dist/commands/copyAgentPrompt.js +52 -0
  19. package/dist/commands/copyContext.js +54 -0
  20. package/dist/commands/explainSelectionRelevance.js +57 -0
  21. package/dist/commands/findRelevantContext.js +127 -0
  22. package/dist/commands/openEvidence.js +49 -0
  23. package/dist/commands/openMcpConfig.js +81 -0
  24. package/dist/commands/openRelatedTests.js +54 -0
  25. package/dist/commands/rebuildIndex.js +45 -0
  26. package/dist/commands/runEvaluationSuite.js +323 -0
  27. package/dist/commands/runReplaySuite.js +228 -0
  28. package/dist/config/defaultConfig.js +72 -0
  29. package/dist/config/loadConfig.js +84 -0
  30. package/dist/config/loadConfigFromPath.js +60 -0
  31. package/dist/extension.js +513 -0
  32. package/dist/gateway/agentPrompts.js +176 -0
  33. package/dist/gateway/aiGateway.js +1255 -0
  34. package/dist/gateway/aiProviders.js +901 -0
  35. package/dist/gateway/contextExpansion.js +331 -0
  36. package/dist/gateway/editProposalStore.js +238 -0
  37. package/dist/gateway/planProposalStore.js +28 -0
  38. package/dist/index/cacheStore.js +51 -0
  39. package/dist/index/chunker.js +45 -0
  40. package/dist/index/dependencyExtractor.js +107 -0
  41. package/dist/index/fileDiscovery.js +177 -0
  42. package/dist/index/structuredExtractor.js +256 -0
  43. package/dist/index/workspaceIndex.js +518 -0
  44. package/dist/mcp/mcpConfig.js +154 -0
  45. package/dist/mcp/mcpProvider.js +109 -0
  46. package/dist/mcp/mcpTools.js +215 -0
  47. package/dist/pipeline/agentPrompt.js +79 -0
  48. package/dist/pipeline/agentPromptHeadless.js +85 -0
  49. package/dist/pipeline/contextBlueprint.js +346 -0
  50. package/dist/pipeline/contextPack.js +80 -0
  51. package/dist/pipeline/diffPreview.js +79 -0
  52. package/dist/pipeline/evaluationMetrics.js +154 -0
  53. package/dist/pipeline/evidenceGraph.js +389 -0
  54. package/dist/pipeline/feedback.js +215 -0
  55. package/dist/pipeline/fileGroups.js +84 -0
  56. package/dist/pipeline/fileScanner.js +866 -0
  57. package/dist/pipeline/nodeScan.js +219 -0
  58. package/dist/pipeline/ranker.js +563 -0
  59. package/dist/pipeline/responseLanguage.js +39 -0
  60. package/dist/pipeline/retrievalPlan.js +163 -0
  61. package/dist/pipeline/runHeadless.js +54 -0
  62. package/dist/pipeline/runPipeline.js +114 -0
  63. package/dist/pipeline/solvePacket.js +382 -0
  64. package/dist/pipeline/subsystem.js +257 -0
  65. package/dist/pipeline/taskUnderstanding.js +453 -0
  66. package/dist/pipeline/tokenSavings.js +146 -0
  67. package/dist/pipeline/universalScan.js +216 -0
  68. package/dist/pipeline/verifyAfterApply.js +233 -0
  69. package/dist/runtime/capabilities.js +71 -0
  70. package/dist/runtime/hostDetect.js +98 -0
  71. package/dist/runtime/hostTier.js +68 -0
  72. package/dist/runtime/statusBar.js +80 -0
  73. package/dist/skills/skillRegistry.js +208 -0
  74. package/dist/types.js +3 -0
  75. package/dist/ui/chatViewProvider.js +3899 -0
  76. package/dist/ui/resultTreeProvider.js +174 -0
  77. package/dist/usage/quotaTracker.js +358 -0
  78. package/dist/utils/async.js +30 -0
  79. package/dist/utils/logger.js +64 -0
  80. package/dist/utils/text.js +364 -0
  81. package/dist/utils/updateChecker.js +140 -0
  82. package/package.json +561 -0
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createGuidancePrompt = createGuidancePrompt;
37
+ exports.createPlanPrompt = createPlanPrompt;
38
+ exports.createApprovedEditPrompt = createApprovedEditPrompt;
39
+ exports.createPromptWithInstruction = createPromptWithInstruction;
40
+ exports.createPlanInstruction = createPlanInstruction;
41
+ exports.createApprovedEditInstruction = createApprovedEditInstruction;
42
+ const vscode = __importStar(require("vscode"));
43
+ const responseLanguage_1 = require("../pipeline/responseLanguage");
44
+ const solvePacket_1 = require("../pipeline/solvePacket");
45
+ const tokenSavings_1 = require("../pipeline/tokenSavings");
46
+ const approvalPolicy_1 = require("../agent/approvalPolicy");
47
+ const mcpToolRunner_1 = require("../agent/mcpToolRunner");
48
+ function createGuidancePrompt(result) {
49
+ return createBasePrompt(result, "Return concise markdown guidance. Explain the likely edit files, why they matter, what to inspect, what to change, risks, and focused verification steps. Do not invent files that are not supported by the retrieved context.");
50
+ }
51
+ function createPlanPrompt(result) {
52
+ return createBasePrompt(result, createPlanInstruction());
53
+ }
54
+ function createApprovedEditPrompt(result, approvedPlan) {
55
+ return createBasePrompt(result, createApprovedEditInstruction(approvedPlan));
56
+ }
57
+ function createPromptWithInstruction(result, instruction) {
58
+ return createBasePrompt(result, instruction);
59
+ }
60
+ function createPlanInstruction() {
61
+ return [
62
+ "Return a reviewable implementation plan in markdown only.",
63
+ "Do not output code edits, patches, diffs, or JSON.",
64
+ "The plan must include: goal, files likely to edit, files to inspect only, step-by-step change plan, test/verification plan, and risks/unknowns.",
65
+ "Keep the plan specific to the retrieved files and explain if confidence is low.",
66
+ "End with: Awaiting user approval before generating edits."
67
+ ].join(" ");
68
+ }
69
+ function createApprovedEditInstruction(approvedPlan) {
70
+ return [
71
+ "The user approved this plan:",
72
+ approvedPlan,
73
+ "",
74
+ "CRITICAL — YOUR ENTIRE RESPONSE MUST BE A SINGLE JSON OBJECT AND NOTHING ELSE.",
75
+ "No markdown. No code fences. No explanation before or after the JSON. Start with { and end with }.",
76
+ "",
77
+ "Schema (every field is required):",
78
+ "{",
79
+ " \"message\": \"short summary of what was changed\",",
80
+ " \"edits\": [",
81
+ " {",
82
+ " \"file\": \"relative/path/from/workspace/root\",",
83
+ " \"range\": { \"startLine\": 1, \"startColumn\": 1, \"endLine\": 1, \"endColumn\": 1 },",
84
+ " \"text\": \"complete replacement text for that range\"",
85
+ " }",
86
+ " ],",
87
+ " \"commands\": [{ \"command\": \"npm run test\", \"rationale\": \"why this verifies the change\" }],",
88
+ " \"mcpTools\": [{ \"tool\": \"tool.name\", \"input\": {}, \"rationale\": \"why this tool is needed\" }]",
89
+ "}",
90
+ "",
91
+ "Rules:",
92
+ "- edits MUST be an array. A single edit object is invalid.",
93
+ "- Use 1-based line and column numbers.",
94
+ "- Every edit needs file + range + text.",
95
+ "- Only edit files that appear in the context above and are in the approved plan.",
96
+ "- If you cannot safely produce edits, return {\"message\":\"explain why\",\"edits\":[],\"commands\":[],\"mcpTools\":[]}.",
97
+ "- Commands and mcpTools are optional (empty arrays are fine).",
98
+ "",
99
+ "REMINDER: Output raw JSON only. First character must be {. Last character must be }."
100
+ ].join("\n");
101
+ }
102
+ function createBasePrompt(result, instruction) {
103
+ const packetMarkdown = result.solvePacket ? (0, solvePacket_1.renderSolvePacketMarkdown)(result.solvePacket) : result.contextPack;
104
+ const lang = vscode.workspace.getConfiguration("flowseeker").get("ai.outputLanguage", "auto");
105
+ const langInstruction = (0, responseLanguage_1.buildResponseLanguageInstruction)(lang, result.task);
106
+ const ruleInstruction = renderRuleInstruction();
107
+ const approvalInstruction = renderApprovalPolicyInstruction();
108
+ return [
109
+ "You are FlowSeeker's codebase-solving agent.",
110
+ "FlowSeeker already retrieved a bounded context pack from a large repository to reduce token use.",
111
+ renderPromptTokenSavings(result),
112
+ "Use only this context unless you clearly explain why extra files are needed.",
113
+ "FlowSeeker evidence is candidate context, not guaranteed truth.",
114
+ "Validate relevance before editing. Drop irrelevant files. Identify missing links before guessing.",
115
+ modeSpecificPromptPolicy(result),
116
+ approvalInstruction,
117
+ renderMcpToolInventory(),
118
+ ruleInstruction,
119
+ langInstruction,
120
+ "",
121
+ "Task:",
122
+ result.task,
123
+ "",
124
+ packetMarkdown,
125
+ "",
126
+ "---",
127
+ "",
128
+ instruction
129
+ ].join("\n");
130
+ }
131
+ function renderMcpToolInventory() {
132
+ const tools = (0, mcpToolRunner_1.availableToolNames)();
133
+ if (tools.length === 0) {
134
+ return "Available MCP/tools: none detected in this editor host.";
135
+ }
136
+ return ["Available MCP/tools:", ...tools.slice(0, 40).map((tool) => `- ${tool}`)].join("\n");
137
+ }
138
+ function renderApprovalPolicyInstruction() {
139
+ const policy = (0, approvalPolicy_1.getApprovalPolicy)();
140
+ return [
141
+ "Agent approval policy:",
142
+ `- Workspace reads/searches are ${policy.readWorkspace ? "allowed" : "not auto-approved"}.`,
143
+ `- Workspace edits are ${policy.editWorkspace ? "auto-approved by current settings" : "not auto-approved; produce a plan/diff and wait for user approval"}.`,
144
+ `- Safe verification commands are ${policy.safeCommands ? "auto-approved" : "not auto-approved unless explicitly requested by the user"}.`,
145
+ `- Arbitrary commands are ${policy.allCommands ? "auto-approved except destructive operations" : "not auto-approved"}.`,
146
+ `- MCP tools are ${policy.mcpTools ? "auto-approved" : "not auto-approved"}.`
147
+ ].join("\n");
148
+ }
149
+ function renderRuleInstruction() {
150
+ const rules = (0, approvalPolicy_1.getApprovalPolicy)().rules.map((rule) => rule.trim()).filter(Boolean);
151
+ if (rules.length === 0) {
152
+ return "User rules: none configured.";
153
+ }
154
+ return ["User rules:", ...rules.map((rule) => `- ${rule}`)].join("\n");
155
+ }
156
+ function modeSpecificPromptPolicy(result) {
157
+ if (["investigation", "unknown"].includes(result.profile.taskShape)) {
158
+ return [
159
+ "Task mode: read-only investigation/explanation.",
160
+ "Answer the user's question from the packet instead of producing an implementation plan.",
161
+ "Do not suggest edits or ask for expansion unless the retrieved context is genuinely insufficient.",
162
+ "When context is partial but enough to explain the likely flow, state that clearly and continue."
163
+ ].join(" ");
164
+ }
165
+ return "Task mode: implementation support. Produce a plan first for edits, then wait for user approval before generating changes.";
166
+ }
167
+ function renderPromptTokenSavings(result) {
168
+ const metrics = result.tokenSavings;
169
+ if (!metrics || metrics.status === "unavailable") {
170
+ return "Token savings metrics are unavailable for this run.";
171
+ }
172
+ const basis = metrics.basis === "workspace_index" ? "workspace index" : "scanned candidate text";
173
+ const warning = metrics.proofWarnings.length > 0 ? ` Proof warnings: ${metrics.proofWarnings.join("; ")}.` : "";
174
+ return `Measured token savings: Solve Packet ${(0, tokenSavings_1.formatTokenCount)(metrics.solvePacketTokensEstimate)} tokens vs ${basis} ${(0, tokenSavings_1.formatTokenCount)(metrics.workspaceTokensEstimate)} tokens by ${metrics.tokenizer} (${(0, tokenSavings_1.formatReductionPercent)(metrics.reductionPercent)} reduction, proof ${metrics.proofStatus}).${warning}`;
175
+ }
176
+ //# sourceMappingURL=agentPrompts.js.map