{"_id":"@bernierllc/onboarding-config-core","_rev":"3-d923feb42dbd002aae02ca3dd81eb492","name":"@bernierllc/onboarding-config-core","dist-tags":{"latest":"0.2.1"},"versions":{"0.0.1":{"name":"@bernierllc/onboarding-config-core","version":"0.0.1","keywords":["oidc","trusted-publishing","setup"],"_id":"@bernierllc/onboarding-config-core@0.0.1","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"dist":{"shasum":"6357763fe54199203ced62f6588eb3f01dd457ae","tarball":"https://registry.npmjs.org/@bernierllc/onboarding-config-core/-/onboarding-config-core-0.0.1.tgz","fileCount":2,"integrity":"sha512-XKl1ht0FCOEGLjrDj0r1oK3jEItmf0tm4DK5jSTnjhPkdVaDB0bBzrXZ2U6qY0sLR4rRgbkpoewTn1RV9ciAgQ==","signatures":[{"sig":"MEYCIQCIDVAfA7Teug0EXCCaqBEDPu1Xiklx/L+tGY3trICp4gIhAJfPrgpL4SG/U6y5LGZtXbx8O7K0WymP1UfRWhnK6oas","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2099},"_npmUser":{"name":"mkbernier","email":"mkbernier@gmail.com"},"_npmVersion":"11.12.1","description":"OIDC trusted publishing setup package for @bernierllc/onboarding-config-core","directories":{},"_nodeVersion":"25.9.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/onboarding-config-core_0.0.1_1781634193348_0.48104514615173977","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@bernierllc/onboarding-config-core","version":"0.2.0","keywords":["onboarding","config","schema","ai","agent","prompt-compiler","bernierllc"],"author":{"name":"Bernier LLC"},"license":"Bernier LLC","_id":"@bernierllc/onboarding-config-core@0.2.0","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"homepage":"https://github.com/bernierllc/tools#readme","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"dist":{"shasum":"988517a3e12dde797b3f23d5d12ee105e6cc32b9","tarball":"https://registry.npmjs.org/@bernierllc/onboarding-config-core/-/onboarding-config-core-0.2.0.tgz","fileCount":31,"integrity":"sha512-6//M8tGzy0JpGJLvA7PYsFig4oVPhZ56U6weaRQ5Sc5DJnjfbWNWBtrRNPy5RGlTtaFbfThu7BW77xAttjMO1A==","signatures":[{"sig":"MEUCIQDnNLsN7TuMayyDGY9JYPwCoXpa+tIMrCG5NNH7lPqQ4wIgGsnHIgrya/99PHOhvvrmDNbkkJedDKc92XFZRgjaCRY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":83837},"main":"dist/index.js","_from":"file:bernierllc-onboarding-config-core-0.2.0.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"lint":"eslint src/**/*.ts","test":"jest","build":"tsc","clean":"rm -rf dist","prebuild":"npm run clean","test:run":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fe3165e8-e47b-4359-af35-426ead8c8e90"}},"_resolved":"/home/runner/work/tools/tools/packages/core/onboarding-config-core/bernierllc-onboarding-config-core-0.2.0.tgz","_integrity":"sha512-6//M8tGzy0JpGJLvA7PYsFig4oVPhZ56U6weaRQ5Sc5DJnjfbWNWBtrRNPy5RGlTtaFbfThu7BW77xAttjMO1A==","repository":{"url":"git+https://github.com/bernierllc/tools.git","type":"git","directory":"packages/core/onboarding-config-core"},"_npmVersion":"11.17.0","description":"Typed onboarding configuration schema, validation, builder, and system-prompt compiler for goal-directed conversational agents.","directories":{},"_nodeVersion":"24.16.0","dependencies":{"@bernierllc/logger":"1.7.0","@bernierllc/schema-validator":"3.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.0.0","rimraf":"^5.0.0","ts-jest":"^29.1.2","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/node":"^20.11.19"},"_npmOperationalInternal":{"tmp":"tmp/onboarding-config-core_0.2.0_1781801854172_0.858984265389102","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@bernierllc/onboarding-config-core","version":"0.2.1","description":"Typed onboarding configuration schema, validation, builder, and system-prompt compiler for goal-directed conversational agents.","main":"dist/index.js","types":"dist/index.d.ts","keywords":["onboarding","config","schema","ai","agent","prompt-compiler","bernierllc"],"author":{"name":"Bernier LLC"},"license":"Bernier LLC","repository":{"type":"git","url":"git+https://github.com/bernierllc/tools.git","directory":"packages/core/onboarding-config-core"},"dependencies":{"@bernierllc/logger":"1.7.1","@bernierllc/schema-validator":"3.0.0"},"devDependencies":{"@types/jest":"^29.5.12","@types/node":"^20.11.19","eslint":"^8.0.0","jest":"^29.7.0","rimraf":"^5.0.0","ts-jest":"^29.1.2","typescript":"^5.3.3"},"engines":{"node":">=18.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"build":"tsc","test":"jest","test:watch":"jest --watch","test:run":"jest","test:coverage":"jest --coverage","lint":"eslint src/**/*.ts","clean":"rm -rf dist","prebuild":"npm run clean"},"_id":"@bernierllc/onboarding-config-core@0.2.1","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"homepage":"https://github.com/bernierllc/tools#readme","_integrity":"sha512-HOIVYHnQTvup5a6h/ndYnFog8Zes9/gAeHSXb3iEyknM9RcMQXIIK0XeP7xXYo8QGEtDuuBsmZH1+HO8iQjk6A==","_resolved":"/home/runner/work/tools/tools/packages/core/onboarding-config-core/bernierllc-onboarding-config-core-0.2.1.tgz","_from":"file:bernierllc-onboarding-config-core-0.2.1.tgz","_nodeVersion":"24.18.0","_npmVersion":"12.0.1","dist":{"integrity":"sha512-HOIVYHnQTvup5a6h/ndYnFog8Zes9/gAeHSXb3iEyknM9RcMQXIIK0XeP7xXYo8QGEtDuuBsmZH1+HO8iQjk6A==","shasum":"50259a0d472bfe5c95be421a616dde6e446a0ebb","tarball":"https://registry.npmjs.org/@bernierllc/onboarding-config-core/-/onboarding-config-core-0.2.1.tgz","fileCount":31,"unpackedSize":83837,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGvDPA1On5n1B6srqhvvj9umiFAv/+kquCUo5MqiXlZ5AiBQATcp9x2+MXQknHB1NUOQerGq3UNPONAvnDl/ikD/kA=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fe3165e8-e47b-4359-af35-426ead8c8e90"}},"directories":{},"maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/onboarding-config-core_0.2.1_1784015669132_0.012379035571519204"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-16T18:23:13.158Z","modified":"2026-07-14T07:54:29.406Z","0.0.1":"2026-06-16T18:23:13.476Z","0.2.0":"2026-06-18T16:57:34.291Z","0.2.1":"2026-07-14T07:54:29.259Z"},"bugs":{"url":"https://github.com/bernierllc/tools/issues"},"author":{"name":"Bernier LLC"},"license":"Bernier LLC","homepage":"https://github.com/bernierllc/tools#readme","keywords":["onboarding","config","schema","ai","agent","prompt-compiler","bernierllc"],"repository":{"type":"git","url":"git+https://github.com/bernierllc/tools.git","directory":"packages/core/onboarding-config-core"},"description":"Typed onboarding configuration schema, validation, builder, and system-prompt compiler for goal-directed conversational agents.","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"readme":"# @bernierllc/onboarding-config-core\n\nTyped onboarding configuration schema, validation, builder, and system-prompt compiler for goal-directed conversational agents.\n\n## Overview\n\nThis package provides the canonical data layer for conversational onboarding agents:\n\n- **Schema and validation** — typed `OnboardingConfig` interfaces validated via `@bernierllc/schema-validator`\n- **Fluent builder** — `OnboardingConfigBuilder` for constructing configs programmatically\n- **System-prompt compiler** — `compileSystemPrompt()` turns config + state into the prose an LLM receives\n- **Returning-user context** — `injectReturningUserContext()` skips already-answered goals\n- **Goal evaluator** — `evaluateGoals()` determines which goals are met and whether completion criteria are satisfied\n\n## Installation\n\n```bash\nnpm install @bernierllc/onboarding-config-core\n```\n\n## Quick start\n\n```typescript\nimport {\n  OnboardingConfigBuilder,\n  compileSystemPrompt,\n  evaluateGoals,\n} from '@bernierllc/onboarding-config-core';\n\nconst config = new OnboardingConfigBuilder('contractor-onboarding')\n  .setPersona({\n    tone: 'warm-casual',\n    greeting: \"Hey! Let's get {{appName}} set up in a few quick steps.\",\n    askOneAtATime: true,\n    returningUserPrompt:\n      'The user has already completed: {{completedGoals}}. Skip those; pick up where they left off.',\n  })\n  .addPhase({ id: 'basics', title: 'Getting Started',    guidance: 'Start with business name and type of work.', order: 1 })\n  .addPhase({ id: 'services', title: 'Services',         guidance: 'Ask what services they offer, one at a time.', order: 2 })\n  .addPhase({ id: 'wrap-up', title: 'Wrapping Up',       guidance: 'Confirm everything, mention next steps.', order: 3 })\n  .addGoal({\n    id: 'business-name',\n    description: 'Business name collected',\n    required: true,\n    phase: 'basics',\n    completionCheck: { type: 'field-present', field: 'businessName' },\n  })\n  .addGoal({\n    id: 'service-added',\n    description: 'At least one service added',\n    required: true,\n    phase: 'services',\n    completionCheck: { type: 'count-gte', field: 'services', threshold: 1 },\n  })\n  .addGoal({\n    id: 'logo-uploaded',\n    description: 'Logo uploaded',\n    required: false,\n    phase: 'basics',\n    completionCheck: { type: 'field-truthy', field: 'logoUrl' },\n  })\n  .addHandoff({ id: 'dashboard', type: 'route', label: 'Go to your dashboard', order: 1 })\n  .addHandoff({\n    id: 'calendar',\n    type: 'task',\n    label: 'Connect your calendar',\n    condition: 'state.calendarConnected !== true',\n    order: 2,\n  })\n  .setCompletionCriteria({ requireAllGoals: true })\n  .setFeatures({ enabledPlugins: [], pluginConfig: {} })\n  .build();\n```\n\n## Compiling a system prompt\n\n`compileSystemPrompt` is a pure function — it has no side effects and can be called on every turn.\n\n```typescript\n// First-time user\nconst systemPrompt = compileSystemPrompt(config, currentState, {\n  returningUser: false,\n  appName: 'Contractor Pro',\n});\n\n// Returning user — already answered some goals\nconst systemPrompt = compileSystemPrompt(config, currentState, {\n  returningUser: true,\n  appName: 'Contractor Pro',\n});\n```\n\nThe compiler:\n1. Emits persona instructions (tone, single-question rule)\n2. Iterates phases in `order` — emitting each guidance block with its goals\n3. When `returningUser: true` — annotates completed goals and injects the `returningUserPrompt` block\n4. Appends handoff instructions at the end\n\n## Evaluating goal progress\n\n```typescript\nimport { evaluateGoals } from '@bernierllc/onboarding-config-core';\n\nconst currentState = { businessName: 'Acme HVAC', services: ['AC repair'] };\n\nconst progress = evaluateGoals(config.goals, currentState, config.completionCriteria);\n\nconsole.log(progress.isComplete);        // false — logo not uploaded yet (optional, but all required met)\nconsole.log(progress.requiredMet);       // 2\nconsole.log(progress.requiredTotal);     // 2\nconsole.log(progress.pendingRequired);   // []\n```\n\n### Custom evaluators\n\nUse `type: 'custom'` goals with an evaluator map for logic that cannot be expressed with `field-present`, `field-truthy`, or `count-gte`:\n\n```typescript\nimport { evaluateGoals, type CustomEvaluators } from '@bernierllc/onboarding-config-core';\n\nconst evaluators: CustomEvaluators = {\n  termsAccepted: (state) => state['termsVersion'] === '2025-01',\n};\n\nconst progress = evaluateGoals(config.goals, currentState, config.completionCriteria, evaluators);\n```\n\n## Returning-user context injection\n\n```typescript\nimport { injectReturningUserContext } from '@bernierllc/onboarding-config-core';\n\nconst contextBlock = injectReturningUserContext(config, currentState);\n// Returns a markdown block listing completed goals, or '' when nothing is done yet.\n```\n\n## Validating a raw config object\n\n`validate()` is useful when configs arrive from external sources (database, API, user-supplied JSON):\n\n```typescript\nimport { validate } from '@bernierllc/onboarding-config-core';\n\nconst result = validate(rawConfig);\n\nif (!result.valid) {\n  console.error(result.errors);\n  // [{ path: 'goals[0].completionCheck.threshold', message: '...', code: 'REQUIRED' }]\n}\n\nif (result.warnings.length > 0) {\n  console.warn(result.warnings);\n  // e.g. a goal references a phase id that does not exist\n}\n```\n\n## Types reference\n\n```typescript\nimport type {\n  OnboardingConfig,\n  OnboardingPersona,\n  OnboardingPhase,\n  OnboardingGoal,\n  HandoffTarget,\n  CompletionCriteria,\n  FeatureConfig,\n  CompletionCheckDescriptor,\n  GoalProgress,\n  GoalStatus,\n  CustomEvaluators,\n  CompileOptions,\n} from '@bernierllc/onboarding-config-core';\n```\n\n### `CompletionCheckDescriptor.type` values\n\n| Type | Required fields | Description |\n|------|----------------|-------------|\n| `field-present` | `field` | Goal met when `state[field]` is not `undefined` |\n| `field-truthy` | `field` | Goal met when `state[field]` is truthy |\n| `count-gte` | `field`, `threshold` | Goal met when `state[field]` is an array with `>= threshold` items |\n| `custom` | `customKey` | Goal met when the registered evaluator returns `true` |\n\nDot-notation is supported for `field` (e.g. `\"business.name\"`).\n\n## Error handling\n\n```typescript\nimport {\n  OnboardingConfigError,\n  OnboardingConfigValidationError,\n} from '@bernierllc/onboarding-config-core';\n\ntry {\n  const config = builder.build();\n} catch (err) {\n  if (err instanceof OnboardingConfigValidationError) {\n    // err.code === 'ONBOARDING_CONFIG_VALIDATION_ERROR'\n    // err.context.errors — structured ValidationError[]\n    console.error('Config invalid:', err.context?.['errors']);\n  } else if (err instanceof OnboardingConfigError) {\n    // err.code — specific error code\n    // err.cause — underlying error (if any)\n    console.error('Config error:', err.code, err.cause);\n  }\n}\n```\n\n## Integration flow\n\n```\nCaller (onboarding-agent-service)\n  |\n  validate(rawConfig) --> OnboardingConfig\n  |\n  compileSystemPrompt(config, state, { returningUser }) --> system prompt string\n  |   (pass to LLM via ai-agent-runtime)\n  |\n  evaluateGoals(config.goals, latestState, config.completionCriteria) --> GoalProgress\n  |   (compare to completionCriteria)\n  |\n  isComplete === true --> emit handoffs in HandoffTarget.order sequence\n```\n\n## License\n\nCopyright (c) 2025 Bernier LLC. See LICENSE for details.\n","readmeFilename":"README.md"}