@pagelines/sdk 1.0.652 → 1.0.653
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/dist/AgentProvider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js +1921 -1785
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/agent/AgentController.d.ts +33 -19
- package/dist/agent/index.d.ts +2 -1
- package/dist/agent/schema.d.ts +8 -0
- package/dist/agent/ui/AgentToolActivityGroup.vue.d.ts +3 -3
- package/dist/agent/work-journal.d.ts +60 -0
- package/dist/index.js +227 -227
- package/dist/sdkClient.js +5 -1
- package/dist/sdkClient.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { ComputedRef, Ref } from 'vue';
|
|
|
2
2
|
import { AgentConfig, ChatToolActivityData, SettingsObject } from '@pagelines/core';
|
|
3
3
|
import { PageLinesSDK } from '../sdkClient';
|
|
4
4
|
import { AgentMode, ChatAttachment, ChatMessage, TextConnectionState, Agent } from './schema';
|
|
5
|
+
import { WorkJournalModel, WorkJournalOutcome } from './work-journal';
|
|
5
6
|
import { VoiceRecorderController } from './VoiceRecorderController';
|
|
6
7
|
/**
|
|
7
8
|
* Structured error payload surfaced by the chat stream. Matches the
|
|
@@ -65,15 +66,6 @@ export type AgentChatComposerState = {
|
|
|
65
66
|
pendingAttachments: ChatAttachment[];
|
|
66
67
|
isUploading: boolean;
|
|
67
68
|
};
|
|
68
|
-
export type AgentToolActivityLine = {
|
|
69
|
-
activityId: string;
|
|
70
|
-
status: ChatToolActivityData['status'];
|
|
71
|
-
toolIcon: string;
|
|
72
|
-
statusIcon: string;
|
|
73
|
-
label: string;
|
|
74
|
-
detail: string;
|
|
75
|
-
note?: string;
|
|
76
|
-
};
|
|
77
69
|
type AgentChatControllerSettings = {
|
|
78
70
|
sdk?: PageLinesSDK;
|
|
79
71
|
agent: Agent | AgentConfig;
|
|
@@ -92,15 +84,21 @@ export declare class AgentChatController extends SettingsObject<AgentChatControl
|
|
|
92
84
|
private lastMessage;
|
|
93
85
|
private isConnecting;
|
|
94
86
|
private activeTurnGeneration;
|
|
95
|
-
private
|
|
96
|
-
private readonly
|
|
87
|
+
private boundaryTimer?;
|
|
88
|
+
private readonly nowMs;
|
|
97
89
|
private readonly toolActivityTiming;
|
|
98
90
|
private conversationId?;
|
|
99
91
|
textState: Ref<TextConnectionState>;
|
|
100
92
|
agentMode: Ref<AgentMode>;
|
|
101
93
|
sharedMessages: Ref<ChatMessage[]>;
|
|
102
94
|
readonly composerState: Ref<AgentChatComposerState>;
|
|
103
|
-
|
|
95
|
+
/**
|
|
96
|
+
* The live line of work for the in-flight turn. Present only once the first
|
|
97
|
+
* activity arrives (before that, the top-level thinking cue owns the state —
|
|
98
|
+
* the two are mutually exclusive). Transient live work is always `running`;
|
|
99
|
+
* Task 7 owns `stopped`.
|
|
100
|
+
*/
|
|
101
|
+
readonly workJournal: ComputedRef<WorkJournalModel | undefined>;
|
|
104
102
|
readonly canUseComposer: ComputedRef<boolean>;
|
|
105
103
|
readonly canAttachFile: ComputedRef<boolean>;
|
|
106
104
|
readonly canRecordAudio: ComputedRef<boolean>;
|
|
@@ -151,18 +149,34 @@ export declare class AgentChatController extends SettingsObject<AgentChatControl
|
|
|
151
149
|
private updateState;
|
|
152
150
|
private resetToolActivityTiming;
|
|
153
151
|
private resetState;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Wake exactly once at the live journal's next slow/long boundary, recompute,
|
|
154
|
+
* and reschedule to the following one. When the boundary is undefined (turn
|
|
155
|
+
* finished, or already past the last boundary) the timer clears — so
|
|
156
|
+
* completion, cancellation, navigation, and teardown all stop it for free.
|
|
157
|
+
*/
|
|
158
|
+
private setupBoundaryWatcher;
|
|
159
|
+
private scheduleBoundary;
|
|
160
|
+
private clearBoundaryTimer;
|
|
157
161
|
private rememberToolActivity;
|
|
162
|
+
/**
|
|
163
|
+
* Backfill `startedAt`/`endedAt` when the wire omits them so the journal has
|
|
164
|
+
* stable timestamps for ordering, coalescing, and boundary scheduling. No
|
|
165
|
+
* duration is computed — elapsed time is never presented.
|
|
166
|
+
*/
|
|
158
167
|
private withToolActivityTiming;
|
|
159
168
|
private updateToolActivity;
|
|
160
169
|
private finishToolActivities;
|
|
161
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Project a persisted turn's activity into a durable work journal. The turn
|
|
172
|
+
* outcome is explicit — an assistant reply is `completed` (green terminal,
|
|
173
|
+
* even with a failed child), a system-error row is `failed`. Never inferred
|
|
174
|
+
* from child statuses.
|
|
175
|
+
*/
|
|
176
|
+
workJournalFor(args: {
|
|
162
177
|
activities?: ChatToolActivityData[];
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
private toolActivityElapsed;
|
|
178
|
+
outcome: WorkJournalOutcome;
|
|
179
|
+
}): WorkJournalModel | undefined;
|
|
166
180
|
private setupModeWatcher;
|
|
167
181
|
private setupAvailabilityWatcher;
|
|
168
182
|
/**
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { default as AgentWrap } from './ui/AgentWrap.vue';
|
|
|
6
6
|
import { default as ElAgentChat } from './ui/ElAgentChat.vue';
|
|
7
7
|
import { default as ElAgentChatPreview } from './ui/ElAgentChatPreview.vue';
|
|
8
8
|
export { AgentChatController, AgentChatController as AgentController } from './AgentController';
|
|
9
|
-
export type { AgentChatComposerState,
|
|
9
|
+
export type { AgentChatComposerState, ChatStreamFn, ChatUploadFn } from './AgentController';
|
|
10
|
+
export type { WorkJournalModel, WorkJournalOutcome, WorkJournalRow, WorkJournalTone } from './work-journal';
|
|
10
11
|
export * from './schema';
|
|
11
12
|
export { AgentChat, AgentModal, AgentProvider, AgentWidget, AgentWrap, ElAgentChat, ElAgentChatPreview };
|
package/dist/agent/schema.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export interface ChatMessage {
|
|
|
31
31
|
conversationId?: string;
|
|
32
32
|
sequence?: string;
|
|
33
33
|
systemKind?: string | null;
|
|
34
|
+
/** Non-successful ending owned by the persisted assistant row. */
|
|
35
|
+
turnOutcome?: 'failed' | 'stopped';
|
|
34
36
|
attachments?: ChatAttachment[];
|
|
35
37
|
toolActivities?: ChatToolActivityData[];
|
|
36
38
|
issue?: ChatMessageIssue;
|
|
@@ -51,6 +53,12 @@ export interface TextConnectionState {
|
|
|
51
53
|
* Render as live chrome/details, never as transcript content.
|
|
52
54
|
*/
|
|
53
55
|
toolActivities?: ChatToolActivityData[];
|
|
56
|
+
/**
|
|
57
|
+
* Keeps a non-successful live journal at the turn boundary. Cleared on the
|
|
58
|
+
* next send; persisted rows carry `failed` for salvaged partial replies and
|
|
59
|
+
* `stopped` for interruption, while system rows are failed by definition.
|
|
60
|
+
*/
|
|
61
|
+
turnOutcome?: 'failed' | 'stopped';
|
|
54
62
|
/**
|
|
55
63
|
* Durable send block from a server issue that retrying cannot fix in this
|
|
56
64
|
* session. Stays set until the controller is recreated or upstream state
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WorkJournalModel } from '../work-journal';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
3
|
+
model: WorkJournalModel;
|
|
4
4
|
isLight: boolean;
|
|
5
5
|
};
|
|
6
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
6
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
7
7
|
export default _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ChatToolActivityData } from '@pagelines/core';
|
|
2
|
+
/**
|
|
3
|
+
* The line of work — a pure projection of a turn's tool activity into one
|
|
4
|
+
* bounded work journal (plans/bots/bot-tool-calling.md § "One compact work
|
|
5
|
+
* journal"). Views render the result; they never decide lifecycle.
|
|
6
|
+
*
|
|
7
|
+
* `outcome` describes the TURN, never its children: a completed turn that
|
|
8
|
+
* contains a failed source still ends in the green `Work complete` terminal,
|
|
9
|
+
* with the failed source hanging inside the disclosure as a red station.
|
|
10
|
+
*
|
|
11
|
+
* The function is pure and takes `nowMs` — it never reads a clock. The clock
|
|
12
|
+
* only advances projection state (action → waiting label, then the leave
|
|
13
|
+
* hint); it never creates a milestone. Real completions create milestones;
|
|
14
|
+
* time may reveal the one transient wait tip after the slow boundary.
|
|
15
|
+
*/
|
|
16
|
+
export type WorkJournalOutcome = 'running' | 'completed' | 'failed' | 'stopped';
|
|
17
|
+
export type WorkJournalTone = 'done' | 'active' | 'failed' | 'stopped' | 'completed';
|
|
18
|
+
export type WorkJournalRow = {
|
|
19
|
+
id: string;
|
|
20
|
+
tone: WorkJournalTone;
|
|
21
|
+
label: string;
|
|
22
|
+
note?: string;
|
|
23
|
+
};
|
|
24
|
+
export type WorkJournalModel = {
|
|
25
|
+
outcome: WorkJournalOutcome;
|
|
26
|
+
visibleRows: WorkJournalRow[];
|
|
27
|
+
hiddenRows: WorkJournalRow[];
|
|
28
|
+
terminal?: WorkJournalRow;
|
|
29
|
+
hint?: string;
|
|
30
|
+
nextBoundaryAtMs?: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The persisted row owns its turn's ending: an assistant reply is a completed
|
|
34
|
+
* turn (green terminal, even with a failed child), a system-error row is the
|
|
35
|
+
* failed turn, and an explicit `turnOutcome` marker owns salvaged failures
|
|
36
|
+
* and interruptions. Never inferred from child activity statuses.
|
|
37
|
+
*/
|
|
38
|
+
export declare function durableJournalOutcome(msg: {
|
|
39
|
+
sender: 'user' | 'agent' | 'system';
|
|
40
|
+
turnOutcome?: 'failed' | 'stopped';
|
|
41
|
+
}): WorkJournalOutcome;
|
|
42
|
+
/**
|
|
43
|
+
* Server composes activity labels; the client owns exactly these fixed
|
|
44
|
+
* strings (the single slow transition and the terminal/hint copy). Curly
|
|
45
|
+
* apostrophes and no em-dashes per std-writing / std-code-style.
|
|
46
|
+
*/
|
|
47
|
+
export declare const WORK_JOURNAL_COPY: {
|
|
48
|
+
readonly waiting: "Waiting for results";
|
|
49
|
+
readonly completed: "Work complete";
|
|
50
|
+
readonly failed: "Couldn’t finish";
|
|
51
|
+
readonly stopped: "Stopped";
|
|
52
|
+
readonly notifyHint: "Taking longer than usual. You can leave and I’ll notify you when it’s ready.";
|
|
53
|
+
readonly leaveHint: "You can leave this chat while I work.";
|
|
54
|
+
};
|
|
55
|
+
export declare function buildWorkJournalModel(args: {
|
|
56
|
+
activities: ChatToolActivityData[];
|
|
57
|
+
outcome: WorkJournalOutcome;
|
|
58
|
+
nowMs: number;
|
|
59
|
+
canNotifyOnCompletion: boolean;
|
|
60
|
+
}): WorkJournalModel;
|