@singi-labs/sifa-sdk 0.19.79 → 0.19.80
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.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/jev/issue.cjs +183 -0
- package/dist/jev/issue.cjs.map +1 -0
- package/dist/jev/issue.d.cts +119 -0
- package/dist/jev/issue.d.ts +119 -0
- package/dist/jev/issue.js +166 -0
- package/dist/jev/issue.js.map +1 -0
- package/package.json +11 -1
package/dist/index.cjs
CHANGED
|
@@ -7313,7 +7313,7 @@ function describeSifaRecord(collection, value) {
|
|
|
7313
7313
|
}
|
|
7314
7314
|
|
|
7315
7315
|
// src/index.ts
|
|
7316
|
-
var SIFA_SDK_VERSION = "0.19.
|
|
7316
|
+
var SIFA_SDK_VERSION = "0.19.80";
|
|
7317
7317
|
|
|
7318
7318
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
7319
7319
|
exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
|
package/dist/index.js
CHANGED
|
@@ -370,7 +370,7 @@ import {
|
|
|
370
370
|
roadmapIssueUrl
|
|
371
371
|
} from "./roadmap/index.js";
|
|
372
372
|
import { SIFA_REPO_GROUPS, describeSifaRecord, repoGroupForCollection } from "./repo/index.js";
|
|
373
|
-
var SIFA_SDK_VERSION = "0.19.
|
|
373
|
+
var SIFA_SDK_VERSION = "0.19.80";
|
|
374
374
|
export {
|
|
375
375
|
ACTIVITY_TIERS,
|
|
376
376
|
ACTIVITY_VERBS,
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
// src/jev/issue.ts
|
|
6
|
+
var noulAnswerSchema = zod.z.object({
|
|
7
|
+
type: zod.z.literal("noul"),
|
|
8
|
+
noul: zod.z.number().min(0).max(1)
|
|
9
|
+
});
|
|
10
|
+
var choiceAnswerSchema = zod.z.object({
|
|
11
|
+
type: zod.z.literal("choice"),
|
|
12
|
+
choice: zod.z.string(),
|
|
13
|
+
confidence: zod.z.number().min(0).max(1),
|
|
14
|
+
probabilities: zod.z.record(zod.z.string(), zod.z.number())
|
|
15
|
+
});
|
|
16
|
+
var FIRMOGRAPHIC_CONFIDENCE_FLOOR = 0.6;
|
|
17
|
+
function pickChoiceAboveFloor(answer, opts = {}) {
|
|
18
|
+
const floor = opts.floor ?? FIRMOGRAPHIC_CONFIDENCE_FLOOR;
|
|
19
|
+
if (answer.confidence < floor) return null;
|
|
20
|
+
if (opts.noMatch !== void 0 && answer.choice === opts.noMatch) return null;
|
|
21
|
+
return answer.choice;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/jev/issue.ts
|
|
25
|
+
var ISSUE_BODY_MAX_CHARS = 6e3;
|
|
26
|
+
function buildIssueTriageState(issue) {
|
|
27
|
+
const state = { repo: issue.repo, title: issue.title.trim() };
|
|
28
|
+
const body = issue.body?.trim();
|
|
29
|
+
if (body) {
|
|
30
|
+
if (body.length > ISSUE_BODY_MAX_CHARS) {
|
|
31
|
+
state.body = body.slice(0, ISSUE_BODY_MAX_CHARS);
|
|
32
|
+
state.bodyTruncated = true;
|
|
33
|
+
} else {
|
|
34
|
+
state.body = body;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (issue.existingLabels && issue.existingLabels.length > 0) {
|
|
38
|
+
state.existingLabels = issue.existingLabels;
|
|
39
|
+
}
|
|
40
|
+
return state;
|
|
41
|
+
}
|
|
42
|
+
var ISSUE_TYPE_TAXONOMY = {
|
|
43
|
+
bug: "Something that exists does not behave as documented or expected (error, crash, wrong output)",
|
|
44
|
+
feature: "A request for new behaviour or capability that does not exist yet",
|
|
45
|
+
question: "A question about how something works, with nothing to build or fix",
|
|
46
|
+
documentation: "Docs, README, comments, or examples are missing, wrong, or unclear",
|
|
47
|
+
"tech-debt": "Internal refactor, cleanup, dependency, or tooling work with no user-visible change",
|
|
48
|
+
spam: "Spam, gibberish, advertising, or a test submission",
|
|
49
|
+
unclear: "Not enough information to decide the type"
|
|
50
|
+
};
|
|
51
|
+
var ISSUE_STREAM_TAXONOMY = {
|
|
52
|
+
sifa: "The Sifa profile, activity stream, ingestion, search, or web app",
|
|
53
|
+
kootana: "Kootana: events, meetings, in-person connect, QR scan, organizer tools",
|
|
54
|
+
unclear: "Cannot tell from the issue"
|
|
55
|
+
};
|
|
56
|
+
var ISSUE_STREAM_LABELS = {
|
|
57
|
+
sifa: null,
|
|
58
|
+
kootana: "stream:kootana",
|
|
59
|
+
unclear: null
|
|
60
|
+
};
|
|
61
|
+
function choiceQuestion2(instructions, criteria) {
|
|
62
|
+
return { type: "choice", instructions, criteria };
|
|
63
|
+
}
|
|
64
|
+
var ISSUE_TYPE_CHOICE_QUESTION = choiceQuestion2(
|
|
65
|
+
"The state holds one GitHub issue (repo, title, body, existing labels). Which single type best describes it?",
|
|
66
|
+
ISSUE_TYPE_TAXONOMY
|
|
67
|
+
);
|
|
68
|
+
var ISSUE_STREAM_CHOICE_QUESTION = choiceQuestion2(
|
|
69
|
+
"Which product stream does this issue concern?",
|
|
70
|
+
ISSUE_STREAM_TAXONOMY
|
|
71
|
+
);
|
|
72
|
+
var ISSUE_ACTIONABLE_NOUL_QUESTION = {
|
|
73
|
+
type: "noul",
|
|
74
|
+
instructions: "Does the issue contain enough information for a maintainer to act on it without asking the reporter anything?",
|
|
75
|
+
criteria: {
|
|
76
|
+
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.",
|
|
77
|
+
false: "Essential details are missing: no way to reproduce, no expected behaviour, vague wish with no outcome, or a bare title."
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var ISSUE_SECURITY_NOUL_QUESTION = {
|
|
81
|
+
type: "noul",
|
|
82
|
+
instructions: "Does the issue describe a security-relevant problem?",
|
|
83
|
+
criteria: {
|
|
84
|
+
true: "A vulnerability, auth or session flaw, data exposure, abuse or spam vector, secrets handling, or a dependency advisory.",
|
|
85
|
+
false: "An ordinary bug, feature, question, or docs issue with no security angle."
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var ISSUE_REGRESSION_NOUL_QUESTION = {
|
|
89
|
+
type: "noul",
|
|
90
|
+
instructions: "Does the issue report that something which previously worked no longer works?",
|
|
91
|
+
criteria: {
|
|
92
|
+
true: "The reporter states or clearly implies the behaviour worked before a release, deploy, or change.",
|
|
93
|
+
false: "A new bug with no prior-working claim, a feature request, or a question."
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var ISSUE_TRIAGE_QUESTION_IDS = {
|
|
97
|
+
type: "issueType",
|
|
98
|
+
stream: "issueStream",
|
|
99
|
+
actionable: "issueActionable",
|
|
100
|
+
security: "issueSecurity",
|
|
101
|
+
regression: "issueRegression"
|
|
102
|
+
};
|
|
103
|
+
function buildIssueTriageQuestions() {
|
|
104
|
+
return {
|
|
105
|
+
[ISSUE_TRIAGE_QUESTION_IDS.type]: ISSUE_TYPE_CHOICE_QUESTION,
|
|
106
|
+
[ISSUE_TRIAGE_QUESTION_IDS.stream]: ISSUE_STREAM_CHOICE_QUESTION,
|
|
107
|
+
[ISSUE_TRIAGE_QUESTION_IDS.actionable]: ISSUE_ACTIONABLE_NOUL_QUESTION,
|
|
108
|
+
[ISSUE_TRIAGE_QUESTION_IDS.security]: ISSUE_SECURITY_NOUL_QUESTION,
|
|
109
|
+
[ISSUE_TRIAGE_QUESTION_IDS.regression]: ISSUE_REGRESSION_NOUL_QUESTION
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
var issueTriageAnswersSchema = zod.z.object({
|
|
113
|
+
[ISSUE_TRIAGE_QUESTION_IDS.type]: choiceAnswerSchema,
|
|
114
|
+
[ISSUE_TRIAGE_QUESTION_IDS.stream]: choiceAnswerSchema,
|
|
115
|
+
[ISSUE_TRIAGE_QUESTION_IDS.actionable]: noulAnswerSchema,
|
|
116
|
+
[ISSUE_TRIAGE_QUESTION_IDS.security]: noulAnswerSchema,
|
|
117
|
+
[ISSUE_TRIAGE_QUESTION_IDS.regression]: noulAnswerSchema
|
|
118
|
+
});
|
|
119
|
+
var ISSUE_TYPE_CONFIDENCE_FLOOR = 0.6;
|
|
120
|
+
var ISSUE_STREAM_CONFIDENCE_FLOOR = 0.7;
|
|
121
|
+
var ISSUE_NEEDS_INFO_MAX_ACTIONABLE = 0.35;
|
|
122
|
+
var ISSUE_ROUTING_THRESHOLD = 0.85;
|
|
123
|
+
function clearsNoul(answer, threshold) {
|
|
124
|
+
return answer.noul >= threshold;
|
|
125
|
+
}
|
|
126
|
+
function pickType(answer, floor) {
|
|
127
|
+
const choice = pickChoiceAboveFloor(answer, { floor, noMatch: "unclear" });
|
|
128
|
+
return choice !== null && choice in ISSUE_TYPE_TAXONOMY ? choice : null;
|
|
129
|
+
}
|
|
130
|
+
function pickStream(answer, floor) {
|
|
131
|
+
const choice = pickChoiceAboveFloor(answer, { floor, noMatch: "unclear" });
|
|
132
|
+
return choice !== null && choice in ISSUE_STREAM_TAXONOMY ? choice : null;
|
|
133
|
+
}
|
|
134
|
+
function issueLabelsFromAnswers(answers, opts = {}) {
|
|
135
|
+
const typeFloor = opts.typeFloor ?? ISSUE_TYPE_CONFIDENCE_FLOOR;
|
|
136
|
+
const streamFloor = opts.streamFloor ?? ISSUE_STREAM_CONFIDENCE_FLOOR;
|
|
137
|
+
const needsInfoMax = opts.needsInfoMaxActionable ?? ISSUE_NEEDS_INFO_MAX_ACTIONABLE;
|
|
138
|
+
const routing = opts.routingThreshold ?? ISSUE_ROUTING_THRESHOLD;
|
|
139
|
+
const type = pickType(answers[ISSUE_TRIAGE_QUESTION_IDS.type], typeFloor);
|
|
140
|
+
if (type === "spam") {
|
|
141
|
+
return {
|
|
142
|
+
labels: ["spam"],
|
|
143
|
+
type,
|
|
144
|
+
stream: null,
|
|
145
|
+
needsInfo: false,
|
|
146
|
+
security: false,
|
|
147
|
+
regression: false
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const stream = pickStream(answers[ISSUE_TRIAGE_QUESTION_IDS.stream], streamFloor);
|
|
151
|
+
const needsInfo = answers[ISSUE_TRIAGE_QUESTION_IDS.actionable].noul < needsInfoMax;
|
|
152
|
+
const security = clearsNoul(answers[ISSUE_TRIAGE_QUESTION_IDS.security], routing);
|
|
153
|
+
const regression = clearsNoul(answers[ISSUE_TRIAGE_QUESTION_IDS.regression], routing);
|
|
154
|
+
const labels = [];
|
|
155
|
+
if (type !== null) labels.push(type);
|
|
156
|
+
if (security) labels.push("security");
|
|
157
|
+
if (regression) labels.push("regression");
|
|
158
|
+
const streamLabel = stream !== null ? ISSUE_STREAM_LABELS[stream] : null;
|
|
159
|
+
if (streamLabel) labels.push(streamLabel);
|
|
160
|
+
if (needsInfo) labels.push("needs-info");
|
|
161
|
+
return { labels, type, stream, needsInfo, security, regression };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
exports.ISSUE_ACTIONABLE_NOUL_QUESTION = ISSUE_ACTIONABLE_NOUL_QUESTION;
|
|
165
|
+
exports.ISSUE_BODY_MAX_CHARS = ISSUE_BODY_MAX_CHARS;
|
|
166
|
+
exports.ISSUE_NEEDS_INFO_MAX_ACTIONABLE = ISSUE_NEEDS_INFO_MAX_ACTIONABLE;
|
|
167
|
+
exports.ISSUE_REGRESSION_NOUL_QUESTION = ISSUE_REGRESSION_NOUL_QUESTION;
|
|
168
|
+
exports.ISSUE_ROUTING_THRESHOLD = ISSUE_ROUTING_THRESHOLD;
|
|
169
|
+
exports.ISSUE_SECURITY_NOUL_QUESTION = ISSUE_SECURITY_NOUL_QUESTION;
|
|
170
|
+
exports.ISSUE_STREAM_CHOICE_QUESTION = ISSUE_STREAM_CHOICE_QUESTION;
|
|
171
|
+
exports.ISSUE_STREAM_CONFIDENCE_FLOOR = ISSUE_STREAM_CONFIDENCE_FLOOR;
|
|
172
|
+
exports.ISSUE_STREAM_LABELS = ISSUE_STREAM_LABELS;
|
|
173
|
+
exports.ISSUE_STREAM_TAXONOMY = ISSUE_STREAM_TAXONOMY;
|
|
174
|
+
exports.ISSUE_TRIAGE_QUESTION_IDS = ISSUE_TRIAGE_QUESTION_IDS;
|
|
175
|
+
exports.ISSUE_TYPE_CHOICE_QUESTION = ISSUE_TYPE_CHOICE_QUESTION;
|
|
176
|
+
exports.ISSUE_TYPE_CONFIDENCE_FLOOR = ISSUE_TYPE_CONFIDENCE_FLOOR;
|
|
177
|
+
exports.ISSUE_TYPE_TAXONOMY = ISSUE_TYPE_TAXONOMY;
|
|
178
|
+
exports.buildIssueTriageQuestions = buildIssueTriageQuestions;
|
|
179
|
+
exports.buildIssueTriageState = buildIssueTriageState;
|
|
180
|
+
exports.issueLabelsFromAnswers = issueLabelsFromAnswers;
|
|
181
|
+
exports.issueTriageAnswersSchema = issueTriageAnswersSchema;
|
|
182
|
+
//# sourceMappingURL=issue.cjs.map
|
|
183
|
+
//# sourceMappingURL=issue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/jev/index.ts","../../src/jev/issue.ts"],"names":["z","choiceQuestion"],"mappings":";;;;;AA+CO,IAAM,gBAAA,GAAmBA,MAAE,MAAA,CAAO;AAAA,EACvC,IAAA,EAAMA,KAAA,CAAE,OAAA,CAAQ,MAAM,CAAA;AAAA,EACtB,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,CAAC;AAC/B,CAAC,CAAA;AAOM,IAAM,kBAAA,GAAqBA,MAAE,MAAA,CAAO;AAAA,EACzC,IAAA,EAAMA,KAAA,CAAE,OAAA,CAAQ,QAAQ,CAAA;AAAA,EACxB,MAAA,EAAQA,MAAE,MAAA,EAAO;AAAA,EACjB,UAAA,EAAYA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,CAAC,CAAA;AAAA,EACnC,aAAA,EAAeA,MAAE,MAAA,CAAOA,KAAA,CAAE,QAAO,EA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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/** 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"]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { NoulQuestion, ChoiceQuestion } from './index.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Issue-triage judgments for the background-agent chores (sifa-workspace
|
|
6
|
+
* decision 2026-10-05, background agents tier policy). Pure builders: the
|
|
7
|
+
* typed questions to ask Jev about a GitHub issue, the label taxonomies, and
|
|
8
|
+
* the thresholds that turn answers into label suggestions. No network, no key.
|
|
9
|
+
*
|
|
10
|
+
* Scope is deliberately T0 (read-only): the output is a list of label
|
|
11
|
+
* suggestions a workflow may apply from an allowlist, never a code change.
|
|
12
|
+
* Jev only sees public issue text. Exact signals (GlitchTip links, template
|
|
13
|
+
* fields present) stay in code, not in a judgment.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Public, non-user fields of a GitHub issue that the judgment may see. */
|
|
17
|
+
interface IssueInput {
|
|
18
|
+
repo: string;
|
|
19
|
+
title: string;
|
|
20
|
+
body?: string;
|
|
21
|
+
/** Labels already on the issue (e.g. set by a template). */
|
|
22
|
+
existingLabels?: string[];
|
|
23
|
+
}
|
|
24
|
+
/** Longest issue body forwarded to Jev; keeps state bounded and cheap. */
|
|
25
|
+
declare const ISSUE_BODY_MAX_CHARS = 6000;
|
|
26
|
+
interface IssueTriageState {
|
|
27
|
+
repo: string;
|
|
28
|
+
title: string;
|
|
29
|
+
body?: string;
|
|
30
|
+
bodyTruncated?: true;
|
|
31
|
+
existingLabels?: string[];
|
|
32
|
+
}
|
|
33
|
+
/** State for the issue questions. Absent and blank fields are dropped. */
|
|
34
|
+
declare function buildIssueTriageState(issue: IssueInput): IssueTriageState;
|
|
35
|
+
/** One type label per issue. `unclear` is the no-match option and never a label. */
|
|
36
|
+
declare const ISSUE_TYPE_TAXONOMY: Record<string, string>;
|
|
37
|
+
/** Which product stream an issue belongs to. `unclear` is the no-match option. */
|
|
38
|
+
declare const ISSUE_STREAM_TAXONOMY: Record<string, string>;
|
|
39
|
+
/** Label applied for the Kootana stream; the Sifa stream carries no label. */
|
|
40
|
+
declare const ISSUE_STREAM_LABELS: Readonly<Record<string, string | null>>;
|
|
41
|
+
declare const ISSUE_TYPE_CHOICE_QUESTION: ChoiceQuestion;
|
|
42
|
+
declare const ISSUE_STREAM_CHOICE_QUESTION: ChoiceQuestion;
|
|
43
|
+
declare const ISSUE_ACTIONABLE_NOUL_QUESTION: NoulQuestion;
|
|
44
|
+
declare const ISSUE_SECURITY_NOUL_QUESTION: NoulQuestion;
|
|
45
|
+
declare const ISSUE_REGRESSION_NOUL_QUESTION: NoulQuestion;
|
|
46
|
+
/** Stable question ids; the answer keys Jev returns. */
|
|
47
|
+
declare const ISSUE_TRIAGE_QUESTION_IDS: {
|
|
48
|
+
readonly type: "issueType";
|
|
49
|
+
readonly stream: "issueStream";
|
|
50
|
+
readonly actionable: "issueActionable";
|
|
51
|
+
readonly security: "issueSecurity";
|
|
52
|
+
readonly regression: "issueRegression";
|
|
53
|
+
};
|
|
54
|
+
/** All issue questions, keyed by {@link ISSUE_TRIAGE_QUESTION_IDS}, for one batched call. */
|
|
55
|
+
declare function buildIssueTriageQuestions(): Record<string, ChoiceQuestion | NoulQuestion>;
|
|
56
|
+
/** Parsed answers for the batched issue call. */
|
|
57
|
+
declare const issueTriageAnswersSchema: z.ZodObject<{
|
|
58
|
+
issueType: z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"choice">;
|
|
60
|
+
choice: z.ZodString;
|
|
61
|
+
confidence: z.ZodNumber;
|
|
62
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
issueStream: z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"choice">;
|
|
66
|
+
choice: z.ZodString;
|
|
67
|
+
confidence: z.ZodNumber;
|
|
68
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
issueActionable: z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"noul">;
|
|
72
|
+
noul: z.ZodNumber;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
issueSecurity: z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"noul">;
|
|
76
|
+
noul: z.ZodNumber;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
issueRegression: z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"noul">;
|
|
80
|
+
noul: z.ZodNumber;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
type IssueTriageAnswers = z.infer<typeof issueTriageAnswersSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* Thresholds. Precision over recall: a wrong label costs a maintainer a click
|
|
86
|
+
* and trains distrust; a missing label costs nothing. Validate on labelled
|
|
87
|
+
* closed issues (sifa-api#1555) before widening.
|
|
88
|
+
*/
|
|
89
|
+
declare const ISSUE_TYPE_CONFIDENCE_FLOOR = 0.6;
|
|
90
|
+
declare const ISSUE_STREAM_CONFIDENCE_FLOOR = 0.7;
|
|
91
|
+
/** Below this P(actionable) the issue gets `needs-info`. */
|
|
92
|
+
declare const ISSUE_NEEDS_INFO_MAX_ACTIONABLE = 0.35;
|
|
93
|
+
/** Routing labels (security, regression) need a confident yes. */
|
|
94
|
+
declare const ISSUE_ROUTING_THRESHOLD = 0.85;
|
|
95
|
+
interface IssueLabelSuggestions {
|
|
96
|
+
/** Labels to apply, in a stable order, each guaranteed to be a real label name. */
|
|
97
|
+
labels: string[];
|
|
98
|
+
/** The type choice after the floor, or null when unset. */
|
|
99
|
+
type: string | null;
|
|
100
|
+
/** The stream choice after the floor, or null when unset. */
|
|
101
|
+
stream: string | null;
|
|
102
|
+
needsInfo: boolean;
|
|
103
|
+
security: boolean;
|
|
104
|
+
regression: boolean;
|
|
105
|
+
}
|
|
106
|
+
interface IssueLabelOptions {
|
|
107
|
+
typeFloor?: number;
|
|
108
|
+
streamFloor?: number;
|
|
109
|
+
needsInfoMaxActionable?: number;
|
|
110
|
+
routingThreshold?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Turn validated answers into label suggestions. Spam short-circuits: a spam
|
|
114
|
+
* issue gets only `spam`, no routing or needs-info. A choice outside the
|
|
115
|
+
* taxonomy (Jev invented a key) is treated as unset.
|
|
116
|
+
*/
|
|
117
|
+
declare function issueLabelsFromAnswers(answers: IssueTriageAnswers, opts?: IssueLabelOptions): IssueLabelSuggestions;
|
|
118
|
+
|
|
119
|
+
export { ISSUE_ACTIONABLE_NOUL_QUESTION, ISSUE_BODY_MAX_CHARS, ISSUE_NEEDS_INFO_MAX_ACTIONABLE, ISSUE_REGRESSION_NOUL_QUESTION, ISSUE_ROUTING_THRESHOLD, ISSUE_SECURITY_NOUL_QUESTION, ISSUE_STREAM_CHOICE_QUESTION, ISSUE_STREAM_CONFIDENCE_FLOOR, ISSUE_STREAM_LABELS, ISSUE_STREAM_TAXONOMY, ISSUE_TRIAGE_QUESTION_IDS, ISSUE_TYPE_CHOICE_QUESTION, ISSUE_TYPE_CONFIDENCE_FLOOR, ISSUE_TYPE_TAXONOMY, type IssueInput, type IssueLabelOptions, type IssueLabelSuggestions, type IssueTriageAnswers, type IssueTriageState, buildIssueTriageQuestions, buildIssueTriageState, issueLabelsFromAnswers, issueTriageAnswersSchema };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { NoulQuestion, ChoiceQuestion } from './index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Issue-triage judgments for the background-agent chores (sifa-workspace
|
|
6
|
+
* decision 2026-10-05, background agents tier policy). Pure builders: the
|
|
7
|
+
* typed questions to ask Jev about a GitHub issue, the label taxonomies, and
|
|
8
|
+
* the thresholds that turn answers into label suggestions. No network, no key.
|
|
9
|
+
*
|
|
10
|
+
* Scope is deliberately T0 (read-only): the output is a list of label
|
|
11
|
+
* suggestions a workflow may apply from an allowlist, never a code change.
|
|
12
|
+
* Jev only sees public issue text. Exact signals (GlitchTip links, template
|
|
13
|
+
* fields present) stay in code, not in a judgment.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Public, non-user fields of a GitHub issue that the judgment may see. */
|
|
17
|
+
interface IssueInput {
|
|
18
|
+
repo: string;
|
|
19
|
+
title: string;
|
|
20
|
+
body?: string;
|
|
21
|
+
/** Labels already on the issue (e.g. set by a template). */
|
|
22
|
+
existingLabels?: string[];
|
|
23
|
+
}
|
|
24
|
+
/** Longest issue body forwarded to Jev; keeps state bounded and cheap. */
|
|
25
|
+
declare const ISSUE_BODY_MAX_CHARS = 6000;
|
|
26
|
+
interface IssueTriageState {
|
|
27
|
+
repo: string;
|
|
28
|
+
title: string;
|
|
29
|
+
body?: string;
|
|
30
|
+
bodyTruncated?: true;
|
|
31
|
+
existingLabels?: string[];
|
|
32
|
+
}
|
|
33
|
+
/** State for the issue questions. Absent and blank fields are dropped. */
|
|
34
|
+
declare function buildIssueTriageState(issue: IssueInput): IssueTriageState;
|
|
35
|
+
/** One type label per issue. `unclear` is the no-match option and never a label. */
|
|
36
|
+
declare const ISSUE_TYPE_TAXONOMY: Record<string, string>;
|
|
37
|
+
/** Which product stream an issue belongs to. `unclear` is the no-match option. */
|
|
38
|
+
declare const ISSUE_STREAM_TAXONOMY: Record<string, string>;
|
|
39
|
+
/** Label applied for the Kootana stream; the Sifa stream carries no label. */
|
|
40
|
+
declare const ISSUE_STREAM_LABELS: Readonly<Record<string, string | null>>;
|
|
41
|
+
declare const ISSUE_TYPE_CHOICE_QUESTION: ChoiceQuestion;
|
|
42
|
+
declare const ISSUE_STREAM_CHOICE_QUESTION: ChoiceQuestion;
|
|
43
|
+
declare const ISSUE_ACTIONABLE_NOUL_QUESTION: NoulQuestion;
|
|
44
|
+
declare const ISSUE_SECURITY_NOUL_QUESTION: NoulQuestion;
|
|
45
|
+
declare const ISSUE_REGRESSION_NOUL_QUESTION: NoulQuestion;
|
|
46
|
+
/** Stable question ids; the answer keys Jev returns. */
|
|
47
|
+
declare const ISSUE_TRIAGE_QUESTION_IDS: {
|
|
48
|
+
readonly type: "issueType";
|
|
49
|
+
readonly stream: "issueStream";
|
|
50
|
+
readonly actionable: "issueActionable";
|
|
51
|
+
readonly security: "issueSecurity";
|
|
52
|
+
readonly regression: "issueRegression";
|
|
53
|
+
};
|
|
54
|
+
/** All issue questions, keyed by {@link ISSUE_TRIAGE_QUESTION_IDS}, for one batched call. */
|
|
55
|
+
declare function buildIssueTriageQuestions(): Record<string, ChoiceQuestion | NoulQuestion>;
|
|
56
|
+
/** Parsed answers for the batched issue call. */
|
|
57
|
+
declare const issueTriageAnswersSchema: z.ZodObject<{
|
|
58
|
+
issueType: z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"choice">;
|
|
60
|
+
choice: z.ZodString;
|
|
61
|
+
confidence: z.ZodNumber;
|
|
62
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
issueStream: z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"choice">;
|
|
66
|
+
choice: z.ZodString;
|
|
67
|
+
confidence: z.ZodNumber;
|
|
68
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
issueActionable: z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"noul">;
|
|
72
|
+
noul: z.ZodNumber;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
issueSecurity: z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"noul">;
|
|
76
|
+
noul: z.ZodNumber;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
issueRegression: z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"noul">;
|
|
80
|
+
noul: z.ZodNumber;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
type IssueTriageAnswers = z.infer<typeof issueTriageAnswersSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* Thresholds. Precision over recall: a wrong label costs a maintainer a click
|
|
86
|
+
* and trains distrust; a missing label costs nothing. Validate on labelled
|
|
87
|
+
* closed issues (sifa-api#1555) before widening.
|
|
88
|
+
*/
|
|
89
|
+
declare const ISSUE_TYPE_CONFIDENCE_FLOOR = 0.6;
|
|
90
|
+
declare const ISSUE_STREAM_CONFIDENCE_FLOOR = 0.7;
|
|
91
|
+
/** Below this P(actionable) the issue gets `needs-info`. */
|
|
92
|
+
declare const ISSUE_NEEDS_INFO_MAX_ACTIONABLE = 0.35;
|
|
93
|
+
/** Routing labels (security, regression) need a confident yes. */
|
|
94
|
+
declare const ISSUE_ROUTING_THRESHOLD = 0.85;
|
|
95
|
+
interface IssueLabelSuggestions {
|
|
96
|
+
/** Labels to apply, in a stable order, each guaranteed to be a real label name. */
|
|
97
|
+
labels: string[];
|
|
98
|
+
/** The type choice after the floor, or null when unset. */
|
|
99
|
+
type: string | null;
|
|
100
|
+
/** The stream choice after the floor, or null when unset. */
|
|
101
|
+
stream: string | null;
|
|
102
|
+
needsInfo: boolean;
|
|
103
|
+
security: boolean;
|
|
104
|
+
regression: boolean;
|
|
105
|
+
}
|
|
106
|
+
interface IssueLabelOptions {
|
|
107
|
+
typeFloor?: number;
|
|
108
|
+
streamFloor?: number;
|
|
109
|
+
needsInfoMaxActionable?: number;
|
|
110
|
+
routingThreshold?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Turn validated answers into label suggestions. Spam short-circuits: a spam
|
|
114
|
+
* issue gets only `spam`, no routing or needs-info. A choice outside the
|
|
115
|
+
* taxonomy (Jev invented a key) is treated as unset.
|
|
116
|
+
*/
|
|
117
|
+
declare function issueLabelsFromAnswers(answers: IssueTriageAnswers, opts?: IssueLabelOptions): IssueLabelSuggestions;
|
|
118
|
+
|
|
119
|
+
export { ISSUE_ACTIONABLE_NOUL_QUESTION, ISSUE_BODY_MAX_CHARS, ISSUE_NEEDS_INFO_MAX_ACTIONABLE, ISSUE_REGRESSION_NOUL_QUESTION, ISSUE_ROUTING_THRESHOLD, ISSUE_SECURITY_NOUL_QUESTION, ISSUE_STREAM_CHOICE_QUESTION, ISSUE_STREAM_CONFIDENCE_FLOOR, ISSUE_STREAM_LABELS, ISSUE_STREAM_TAXONOMY, ISSUE_TRIAGE_QUESTION_IDS, ISSUE_TYPE_CHOICE_QUESTION, ISSUE_TYPE_CONFIDENCE_FLOOR, ISSUE_TYPE_TAXONOMY, type IssueInput, type IssueLabelOptions, type IssueLabelSuggestions, type IssueTriageAnswers, type IssueTriageState, buildIssueTriageQuestions, buildIssueTriageState, issueLabelsFromAnswers, issueTriageAnswersSchema };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// src/jev/issue.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import {
|
|
4
|
+
choiceAnswerSchema,
|
|
5
|
+
noulAnswerSchema,
|
|
6
|
+
pickChoiceAboveFloor
|
|
7
|
+
} from "./index.js";
|
|
8
|
+
var ISSUE_BODY_MAX_CHARS = 6e3;
|
|
9
|
+
function buildIssueTriageState(issue) {
|
|
10
|
+
const state = { repo: issue.repo, title: issue.title.trim() };
|
|
11
|
+
const body = issue.body?.trim();
|
|
12
|
+
if (body) {
|
|
13
|
+
if (body.length > ISSUE_BODY_MAX_CHARS) {
|
|
14
|
+
state.body = body.slice(0, ISSUE_BODY_MAX_CHARS);
|
|
15
|
+
state.bodyTruncated = true;
|
|
16
|
+
} else {
|
|
17
|
+
state.body = body;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (issue.existingLabels && issue.existingLabels.length > 0) {
|
|
21
|
+
state.existingLabels = issue.existingLabels;
|
|
22
|
+
}
|
|
23
|
+
return state;
|
|
24
|
+
}
|
|
25
|
+
var ISSUE_TYPE_TAXONOMY = {
|
|
26
|
+
bug: "Something that exists does not behave as documented or expected (error, crash, wrong output)",
|
|
27
|
+
feature: "A request for new behaviour or capability that does not exist yet",
|
|
28
|
+
question: "A question about how something works, with nothing to build or fix",
|
|
29
|
+
documentation: "Docs, README, comments, or examples are missing, wrong, or unclear",
|
|
30
|
+
"tech-debt": "Internal refactor, cleanup, dependency, or tooling work with no user-visible change",
|
|
31
|
+
spam: "Spam, gibberish, advertising, or a test submission",
|
|
32
|
+
unclear: "Not enough information to decide the type"
|
|
33
|
+
};
|
|
34
|
+
var ISSUE_STREAM_TAXONOMY = {
|
|
35
|
+
sifa: "The Sifa profile, activity stream, ingestion, search, or web app",
|
|
36
|
+
kootana: "Kootana: events, meetings, in-person connect, QR scan, organizer tools",
|
|
37
|
+
unclear: "Cannot tell from the issue"
|
|
38
|
+
};
|
|
39
|
+
var ISSUE_STREAM_LABELS = {
|
|
40
|
+
sifa: null,
|
|
41
|
+
kootana: "stream:kootana",
|
|
42
|
+
unclear: null
|
|
43
|
+
};
|
|
44
|
+
function choiceQuestion(instructions, criteria) {
|
|
45
|
+
return { type: "choice", instructions, criteria };
|
|
46
|
+
}
|
|
47
|
+
var ISSUE_TYPE_CHOICE_QUESTION = choiceQuestion(
|
|
48
|
+
"The state holds one GitHub issue (repo, title, body, existing labels). Which single type best describes it?",
|
|
49
|
+
ISSUE_TYPE_TAXONOMY
|
|
50
|
+
);
|
|
51
|
+
var ISSUE_STREAM_CHOICE_QUESTION = choiceQuestion(
|
|
52
|
+
"Which product stream does this issue concern?",
|
|
53
|
+
ISSUE_STREAM_TAXONOMY
|
|
54
|
+
);
|
|
55
|
+
var ISSUE_ACTIONABLE_NOUL_QUESTION = {
|
|
56
|
+
type: "noul",
|
|
57
|
+
instructions: "Does the issue contain enough information for a maintainer to act on it without asking the reporter anything?",
|
|
58
|
+
criteria: {
|
|
59
|
+
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.",
|
|
60
|
+
false: "Essential details are missing: no way to reproduce, no expected behaviour, vague wish with no outcome, or a bare title."
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var ISSUE_SECURITY_NOUL_QUESTION = {
|
|
64
|
+
type: "noul",
|
|
65
|
+
instructions: "Does the issue describe a security-relevant problem?",
|
|
66
|
+
criteria: {
|
|
67
|
+
true: "A vulnerability, auth or session flaw, data exposure, abuse or spam vector, secrets handling, or a dependency advisory.",
|
|
68
|
+
false: "An ordinary bug, feature, question, or docs issue with no security angle."
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var ISSUE_REGRESSION_NOUL_QUESTION = {
|
|
72
|
+
type: "noul",
|
|
73
|
+
instructions: "Does the issue report that something which previously worked no longer works?",
|
|
74
|
+
criteria: {
|
|
75
|
+
true: "The reporter states or clearly implies the behaviour worked before a release, deploy, or change.",
|
|
76
|
+
false: "A new bug with no prior-working claim, a feature request, or a question."
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var ISSUE_TRIAGE_QUESTION_IDS = {
|
|
80
|
+
type: "issueType",
|
|
81
|
+
stream: "issueStream",
|
|
82
|
+
actionable: "issueActionable",
|
|
83
|
+
security: "issueSecurity",
|
|
84
|
+
regression: "issueRegression"
|
|
85
|
+
};
|
|
86
|
+
function buildIssueTriageQuestions() {
|
|
87
|
+
return {
|
|
88
|
+
[ISSUE_TRIAGE_QUESTION_IDS.type]: ISSUE_TYPE_CHOICE_QUESTION,
|
|
89
|
+
[ISSUE_TRIAGE_QUESTION_IDS.stream]: ISSUE_STREAM_CHOICE_QUESTION,
|
|
90
|
+
[ISSUE_TRIAGE_QUESTION_IDS.actionable]: ISSUE_ACTIONABLE_NOUL_QUESTION,
|
|
91
|
+
[ISSUE_TRIAGE_QUESTION_IDS.security]: ISSUE_SECURITY_NOUL_QUESTION,
|
|
92
|
+
[ISSUE_TRIAGE_QUESTION_IDS.regression]: ISSUE_REGRESSION_NOUL_QUESTION
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
var issueTriageAnswersSchema = z.object({
|
|
96
|
+
[ISSUE_TRIAGE_QUESTION_IDS.type]: choiceAnswerSchema,
|
|
97
|
+
[ISSUE_TRIAGE_QUESTION_IDS.stream]: choiceAnswerSchema,
|
|
98
|
+
[ISSUE_TRIAGE_QUESTION_IDS.actionable]: noulAnswerSchema,
|
|
99
|
+
[ISSUE_TRIAGE_QUESTION_IDS.security]: noulAnswerSchema,
|
|
100
|
+
[ISSUE_TRIAGE_QUESTION_IDS.regression]: noulAnswerSchema
|
|
101
|
+
});
|
|
102
|
+
var ISSUE_TYPE_CONFIDENCE_FLOOR = 0.6;
|
|
103
|
+
var ISSUE_STREAM_CONFIDENCE_FLOOR = 0.7;
|
|
104
|
+
var ISSUE_NEEDS_INFO_MAX_ACTIONABLE = 0.35;
|
|
105
|
+
var ISSUE_ROUTING_THRESHOLD = 0.85;
|
|
106
|
+
function clearsNoul(answer, threshold) {
|
|
107
|
+
return answer.noul >= threshold;
|
|
108
|
+
}
|
|
109
|
+
function pickType(answer, floor) {
|
|
110
|
+
const choice = pickChoiceAboveFloor(answer, { floor, noMatch: "unclear" });
|
|
111
|
+
return choice !== null && choice in ISSUE_TYPE_TAXONOMY ? choice : null;
|
|
112
|
+
}
|
|
113
|
+
function pickStream(answer, floor) {
|
|
114
|
+
const choice = pickChoiceAboveFloor(answer, { floor, noMatch: "unclear" });
|
|
115
|
+
return choice !== null && choice in ISSUE_STREAM_TAXONOMY ? choice : null;
|
|
116
|
+
}
|
|
117
|
+
function issueLabelsFromAnswers(answers, opts = {}) {
|
|
118
|
+
const typeFloor = opts.typeFloor ?? ISSUE_TYPE_CONFIDENCE_FLOOR;
|
|
119
|
+
const streamFloor = opts.streamFloor ?? ISSUE_STREAM_CONFIDENCE_FLOOR;
|
|
120
|
+
const needsInfoMax = opts.needsInfoMaxActionable ?? ISSUE_NEEDS_INFO_MAX_ACTIONABLE;
|
|
121
|
+
const routing = opts.routingThreshold ?? ISSUE_ROUTING_THRESHOLD;
|
|
122
|
+
const type = pickType(answers[ISSUE_TRIAGE_QUESTION_IDS.type], typeFloor);
|
|
123
|
+
if (type === "spam") {
|
|
124
|
+
return {
|
|
125
|
+
labels: ["spam"],
|
|
126
|
+
type,
|
|
127
|
+
stream: null,
|
|
128
|
+
needsInfo: false,
|
|
129
|
+
security: false,
|
|
130
|
+
regression: false
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const stream = pickStream(answers[ISSUE_TRIAGE_QUESTION_IDS.stream], streamFloor);
|
|
134
|
+
const needsInfo = answers[ISSUE_TRIAGE_QUESTION_IDS.actionable].noul < needsInfoMax;
|
|
135
|
+
const security = clearsNoul(answers[ISSUE_TRIAGE_QUESTION_IDS.security], routing);
|
|
136
|
+
const regression = clearsNoul(answers[ISSUE_TRIAGE_QUESTION_IDS.regression], routing);
|
|
137
|
+
const labels = [];
|
|
138
|
+
if (type !== null) labels.push(type);
|
|
139
|
+
if (security) labels.push("security");
|
|
140
|
+
if (regression) labels.push("regression");
|
|
141
|
+
const streamLabel = stream !== null ? ISSUE_STREAM_LABELS[stream] : null;
|
|
142
|
+
if (streamLabel) labels.push(streamLabel);
|
|
143
|
+
if (needsInfo) labels.push("needs-info");
|
|
144
|
+
return { labels, type, stream, needsInfo, security, regression };
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
ISSUE_ACTIONABLE_NOUL_QUESTION,
|
|
148
|
+
ISSUE_BODY_MAX_CHARS,
|
|
149
|
+
ISSUE_NEEDS_INFO_MAX_ACTIONABLE,
|
|
150
|
+
ISSUE_REGRESSION_NOUL_QUESTION,
|
|
151
|
+
ISSUE_ROUTING_THRESHOLD,
|
|
152
|
+
ISSUE_SECURITY_NOUL_QUESTION,
|
|
153
|
+
ISSUE_STREAM_CHOICE_QUESTION,
|
|
154
|
+
ISSUE_STREAM_CONFIDENCE_FLOOR,
|
|
155
|
+
ISSUE_STREAM_LABELS,
|
|
156
|
+
ISSUE_STREAM_TAXONOMY,
|
|
157
|
+
ISSUE_TRIAGE_QUESTION_IDS,
|
|
158
|
+
ISSUE_TYPE_CHOICE_QUESTION,
|
|
159
|
+
ISSUE_TYPE_CONFIDENCE_FLOOR,
|
|
160
|
+
ISSUE_TYPE_TAXONOMY,
|
|
161
|
+
buildIssueTriageQuestions,
|
|
162
|
+
buildIssueTriageState,
|
|
163
|
+
issueLabelsFromAnswers,
|
|
164
|
+
issueTriageAnswersSchema
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/jev/issue.ts"],"sourcesContent":["/**\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"],"mappings":";AAYA,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAgBA,IAAM,uBAAuB;AAW7B,SAAS,sBAAsB,OAAqC;AACzE,QAAM,QAA0B,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,MAAM,KAAK,EAAE;AAC9E,QAAM,OAAO,MAAM,MAAM,KAAK;AAC9B,MAAI,MAAM;AACR,QAAI,KAAK,SAAS,sBAAsB;AACtC,YAAM,OAAO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,YAAY;AAAA,IACd;AAAA,EACF;AAEA,QAAM,SAAS,WAAW,QAAQ,0BAA0B,MAAM,GAAG,WAAW;AAChF,QAAM,YAAY,QAAQ,0BAA0B,UAAU,EAAE,OAAO;AACvE,QAAM,WAAW,WAAW,QAAQ,0BAA0B,QAAQ,GAAG,OAAO;AAChF,QAAM,aAAa,WAAW,QAAQ,0BAA0B,UAAU,GAAG,OAAO;AAEpF,QAAM,SAAmB,CAAC;AAC1B,MAAI,SAAS,KAAM,QAAO,KAAK,IAAI;AACnC,MAAI,SAAU,QAAO,KAAK,UAAU;AACpC,MAAI,WAAY,QAAO,KAAK,YAAY;AACxC,QAAM,cAAc,WAAW,OAAO,oBAAoB,MAAM,IAAI;AACpE,MAAI,YAAa,QAAO,KAAK,WAAW;AACxC,MAAI,UAAW,QAAO,KAAK,YAAY;AAEvC,SAAO,EAAE,QAAQ,MAAM,QAAQ,WAAW,UAAU,WAAW;AACjE;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singi-labs/sifa-sdk",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.80",
|
|
4
4
|
"description": "Sifa SDK — public client library for the Sifa AppView on AT Protocol. Shared by sifa-web and sifa-app.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -172,6 +172,16 @@
|
|
|
172
172
|
"default": "./dist/jev/index.cjs"
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
|
+
"./jev/issue": {
|
|
176
|
+
"import": {
|
|
177
|
+
"types": "./dist/jev/issue.d.ts",
|
|
178
|
+
"default": "./dist/jev/issue.js"
|
|
179
|
+
},
|
|
180
|
+
"require": {
|
|
181
|
+
"types": "./dist/jev/issue.d.cts",
|
|
182
|
+
"default": "./dist/jev/issue.cjs"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
175
185
|
"./rpg": {
|
|
176
186
|
"import": {
|
|
177
187
|
"types": "./dist/rpg/index.d.ts",
|