@newheap/platform-ai-chat 0.19.0 → 0.21.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.21.0",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "^20.2.14",
6
6
  "@angular/common": "^20.3.28",
@@ -20,6 +20,9 @@
20
20
  "./i18n/*.json": {
21
21
  "default": "./i18n/*.json"
22
22
  },
23
+ "./admin/i18n/*.json": {
24
+ "default": "./admin/i18n/*.json"
25
+ },
23
26
  "./push/*": {
24
27
  "default": "./push/*"
25
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.
@@ -224,6 +247,11 @@ interface NhAssistantMockAdminAgent extends AdminAgentInput {
224
247
  worksOnDeclared?: boolean;
225
248
  /** The object types the agent is known to work on, shown as a hint next to "All objects". */
226
249
  knownSubjectTypes?: string[];
250
+ /**
251
+ * A code agent that works in people's chats only (`ChatOnly()`): it works on no subject, so the
252
+ * mock refuses its starts, its shadow mode and lists it on no object's page, as the server does.
253
+ */
254
+ chatOnly?: boolean;
227
255
  /**
228
256
  * How a code agent runs, as its code says (`codeRunSettings` of its run configuration). By default
229
257
  * it answers to its `serviceAccount` when it has one and to itself otherwise, with the platform's
@@ -755,6 +783,11 @@ interface NhAssistantMockProposal {
755
783
  executionReportDueAt?: string | null;
756
784
  /** The execution's result code, such as `report-overdue`. Default none. */
757
785
  executionResultCode?: string | null;
786
+ /**
787
+ * The newer proposal for the same objects that replaced this one, as the server names it for a
788
+ * `withdrawn` proposal and a `shadow-superseded` shadow proposal. Default none.
789
+ */
790
+ supersededByApprovalId?: string | null;
758
791
  }
759
792
  /** One request the mock API received, for assertions in tests. */
760
793
  interface NhAssistantMockRequest {
@@ -813,6 +846,7 @@ declare class NhAssistantMockBackend {
813
846
  private readonly config;
814
847
  private readonly conversations;
815
848
  private readonly pendingApprovals;
849
+ private readonly pendingQuestions;
816
850
  private readonly runs;
817
851
  /** Page context of the latest message per conversation, as the server stores it. */
818
852
  private readonly pageContexts;
@@ -906,9 +940,32 @@ declare class NhAssistantMockBackend {
906
940
  * (`consultation.movedToApprovalId`) and resumes the turn with the step's `left` steps.
907
941
  */
908
942
  private decide;
943
+ /**
944
+ * `POST conversations/{id}/approvals/{approvalId}/resolve`: the person who approved a proposal in this
945
+ * chat resolves its uncertain hand-off (`canResolve`), as the server does: `hand-to-application` hands
946
+ * it to the application again with a new report deadline, `mark-resolved` confirms it. Another action
947
+ * is refused, as are an approval in another status and one the caller may not resolve. Returns the
948
+ * conversation.
949
+ */
950
+ private resolve;
951
+ /**
952
+ * `POST conversations/{id}/questions/{questionId}/answer`: the addressee answers the question the
953
+ * turn waits for with the index of a choice, as on the server. Anyone else is refused, as are a
954
+ * choice the question does not offer and a question whose wait ended, which releases the
955
+ * conversation. The answer resumes the turn with the step's answered steps.
956
+ */
957
+ private answer;
958
+ /**
959
+ * Closes the question or the approval a chat waits for once its lifetime passed, as a late answer or
960
+ * decision closes it on the server; one that is still valid keeps the chat busy. Agent threads keep
961
+ * their own rules.
962
+ */
963
+ private closeExpiredWait;
909
964
  private cancel;
910
965
  private playSteps;
911
966
  private pauseForApproval;
967
+ /** Records the `ask_question` call and posts the question; the turn then waits for its answer. */
968
+ private pauseForQuestion;
912
969
  private stream;
913
970
  private findTurn;
914
971
  private update;
@@ -1017,4 +1074,4 @@ declare class NhAssistantMockLiveService implements NhAssistantLiveSurface {
1017
1074
  declare function provideNhAssistantMockApi(script: NhAssistantMockScenario): EnvironmentProviders;
1018
1075
 
1019
1076
  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 };
1077
+ 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 };