{
  "schemaVersion": 1,
  "slug": "ollama-js-first-run",
  "tool": {
    "name": "ollama-js",
    "repo": "ollama/ollama-js",
    "version": "0.6.4"
  },
  "environment": {
    "arch": "aarch64",
    "cpu": "Neoverse-N1 x2, CPUQuota 150%",
    "memMB": 2048,
    "os": "Ubuntu 24.04.4 LTS",
    "runtime": "Node.js 24.21.0",
    "installSeconds": 0.8,
    "installBytes": 196153
  },
  "method": {
    "hypothesis": "README 사용법: npm으로 패키지를 설치한 뒤 기본 클라이언트나 Ollama 인스턴스를 생성해 로컬 서버에 모델 목록 조회와 채팅 요청을 보낸다. 이 환경에서 확인: 오프라인 샌드박스에서 모듈 로드, 호스트 설정 초기화, 이미지 바이트 버퍼 인코딩의 동작 여부와 상주 서버가 없을 때 목록 조회·채팅 호출이 일으키는 예외 종류 및 소요 시간을 확인한다.",
    "conditions": [
      "네트워크가 차단되고 로컬 상주 서버가 실행되지 않은 격리된 오프라인 환경에서 한 번씩 호출한다.",
      "결정적 입력으로 이미지 바이트 버퍼 8바이트와 채팅 메시지 1개 및 서버 조회 요청 2건을 사용한다.",
      "클라이언트 설정 및 이미지 인코딩 성공 지표가 1개 이상 참이고 서버 미연결 요청 2건의 예외 클래스가 기록되면 확인 완료로 본다."
    ],
    "repeats": 5
  },
  "script": "import { performance } from 'node:perf_hooks';\n\nconst t0 = performance.now();\nlet mod = null;\nlet importOk = 0;\ntry {\n  mod = await import('ollama');\n  importOk = mod && (mod.Ollama || mod.default) ? 1 : 0;\n} catch (e) {\n  importOk = 0;\n}\nconst importMs = Number((performance.now() - t0).toFixed(3));\n\nconst t1 = performance.now();\nlet client = null;\nlet methodCount = 0;\nlet clientConfigOk = 0;\ntry {\n  const OllamaClass = mod.Ollama || (mod.default && mod.default.Ollama);\n  const defaultClient = mod.default || mod;\n  const proto = OllamaClass ? OllamaClass.prototype : Object.getPrototypeOf(defaultClient);\n  const names = proto ? Object.getOwnPropertyNames(proto).filter((k) => k !== 'constructor' && typeof proto[k] === 'function') : [];\n  methodCount = names.length;\n  client = OllamaClass ? new OllamaClass({ host: '127.0.0.1:11434' }) : defaultClient;\n  if (client && typeof client.abort === 'function') {\n    client.abort();\n  }\n  clientConfigOk = client && methodCount > 0 ? 1 : 0;\n} catch (e) {\n  clientConfigOk = 0;\n}\nconst clientConfigMs = Number((performance.now() - t1).toFixed(3));\n\nconst t2 = performance.now();\nlet encodeImageChars = 0;\nlet encodeImageOk = 0;\ntry {\n  const pngHeader = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);\n  const encoded = await client.encodeImage(pngHeader);\n  encodeImageChars = typeof encoded === 'string' ? encoded.length : 0;\n  encodeImageOk = encoded === pngHeader.toString('base64') && encodeImageChars > 0 ? 1 : 0;\n} catch (e) {\n  encodeImageOk = 0;\n}\nconst encodeImageMs = Number((performance.now() - t2).toFixed(3));\n\nconst t3 = performance.now();\nlet listOk = 0;\nlet listErr = 'none';\ntry {\n  const res = await client.list();\n  listOk = res && Array.isArray(res.models) ? 1 : 0;\n} catch (e) {\n  listOk = 0;\n  listErr = e && e.constructor && typeof e.constructor.name === 'string' && !e.constructor.name.includes('<') ? e.constructor.name : 'Error';\n}\nconst listMs = Number((performance.now() - t3).toFixed(3));\n\nconst t4 = performance.now();\nlet chatOk = 0;\nlet chatErr = 'none';\ntry {\n  const res = await client.chat({\n    model: 'llama3.2',\n    messages: [{ role: 'user', content: 'ping' }],\n    stream: false\n  });\n  chatOk = res && res.message ? 1 : 0;\n} catch (e) {\n  chatOk = 0;\n  chatErr = e && e.constructor && typeof e.constructor.name === 'string' && !e.constructor.name.includes('<') ? e.constructor.name : 'Error';\n}\nconst chatMs = Number((performance.now() - t4).toFixed(3));\n\nconsole.log(JSON.stringify({\n  importMs,\n  importOk,\n  clientConfigMs,\n  methodCount,\n  clientConfigOk,\n  encodeImageMs,\n  encodeImageChars,\n  encodeImageOk,\n  listMs,\n  listOk,\n  listErr,\n  chatMs,\n  chatOk,\n  chatErr\n}));",
  "scriptSha256": "76acfb8bf24749d2be240d82719b505f63031f336ab9dd9279f629d8352514f7",
  "runs": [
    {
      "run": 1,
      "importMs": 9.92,
      "importOk": 1,
      "clientConfigMs": 0.088,
      "methodCount": 3,
      "clientConfigOk": 1,
      "encodeImageMs": 0.057,
      "encodeImageChars": 12,
      "encodeImageOk": 1,
      "listMs": 49.918,
      "listOk": 0,
      "listErr": "TypeError",
      "chatMs": 6.701,
      "chatOk": 0,
      "chatErr": "TypeError",
      "wallMs": 167.082
    },
    {
      "run": 2,
      "importMs": 9.79,
      "importOk": 1,
      "clientConfigMs": 0.088,
      "methodCount": 3,
      "clientConfigOk": 1,
      "encodeImageMs": 0.067,
      "encodeImageChars": 12,
      "encodeImageOk": 1,
      "listMs": 46.581,
      "listOk": 0,
      "listErr": "TypeError",
      "chatMs": 4.567,
      "chatOk": 0,
      "chatErr": "TypeError",
      "wallMs": 164.992
    },
    {
      "run": 3,
      "importMs": 10.496,
      "importOk": 1,
      "clientConfigMs": 0.099,
      "methodCount": 3,
      "clientConfigOk": 1,
      "encodeImageMs": 0.059,
      "encodeImageChars": 12,
      "encodeImageOk": 1,
      "listMs": 43.18,
      "listOk": 0,
      "listErr": "TypeError",
      "chatMs": 4.312,
      "chatOk": 0,
      "chatErr": "TypeError",
      "wallMs": 167.648
    },
    {
      "run": 4,
      "importMs": 10.758,
      "importOk": 1,
      "clientConfigMs": 0.087,
      "methodCount": 3,
      "clientConfigOk": 1,
      "encodeImageMs": 0.057,
      "encodeImageChars": 12,
      "encodeImageOk": 1,
      "listMs": 42.424,
      "listOk": 0,
      "listErr": "TypeError",
      "chatMs": 4.398,
      "chatOk": 0,
      "chatErr": "TypeError",
      "wallMs": 165.918
    },
    {
      "run": 5,
      "importMs": 10.805,
      "importOk": 1,
      "clientConfigMs": 0.121,
      "methodCount": 3,
      "clientConfigOk": 1,
      "encodeImageMs": 0.064,
      "encodeImageChars": 12,
      "encodeImageOk": 1,
      "listMs": 42.078,
      "listOk": 0,
      "listErr": "TypeError",
      "chatMs": 4.098,
      "chatOk": 0,
      "chatErr": "TypeError",
      "wallMs": 165.904
    }
  ],
  "summary": {
    "importMs": {
      "median": 10.496,
      "min": 9.79,
      "max": 10.805,
      "unit": "ms"
    },
    "importOk": {
      "median": 1,
      "min": 1,
      "max": 1,
      "unit": "flag"
    },
    "clientConfigMs": {
      "median": 0.088,
      "min": 0.087,
      "max": 0.121,
      "unit": "ms"
    },
    "methodCount": {
      "median": 3,
      "min": 3,
      "max": 3,
      "unit": "count"
    },
    "clientConfigOk": {
      "median": 1,
      "min": 1,
      "max": 1,
      "unit": "flag"
    },
    "encodeImageMs": {
      "median": 0.059,
      "min": 0.057,
      "max": 0.067,
      "unit": "ms"
    },
    "encodeImageChars": {
      "median": 12,
      "min": 12,
      "max": 12,
      "unit": "chars"
    },
    "encodeImageOk": {
      "median": 1,
      "min": 1,
      "max": 1,
      "unit": "flag"
    },
    "listMs": {
      "median": 43.18,
      "min": 42.078,
      "max": 49.918,
      "unit": "ms"
    },
    "listOk": {
      "median": 0,
      "min": 0,
      "max": 0,
      "unit": "flag"
    },
    "chatMs": {
      "median": 4.398,
      "min": 4.098,
      "max": 6.701,
      "unit": "ms"
    },
    "chatOk": {
      "median": 0,
      "min": 0,
      "max": 0,
      "unit": "flag"
    }
  },
  "createdAt": "2026-11-10T01:34:32Z"
}
