@selesai/code 0.13.14 → 0.13.16

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.
@@ -1684,6 +1684,32 @@ describe("working-line runtime ownership", () => {
1684
1684
  expect(phaseSignature(retried.frames[0] ?? "")[0]).toBe("⣏⠀⣹");
1685
1685
  });
1686
1686
 
1687
+ it("drops timer-driven updates when the captured ctx goes stale after session replacement", () => {
1688
+ vi.useFakeTimers();
1689
+ try {
1690
+ const harness = runtime(true);
1691
+ harness.controller.startSession(harness.ctx);
1692
+ harness.clock.start();
1693
+ harness.controller.startAgent(harness.ctx);
1694
+ harness.controller.startTurn(harness.ctx);
1695
+ harness.calls.length = 0;
1696
+ // Simulate a session replacement invalidating the captured ctx: its getters throw.
1697
+ const stale = harness.ctx as { hasUI: boolean };
1698
+ Object.defineProperty(stale, "hasUI", {
1699
+ get() {
1700
+ throw new Error("stale ctx");
1701
+ },
1702
+ configurable: true,
1703
+ });
1704
+ expect(() => vi.advanceTimersByTime(1000)).not.toThrow();
1705
+ expect(harness.calls).toEqual([]);
1706
+ harness.controller.dispose(harness.ctx);
1707
+ harness.clock.reset();
1708
+ } finally {
1709
+ vi.useRealTimers();
1710
+ }
1711
+ });
1712
+
1687
1713
  it("releases ownership when recovery also throws and waits for a clean reinstall", () => {
1688
1714
  const current = config();
1689
1715
  current.components.workingLine.enabled = true;
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { readStoredCredential } from "./core/auth-storage.ts";
5
5
  export { ensureTool, getToolPath, type ManagedTool } from "./utils/tools-manager.ts";
6
6
  export { type BranchPreparation, type BranchSummaryResult, type CollectEntriesResult, type CompactionResult, type CutPointResult, calculateContextTokens, collectEntriesForBranchSummary, compact, DEFAULT_COMPACTION_SETTINGS, estimateTokens, type FileOperations, findCutPoint, findTurnStartIndex, type GenerateBranchSummaryOptions, generateBranchSummary, generateSummary, generateSummaryWithUsage, getLastAssistantUsage, prepareBranchEntries, serializeConversation, shouldCompact, } from "./core/compaction/index.ts";
7
7
  export { createEventBus, type EventBus, type EventBusController } from "./core/event-bus.ts";
8
- export type { AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BuildSystemPromptOptions, CompactOptions, ContextEvent, ContextUsage, CustomToolCallEvent, EditToolCallEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, FindToolCallEvent, GrepToolCallEvent, InlineExtension, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MessageEndEvent, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderConfig, ProviderModelConfig, ReadToolCallEvent, RegisteredCommand, RegisteredTool, ResolvedCommand, SessionBeforeCompactEvent, SessionBeforeForkEvent, SessionBeforeSwitchEvent, SessionBeforeTreeEvent, SessionCompactEvent, SessionInfoChangedEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolInfo, ToolRenderResultOptions, ToolResultEvent, TurnEndEvent, TurnStartEvent, UIPromptEndEvent, UIPromptKind, UIPromptStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
8
+ export type { AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BuildSystemPromptOptions, CompactOptions, ContextEvent, ContextUsage, CustomToolCallEvent, EditToolCallEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, FindToolCallEvent, GrepToolCallEvent, InlineExtension, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MessageEndEvent, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderConfig, ProviderModelConfig, ReadToolCallEvent, RegisteredCommand, RegisteredTool, ResolvedCommand, ResolvedSkillInfo, SessionBeforeCompactEvent, SessionBeforeForkEvent, SessionBeforeSwitchEvent, SessionBeforeTreeEvent, SessionCompactEvent, SessionInfoChangedEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolInfo, ToolRenderResultOptions, ToolResultEvent, TurnEndEvent, TurnStartEvent, UIPromptEndEvent, UIPromptKind, UIPromptStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
9
9
  export { createExtensionRuntime, defineTool, discoverAndLoadExtensions, ExtensionRunner, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, wrapRegisteredTool, wrapRegisteredTools, } from "./core/extensions/index.ts";
10
10
  export type { ReadonlyFooterDataProvider } from "./core/footer-data-provider.ts";
11
11
  export { convertToLlm } from "./core/messages.ts";
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: to-prd
3
+ description: Turn the current conversation context into a PRD and save it under .selesai/docs/prds in the current project. Use when user wants to create a PRD from the current context.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ This skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user — just synthesize what you already know.
8
+
9
+ ## Process
10
+
11
+ 1. Explore the repo to understand the current state of the codebase, if you haven't already. Use the project's domain glossary vocabulary throughout the PRD, and respect any ADRs in the area you're touching.
12
+
13
+ 2. Sketch out the seams at which you're going to test the feature. Existing seams should be preferred to new ones. Use the highest seam possible. If new seams are needed, propose them at the highest point you can.
14
+
15
+ Check with the user that these seams match their expectations.
16
+
17
+ 3. Write the PRD using the template below, then save it as Markdown under `.selesai/docs/prds` relative to the current working directory. Create the directory if needed. Use a descriptive kebab-case filename ending in `.md`, and report the saved path to the user.
18
+
19
+ <prd-template>
20
+
21
+ ## Problem Statement
22
+
23
+ The problem that the user is facing, from the user's perspective.
24
+
25
+ ## Solution
26
+
27
+ The solution to the problem, from the user's perspective.
28
+
29
+ ## User Stories
30
+
31
+ A LONG, numbered list of user stories. Each user story should be in the format of:
32
+
33
+ 1. As an <actor>, I want a <feature>, so that <benefit>
34
+
35
+ <user-story-example>
36
+ 1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending
37
+ </user-story-example>
38
+
39
+ This list of user stories should be extremely extensive and cover all aspects of the feature.
40
+
41
+ ## Implementation Decisions
42
+
43
+ A list of implementation decisions that were made. This can include:
44
+
45
+ - The modules that will be built/modified
46
+ - The interfaces of those modules that will be modified
47
+ - Technical clarifications from the developer
48
+ - Architectural decisions
49
+ - Schema changes
50
+ - API contracts
51
+ - Specific interactions
52
+
53
+ Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
54
+
55
+ Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it within the relevant decision and note briefly that it came from a prototype. Trim to the decision-rich parts — not a working demo, just the important bits.
56
+
57
+ ## Testing Decisions
58
+
59
+ A list of testing decisions that were made. Include:
60
+
61
+ - A description of what makes a good test (only test external behavior, not implementation details)
62
+ - Which modules will be tested
63
+ - Prior art for the tests (i.e. similar types of tests in the codebase)
64
+
65
+ ## Out of Scope
66
+
67
+ A description of the things that are out of scope for this PRD.
68
+
69
+ ## Further Notes
70
+
71
+ Any further notes about the feature.
72
+
73
+ </prd-template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selesai/code",
3
- "version": "0.13.14",
3
+ "version": "0.13.16",
4
4
  "description": "Maintained, extension-first Pi coding agent with built-in workflows, subagents, web research, questions, skills, and an enhanced terminal UI.",
5
5
  "type": "module",
6
6
  "repository": {