norn-cli 2.4.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +26 -1
  3. package/dist/cli.js +330 -85
  4. package/package.json +24 -5
  5. package/schemas/norn.config.schema.json +43 -1
  6. package/scripts/__pycache__/reddit_signal_miner.cpython-312.pyc +0 -0
  7. package/scripts/reddit_signal_miner.py +482 -0
  8. package/.claude/settings.local.json +0 -18
  9. package/.claude/skills/norn-social-campaign/SKILL.md +0 -70
  10. package/out/apiResponseIntellisenseCache.js +0 -394
  11. package/out/assertionRunner.js +0 -567
  12. package/out/cacheDir.js +0 -136
  13. package/out/chatParticipant.js +0 -763
  14. package/out/cli/colors.js +0 -127
  15. package/out/cli/formatters/assertion.js +0 -102
  16. package/out/cli/formatters/index.js +0 -23
  17. package/out/cli/formatters/response.js +0 -106
  18. package/out/cli/formatters/summary.js +0 -246
  19. package/out/cli/redaction.js +0 -237
  20. package/out/cli/reporters/html.js +0 -689
  21. package/out/cli/reporters/index.js +0 -22
  22. package/out/cli/reporters/junit.js +0 -226
  23. package/out/codeLensProvider.js +0 -351
  24. package/out/compareContentProvider.js +0 -85
  25. package/out/completionProvider.js +0 -3739
  26. package/out/contractAssertionSummary.js +0 -225
  27. package/out/contractDecorationProvider.js +0 -243
  28. package/out/coverageCalculator.js +0 -879
  29. package/out/coveragePanel.js +0 -597
  30. package/out/debug/breakpointResolver.js +0 -84
  31. package/out/debug/breakpoints.js +0 -52
  32. package/out/debug/nornDebugAdapter.js +0 -166
  33. package/out/debug/nornDebugSession.js +0 -613
  34. package/out/debug/sequenceLocationIndex.js +0 -77
  35. package/out/debug/types.js +0 -3
  36. package/out/deepClone.js +0 -21
  37. package/out/diagnosticProvider.js +0 -2554
  38. package/out/environmentParser.js +0 -736
  39. package/out/environmentProvider.js +0 -544
  40. package/out/environmentTemplates.js +0 -146
  41. package/out/errors/formatError.js +0 -113
  42. package/out/errors/nornError.js +0 -29
  43. package/out/formUrlEncoded.js +0 -89
  44. package/out/httpClient.js +0 -348
  45. package/out/httpRuntimeOptions.js +0 -16
  46. package/out/importErrors.js +0 -31
  47. package/out/inlayHintResolver.js +0 -70
  48. package/out/jsonFileReader.js +0 -323
  49. package/out/mcpClient.js +0 -193
  50. package/out/mcpConfig.js +0 -184
  51. package/out/mcpToolIntellisenseCache.js +0 -96
  52. package/out/mcpToolSchema.js +0 -50
  53. package/out/nornConfig.js +0 -132
  54. package/out/nornHoverProvider.js +0 -124
  55. package/out/nornInlayHintsProvider.js +0 -191
  56. package/out/nornPrompt.js +0 -755
  57. package/out/nornSqlParser.js +0 -286
  58. package/out/nornapiHoverProvider.js +0 -135
  59. package/out/nornapiInlayHintsProvider.js +0 -94
  60. package/out/nornapiParser.js +0 -324
  61. package/out/nornenvCodeActionProvider.js +0 -101
  62. package/out/nornenvDecorationProvider.js +0 -239
  63. package/out/nornenvFoldingProvider.js +0 -63
  64. package/out/nornenvHoverProvider.js +0 -114
  65. package/out/nornenvInlayHintsProvider.js +0 -99
  66. package/out/nornenvLanguageModel.js +0 -187
  67. package/out/nornenvRegionRefactor.js +0 -267
  68. package/out/nornsqlHoverProvider.js +0 -95
  69. package/out/nornsqlInlayHintsProvider.js +0 -114
  70. package/out/parser.js +0 -839
  71. package/out/pathAccess.js +0 -28
  72. package/out/postmanImportPanel.js +0 -732
  73. package/out/postmanImportPlanner.js +0 -1155
  74. package/out/postmanImportSidebarView.js +0 -532
  75. package/out/quotedString.js +0 -35
  76. package/out/requestPreparation.js +0 -179
  77. package/out/requestValidation.js +0 -146
  78. package/out/responsePanel.js +0 -7754
  79. package/out/schemaGenerator.js +0 -562
  80. package/out/scriptRunner.js +0 -419
  81. package/out/secrets/cliSecrets.js +0 -415
  82. package/out/secrets/crypto.js +0 -105
  83. package/out/secrets/envFileSecrets.js +0 -177
  84. package/out/secrets/keyStore.js +0 -259
  85. package/out/sequenceDeclaration.js +0 -15
  86. package/out/sequenceRunner.js +0 -3590
  87. package/out/sqlAdapterRunner.js +0 -122
  88. package/out/sqlBuiltInAdapters.js +0 -604
  89. package/out/sqlConfig.js +0 -184
  90. package/out/starterCatalog.js +0 -554
  91. package/out/stringUtils.js +0 -25
  92. package/out/swaggerBodyIntellisenseCache.js +0 -114
  93. package/out/swaggerParser.js +0 -464
  94. package/out/testProvider.js +0 -767
  95. package/out/theoryCaseLoader.js +0 -113
  96. package/out/validationCache.js +0 -211
@@ -1,613 +0,0 @@
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.NornDebugSession = void 0;
37
- const fs = __importStar(require("fs/promises"));
38
- const path = __importStar(require("path"));
39
- const parser_1 = require("../parser");
40
- const sequenceRunner_1 = require("../sequenceRunner");
41
- const responsePanel_1 = require("../responsePanel");
42
- const environmentProvider_1 = require("../environmentProvider");
43
- const formatError_1 = require("../errors/formatError");
44
- const importErrors_1 = require("../importErrors");
45
- const breakpointResolver_1 = require("./breakpointResolver");
46
- const sequenceLocationIndex_1 = require("./sequenceLocationIndex");
47
- const THREAD_ID = 1;
48
- function isObjectLike(value) {
49
- return typeof value === 'object' && value !== null;
50
- }
51
- function formatVariableValue(value) {
52
- if (value === null) {
53
- return 'null';
54
- }
55
- if (value === undefined) {
56
- return 'undefined';
57
- }
58
- if (typeof value === 'string') {
59
- return value;
60
- }
61
- if (typeof value === 'number' || typeof value === 'boolean') {
62
- return String(value);
63
- }
64
- if (Array.isArray(value)) {
65
- return `Array(${value.length})`;
66
- }
67
- return 'Object';
68
- }
69
- class NornDebugSession {
70
- send;
71
- extensionUri;
72
- outgoingSeq = 1;
73
- launchConfig;
74
- configurationDone = false;
75
- launchStarted = false;
76
- terminated = false;
77
- breakpointsByFile = new Map();
78
- continueMode = 'continue';
79
- stepDepthTarget = 0;
80
- pauseRequested = false;
81
- waitForResume;
82
- resumeResolver;
83
- stopOnEntryConsumed = false;
84
- frames = [];
85
- nextFrameId = 1;
86
- pausedState;
87
- lastStepEvent;
88
- failurePauseHandled = false;
89
- runtimeVariables = {};
90
- responses = [];
91
- variableHandles = new Map();
92
- nextVariableHandle = 1;
93
- constructor(extensionUri, send) {
94
- this.extensionUri = extensionUri;
95
- this.send = send;
96
- }
97
- async handleRequest(request) {
98
- try {
99
- switch (request.command) {
100
- case 'initialize':
101
- this.handleInitialize(request);
102
- return;
103
- case 'launch':
104
- this.handleLaunch(request);
105
- return;
106
- case 'setBreakpoints':
107
- await this.handleSetBreakpoints(request);
108
- return;
109
- case 'configurationDone':
110
- this.handleConfigurationDone(request);
111
- return;
112
- case 'threads':
113
- this.handleThreads(request);
114
- return;
115
- case 'stackTrace':
116
- this.handleStackTrace(request);
117
- return;
118
- case 'scopes':
119
- this.handleScopes(request);
120
- return;
121
- case 'variables':
122
- this.handleVariables(request);
123
- return;
124
- case 'continue':
125
- this.handleContinue(request);
126
- return;
127
- case 'next':
128
- this.handleNext(request);
129
- return;
130
- case 'stepIn':
131
- this.handleStepIn(request);
132
- return;
133
- case 'stepOut':
134
- this.handleStepOut(request);
135
- return;
136
- case 'pause':
137
- this.handlePause(request);
138
- return;
139
- case 'disconnect':
140
- case 'terminate':
141
- this.handleDisconnect(request);
142
- return;
143
- default:
144
- this.sendErrorResponse(request, `Unsupported command: ${request.command}`);
145
- }
146
- }
147
- catch (error) {
148
- const message = error instanceof Error ? error.message : String(error);
149
- this.sendErrorResponse(request, message);
150
- }
151
- }
152
- handleInitialize(request) {
153
- this.sendResponse(request, {
154
- supportsConfigurationDoneRequest: true,
155
- supportsTerminateRequest: true,
156
- supportsConditionalBreakpoints: false,
157
- supportsHitConditionalBreakpoints: false,
158
- supportsLogPoints: false
159
- });
160
- this.sendEvent('initialized');
161
- }
162
- handleLaunch(request) {
163
- const config = request.arguments;
164
- if (!config || !config.file || !config.sequence) {
165
- this.sendErrorResponse(request, 'Launch requires file and sequence');
166
- return;
167
- }
168
- this.launchConfig = {
169
- ...config,
170
- file: path.resolve(config.file),
171
- stopOnEntry: config.stopOnEntry ?? true
172
- };
173
- this.sendResponse(request);
174
- if (this.configurationDone && !this.launchStarted) {
175
- this.startLaunch();
176
- }
177
- }
178
- async handleSetBreakpoints(request) {
179
- const args = request.arguments || {};
180
- const sourcePath = typeof args?.source?.path === 'string' ? path.resolve(args.source.path) : undefined;
181
- if (!sourcePath) {
182
- this.sendResponse(request, { breakpoints: [] });
183
- return;
184
- }
185
- const requestedLines = Array.isArray(args.lines)
186
- ? args.lines
187
- : Array.isArray(args.breakpoints)
188
- ? args.breakpoints.map((bp) => bp?.line).filter((line) => typeof line === 'number')
189
- : [];
190
- const resolved = await (0, breakpointResolver_1.resolveBreakpointsForFile)(sourcePath, requestedLines);
191
- const verified = new Set();
192
- for (const item of resolved) {
193
- if (item.verified) {
194
- verified.add(item.line);
195
- }
196
- }
197
- this.breakpointsByFile.set(sourcePath, verified);
198
- this.sendResponse(request, {
199
- breakpoints: resolved.map(item => ({
200
- verified: item.verified,
201
- line: item.line,
202
- message: item.message
203
- }))
204
- });
205
- }
206
- handleConfigurationDone(request) {
207
- this.configurationDone = true;
208
- this.sendResponse(request);
209
- if (this.launchConfig && !this.launchStarted) {
210
- this.startLaunch();
211
- }
212
- }
213
- handleThreads(request) {
214
- this.sendResponse(request, {
215
- threads: [{ id: THREAD_ID, name: 'Norn' }]
216
- });
217
- }
218
- handleStackTrace(request) {
219
- const ordered = [...this.frames].sort((a, b) => b.nestingDepth - a.nestingDepth);
220
- const stackFrames = ordered.map(frame => {
221
- const lineZero = frame.currentLine ?? frame.declarationLine ?? 0;
222
- const sourcePath = frame.filePath;
223
- return {
224
- id: frame.id,
225
- name: frame.sequenceName,
226
- source: sourcePath
227
- ? { name: path.basename(sourcePath), path: sourcePath }
228
- : undefined,
229
- line: lineZero + 1,
230
- column: 1
231
- };
232
- });
233
- this.sendResponse(request, {
234
- stackFrames,
235
- totalFrames: stackFrames.length
236
- });
237
- }
238
- handleScopes(request) {
239
- const runtimeRef = this.createVariableReference(this.runtimeVariables);
240
- const responsesObject = {};
241
- this.responses.forEach((resp, idx) => {
242
- responsesObject[`$${idx + 1}`] = resp;
243
- });
244
- const responsesRef = this.createVariableReference(responsesObject);
245
- this.sendResponse(request, {
246
- scopes: [
247
- {
248
- name: 'Runtime Variables',
249
- variablesReference: runtimeRef,
250
- expensive: false
251
- },
252
- {
253
- name: 'Responses',
254
- variablesReference: responsesRef,
255
- expensive: false
256
- }
257
- ]
258
- });
259
- }
260
- handleVariables(request) {
261
- const args = request.arguments || {};
262
- const handle = typeof args.variablesReference === 'number' ? args.variablesReference : 0;
263
- const value = this.variableHandles.get(handle);
264
- if (value === undefined) {
265
- this.sendResponse(request, { variables: [] });
266
- return;
267
- }
268
- const variables = [];
269
- if (Array.isArray(value)) {
270
- value.forEach((item, idx) => {
271
- variables.push({
272
- name: String(idx),
273
- value: formatVariableValue(item),
274
- variablesReference: this.createVariableReference(item),
275
- type: Array.isArray(item) ? 'array' : typeof item
276
- });
277
- });
278
- }
279
- else if (isObjectLike(value)) {
280
- for (const [key, item] of Object.entries(value)) {
281
- variables.push({
282
- name: key,
283
- value: formatVariableValue(item),
284
- variablesReference: this.createVariableReference(item),
285
- type: Array.isArray(item) ? 'array' : typeof item
286
- });
287
- }
288
- }
289
- this.sendResponse(request, { variables });
290
- }
291
- handleContinue(request) {
292
- this.continueMode = 'continue';
293
- this.resumeExecution();
294
- this.sendResponse(request, { allThreadsContinued: true });
295
- }
296
- handleNext(request) {
297
- this.continueMode = 'next';
298
- this.stepDepthTarget = Math.max(1, this.frames.length);
299
- this.resumeExecution();
300
- this.sendResponse(request);
301
- }
302
- handleStepIn(request) {
303
- this.continueMode = 'stepIn';
304
- this.resumeExecution();
305
- this.sendResponse(request);
306
- }
307
- handleStepOut(request) {
308
- this.continueMode = 'stepOut';
309
- this.stepDepthTarget = Math.max(0, this.frames.length - 1);
310
- this.resumeExecution();
311
- this.sendResponse(request);
312
- }
313
- handlePause(request) {
314
- this.pauseRequested = true;
315
- this.sendResponse(request);
316
- }
317
- handleDisconnect(request) {
318
- this.terminated = true;
319
- this.resumeExecution();
320
- this.sendResponse(request);
321
- this.sendEvent('terminated');
322
- }
323
- createVariableReference(value) {
324
- if (!isObjectLike(value) && !Array.isArray(value)) {
325
- return 0;
326
- }
327
- const handle = this.nextVariableHandle++;
328
- this.variableHandles.set(handle, value);
329
- return handle;
330
- }
331
- resetVariableHandles() {
332
- this.variableHandles.clear();
333
- this.nextVariableHandle = 1;
334
- }
335
- startLaunch() {
336
- if (this.launchStarted) {
337
- return;
338
- }
339
- this.launchStarted = true;
340
- void this.runLaunch();
341
- }
342
- async runLaunch() {
343
- if (!this.launchConfig) {
344
- return;
345
- }
346
- this.sendEvent('thread', { reason: 'started', threadId: THREAD_ID });
347
- const config = this.launchConfig;
348
- const previousEnv = (0, environmentProvider_1.getActiveEnvironment)(config.file);
349
- try {
350
- await this.validateEnvironmentSelection(config.file, config.env);
351
- if (config.env) {
352
- (0, environmentProvider_1.setActiveEnvironment)(config.env, config.file);
353
- }
354
- await this.ensureEnvironmentReady(config.file);
355
- const fileContent = await fs.readFile(config.file, 'utf-8');
356
- const importResult = await (0, parser_1.resolveImports)(fileContent, path.dirname(config.file), async (importPath) => fs.readFile(importPath, 'utf-8'), undefined, undefined, config.file);
357
- const duplicateErrors = (0, importErrors_1.getBlockingImportErrors)(importResult.errors);
358
- if (duplicateErrors.length > 0) {
359
- throw new Error(`Cannot debug sequence due to blocking import errors: ${duplicateErrors[0].error}`);
360
- }
361
- const fullTextWithImports = importResult.importedContent
362
- ? `${importResult.importedContent}\n\n${fileContent}`
363
- : fileContent;
364
- const sequence = (0, sequenceRunner_1.extractSequences)(fullTextWithImports).find(seq => seq.name === config.sequence);
365
- if (!sequence) {
366
- throw new Error(`Sequence '${config.sequence}' not found`);
367
- }
368
- const locationIndex = await (0, sequenceLocationIndex_1.buildSequenceLocationIndex)(config.file, importResult.sequenceSources);
369
- const location = locationIndex.get(sequence.name.toLowerCase());
370
- const envVars = (0, environmentProvider_1.getEnvironmentVariables)(config.file);
371
- const fileVariables = (0, parser_1.extractFileLevelVariables)(fileContent);
372
- const allVariables = (0, parser_1.attachEnvironmentScope)({ ...envVars, ...fileVariables }, envVars);
373
- const defaultArgs = {};
374
- if (sequence.parameters) {
375
- for (const param of sequence.parameters) {
376
- if (param.defaultValue !== undefined) {
377
- defaultArgs[param.name] = param.defaultValue;
378
- }
379
- }
380
- }
381
- const runArgs = { ...defaultArgs, ...(config.args || {}) };
382
- const apiDefinitions = (importResult.headerGroups?.length || 0) > 0 || (importResult.endpoints?.length || 0) > 0
383
- ? { headerGroups: importResult.headerGroups || [], endpoints: importResult.endpoints || [] }
384
- : undefined;
385
- const envValidationContext = this.getEnvironmentValidationContext(config.file);
386
- const executionContext = {
387
- filePath: location?.filePath ?? config.file,
388
- sequenceName: sequence.name,
389
- environment: envValidationContext,
390
- sequenceStartLine: location?.startLine ?? sequence.startLine,
391
- sequenceLocationIndex: locationIndex
392
- };
393
- this.frames = [];
394
- this.pauseRequested = false;
395
- this.stopOnEntryConsumed = false;
396
- this.failurePauseHandled = false;
397
- this.runtimeVariables = allVariables;
398
- this.responses = [];
399
- responsePanel_1.ResponsePanel.startSequenceRun(this.extensionUri, sequence.name, (0, sequenceRunner_1.countSequenceSteps)(sequence.content), config.file);
400
- const debugHooks = {
401
- onSequenceEnter: (info) => this.onSequenceEnter(info),
402
- onSequenceExit: (info) => this.onSequenceExit(info),
403
- beforeStep: (event) => this.onBeforeStep(event),
404
- onFailure: async (failure) => {
405
- const event = this.lastStepEvent;
406
- if (!event) {
407
- return;
408
- }
409
- this.failurePauseHandled = true;
410
- await this.pauseExecution('exception', event, failure.message);
411
- }
412
- };
413
- const result = await (0, sequenceRunner_1.runSequence)(sequence.content, allVariables, path.dirname(config.file), fullTextWithImports, (progress) => this.onProgress(progress), undefined, runArgs, apiDefinitions, undefined, importResult.sequenceSources, importResult.sqlOperationsBySource, executionContext, debugHooks);
414
- result.name = sequence.name;
415
- responsePanel_1.ResponsePanel.finalizeSequence(result);
416
- if (!result.success && this.lastStepEvent && !this.pausedState && !this.failurePauseHandled) {
417
- await this.pauseExecution('exception', this.lastStepEvent, result.errors[0] || 'Sequence failed');
418
- }
419
- }
420
- catch (error) {
421
- const message = (0, formatError_1.formatUserFacingError)(error, {
422
- source: 'extension',
423
- filePath: this.launchConfig.file,
424
- sequenceName: this.launchConfig.sequence,
425
- environment: this.getEnvironmentValidationContext(this.launchConfig.file)
426
- });
427
- this.sendEvent('output', {
428
- category: 'stderr',
429
- output: `Norn debug error: ${message}\n`
430
- });
431
- responsePanel_1.ResponsePanel.finalizeSequence({
432
- name: this.launchConfig.sequence,
433
- success: false,
434
- responses: [],
435
- scriptResults: [],
436
- assertionResults: [],
437
- steps: [],
438
- errors: [message],
439
- duration: 0
440
- });
441
- }
442
- finally {
443
- if (config.env) {
444
- (0, environmentProvider_1.setActiveEnvironment)(previousEnv, config.file);
445
- }
446
- this.sendEvent('thread', { reason: 'exited', threadId: THREAD_ID });
447
- this.sendEvent('terminated');
448
- }
449
- }
450
- getEnvironmentValidationContext(filePath) {
451
- return {
452
- hasEnvFile: (0, environmentProvider_1.getAvailableEnvironments)(filePath).length > 0,
453
- activeEnvironment: (0, environmentProvider_1.getActiveEnvironment)(filePath),
454
- availableEnvironments: (0, environmentProvider_1.getAvailableEnvironments)(filePath)
455
- };
456
- }
457
- async validateEnvironmentSelection(filePath, env) {
458
- if (!env) {
459
- return;
460
- }
461
- const available = (0, environmentProvider_1.getAvailableEnvironments)(filePath);
462
- if (!available.includes(env)) {
463
- throw new Error(`Environment '${env}' not found. Available: ${available.join(', ') || 'none'}`);
464
- }
465
- }
466
- async ensureEnvironmentReady(filePath) {
467
- const envErrors = (0, environmentProvider_1.getEnvironmentImportErrorDetails)(filePath);
468
- if (envErrors.length > 0) {
469
- throw new Error(`.nornenv has errors: ${envErrors[0].message}`);
470
- }
471
- const unlocked = await (0, environmentProvider_1.promptForMissingEnvironmentSecretKeys)(filePath);
472
- if (!unlocked) {
473
- throw new Error('Secrets are locked. Enter shared key to continue.');
474
- }
475
- const secretErrors = (0, environmentProvider_1.getEnvironmentSecretErrorDetails)(filePath);
476
- if (secretErrors.length > 0) {
477
- throw new Error(`.nornenv secret error: ${secretErrors[0].message}`);
478
- }
479
- }
480
- onProgress(progress) {
481
- const prefix = progress.nestingDepth && progress.nestingDepth > 0 ? `${' '.repeat(progress.nestingDepth)}` : '';
482
- this.sendEvent('output', {
483
- category: 'console',
484
- output: `${prefix}[${progress.currentStep}/${progress.totalSteps}] ${progress.stepDescription}\n`
485
- });
486
- if (progress.stepType === 'sequenceStart' || progress.stepType === 'sequenceEnd') {
487
- responsePanel_1.ResponsePanel.addSequenceStep(undefined, progress);
488
- }
489
- else if (progress.stepResult) {
490
- responsePanel_1.ResponsePanel.addSequenceStep(progress.stepResult, progress);
491
- }
492
- }
493
- async onSequenceEnter(info) {
494
- const frame = {
495
- id: this.nextFrameId++,
496
- sequenceName: info.sequenceName || 'sequence',
497
- filePath: info.filePath,
498
- declarationLine: info.declarationLine,
499
- currentLine: info.declarationLine,
500
- nestingDepth: info.nestingDepth
501
- };
502
- this.frames.push(frame);
503
- }
504
- async onSequenceExit(info) {
505
- while (this.frames.length > info.nestingDepth) {
506
- this.frames.pop();
507
- }
508
- }
509
- async onBeforeStep(event) {
510
- if (this.terminated) {
511
- throw new Error('Debug session terminated');
512
- }
513
- this.lastStepEvent = event;
514
- this.runtimeVariables = event.runtimeVariables;
515
- this.responses = event.responses;
516
- const currentFrame = this.frames[this.frames.length - 1];
517
- if (currentFrame && event.location.absoluteLine !== undefined) {
518
- currentFrame.currentLine = event.location.absoluteLine;
519
- }
520
- const currentDepth = Math.max(1, this.frames.length);
521
- let reason;
522
- if (!this.stopOnEntryConsumed && (this.launchConfig?.stopOnEntry ?? true)) {
523
- reason = 'entry';
524
- this.stopOnEntryConsumed = true;
525
- }
526
- else if (this.pauseRequested) {
527
- reason = 'pause';
528
- this.pauseRequested = false;
529
- }
530
- else if (this.continueMode === 'stepIn') {
531
- reason = 'step';
532
- }
533
- else if (this.continueMode === 'next' && currentDepth <= this.stepDepthTarget) {
534
- reason = 'step';
535
- }
536
- else if (this.continueMode === 'stepOut' && currentDepth <= this.stepDepthTarget) {
537
- reason = 'step';
538
- }
539
- else if (event.location.filePath && event.location.absoluteLine !== undefined) {
540
- const filePath = path.resolve(event.location.filePath);
541
- const lineOneBased = event.location.absoluteLine + 1;
542
- const fileBreakpoints = this.breakpointsByFile.get(filePath);
543
- if (fileBreakpoints && fileBreakpoints.has(lineOneBased)) {
544
- reason = 'breakpoint';
545
- }
546
- }
547
- if (!reason) {
548
- return;
549
- }
550
- await this.pauseExecution(reason, event);
551
- }
552
- async pauseExecution(reason, event, message) {
553
- if (this.terminated) {
554
- throw new Error('Debug session terminated');
555
- }
556
- this.pausedState = { reason, event, message };
557
- this.resetVariableHandles();
558
- this.sendEvent('stopped', {
559
- reason,
560
- threadId: THREAD_ID,
561
- description: message,
562
- allThreadsStopped: true
563
- });
564
- this.waitForResume = new Promise((resolve) => {
565
- this.resumeResolver = resolve;
566
- });
567
- await this.waitForResume;
568
- this.waitForResume = undefined;
569
- this.resumeResolver = undefined;
570
- this.pausedState = undefined;
571
- if (this.terminated) {
572
- throw new Error('Debug session terminated');
573
- }
574
- }
575
- resumeExecution() {
576
- if (this.resumeResolver) {
577
- this.resumeResolver();
578
- }
579
- }
580
- sendResponse(request, body) {
581
- const response = {
582
- seq: this.outgoingSeq++,
583
- type: 'response',
584
- request_seq: request.seq,
585
- command: request.command,
586
- success: true,
587
- body
588
- };
589
- this.send(response);
590
- }
591
- sendErrorResponse(request, message) {
592
- const response = {
593
- seq: this.outgoingSeq++,
594
- type: 'response',
595
- request_seq: request.seq,
596
- command: request.command,
597
- success: false,
598
- message
599
- };
600
- this.send(response);
601
- }
602
- sendEvent(event, body) {
603
- const output = {
604
- seq: this.outgoingSeq++,
605
- type: 'event',
606
- event,
607
- body
608
- };
609
- this.send(output);
610
- }
611
- }
612
- exports.NornDebugSession = NornDebugSession;
613
- //# sourceMappingURL=nornDebugSession.js.map
@@ -1,77 +0,0 @@
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.buildSequenceLocationIndex = buildSequenceLocationIndex;
37
- const fs = __importStar(require("fs/promises"));
38
- const sequenceRunner_1 = require("../sequenceRunner");
39
- const sequenceDeclaration_1 = require("../sequenceDeclaration");
40
- async function indexFile(filePath, index, readFile, visited) {
41
- if (visited.has(filePath)) {
42
- return;
43
- }
44
- visited.add(filePath);
45
- const content = await readFile(filePath);
46
- const lines = content.split('\n');
47
- const sequences = (0, sequenceRunner_1.extractSequences)(content);
48
- for (const seq of sequences) {
49
- const key = seq.name.toLowerCase();
50
- if (index.has(key)) {
51
- continue;
52
- }
53
- const declarationLine = (0, sequenceDeclaration_1.findSequenceDeclarationLine)(lines, seq.startLine, seq.endLine);
54
- const entry = {
55
- filePath,
56
- sequenceName: seq.name,
57
- declarationLine,
58
- startLine: declarationLine,
59
- endLine: seq.endLine
60
- };
61
- index.set(key, entry);
62
- }
63
- }
64
- /**
65
- * Builds a sequence location index for root file and imported sequence sources.
66
- */
67
- async function buildSequenceLocationIndex(rootFilePath, importedSequenceSources, readFile = (p) => fs.readFile(p, 'utf-8')) {
68
- const index = new Map();
69
- const visited = new Set();
70
- await indexFile(rootFilePath, index, readFile, visited);
71
- const importedFiles = new Set(Array.from(importedSequenceSources.values()));
72
- for (const filePath of importedFiles) {
73
- await indexFile(filePath, index, readFile, visited);
74
- }
75
- return index;
76
- }
77
- //# sourceMappingURL=sequenceLocationIndex.js.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map