@aparte/core 0.8.0 → 0.9.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/dist/client/aparte-client.d.ts.map +1 -1
- package/dist/client/stream-adapter.d.ts.map +1 -1
- package/dist/client/xml-artifact-feed.d.ts.map +1 -1
- package/dist/components/bubble/bubble-sync.d.ts.map +1 -1
- package/dist/components/viewport/aparte-chat-viewport.d.ts +10 -0
- package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
- package/dist/custom-elements.json +7946 -7610
- package/dist/host/aparte-chat-host.d.ts.map +1 -1
- package/dist/{index-BieFbKeW.js → index-hQQljwfX.js} +160 -49
- package/dist/index-hQQljwfX.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -19
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +1 -0
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +15 -13
- package/dist/index.node.js.map +1 -1
- package/dist/parsers/aparte-stream-parser.d.ts +25 -0
- package/dist/parsers/aparte-stream-parser.d.ts.map +1 -1
- package/dist/renderers/segment-renderers.d.ts.map +1 -1
- package/dist/renderers/segments/code.d.ts.map +1 -1
- package/dist/renderers/segments/terminal.d.ts.map +1 -1
- package/dist/types/events.d.ts +9 -3
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/segments.d.ts +32 -0
- package/dist/types/segments.d.ts.map +1 -1
- package/dist/utils/segments.d.ts +174 -0
- package/dist/utils/segments.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/index-BieFbKeW.js.map +0 -1
package/dist/index.node.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export { isAwaitingReply } from './utils/is-awaiting-reply.js';
|
|
|
51
51
|
export { escapeHtml, escapeAttr } from './utils/escape.js';
|
|
52
52
|
export { cssEscape } from './utils/css-escape.js';
|
|
53
53
|
export { uuid } from './utils/uuid.js';
|
|
54
|
+
export { isSegmentSettled, segmentDuration } from './utils/segments.js';
|
|
54
55
|
export type { AparteHostHandlersConfig } from './types/models.js';
|
|
55
56
|
export type { AparteKeyProvider } from './config/aparte-config.js';
|
|
56
57
|
export { requestUserInput, buildElicitationPanel } from './elicitation/index.js';
|
package/dist/index.node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,YAAY,EACR,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EAIrB,8BAA8B,EAC9B,gBAAgB,EAChB,aAAa,EACb,2BAA2B,EAC3B,4BAA4B,EAC5B,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,+BAA+B,EAC/B,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,kCAAkC,EAClC,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,iBAAiB,EACjB,+BAA+B,EAC/B,4BAA4B,EAC5B,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,mCAAmC,EACnC,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd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GhC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI3D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAIxE,YAAY,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACjF,YAAY,EACR,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
|
package/dist/index.node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _,
|
|
1
|
+
import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1 } from "./index-hQQljwfX.js";
|
|
2
2
|
function registerAllComponents() {
|
|
3
3
|
}
|
|
4
4
|
export {
|
|
@@ -44,18 +44,20 @@ export {
|
|
|
44
44
|
N as isAwaitingReply,
|
|
45
45
|
O as isFormatAdapter,
|
|
46
46
|
P as isSafeUrl,
|
|
47
|
-
Q as
|
|
48
|
-
R as
|
|
49
|
-
S as
|
|
50
|
-
T as
|
|
47
|
+
Q as isSegmentSettled,
|
|
48
|
+
R as parseAparteEventStream,
|
|
49
|
+
S as parseMarkdownToSegments,
|
|
50
|
+
T as populateBubbleFromMessage,
|
|
51
|
+
U as readableToAsyncIterable,
|
|
51
52
|
registerAllComponents,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
V as registerDefaultRenderers,
|
|
54
|
+
W as registerSegmentRenderer,
|
|
55
|
+
X as requestUserInput,
|
|
56
|
+
Y as resolveConfig,
|
|
57
|
+
Z as revokeAttachmentUrls,
|
|
58
|
+
_ as runWithConfig,
|
|
59
|
+
$ as segmentDuration,
|
|
60
|
+
a0 as unregisterSegmentRenderer,
|
|
61
|
+
a1 as uuid
|
|
60
62
|
};
|
|
61
63
|
//# sourceMappingURL=index.node.js.map
|
package/dist/index.node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.js","sources":["../src/index.node.ts"],"sourcesContent":["/**\n * @aparte/core — Node.js / SSR-safe entry point.\n *\n * Resolved via the `node` export condition, so `import '@aparte/core'` in Node\n * (Next.js / Nuxt / Angular Universal / SvelteKit server, tsx, CLI tools) loads\n * THIS module instead of the browser entry. It exposes the same public API\n * surface MINUS the Web Components and CSS side-effects — importing the real\n * `index.ts` in Node throws `HTMLElement is not defined` because the custom\n * elements extend `HTMLElement` at module scope.\n *\n * Everything re-exported here is DOM-free at import time. Custom-element CLASSES\n * (AparteChatBubble, AparteComposer*, AparteSelect, …) are intentionally NOT exported\n * as runtime values — they only exist in the browser build. Their TYPES are\n * re-exported (types are erased, so they never pull DOM at runtime), which keeps\n * TypeScript consumers fully typed on the server; `registerAllComponents()` is a\n * no-op here (there is nothing to register without a DOM).\n */\n\n// ── Types (erased at runtime — always safe, mirror index.ts) ────────────────\nexport type {\n AparteBubbleRole,\n AparteMessage,\n AparteContentParser,\n AparteSendEventDetail,\n AparteViewportConfig,\n AparteInputConfig,\n AparteThemeVariables,\n AparteStatus,\n AparteAttachment,\n AparteMessageBranch,\n AparteBubbleActionsConfig,\n AparteBubbleActionName,\n AparteSegment,\n AparteSegmentType,\n AparteTextSegment,\n AparteThinkingSegment,\n AparteCodeSegment,\n AparteTerminalSegment,\n AparteSegmentRenderer,\n AparteCustomSegment,\n AparteToolCallSegment,\n AparteArtifactSegment,\n // The detail of the `aparte-segment-update` event. It reached types/index.ts and\n // stopped there — and types/index.ts is not an entry point, so a consumer could\n // bind the event (it is in the published event table) and never name its detail.\n AparteSegmentUpdateEventDetail,\n AparteAIProvider,\n AparteAIModel,\n AparteAIProviderConfigField,\n AparteAIProviderConfigSchema,\n AparteModelConfig,\n ModelStatus,\n ModelLoadProgress,\n AparteModelChangeEventDetail,\n AparteMessageDoneEventDetail,\n AparteMessageStartEventDetail,\n AparteMessageErrorEventDetail,\n AparteMessageAbortedEventDetail,\n AparteAbortEventDetail,\n AparteCompactEventDetail,\n AparteCompactDoneEventDetail,\n AparteCompactErrorEventDetail,\n AparteAttachmentPreviewEventDetail,\n AparteTerminalRunEventDetail,\n AparteFileGenReadyEventDetail,\n AparteFileGenErrorEventDetail,\n AparteMessageInfoEventDetail,\n AparteSiblingInfo,\n AparteBranchNavigateEventDetail,\n ApartePathChangedEventDetail,\n AparteRetryEventDetail,\n AparteEditEventDetail,\n AparteFeedbackEventDetail,\n AparteActionEventDetail,\n AparteArtifactStartEventDetail,\n AparteArtifactDeltaEventDetail,\n AparteArtifactReadyEventDetail,\n AparteArtifactRedownloadEventDetail,\n AparteChatRequest,\n AparteChatResponse,\n AparteChatMessage,\n AparteContentPart,\n AparteTextPart,\n AparteImagePart,\n AparteFilePart,\n AparteStreamEvent,\n AparteStreamEventMap,\n AparteUsage,\n AparteTool,\n AparteToolCall,\n AparteToolResult,\n AparteToolHandler,\n AparteToolContext,\n AparteToolRenderer,\n AparteToolDecisionDetail,\n AparteToolApprovalRequestDetail,\n AparteChatImperativeApi,\n} from './types/index.js';\nexport { AparteErrorCode, AparteError, contentToText } from './types/index.js';\n\n// Custom-element TYPES (erased) — keep server consumers fully typed.\nexport type { AparteSelectChangeDetail, AparteOptgroupToggleEventDetail } from './primitives/index.js';\nexport type { SyncableBubble, AparteComposerEventMap, AparteComposerEventType, AparteComposerState, AparteComposerChangeEventDetail, AparteActionClickEventDetail } from './components/index.js';\nexport type { AparteConversationListItem, AparteConversationSelectDetail, AparteConversationDeleteDetail, AparteConversationArchiveDetail } from './components/index.js';\n\n// ── Renderers (produce HTML strings; DOM-free at import) ────────────────────\nexport {\n registerSegmentRenderer,\n unregisterSegmentRenderer,\n getSegmentRenderer,\n collectRendererStyles,\n registerDefaultRenderers,\n installDefaultRenderersOnce,\n declineDefaultRenderers,\n getAllRenderers,\n} from './renderers/index.js';\n\n// `populateBubbleFromMessage` is a plain helper — import it from its own module,\n// NOT the components barrel (which would pull in the HTMLElement classes).\nexport { populateBubbleFromMessage } from './components/bubble/bubble-sync.js';\n\n// ── Conversations (types, adapter contract, manager, controller) ────────────\nexport type {\n AparteConversation,\n AparteConversationMeta,\n AparteStorageAdapter,\n AparteMemoryFact,\n AparteArtifactRow,\n AparteAttachmentRow,\n} from './conversations/index.js';\nexport { APARTE_CONVERSATION_SCHEMA_VERSION } from './conversations/index.js';\nexport { AparteConversationManager, type ConversationManagerOptions } from './conversations/index.js';\nexport {\n AparteConversationController,\n type AparteChatBinding,\n type AparteConversationControllerOptions,\n} from './conversations/index.js';\n\n// ── Framework-agnostic chat-host orchestrator (every wrapper binds to it) ───\nexport {\n AparteChatHost,\n type AparteChatHostBinding,\n type AparteChatHostOptions,\n} from './host/index.js';\n\n// ── Parsers ─────────────────────────────────────────────────────────────────\nexport { AparteStreamParser, parseMarkdownToSegments, deriveArtifactKind, parseAparteEventStream } from './parsers/index.js';\nexport type { AparteStreamParserOptions, AparteThinkingDelimiterPair, AparteParserState, AparteParserResult } from './parsers/index.js';\n\n// Transport seam — DOM-free (fetch-based), so the whole seam is SSR-safe. The\n// server-side `/api/chat` handler AND both client transports live here; a browser\n// never runs the handler, and the transports touch no DOM at import. Mirrored in\n// full so a wrapper barrel re-exporting a transport can't crash under SSR.\nexport { AparteDirectTransport, AparteBackendTransport, createAparteChatHandler, isFormatAdapter } from './transport/index.js';\nexport type {\n AparteTransport,\n AparteTransportContext,\n AparteFormatAdapter,\n AparteVendorRequest,\n BackendTransportOptions,\n DirectTransportOptions,\n AparteChatHandlerOptions,\n} from './transport/index.js';\n\n// ── Config ──────────────────────────────────────────────────────────────────\nexport { aparteGlobalConfig, AparteConfig, APARTE_DEFAULT_BUBBLE_ACTIONS, APARTE_DEFAULT_HOST_HANDLERS } from './config/index.js';\nexport type { AparteConfigChangeEventDetail } from './config/index.js';\nexport { resolveConfig, attachConfig, detachConfig, runWithConfig, contextConfig, APARTE_HOST_ATTR } from './config/index.js';\nexport type { AparteConfigAware } from './config/index.js';\nexport type {\n AparteMarkdownProvider,\n AparteStreamingMarkdownProvider,\n AparteStreamingMarkdownRenderer,\n AparteHighlightProvider,\n AparteSystemPromptVarsProvider,\n AparteSkeletonProvider,\n AparteSkeletonType,\n AparteLocale,\n AparteAction,\n AparteActionZone,\n AparteIconProvider,\n AparteIconName,\n AparteAvatarProvider,\n AparteStatusRenderer,\n AparteErrorRenderer,\n AparteAttachmentRenderer,\n AparteElicitationFieldRenderer,\n AparteElicitationFieldContext,\n AparteElicitationFieldControl,\n AparteSiblingNavRenderer,\n AparteBubbleShellRenderer,\n AparteModelPreference,\n AparteModelPreferenceProvider,\n AparteArtifactPreviewBuilder,\n AparteSanitizer,\n} from './config/index.js';\nexport { APARTE_DEFAULT_ICON_FALLBACKS, APARTE_DEFAULT_SKELETON_FALLBACKS, APARTE_DEFAULT_LOCALE, defaultSanitizer, isSafeUrl } from './config/index.js';\n\n// ── Client + runtime ─────────────────────────────────────────────────────────\nexport { AparteClient } from './client/aparte-client.js';\nexport type { AparteClientOptions, AparteToolApprovalResolver, AparteCompactionSelector } from './client/aparte-client.js';\nexport { createStreamAdapter, readableToAsyncIterable } from './client/stream-adapter.js';\nexport type { AparteStreamRunEvent, AparteStreamRunEmitter, StreamAdapterTarget, CreateStreamAdapterOptions, AparteStreamRunner, AparteStreamRunOptions } from './client/stream-adapter.js';\nexport { AparteMessageRepository } from './runtime/message-repository.js';\nexport type { ExportedMessageRepository } from './runtime/message-repository.js';\n\n// ── Wrapper interop (DOM-free helpers the four wrappers' AparteUi value-imports) ─\n// `applyElementProps`/`APARTE_DEFAULT_UI_EVENTS` are pure (a string array + a function that\n// only touches its `HTMLElement` argument when CALLED, never at import). They MUST be\n// on the Node surface: every wrapper barrel re-exports `AparteUi`, which value-imports\n// these two — omit them here and any SSR toolchain resolving the `node` condition\n// crashes the whole barrel with \"does not provide an export named 'applyElementProps'\".\nexport { applyElementProps, APARTE_DEFAULT_UI_EVENTS } from './interop/element-props.js';\n// Same rule: DOM-free at import (it only reaches for `URL.createObjectURL` when\n// CALLED, which is a browser-side concern), so it belongs on the SSR surface too.\nexport { filesToAttachments, revokeAttachmentUrls } from './utils/files-to-attachments.js';\n\n/*\n * The global type augmentations, which only the BROWSER entry pulled in.\n *\n * TypeScript applies the `node` export condition under `moduleResolution: node16`\n * / `nodenext`, so a consumer in that mode resolves `index.node.d.ts` — and\n * silently lost typed `e.detail` on every aparté event and typed\n * `querySelector('aparte-…')`. Not a runtime concern and not an SSR hazard: both\n * modules are `import type` throughout, so nothing is emitted and no DOM global is\n * touched. `check:node-barrel-types` diffed export NAMES, which an augmentation\n * has none of, so it saw nothing.\n */\nimport './types/event-map.js';\nimport './types/element-map.js';\n// Is a message waiting for a reply? Shared by the viewport, the four wrappers and\n// any consumer rendering its own bubble — one rule, so they can't disagree.\nexport { isAwaitingReply } from './utils/is-awaiting-reply.js';\nexport { escapeHtml, escapeAttr } from './utils/escape.js';\n// Same reasoning as the browser barrel: the gate script and the customization\n// guide both tell a renderer author to use `cssEscape` for a selector, so it has to\n// be importable. It touches no DOM, so the SSR barrel carries it too.\nexport { cssEscape } from './utils/css-escape.js';\nexport { uuid } from './utils/uuid.js';\n// The PARAMETER types of two documented setters. They existed and were the declared\n// argument types, but were not exported — so anyone typing a settings layer over\n// `setHostHandlers` / `setKeyProvider` had to re-declare the shape by hand.\nexport type { AparteHostHandlersConfig } from './types/models.js';\nexport type { AparteKeyProvider } from './config/aparte-config.js';\n\n// Elicitation (human-in-the-loop typed input) — DOM-free at import.\nexport { requestUserInput, buildElicitationPanel } from './elicitation/index.js';\nexport type {\n AparteElicitationSchema,\n AparteElicitationField,\n AparteElicitationEnumField,\n AparteElicitationBooleanField,\n AparteElicitationStringField,\n AparteElicitationObjectSchema,\n AparteElicitationRequest,\n AparteElicitationResult,\n AparteElicitationPresenter,\n BuiltElicitationPanel,\n} from './elicitation/index.js';\n\n/**\n * No-op on the server: custom elements only exist in the browser, where the\n * real `index.ts` registers them at import time. Wrappers can call this\n * unconditionally without a `typeof window` guard.\n */\nexport function registerAllComponents(): void {\n /* browser-only — nothing to register without a DOM */\n}\n"],"names":[],"mappings":";AAyQO,SAAS,wBAA8B;AAE9C;"}
|
|
1
|
+
{"version":3,"file":"index.node.js","sources":["../src/index.node.ts"],"sourcesContent":["/**\n * @aparte/core — Node.js / SSR-safe entry point.\n *\n * Resolved via the `node` export condition, so `import '@aparte/core'` in Node\n * (Next.js / Nuxt / Angular Universal / SvelteKit server, tsx, CLI tools) loads\n * THIS module instead of the browser entry. It exposes the same public API\n * surface MINUS the Web Components and CSS side-effects — importing the real\n * `index.ts` in Node throws `HTMLElement is not defined` because the custom\n * elements extend `HTMLElement` at module scope.\n *\n * Everything re-exported here is DOM-free at import time. Custom-element CLASSES\n * (AparteChatBubble, AparteComposer*, AparteSelect, …) are intentionally NOT exported\n * as runtime values — they only exist in the browser build. Their TYPES are\n * re-exported (types are erased, so they never pull DOM at runtime), which keeps\n * TypeScript consumers fully typed on the server; `registerAllComponents()` is a\n * no-op here (there is nothing to register without a DOM).\n */\n\n// ── Types (erased at runtime — always safe, mirror index.ts) ────────────────\nexport type {\n AparteBubbleRole,\n AparteMessage,\n AparteContentParser,\n AparteSendEventDetail,\n AparteViewportConfig,\n AparteInputConfig,\n AparteThemeVariables,\n AparteStatus,\n AparteAttachment,\n AparteMessageBranch,\n AparteBubbleActionsConfig,\n AparteBubbleActionName,\n AparteSegment,\n AparteSegmentType,\n AparteTextSegment,\n AparteThinkingSegment,\n AparteCodeSegment,\n AparteTerminalSegment,\n AparteSegmentRenderer,\n AparteCustomSegment,\n AparteToolCallSegment,\n AparteArtifactSegment,\n // The detail of the `aparte-segment-update` event. It reached types/index.ts and\n // stopped there — and types/index.ts is not an entry point, so a consumer could\n // bind the event (it is in the published event table) and never name its detail.\n AparteSegmentUpdateEventDetail,\n AparteAIProvider,\n AparteAIModel,\n AparteAIProviderConfigField,\n AparteAIProviderConfigSchema,\n AparteModelConfig,\n ModelStatus,\n ModelLoadProgress,\n AparteModelChangeEventDetail,\n AparteMessageDoneEventDetail,\n AparteMessageStartEventDetail,\n AparteMessageErrorEventDetail,\n AparteMessageAbortedEventDetail,\n AparteAbortEventDetail,\n AparteCompactEventDetail,\n AparteCompactDoneEventDetail,\n AparteCompactErrorEventDetail,\n AparteAttachmentPreviewEventDetail,\n AparteTerminalRunEventDetail,\n AparteFileGenReadyEventDetail,\n AparteFileGenErrorEventDetail,\n AparteMessageInfoEventDetail,\n AparteSiblingInfo,\n AparteBranchNavigateEventDetail,\n ApartePathChangedEventDetail,\n AparteRetryEventDetail,\n AparteEditEventDetail,\n AparteFeedbackEventDetail,\n AparteActionEventDetail,\n AparteArtifactStartEventDetail,\n AparteArtifactDeltaEventDetail,\n AparteArtifactReadyEventDetail,\n AparteArtifactRedownloadEventDetail,\n AparteChatRequest,\n AparteChatResponse,\n AparteChatMessage,\n AparteContentPart,\n AparteTextPart,\n AparteImagePart,\n AparteFilePart,\n AparteStreamEvent,\n AparteStreamEventMap,\n AparteUsage,\n AparteTool,\n AparteToolCall,\n AparteToolResult,\n AparteToolHandler,\n AparteToolContext,\n AparteToolRenderer,\n AparteToolDecisionDetail,\n AparteToolApprovalRequestDetail,\n AparteChatImperativeApi,\n} from './types/index.js';\nexport { AparteErrorCode, AparteError, contentToText } from './types/index.js';\n\n// Custom-element TYPES (erased) — keep server consumers fully typed.\nexport type { AparteSelectChangeDetail, AparteOptgroupToggleEventDetail } from './primitives/index.js';\nexport type { SyncableBubble, AparteComposerEventMap, AparteComposerEventType, AparteComposerState, AparteComposerChangeEventDetail, AparteActionClickEventDetail } from './components/index.js';\nexport type { AparteConversationListItem, AparteConversationSelectDetail, AparteConversationDeleteDetail, AparteConversationArchiveDetail } from './components/index.js';\n\n// ── Renderers (produce HTML strings; DOM-free at import) ────────────────────\nexport {\n registerSegmentRenderer,\n unregisterSegmentRenderer,\n getSegmentRenderer,\n collectRendererStyles,\n registerDefaultRenderers,\n installDefaultRenderersOnce,\n declineDefaultRenderers,\n getAllRenderers,\n} from './renderers/index.js';\n\n// `populateBubbleFromMessage` is a plain helper — import it from its own module,\n// NOT the components barrel (which would pull in the HTMLElement classes).\nexport { populateBubbleFromMessage } from './components/bubble/bubble-sync.js';\n\n// ── Conversations (types, adapter contract, manager, controller) ────────────\nexport type {\n AparteConversation,\n AparteConversationMeta,\n AparteStorageAdapter,\n AparteMemoryFact,\n AparteArtifactRow,\n AparteAttachmentRow,\n} from './conversations/index.js';\nexport { APARTE_CONVERSATION_SCHEMA_VERSION } from './conversations/index.js';\nexport { AparteConversationManager, type ConversationManagerOptions } from './conversations/index.js';\nexport {\n AparteConversationController,\n type AparteChatBinding,\n type AparteConversationControllerOptions,\n} from './conversations/index.js';\n\n// ── Framework-agnostic chat-host orchestrator (every wrapper binds to it) ───\nexport {\n AparteChatHost,\n type AparteChatHostBinding,\n type AparteChatHostOptions,\n} from './host/index.js';\n\n// ── Parsers ─────────────────────────────────────────────────────────────────\nexport { AparteStreamParser, parseMarkdownToSegments, deriveArtifactKind, parseAparteEventStream } from './parsers/index.js';\nexport type { AparteStreamParserOptions, AparteThinkingDelimiterPair, AparteParserState, AparteParserResult } from './parsers/index.js';\n\n// Transport seam — DOM-free (fetch-based), so the whole seam is SSR-safe. The\n// server-side `/api/chat` handler AND both client transports live here; a browser\n// never runs the handler, and the transports touch no DOM at import. Mirrored in\n// full so a wrapper barrel re-exporting a transport can't crash under SSR.\nexport { AparteDirectTransport, AparteBackendTransport, createAparteChatHandler, isFormatAdapter } from './transport/index.js';\nexport type {\n AparteTransport,\n AparteTransportContext,\n AparteFormatAdapter,\n AparteVendorRequest,\n BackendTransportOptions,\n DirectTransportOptions,\n AparteChatHandlerOptions,\n} from './transport/index.js';\n\n// ── Config ──────────────────────────────────────────────────────────────────\nexport { aparteGlobalConfig, AparteConfig, APARTE_DEFAULT_BUBBLE_ACTIONS, APARTE_DEFAULT_HOST_HANDLERS } from './config/index.js';\nexport type { AparteConfigChangeEventDetail } from './config/index.js';\nexport { resolveConfig, attachConfig, detachConfig, runWithConfig, contextConfig, APARTE_HOST_ATTR } from './config/index.js';\nexport type { AparteConfigAware } from './config/index.js';\nexport type {\n AparteMarkdownProvider,\n AparteStreamingMarkdownProvider,\n AparteStreamingMarkdownRenderer,\n AparteHighlightProvider,\n AparteSystemPromptVarsProvider,\n AparteSkeletonProvider,\n AparteSkeletonType,\n AparteLocale,\n AparteAction,\n AparteActionZone,\n AparteIconProvider,\n AparteIconName,\n AparteAvatarProvider,\n AparteStatusRenderer,\n AparteErrorRenderer,\n AparteAttachmentRenderer,\n AparteElicitationFieldRenderer,\n AparteElicitationFieldContext,\n AparteElicitationFieldControl,\n AparteSiblingNavRenderer,\n AparteBubbleShellRenderer,\n AparteModelPreference,\n AparteModelPreferenceProvider,\n AparteArtifactPreviewBuilder,\n AparteSanitizer,\n} from './config/index.js';\nexport { APARTE_DEFAULT_ICON_FALLBACKS, APARTE_DEFAULT_SKELETON_FALLBACKS, APARTE_DEFAULT_LOCALE, defaultSanitizer, isSafeUrl } from './config/index.js';\n\n// ── Client + runtime ─────────────────────────────────────────────────────────\nexport { AparteClient } from './client/aparte-client.js';\nexport type { AparteClientOptions, AparteToolApprovalResolver, AparteCompactionSelector } from './client/aparte-client.js';\nexport { createStreamAdapter, readableToAsyncIterable } from './client/stream-adapter.js';\nexport type { AparteStreamRunEvent, AparteStreamRunEmitter, StreamAdapterTarget, CreateStreamAdapterOptions, AparteStreamRunner, AparteStreamRunOptions } from './client/stream-adapter.js';\nexport { AparteMessageRepository } from './runtime/message-repository.js';\nexport type { ExportedMessageRepository } from './runtime/message-repository.js';\n\n// ── Wrapper interop (DOM-free helpers the four wrappers' AparteUi value-imports) ─\n// `applyElementProps`/`APARTE_DEFAULT_UI_EVENTS` are pure (a string array + a function that\n// only touches its `HTMLElement` argument when CALLED, never at import). They MUST be\n// on the Node surface: every wrapper barrel re-exports `AparteUi`, which value-imports\n// these two — omit them here and any SSR toolchain resolving the `node` condition\n// crashes the whole barrel with \"does not provide an export named 'applyElementProps'\".\nexport { applyElementProps, APARTE_DEFAULT_UI_EVENTS } from './interop/element-props.js';\n// Same rule: DOM-free at import (it only reaches for `URL.createObjectURL` when\n// CALLED, which is a browser-side concern), so it belongs on the SSR surface too.\nexport { filesToAttachments, revokeAttachmentUrls } from './utils/files-to-attachments.js';\n\n/*\n * The global type augmentations, which only the BROWSER entry pulled in.\n *\n * TypeScript applies the `node` export condition under `moduleResolution: node16`\n * / `nodenext`, so a consumer in that mode resolves `index.node.d.ts` — and\n * silently lost typed `e.detail` on every aparté event and typed\n * `querySelector('aparte-…')`. Not a runtime concern and not an SSR hazard: both\n * modules are `import type` throughout, so nothing is emitted and no DOM global is\n * touched. `check:node-barrel-types` diffed export NAMES, which an augmentation\n * has none of, so it saw nothing.\n */\nimport './types/event-map.js';\nimport './types/element-map.js';\n// Is a message waiting for a reply? Shared by the viewport, the four wrappers and\n// any consumer rendering its own bubble — one rule, so they can't disagree.\nexport { isAwaitingReply } from './utils/is-awaiting-reply.js';\nexport { escapeHtml, escapeAttr } from './utils/escape.js';\n// Same reasoning as the browser barrel: the gate script and the customization\n// guide both tell a renderer author to use `cssEscape` for a selector, so it has to\n// be importable. It touches no DOM, so the SSR barrel carries it too.\nexport { cssEscape } from './utils/css-escape.js';\nexport { uuid } from './utils/uuid.js';\n// Pure and DOM-free, so the SSR barrel carries it too — and that is the point: a\n// consumer can assert their own duration logic in Node, with no browser.\nexport { isSegmentSettled, segmentDuration } from './utils/segments.js';\n// The PARAMETER types of two documented setters. They existed and were the declared\n// argument types, but were not exported — so anyone typing a settings layer over\n// `setHostHandlers` / `setKeyProvider` had to re-declare the shape by hand.\nexport type { AparteHostHandlersConfig } from './types/models.js';\nexport type { AparteKeyProvider } from './config/aparte-config.js';\n\n// Elicitation (human-in-the-loop typed input) — DOM-free at import.\nexport { requestUserInput, buildElicitationPanel } from './elicitation/index.js';\nexport type {\n AparteElicitationSchema,\n AparteElicitationField,\n AparteElicitationEnumField,\n AparteElicitationBooleanField,\n AparteElicitationStringField,\n AparteElicitationObjectSchema,\n AparteElicitationRequest,\n AparteElicitationResult,\n AparteElicitationPresenter,\n BuiltElicitationPanel,\n} from './elicitation/index.js';\n\n/**\n * No-op on the server: custom elements only exist in the browser, where the\n * real `index.ts` registers them at import time. Wrappers can call this\n * unconditionally without a `typeof window` guard.\n */\nexport function registerAllComponents(): void {\n /* browser-only — nothing to register without a DOM */\n}\n"],"names":[],"mappings":";AA4QO,SAAS,wBAA8B;AAE9C;"}
|
|
@@ -103,6 +103,31 @@ export declare class AparteStreamParser {
|
|
|
103
103
|
private _parseArtifactMode;
|
|
104
104
|
private _createInitialState;
|
|
105
105
|
private _generateId;
|
|
106
|
+
/**
|
|
107
|
+
* Mark a segment the parser has just CLOSED.
|
|
108
|
+
*
|
|
109
|
+
* The end of a delimited segment is not a guess: the closing token IS the end.
|
|
110
|
+
* `</think>`, a closing fence, `</artifact>` — and, for a text run, the opening
|
|
111
|
+
* of whatever comes next. The parser computes that moment at six sites and used
|
|
112
|
+
* to drop it, emitting the finished segment with no flag saying so.
|
|
113
|
+
*
|
|
114
|
+
* What that cost: nothing downstream could tell a finished reasoning block from
|
|
115
|
+
* one still streaming, so the only remaining signal was the END OF THE TURN. A
|
|
116
|
+
* reader watched "Thinking" for as long as the answer took to stream — twenty
|
|
117
|
+
* seconds after the model had stopped thinking — and the Markdown flush and the
|
|
118
|
+
* highlight-on-settle waited exactly as long. Two workarounds were written
|
|
119
|
+
* before this one: close at the end of the message (wrong value), and close when
|
|
120
|
+
* the next segment opens (right value, wrong moment, and no help for a reply
|
|
121
|
+
* that is reasoning and nothing else).
|
|
122
|
+
*
|
|
123
|
+
* Both agent loops share this parser, so saying it here says it once.
|
|
124
|
+
*
|
|
125
|
+
* Not every end is in band, and the exceptions are honest: a text run that ends
|
|
126
|
+
* only because the STREAM ended has no delimiter — `finalize()` is its truth —
|
|
127
|
+
* and a `tool_call` never passes through here at all, since its end is its
|
|
128
|
+
* `status`.
|
|
129
|
+
*/
|
|
130
|
+
private _closed;
|
|
106
131
|
private _createTextSegment;
|
|
107
132
|
private _createCodeSegment;
|
|
108
133
|
private _createThinkingSegment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aparte-stream-parser.d.ts","sourceRoot":"","sources":["../../src/parsers/aparte-stream-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACR,aAAa,EAKhB,MAAM,mBAAmB,CAAC;AAO3B,iEAAiE;AACjE,MAAM,WAAW,2BAA2B;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACtC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,2BAA2B,GAAG,2BAA2B,EAAE,CAAC;IACjF,gDAAgD;IAChD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,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2B,CAAC,MAAM,GAAE,YAA8B,GAAG,IAAI,CASxF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,YAA8B,GAAG,IAAI,CAEpG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,YAA8B,GACvC,qBAAqB,GAAG,SAAS,CAEnC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,YAA8B,GAAG,SAAS,qBAAqB,EAAE,CAExG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,GAAE,YAA8B,GAAG,MAAM,CAKpF;AAoBD,wBAAgB,oBAAoB,CAAC,MAAM,GAAE,YAA8B,GAAG,IAAI,CAwBjF;AAqDD,wBAAgB,wBAAwB,CAAC,MAAM,GAAE,YAA8B,GAAG,IAAI,CAkBrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../src/renderers/segments/code.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACR,qBAAqB,EACrB,iBAAiB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,YAAY,EAAE,qBAAqB,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../src/renderers/segments/code.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACR,qBAAqB,EACrB,iBAAiB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,YAAY,EAAE,qBAAqB,CAAC,iBAAiB,CAkFjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../src/renderers/segments/terminal.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACR,qBAAqB,EACrB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../src/renderers/segments/terminal.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACR,qBAAqB,EACrB,qBAAqB,EAExB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,gBAAgB,EAAE,qBAAqB,CAAC,qBAAqB,CAiEzE,CAAC"}
|
package/dist/types/events.d.ts
CHANGED
|
@@ -382,11 +382,17 @@ export interface AparteAttachmentPreviewEventDetail {
|
|
|
382
382
|
* @event aparte-terminal-run
|
|
383
383
|
*/
|
|
384
384
|
export interface AparteTerminalRunEventDetail {
|
|
385
|
+
/** Owning segment id. */
|
|
386
|
+
segmentId: string;
|
|
385
387
|
/**
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
+
* Id of the message the terminal belongs to.
|
|
389
|
+
*
|
|
390
|
+
* Without it this event was not resolvable: a consumer knew a command was
|
|
391
|
+
* asked for and could not say which turn asked. Absent only when the segment
|
|
392
|
+
* reached the renderer without passing through `addSegment` (an app rendering
|
|
393
|
+
* a segment it built by hand), because core stamps identity exactly there.
|
|
388
394
|
*/
|
|
389
|
-
|
|
395
|
+
messageId?: string;
|
|
390
396
|
/** The command text the user asked to run. */
|
|
391
397
|
command: string;
|
|
392
398
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IAClC,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAEhB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,yEAAyE;IACzE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AACH,MAAM,WAAW,6BAA6B;IAC1C,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;CACjB;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,kCAAkC;IAC/C,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IACzC,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,6BAA6B;IAC1C,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,MAAM,EAAE,UAAU,GAAG,WAAW,CAAC;IACjC,sEAAsE;IACtE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC1C,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/types/segments.d.ts
CHANGED
|
@@ -10,6 +10,38 @@ export interface AparteSegmentBase {
|
|
|
10
10
|
type: string;
|
|
11
11
|
/** Whether segment is currently being streamed */
|
|
12
12
|
isStreaming?: boolean;
|
|
13
|
+
/** Id of the message this segment belongs to. Stamped on insertion. */
|
|
14
|
+
messageId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Position in the owning message's `segments[]`, maintained across
|
|
17
|
+
* insertions and removals.
|
|
18
|
+
*/
|
|
19
|
+
index?: number;
|
|
20
|
+
/** Epoch ms when the segment entered the transcript. */
|
|
21
|
+
startedAt?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Epoch ms when content last arrived on this segment.
|
|
24
|
+
*
|
|
25
|
+
* It ADVANCES while the segment streams and freezes when the segment settles,
|
|
26
|
+
* so `endedAt - startedAt` is a live duration during a turn and a final one
|
|
27
|
+
* after it — ask `isSegmentSettled(segment)` which you are looking at. Core
|
|
28
|
+
* never renders either.
|
|
29
|
+
*
|
|
30
|
+
* Why not simply "when it finished": the two obvious rules are both wrong, and
|
|
31
|
+
* measurably. Closing at the end of the turn makes a reasoning block span the
|
|
32
|
+
* whole answer that followed it (2s of thinking before a 20s reply reads
|
|
33
|
+
* "22s"). Closing when the next segment opens is the same error, smaller — a
|
|
34
|
+
* gap of ten seconds before the next segment is counted as thinking, while the
|
|
35
|
+
* person watching knows nothing happened. The last delta is the only moment
|
|
36
|
+
* the segment itself can vouch for.
|
|
37
|
+
*/
|
|
38
|
+
endedAt?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Extras only the producer of the segment can know — token counts, cost,
|
|
41
|
+
* compute device. Core writes nothing here: fill it from an app with
|
|
42
|
+
* `updateSegment(segmentId, { meta })`. Mirrors `AparteMessage.metadata`.
|
|
43
|
+
*/
|
|
44
|
+
meta?: Record<string, unknown>;
|
|
13
45
|
}
|
|
14
46
|
/** Text segment - plain text content */
|
|
15
47
|
export interface AparteTextSegment extends AparteSegmentBase {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/types/segments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAC9B,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAA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IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a segment knows about itself — stamped in one place.
|
|
3
|
+
*
|
|
4
|
+
* A segment carried `id`, `type` and `isStreaming` and nothing else, while the
|
|
5
|
+
* message one level up already had a `timestamp`, a `usage` and a `metadata` bag.
|
|
6
|
+
* Three places in this repo paid for the gap: `render(segment)` takes one argument
|
|
7
|
+
* so a custom renderer could not learn its message, `aparte-terminal-run` shipped a
|
|
8
|
+
* `segmentId` nobody could resolve, and the artifact renderer fabricated a message
|
|
9
|
+
* id to slip past a consumer dedupe keyed on a pair it did not have.
|
|
10
|
+
*
|
|
11
|
+
* **Why the stamp lives here and not in `AparteStreamParser`.** The parser looked
|
|
12
|
+
* like the right owner — both agent loops share it, so parity would be free. It is
|
|
13
|
+
* the wrong one. `tool_call` segments are built by the client and the stream
|
|
14
|
+
* adapter (three sites), `pipeline-waiting` by two more, and `prefixSegments` by the
|
|
15
|
+
* app itself: stamping in the parser would have left a TOOL CALL — the single most
|
|
16
|
+
* useful duration in the whole transcript — with no measurement at all. Worse, the
|
|
17
|
+
* parser's own `segmentCounter` would have produced a wrong index: it is recreated
|
|
18
|
+
* on every `turn-start`, while a tool round-trip appends to the SAME message across
|
|
19
|
+
* turns, so one message would hold two segments at index 0, silently.
|
|
20
|
+
*
|
|
21
|
+
* A segment can only reach a transcript one way — through `addSegment` — and there
|
|
22
|
+
* are exactly two owners of the array behind it: `aparte-chat-viewport` (native) and
|
|
23
|
+
* `aparte-chat-host` (framework-managed). Both call these functions; nothing else
|
|
24
|
+
* writes those fields. `pnpm check:segment-stamp` keeps it that way, because two
|
|
25
|
+
* owners is exactly the shape of the forgotten-sibling bug this repo keeps finding.
|
|
26
|
+
*
|
|
27
|
+
* Everything here is pure and DOM-free, so a consumer can test their own wiring in
|
|
28
|
+
* Node — the introspectability half of the reachability rule.
|
|
29
|
+
*/
|
|
30
|
+
import type { AparteSegment } from '../types/index.js';
|
|
31
|
+
/**
|
|
32
|
+
* Stamp identity and start time on a segment joining `segments` at the tail.
|
|
33
|
+
*
|
|
34
|
+
* Returns a new object; the caller's segment is never mutated — the viewport hands
|
|
35
|
+
* the same segment object to the repository AND to the bubble, so mutating one is
|
|
36
|
+
* action at a distance (a bug this repo has already paid for in `appendToSegment`).
|
|
37
|
+
*
|
|
38
|
+
* A value already present is never overwritten, so a segment rehydrated from a
|
|
39
|
+
* consumer's storage keeps the numbers it was persisted with.
|
|
40
|
+
*/
|
|
41
|
+
export declare function stampSegmentOnInsert(segments: readonly AparteSegment[], segment: AparteSegment, messageId: string): AparteSegment;
|
|
42
|
+
/**
|
|
43
|
+
* Has this segment settled? The trigger for `endedAt`.
|
|
44
|
+
*
|
|
45
|
+
* Exported on purpose: a consumer rendering its own "thought for 8 s" line needs
|
|
46
|
+
* the same predicate, and a rule buried inside a component method is a rule that
|
|
47
|
+
* gets re-derived slightly differently somewhere else.
|
|
48
|
+
*
|
|
49
|
+
* A segment with no streaming flag at all is NOT settled. That is deliberate: a
|
|
50
|
+
* reply that arrived whole never had a span to measure, and stamping an `endedAt`
|
|
51
|
+
* equal to its `startedAt` would dress a zero up as a measurement.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isSegmentSettled(segment: AparteSegment): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Move `endedAt` to now while the segment is open; freeze it once it settles.
|
|
56
|
+
*
|
|
57
|
+
* `endedAt` is **the moment content last arrived**, and that is the only honest
|
|
58
|
+
* signal available. Two simpler rules were tried and are wrong, both measurably:
|
|
59
|
+
*
|
|
60
|
+
* - *"ends when the turn ends"* — a reasoning block would then span the whole
|
|
61
|
+
* answer that followed it. 2s of thinking before a 20s reply reads "22s". A
|
|
62
|
+
* mocked stream hides this (it moves from reasoning to text in milliseconds); a
|
|
63
|
+
* real model does not.
|
|
64
|
+
* - *"ends when the next segment starts"* — the same error, smaller: if the next
|
|
65
|
+
* segment opens ten seconds later, those ten seconds are counted as thinking,
|
|
66
|
+
* while the person watching the screen knows perfectly well nothing happened.
|
|
67
|
+
*
|
|
68
|
+
* So every update nudges it forward, and the settling update keeps whatever the
|
|
69
|
+
* last delta left rather than stamping its own arrival time. A segment that settles
|
|
70
|
+
* having never received an update gets its end then — nothing else is knowable
|
|
71
|
+
* about it.
|
|
72
|
+
*
|
|
73
|
+
* The consequence, stated because it is a contract: `endedAt` is present WHILE a
|
|
74
|
+
* segment streams, and `endedAt - startedAt` is a live duration that grows. Ask
|
|
75
|
+
* {@link isSegmentSettled} whether it is final. That is also what a UI wants — the
|
|
76
|
+
* counter that ticks while a model reasons is the same number, read earlier.
|
|
77
|
+
*/
|
|
78
|
+
export declare function stampSegmentOnUpdate(segment: AparteSegment, updates: Partial<AparteSegment>): Partial<AparteSegment>;
|
|
79
|
+
/**
|
|
80
|
+
* How long this segment took, or `undefined` when that is not knowable yet.
|
|
81
|
+
*
|
|
82
|
+
* The five identity/measurement fields are optional because they describe a
|
|
83
|
+
* LIFECYCLE: a segment built by hand or freshly emitted by the parser has not been
|
|
84
|
+
* inserted yet, so it has no start, and an open segment has no end. Making them
|
|
85
|
+
* required would either force every creation site to stamp — six of them, which is
|
|
86
|
+
* the forgotten-sibling shape this seam exists to prevent — or force a hand-written
|
|
87
|
+
* literal to invent values the owner then refuses to overwrite.
|
|
88
|
+
*
|
|
89
|
+
* The cost of that optionality lands on the reader, and this is what removes it. The
|
|
90
|
+
* guard it replaces was written three times in this repo before it earned a function:
|
|
91
|
+
*
|
|
92
|
+
* if (!isSegmentSettled(seg) || !seg.startedAt || !seg.endedAt) return;
|
|
93
|
+
*
|
|
94
|
+
* — three conditions to get right, and the last two are wrong at epoch 0, where a
|
|
95
|
+
* valid timestamp is falsy. Nobody streams in 1970, but the test suite sets the clock
|
|
96
|
+
* to 0 routinely, so the trap was already in the repo waiting for its first victim.
|
|
97
|
+
*
|
|
98
|
+
* It deliberately does NOT ask whether the segment is finished: during a turn a
|
|
99
|
+
* growing duration is exactly what a "thinking…" counter shows. Pair it with
|
|
100
|
+
* {@link isSegmentSettled} when you need the final number.
|
|
101
|
+
*/
|
|
102
|
+
export declare function segmentDuration(segment: AparteSegment): number | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* The patch that records "content just arrived on this segment".
|
|
105
|
+
*
|
|
106
|
+
* The append paths do not go through {@link stampSegmentOnUpdate} — they rebuild
|
|
107
|
+
* the segment themselves, for reasons that predate this (the viewport must not
|
|
108
|
+
* mutate an object the bubble shares; the host coalesces a frame's chunks into one
|
|
109
|
+
* absolute write). They still have to move `endedAt`, because content arriving IS
|
|
110
|
+
* the activity it measures. So they spread this in, and the rule stays in one file
|
|
111
|
+
* — which is not a style preference: `pnpm check:segment-stamp` refused the two
|
|
112
|
+
* inline `endedAt: Date.now()` this replaced, and it was right to.
|
|
113
|
+
*
|
|
114
|
+
* Empty once the segment has settled, so a late write cannot move a final end.
|
|
115
|
+
*/
|
|
116
|
+
export declare function stampSegmentActivity(segment: AparteSegment): {
|
|
117
|
+
endedAt?: number;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* The update that forwards a parser-emitted segment's content — carrying the fact
|
|
121
|
+
* that it CLOSED, when it did.
|
|
122
|
+
*
|
|
123
|
+
* The parser marks the segments it closes (`</think>`, a closing fence,
|
|
124
|
+
* `</artifact>`, the opening of the next block). That mark reached nobody: every
|
|
125
|
+
* forwarding site sent `{ content }` alone, so a finished segment arrived at the
|
|
126
|
+
* owner looking exactly like a streaming one. The end then had to be inferred from
|
|
127
|
+
* the end of the TURN, which is what kept a reasoning block reading "Thinking" for
|
|
128
|
+
* as long as the answer took to stream.
|
|
129
|
+
*
|
|
130
|
+
* Five sites forward this way across the two agent loops, which is four too many to
|
|
131
|
+
* patch by hand — that is how the same rule ends up spelled three different ways.
|
|
132
|
+
*/
|
|
133
|
+
export declare function segmentContentUpdate(segment: AparteSegment): Partial<AparteSegment>;
|
|
134
|
+
/**
|
|
135
|
+
* Statuses that mean the turn is over, whatever the outcome.
|
|
136
|
+
*
|
|
137
|
+
* `error` and `aborted` count: a stopped stream still produced what it produced,
|
|
138
|
+
* and refusing to close its segments would leave every one of them measuring
|
|
139
|
+
* forever. `undefined` does NOT count — a message with no status yet has not
|
|
140
|
+
* finished, and treating "unknown" as "done" would end a segment on its first
|
|
141
|
+
* render.
|
|
142
|
+
*/
|
|
143
|
+
export declare function isTerminalStatus(status: string | null | undefined): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Ids of the segments a finished turn still has to close.
|
|
146
|
+
*
|
|
147
|
+
* Where `endedAt` comes from for everything that is not a tool call. Nothing in the
|
|
148
|
+
* stream says "this thinking block is over": the parser closes its active segment
|
|
149
|
+
* silently, and both agent loops report the end on the MESSAGE
|
|
150
|
+
* (`updateMessage({ status: 'completed' })`). So the message's end is the segments'
|
|
151
|
+
* end, and this says which ones are still waiting for it.
|
|
152
|
+
*
|
|
153
|
+
* It returns ids rather than settling the array itself, and that is the point. The
|
|
154
|
+
* first version did mutate in place — and the browser proved it half-broken: the
|
|
155
|
+
* model gained its `endedAt` while the RENDERER never learned the segment had
|
|
156
|
+
* settled, because a silent mutation notifies nobody. Routing each close through
|
|
157
|
+
* the owner's own `updateSegment` gives one path that stamps the model AND repaints
|
|
158
|
+
* the bubble, which is also the path `update()` and the incremental Markdown flush
|
|
159
|
+
* already depend on.
|
|
160
|
+
*
|
|
161
|
+
* Already-closed segments are skipped, so reporting a turn finished twice — a
|
|
162
|
+
* re-render, a branch switch, a reloaded conversation — cannot move an end.
|
|
163
|
+
*/
|
|
164
|
+
export declare function openSegmentIds(segments: readonly AparteSegment[]): string[];
|
|
165
|
+
/**
|
|
166
|
+
* Close the gap a removal left, in place.
|
|
167
|
+
*
|
|
168
|
+
* The single place `index` is maintained after the array changes shape. Entries are
|
|
169
|
+
* REPLACED rather than mutated, for the same shared-object reason as
|
|
170
|
+
* {@link stampSegmentOnInsert}; a segment already at its correct position is left
|
|
171
|
+
* alone, so a renumber after an append-only sequence allocates nothing.
|
|
172
|
+
*/
|
|
173
|
+
export declare function renumberSegments(segments: AparteSegment[]): void;
|
|
174
|
+
//# sourceMappingURL=segments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/utils/segments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA6BvD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,MAAM,GAClB,aAAa,CAOf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAGhE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAChC,OAAO,CAAC,aAAa,CAAC,CAaxB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAI1E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAEjF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAMnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE3E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,EAAE,CAE3E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,CAMhE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aparte/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "High-performance AI conversation engine - Zero-dependency Web Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"//sideEffects": "The BROWSER entry defines the custom elements and imports CSS at module scope, so it must never be tree-shaken; the Node entry (`index.node`) and every other module are pure. Listing them explicitly is what lets a bundler drop the rest — the whole package was implicitly side-effectful before, the only one of the 14 without this field.",
|