サンプル
@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
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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();
オリジンシーダー
匿名