@qilin-agent/client-ui-conversation 0.0.0-stage → 3.1.4

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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +37 -0
  3. package/README.md +149 -2
  4. package/README.zh.md +150 -0
  5. package/lib/client.js +19208 -0
  6. package/lib/index.js +46 -0
  7. package/lib/types/client/apply.d.ts +25 -0
  8. package/lib/types/client/context-occupancy.d.ts +14 -0
  9. package/lib/types/client/contract/composer-blocks.d.ts +28 -0
  10. package/lib/types/client/contract/composer-submission.d.ts +8 -0
  11. package/lib/types/client/contract/context-producer.d.ts +29 -0
  12. package/lib/types/client/contract/conversation.d.ts +279 -0
  13. package/lib/types/client/contract/draft-editor.d.ts +102 -0
  14. package/lib/types/client/contract/groups.d.ts +116 -0
  15. package/lib/types/client/contract/input.d.ts +361 -0
  16. package/lib/types/client/contract/records.d.ts +301 -0
  17. package/lib/types/client/contract/request-inspection.d.ts +132 -0
  18. package/lib/types/client/contract/slots.d.ts +541 -0
  19. package/lib/types/client/contract/snapshot.d.ts +20 -0
  20. package/lib/types/client/contract/system-prompt.d.ts +35 -0
  21. package/lib/types/client/contract/views.d.ts +36 -0
  22. package/lib/types/client/conversation/assembler.d.ts +151 -0
  23. package/lib/types/client/conversation/assembly.d.ts +128 -0
  24. package/lib/types/client/conversation/definition-registry.d.ts +33 -0
  25. package/lib/types/client/conversation/event-registry.d.ts +40 -0
  26. package/lib/types/client/conversation/group-registry.d.ts +30 -0
  27. package/lib/types/client/conversation/group-store.d.ts +29 -0
  28. package/lib/types/client/conversation/historical-images.d.ts +49 -0
  29. package/lib/types/client/conversation/location-index.d.ts +91 -0
  30. package/lib/types/client/conversation/view-registry.d.ts +12 -0
  31. package/lib/types/client/image-labels.d.ts +23 -0
  32. package/lib/types/client/index.d.ts +39 -0
  33. package/lib/types/client/input/blocks.d.ts +27 -0
  34. package/lib/types/client/input/decorations.d.ts +32 -0
  35. package/lib/types/client/input/editor/ComposerContentEditable.d.ts +16 -0
  36. package/lib/types/client/input/editor/DecoratorPortals.d.ts +14 -0
  37. package/lib/types/client/input/editor/DraftEditor.d.ts +27 -0
  38. package/lib/types/client/input/editor/ReferenceChip.d.ts +17 -0
  39. package/lib/types/client/input/editor/chip-node.d.ts +110 -0
  40. package/lib/types/client/input/editor/claim-decor.d.ts +23 -0
  41. package/lib/types/client/input/editor/keymap.d.ts +43 -0
  42. package/lib/types/client/input/editor/projection.d.ts +93 -0
  43. package/lib/types/client/input/editor/reference-activation.d.ts +10 -0
  44. package/lib/types/client/input/editor/runtime.d.ts +123 -0
  45. package/lib/types/client/input/editor/span-map.d.ts +38 -0
  46. package/lib/types/client/input/editor/text-ref.d.ts +49 -0
  47. package/lib/types/client/input/editor/view-binding.d.ts +60 -0
  48. package/lib/types/client/input/facade.d.ts +303 -0
  49. package/lib/types/client/input/hub.d.ts +100 -0
  50. package/lib/types/client/input/machine.d.ts +46 -0
  51. package/lib/types/client/input/submission-policy.d.ts +52 -0
  52. package/lib/types/client/layout-policy.d.ts +42 -0
  53. package/lib/types/client/locales.d.ts +772 -0
  54. package/lib/types/client/queue/QueueDock.d.ts +27 -0
  55. package/lib/types/client/service.d.ts +192 -0
  56. package/lib/types/client/settings/ContentWidthRow.d.ts +26 -0
  57. package/lib/types/client/settings/EnterBehaviorRow.d.ts +21 -0
  58. package/lib/types/client/skeleton/ContextMeter.d.ts +14 -0
  59. package/lib/types/client/skeleton/ConversationContent.d.ts +8 -0
  60. package/lib/types/client/skeleton/ConversationHeader.d.ts +8 -0
  61. package/lib/types/client/skeleton/ConversationMainPanel.d.ts +3 -0
  62. package/lib/types/client/skeleton/ConversationPanel.d.ts +9 -0
  63. package/lib/types/client/skeleton/ConversationRoot.d.ts +5 -0
  64. package/lib/types/client/skeleton/ConversationSession.d.ts +21 -0
  65. package/lib/types/client/skeleton/ConversationWidthControls.d.ts +14 -0
  66. package/lib/types/client/skeleton/DefaultConversationViews.d.ts +9 -0
  67. package/lib/types/client/skeleton/EmptyHero.d.ts +49 -0
  68. package/lib/types/client/skeleton/InputBar.d.ts +18 -0
  69. package/lib/types/client/skeleton/TodoPanel.d.ts +21 -0
  70. package/lib/types/client/skeleton/control-row-layout.d.ts +10 -0
  71. package/lib/types/client/skeleton/safari.d.ts +18 -0
  72. package/lib/types/client/stop-sequence.d.ts +32 -0
  73. package/lib/types/client/stop-shortcut.d.ts +17 -0
  74. package/lib/types/client/stores.d.ts +24 -0
  75. package/lib/types/client/view-selection.d.ts +11 -0
  76. package/lib/types/conversation-settings.d.ts +38 -0
  77. package/lib/types/index.d.ts +9 -0
  78. package/package.json +106 -3
@@ -0,0 +1,20 @@
1
+ /** Target-neutral Conversation state assembled from one Session event window. */
2
+ import type { SessionSnapshot } from '@qilin-agent/api-session-controller/client';
3
+ import type { ConversationViewSnapshotStore } from './conversation.ts';
4
+ /** Latest registered target snapshots and their shell-level activity. */
5
+ export interface ConversationSnapshot {
6
+ readonly views: ConversationViewSnapshotStore;
7
+ readonly activeTargets: ReadonlySet<string>;
8
+ }
9
+ /** Empty Conversation value used before a Session binding is available. */
10
+ export declare const EMPTY_CONVERSATION_SNAPSHOT: ConversationSnapshot;
11
+ /** Shell phase derived from Session lifecycle and registered target activity. */
12
+ export type ConversationPhase = 'blank' | 'engaging' | 'active';
13
+ /**
14
+ * Resolve the shell phase without adding Conversation data to the Session snapshot.
15
+ * @param session - current Session lifecycle state.
16
+ * @param conversation - current target-neutral Conversation state.
17
+ * @returns the phase used by the header, View ring, and composer layout.
18
+ */
19
+ export declare function conversationPhase(session: SessionSnapshot, conversation: ConversationSnapshot): ConversationPhase;
20
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1,35 @@
1
+ /** Immutable system-only interpretation of the loaded Session surface. */
2
+ import type { SessionEvent } from '@qilin-agent/session/types';
3
+ import type { SystemPromptNode } from './request-inspection.ts';
4
+ interface PositionedSystem {
5
+ readonly position: number;
6
+ readonly node: SystemPromptNode;
7
+ }
8
+ /** Prompt facts at one log prefix; earlier instances remain valid for historical cards. */
9
+ export interface SystemPromptState {
10
+ /** Earliest relevant loaded event; older unindexed endpoints have unknown surface positions. */
11
+ readonly firstSeq: number;
12
+ /** Missing endpoint order makes the prompt unavailable until prepend replay supplies it. */
13
+ readonly uncertain: boolean;
14
+ /** Loaded system nodes in surface order, including empty dormant nodes. */
15
+ readonly nodes: readonly PositionedSystem[];
16
+ /** Surviving replacement endpoints only, mapped to inherited surface positions. */
17
+ readonly replacements: ReadonlyMap<number, number>;
18
+ /** Effective prompt and its change origin; empty text records removal, undefined means unavailable. */
19
+ readonly effective: SystemPromptNode | undefined;
20
+ /** System event at this position, if any; only this node may own an update card. */
21
+ readonly introduced: SystemPromptNode | undefined;
22
+ }
23
+ /** Pure interpretation supplied to target-owned Definitions through uiConversation. */
24
+ export type SystemPromptInspector = (previous: SystemPromptState | undefined, event: SessionEvent) => SystemPromptState;
25
+ /**
26
+ * Apply a system event or positional replacement without retaining ordinary messages.
27
+ * Replacement positions inherit their start endpoint, not their chronological seq.
28
+ * Unknown older endpoint order withholds the prompt until prepend replay resolves it.
29
+ * @param previous - Interpretation at the preceding relevant event in the loaded window.
30
+ * @param event - System message or surface replacement already admitted by Session.
31
+ * @returns Immutable surviving system facts and the effective nonempty prompt.
32
+ */
33
+ export declare function inspectSystemPrompt(previous: SystemPromptState | undefined, event: SessionEvent): SystemPromptState;
34
+ export {};
35
+ //# sourceMappingURL=system-prompt.d.ts.map
@@ -0,0 +1,36 @@
1
+ /** Conversation view and session-local presentation state. */
2
+ /**
3
+ * One conversation view tab, projected from a 'conversation.view' slot
4
+ * entry's registration options (label falls back to the entry id).
5
+ */
6
+ export interface ViewTab {
7
+ id: string;
8
+ label: string;
9
+ }
10
+ /** Per-session state owned by the target-neutral Conversation shell. */
11
+ /** Conversation view and session-local presentation state. */
12
+ /**
13
+ * One conversation view tab, projected from a 'conversation.view' slot
14
+ * entry's registration options (label falls back to the entry id).
15
+ */
16
+ export interface ViewTab {
17
+ id: string;
18
+ label: string;
19
+ }
20
+ /** One-shot focus request addressed to a Conversation View. */
21
+ export interface ConversationViewRequest {
22
+ /** Target `conversation.view` entry id. */
23
+ readonly view: string;
24
+ /** Target-owned opaque focus identity. */
25
+ readonly focus: string;
26
+ }
27
+ /** The conversation store's own state: the composer draft, the selected View, and one pending focus request. */
28
+ export interface ConversationStoreState {
29
+ /** Composer draft (persisted; survives session switches and reloads). */
30
+ draft: string;
31
+ /** Preferred `conversation.view` entry id; null resolves to Chat when registered. */
32
+ view: string | null;
33
+ /** One-shot focus request addressed to the selected View. */
34
+ viewRequest: ConversationViewRequest | null;
35
+ }
36
+ //# sourceMappingURL=views.d.ts.map
@@ -0,0 +1,151 @@
1
+ import type { SessionAssistantSettlementEntry, SessionEventLikeEntry } from '@qilin-agent/api-session-controller/client';
2
+ import type { LlmAttemptId } from '@qilin-agent/llm/brand';
3
+ import type { ConversationNodeDefinition, ConversationPublication, ConversationViewDefinition, ConversationViewSnapshotMap, ConversationViewSnapshotStore } from '../contract/conversation.ts';
4
+ import type { ConversationGroupData, ConversationGroupDefinition, ConversationGroupedView } from '../contract/groups.ts';
5
+ /** Event Registry subset consumed by a Session-owned Assembler. */
6
+ export interface ConversationEventDefinitions {
7
+ /** @returns ordinary Definitions in registration order. */
8
+ entries(): readonly ConversationNodeDefinition[];
9
+ /** @returns unmatched-event fallback, when registered. */
10
+ fallbackEntry(): ConversationNodeDefinition | undefined;
11
+ }
12
+ /** View Registry subset consumed by a Session-owned Assembler. */
13
+ export interface ConversationViewDefinitions {
14
+ /** @returns view builder factories in registration order. */
15
+ entries(): readonly ConversationViewDefinition[];
16
+ }
17
+ /** Registered grouping rules consumed by the target-neutral assembler. */
18
+ export interface ConversationGroupDefinitions {
19
+ /** @returns grouping Definitions in registration order. */
20
+ entries(): readonly ConversationGroupDefinition[];
21
+ /** @param target - View target. @returns its optional Group Definition. */
22
+ forTarget(target: string): ConversationGroupDefinition | undefined;
23
+ }
24
+ /**
25
+ * Session-owned incremental engine that assembles business Contexts from a
26
+ * contiguous Event window and materializes registered view snapshots.
27
+ */
28
+ export declare class ConversationNodeAssembler implements ConversationViewSnapshotStore {
29
+ private readonly eventDefinitions;
30
+ private readonly viewDefinitions;
31
+ private readonly groupDefinitions;
32
+ private readonly contexts;
33
+ private readonly contextsByKind;
34
+ private readonly contextsBySeq;
35
+ private readonly contextsByTarget;
36
+ private readonly inputs;
37
+ private readonly locationIndex;
38
+ private readonly dirty;
39
+ private readonly dirtyByTarget;
40
+ private readonly revised;
41
+ private readonly dependents;
42
+ private readonly views;
43
+ private readonly groups;
44
+ private readonly pendingGroupStores;
45
+ private readonly activeTargets;
46
+ private hasMore;
47
+ private replacePending;
48
+ private timelineDirty;
49
+ /**
50
+ * @param eventDefinitions - live Event Definition registry.
51
+ * @param viewDefinitions - live view builder registry.
52
+ * @param groupDefinitions - optional registered grouping rules, independent of presentation modes.
53
+ */
54
+ constructor(eventDefinitions: ConversationEventDefinitions, viewDefinitions: ConversationViewDefinitions, groupDefinitions?: ConversationGroupDefinitions);
55
+ /**
56
+ * Read the current open turn without activating a View.
57
+ * @returns the latest turn number when its start is loaded and it remains open, otherwise undefined.
58
+ */
59
+ openTurn(): number | undefined;
60
+ /**
61
+ * Replace the complete loaded window after open, resync, or gap repair.
62
+ * @param entries - complete contiguous window.
63
+ * @param hasMore - whether older history remains outside the window.
64
+ * @returns immediate publication request.
65
+ */
66
+ replaceWindow(entries: readonly SessionEventLikeEntry[], hasMore: boolean): ConversationPublication;
67
+ /**
68
+ * Add one contiguous live tail event without scanning existing Contexts.
69
+ * @param record - appended Session event entry.
70
+ * @returns highest requested publication cadence.
71
+ */
72
+ append(record: SessionEventLikeEntry): ConversationPublication;
73
+ /**
74
+ * Retire one Assistant attempt's transient matches and apply its optional durable settlement.
75
+ * Empty Contexts retain their keys and published nodes until the loaded window is rebuilt;
76
+ * Definitions may hide those nodes when no start remains instead of withdrawing their identities.
77
+ * @param attemptId - process-local attempt whose transient presentation ended.
78
+ * @param entry - durable message or attempt event committed for the stream.
79
+ * @returns highest requested publication cadence.
80
+ */
81
+ settleAssistant(attemptId: LlmAttemptId, entry?: SessionAssistantSettlementEntry): ConversationPublication;
82
+ /**
83
+ * Add an older page while preserving existing Context and view identities.
84
+ * @param entries - newly loaded older Events.
85
+ * @param hasMore - whether history still precedes the expanded window.
86
+ * @returns highest requested publication cadence.
87
+ */
88
+ prepend(entries: readonly SessionEventLikeEntry[], hasMore: boolean): ConversationPublication;
89
+ /**
90
+ * Rebuild against the current Registry set after a low-frequency plugin change.
91
+ * @returns immediate publication request.
92
+ */
93
+ rebuildRegistry(): ConversationPublication;
94
+ /**
95
+ * Materialize dirty Contexts and advance every active view builder.
96
+ * @returns whether any view snapshot was rebuilt or incrementally applied.
97
+ */
98
+ flush(): boolean;
99
+ /**
100
+ * Add one target to the monotonic active set and materialize its current snapshot.
101
+ * Pending Context work is flushed before the first complete replacement.
102
+ * @param target - registered or subsequently registered view target.
103
+ * @returns whether any active target snapshot changed.
104
+ */
105
+ activateTarget(target: string): boolean;
106
+ /**
107
+ * Read the latest snapshot of a registered target.
108
+ * @param target - registered view target.
109
+ * @returns target snapshot, or undefined before registration or activation.
110
+ */
111
+ snapshot(target: string): unknown;
112
+ get<Target extends Extract<keyof ConversationViewSnapshotMap, string>>(target: Target): ConversationViewSnapshotMap[Target] | undefined;
113
+ grouped<Target extends string>(target: Target): ConversationGroupedView<ConversationGroupData<Target>> | undefined;
114
+ /**
115
+ * Read targets whose owners classify their latest snapshot as visible activity.
116
+ * @returns target ids contributing visible activity.
117
+ */
118
+ activityTargets(): ReadonlySet<string>;
119
+ private sortedInputs;
120
+ private matchInput;
121
+ private collectInput;
122
+ private dispatchInput;
123
+ private createContext;
124
+ private acceptMatch;
125
+ private applyPendingMatches;
126
+ private replayContexts;
127
+ private refreshStarts;
128
+ private replayContext;
129
+ private indexTargetContext;
130
+ private markDirty;
131
+ private replaceDependencies;
132
+ private replayRevisedDependents;
133
+ private readerFor;
134
+ private previousContext;
135
+ /** Insert one newly discovered start into its Definition's ordered predecessor index. */
136
+ private indexStartedContext;
137
+ private indexStartedContexts;
138
+ private replayDependencies;
139
+ private refreshMatchLocations;
140
+ private buildNode;
141
+ private replaceView;
142
+ private updateView;
143
+ private publishViews;
144
+ private buildTargetNodes;
145
+ private buildTargetUpserts;
146
+ private buildLocationData;
147
+ private replaceLocationData;
148
+ private applyDirtyLocationData;
149
+ private resetViewBuilders;
150
+ }
151
+ //# sourceMappingURL=assembler.d.ts.map
@@ -0,0 +1,128 @@
1
+ /** Per-Session target-neutral Conversation assembly. */
2
+ import { Service, type Context } from '@qilin-agent/kylin';
3
+ import type { ImageAttachmentRef } from '@qilin-agent/attachment';
4
+ import type { ISessions, SessionBinding } from '@qilin-agent/api-session-controller/client';
5
+ import type { SessionEvent, SessionId } from '@qilin-agent/session/types';
6
+ import { type ObservableSnapshot } from '@qilin-agent/client-store';
7
+ import type { ConversationViewSnapshotMap } from '../contract/conversation.ts';
8
+ import type { ConversationSnapshot } from '../contract/snapshot.ts';
9
+ import type { ConversationPromptSnapshot, RequestPromptInspection, SystemPromptNode } from '../contract/request-inspection.ts';
10
+ import { type SystemPromptState } from '../contract/system-prompt.ts';
11
+ import { ConversationEventRegistry } from './event-registry.ts';
12
+ import { ConversationGroupRegistry } from './group-registry.ts';
13
+ import { ConversationViewRegistry } from './view-registry.ts';
14
+ /** Observable faces published for one Session's Conversation assembly. */
15
+ export interface ConversationBinding {
16
+ readonly snapshot: ObservableSnapshot<ConversationSnapshot>;
17
+ /**
18
+ * Identity-stable source of the latest turn number, undefined unless its start is loaded and it remains open.
19
+ * Turn changes publish synchronously, including without an active View.
20
+ */
21
+ readonly openTurn: ObservableSnapshot<number | undefined>;
22
+ /**
23
+ * Add one selected target to the Session's monotonic active set.
24
+ * @param target - registered or subsequently registered Conversation target.
25
+ */
26
+ activate(target: string): void;
27
+ /**
28
+ * Resolve one target-owned snapshot source.
29
+ * The first subscriber activates the target unless shell selection already
30
+ * activated it; activation lasts for the remaining Session lifetime.
31
+ * @param target - registered Conversation target.
32
+ * @returns identity-stable source following the target.
33
+ */
34
+ target<Target extends Extract<keyof ConversationViewSnapshotMap, string>>(target: Target): ObservableSnapshot<ConversationViewSnapshotMap[Target] | undefined>;
35
+ }
36
+ /** Root service owning Conversation registries and per-Session bindings. */
37
+ export declare class UiConversation extends Service {
38
+ private readonly sessions;
39
+ /** Registry of event matchers and target snapshot builders. */
40
+ readonly events: ConversationEventRegistry;
41
+ /** Registry of target View definitions. */
42
+ readonly views: ConversationViewRegistry;
43
+ /** Business grouping rules over already materialized target Nodes. */
44
+ readonly groups: ConversationGroupRegistry;
45
+ private readonly bindings;
46
+ private readonly images;
47
+ /**
48
+ * @param ctx - owning Client context.
49
+ * @param sessions - Session Controller object layer.
50
+ */
51
+ constructor(ctx: Context, sessions: ISessions);
52
+ /**
53
+ * Resolve the Conversation binding for one Controller binding or Session id.
54
+ * @param source - Session binding or identity.
55
+ * @returns stable Conversation binding.
56
+ */
57
+ binding(source: SessionBinding | SessionId): ConversationBinding;
58
+ /**
59
+ * Resolve one session-authorized durable image URL, cached per Session so
60
+ * every Conversation target shares one read and one browser URL.
61
+ * @param sessionId - Session authorization and lifetime scope.
62
+ * @param attachment - Durable image reference from a session event.
63
+ * @returns browser URL valid until the Session binding is released.
64
+ */
65
+ imageUrl(sessionId: SessionId, attachment: ImageAttachmentRef): Promise<string>;
66
+ /**
67
+ * Read a cached durable image URL synchronously when one is available.
68
+ * @param sessionId - Session authorization and lifetime scope.
69
+ * @param attachment - Durable image reference from a session event.
70
+ * @returns current preview or canonical URL, if cached.
71
+ */
72
+ peekImageUrl(sessionId: SessionId, attachment: ImageAttachmentRef): string | undefined;
73
+ /**
74
+ * Replace one Session's composer draft with `text` — the transcript
75
+ * "edit this message and resend" entry. Resolves the Session's resident
76
+ * input shell through the conversation service's input registry; no-op
77
+ * when the session has no shell. SessionId-explicit, like {@link imageUrl},
78
+ * so a call from any package needs no scope-addressed service inject.
79
+ * @param sessionId - target Session.
80
+ * @param text - full draft text.
81
+ */
82
+ fillDraft(sessionId: SessionId, text: string): void;
83
+ /**
84
+ * Append `text` after one Session's composer draft, leaving the draft's
85
+ * existing text and reference chips in place. Dispatched as the scoped
86
+ * insert event against the revision the draft is read at, so a concurrent
87
+ * edit makes the shell refuse the insert instead of splicing into moved
88
+ * text; a non-empty draft that does not already end in whitespace gains one
89
+ * separating newline. SessionId-explicit, like {@link fillDraft}, so a call
90
+ * from any package needs no scope-addressed service inject.
91
+ * @param sessionId - target Session.
92
+ * @param text - text to append.
93
+ * @returns whether the resident input shell applied the insert.
94
+ */
95
+ insertDraft(sessionId: SessionId, text: string): boolean;
96
+ /**
97
+ * Adopt an already-displayable URL for one durable reference (see
98
+ * HistoricalImageCache.seed): the transcript node then renders it without a
99
+ * byte round-trip.
100
+ * @param sessionId - Session authorization and lifetime scope.
101
+ * @param attachment - Durable image reference the URL displays.
102
+ * @param url - browser URL to adopt.
103
+ * @returns whether the cache took URL ownership.
104
+ */
105
+ seedImageUrl(sessionId: SessionId, attachment: ImageAttachmentRef, url: string): boolean;
106
+ /**
107
+ * Interpret a system message or surface replacement for target-owned prompt Definitions.
108
+ * @param previous - System facts at the preceding relevant loaded event.
109
+ * @param event - Durable system message or positional replacement.
110
+ * @returns Immutable prompt interpretation at this event.
111
+ */
112
+ inspectSystemPrompt(previous: SystemPromptState | undefined, event: SessionEvent): SystemPromptState;
113
+ /**
114
+ * Canonicalize one `request/header` event against the previous prompt state
115
+ * and the `system/message` node in force.
116
+ *
117
+ * A pure interpretation shared by the Chat and Trajectory Definitions, exposed
118
+ * as a service method because cross-plugin value imports are forbidden in
119
+ * client bundles.
120
+ * @param previous - prompt recorded by the preceding loaded header, if any.
121
+ * @param event - the `request/header` session event to interpret.
122
+ * @param system - effective prompt after loaded surface replacements, if any.
123
+ * @returns the canonical prompt snapshot and any model-visible change.
124
+ */
125
+ inspectRequestPrompt(previous: ConversationPromptSnapshot | undefined, event: SessionEvent<'request/header'>, system: SystemPromptNode | undefined): RequestPromptInspection;
126
+ private drop;
127
+ }
128
+ //# sourceMappingURL=assembly.d.ts.map
@@ -0,0 +1,33 @@
1
+ import { type Context } from '@qilin-agent/kylin';
2
+ /** Shared lifecycle and stable-entry storage for one Conversation Definition registry. */
3
+ export declare abstract class ConversationDefinitionRegistry<Definition> {
4
+ protected readonly ctx: Context;
5
+ protected readonly definitions: Map<string, Definition>;
6
+ private listeners;
7
+ private cached;
8
+ /** @param ctx - Context whose effects own contributed Definitions. */
9
+ constructor(ctx: Context);
10
+ /**
11
+ * Return reference-stable Definitions in registration order.
12
+ * @returns current Definitions.
13
+ */
14
+ entries(): readonly Definition[];
15
+ /**
16
+ * Observe low-frequency registry changes.
17
+ * @param listener - synchronous invalidation callback.
18
+ * @returns unsubscribe callback.
19
+ */
20
+ subscribe(listener: () => void): () => void;
21
+ /**
22
+ * Register one uniquely keyed Definition for the caller's lifetime.
23
+ * @param key - registry-local unique key.
24
+ * @param definition - contributed Definition.
25
+ * @param duplicateMessage - error raised when the key is already owned.
26
+ * @param effectName - Cordis effect diagnostic label.
27
+ * @returns idempotent disposer.
28
+ */
29
+ protected registerDefinition(key: string, definition: Definition, duplicateMessage: string, effectName: string): () => void;
30
+ /** Refresh cached entries and synchronously invalidate subscribers. */
31
+ protected refresh(): void;
32
+ }
33
+ //# sourceMappingURL=definition-registry.d.ts.map
@@ -0,0 +1,40 @@
1
+ import type { ConversationMatchHandler, ConversationNodeDefinition, ConversationNodeDefinitionInput } from '../contract/conversation.ts';
2
+ import { ConversationDefinitionRegistry } from './definition-registry.ts';
3
+ /** A registered Definition and its event-type-selected handler. */
4
+ export interface ConversationEventRoute {
5
+ readonly definition: ConversationNodeDefinition;
6
+ readonly match: ConversationMatchHandler;
7
+ }
8
+ /** Runtime registry of independently owned Conversation business Definitions. */
9
+ export declare class ConversationEventRegistry extends ConversationDefinitionRegistry<ConversationNodeDefinition> {
10
+ private fallback;
11
+ private routes;
12
+ private unrestricted;
13
+ private readonly tables;
14
+ /**
15
+ * Register a uniquely named business Definition for the caller's lifetime.
16
+ * @param definition - Definition contribution.
17
+ * @returns idempotent disposer.
18
+ */
19
+ register(definition: ConversationNodeDefinitionInput): () => void;
20
+ /**
21
+ * Register the sole fallback used only when no ordinary Definition matches.
22
+ * @param input - fallback Definition.
23
+ * @returns idempotent disposer.
24
+ */
25
+ registerFallback(input: ConversationNodeDefinitionInput): () => void;
26
+ /**
27
+ * Return the current unmatched-event fallback.
28
+ * @returns installed fallback, when present.
29
+ */
30
+ fallbackEntry(): ConversationNodeDefinition | undefined;
31
+ /**
32
+ * Read precomputed candidates in registration order; the returned Set is borrowed read-only.
33
+ * @param type - current event type.
34
+ * @returns table handlers for this type together with all function-form handlers.
35
+ */
36
+ forEvent(type: string): ReadonlySet<ConversationEventRoute>;
37
+ private resolve;
38
+ protected refresh(): void;
39
+ }
40
+ //# sourceMappingURL=event-registry.d.ts.map
@@ -0,0 +1,30 @@
1
+ /** Target-indexed business grouping registrations with the existing effect lifecycle. */
2
+ import type { Context } from '@qilin-agent/kylin';
3
+ import type { ConversationViewNode } from '../contract/conversation.ts';
4
+ import type { ConversationGroupData, ConversationGroupDefinition } from '../contract/groups.ts';
5
+ import { ConversationDefinitionRegistry } from './definition-registry.ts';
6
+ import type { ConversationViewRegistry } from './view-registry.ts';
7
+ /** One Group Definition per target; registration never instantiates its Builder. */
8
+ export declare class ConversationGroupRegistry extends ConversationDefinitionRegistry<ConversationGroupDefinition> {
9
+ private readonly views;
10
+ /**
11
+ * @param ctx - owning plugin context.
12
+ * @param views - registered target Builder definitions.
13
+ */
14
+ constructor(ctx: Context, views: ConversationViewRegistry);
15
+ /**
16
+ * Register grouping rules for an existing target.
17
+ * @param definition - business State and grouping output for the declared target data.
18
+ * @returns the effect-owned, idempotent registration disposer.
19
+ */
20
+ register<Node extends ConversationViewNode, State, Target extends string>(definition: ConversationGroupDefinition<Node, State, ConversationGroupData<Target>> & {
21
+ readonly target: Target;
22
+ }): () => void;
23
+ /**
24
+ * Find the grouping rules registered for one target.
25
+ * @param target - View target.
26
+ * @returns its grouping Definition, when registered.
27
+ */
28
+ forTarget(target: string): ConversationGroupDefinition | undefined;
29
+ }
30
+ //# sourceMappingURL=group-registry.d.ts.map
@@ -0,0 +1,29 @@
1
+ /** Keyed group publication and incremental validation of rendering positions. */
2
+ import { type ObservableSnapshot } from '@qilin-agent/client-store';
3
+ import type { ConversationViewNode } from '../contract/conversation.ts';
4
+ import type { ConversationGroupedView, GroupKey, GroupSnapshot, GroupUpdate, NodeKey, RenderEntry } from '../contract/groups.ts';
5
+ /** Validates a complete batch before installing its group and root-list changes. */
6
+ export declare class ConversationGroupStore<Data> implements ConversationGroupedView<Data> {
7
+ private root;
8
+ private rootGroups;
9
+ private readonly groups;
10
+ private readonly placements;
11
+ private readonly sources;
12
+ private readonly dirty;
13
+ /** @returns the identity-stable ordered root references. */
14
+ get entries(): readonly RenderEntry[];
15
+ groupSource(key: GroupKey): ObservableSnapshot<GroupSnapshot<Data> | undefined>;
16
+ /**
17
+ * Install one validated update without notifying readers.
18
+ * @param update - root replacement and complete or incremental group records.
19
+ * @param readNode - synchronous reader of the current target Nodes.
20
+ */
21
+ prepareAndInstall(update: GroupUpdate<Data>, readNode: (key: NodeKey) => ConversationViewNode | undefined): void;
22
+ /** Publish changed group sources after all related target data has been installed. */
23
+ publish(): void;
24
+ /** Remove grouping without deleting its source Nodes; publication remains deferred. */
25
+ clear(): void;
26
+ private collectRootGroups;
27
+ private collectChanges;
28
+ }
29
+ //# sourceMappingURL=group-store.d.ts.map
@@ -0,0 +1,49 @@
1
+ /** Session-scoped durable image URL cache shared by Conversation targets. */
2
+ import type { Context } from '@qilin-agent/kylin';
3
+ import type { ImageAttachmentRef } from '@qilin-agent/attachment';
4
+ import type { ISessions } from '@qilin-agent/api-session-controller/client';
5
+ import type { SessionId } from '@qilin-agent/session/types';
6
+ /** Resolve durable Conversation images and release their browser URLs with Session scope. */
7
+ export declare class HistoricalImageCache {
8
+ private readonly sessions;
9
+ private readonly entries;
10
+ private readonly scopeDisposers;
11
+ private readonly urls;
12
+ private disposed;
13
+ /**
14
+ * @param ctx - Owning ui-conversation fiber.
15
+ * @param sessions - Session Controller object layer.
16
+ */
17
+ constructor(ctx: Context, sessions: ISessions);
18
+ /**
19
+ * Resolve and cache one session-authorized image URL.
20
+ * @param sessionId - Session authorization and lifetime scope.
21
+ * @param attachment - Durable image reference.
22
+ * @returns browser URL valid until the Session binding is released.
23
+ */
24
+ resolve(sessionId: SessionId, attachment: ImageAttachmentRef): Promise<string>;
25
+ /**
26
+ * Return an already-displayable URL without starting a read.
27
+ * @param sessionId - Session authorization and lifetime scope.
28
+ * @param attachment - Durable image reference.
29
+ * @returns current preview or canonical URL when cached.
30
+ */
31
+ peek(sessionId: SessionId, attachment: ImageAttachmentRef): string | undefined;
32
+ /**
33
+ * Adopt a submission preview while fetching the durable admitted bytes.
34
+ * The preview is available synchronously, then replaced and revoked when
35
+ * the canonical attachment read completes.
36
+ * @param sessionId - Session authorization and lifetime scope.
37
+ * @param attachment - Durable image reference the URL temporarily displays.
38
+ * @param url - browser URL to adopt.
39
+ * @returns whether the cache took ownership.
40
+ */
41
+ seed(sessionId: SessionId, attachment: ImageAttachmentRef, url: string): boolean;
42
+ private loadCanonical;
43
+ private assertLive;
44
+ private bindScope;
45
+ private release;
46
+ private releaseUrl;
47
+ private dispose;
48
+ }
49
+ //# sourceMappingURL=historical-images.d.ts.map
@@ -0,0 +1,91 @@
1
+ import { type AssistantLiveChunkEvent, type SessionEventLike, type SessionEventLikeEntry } from '@qilin-agent/api-session-controller/client';
2
+ import type { SessionEvent } from '@qilin-agent/session/types';
3
+ import type { ConversationLocation, ConversationLocationData, ConversationTimelineSnapshot } from '../contract/conversation.ts';
4
+ /** One Context's previous and next Location-data publication. */
5
+ export interface ConversationLocationDataChange {
6
+ readonly owner: string;
7
+ readonly previous: ConversationLocationData | null;
8
+ readonly next: ConversationLocationData | null;
9
+ }
10
+ /** Session-owned Turn/Step timeline and event-to-Location index. */
11
+ export declare class ConversationLocationIndex {
12
+ private coordinates;
13
+ private locations;
14
+ private seqsByTurn;
15
+ private timeline;
16
+ private readonly turnDataStores;
17
+ private readonly stepDataStores;
18
+ private readonly dirtyDataStores;
19
+ private readonly changedTurns;
20
+ private currentTurn;
21
+ private currentStep;
22
+ /**
23
+ * Return the current reference-stable timeline.
24
+ * @returns current timeline snapshot.
25
+ */
26
+ snapshot(): ConversationTimelineSnapshot;
27
+ /**
28
+ * Drain the Turn changes accumulated for one assembly flush.
29
+ * @returns Turn identities changed since the preceding drain.
30
+ */
31
+ takeChangedTurns(): readonly number[];
32
+ /**
33
+ * Replace all Definition-owned Location values while preserving reader identities.
34
+ * @param entries - complete current set of Definition-owned Location values.
35
+ * @returns whether any published Location data changed.
36
+ */
37
+ replaceData(entries: readonly {
38
+ readonly owner: string;
39
+ readonly data: ConversationLocationData;
40
+ }[]): boolean;
41
+ /**
42
+ * Apply changed Context publications without rebuilding Turn/Step membership.
43
+ * @param changes - incremental removals and replacements from published Contexts.
44
+ * @returns whether any published Location data changed.
45
+ */
46
+ applyData(changes: readonly ConversationLocationDataChange[]): boolean;
47
+ /** Publish committed Location-data changes to their keyed sources. */
48
+ publishData(): void;
49
+ /**
50
+ * Resolve the latest Location for one event.
51
+ * @param event - event already ingested into this index.
52
+ * @returns current Location, falling back to session when it has no Turn/Step affinity.
53
+ */
54
+ locationOf(event: SessionEventLike): ConversationLocation;
55
+ /**
56
+ * Rebuild timeline facts after replace/prepend or a boundary append.
57
+ * @param entries - complete current window in ascending seq order.
58
+ * @returns seqs whose resolved Location changed.
59
+ */
60
+ rebuild(entries: readonly SessionEventLikeEntry[]): ReadonlySet<number>;
61
+ /**
62
+ * Append one Turn/Step boundary while revisiting only the owning Turn.
63
+ * @param event - contiguous tail boundary event.
64
+ * @returns seqs whose immutable Location reference changed.
65
+ */
66
+ appendBoundary(event: SessionEvent): ReadonlySet<number>;
67
+ /**
68
+ * Index one non-boundary tail event without rescanning the window.
69
+ * @param event - contiguous appended event.
70
+ */
71
+ appendNonBoundary(event: SessionEventLike): void;
72
+ /**
73
+ * Remove indexed Assistant transients without rebuilding the Turn/Step timeline.
74
+ * @param events - transient events retired by one Assistant settlement.
75
+ */
76
+ removeAssistantTransients(events: readonly AssistantLiveChunkEvent[]): void;
77
+ /**
78
+ * Index one durable Assistant settlement inserted before an already visible tail.
79
+ * @param event - message or attempt settlement with explicit Turn and Step coordinates.
80
+ */
81
+ insertAssistantSettlement(event: SessionEvent<'assistant/message'> | SessionEvent<'assistant/attempt'>): void;
82
+ private indexTurnSeq;
83
+ private turnData;
84
+ private stepData;
85
+ private mutableTurnData;
86
+ private mutableStepData;
87
+ private createDataStore;
88
+ private storeFor;
89
+ private resolve;
90
+ }
91
+ //# sourceMappingURL=location-index.d.ts.map
@@ -0,0 +1,12 @@
1
+ import type { ConversationViewDefinition } from '../contract/conversation.ts';
2
+ import { ConversationDefinitionRegistry } from './definition-registry.ts';
3
+ /** Runtime registry of per-target Conversation snapshot builders. */
4
+ export declare class ConversationViewRegistry extends ConversationDefinitionRegistry<ConversationViewDefinition> {
5
+ /**
6
+ * Register a uniquely named view builder factory for the caller's lifetime.
7
+ * @param definition - target builder contribution.
8
+ * @returns idempotent disposer.
9
+ */
10
+ register(definition: ConversationViewDefinition): () => void;
11
+ }
12
+ //# sourceMappingURL=view-registry.d.ts.map