@singi-labs/sifa-sdk 0.19.99 → 0.19.101
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.
- package/dist/{index-CL8l5aB-.d.cts → index-BQAKeEoj.d.cts} +13 -1
- package/dist/{index-5T1grOo4.d.ts → index-DDh2RLvx.d.ts} +13 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jev/index.cjs +0 -2
- package/dist/jev/index.cjs.map +1 -1
- package/dist/jev/index.d.cts +4 -0
- package/dist/jev/index.d.ts +4 -0
- package/dist/jev/index.js +0 -2
- package/dist/jev/index.js.map +1 -1
- package/dist/jev/issue.cjs.map +1 -1
- package/dist/jsonld/index.d.cts +1 -1
- package/dist/jsonld/index.d.ts +1 -1
- package/dist/{network-map-CkmtsHDY.d.cts → network-map-CVr1LskK.d.cts} +3 -3
- package/dist/{network-map-v2LJbj0p.d.ts → network-map-DTlhFNIf.d.ts} +3 -3
- package/dist/{profile-summary-BpDqAdtX.d.ts → profile-summary-0T0VS7Rz.d.ts} +1 -1
- package/dist/{profile-summary-yoljNqGz.d.cts → profile-summary-C5LlxPKK.d.cts} +1 -1
- package/dist/query/fetchers/index.d.cts +6 -6
- package/dist/query/fetchers/index.d.ts +6 -6
- package/dist/query/hooks/index.d.cts +4 -4
- package/dist/query/hooks/index.d.ts +4 -4
- package/dist/query/index.d.cts +9 -9
- package/dist/query/index.d.ts +9 -9
- package/dist/resume/index.d.cts +1 -1
- package/dist/resume/index.d.ts +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/{types-B9nkqX3O.d.ts → types-B0zZiWDH.d.ts} +1 -1
- package/dist/{types-C6ghq8Fv.d.cts → types-jE1ofoPI.d.cts} +1 -1
- package/dist/{use-user-settings-BNhxzw2f.d.ts → use-user-settings-CCAw3_Q2.d.ts} +3 -3
- package/dist/{use-user-settings-Bah9kEqH.d.cts → use-user-settings-DjnTECGe.d.cts} +3 -3
- package/dist/{user-settings-CdXeV4lU.d.cts → user-settings-C5sOgvhL.d.cts} +2 -2
- package/dist/{user-settings-C_8R5XSQ.d.ts → user-settings-D_DjukR6.d.ts} +2 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { P as ProfileSkill, a as ProfilePresentationDelivery, L as LocationValue, b as PdsProviderInfo, c as Profile, A as AccountFacetMode, d as ProfilePosition, e as ProfileCertification, f as ProfileEducation, g as ProfileHonor, h as ProfileLanguage, i as ProfileProject, j as ProfilePublication, k as ProfileInvolvement, R as RelatedIdentifier } from './index-
|
|
2
|
-
export { l as ActiveApp, m as ActorCard, n as AuthorSuggestion, C as CoSpeaker, E as Endorsement, o as EndorsementData, p as ExternalAccount, q as ExternalAccountKeytraceClaim, F as FeedItem, r as LanguageProficiency, O as OrgAddressView, s as OrgFloorVerdict, t as OrgLinkView, u as OrgProfileView, v as PROJECT_ROLES, w as PositionConfirmations, x as PositionEmailVerification, y as PositionOrgVerification, z as
|
|
3
|
-
import { S as SearchFilters } from './types-
|
|
4
|
-
export { A as ADULT_CONTENT_LABELS, a as ActiveAppView, b as ActivityLabel, c as AdultContentLabel, d as AtfundLinkView, C as CertificationView, e as CoSpeakerView, f as ContributorView, g as CourseView, D as DurationView, E as EMPTY_SITE_ACTIVITY_PRESET, h as EducationView, i as ExternalAccountView, H as HonorView, I as IndustryDomain, j as InvolvementLinkView, k as InvolvementView, L as LanguageView, P as PositionView, l as PresentationDeliveryView, m as PresentationView, n as ProfileLocationView, o as ProfileView, p as ProjectMemberView, q as ProjectView, r as PublicationView, R as RepoCollectionGroup, s as RepoDeleteOutcome, t as RepoDeleteRecordResult, u as RepoDeleteResult, v as RepoGroupDefinition, w as RepoGroupId, x as RepoInventory, y as RepoRecordLabel, z as RepoRecordSummary, B as SIFA_REPO_GROUPS, F as SITE_PRESET_MAX_TAGS, G as SITE_PRESET_MAX_TAG_LENGTH, J as SITE_PRESET_TAG_CATEGORY, K as SiteActivityPreset, M as SkillView, V as VolunteeringView, N as describeSifaRecord, O as hasAdultContent, Q as isSiteActivityPresetActive, T as matchesSiteActivityPreset, U as matchesSitePresetTags, W as normalizeSitePresetTag, X as parseSitePresetTags, Y as recordTags, Z as repoGroupForCollection, _ as siteActivityPresetSchema, $ as siteActivityPresetUpdateSchema } from './types-
|
|
1
|
+
import { P as ProfileSkill, a as ProfilePresentationDelivery, L as LocationValue, b as PdsProviderInfo, c as Profile, A as AccountFacetMode, d as ProfilePosition, e as ProfileCertification, f as ProfileEducation, g as ProfileHonor, h as ProfileLanguage, i as ProfileProject, j as ProfilePublication, k as ProfileInvolvement, R as RelatedIdentifier } from './index-BQAKeEoj.cjs';
|
|
2
|
+
export { l as ActiveApp, m as ActorCard, n as AuthorSuggestion, C as CoSpeaker, E as Endorsement, o as EndorsementData, p as ExternalAccount, q as ExternalAccountKeytraceClaim, F as FeedItem, r as LanguageProficiency, O as OrgAddressView, s as OrgFloorVerdict, t as OrgLinkView, u as OrgProfileView, v as PROJECT_ROLES, w as PositionConfirmations, x as PositionEmailVerification, y as PositionOrgVerification, z as PositionPeerVerification, B as PositionViewerConfirmation, D as PresentationLinkView, G as ProfileCourse, H as ProfileIndustry, I as ProfileInvestment, J as ProfileInvestmentLink, K as ProfileInvolvementLink, M as ProfileLocation, N as ProfileOverrideSource, Q as ProfilePresentation, S as ProfileVolunteering, T as ProjectEventView, U as ProjectMemberCard, V as ProjectRole, W as PublicationContributor, X as RecognizedEntity, Y as SkillRef, Z as SkillSuggestion, _ as TrustStat, $ as VerifiedAccount } from './index-BQAKeEoj.cjs';
|
|
3
|
+
import { S as SearchFilters } from './types-jE1ofoPI.cjs';
|
|
4
|
+
export { A as ADULT_CONTENT_LABELS, a as ActiveAppView, b as ActivityLabel, c as AdultContentLabel, d as AtfundLinkView, C as CertificationView, e as CoSpeakerView, f as ContributorView, g as CourseView, D as DurationView, E as EMPTY_SITE_ACTIVITY_PRESET, h as EducationView, i as ExternalAccountView, H as HonorView, I as IndustryDomain, j as InvolvementLinkView, k as InvolvementView, L as LanguageView, P as PositionView, l as PresentationDeliveryView, m as PresentationView, n as ProfileLocationView, o as ProfileView, p as ProjectMemberView, q as ProjectView, r as PublicationView, R as RepoCollectionGroup, s as RepoDeleteOutcome, t as RepoDeleteRecordResult, u as RepoDeleteResult, v as RepoGroupDefinition, w as RepoGroupId, x as RepoInventory, y as RepoRecordLabel, z as RepoRecordSummary, B as SIFA_REPO_GROUPS, F as SITE_PRESET_MAX_TAGS, G as SITE_PRESET_MAX_TAG_LENGTH, J as SITE_PRESET_TAG_CATEGORY, K as SiteActivityPreset, M as SkillView, V as VolunteeringView, N as describeSifaRecord, O as hasAdultContent, Q as isSiteActivityPresetActive, T as matchesSiteActivityPreset, U as matchesSitePresetTags, W as normalizeSitePresetTag, X as parseSitePresetTags, Y as recordTags, Z as repoGroupForCollection, _ as siteActivityPresetSchema, $ as siteActivityPresetUpdateSchema } from './types-jE1ofoPI.cjs';
|
|
5
5
|
import { A as AgentRef } from './verification-providers-DeyGqaoC.cjs';
|
|
6
6
|
export { a as AccountVerification, V as VERIFICATION_PROVIDERS, b as VerificationProvider, c as VerificationProviderId, d as VerificationSource, e as VerifierListItem, f as agentRefSchema, g as atUriSchema, h as buildVerifierListMembers, i as cidSchema, j as datetimeSchema, k as didSchema, l as externalRecordRefSchema, m as getVerificationProvider, n as isKnownVerificationProvider, o as languageTagSchema, p as maxGraphemes, q as partialDateSchema, r as primaryVerification, s as resolveVerificationBadges, t as resolveVerifierProvider, u as selfLabelsSchema, v as skillRefSchema, w as strongRefSchema, x as uriSchema, y as verificationLabel } from './verification-providers-DeyGqaoC.cjs';
|
|
7
7
|
import { P as PresentationDuration, a as ProfilePresentationDeliveryRecord, b as ProfilePresentationRecord, O as OrgProfileRecord } from './profile-investment-QSwX2GL5.cjs';
|
|
8
8
|
export { A as ArtifactLink, c as ArtifactLinkSchema, d as AtmosphereFeedItem, e as AtmosphereFeedItemSchema, B as BlobRef, f as BlobRefSchema, E as EMPLOYMENT_STATUS_TOKENS, g as EmploymentVerificationRecord, h as EmploymentVerificationRecordSchema, i as EmploymentVerificationResolution, j as EndorsementConfirmationRecord, k as EndorsementConfirmationRecordSchema, l as EndorsementRecord, m as EndorsementRecordSchema, F as FeedActor, n as FeedActorSchema, o as FeedCursor, p as FollowFeedItem, q as FollowFeedItemSchema, r as FollowFeedPage, s as FollowFeedPageSchema, G as GraphFollowRecord, t as GraphFollowRecordSchema, I as InvestmentAmountSchema, u as OrgEmploymentAttestationRecord, v as OrgEmploymentAttestationRecordSchema, w as OrgProfileRecordSchema, x as PROFILE_INVESTMENT_NSID, y as PROFILE_INVOLVEMENT_NSID, z as PresentationDurationSchema, C as PresentationLink, D as PresentationLinkSchema, H as ProfileCertificationRecord, J as ProfileCertificationRecordSchema, K as ProfileCourseRecord, L as ProfileCourseRecordSchema, M as ProfileEducationRecord, N as ProfileEducationRecordSchema, Q as ProfileExternalAccountRecord, R as ProfileExternalAccountRecordSchema, S as ProfileHonorRecord, T as ProfileHonorRecordSchema, U as ProfileInvestmentRecordSchema, V as ProfileInvolvementRecord, W as ProfileInvolvementRecordSchema, X as ProfileLanguageRecord, Y as ProfileLanguageRecordSchema, Z as ProfilePositionRecord, _ as ProfilePositionRecordSchema, $ as ProfilePresentationDeliveryRecordSchema, a0 as ProfilePresentationRecordSchema, a1 as ProfileProjectRecord, a2 as ProfileProjectRecordSchema, a3 as ProfilePublicationRecord, a4 as ProfilePublicationRecordSchema, a5 as ProfileSelfRecord, a6 as ProfileSelfRecordSchema, a7 as ProfileSkillRecord, a8 as ProfileSkillRecordSchema, a9 as ProfileVolunteeringRecord, aa as ProfileVolunteeringRecordSchema, ab as PublicationAuthor, ac as PublicationAuthorSchema, ad as RelatedIdentifierSchema, ae as ResolveEmploymentVerificationOptions, af as SifaFeedItem, ag as SifaFeedItemSchema, ah as VERIFICATION_METHOD_TOKENS, ai as decodeFeedCursor, aj as encodeFeedCursor, ak as makeGraphFollowRecordSchema, al as resolveEmploymentVerification } from './profile-investment-QSwX2GL5.cjs';
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
-
export { P as ProfileSummary, S as SummarizeProfileViewOptions, s as summarizeProfileView } from './profile-summary-
|
|
10
|
+
export { P as ProfileSummary, S as SummarizeProfileViewOptions, s as summarizeProfileView } from './profile-summary-C5LlxPKK.cjs';
|
|
11
11
|
import { E as EntitySearchResult } from './follow-profile-CgLLLQtJ.cjs';
|
|
12
12
|
export { a as EntityImportSearchResponse, b as EntityImportSearchResponseSchema, c as EntityMintDomainResponse, d as EntityMintDomainResponseSchema, e as EntityResolveDomainRequest, f as EntityResolveDomainRequestSchema, g as EntityResolveDomainResponse, h as EntityResolveDomainResponseSchema, i as EntitySearchResponse, j as EntitySearchResponseSchema, k as EntitySearchResultSchema, l as EntitySelectRequest, m as EntitySelectRequestSchema, n as EntitySelectResponse, o as EntitySelectResponseSchema, F as FEATURE_FLAGS, p as FeatureAllowlistEntry, q as FeatureAllowlistEntrySchema, r as FeatureFlag, s as FollowProfileItem, t as FollowProfilePage, u as FollowProfilePageSchema, v as FollowProfileSchema } from './follow-profile-CgLLLQtJ.cjs';
|
|
13
13
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { P as ProfileSkill, a as ProfilePresentationDelivery, L as LocationValue, b as PdsProviderInfo, c as Profile, A as AccountFacetMode, d as ProfilePosition, e as ProfileCertification, f as ProfileEducation, g as ProfileHonor, h as ProfileLanguage, i as ProfileProject, j as ProfilePublication, k as ProfileInvolvement, R as RelatedIdentifier } from './index-
|
|
2
|
-
export { l as ActiveApp, m as ActorCard, n as AuthorSuggestion, C as CoSpeaker, E as Endorsement, o as EndorsementData, p as ExternalAccount, q as ExternalAccountKeytraceClaim, F as FeedItem, r as LanguageProficiency, O as OrgAddressView, s as OrgFloorVerdict, t as OrgLinkView, u as OrgProfileView, v as PROJECT_ROLES, w as PositionConfirmations, x as PositionEmailVerification, y as PositionOrgVerification, z as
|
|
3
|
-
import { S as SearchFilters } from './types-
|
|
4
|
-
export { A as ADULT_CONTENT_LABELS, a as ActiveAppView, b as ActivityLabel, c as AdultContentLabel, d as AtfundLinkView, C as CertificationView, e as CoSpeakerView, f as ContributorView, g as CourseView, D as DurationView, E as EMPTY_SITE_ACTIVITY_PRESET, h as EducationView, i as ExternalAccountView, H as HonorView, I as IndustryDomain, j as InvolvementLinkView, k as InvolvementView, L as LanguageView, P as PositionView, l as PresentationDeliveryView, m as PresentationView, n as ProfileLocationView, o as ProfileView, p as ProjectMemberView, q as ProjectView, r as PublicationView, R as RepoCollectionGroup, s as RepoDeleteOutcome, t as RepoDeleteRecordResult, u as RepoDeleteResult, v as RepoGroupDefinition, w as RepoGroupId, x as RepoInventory, y as RepoRecordLabel, z as RepoRecordSummary, B as SIFA_REPO_GROUPS, F as SITE_PRESET_MAX_TAGS, G as SITE_PRESET_MAX_TAG_LENGTH, J as SITE_PRESET_TAG_CATEGORY, K as SiteActivityPreset, M as SkillView, V as VolunteeringView, N as describeSifaRecord, O as hasAdultContent, Q as isSiteActivityPresetActive, T as matchesSiteActivityPreset, U as matchesSitePresetTags, W as normalizeSitePresetTag, X as parseSitePresetTags, Y as recordTags, Z as repoGroupForCollection, _ as siteActivityPresetSchema, $ as siteActivityPresetUpdateSchema } from './types-
|
|
1
|
+
import { P as ProfileSkill, a as ProfilePresentationDelivery, L as LocationValue, b as PdsProviderInfo, c as Profile, A as AccountFacetMode, d as ProfilePosition, e as ProfileCertification, f as ProfileEducation, g as ProfileHonor, h as ProfileLanguage, i as ProfileProject, j as ProfilePublication, k as ProfileInvolvement, R as RelatedIdentifier } from './index-DDh2RLvx.js';
|
|
2
|
+
export { l as ActiveApp, m as ActorCard, n as AuthorSuggestion, C as CoSpeaker, E as Endorsement, o as EndorsementData, p as ExternalAccount, q as ExternalAccountKeytraceClaim, F as FeedItem, r as LanguageProficiency, O as OrgAddressView, s as OrgFloorVerdict, t as OrgLinkView, u as OrgProfileView, v as PROJECT_ROLES, w as PositionConfirmations, x as PositionEmailVerification, y as PositionOrgVerification, z as PositionPeerVerification, B as PositionViewerConfirmation, D as PresentationLinkView, G as ProfileCourse, H as ProfileIndustry, I as ProfileInvestment, J as ProfileInvestmentLink, K as ProfileInvolvementLink, M as ProfileLocation, N as ProfileOverrideSource, Q as ProfilePresentation, S as ProfileVolunteering, T as ProjectEventView, U as ProjectMemberCard, V as ProjectRole, W as PublicationContributor, X as RecognizedEntity, Y as SkillRef, Z as SkillSuggestion, _ as TrustStat, $ as VerifiedAccount } from './index-DDh2RLvx.js';
|
|
3
|
+
import { S as SearchFilters } from './types-B0zZiWDH.js';
|
|
4
|
+
export { A as ADULT_CONTENT_LABELS, a as ActiveAppView, b as ActivityLabel, c as AdultContentLabel, d as AtfundLinkView, C as CertificationView, e as CoSpeakerView, f as ContributorView, g as CourseView, D as DurationView, E as EMPTY_SITE_ACTIVITY_PRESET, h as EducationView, i as ExternalAccountView, H as HonorView, I as IndustryDomain, j as InvolvementLinkView, k as InvolvementView, L as LanguageView, P as PositionView, l as PresentationDeliveryView, m as PresentationView, n as ProfileLocationView, o as ProfileView, p as ProjectMemberView, q as ProjectView, r as PublicationView, R as RepoCollectionGroup, s as RepoDeleteOutcome, t as RepoDeleteRecordResult, u as RepoDeleteResult, v as RepoGroupDefinition, w as RepoGroupId, x as RepoInventory, y as RepoRecordLabel, z as RepoRecordSummary, B as SIFA_REPO_GROUPS, F as SITE_PRESET_MAX_TAGS, G as SITE_PRESET_MAX_TAG_LENGTH, J as SITE_PRESET_TAG_CATEGORY, K as SiteActivityPreset, M as SkillView, V as VolunteeringView, N as describeSifaRecord, O as hasAdultContent, Q as isSiteActivityPresetActive, T as matchesSiteActivityPreset, U as matchesSitePresetTags, W as normalizeSitePresetTag, X as parseSitePresetTags, Y as recordTags, Z as repoGroupForCollection, _ as siteActivityPresetSchema, $ as siteActivityPresetUpdateSchema } from './types-B0zZiWDH.js';
|
|
5
5
|
import { A as AgentRef } from './verification-providers-DeyGqaoC.js';
|
|
6
6
|
export { a as AccountVerification, V as VERIFICATION_PROVIDERS, b as VerificationProvider, c as VerificationProviderId, d as VerificationSource, e as VerifierListItem, f as agentRefSchema, g as atUriSchema, h as buildVerifierListMembers, i as cidSchema, j as datetimeSchema, k as didSchema, l as externalRecordRefSchema, m as getVerificationProvider, n as isKnownVerificationProvider, o as languageTagSchema, p as maxGraphemes, q as partialDateSchema, r as primaryVerification, s as resolveVerificationBadges, t as resolveVerifierProvider, u as selfLabelsSchema, v as skillRefSchema, w as strongRefSchema, x as uriSchema, y as verificationLabel } from './verification-providers-DeyGqaoC.js';
|
|
7
7
|
import { P as PresentationDuration, a as ProfilePresentationDeliveryRecord, b as ProfilePresentationRecord, O as OrgProfileRecord } from './profile-investment-QSwX2GL5.js';
|
|
8
8
|
export { A as ArtifactLink, c as ArtifactLinkSchema, d as AtmosphereFeedItem, e as AtmosphereFeedItemSchema, B as BlobRef, f as BlobRefSchema, E as EMPLOYMENT_STATUS_TOKENS, g as EmploymentVerificationRecord, h as EmploymentVerificationRecordSchema, i as EmploymentVerificationResolution, j as EndorsementConfirmationRecord, k as EndorsementConfirmationRecordSchema, l as EndorsementRecord, m as EndorsementRecordSchema, F as FeedActor, n as FeedActorSchema, o as FeedCursor, p as FollowFeedItem, q as FollowFeedItemSchema, r as FollowFeedPage, s as FollowFeedPageSchema, G as GraphFollowRecord, t as GraphFollowRecordSchema, I as InvestmentAmountSchema, u as OrgEmploymentAttestationRecord, v as OrgEmploymentAttestationRecordSchema, w as OrgProfileRecordSchema, x as PROFILE_INVESTMENT_NSID, y as PROFILE_INVOLVEMENT_NSID, z as PresentationDurationSchema, C as PresentationLink, D as PresentationLinkSchema, H as ProfileCertificationRecord, J as ProfileCertificationRecordSchema, K as ProfileCourseRecord, L as ProfileCourseRecordSchema, M as ProfileEducationRecord, N as ProfileEducationRecordSchema, Q as ProfileExternalAccountRecord, R as ProfileExternalAccountRecordSchema, S as ProfileHonorRecord, T as ProfileHonorRecordSchema, U as ProfileInvestmentRecordSchema, V as ProfileInvolvementRecord, W as ProfileInvolvementRecordSchema, X as ProfileLanguageRecord, Y as ProfileLanguageRecordSchema, Z as ProfilePositionRecord, _ as ProfilePositionRecordSchema, $ as ProfilePresentationDeliveryRecordSchema, a0 as ProfilePresentationRecordSchema, a1 as ProfileProjectRecord, a2 as ProfileProjectRecordSchema, a3 as ProfilePublicationRecord, a4 as ProfilePublicationRecordSchema, a5 as ProfileSelfRecord, a6 as ProfileSelfRecordSchema, a7 as ProfileSkillRecord, a8 as ProfileSkillRecordSchema, a9 as ProfileVolunteeringRecord, aa as ProfileVolunteeringRecordSchema, ab as PublicationAuthor, ac as PublicationAuthorSchema, ad as RelatedIdentifierSchema, ae as ResolveEmploymentVerificationOptions, af as SifaFeedItem, ag as SifaFeedItemSchema, ah as VERIFICATION_METHOD_TOKENS, ai as decodeFeedCursor, aj as encodeFeedCursor, ak as makeGraphFollowRecordSchema, al as resolveEmploymentVerification } from './profile-investment-QSwX2GL5.js';
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
-
export { P as ProfileSummary, S as SummarizeProfileViewOptions, s as summarizeProfileView } from './profile-summary-
|
|
10
|
+
export { P as ProfileSummary, S as SummarizeProfileViewOptions, s as summarizeProfileView } from './profile-summary-0T0VS7Rz.js';
|
|
11
11
|
import { E as EntitySearchResult } from './follow-profile-CVcA2w1v.js';
|
|
12
12
|
export { a as EntityImportSearchResponse, b as EntityImportSearchResponseSchema, c as EntityMintDomainResponse, d as EntityMintDomainResponseSchema, e as EntityResolveDomainRequest, f as EntityResolveDomainRequestSchema, g as EntityResolveDomainResponse, h as EntityResolveDomainResponseSchema, i as EntitySearchResponse, j as EntitySearchResponseSchema, k as EntitySearchResultSchema, l as EntitySelectRequest, m as EntitySelectRequestSchema, n as EntitySelectResponse, o as EntitySelectResponseSchema, F as FEATURE_FLAGS, p as FeatureAllowlistEntry, q as FeatureAllowlistEntrySchema, r as FeatureFlag, s as FollowProfileItem, t as FollowProfilePage, u as FollowProfilePageSchema, v as FollowProfileSchema } from './follow-profile-CVcA2w1v.js';
|
|
13
13
|
|
package/dist/index.js
CHANGED
|
@@ -379,7 +379,7 @@ import {
|
|
|
379
379
|
roadmapIssueUrl
|
|
380
380
|
} from "./roadmap/index.js";
|
|
381
381
|
import { SIFA_REPO_GROUPS, describeSifaRecord, repoGroupForCollection } from "./repo/index.js";
|
|
382
|
-
var SIFA_SDK_VERSION = "0.19.
|
|
382
|
+
var SIFA_SDK_VERSION = "0.19.101";
|
|
383
383
|
export {
|
|
384
384
|
ACTIVITY_TIERS,
|
|
385
385
|
ACTIVITY_VERBS,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Sifa SDK -- public client library for the Sifa AppView on AT Protocol.\n *\n * Pre-1.0: the public API is unstable and may change in any minor release.\n *\n * @see https://github.com/singi-labs/sifa-sdk\n */\n\ndeclare const __SIFA_SDK_VERSION__: string;\n\nexport const SIFA_SDK_VERSION: string = __SIFA_SDK_VERSION__;\n\nexport type {\n ActiveApp,\n Endorsement,\n EndorsementData,\n ExternalAccount,\n ExternalAccountKeytraceClaim,\n FeedItem,\n LanguageProficiency,\n LocationValue,\n OrgAddressView,\n OrgFloorVerdict,\n OrgLinkView,\n OrgProfileView,\n RecognizedEntity,\n PdsProviderInfo,\n PresentationLinkView,\n Profile,\n ProfileCertification,\n ProfileCourse,\n ProfileEducation,\n ProfileHonor,\n ProfileIndustry,\n ProfileInvestment,\n ProfileInvestmentLink,\n ProfileInvolvement,\n ProfileInvolvementLink,\n ProfileLanguage,\n ProfileLocation,\n ProfileOverrideSource,\n ProfilePosition,\n PositionConfirmations,\n PositionViewerConfirmation,\n PositionOrgVerification,\n PositionEmailVerification,\n ProfilePresentation,\n CoSpeaker,\n ActorCard,\n AuthorSuggestion,\n ProjectMemberCard,\n ProjectRole,\n ProfilePresentationDelivery,\n ProfileProject,\n ProjectEventView,\n ProfilePublication,\n ProfileSkill,\n ProfileVolunteering,\n PublicationContributor,\n RelatedIdentifier,\n SkillRef,\n SkillSuggestion,\n TrustStat,\n VerifiedAccount,\n AccountFacetMode,\n} from './types/index.js';\n\n// Aggregated public profile view (`id.sifa.getProfileView` XRPC query).\nexport type {\n ProfileView,\n IndustryDomain,\n ProfileLocationView,\n PositionView,\n EducationView,\n SkillView,\n CertificationView,\n ProjectView,\n VolunteeringView,\n InvolvementView,\n InvolvementLinkView,\n PublicationView,\n ContributorView,\n CourseView,\n DurationView,\n CoSpeakerView,\n ProjectMemberView,\n PresentationDeliveryView,\n PresentationView,\n HonorView,\n LanguageView,\n ExternalAccountView,\n ActiveAppView,\n AtfundLinkView,\n} from './types/profile-view.js';\n\nexport { PROJECT_ROLES } from './types/index.js';\n\nexport {\n ACTIVITY_TIERS,\n APP_CATEGORIES,\n APP_CATEGORY_IDS,\n APP_CATEGORY_MAP,\n CATEGORY_LABELS,\n normalizeSkillCategory,\n CATEGORY_ORDER,\n CONTINENTS,\n COMPANY_OPTIONAL_EMPLOYMENT_TYPES,\n COUNTRIES,\n CALENDAR_EVENT_MODE_LABELS,\n CALENDAR_EVENT_STATUS_LABELS,\n PRESENTATION_LINK_TYPE_LABELS,\n PRESENTATION_LINK_TYPE_OPTIONS,\n PRESENTATION_ROLE_LABELS,\n PRESENTATION_ROLE_OPTIONS,\n PUBLICATION_TYPE_LABELS,\n PUBLICATION_TYPE_OPTIONS,\n EMPLOYMENT_TYPE_GROUPS,\n INVESTMENT_ROLE_OPTIONS,\n INVESTMENT_ROLE_LABELS,\n INVESTMENT_STAGE_OPTIONS,\n INVESTMENT_STAGE_LABELS,\n INVESTMENT_STATUS_OPTIONS,\n INVESTMENT_STATUS_LABELS,\n ON_BEHALF_OF_EMPLOYMENT_TYPES,\n EMPLOYMENT_TYPE_LABELS,\n INDUSTRY_OPTIONS,\n INDUSTRY_LABELS,\n getIndustryLabel,\n SEARCH_FILTER_DEFS,\n OPEN_TO_OPTIONS,\n OPEN_TO_TOKEN_LABELS,\n OPEN_TO_GROUP_LABELS,\n OPEN_TO_TOKENS,\n OPEN_TO_TOKEN_TO_VALUE,\n OPEN_TO_VALUE_TO_TOKEN,\n categoryForApp,\n findIndustry,\n getActivityTaxonomyVersion,\n getActivityTier,\n isRelationalActivity,\n getCalendarEventModeLabel,\n getCalendarEventStatusLabel,\n getPresentationLinkTypeLabel,\n getPresentationRoleLabel,\n getPublicationTypeLabel,\n getAppCategoryIcon,\n getEmploymentTypeLabel,\n isCompanyRequired,\n getInvestmentRoleLabel,\n getInvestmentStageLabel,\n getInvestmentStatusLabel,\n isOnBehalfOfApplicable,\n getIndustryLabelKey,\n getLexiconEntry,\n getOpenToLabelKey,\n normalizeOpenTo,\n openToTokenToValue,\n openToValueToToken,\n getTierMeta,\n getWorkplaceTypeLabel,\n normalizeWorkplaceTypes,\n isAppCategory,\n isKnownAppId,\n PLATFORM_LABELS,\n PLATFORM_OPTIONS,\n SKILL_CATEGORIES,\n WORKPLACE_TYPE_LABELS,\n WORKPLACE_TYPE_OPTIONS,\n dedupeSkills,\n getContinent,\n getFaviconUrl,\n getPlatformLabel,\n groupSkillsByCategory,\n groupSkillsBySubCategory,\n groupSkillsForDisplay,\n isKnownPlatform,\n normalizePlatformId,\n type ActivityTaxonomy,\n type ActivityTier,\n type AppCategoryId,\n type ContinentCode,\n type EmploymentTypeGroup,\n type EmploymentTypeOption,\n type InvestmentOption,\n type IndustryOption,\n type KnownAppId,\n type LexiconEntry,\n type MergedProfileSkill,\n type PresentationLinkTypeOption,\n type PresentationRoleOption,\n type PublicationTypeOption,\n INVOLVEMENT_KIND_OPTIONS,\n INVOLVEMENT_KIND_LABELS,\n INVOLVEMENT_KIND_HEADINGS,\n getInvolvementKindHeading,\n getInvolvementKindLabel,\n COURSE_ROLE_OPTIONS,\n COURSE_ROLE_LABELS,\n COURSE_ROLE_TAKEN,\n COURSE_ROLE_TAUGHT,\n COURSE_ROLE_TEACHING_ASSISTANT,\n getCourseRoleLabel,\n isTeachingCourse,\n splitCoursesByRole,\n type CourseRoleOption,\n EQF_LEVEL_LABELS,\n EQF_LEVEL_OPTIONS,\n getEducationLevelDisplay,\n getEqfLevelLabel,\n readEqfLevel,\n suggestEqfLevelFromDegree,\n type EqfLevel,\n type EqfLevelOption,\n ARTIFACT_LINK_KIND_OPTIONS,\n ARTIFACT_LINK_KIND_LABELS,\n getArtifactLinkKindLabel,\n VERIFICATION_PROVIDERS,\n getVerificationProvider,\n isKnownVerificationProvider,\n resolveVerifierProvider,\n buildVerifierListMembers,\n primaryVerification,\n resolveVerificationBadges,\n verificationLabel,\n type AccountVerification,\n type VerifierListItem,\n type VerificationProvider,\n type VerificationProviderId,\n type VerificationSource,\n type InvolvementKindOption,\n type ArtifactLinkKindOption,\n type OpenToGroup,\n type OpenToOption,\n type PlatformId,\n type SearchFilterControl,\n type SearchFilterDef,\n type SearchFilterOptionSource,\n type SkillCategory,\n type TierMeta,\n type WorkplaceTypeOption,\n} from './taxonomy/index.js';\n\nexport {\n certDateExtractor,\n contrastRatio,\n countryCodeToFlag,\n dateRangeExtractor,\n detectPdsProvider,\n formatCompanyName,\n formatCredentialDateRange,\n formatDateRange,\n formatPositionDateRange,\n formatDisplayUrl,\n formatDistanceToNow,\n formatIsoTitle,\n formatLocation,\n formatPresentationDuration,\n formatRelativeTime,\n formatTimelineDate,\n getDisplayLabel,\n getHandleStem,\n getPdsDisplayName,\n isValidRgbColor,\n lexiconDateExtractor,\n limitCombiningMarks,\n locationSegments,\n meetsContrastAA,\n normalizeCompanyKey,\n normalizeLegalForm,\n parseLocationString,\n parseTalkRkey,\n pdsProviderFromApi,\n relativeLuminance,\n resolveEmbed,\n youtubeVideoId,\n youtubeThumbnailUrl,\n rgbToString,\n sanitizeDisplayText,\n normalizeDoi,\n openAlexWorkUrl,\n blobProxyUrl,\n type BlobProxyVariant,\n formatRelationship,\n parseEndorsementComment,\n sanitizeHandleInput,\n singleDateExtractor,\n slugifyTitle,\n buildMetaDescription,\n buildTalkSlug,\n sortByDateDesc,\n summarizePresentationDeliveries,\n truncateGraphemes,\n collapseContributors,\n type CollapseContributorsOptions,\n type CollapsedContributors,\n type EmbedResult,\n type ParsedEndorsementComment,\n type PdsProvider,\n type PresentationDeliverySummary,\n type RgbColor,\n} from './format/index.js';\n\nexport {\n parsePresentationDuration,\n durationFromMinutes,\n parseIntendedAudiences,\n stripHtmlToText,\n normalizePresentationRole,\n normalizePresentationMode,\n presentationCsvRowToRecord,\n presentationDeliveryCsvRowToRecord,\n PRESENTATION_ROLE_VALUES,\n PRESENTATION_MODE_VALUES,\n type CsvRow,\n type ParsedPresentation,\n type ParsedDelivery,\n validateTalksImport,\n type TalksImportIssue,\n type TalksImportIssueCode,\n type TalksImportValidation,\n} from './import/index.js';\n\nexport {\n ACTIVITY_VISIBILITY_RULES,\n ADULT_CONTENT_LABELS,\n APP_URL_PATTERNS,\n COLLECTION_TO_APP,\n getAppIdForCollection,\n hasAdultContent,\n isVisibleActivityItem,\n resolveCardHealth,\n resolveCardUrl,\n type ActivityItemForUrl,\n type ActivityLabel,\n type AdultContentLabel,\n type AppUrlPatterns,\n type CardHealth,\n type CardHealthStrategy,\n} from './cards/index.js';\n\nexport {\n PUBLISHERS,\n STANDARD_PUBLISHER_ID,\n getPublisherById,\n getPublisherByHost,\n getPublisherFromSiteUrl,\n type Publisher,\n} from './publishers/index.js';\n\n// Shared activity-stream view-model: the normalized, framework-free feed both\n// sifa-web (React cards) and page.sifa.id (string-HTML renderer) consume.\nexport {\n ACTIVITY_VERBS,\n STREAM_VERBS,\n getActivityVerbsVersion,\n streamVerbSchema,\n verbForCollection,\n streamAddressSchema,\n streamAuthorSchema,\n streamCardBodySchema,\n streamCardSubjectSchema,\n streamCardVMSchema,\n streamExternalLinkSchema,\n streamGeoSchema,\n streamMediaSchema,\n streamRichSegmentSchema,\n streamSourceSchema,\n streamThemeSchema,\n isSelfAuthoredRich,\n renderAsLine,\n streamCardBodyContent,\n streamCardContent,\n streamCardSubjectText,\n toStreamCardVM,\n toStreamCardVMs,\n type ActivityItem,\n type StreamCardContent,\n type ActivityVerbMap,\n type StreamAddress,\n type StreamAuthor,\n type StreamCardBody,\n type StreamCardSubject,\n type StreamCardVM,\n type StreamExternalLink,\n type StreamGeo,\n type StreamMedia,\n type StreamMediaBase,\n type StreamMediaBlob,\n type StreamMediaResolved,\n type StreamRichSegment,\n type StreamSource,\n type StreamTheme,\n type StreamVerb,\n type ToStreamCardVMOptions,\n} from './stream/index.js';\n\nexport {\n COMPLETENESS_MAX_SCORE,\n completenessPercent,\n completenessScore,\n isOptionalCompletenessSignal,\n OPTIONAL_COMPLETENESS_SIGNALS,\n DIMENSIONS_MAX_SCORE,\n MIN_SKILLS,\n countFilledDimensions,\n dimensionsFromInputs,\n getFilledDimensionsMap,\n pickPrimaryPosition,\n DATE_LOOKAHEAD_MONTHS,\n isBeyondLookahead,\n isUpcomingStart,\n type DateLookaheadKind,\n pickPrimaryFlagged,\n summarizeProfileView,\n profileToDimensionInputs,\n isPseudoEmployer,\n looksLikeDomain,\n entityDisambiguationLabel,\n searchResultDisambiguation,\n entityResultKey,\n classifyEntityRef,\n isLinked,\n ENTITY_REF_ANCHORS,\n qualifiesAsOrg,\n isRegistrableDomainHandle,\n hasPersonalProfileContent,\n rendersPersonalProfile,\n rendersCompanyProfile,\n resolveAccountFacetMode,\n isCompanyPageIndexable,\n companyPageRichness,\n COMPANY_PAGE_MIN_FIRMOGRAPHIC_FIELDS,\n COMPANY_PAGE_MIN_DESCRIPTION_LENGTH,\n COMPANY_PAGE_ROSTER_MIN_MEMBERS,\n countRecentActivity,\n followingFeedFallbackApp,\n SELF_APP_ID,\n excludeSelfApp,\n actorShowsIdentity,\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 type DailyActivityCount,\n type AppWithId,\n type DimensionKey,\n type DimensionMap,\n type PrimaryPositionCandidate,\n type PrimaryFlagCandidate,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n type ProfileCompletion,\n type ProfileDimensionInputs,\n type DisambiguationFields,\n type EntityRefAnchor,\n type CompanyFirmographics,\n type CompanyHqFacts,\n type PersonalFacetContent,\n resolveAgentRef,\n type AgentRefFlat,\n} from './logic/index.js';\n\n// Profile section model: which sections render, in what order, their nav\n// grouping, per-section sorts, and involvement grouping. Shared by the HTML\n// profile page, the Markdown/DOCX/print exports, and the personal-site renderer.\nexport {\n ALL_SECTIONS,\n INVOLVEMENT_HEADING_ORDER,\n SECTION_GROUPS,\n SECTION_LABELS,\n filterHidden,\n getVisibleSectionIds,\n groupInvolvementByHeading,\n groupPublicationVersions,\n type GroupPublicationVersionsOptions,\n type PublicationVersionGroup,\n type VersionablePublication,\n hoistPrimary,\n isRoleLineRedundant,\n isSectionPopulated,\n sortByActiveDateRange,\n sortCertifications,\n sortEducation,\n sortHonors,\n sortLanguages,\n sortLanguagesByProficiency,\n sortPositions,\n sortProjects,\n sortPublications,\n visibleItems,\n type InvolvementGroup,\n type SectionGroupId,\n type SectionId,\n} from './profile/index.js';\n\n// Profile \"Highlights\" block: selection + labeling of the one ongoing (or\n// most-recent) record per section. Shared by the sifa-web profile page and the\n// personal-site renderer so the two surfaces never diverge on what's featured.\nexport {\n buildProfileHighlights,\n shouldRenderHighlights,\n formatSpanDate,\n formatSingleDate,\n formatEventDate,\n type ProfileHighlightsInput,\n type ProfileHighlightSection,\n type ProfileHighlightStatus,\n type ProfileHighlightTile,\n type BuildProfileHighlightsOptions,\n} from './profile/index.js';\n\nexport {\n AtmosphereFeedItemSchema,\n BlobRefSchema,\n EndorsementConfirmationRecordSchema,\n EndorsementRecordSchema,\n OrgProfileRecordSchema,\n OrgEmploymentAttestationRecordSchema,\n EmploymentVerificationRecordSchema,\n EMPLOYMENT_STATUS_TOKENS,\n VERIFICATION_METHOD_TOKENS,\n resolveEmploymentVerification,\n EntitySearchResultSchema,\n EntitySearchResponseSchema,\n EntitySelectRequestSchema,\n EntitySelectResponseSchema,\n EntityImportSearchResponseSchema,\n EntityResolveDomainRequestSchema,\n EntityResolveDomainResponseSchema,\n EntityMintDomainResponseSchema,\n FEATURE_FLAGS,\n FeatureAllowlistEntrySchema,\n FeedActorSchema,\n FollowFeedItemSchema,\n FollowFeedPageSchema,\n FollowProfilePageSchema,\n FollowProfileSchema,\n GraphFollowRecordSchema,\n PresentationDurationSchema,\n PresentationLinkSchema,\n ProfileCertificationRecordSchema,\n ProfileCourseRecordSchema,\n ProfileEducationRecordSchema,\n ProfileExternalAccountRecordSchema,\n ProfileHonorRecordSchema,\n ProfileInvestmentRecordSchema,\n InvestmentAmountSchema,\n PROFILE_INVESTMENT_NSID,\n ProfileInvolvementRecordSchema,\n ArtifactLinkSchema,\n PROFILE_INVOLVEMENT_NSID,\n ProfileLanguageRecordSchema,\n ProfilePositionRecordSchema,\n ProfilePresentationDeliveryRecordSchema,\n ProfilePresentationRecordSchema,\n ProfileProjectRecordSchema,\n ProfilePublicationRecordSchema,\n RelatedIdentifierSchema,\n ProfileSelfRecordSchema,\n ProfileSkillRecordSchema,\n ProfileVolunteeringRecordSchema,\n PublicationAuthorSchema,\n SifaFeedItemSchema,\n atUriSchema,\n cidSchema,\n datetimeSchema,\n decodeFeedCursor,\n didSchema,\n encodeFeedCursor,\n externalRecordRefSchema,\n languageTagSchema,\n makeGraphFollowRecordSchema,\n maxGraphemes,\n partialDateSchema,\n selfLabelsSchema,\n skillRefSchema,\n strongRefSchema,\n uriSchema,\n type AtmosphereFeedItem,\n type BlobRef,\n type EndorsementConfirmationRecord,\n type EndorsementRecord,\n type OrgProfileRecord,\n type OrgEmploymentAttestationRecord,\n type EmploymentVerificationRecord,\n type EmploymentVerificationResolution,\n type ResolveEmploymentVerificationOptions,\n type EntitySearchResult,\n type EntitySearchResponse,\n type EntitySelectRequest,\n type EntitySelectResponse,\n type EntityImportSearchResponse,\n type EntityResolveDomainRequest,\n type EntityResolveDomainResponse,\n type EntityMintDomainResponse,\n type FeatureAllowlistEntry,\n type FeatureFlag,\n type FeedActor,\n type FeedCursor,\n type FollowFeedItem,\n type FollowFeedPage,\n type FollowProfileItem,\n type FollowProfilePage,\n type GraphFollowRecord,\n type SifaFeedItem,\n type ProfileCertificationRecord,\n type ProfileCourseRecord,\n type ProfileEducationRecord,\n type ProfileExternalAccountRecord,\n type ProfileHonorRecord,\n type ProfileInvolvementRecord,\n type ArtifactLink,\n type ProfileLanguageRecord,\n type PresentationDuration,\n type PresentationLink,\n type ProfilePositionRecord,\n type ProfilePresentationDeliveryRecord,\n type ProfilePresentationRecord,\n type ProfileProjectRecord,\n type ProfilePublicationRecord,\n type ProfileSelfRecord,\n type ProfileSkillRecord,\n type ProfileVolunteeringRecord,\n type PublicationAuthor,\n agentRefSchema,\n type AgentRef,\n} from './schemas/index.js';\n\nexport {\n ROADMAP_ITEM_META,\n ROADMAP_ISSUES_REPO,\n roadmapIssueUrl,\n type RoadmapItemMeta,\n} from './roadmap/index.js';\n\nexport type {\n LocationSegment,\n LocationSegmentKind,\n LocationSegmentsOptions,\n} from './format/index.js';\n\nexport type { DisplayUrl, FormatDisplayUrlOptions, UrlPathPolicy } from './format/index.js';\n\nexport { SIFA_REPO_GROUPS, describeSifaRecord, repoGroupForCollection } from './repo/index.js';\nexport type {\n RepoCollectionGroup,\n RepoDeleteOutcome,\n RepoDeleteRecordResult,\n RepoDeleteResult,\n RepoGroupDefinition,\n RepoGroupId,\n RepoInventory,\n RepoRecordLabel,\n RepoRecordSummary,\n} from './repo/index.js';\n"],"mappings":";AA+FA,SAAS,qBAAqB;AAE9B;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAeA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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AA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAiBA;AAAA,OAEK;AAKP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAKP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AAEP;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EA+CA;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAUP,SAAS,kBAAkB,oBAAoB,8BAA8B;AAloBtE,IAAM,mBAA2B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Sifa SDK -- public client library for the Sifa AppView on AT Protocol.\n *\n * Pre-1.0: the public API is unstable and may change in any minor release.\n *\n * @see https://github.com/singi-labs/sifa-sdk\n */\n\ndeclare const __SIFA_SDK_VERSION__: string;\n\nexport const SIFA_SDK_VERSION: string = __SIFA_SDK_VERSION__;\n\nexport type {\n ActiveApp,\n Endorsement,\n EndorsementData,\n ExternalAccount,\n ExternalAccountKeytraceClaim,\n FeedItem,\n LanguageProficiency,\n LocationValue,\n OrgAddressView,\n OrgFloorVerdict,\n OrgLinkView,\n OrgProfileView,\n RecognizedEntity,\n PdsProviderInfo,\n PresentationLinkView,\n Profile,\n ProfileCertification,\n ProfileCourse,\n ProfileEducation,\n ProfileHonor,\n ProfileIndustry,\n ProfileInvestment,\n ProfileInvestmentLink,\n ProfileInvolvement,\n ProfileInvolvementLink,\n ProfileLanguage,\n ProfileLocation,\n ProfileOverrideSource,\n ProfilePosition,\n PositionConfirmations,\n PositionViewerConfirmation,\n PositionOrgVerification,\n PositionEmailVerification,\n PositionPeerVerification,\n ProfilePresentation,\n CoSpeaker,\n ActorCard,\n AuthorSuggestion,\n ProjectMemberCard,\n ProjectRole,\n ProfilePresentationDelivery,\n ProfileProject,\n ProjectEventView,\n ProfilePublication,\n ProfileSkill,\n ProfileVolunteering,\n PublicationContributor,\n RelatedIdentifier,\n SkillRef,\n SkillSuggestion,\n TrustStat,\n VerifiedAccount,\n AccountFacetMode,\n} from './types/index.js';\n\n// Aggregated public profile view (`id.sifa.getProfileView` XRPC query).\nexport type {\n ProfileView,\n IndustryDomain,\n ProfileLocationView,\n PositionView,\n EducationView,\n SkillView,\n CertificationView,\n ProjectView,\n VolunteeringView,\n InvolvementView,\n InvolvementLinkView,\n PublicationView,\n ContributorView,\n CourseView,\n DurationView,\n CoSpeakerView,\n ProjectMemberView,\n PresentationDeliveryView,\n PresentationView,\n HonorView,\n LanguageView,\n ExternalAccountView,\n ActiveAppView,\n AtfundLinkView,\n} from './types/profile-view.js';\n\nexport { PROJECT_ROLES } from './types/index.js';\n\nexport {\n ACTIVITY_TIERS,\n APP_CATEGORIES,\n APP_CATEGORY_IDS,\n APP_CATEGORY_MAP,\n CATEGORY_LABELS,\n normalizeSkillCategory,\n CATEGORY_ORDER,\n CONTINENTS,\n COMPANY_OPTIONAL_EMPLOYMENT_TYPES,\n COUNTRIES,\n CALENDAR_EVENT_MODE_LABELS,\n CALENDAR_EVENT_STATUS_LABELS,\n PRESENTATION_LINK_TYPE_LABELS,\n PRESENTATION_LINK_TYPE_OPTIONS,\n PRESENTATION_ROLE_LABELS,\n PRESENTATION_ROLE_OPTIONS,\n PUBLICATION_TYPE_LABELS,\n PUBLICATION_TYPE_OPTIONS,\n EMPLOYMENT_TYPE_GROUPS,\n INVESTMENT_ROLE_OPTIONS,\n INVESTMENT_ROLE_LABELS,\n INVESTMENT_STAGE_OPTIONS,\n INVESTMENT_STAGE_LABELS,\n INVESTMENT_STATUS_OPTIONS,\n INVESTMENT_STATUS_LABELS,\n ON_BEHALF_OF_EMPLOYMENT_TYPES,\n EMPLOYMENT_TYPE_LABELS,\n INDUSTRY_OPTIONS,\n INDUSTRY_LABELS,\n getIndustryLabel,\n SEARCH_FILTER_DEFS,\n OPEN_TO_OPTIONS,\n OPEN_TO_TOKEN_LABELS,\n OPEN_TO_GROUP_LABELS,\n OPEN_TO_TOKENS,\n OPEN_TO_TOKEN_TO_VALUE,\n OPEN_TO_VALUE_TO_TOKEN,\n categoryForApp,\n findIndustry,\n getActivityTaxonomyVersion,\n getActivityTier,\n isRelationalActivity,\n getCalendarEventModeLabel,\n getCalendarEventStatusLabel,\n getPresentationLinkTypeLabel,\n getPresentationRoleLabel,\n getPublicationTypeLabel,\n getAppCategoryIcon,\n getEmploymentTypeLabel,\n isCompanyRequired,\n getInvestmentRoleLabel,\n getInvestmentStageLabel,\n getInvestmentStatusLabel,\n isOnBehalfOfApplicable,\n getIndustryLabelKey,\n getLexiconEntry,\n getOpenToLabelKey,\n normalizeOpenTo,\n openToTokenToValue,\n openToValueToToken,\n getTierMeta,\n getWorkplaceTypeLabel,\n normalizeWorkplaceTypes,\n isAppCategory,\n isKnownAppId,\n PLATFORM_LABELS,\n PLATFORM_OPTIONS,\n SKILL_CATEGORIES,\n WORKPLACE_TYPE_LABELS,\n WORKPLACE_TYPE_OPTIONS,\n dedupeSkills,\n getContinent,\n getFaviconUrl,\n getPlatformLabel,\n groupSkillsByCategory,\n groupSkillsBySubCategory,\n groupSkillsForDisplay,\n isKnownPlatform,\n normalizePlatformId,\n type ActivityTaxonomy,\n type ActivityTier,\n type AppCategoryId,\n type ContinentCode,\n type EmploymentTypeGroup,\n type EmploymentTypeOption,\n type InvestmentOption,\n type IndustryOption,\n type KnownAppId,\n type LexiconEntry,\n type MergedProfileSkill,\n type PresentationLinkTypeOption,\n type PresentationRoleOption,\n type PublicationTypeOption,\n INVOLVEMENT_KIND_OPTIONS,\n INVOLVEMENT_KIND_LABELS,\n INVOLVEMENT_KIND_HEADINGS,\n getInvolvementKindHeading,\n getInvolvementKindLabel,\n COURSE_ROLE_OPTIONS,\n COURSE_ROLE_LABELS,\n COURSE_ROLE_TAKEN,\n COURSE_ROLE_TAUGHT,\n COURSE_ROLE_TEACHING_ASSISTANT,\n getCourseRoleLabel,\n isTeachingCourse,\n splitCoursesByRole,\n type CourseRoleOption,\n EQF_LEVEL_LABELS,\n EQF_LEVEL_OPTIONS,\n getEducationLevelDisplay,\n getEqfLevelLabel,\n readEqfLevel,\n suggestEqfLevelFromDegree,\n type EqfLevel,\n type EqfLevelOption,\n ARTIFACT_LINK_KIND_OPTIONS,\n ARTIFACT_LINK_KIND_LABELS,\n getArtifactLinkKindLabel,\n VERIFICATION_PROVIDERS,\n getVerificationProvider,\n isKnownVerificationProvider,\n resolveVerifierProvider,\n buildVerifierListMembers,\n primaryVerification,\n resolveVerificationBadges,\n verificationLabel,\n type AccountVerification,\n type VerifierListItem,\n type VerificationProvider,\n type VerificationProviderId,\n type VerificationSource,\n type InvolvementKindOption,\n type ArtifactLinkKindOption,\n type OpenToGroup,\n type OpenToOption,\n type PlatformId,\n type SearchFilterControl,\n type SearchFilterDef,\n type SearchFilterOptionSource,\n type SkillCategory,\n type TierMeta,\n type WorkplaceTypeOption,\n} from './taxonomy/index.js';\n\nexport {\n certDateExtractor,\n contrastRatio,\n countryCodeToFlag,\n dateRangeExtractor,\n detectPdsProvider,\n formatCompanyName,\n formatCredentialDateRange,\n formatDateRange,\n formatPositionDateRange,\n formatDisplayUrl,\n formatDistanceToNow,\n formatIsoTitle,\n formatLocation,\n formatPresentationDuration,\n formatRelativeTime,\n formatTimelineDate,\n getDisplayLabel,\n getHandleStem,\n getPdsDisplayName,\n isValidRgbColor,\n lexiconDateExtractor,\n limitCombiningMarks,\n locationSegments,\n meetsContrastAA,\n normalizeCompanyKey,\n normalizeLegalForm,\n parseLocationString,\n parseTalkRkey,\n pdsProviderFromApi,\n relativeLuminance,\n resolveEmbed,\n youtubeVideoId,\n youtubeThumbnailUrl,\n rgbToString,\n sanitizeDisplayText,\n normalizeDoi,\n openAlexWorkUrl,\n blobProxyUrl,\n type BlobProxyVariant,\n formatRelationship,\n parseEndorsementComment,\n sanitizeHandleInput,\n singleDateExtractor,\n slugifyTitle,\n buildMetaDescription,\n buildTalkSlug,\n sortByDateDesc,\n summarizePresentationDeliveries,\n truncateGraphemes,\n collapseContributors,\n type CollapseContributorsOptions,\n type CollapsedContributors,\n type EmbedResult,\n type ParsedEndorsementComment,\n type PdsProvider,\n type PresentationDeliverySummary,\n type RgbColor,\n} from './format/index.js';\n\nexport {\n parsePresentationDuration,\n durationFromMinutes,\n parseIntendedAudiences,\n stripHtmlToText,\n normalizePresentationRole,\n normalizePresentationMode,\n presentationCsvRowToRecord,\n presentationDeliveryCsvRowToRecord,\n PRESENTATION_ROLE_VALUES,\n PRESENTATION_MODE_VALUES,\n type CsvRow,\n type ParsedPresentation,\n type ParsedDelivery,\n validateTalksImport,\n type TalksImportIssue,\n type TalksImportIssueCode,\n type TalksImportValidation,\n} from './import/index.js';\n\nexport {\n ACTIVITY_VISIBILITY_RULES,\n ADULT_CONTENT_LABELS,\n APP_URL_PATTERNS,\n COLLECTION_TO_APP,\n getAppIdForCollection,\n hasAdultContent,\n isVisibleActivityItem,\n resolveCardHealth,\n resolveCardUrl,\n type ActivityItemForUrl,\n type ActivityLabel,\n type AdultContentLabel,\n type AppUrlPatterns,\n type CardHealth,\n type CardHealthStrategy,\n} from './cards/index.js';\n\nexport {\n PUBLISHERS,\n STANDARD_PUBLISHER_ID,\n getPublisherById,\n getPublisherByHost,\n getPublisherFromSiteUrl,\n type Publisher,\n} from './publishers/index.js';\n\n// Shared activity-stream view-model: the normalized, framework-free feed both\n// sifa-web (React cards) and page.sifa.id (string-HTML renderer) consume.\nexport {\n ACTIVITY_VERBS,\n STREAM_VERBS,\n getActivityVerbsVersion,\n streamVerbSchema,\n verbForCollection,\n streamAddressSchema,\n streamAuthorSchema,\n streamCardBodySchema,\n streamCardSubjectSchema,\n streamCardVMSchema,\n streamExternalLinkSchema,\n streamGeoSchema,\n streamMediaSchema,\n streamRichSegmentSchema,\n streamSourceSchema,\n streamThemeSchema,\n isSelfAuthoredRich,\n renderAsLine,\n streamCardBodyContent,\n streamCardContent,\n streamCardSubjectText,\n toStreamCardVM,\n toStreamCardVMs,\n type ActivityItem,\n type StreamCardContent,\n type ActivityVerbMap,\n type StreamAddress,\n type StreamAuthor,\n type StreamCardBody,\n type StreamCardSubject,\n type StreamCardVM,\n type StreamExternalLink,\n type StreamGeo,\n type StreamMedia,\n type StreamMediaBase,\n type StreamMediaBlob,\n type StreamMediaResolved,\n type StreamRichSegment,\n type StreamSource,\n type StreamTheme,\n type StreamVerb,\n type ToStreamCardVMOptions,\n} from './stream/index.js';\n\nexport {\n COMPLETENESS_MAX_SCORE,\n completenessPercent,\n completenessScore,\n isOptionalCompletenessSignal,\n OPTIONAL_COMPLETENESS_SIGNALS,\n DIMENSIONS_MAX_SCORE,\n MIN_SKILLS,\n countFilledDimensions,\n dimensionsFromInputs,\n getFilledDimensionsMap,\n pickPrimaryPosition,\n DATE_LOOKAHEAD_MONTHS,\n isBeyondLookahead,\n isUpcomingStart,\n type DateLookaheadKind,\n pickPrimaryFlagged,\n summarizeProfileView,\n profileToDimensionInputs,\n isPseudoEmployer,\n looksLikeDomain,\n entityDisambiguationLabel,\n searchResultDisambiguation,\n entityResultKey,\n classifyEntityRef,\n isLinked,\n ENTITY_REF_ANCHORS,\n qualifiesAsOrg,\n isRegistrableDomainHandle,\n hasPersonalProfileContent,\n rendersPersonalProfile,\n rendersCompanyProfile,\n resolveAccountFacetMode,\n isCompanyPageIndexable,\n companyPageRichness,\n COMPANY_PAGE_MIN_FIRMOGRAPHIC_FIELDS,\n COMPANY_PAGE_MIN_DESCRIPTION_LENGTH,\n COMPANY_PAGE_ROSTER_MIN_MEMBERS,\n countRecentActivity,\n followingFeedFallbackApp,\n SELF_APP_ID,\n excludeSelfApp,\n actorShowsIdentity,\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 type DailyActivityCount,\n type AppWithId,\n type DimensionKey,\n type DimensionMap,\n type PrimaryPositionCandidate,\n type PrimaryFlagCandidate,\n type ProfileSummary,\n type SummarizeProfileViewOptions,\n type ProfileCompletion,\n type ProfileDimensionInputs,\n type DisambiguationFields,\n type EntityRefAnchor,\n type CompanyFirmographics,\n type CompanyHqFacts,\n type PersonalFacetContent,\n resolveAgentRef,\n type AgentRefFlat,\n} from './logic/index.js';\n\n// Profile section model: which sections render, in what order, their nav\n// grouping, per-section sorts, and involvement grouping. Shared by the HTML\n// profile page, the Markdown/DOCX/print exports, and the personal-site renderer.\nexport {\n ALL_SECTIONS,\n INVOLVEMENT_HEADING_ORDER,\n SECTION_GROUPS,\n SECTION_LABELS,\n filterHidden,\n getVisibleSectionIds,\n groupInvolvementByHeading,\n groupPublicationVersions,\n type GroupPublicationVersionsOptions,\n type PublicationVersionGroup,\n type VersionablePublication,\n hoistPrimary,\n isRoleLineRedundant,\n isSectionPopulated,\n sortByActiveDateRange,\n sortCertifications,\n sortEducation,\n sortHonors,\n sortLanguages,\n sortLanguagesByProficiency,\n sortPositions,\n sortProjects,\n sortPublications,\n visibleItems,\n type InvolvementGroup,\n type SectionGroupId,\n type SectionId,\n} from './profile/index.js';\n\n// Profile \"Highlights\" block: selection + labeling of the one ongoing (or\n// most-recent) record per section. Shared by the sifa-web profile page and the\n// personal-site renderer so the two surfaces never diverge on what's featured.\nexport {\n buildProfileHighlights,\n shouldRenderHighlights,\n formatSpanDate,\n formatSingleDate,\n formatEventDate,\n type ProfileHighlightsInput,\n type ProfileHighlightSection,\n type ProfileHighlightStatus,\n type ProfileHighlightTile,\n type BuildProfileHighlightsOptions,\n} from './profile/index.js';\n\nexport {\n AtmosphereFeedItemSchema,\n BlobRefSchema,\n EndorsementConfirmationRecordSchema,\n EndorsementRecordSchema,\n OrgProfileRecordSchema,\n OrgEmploymentAttestationRecordSchema,\n EmploymentVerificationRecordSchema,\n EMPLOYMENT_STATUS_TOKENS,\n VERIFICATION_METHOD_TOKENS,\n resolveEmploymentVerification,\n EntitySearchResultSchema,\n EntitySearchResponseSchema,\n EntitySelectRequestSchema,\n EntitySelectResponseSchema,\n EntityImportSearchResponseSchema,\n EntityResolveDomainRequestSchema,\n EntityResolveDomainResponseSchema,\n EntityMintDomainResponseSchema,\n FEATURE_FLAGS,\n FeatureAllowlistEntrySchema,\n FeedActorSchema,\n FollowFeedItemSchema,\n FollowFeedPageSchema,\n FollowProfilePageSchema,\n FollowProfileSchema,\n GraphFollowRecordSchema,\n PresentationDurationSchema,\n PresentationLinkSchema,\n ProfileCertificationRecordSchema,\n ProfileCourseRecordSchema,\n ProfileEducationRecordSchema,\n ProfileExternalAccountRecordSchema,\n ProfileHonorRecordSchema,\n ProfileInvestmentRecordSchema,\n InvestmentAmountSchema,\n PROFILE_INVESTMENT_NSID,\n ProfileInvolvementRecordSchema,\n ArtifactLinkSchema,\n PROFILE_INVOLVEMENT_NSID,\n ProfileLanguageRecordSchema,\n ProfilePositionRecordSchema,\n ProfilePresentationDeliveryRecordSchema,\n ProfilePresentationRecordSchema,\n ProfileProjectRecordSchema,\n ProfilePublicationRecordSchema,\n RelatedIdentifierSchema,\n ProfileSelfRecordSchema,\n ProfileSkillRecordSchema,\n ProfileVolunteeringRecordSchema,\n PublicationAuthorSchema,\n SifaFeedItemSchema,\n atUriSchema,\n cidSchema,\n datetimeSchema,\n decodeFeedCursor,\n didSchema,\n encodeFeedCursor,\n externalRecordRefSchema,\n languageTagSchema,\n makeGraphFollowRecordSchema,\n maxGraphemes,\n partialDateSchema,\n selfLabelsSchema,\n skillRefSchema,\n strongRefSchema,\n uriSchema,\n type AtmosphereFeedItem,\n type BlobRef,\n type EndorsementConfirmationRecord,\n type EndorsementRecord,\n type OrgProfileRecord,\n type OrgEmploymentAttestationRecord,\n type EmploymentVerificationRecord,\n type EmploymentVerificationResolution,\n type ResolveEmploymentVerificationOptions,\n type EntitySearchResult,\n type EntitySearchResponse,\n type EntitySelectRequest,\n type EntitySelectResponse,\n type EntityImportSearchResponse,\n type EntityResolveDomainRequest,\n type EntityResolveDomainResponse,\n type EntityMintDomainResponse,\n type FeatureAllowlistEntry,\n type FeatureFlag,\n type FeedActor,\n type FeedCursor,\n type FollowFeedItem,\n type FollowFeedPage,\n type FollowProfileItem,\n type FollowProfilePage,\n type GraphFollowRecord,\n type SifaFeedItem,\n type ProfileCertificationRecord,\n type ProfileCourseRecord,\n type ProfileEducationRecord,\n type ProfileExternalAccountRecord,\n type ProfileHonorRecord,\n type ProfileInvolvementRecord,\n type ArtifactLink,\n type ProfileLanguageRecord,\n type PresentationDuration,\n type PresentationLink,\n type ProfilePositionRecord,\n type ProfilePresentationDeliveryRecord,\n type ProfilePresentationRecord,\n type ProfileProjectRecord,\n type ProfilePublicationRecord,\n type ProfileSelfRecord,\n type ProfileSkillRecord,\n type ProfileVolunteeringRecord,\n type PublicationAuthor,\n agentRefSchema,\n type AgentRef,\n} from './schemas/index.js';\n\nexport {\n ROADMAP_ITEM_META,\n ROADMAP_ISSUES_REPO,\n roadmapIssueUrl,\n type RoadmapItemMeta,\n} from './roadmap/index.js';\n\nexport type {\n LocationSegment,\n LocationSegmentKind,\n LocationSegmentsOptions,\n} from './format/index.js';\n\nexport type { DisplayUrl, FormatDisplayUrlOptions, UrlPathPolicy } from './format/index.js';\n\nexport { SIFA_REPO_GROUPS, describeSifaRecord, repoGroupForCollection } from './repo/index.js';\nexport type {\n RepoCollectionGroup,\n RepoDeleteOutcome,\n RepoDeleteRecordResult,\n RepoDeleteResult,\n RepoGroupDefinition,\n RepoGroupId,\n RepoInventory,\n RepoRecordLabel,\n RepoRecordSummary,\n} from './repo/index.js';\n"],"mappings":";AAgGA,SAAS,qBAAqB;AAE9B;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAeA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAiBK;AAEP;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAQK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,OAIK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAIP;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAoBK;AAEP;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,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAiBA;AAAA,OAEK;AAKP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAKP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AAEP;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EA+CA;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAUP,SAAS,kBAAkB,oBAAoB,8BAA8B;AAnoBtE,IAAM,mBAA2B;","names":[]}
|
package/dist/jev/index.cjs
CHANGED
|
@@ -71,8 +71,6 @@ var ORG_TYPE_TAXONOMY = {
|
|
|
71
71
|
var SECTOR_ORG_TYPE_INDUSTRY_HINTS = {
|
|
72
72
|
healthcare_provider: ["health", "hospital", "medical", "clinic", "nursing", "dental"],
|
|
73
73
|
educational: ["educat", "school", "universit", "college", "academ"],
|
|
74
|
-
government: ["government", "public_sector", "public sector", "public administration", "defen"],
|
|
75
|
-
research_institute: ["research", "scien", "laborator", "educat"],
|
|
76
74
|
religious: ["relig", "church", "faith", "nonprofit"],
|
|
77
75
|
political: ["politic", "nonprofit"]
|
|
78
76
|
};
|
package/dist/jev/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/jev/index.ts"],"names":["z"],"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;AAOM,IAAM,kBAAA,GAAqBA,MAAE,MAAA,CAAO;AAAA,EACzC,IAAA,EAAMA,KAAA,CAAE,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AAA,SAAU,SAAA,CAAU,KAAA;AACtE,EAAA,OAAO,SAAA;AACT;AAMO,IAAM,6BAAA,GAAgC;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,EAAO,OAAO,IAAA;AACtC,EAAA,IAAI,KAAK,OAAA,KAAY,MAAA,IAAa,OAAO,MAAA,KAAW,IAAA,CAAK,SAAS,OAAO,IAAA;AACzE,EAAA,OAAO,MAAA,CAAO,MAAA;AAChB","file":"index.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"]}
|
|
1
|
+
{"version":3,"sources":["../../src/jev/index.ts"],"names":["z"],"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;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;AAgBD,SAAS,QAA0B,GAAA,EAAoB;AACrD,EAAA,MAAM,MAAkB,EAAC;AACzB,EAAA,KAAA,MAAW,CAAC,CAAA,EAAG,CAAC,KAAK,MAAA,CAAO,OAAA,CAAQ,GAAG,CAAA,EAAG;AACxC,IAAA,IAAI,CAAA,KAAM,UAAa,CAAA,KAAM,IAAA,IAAQ,MAAM,EAAA,EAAI,GAAA,CAAI,CAAY,CAAA,GAAI,CAAA;AAAA,EACrE;AACA,EAAA,OAAO,GAAA;AACT;AAMO,SAAS,iBAAA,CACd,GACA,CAAA,EACkE;AAClE,EAAA,OAAO,EAAE,MAAM,OAAA,CAAQ,CAAC,GAAG,IAAA,EAAM,OAAA,CAAQ,CAA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AAS;AAClD;AAEO,IAAM,wBAAA,GAA2B,cAAA;AAAA,EACtC,iFAAA;AAAA,EACA;AACF;AAEO,IAAM,wBAAA,GAA2B,cAAA;AAAA,EACtC,8HAAA;AAAA,EACA;AACF;AAEO,IAAM,yBAAA,GAA4B,cAAA;AAAA,EACvC,+EAAA;AAAA,EACA;AACF;AAwBO,SAAS,uBAAuB,GAAA,EAAoD;AACzF,EAAA,MAAM,SAAA,GAAY,QAAQ,GAAG,CAAA;AAC7B,EAAA,IAAI,UAAU,KAAA,IAAS,SAAA,CAAU,MAAM,MAAA,KAAW,CAAA,SAAU,SAAA,CAAU,KAAA;AACtE,EAAA,OAAO,SAAA;AACT;AAMO,IAAM,6BAAA,GAAgC;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,EAAO,OAAO,IAAA;AACtC,EAAA,IAAI,KAAK,OAAA,KAAY,MAAA,IAAa,OAAO,MAAA,KAAW,IAAA,CAAK,SAAS,OAAO,IAAA;AACzE,EAAA,OAAO,MAAA,CAAO,MAAA;AAChB","file":"index.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 * `government` and `research_institute` are deliberately absent: public bodies\n * and research institutes exist in every sector (an energy utility, a rail\n * operator, a heart research institute), so an industry check rejects true\n * labels.\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 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"]}
|
package/dist/jev/index.d.cts
CHANGED
|
@@ -94,6 +94,10 @@ declare const ORG_TYPE_TAXONOMY: Record<string, string>;
|
|
|
94
94
|
* Industry values are free text (Jev tokens like `public_sector`, or registry
|
|
95
95
|
* labels like "Hospital & Health Care"), hence substring hints. Types not listed
|
|
96
96
|
* here describe a legal or organisational form only and need no sector match.
|
|
97
|
+
* `government` and `research_institute` are deliberately absent: public bodies
|
|
98
|
+
* and research institutes exist in every sector (an energy utility, a rail
|
|
99
|
+
* operator, a heart research institute), so an industry check rejects true
|
|
100
|
+
* labels.
|
|
97
101
|
*/
|
|
98
102
|
declare const SECTOR_ORG_TYPE_INDUSTRY_HINTS: Record<string, readonly string[]>;
|
|
99
103
|
/**
|
package/dist/jev/index.d.ts
CHANGED
|
@@ -94,6 +94,10 @@ declare const ORG_TYPE_TAXONOMY: Record<string, string>;
|
|
|
94
94
|
* Industry values are free text (Jev tokens like `public_sector`, or registry
|
|
95
95
|
* labels like "Hospital & Health Care"), hence substring hints. Types not listed
|
|
96
96
|
* here describe a legal or organisational form only and need no sector match.
|
|
97
|
+
* `government` and `research_institute` are deliberately absent: public bodies
|
|
98
|
+
* and research institutes exist in every sector (an energy utility, a rail
|
|
99
|
+
* operator, a heart research institute), so an industry check rejects true
|
|
100
|
+
* labels.
|
|
97
101
|
*/
|
|
98
102
|
declare const SECTOR_ORG_TYPE_INDUSTRY_HINTS: Record<string, readonly string[]>;
|
|
99
103
|
/**
|
package/dist/jev/index.js
CHANGED
|
@@ -68,8 +68,6 @@ var ORG_TYPE_TAXONOMY = {
|
|
|
68
68
|
var SECTOR_ORG_TYPE_INDUSTRY_HINTS = {
|
|
69
69
|
healthcare_provider: ["health", "hospital", "medical", "clinic", "nursing", "dental"],
|
|
70
70
|
educational: ["educat", "school", "universit", "college", "academ"],
|
|
71
|
-
government: ["government", "public_sector", "public sector", "public administration", "defen"],
|
|
72
|
-
research_institute: ["research", "scien", "laborator", "educat"],
|
|
73
71
|
religious: ["relig", "church", "faith", "nonprofit"],
|
|
74
72
|
political: ["politic", "nonprofit"]
|
|
75
73
|
};
|
package/dist/jev/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/jev/index.ts"],"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"],"mappings":";AAsBA,SAAS,SAAS;AAyBX,IAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,MAAM,EAAE,QAAQ,MAAM;AAAA,EACtB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAC/B,CAAC;AAOM,IAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACxB,QAAQ,EAAE,OAAO;AAAA,EACjB,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACnC,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAChD,CAAC;AAgBD,SAAS,QAA0B,KAAoB;AACrD,QAAM,MAAkB,CAAC;AACzB,aAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,GAAG,GAAG;AACxC,QAAI,MAAM,UAAa,MAAM,QAAQ,MAAM,GAAI,KAAI,CAAY,IAAI;AAAA,EACrE;AACA,SAAO;AACT;AAMO,SAAS,kBACd,GACA,GACkE;AAClE,SAAO,EAAE,MAAM,QAAQ,CAAC,GAAG,MAAM,QAAQ,CAAC,EAAE;AAC9C;AAGO,IAAM,yBAAuC;AAAA,EAClD,MAA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C,MAAO,QAAO;AACnB,MAAI,CAAC,IAAI,kBAAkB,CAAC,IAAI,SAAU,QAAO;AACjD,QAAM,WAAW,IAAI,SAAS,YAAY;AAC1C,SAAO,MAAM,KAAK,CAAC,SAAS,SAAS,SAAS,IAAI,CAAC;AACrD;AAMO,IAAM,uBAAuB,CAAC,YAAY,YAAY,SAAS;AAI/D,IAAM,qBAA6C;AAAA,EACxD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,SAAS;AACX;AAEA,SAAS,eAAe,cAAsB,UAAkD;AAC9F,SAAO,EAAE,MAAM,UAAU,cAAc,SAAS;AAClD;AAEO,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AACF;AAEO,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AACF;AAEO,IAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AACF;AAwBO,SAAS,uBAAuB,KAAoD;AACzF,QAAM,YAAY,QAAQ,GAAG;AAC7B,MAAI,UAAU,SAAS,UAAU,MAAM,WAAW,EAAG,QAAO,UAAU;AACtE,SAAO;AACT;AAMO,IAAM,gCAAgC;AAOtC,SAAS,qBACd,QACA,OAA6C,CAAC,GAC/B;AACf,QAAM,QAAQ,KAAK,SAAS;AAC5B,MAAI,OAAO,aAAa,MAAO,QAAO;AACtC,MAAI,KAAK,YAAY,UAAa,OAAO,WAAW,KAAK,QAAS,QAAO;AACzE,SAAO,OAAO;AAChB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/jev/index.ts"],"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 * `government` and `research_institute` are deliberately absent: public bodies\n * and research institutes exist in every sector (an energy utility, a rail\n * operator, a heart research institute), so an industry check rejects true\n * labels.\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 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"],"mappings":";AAsBA,SAAS,SAAS;AAyBX,IAAM,mBAAmB,EAAE,OAAO;AAAA,EACvC,MAAM,EAAE,QAAQ,MAAM;AAAA,EACtB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAC/B,CAAC;AAOM,IAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACxB,QAAQ,EAAE,OAAO;AAAA,EACjB,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACnC,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAChD,CAAC;AAgBD,SAAS,QAA0B,KAAoB;AACrD,QAAM,MAAkB,CAAC;A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ACR,SAAA,EAAW,KAAA;AAAA,MACX,QAAA,EAAU,KAAA;AAAA,MACV,UAAA,EAAY;AAAA,KACd;AAAA,EACF;AAEA,EAAA,MAAM,SAAS,UAAA,CAAW,OAAA,CAAQ,yBAAA,CAA0B,MAAM,GAAG,WAAW,CAAA;AAChF,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,yBAAA,CAA0B,UAAU,EAAE,IAAA,GAAO,YAAA;AACvE,EAAA,MAAM,WAAW,UAAA,CAAW,OAAA,CAAQ,yBAAA,CAA0B,QAAQ,GAAG,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"]}
|
|
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;AAmNM,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,EAAO,OAAO,IAAA;AACtC,EAAA,IAAI,KAAK,OAAA,KAAY,MAAA,IAAa,OAAO,MAAA,KAAW,IAAA,CAAK,SAAS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,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 * `government` and `research_institute` are deliberately absent: public bodies\n * and research institutes exist in every sector (an energy utility, a rail\n * operator, a heart research institute), so an industry check rejects true\n * labels.\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 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"]}
|
package/dist/jsonld/index.d.cts
CHANGED
package/dist/jsonld/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as Profile, d as ProfilePosition,
|
|
2
|
-
import { a1 as SifaApiConfig, a0 as ApiFetchOptions, o as ProfileView, a3 as CreateResult, a2 as WriteResult } from './types-
|
|
3
|
-
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-
|
|
1
|
+
import { c as Profile, d as ProfilePosition, Y as SkillRef, D as PresentationLinkView } from './index-BQAKeEoj.cjs';
|
|
2
|
+
import { a1 as SifaApiConfig, a0 as ApiFetchOptions, o as ProfileView, a3 as CreateResult, a2 as WriteResult } from './types-jE1ofoPI.cjs';
|
|
3
|
+
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-C5LlxPKK.cjs';
|
|
4
4
|
import { i as EntitySearchResponse, E as EntitySearchResult, c as EntityMintDomainResponse, g as EntityResolveDomainResponse, l as EntitySelectRequest, n as EntitySelectResponse } from './follow-profile-CgLLLQtJ.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as Profile, d as ProfilePosition,
|
|
2
|
-
import { a1 as SifaApiConfig, a0 as ApiFetchOptions, o as ProfileView, a3 as CreateResult, a2 as WriteResult } from './types-
|
|
3
|
-
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-
|
|
1
|
+
import { c as Profile, d as ProfilePosition, Y as SkillRef, D as PresentationLinkView } from './index-DDh2RLvx.js';
|
|
2
|
+
import { a1 as SifaApiConfig, a0 as ApiFetchOptions, o as ProfileView, a3 as CreateResult, a2 as WriteResult } from './types-B0zZiWDH.js';
|
|
3
|
+
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-0T0VS7Rz.js';
|
|
4
4
|
import { i as EntitySearchResponse, E as EntitySearchResult, c as EntityMintDomainResponse, g as EntityResolveDomainResponse, l as EntitySelectRequest, n as EntitySelectResponse } from './follow-profile-CVcA2w1v.js';
|
|
5
5
|
|
|
6
6
|
/**
|