샘플
@xterm/xterm 5.5.0: Terminal
검증된 샘플 — npm @xterm/xterm 5.5.0: Terminal. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: Instantiating Terminal with custom cols and rows…
sha256:941221b0847df07d5d2fd50136bae1ec63115f24048c69bd71bdc2f5c208332b
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
케이스
HOW- 목표
- verify @xterm/xterm.Terminal in pkg:npm/%40xterm/xterm@5.5.0
- 심벌
-
- @xterm/xterm.Terminal
- 생성일
- 2026-08-23T15:00:29Z
컨트랙트
- Instantiating Terminal with custom cols and rows initializes the terminal buffer with the specified dimensions.
- Calling resize on Terminal updates the dimensions and fires the onResize event with the new column and row counts.
- Writing text with CRLF populates the active buffer and executes the write completion callback.
- Setting convertEol to true causes line feeds to reset cursorX to column 0 on the next row.
- Calling input on Terminal triggers the onData event listener with the provided input string.
- Calling reset on Terminal restores initial cursor positions, and calling dispose cleanly shuts down the instance.
파일
- NOTES.md
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
# @xterm/xterm Terminal Verification
## Search Results and Prior Findings
A search for prior solutions on `@xterm/xterm@5.5.0` returned `NO_SAFE_MATCH`. This sample establishes verified clean-room evidence for `@xterm/xterm.Terminal`.
## Pinned Release
- `@xterm/xterm`: `5.5.0`
## Observed Behavior
`@xterm/xterm` provides the `Terminal` class representing an xterm terminal emulator.
In Node.js / headless environments:
1. **Instantiation**: `new Terminal(options)` initializes a terminal instance with configurable dimensions (`cols`, `rows`) and options such as `convertEol`.
2. **Resizing**: `terminal.resize(cols, rows)` updates the terminal geometry and fires the `onResize` event listener.
3. **Buffer Writing**: `terminal.write(text, callback)` processes input text asynchronously, populates the active buffer (`terminal.buffer.active`), and executes the optional callback when parsing completes.
4. **EOL Conversion**: With `convertEol: true`, `\n` line feeds reset `cursorX` to column 0 on the next row.
5. **Input and Data Flow**: `terminal.input(data)` emits the `onData` event for consumers listening to user keystrokes/data input.
6. **Lifecycle**: `terminal.reset()` resets cursor state, and `terminal.dispose()` cleans up listeners and resources.
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify @xterm/xterm.Terminal in pkg:npm/%40xterm/xterm@5.5.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40xterm/xterm@5.5.0
Demonstrate these symbols/APIs:
- @xterm/xterm.Terminal
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:5c32ce90f1949d2338b7458e87a5aad6b2a1b5c15701e4e766ede7b4c83d68b3","contract":["Instantiating Terminal with custom cols and rows initializes the terminal buffer with the specified dimensions.","Calling resize on Terminal updates the dimensions and fires the onResize event with the new column and row counts.","Writing text with CRLF populates the active buffer and executes the write completion callback.","Setting convertEol to true causes line feeds to reset cursorX to column 0 on the next row.","Calling input on Terminal triggers the onData event listener with the provided input string.","Calling reset on Terminal restores initial cursor positions, and calling dispose cleanly shuts down the instance."],"goal":"verify @xterm/xterm.Terminal in pkg:npm/%40xterm/xterm@5.5.0","kind":"HOW","packages":["pkg:npm/%40xterm/xterm@5.5.0"],"schemaVersion":1,"symbols":["@xterm/xterm.Terminal"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40xterm/xterm@5.5.0"],"schemaVersion":1,"subject":"pkg:npm/%40xterm/xterm@5.5.0","symbols":["@xterm/xterm.Terminal"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-xterm-terminal-verify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-xterm-terminal-verify",
"version": "1.0.0",
"dependencies": {
"@xterm/xterm": "5.5.0"
}
},
"node_modules/@xterm/xterm": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/@xterm/xterm/-/xterm-5.5.0.tgz",
"integrity": "sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==",
"license": "MIT"
}
}
}
{
"name": "sample-xterm-terminal-verify",
"version": "1.0.0",
"type": "module",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"@xterm/xterm": "5.5.0"
}
}
{
"schemaVersion": 1,
"goal": "verify @xterm/xterm.Terminal in pkg:npm/%40xterm/xterm@5.5.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40xterm/xterm@5.5.0"
],
"symbols": [
"@xterm/xterm.Terminal"
]
}
import assert from 'node:assert/strict';
import xtermModule from '@xterm/xterm';
// In Node ESM, @xterm/xterm exports { default: { Terminal } }
const { Terminal } = xtermModule.default || xtermModule;
assert.equal(typeof Terminal, 'function', 'Terminal constructor must be exported');
async function runTests() {
// 1. Instantiating Terminal with custom cols/rows creates a buffer with matching dimensions
const term = new Terminal({ cols: 100, rows: 30, convertEol: true });
assert.equal(term.cols, 100, 'Terminal columns must match configuration');
assert.equal(term.rows, 30, 'Terminal rows must match configuration');
assert.equal(term.buffer.active.type, 'normal', 'Default active buffer type must be normal');
assert.equal(term.buffer.active.cursorX, 0, 'Initial cursor X must be 0');
assert.equal(term.buffer.active.cursorY, 0, 'Initial cursor Y must be 0');
// 2. resize() updates cols and rows and triggers onResize listener
let resized = false;
const resizeDisposable = term.onResize(({ cols, rows }) => {
resized = true;
assert.equal(cols, 80);
assert.equal(rows, 24);
});
term.resize(80, 24);
assert.equal(term.cols, 80, 'Terminal columns must update on resize');
assert.equal(term.rows, 24, 'Terminal rows must update on resize');
assert.equal(resized, true, 'onResize event listener must have fired');
resizeDisposable.dispose();
// 3. write() with callback populates active buffer and translates lines correctly
await new Promise((resolve) => {
term.write('Hello, CodeSampleX Terminal!\r\nLine 2', () => {
resolve();
});
});
const line0 = term.buffer.active.getLine(0);
assert.ok(line0, 'Line 0 must exist in active buffer');
assert.equal(line0.translateToString(true), 'Hello, CodeSampleX Terminal!', 'Line 0 content must match written string');
const line1 = term.buffer.active.getLine(1);
assert.ok(line1, 'Line 1 must exist in active buffer');
assert.equal(line1.translateToString(true), 'Line 2', 'Line 1 content must match written string');
// 4. convertEol option resets cursorX to 0 on line feed (\n)
await new Promise((resolve) => {
term.write('\nLine 3', () => {
resolve();
});
});
const line2 = term.buffer.active.getLine(2);
assert.ok(line2, 'Line 2 must exist in active buffer');
assert.equal(line2.translateToString(true), 'Line 3', 'convertEol must place text at column 0');
// 5. input() triggers onData event listener
let receivedData = '';
const dataDisposable = term.onData((data) => {
receivedData += data;
});
term.input('user command input');
assert.equal(receivedData, 'user command input', 'onData must receive input string');
dataDisposable.dispose();
// 6. Reset / clear resets buffer
term.reset();
assert.equal(term.buffer.active.cursorX, 0, 'Cursor X must be 0 after reset');
assert.equal(term.buffer.active.cursorY, 0, 'Cursor Y must be 0 after reset');
// 7. Dispose cleans up terminal
term.dispose();
}
await runTests();
오리진 시더
익명