{"_id":"@ah-monica/core","_rev":"8-b7396f23f7af2618e96c023adc5b74c7","name":"@ah-monica/core","dist-tags":{"latest":"0.4.1"},"versions":{"0.1.0":{"name":"@ah-monica/core","version":"0.1.0","license":"Apache-2.0","_id":"@ah-monica/core@0.1.0","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica#readme","bugs":{"url":"https://github.com/Accel-Hack/monica/issues"},"dist":{"shasum":"24907ceddff2471db2da76bf8abb8154568968e5","tarball":"https://registry.npmjs.org/@ah-monica/core/-/core-0.1.0.tgz","fileCount":11,"integrity":"sha512-sUm3E0yEK9pulAO/JaGbQl0cuAhfEcgmZL3BWQp9Abv3UAtJqAxRI2HnrPFeTJUxeCsOhLgNaf/agoUoJRXa+w==","signatures":[{"sig":"MEUCIQDBPgwEA+erLbLQ0m1Ttbw3cZ/K1BTDBu1xr4iWVJ3KJwIgHoWxTjdbFt6TPHpxbrpIs21twdRjueNdaAUX60VVQSI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29421},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","pack:check":"bun run build && bun pm pack --dry-run"},"_npmUser":{"name":"kkyosuke","email":"kawamura@accelhack.com"},"repository":{"url":"git+https://github.com/Accel-Hack/monica.git","type":"git","directory":"packages/core"},"_npmVersion":"10.9.8","description":"Runtime-neutral transport and buffering core for the MONICA SDK","directories":{},"sideEffects":false,"_nodeVersion":"22.23.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.0_1787997519725_0.09638936488851746","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@ah-monica/core","version":"0.1.2","license":"Apache-2.0","_id":"@ah-monica/core@0.1.2","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"f7055cafcef55512d1d545be061749166ea338b2","tarball":"https://registry.npmjs.org/@ah-monica/core/-/core-0.1.2.tgz","fileCount":13,"integrity":"sha512-CcFM00iwLbIzpDGeC0XJZYbB7LBaVkFtuY06BnDvXJ/2zMbvMg44ZYoTnxDGTRmbJtNFNrdYVOM6KQMTS99cnQ==","signatures":[{"sig":"MEQCIFvZ1Dc9LBuH2Pd/xGgx2nAjgF+uMDAySuvofiRsNM+BAiAb1v8pWHsz3Ikxqrp3CHYJjr/5ZvPhS0vBwsyAPYvOcw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcore@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":32340},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"fef6c6301fc29c3d036ec980c2c562c7b5f6af5d","scripts":{"test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","pack:check":"bun run build && bun pm pack --dry-run"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:422c9f6b-d106-412c-ab6c-7c77e4018d60"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"core"},"_npmVersion":"11.19.1","description":"Runtime-neutral transport and buffering core for the MONICA SDK","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/core_0.1.2_1789004412477_0.6582966726510155","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@ah-monica/core","version":"0.2.0","license":"Apache-2.0","_id":"@ah-monica/core@0.2.0","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"9c962ecc643a83eac683bcf75d65cf286a210b9c","tarball":"https://registry.npmjs.org/@ah-monica/core/-/core-0.2.0.tgz","fileCount":13,"integrity":"sha512-yh0OJPiG+bwtZ7gv7DVXnSrGBF6Xn9HvrNOQA9EZVtkeZyBy2/Vv/z/8uADt/xKS/DBdT0xgSkEZF8Mi/unaag==","signatures":[{"sig":"MEUCIQDpmD3hMAEZStzIRhfQ03dFVR9IxbaO2Nmvj3UbVRmZTwIgUJ4Gew23ANIUsEKQAE8oysOYsucvOGja2Kd09aIPrvo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcore@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":51408},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"710a43a9849dba9f1c2ce98a45652d0d59f3a91a","scripts":{"test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","pack:check":"bun run build && bun pm pack --dry-run"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:422c9f6b-d106-412c-ab6c-7c77e4018d60"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"core"},"_npmVersion":"11.19.1","description":"Runtime-neutral transport and buffering core for the MONICA SDK","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/core_0.2.0_1789034574983_0.7264426572360076","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@ah-monica/core","version":"0.2.1","license":"Apache-2.0","_id":"@ah-monica/core@0.2.1","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"d80a962f206a4e513edf77d4bb17b2cbf7bffd36","tarball":"https://registry.npmjs.org/@ah-monica/core/-/core-0.2.1.tgz","fileCount":13,"integrity":"sha512-XGhZ4eXPk05vpGeYYJh4CoT/ywF3cmY5+7gALSkl9YFRp+yeJx3dFlZ8hA95s/RykY1phxVeTawtK8UdNVwIvw==","signatures":[{"sig":"MEQCIFeAse4vmLknnS9AOaeMpfpNfcqgbeFMqo4oD0W2poklAiB2uIOe5S0t/xrBBgmD8Mi6nmfIFnVx7TOF2R/D8jxBCw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcore@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":54200},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"6ccb8fc3a6ed26a1cee976602bba04f0d5891db1","scripts":{"test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","pack:check":"bun run build && bun pm pack --dry-run"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:422c9f6b-d106-412c-ab6c-7c77e4018d60"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"core"},"_npmVersion":"11.19.1","description":"Runtime-neutral transport and buffering core for the MONICA SDK","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/core_0.2.1_1789097573898_0.10451071767262166","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@ah-monica/core","version":"0.3.0","license":"Apache-2.0","_id":"@ah-monica/core@0.3.0","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"e6a85a86bf6e43a177e291a667aaf42965966509","tarball":"https://registry.npmjs.org/@ah-monica/core/-/core-0.3.0.tgz","fileCount":13,"integrity":"sha512-T3jmPKRUjuSSNR8rrLlcDh7uyzy/DONM7Hch1UIcPg6qm3tnhiENLt5+UQSOBrKS8EEV6dwMH8RLOBS8FlEMcg==","signatures":[{"sig":"MEYCIQC7JGxoObcE2kSbXRTrspV6iwfCDKyZedwNl1NPyYcOqwIhAO5KrnRIXcypQCzQBt9Os7vKoV2FM4VG5rpXOh5RjJgI","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDGyVkF3TtcaUYE20GngPMcX+fe7Bof37+iqhD3IwpwnwIhAP2D/M3AU7gYLRO732OV6zkHhLDzPWPF/3D5jp1X3uBf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcore@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":55415},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"ff961deaf85cd3e52d04e6857044944f841bba46","scripts":{"test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","pack:check":"bun run build && bun pm pack --dry-run"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:422c9f6b-d106-412c-ab6c-7c77e4018d60"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"core"},"_npmVersion":"11.19.1","description":"Runtime-neutral transport and buffering core for the MONICA SDK","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/core_0.3.0_1790226268293_0.4324861346903781","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@ah-monica/core","version":"0.4.0","license":"Apache-2.0","_id":"@ah-monica/core@0.4.0","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"cf2ad3b0c50b2cb55260658c376bffcd5fad53de","tarball":"https://registry.npmjs.org/@ah-monica/core/-/core-0.4.0.tgz","fileCount":13,"integrity":"sha512-aNSq446cFy5A7qMgV7zNjpmsLgu/7kSRxY47RBsbIHeJnh0BcBaTYSp8zhW+L4DtocNXJXwcDxMr65x226GZWg==","signatures":[{"sig":"MEQCIAOzYf1f9OR57PeLuacbuN9UwwNafKiILrDwXZFp50kMAiA+hpHp/vllJnUKRpdE8yrcUMw5wzBhPUs984Qa4VF4CQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQC4GlTOYWHLIxvpPk0FXPV3s67rcTSdF57+4kDTna8eEwIhAJcSxkhXUAxcX8IljwsNz64pFsEVK3c+uqLZVD7B0vfA","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcore@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":65427},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"5302bc5a3a31ba74743de4015f3bc91fa66f07ce","scripts":{"test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","pack:check":"bun run build && bun pm pack --dry-run"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"422c9f6b-d106-412c-ab6c-7c77e4018d60"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"core"},"_npmVersion":"11.19.1","description":"Runtime-neutral transport and buffering core for the MONICA SDK","directories":{},"sideEffects":false,"_nodeVersion":"24.21.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/core_0.4.0_1790667507291_0.48967526066115363","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"_id":"@ah-monica/core@0.4.1","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"8ee63ff15cb57d84c06cd5298207511398b6cc2c","tarball":"https://registry.npmjs.org/@ah-monica/core/-/core-0.4.1.tgz","fileCount":13,"integrity":"sha512-w9IzhRmfdpgIFCnJ9UHytLns1g6s4t88yoYjNhnwtZxk1nFkbkmzcmddyV8G4bIvy9N8eraXeZQ+v1BY6pcqTg==","signatures":[{"sig":"MEYCIQDc/jmWFeY/vutIpp+XFC6JCGF2fxPY5y2LRAhLLbBNBgIhAIBnRpzKfG5sDaXey//axL8wTHEfbWmmixQCg1PmV8lK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGixOGg4v3No5QRTCVzoRgUkVFmy1eFShEXbdf7re6RXAiEA01VYQQNzC3I2NFeHtzZ/YSim+A1d5+FGbr211yxvH9Y="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcore@0.4.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":65427},"main":"./dist/index.js","name":"@ah-monica/core","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"cc26fcc5068f2643df9a53ca42fca233bad62f87","license":"Apache-2.0","scripts":{"test":"bun test","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","pack:check":"bun run build && bun pm pack --dry-run"},"version":"0.4.1","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"422c9f6b-d106-412c-ab6c-7c77e4018d60"}},"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"core"},"_npmVersion":"11.19.1","description":"Runtime-neutral transport and buffering core for the MONICA SDK","directories":{},"maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"sideEffects":false,"_nodeVersion":"24.21.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.4.1_1790669835700_0.9158666508388869"}}},"time":{"created":"2026-08-29T09:58:39.522Z","modified":"2026-09-29T08:17:16.156Z","0.1.0":"2026-08-29T09:58:39.872Z","0.1.2":"2026-09-10T01:40:12.623Z","0.2.0":"2026-09-10T10:02:55.107Z","0.2.1":"2026-09-11T03:32:54.047Z","0.3.0":"2026-09-24T05:04:28.377Z","0.4.0":"2026-09-29T07:38:27.391Z","0.4.1":"2026-09-29T08:17:15.786Z"},"bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"license":"Apache-2.0","homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"core"},"description":"Runtime-neutral transport and buffering core for the MONICA SDK","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"readme":"# @ah-monica/core\n\nMONICA SDK のランタイム非依存な envelope 組み立て・バッファ・送信。\n`fetch` と `CompressionStream` があるランタイムで動く。依存 package は無い。\n\nNode.js・Cloudflare Workers・Next.js では、この package を直接使わず\n[`@ah-monica/node`](../node/README.md) / [`@ah-monica/cloudflare`](../cloudflare/README.md) /\n[`@ah-monica/next`](../next/README.md) を使う。この README は、対応 adapter の無い\nランタイムに自分で載せる場合の入口をまとめる。\n\n共通の使い方・オプション・制約は [ルートの README](../README.md) にある。\n\n## インストール\n\n```bash\nnpm install @ah-monica/core\n```\n\n## 初期化\n\ntransport と client を別々に組み立てる。\n\n```ts\nimport { createCoreClient, createFetchTransport } from \"@ah-monica/core\";\n\nconst client = createCoreClient({\n  transport: createFetchTransport({\n    dsn: process.env.MONICA_DSN,\n    auth: \"secret\",\n  }),\n  environment: process.env.NODE_ENV ?? \"development\",\n  release: process.env.GIT_SHA,\n});\n```\n\n## 使い方\n\n`capture` は item をそのまま受け取る。`event_id` / `timestamp` / `environment` /\n`release` は省略すると補われる。例外から item を組み立てる処理（stacktrace の解析、\n`cause` の連鎖、mechanism の付与）は adapter 側の仕事で、この package には無い。\n\n```ts\nconst eventId = await client.capture({\n  type: \"error\",\n  platform: \"javascript\",\n  level: \"error\",\n  message: \"checkout failed\",\n  exception: {\n    values: [{ type: \"TypeError\", value: \"checkout failed\", mechanism: { type: \"generic\", handled: true } }],\n  },\n});\n\nconst result = await client.flush(2_000);\nawait client.close(2_000);\n```\n\n送信そのものを差し替える場合は `MonicaTransport`（`send(envelope, signal)` が\n`TransportResult` を返す）を実装して `transport` に渡す。`401` を返せば\n`createFetchTransport` と同じように client が停止する。受理された応答の\n`X-Monica-Presence-Interval-Ms` / `X-Monica-Presence-Sample-Rate` は、読んだままの文字列を\n`TransportResult.presence` に入れて返す（`readPresenceHeaders(response.headers)`）。\n\n## 稼働確認\n\n共通の仕組みは [ルートの README](../README.md#稼働確認) にある。core は自分からは判定しない。\nadapter が起動時や定期的に `checkPresence` を呼ぶ。\n\n`presence` を渡した client だけが送る。`checkPresence(\"start\" | \"interval\")` は\n直近の interval に `202` が無く queue が空なら `client_report` を 1 通送り、次に判定すべきまでの\nミリ秒を返す。間引きで見送った・送信に失敗した場合も、次の interval まで判定し直さない。\ninterval を数え始めた時刻（`intervalStartedAt`）と header の値は `presence.store`（既定は client\nごとのメモリ）に持つ。\n\n## オプション\n\n### `createFetchTransport(options)`\n\n| option | 型 | default | 説明 |\n| --- | --- | --- | --- |\n| `dsn` | `string \\| null` | なし | `https://<key>@<ingest-host>`。`localhost` と `127.0.0.1` 以外は https のみ。未指定・空文字なら何も送らない |\n| `auth` | `\"public\" \\| \"secret\"` | `\"secret\"` | `secret` は `Authorization: Bearer <key>`、`public` は `X-Monica-Key: <key>` |\n| `fetch` | `typeof fetch` | `globalThis.fetch` | 送信に使う fetch。無いと `Error` |\n| `maxRetries` | `number` | `5` | `429` / `5xx` / network 障害の再送回数 |\n| `requestTimeoutMs` | `number` | `2000` | 1 回の HTTP request の上限 |\n| `onDiagnostic` | `(diagnostic) => void \\| null` | `console.warn` に 1 行 | 拒否されたときの診断の受け取り先。`null` で無効 |\n\n### `createCoreClient(options)`\n\n| option | 型 | default | 説明 |\n| --- | --- | --- | --- |\n| `transport` | `MonicaTransport` | 必須 | `createFetchTransport` の戻り値か自前実装 |\n| `environment` | `string` | 必須 | 1〜128 文字。空文字は不可 |\n| `release` | `string` | なし | item の `release` に載る |\n| `sampleRate` | `number` | `1` | 0〜1 |\n| `maxQueueSize` | `number` | `100` | queue の上限。溢れると古い item から捨てる |\n| `batchSize` | `number` | `30` | 1 envelope に載せる item 数。`maxQueueSize` と 100 で頭打ち |\n| `flushIntervalMs` | `number` | `5000` | queue に item がある間の自動送信間隔 |\n| `beforeSend` | `(item, hint) => item \\| null \\| Promise<...>` | なし | `null` を返すと破棄 |\n| `sdk` | `{ name, version }` | `{ name: \"@ah-monica/core\", version: <この package の版> }` | envelope の `sdk` |\n| `now` | `() => Date` | `() => new Date()` | `timestamp` と `sent_at` に使う時刻 |\n| `random` | `() => number` | `Math.random` | `sampleRate` の判定に使う乱数 |\n| `generateEventId` | `() => string` | `crypto.randomUUID` | `event_id` の生成 |\n| `presence` | `{ platform, store?, applySampleRate? }` | なし | 稼働確認。`applySampleRate` は配布物だけ `true` |\n\n`flush(timeoutMs)` と `close(timeoutMs)` の `timeoutMs` は既定 2,000 ミリ秒。\n\n## 送信結果と診断\n\n`flush()` / `close()` が返す `FlushResult`、`onDiagnostic` に渡る `TransportDiagnostic`、\n自前 transport が返す `TransportResult` の各 field は\n[TROUBLESHOOTING.md](../TROUBLESHOOTING.md) にまとめてある。\n\n## ライセンス\n\n[Apache-2.0](LICENSE)\n","readmeFilename":"README.md"}