@singi-labs/sifa-sdk 0.19.95 → 0.19.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/index.cjs +7 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +11 -1
  4. package/dist/index.d.ts +11 -1
  5. package/dist/index.js +5 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/jev/index.cjs +20 -0
  8. package/dist/jev/index.cjs.map +1 -1
  9. package/dist/jev/index.d.cts +29 -1
  10. package/dist/jev/index.d.ts +29 -1
  11. package/dist/jev/index.js +20 -0
  12. package/dist/jev/index.js.map +1 -1
  13. package/dist/jev/issue.cjs.map +1 -1
  14. package/dist/logic/index.js +5 -1
  15. package/dist/logic/index.js.map +1 -1
  16. package/dist/logic/profile-completeness.js +7 -1
  17. package/dist/logic/profile-completeness.js.map +1 -1
  18. package/dist/query/fetchers/admin-review-queues.js +3 -1
  19. package/dist/query/fetchers/admin-review-queues.js.map +1 -1
  20. package/dist/query/fetchers/index.cjs +20 -2
  21. package/dist/query/fetchers/index.cjs.map +1 -1
  22. package/dist/query/fetchers/index.d.cts +1 -1
  23. package/dist/query/fetchers/index.d.ts +1 -1
  24. package/dist/query/fetchers/index.js +4 -0
  25. package/dist/query/fetchers/index.js.map +1 -1
  26. package/dist/query/fetchers/profile-completeness.js +21 -2
  27. package/dist/query/fetchers/profile-completeness.js.map +1 -1
  28. package/dist/query/hooks/index.cjs +53 -2
  29. package/dist/query/hooks/index.cjs.map +1 -1
  30. package/dist/query/hooks/index.d.cts +2 -2
  31. package/dist/query/hooks/index.d.ts +2 -2
  32. package/dist/query/hooks/index.js +7 -1
  33. package/dist/query/hooks/index.js.map +1 -1
  34. package/dist/query/hooks/use-profile-completeness.js +43 -1
  35. package/dist/query/hooks/use-profile-completeness.js.map +1 -1
  36. package/dist/query/index.cjs +55 -2
  37. package/dist/query/index.cjs.map +1 -1
  38. package/dist/query/index.d.cts +3 -3
  39. package/dist/query/index.d.ts +3 -3
  40. package/dist/query/index.js +11 -1
  41. package/dist/query/index.js.map +1 -1
  42. package/dist/{use-user-settings-CBH1CeDP.d.cts → use-user-settings-CNbF2SR5.d.cts} +13 -2
  43. package/dist/{use-user-settings-CFhaGcAq.d.ts → use-user-settings-GNjzBIGz.d.ts} +13 -2
  44. package/dist/{user-settings-D1zKOWa2.d.ts → user-settings-D77MWX_w.d.ts} +20 -1
  45. package/dist/{user-settings-ChPm0BFN.d.cts → user-settings-DWNbF59w.d.cts} +20 -1
  46. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/jev/index.ts","../../src/jev/issue.ts"],"names":["z","choiceQuestion"],"mappings":";;;;;AA+CO,IAAM,gBAAA,GAAmBA,MAAE,MAAA,CAAO;AAAA,EACvC,IAAA,EAAMA,KAAA,CAAE,OAAA,CAAQ,MAAM,CAAA;AAAA,EACtB,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,CAAC;AAC/B,CAAC,CAAA;AAOM,IAAM,kBAAA,GAAqBA,MAAE,MAAA,CAAO;AAAA,EACzC,IAAA,EAAMA,KAAA,CAAE,OAAA,CAAQ,QAAQ,CAAA;AAAA,EACxB,MAAA,EAAQA,MAAE,MAAA,EAAO;AAAA,EACjB,UAAA,EAAYA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,CAAC,CAAA;AAAA,EACnC,aAAA,EAAeA,MAAE,MAAA,CAAOA,KAAA,CAAE,QAAO,EAAGA,KAAA,CAAE,QAAQ;AAChD,CAAC,CAAA;AAoKM,IAAM,6BAAA,GAAgC,GAAA;AAOtC,SAAS,oBAAA,CACd,MAAA,EACA,IAAA,GAA6C,EAAC,EAC/B;AACf,EAAA,MAAM,KAAA,GAAQ,KAAK,KAAA,IAAS,6BAAA;AAC5B,EAAA,IAAI,MAAA,CAAO,UAAA,GAAa,KAAA,EA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AA,IAAI,WAAA,EAAa,MAAA,CAAO,IAAA,CAAK,WAAW,CAAA;AACxC,EAAA,IAAI,SAAA,EAAW,MAAA,CAAO,IAAA,CAAK,YAAY,CAAA;AAEvC,EAAA,OAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,MAAA,EAAQ,SAAA,EAAW,UAAU,UAAA,EAAW;AACjE","file":"issue.cjs","sourcesContent":["/**\n * `@singi-labs/sifa-sdk/jev` -- TypeSafe System One (Jev) question builders,\n * taxonomies, result schemas, and threshold predicates for Sifa's organisation\n * intelligence.\n *\n * This subpath is pure: it defines the typed *questions* to ask Jev, validates\n * the *answers*, and holds the policy constants (thresholds, taxonomies) that\n * turn a raw judgment into a decision. It performs no network calls and needs\n * no API key, so it is safe to import anywhere. The actual `systemOne` call\n * lives server-side in sifa-api, which passes an API key that must never reach\n * the browser.\n *\n * Judgment shapes:\n * - Duplicate-org detection: a single Noul over a candidate pair.\n * - Firmographic classification: independent Choice questions (industry, type,\n * size) asked together over one org's state.\n *\n * See docs.typesafe.ai for the wire contract. Typed output guarantees the\n * interface, not truth: validate thresholds on labelled Sifa data before\n * enabling any write.\n */\n\nimport { z } from 'zod';\n\n// ---------------------------------------------------------------------------\n// Wire question types\n// ---------------------------------------------------------------------------\n\n/** A yes/no judgment. `criteria` clarifies what true vs false means. */\nexport interface NoulQuestion {\n type: 'noul';\n instructions: string;\n criteria?: { true: string; false: string };\n}\n\n/** A single-selection judgment. `criteria` maps each option to its description. */\nexport interface ChoiceQuestion {\n type: 'choice';\n instructions: string;\n criteria: Record<string, string>;\n}\n\n// ---------------------------------------------------------------------------\n// Answer schemas (validate Jev's response before code trusts it)\n// ---------------------------------------------------------------------------\n\n/** Jev's Noul answer: `noul` is the probability that the answer is yes (0..1). */\nexport const noulAnswerSchema = z.object({\n type: z.literal('noul'),\n noul: z.number().min(0).max(1),\n});\nexport type NoulAnswer = z.infer<typeof noulAnswerSchema>;\n\n/**\n * Jev's Choice answer: `choice` is the highest-probability option, `confidence`\n * summarises how concentrated the distribution is, `probabilities` sums to 1.\n */\nexport const choiceAnswerSchema = z.object({\n type: z.literal('choice'),\n choice: z.string(),\n confidence: z.number().min(0).max(1),\n probabilities: z.record(z.string(), z.number()),\n});\nexport type ChoiceAnswer = z.infer<typeof choiceAnswerSchema>;\n\n// ---------------------------------------------------------------------------\n// Duplicate-org detection (Noul) -- ticket #560\n// ---------------------------------------------------------------------------\n\n/** Public, non-user fields we compare when judging whether two orgs are the same. */\nexport interface OrgRecordInput {\n name: string;\n domain?: string;\n location?: string;\n description?: string;\n}\n\n/** Build a plain object with only the defined keys (Jev sees no `undefined`). */\nfunction compact<T extends object>(obj: T): Partial<T> {\n const out: Partial<T> = {};\n for (const [k, v] of Object.entries(obj)) {\n if (v !== undefined && v !== null && v !== '') out[k as keyof T] = v as T[keyof T];\n }\n return out;\n}\n\n/**\n * State for the org-pair judgment. Both records live under stable named fields\n * so the question can reference them unambiguously.\n */\nexport function buildOrgPairState(\n a: OrgRecordInput,\n b: OrgRecordInput,\n): { orgA: Partial<OrgRecordInput>; orgB: Partial<OrgRecordInput> } {\n return { orgA: compact(a), orgB: compact(b) };\n}\n\n/** Static Noul question paired with {@link buildOrgPairState}. */\nexport const ORG_PAIR_NOUL_QUESTION: NoulQuestion = {\n type: 'noul',\n instructions:\n 'The state holds two organisation records, orgA and orgB. Do they refer to the same real-world organisation?',\n criteria: {\n true: 'Same organisation, e.g. a legal-suffix or abbreviation variant of the same name, or the same primary domain.',\n false:\n 'Distinct organisations, e.g. a shared word in the name but different domains, locations, or lines of business.',\n },\n};\n\n/**\n * Threshold favouring precision: a wrong merge is worse than a missed one.\n * Validate on labelled pairs (ticket #560) before enabling merges in prod.\n */\nexport const SAME_ORG_THRESHOLD = 0.85;\n\n/** True when the Noul probability clears the merge threshold. */\nexport function isLikelySameOrg(noul: number, threshold: number = SAME_ORG_THRESHOLD): boolean {\n return noul >= threshold;\n}\n\n// ---------------------------------------------------------------------------\n// Firmographic classification (Choice) -- ticket #561\n// ---------------------------------------------------------------------------\n\n/** Industry taxonomy. Single source of truth; `other` is the no-match option. */\nexport const INDUSTRY_TAXONOMY: Record<string, string> = {\n technology: 'Software, IT services, internet, hardware, telecoms',\n finance: 'Banking, insurance, investment, fintech, accounting',\n healthcare: 'Medical care, pharma, biotech, health services',\n education: 'Schools, universities, training, edtech',\n manufacturing: 'Industrial production, hardware, materials, automotive',\n retail: 'Retail, ecommerce, consumer goods, hospitality, food',\n media: 'Media, publishing, entertainment, marketing, advertising',\n energy: 'Energy, utilities, oil and gas, renewables',\n construction: 'Construction, real estate, architecture, engineering',\n transport: 'Transport, logistics, shipping, aviation',\n professional_services: 'Legal, consulting, HR, business services',\n public_sector: 'Government, defence, public administration',\n nonprofit: 'Charities, NGOs, foundations, associations',\n agriculture: 'Agriculture, farming, fishing, forestry',\n other: 'None of the above, or not enough information to decide',\n};\n\n/**\n * Organisation type (the org's FORM, not its sector -- a hospital's type is\n * healthcare_provider while its industry is healthcare). `other` is the no-match\n * option. Prefer the registry `legalForm` where it already encodes the form.\n */\nexport const ORG_TYPE_TAXONOMY: Record<string, string> = {\n company: 'For-profit company or corporation',\n cooperative: 'Member-owned co-operative (e.g. eG, SCOP, mutual, credit union)',\n nonprofit: 'Nonprofit, charity, or NGO',\n foundation: 'Grant-making or endowed foundation (e.g. Stiftung, fonds)',\n government: 'Government body, agency, or public-sector authority',\n educational: 'School, college, or university',\n research_institute: 'Independent research institute or laboratory',\n healthcare_provider: 'Hospital, clinic, or healthcare provider',\n professional_association: 'Professional association, trade body, or trade union',\n agency: 'Agency, consultancy, or professional-services firm',\n religious: 'Religious organisation',\n political: 'Political party or organisation',\n self_employed: 'Sole proprietor, freelancer, or self-employed individual',\n other: 'None of the above, or not enough information to decide',\n};\n\n/** Ordered employee-size bands; `unknown` is the no-match option. */\nexport const SIZE_BAND_TAXONOMY: Record<string, string> = {\n solo: '1 person',\n small: '2 to 10 people',\n medium: '11 to 50 people',\n large: '51 to 250 people',\n enterprise: 'More than 250 people',\n unknown: 'Not enough information to decide',\n};\n\nfunction choiceQuestion(instructions: string, criteria: Record<string, string>): ChoiceQuestion {\n return { type: 'choice', instructions, criteria };\n}\n\nexport const INDUSTRY_CHOICE_QUESTION = choiceQuestion(\n 'Based on the org state, which single industry best describes this organisation?',\n INDUSTRY_TAXONOMY,\n);\n\nexport const ORG_TYPE_CHOICE_QUESTION = choiceQuestion(\n 'Based on the org state, which single organisation type (its form, not its industry sector) best describes this organisation?',\n ORG_TYPE_TAXONOMY,\n);\n\nexport const SIZE_BAND_CHOICE_QUESTION = choiceQuestion(\n 'Based on the org state, which employee-size band best fits this organisation?',\n SIZE_BAND_TAXONOMY,\n);\n\n/**\n * Input for firmographic classification. `enrichmentText` (the org's description)\n * is the strongest evidence, but it is optional: many registry orgs have only a\n * name, domain, country, or link set. Passing those lets Jev classify from the\n * signal we hold rather than skipping the org for want of a description. A bare\n * name alone rarely suffices; a name plus a domain or country often does.\n */\nexport interface FirmographicInput {\n name: string;\n domain?: string;\n country?: string;\n /** Featured/external link labels or hosts (e.g. 'linkedin', 'wikipedia'). */\n links?: string[];\n /** An already-known industry, when set (helps disambiguate type/size). */\n industry?: string;\n enrichmentText?: string;\n}\n\n/**\n * State for the firmographic questions. Drops absent/empty fields (including\n * empty arrays) so Jev never sees a null or `[]` it would have to reason about.\n */\nexport function buildFirmographicState(org: FirmographicInput): Partial<FirmographicInput> {\n const compacted = compact(org);\n if (compacted.links && compacted.links.length === 0) delete compacted.links;\n return compacted;\n}\n\n/**\n * Below this confidence a firmographic field is left unset rather than guessed.\n * Validate per field on labelled orgs (ticket #561).\n */\nexport const FIRMOGRAPHIC_CONFIDENCE_FLOOR = 0.6;\n\n/**\n * Select the classified option, or `null` to leave the field unset. Returns\n * null when confidence is below the floor, or when the selected option is the\n * taxonomy's no-match option.\n */\nexport function pickChoiceAboveFloor(\n answer: ChoiceAnswer,\n opts: { floor?: number; noMatch?: string } = {},\n): string | null {\n const floor = opts.floor ?? FIRMOGRAPHIC_CONFIDENCE_FLOOR;\n if (answer.confidence < floor) return null;\n if (opts.noMatch !== undefined && answer.choice === opts.noMatch) return null;\n return answer.choice;\n}\n","/**\n * Issue-triage judgments for the background-agent chores (sifa-workspace\n * decision 2026-10-05, background agents tier policy). Pure builders: the\n * typed questions to ask Jev about a GitHub issue, the label taxonomies, and\n * the thresholds that turn answers into label suggestions. No network, no key.\n *\n * Scope is deliberately T0 (read-only): the output is a list of label\n * suggestions a workflow may apply from an allowlist, never a code change.\n * Jev only sees public issue text. Exact signals (GlitchTip links, template\n * fields present) stay in code, not in a judgment.\n */\n\nimport { z } from 'zod';\n\nimport {\n choiceAnswerSchema,\n noulAnswerSchema,\n pickChoiceAboveFloor,\n type ChoiceAnswer,\n type ChoiceQuestion,\n type NoulAnswer,\n type NoulQuestion,\n} from './index.js';\n\n// ---------------------------------------------------------------------------\n// Input and state\n// ---------------------------------------------------------------------------\n\n/** Public, non-user fields of a GitHub issue that the judgment may see. */\nexport interface IssueInput {\n repo: string;\n title: string;\n body?: string;\n /** Labels already on the issue (e.g. set by a template). */\n existingLabels?: string[];\n}\n\n/** Longest issue body forwarded to Jev; keeps state bounded and cheap. */\nexport const ISSUE_BODY_MAX_CHARS = 6000;\n\nexport interface IssueTriageState {\n repo: string;\n title: string;\n body?: string;\n bodyTruncated?: true;\n existingLabels?: string[];\n}\n\n/** State for the issue questions. Absent and blank fields are dropped. */\nexport function buildIssueTriageState(issue: IssueInput): IssueTriageState {\n const state: IssueTriageState = { repo: issue.repo, title: issue.title.trim() };\n const body = issue.body?.trim();\n if (body) {\n if (body.length > ISSUE_BODY_MAX_CHARS) {\n state.body = body.slice(0, ISSUE_BODY_MAX_CHARS);\n state.bodyTruncated = true;\n } else {\n state.body = body;\n }\n }\n if (issue.existingLabels && issue.existingLabels.length > 0) {\n state.existingLabels = issue.existingLabels;\n }\n return state;\n}\n\n// ---------------------------------------------------------------------------\n// Taxonomies (keys double as label names where a label exists)\n// ---------------------------------------------------------------------------\n\n/** One type label per issue. `unclear` is the no-match option and never a label. */\nexport const ISSUE_TYPE_TAXONOMY: Record<string, string> = {\n bug: 'Something that exists does not behave as documented or expected (error, crash, wrong output)',\n feature: 'A request for new behaviour or capability that does not exist yet',\n question: 'A question about how something works, with nothing to build or fix',\n documentation: 'Docs, README, comments, or examples are missing, wrong, or unclear',\n 'tech-debt':\n 'Internal refactor, cleanup, dependency, or tooling work with no user-visible change',\n spam: 'Spam, gibberish, advertising, or a test submission',\n unclear: 'Not enough information to decide the type',\n};\n\n/** Which product stream an issue belongs to. `unclear` is the no-match option. */\nexport const ISSUE_STREAM_TAXONOMY: Record<string, string> = {\n sifa: 'The Sifa profile, activity stream, ingestion, search, or web app',\n kootana: 'Kootana: events, meetings, in-person connect, QR scan, organizer tools',\n unclear: 'Cannot tell from the issue',\n};\n\n/** Label applied for the Kootana stream; the Sifa stream carries no label. */\nexport const ISSUE_STREAM_LABELS: Readonly<Record<string, string | null>> = {\n sifa: null,\n kootana: 'stream:kootana',\n unclear: null,\n};\n\n// ---------------------------------------------------------------------------\n// Questions (asked together over one issue state)\n// ---------------------------------------------------------------------------\n\nfunction choiceQuestion(instructions: string, criteria: Record<string, string>): ChoiceQuestion {\n return { type: 'choice', instructions, criteria };\n}\n\nexport const ISSUE_TYPE_CHOICE_QUESTION = choiceQuestion(\n 'The state holds one GitHub issue (repo, title, body, existing labels). Which single type best describes it?',\n ISSUE_TYPE_TAXONOMY,\n);\n\nexport const ISSUE_STREAM_CHOICE_QUESTION = choiceQuestion(\n 'Which product stream does this issue concern?',\n ISSUE_STREAM_TAXONOMY,\n);\n\nexport const ISSUE_ACTIONABLE_NOUL_QUESTION: NoulQuestion = {\n type: 'noul',\n instructions:\n 'Does the issue contain enough information for a maintainer to act on it without asking the reporter anything?',\n criteria: {\n true: 'For a bug: steps or a trigger, expected vs actual, and an error or location. For a feature: the problem, the desired outcome, and rough scope.',\n false:\n 'Essential details are missing: no way to reproduce, no expected behaviour, vague wish with no outcome, or a bare title.',\n },\n};\n\nexport const ISSUE_SECURITY_NOUL_QUESTION: NoulQuestion = {\n type: 'noul',\n instructions: 'Does the issue describe a security-relevant problem?',\n criteria: {\n true: 'A vulnerability, auth or session flaw, data exposure, abuse or spam vector, secrets handling, or a dependency advisory.',\n false: 'An ordinary bug, feature, question, or docs issue with no security angle.',\n },\n};\n\nexport const ISSUE_REGRESSION_NOUL_QUESTION: NoulQuestion = {\n type: 'noul',\n instructions: 'Does the issue report that something which previously worked no longer works?',\n criteria: {\n true: 'The reporter states or clearly implies the behaviour worked before a release, deploy, or change.',\n false: 'A new bug with no prior-working claim, a feature request, or a question.',\n },\n};\n\n/** Stable question ids; the answer keys Jev returns. */\nexport const ISSUE_TRIAGE_QUESTION_IDS = {\n type: 'issueType',\n stream: 'issueStream',\n actionable: 'issueActionable',\n security: 'issueSecurity',\n regression: 'issueRegression',\n} as const;\n\n/** All issue questions, keyed by {@link ISSUE_TRIAGE_QUESTION_IDS}, for one batched call. */\nexport function buildIssueTriageQuestions(): Record<string, ChoiceQuestion | NoulQuestion> {\n return {\n [ISSUE_TRIAGE_QUESTION_IDS.type]: ISSUE_TYPE_CHOICE_QUESTION,\n [ISSUE_TRIAGE_QUESTION_IDS.stream]: ISSUE_STREAM_CHOICE_QUESTION,\n [ISSUE_TRIAGE_QUESTION_IDS.actionable]: ISSUE_ACTIONABLE_NOUL_QUESTION,\n [ISSUE_TRIAGE_QUESTION_IDS.security]: ISSUE_SECURITY_NOUL_QUESTION,\n [ISSUE_TRIAGE_QUESTION_IDS.regression]: ISSUE_REGRESSION_NOUL_QUESTION,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Answers -> label suggestions\n// ---------------------------------------------------------------------------\n\n/** Parsed answers for the batched issue call. */\nexport const issueTriageAnswersSchema = z.object({\n [ISSUE_TRIAGE_QUESTION_IDS.type]: choiceAnswerSchema,\n [ISSUE_TRIAGE_QUESTION_IDS.stream]: choiceAnswerSchema,\n [ISSUE_TRIAGE_QUESTION_IDS.actionable]: noulAnswerSchema,\n [ISSUE_TRIAGE_QUESTION_IDS.security]: noulAnswerSchema,\n [ISSUE_TRIAGE_QUESTION_IDS.regression]: noulAnswerSchema,\n});\nexport type IssueTriageAnswers = z.infer<typeof issueTriageAnswersSchema>;\n\n/**\n * Thresholds. Precision over recall: a wrong label costs a maintainer a click\n * and trains distrust; a missing label costs nothing. Validate on labelled\n * closed issues (sifa-api#1555) before widening.\n */\nexport const ISSUE_TYPE_CONFIDENCE_FLOOR = 0.6;\nexport const ISSUE_STREAM_CONFIDENCE_FLOOR = 0.7;\n/** Below this P(actionable) the issue gets `needs-info`. */\nexport const ISSUE_NEEDS_INFO_MAX_ACTIONABLE = 0.35;\n/** Routing labels (security, regression) need a confident yes. */\nexport const ISSUE_ROUTING_THRESHOLD = 0.85;\n\nexport interface IssueLabelSuggestions {\n /** Labels to apply, in a stable order, each guaranteed to be a real label name. */\n labels: string[];\n /** The type choice after the floor, or null when unset. */\n type: string | null;\n /** The stream choice after the floor, or null when unset. */\n stream: string | null;\n needsInfo: boolean;\n security: boolean;\n regression: boolean;\n}\n\nexport interface IssueLabelOptions {\n typeFloor?: number;\n streamFloor?: number;\n needsInfoMaxActionable?: number;\n routingThreshold?: number;\n}\n\nfunction clearsNoul(answer: NoulAnswer, threshold: number): boolean {\n return answer.noul >= threshold;\n}\n\nfunction pickType(answer: ChoiceAnswer, floor: number): string | null {\n const choice = pickChoiceAboveFloor(answer, { floor, noMatch: 'unclear' });\n return choice !== null && choice in ISSUE_TYPE_TAXONOMY ? choice : null;\n}\n\nfunction pickStream(answer: ChoiceAnswer, floor: number): string | null {\n const choice = pickChoiceAboveFloor(answer, { floor, noMatch: 'unclear' });\n return choice !== null && choice in ISSUE_STREAM_TAXONOMY ? choice : null;\n}\n\n/**\n * Turn validated answers into label suggestions. Spam short-circuits: a spam\n * issue gets only `spam`, no routing or needs-info. A choice outside the\n * taxonomy (Jev invented a key) is treated as unset.\n */\nexport function issueLabelsFromAnswers(\n answers: IssueTriageAnswers,\n opts: IssueLabelOptions = {},\n): IssueLabelSuggestions {\n const typeFloor = opts.typeFloor ?? ISSUE_TYPE_CONFIDENCE_FLOOR;\n const streamFloor = opts.streamFloor ?? ISSUE_STREAM_CONFIDENCE_FLOOR;\n const needsInfoMax = opts.needsInfoMaxActionable ?? ISSUE_NEEDS_INFO_MAX_ACTIONABLE;\n const routing = opts.routingThreshold ?? ISSUE_ROUTING_THRESHOLD;\n\n const type = pickType(answers[ISSUE_TRIAGE_QUESTION_IDS.type], typeFloor);\n if (type === 'spam') {\n return {\n labels: ['spam'],\n type,\n stream: null,\n needsInfo: false,\n security: false,\n regression: false,\n };\n }\n\n const stream = pickStream(answers[ISSUE_TRIAGE_QUESTION_IDS.stream], streamFloor);\n const needsInfo = answers[ISSUE_TRIAGE_QUESTION_IDS.actionable].noul < needsInfoMax;\n const security = clearsNoul(answers[ISSUE_TRIAGE_QUESTION_IDS.security], routing);\n const regression = clearsNoul(answers[ISSUE_TRIAGE_QUESTION_IDS.regression], routing);\n\n const labels: string[] = [];\n if (type !== null) labels.push(type);\n if (security) labels.push('security');\n if (regression) labels.push('regression');\n const streamLabel = stream !== null ? ISSUE_STREAM_LABELS[stream] : null;\n if (streamLabel) labels.push(streamLabel);\n if (needsInfo) labels.push('needs-info');\n\n return { labels, type, stream, needsInfo, security, regression };\n}\n"]}
1
+ {"version":3,"sources":["../../src/jev/index.ts","../../src/jev/issue.ts"],"names":["z","choiceQuestion"],"mappings":";;;;;AA+CO,IAAM,gBAAA,GAAmBA,MAAE,MAAA,CAAO;AAAA,EACvC,IAAA,EAAMA,KAAA,CAAE,OAAA,CAAQ,MAAM,CAAA;AAAA,EACtB,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,CAAC;AAC/B,CAAC,CAAA;AAOM,IAAM,kBAAA,GAAqBA,MAAE,MAAA,CAAO;AAAA,EACzC,IAAA,EAAMA,KAAA,CAAE,OAAA,CAAQ,QAAQ,CAA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G,OAAO,CAAA;AAChF,EAAA,MAAM,aAAa,UAAA,CAAW,OAAA,CAAQ,yBAAA,CAA0B,UAAU,GAAG,OAAO,CAAA;AAEpF,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAA,IAAI,IAAA,KAAS,IAAA,EAAM,MAAA,CAAO,IAAA,CAAK,IAAI,CAAA;AACnC,EAAA,IAAI,QAAA,EAAU,MAAA,CAAO,IAAA,CAAK,UAAU,CAAA;AACpC,EAAA,IAAI,UAAA,EAAY,MAAA,CAAO,IAAA,CAAK,YAAY,CAAA;AACxC,EAAA,MAAM,WAAA,GAAc,MAAA,KAAW,IAAA,GAAO,mBAAA,CAAoB,MAAM,CAAA,GAAI,IAAA;AACpE,EAAA,IAAI,WAAA,EAAa,MAAA,CAAO,IAAA,CAAK,WAAW,CAAA;AACxC,EAAA,IAAI,SAAA,EAAW,MAAA,CAAO,IAAA,CAAK,YAAY,CAAA;AAEvC,EAAA,OAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,MAAA,EAAQ,SAAA,EAAW,UAAU,UAAA,EAAW;AACjE","file":"issue.cjs","sourcesContent":["/**\n * `@singi-labs/sifa-sdk/jev` -- TypeSafe System One (Jev) question builders,\n * taxonomies, result schemas, and threshold predicates for Sifa's organisation\n * intelligence.\n *\n * This subpath is pure: it defines the typed *questions* to ask Jev, validates\n * the *answers*, and holds the policy constants (thresholds, taxonomies) that\n * turn a raw judgment into a decision. It performs no network calls and needs\n * no API key, so it is safe to import anywhere. The actual `systemOne` call\n * lives server-side in sifa-api, which passes an API key that must never reach\n * the browser.\n *\n * Judgment shapes:\n * - Duplicate-org detection: a single Noul over a candidate pair.\n * - Firmographic classification: independent Choice questions (industry, type,\n * size) asked together over one org's state.\n *\n * See docs.typesafe.ai for the wire contract. Typed output guarantees the\n * interface, not truth: validate thresholds on labelled Sifa data before\n * enabling any write.\n */\n\nimport { z } from 'zod';\n\n// ---------------------------------------------------------------------------\n// Wire question types\n// ---------------------------------------------------------------------------\n\n/** A yes/no judgment. `criteria` clarifies what true vs false means. */\nexport interface NoulQuestion {\n type: 'noul';\n instructions: string;\n criteria?: { true: string; false: string };\n}\n\n/** A single-selection judgment. `criteria` maps each option to its description. */\nexport interface ChoiceQuestion {\n type: 'choice';\n instructions: string;\n criteria: Record<string, string>;\n}\n\n// ---------------------------------------------------------------------------\n// Answer schemas (validate Jev's response before code trusts it)\n// ---------------------------------------------------------------------------\n\n/** Jev's Noul answer: `noul` is the probability that the answer is yes (0..1). */\nexport const noulAnswerSchema = z.object({\n type: z.literal('noul'),\n noul: z.number().min(0).max(1),\n});\nexport type NoulAnswer = z.infer<typeof noulAnswerSchema>;\n\n/**\n * Jev's Choice answer: `choice` is the highest-probability option, `confidence`\n * summarises how concentrated the distribution is, `probabilities` sums to 1.\n */\nexport const choiceAnswerSchema = z.object({\n type: z.literal('choice'),\n choice: z.string(),\n confidence: z.number().min(0).max(1),\n probabilities: z.record(z.string(), z.number()),\n});\nexport type ChoiceAnswer = z.infer<typeof choiceAnswerSchema>;\n\n// ---------------------------------------------------------------------------\n// Duplicate-org detection (Noul) -- ticket #560\n// ---------------------------------------------------------------------------\n\n/** Public, non-user fields we compare when judging whether two orgs are the same. */\nexport interface OrgRecordInput {\n name: string;\n domain?: string;\n location?: string;\n description?: string;\n}\n\n/** Build a plain object with only the defined keys (Jev sees no `undefined`). */\nfunction compact<T extends object>(obj: T): Partial<T> {\n const out: Partial<T> = {};\n for (const [k, v] of Object.entries(obj)) {\n if (v !== undefined && v !== null && v !== '') out[k as keyof T] = v as T[keyof T];\n }\n return out;\n}\n\n/**\n * State for the org-pair judgment. Both records live under stable named fields\n * so the question can reference them unambiguously.\n */\nexport function buildOrgPairState(\n a: OrgRecordInput,\n b: OrgRecordInput,\n): { orgA: Partial<OrgRecordInput>; orgB: Partial<OrgRecordInput> } {\n return { orgA: compact(a), orgB: compact(b) };\n}\n\n/** Static Noul question paired with {@link buildOrgPairState}. */\nexport const ORG_PAIR_NOUL_QUESTION: NoulQuestion = {\n type: 'noul',\n instructions:\n 'The state holds two organisation records, orgA and orgB. Do they refer to the same real-world organisation?',\n criteria: {\n true: 'Same organisation, e.g. a legal-suffix or abbreviation variant of the same name, or the same primary domain.',\n false:\n 'Distinct organisations, e.g. a shared word in the name but different domains, locations, or lines of business.',\n },\n};\n\n/**\n * Threshold favouring precision: a wrong merge is worse than a missed one.\n * Validate on labelled pairs (ticket #560) before enabling merges in prod.\n */\nexport const SAME_ORG_THRESHOLD = 0.85;\n\n/** True when the Noul probability clears the merge threshold. */\nexport function isLikelySameOrg(noul: number, threshold: number = SAME_ORG_THRESHOLD): boolean {\n return noul >= threshold;\n}\n\n// ---------------------------------------------------------------------------\n// Firmographic classification (Choice) -- ticket #561\n// ---------------------------------------------------------------------------\n\n/** Industry taxonomy. Single source of truth; `other` is the no-match option. */\nexport const INDUSTRY_TAXONOMY: Record<string, string> = {\n technology: 'Software, IT services, internet, hardware, telecoms',\n finance: 'Banking, insurance, investment, fintech, accounting',\n healthcare: 'Medical care, pharma, biotech, health services',\n education: 'Schools, universities, training, edtech',\n manufacturing: 'Industrial production, hardware, materials, automotive',\n retail: 'Retail, ecommerce, consumer goods, hospitality, food',\n media: 'Media, publishing, entertainment, marketing, advertising',\n energy: 'Energy, utilities, oil and gas, renewables',\n construction: 'Construction, real estate, architecture, engineering',\n transport: 'Transport, logistics, shipping, aviation',\n professional_services: 'Legal, consulting, HR, business services',\n public_sector: 'Government, defence, public administration',\n nonprofit: 'Charities, NGOs, foundations, associations',\n agriculture: 'Agriculture, farming, fishing, forestry',\n other: 'None of the above, or not enough information to decide',\n};\n\n/**\n * Organisation type (the org's FORM, not its sector -- a hospital's type is\n * healthcare_provider while its industry is healthcare). `other` is the no-match\n * option. Prefer the registry `legalForm` where it already encodes the form.\n */\nexport const ORG_TYPE_TAXONOMY: Record<string, string> = {\n company: 'For-profit company or corporation',\n cooperative: 'Member-owned co-operative (e.g. eG, SCOP, mutual, credit union)',\n nonprofit: 'Nonprofit, charity, or NGO',\n foundation: 'Grant-making or endowed foundation (e.g. Stiftung, fonds)',\n government: 'Government body, agency, or public-sector authority',\n educational: 'School, college, or university',\n research_institute: 'Independent research institute or laboratory',\n healthcare_provider: 'Hospital, clinic, or healthcare provider',\n professional_association: 'Professional association, trade body, or trade union',\n agency: 'Agency, consultancy, or professional-services firm',\n religious: 'Religious organisation',\n political: 'Political party or organisation',\n self_employed: 'Sole proprietor, freelancer, or self-employed individual',\n other: 'None of the above, or not enough information to decide',\n};\n\n/**\n * Org types that also imply a sector. Jev can pick one that contradicts the\n * org's industry (a software company typed `healthcare_provider`), especially\n * from thin, description-less input. Each maps to lowercase substrings, one of\n * which the org's industry must contain for the inferred type to be shown.\n * Industry values are free text (Jev tokens like `public_sector`, or registry\n * labels like \"Hospital & Health Care\"), hence substring hints. Types not listed\n * here describe a legal or organisational form only and need no sector match.\n */\nexport const SECTOR_ORG_TYPE_INDUSTRY_HINTS: Record<string, readonly string[]> = {\n healthcare_provider: ['health', 'hospital', 'medical', 'clinic', 'nursing', 'dental'],\n educational: ['educat', 'school', 'universit', 'college', 'academ'],\n government: ['government', 'public_sector', 'public sector', 'public administration', 'defen'],\n research_institute: ['research', 'scien', 'laborator', 'educat'],\n religious: ['relig', 'church', 'faith', 'nonprofit'],\n political: ['politic', 'nonprofit'],\n};\n\n/**\n * Whether a Jev-inferred org type is plausible enough to store or show.\n *\n * - The no-match option and unknown tokens are never plausible.\n * - Form types (company, nonprofit, ...) are always plausible.\n * - Sector-bound types need an org description (thin input is where Jev\n * guesses wrong) AND an industry that matches the type's sector.\n */\nexport function isInferredOrgTypePlausible(\n orgType: string,\n ctx: { industry?: string | null; hasDescription: boolean },\n): boolean {\n if (orgType === 'other' || !Object.hasOwn(ORG_TYPE_TAXONOMY, orgType)) return false;\n const hints = SECTOR_ORG_TYPE_INDUSTRY_HINTS[orgType];\n if (!hints) return true;\n if (!ctx.hasDescription || !ctx.industry) return false;\n const industry = ctx.industry.toLowerCase();\n return hints.some((hint) => industry.includes(hint));\n}\n\n/**\n * Jev-inferred company facts a signed-in visitor can dispute (mark as wrong).\n * A dispute hides the inferred value; it never touches registry or owner data.\n */\nexport const INFERRED_FACT_FIELDS = ['industry', 'sizeBand', 'orgType'] as const;\nexport type InferredFactField = (typeof INFERRED_FACT_FIELDS)[number];\n\n/** Ordered employee-size bands; `unknown` is the no-match option. */\nexport const SIZE_BAND_TAXONOMY: Record<string, string> = {\n solo: '1 person',\n small: '2 to 10 people',\n medium: '11 to 50 people',\n large: '51 to 250 people',\n enterprise: 'More than 250 people',\n unknown: 'Not enough information to decide',\n};\n\nfunction choiceQuestion(instructions: string, criteria: Record<string, string>): ChoiceQuestion {\n return { type: 'choice', instructions, criteria };\n}\n\nexport const INDUSTRY_CHOICE_QUESTION = choiceQuestion(\n 'Based on the org state, which single industry best describes this organisation?',\n INDUSTRY_TAXONOMY,\n);\n\nexport const ORG_TYPE_CHOICE_QUESTION = choiceQuestion(\n 'Based on the org state, which single organisation type (its form, not its industry sector) best describes this organisation?',\n ORG_TYPE_TAXONOMY,\n);\n\nexport const SIZE_BAND_CHOICE_QUESTION = choiceQuestion(\n 'Based on the org state, which employee-size band best fits this organisation?',\n SIZE_BAND_TAXONOMY,\n);\n\n/**\n * Input for firmographic classification. `enrichmentText` (the org's description)\n * is the strongest evidence, but it is optional: many registry orgs have only a\n * name, domain, country, or link set. Passing those lets Jev classify from the\n * signal we hold rather than skipping the org for want of a description. A bare\n * name alone rarely suffices; a name plus a domain or country often does.\n */\nexport interface FirmographicInput {\n name: string;\n domain?: string;\n country?: string;\n /** Featured/external link labels or hosts (e.g. 'linkedin', 'wikipedia'). */\n links?: string[];\n /** An already-known industry, when set (helps disambiguate type/size). */\n industry?: string;\n enrichmentText?: string;\n}\n\n/**\n * State for the firmographic questions. Drops absent/empty fields (including\n * empty arrays) so Jev never sees a null or `[]` it would have to reason about.\n */\nexport function buildFirmographicState(org: FirmographicInput): Partial<FirmographicInput> {\n const compacted = compact(org);\n if (compacted.links && compacted.links.length === 0) delete compacted.links;\n return compacted;\n}\n\n/**\n * Below this confidence a firmographic field is left unset rather than guessed.\n * Validate per field on labelled orgs (ticket #561).\n */\nexport const FIRMOGRAPHIC_CONFIDENCE_FLOOR = 0.6;\n\n/**\n * Select the classified option, or `null` to leave the field unset. Returns\n * null when confidence is below the floor, or when the selected option is the\n * taxonomy's no-match option.\n */\nexport function pickChoiceAboveFloor(\n answer: ChoiceAnswer,\n opts: { floor?: number; noMatch?: string } = {},\n): string | null {\n const floor = opts.floor ?? FIRMOGRAPHIC_CONFIDENCE_FLOOR;\n if (answer.confidence < floor) return null;\n if (opts.noMatch !== undefined && answer.choice === opts.noMatch) return null;\n return answer.choice;\n}\n","/**\n * Issue-triage judgments for the background-agent chores (sifa-workspace\n * decision 2026-10-05, background agents tier policy). Pure builders: the\n * typed questions to ask Jev about a GitHub issue, the label taxonomies, and\n * the thresholds that turn answers into label suggestions. No network, no key.\n *\n * Scope is deliberately T0 (read-only): the output is a list of label\n * suggestions a workflow may apply from an allowlist, never a code change.\n * Jev only sees public issue text. Exact signals (GlitchTip links, template\n * fields present) stay in code, not in a judgment.\n */\n\nimport { z } from 'zod';\n\nimport {\n choiceAnswerSchema,\n noulAnswerSchema,\n pickChoiceAboveFloor,\n type ChoiceAnswer,\n type ChoiceQuestion,\n type NoulAnswer,\n type NoulQuestion,\n} from './index.js';\n\n// ---------------------------------------------------------------------------\n// Input and state\n// ---------------------------------------------------------------------------\n\n/** Public, non-user fields of a GitHub issue that the judgment may see. */\nexport interface IssueInput {\n repo: string;\n title: string;\n body?: string;\n /** Labels already on the issue (e.g. set by a template). */\n existingLabels?: string[];\n}\n\n/** Longest issue body forwarded to Jev; keeps state bounded and cheap. */\nexport const ISSUE_BODY_MAX_CHARS = 6000;\n\nexport interface IssueTriageState {\n repo: string;\n title: string;\n body?: string;\n bodyTruncated?: true;\n existingLabels?: string[];\n}\n\n/** State for the issue questions. Absent and blank fields are dropped. */\nexport function buildIssueTriageState(issue: IssueInput): IssueTriageState {\n const state: IssueTriageState = { repo: issue.repo, title: issue.title.trim() };\n const body = issue.body?.trim();\n if (body) {\n if (body.length > ISSUE_BODY_MAX_CHARS) {\n state.body = body.slice(0, ISSUE_BODY_MAX_CHARS);\n state.bodyTruncated = true;\n } else {\n state.body = body;\n }\n }\n if (issue.existingLabels && issue.existingLabels.length > 0) {\n state.existingLabels = issue.existingLabels;\n }\n return state;\n}\n\n// ---------------------------------------------------------------------------\n// Taxonomies (keys double as label names where a label exists)\n// ---------------------------------------------------------------------------\n\n/** One type label per issue. `unclear` is the no-match option and never a label. */\nexport const ISSUE_TYPE_TAXONOMY: Record<string, string> = {\n bug: 'Something that exists does not behave as documented or expected (error, crash, wrong output)',\n feature: 'A request for new behaviour or capability that does not exist yet',\n question: 'A question about how something works, with nothing to build or fix',\n documentation: 'Docs, README, comments, or examples are missing, wrong, or unclear',\n 'tech-debt':\n 'Internal refactor, cleanup, dependency, or tooling work with no user-visible change',\n spam: 'Spam, gibberish, advertising, or a test submission',\n unclear: 'Not enough information to decide the type',\n};\n\n/** Which product stream an issue belongs to. `unclear` is the no-match option. */\nexport const ISSUE_STREAM_TAXONOMY: Record<string, string> = {\n sifa: 'The Sifa profile, activity stream, ingestion, search, or web app',\n kootana: 'Kootana: events, meetings, in-person connect, QR scan, organizer tools',\n unclear: 'Cannot tell from the issue',\n};\n\n/** Label applied for the Kootana stream; the Sifa stream carries no label. */\nexport const ISSUE_STREAM_LABELS: Readonly<Record<string, string | null>> = {\n sifa: null,\n kootana: 'stream:kootana',\n unclear: null,\n};\n\n// ---------------------------------------------------------------------------\n// Questions (asked together over one issue state)\n// ---------------------------------------------------------------------------\n\nfunction choiceQuestion(instructions: string, criteria: Record<string, string>): ChoiceQuestion {\n return { type: 'choice', instructions, criteria };\n}\n\nexport const ISSUE_TYPE_CHOICE_QUESTION = choiceQuestion(\n 'The state holds one GitHub issue (repo, title, body, existing labels). Which single type best describes it?',\n ISSUE_TYPE_TAXONOMY,\n);\n\nexport const ISSUE_STREAM_CHOICE_QUESTION = choiceQuestion(\n 'Which product stream does this issue concern?',\n ISSUE_STREAM_TAXONOMY,\n);\n\nexport const ISSUE_ACTIONABLE_NOUL_QUESTION: NoulQuestion = {\n type: 'noul',\n instructions:\n 'Does the issue contain enough information for a maintainer to act on it without asking the reporter anything?',\n criteria: {\n true: 'For a bug: steps or a trigger, expected vs actual, and an error or location. For a feature: the problem, the desired outcome, and rough scope.',\n false:\n 'Essential details are missing: no way to reproduce, no expected behaviour, vague wish with no outcome, or a bare title.',\n },\n};\n\nexport const ISSUE_SECURITY_NOUL_QUESTION: NoulQuestion = {\n type: 'noul',\n instructions: 'Does the issue describe a security-relevant problem?',\n criteria: {\n true: 'A vulnerability, auth or session flaw, data exposure, abuse or spam vector, secrets handling, or a dependency advisory.',\n false: 'An ordinary bug, feature, question, or docs issue with no security angle.',\n },\n};\n\nexport const ISSUE_REGRESSION_NOUL_QUESTION: NoulQuestion = {\n type: 'noul',\n instructions: 'Does the issue report that something which previously worked no longer works?',\n criteria: {\n true: 'The reporter states or clearly implies the behaviour worked before a release, deploy, or change.',\n false: 'A new bug with no prior-working claim, a feature request, or a question.',\n },\n};\n\n/** Stable question ids; the answer keys Jev returns. */\nexport const ISSUE_TRIAGE_QUESTION_IDS = {\n type: 'issueType',\n stream: 'issueStream',\n actionable: 'issueActionable',\n security: 'issueSecurity',\n regression: 'issueRegression',\n} as const;\n\n/** All issue questions, keyed by {@link ISSUE_TRIAGE_QUESTION_IDS}, for one batched call. */\nexport function buildIssueTriageQuestions(): Record<string, ChoiceQuestion | NoulQuestion> {\n return {\n [ISSUE_TRIAGE_QUESTION_IDS.type]: ISSUE_TYPE_CHOICE_QUESTION,\n [ISSUE_TRIAGE_QUESTION_IDS.stream]: ISSUE_STREAM_CHOICE_QUESTION,\n [ISSUE_TRIAGE_QUESTION_IDS.actionable]: ISSUE_ACTIONABLE_NOUL_QUESTION,\n [ISSUE_TRIAGE_QUESTION_IDS.security]: ISSUE_SECURITY_NOUL_QUESTION,\n [ISSUE_TRIAGE_QUESTION_IDS.regression]: ISSUE_REGRESSION_NOUL_QUESTION,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Answers -> label suggestions\n// ---------------------------------------------------------------------------\n\n/** Parsed answers for the batched issue call. */\nexport const issueTriageAnswersSchema = z.object({\n [ISSUE_TRIAGE_QUESTION_IDS.type]: choiceAnswerSchema,\n [ISSUE_TRIAGE_QUESTION_IDS.stream]: choiceAnswerSchema,\n [ISSUE_TRIAGE_QUESTION_IDS.actionable]: noulAnswerSchema,\n [ISSUE_TRIAGE_QUESTION_IDS.security]: noulAnswerSchema,\n [ISSUE_TRIAGE_QUESTION_IDS.regression]: noulAnswerSchema,\n});\nexport type IssueTriageAnswers = z.infer<typeof issueTriageAnswersSchema>;\n\n/**\n * Thresholds. Precision over recall: a wrong label costs a maintainer a click\n * and trains distrust; a missing label costs nothing. Validate on labelled\n * closed issues (sifa-api#1555) before widening.\n */\nexport const ISSUE_TYPE_CONFIDENCE_FLOOR = 0.6;\nexport const ISSUE_STREAM_CONFIDENCE_FLOOR = 0.7;\n/** Below this P(actionable) the issue gets `needs-info`. */\nexport const ISSUE_NEEDS_INFO_MAX_ACTIONABLE = 0.35;\n/** Routing labels (security, regression) need a confident yes. */\nexport const ISSUE_ROUTING_THRESHOLD = 0.85;\n\nexport interface IssueLabelSuggestions {\n /** Labels to apply, in a stable order, each guaranteed to be a real label name. */\n labels: string[];\n /** The type choice after the floor, or null when unset. */\n type: string | null;\n /** The stream choice after the floor, or null when unset. */\n stream: string | null;\n needsInfo: boolean;\n security: boolean;\n regression: boolean;\n}\n\nexport interface IssueLabelOptions {\n typeFloor?: number;\n streamFloor?: number;\n needsInfoMaxActionable?: number;\n routingThreshold?: number;\n}\n\nfunction clearsNoul(answer: NoulAnswer, threshold: number): boolean {\n return answer.noul >= threshold;\n}\n\nfunction pickType(answer: ChoiceAnswer, floor: number): string | null {\n const choice = pickChoiceAboveFloor(answer, { floor, noMatch: 'unclear' });\n return choice !== null && choice in ISSUE_TYPE_TAXONOMY ? choice : null;\n}\n\nfunction pickStream(answer: ChoiceAnswer, floor: number): string | null {\n const choice = pickChoiceAboveFloor(answer, { floor, noMatch: 'unclear' });\n return choice !== null && choice in ISSUE_STREAM_TAXONOMY ? choice : null;\n}\n\n/**\n * Turn validated answers into label suggestions. Spam short-circuits: a spam\n * issue gets only `spam`, no routing or needs-info. A choice outside the\n * taxonomy (Jev invented a key) is treated as unset.\n */\nexport function issueLabelsFromAnswers(\n answers: IssueTriageAnswers,\n opts: IssueLabelOptions = {},\n): IssueLabelSuggestions {\n const typeFloor = opts.typeFloor ?? ISSUE_TYPE_CONFIDENCE_FLOOR;\n const streamFloor = opts.streamFloor ?? ISSUE_STREAM_CONFIDENCE_FLOOR;\n const needsInfoMax = opts.needsInfoMaxActionable ?? ISSUE_NEEDS_INFO_MAX_ACTIONABLE;\n const routing = opts.routingThreshold ?? ISSUE_ROUTING_THRESHOLD;\n\n const type = pickType(answers[ISSUE_TRIAGE_QUESTION_IDS.type], typeFloor);\n if (type === 'spam') {\n return {\n labels: ['spam'],\n type,\n stream: null,\n needsInfo: false,\n security: false,\n regression: false,\n };\n }\n\n const stream = pickStream(answers[ISSUE_TRIAGE_QUESTION_IDS.stream], streamFloor);\n const needsInfo = answers[ISSUE_TRIAGE_QUESTION_IDS.actionable].noul < needsInfoMax;\n const security = clearsNoul(answers[ISSUE_TRIAGE_QUESTION_IDS.security], routing);\n const regression = clearsNoul(answers[ISSUE_TRIAGE_QUESTION_IDS.regression], routing);\n\n const labels: string[] = [];\n if (type !== null) labels.push(type);\n if (security) labels.push('security');\n if (regression) labels.push('regression');\n const streamLabel = stream !== null ? ISSUE_STREAM_LABELS[stream] : null;\n if (streamLabel) labels.push(streamLabel);\n if (needsInfo) labels.push('needs-info');\n\n return { labels, type, stream, needsInfo, security, regression };\n}\n"]}
@@ -2,7 +2,9 @@
2
2
  import {
3
3
  COMPLETENESS_MAX_SCORE,
4
4
  completenessPercent,
5
- completenessScore
5
+ completenessScore,
6
+ isOptionalCompletenessSignal,
7
+ OPTIONAL_COMPLETENESS_SIGNALS
6
8
  } from "./profile-completeness.js";
7
9
  import {
8
10
  DIMENSIONS_MAX_SCORE,
@@ -78,6 +80,7 @@ export {
78
80
  EMPTY_SITE_ACTIVITY_PRESET,
79
81
  ENTITY_REF_ANCHORS,
80
82
  MIN_SKILLS,
83
+ OPTIONAL_COMPLETENESS_SIGNALS,
81
84
  SELF_APP_ID,
82
85
  SITE_PRESET_MAX_TAGS,
83
86
  SITE_PRESET_MAX_TAG_LENGTH,
@@ -99,6 +102,7 @@ export {
99
102
  isBeyondLookahead,
100
103
  isCompanyPageIndexable,
101
104
  isLinked,
105
+ isOptionalCompletenessSignal,
102
106
  isPseudoEmployer,
103
107
  isRegistrableDomainHandle,
104
108
  isSiteActivityPresetActive,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/logic/index.ts"],"sourcesContent":["export {\n COMPLETENESS_MAX_SCORE,\n completenessPercent,\n completenessScore,\n type ProfileCompletion,\n} from './profile-completeness.js';\n\nexport {\n DIMENSIONS_MAX_SCORE,\n MIN_SKILLS,\n countFilledDimensions,\n dimensionsFromInputs,\n getFilledDimensionsMap,\n profileToDimensionInputs,\n type DimensionKey,\n type DimensionMap,\n type ProfileDimensionInputs,\n} from './profile-dimensions.js';\n\nexport { pickPrimaryPosition, type PrimaryPositionCandidate } from './primary-position.js';\n\nexport {\n DATE_LOOKAHEAD_MONTHS,\n isBeyondLookahead,\n isUpcomingStart,\n type DateLookaheadKind,\n} from './date-lookahead.js';\n\nexport { pickPrimaryFlagged, type PrimaryFlagCandidate } from './primary-item.js';\n\nexport {\n summarizeProfileView,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n} from './profile-summary.js';\n\nexport { isPseudoEmployer } from './pseudo-employer.js';\nexport { looksLikeDomain } from './domain-detect.js';\nexport {\n entityDisambiguationLabel,\n searchResultDisambiguation,\n entityResultKey,\n type DisambiguationFields,\n} from './entity-disambiguation.js';\nexport {\n classifyEntityRef,\n isLinked,\n ENTITY_REF_ANCHORS,\n type EntityRefAnchor,\n} from './entity-ref-anchor.js';\nexport { resolveAgentRef, type AgentRefFlat } from './agent-ref.js';\nexport {\n qualifiesAsOrg,\n isRegistrableDomainHandle,\n hasPersonalProfileContent,\n rendersPersonalProfile,\n rendersCompanyProfile,\n resolveAccountFacetMode,\n} from './org-floor.js';\nexport type { PersonalFacetContent } from './org-floor.js';\nexport {\n isCompanyPageIndexable,\n companyPageRichness,\n COMPANY_PAGE_MIN_FIRMOGRAPHIC_FIELDS,\n COMPANY_PAGE_MIN_DESCRIPTION_LENGTH,\n COMPANY_PAGE_ROSTER_MIN_MEMBERS,\n type CompanyFirmographics,\n type CompanyHqFacts,\n} from './company-page-indexable.js';\nexport { countRecentActivity, type DailyActivityCount } from './recent-activity.js';\nexport { followingFeedFallbackApp } from './following-feed-fallback.js';\nexport { SELF_APP_ID, excludeSelfApp, type AppWithId } from './self-app.js';\nexport { actorShowsIdentity } from './actor-identity.js';\nexport {\n EMPTY_SITE_ACTIVITY_PRESET,\n SITE_PRESET_TAG_CATEGORY,\n SITE_PRESET_MAX_TAGS,\n SITE_PRESET_MAX_TAG_LENGTH,\n normalizeSitePresetTag,\n parseSitePresetTags,\n isSiteActivityPresetActive,\n recordTags,\n matchesSitePresetTags,\n matchesSiteActivityPreset,\n siteActivityPresetSchema,\n siteActivityPresetUpdateSchema,\n type SiteActivityPreset,\n} from './site-activity-preset.js';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEP,SAAS,2BAA0D;AAEnE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,0BAAqD;AAE9D;AAAA,EACE;AAAA,OAGK;AAEP,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,uBAA0C;AACnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,2BAAoD;AAC7D,SAAS,gCAAgC;AACzC,SAAS,aAAa,sBAAsC;AAC5D,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;","names":[]}
1
+ {"version":3,"sources":["../../src/logic/index.ts"],"sourcesContent":["export {\n COMPLETENESS_MAX_SCORE,\n completenessPercent,\n completenessScore,\n isOptionalCompletenessSignal,\n OPTIONAL_COMPLETENESS_SIGNALS,\n type ProfileCompletion,\n} from './profile-completeness.js';\n\nexport {\n DIMENSIONS_MAX_SCORE,\n MIN_SKILLS,\n countFilledDimensions,\n dimensionsFromInputs,\n getFilledDimensionsMap,\n profileToDimensionInputs,\n type DimensionKey,\n type DimensionMap,\n type ProfileDimensionInputs,\n} from './profile-dimensions.js';\n\nexport { pickPrimaryPosition, type PrimaryPositionCandidate } from './primary-position.js';\n\nexport {\n DATE_LOOKAHEAD_MONTHS,\n isBeyondLookahead,\n isUpcomingStart,\n type DateLookaheadKind,\n} from './date-lookahead.js';\n\nexport { pickPrimaryFlagged, type PrimaryFlagCandidate } from './primary-item.js';\n\nexport {\n summarizeProfileView,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n} from './profile-summary.js';\n\nexport { isPseudoEmployer } from './pseudo-employer.js';\nexport { looksLikeDomain } from './domain-detect.js';\nexport {\n entityDisambiguationLabel,\n searchResultDisambiguation,\n entityResultKey,\n type DisambiguationFields,\n} from './entity-disambiguation.js';\nexport {\n classifyEntityRef,\n isLinked,\n ENTITY_REF_ANCHORS,\n type EntityRefAnchor,\n} from './entity-ref-anchor.js';\nexport { resolveAgentRef, type AgentRefFlat } from './agent-ref.js';\nexport {\n qualifiesAsOrg,\n isRegistrableDomainHandle,\n hasPersonalProfileContent,\n rendersPersonalProfile,\n rendersCompanyProfile,\n resolveAccountFacetMode,\n} from './org-floor.js';\nexport type { PersonalFacetContent } from './org-floor.js';\nexport {\n isCompanyPageIndexable,\n companyPageRichness,\n COMPANY_PAGE_MIN_FIRMOGRAPHIC_FIELDS,\n COMPANY_PAGE_MIN_DESCRIPTION_LENGTH,\n COMPANY_PAGE_ROSTER_MIN_MEMBERS,\n type CompanyFirmographics,\n type CompanyHqFacts,\n} from './company-page-indexable.js';\nexport { countRecentActivity, type DailyActivityCount } from './recent-activity.js';\nexport { followingFeedFallbackApp } from './following-feed-fallback.js';\nexport { SELF_APP_ID, excludeSelfApp, type AppWithId } from './self-app.js';\nexport { actorShowsIdentity } from './actor-identity.js';\nexport {\n EMPTY_SITE_ACTIVITY_PRESET,\n SITE_PRESET_TAG_CATEGORY,\n SITE_PRESET_MAX_TAGS,\n SITE_PRESET_MAX_TAG_LENGTH,\n normalizeSitePresetTag,\n parseSitePresetTags,\n isSiteActivityPresetActive,\n recordTags,\n matchesSitePresetTags,\n matchesSiteActivityPreset,\n siteActivityPresetSchema,\n siteActivityPresetUpdateSchema,\n type SiteActivityPreset,\n} from './site-activity-preset.js';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEP,SAAS,2BAA0D;AAEnE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,0BAAqD;AAE9D;AAAA,EACE;AAAA,OAGK;AAEP,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,uBAA0C;AACnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,2BAAoD;AAC7D,SAAS,gCAAgC;AACzC,SAAS,aAAa,sBAAsC;AAC5D,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;","names":[]}
@@ -13,9 +13,15 @@ function completenessScore(c) {
13
13
  function completenessPercent(c) {
14
14
  return Math.round(completenessScore(c) / COMPLETENESS_MAX_SCORE * 100);
15
15
  }
16
+ var OPTIONAL_COMPLETENESS_SIGNALS = ["certification"];
17
+ function isOptionalCompletenessSignal(signal) {
18
+ return OPTIONAL_COMPLETENESS_SIGNALS.some((optional) => optional === signal);
19
+ }
16
20
  export {
17
21
  COMPLETENESS_MAX_SCORE,
22
+ OPTIONAL_COMPLETENESS_SIGNALS,
18
23
  completenessPercent,
19
- completenessScore
24
+ completenessScore,
25
+ isOptionalCompletenessSignal
20
26
  };
21
27
  //# sourceMappingURL=profile-completeness.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/logic/profile-completeness.ts"],"sourcesContent":["/**\n * Profile completeness scoring.\n *\n * Six binary signals, equal weight: headline filled, about filled, has at least\n * one position, education, skill, certification.\n *\n * Score: integer 0..6. Percent: round(score / 6 * 100) -- discrete values\n * {0, 17, 33, 50, 67, 83, 100}.\n *\n * Canonical source of truth for completeness scoring across Sifa clients.\n * sifa-api computes the underlying `ProfileCompletion` shape inline (in SQL\n * for admin-stats queries, in route handlers elsewhere) but defers scoring\n * to this module.\n */\n\nexport const COMPLETENESS_MAX_SCORE = 6;\n\nexport interface ProfileCompletion {\n hasHeadline: boolean;\n hasAbout: boolean;\n positionCount: number;\n educationCount: number;\n skillCount: number;\n certificationCount: number;\n}\n\n/** Pure-TS computation of the 0..6 score. */\nexport function completenessScore(c: ProfileCompletion): number {\n let filled = 0;\n if (c.hasHeadline) filled++;\n if (c.hasAbout) filled++;\n if (c.positionCount > 0) filled++;\n if (c.educationCount > 0) filled++;\n if (c.skillCount > 0) filled++;\n if (c.certificationCount > 0) filled++;\n return filled;\n}\n\n/** Completion as a rounded 0..100 integer percent (matches API serialisation). */\nexport function completenessPercent(c: ProfileCompletion): number {\n return Math.round((completenessScore(c) / COMPLETENESS_MAX_SCORE) * 100);\n}\n"],"mappings":";AAeO,IAAM,yBAAyB;AAY/B,SAAS,kBAAkB,GAA8B;AAC9D,MAAI,SAAS;AACb,MAAI,EAAE,YAAa;AACnB,MAAI,EAAE,SAAU;AAChB,MAAI,EAAE,gBAAgB,EAAG;AACzB,MAAI,EAAE,iBAAiB,EAAG;AAC1B,MAAI,EAAE,aAAa,EAAG;AACtB,MAAI,EAAE,qBAAqB,EAAG;AAC9B,SAAO;AACT;AAGO,SAAS,oBAAoB,GAA8B;AAChE,SAAO,KAAK,MAAO,kBAAkB,CAAC,IAAI,yBAA0B,GAAG;AACzE;","names":[]}
1
+ {"version":3,"sources":["../../src/logic/profile-completeness.ts"],"sourcesContent":["/**\n * Profile completeness scoring.\n *\n * Six binary signals, equal weight: headline filled, about filled, has at least\n * one position, education, skill, certification.\n *\n * Score: integer 0..6. Percent: round(score / 6 * 100) -- discrete values\n * {0, 17, 33, 50, 67, 83, 100}.\n *\n * Canonical source of truth for completeness scoring across Sifa clients.\n * sifa-api computes the underlying `ProfileCompletion` shape inline (in SQL\n * for admin-stats queries, in route handlers elsewhere) but defers scoring\n * to this module.\n */\n\nexport const COMPLETENESS_MAX_SCORE = 6;\n\nexport interface ProfileCompletion {\n hasHeadline: boolean;\n hasAbout: boolean;\n positionCount: number;\n educationCount: number;\n skillCount: number;\n certificationCount: number;\n}\n\n/** Pure-TS computation of the 0..6 score. */\nexport function completenessScore(c: ProfileCompletion): number {\n let filled = 0;\n if (c.hasHeadline) filled++;\n if (c.hasAbout) filled++;\n if (c.positionCount > 0) filled++;\n if (c.educationCount > 0) filled++;\n if (c.skillCount > 0) filled++;\n if (c.certificationCount > 0) filled++;\n return filled;\n}\n\n/** Completion as a rounded 0..100 integer percent (matches API serialisation). */\nexport function completenessPercent(c: ProfileCompletion): number {\n return Math.round((completenessScore(c) / COMPLETENESS_MAX_SCORE) * 100);\n}\n\n/**\n * Completeness signals that are not a goal for every user, so clients never ask\n * for them: plenty of people never earn a certification, and asking for one\n * makes the \"complete your profile\" task impossible to finish. They still count\n * toward {@link completenessScore} (`certificationCount`). The AppView uses this list for the inbox\n * task count and sifa-web for the checklist, so the two stay in step.\n */\nexport const OPTIONAL_COMPLETENESS_SIGNALS = ['certification'] as const;\n\n/** True when `signal` is in {@link OPTIONAL_COMPLETENESS_SIGNALS}. */\nexport function isOptionalCompletenessSignal(signal: string): boolean {\n return OPTIONAL_COMPLETENESS_SIGNALS.some((optional) => optional === signal);\n}\n"],"mappings":";AAeO,IAAM,yBAAyB;AAY/B,SAAS,kBAAkB,GAA8B;AAC9D,MAAI,SAAS;AACb,MAAI,EAAE,YAAa;AACnB,MAAI,EAAE,SAAU;AAChB,MAAI,EAAE,gBAAgB,EAAG;AACzB,MAAI,EAAE,iBAAiB,EAAG;AAC1B,MAAI,EAAE,aAAa,EAAG;AACtB,MAAI,EAAE,qBAAqB,EAAG;AAC9B,SAAO;AACT;AAGO,SAAS,oBAAoB,GAA8B;AAChE,SAAO,KAAK,MAAO,kBAAkB,CAAC,IAAI,yBAA0B,GAAG;AACzE;AASO,IAAM,gCAAgC,CAAC,eAAe;AAGtD,SAAS,6BAA6B,QAAyB;AACpE,SAAO,8BAA8B,KAAK,CAAC,aAAa,aAAa,MAAM;AAC7E;","names":[]}
@@ -13,14 +13,16 @@ async function getAdminReviewQueues(config, opts = {}) {
13
13
  const nameCorrections = res.nameCorrections ?? 0;
14
14
  const pendingCompanies = res.pendingCompanies ?? 0;
15
15
  const duplicateOrgs = res.duplicateOrgs ?? 0;
16
+ const inferredFactReports = res.inferredFactReports ?? 0;
16
17
  return {
17
18
  ideas,
18
19
  nameCorrections,
19
20
  pendingCompanies,
20
21
  duplicateOrgs,
22
+ inferredFactReports,
21
23
  // Derived rather than trusted so an API that predates the field still
22
24
  // yields a usable pill count.
23
- total: res.total ?? ideas + nameCorrections + pendingCompanies + duplicateOrgs,
25
+ total: res.total ?? ideas + nameCorrections + pendingCompanies + duplicateOrgs + inferredFactReports,
24
26
  generatedAt: res.generatedAt ?? ""
25
27
  };
26
28
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/query/fetchers/admin-review-queues.ts"],"sourcesContent":["import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Options for {@link getAdminReviewQueues}. Supports the same `cookieHeader`\n * passthrough as the other admin reads for RSC contexts.\n */\nexport interface GetAdminReviewQueuesOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/** Response shape of `GET /api/admin/stats/review-queues`. */\nexport interface AdminReviewQueues {\n ideas: number;\n nameCorrections: number;\n pendingCompanies: number;\n duplicateOrgs: number;\n /** Sum of the queues. */\n total: number;\n generatedAt: string;\n}\n\n/**\n * Open counts for the three admin review queues (ideas, pending companies,\n * name corrections) plus their total.\n *\n * Unlike {@link listFeatureAllowlist} this does NOT swallow errors: a zeroed\n * payload would render as \"all queues clear\" in the admin nav, which is worse\n * than rendering nothing. Callers decide how to degrade.\n */\nexport async function getAdminReviewQueues(\n config: SifaApiConfig,\n opts: GetAdminReviewQueuesOptions = {},\n): Promise<AdminReviewQueues> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n const res = await apiFetch<Partial<AdminReviewQueues>>(config, '/api/admin/stats/review-queues', {\n credentials: 'include',\n cache: 'no-store',\n ...opts,\n headers,\n });\n\n const ideas = res.ideas ?? 0;\n const nameCorrections = res.nameCorrections ?? 0;\n const pendingCompanies = res.pendingCompanies ?? 0;\n const duplicateOrgs = res.duplicateOrgs ?? 0;\n\n return {\n ideas,\n nameCorrections,\n pendingCompanies,\n duplicateOrgs,\n // Derived rather than trusted so an API that predates the field still\n // yields a usable pill count.\n total: res.total ?? ideas + nameCorrections + pendingCompanies + duplicateOrgs,\n generatedAt: res.generatedAt ?? '',\n };\n}\n"],"mappings":";AAAA,SAAS,gBAA0D;AA6BnE,eAAsB,qBACpB,QACA,OAAoC,CAAC,GACT;AAC5B,QAAM,UAAkC,EAAE,GAAI,KAAK,WAAW,CAAC,EAAG;AAClE,MAAI,KAAK,aAAc,SAAQ,SAAS,KAAK;AAE7C,QAAM,MAAM,MAAM,SAAqC,QAAQ,kCAAkC;AAAA,IAC/F,aAAa;AAAA,IACb,OAAO;AAAA,IACP,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,QAAQ,IAAI,SAAS;AAC3B,QAAM,kBAAkB,IAAI,mBAAmB;AAC/C,QAAM,mBAAmB,IAAI,oBAAoB;AACjD,QAAM,gBAAgB,IAAI,iBAAiB;AAE3C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,OAAO,IAAI,SAAS,QAAQ,kBAAkB,mBAAmB;AAAA,IACjE,aAAa,IAAI,eAAe;AAAA,EAClC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/query/fetchers/admin-review-queues.ts"],"sourcesContent":["import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Options for {@link getAdminReviewQueues}. Supports the same `cookieHeader`\n * passthrough as the other admin reads for RSC contexts.\n */\nexport interface GetAdminReviewQueuesOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/** Response shape of `GET /api/admin/stats/review-queues`. */\nexport interface AdminReviewQueues {\n ideas: number;\n nameCorrections: number;\n pendingCompanies: number;\n duplicateOrgs: number;\n /** Pending reports of wrong Jev-inferred company facts (one per org + field). */\n inferredFactReports: number;\n /** Sum of the queues. */\n total: number;\n generatedAt: string;\n}\n\n/**\n * Open counts for the three admin review queues (ideas, pending companies,\n * name corrections) plus their total.\n *\n * Unlike {@link listFeatureAllowlist} this does NOT swallow errors: a zeroed\n * payload would render as \"all queues clear\" in the admin nav, which is worse\n * than rendering nothing. Callers decide how to degrade.\n */\nexport async function getAdminReviewQueues(\n config: SifaApiConfig,\n opts: GetAdminReviewQueuesOptions = {},\n): Promise<AdminReviewQueues> {\n const headers: Record<string, string> = { ...(opts.headers ?? {}) };\n if (opts.cookieHeader) headers.cookie = opts.cookieHeader;\n\n const res = await apiFetch<Partial<AdminReviewQueues>>(config, '/api/admin/stats/review-queues', {\n credentials: 'include',\n cache: 'no-store',\n ...opts,\n headers,\n });\n\n const ideas = res.ideas ?? 0;\n const nameCorrections = res.nameCorrections ?? 0;\n const pendingCompanies = res.pendingCompanies ?? 0;\n const duplicateOrgs = res.duplicateOrgs ?? 0;\n const inferredFactReports = res.inferredFactReports ?? 0;\n\n return {\n ideas,\n nameCorrections,\n pendingCompanies,\n duplicateOrgs,\n inferredFactReports,\n // Derived rather than trusted so an API that predates the field still\n // yields a usable pill count.\n total:\n res.total ?? ideas + nameCorrections + pendingCompanies + duplicateOrgs + inferredFactReports,\n generatedAt: res.generatedAt ?? '',\n };\n}\n"],"mappings":";AAAA,SAAS,gBAA0D;AA+BnE,eAAsB,qBACpB,QACA,OAAoC,CAAC,GACT;AAC5B,QAAM,UAAkC,EAAE,GAAI,KAAK,WAAW,CAAC,EAAG;AAClE,MAAI,KAAK,aAAc,SAAQ,SAAS,KAAK;AAE7C,QAAM,MAAM,MAAM,SAAqC,QAAQ,kCAAkC;AAAA,IAC/F,aAAa;AAAA,IACb,OAAO;AAAA,IACP,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,QAAQ,IAAI,SAAS;AAC3B,QAAM,kBAAkB,IAAI,mBAAmB;AAC/C,QAAM,mBAAmB,IAAI,oBAAoB;AACjD,QAAM,gBAAgB,IAAI,iBAAiB;AAC3C,QAAM,sBAAsB,IAAI,uBAAuB;AAEvD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,OACE,IAAI,SAAS,QAAQ,kBAAkB,mBAAmB,gBAAgB;AAAA,IAC5E,aAAa,IAAI,eAAe;AAAA,EAClC;AACF;","names":[]}
@@ -631,6 +631,9 @@ var PROFILE_COMPLETENESS_SIGNALS = [
631
631
  "skill",
632
632
  "certification"
633
633
  ];
634
+ function isProfileCompletenessSignal(value) {
635
+ return PROFILE_COMPLETENESS_SIGNALS.some((signal) => signal === value);
636
+ }
634
637
  async function fetchProfileCompleteness(config, options = {}) {
635
638
  const { cookieHeader, ...rest } = options;
636
639
  const headers = { ...rest.headers ?? {} };
@@ -651,16 +654,27 @@ async function fetchProfileCompleteness(config, options = {}) {
651
654
  });
652
655
  if (!data) return empty;
653
656
  const missing = Array.isArray(data.missing) ? data.missing : [];
657
+ const dismissed = Array.isArray(data.dismissed) ? data.dismissed.filter(isProfileCompletenessSignal) : void 0;
654
658
  return {
655
659
  complete: data.complete ?? missing.length === 0,
656
660
  score: data.score ?? PROFILE_COMPLETENESS_SIGNALS.length - missing.length,
657
661
  total: data.total ?? PROFILE_COMPLETENESS_SIGNALS.length,
658
- missing
662
+ missing,
663
+ ...dismissed ? { dismissed } : {}
659
664
  };
660
665
  } catch {
661
666
  return empty;
662
667
  }
663
668
  }
669
+ function dismissCompletenessSignal(config, data, options = {}) {
670
+ return apiWrite(config, "/api/profile/completeness/dismiss", "POST", { body: data, ...options });
671
+ }
672
+ function clearCompletenessDismissals(config, options = {}) {
673
+ return apiWrite(config, "/api/profile/completeness/dismissals/clear", "POST", {
674
+ body: {},
675
+ ...options
676
+ });
677
+ }
664
678
 
665
679
  // src/query/fetchers/keytrace-claims.ts
666
680
  function hideKeytraceClaim(config, rkey, options = {}) {
@@ -1270,14 +1284,16 @@ async function getAdminReviewQueues(config, opts = {}) {
1270
1284
  const nameCorrections = res.nameCorrections ?? 0;
1271
1285
  const pendingCompanies = res.pendingCompanies ?? 0;
1272
1286
  const duplicateOrgs = res.duplicateOrgs ?? 0;
1287
+ const inferredFactReports = res.inferredFactReports ?? 0;
1273
1288
  return {
1274
1289
  ideas,
1275
1290
  nameCorrections,
1276
1291
  pendingCompanies,
1277
1292
  duplicateOrgs,
1293
+ inferredFactReports,
1278
1294
  // Derived rather than trusted so an API that predates the field still
1279
1295
  // yields a usable pill count.
1280
- total: res.total ?? ideas + nameCorrections + pendingCompanies + duplicateOrgs,
1296
+ total: res.total ?? ideas + nameCorrections + pendingCompanies + duplicateOrgs + inferredFactReports,
1281
1297
  generatedAt: res.generatedAt ?? ""
1282
1298
  };
1283
1299
  }
@@ -2267,6 +2283,7 @@ exports.bulkUnhideStandardPublications = bulkUnhideStandardPublications;
2267
2283
  exports.castRoadmapVote = castRoadmapVote;
2268
2284
  exports.checkAppAccount = checkAppAccount;
2269
2285
  exports.checkNetworkMapJobStatus = checkNetworkMapJobStatus;
2286
+ exports.clearCompletenessDismissals = clearCompletenessDismissals;
2270
2287
  exports.confirmEndorsement = confirmEndorsement;
2271
2288
  exports.createConfirmation = createConfirmation;
2272
2289
  exports.createEducation = createEducation;
@@ -2290,6 +2307,7 @@ exports.deleteReaction = deleteReaction;
2290
2307
  exports.deleteRecord = deleteRecord;
2291
2308
  exports.deleteRepoRecords = deleteRepoRecords;
2292
2309
  exports.deleteSkill = deleteSkill;
2310
+ exports.dismissCompletenessSignal = dismissCompletenessSignal;
2293
2311
  exports.dismissConfirmation = dismissConfirmation;
2294
2312
  exports.dismissEndorsement = dismissEndorsement;
2295
2313
  exports.dismissUnlinkedPosition = dismissUnlinkedPosition;