@ghostpaw/questlog 0.5.1 → 0.6.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.
Files changed (41) hide show
  1. package/README.md +74 -1
  2. package/SKILL.md +293 -0
  3. package/dist/cli.js +7204 -0
  4. package/dist/database-DShQ4N46.d.cts +20 -0
  5. package/dist/database-DShQ4N46.d.ts +20 -0
  6. package/dist/index.cjs +33 -1
  7. package/dist/index.d.cts +3 -19
  8. package/dist/index.d.ts +3 -19
  9. package/dist/index.js +33 -1
  10. package/dist/mcp-server.js +5931 -0
  11. package/dist/mcp.cjs +4954 -0
  12. package/dist/mcp.d.cts +89 -0
  13. package/dist/mcp.d.ts +89 -0
  14. package/dist/mcp.js +4946 -0
  15. package/package.json +46 -9
  16. package/skills/questlog/SKILL.md +293 -0
  17. package/skills/questlog/references/archive-delete-and-prune.md +25 -0
  18. package/skills/questlog/references/choose-work-shape.md +25 -0
  19. package/skills/questlog/references/clarify-ambiguous-requests.md +24 -0
  20. package/skills/questlog/references/close-work-and-claim-outcomes.md +23 -0
  21. package/skills/questlog/references/create-concrete-quest.md +21 -0
  22. package/skills/questlog/references/detect-slips-and-staleness.md +22 -0
  23. package/skills/questlog/references/escalate-and-unblock.md +22 -0
  24. package/skills/questlog/references/frame-initiative-questline.md +23 -0
  25. package/skills/questlog/references/handle-exceptions-and-weird-cases.md +24 -0
  26. package/skills/questlog/references/intake-triage.md +25 -0
  27. package/skills/questlog/references/maintain-clear-ownership.md +22 -0
  28. package/skills/questlog/references/manage-approvals-and-promises.md +22 -0
  29. package/skills/questlog/references/plan-successor-work.md +22 -0
  30. package/skills/questlog/references/plan-time-correctly.md +22 -0
  31. package/skills/questlog/references/prioritize-across-streams.md +21 -0
  32. package/skills/questlog/references/protect-capacity-and-focus.md +20 -0
  33. package/skills/questlog/references/recover-from-modeling-mistakes.md +25 -0
  34. package/skills/questlog/references/report-status-and-manage-expectations.md +20 -0
  35. package/skills/questlog/references/revise-or-reshape-commitment.md +22 -0
  36. package/skills/questlog/references/run-operational-review.md +24 -0
  37. package/skills/questlog/references/run-recurring-rhythms.md +24 -0
  38. package/skills/questlog/references/search-and-retrieve-context.md +23 -0
  39. package/skills/questlog/references/sequence-with-unlocks.md +23 -0
  40. package/skills/questlog/references/settle-rumor-into-structure.md +25 -0
  41. package/skills/questlog/references/tag-and-filter-portfolios.md +21 -0
@@ -0,0 +1,20 @@
1
+ interface QuestlogRunResult {
2
+ lastInsertRowid: number | bigint;
3
+ changes?: number | bigint | undefined;
4
+ }
5
+ interface QuestlogStatement {
6
+ run(...params: unknown[]): QuestlogRunResult;
7
+ get<TRecord = Record<string, unknown>>(...params: unknown[]): TRecord | undefined;
8
+ all<TRecord = Record<string, unknown>>(...params: unknown[]): TRecord[];
9
+ }
10
+ /**
11
+ * SQLite dependency injected into every questlog operation.
12
+ * Node.js `DatabaseSync` satisfies this interface directly.
13
+ */
14
+ type QuestlogDb = {
15
+ exec(sql: string): void;
16
+ prepare(sql: string): QuestlogStatement;
17
+ close(): void;
18
+ };
19
+
20
+ export type { QuestlogDb as Q };
@@ -0,0 +1,20 @@
1
+ interface QuestlogRunResult {
2
+ lastInsertRowid: number | bigint;
3
+ changes?: number | bigint | undefined;
4
+ }
5
+ interface QuestlogStatement {
6
+ run(...params: unknown[]): QuestlogRunResult;
7
+ get<TRecord = Record<string, unknown>>(...params: unknown[]): TRecord | undefined;
8
+ all<TRecord = Record<string, unknown>>(...params: unknown[]): TRecord[];
9
+ }
10
+ /**
11
+ * SQLite dependency injected into every questlog operation.
12
+ * Node.js `DatabaseSync` satisfies this interface directly.
13
+ */
14
+ type QuestlogDb = {
15
+ exec(sql: string): void;
16
+ prepare(sql: string): QuestlogStatement;
17
+ close(): void;
18
+ };
19
+
20
+ export type { QuestlogDb as Q };
package/dist/index.cjs CHANGED
@@ -4766,6 +4766,30 @@ function runQuestToolHandler(db, input) {
4766
4766
  }
4767
4767
  );
4768
4768
  }
4769
+ const blockers = db.prepare(
4770
+ `SELECT blocker.id FROM quest_unlocks prerequisite
4771
+ JOIN quests blocker ON blocker.id = prerequisite.from_quest_id
4772
+ WHERE prerequisite.to_quest_id = ?
4773
+ AND prerequisite.deleted_at IS NULL
4774
+ AND blocker.deleted_at IS NULL
4775
+ AND NOT (blocker.resolved_at IS NOT NULL AND blocker.success = 1)
4776
+ ORDER BY blocker.id`
4777
+ ).all(current.id).map(({ id }) => getQuestDetail(db, id));
4778
+ if (blockers.length && !input.force) {
4779
+ return toolFailure(
4780
+ "domain",
4781
+ "invalid_state",
4782
+ `Quest "${current.title}" is blocked by ${blockers.map((quest) => quest.title).join(", ")}.`,
4783
+ "Finish the blocking prerequisites before starting this quest, or set force to true.",
4784
+ {
4785
+ entities: [toQuestRef(current), ...blockers.map(toQuestRef)],
4786
+ next: blockers.map((quest) => ({
4787
+ ...inspectItemNext(toQuestRef(quest)),
4788
+ message: `Inspect and finish blocker "${quest.title}".`
4789
+ }))
4790
+ }
4791
+ );
4792
+ }
4769
4793
  startQuest(db, input.questId, input.startedAt);
4770
4794
  const detail = getQuestDetail(db, input.questId);
4771
4795
  return toolSuccess(
@@ -4777,7 +4801,13 @@ function runQuestToolHandler(db, input) {
4777
4801
  quest: detail
4778
4802
  },
4779
4803
  {
4780
- entities: [toQuestRef(detail)]
4804
+ entities: [toQuestRef(detail)],
4805
+ warnings: blockers.length ? [
4806
+ {
4807
+ code: "derived_value_used",
4808
+ message: `Forced start with unmet prerequisites: ${blockers.map((quest) => quest.title).join(", ")}.`
4809
+ }
4810
+ ] : void 0
4781
4811
  }
4782
4812
  );
4783
4813
  }
@@ -4886,6 +4916,7 @@ var runQuestTool = defineQuestlogTool({
4886
4916
  action: "Which execution lifecycle step to perform on the quest.",
4887
4917
  questId: "The concrete quest whose execution state should change.",
4888
4918
  startedAt: "Optional actual start timestamp for the start action.",
4919
+ force: "Start despite unmet unlock prerequisites. Defaults to false.",
4889
4920
  effortSeconds: "Positive active-effort increment in seconds for the log-effort action.",
4890
4921
  now: "Optional timestamp for the effort log action.",
4891
4922
  outcome: "Terminal outcome text for finish or abandon actions.",
@@ -4904,6 +4935,7 @@ var runQuestTool = defineQuestlogTool({
4904
4935
  ]),
4905
4936
  questId: integerSchema("Quest whose execution state should change."),
4906
4937
  startedAt: integerSchema("Optional start timestamp for the start action."),
4938
+ force: booleanSchema("Start despite unmet unlock prerequisites. Defaults to false."),
4907
4939
  effortSeconds: integerSchema(
4908
4940
  "Positive active-effort increment in seconds. Required for log_effort."
4909
4941
  ),
package/dist/index.d.cts CHANGED
@@ -1,21 +1,4 @@
1
- interface QuestlogRunResult {
2
- lastInsertRowid: number | bigint;
3
- changes?: number | bigint | undefined;
4
- }
5
- interface QuestlogStatement {
6
- run(...params: unknown[]): QuestlogRunResult;
7
- get<TRecord = Record<string, unknown>>(...params: unknown[]): TRecord | undefined;
8
- all<TRecord = Record<string, unknown>>(...params: unknown[]): TRecord[];
9
- }
10
- /**
11
- * SQLite dependency injected into every questlog operation.
12
- * Node.js `DatabaseSync` satisfies this interface directly.
13
- */
14
- type QuestlogDb = {
15
- exec(sql: string): void;
16
- prepare(sql: string): QuestlogStatement;
17
- close(): void;
18
- };
1
+ import { Q as QuestlogDb } from './database-DShQ4N46.cjs';
19
2
 
20
3
  /**
21
4
  * Creates the full standalone questlog schema, including FTS and indexing.
@@ -1434,6 +1417,7 @@ type RunQuestToolInput = {
1434
1417
  action: 'start';
1435
1418
  questId: number;
1436
1419
  startedAt?: number;
1420
+ force?: boolean;
1437
1421
  };
1438
1422
  interface RunQuestToolData {
1439
1423
  action: RunQuestToolInput['action'];
@@ -1720,4 +1704,4 @@ declare namespace write {
1720
1704
  export { write_abandonQuest as abandonQuest, write_abandonQuestAndSpawnFollowups as abandonQuestAndSpawnFollowups, write_addQuestReward as addQuestReward, write_addUnlock as addUnlock, write_archiveQuestline as archiveQuestline, write_archiveRepeatableQuest as archiveRepeatableQuest, write_captureRumor as captureRumor, write_claimQuestReward as claimQuestReward, write_createQuest as createQuest, write_createQuestline as createQuestline, write_createRepeatableQuest as createRepeatableQuest, write_detachQuestFromQuestline as detachQuestFromQuestline, write_dismissRumor as dismissRumor, write_finishQuest as finishQuest, write_logQuestEffort as logQuestEffort, write_moveQuestToQuestline as moveQuestToQuestline, write_planQuestTime as planQuestTime, write_removeQuestReward as removeQuestReward, write_removeUnlock as removeUnlock, write_reopenRumor as reopenRumor, write_replaceQuestTags as replaceQuestTags, write_replaceRepeatableQuestRewards as replaceRepeatableQuestRewards, write_replaceRepeatableQuestTags as replaceRepeatableQuestTags, write_replaceUnlocks as replaceUnlocks, write_reviseQuestObjective as reviseQuestObjective, write_settleRumor as settleRumor, write_softDeleteQuest as softDeleteQuest, write_softDeleteQuestline as softDeleteQuestline, write_softDeleteRepeatableQuest as softDeleteRepeatableQuest, write_softDeleteRumor as softDeleteRumor, write_spawnDueRepeatableQuests as spawnDueRepeatableQuests, write_startQuest as startQuest, write_tagQuest as tagQuest, write_untagQuest as untagQuest, write_updateQuestReward as updateQuestReward, write_updateQuestline as updateQuestline, write_updateRepeatableQuest as updateRepeatableQuest, write_updateRumor as updateRumor };
1721
1705
  }
1722
1706
 
1723
- export { type AbandonQuestResult, type CaptureRumorInput, type CreateQuestInput, type CreateQuestlineInput, type CreateRepeatableQuestInput, type DueRepeatableAnchor, type FollowupQuestInput, type JsonSchema, type JsonSchemaType, type MarkerDefinition, type MarkerId, type PlanQuestTimeInput, type Quest, type QuestDetail, type QuestListFilters, type QuestReward, type QuestRewardInput, type QuestState, type QuestUnlock, type Questline, type QuestlineDetail, type QuestlogDb, type QuestlogSearchResult, type QuestlogSkill, type QuestlogSkillRegistry, type QuestlogSoul, type QuestlogSoulTrait, type QuestlogToolDefinition, type QuestlogToolMapping, type RepeatableQuest, type RepeatableQuestReward, type RepeatableQuestRewardInput, type Rumor, type RumorDetail, type RumorOutput, type RumorState, type SettleRumorInput, type SettleRumorResult, type Tag, type ToolClarificationCode, type ToolDefinitionRegistry, type ToolEntityKind, type ToolEntityRef, type ToolErrorCode, type ToolErrorKind, type ToolFailure, type ToolInputDescriptions, type ToolListItem, type ToolNeedsClarification, type ToolNextStepHint, type ToolNextStepHintKind, type ToolOutcomeKind, type ToolOutputDescription, type ToolResult, type ToolSideEffects, type ToolSuccess, type ToolWarning, type ToolWarningCode, type UpdateQuestlineInput, type UpdateRepeatableQuestInput, type UpdateRumorInput, abandonQuest, abandonQuestAndSpawnFollowups, addQuestReward, addUnlock, archiveDeleteAndPruneSkill, archiveQuestline, archiveRepeatableQuest, arraySchema, booleanSchema, captureRumor, captureRumorTool, captureRumorToolHandler, captureRumorToolName, chooseWorkShapeSkill, claimQuestReward, clarifyAmbiguousRequestsSkill, closeWorkAndClaimOutcomesSkill, createConcreteQuestSkill, createQuest, createQuestline, createRepeatableQuest, defineQuestlogSkill, defineQuestlogTool, detachQuestFromQuestline, detectSlipsAndStalenessSkill, dismissRumor, enumSchema, escalateAndUnblockSkill, finishQuest, frameInitiativeQuestlineSkill, getQuestDetail, getQuestlineDetail, getQuestlogSkillByName, getQuestlogToolByName, getRumorDetail, getRumorOutputs, handleExceptionsAndWeirdCasesSkill, initQuestlogTables, inspectQuestlogItemTool, inspectQuestlogItemToolHandler, inspectQuestlogItemToolName, intakeTriageSkill, integerSchema, listActiveQuests, listAvailableQuests, listBlockedQuests, listDeferredQuests, listDueRepeatableQuestAnchors, listDueSoonQuests, listInProgressQuests, listMissedScheduledQuests, listOpenQuests, listOverdueQuests, listQuestlines, listQuestlogSkills, listQuestlogToolDefinitions, listResolvedQuests, listRumors, listScheduledForDay, listScheduledNow, literalSchema, logQuestEffort, maintainClearOwnershipSkill, manageApprovalsAndPromisesSkill, manageRepeatableTool, manageRepeatableToolHandler, manageRepeatableToolName, index$2 as markers, moveQuestToQuestline, numberSchema, objectSchema, oneOfSchema, organizeWorkTool, organizeWorkToolHandler, organizeWorkToolName, planQuestTime, planQuestTool, planQuestToolHandler, planQuestToolName, planSuccessorWorkSkill, planTimeCorrectlySkill, prioritizeAcrossStreamsSkill, protectCapacityAndFocusSkill, questlogSkills, questlogToolMappings, questlogTools, read, recoverFromModelingMistakesSkill, removeQuestReward, removeUnlock, reopenRumor, replaceQuestTags, replaceRepeatableQuestRewards, replaceRepeatableQuestTags, replaceUnlocks, reportStatusAndManageExpectationsSkill, retireWorkTool, retireWorkToolHandler, retireWorkToolName, reviewQuestlogTool, reviewQuestlogToolHandler, reviewQuestlogToolName, reviseOrReshapeCommitmentSkill, reviseQuestObjective, rewardWorkTool, rewardWorkToolHandler, rewardWorkToolName, runOperationalReviewSkill, runQuestTool, runQuestToolHandler, runQuestToolName, runRecurringRhythmsSkill, searchAndRetrieveContextSkill, searchQuestlogTool, searchQuestlogToolHandler, searchQuestlogToolName, sequenceWithUnlocksSkill, settleRumor, settleRumorIntoStructureSkill, shapeWorkTool, shapeWorkToolHandler, shapeWorkToolName, index$1 as skills, softDeleteQuest, softDeleteQuestline, softDeleteRepeatableQuest, softDeleteRumor, soul, spawnDueRepeatableQuests, startQuest, stringSchema, tagAndFilterPortfoliosSkill, tagQuest, tagWorkTool, tagWorkToolHandler, tagWorkToolName, toolFailure, toolNeedsClarification, toolNoOp, toolSuccess, toolWarning, index as tools, untagQuest, updateQuestReward, updateQuestline, updateRepeatableQuest, updateRumor, write };
1707
+ export { type AbandonQuestResult, type CaptureRumorInput, type CreateQuestInput, type CreateQuestlineInput, type CreateRepeatableQuestInput, type DueRepeatableAnchor, type FollowupQuestInput, type JsonSchema, type JsonSchemaType, type MarkerDefinition, type MarkerId, type PlanQuestTimeInput, type Quest, type QuestDetail, type QuestListFilters, type QuestReward, type QuestRewardInput, type QuestState, type QuestUnlock, type Questline, type QuestlineDetail, QuestlogDb, type QuestlogSearchResult, type QuestlogSkill, type QuestlogSkillRegistry, type QuestlogSoul, type QuestlogSoulTrait, type QuestlogToolDefinition, type QuestlogToolMapping, type RepeatableQuest, type RepeatableQuestReward, type RepeatableQuestRewardInput, type Rumor, type RumorDetail, type RumorOutput, type RumorState, type SettleRumorInput, type SettleRumorResult, type Tag, type ToolClarificationCode, type ToolDefinitionRegistry, type ToolEntityKind, type ToolEntityRef, type ToolErrorCode, type ToolErrorKind, type ToolFailure, type ToolInputDescriptions, type ToolListItem, type ToolNeedsClarification, type ToolNextStepHint, type ToolNextStepHintKind, type ToolOutcomeKind, type ToolOutputDescription, type ToolResult, type ToolSideEffects, type ToolSuccess, type ToolWarning, type ToolWarningCode, type UpdateQuestlineInput, type UpdateRepeatableQuestInput, type UpdateRumorInput, abandonQuest, abandonQuestAndSpawnFollowups, addQuestReward, addUnlock, archiveDeleteAndPruneSkill, archiveQuestline, archiveRepeatableQuest, arraySchema, booleanSchema, captureRumor, captureRumorTool, captureRumorToolHandler, captureRumorToolName, chooseWorkShapeSkill, claimQuestReward, clarifyAmbiguousRequestsSkill, closeWorkAndClaimOutcomesSkill, createConcreteQuestSkill, createQuest, createQuestline, createRepeatableQuest, defineQuestlogSkill, defineQuestlogTool, detachQuestFromQuestline, detectSlipsAndStalenessSkill, dismissRumor, enumSchema, escalateAndUnblockSkill, finishQuest, frameInitiativeQuestlineSkill, getQuestDetail, getQuestlineDetail, getQuestlogSkillByName, getQuestlogToolByName, getRumorDetail, getRumorOutputs, handleExceptionsAndWeirdCasesSkill, initQuestlogTables, inspectQuestlogItemTool, inspectQuestlogItemToolHandler, inspectQuestlogItemToolName, intakeTriageSkill, integerSchema, listActiveQuests, listAvailableQuests, listBlockedQuests, listDeferredQuests, listDueRepeatableQuestAnchors, listDueSoonQuests, listInProgressQuests, listMissedScheduledQuests, listOpenQuests, listOverdueQuests, listQuestlines, listQuestlogSkills, listQuestlogToolDefinitions, listResolvedQuests, listRumors, listScheduledForDay, listScheduledNow, literalSchema, logQuestEffort, maintainClearOwnershipSkill, manageApprovalsAndPromisesSkill, manageRepeatableTool, manageRepeatableToolHandler, manageRepeatableToolName, index$2 as markers, moveQuestToQuestline, numberSchema, objectSchema, oneOfSchema, organizeWorkTool, organizeWorkToolHandler, organizeWorkToolName, planQuestTime, planQuestTool, planQuestToolHandler, planQuestToolName, planSuccessorWorkSkill, planTimeCorrectlySkill, prioritizeAcrossStreamsSkill, protectCapacityAndFocusSkill, questlogSkills, questlogToolMappings, questlogTools, read, recoverFromModelingMistakesSkill, removeQuestReward, removeUnlock, reopenRumor, replaceQuestTags, replaceRepeatableQuestRewards, replaceRepeatableQuestTags, replaceUnlocks, reportStatusAndManageExpectationsSkill, retireWorkTool, retireWorkToolHandler, retireWorkToolName, reviewQuestlogTool, reviewQuestlogToolHandler, reviewQuestlogToolName, reviseOrReshapeCommitmentSkill, reviseQuestObjective, rewardWorkTool, rewardWorkToolHandler, rewardWorkToolName, runOperationalReviewSkill, runQuestTool, runQuestToolHandler, runQuestToolName, runRecurringRhythmsSkill, searchAndRetrieveContextSkill, searchQuestlogTool, searchQuestlogToolHandler, searchQuestlogToolName, sequenceWithUnlocksSkill, settleRumor, settleRumorIntoStructureSkill, shapeWorkTool, shapeWorkToolHandler, shapeWorkToolName, index$1 as skills, softDeleteQuest, softDeleteQuestline, softDeleteRepeatableQuest, softDeleteRumor, soul, spawnDueRepeatableQuests, startQuest, stringSchema, tagAndFilterPortfoliosSkill, tagQuest, tagWorkTool, tagWorkToolHandler, tagWorkToolName, toolFailure, toolNeedsClarification, toolNoOp, toolSuccess, toolWarning, index as tools, untagQuest, updateQuestReward, updateQuestline, updateRepeatableQuest, updateRumor, write };
package/dist/index.d.ts CHANGED
@@ -1,21 +1,4 @@
1
- interface QuestlogRunResult {
2
- lastInsertRowid: number | bigint;
3
- changes?: number | bigint | undefined;
4
- }
5
- interface QuestlogStatement {
6
- run(...params: unknown[]): QuestlogRunResult;
7
- get<TRecord = Record<string, unknown>>(...params: unknown[]): TRecord | undefined;
8
- all<TRecord = Record<string, unknown>>(...params: unknown[]): TRecord[];
9
- }
10
- /**
11
- * SQLite dependency injected into every questlog operation.
12
- * Node.js `DatabaseSync` satisfies this interface directly.
13
- */
14
- type QuestlogDb = {
15
- exec(sql: string): void;
16
- prepare(sql: string): QuestlogStatement;
17
- close(): void;
18
- };
1
+ import { Q as QuestlogDb } from './database-DShQ4N46.js';
19
2
 
20
3
  /**
21
4
  * Creates the full standalone questlog schema, including FTS and indexing.
@@ -1434,6 +1417,7 @@ type RunQuestToolInput = {
1434
1417
  action: 'start';
1435
1418
  questId: number;
1436
1419
  startedAt?: number;
1420
+ force?: boolean;
1437
1421
  };
1438
1422
  interface RunQuestToolData {
1439
1423
  action: RunQuestToolInput['action'];
@@ -1720,4 +1704,4 @@ declare namespace write {
1720
1704
  export { write_abandonQuest as abandonQuest, write_abandonQuestAndSpawnFollowups as abandonQuestAndSpawnFollowups, write_addQuestReward as addQuestReward, write_addUnlock as addUnlock, write_archiveQuestline as archiveQuestline, write_archiveRepeatableQuest as archiveRepeatableQuest, write_captureRumor as captureRumor, write_claimQuestReward as claimQuestReward, write_createQuest as createQuest, write_createQuestline as createQuestline, write_createRepeatableQuest as createRepeatableQuest, write_detachQuestFromQuestline as detachQuestFromQuestline, write_dismissRumor as dismissRumor, write_finishQuest as finishQuest, write_logQuestEffort as logQuestEffort, write_moveQuestToQuestline as moveQuestToQuestline, write_planQuestTime as planQuestTime, write_removeQuestReward as removeQuestReward, write_removeUnlock as removeUnlock, write_reopenRumor as reopenRumor, write_replaceQuestTags as replaceQuestTags, write_replaceRepeatableQuestRewards as replaceRepeatableQuestRewards, write_replaceRepeatableQuestTags as replaceRepeatableQuestTags, write_replaceUnlocks as replaceUnlocks, write_reviseQuestObjective as reviseQuestObjective, write_settleRumor as settleRumor, write_softDeleteQuest as softDeleteQuest, write_softDeleteQuestline as softDeleteQuestline, write_softDeleteRepeatableQuest as softDeleteRepeatableQuest, write_softDeleteRumor as softDeleteRumor, write_spawnDueRepeatableQuests as spawnDueRepeatableQuests, write_startQuest as startQuest, write_tagQuest as tagQuest, write_untagQuest as untagQuest, write_updateQuestReward as updateQuestReward, write_updateQuestline as updateQuestline, write_updateRepeatableQuest as updateRepeatableQuest, write_updateRumor as updateRumor };
1721
1705
  }
1722
1706
 
1723
- export { type AbandonQuestResult, type CaptureRumorInput, type CreateQuestInput, type CreateQuestlineInput, type CreateRepeatableQuestInput, type DueRepeatableAnchor, type FollowupQuestInput, type JsonSchema, type JsonSchemaType, type MarkerDefinition, type MarkerId, type PlanQuestTimeInput, type Quest, type QuestDetail, type QuestListFilters, type QuestReward, type QuestRewardInput, type QuestState, type QuestUnlock, type Questline, type QuestlineDetail, type QuestlogDb, type QuestlogSearchResult, type QuestlogSkill, type QuestlogSkillRegistry, type QuestlogSoul, type QuestlogSoulTrait, type QuestlogToolDefinition, type QuestlogToolMapping, type RepeatableQuest, type RepeatableQuestReward, type RepeatableQuestRewardInput, type Rumor, type RumorDetail, type RumorOutput, type RumorState, type SettleRumorInput, type SettleRumorResult, type Tag, type ToolClarificationCode, type ToolDefinitionRegistry, type ToolEntityKind, type ToolEntityRef, type ToolErrorCode, type ToolErrorKind, type ToolFailure, type ToolInputDescriptions, type ToolListItem, type ToolNeedsClarification, type ToolNextStepHint, type ToolNextStepHintKind, type ToolOutcomeKind, type ToolOutputDescription, type ToolResult, type ToolSideEffects, type ToolSuccess, type ToolWarning, type ToolWarningCode, type UpdateQuestlineInput, type UpdateRepeatableQuestInput, type UpdateRumorInput, abandonQuest, abandonQuestAndSpawnFollowups, addQuestReward, addUnlock, archiveDeleteAndPruneSkill, archiveQuestline, archiveRepeatableQuest, arraySchema, booleanSchema, captureRumor, captureRumorTool, captureRumorToolHandler, captureRumorToolName, chooseWorkShapeSkill, claimQuestReward, clarifyAmbiguousRequestsSkill, closeWorkAndClaimOutcomesSkill, createConcreteQuestSkill, createQuest, createQuestline, createRepeatableQuest, defineQuestlogSkill, defineQuestlogTool, detachQuestFromQuestline, detectSlipsAndStalenessSkill, dismissRumor, enumSchema, escalateAndUnblockSkill, finishQuest, frameInitiativeQuestlineSkill, getQuestDetail, getQuestlineDetail, getQuestlogSkillByName, getQuestlogToolByName, getRumorDetail, getRumorOutputs, handleExceptionsAndWeirdCasesSkill, initQuestlogTables, inspectQuestlogItemTool, inspectQuestlogItemToolHandler, inspectQuestlogItemToolName, intakeTriageSkill, integerSchema, listActiveQuests, listAvailableQuests, listBlockedQuests, listDeferredQuests, listDueRepeatableQuestAnchors, listDueSoonQuests, listInProgressQuests, listMissedScheduledQuests, listOpenQuests, listOverdueQuests, listQuestlines, listQuestlogSkills, listQuestlogToolDefinitions, listResolvedQuests, listRumors, listScheduledForDay, listScheduledNow, literalSchema, logQuestEffort, maintainClearOwnershipSkill, manageApprovalsAndPromisesSkill, manageRepeatableTool, manageRepeatableToolHandler, manageRepeatableToolName, index$2 as markers, moveQuestToQuestline, numberSchema, objectSchema, oneOfSchema, organizeWorkTool, organizeWorkToolHandler, organizeWorkToolName, planQuestTime, planQuestTool, planQuestToolHandler, planQuestToolName, planSuccessorWorkSkill, planTimeCorrectlySkill, prioritizeAcrossStreamsSkill, protectCapacityAndFocusSkill, questlogSkills, questlogToolMappings, questlogTools, read, recoverFromModelingMistakesSkill, removeQuestReward, removeUnlock, reopenRumor, replaceQuestTags, replaceRepeatableQuestRewards, replaceRepeatableQuestTags, replaceUnlocks, reportStatusAndManageExpectationsSkill, retireWorkTool, retireWorkToolHandler, retireWorkToolName, reviewQuestlogTool, reviewQuestlogToolHandler, reviewQuestlogToolName, reviseOrReshapeCommitmentSkill, reviseQuestObjective, rewardWorkTool, rewardWorkToolHandler, rewardWorkToolName, runOperationalReviewSkill, runQuestTool, runQuestToolHandler, runQuestToolName, runRecurringRhythmsSkill, searchAndRetrieveContextSkill, searchQuestlogTool, searchQuestlogToolHandler, searchQuestlogToolName, sequenceWithUnlocksSkill, settleRumor, settleRumorIntoStructureSkill, shapeWorkTool, shapeWorkToolHandler, shapeWorkToolName, index$1 as skills, softDeleteQuest, softDeleteQuestline, softDeleteRepeatableQuest, softDeleteRumor, soul, spawnDueRepeatableQuests, startQuest, stringSchema, tagAndFilterPortfoliosSkill, tagQuest, tagWorkTool, tagWorkToolHandler, tagWorkToolName, toolFailure, toolNeedsClarification, toolNoOp, toolSuccess, toolWarning, index as tools, untagQuest, updateQuestReward, updateQuestline, updateRepeatableQuest, updateRumor, write };
1707
+ export { type AbandonQuestResult, type CaptureRumorInput, type CreateQuestInput, type CreateQuestlineInput, type CreateRepeatableQuestInput, type DueRepeatableAnchor, type FollowupQuestInput, type JsonSchema, type JsonSchemaType, type MarkerDefinition, type MarkerId, type PlanQuestTimeInput, type Quest, type QuestDetail, type QuestListFilters, type QuestReward, type QuestRewardInput, type QuestState, type QuestUnlock, type Questline, type QuestlineDetail, QuestlogDb, type QuestlogSearchResult, type QuestlogSkill, type QuestlogSkillRegistry, type QuestlogSoul, type QuestlogSoulTrait, type QuestlogToolDefinition, type QuestlogToolMapping, type RepeatableQuest, type RepeatableQuestReward, type RepeatableQuestRewardInput, type Rumor, type RumorDetail, type RumorOutput, type RumorState, type SettleRumorInput, type SettleRumorResult, type Tag, type ToolClarificationCode, type ToolDefinitionRegistry, type ToolEntityKind, type ToolEntityRef, type ToolErrorCode, type ToolErrorKind, type ToolFailure, type ToolInputDescriptions, type ToolListItem, type ToolNeedsClarification, type ToolNextStepHint, type ToolNextStepHintKind, type ToolOutcomeKind, type ToolOutputDescription, type ToolResult, type ToolSideEffects, type ToolSuccess, type ToolWarning, type ToolWarningCode, type UpdateQuestlineInput, type UpdateRepeatableQuestInput, type UpdateRumorInput, abandonQuest, abandonQuestAndSpawnFollowups, addQuestReward, addUnlock, archiveDeleteAndPruneSkill, archiveQuestline, archiveRepeatableQuest, arraySchema, booleanSchema, captureRumor, captureRumorTool, captureRumorToolHandler, captureRumorToolName, chooseWorkShapeSkill, claimQuestReward, clarifyAmbiguousRequestsSkill, closeWorkAndClaimOutcomesSkill, createConcreteQuestSkill, createQuest, createQuestline, createRepeatableQuest, defineQuestlogSkill, defineQuestlogTool, detachQuestFromQuestline, detectSlipsAndStalenessSkill, dismissRumor, enumSchema, escalateAndUnblockSkill, finishQuest, frameInitiativeQuestlineSkill, getQuestDetail, getQuestlineDetail, getQuestlogSkillByName, getQuestlogToolByName, getRumorDetail, getRumorOutputs, handleExceptionsAndWeirdCasesSkill, initQuestlogTables, inspectQuestlogItemTool, inspectQuestlogItemToolHandler, inspectQuestlogItemToolName, intakeTriageSkill, integerSchema, listActiveQuests, listAvailableQuests, listBlockedQuests, listDeferredQuests, listDueRepeatableQuestAnchors, listDueSoonQuests, listInProgressQuests, listMissedScheduledQuests, listOpenQuests, listOverdueQuests, listQuestlines, listQuestlogSkills, listQuestlogToolDefinitions, listResolvedQuests, listRumors, listScheduledForDay, listScheduledNow, literalSchema, logQuestEffort, maintainClearOwnershipSkill, manageApprovalsAndPromisesSkill, manageRepeatableTool, manageRepeatableToolHandler, manageRepeatableToolName, index$2 as markers, moveQuestToQuestline, numberSchema, objectSchema, oneOfSchema, organizeWorkTool, organizeWorkToolHandler, organizeWorkToolName, planQuestTime, planQuestTool, planQuestToolHandler, planQuestToolName, planSuccessorWorkSkill, planTimeCorrectlySkill, prioritizeAcrossStreamsSkill, protectCapacityAndFocusSkill, questlogSkills, questlogToolMappings, questlogTools, read, recoverFromModelingMistakesSkill, removeQuestReward, removeUnlock, reopenRumor, replaceQuestTags, replaceRepeatableQuestRewards, replaceRepeatableQuestTags, replaceUnlocks, reportStatusAndManageExpectationsSkill, retireWorkTool, retireWorkToolHandler, retireWorkToolName, reviewQuestlogTool, reviewQuestlogToolHandler, reviewQuestlogToolName, reviseOrReshapeCommitmentSkill, reviseQuestObjective, rewardWorkTool, rewardWorkToolHandler, rewardWorkToolName, runOperationalReviewSkill, runQuestTool, runQuestToolHandler, runQuestToolName, runRecurringRhythmsSkill, searchAndRetrieveContextSkill, searchQuestlogTool, searchQuestlogToolHandler, searchQuestlogToolName, sequenceWithUnlocksSkill, settleRumor, settleRumorIntoStructureSkill, shapeWorkTool, shapeWorkToolHandler, shapeWorkToolName, index$1 as skills, softDeleteQuest, softDeleteQuestline, softDeleteRepeatableQuest, softDeleteRumor, soul, spawnDueRepeatableQuests, startQuest, stringSchema, tagAndFilterPortfoliosSkill, tagQuest, tagWorkTool, tagWorkToolHandler, tagWorkToolName, toolFailure, toolNeedsClarification, toolNoOp, toolSuccess, toolWarning, index as tools, untagQuest, updateQuestReward, updateQuestline, updateRepeatableQuest, updateRumor, write };
package/dist/index.js CHANGED
@@ -4764,6 +4764,30 @@ function runQuestToolHandler(db, input) {
4764
4764
  }
4765
4765
  );
4766
4766
  }
4767
+ const blockers = db.prepare(
4768
+ `SELECT blocker.id FROM quest_unlocks prerequisite
4769
+ JOIN quests blocker ON blocker.id = prerequisite.from_quest_id
4770
+ WHERE prerequisite.to_quest_id = ?
4771
+ AND prerequisite.deleted_at IS NULL
4772
+ AND blocker.deleted_at IS NULL
4773
+ AND NOT (blocker.resolved_at IS NOT NULL AND blocker.success = 1)
4774
+ ORDER BY blocker.id`
4775
+ ).all(current.id).map(({ id }) => getQuestDetail(db, id));
4776
+ if (blockers.length && !input.force) {
4777
+ return toolFailure(
4778
+ "domain",
4779
+ "invalid_state",
4780
+ `Quest "${current.title}" is blocked by ${blockers.map((quest) => quest.title).join(", ")}.`,
4781
+ "Finish the blocking prerequisites before starting this quest, or set force to true.",
4782
+ {
4783
+ entities: [toQuestRef(current), ...blockers.map(toQuestRef)],
4784
+ next: blockers.map((quest) => ({
4785
+ ...inspectItemNext(toQuestRef(quest)),
4786
+ message: `Inspect and finish blocker "${quest.title}".`
4787
+ }))
4788
+ }
4789
+ );
4790
+ }
4767
4791
  startQuest(db, input.questId, input.startedAt);
4768
4792
  const detail = getQuestDetail(db, input.questId);
4769
4793
  return toolSuccess(
@@ -4775,7 +4799,13 @@ function runQuestToolHandler(db, input) {
4775
4799
  quest: detail
4776
4800
  },
4777
4801
  {
4778
- entities: [toQuestRef(detail)]
4802
+ entities: [toQuestRef(detail)],
4803
+ warnings: blockers.length ? [
4804
+ {
4805
+ code: "derived_value_used",
4806
+ message: `Forced start with unmet prerequisites: ${blockers.map((quest) => quest.title).join(", ")}.`
4807
+ }
4808
+ ] : void 0
4779
4809
  }
4780
4810
  );
4781
4811
  }
@@ -4884,6 +4914,7 @@ var runQuestTool = defineQuestlogTool({
4884
4914
  action: "Which execution lifecycle step to perform on the quest.",
4885
4915
  questId: "The concrete quest whose execution state should change.",
4886
4916
  startedAt: "Optional actual start timestamp for the start action.",
4917
+ force: "Start despite unmet unlock prerequisites. Defaults to false.",
4887
4918
  effortSeconds: "Positive active-effort increment in seconds for the log-effort action.",
4888
4919
  now: "Optional timestamp for the effort log action.",
4889
4920
  outcome: "Terminal outcome text for finish or abandon actions.",
@@ -4902,6 +4933,7 @@ var runQuestTool = defineQuestlogTool({
4902
4933
  ]),
4903
4934
  questId: integerSchema("Quest whose execution state should change."),
4904
4935
  startedAt: integerSchema("Optional start timestamp for the start action."),
4936
+ force: booleanSchema("Start despite unmet unlock prerequisites. Defaults to false."),
4905
4937
  effortSeconds: integerSchema(
4906
4938
  "Positive active-effort increment in seconds. Required for log_effort."
4907
4939
  ),