@longtable/cli 0.1.54 → 0.1.55

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.
@@ -636,6 +636,18 @@ function changeSummaryForRevision(changes) {
636
636
  }
637
637
  return changes.slice(0, 12).map((change) => change.summary);
638
638
  }
639
+ function researchSpecificationAnswerConfirms(answer) {
640
+ return answer === "confirm_specification";
641
+ }
642
+ function researchSpecificationAnswerStatus(answer) {
643
+ if (researchSpecificationAnswerConfirms(answer)) {
644
+ return "confirmed";
645
+ }
646
+ if (answer === "keep_open") {
647
+ return "deferred";
648
+ }
649
+ return "draft";
650
+ }
639
651
  export function applyResearchSpecificationAuditUpdate(state, options) {
640
652
  const previous = state.researchSpecification;
641
653
  const incomingEvidenceIds = mergeStringLists(options.patch?.sourceEvidenceIds, options.specification.sourceEvidenceIds, options.sourceEvidenceIds);
@@ -2723,7 +2735,56 @@ export async function answerWorkspaceQuestion(options) {
2723
2735
  invocationLog: (state.invocationLog ?? []).map((record) => updateInvocationWithDecision(record, question.id, decision.id))
2724
2736
  };
2725
2737
  const withDecision = appendDecisionToResearchState(withQuestion, decision);
2726
- const updated = resolveQuestionObligationByQuestionId(withDecision, question.id, decision.id);
2738
+ let updated = resolveQuestionObligationByQuestionId(withDecision, question.id, decision.id);
2739
+ if (question.prompt.checkpointKey === "research_specification_confirmation") {
2740
+ const specification = updated.researchSpecification ?? options.context.session.researchSpecification;
2741
+ const selectedAnswer = answer.selectedValues[0];
2742
+ if (specification) {
2743
+ const nextStatus = researchSpecificationAnswerStatus(selectedAnswer);
2744
+ const confirmedSpecification = {
2745
+ ...specification,
2746
+ status: nextStatus,
2747
+ updatedAt: timestamp,
2748
+ ...(nextStatus === "confirmed" ? { confirmedAt: specification.confirmedAt ?? timestamp } : {})
2749
+ };
2750
+ const withHookStatus = {
2751
+ ...updated,
2752
+ hooks: (updated.hooks ?? []).map((hook) => {
2753
+ if (hook.id !== confirmedSpecification.sourceHookId) {
2754
+ return hook;
2755
+ }
2756
+ return {
2757
+ ...hook,
2758
+ status: nextStatus === "draft" ? "active" : nextStatus,
2759
+ updatedAt: timestamp,
2760
+ researchSpecification: confirmedSpecification,
2761
+ linkedQuestionRecordIds: mergeStringLists(hook.linkedQuestionRecordIds, [question.id]),
2762
+ linkedDecisionRecordIds: mergeStringLists(hook.linkedDecisionRecordIds, [decision.id])
2763
+ };
2764
+ })
2765
+ };
2766
+ const sourceEvidenceIds = (withHookStatus.evidenceRecords ?? [])
2767
+ .filter((record) => record.sourceHookId && record.sourceHookId === confirmedSpecification.sourceHookId)
2768
+ .map((record) => record.id);
2769
+ updated = applyResearchSpecificationAuditUpdate(withHookStatus, {
2770
+ specification: confirmedSpecification,
2771
+ timestamp,
2772
+ source: "decision",
2773
+ title: `Research Specification confirmation: ${confirmedSpecification.title}`,
2774
+ rationale: `Research Specification confirmation answer: ${selectedAnswer}`,
2775
+ sourceEvidenceIds,
2776
+ questionRecordId: question.id,
2777
+ decisionRecordId: decision.id,
2778
+ createDecisionRecord: false
2779
+ }).state;
2780
+ options.context.session = {
2781
+ ...options.context.session,
2782
+ researchSpecification: confirmedSpecification,
2783
+ lastUpdatedAt: timestamp
2784
+ };
2785
+ await writeFile(options.context.sessionFilePath, JSON.stringify(options.context.session, null, 2), "utf8");
2786
+ }
2787
+ }
2727
2788
  await writeFile(options.context.stateFilePath, JSON.stringify(updated, null, 2), "utf8");
2728
2789
  await syncCurrentWorkspaceView(options.context);
2729
2790
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longtable/cli",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "private": false,
5
5
  "description": "Researcher-facing LongTable CLI",
6
6
  "type": "module",
@@ -29,12 +29,12 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@clack/prompts": "^1.2.0",
32
- "@longtable/checkpoints": "0.1.54",
33
- "@longtable/core": "0.1.54",
34
- "@longtable/memory": "0.1.54",
35
- "@longtable/provider-claude": "0.1.54",
36
- "@longtable/provider-codex": "0.1.54",
37
- "@longtable/setup": "0.1.54"
32
+ "@longtable/checkpoints": "0.1.55",
33
+ "@longtable/core": "0.1.55",
34
+ "@longtable/memory": "0.1.55",
35
+ "@longtable/provider-claude": "0.1.55",
36
+ "@longtable/provider-codex": "0.1.55",
37
+ "@longtable/setup": "0.1.55"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.10.1",