@brixel_ai/artifact-sdk 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -104,24 +104,6 @@ if (import.meta.env.DEV) {
104
104
  }
105
105
  ```
106
106
 
107
- ### Mock Host for Testing
108
-
109
- ```tsx
110
- import { createMockBrixelHost } from "@brixel_ai/artifact-sdk";
111
-
112
- const host = createMockBrixelHost({
113
- onComplete: (output) => console.debug("Completed:", output),
114
- onCancel: (reason) => console.debug("Cancelled:", reason),
115
- onResize: (height) => console.debug("Resize:", height),
116
- });
117
-
118
- // Send init
119
- host.init({ title: "Test" });
120
-
121
- // Later: cleanup
122
- host.destroy();
123
- ```
124
-
125
107
  ## Render Modes
126
108
 
127
109
  ### Display Mode
package/dist/index.d.mts CHANGED
@@ -373,10 +373,6 @@ declare function createGetFileContent(contextAuth?: {
373
373
  *
374
374
  * These utilities help simulate the Brixel host environment during development
375
375
  */
376
- /**
377
- * Default mock context for development
378
- */
379
- declare const mockContext: BrixelContext;
380
376
  /**
381
377
  * Simulate the Brixel host sending an INIT message
382
378
  *
@@ -413,40 +409,5 @@ declare function simulateBrixelInit<TInputs = unknown>(inputs: TInputs, options?
413
409
  * ```
414
410
  */
415
411
  declare function listenToUITaskMessages(callback: (message: unknown) => void): () => void;
416
- /**
417
- * Create a mock Brixel host for development
418
- *
419
- * @example
420
- * ```tsx
421
- * const host = createMockBrixelHost({
422
- * onComplete: (output) => console.debug("Completed:", output),
423
- * onCancel: (reason) => console.debug("Cancelled:", reason),
424
- * });
425
- *
426
- * // Send init
427
- * host.init({ title: "Test" });
428
- *
429
- * // Cleanup
430
- * host.destroy();
431
- * ```
432
- */
433
- declare function createMockBrixelHost<TInputs = unknown, TOutput = unknown>(options: {
434
- onReady?: (version: string) => void;
435
- onComplete?: (output: TOutput) => void;
436
- onCancel?: (reason?: string) => void;
437
- onResize?: (height: number | "auto") => void;
438
- onLog?: (level: string, message: string, data?: unknown) => void;
439
- onError?: (error: {
440
- code: string;
441
- message: string;
442
- details?: unknown;
443
- }) => void;
444
- }): {
445
- init(inputs: TInputs, runId?: string, renderMode?: RenderMode): void;
446
- updateInputs(inputs: Partial<TInputs>): void;
447
- destroy(): void;
448
- updateTheme(theme: BrixelContext["theme"]): void;
449
- updateLocale(locale: string): void;
450
- };
451
412
 
452
- export { type ArtifactManifest, type BrixelContext, type CancelMessage, type CompleteMessage, type DestroyMessage, type ErrorMessage, type ExecuteTaskParams, type ExecuteTaskResponse, type FileContentData, type GetFileContentParams, type GetFileContentResponse, type HostToIframeMessage, type IframeToHostMessage, type InitMessage, type InternalFileMimeType, type InternalFilePublicOut, type LogMessage, type ReadyMessage, type RenderMode, type ResizeMessage, type TaskStatus, type UpdateInputsMessage, type UpdateLocaleMessage, type UpdateThemeMessage, type UploadFileParams, type UploadFileResponse, type UseBrixelTaskOptions, type UseBrixelTaskResult, createExecuteTask, createGetFileContent, createMockBrixelHost, createUploadFile, executeTask, getFileContent, listenToUITaskMessages, mockContext, simulateBrixelInit, uploadFile, useBrixelArtifact };
413
+ export { type ArtifactManifest, type BrixelContext, type CancelMessage, type CompleteMessage, type DestroyMessage, type ErrorMessage, type ExecuteTaskParams, type ExecuteTaskResponse, type FileContentData, type GetFileContentParams, type GetFileContentResponse, type HostToIframeMessage, type IframeToHostMessage, type InitMessage, type InternalFileMimeType, type InternalFilePublicOut, type LogMessage, type ReadyMessage, type RenderMode, type ResizeMessage, type TaskStatus, type UpdateInputsMessage, type UpdateLocaleMessage, type UpdateThemeMessage, type UploadFileParams, type UploadFileResponse, type UseBrixelTaskOptions, type UseBrixelTaskResult, createExecuteTask, createGetFileContent, createUploadFile, executeTask, getFileContent, listenToUITaskMessages, simulateBrixelInit, uploadFile, useBrixelArtifact };
package/dist/index.d.ts CHANGED
@@ -373,10 +373,6 @@ declare function createGetFileContent(contextAuth?: {
373
373
  *
374
374
  * These utilities help simulate the Brixel host environment during development
375
375
  */
376
- /**
377
- * Default mock context for development
378
- */
379
- declare const mockContext: BrixelContext;
380
376
  /**
381
377
  * Simulate the Brixel host sending an INIT message
382
378
  *
@@ -413,40 +409,5 @@ declare function simulateBrixelInit<TInputs = unknown>(inputs: TInputs, options?
413
409
  * ```
414
410
  */
415
411
  declare function listenToUITaskMessages(callback: (message: unknown) => void): () => void;
416
- /**
417
- * Create a mock Brixel host for development
418
- *
419
- * @example
420
- * ```tsx
421
- * const host = createMockBrixelHost({
422
- * onComplete: (output) => console.debug("Completed:", output),
423
- * onCancel: (reason) => console.debug("Cancelled:", reason),
424
- * });
425
- *
426
- * // Send init
427
- * host.init({ title: "Test" });
428
- *
429
- * // Cleanup
430
- * host.destroy();
431
- * ```
432
- */
433
- declare function createMockBrixelHost<TInputs = unknown, TOutput = unknown>(options: {
434
- onReady?: (version: string) => void;
435
- onComplete?: (output: TOutput) => void;
436
- onCancel?: (reason?: string) => void;
437
- onResize?: (height: number | "auto") => void;
438
- onLog?: (level: string, message: string, data?: unknown) => void;
439
- onError?: (error: {
440
- code: string;
441
- message: string;
442
- details?: unknown;
443
- }) => void;
444
- }): {
445
- init(inputs: TInputs, runId?: string, renderMode?: RenderMode): void;
446
- updateInputs(inputs: Partial<TInputs>): void;
447
- destroy(): void;
448
- updateTheme(theme: BrixelContext["theme"]): void;
449
- updateLocale(locale: string): void;
450
- };
451
412
 
452
- export { type ArtifactManifest, type BrixelContext, type CancelMessage, type CompleteMessage, type DestroyMessage, type ErrorMessage, type ExecuteTaskParams, type ExecuteTaskResponse, type FileContentData, type GetFileContentParams, type GetFileContentResponse, type HostToIframeMessage, type IframeToHostMessage, type InitMessage, type InternalFileMimeType, type InternalFilePublicOut, type LogMessage, type ReadyMessage, type RenderMode, type ResizeMessage, type TaskStatus, type UpdateInputsMessage, type UpdateLocaleMessage, type UpdateThemeMessage, type UploadFileParams, type UploadFileResponse, type UseBrixelTaskOptions, type UseBrixelTaskResult, createExecuteTask, createGetFileContent, createMockBrixelHost, createUploadFile, executeTask, getFileContent, listenToUITaskMessages, mockContext, simulateBrixelInit, uploadFile, useBrixelArtifact };
413
+ export { type ArtifactManifest, type BrixelContext, type CancelMessage, type CompleteMessage, type DestroyMessage, type ErrorMessage, type ExecuteTaskParams, type ExecuteTaskResponse, type FileContentData, type GetFileContentParams, type GetFileContentResponse, type HostToIframeMessage, type IframeToHostMessage, type InitMessage, type InternalFileMimeType, type InternalFilePublicOut, type LogMessage, type ReadyMessage, type RenderMode, type ResizeMessage, type TaskStatus, type UpdateInputsMessage, type UpdateLocaleMessage, type UpdateThemeMessage, type UploadFileParams, type UploadFileResponse, type UseBrixelTaskOptions, type UseBrixelTaskResult, createExecuteTask, createGetFileContent, createUploadFile, executeTask, getFileContent, listenToUITaskMessages, simulateBrixelInit, uploadFile, useBrixelArtifact };
package/dist/index.js CHANGED
@@ -22,12 +22,10 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  createExecuteTask: () => createExecuteTask,
24
24
  createGetFileContent: () => createGetFileContent,
25
- createMockBrixelHost: () => createMockBrixelHost,
26
25
  createUploadFile: () => createUploadFile,
27
26
  executeTask: () => executeTask,
28
27
  getFileContent: () => getFileContent,
29
28
  listenToUITaskMessages: () => listenToUITaskMessages,
30
- mockContext: () => mockContext,
31
29
  simulateBrixelInit: () => simulateBrixelInit,
32
30
  uploadFile: () => uploadFile,
33
31
  useBrixelArtifact: () => useBrixelArtifact
@@ -524,15 +522,6 @@ function useBrixelArtifact(options = {}) {
524
522
  }
525
523
 
526
524
  // src/devTools.ts
527
- var mockContext = {
528
- runId: "dev-run-001",
529
- stepId: "dev-step-001",
530
- userId: "dev-user-001",
531
- organizationId: "dev-org-001",
532
- theme: "light",
533
- locale: "en-US",
534
- conversationId: "dev-conversation-001"
535
- };
536
525
  function simulateBrixelInit(inputs, options = {}) {
537
526
  const { runId = "dev-run-001", renderMode = "interaction", context = {}, delay = 100 } = options;
538
527
  const message = {
@@ -540,7 +529,7 @@ function simulateBrixelInit(inputs, options = {}) {
540
529
  payload: {
541
530
  runId,
542
531
  inputs,
543
- context: { ...mockContext, ...context, runId },
532
+ context: { ...context, runId },
544
533
  renderMode
545
534
  }
546
535
  };
@@ -561,97 +550,14 @@ function listenToUITaskMessages(callback) {
561
550
  window.removeEventListener("message", handleMessage);
562
551
  };
563
552
  }
564
- function createMockBrixelHost(options) {
565
- const { onReady, onComplete, onCancel, onResize, onLog, onError } = options;
566
- let currentRunId = null;
567
- const postMessage = (message) => window.postMessage(message, "*");
568
- const getRunIdOrWarn = (action) => {
569
- if (!currentRunId) {
570
- console.warn(`[MockHost] Cannot ${action} - no active run`);
571
- return null;
572
- }
573
- return currentRunId;
574
- };
575
- const handleMessage = (event) => {
576
- const message = event.data;
577
- if (!message || typeof message !== "object" || !message.type?.startsWith("BRIXEL_")) {
578
- return;
579
- }
580
- switch (message.type) {
581
- case "BRIXEL_READY":
582
- onReady?.(message.payload?.version);
583
- break;
584
- case "BRIXEL_COMPLETE":
585
- onComplete?.(message.payload?.output);
586
- break;
587
- case "BRIXEL_CANCEL":
588
- onCancel?.(message.payload?.reason);
589
- break;
590
- case "BRIXEL_RESIZE":
591
- onResize?.(message.payload?.height);
592
- break;
593
- case "BRIXEL_LOG":
594
- onLog?.(message.payload?.level, message.payload?.message, message.payload?.data);
595
- break;
596
- case "BRIXEL_ERROR":
597
- onError?.(message.payload?.error);
598
- break;
599
- }
600
- };
601
- window.addEventListener("message", handleMessage);
602
- return {
603
- init(inputs, runId = "mock-run-001", renderMode = "interaction") {
604
- currentRunId = runId;
605
- postMessage({
606
- type: "BRIXEL_INIT",
607
- payload: {
608
- runId,
609
- inputs,
610
- context: { ...mockContext, runId },
611
- renderMode
612
- }
613
- });
614
- },
615
- updateInputs(inputs) {
616
- const runId = getRunIdOrWarn("update inputs");
617
- if (!runId) {
618
- return;
619
- }
620
- postMessage({ type: "BRIXEL_UPDATE_INPUTS", payload: { runId, inputs } });
621
- },
622
- destroy() {
623
- if (currentRunId) {
624
- postMessage({ type: "BRIXEL_DESTROY", payload: { runId: currentRunId } });
625
- }
626
- window.removeEventListener("message", handleMessage);
627
- currentRunId = null;
628
- },
629
- updateTheme(theme) {
630
- const runId = getRunIdOrWarn("update theme");
631
- if (!runId) {
632
- return;
633
- }
634
- postMessage({ type: "BRIXEL_UPDATE_THEME", payload: { runId, theme } });
635
- },
636
- updateLocale(locale) {
637
- const runId = getRunIdOrWarn("update locale");
638
- if (!runId) {
639
- return;
640
- }
641
- postMessage({ type: "BRIXEL_UPDATE_LOCALE", payload: { runId, locale } });
642
- }
643
- };
644
- }
645
553
  // Annotate the CommonJS export names for ESM import in node:
646
554
  0 && (module.exports = {
647
555
  createExecuteTask,
648
556
  createGetFileContent,
649
- createMockBrixelHost,
650
557
  createUploadFile,
651
558
  executeTask,
652
559
  getFileContent,
653
560
  listenToUITaskMessages,
654
- mockContext,
655
561
  simulateBrixelInit,
656
562
  uploadFile,
657
563
  useBrixelArtifact
package/dist/index.mjs CHANGED
@@ -488,15 +488,6 @@ function useBrixelArtifact(options = {}) {
488
488
  }
489
489
 
490
490
  // src/devTools.ts
491
- var mockContext = {
492
- runId: "dev-run-001",
493
- stepId: "dev-step-001",
494
- userId: "dev-user-001",
495
- organizationId: "dev-org-001",
496
- theme: "light",
497
- locale: "en-US",
498
- conversationId: "dev-conversation-001"
499
- };
500
491
  function simulateBrixelInit(inputs, options = {}) {
501
492
  const { runId = "dev-run-001", renderMode = "interaction", context = {}, delay = 100 } = options;
502
493
  const message = {
@@ -504,7 +495,7 @@ function simulateBrixelInit(inputs, options = {}) {
504
495
  payload: {
505
496
  runId,
506
497
  inputs,
507
- context: { ...mockContext, ...context, runId },
498
+ context: { ...context, runId },
508
499
  renderMode
509
500
  }
510
501
  };
@@ -525,96 +516,13 @@ function listenToUITaskMessages(callback) {
525
516
  window.removeEventListener("message", handleMessage);
526
517
  };
527
518
  }
528
- function createMockBrixelHost(options) {
529
- const { onReady, onComplete, onCancel, onResize, onLog, onError } = options;
530
- let currentRunId = null;
531
- const postMessage = (message) => window.postMessage(message, "*");
532
- const getRunIdOrWarn = (action) => {
533
- if (!currentRunId) {
534
- console.warn(`[MockHost] Cannot ${action} - no active run`);
535
- return null;
536
- }
537
- return currentRunId;
538
- };
539
- const handleMessage = (event) => {
540
- const message = event.data;
541
- if (!message || typeof message !== "object" || !message.type?.startsWith("BRIXEL_")) {
542
- return;
543
- }
544
- switch (message.type) {
545
- case "BRIXEL_READY":
546
- onReady?.(message.payload?.version);
547
- break;
548
- case "BRIXEL_COMPLETE":
549
- onComplete?.(message.payload?.output);
550
- break;
551
- case "BRIXEL_CANCEL":
552
- onCancel?.(message.payload?.reason);
553
- break;
554
- case "BRIXEL_RESIZE":
555
- onResize?.(message.payload?.height);
556
- break;
557
- case "BRIXEL_LOG":
558
- onLog?.(message.payload?.level, message.payload?.message, message.payload?.data);
559
- break;
560
- case "BRIXEL_ERROR":
561
- onError?.(message.payload?.error);
562
- break;
563
- }
564
- };
565
- window.addEventListener("message", handleMessage);
566
- return {
567
- init(inputs, runId = "mock-run-001", renderMode = "interaction") {
568
- currentRunId = runId;
569
- postMessage({
570
- type: "BRIXEL_INIT",
571
- payload: {
572
- runId,
573
- inputs,
574
- context: { ...mockContext, runId },
575
- renderMode
576
- }
577
- });
578
- },
579
- updateInputs(inputs) {
580
- const runId = getRunIdOrWarn("update inputs");
581
- if (!runId) {
582
- return;
583
- }
584
- postMessage({ type: "BRIXEL_UPDATE_INPUTS", payload: { runId, inputs } });
585
- },
586
- destroy() {
587
- if (currentRunId) {
588
- postMessage({ type: "BRIXEL_DESTROY", payload: { runId: currentRunId } });
589
- }
590
- window.removeEventListener("message", handleMessage);
591
- currentRunId = null;
592
- },
593
- updateTheme(theme) {
594
- const runId = getRunIdOrWarn("update theme");
595
- if (!runId) {
596
- return;
597
- }
598
- postMessage({ type: "BRIXEL_UPDATE_THEME", payload: { runId, theme } });
599
- },
600
- updateLocale(locale) {
601
- const runId = getRunIdOrWarn("update locale");
602
- if (!runId) {
603
- return;
604
- }
605
- postMessage({ type: "BRIXEL_UPDATE_LOCALE", payload: { runId, locale } });
606
- }
607
- };
608
- }
609
519
  export {
610
520
  createExecuteTask,
611
521
  createGetFileContent,
612
- createMockBrixelHost,
613
522
  createUploadFile,
614
523
  executeTask,
615
524
  getFileContent,
616
525
  listenToUITaskMessages,
617
- mockContext,
618
526
  simulateBrixelInit,
619
527
  uploadFile,
620
528
  useBrixelArtifact
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brixel_ai/artifact-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "SDK for building Brixel Artifacts - interactive React components that integrate with Brixel workflows",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",