@ghostpaw/questlog 0.7.0 → 0.9.0

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/mcp.js CHANGED
@@ -384,7 +384,7 @@ async function openQuestlogDb(path) {
384
384
  }
385
385
 
386
386
  // src/version.ts
387
- var questlogVersion = "0.7.0";
387
+ var questlogVersion = "0.9.0";
388
388
 
389
389
  // src/surface/questlog_mcp_instructions.ts
390
390
  var questlogMcpInstructions = "Questlog manages local tasks, calendar commitments, and recurring work. Search before creating work, inspect before changing it, and keep uncertain work as rumors. Use unlock prerequisites to sequence work. run_quest refuses blocked starts unless force is true. Review commitments and resolve work with an honest outcome.";
@@ -721,6 +721,17 @@ function deriveQuestState(quest) {
721
721
  return "open";
722
722
  }
723
723
 
724
+ // src/tools/quest_resolution_fields.ts
725
+ function questResolutionFields({
726
+ outcome,
727
+ resolvedAt
728
+ }) {
729
+ const fields = {};
730
+ if (outcome != null) fields.outcome = outcome;
731
+ if (resolvedAt != null) fields.resolvedAt = resolvedAt;
732
+ return fields;
733
+ }
734
+
724
735
  // src/tools/tool_ref.ts
725
736
  function toQuestRef(quest) {
726
737
  return {
@@ -728,15 +739,12 @@ function toQuestRef(quest) {
728
739
  id: quest.id,
729
740
  title: quest.title,
730
741
  markerId: "markerId" in quest ? quest.markerId : null,
731
- state: "state" in quest ? quest.state : deriveQuestState({
732
- startedAt: quest.startedAt,
733
- resolvedAt: quest.resolvedAt,
734
- success: quest.success
735
- })
742
+ state: "state" in quest ? quest.state : deriveQuestState(quest)
736
743
  };
737
744
  }
738
745
  function toQuestListItem(quest) {
739
746
  return {
747
+ ...questResolutionFields(quest),
740
748
  ...toQuestRef(quest),
741
749
  subtitle: quest.objective,
742
750
  dueAt: quest.effectiveDueAt,
@@ -1262,55 +1270,56 @@ function getRumorDetail(db, rumorId) {
1262
1270
  }
1263
1271
 
1264
1272
  // src/tools/inspect_questlog_item_tool.ts
1273
+ function compactFields(detail, keys) {
1274
+ const compact = {};
1275
+ for (const key of keys) compact[key] = detail[key];
1276
+ return compact;
1277
+ }
1265
1278
  function toQuestCompactDetail(detail) {
1266
1279
  return {
1267
- id: detail.id,
1268
- title: detail.title,
1269
- objective: detail.objective,
1270
- state: detail.state,
1271
- markerId: detail.markerId,
1272
- available: detail.available,
1273
- effectiveDueAt: detail.effectiveDueAt,
1274
- tagNames: detail.tagNames,
1275
- questlineId: detail.questlineId,
1276
- sourceRumorId: detail.sourceRumorId,
1277
- spawnedFromRepeatableId: detail.spawnedFromRepeatableId
1280
+ ...questResolutionFields(detail),
1281
+ ...compactFields(detail, [
1282
+ "id",
1283
+ "title",
1284
+ "objective",
1285
+ "state",
1286
+ "markerId",
1287
+ "available",
1288
+ "effectiveDueAt",
1289
+ "tagNames",
1290
+ "questlineId",
1291
+ "sourceRumorId",
1292
+ "spawnedFromRepeatableId"
1293
+ ])
1278
1294
  };
1279
1295
  }
1280
1296
  function toQuestlineCompactDetail(detail) {
1281
- return {
1282
- id: detail.id,
1283
- title: detail.title,
1284
- description: detail.description,
1285
- dueAt: detail.dueAt,
1286
- archivedAt: detail.archivedAt,
1287
- totalQuests: detail.totalQuests,
1288
- availableQuests: detail.availableQuests,
1289
- overdueQuests: detail.overdueQuests,
1290
- sourceRumorId: detail.sourceRumorId
1291
- };
1297
+ return compactFields(detail, [
1298
+ "id",
1299
+ "title",
1300
+ "description",
1301
+ "dueAt",
1302
+ "archivedAt",
1303
+ "totalQuests",
1304
+ "availableQuests",
1305
+ "overdueQuests",
1306
+ "sourceRumorId"
1307
+ ]);
1292
1308
  }
1293
1309
  function toRepeatableQuestCompactDetail(detail) {
1294
- return {
1295
- id: detail.id,
1296
- title: detail.title,
1297
- objective: detail.objective,
1298
- rrule: detail.rrule,
1299
- anchorAt: detail.anchorAt,
1300
- questlineId: detail.questlineId,
1301
- archivedAt: detail.archivedAt,
1302
- deletedAt: detail.deletedAt
1303
- };
1310
+ return compactFields(detail, [
1311
+ "id",
1312
+ "title",
1313
+ "objective",
1314
+ "rrule",
1315
+ "anchorAt",
1316
+ "questlineId",
1317
+ "archivedAt",
1318
+ "deletedAt"
1319
+ ]);
1304
1320
  }
1305
1321
  function toRumorCompactDetail(detail) {
1306
- return {
1307
- id: detail.id,
1308
- title: detail.title,
1309
- details: detail.details,
1310
- state: detail.state,
1311
- markerId: detail.markerId,
1312
- outputs: detail.outputs
1313
- };
1322
+ return compactFields(detail, ["id", "title", "details", "state", "markerId", "outputs"]);
1314
1323
  }
1315
1324
  function inspectQuestlogItemToolHandler(db, input) {
1316
1325
  const detailLevel = input.detailLevel ?? "compact";
@@ -3597,6 +3606,16 @@ var rewardWorkTool = defineQuestlogTool({
3597
3606
  function runQuestToolHandler(db, input) {
3598
3607
  try {
3599
3608
  const current = getQuestDetail(db, input.questId);
3609
+ if (input.action !== "start" && input.action !== "log_effort") {
3610
+ const outcome = input.outcome;
3611
+ if (typeof outcome !== "string") {
3612
+ return toolNeedsClarification(
3613
+ "missing_required_choice",
3614
+ `What outcome should be recorded for quest \`${current.title}\`?`,
3615
+ ["outcome"]
3616
+ );
3617
+ }
3618
+ }
3600
3619
  switch (input.action) {
3601
3620
  case "start": {
3602
3621
  if (current.resolvedAt != null) {
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export { openQuestlogDb } from './chunk-3B6FMHZU.js';