@pagelines/sdk 1.0.652 → 1.0.654
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 +2127 -1969
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/agent/AgentController.d.ts +34 -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/ui/ChatScroller.vue.d.ts +2 -2
- package/dist/agent/ui/ElAgentChat.vue.d.ts +1 -1
- package/dist/agent/work-journal.d.ts +68 -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,22 @@ 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;
|
|
90
|
+
private readonly isStreamingText;
|
|
98
91
|
private conversationId?;
|
|
99
92
|
textState: Ref<TextConnectionState>;
|
|
100
93
|
agentMode: Ref<AgentMode>;
|
|
101
94
|
sharedMessages: Ref<ChatMessage[]>;
|
|
102
95
|
readonly composerState: Ref<AgentChatComposerState>;
|
|
103
|
-
|
|
96
|
+
/**
|
|
97
|
+
* The live line of work for the in-flight turn. Present only once the first
|
|
98
|
+
* activity arrives (before that, the top-level thinking cue owns the state —
|
|
99
|
+
* the two are mutually exclusive). Transient live work is always `running`;
|
|
100
|
+
* Task 7 owns `stopped`.
|
|
101
|
+
*/
|
|
102
|
+
readonly workJournal: ComputedRef<WorkJournalModel | undefined>;
|
|
104
103
|
readonly canUseComposer: ComputedRef<boolean>;
|
|
105
104
|
readonly canAttachFile: ComputedRef<boolean>;
|
|
106
105
|
readonly canRecordAudio: ComputedRef<boolean>;
|
|
@@ -151,18 +150,34 @@ export declare class AgentChatController extends SettingsObject<AgentChatControl
|
|
|
151
150
|
private updateState;
|
|
152
151
|
private resetToolActivityTiming;
|
|
153
152
|
private resetState;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Wake exactly once at the live journal's next slow/long boundary, recompute,
|
|
155
|
+
* and reschedule to the following one. When the boundary is undefined (turn
|
|
156
|
+
* finished, or already past the last boundary) the timer clears — so
|
|
157
|
+
* completion, cancellation, navigation, and teardown all stop it for free.
|
|
158
|
+
*/
|
|
159
|
+
private setupBoundaryWatcher;
|
|
160
|
+
private scheduleBoundary;
|
|
161
|
+
private clearBoundaryTimer;
|
|
157
162
|
private rememberToolActivity;
|
|
163
|
+
/**
|
|
164
|
+
* Backfill `startedAt`/`endedAt` when the wire omits them so the journal has
|
|
165
|
+
* stable timestamps for ordering, coalescing, and boundary scheduling. No
|
|
166
|
+
* duration is computed — elapsed time is never presented.
|
|
167
|
+
*/
|
|
158
168
|
private withToolActivityTiming;
|
|
159
169
|
private updateToolActivity;
|
|
160
170
|
private finishToolActivities;
|
|
161
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Project a persisted turn's activity into a durable work journal. The turn
|
|
173
|
+
* outcome is explicit — an assistant reply is `completed` (green terminal,
|
|
174
|
+
* even with a failed child), a system-error row is `failed`. Never inferred
|
|
175
|
+
* from child statuses.
|
|
176
|
+
*/
|
|
177
|
+
workJournalFor(args: {
|
|
162
178
|
activities?: ChatToolActivityData[];
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
private toolActivityElapsed;
|
|
179
|
+
outcome: WorkJournalOutcome;
|
|
180
|
+
}): WorkJournalModel | undefined;
|
|
166
181
|
private setupModeWatcher;
|
|
167
182
|
private setupAvailabilityWatcher;
|
|
168
183
|
/**
|
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;
|
|
@@ -8,7 +8,7 @@ declare function __VLS_template(): {
|
|
|
8
8
|
viewport: HTMLDivElement;
|
|
9
9
|
content: HTMLDivElement;
|
|
10
10
|
};
|
|
11
|
-
rootEl:
|
|
11
|
+
rootEl: any;
|
|
12
12
|
};
|
|
13
13
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
14
14
|
declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
@@ -16,7 +16,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
16
16
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
17
17
|
viewport: HTMLDivElement;
|
|
18
18
|
content: HTMLDivElement;
|
|
19
|
-
},
|
|
19
|
+
}, any>;
|
|
20
20
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
21
21
|
export default _default;
|
|
22
22
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -32,7 +32,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
32
32
|
$parent: import('vue').ComponentPublicInstance | null;
|
|
33
33
|
$host: Element | null;
|
|
34
34
|
$emit: (event: string, ...args: any[]) => void;
|
|
35
|
-
$el:
|
|
35
|
+
$el: any;
|
|
36
36
|
$options: import('vue').ComponentOptionsBase<Readonly<{}> & Readonly<{}>, {
|
|
37
37
|
pin: () => void;
|
|
38
38
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
* `streamingText` marks that the assistant's reply is actively streaming under
|
|
17
|
+
* the journal (the Swift twin must mirror this rule). While it is true and the
|
|
18
|
+
* turn is running, the deltas ARE the progress: the wait tip and the leave hint
|
|
19
|
+
* are both suppressed, and only a genuinely in-flight tool keeps the active tip
|
|
20
|
+
* (milestones still render). Boundaries are still returned so the wait clock
|
|
21
|
+
* resumes the instant streaming stops.
|
|
22
|
+
*/
|
|
23
|
+
export type WorkJournalOutcome = 'running' | 'completed' | 'failed' | 'stopped';
|
|
24
|
+
export type WorkJournalTone = 'done' | 'active' | 'failed' | 'stopped' | 'completed';
|
|
25
|
+
export type WorkJournalRow = {
|
|
26
|
+
id: string;
|
|
27
|
+
tone: WorkJournalTone;
|
|
28
|
+
label: string;
|
|
29
|
+
note?: string;
|
|
30
|
+
};
|
|
31
|
+
export type WorkJournalModel = {
|
|
32
|
+
outcome: WorkJournalOutcome;
|
|
33
|
+
visibleRows: WorkJournalRow[];
|
|
34
|
+
hiddenRows: WorkJournalRow[];
|
|
35
|
+
terminal?: WorkJournalRow;
|
|
36
|
+
hint?: string;
|
|
37
|
+
nextBoundaryAtMs?: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The persisted row owns its turn's ending: an assistant reply is a completed
|
|
41
|
+
* turn (green terminal, even with a failed child), a system-error row is the
|
|
42
|
+
* failed turn, and an explicit `turnOutcome` marker owns salvaged failures
|
|
43
|
+
* and interruptions. Never inferred from child activity statuses.
|
|
44
|
+
*/
|
|
45
|
+
export declare function durableJournalOutcome(msg: {
|
|
46
|
+
sender: 'user' | 'agent' | 'system';
|
|
47
|
+
turnOutcome?: 'failed' | 'stopped';
|
|
48
|
+
}): WorkJournalOutcome;
|
|
49
|
+
/**
|
|
50
|
+
* Server composes activity labels; the client owns exactly these fixed
|
|
51
|
+
* strings (the single slow transition and the terminal/hint copy). Curly
|
|
52
|
+
* apostrophes and no em-dashes per std-writing / std-code-style.
|
|
53
|
+
*/
|
|
54
|
+
export declare const WORK_JOURNAL_COPY: {
|
|
55
|
+
readonly waiting: "Waiting for results";
|
|
56
|
+
readonly completed: "Work complete";
|
|
57
|
+
readonly failed: "Couldn’t finish";
|
|
58
|
+
readonly stopped: "Stopped";
|
|
59
|
+
readonly notifyHint: "Taking longer than usual. You can leave and I’ll notify you when it’s ready.";
|
|
60
|
+
readonly leaveHint: "You can leave this chat while I work.";
|
|
61
|
+
};
|
|
62
|
+
export declare function buildWorkJournalModel(args: {
|
|
63
|
+
activities: ChatToolActivityData[];
|
|
64
|
+
outcome: WorkJournalOutcome;
|
|
65
|
+
nowMs: number;
|
|
66
|
+
canNotifyOnCompletion: boolean;
|
|
67
|
+
streamingText?: boolean;
|
|
68
|
+
}): WorkJournalModel;
|