@tangle-network/agent-app 0.60.109 → 0.60.110

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.
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import { type ChatInteraction, type InteractionAnswers } from './chat-interactions';
3
3
  import { type ChatPlan } from '../plans/index';
4
4
  import type { DurablePlanDecision, DurablePlanDecisionResult } from './durable-plan-flow';
5
+ import { type LateAnswerResult } from './interaction-question-card';
5
6
  import type { SubmitInteractionAnswer } from './interaction-card-support';
6
7
  export type DurableChatCard = {
7
8
  kind: 'plan';
@@ -24,7 +25,7 @@ export interface DurableChatCardsProps {
24
25
  decidingPlan?: (plan: ChatPlan) => DurablePlanDecision | null;
25
26
  planError?: (plan: ChatPlan) => string | null;
26
27
  onInteractionResolved?: (id: string, status: Exclude<ChatInteraction['status'], 'pending'>, answers?: InteractionAnswers) => void;
27
- onLateAnswer?: (message: string) => boolean | void | Promise<boolean | void>;
28
+ onLateAnswer?: (message: string) => LateAnswerResult | Promise<LateAnswerResult>;
28
29
  /** Fired when the user asks the agent to re-submit an expired/withdrawn
29
30
  * plan card as a new chat turn; receives that card's interaction. Omit to
30
31
  * hide the affordance entirely. */
@@ -60,6 +60,7 @@ import {
60
60
  durableChatCardsFromParts,
61
61
  fieldAnswer,
62
62
  fieldValuesFromAnswers,
63
+ firstUnansweredRequiredField,
63
64
  formatActivityCost,
64
65
  formatActivityDuration,
65
66
  formatInsightDelta,
@@ -84,6 +85,7 @@ import {
84
85
  loadAttachmentFile,
85
86
  loadingProvenanceSources,
86
87
  mergeActivityPages,
88
+ missingAnswerHint,
87
89
  nextRevealCount,
88
90
  parseRecordGridInput,
89
91
  pendingApprovalOf,
@@ -136,7 +138,7 @@ import {
136
138
  withoutRecordGridCreated,
137
139
  withoutRecordGridRemoved,
138
140
  withoutRecordGridUpdate
139
- } from "../chunk-NBZQYRRM.js";
141
+ } from "../chunk-FERGTHQF.js";
140
142
  import {
141
143
  MENTION_PILL_CLASS
142
144
  } from "../chunk-3HUFJ5LO.js";
@@ -422,6 +424,7 @@ export {
422
424
  fieldValuesFromAnswers,
423
425
  fileMentionsToParts,
424
426
  filterAcceptedFiles,
427
+ firstUnansweredRequiredField,
425
428
  formatActivityCost,
426
429
  formatActivityDuration,
427
430
  formatDictationElapsed,
@@ -463,6 +466,7 @@ export {
463
466
  mentionPartsFromMessageParts,
464
467
  mergeActivityPages,
465
468
  mergeReviewQueuePages,
469
+ missingAnswerHint,
466
470
  nextRevealCount,
467
471
  noticePart,
468
472
  noticePartKey,
@@ -44,6 +44,13 @@ export declare function fieldAnswer(field: ChatInteractionField, values: FieldVa
44
44
  * required only when it says `required: true`, as the interaction protocol
45
45
  * validates it; an omitted flag is optional (a permission ask's feedback). */
46
46
  export declare function buildAnswerData(fields: ChatInteractionField[], values: FieldValues): InteractionAnswers | null;
47
+ /** The first required field still without an answer, or null when every
48
+ * required field has one: the reason `buildAnswerData` returned null. */
49
+ export declare function firstUnansweredRequiredField(fields: ChatInteractionField[], values: FieldValues): ChatInteractionField | null;
50
+ /** What the reader still has to do before the card's action (`verb`: submit,
51
+ * send) is available, in plain words, for the line beside the disabled
52
+ * button. It names the question only when the card asks more than one. */
53
+ export declare function missingAnswerHint(field: ChatInteractionField, fieldCount: number, verb: string): string;
47
54
  /** Determine if a status is late answerable by checking if it is expired or cancelled */
48
55
  export declare function isLateAnswerableStatus(status: ChatInteractionStatus): boolean;
49
56
  /** Secrets must never leave the sidecar answer channel for the visible chat
@@ -11,7 +11,8 @@
11
11
  * cancel event produces (never a raw error),
12
12
  * - expired/withdrawn asks stay answerable: the answer is delivered as a NEW
13
13
  * chat turn via `onLateAnswer` (secret-bearing asks are blocked from that
14
- * path),
14
+ * path), sent now or queued behind a run that is still working,
15
+ * - a disabled submit says which answer it is waiting for,
15
16
  * - one submit in flight at a time; a failed/timed-out submit stays
16
17
  * retryable.
17
18
  *
@@ -58,6 +59,9 @@ export interface QuestionOptionListProps {
58
59
  * not re-sort under a mounted card — a different set of options is a
59
60
  * different `key`, and a different ask resets the card wholesale. */
60
61
  export declare function QuestionOptionList({ groupName, idPrefix, options, multi, selectedValues, disabled, onToggle, answered, }: QuestionOptionListProps): import("react").JSX.Element;
62
+ /** What a host did with a late answer: sent it (`true` or nothing returned),
63
+ * queued it behind the running turn, or refused it (`false`). */
64
+ export type LateAnswerResult = boolean | 'queued' | void;
61
65
  export interface InteractionQuestionCardProps {
62
66
  interaction: ChatInteraction;
63
67
  /** Viewer-vs-editor gate: false renders everything read-only. */
@@ -70,8 +74,10 @@ export interface InteractionQuestionCardProps {
70
74
  onResolved?: (id: string, status: Exclude<ChatInteractionStatus, 'pending'>, answers?: ChatInteraction['answers']) => void;
71
75
  /** Delivers a late answer (the ask expired/was withdrawn) as a fresh chat
72
76
  * turn. Return/resolve `false` when the send was rejected so the card stays
73
- * retryable. Omit to hide the late-answer affordance entirely. */
74
- onLateAnswer?: (message: string) => boolean | void | Promise<boolean | void>;
77
+ * retryable, and `'queued'` when it will go out after a run that is still
78
+ * working (an ask can time out while its run goes on). Omit to hide the
79
+ * late-answer affordance entirely. */
80
+ onLateAnswer?: (message: string) => LateAnswerResult | Promise<LateAnswerResult>;
75
81
  /** Overrides the kind badge ("Question"). */
76
82
  kindLabel?: string;
77
83
  /** What happens if nobody answers, rendered beside the submit action.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.60.109",
3
+ "version": "0.60.110",
4
4
  "packageManager": "pnpm@11.24.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [