@aparte/plugin-artifacts 0.16.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.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Record `id`'s last-seen time in a bounded, insertion-ordered map.
3
+ *
4
+ * Shared with the artifact's event-dispatch throttle, which is why it is generic
5
+ * over the map rather than closing over one.
6
+ */
7
+ export declare function markThrottle(map: Map<string, number>, id: string, at: number): void;
8
+ /**
9
+ * Paint `content` into `paneSelector` while it streams.
10
+ *
11
+ * Call it on every token: the cheap half runs every time, the highlight is
12
+ * throttled internally. The caller still runs one final, whole-content highlight
13
+ * when the segment settles — this function deliberately never colours the last
14
+ * line, so the settle pass is what completes it.
15
+ */
16
+ export declare function streamHighlight(element: HTMLElement, paneSelector: string, content: string, lang: string, segId: string): void;
17
+ //# sourceMappingURL=highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../src/highlight.ts"],"names":[],"mappings":"AAqCA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAOnF;AAQD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC3B,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACd,IAAI,CA6CN"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @aparte/plugin-artifacts
3
+ *
4
+ * An artifact is a document the model produces — a page, a component, a script, a
5
+ * spreadsheet — and nothing a model does by nature: it is a convention an app teaches
6
+ * it. This package is that convention, end to end, for aparté:
7
+ *
8
+ * - a real `create_artifact` **tool** the model calls (`./tool.ts`), whose structured
9
+ * result is the document;
10
+ * - a **tool renderer** that draws that result as the Code/Preview card;
11
+ * - the `<artifact …>…</artifact>` **block grammar**, for a model that writes one in
12
+ * its prose, registered on core's parser (`registerStreamBlock`);
13
+ * - the **segment renderer** for the segment that grammar produces — the same card.
14
+ *
15
+ * One implementation, four registrations, all made by `setupArtifacts()`.
16
+ *
17
+ * Usage:
18
+ * import { setupArtifacts } from '@aparte/plugin-artifacts';
19
+ * setupArtifacts();
20
+ */
21
+ import { type AparteConfig } from '@aparte/core';
22
+ import { type ArtifactsSetupOptions } from './options.js';
23
+ /**
24
+ * Register the tool, its renderer, the block grammar and the segment renderer on
25
+ * `config` (the global config by default). Call once at application startup;
26
+ * returns a function that unregisters all four.
27
+ */
28
+ export declare function setupArtifacts(options?: ArtifactsSetupOptions, config?: AparteConfig): () => void;
29
+ export { createArtifactTool, artifactHandler, ARTIFACT_SYSTEM_PROMPT } from './tool.js';
30
+ export type { ArtifactToolOptions } from './tool.js';
31
+ export { artifactRenderer } from './card.js';
32
+ export type { AparteArtifactSegment } from './card.js';
33
+ export { artifactBlock, artifactSegment, artifactFromToolCall, ARTIFACT_TAG, ARTIFACT_SEGMENT_TYPE } from './segment.js';
34
+ export type { ArtifactSegment, ArtifactInput } from './segment.js';
35
+ export { deriveArtifactKind } from './kinds.js';
36
+ export { buildSafePreviewDocument, PREVIEW_CSP } from './preview-document.js';
37
+ export type { ArtifactRenderOptions, ArtifactPreviewBuilder, ArtifactBinary, ArtifactBinaryResolver, ArtifactsSetupOptions } from './options.js';
38
+ export type { AparteTool, AparteToolHandler, AparteToolCall, AparteToolResult } from '@aparte/core';
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAA0E,KAAK,YAAY,EAA2B,MAAM,cAAc,CAAC;AAIlJ,OAAO,EAAwC,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEhG;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,EAAE,MAAM,GAAE,YAAiC,GAAG,MAAM,IAAI,CA4BzH;AAED,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxF,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACzH,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9E,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,cAAc,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACjJ,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}