@ryuenn3123/agentic-senior-core 2.0.12 → 2.0.13

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/.cursorrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTIC-SENIOR-CORE DYNAMIC GOVERNANCE RULESET
2
2
 
3
- Generated by Agentic-Senior-Core CLI v2.0.12
3
+ Generated by Agentic-Senior-Core CLI v2.0.13
4
4
  Timestamp: 2026-04-08T14:58:53.570Z
5
5
  Selected profile: beginner
6
6
  Selected policy file: .agent-context/policies/llm-judge-threshold.json
package/.windsurfrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTIC-SENIOR-CORE DYNAMIC GOVERNANCE RULESET
2
2
 
3
- Generated by Agentic-Senior-Core CLI v2.0.12
3
+ Generated by Agentic-Senior-Core CLI v2.0.13
4
4
  Timestamp: 2026-04-08T14:58:53.570Z
5
5
  Selected profile: beginner
6
6
  Selected policy file: .agent-context/policies/llm-judge-threshold.json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "type": "module",
5
5
  "description": "Force your AI Agent to code like a Staff Engineer, not a Junior.",
6
6
  "bin": {
@@ -67,32 +67,10 @@ const TOOL_DEFINITIONS = [
67
67
 
68
68
  let incomingBuffer = Buffer.alloc(0);
69
69
 
70
- function findHeaderTerminator(buffer) {
71
- const crlfHeaderEndIndex = buffer.indexOf('\r\n\r\n');
72
- if (crlfHeaderEndIndex !== -1) {
73
- return {
74
- headerEndIndex: crlfHeaderEndIndex,
75
- delimiterLength: 4,
76
- lineSeparator: '\r\n',
77
- };
78
- }
79
-
80
- const lfHeaderEndIndex = buffer.indexOf('\n\n');
81
- if (lfHeaderEndIndex !== -1) {
82
- return {
83
- headerEndIndex: lfHeaderEndIndex,
84
- delimiterLength: 2,
85
- lineSeparator: '\n',
86
- };
87
- }
88
-
89
- return null;
90
- }
91
-
92
70
  function writeMessage(payload) {
93
71
  const serializedPayload = JSON.stringify(payload);
94
- const payloadLength = Buffer.byteLength(serializedPayload, 'utf8');
95
- process.stdout.write(`Content-Length: ${payloadLength}\r\n\r\n${serializedPayload}`);
72
+ // MCP standard: line-delimited JSON (no Content-Length header)
73
+ process.stdout.write(serializedPayload + '\n');
96
74
  }
97
75
 
98
76
  function sendResponse(id, result) {
@@ -291,69 +269,94 @@ async function handleRequest(requestMessage) {
291
269
  }
292
270
  }
293
271
 
294
- function readNextFramedMessage() {
295
- const headerTerminator = findHeaderTerminator(incomingBuffer);
296
- if (!headerTerminator) {
297
- return null;
272
+ function processIncomingBuffer() {
273
+ const fullContent = incomingBuffer.toString('utf8');
274
+
275
+ // Try to parse as line-delimited JSON first (modern MCP standard)
276
+ let parseMode = 'line-delimited';
277
+ let contentToProcess = fullContent;
278
+
279
+ // Check if Content-Length header is present (LSP-style for backward compatibility)
280
+ if (fullContent.includes('Content-Length:')) {
281
+ parseMode = 'content-length';
298
282
  }
299
-
300
- const { headerEndIndex, delimiterLength, lineSeparator } = headerTerminator;
301
-
302
- const rawHeader = incomingBuffer.slice(0, headerEndIndex).toString('utf8');
303
- const headerLines = rawHeader.split(lineSeparator);
304
- let contentLength = null;
305
-
306
- for (const headerLine of headerLines) {
307
- const separatorIndex = headerLine.indexOf(':');
308
- if (separatorIndex === -1) {
309
- continue;
310
- }
311
-
312
- const headerName = headerLine.slice(0, separatorIndex).trim().toLowerCase();
313
- const headerValue = headerLine.slice(separatorIndex + 1).trim();
314
-
315
- if (headerName === 'content-length') {
316
- contentLength = Number.parseInt(headerValue, 10);
317
- break;
283
+
284
+ if (parseMode === 'content-length') {
285
+ // LSP-style: Parse Content-Length headers
286
+ const headerTerminatorIndex = Math.max(
287
+ fullContent.indexOf('\r\n\r\n'),
288
+ fullContent.indexOf('\n\n')
289
+ );
290
+
291
+ if (headerTerminatorIndex === -1) {
292
+ return; // Incomplete header, wait for more data
318
293
  }
319
- }
320
-
321
- if (!Number.isFinite(contentLength) || contentLength < 0) {
322
- incomingBuffer = Buffer.alloc(0);
323
- return null;
324
- }
325
-
326
- const bodyStartIndex = headerEndIndex + delimiterLength;
327
- const frameEndIndex = bodyStartIndex + contentLength;
328
-
329
- if (incomingBuffer.length < frameEndIndex) {
330
- return null;
331
- }
332
-
333
- const rawMessage = incomingBuffer.slice(bodyStartIndex, frameEndIndex).toString('utf8');
334
- incomingBuffer = incomingBuffer.slice(frameEndIndex);
335
- return rawMessage;
336
- }
337
-
338
- function processIncomingBuffer() {
339
- while (true) {
340
- const framedMessage = readNextFramedMessage();
341
- if (framedMessage === null) {
294
+
295
+ const headerText = fullContent.slice(0, headerTerminatorIndex);
296
+ const contentLengthMatch = headerText.match(/Content-Length:\s*(\d+)/i);
297
+
298
+ if (!contentLengthMatch) {
299
+ incomingBuffer = Buffer.alloc(0);
342
300
  return;
343
301
  }
344
-
345
- let parsedRequest;
302
+
303
+ const contentLength = parseInt(contentLengthMatch[1], 10);
304
+ const headerEndLength = fullContent[headerTerminatorIndex] === '\r' ? 4 : 2;
305
+ const bodyStartIndex = headerTerminatorIndex + headerEndLength;
306
+ const bodyEndIndex = bodyStartIndex + contentLength;
307
+
308
+ if (fullContent.length < bodyEndIndex) {
309
+ return; // Body not yet complete
310
+ }
311
+
312
+ const messageBody = fullContent.slice(bodyStartIndex, bodyEndIndex);
313
+ incomingBuffer = Buffer.from(fullContent.slice(bodyEndIndex), 'utf8');
314
+
346
315
  try {
347
- parsedRequest = JSON.parse(framedMessage);
316
+ const parsedRequest = JSON.parse(messageBody);
317
+ Promise.resolve(handleRequest(parsedRequest)).catch((error) => {
318
+ if (typeof parsedRequest?.id !== 'undefined') {
319
+ sendError(parsedRequest.id, -32603, 'Internal error', String(error?.message || error));
320
+ }
321
+ });
348
322
  } catch {
349
- continue;
323
+ // Ignore parse errors
350
324
  }
351
-
352
- Promise.resolve(handleRequest(parsedRequest)).catch((error) => {
353
- if (typeof parsedRequest?.id !== 'undefined') {
354
- sendError(parsedRequest.id, -32603, 'Internal error', String(error?.message || error));
325
+
326
+ // Recursively process if there's more data
327
+ if (incomingBuffer.length > 0) {
328
+ processIncomingBuffer();
329
+ }
330
+ } else {
331
+ // Line-delimited: parse one JSON per line
332
+ const lines = fullContent.split('\n');
333
+
334
+ // Keep incomplete last line in buffer
335
+ if (fullContent.endsWith('\n')) {
336
+ incomingBuffer = Buffer.alloc(0);
337
+ } else {
338
+ const lastLine = lines.pop() || '';
339
+ incomingBuffer = Buffer.from(lastLine, 'utf8');
340
+ }
341
+
342
+ for (const line of lines) {
343
+ const trimmed = line.trim();
344
+ if (!trimmed) continue;
345
+
346
+ let parsedRequest;
347
+ try {
348
+ parsedRequest = JSON.parse(trimmed);
349
+ } catch {
350
+ // Ignore non-JSON lines
351
+ continue;
355
352
  }
356
- });
353
+
354
+ Promise.resolve(handleRequest(parsedRequest)).catch((error) => {
355
+ if (typeof parsedRequest?.id !== 'undefined') {
356
+ sendError(parsedRequest.id, -32603, 'Internal error', String(error?.message || error));
357
+ }
358
+ });
359
+ }
357
360
  }
358
361
  }
359
362