{"_id":"@airtrafficcontrol/core","name":"@airtrafficcontrol/core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@airtrafficcontrol/core","version":"0.1.0","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","dependencies":{"@airtrafficcontrol/types":"0.0.1","@airtrafficcontrol/validation":"0.0.1","@airtrafficcontrol/errors":"0.0.1"},"scripts":{"clean:shadow":"rm -f scripts/contributors.js scripts/contributors.js.map scripts/contributors.d.ts scripts/contributors.d.ts.map","prebuild":"pnpm clean:shadow && codegen:contributors","build":"tsc --build","codegen:contributors":"tsx scripts/contributors.ts"},"_id":"@airtrafficcontrol/core@0.1.0","description":"Runtime implementation of the ATC system. Provides pure functions for craft creation, lifecycle transitions, black box management, controls protocol, and flight plan navigation. All functions are immutable — they return new objects rather than mutating in","_integrity":"sha512-BjgntnkPHUHGYXVsESxCmCDGMBe+CbaVDij2FZKwF3WTe5eXC3wNkxFSdZ0Vw2NfOZ/RJyoCxHsiQzKVWyT0RA==","_resolved":"/private/var/folders/n5/tzqmrds50218kyrpz8166v3w0000gn/T/41b02c5379136f282c2fc27536a27ed6/airtrafficcontrol-core-0.1.0.tgz","_from":"file:airtrafficcontrol-core-0.1.0.tgz","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-BjgntnkPHUHGYXVsESxCmCDGMBe+CbaVDij2FZKwF3WTe5eXC3wNkxFSdZ0Vw2NfOZ/RJyoCxHsiQzKVWyT0RA==","shasum":"9c1661d72bc32ca56aeaa3d2f54ac9ad1d2d3bf3","tarball":"https://registry.npmjs.org/@airtrafficcontrol/core/-/core-0.1.0.tgz","fileCount":55,"unpackedSize":136176,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD4PoX2HNYtyo7Enbj+pWzaMWVnMntcuQ7oxuSwpvabWwIhAN8B/9nmVlm2LcdPCrSQv4by4p8dAU4BAt+/+n10aNyB"}]},"_npmUser":{"name":"mfoulks200","email":"mfoulks1@gmail.com"},"directories":{},"maintainers":[{"name":"mfoulks200","email":"mfoulks1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.1.0_1776908440363_0.7160694276369075"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-23T01:40:40.244Z","0.1.0":"2026-04-23T01:40:40.514Z","modified":"2026-04-23T01:40:41.263Z"},"maintainers":[{"name":"mfoulks200","email":"mfoulks1@gmail.com"}],"description":"Runtime implementation of the ATC system. Provides pure functions for craft creation, lifecycle transitions, black box management, controls protocol, and flight plan navigation. All functions are immutable — they return new objects rather than mutating in","readme":"# @airtrafficcontrol/core\n\nRuntime implementation of the ATC system. Provides pure functions for craft creation, lifecycle transitions, black box management, controls protocol, and flight plan navigation. All functions are immutable — they return new objects rather than mutating inputs.\n\n## Installation\n\n```bash\npnpm add @airtrafficcontrol/core\n```\n\nThis is an internal workspace package (`workspace:*`).\n\n## API Reference\n\n### Craft Creation\n\n#### `createCraft(params: CreateCraftParams): Craft`\n\nCreates a new craft, validating all `RULE-CRAFT-*` invariants. The craft is initialized in the `Taxiing` state with an empty black box and exclusive controls held by the captain.\n\nThrows `CraftError` if any required field is missing. Throws `SeatAssignmentError` if any crew member lacks the required certification.\n\nSee `RULE-CRAFT-1` through `RULE-CRAFT-5`, `RULE-LIFE-1`, `RULE-BBOX-1`, `RULE-CTRL-1`.\n\n#### `CreateCraftParams`\n\n| Property | Type | Required | Description |\n|---|---|---|---|\n| `callsign` | `string` | yes | Unique, immutable identifier |\n| `branch` | `string` | yes | Associated git branch (1:1) |\n| `cargo` | `string` | yes | Description of the change and its scope |\n| `category` | `string` | yes | Classification of change type |\n| `captain` | `Pilot` | yes | Pilot-in-command (must be certified) |\n| `firstOfficers` | `readonly Pilot[]` | no | Certified assistant pilots |\n| `jumpseaters` | `readonly Pilot[]` | no | Observer/advisor pilots |\n| `flightPlan` | `readonly Vector[]` | yes | Ordered milestones for the craft |\n\n### Lifecycle\n\n#### `transitionCraft(craft: Craft, to: CraftStatus): Craft`\n\nTransitions a craft to a new lifecycle state. Validates the transition against the `TRANSITIONS` table and checks preconditions. Returns a new `Craft` with the updated status. See `RULE-LIFE-2` through `RULE-LIFE-8`.\n\nThrows `LifecycleError` if the transition is invalid or preconditions are not met.\n\n#### `canTransition(from: CraftStatus, to: CraftStatus): boolean`\n\nChecks whether a state transition is valid. See `RULE-LIFE-2`.\n\n#### `isTerminalState(status: CraftStatus): boolean`\n\nChecks whether a status is terminal (`Landed` or `ReturnToOrigin`). See `RULE-LIFE-8`.\n\n### Black Box\n\n#### `createBlackBoxEntry(author: string, type: BlackBoxEntryType, content: string): BlackBoxEntry`\n\nCreates a new entry with the current timestamp. See `RULE-BBOX-1`, `RULE-BBOX-3`.\n\n#### `appendToBlackBox(blackBox: readonly BlackBoxEntry[], entry: BlackBoxEntry): readonly BlackBoxEntry[]`\n\nAppends an entry, returning a new array. The original is never mutated. See `RULE-BBOX-2`.\n\n### Controls\n\n#### `createInitialControls(captainId: string): ControlState`\n\nCreates the initial control state (exclusive, held by captain). See `RULE-CTRL-1`.\n\n#### `claimExclusiveControls(current: ControlState, pilotId: string, seat: SeatType): ControlState`\n\nClaims exclusive controls for a pilot. Throws `ControlsError` for Jumpseat pilots. See `RULE-CTRL-2`.\n\n#### `shareControls(areas: SharedControlArea[]): ControlState`\n\nCreates a shared control state with non-overlapping areas. Throws `ControlsError` if areas is empty or contains duplicate pilots. See `RULE-CTRL-5`.\n\n#### `isHoldingControls(controls: ControlState, pilotId: string): boolean`\n\nChecks whether a pilot currently holds controls. See `RULE-CTRL-3`.\n\n### Flight Plan\n\n#### `getNextVector(flightPlan: FlightPlan): Vector | undefined`\n\nReturns the first pending vector. See `RULE-VEC-2`.\n\n#### `reportVector(flightPlan: FlightPlan, vectorName: string): { flightPlan: FlightPlan; report: VectorReport }`\n\nReports a vector as passed. Validates ordering (no skipping). Returns the updated flight plan and a vector report. Throws `VectorError` if the vector is not found, not next in sequence, or already passed. See `RULE-VEC-2`, `RULE-VEC-3`, `RULE-VRPT-1`.\n\n#### `allVectorsPassed(flightPlan: FlightPlan): boolean`\n\nChecks whether every vector in a flight plan has been passed. See `RULE-VEC-4`.\n\n#### `createVectorReport(craftCallsign: string, vectorName: string, evidence: string): VectorReport`\n\nCreates a vector report with the current timestamp. See `RULE-VRPT-2`.\n\n## Usage\n\n```typescript\nimport {\n  createCraft,\n  transitionCraft,\n  createBlackBoxEntry,\n  appendToBlackBox,\n  claimExclusiveControls,\n  getNextVector,\n  reportVector,\n  allVectorsPassed,\n} from \"@airtrafficcontrol/core\";\nimport { CraftStatus, SeatType, BlackBoxEntryType, VectorStatus } from \"@airtrafficcontrol/types\";\n\n// Create a craft\nconst craft = createCraft({\n  callsign: \"ALPHA-1\",\n  branch: \"feat/alpha-1\",\n  cargo: \"Add user authentication\",\n  category: \"feature\",\n  captain: { identifier: \"agent-1\", certifications: [\"feature\"] },\n  flightPlan: [\n    { name: \"Design\", acceptanceCriteria: \"API schema defined\", status: VectorStatus.Pending },\n    { name: \"Implement\", acceptanceCriteria: \"All endpoints working\", status: VectorStatus.Pending },\n  ],\n});\n\n// Transition to InFlight\nconst inFlight = transitionCraft(craft, CraftStatus.InFlight);\n\n// Log a decision\nconst entry = createBlackBoxEntry(\"agent-1\", BlackBoxEntryType.Decision, \"Using JWT for auth tokens\");\nconst updated = { ...inFlight, blackBox: appendToBlackBox(inFlight.blackBox, entry) };\n```\n\n## Dependencies\n\n| Package | Purpose |\n|---|---|\n| `@airtrafficcontrol/types` | Domain types and enums |\n| `@airtrafficcontrol/errors` | Error classes for rule violations |\n| `@airtrafficcontrol/validation` | Crew certification validation |\n\n## Related Packages\n\n- [`@airtrafficcontrol/types`](../types/) — Type definitions consumed by this package\n- [`@airtrafficcontrol/errors`](../errors/) — Error classes thrown by this package\n- [`@airtrafficcontrol/validation`](../validation/) — Validation functions used during craft creation\n- [`@airtrafficcontrol/tower`](../tower/) — Merge coordination consuming craft state\n- [`@airtrafficcontrol/daemon`](../daemon/) — Long-running process that orchestrates core operations\n","readmeFilename":"README.md","_rev":"1-0323dc60c25eeb1fdcc542cd4ef79e39"}