@opengeni/react 0.13.0 → 0.15.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/README.md +19 -13
- package/dist/chunk-TOJR776I.js +2280 -0
- package/dist/chunk-TOJR776I.js.map +1 -0
- package/dist/index.d.ts +314 -255
- package/dist/index.js +5862 -4404
- package/dist/index.js.map +1 -1
- package/dist/{machines-CnlMb7E-.d.ts → machines-BpdwuQcD.d.ts} +130 -10
- package/dist/machines.d.ts +1 -1
- package/dist/machines.js +23 -1
- package/package.json +5 -2
- package/src/client.ts +10 -1
- package/src/components/chat-composer.tsx +309 -57
- package/src/components/machine-card.tsx +81 -15
- package/src/components/machine-health-pill.tsx +68 -0
- package/src/components/machine-metrics.tsx +10 -24
- package/src/components/machines/health.ts +146 -0
- package/src/components/machines/machine-detail.tsx +220 -0
- package/src/components/machines/metric-history-chart.tsx +298 -0
- package/src/components/machines/metric-sparkline.tsx +76 -0
- package/src/components/machines/series.ts +113 -0
- package/src/components/machines-dashboard.tsx +13 -1
- package/src/components/queue-surface.tsx +578 -0
- package/src/components/sandbox-files.tsx +94 -9
- package/src/components/sandbox-workspace.tsx +186 -52
- package/src/components/session-status.tsx +0 -6
- package/src/components/workbench-changes.tsx +64 -20
- package/src/components/workspace-dock.tsx +146 -55
- package/src/hooks/use-composer.ts +369 -39
- package/src/hooks/use-session-control.ts +6 -7
- package/src/hooks/use-session-events.ts +3 -2
- package/src/hooks/use-session-lineage.ts +15 -6
- package/src/hooks/use-session.ts +10 -2
- package/src/hooks/use-turn-queue.ts +175 -47
- package/src/index.ts +13 -7
- package/src/machines.ts +16 -0
- package/src/provider.tsx +192 -5
- package/src/timeline/parsers.ts +43 -6
- package/src/timeline/projection.ts +24 -2
- package/styles/index.css +22 -0
- package/dist/chunk-NFYVQWIB.js +0 -1377
- package/dist/chunk-NFYVQWIB.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { C as ClientOverride, S as SessionClientLike } from './machines-
|
|
2
|
-
export { a as CONNECTION_STATUS_META, b as ConnectionDot, c as ConnectionDotProps, d as ConnectionStatus, e as ConnectionStatusMeta, f as ConnectionStatusPill, g as ConnectionStatusPillProps, D as DeviceFlowPhase, E as EnrollmentConsent, h as EnrollmentConsentMachine, i as EnrollmentConsentPhase, j as EnrollmentConsentProps, k as EnrollmentDeviceFlow, l as EnrollmentDeviceFlowProps, M as MACHINE_STATE_BADGE_META,
|
|
3
|
-
import { SessionEvent, Session, ResourceRef, ToolRef, SessionStatus as SessionStatus$1, GitFileDiff, StreamConnectionState, SendMessageInput, FileAsset, FileResourceRef, SessionQueueSnapshot, SessionTurn, SessionGoal, ScheduledTask, SessionLineageResponse, VariableSet, CreateVariableSetRequest, UpdateVariableSetRequest, VariableSetVariableMetadata, RigChange, Rig, UpdateRigRequest, RigVersion, ProposeRigChangeRequest, CreateRigRequest, CapabilityPack, PackInstallation, RegisterCapabilityPackRequest, WorkspaceRegisteredPack, EnablePackRequest, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, BillingBalance, UsageEvent,
|
|
1
|
+
import { C as ClientOverride, S as SessionClientLike } from './machines-BpdwuQcD.js';
|
|
2
|
+
export { a as CONNECTION_STATUS_META, b as ConnectionDot, c as ConnectionDotProps, d as ConnectionStatus, e as ConnectionStatusMeta, f as ConnectionStatusPill, g as ConnectionStatusPillProps, D as DeviceFlowPhase, E as EnrollmentConsent, h as EnrollmentConsentMachine, i as EnrollmentConsentPhase, j as EnrollmentConsentProps, k as EnrollmentDeviceFlow, l as EnrollmentDeviceFlowProps, H as HEALTH_TOKEN, m as HealthLevel, n as HealthVerdict, M as MACHINE_STATE_BADGE_META, o as METRICS, p as METRIC_WINDOWS, q as MachineCard, r as MachineCardProps, s as MachineDetail, t as MachineDetailProps, u as MachineDockBar, v as MachineDockBarProps, w as MachineHealthPill, x as MachineHealthPillProps, y as MachineMetrics, z as MachineMetricsProps, A as MachineStateBadgeMeta, B as MachineStatusPill, F as MachineStatusPillProps, G as MachinesClientLike, I as MachinesDashboard, J as MachinesDashboardProps, K as MetricDef, L as MetricHistoryChart, N as MetricHistoryChartProps, O as MetricKey, P as MetricSparkline, Q as MetricSparklineProps, R as MetricWindow, T as OpenGeniContextValue, U as OpenGeniProvider, V as OpenGeniProviderProps, W as SeriesPoint, X as SharedMachineDisclosure, Y as SharedMachineDisclosureProps, Z as UseMachinesOptions, _ as UseMachinesResult, $ as WINDOW_LABEL, a0 as connectionStatusForState, a1 as deriveHealth, a2 as healthPulses, a3 as pointsFor, a4 as useMachines, a5 as useOpenGeni, a6 as useOpenGeniClient } from './machines-BpdwuQcD.js';
|
|
3
|
+
import { SessionEvent, Session, ResourceRef, ToolRef, SessionStatus as SessionStatus$1, GitFileDiff, StreamConnectionState, EffectiveControlResumeOption, ComposerDraft, SendMessageInput, EffectiveSessionControl, FileAsset, FileResourceRef, SessionQueueSnapshot, SessionTurn, Permission, ClientModel, SessionGoal, SessionControlResponse, ScheduledTask, SessionLineageResponse, VariableSet, CreateVariableSetRequest, UpdateVariableSetRequest, VariableSetVariableMetadata, RigChange, Rig, UpdateRigRequest, RigVersion, ProposeRigChangeRequest, CreateRigRequest, CapabilityPack, PackInstallation, RegisterCapabilityPackRequest, WorkspaceRegisteredPack, EnablePackRequest, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, BillingBalance, UsageEvent, SessionCapabilities, DesktopStreamCapability, DesktopConnectionState, DesktopRfbFactory, TerminalCapability, FsReadResponse, FsWriteResponse, WorkspaceCaptureManifest, WorkspaceCaptureDegradedReason, MachineState, CapabilityUnavailableReason, MachineView, CodexAccountsResponse, CodexAccount, CodexRotationSettings } from '@opengeni/sdk';
|
|
4
4
|
export { MachineKind, MachineMetricsSeriesResponse, MachineState, MachineView, MachinesResponse, MetricSample } from '@opengeni/sdk';
|
|
5
|
-
import * as react from 'react';
|
|
6
|
-
import { ComponentType, ReactNode, RefObject, KeyboardEvent, ClipboardEvent } from 'react';
|
|
7
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import * as react from 'react';
|
|
7
|
+
import { ComponentType, ReactNode, KeyboardEvent, ClipboardEvent, RefObject } from 'react';
|
|
8
8
|
import { ClassValue } from 'clsx';
|
|
9
9
|
|
|
10
10
|
type SessionEventFeedOptions = {
|
|
@@ -638,12 +638,7 @@ type UseSessionEventsResult = {
|
|
|
638
638
|
declare function useSessionEvents(sessionId: string | null | undefined, options?: UseSessionEventsOptions): UseSessionEventsResult;
|
|
639
639
|
|
|
640
640
|
type ComposerSendExtras = Omit<SendMessageInput, "text" | "clientEventId">;
|
|
641
|
-
|
|
642
|
-
* Enter appends a prompt; Cmd/Ctrl+Enter steers it to the head and supersedes
|
|
643
|
-
* the current inference.
|
|
644
|
-
*/
|
|
645
|
-
type ComposerMode = "queue" | "steer";
|
|
646
|
-
type UseComposerOptions = ClientOverride & {
|
|
641
|
+
type UseComposerOptions = ClientOverride & SessionEventFeedOptions & {
|
|
647
642
|
/** Called with the accepted text after a successful send. */
|
|
648
643
|
onSent?: ((text: string) => void) | undefined;
|
|
649
644
|
/**
|
|
@@ -652,19 +647,37 @@ type UseComposerOptions = ClientOverride & {
|
|
|
652
647
|
* surrounding UI state (attachment pickers, model selectors, ...).
|
|
653
648
|
*/
|
|
654
649
|
sendExtras?: ComposerSendExtras | (() => ComposerSendExtras) | undefined;
|
|
650
|
+
/** Latest server-derived workstream control; bound into Send/Steer OCC. */
|
|
651
|
+
effectiveControl?: EffectiveSessionControl | null | undefined;
|
|
652
|
+
/** Apply durable model/tool/reasoning settings in the host's controlled UI. */
|
|
653
|
+
onDraftApplied?: ((draft: ComposerDraft) => void) | undefined;
|
|
655
654
|
};
|
|
656
655
|
type ComposerState = {
|
|
657
656
|
value: string;
|
|
658
657
|
setValue: (value: string) => void;
|
|
659
|
-
/**
|
|
660
|
-
send: (text?: string
|
|
658
|
+
/** Append the draft behind prompts already visible in the queue. */
|
|
659
|
+
send: (text?: string) => Promise<boolean>;
|
|
660
|
+
/** Supersede current direction with the draft. */
|
|
661
|
+
steer: (text?: string) => Promise<boolean>;
|
|
661
662
|
sending: boolean;
|
|
662
663
|
canSend: boolean;
|
|
663
664
|
/** Pause the session without deleting its prompt queue. */
|
|
664
665
|
pause: (reason?: string) => Promise<void>;
|
|
665
666
|
pausing: boolean;
|
|
666
667
|
resume: (reason?: string) => Promise<void>;
|
|
668
|
+
resumeScope: (option: EffectiveControlResumeOption) => Promise<void>;
|
|
667
669
|
resuming: boolean;
|
|
670
|
+
draft: ComposerDraft | null;
|
|
671
|
+
draftRevision: number;
|
|
672
|
+
draftLoading: boolean;
|
|
673
|
+
draftSaving: boolean;
|
|
674
|
+
draftConflict: Error | null;
|
|
675
|
+
/** Apply an atomic queue Edit checkout without a second read. */
|
|
676
|
+
applyDraft: (draft: ComposerDraft) => void;
|
|
677
|
+
reloadDraft: () => Promise<void>;
|
|
678
|
+
resolveDraftConflict: (choice: "keep_mine" | "use_remote") => Promise<void>;
|
|
679
|
+
restoredResources: ResourceRef[];
|
|
680
|
+
removeRestoredResource: (index: number) => void;
|
|
668
681
|
error: Error | null;
|
|
669
682
|
clearError: () => void;
|
|
670
683
|
};
|
|
@@ -686,7 +699,7 @@ declare const FILE_ONLY_MESSAGE_TEXT = "(see attached files)";
|
|
|
686
699
|
* Merge the draft text + idempotency key with caller-provided extras. The
|
|
687
700
|
* text and clientEventId always win over extras. Exported for tests.
|
|
688
701
|
*/
|
|
689
|
-
declare function composeSendInput(text: string, clientEventId: string, extras: ComposerSendExtras | (() => ComposerSendExtras) | undefined): SendMessageInput;
|
|
702
|
+
declare function composeSendInput(text: string, clientEventId: string, extras: ComposerSendExtras | (() => ComposerSendExtras) | undefined, bound?: Partial<SendMessageInput>): SendMessageInput;
|
|
690
703
|
/** Submit on plain Enter; Shift+Enter inserts a newline. Exported for tests. */
|
|
691
704
|
declare function shouldSubmitOnKey(event: {
|
|
692
705
|
key: string;
|
|
@@ -697,6 +710,11 @@ declare function shouldSubmitOnKey(event: {
|
|
|
697
710
|
isComposing?: boolean;
|
|
698
711
|
};
|
|
699
712
|
}): boolean;
|
|
713
|
+
/** Cmd/Ctrl+Enter steers; ordinary Enter appends to the queue. */
|
|
714
|
+
declare function shouldSteerOnKey(event: {
|
|
715
|
+
metaKey?: boolean;
|
|
716
|
+
ctrlKey?: boolean;
|
|
717
|
+
}): boolean;
|
|
700
718
|
|
|
701
719
|
type UseFileAttachmentsOptions = ClientOverride & {
|
|
702
720
|
/**
|
|
@@ -756,8 +774,9 @@ type UseFileAttachmentsResult = {
|
|
|
756
774
|
*/
|
|
757
775
|
declare function useFileAttachments(options?: UseFileAttachmentsOptions): UseFileAttachmentsResult;
|
|
758
776
|
|
|
759
|
-
/** Events that can change the authoritative prompt queue or
|
|
777
|
+
/** Events that can change the authoritative prompt queue or effective control. */
|
|
760
778
|
declare function isTurnQueueEvent(event: Pick<SessionEvent, "type">): boolean;
|
|
779
|
+
type QueueMutationKind = "move" | "edit" | "steer" | "delete";
|
|
761
780
|
type UseTurnQueueOptions = ClientOverride & SessionEventFeedOptions & {
|
|
762
781
|
pollIntervalMs?: number | undefined;
|
|
763
782
|
};
|
|
@@ -765,26 +784,269 @@ type UseTurnQueueResult = {
|
|
|
765
784
|
snapshot: SessionQueueSnapshot | null;
|
|
766
785
|
/** Human/API prompts exactly in server execution order. Never client-sorted. */
|
|
767
786
|
queue: SessionTurn[];
|
|
768
|
-
|
|
769
|
-
controlGeneration: number | null;
|
|
770
|
-
workspaceInferenceState: SessionQueueSnapshot["workspaceInferenceState"] | null;
|
|
771
|
-
workspaceInferenceGeneration: number | null;
|
|
772
|
-
workspaceRunExceptionGeneration: number | null;
|
|
787
|
+
effectiveControl: EffectiveSessionControl | null;
|
|
773
788
|
loading: boolean;
|
|
774
789
|
error: Error | null;
|
|
775
790
|
refresh: () => Promise<void>;
|
|
776
|
-
|
|
791
|
+
moveTurn: (turnId: string, beforeTurnId: string | null) => Promise<boolean>;
|
|
792
|
+
/** Atomically withdraw a waiting prompt into the private durable composer draft. */
|
|
793
|
+
editTurn: (turnId: string, options: {
|
|
794
|
+
expectedDraftRevision: number;
|
|
795
|
+
replaceDraft: boolean;
|
|
796
|
+
}) => Promise<ComposerDraft | null>;
|
|
797
|
+
/** Advance the same durable waiting prompt; no duplicate prompt is created. */
|
|
798
|
+
steerTurn: (turnId: string) => Promise<boolean>;
|
|
777
799
|
removeTurn: (turnId: string) => Promise<boolean>;
|
|
800
|
+
pendingByTurn: Readonly<Record<string, QueueMutationKind>>;
|
|
801
|
+
mutationFor: (turnId: string) => QueueMutationKind | null;
|
|
778
802
|
mutating: boolean;
|
|
779
803
|
mutationError: Error | null;
|
|
780
804
|
clearMutationError: () => void;
|
|
781
805
|
};
|
|
782
806
|
/**
|
|
783
|
-
* The
|
|
784
|
-
*
|
|
807
|
+
* The one authoritative human prompt queue. Every mutation carries the exact
|
|
808
|
+
* server versions the operator saw and accepts only monotonic snapshots. A
|
|
809
|
+
* conflict immediately reloads server truth; the client never invents order.
|
|
785
810
|
*/
|
|
786
811
|
declare function useTurnQueue(sessionId: string | null | undefined, options?: UseTurnQueueOptions): UseTurnQueueResult;
|
|
787
812
|
|
|
813
|
+
/** The sole human prompt queue: compact above Goal, Agents, and composer. */
|
|
814
|
+
type QueueSurfaceProps = {
|
|
815
|
+
queue: UseTurnQueueResult;
|
|
816
|
+
composer: ComposerState;
|
|
817
|
+
readOnly?: false | undefined;
|
|
818
|
+
} | {
|
|
819
|
+
queue: UseTurnQueueResult;
|
|
820
|
+
composer?: undefined;
|
|
821
|
+
readOnly: true;
|
|
822
|
+
};
|
|
823
|
+
declare function QueueSurface({ queue, composer, readOnly }: QueueSurfaceProps): react_jsx_runtime.JSX.Element | null;
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* The slash-command registry. A command is a SESSION / OPERATOR control — an
|
|
827
|
+
* action on the session or the UI (clear, compact, pause the goal, show help) —
|
|
828
|
+
* NOT a structured way to talk to the agent. The human↔agent channel stays
|
|
829
|
+
* plain chat; the palette only recognizes a leading "/" and never sends a
|
|
830
|
+
* command to the model.
|
|
831
|
+
*
|
|
832
|
+
* Two kinds, modeled by where the handler does its work:
|
|
833
|
+
* - CLIENT commands touch only the local UI (e.g. /help, /clear-view).
|
|
834
|
+
* - SERVER commands call the API through the SDK (e.g. /clear, /compact,
|
|
835
|
+
* /goal).
|
|
836
|
+
* Both are just `run(args, ctx)`; `ctx` exposes the client for server commands
|
|
837
|
+
* and the UI affordances (notice, openHelp, clearView, confirm) for both.
|
|
838
|
+
*/
|
|
839
|
+
/** A positional argument a command accepts after its name. */
|
|
840
|
+
type SlashArg = {
|
|
841
|
+
name: string;
|
|
842
|
+
/** Enter runs only once every required arg is present; otherwise autocompletes. */
|
|
843
|
+
required?: boolean;
|
|
844
|
+
/** Closed value set (rendered as a hint; validated by the command itself). */
|
|
845
|
+
oneOf?: readonly string[];
|
|
846
|
+
description?: string;
|
|
847
|
+
};
|
|
848
|
+
/** Transient feedback surfaced in the composer (generalized error line). */
|
|
849
|
+
type Notice = {
|
|
850
|
+
tone: "ok" | "error";
|
|
851
|
+
message: string;
|
|
852
|
+
};
|
|
853
|
+
/** Everything a command handler can reach. Assembled by the composer. */
|
|
854
|
+
type CommandContext = {
|
|
855
|
+
/** SDK-shaped client for server commands. */
|
|
856
|
+
client: SessionClientLike;
|
|
857
|
+
workspaceId: string;
|
|
858
|
+
/** Null before a session exists (server commands should guard on this). */
|
|
859
|
+
sessionId: string | null;
|
|
860
|
+
status: SessionStatus$1 | null;
|
|
861
|
+
/** The operator's permissions on this workspace (gates command visibility). */
|
|
862
|
+
permissions: Permission[];
|
|
863
|
+
/** Surface a transient ok/error notice in the composer. */
|
|
864
|
+
notice: (notice: Notice) => void;
|
|
865
|
+
/** Open the in-composer /help panel (rendered from the registry). */
|
|
866
|
+
openHelp: () => void;
|
|
867
|
+
/**
|
|
868
|
+
* Reset only the LOCAL timeline view — no server call. Returns whether a
|
|
869
|
+
* view-reset affordance was actually wired (and thus had an effect): the host
|
|
870
|
+
* surface supplies one via the composer's `onClearView` prop, and consoles
|
|
871
|
+
* that don't (no resettable local timeline) get `false`. The /clear-view
|
|
872
|
+
* command uses this to avoid reporting a false "cleared" success on a no-op.
|
|
873
|
+
*/
|
|
874
|
+
clearView: () => boolean;
|
|
875
|
+
/** Show the danger confirm bar; resolves true once the operator confirms. */
|
|
876
|
+
confirm: () => Promise<boolean>;
|
|
877
|
+
};
|
|
878
|
+
type CommandResult = {
|
|
879
|
+
status: "ok" | "error";
|
|
880
|
+
message?: string;
|
|
881
|
+
/**
|
|
882
|
+
* Keep the composer draft instead of clearing it on an ok result. Used when a
|
|
883
|
+
* command resolves to a no-op the operator may want to retry — e.g. canceling
|
|
884
|
+
* the /clear confirm bar returns ok (no error) but must NOT wipe the typed
|
|
885
|
+
* "/clear" draft. Default false: a successful command clears the draft.
|
|
886
|
+
*/
|
|
887
|
+
keepDraft?: boolean;
|
|
888
|
+
};
|
|
889
|
+
type SlashCommand = {
|
|
890
|
+
/** Primary token after the slash (no leading "/"). */
|
|
891
|
+
name: string;
|
|
892
|
+
/** Alternate tokens that resolve to this command. */
|
|
893
|
+
aliases?: readonly string[];
|
|
894
|
+
description: string;
|
|
895
|
+
args?: readonly SlashArg[];
|
|
896
|
+
/** Required permission; the command is hidden from the palette without it. */
|
|
897
|
+
permission?: Permission;
|
|
898
|
+
/** Destructive — the palette shows a confirm bar before running. */
|
|
899
|
+
danger?: boolean;
|
|
900
|
+
/**
|
|
901
|
+
* Dynamic availability beyond the permission gate (e.g. hide a server command
|
|
902
|
+
* until a session exists). Returning false hides the command.
|
|
903
|
+
*/
|
|
904
|
+
available?: (ctx: Pick<CommandContext, "sessionId" | "status" | "permissions">) => boolean;
|
|
905
|
+
/** Execute the command. Throwing is caught and surfaced as an error notice. */
|
|
906
|
+
run: (args: string[], ctx: CommandContext) => Promise<CommandResult> | CommandResult;
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Context the composer supplies for command execution and visibility. The
|
|
911
|
+
* composer owns the UI affordances (notice/openHelp/clearView/confirm), so they
|
|
912
|
+
* are NOT part of this slice — the hook closes over them via `handlers`.
|
|
913
|
+
*/
|
|
914
|
+
type SlashCommandContext = Pick<CommandContext, "client" | "workspaceId" | "sessionId" | "status" | "permissions">;
|
|
915
|
+
/**
|
|
916
|
+
* UI affordances the composer supplies. `confirm` differs from the registry-
|
|
917
|
+
* facing {@link CommandContext.confirm} (which takes no args): the composer's
|
|
918
|
+
* confirm receives the command being run so the confirm bar renders from that
|
|
919
|
+
* exact command's identity. The hook bridges the two in {@link buildContext}.
|
|
920
|
+
*/
|
|
921
|
+
type SlashCommandHandlers = Pick<CommandContext, "notice" | "openHelp" | "clearView"> & {
|
|
922
|
+
confirm: (command: SlashCommand) => Promise<boolean>;
|
|
923
|
+
};
|
|
924
|
+
type ConfirmState = {
|
|
925
|
+
command: SlashCommand;
|
|
926
|
+
/** Resolve the pending confirm() promise. */
|
|
927
|
+
resolve: (confirmed: boolean) => void;
|
|
928
|
+
} | null;
|
|
929
|
+
type UseSlashCommandsOptions = {
|
|
930
|
+
commands: readonly SlashCommand[];
|
|
931
|
+
context: SlashCommandContext | undefined;
|
|
932
|
+
handlers: SlashCommandHandlers;
|
|
933
|
+
/** The current composer draft. */
|
|
934
|
+
value: string;
|
|
935
|
+
/** Replace the composer draft (autocomplete writes through this). */
|
|
936
|
+
setValue: (value: string) => void;
|
|
937
|
+
};
|
|
938
|
+
type UseSlashCommandsResult = {
|
|
939
|
+
/** Whether the palette is open (a command token is being typed). */
|
|
940
|
+
open: boolean;
|
|
941
|
+
/**
|
|
942
|
+
* Whether the draft is a slash-command attempt (matches a registered command)
|
|
943
|
+
* — true even after Escape dismisses the popover. The composer blocks its send
|
|
944
|
+
* path while this holds so a command can't be delivered to the agent as chat.
|
|
945
|
+
*/
|
|
946
|
+
isCommandDraft: boolean;
|
|
947
|
+
/** Commands shown for the current token + context, in display order. */
|
|
948
|
+
items: SlashCommand[];
|
|
949
|
+
/** Index into `items` of the highlighted row. */
|
|
950
|
+
highlight: number;
|
|
951
|
+
setHighlight: (index: number) => void;
|
|
952
|
+
/** The matched command once the name is closed by a space (arg-hint mode). */
|
|
953
|
+
activeCommand: SlashCommand | null;
|
|
954
|
+
/** The arg hint string for the active command (footer), or "". */
|
|
955
|
+
activeArgHint: string;
|
|
956
|
+
/**
|
|
957
|
+
* Key handler for the textarea. Returns true when it consumed the event
|
|
958
|
+
* (the composer must then NOT run its send path). Only consumes while open.
|
|
959
|
+
*/
|
|
960
|
+
onKeyDown: (event: KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
961
|
+
/** Run the highlighted command (or the active command in arg-hint mode). */
|
|
962
|
+
runHighlighted: () => Promise<void>;
|
|
963
|
+
/**
|
|
964
|
+
* Run the command at an explicitly chosen index (a pointer click on a row).
|
|
965
|
+
* Bypasses the exact-match token heuristic that runHighlighted uses for
|
|
966
|
+
* keyboard Enter, so an explicit click always runs the clicked command.
|
|
967
|
+
*/
|
|
968
|
+
runAt: (index: number) => Promise<void>;
|
|
969
|
+
/** Autocomplete the highlighted command name + a trailing space. */
|
|
970
|
+
autocompleteHighlighted: () => void;
|
|
971
|
+
};
|
|
972
|
+
declare function useSlashCommands(options: UseSlashCommandsOptions): UseSlashCommandsResult;
|
|
973
|
+
|
|
974
|
+
type ChatComposerProps = {
|
|
975
|
+
composer: ComposerState;
|
|
976
|
+
/** Canonical workstream control, separate from lifecycle status. */
|
|
977
|
+
effectiveControl?: EffectiveSessionControl | null | undefined;
|
|
978
|
+
/** Waiting prompts already ahead of a normal Send. */
|
|
979
|
+
queuedAheadCount?: number | undefined;
|
|
980
|
+
/** Whether broader Workspace Resume is authorized for this viewer. */
|
|
981
|
+
canControlWorkspace?: boolean | undefined;
|
|
982
|
+
/** Optional host routes used to navigate from effective Pause blockers. */
|
|
983
|
+
controlLinks?: {
|
|
984
|
+
workspaceHref?: string | undefined;
|
|
985
|
+
sessionHref?: ((sessionId: string) => string) | undefined;
|
|
986
|
+
} | undefined;
|
|
987
|
+
placeholder?: string | undefined;
|
|
988
|
+
disabled?: boolean | undefined;
|
|
989
|
+
autoFocus?: boolean | undefined;
|
|
990
|
+
/** Replaces the default keyboard hint under the field. */
|
|
991
|
+
hint?: string | undefined;
|
|
992
|
+
/** App controls (model picker, attach button, ...) in the footer row, replacing the hint. */
|
|
993
|
+
controlsStart?: ReactNode | undefined;
|
|
994
|
+
/** Content rendered above the textarea, inside the field chrome (e.g. attachment chips). */
|
|
995
|
+
header?: ReactNode | undefined;
|
|
996
|
+
/** Paste hook on the textarea (e.g. paste-image-to-attach). */
|
|
997
|
+
onPaste?: ((event: ClipboardEvent<HTMLTextAreaElement>) => void) | undefined;
|
|
998
|
+
/**
|
|
999
|
+
* Opt-in file attachments. When supplied (e.g. from {@link useFileAttachments}),
|
|
1000
|
+
* the composer renders a built-in attach button (prepended to `controlsStart`),
|
|
1001
|
+
* an attachment-chips strip (above the textarea, before any host `header`),
|
|
1002
|
+
* routes paste through `addFromPaste` (image/* filter lives in the hook), and
|
|
1003
|
+
* gates send while `uploading` so a message never departs without its files.
|
|
1004
|
+
* Absent → no attachment UI renders and the composer behaves exactly as before.
|
|
1005
|
+
*/
|
|
1006
|
+
attachments?: UseFileAttachmentsResult | undefined;
|
|
1007
|
+
/**
|
|
1008
|
+
* Opt-in model picker. When supplied (e.g. from {@link useAvailableModels}),
|
|
1009
|
+
* the composer renders a {@link ModelPicker} at the start of `controlsStart`
|
|
1010
|
+
* so the operator can choose which host-exposed model serves the next message.
|
|
1011
|
+
* The host owns the selection (`selectedModel`/`onSelectModel`) and is
|
|
1012
|
+
* responsible for threading it into the composer's `sendExtras` (typically
|
|
1013
|
+
* `useComposer({ sendExtras: () => ({ model }) })`) so `composeSendInput`
|
|
1014
|
+
* carries it. Absent → no picker renders and the composer behaves as before.
|
|
1015
|
+
*/
|
|
1016
|
+
models?: ClientModel[] | undefined;
|
|
1017
|
+
/** The currently selected model id (the picker's controlled value). */
|
|
1018
|
+
selectedModel?: string | undefined;
|
|
1019
|
+
/** Called with the chosen model id when the operator picks one. */
|
|
1020
|
+
onSelectModel?: ((modelId: string) => void) | undefined;
|
|
1021
|
+
className?: string | undefined;
|
|
1022
|
+
/**
|
|
1023
|
+
* Slash-command palette. Defaults to the built-in {@link defaultCommands};
|
|
1024
|
+
* apps concat their own. Backward-compatible: when `commandContext` is absent
|
|
1025
|
+
* the palette is inert and behavior is identical to before.
|
|
1026
|
+
*/
|
|
1027
|
+
commands?: readonly SlashCommand[] | undefined;
|
|
1028
|
+
/**
|
|
1029
|
+
* Wiring the palette needs to run server commands and gate visibility. The
|
|
1030
|
+
* composer supplies notice/openHelp/clearView/confirm internally.
|
|
1031
|
+
*/
|
|
1032
|
+
commandContext?: SlashCommandContext | undefined;
|
|
1033
|
+
/** Reset the local timeline view (the /clear-view command target). */
|
|
1034
|
+
onClearView?: (() => void) | undefined;
|
|
1035
|
+
};
|
|
1036
|
+
declare const OPEN_WORKSTREAM_CONTROL_EVENT = "opengeni:open-workstream-control";
|
|
1037
|
+
/**
|
|
1038
|
+
* The chat composer — the only human-to-agent input surface. Plain chat in,
|
|
1039
|
+
* everything else is the agent's job. Enter sends, Shift+Enter breaks the
|
|
1040
|
+
* line, and the stop control appears while a turn is running (sending while
|
|
1041
|
+
* running is legitimate steering, so send stays available too).
|
|
1042
|
+
*
|
|
1043
|
+
* Typing a leading "/" opens the slash-command palette — SESSION/OPERATOR
|
|
1044
|
+
* controls (clear, compact, pause goal, help), never a structured channel to
|
|
1045
|
+
* the agent. The palette is purely additive: with no `commandContext` it is
|
|
1046
|
+
* inert and the composer behaves exactly as before.
|
|
1047
|
+
*/
|
|
1048
|
+
declare function ChatComposer({ composer, effectiveControl, queuedAheadCount, canControlWorkspace, controlLinks, placeholder, disabled, autoFocus, hint, controlsStart, header, onPaste, attachments, models, selectedModel, onSelectModel, className, commands, commandContext, onClearView, }: ChatComposerProps): react_jsx_runtime.JSX.Element;
|
|
1049
|
+
|
|
788
1050
|
/** Event types that change the session goal (set/updated/completed/paused/...). */
|
|
789
1051
|
declare function isGoalEvent(event: Pick<SessionEvent, "type">): boolean;
|
|
790
1052
|
type UseGoalOptions = ClientOverride & SessionEventFeedOptions & {
|
|
@@ -824,8 +1086,8 @@ declare function useGoal(sessionId: string | null | undefined, options?: UseGoal
|
|
|
824
1086
|
|
|
825
1087
|
type UseSessionControlOptions = ClientOverride;
|
|
826
1088
|
type UseSessionControlResult = {
|
|
827
|
-
pause: (reason?: string) => Promise<
|
|
828
|
-
resume: (reason?: string) => Promise<
|
|
1089
|
+
pause: (reason?: string) => Promise<SessionControlResponse | null>;
|
|
1090
|
+
resume: (reason?: string) => Promise<SessionControlResponse | null>;
|
|
829
1091
|
controlling: boolean;
|
|
830
1092
|
/** Approve a pending `requires_action` approval. */
|
|
831
1093
|
approve: (approvalId: string, message?: string) => Promise<SessionEvent | null>;
|
|
@@ -1710,90 +1972,6 @@ declare function approvalsFromRequiresAction(payload: unknown): PendingApproval[
|
|
|
1710
1972
|
/** The approvals still awaiting a decision after replaying `events` in order. */
|
|
1711
1973
|
declare function projectPendingApprovals(events: SessionEvent[]): PendingApproval[];
|
|
1712
1974
|
|
|
1713
|
-
/**
|
|
1714
|
-
* The slash-command registry. A command is a SESSION / OPERATOR control — an
|
|
1715
|
-
* action on the session or the UI (clear, compact, pause the goal, show help) —
|
|
1716
|
-
* NOT a structured way to talk to the agent. The human↔agent channel stays
|
|
1717
|
-
* plain chat; the palette only recognizes a leading "/" and never sends a
|
|
1718
|
-
* command to the model.
|
|
1719
|
-
*
|
|
1720
|
-
* Two kinds, modeled by where the handler does its work:
|
|
1721
|
-
* - CLIENT commands touch only the local UI (e.g. /help, /clear-view).
|
|
1722
|
-
* - SERVER commands call the API through the SDK (e.g. /clear, /compact,
|
|
1723
|
-
* /goal).
|
|
1724
|
-
* Both are just `run(args, ctx)`; `ctx` exposes the client for server commands
|
|
1725
|
-
* and the UI affordances (notice, openHelp, clearView, confirm) for both.
|
|
1726
|
-
*/
|
|
1727
|
-
/** A positional argument a command accepts after its name. */
|
|
1728
|
-
type SlashArg = {
|
|
1729
|
-
name: string;
|
|
1730
|
-
/** Enter runs only once every required arg is present; otherwise autocompletes. */
|
|
1731
|
-
required?: boolean;
|
|
1732
|
-
/** Closed value set (rendered as a hint; validated by the command itself). */
|
|
1733
|
-
oneOf?: readonly string[];
|
|
1734
|
-
description?: string;
|
|
1735
|
-
};
|
|
1736
|
-
/** Transient feedback surfaced in the composer (generalized error line). */
|
|
1737
|
-
type Notice = {
|
|
1738
|
-
tone: "ok" | "error";
|
|
1739
|
-
message: string;
|
|
1740
|
-
};
|
|
1741
|
-
/** Everything a command handler can reach. Assembled by the composer. */
|
|
1742
|
-
type CommandContext = {
|
|
1743
|
-
/** SDK-shaped client for server commands. */
|
|
1744
|
-
client: SessionClientLike;
|
|
1745
|
-
workspaceId: string;
|
|
1746
|
-
/** Null before a session exists (server commands should guard on this). */
|
|
1747
|
-
sessionId: string | null;
|
|
1748
|
-
status: SessionStatus$1 | null;
|
|
1749
|
-
/** The operator's permissions on this workspace (gates command visibility). */
|
|
1750
|
-
permissions: Permission[];
|
|
1751
|
-
/** Surface a transient ok/error notice in the composer. */
|
|
1752
|
-
notice: (notice: Notice) => void;
|
|
1753
|
-
/** Open the in-composer /help panel (rendered from the registry). */
|
|
1754
|
-
openHelp: () => void;
|
|
1755
|
-
/**
|
|
1756
|
-
* Reset only the LOCAL timeline view — no server call. Returns whether a
|
|
1757
|
-
* view-reset affordance was actually wired (and thus had an effect): the host
|
|
1758
|
-
* surface supplies one via the composer's `onClearView` prop, and consoles
|
|
1759
|
-
* that don't (no resettable local timeline) get `false`. The /clear-view
|
|
1760
|
-
* command uses this to avoid reporting a false "cleared" success on a no-op.
|
|
1761
|
-
*/
|
|
1762
|
-
clearView: () => boolean;
|
|
1763
|
-
/** Show the danger confirm bar; resolves true once the operator confirms. */
|
|
1764
|
-
confirm: () => Promise<boolean>;
|
|
1765
|
-
};
|
|
1766
|
-
type CommandResult = {
|
|
1767
|
-
status: "ok" | "error";
|
|
1768
|
-
message?: string;
|
|
1769
|
-
/**
|
|
1770
|
-
* Keep the composer draft instead of clearing it on an ok result. Used when a
|
|
1771
|
-
* command resolves to a no-op the operator may want to retry — e.g. canceling
|
|
1772
|
-
* the /clear confirm bar returns ok (no error) but must NOT wipe the typed
|
|
1773
|
-
* "/clear" draft. Default false: a successful command clears the draft.
|
|
1774
|
-
*/
|
|
1775
|
-
keepDraft?: boolean;
|
|
1776
|
-
};
|
|
1777
|
-
type SlashCommand = {
|
|
1778
|
-
/** Primary token after the slash (no leading "/"). */
|
|
1779
|
-
name: string;
|
|
1780
|
-
/** Alternate tokens that resolve to this command. */
|
|
1781
|
-
aliases?: readonly string[];
|
|
1782
|
-
description: string;
|
|
1783
|
-
args?: readonly SlashArg[];
|
|
1784
|
-
/** Required permission; the command is hidden from the palette without it. */
|
|
1785
|
-
permission?: Permission;
|
|
1786
|
-
/** Destructive — the palette shows a confirm bar before running. */
|
|
1787
|
-
danger?: boolean;
|
|
1788
|
-
/**
|
|
1789
|
-
* Dynamic availability beyond the permission gate (e.g. hide a server command
|
|
1790
|
-
* until a session exists). Returning false hides the command.
|
|
1791
|
-
*/
|
|
1792
|
-
available?: (ctx: Pick<CommandContext, "sessionId" | "status" | "permissions">) => boolean;
|
|
1793
|
-
/** Execute the command. Throwing is caught and surfaced as an error notice. */
|
|
1794
|
-
run: (args: string[], ctx: CommandContext) => Promise<CommandResult> | CommandResult;
|
|
1795
|
-
};
|
|
1796
|
-
|
|
1797
1975
|
/**
|
|
1798
1976
|
* Parse a composer value into a command name + the rest. A command is
|
|
1799
1977
|
* recognized ONLY when the value's first character is "/" (the start token);
|
|
@@ -1833,71 +2011,6 @@ declare function firstMissingRequiredArg(command: SlashCommand, args: string[]):
|
|
|
1833
2011
|
*/
|
|
1834
2012
|
declare const defaultCommands: readonly SlashCommand[];
|
|
1835
2013
|
|
|
1836
|
-
/**
|
|
1837
|
-
* Context the composer supplies for command execution and visibility. The
|
|
1838
|
-
* composer owns the UI affordances (notice/openHelp/clearView/confirm), so they
|
|
1839
|
-
* are NOT part of this slice — the hook closes over them via `handlers`.
|
|
1840
|
-
*/
|
|
1841
|
-
type SlashCommandContext = Pick<CommandContext, "client" | "workspaceId" | "sessionId" | "status" | "permissions">;
|
|
1842
|
-
/**
|
|
1843
|
-
* UI affordances the composer supplies. `confirm` differs from the registry-
|
|
1844
|
-
* facing {@link CommandContext.confirm} (which takes no args): the composer's
|
|
1845
|
-
* confirm receives the command being run so the confirm bar renders from that
|
|
1846
|
-
* exact command's identity. The hook bridges the two in {@link buildContext}.
|
|
1847
|
-
*/
|
|
1848
|
-
type SlashCommandHandlers = Pick<CommandContext, "notice" | "openHelp" | "clearView"> & {
|
|
1849
|
-
confirm: (command: SlashCommand) => Promise<boolean>;
|
|
1850
|
-
};
|
|
1851
|
-
type ConfirmState = {
|
|
1852
|
-
command: SlashCommand;
|
|
1853
|
-
/** Resolve the pending confirm() promise. */
|
|
1854
|
-
resolve: (confirmed: boolean) => void;
|
|
1855
|
-
} | null;
|
|
1856
|
-
type UseSlashCommandsOptions = {
|
|
1857
|
-
commands: readonly SlashCommand[];
|
|
1858
|
-
context: SlashCommandContext | undefined;
|
|
1859
|
-
handlers: SlashCommandHandlers;
|
|
1860
|
-
/** The current composer draft. */
|
|
1861
|
-
value: string;
|
|
1862
|
-
/** Replace the composer draft (autocomplete writes through this). */
|
|
1863
|
-
setValue: (value: string) => void;
|
|
1864
|
-
};
|
|
1865
|
-
type UseSlashCommandsResult = {
|
|
1866
|
-
/** Whether the palette is open (a command token is being typed). */
|
|
1867
|
-
open: boolean;
|
|
1868
|
-
/**
|
|
1869
|
-
* Whether the draft is a slash-command attempt (matches a registered command)
|
|
1870
|
-
* — true even after Escape dismisses the popover. The composer blocks its send
|
|
1871
|
-
* path while this holds so a command can't be delivered to the agent as chat.
|
|
1872
|
-
*/
|
|
1873
|
-
isCommandDraft: boolean;
|
|
1874
|
-
/** Commands shown for the current token + context, in display order. */
|
|
1875
|
-
items: SlashCommand[];
|
|
1876
|
-
/** Index into `items` of the highlighted row. */
|
|
1877
|
-
highlight: number;
|
|
1878
|
-
setHighlight: (index: number) => void;
|
|
1879
|
-
/** The matched command once the name is closed by a space (arg-hint mode). */
|
|
1880
|
-
activeCommand: SlashCommand | null;
|
|
1881
|
-
/** The arg hint string for the active command (footer), or "". */
|
|
1882
|
-
activeArgHint: string;
|
|
1883
|
-
/**
|
|
1884
|
-
* Key handler for the textarea. Returns true when it consumed the event
|
|
1885
|
-
* (the composer must then NOT run its send path). Only consumes while open.
|
|
1886
|
-
*/
|
|
1887
|
-
onKeyDown: (event: KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
1888
|
-
/** Run the highlighted command (or the active command in arg-hint mode). */
|
|
1889
|
-
runHighlighted: () => Promise<void>;
|
|
1890
|
-
/**
|
|
1891
|
-
* Run the command at an explicitly chosen index (a pointer click on a row).
|
|
1892
|
-
* Bypasses the exact-match token heuristic that runHighlighted uses for
|
|
1893
|
-
* keyboard Enter, so an explicit click always runs the clicked command.
|
|
1894
|
-
*/
|
|
1895
|
-
runAt: (index: number) => Promise<void>;
|
|
1896
|
-
/** Autocomplete the highlighted command name + a trailing space. */
|
|
1897
|
-
autocompleteHighlighted: () => void;
|
|
1898
|
-
};
|
|
1899
|
-
declare function useSlashCommands(options: UseSlashCommandsOptions): UseSlashCommandsResult;
|
|
1900
|
-
|
|
1901
2014
|
type CommandPaletteProps = {
|
|
1902
2015
|
open: boolean;
|
|
1903
2016
|
items: SlashCommand[];
|
|
@@ -1919,72 +2032,6 @@ type CommandPaletteProps = {
|
|
|
1919
2032
|
*/
|
|
1920
2033
|
declare function CommandPalette({ open, items, highlight, onHighlight, onRun, argHintText, listboxId, }: CommandPaletteProps): react_jsx_runtime.JSX.Element;
|
|
1921
2034
|
|
|
1922
|
-
type ChatComposerProps = {
|
|
1923
|
-
composer: ComposerState;
|
|
1924
|
-
/** Current session status; shows the stop control while a turn runs. */
|
|
1925
|
-
status?: SessionStatus$1 | null | undefined;
|
|
1926
|
-
placeholder?: string | undefined;
|
|
1927
|
-
disabled?: boolean | undefined;
|
|
1928
|
-
autoFocus?: boolean | undefined;
|
|
1929
|
-
/** Replaces the default keyboard hint under the field. */
|
|
1930
|
-
hint?: string | undefined;
|
|
1931
|
-
/** App controls (model picker, attach button, ...) in the footer row, replacing the hint. */
|
|
1932
|
-
controlsStart?: ReactNode | undefined;
|
|
1933
|
-
/** Content rendered above the textarea, inside the field chrome (e.g. attachment chips). */
|
|
1934
|
-
header?: ReactNode | undefined;
|
|
1935
|
-
/** Paste hook on the textarea (e.g. paste-image-to-attach). */
|
|
1936
|
-
onPaste?: ((event: ClipboardEvent<HTMLTextAreaElement>) => void) | undefined;
|
|
1937
|
-
/**
|
|
1938
|
-
* Opt-in file attachments. When supplied (e.g. from {@link useFileAttachments}),
|
|
1939
|
-
* the composer renders a built-in attach button (prepended to `controlsStart`),
|
|
1940
|
-
* an attachment-chips strip (above the textarea, before any host `header`),
|
|
1941
|
-
* routes paste through `addFromPaste` (image/* filter lives in the hook), and
|
|
1942
|
-
* gates send while `uploading` so a message never departs without its files.
|
|
1943
|
-
* Absent → no attachment UI renders and the composer behaves exactly as before.
|
|
1944
|
-
*/
|
|
1945
|
-
attachments?: UseFileAttachmentsResult | undefined;
|
|
1946
|
-
/**
|
|
1947
|
-
* Opt-in model picker. When supplied (e.g. from {@link useAvailableModels}),
|
|
1948
|
-
* the composer renders a {@link ModelPicker} at the start of `controlsStart`
|
|
1949
|
-
* so the operator can choose which host-exposed model serves the next message.
|
|
1950
|
-
* The host owns the selection (`selectedModel`/`onSelectModel`) and is
|
|
1951
|
-
* responsible for threading it into the composer's `sendExtras` (typically
|
|
1952
|
-
* `useComposer({ sendExtras: () => ({ model }) })`) so `composeSendInput`
|
|
1953
|
-
* carries it. Absent → no picker renders and the composer behaves as before.
|
|
1954
|
-
*/
|
|
1955
|
-
models?: ClientModel[] | undefined;
|
|
1956
|
-
/** The currently selected model id (the picker's controlled value). */
|
|
1957
|
-
selectedModel?: string | undefined;
|
|
1958
|
-
/** Called with the chosen model id when the operator picks one. */
|
|
1959
|
-
onSelectModel?: ((modelId: string) => void) | undefined;
|
|
1960
|
-
className?: string | undefined;
|
|
1961
|
-
/**
|
|
1962
|
-
* Slash-command palette. Defaults to the built-in {@link defaultCommands};
|
|
1963
|
-
* apps concat their own. Backward-compatible: when `commandContext` is absent
|
|
1964
|
-
* the palette is inert and behavior is identical to before.
|
|
1965
|
-
*/
|
|
1966
|
-
commands?: readonly SlashCommand[] | undefined;
|
|
1967
|
-
/**
|
|
1968
|
-
* Wiring the palette needs to run server commands and gate visibility. The
|
|
1969
|
-
* composer supplies notice/openHelp/clearView/confirm internally.
|
|
1970
|
-
*/
|
|
1971
|
-
commandContext?: SlashCommandContext | undefined;
|
|
1972
|
-
/** Reset the local timeline view (the /clear-view command target). */
|
|
1973
|
-
onClearView?: (() => void) | undefined;
|
|
1974
|
-
};
|
|
1975
|
-
/**
|
|
1976
|
-
* The chat composer — the only human-to-agent input surface. Plain chat in,
|
|
1977
|
-
* everything else is the agent's job. Enter sends, Shift+Enter breaks the
|
|
1978
|
-
* line, and the stop control appears while a turn is running (sending while
|
|
1979
|
-
* running is legitimate steering, so send stays available too).
|
|
1980
|
-
*
|
|
1981
|
-
* Typing a leading "/" opens the slash-command palette — SESSION/OPERATOR
|
|
1982
|
-
* controls (clear, compact, pause goal, help), never a structured channel to
|
|
1983
|
-
* the agent. The palette is purely additive: with no `commandContext` it is
|
|
1984
|
-
* inert and the composer behaves exactly as before.
|
|
1985
|
-
*/
|
|
1986
|
-
declare function ChatComposer({ composer, status, placeholder, disabled, autoFocus, hint, controlsStart, header, onPaste, attachments, models, selectedModel, onSelectModel, className, commands, commandContext, onClearView, }: ChatComposerProps): react_jsx_runtime.JSX.Element;
|
|
1987
|
-
|
|
1988
2035
|
type ModelPickerProps = {
|
|
1989
2036
|
/** The host-exposed models to choose from (typically {@link useAvailableModels}). */
|
|
1990
2037
|
models: ClientModel[];
|
|
@@ -2466,6 +2513,14 @@ type SandboxFilesProps = {
|
|
|
2466
2513
|
* dock warms the box on this so the save lands fast; opening/reading never fires
|
|
2467
2514
|
* it. Browsing the tree/diff must not warm a box. */
|
|
2468
2515
|
onEditIntent?: (() => void) | undefined;
|
|
2516
|
+
/** A guarded diff path routed here by the parent workspace. */
|
|
2517
|
+
requestedPath?: string | undefined;
|
|
2518
|
+
/** Identity for one guarded-file request. Increment this when the same path is
|
|
2519
|
+
* deliberately requested again; it also lets a pending request be consumed
|
|
2520
|
+
* without overriding later manual tree navigation. Defaults to the path. */
|
|
2521
|
+
requestedPathRequestId?: string | number | undefined;
|
|
2522
|
+
/** False while the parent is waking a cold sandbox for `requestedPath`. */
|
|
2523
|
+
requestedPathReady?: boolean | undefined;
|
|
2469
2524
|
themeType?: "dark" | "light" | undefined;
|
|
2470
2525
|
className?: string | undefined;
|
|
2471
2526
|
};
|
|
@@ -2476,7 +2531,7 @@ type SandboxFilesProps = {
|
|
|
2476
2531
|
* surface deliberately does NOT replicate the changed-files list, and does not
|
|
2477
2532
|
* diff here — one job per tab). The agent commits; the human reviews.
|
|
2478
2533
|
*/
|
|
2479
|
-
declare function SandboxFiles({ files, git, fileSystemAvailable, usePierre, editable, onEditIntent, themeType, className, }: SandboxFilesProps): react_jsx_runtime.JSX.Element;
|
|
2534
|
+
declare function SandboxFiles({ files, git, fileSystemAvailable, usePierre, editable, onEditIntent, requestedPath, requestedPathRequestId, requestedPathReady, themeType, className, }: SandboxFilesProps): react_jsx_runtime.JSX.Element;
|
|
2480
2535
|
|
|
2481
2536
|
type DesktopViewerProps = {
|
|
2482
2537
|
/** The desktop cell of the negotiated capabilities (`capabilities.DesktopStream`). */
|
|
@@ -2610,11 +2665,9 @@ declare const WORKBENCH_TAB_FILES = "files";
|
|
|
2610
2665
|
* "changes exist → Changes, else Files" needs zero machine round-trips. A host
|
|
2611
2666
|
* `override` (e.g. a landing "run" tab) wins when supplied.
|
|
2612
2667
|
*
|
|
2613
|
-
*
|
|
2614
|
-
*
|
|
2615
|
-
*
|
|
2616
|
-
* 2). This remains exported as a standalone helper for hosts that already hold
|
|
2617
|
-
* the event log and want the same decision without the capture fetch.
|
|
2668
|
+
* `<SandboxWorkspace>` uses this only as an optional early hint after its own
|
|
2669
|
+
* capture GET reports no durable capture. A pure embedder needs no events-at-mount
|
|
2670
|
+
* contract: it falls through to authoritative live Git instead.
|
|
2618
2671
|
*/
|
|
2619
2672
|
declare function initialWorkspaceTab(events: SessionEvent[] | undefined, override?: string | null): string;
|
|
2620
2673
|
type WorkspaceMachine = {
|
|
@@ -2631,21 +2684,27 @@ type UseSandboxWorkspaceTabsOptions = ClientOverride & {
|
|
|
2631
2684
|
sessionId: string;
|
|
2632
2685
|
/** Live event log (usually `useSessionEvents().events`). */
|
|
2633
2686
|
events: SessionEvent[];
|
|
2634
|
-
/** Override the
|
|
2635
|
-
* omitted the workbench picks Changes-vs-Files from
|
|
2687
|
+
/** Override the source-driven default tab (e.g. a host landing tab id). When
|
|
2688
|
+
* omitted the workbench picks Changes-vs-Files from capture or live Git. */
|
|
2636
2689
|
initialTab?: string | null | undefined;
|
|
2637
2690
|
/** Host-routed notifications (mutation errors, desktop-consent failures). The
|
|
2638
2691
|
* package never imports a toast library — the host decides how to surface. */
|
|
2639
2692
|
onNotify?: ((notification: WorkspaceNotification) => void) | undefined;
|
|
2693
|
+
/** File requested by a Changes guard. The Files surface defers the read until
|
|
2694
|
+
* the sandbox is live, then reveals this path. */
|
|
2695
|
+
requestedFilePath?: string | null | undefined;
|
|
2696
|
+
/** Unique identity for `requestedFilePath`, including repeated requests for the
|
|
2697
|
+
* same path. */
|
|
2698
|
+
requestedFileRequestId?: string | number | null | undefined;
|
|
2699
|
+
/** Route a guarded diff into the host's Files tab. */
|
|
2700
|
+
onOpenFile?: ((path: string) => void) | undefined;
|
|
2640
2701
|
};
|
|
2641
2702
|
type UseSandboxWorkspaceTabsResult = {
|
|
2642
2703
|
/** Changes | Files | Terminal | Desktop (capability-gated where noted). */
|
|
2643
2704
|
tabs: WorkspaceTab[];
|
|
2644
|
-
/** The
|
|
2645
|
-
* Files (a host `initialTab` overrides).
|
|
2646
|
-
*
|
|
2647
|
-
* their dock's own first-tab fallback until it latches, which it does ONCE, so it
|
|
2648
|
-
* never causes a post-render switch. */
|
|
2705
|
+
/** The source-driven default tab: Changes when the first authoritative capture
|
|
2706
|
+
* or live Git result has changes, else Files (a host `initialTab` overrides).
|
|
2707
|
+
* null while that source resolves; the choice latches once. */
|
|
2649
2708
|
defaultTab: string | null;
|
|
2650
2709
|
/** The machine-state model for the dock-header chip. */
|
|
2651
2710
|
machine: WorkspaceMachine;
|
|
@@ -2667,7 +2726,7 @@ type SandboxWorkspaceProps = ClientOverride & {
|
|
|
2667
2726
|
/** Host tabs injected AFTER the workbench tabs (e.g. a "Debug" tab). */
|
|
2668
2727
|
trailingTabs?: WorkspaceTab[] | undefined;
|
|
2669
2728
|
/** Override the pre-paint default tab (e.g. a host landing tab id). When
|
|
2670
|
-
* omitted the workbench decides
|
|
2729
|
+
* omitted the workbench decides from capture, then live Git when no capture exists. */
|
|
2671
2730
|
initialTab?: string | undefined;
|
|
2672
2731
|
/** Host-routed notifications (no toast dependency in the package). */
|
|
2673
2732
|
onNotify?: ((notification: WorkspaceNotification) => void) | undefined;
|
|
@@ -2823,4 +2882,4 @@ declare function isCreditExhaustion(input: {
|
|
|
2823
2882
|
*/
|
|
2824
2883
|
declare function humanizeFailureReason(reason: string | null): string | null;
|
|
2825
2884
|
|
|
2826
|
-
export { ActivityDisclosure, type ActivityDisclosureProps, type ActivityItem, ActivityRail, type ActivityRailProps, type AgentMessageItem, type ApplyPatchOperation, type AuthNeededItem, BodyNote, CREDIT_EXHAUSTION_MESSAGE, ChatComposer, type ChatComposerProps, ClientOverride, CodeEditor, type CodeEditorProps, type CodexAccountsClientLike, type CommandContext, CommandPalette, type CommandPaletteProps, type CommandResult, type
|
|
2885
|
+
export { ActivityDisclosure, type ActivityDisclosureProps, type ActivityItem, ActivityRail, type ActivityRailProps, type AgentMessageItem, type ApplyPatchOperation, type AuthNeededItem, BodyNote, CREDIT_EXHAUSTION_MESSAGE, ChatComposer, type ChatComposerProps, ClientOverride, CodeEditor, type CodeEditorProps, type CodexAccountsClientLike, type CommandContext, CommandPalette, type CommandPaletteProps, type CommandResult, type ComposerSendExtras, type ComposerState, type ConfirmState, type CreateToolRegistryOptions, type DeriveMachineChipInput, DesktopViewer, type DesktopViewerProps, type DesktopWebSocketFactory, type DesktopWebSocketLike, type DiffTheme, DiffView, type DiffViewProps, type DisclosureChip, DisclosureDefaultsProvider, FILE_ONLY_MESSAGE_TEXT, type FileAttachment, FileBrowser, type FileBrowserProps, type FileTreeNode, type FileTreeStatus, FleetTile, type FleetTileProps, type GoalItem, LightboxProvider, type MachineChip, type MachineChipState, Markdown, type MarkdownProps, MediaEmpty, MediaSkeleton, MessageTimeline, type MessageTimelineProps, ModelPicker, type ModelPickerProps, type Notice, type NoticeItem, OPEN_WORKSTREAM_CONTROL_EVENT, type ParsedCommandLine, PayloadBlock, type PendingApproval, PierreDiff, type PierreDiffProps, PierreFile, type PierreFileProps, type QueueMutationKind, QueueSurface, type QueueSurfaceProps, type ReasoningItem, SESSION_STATUS_META, SandboxFiles, type SandboxFilesProps, type SandboxItem, SandboxTerminal, type SandboxTerminalProps, SandboxWorkspace, type SandboxWorkspaceProps, ScreenshotFigure, type SessionCapabilitiesState, SessionClientLike, type SessionEventsConnectionState, SessionStatus, type SessionStatusItem, type SessionStatusMeta, type SessionStatusProps, type SlashArg, type SlashCommand, type SlashCommandContext, type SlashCommandHandlers, StatusDot, type StatusDotProps, TermBlock, type TerminalChunk, type TerminalStreamStatus, Thumbnail, type TimelineGroup, type TimelineItem, TimelineRow, type ToolCallItem, type ToolRegistry, type ToolRegistryEntry, type ToolRenderer, type ToolRendererProps, type TurnEndItem, type TurnOutcome, TurnSummary, type TurnSummaryProps, type UseAvailableModelsOptions, type UseAvailableModelsResult, type UseBillingUsageOptions, type UseBillingUsageResult, type UseCodexAccountsOptions, type UseCodexAccountsResult, type UseComposerOptions, type UseDesktopStreamOptions, type UseDesktopStreamResult, type UseEnvironmentsOptions, type UseEnvironmentsResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseGoalOptions, type UseGoalResult, type UseMachineChipOptions, type UsePacksOptions, type UsePacksResult, type UseRelayFrameStreamOptions, type UseRelayFrameStreamResult, type UseRigChangesOptions, type UseRigChangesResult, type UseRigOptions, type UseRigResult, type UseRigVersionsOptions, type UseRigVersionsResult, type UseRigsOptions, type UseRigsResult, type UseSandboxFilesOptions, type UseSandboxFilesResult, type UseSandboxGitOptions, type UseSandboxGitResult, type UseSandboxTerminalOptions, type UseSandboxTerminalResult, type UseSandboxWorkspaceTabsOptions, type UseSandboxWorkspaceTabsResult, type UseScheduledTasksOptions, type UseScheduledTasksResult, type UseSessionCapabilitiesOptions, type UseSessionCapabilitiesResult, type UseSessionControlOptions, type UseSessionControlResult, type UseSessionEventsOptions, type UseSessionEventsResult, type UseSessionLineageOptions, type UseSessionLineageResult, type UseSessionOptions, type UseSessionResult, type UseSlashCommandsOptions, type UseSlashCommandsResult, type UseTerminalStreamOptions, type UseTerminalStreamResult, type UseTurnQueueOptions, type UseTurnQueueResult, type UseVariableSetsOptions, type UseVariableSetsResult, type UseWorkspaceCaptureOptions, type UseWorkspaceCaptureResult, type UseWorkspaceEditOptions, type UseWorkspaceEditResult, type UseWorkspaceSessionsOptions, type UseWorkspaceSessionsResult, type UseWorkspacesOptions, type UseWorkspacesResult, type UserMessageItem, WORKBENCH_TAB_CHANGES, WORKBENCH_TAB_FILES, type WorkerItem, WorkspaceDock, type WorkspaceDockProps, type WorkspaceEditConflict, type WorkspaceEditState, type WorkspaceMachine, type WorkspaceNotification, type WorkspaceTab, type XtermTheme, applyPatchOps, approvalsFromRequiresAction, argHint, buildTimeline, cn, composeSendInput, controlCaret, createDefaultToolRegistry, createToolRegistry, creditExhaustedFromEvents, defaultCommands, defaultToolRegistry, deriveMachineChip, execTruncated, extractSessionRef, filterCommands, firstMissingRequiredArg, formatAsOf, formatBytes, formatRelativeTime, gitFileDiffToPatch, groupTimeline, hasPermission, humanizeFailureReason, initialWorkspaceTab, isApplyPatch, isCodexAccountEvent, isCreditExhaustion, isExecSessionLostBanner, isGoalEvent, isLineageRefreshEvent, isTitleEvent, isTurnQueueEvent, languageForPath, looksBinary, matchCommand, parseCommandLine, parseExecBannerSessionId, parseToolArgs, projectPendingApprovals, rawTypeOf, redactSecrets, sandboxCommandExitCode, sessionDisplayTitle, sessionStatusFromEvents, shouldSteerOnKey, shouldSubmitOnKey, stringifyPayload, stripExecBanner, tailPeek, toolDisplayName, truncate, tryParseJson, unwrapMcpOutput, useAvailableModels, useBillingUsage, useCodexAccounts, useComposer, useDesktopStream, useEnvironments, useFileAttachments, useGoal, useLightbox, useLightboxOptional, useMachineChip, usePacks, useRelayFrameStream, useRig, useRigChanges, useRigVersions, useRigs, useSandboxFiles, useSandboxGit, useSandboxTerminal, useSandboxWorkspaceTabs, useScheduledTasks, useSession, useSessionCapabilities, useSessionControl, useSessionEvents, useSessionLineage, useSlashCommands, useTerminalStream, useTurnQueue, useVariableSets, useWorkspaceCapture, useWorkspaceEdit, useWorkspaceSessions, useWorkspaces, v4aToGitFileDiff, xtermThemeFromTokens };
|