@wrongstack/requirement-intake 1.0.33 → 1.0.36
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/constants.d.ts +0 -2
- package/dist/index.js +182 -126
- package/dist/service-helpers.d.ts +2 -0
- package/dist/service-suggestions.d.ts +23 -0
- package/dist/service.d.ts +2 -1
- package/package.json +3 -3
package/dist/constants.d.ts
CHANGED
|
@@ -68,8 +68,6 @@ export declare const MAX_QUESTION_LENGTH = 500;
|
|
|
68
68
|
export declare const MAX_HISTORY_ENTRIES = 200;
|
|
69
69
|
/** Maximum number of pending LLM suggestions retained per record. */
|
|
70
70
|
export declare const MAX_SUGGESTIONS = 100;
|
|
71
|
-
/** Deterministic fallback summary length when no LLM summary is available. */
|
|
72
|
-
export declare const DETERMINISTIC_SUMMARY_LENGTH = 240;
|
|
73
71
|
/**
|
|
74
72
|
* Default intake question catalog. Hosts may override via create options.
|
|
75
73
|
* `field` values map to record properties through the answer pipeline
|
package/dist/index.js
CHANGED
|
@@ -1027,9 +1027,11 @@ function deriveVibeState(rawText, existingState, now = Date.now()) {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
1029
|
// src/service-helpers.ts
|
|
1030
|
+
function splitItems(raw) {
|
|
1031
|
+
return raw.split(/[\n,;]+/).map((item) => item.trim()).filter((item) => item.length > 0);
|
|
1032
|
+
}
|
|
1030
1033
|
function appendItems(target, raw) {
|
|
1031
|
-
const
|
|
1032
|
-
for (const item of items) {
|
|
1034
|
+
for (const item of splitItems(raw)) {
|
|
1033
1035
|
if (!target.includes(item) && target.length < MAX_ARRAY_ITEMS) {
|
|
1034
1036
|
target.push(item);
|
|
1035
1037
|
}
|
|
@@ -1059,22 +1061,26 @@ var ANSWER_FIELD_MAPPING = {
|
|
|
1059
1061
|
target_users: {
|
|
1060
1062
|
set: (record, value) => {
|
|
1061
1063
|
appendItems(record.targetUsers, value);
|
|
1062
|
-
}
|
|
1064
|
+
},
|
|
1065
|
+
list: (record) => record.targetUsers
|
|
1063
1066
|
},
|
|
1064
1067
|
constraints: {
|
|
1065
1068
|
set: (record, value) => {
|
|
1066
1069
|
appendItems(record.constraints, value);
|
|
1067
|
-
}
|
|
1070
|
+
},
|
|
1071
|
+
list: (record) => record.constraints
|
|
1068
1072
|
},
|
|
1069
1073
|
provided_context: {
|
|
1070
1074
|
set: (record, value) => {
|
|
1071
1075
|
appendItems(record.providedContext, value);
|
|
1072
|
-
}
|
|
1076
|
+
},
|
|
1077
|
+
list: (record) => record.providedContext
|
|
1073
1078
|
},
|
|
1074
1079
|
project_component: {
|
|
1075
1080
|
set: (record, value) => {
|
|
1076
1081
|
appendItems(record.providedContext, value);
|
|
1077
|
-
}
|
|
1082
|
+
},
|
|
1083
|
+
list: (record) => record.providedContext
|
|
1078
1084
|
},
|
|
1079
1085
|
priority: {
|
|
1080
1086
|
set: (record, value) => {
|
|
@@ -1319,6 +1325,7 @@ function applyAnswerUpdateToRecord(record, answerId, newAnswer) {
|
|
|
1319
1325
|
{ field: "answerId", message: `answer not found: ${answerId}` }
|
|
1320
1326
|
]);
|
|
1321
1327
|
}
|
|
1328
|
+
const previous = answer.answer;
|
|
1322
1329
|
answer.answer = newAnswer;
|
|
1323
1330
|
answer.answeredAt = Date.now();
|
|
1324
1331
|
const question = record.questions.find((candidate) => candidate.field === answer.field);
|
|
@@ -1327,6 +1334,18 @@ function applyAnswerUpdateToRecord(record, answerId, newAnswer) {
|
|
|
1327
1334
|
question.status = "answered";
|
|
1328
1335
|
}
|
|
1329
1336
|
const mapping = ANSWER_FIELD_MAPPING[answer.field];
|
|
1337
|
+
const list = mapping?.list?.(record);
|
|
1338
|
+
if (list) {
|
|
1339
|
+
const stillGiven = new Set(
|
|
1340
|
+
record.answers.filter(
|
|
1341
|
+
(other) => other !== answer && ANSWER_FIELD_MAPPING[other.field]?.list?.(record) === list
|
|
1342
|
+
).flatMap((other) => splitItems(other.answer))
|
|
1343
|
+
);
|
|
1344
|
+
for (const item of splitItems(previous)) {
|
|
1345
|
+
const at = list.indexOf(item);
|
|
1346
|
+
if (at >= 0 && !stillGiven.has(item)) list.splice(at, 1);
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1330
1349
|
if (mapping) {
|
|
1331
1350
|
mapping.set(record, newAnswer);
|
|
1332
1351
|
const sourceKey = answer.field;
|
|
@@ -1380,6 +1399,134 @@ function applyRelatedResourceToRecord(record, validated, actorId, now) {
|
|
|
1380
1399
|
return resource;
|
|
1381
1400
|
}
|
|
1382
1401
|
|
|
1402
|
+
// src/service-suggestions.ts
|
|
1403
|
+
async function generateSuggestions(host, id, ctx, focus) {
|
|
1404
|
+
const record = await host.requireRecord(id, ctx, "suggest");
|
|
1405
|
+
host.assertMutable(record, "generateSuggestions");
|
|
1406
|
+
if (!host.generator) {
|
|
1407
|
+
throw new IntakeSuggestionError("No LLM suggestion generator is configured on this service");
|
|
1408
|
+
}
|
|
1409
|
+
host.metrics.increment("intake.suggestions.requested");
|
|
1410
|
+
let output;
|
|
1411
|
+
try {
|
|
1412
|
+
output = await host.generator.generate({ record, focus });
|
|
1413
|
+
} catch (error) {
|
|
1414
|
+
host.metrics.increment("intake.suggestions.failed");
|
|
1415
|
+
host.logger.error("intake", "intake.suggestions.failed", {
|
|
1416
|
+
intakeId: record.id,
|
|
1417
|
+
projectId: record.projectId,
|
|
1418
|
+
actorId: ctx.id
|
|
1419
|
+
});
|
|
1420
|
+
throw new IntakeSuggestionError("LLM suggestion generation failed", { cause: error });
|
|
1421
|
+
}
|
|
1422
|
+
let proposals;
|
|
1423
|
+
try {
|
|
1424
|
+
proposals = toProposals(validateLlmSuggestionOutput(output));
|
|
1425
|
+
} catch (error) {
|
|
1426
|
+
host.metrics.increment("intake.suggestions.failed");
|
|
1427
|
+
throw error instanceof IntakeSuggestionError ? error : new IntakeSuggestionError("LLM suggestion output could not be validated", {
|
|
1428
|
+
cause: error
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
if (proposals.length === 0) {
|
|
1432
|
+
host.metrics.increment("intake.suggestions.failed");
|
|
1433
|
+
throw new IntakeSuggestionError("LLM suggestion output contained no usable proposals");
|
|
1434
|
+
}
|
|
1435
|
+
const hadQuestions = proposals.some((proposal2) => proposal2.kind === "question");
|
|
1436
|
+
let previousStatus = record.status;
|
|
1437
|
+
const updateOptions = {
|
|
1438
|
+
actorId: ctx.id,
|
|
1439
|
+
actorType: ctx.type,
|
|
1440
|
+
action: hadQuestions ? "information_requested" : "suggestions_added"
|
|
1441
|
+
};
|
|
1442
|
+
const updated = await host.store.update(id, updateOptions, (next) => {
|
|
1443
|
+
host.assertMutable(next, "generateSuggestions");
|
|
1444
|
+
previousStatus = next.status;
|
|
1445
|
+
if (next.status === "draft") {
|
|
1446
|
+
updateOptions.from = "draft";
|
|
1447
|
+
updateOptions.to = "collecting_information";
|
|
1448
|
+
next.status = "collecting_information";
|
|
1449
|
+
}
|
|
1450
|
+
next.llmSuggestions.push(...proposals);
|
|
1451
|
+
if (next.llmSuggestions.length > MAX_SUGGESTIONS) {
|
|
1452
|
+
next.llmSuggestions = next.llmSuggestions.slice(next.llmSuggestions.length - MAX_SUGGESTIONS);
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
host.metrics.increment("intake.suggestions.succeeded");
|
|
1456
|
+
host.logger.info("intake", "intake.suggestions.succeeded", {
|
|
1457
|
+
intakeId: updated.id,
|
|
1458
|
+
projectId: updated.projectId,
|
|
1459
|
+
actorId: ctx.id,
|
|
1460
|
+
count: proposals.length
|
|
1461
|
+
});
|
|
1462
|
+
host.emit(hadQuestions ? "RequirementIntakeInformationRequested" : "RequirementIntakeUpdated", {
|
|
1463
|
+
intakeId: updated.id,
|
|
1464
|
+
projectId: updated.projectId,
|
|
1465
|
+
actorId: ctx.id,
|
|
1466
|
+
actorType: ctx.type,
|
|
1467
|
+
previousStatus,
|
|
1468
|
+
status: updated.status
|
|
1469
|
+
});
|
|
1470
|
+
return proposals;
|
|
1471
|
+
}
|
|
1472
|
+
async function acceptSuggestion(host, id, proposalId, ctx, expectedVersion) {
|
|
1473
|
+
const record = await host.requireRecord(id, ctx, "accept_suggestion");
|
|
1474
|
+
host.assertMutable(record, "acceptSuggestion");
|
|
1475
|
+
const proposal2 = host.findSuggestion(record, proposalId);
|
|
1476
|
+
if (proposal2.status !== "pending") {
|
|
1477
|
+
throw new IntakeValidationError([
|
|
1478
|
+
{ field: "suggestionId", message: `suggestion is already ${proposal2.status}` }
|
|
1479
|
+
]);
|
|
1480
|
+
}
|
|
1481
|
+
return host.store.update(
|
|
1482
|
+
id,
|
|
1483
|
+
host.updateMeta(ctx, "suggestion_accepted", [proposal2.kind], expectedVersion),
|
|
1484
|
+
(next) => {
|
|
1485
|
+
host.assertMutable(next, "acceptSuggestion");
|
|
1486
|
+
const target = next.llmSuggestions.find((candidate) => candidate.id === proposalId);
|
|
1487
|
+
if (!target) {
|
|
1488
|
+
throw new IntakeValidationError([
|
|
1489
|
+
{ field: "suggestionId", message: `suggestion not found: ${proposalId}` }
|
|
1490
|
+
]);
|
|
1491
|
+
}
|
|
1492
|
+
host.applyProposal(next, target);
|
|
1493
|
+
target.status = "accepted";
|
|
1494
|
+
target.resolvedAt = Date.now();
|
|
1495
|
+
}
|
|
1496
|
+
).then((updated) => {
|
|
1497
|
+
host.afterMutation(updated, ctx, "RequirementIntakeUpdated");
|
|
1498
|
+
return updated;
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
async function rejectSuggestion(host, id, proposalId, ctx, expectedVersion) {
|
|
1502
|
+
const record = await host.requireRecord(id, ctx, "reject_suggestion");
|
|
1503
|
+
host.assertMutable(record, "rejectSuggestion");
|
|
1504
|
+
host.findSuggestion(record, proposalId);
|
|
1505
|
+
return host.store.update(
|
|
1506
|
+
id,
|
|
1507
|
+
host.updateMeta(ctx, "suggestion_rejected", [proposalId], expectedVersion),
|
|
1508
|
+
(next) => {
|
|
1509
|
+
host.assertMutable(next, "rejectSuggestion");
|
|
1510
|
+
const target = next.llmSuggestions.find((candidate) => candidate.id === proposalId);
|
|
1511
|
+
if (!target) {
|
|
1512
|
+
throw new IntakeValidationError([
|
|
1513
|
+
{ field: "suggestionId", message: `suggestion not found: ${proposalId}` }
|
|
1514
|
+
]);
|
|
1515
|
+
}
|
|
1516
|
+
if (target.status !== "pending") {
|
|
1517
|
+
throw new IntakeValidationError([
|
|
1518
|
+
{ field: "suggestionId", message: `suggestion is already ${target.status}` }
|
|
1519
|
+
]);
|
|
1520
|
+
}
|
|
1521
|
+
target.status = "rejected";
|
|
1522
|
+
target.resolvedAt = Date.now();
|
|
1523
|
+
}
|
|
1524
|
+
).then((updated) => {
|
|
1525
|
+
host.afterMutation(updated, ctx, "RequirementIntakeUpdated");
|
|
1526
|
+
return updated;
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1383
1530
|
// src/service.ts
|
|
1384
1531
|
var RequirementIntakeService = class {
|
|
1385
1532
|
store;
|
|
@@ -1598,132 +1745,25 @@ var RequirementIntakeService = class {
|
|
|
1598
1745
|
// LLM suggestions (always proposals)
|
|
1599
1746
|
// -------------------------------------------------------------------------
|
|
1600
1747
|
async generateSuggestions(id, ctx, focus) {
|
|
1601
|
-
|
|
1602
|
-
this.assertMutable(record, "generateSuggestions");
|
|
1603
|
-
if (!this.generator) {
|
|
1604
|
-
throw new IntakeSuggestionError("No LLM suggestion generator is configured on this service");
|
|
1605
|
-
}
|
|
1606
|
-
this.metrics.increment("intake.suggestions.requested");
|
|
1607
|
-
let output;
|
|
1608
|
-
try {
|
|
1609
|
-
output = await this.generator.generate({ record, focus });
|
|
1610
|
-
} catch (error) {
|
|
1611
|
-
this.metrics.increment("intake.suggestions.failed");
|
|
1612
|
-
this.logger.error("intake", "intake.suggestions.failed", {
|
|
1613
|
-
intakeId: record.id,
|
|
1614
|
-
projectId: record.projectId,
|
|
1615
|
-
actorId: ctx.id
|
|
1616
|
-
});
|
|
1617
|
-
throw new IntakeSuggestionError("LLM suggestion generation failed", { cause: error });
|
|
1618
|
-
}
|
|
1619
|
-
let proposals;
|
|
1620
|
-
try {
|
|
1621
|
-
proposals = toProposals(validateLlmSuggestionOutput(output));
|
|
1622
|
-
} catch (error) {
|
|
1623
|
-
this.metrics.increment("intake.suggestions.failed");
|
|
1624
|
-
throw error instanceof IntakeSuggestionError ? error : new IntakeSuggestionError("LLM suggestion output could not be validated", {
|
|
1625
|
-
cause: error
|
|
1626
|
-
});
|
|
1627
|
-
}
|
|
1628
|
-
if (proposals.length === 0) {
|
|
1629
|
-
this.metrics.increment("intake.suggestions.failed");
|
|
1630
|
-
throw new IntakeSuggestionError("LLM suggestion output contained no usable proposals");
|
|
1631
|
-
}
|
|
1632
|
-
const hadQuestions = proposals.some((proposal2) => proposal2.kind === "question");
|
|
1633
|
-
let previousStatus = record.status;
|
|
1634
|
-
const updateOptions = {
|
|
1635
|
-
actorId: ctx.id,
|
|
1636
|
-
actorType: ctx.type,
|
|
1637
|
-
action: hadQuestions ? "information_requested" : "suggestions_added"
|
|
1638
|
-
};
|
|
1639
|
-
const updated = await this.store.update(id, updateOptions, (next) => {
|
|
1640
|
-
this.assertMutable(next, "generateSuggestions");
|
|
1641
|
-
previousStatus = next.status;
|
|
1642
|
-
if (next.status === "draft") {
|
|
1643
|
-
updateOptions.from = "draft";
|
|
1644
|
-
updateOptions.to = "collecting_information";
|
|
1645
|
-
next.status = "collecting_information";
|
|
1646
|
-
}
|
|
1647
|
-
next.llmSuggestions.push(...proposals);
|
|
1648
|
-
if (next.llmSuggestions.length > MAX_SUGGESTIONS) {
|
|
1649
|
-
next.llmSuggestions = next.llmSuggestions.slice(
|
|
1650
|
-
next.llmSuggestions.length - MAX_SUGGESTIONS
|
|
1651
|
-
);
|
|
1652
|
-
}
|
|
1653
|
-
});
|
|
1654
|
-
this.metrics.increment("intake.suggestions.succeeded");
|
|
1655
|
-
this.logger.info("intake", "intake.suggestions.succeeded", {
|
|
1656
|
-
intakeId: updated.id,
|
|
1657
|
-
projectId: updated.projectId,
|
|
1658
|
-
actorId: ctx.id,
|
|
1659
|
-
count: proposals.length
|
|
1660
|
-
});
|
|
1661
|
-
this.emit(hadQuestions ? "RequirementIntakeInformationRequested" : "RequirementIntakeUpdated", {
|
|
1662
|
-
intakeId: updated.id,
|
|
1663
|
-
projectId: updated.projectId,
|
|
1664
|
-
actorId: ctx.id,
|
|
1665
|
-
actorType: ctx.type,
|
|
1666
|
-
previousStatus,
|
|
1667
|
-
status: updated.status
|
|
1668
|
-
});
|
|
1669
|
-
return proposals;
|
|
1748
|
+
return generateSuggestions(this.intakeSuggestionsHost(), id, ctx, focus);
|
|
1670
1749
|
}
|
|
1671
1750
|
async acceptSuggestion(id, proposalId, ctx, expectedVersion) {
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
const proposal2 = this.findSuggestion(record, proposalId);
|
|
1675
|
-
if (proposal2.status !== "pending") {
|
|
1676
|
-
throw new IntakeValidationError([
|
|
1677
|
-
{ field: "suggestionId", message: `suggestion is already ${proposal2.status}` }
|
|
1678
|
-
]);
|
|
1679
|
-
}
|
|
1680
|
-
return this.store.update(
|
|
1751
|
+
return acceptSuggestion(
|
|
1752
|
+
this.intakeSuggestionsHost(),
|
|
1681
1753
|
id,
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
if (!target) {
|
|
1687
|
-
throw new IntakeValidationError([
|
|
1688
|
-
{ field: "suggestionId", message: `suggestion not found: ${proposalId}` }
|
|
1689
|
-
]);
|
|
1690
|
-
}
|
|
1691
|
-
this.applyProposal(next, target);
|
|
1692
|
-
target.status = "accepted";
|
|
1693
|
-
target.resolvedAt = Date.now();
|
|
1694
|
-
}
|
|
1695
|
-
).then((updated) => {
|
|
1696
|
-
this.afterMutation(updated, ctx, "RequirementIntakeUpdated");
|
|
1697
|
-
return updated;
|
|
1698
|
-
});
|
|
1754
|
+
proposalId,
|
|
1755
|
+
ctx,
|
|
1756
|
+
expectedVersion
|
|
1757
|
+
);
|
|
1699
1758
|
}
|
|
1700
1759
|
async rejectSuggestion(id, proposalId, ctx, expectedVersion) {
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
this.findSuggestion(record, proposalId);
|
|
1704
|
-
return this.store.update(
|
|
1760
|
+
return rejectSuggestion(
|
|
1761
|
+
this.intakeSuggestionsHost(),
|
|
1705
1762
|
id,
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
if (!target) {
|
|
1711
|
-
throw new IntakeValidationError([
|
|
1712
|
-
{ field: "suggestionId", message: `suggestion not found: ${proposalId}` }
|
|
1713
|
-
]);
|
|
1714
|
-
}
|
|
1715
|
-
if (target.status !== "pending") {
|
|
1716
|
-
throw new IntakeValidationError([
|
|
1717
|
-
{ field: "suggestionId", message: `suggestion is already ${target.status}` }
|
|
1718
|
-
]);
|
|
1719
|
-
}
|
|
1720
|
-
target.status = "rejected";
|
|
1721
|
-
target.resolvedAt = Date.now();
|
|
1722
|
-
}
|
|
1723
|
-
).then((updated) => {
|
|
1724
|
-
this.afterMutation(updated, ctx, "RequirementIntakeUpdated");
|
|
1725
|
-
return updated;
|
|
1726
|
-
});
|
|
1763
|
+
proposalId,
|
|
1764
|
+
ctx,
|
|
1765
|
+
expectedVersion
|
|
1766
|
+
);
|
|
1727
1767
|
}
|
|
1728
1768
|
// -------------------------------------------------------------------------
|
|
1729
1769
|
// Lifecycle
|
|
@@ -1947,6 +1987,22 @@ var RequirementIntakeService = class {
|
|
|
1947
1987
|
throw error;
|
|
1948
1988
|
}
|
|
1949
1989
|
}
|
|
1990
|
+
intakeSuggestionsHost() {
|
|
1991
|
+
void {
|
|
1992
|
+
requireRecord: this.requireRecord,
|
|
1993
|
+
assertMutable: this.assertMutable,
|
|
1994
|
+
generator: this.generator,
|
|
1995
|
+
metrics: this.metrics,
|
|
1996
|
+
logger: this.logger,
|
|
1997
|
+
store: this.store,
|
|
1998
|
+
emit: this.emit,
|
|
1999
|
+
findSuggestion: this.findSuggestion,
|
|
2000
|
+
updateMeta: this.updateMeta,
|
|
2001
|
+
applyProposal: this.applyProposal,
|
|
2002
|
+
afterMutation: this.afterMutation
|
|
2003
|
+
};
|
|
2004
|
+
return this;
|
|
2005
|
+
}
|
|
1950
2006
|
};
|
|
1951
2007
|
|
|
1952
2008
|
// src/types.ts
|
|
@@ -4,6 +4,8 @@ export declare function appendItems(target: string[], raw: string): void;
|
|
|
4
4
|
/** Answer fields that also update a record property. */
|
|
5
5
|
export declare const ANSWER_FIELD_MAPPING: Readonly<Record<string, {
|
|
6
6
|
set: (record: RequirementIntakeRecord, value: string) => void;
|
|
7
|
+
/** The list an append-only answer feeds; an update takes its old items back out. */
|
|
8
|
+
list?: (record: RequirementIntakeRecord) => string[];
|
|
7
9
|
}>>;
|
|
8
10
|
export declare function buildNewIntakeRecord(input: CreateIntakeInput, ctx: IntakeContext, now: number, catalog: readonly IntakeQuestionTemplate[]): RequirementIntakeRecord;
|
|
9
11
|
export declare function assertIntakeSubmitReady(record: RequirementIntakeRecord): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IntakeOperation } from './authorization.js';
|
|
2
|
+
import type { IntakeLogger } from './logger.js';
|
|
3
|
+
import type { IntakeMetrics } from './metrics.js';
|
|
4
|
+
import type { RequirementIntakeStore, StoreUpdateOptions } from './store.js';
|
|
5
|
+
import { type LlmSuggestionGenerator } from './suggestions.js';
|
|
6
|
+
import type { IntakeContext, IntakeEvent, IntakeEventName, LlmSuggestionProposal, RequirementIntakeRecord } from './types.js';
|
|
7
|
+
export interface IntakeSuggestionsHost {
|
|
8
|
+
requireRecord(id: string, ctx: IntakeContext, operation: IntakeOperation): Promise<RequirementIntakeRecord>;
|
|
9
|
+
assertMutable(record: RequirementIntakeRecord, action: string): void;
|
|
10
|
+
generator: LlmSuggestionGenerator | undefined;
|
|
11
|
+
metrics: IntakeMetrics;
|
|
12
|
+
logger: IntakeLogger;
|
|
13
|
+
store: RequirementIntakeStore;
|
|
14
|
+
emit(event: IntakeEventName, data: Omit<IntakeEvent, 'event' | 'timestamp'>): void;
|
|
15
|
+
findSuggestion(record: RequirementIntakeRecord, proposalId: string): LlmSuggestionProposal;
|
|
16
|
+
updateMeta(ctx: IntakeContext, action: string, fields: string[], expectedVersion?: number | undefined): StoreUpdateOptions;
|
|
17
|
+
applyProposal(record: RequirementIntakeRecord, proposal: LlmSuggestionProposal): void;
|
|
18
|
+
afterMutation(record: RequirementIntakeRecord, ctx: IntakeContext, event: IntakeEventName): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function generateSuggestions(host: IntakeSuggestionsHost, id: string, ctx: IntakeContext, focus?: string[] | undefined): Promise<LlmSuggestionProposal[]>;
|
|
21
|
+
export declare function acceptSuggestion(host: IntakeSuggestionsHost, id: string, proposalId: string, ctx: IntakeContext, expectedVersion?: number | undefined): Promise<RequirementIntakeRecord>;
|
|
22
|
+
export declare function rejectSuggestion(host: IntakeSuggestionsHost, id: string, proposalId: string, ctx: IntakeContext, expectedVersion?: number | undefined): Promise<RequirementIntakeRecord>;
|
|
23
|
+
//# sourceMappingURL=service-suggestions.d.ts.map
|
package/dist/service.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { IntakeEventEmitter } from './events.js';
|
|
|
19
19
|
import { type IntakeLogger } from './logger.js';
|
|
20
20
|
import { type IntakeMetrics } from './metrics.js';
|
|
21
21
|
import type { RequirementIntakeStore } from './store.js';
|
|
22
|
-
import {
|
|
22
|
+
import type { LlmSuggestionGenerator } from './suggestions.js';
|
|
23
23
|
import type { AddAnswerInput, AttachResourceInput, CreateIntakeInput, IntakeContext, IntakeEvent, IntakeQuestion, LlmSuggestionProposal, RequirementIntakeRecord, UpdateIntakeInput } from './types.js';
|
|
24
24
|
export interface RequirementIntakeServiceOptions {
|
|
25
25
|
store: RequirementIntakeStore;
|
|
@@ -85,5 +85,6 @@ export declare class RequirementIntakeService {
|
|
|
85
85
|
private afterMutation;
|
|
86
86
|
private emit;
|
|
87
87
|
private guardValidation;
|
|
88
|
+
private intakeSuggestionsHost;
|
|
88
89
|
}
|
|
89
90
|
//# sourceMappingURL=service.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/requirement-intake",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.36",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "WrongStack Requirements Intake — collect, preserve, validate, normalize, and submit unstructured software development requests as structured intake records. Upstream of spec-driven development: it never plans, specifies, or implements.",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"!dist/**/*.map"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@wrongstack/core": "1.0.
|
|
30
|
+
"@wrongstack/core": "1.0.36",
|
|
31
31
|
"zod": "4.6.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "node ../../scripts/build-package.mjs",
|
|
42
|
-
"typecheck": "
|
|
42
|
+
"typecheck": "node ../../scripts/bun-typecheck.mjs --noEmit",
|
|
43
43
|
"test": "vitest run",
|
|
44
44
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|
|
45
45
|
}
|