{"_id":"@agent-foundry/replay","_rev":"2-bf9fb40a8020e42c502ce4ac905ddd8d","name":"@agent-foundry/replay","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@agent-foundry/replay","version":"1.0.0","keywords":["agent-foundry","replay","typescript","types","schema","manifest","game-replay"],"author":{"name":"Agent Foundry"},"license":"MIT","_id":"@agent-foundry/replay@1.0.0","maintainers":[{"name":"agentfoundry","email":"qwen.wenquan@gmail.com"}],"dist":{"shasum":"2291efdf1354f5ab8a5a7c80f425e08e5bd66d92","tarball":"https://registry.npmjs.org/@agent-foundry/replay/-/replay-1.0.0.tgz","fileCount":17,"integrity":"sha512-AZolN+fZax8JpneTVg2zMHc8d1fn/y6dihT9R2KUdChTVKMbYjpAxVjf20DYlRd2QRCT1Hra54NzysUfz/szlQ==","signatures":[{"sig":"MEUCIQDJVOTC/rOX2snDOhgid2NNY9r9Zb1tbZC1tzhEEPuqHAIgZHI6dF+Vn1yK9Osabm7UFnbqEnlWkvrU7YIfauzwJQQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23946},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"211ae309545ed6e377dba9885ea87dcbd3bcc52a","scripts":{"dev":"tsc --watch","build":"tsc","clean":"rimraf dist","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"agentfoundry","email":"qwen.wenquan@gmail.com"},"_npmVersion":"11.6.2","description":"TypeScript type definitions for Agent Foundry replay manifest schema","directories":{},"_nodeVersion":"25.2.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.5","typescript":"^5.3.3"},"_npmOperationalInternal":{"tmp":"tmp/replay_1.0.0_1768312789261_0.035635540119810516","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@agent-foundry/replay","version":"1.0.1","description":"TypeScript type definitions for Agent Foundry replay manifest schema","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","dev":"tsc --watch","clean":"rimraf dist","prepublishOnly":"npm run clean && npm run build"},"keywords":["agent-foundry","replay","typescript","types","schema","manifest","game-replay"],"author":{"name":"Agent Foundry"},"license":"MIT","devDependencies":{"typescript":"^5.3.3","rimraf":"^5.0.5"},"publishConfig":{"access":"public"},"gitHead":"1454060d79d4f5bf22315072cdcebf0f8fc94231","_id":"@agent-foundry/replay@1.0.1","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-MuwVyVpsLBd2MJOVcZglzPU12dakaBssomLCvrr/Co3P6TDO77lhbSCLoSIikpnEHqs4TTBaIiDVH5Xm5JcovQ==","shasum":"b7231c7078d02050c8469be789fded425a3fcd93","tarball":"https://registry.npmjs.org/@agent-foundry/replay/-/replay-1.0.1.tgz","fileCount":17,"unpackedSize":25556,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGombuWY+CW6zFXpNQrzeiTWPzlS0BbexYlkh2O2yoyYAiBD5ClBPc4xFNKf8YK68YfLKQC66je0W7kZvmdxzkKpRw=="}]},"_npmUser":{"name":"agentfoundry","email":"qwen.wenquan@gmail.com"},"directories":{},"maintainers":[{"name":"agentfoundry","email":"qwen.wenquan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/replay_1.0.1_1768358003047_0.6679034129127219"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-13T13:59:49.177Z","modified":"2026-01-14T02:33:23.315Z","1.0.0":"2026-01-13T13:59:49.396Z","1.0.1":"2026-01-14T02:33:23.202Z"},"author":{"name":"Agent Foundry"},"license":"MIT","keywords":["agent-foundry","replay","typescript","types","schema","manifest","game-replay"],"description":"TypeScript type definitions for Agent Foundry replay manifest schema","maintainers":[{"name":"agentfoundry","email":"qwen.wenquan@gmail.com"}],"readme":"# @agent-foundry/replay\r\n\r\nTypeScript type definitions and utilities for Agent Foundry replay manifest schema.\r\n\r\n## Overview\r\n\r\nThis package provides TypeScript type definitions for the replay manifest schema used in Agent Foundry applications. It includes all necessary types for creating, validating, and working with replay data structures.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @agent-foundry/replay\r\n```\r\n\r\n```bash\r\nyarn add @agent-foundry/replay\r\n```\r\n\r\n```bash\r\npnpm add @agent-foundry/replay\r\n```\r\n\r\n## Usage\r\n\r\n### Basic Import\r\n\r\n```typescript\r\nimport type { ReplayManifestV1 } from '@agent-foundry/replay';\r\n```\r\n\r\n### Type Definitions\r\n\r\nThe package exports the following main types:\r\n\r\n#### `ReplayManifestV1`\r\n\r\nThe main replay manifest interface containing all game session data:\r\n\r\n```typescript\r\nimport type { ReplayManifestV1 } from '@agent-foundry/replay';\r\n\r\nconst manifest: ReplayManifestV1 = {\r\n  schema: 'lifeRestart.replay.v1',\r\n  gameId: 'lr-abc123-def456',\r\n  gameVersion: '1.0.0',\r\n  createdAt: '2024-01-01T00:00:00.000Z',\r\n  language: 'en-us',\r\n  seed: 12345,\r\n  dataHash: 'abc123...',\r\n  inputs: {\r\n    selectedTalents: [1, 2, 3],\r\n    propertyAllocation: {\r\n      CHR: 5,\r\n      INT: 5,\r\n      STR: 5,\r\n      MNY: 5,\r\n      SPR: 5,\r\n    },\r\n  },\r\n  timeline: [/* ... */],\r\n  highlights: [/* ... */],\r\n  summary: {/* ... */},\r\n};\r\n```\r\n\r\n#### Supporting Types\r\n\r\n- `PropertySnapshot` - Property values at a point in time\r\n- `PropertyEffectsRecord` - Property changes applied\r\n- `TimelineEntry` - Single event in the timeline\r\n- `Highlight` - Important moment marker\r\n- `GameSummary` - Final game statistics\r\n- `PlayerInputsRecord` - Player choices\r\n- `HighlightType` - Types of highlights\r\n\r\n### Utility Functions\r\n\r\nThe package includes utility functions for working with manifests:\r\n\r\n```typescript\r\nimport { ReplayManifestUtils } from '@agent-foundry/replay';\r\n\r\n// Generate a unique game ID\r\nconst gameId = ReplayManifestUtils.generateGameId();\r\n// Returns: \"lr-abc123-def456\"\r\n\r\n// Validate a manifest\r\nconst isValid = ReplayManifestUtils.validate(unknownData);\r\n// Returns: boolean\r\n\r\n// Parse from JSON string\r\nconst manifest = ReplayManifestUtils.parse(jsonString);\r\n// Returns: ReplayManifestV1\r\n\r\n// Stringify to JSON\r\nconst json = ReplayManifestUtils.stringify(manifest, true);\r\n// Returns: formatted JSON string\r\n```\r\n\r\n### Example: Validating a Manifest\r\n\r\n```typescript\r\nimport { ReplayManifestUtils } from '@agent-foundry/replay';\r\n\r\nfunction loadReplay(jsonString: string): ReplayManifestV1 {\r\n  try {\r\n    const manifest = ReplayManifestUtils.parse(jsonString);\r\n    return manifest;\r\n  } catch (error) {\r\n    console.error('Invalid replay manifest:', error);\r\n    throw error;\r\n  }\r\n}\r\n```\r\n\r\n### Example: Creating a Manifest\r\n\r\n```typescript\r\nimport type { ReplayManifestV1 } from '@agent-foundry/replay';\r\nimport { ReplayManifestUtils } from '@agent-foundry/replay';\r\n\r\nfunction createManifest(): ReplayManifestV1 {\r\n  return {\r\n    schema: 'lifeRestart.replay.v1',\r\n    gameId: ReplayManifestUtils.generateGameId(),\r\n    gameVersion: '1.0.0',\r\n    createdAt: new Date().toISOString(),\r\n    language: 'en-us',\r\n    seed: Math.floor(Math.random() * 1000000),\r\n    dataHash: '',\r\n    inputs: {\r\n      selectedTalents: [],\r\n      propertyAllocation: {\r\n        CHR: 0,\r\n        INT: 0,\r\n        STR: 0,\r\n        MNY: 0,\r\n        SPR: 0,\r\n      },\r\n    },\r\n    timeline: [],\r\n    highlights: [],\r\n    summary: {\r\n      finalAge: 0,\r\n      rating: '',\r\n      score: 0,\r\n      peakProperties: {\r\n        CHR: 0,\r\n        INT: 0,\r\n        STR: 0,\r\n        MNY: 0,\r\n        SPR: 0,\r\n      },\r\n      totalEvents: 0,\r\n      highlightsCount: 0,\r\n      duration: 0,\r\n    },\r\n  };\r\n}\r\n```\r\n\r\n## Type Definitions\r\n\r\n### ReplayManifestV1\r\n\r\nThe complete replay manifest structure:\r\n\r\n```typescript\r\ninterface ReplayManifestV1 {\r\n  schema: 'lifeRestart.replay.v1';\r\n  gameId: string;\r\n  gameVersion: string;\r\n  createdAt: string;\r\n  language: string;\r\n  seed: number;\r\n  dataHash: string;\r\n  inputs: PlayerInputsRecord;\r\n  timeline: TimelineEntry[];\r\n  highlights: Highlight[];\r\n  summary: GameSummary;\r\n}\r\n```\r\n\r\n### TimelineEntry\r\n\r\nA single event in the game timeline:\r\n\r\n```typescript\r\ninterface TimelineEntry {\r\n  age: number;\r\n  eventId: number;\r\n  description: string;\r\n  grade?: number;\r\n  effects?: PropertyEffectsRecord;\r\n  propertyDeltas: Partial<PropertySnapshot>;\r\n  propertiesAfter: PropertySnapshot;\r\n  branchEventId?: number;\r\n}\r\n```\r\n\r\n### Highlight\r\n\r\nA marker for important moments:\r\n\r\n```typescript\r\ninterface Highlight {\r\n  age: number;\r\n  type: HighlightType;\r\n  label: string;\r\n  importance: number;\r\n  eventId?: number;\r\n  metadata?: Record<string, unknown>;\r\n}\r\n```\r\n\r\n## Requirements\r\n\r\n- TypeScript 5.3.3 or higher\r\n- Node.js 18+ (for runtime usage)\r\n\r\n## License\r\n\r\nMIT\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n\r\n## Support\r\n\r\n- [GitHub Issues](https://github.com/agent-foundry/replay/issues)\r\n- [Documentation](https://github.com/agent-foundry/replay#readme)\r\n\r\n## Publishing\r\n\r\n### Prerequisites\r\n\r\n1. Ensure you have an npm account and are logged in:\r\n   ```bash\r\n   npm login\r\n   ```\r\n\r\n2. Verify you have access to the `@agent-foundry` organization on npm.\r\n\r\n### Release Steps\r\n\r\n1. **Update version** in `package.json`:\r\n   ```bash\r\n   # For patch version (1.0.0 -> 1.0.1)\r\n   npm version patch\r\n   \r\n   # For minor version (1.0.0 -> 1.1.0)\r\n   npm version minor\r\n   \r\n   # For major version (1.0.0 -> 2.0.0)\r\n   npm version major\r\n   ```\r\n\r\n2. **Build the package** (automatically runs via `prepublishOnly` script):\r\n   ```bash\r\n   npm run build\r\n   ```\r\n\r\n3. **Verify the build output**:\r\n   ```bash\r\n   ls -la dist/\r\n   ```\r\n\r\n4. **Publish to npm**:\r\n   ```bash\r\n   npm publish\r\n   ```\r\n   \r\n   The `prepublishOnly` script will automatically:\r\n   - Clean the `dist` directory\r\n   - Build the TypeScript files\r\n   - Ensure only the correct files are published (as specified in `package.json` `files` field)\r\n\r\n5. **Verify the publication**:\r\n   ```bash\r\n   npm view @agent-foundry/replay\r\n   ```\r\n\r\n### Notes\r\n\r\n- The package is configured with `\"access\": \"public\"` in `publishConfig`, so scoped packages are published publicly\r\n- Only files specified in the `files` field (`dist`, `src`, `README.md`) will be included in the published package\r\n- The `prepublishOnly` hook ensures the package is always built before publishing\r\n\r\n## Version History\r\n\r\n### 1.0.0\r\n\r\n- Initial release\r\n- TypeScript type definitions for replay manifest schema\r\n- Utility functions for manifest validation and parsing\r\n","readmeFilename":"README.md"}