@newheap/platform-ai-chat 0.19.0 → 0.20.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newheap/platform-ai-chat",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "^20.2.14",
6
6
  "@angular/common": "^20.3.28",
@@ -80,6 +80,24 @@ interface NhAssistantMockApprovalConsultation {
80
80
  /** The consulted agent's answer. Default none. */
81
81
  answer?: string | null;
82
82
  }
83
+ /**
84
+ * Asks a question with `ask_question`: `tool.started`, `question.asked` and `turn.completed` with
85
+ * status `waiting-for-approval`, as the server's `run.AllowQuestions()` does. Only the addressee
86
+ * answers, with `POST conversations/{id}/questions/{questionId}/answer`; the answer resumes the turn
87
+ * with the `answered` steps, or with the steps that function returns for the chosen answer.
88
+ */
89
+ interface NhAssistantMockQuestionStep {
90
+ question: {
91
+ question: string;
92
+ /** Two to six answers. */
93
+ choices: string[];
94
+ /** The person who answers; default the person whose turn asks. */
95
+ addresseeActorId?: string;
96
+ /** Default 900 seconds, the server's default wait. */
97
+ expiresInSeconds?: number;
98
+ answered: NhAssistantMockStep[] | ((answer: string, choice: number) => NhAssistantMockStep[]);
99
+ };
100
+ }
83
101
  /** Ends the stream with an `error` event. */
84
102
  interface NhAssistantMockErrorStep {
85
103
  error: {
@@ -104,7 +122,7 @@ interface NhAssistantMockConnectionStep {
104
122
  text?: string;
105
123
  };
106
124
  }
107
- type NhAssistantMockStep = NhAssistantMockTextStep | NhAssistantMockToolStep | NhAssistantMockApprovalStep | NhAssistantMockErrorStep | NhAssistantMockFailStep | NhAssistantMockConnectionStep;
125
+ type NhAssistantMockStep = NhAssistantMockTextStep | NhAssistantMockToolStep | NhAssistantMockApprovalStep | NhAssistantMockQuestionStep | NhAssistantMockErrorStep | NhAssistantMockFailStep | NhAssistantMockConnectionStep;
108
126
  /** A scripted assistant turn, chosen by matching the user's message. */
109
127
  interface NhAssistantMockTurn {
110
128
  /** Case-insensitive substring, regular expression or predicate. Omit to match every message. */
@@ -150,6 +168,11 @@ interface NhAssistantMockAgentMetadataEntry {
150
168
  maxBytes?: number;
151
169
  /** The field of the value whose text is its searchable value, as `IndexBy`. */
152
170
  indexBy?: string;
171
+ /**
172
+ * The field of the value whose texts are its searchable values, as `IndexByEach`; an entry names
173
+ * `indexBy` or `indexByEach`.
174
+ */
175
+ indexByEach?: string;
153
176
  /**
154
177
  * The fields of the entry's type: a value with another field is refused with `value: invalid`, as
155
178
  * the server refuses JSON that does not fit the type. Without it every field is accepted.
@@ -813,6 +836,7 @@ declare class NhAssistantMockBackend {
813
836
  private readonly config;
814
837
  private readonly conversations;
815
838
  private readonly pendingApprovals;
839
+ private readonly pendingQuestions;
816
840
  private readonly runs;
817
841
  /** Page context of the latest message per conversation, as the server stores it. */
818
842
  private readonly pageContexts;
@@ -906,9 +930,26 @@ declare class NhAssistantMockBackend {
906
930
  * (`consultation.movedToApprovalId`) and resumes the turn with the step's `left` steps.
907
931
  */
908
932
  private decide;
933
+ /**
934
+ * `POST conversations/{id}/approvals/{approvalId}/resolve`: the person who approved a proposal in this
935
+ * chat resolves its uncertain hand-off (`canResolve`), as the server does: `hand-to-application` hands
936
+ * it to the application again with a new report deadline, `mark-resolved` confirms it. Another action
937
+ * is refused, as are an approval in another status and one the caller may not resolve. Returns the
938
+ * conversation.
939
+ */
940
+ private resolve;
941
+ /**
942
+ * `POST conversations/{id}/questions/{questionId}/answer`: the addressee answers the question the
943
+ * turn waits for with the index of a choice, as on the server. Anyone else is refused, as are a
944
+ * choice the question does not offer and a question whose wait ended, which releases the
945
+ * conversation. The answer resumes the turn with the step's answered steps.
946
+ */
947
+ private answer;
909
948
  private cancel;
910
949
  private playSteps;
911
950
  private pauseForApproval;
951
+ /** Records the `ask_question` call and posts the question; the turn then waits for its answer. */
952
+ private pauseForQuestion;
912
953
  private stream;
913
954
  private findTurn;
914
955
  private update;
@@ -1017,4 +1058,4 @@ declare class NhAssistantMockLiveService implements NhAssistantLiveSurface {
1017
1058
  declare function provideNhAssistantMockApi(script: NhAssistantMockScenario): EnvironmentProviders;
1018
1059
 
1019
1060
  export { NH_ASSISTANT_MOCK_HUB_PATH, NH_ASSISTANT_MOCK_SCENARIO, NhAssistantMockAuthorizationWindow, NhAssistantMockBackend, NhAssistantMockLiveService, provideNhAssistantMockApi };
1020
- export type { NhAssistantMockAdminAgent, NhAssistantMockAdminScenario, NhAssistantMockAgentGroup, NhAssistantMockAgentMetadataEntry, NhAssistantMockAgentPackage, NhAssistantMockApprovalConsultation, NhAssistantMockApprovalStep, NhAssistantMockCodeHandOff, NhAssistantMockCollaboration, NhAssistantMockConnectionStep, NhAssistantMockConsultation, NhAssistantMockConsultationCeiling, NhAssistantMockDataConsultation, NhAssistantMockDataSkill, NhAssistantMockDataTrigger, NhAssistantMockDivision, NhAssistantMockErrorStep, NhAssistantMockFailStep, NhAssistantMockHandOffCeiling, NhAssistantMockHandOffRule, NhAssistantMockInstructionAsset, NhAssistantMockLiveMessage, NhAssistantMockMcpServer, NhAssistantMockPerson, NhAssistantMockProposal, NhAssistantMockRemoteTool, NhAssistantMockRequest, NhAssistantMockRun, NhAssistantMockRunConfigurationPreset, NhAssistantMockRunNow, NhAssistantMockScenario, NhAssistantMockShadowVariantCeiling, NhAssistantMockStep, NhAssistantMockSubject, NhAssistantMockSubjectType, NhAssistantMockTextStep, NhAssistantMockTiming, NhAssistantMockToolStep, NhAssistantMockTurn, NhAssistantMockUpload };
1061
+ export type { NhAssistantMockAdminAgent, NhAssistantMockAdminScenario, NhAssistantMockAgentGroup, NhAssistantMockAgentMetadataEntry, NhAssistantMockAgentPackage, NhAssistantMockApprovalConsultation, NhAssistantMockApprovalStep, NhAssistantMockCodeHandOff, NhAssistantMockCollaboration, NhAssistantMockConnectionStep, NhAssistantMockConsultation, NhAssistantMockConsultationCeiling, NhAssistantMockDataConsultation, NhAssistantMockDataSkill, NhAssistantMockDataTrigger, NhAssistantMockDivision, NhAssistantMockErrorStep, NhAssistantMockFailStep, NhAssistantMockHandOffCeiling, NhAssistantMockHandOffRule, NhAssistantMockInstructionAsset, NhAssistantMockLiveMessage, NhAssistantMockMcpServer, NhAssistantMockPerson, NhAssistantMockProposal, NhAssistantMockQuestionStep, NhAssistantMockRemoteTool, NhAssistantMockRequest, NhAssistantMockRun, NhAssistantMockRunConfigurationPreset, NhAssistantMockRunNow, NhAssistantMockScenario, NhAssistantMockShadowVariantCeiling, NhAssistantMockStep, NhAssistantMockSubject, NhAssistantMockSubjectType, NhAssistantMockTextStep, NhAssistantMockTiming, NhAssistantMockToolStep, NhAssistantMockTurn, NhAssistantMockUpload };