MCPcopy Create free account
hub / github.com/Noumena-Network/code / processSequence

Method processSequence

src/ink/termio/parser.ts:385–439  ·  view source on GitHub ↗
(seq: string)

Source from the content-addressed store, hash-verified

383 }
384
385 private processSequence(seq: string): Action[] {
386 const seqType = identifySequence(seq)
387
388 switch (seqType) {
389 case 'csi': {
390 const action = parseCSI(seq)
391 if (!action) return []
392 if (action.type === 'sgr') {
393 this.style = applySGR(action.params, this.style)
394 return []
395 }
396 return [action]
397 }
398
399 case 'osc': {
400 // Extract OSC content (between ESC ] and terminator)
401 let content = seq.slice(2)
402 // Remove terminator (BEL or ESC \)
403 if (content.endsWith('\x07')) {
404 content = content.slice(0, -1)
405 } else if (content.endsWith('\x1b\\')) {
406 content = content.slice(0, -2)
407 }
408
409 const action = parseOSC(content)
410 if (action) {
411 if (action.type === 'link') {
412 if (action.action.type === 'start') {
413 this.inLink = true
414 this.linkUrl = action.action.url
415 } else {
416 this.inLink = false
417 this.linkUrl = undefined
418 }
419 }
420 return [action]
421 }
422 return []
423 }
424
425 case 'esc': {
426 const escContent = seq.slice(1)
427 const action = parseEsc(escContent)
428 return action ? [action] : []
429 }
430
431 case 'ss3':
432 // SS3 sequences are typically cursor keys in application mode
433 // For output parsing, treat as unknown
434 return [{ type: 'unknown', sequence: seq }]
435
436 default:
437 return [{ type: 'unknown', sequence: seq }]
438 }
439 }
440}

Callers 1

processTokenMethod · 0.95

Calls 5

identifySequenceFunction · 0.85
parseCSIFunction · 0.85
applySGRFunction · 0.85
parseOSCFunction · 0.85
parseEscFunction · 0.85

Tested by

no test coverage detected