@percena/weft 0.4.0-next.7 → 0.4.0-next.9

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/chat.cjs CHANGED
@@ -7114,7 +7114,7 @@ var InProcessEventSource = class {
7114
7114
  }
7115
7115
  };
7116
7116
 
7117
- // ../packages/local-chat/dist/index.js
7117
+ // ../packages/chat/dist/index.js
7118
7118
  var import_react18 = require("react");
7119
7119
  var import_react19 = require("react");
7120
7120
 
@@ -7136,7 +7136,7 @@ function timelineKey(item) {
7136
7136
  return `${item.epoch}:${item.seq}`;
7137
7137
  }
7138
7138
 
7139
- // ../packages/local-chat/dist/index.js
7139
+ // ../packages/chat/dist/index.js
7140
7140
  var import_jsx_runtime39 = require("react/jsx-runtime");
7141
7141
  var import_react20 = require("react");
7142
7142
  var import_jsx_runtime40 = require("react/jsx-runtime");
package/dist/chat.d.cts CHANGED
@@ -4678,170 +4678,3 @@ declare function selectRuntimeCandidate(options: RuntimeSelectionOptions): Runti
4678
4678
  declare function createRuntimeCapabilityReport(options: CreateRuntimeCapabilityReportOptions): RuntimeCapabilityReport;
4679
4679
 
4680
4680
  export { type AgentCommandSink, type AgentEventStream, type AgentRuntime, type AgentRuntimeKind, type AgentRuntimeOptions, type AgentRuntimeState, type AgentRuntimeStatus, type AgentTimelineStream, type BrowserActionReceipt, type BrowserActionRequest, type CodexPermissionParams, type CommandOrigin, type CommandReceipt, type CreateRuntimeCapabilityReportOptions, type CreateSkillRequest, type CreateSkillResult, type CreateSourceRequest, type CreateSourceResult, type DeleteSkillRequest, type DeleteSkillResult, type DeleteSourceRequest, type DeleteSourceResult, type GetAutomationsConfigRequest, type GetAutomationsConfigResult, type GetSkillRequest, type GetSkillResult, type GetSourceRequest, type GetSourceResult, type InterSessionMessageRequest, type InvokeSessionToolOptions, type ListSchedulesRequest, type ListSchedulesResult, type ListSkillsRequest, type ListSkillsResult, type ListSourcesRequest, type ListSourcesResult, type LlmToolRequest, type LlmToolResult, type ProviderAuthDetection, type ProviderAuthMode, type ProviderSourceCredentialRef, type ProviderSourceToolDescriptor, RUNTIME_KINDS, type RuntimeAction, type RuntimeAuthDetection, type RuntimeAutomationCapabilities, type RuntimeCandidate, type RuntimeCapabilityReport, type RuntimeExtensionCapabilities, type RuntimeExtensionContext, type RuntimeFeatureCapabilities, type RuntimeHostServices, type RuntimeHostToolCapabilities, type RuntimePermissionScope, type RuntimePermissionScopeInput, type RuntimePolicyCapabilities, type RuntimePolicyExtension, type RuntimePolicyHook, type RuntimeSelection, type RuntimeSelectionOptions, type RuntimeSkillCapabilities, type RuntimeSourceCapabilities, type RuntimeToolIntent, type ScheduleSummary, type SendMessageOptions, type SessionListRequest, type SessionListResult, type SessionMetadataPatch, type SessionMetadataSnapshot, type SessionToolBridge, type SessionToolInvocationReceipt, type SessionToolName, type SessionToolRequest, type SessionToolTimelineRef, type SkillSelection, type SkillSummary, type SourceActivationReceipt, type SourceActivationRequest, type SourceAuthReceipt, type SourceAuthRequest, type SourceSelection, type SourceSummary, type SpawnSessionReceipt, type SpawnSessionRequest, type StartScheduleRequest, type StartScheduleResult, type StopScheduleRequest, type StopScheduleResult, type SubmitPlanReceipt, type SubmitPlanRequest, type ToolPolicyDecision, type ToolPolicyRequest, type UpdateAutomationsConfigRequest, type UpdateAutomationsConfigResult, type UpdateSkillRequest, type UpdateSkillResult, type UpdateSourceRequest, type UpdateSourceResult, createRuntimeCapabilityReport, createRuntimeExtensionContext, initialRuntimeState, invokeSessionTool, mapCodexSandboxModeToSandboxPolicy, mapPermissionModeToCodexParams, reduceRuntimeState, sanitizeProviderSourceTools, selectRuntimeCandidate };
4681
-
4682
- // ── inlined from @weft/local-chat ──
4683
- // -- @weft/local-chat/index.d.ts --
4684
- import * as react_jsx_runtime from 'react/jsx-runtime';
4685
-
4686
- interface LocalChatAuthDetection {
4687
- provider: string;
4688
- configured: boolean;
4689
- source?: string;
4690
- error?: string;
4691
- }
4692
- interface LocalChatRuntimeState {
4693
- status: 'idle' | 'preflighting' | 'running' | 'ready' | 'failed' | string;
4694
- }
4695
- interface LocalChatEventSource {
4696
- connect(onEvent: (event: AgentEvent) => void, onError?: (error: Error) => void, onClose?: () => void): void;
4697
- disconnect(): void;
4698
- isConnected(): boolean;
4699
- }
4700
- interface LocalChatCommandSink {
4701
- sendMessage(message: string): Promise<void>;
4702
- abort(reason?: string): Promise<void>;
4703
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4704
- }
4705
- interface LocalChatSessionRuntime {
4706
- sessionId: string;
4707
- provider: string;
4708
- events: LocalChatEventSource;
4709
- commands: LocalChatCommandSink;
4710
- preflight(): Promise<LocalChatAuthDetection>;
4711
- getState(): LocalChatRuntimeState;
4712
- }
4713
- interface AgentChatSessionModel {
4714
- session: Session | null;
4715
- turns: Turn[];
4716
- isRunning: boolean;
4717
- auth: LocalChatAuthDetection | null;
4718
- error: Error | null;
4719
- sendMessage(message: string): Promise<void>;
4720
- abort(): Promise<void>;
4721
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4722
- }
4723
- interface UseAgentChatSessionOptions {
4724
- runtime: LocalChatSessionRuntime;
4725
- workspaceId?: string;
4726
- workspaceName?: string;
4727
- }
4728
- interface TimelineChatPanelModel {
4729
- session: Session;
4730
- turns: Turn[];
4731
- }
4732
- type TimelineDetailKind = 'permission' | 'runtime' | 'source' | 'skill' | 'automation' | 'host' | 'tool';
4733
- interface TimelineDetailItem {
4734
- id: string;
4735
- kind: TimelineDetailKind;
4736
- title: string;
4737
- summary?: string;
4738
- status?: string;
4739
- timestamp: number;
4740
- detail: unknown;
4741
- envelope: TimelineEnvelope;
4742
- }
4743
- interface TimelineAgentChatSessionModel extends TimelineChatPanelModel {
4744
- timeline: TimelineEnvelope[];
4745
- isRunning: boolean;
4746
- isConnected: boolean;
4747
- isReconnecting: boolean;
4748
- hasGap: boolean;
4749
- capabilityReport: RuntimeCapabilityReport | null;
4750
- error: Error | null;
4751
- sendMessage(message: string, options?: SendMessageOptions): Promise<void>;
4752
- abort(): Promise<void>;
4753
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4754
- }
4755
- interface UseTimelineAgentChatSessionOptions {
4756
- runtime: AgentRuntime;
4757
- workspaceId?: string;
4758
- workspaceName?: string;
4759
- }
4760
- declare function createAgentChatPanelModel(args: {
4761
- session: Session | null;
4762
- runtime: LocalChatSessionRuntime;
4763
- auth?: LocalChatAuthDetection | null;
4764
- error?: Error | null;
4765
- }): Pick<AgentChatSessionModel, 'turns' | 'isRunning' | 'auth' | 'error'>;
4766
- declare function createAgentChatPanelModelFromTimeline(args: {
4767
- timeline: TimelineEnvelope[];
4768
- sessionId: string;
4769
- workspaceId: string;
4770
- workspaceName?: string;
4771
- }): TimelineChatPanelModel;
4772
- declare function createTimelineAgentChatPanelModel(args: {
4773
- timeline: TimelineEnvelope[];
4774
- sessionId: string;
4775
- workspaceId: string;
4776
- workspaceName?: string;
4777
- runtimeState: AgentRuntimeState;
4778
- capabilityReport: RuntimeCapabilityReport | null;
4779
- error: Error | null;
4780
- }): Pick<TimelineAgentChatSessionModel, 'session' | 'turns' | 'isRunning' | 'capabilityReport' | 'error'>;
4781
- declare function createTimelineDetailItems(timeline: TimelineEnvelope[]): TimelineDetailItem[];
4782
- declare function useAgentChatSession(options: UseAgentChatSessionOptions): AgentChatSessionModel;
4783
- declare function useTimelineAgentChatSession(options: UseTimelineAgentChatSessionOptions): TimelineAgentChatSessionModel;
4784
-
4785
- interface AgentChatPanelProps {
4786
- runtime: LocalChatSessionRuntime;
4787
- workspaceId?: string;
4788
- workspaceName?: string;
4789
- platformActions?: PlatformActions;
4790
- placeholder?: string;
4791
- className?: string;
4792
- }
4793
- declare function AgentChatPanel({ runtime, workspaceId, workspaceName, platformActions, placeholder, className, }: AgentChatPanelProps): react_jsx_runtime.JSX.Element;
4794
-
4795
- interface TimelineAgentChatPanelProps {
4796
- /** Agent runtime instance from runtime-core */
4797
- runtime: AgentRuntime;
4798
- /** Workspace identifier */
4799
- workspaceId?: string;
4800
- /** Workspace display name */
4801
- workspaceName?: string;
4802
- /** Platform actions for file/URL handling */
4803
- platformActions?: PlatformActions;
4804
- /** Placeholder text for the input area */
4805
- placeholder?: string;
4806
- /** Whether to show the runtime status bar */
4807
- showStatusBar?: boolean;
4808
- /** Whether to show the runtime detail sidebar panel */
4809
- showDetailPanel?: boolean;
4810
- /** Additional className */
4811
- className?: string;
4812
- }
4813
- declare function TimelineAgentChatPanel({ runtime, workspaceId, workspaceName, platformActions, placeholder, showStatusBar, showDetailPanel, className, }: TimelineAgentChatPanelProps): react_jsx_runtime.JSX.Element;
4814
-
4815
- /**
4816
- * Find the active (unresolved) permission request from timeline envelopes.
4817
- *
4818
- * Walks the timeline backwards to find the most recent permission_requested
4819
- * envelope that has not been resolved by a matching permission_resolved.
4820
- */
4821
- declare function findActivePermissionRequest(timeline: TimelineEnvelope[]): {
4822
- requestId: string;
4823
- toolName: string;
4824
- input?: Record<string, unknown>;
4825
- reason?: string;
4826
- scope?: {
4827
- type: string;
4828
- label?: string;
4829
- };
4830
- } | null;
4831
-
4832
- /**
4833
- * Convert a processor Session (returned by useAgentChatSession) into a
4834
- * StoredSession that SessionViewer can render.
4835
- *
4836
- * Consumers embedding AgentChatPanel don't need this — it's called internally.
4837
- * This utility is exported for consumers who use useAgentChatSession directly
4838
- * and build their own panel around SessionViewer.
4839
- */
4840
- declare function toStoredSession(session: Session, fallbackWorkspaceId?: string): StoredSession;
4841
- /**
4842
- * Build an empty StoredSession placeholder for the initial state
4843
- * before the event processor has received any events.
4844
- */
4845
- declare function createEmptyStoredSession(sessionId: string, workspaceId?: string, workspaceName?: string): StoredSession;
4846
-
4847
- export { AgentChatPanel, type AgentChatPanelProps, type AgentChatSessionModel, type LocalChatAuthDetection, type LocalChatCommandSink, type LocalChatEventSource, type LocalChatRuntimeState, type LocalChatSessionRuntime, TimelineAgentChatPanel, type TimelineAgentChatPanelProps, type TimelineAgentChatSessionModel, type TimelineChatPanelModel, type TimelineDetailItem, type TimelineDetailKind, type UseAgentChatSessionOptions, type UseTimelineAgentChatSessionOptions, createAgentChatPanelModel, createAgentChatPanelModelFromTimeline, createEmptyStoredSession, createTimelineAgentChatPanelModel, createTimelineDetailItems, findActivePermissionRequest, toStoredSession, useAgentChatSession, useTimelineAgentChatSession };
package/dist/chat.d.ts CHANGED
@@ -4678,170 +4678,3 @@ declare function selectRuntimeCandidate(options: RuntimeSelectionOptions): Runti
4678
4678
  declare function createRuntimeCapabilityReport(options: CreateRuntimeCapabilityReportOptions): RuntimeCapabilityReport;
4679
4679
 
4680
4680
  export { type AgentCommandSink, type AgentEventStream, type AgentRuntime, type AgentRuntimeKind, type AgentRuntimeOptions, type AgentRuntimeState, type AgentRuntimeStatus, type AgentTimelineStream, type BrowserActionReceipt, type BrowserActionRequest, type CodexPermissionParams, type CommandOrigin, type CommandReceipt, type CreateRuntimeCapabilityReportOptions, type CreateSkillRequest, type CreateSkillResult, type CreateSourceRequest, type CreateSourceResult, type DeleteSkillRequest, type DeleteSkillResult, type DeleteSourceRequest, type DeleteSourceResult, type GetAutomationsConfigRequest, type GetAutomationsConfigResult, type GetSkillRequest, type GetSkillResult, type GetSourceRequest, type GetSourceResult, type InterSessionMessageRequest, type InvokeSessionToolOptions, type ListSchedulesRequest, type ListSchedulesResult, type ListSkillsRequest, type ListSkillsResult, type ListSourcesRequest, type ListSourcesResult, type LlmToolRequest, type LlmToolResult, type ProviderAuthDetection, type ProviderAuthMode, type ProviderSourceCredentialRef, type ProviderSourceToolDescriptor, RUNTIME_KINDS, type RuntimeAction, type RuntimeAuthDetection, type RuntimeAutomationCapabilities, type RuntimeCandidate, type RuntimeCapabilityReport, type RuntimeExtensionCapabilities, type RuntimeExtensionContext, type RuntimeFeatureCapabilities, type RuntimeHostServices, type RuntimeHostToolCapabilities, type RuntimePermissionScope, type RuntimePermissionScopeInput, type RuntimePolicyCapabilities, type RuntimePolicyExtension, type RuntimePolicyHook, type RuntimeSelection, type RuntimeSelectionOptions, type RuntimeSkillCapabilities, type RuntimeSourceCapabilities, type RuntimeToolIntent, type ScheduleSummary, type SendMessageOptions, type SessionListRequest, type SessionListResult, type SessionMetadataPatch, type SessionMetadataSnapshot, type SessionToolBridge, type SessionToolInvocationReceipt, type SessionToolName, type SessionToolRequest, type SessionToolTimelineRef, type SkillSelection, type SkillSummary, type SourceActivationReceipt, type SourceActivationRequest, type SourceAuthReceipt, type SourceAuthRequest, type SourceSelection, type SourceSummary, type SpawnSessionReceipt, type SpawnSessionRequest, type StartScheduleRequest, type StartScheduleResult, type StopScheduleRequest, type StopScheduleResult, type SubmitPlanReceipt, type SubmitPlanRequest, type ToolPolicyDecision, type ToolPolicyRequest, type UpdateAutomationsConfigRequest, type UpdateAutomationsConfigResult, type UpdateSkillRequest, type UpdateSkillResult, type UpdateSourceRequest, type UpdateSourceResult, createRuntimeCapabilityReport, createRuntimeExtensionContext, initialRuntimeState, invokeSessionTool, mapCodexSandboxModeToSandboxPolicy, mapPermissionModeToCodexParams, reduceRuntimeState, sanitizeProviderSourceTools, selectRuntimeCandidate };
4681
-
4682
- // ── inlined from @weft/local-chat ──
4683
- // -- @weft/local-chat/index.d.ts --
4684
- import * as react_jsx_runtime from 'react/jsx-runtime';
4685
-
4686
- interface LocalChatAuthDetection {
4687
- provider: string;
4688
- configured: boolean;
4689
- source?: string;
4690
- error?: string;
4691
- }
4692
- interface LocalChatRuntimeState {
4693
- status: 'idle' | 'preflighting' | 'running' | 'ready' | 'failed' | string;
4694
- }
4695
- interface LocalChatEventSource {
4696
- connect(onEvent: (event: AgentEvent) => void, onError?: (error: Error) => void, onClose?: () => void): void;
4697
- disconnect(): void;
4698
- isConnected(): boolean;
4699
- }
4700
- interface LocalChatCommandSink {
4701
- sendMessage(message: string): Promise<void>;
4702
- abort(reason?: string): Promise<void>;
4703
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4704
- }
4705
- interface LocalChatSessionRuntime {
4706
- sessionId: string;
4707
- provider: string;
4708
- events: LocalChatEventSource;
4709
- commands: LocalChatCommandSink;
4710
- preflight(): Promise<LocalChatAuthDetection>;
4711
- getState(): LocalChatRuntimeState;
4712
- }
4713
- interface AgentChatSessionModel {
4714
- session: Session | null;
4715
- turns: Turn[];
4716
- isRunning: boolean;
4717
- auth: LocalChatAuthDetection | null;
4718
- error: Error | null;
4719
- sendMessage(message: string): Promise<void>;
4720
- abort(): Promise<void>;
4721
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4722
- }
4723
- interface UseAgentChatSessionOptions {
4724
- runtime: LocalChatSessionRuntime;
4725
- workspaceId?: string;
4726
- workspaceName?: string;
4727
- }
4728
- interface TimelineChatPanelModel {
4729
- session: Session;
4730
- turns: Turn[];
4731
- }
4732
- type TimelineDetailKind = 'permission' | 'runtime' | 'source' | 'skill' | 'automation' | 'host' | 'tool';
4733
- interface TimelineDetailItem {
4734
- id: string;
4735
- kind: TimelineDetailKind;
4736
- title: string;
4737
- summary?: string;
4738
- status?: string;
4739
- timestamp: number;
4740
- detail: unknown;
4741
- envelope: TimelineEnvelope;
4742
- }
4743
- interface TimelineAgentChatSessionModel extends TimelineChatPanelModel {
4744
- timeline: TimelineEnvelope[];
4745
- isRunning: boolean;
4746
- isConnected: boolean;
4747
- isReconnecting: boolean;
4748
- hasGap: boolean;
4749
- capabilityReport: RuntimeCapabilityReport | null;
4750
- error: Error | null;
4751
- sendMessage(message: string, options?: SendMessageOptions): Promise<void>;
4752
- abort(): Promise<void>;
4753
- respondToPermission(requestId: string, allowed: boolean, remember?: boolean): Promise<void>;
4754
- }
4755
- interface UseTimelineAgentChatSessionOptions {
4756
- runtime: AgentRuntime;
4757
- workspaceId?: string;
4758
- workspaceName?: string;
4759
- }
4760
- declare function createAgentChatPanelModel(args: {
4761
- session: Session | null;
4762
- runtime: LocalChatSessionRuntime;
4763
- auth?: LocalChatAuthDetection | null;
4764
- error?: Error | null;
4765
- }): Pick<AgentChatSessionModel, 'turns' | 'isRunning' | 'auth' | 'error'>;
4766
- declare function createAgentChatPanelModelFromTimeline(args: {
4767
- timeline: TimelineEnvelope[];
4768
- sessionId: string;
4769
- workspaceId: string;
4770
- workspaceName?: string;
4771
- }): TimelineChatPanelModel;
4772
- declare function createTimelineAgentChatPanelModel(args: {
4773
- timeline: TimelineEnvelope[];
4774
- sessionId: string;
4775
- workspaceId: string;
4776
- workspaceName?: string;
4777
- runtimeState: AgentRuntimeState;
4778
- capabilityReport: RuntimeCapabilityReport | null;
4779
- error: Error | null;
4780
- }): Pick<TimelineAgentChatSessionModel, 'session' | 'turns' | 'isRunning' | 'capabilityReport' | 'error'>;
4781
- declare function createTimelineDetailItems(timeline: TimelineEnvelope[]): TimelineDetailItem[];
4782
- declare function useAgentChatSession(options: UseAgentChatSessionOptions): AgentChatSessionModel;
4783
- declare function useTimelineAgentChatSession(options: UseTimelineAgentChatSessionOptions): TimelineAgentChatSessionModel;
4784
-
4785
- interface AgentChatPanelProps {
4786
- runtime: LocalChatSessionRuntime;
4787
- workspaceId?: string;
4788
- workspaceName?: string;
4789
- platformActions?: PlatformActions;
4790
- placeholder?: string;
4791
- className?: string;
4792
- }
4793
- declare function AgentChatPanel({ runtime, workspaceId, workspaceName, platformActions, placeholder, className, }: AgentChatPanelProps): react_jsx_runtime.JSX.Element;
4794
-
4795
- interface TimelineAgentChatPanelProps {
4796
- /** Agent runtime instance from runtime-core */
4797
- runtime: AgentRuntime;
4798
- /** Workspace identifier */
4799
- workspaceId?: string;
4800
- /** Workspace display name */
4801
- workspaceName?: string;
4802
- /** Platform actions for file/URL handling */
4803
- platformActions?: PlatformActions;
4804
- /** Placeholder text for the input area */
4805
- placeholder?: string;
4806
- /** Whether to show the runtime status bar */
4807
- showStatusBar?: boolean;
4808
- /** Whether to show the runtime detail sidebar panel */
4809
- showDetailPanel?: boolean;
4810
- /** Additional className */
4811
- className?: string;
4812
- }
4813
- declare function TimelineAgentChatPanel({ runtime, workspaceId, workspaceName, platformActions, placeholder, showStatusBar, showDetailPanel, className, }: TimelineAgentChatPanelProps): react_jsx_runtime.JSX.Element;
4814
-
4815
- /**
4816
- * Find the active (unresolved) permission request from timeline envelopes.
4817
- *
4818
- * Walks the timeline backwards to find the most recent permission_requested
4819
- * envelope that has not been resolved by a matching permission_resolved.
4820
- */
4821
- declare function findActivePermissionRequest(timeline: TimelineEnvelope[]): {
4822
- requestId: string;
4823
- toolName: string;
4824
- input?: Record<string, unknown>;
4825
- reason?: string;
4826
- scope?: {
4827
- type: string;
4828
- label?: string;
4829
- };
4830
- } | null;
4831
-
4832
- /**
4833
- * Convert a processor Session (returned by useAgentChatSession) into a
4834
- * StoredSession that SessionViewer can render.
4835
- *
4836
- * Consumers embedding AgentChatPanel don't need this — it's called internally.
4837
- * This utility is exported for consumers who use useAgentChatSession directly
4838
- * and build their own panel around SessionViewer.
4839
- */
4840
- declare function toStoredSession(session: Session, fallbackWorkspaceId?: string): StoredSession;
4841
- /**
4842
- * Build an empty StoredSession placeholder for the initial state
4843
- * before the event processor has received any events.
4844
- */
4845
- declare function createEmptyStoredSession(sessionId: string, workspaceId?: string, workspaceName?: string): StoredSession;
4846
-
4847
- export { AgentChatPanel, type AgentChatPanelProps, type AgentChatSessionModel, type LocalChatAuthDetection, type LocalChatCommandSink, type LocalChatEventSource, type LocalChatRuntimeState, type LocalChatSessionRuntime, TimelineAgentChatPanel, type TimelineAgentChatPanelProps, type TimelineAgentChatSessionModel, type TimelineChatPanelModel, type TimelineDetailItem, type TimelineDetailKind, type UseAgentChatSessionOptions, type UseTimelineAgentChatSessionOptions, createAgentChatPanelModel, createAgentChatPanelModelFromTimeline, createEmptyStoredSession, createTimelineAgentChatPanelModel, createTimelineDetailItems, findActivePermissionRequest, toStoredSession, useAgentChatSession, useTimelineAgentChatSession };
package/dist/chat.js CHANGED
@@ -7038,7 +7038,7 @@ var InProcessEventSource = class {
7038
7038
  }
7039
7039
  };
7040
7040
 
7041
- // ../packages/local-chat/dist/index.js
7041
+ // ../packages/chat/dist/index.js
7042
7042
  import { useState as useState22 } from "react";
7043
7043
  import { useCallback as useCallback9, useEffect as useEffect9, useMemo as useMemo8, useRef as useRef8, useState as useState12 } from "react";
7044
7044
 
@@ -7060,7 +7060,7 @@ function timelineKey(item) {
7060
7060
  return `${item.epoch}:${item.seq}`;
7061
7061
  }
7062
7062
 
7063
- // ../packages/local-chat/dist/index.js
7063
+ // ../packages/chat/dist/index.js
7064
7064
  import { jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
7065
7065
  import { useCallback as useCallback22, useEffect as useEffect22, useMemo as useMemo22, useRef as useRef22, useState as useState32 } from "react";
7066
7066
  import { jsx as jsx210, jsxs as jsxs22 } from "react/jsx-runtime";
package/dist/index.cjs CHANGED
@@ -374,13 +374,14 @@ function timelineKey(item) {
374
374
  }
375
375
 
376
376
  // ../packages/client/dist/index.js
377
- var FlitroHttpClient = class {
377
+ var WeftHttpClient = class {
378
378
  baseUrl;
379
379
  timeout;
380
380
  apiKey;
381
381
  tenantId;
382
382
  onTokenExpired;
383
383
  token;
384
+ embedMode;
384
385
  constructor(options) {
385
386
  this.baseUrl = options.baseUrl.replace(/\/$/, "");
386
387
  this.timeout = options.timeout ?? 3e4;
@@ -388,6 +389,11 @@ var FlitroHttpClient = class {
388
389
  this.tenantId = options.tenantId ?? "";
389
390
  this.token = options.token ?? "";
390
391
  this.onTokenExpired = options.onTokenExpired;
392
+ this.embedMode = !!(this.token && !this.apiKey);
393
+ }
394
+ sessionPath(sessionId) {
395
+ const encoded = encodeURIComponent(sessionId);
396
+ return this.embedMode ? `/v1/embed/sessions/${encoded}` : `/v1/sessions/${encoded}`;
391
397
  }
392
398
  /** Current Authorization bearer (scoped token wins over apiKey). */
393
399
  getBearerToken() {
@@ -419,7 +425,7 @@ var FlitroHttpClient = class {
419
425
  });
420
426
  }
421
427
  async getSession(sessionId) {
422
- return this.get(`/v1/sessions/${encodeURIComponent(sessionId)}`);
428
+ return this.get(`${this.sessionPath(sessionId)}`);
423
429
  }
424
430
  async sendMessage(sessionId, message, options) {
425
431
  const budget = options?.budget ? {
@@ -427,7 +433,7 @@ var FlitroHttpClient = class {
427
433
  max_tokens: options.budget.maxTokens,
428
434
  max_wall_time_sec: options.budget.maxWallTimeSec
429
435
  } : void 0;
430
- return this.post(`/v1/sessions/${encodeURIComponent(sessionId)}/runs`, {
436
+ return this.post(`${this.sessionPath(sessionId)}/runs`, {
431
437
  message,
432
438
  model: options?.model,
433
439
  skill_names: options?.skillNames,
@@ -450,13 +456,13 @@ var FlitroHttpClient = class {
450
456
  }
451
457
  async respondToPermission(sessionId, requestId, allowed, options) {
452
458
  return this.post(
453
- `/v1/sessions/${encodeURIComponent(sessionId)}/permission-response`,
459
+ `${this.sessionPath(sessionId)}/permission-response`,
454
460
  { requestId, allowed, remember: options?.remember, text: options?.text, answer: options?.answer }
455
461
  );
456
462
  }
457
463
  async patchSession(sessionId, patch) {
458
464
  return this.patch(
459
- `/v1/sessions/${encodeURIComponent(sessionId)}`,
465
+ `${this.sessionPath(sessionId)}`,
460
466
  patch
461
467
  );
462
468
  }
@@ -468,12 +474,12 @@ var FlitroHttpClient = class {
468
474
  if (afterSeq !== void 0) params.set("after_seq", String(afterSeq));
469
475
  if (limit !== void 0) params.set("limit", String(limit));
470
476
  const qs = params.toString();
471
- const url = `/v1/sessions/${encodeURIComponent(sessionId)}/timeline/fetch${qs ? `?${qs}` : ""}`;
477
+ const url = `${this.sessionPath(sessionId)}/timeline/fetch${qs ? `?${qs}` : ""}`;
472
478
  return this.get(url);
473
479
  }
474
480
  /** Returns the SSE stream URL for a session's canonical timeline. */
475
481
  sessionTimelineUrl(sessionId) {
476
- return `${this.baseUrl}/v1/sessions/${encodeURIComponent(sessionId)}/timeline`;
482
+ return `${this.baseUrl}${this.sessionPath(sessionId)}/timeline`;
477
483
  }
478
484
  async get(path) {
479
485
  return this.request("GET", path, void 0);
@@ -503,7 +509,7 @@ var FlitroHttpClient = class {
503
509
  }
504
510
  }
505
511
  if (!response.ok) {
506
- let errorMsg = `Flitro HTTP ${response.status}`;
512
+ let errorMsg = `Weft HTTP ${response.status}`;
507
513
  try {
508
514
  const errBody = await response.json();
509
515
  if (errBody.error) errorMsg = `${errorMsg}: ${errBody.error}`;
@@ -517,7 +523,7 @@ var FlitroHttpClient = class {
517
523
  }
518
524
  }
519
525
  };
520
- var FlitroFetchSseTimelineStream = class {
526
+ var WeftFetchSseTimelineStream = class {
521
527
  listeners = /* @__PURE__ */ new Set();
522
528
  abortController = null;
523
529
  connected = false;
@@ -590,7 +596,7 @@ var FlitroFetchSseTimelineStream = class {
590
596
  if (fresh) this.tokenOverride = fresh;
591
597
  }
592
598
  if (!response.ok || !response.body) {
593
- throw new Error(`Flitro SSE: HTTP ${response.status}`);
599
+ throw new Error(`Weft SSE: HTTP ${response.status}`);
594
600
  }
595
601
  this.reconnectAttempts = 0;
596
602
  const reader = response.body.getReader();
@@ -625,7 +631,7 @@ var FlitroFetchSseTimelineStream = class {
625
631
  scheduleReconnect() {
626
632
  if (this.disposed) return;
627
633
  if (this.reconnectAttempts >= this.options.maxReconnectAttempts) {
628
- this.emitError(new Error(`Flitro SSE: max reconnect attempts reached`));
634
+ this.emitError(new Error(`Weft SSE: max reconnect attempts reached`));
629
635
  return;
630
636
  }
631
637
  this.reconnectAttempts++;
@@ -662,8 +668,8 @@ function parseSseBuffer(buffer) {
662
668
  }
663
669
  return { items, remainder };
664
670
  }
665
- function createFlitroTimelineStream(options) {
666
- return new FlitroFetchSseTimelineStream(options);
671
+ function createTimelineStream(options) {
672
+ return new WeftFetchSseTimelineStream(options);
667
673
  }
668
674
 
669
675
  // ../packages/provider-flitro/dist/index.js
@@ -768,7 +774,7 @@ function createFlitroRuntimeCapabilityReport(options) {
768
774
  function createFlitroProviderRuntime(options) {
769
775
  const report = createFlitroRuntimeCapabilityReport(options);
770
776
  const extensions = createRuntimeExtensionContext(options.extensions);
771
- const client = new FlitroHttpClient(options.server);
777
+ const client = new WeftHttpClient(options.server);
772
778
  let resolvedSessionId = options.sessionId ?? "";
773
779
  let epoch = options.epoch ?? (resolvedSessionId ? `flitro-${resolvedSessionId}` : "flitro-pending");
774
780
  const now = options.now ?? (() => Date.now());
@@ -889,7 +895,7 @@ function createFlitroProviderRuntime(options) {
889
895
  }
890
896
  function connectSse() {
891
897
  if (!resolvedSessionId || sseStream) return;
892
- sseStream = createFlitroTimelineStream({
898
+ sseStream = createTimelineStream({
893
899
  url: client.sessionTimelineUrl(resolvedSessionId),
894
900
  apiKey: options.server.apiKey,
895
901
  tenantId: options.server.tenantId,
@@ -1033,7 +1039,7 @@ var PushTimelineStream = class {
1033
1039
  }
1034
1040
  };
1035
1041
 
1036
- // ../packages/local-chat/dist/index.js
1042
+ // ../packages/chat/dist/index.js
1037
1043
  var import_react19 = require("react");
1038
1044
 
1039
1045
  // ../packages/ui/dist/chunk-MRPTNS4U.js
@@ -7805,7 +7811,7 @@ function useEventProcessor(options) {
7805
7811
  };
7806
7812
  }
7807
7813
 
7808
- // ../packages/local-chat/dist/index.js
7814
+ // ../packages/chat/dist/index.js
7809
7815
  var import_react20 = require("react");
7810
7816
  var import_jsx_runtime39 = require("react/jsx-runtime");
7811
7817
  var import_react21 = require("react");