newmark-agent 0.5.11 → 0.5.13

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.
@@ -331,6 +331,13 @@ export declare class Agent {
331
331
  private branchMailbox;
332
332
  private nextBranchMessageSequence;
333
333
  private branchCommunicationEnabled;
334
+ /**
335
+ * Title/model availability is a hard gate for the first formal response.
336
+ * These values mirror the current conversation's persisted gate state so a
337
+ * failed first attempt cannot be bypassed by a second ordinary user send.
338
+ */
339
+ private titleRequestMessageId;
340
+ private firstAgentResponseStarted;
334
341
  private compressionArchiveCountCache;
335
342
  private nextCompressionCacheId;
336
343
  private readonly compressionHistoryArchive;
@@ -512,6 +519,12 @@ export declare class Agent {
512
519
  private conversationEntryForDisk;
513
520
  private normalizeWorkRuns;
514
521
  private recoverPersistedWorkRuns;
522
+ /** Close tool calls left without results by a hard worker exit. */
523
+ private repairDanglingToolCalls;
524
+ repairDanglingToolCallsForTest(messages: Array<Record<string, unknown>>): {
525
+ messages: Array<Record<string, unknown>>;
526
+ changed: boolean;
527
+ };
515
528
  private pauseFlowAfterUnexpectedExit;
516
529
  beginConversationWorkRun(runId: string, target?: ConversationTarget, startedAt?: string, managed?: boolean, runtimeKey?: string): ConversationWorkRun;
517
530
  private buildHistoryStatus;
@@ -678,16 +691,16 @@ export declare class Agent {
678
691
  title: string;
679
692
  };
680
693
  /**
681
- * Build 命名判定:仅当 (1) 当前对话尚无历史 Build(排除当前 run)且
682
- * (2) 其持久化 title 仍是自动生成(含为空)时返回 true。dev-0.4.3 起不再
683
- * 用该判定注入首轮 tool-call 指令,而是在首个完成 Build 的最终响应处自动
684
- * 命名(见 maybeAutoRenameConversationFromRun)。判定本身只读存储、无副作用。
694
+ * Compatibility query for callers that still expose the rename affordance.
695
+ * Automatic naming itself is a hard pre-response gate: until the persisted
696
+ * firstAgentResponseStarted flag is true, every ordinary send must finish a
697
+ * title probe for the first persisted user message before formal execution.
685
698
  */
686
699
  shouldPromptConversationRename(): boolean;
687
700
  /**
688
- * 从首个 Build 的最终响应中提取一个简短对话标题。跳过 Markdown 标题/列表
689
- * 符号与固定 section 标题,取第一条有意义的摘要句并做保守清洗。
690
- * dev-0.4.5 起仅作为独立 rename API 不可用时的本地回退。
701
+ * Legacy explicit-rename sanitizer retained for compatibility tests only.
702
+ * Automatic naming must never use an Agent/Build summary as a fallback;
703
+ * the independent first-input title probe is the sole automatic source.
691
704
  */
692
705
  private deriveConversationTitleFromSummary;
693
706
  /**
@@ -696,19 +709,27 @@ export declare class Agent {
696
709
  */
697
710
  private normalizeConversationRenameTitle;
698
711
  /**
699
- * 用独立的 provider API 请求为对话生成标题(与主响应并行、不共享主前缀缓存)。
700
- * system 约束模型只按格式返回一个简短名词短语标题;失败、超时或无 provider
701
- * 返回空字符串,由调用方回退到本地 deriveConversationTitleFromSummary。
712
+ * Run the independent, tool-free title/model-availability probe. It shares
713
+ * the frozen deployment selected for this send, but no main Agent history or
714
+ * tool schema. An empty result keeps the formal response hard-blocked.
702
715
  */
703
716
  private deriveConversationTitleFromProvider;
717
+ /** Legacy completion hook retained as a no-op; naming is pre-response only. */
718
+ private maybeAutoRenameConversationFromRun;
719
+ private startFirstInputConversationTitle;
720
+ private firstPersistedUserForTitleGate;
704
721
  /**
705
- * dev-0.4.5:conversation_rename 流程独立为「并行响应 API」。首个完成 Build
706
- * 最终响应到达时,fire-and-forget 发起一个独立 provider 请求生成标题并按格式
707
- * rename,不阻塞主流程、不污染主前缀缓存;无 provider / 失败时回退本地启发式。
708
- * conversation_rename 工具与 shouldPromptConversationRename 判定均保留,且不再
709
- * 在首轮 prompt 注入一次性 tool-call 指令。
722
+ * Conversations saved before the durable title gate existed have no explicit
723
+ * flag. Prior assistant history or any persisted WorkRun proves that their
724
+ * first formal response already started. An explicit false is authoritative:
725
+ * it represents a failed title probe that must remain blocked across reloads.
710
726
  */
711
- private maybeAutoRenameConversationFromRun;
727
+ private restoredFirstAgentResponseStarted;
728
+ getConversationTitleGateState(): {
729
+ titleRequestMessageId: string;
730
+ firstAgentResponseStarted: boolean;
731
+ };
732
+ private markFirstAgentResponseStarted;
712
733
  reorderConversations(ids: string[]): boolean;
713
734
  /** Reorder one pinned group inside an explicit workspace without changing membership. */
714
735
  reorderWorkspaceConversationGroup(ids: string[], ws: WorkspaceInfo | null): boolean;
@@ -731,7 +752,7 @@ export declare class Agent {
731
752
  persistActiveConversationSelection(id: string, ws?: WorkspaceInfo | null): string;
732
753
  setInputMode(mode: string): InputMode;
733
754
  private defaultInputMode;
734
- abortActiveKernelRun(): boolean;
755
+ abortActiveKernelRun(reason?: string): boolean;
735
756
  activeProcessSignal(): AbortSignal | undefined;
736
757
  recordWorkRunPrimaryPrompt(content: string): void;
737
758
  conversationBuildHistory(limit?: number): Array<{
@@ -826,11 +847,15 @@ export declare class Agent {
826
847
  handleContextHistoryManage(args: string): NewmarkToolResult;
827
848
  recordContextCompressionStep(): void;
828
849
  compressionContinuationPrompt(): string;
829
- mirrorConversationStateFrom(id: string, source: Pick<Agent, 'chatMessages' | 'history' | 'conversationPlan'> & Partial<Pick<Agent, 'linkedPlan' | 'subagents' | 'workRuns' | 'continuations'>> & {
850
+ mirrorConversationStateFrom(id: string, source: Pick<Agent, 'chatMessages' | 'history' | 'conversationPlan'> & Partial<Pick<Agent, 'linkedPlan' | 'subagents' | 'workRuns' | 'continuations' | 'getConversationTitleGateState'>> & {
830
851
  modelSelection?: ConversationModelSelection;
831
852
  inputMode?: InputMode;
832
853
  mode?: AgentMode;
833
854
  goal?: StoredGoalState | null;
855
+ titleGateState?: {
856
+ titleRequestMessageId?: string;
857
+ firstAgentResponseStarted?: boolean;
858
+ };
834
859
  }): void;
835
860
  getConversationPlan(conversationId?: string): ConversationPlanState;
836
861
  updateConversationPlan(plan: Partial<ConversationPlanState>, conversationId?: string): ConversationPlanState;