@qduc/term2 0.22.0 → 0.22.1

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 (60) hide show
  1. package/dist/components/common/MenuContainer.d.ts +10 -0
  2. package/dist/components/common/MenuContainer.d.ts.map +1 -1
  3. package/dist/components/common/MenuContainer.js +53 -29
  4. package/dist/components/common/MenuContainer.js.map +1 -1
  5. package/dist/components/input/MentorPoolMenuSession.d.ts.map +1 -1
  6. package/dist/components/input/MentorPoolMenuSession.js +5 -8
  7. package/dist/components/input/MentorPoolMenuSession.js.map +1 -1
  8. package/dist/components/input/ModelMenuSession.d.ts.map +1 -1
  9. package/dist/components/input/ModelMenuSession.js +7 -21
  10. package/dist/components/input/ModelMenuSession.js.map +1 -1
  11. package/dist/components/menu/ModelSelectionMenu.js +2 -2
  12. package/dist/components/menu/ModelSelectionMenu.js.map +1 -1
  13. package/dist/components/menu/ProfileSelectionMenu.d.ts.map +1 -1
  14. package/dist/components/menu/ProfileSelectionMenu.js +12 -12
  15. package/dist/components/menu/ProfileSelectionMenu.js.map +1 -1
  16. package/dist/components/menu/ResumeSelectionMenu.d.ts.map +1 -1
  17. package/dist/components/menu/ResumeSelectionMenu.js +10 -10
  18. package/dist/components/menu/ResumeSelectionMenu.js.map +1 -1
  19. package/dist/components/menu/SkillSelectionMenu.d.ts.map +1 -1
  20. package/dist/components/menu/SkillSelectionMenu.js +10 -10
  21. package/dist/components/menu/SkillSelectionMenu.js.map +1 -1
  22. package/dist/components/menu/StandaloneModelPickerApp.d.ts +3 -3
  23. package/dist/components/menu/StandaloneModelPickerApp.d.ts.map +1 -1
  24. package/dist/components/menu/StandaloneModelPickerApp.js +9 -10
  25. package/dist/components/menu/StandaloneModelPickerApp.js.map +1 -1
  26. package/dist/components/message/MessageList.d.ts +2 -1
  27. package/dist/components/message/MessageList.d.ts.map +1 -1
  28. package/dist/components/message/MessageList.js +12 -38
  29. package/dist/components/message/MessageList.js.map +1 -1
  30. package/dist/hooks/use-mentor-pool-selection.d.ts +5 -3
  31. package/dist/hooks/use-mentor-pool-selection.d.ts.map +1 -1
  32. package/dist/hooks/use-mentor-pool-selection.js +63 -51
  33. package/dist/hooks/use-mentor-pool-selection.js.map +1 -1
  34. package/dist/hooks/use-slash-commands.d.ts.map +1 -1
  35. package/dist/hooks/use-slash-commands.js +19 -13
  36. package/dist/hooks/use-slash-commands.js.map +1 -1
  37. package/dist/services/agent-runtime/model-resolver.d.ts.map +1 -1
  38. package/dist/services/agent-runtime/model-resolver.js +1 -23
  39. package/dist/services/agent-runtime/model-resolver.js.map +1 -1
  40. package/dist/services/conversation/conversation-orchestrator.d.ts.map +1 -1
  41. package/dist/services/conversation/conversation-orchestrator.js +42 -22
  42. package/dist/services/conversation/conversation-orchestrator.js.map +1 -1
  43. package/dist/services/models/model-picker-host.d.ts +4 -4
  44. package/dist/services/models/model-picker-host.d.ts.map +1 -1
  45. package/dist/services/models/model-picker-host.js +9 -6
  46. package/dist/services/models/model-picker-host.js.map +1 -1
  47. package/dist/tools/file/edit-healing.d.ts.map +1 -1
  48. package/dist/tools/file/edit-healing.js +1 -4
  49. package/dist/tools/file/edit-healing.js.map +1 -1
  50. package/dist/tools/file/patch-healing.d.ts.map +1 -1
  51. package/dist/tools/file/patch-healing.js +1 -4
  52. package/dist/tools/file/patch-healing.js.map +1 -1
  53. package/dist/tools/file/search-replace.d.ts.map +1 -1
  54. package/dist/tools/file/search-replace.js +1 -3
  55. package/dist/tools/file/search-replace.js.map +1 -1
  56. package/dist/utils/conversation/static-commit-policy.d.ts +38 -0
  57. package/dist/utils/conversation/static-commit-policy.d.ts.map +1 -0
  58. package/dist/utils/conversation/static-commit-policy.js +76 -0
  59. package/dist/utils/conversation/static-commit-policy.js.map +1 -0
  60. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ import type { BotMessage, CommandMessage, ReasoningMessage, SubagentActivityMessage } from '../../types/message.js';
2
+ /**
3
+ * Single source of truth for which message rows can enter Ink's <Static>
4
+ * region. Both the renderer (MessageList's history/active split and the
5
+ * static-commit-blocker warning) and the conversation orchestrator's
6
+ * end-of-turn settlement consume this module, so a new Message variant or
7
+ * status is classified once — an unclassified addition is a type error here,
8
+ * not a silently stranded row that blocks static commit for the rest of the
9
+ * session.
10
+ *
11
+ * The subject is a structural subset of the Message union so tests and the
12
+ * renderer's looser MessageLike rows can be classified without carrying every
13
+ * display field.
14
+ */
15
+ export type StaticCommitSubject = Pick<BotMessage, 'sender' | 'status'> | Pick<CommandMessage, 'sender' | 'status'> | Pick<ReasoningMessage, 'sender' | 'status'> | Pick<SubagentActivityMessage, 'sender' | 'status'> | {
16
+ sender: 'user';
17
+ } | {
18
+ sender: 'system';
19
+ } | {
20
+ sender: 'command-group';
21
+ };
22
+ /** Why a row cannot be committed into <Static>. `null` means committable. */
23
+ export type StaticCommitBlockerReason = 'bot_streaming' | 'reasoning_streaming' | 'command_pending' | 'command_running' | 'subagent_activity';
24
+ export declare function classifyStaticCommitBlocker(message: StaticCommitSubject): StaticCommitBlockerReason | null;
25
+ export declare const isBlockingStaticCommit: (message: StaticCommitSubject) => boolean;
26
+ /**
27
+ * What a closing turn may do with a row that still blocks static commit.
28
+ *
29
+ * This is deliberately not the same question as "does it block": command rows
30
+ * are settled by aborting them, turn-owned streaming rows by finalizing them,
31
+ * and background subagent rows must be left alone — a running background
32
+ * subagent legitimately outlives the turn, and freezing it into <Static>
33
+ * irreversibly misrenders live work. Every blocking classification must name
34
+ * its rule; that table is pinned by static-commit-policy.test.ts.
35
+ */
36
+ export type TurnEndSettlement = 'finalize' | 'abort' | 'leave';
37
+ export declare function turnEndSettlement(reason: StaticCommitBlockerReason): TurnEndSettlement;
38
+ //# sourceMappingURL=static-commit-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-commit-policy.d.ts","sourceRoot":"","sources":["../../../source/utils/conversation/static-commit-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEpH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,mBAAmB,GAC3B,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,QAAQ,CAAC,GACrC,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,QAAQ,CAAC,GACzC,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,QAAQ,CAAC,GAC3C,IAAI,CAAC,uBAAuB,EAAE,QAAQ,GAAG,QAAQ,CAAC,GAClD;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GAGpB;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC;AAEhC,6EAA6E;AAC7E,MAAM,MAAM,yBAAyB,GACjC,eAAe,GACf,qBAAqB,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,CAAC;AAUxB,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,mBAAmB,GAAG,yBAAyB,GAAG,IAAI,CAgD1G;AAED,eAAO,MAAM,sBAAsB,YAAa,mBAAmB,KAAG,OACvB,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,yBAAyB,GAAG,iBAAiB,CAiBtF"}
@@ -0,0 +1,76 @@
1
+ // Exhaustiveness below uses `value satisfies never` in default branches: if
2
+ // the union grows, the default-branch value is no longer `never` and this
3
+ // fails to compile until the new member is classified. Unlike a throwing
4
+ // assertNever it is also runtime-safe — the renderer feeds rows whose loose
5
+ // MessageLike types could in principle carry an unrecognized string, and an
6
+ // unrecognized row must degrade to "committable" (the pre-policy behavior),
7
+ // never crash the render loop.
8
+ export function classifyStaticCommitBlocker(message) {
9
+ switch (message.sender) {
10
+ case 'bot':
11
+ return message.status === 'streaming' ? 'bot_streaming' : null;
12
+ case 'reasoning':
13
+ // No status yet means the live row exists but has not been finalized —
14
+ // it still blocks.
15
+ return message.status === 'finalized' ? null : 'reasoning_streaming';
16
+ case 'command': {
17
+ const status = message.status;
18
+ switch (status) {
19
+ case 'pending':
20
+ return 'command_pending';
21
+ case 'running':
22
+ return 'command_running';
23
+ case 'completed':
24
+ case 'failed':
25
+ case 'aborted':
26
+ return null;
27
+ default:
28
+ status;
29
+ return null;
30
+ }
31
+ }
32
+ case 'subagent': {
33
+ const status = message.status;
34
+ switch (status) {
35
+ case 'running':
36
+ return 'subagent_activity';
37
+ case 'completed':
38
+ case 'failed':
39
+ case 'cancelled':
40
+ case 'interrupted':
41
+ case 'backgrounded':
42
+ return null;
43
+ default:
44
+ status;
45
+ return null;
46
+ }
47
+ }
48
+ case 'user':
49
+ case 'system':
50
+ case 'command-group':
51
+ return null;
52
+ default:
53
+ message;
54
+ return null;
55
+ }
56
+ }
57
+ export const isBlockingStaticCommit = (message) => classifyStaticCommitBlocker(message) !== null;
58
+ export function turnEndSettlement(reason) {
59
+ switch (reason) {
60
+ case 'bot_streaming':
61
+ case 'reasoning_streaming':
62
+ return 'finalize';
63
+ case 'command_pending':
64
+ case 'command_running':
65
+ return 'abort';
66
+ case 'subagent_activity':
67
+ return 'leave';
68
+ default:
69
+ reason;
70
+ // Unreachable for the known union. If it somehow runs, leaving the row
71
+ // alone can only keep the tail rendering dynamically — it can never
72
+ // freeze live work into <Static> irreversibly.
73
+ return 'leave';
74
+ }
75
+ }
76
+ //# sourceMappingURL=static-commit-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-commit-policy.js","sourceRoot":"","sources":["../../../source/utils/conversation/static-commit-policy.ts"],"names":[],"mappings":"AAkCA,4EAA4E;AAC5E,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,+BAA+B;AAE/B,MAAM,UAAU,2BAA2B,CAAC,OAA4B;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BAAsB,GAAG,CAAC,OAA4B,EAAW,EAAE,CAC9E,2BAA2B,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;AAchD,MAAM,UAAU,iBAAiB,CAAC,MAAiC;IACjE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,eAAe,CAAC;QACrB,KAAK,qBAAqB;YACxB,OAAO,UAAU,CAAC;QACpB,KAAK,iBAAiB,CAAC;QACvB,KAAK,iBAAiB;YACpB,OAAO,OAAO,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,OAAO,CAAC;QACjB;YACE,MAAsB,CAAC;YACvB,uEAAuE;YACvE,oEAAoE;YACpE,+CAA+C;YAC/C,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qduc/term2",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "A terminal-based AI assistant that can help you get things done on your computer",
5
5
  "license": "MIT",
6
6
  "author": "qduc",