@bobannomi/client 0.5.0 → 0.6.1
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/index.d.ts +5 -43
- package/dist/index.js +11 -118
- package/dist/index.js.map +3 -3
- package/dist/service.js +11 -6
- package/dist/service.js.map +2 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -539,44 +539,6 @@ interface PermissionRequestRecord {
|
|
|
539
539
|
updatedAt: number;
|
|
540
540
|
}
|
|
541
541
|
|
|
542
|
-
interface PluginUiInventory {
|
|
543
|
-
manifestCount: number;
|
|
544
|
-
componentCount: number | null;
|
|
545
|
-
validatedComponentCount: number;
|
|
546
|
-
}
|
|
547
|
-
interface PluginUiInstanceRecord {
|
|
548
|
-
schemaVersion: 2;
|
|
549
|
-
instanceId: string;
|
|
550
|
-
sessionId: string;
|
|
551
|
-
sourceRunId: string;
|
|
552
|
-
sourcePartId: string;
|
|
553
|
-
sourceToolUseId: string;
|
|
554
|
-
sourceToolName: string;
|
|
555
|
-
pluginId: string;
|
|
556
|
-
pluginVersion: string;
|
|
557
|
-
pluginDigest: string;
|
|
558
|
-
componentId: string;
|
|
559
|
-
componentDigest: string;
|
|
560
|
-
title: string;
|
|
561
|
-
surface: "tool-result" | "session-sidebar";
|
|
562
|
-
status: "open" | "resolved" | "dismissed";
|
|
563
|
-
revision: number;
|
|
564
|
-
data: Record<string, JsonValue>;
|
|
565
|
-
activeActionRunId?: string;
|
|
566
|
-
lastActionRunId?: string;
|
|
567
|
-
dismissal?: {
|
|
568
|
-
requestId: string;
|
|
569
|
-
requestFingerprint: string;
|
|
570
|
-
expectedRevision: number;
|
|
571
|
-
revision: number;
|
|
572
|
-
dismissedAt: number;
|
|
573
|
-
};
|
|
574
|
-
createdAt: number;
|
|
575
|
-
updatedAt: number;
|
|
576
|
-
}
|
|
577
|
-
/** Shape validation only; the Server must also verify ownership against the actual Part. */
|
|
578
|
-
declare function readPluginUiInstance(metadata: unknown): PluginUiInstanceRecord | undefined;
|
|
579
|
-
|
|
580
542
|
type SessionManagementAction = "rename" | "pin" | "archive" | "delete";
|
|
581
543
|
interface SessionMutationResult {
|
|
582
544
|
readonly sessionId: string;
|
|
@@ -1918,7 +1880,6 @@ interface PluginInfo {
|
|
|
1918
1880
|
};
|
|
1919
1881
|
runtimeStatus: PluginRuntimeStatus;
|
|
1920
1882
|
inventory: Record<string, number>;
|
|
1921
|
-
uiInventory?: PluginUiInventory;
|
|
1922
1883
|
permissions: {
|
|
1923
1884
|
requested: string[];
|
|
1924
1885
|
approved: string[];
|
|
@@ -2239,12 +2200,13 @@ interface RawRequestOptions extends RequestInit {
|
|
|
2239
2200
|
query?: Record<string, unknown>;
|
|
2240
2201
|
auth?: boolean;
|
|
2241
2202
|
}
|
|
2242
|
-
/** HTTP API 非 2xx
|
|
2203
|
+
/** HTTP API 非 2xx 时抛出,保留状态、响应体、可识别的错误码与服务端追踪 ID。 */
|
|
2243
2204
|
declare class BobanNomiApiError extends Error {
|
|
2244
2205
|
readonly status: number;
|
|
2245
2206
|
readonly body: unknown;
|
|
2207
|
+
readonly traceId?: string | undefined;
|
|
2246
2208
|
readonly code?: string;
|
|
2247
|
-
constructor(message: string, status: number, body: unknown);
|
|
2209
|
+
constructor(message: string, status: number, body: unknown, traceId?: string | undefined);
|
|
2248
2210
|
}
|
|
2249
2211
|
declare function responseField(value: unknown, field: string): unknown;
|
|
2250
2212
|
declare function responseArray<T>(value: unknown, field: string, decode: (item: unknown) => T): T[];
|
|
@@ -4173,5 +4135,5 @@ declare function isWorkMode(value: unknown): value is WorkMode;
|
|
|
4173
4135
|
declare function readSessionRuntimeConfig(session: SessionRecord, defaults?: Partial<SessionRuntimeConfig>): SessionRuntimeConfig;
|
|
4174
4136
|
declare function patchSessionRuntimeMetadata(metadata: Record<string, unknown>, patch: SessionRuntimeConfigPatch): Record<string, unknown>;
|
|
4175
4137
|
|
|
4176
|
-
export { AttachmentResource, BobanNomiApiError, BobanNomiClient, CURRENT_PROTOCOL_VERSION, ChannelResource, CommandResource, ContextResource, DiagnosticResource, EventResource, GitResource, HookResource, HttpTransport, IncompatibleProtocolError, MaintenanceResource, McpResource, McpServersResource, MemoryResource, PermissionResource, PluginMarketplaceResource, PluginResource, ProjectResource, ProtocolClient, ProtocolValidationError, ScheduleResource, SessionResource, SessionSyncController, SettingsResource, SseTransport, TerminalResource, UnsupportedSessionEventSchemaVersionError, WorktreeResource, applyEvent, applyEvents, attachmentRangeHeader, checkProtocolCompatibility, createClientState, createSessionRequestId, getVisibleSessionMessages, hydrateState, isSupersededModelPart, isWorkMode, normalizeApprovalMode, normalizeDaemonBaseUrl, parseCreateSessionGoalInput, parseGoalActionInput, parseMcpCallResultData, parseUpdateSessionGoalInput, patchSessionRuntimeMetadata,
|
|
4177
|
-
export type { AdmitClientPromptInput, AdmitPromptAttachmentInput, AgentEnvironmentCapabilities, AgentPersonaInfo, ApprovalMode, ApprovalReviewRecord, AttachmentAssetRecord, AttachmentStorageGcResult, AttachmentStorageIssue, AttachmentStorageRepairResult, AttachmentStorageReport, AuthStatus, BobanNomiClientOptions, BobanNomiClientState, BobanNomiServerHealth, CancelQueuedClientPromptInput, CancelQueuedPromptResponse, CancelResponseMode, ChannelConnectorRuntimeStatus, ChannelDeliveryRecord, ChannelDeliveryStatus, ChannelDenialNotice, ChannelDomain, ChannelQuery, ChannelRuntimeControlInput, ChannelRuntimeState, ChannelRuntimeStatus, ChannelStatusSnapshot, CleanupCandidate, CleanupPreview, CleanupResult, ClearMemoryInput, ClientModelConnection, ClientModelProvider, ClientProtocolSupport, CommandCatalogEntry, CommandKind, CommandSelection, CommandSource, ConfigureClientSessionInput, ContextBucketId, ContextUsageBucket, ContextUsageSnapshot, ContextUsageTip, ContextUsageTipCode, CreateBackgroundShellInput, CreateBackgroundShellResult, CreateClientSessionInput, CreateScheduledTaskInput, CreateSessionByProjectInput, CreateSessionGoalInput, CreateSessionWithDirectoryInput, CustomModelProviderInput, DaemonRestartPreview, DiagnosticExecutionQuery, DispatchedSessionCreation, DispatchedSessionCreationRequest, DownloadAttachmentOptions, DraftComposerOptions, DraftComposerTarget, DurableChannelMessageInput, DurableChannelMessageResult, EditLatestClientPromptInput, EventSyncOptions, ExecutionInstructions, ExpectedModelConnection, ExternalConversationRecord, FactReplacementResult, FeishuAllowInput, FeishuChannelSnapshot, FeishuComposedSnapshot, FeishuConnectInput, FeishuPatchInput, FeishuRegistrationSnapshot, FeishuRegistrationStartInput, FeishuRegistrationState, ForkClientSessionInput, GlobalSettingsPatch, GoalActionInput, GoalExternalWait, GoalStopReason, HookInfo, HostDiagnosticSnapshots, HttpRequestOptions, HttpTransportOptions, InputDelivery, InterruptSessionResponse, JobCancelReceipt, JobCapabilities, JobInputReceipt, JobKind, JobListResult, JobReadResult, JobSnapshot, JobStatus, JobTarget, JobWaitResult, JsonValue, ListClientMessagePartsOptions, ListCommandsOptions, ListEventsOptions, ListMessagePartsOptions, ListMessagesOptions, ListPermissionsOptions, ListProjectsOptions, ListSessionJobsOptions, ListSessionsOptions, MaintenanceBackupManifest, MaintenanceBackupResult, MarketplaceAddSourceRequest, MarketplaceCancelRequest, MarketplaceCancelResponse, MarketplaceCatalog, MarketplaceCatalogRequest, MarketplaceEntry, MarketplaceInstallInput, MarketplaceInstallRequest, MarketplaceOperation, MarketplacePreview, MarketplacePreviewRequest, MarketplaceProvenance, MarketplaceSelection, MarketplaceSource, MarketplaceSourceEnabledRequest, MarketplaceSourceView, MarketplaceSourcesResponse, McpConfigOperationResult, McpManagedServerConfig, McpManagedServerSummary, McpOAuthLoginInput, McpOAuthLoginResponse, McpOAuthStatusSnapshot, McpRuntimeStatus, McpRuntimeSyncResult, McpServerRuntimeRef, McpServerStatus, MemoryEntryRecord, MemoryListResponse, MemoryRevision, ModelInfo, ModelProviderConnection, ModelProviderInfo, ModelProviderRequest, OAuthOperationEvent, OAuthOperationView, OutputStyleInfo, PermissionRequestRecord, PermissionStatus, PluginArchiveError, PluginArchiveInstallInput, PluginArchivePreview, PluginArchivePreviewInput, PluginGitInstallInput, PluginGitPreview, PluginGitPreviewInput, PluginInfo, PluginListResult, PluginLocalInstallInput, PluginLocalPreview, PluginLocalPreviewInput, PluginRuntimeStatus,
|
|
4138
|
+
export { AttachmentResource, BobanNomiApiError, BobanNomiClient, CURRENT_PROTOCOL_VERSION, ChannelResource, CommandResource, ContextResource, DiagnosticResource, EventResource, GitResource, HookResource, HttpTransport, IncompatibleProtocolError, MaintenanceResource, McpResource, McpServersResource, MemoryResource, PermissionResource, PluginMarketplaceResource, PluginResource, ProjectResource, ProtocolClient, ProtocolValidationError, ScheduleResource, SessionResource, SessionSyncController, SettingsResource, SseTransport, TerminalResource, UnsupportedSessionEventSchemaVersionError, WorktreeResource, applyEvent, applyEvents, attachmentRangeHeader, checkProtocolCompatibility, createClientState, createSessionRequestId, getVisibleSessionMessages, hydrateState, isSupersededModelPart, isWorkMode, normalizeApprovalMode, normalizeDaemonBaseUrl, parseCreateSessionGoalInput, parseGoalActionInput, parseMcpCallResultData, parseUpdateSessionGoalInput, patchSessionRuntimeMetadata, readRuntimeMetadata, readSessionModelRetryState, readSessionModelUsage, readSessionRuntimeConfig, readWorkspaceChangesMetadata, replaceSessionState, responseArray, responseField, selectFirstPendingPermission, selectSessionInputs, selectSessionMessagesWithParts, selectSessionModelRetry, selectSessionModelUsage, selectSessionOrderedMessages, selectSessionParts, selectSessionPermissions, selectSessionRuns, selectSessionTasks, streamServerSentEvents, supportsFeature, syncEvents };
|
|
4139
|
+
export type { AdmitClientPromptInput, AdmitPromptAttachmentInput, AgentEnvironmentCapabilities, AgentPersonaInfo, ApprovalMode, ApprovalReviewRecord, AttachmentAssetRecord, AttachmentStorageGcResult, AttachmentStorageIssue, AttachmentStorageRepairResult, AttachmentStorageReport, AuthStatus, BobanNomiClientOptions, BobanNomiClientState, BobanNomiServerHealth, CancelQueuedClientPromptInput, CancelQueuedPromptResponse, CancelResponseMode, ChannelConnectorRuntimeStatus, ChannelDeliveryRecord, ChannelDeliveryStatus, ChannelDenialNotice, ChannelDomain, ChannelQuery, ChannelRuntimeControlInput, ChannelRuntimeState, ChannelRuntimeStatus, ChannelStatusSnapshot, CleanupCandidate, CleanupPreview, CleanupResult, ClearMemoryInput, ClientModelConnection, ClientModelProvider, ClientProtocolSupport, CommandCatalogEntry, CommandKind, CommandSelection, CommandSource, ConfigureClientSessionInput, ContextBucketId, ContextUsageBucket, ContextUsageSnapshot, ContextUsageTip, ContextUsageTipCode, CreateBackgroundShellInput, CreateBackgroundShellResult, CreateClientSessionInput, CreateScheduledTaskInput, CreateSessionByProjectInput, CreateSessionGoalInput, CreateSessionWithDirectoryInput, CustomModelProviderInput, DaemonRestartPreview, DiagnosticExecutionQuery, DispatchedSessionCreation, DispatchedSessionCreationRequest, DownloadAttachmentOptions, DraftComposerOptions, DraftComposerTarget, DurableChannelMessageInput, DurableChannelMessageResult, EditLatestClientPromptInput, EventSyncOptions, ExecutionInstructions, ExpectedModelConnection, ExternalConversationRecord, FactReplacementResult, FeishuAllowInput, FeishuChannelSnapshot, FeishuComposedSnapshot, FeishuConnectInput, FeishuPatchInput, FeishuRegistrationSnapshot, FeishuRegistrationStartInput, FeishuRegistrationState, ForkClientSessionInput, GlobalSettingsPatch, GoalActionInput, GoalExternalWait, GoalStopReason, HookInfo, HostDiagnosticSnapshots, HttpRequestOptions, HttpTransportOptions, InputDelivery, InterruptSessionResponse, JobCancelReceipt, JobCapabilities, JobInputReceipt, JobKind, JobListResult, JobReadResult, JobSnapshot, JobStatus, JobTarget, JobWaitResult, JsonValue, ListClientMessagePartsOptions, ListCommandsOptions, ListEventsOptions, ListMessagePartsOptions, ListMessagesOptions, ListPermissionsOptions, ListProjectsOptions, ListSessionJobsOptions, ListSessionsOptions, MaintenanceBackupManifest, MaintenanceBackupResult, MarketplaceAddSourceRequest, MarketplaceCancelRequest, MarketplaceCancelResponse, MarketplaceCatalog, MarketplaceCatalogRequest, MarketplaceEntry, MarketplaceInstallInput, MarketplaceInstallRequest, MarketplaceOperation, MarketplacePreview, MarketplacePreviewRequest, MarketplaceProvenance, MarketplaceSelection, MarketplaceSource, MarketplaceSourceEnabledRequest, MarketplaceSourceView, MarketplaceSourcesResponse, McpConfigOperationResult, McpManagedServerConfig, McpManagedServerSummary, McpOAuthLoginInput, McpOAuthLoginResponse, McpOAuthStatusSnapshot, McpRuntimeStatus, McpRuntimeSyncResult, McpServerRuntimeRef, McpServerStatus, MemoryEntryRecord, MemoryListResponse, MemoryRevision, ModelInfo, ModelProviderConnection, ModelProviderInfo, ModelProviderRequest, OAuthOperationEvent, OAuthOperationView, OutputStyleInfo, PermissionRequestRecord, PermissionStatus, PluginArchiveError, PluginArchiveInstallInput, PluginArchivePreview, PluginArchivePreviewInput, PluginGitInstallInput, PluginGitPreview, PluginGitPreviewInput, PluginInfo, PluginListResult, PluginLocalInstallInput, PluginLocalPreview, PluginLocalPreviewInput, PluginRuntimeStatus, ProjectFactRecord, ProjectRecord, PromoteQueuedClientPromptInput, PromoteQueuedPromptResponse, PromptResponse, ProtocolCompatibility, ProviderConnectionTestResult, ProviderDefaultsRequest, ProviderDefaultsSnapshot, ProviderInfo, QueuedPromptCancelReceipt, RawRequestOptions, RecordChannelDeliveryInput, ReloadPluginsResponse, RememberSessionResponse, ReplyPermissionInput, ResolvedSessionConfiguration, ResumeInterruptedRunInput, ResumeInterruptedRunResponse, RewindSessionResponse, RunResult, ScheduledRunRecord, ScheduledTaskRecord, ScheduledTaskStatusSummary, SearchSessionsOptions, ServerCapabilities, SessionActivityPage, SessionAttachmentMessagePartRecord, SessionBucket, SessionComposerContext, SessionConfigurationInput, SessionConfigurationOptions, SessionConfigurationResultInput, SessionConfigurationSnapshot, SessionControlOriginal, SessionControlReceipt, SessionControls, SessionCreationInput, SessionCreationReceipt, SessionDirectoryEntry, SessionDirectoryPage, SessionDirectoryResult, SessionEventRecord, SessionExecutionRecord, SessionExportResponse, SessionFileErrorCode, SessionFileFindInput, SessionFileFindOptions, SessionFileInfo, SessionFileListInput, SessionFileListOptions, SessionFileReadInput, SessionFileReadOptions, SessionFileRequestOptions, SessionFileSearchInput, SessionFileSearchMatch, SessionFileSearchOptions, SessionFileStatInput, SessionFindFilesResult, SessionGoal, SessionGoalRequestReceipt, SessionHandle, SessionInputAttachmentRecord, SessionInputRecord, SessionManagementAction, SessionMessagePartRecord, SessionMessageRecord, SessionMessageWithParts, SessionModelRetryState, SessionModelUsageSummary, SessionMutationPublicReceipt, SessionObservation, SessionRecord, SessionResourceRevision, SessionRunAttemptRecord, SessionRunRecord, SessionRuntimeConfig, SessionRuntimeConfigPatch, SessionSearchFilesResult, SessionSearchResult, AgentSessionStateSnapshot as SessionStateSnapshot, SessionSyncControllerOptions, SessionTextFileResult, SessionTransformationMessagePartRecord, SessionUsageResponse, SessionUserInputItem, SkillInfo, SkillMarketplaceEntry, SkillMarketplaceInstallInput, SkillProject, SkillSnapshot, SkillSource, StartDreamResponse, StorageCategory, StorageReport, StorageRetentionPolicy, SyncConnectionStatus, SyncEventUpdate, SyncEventsClient, TaskWorktreeRecord, TerminalCreateRequest, TerminalEvent, TerminalReadRequest, TerminalReadResult, TerminalResizeRequest, TerminalRuntime, TerminalSessionInfo, TerminalSessionStatus, TerminalSignal, TerminalSource, TerminalWriteRequest, UpdateMemoryEntryInput, UpdateScheduledTaskInput, UpdateSessionGoalInput, UploadAttachmentInput, UsageFilter, UsagePrice, UsageReport, UsageRequest, UsageSettings, WorkMode, WorkspaceChangeFile, WorkspaceChangesMetadata };
|
package/dist/index.js
CHANGED
|
@@ -659,50 +659,6 @@ var AUTO_REVIEW_VERDICT_SET = new Set(AUTO_REVIEW_VERDICTS);
|
|
|
659
659
|
var AUTO_REVIEW_SEVERITY_SET = new Set(AUTO_REVIEW_SEVERITIES);
|
|
660
660
|
var AUTO_REVIEW_REASON_SET = new Set(AUTO_REVIEW_REASONS);
|
|
661
661
|
|
|
662
|
-
// ../json-data/src/json.ts
|
|
663
|
-
function isJsonObject(value) {
|
|
664
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
665
|
-
const prototype = Object.getPrototypeOf(value);
|
|
666
|
-
return prototype === Object.prototype || prototype === null;
|
|
667
|
-
}
|
|
668
|
-
function isJsonRecord(value, byteLimit) {
|
|
669
|
-
return validateJsonRecord(value, byteLimit).valid;
|
|
670
|
-
}
|
|
671
|
-
function validateJsonRecord(value, byteLimit) {
|
|
672
|
-
if (!isJsonObject(value)) return { valid: false, reason: "invalid_json" };
|
|
673
|
-
try {
|
|
674
|
-
if (new TextEncoder().encode(stringifyCanonicalJson(value)).byteLength > byteLimit) {
|
|
675
|
-
return { valid: false, reason: "payload_too_large" };
|
|
676
|
-
}
|
|
677
|
-
return { valid: true, value };
|
|
678
|
-
} catch {
|
|
679
|
-
return { valid: false, reason: "invalid_json" };
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
function stringifyCanonicalJson(value) {
|
|
683
|
-
const render = (item, depth) => {
|
|
684
|
-
if (item === null || typeof item === "string" || typeof item === "boolean") {
|
|
685
|
-
return JSON.stringify(item);
|
|
686
|
-
}
|
|
687
|
-
if (typeof item === "number" && Number.isFinite(item))
|
|
688
|
-
return JSON.stringify(item);
|
|
689
|
-
if (typeof item !== "object" || item === null)
|
|
690
|
-
throw new Error("Finite requires JSON data");
|
|
691
|
-
if (depth >= 20)
|
|
692
|
-
throw new Error("Finite JSON nesting limit exceeded");
|
|
693
|
-
if (Array.isArray(item)) {
|
|
694
|
-
return `[${Array.from(item, (child) => render(child, depth + 1)).join(",")}]`;
|
|
695
|
-
}
|
|
696
|
-
const prototype = Object.getPrototypeOf(item);
|
|
697
|
-
if (prototype !== Object.prototype && prototype !== null) {
|
|
698
|
-
throw new Error("Finite requires plain JSON objects");
|
|
699
|
-
}
|
|
700
|
-
const record5 = item;
|
|
701
|
-
return `{${Object.keys(record5).sort().map((key) => `${JSON.stringify(key)}:${render(record5[key], depth + 1)}`).join(",")}}`;
|
|
702
|
-
};
|
|
703
|
-
return render(value, 0);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
662
|
// ../plugin-contracts/src/manifest/limits.ts
|
|
707
663
|
var PLUGIN_APP_MANIFEST_LIMITS = Object.freeze({
|
|
708
664
|
manifestCount: 8,
|
|
@@ -716,76 +672,6 @@ var PLUGIN_APP_DATA_LIMITS = Object.freeze({ maxArgsBytes: 64 * 1024 * 1024, jso
|
|
|
716
672
|
// ../domain-contracts/src/plugin-apps/limits.ts
|
|
717
673
|
var PLUGIN_APP_INPUT_LIMITS = Object.freeze({ handoffBytes: 32 * 1024, messageCharacters: 4096, maxComposerContexts: 8 });
|
|
718
674
|
|
|
719
|
-
// ../domain-contracts/src/plugin-apps/history.ts
|
|
720
|
-
var isPluginUiRevision = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
721
|
-
var isPluginUiUuid = (value) => typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
722
|
-
var PLUGIN_UI_LIMITS = { dataBytes: 256 * 1024, actionArgsBytes: 64 * 1024 };
|
|
723
|
-
function exactFields(record5, required, optional = []) {
|
|
724
|
-
return required.every((key) => Object.hasOwn(record5, key)) && Object.keys(record5).every(
|
|
725
|
-
(key) => required.includes(key) || optional.includes(key)
|
|
726
|
-
);
|
|
727
|
-
}
|
|
728
|
-
function nonempty(value) {
|
|
729
|
-
return typeof value === "string" && value.trim().length > 0;
|
|
730
|
-
}
|
|
731
|
-
function digest(value) {
|
|
732
|
-
return typeof value === "string" && /^[0-9a-f]{64}$/i.test(value);
|
|
733
|
-
}
|
|
734
|
-
function finite(value) {
|
|
735
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
736
|
-
}
|
|
737
|
-
function readPluginUiInstance(metadata) {
|
|
738
|
-
if (!isJsonObject(metadata) || !Object.hasOwn(metadata, "pluginUi"))
|
|
739
|
-
return void 0;
|
|
740
|
-
const record5 = metadata.pluginUi;
|
|
741
|
-
const source = [
|
|
742
|
-
"sessionId",
|
|
743
|
-
"sourceRunId",
|
|
744
|
-
"sourcePartId",
|
|
745
|
-
"sourceToolUseId",
|
|
746
|
-
"sourceToolName",
|
|
747
|
-
"pluginId",
|
|
748
|
-
"pluginVersion",
|
|
749
|
-
"componentId",
|
|
750
|
-
"title"
|
|
751
|
-
];
|
|
752
|
-
if (!isJsonObject(record5) || !exactFields(
|
|
753
|
-
record5,
|
|
754
|
-
[
|
|
755
|
-
"schemaVersion",
|
|
756
|
-
"instanceId",
|
|
757
|
-
...source,
|
|
758
|
-
"pluginDigest",
|
|
759
|
-
"componentDigest",
|
|
760
|
-
"surface",
|
|
761
|
-
"status",
|
|
762
|
-
"revision",
|
|
763
|
-
"data",
|
|
764
|
-
"createdAt",
|
|
765
|
-
"updatedAt"
|
|
766
|
-
],
|
|
767
|
-
["activeActionRunId", "lastActionRunId", "dismissal"]
|
|
768
|
-
))
|
|
769
|
-
return void 0;
|
|
770
|
-
if (record5.schemaVersion !== 2 || !isPluginUiUuid(record5.instanceId) || !source.every((key) => nonempty(record5[key])) || !digest(record5.pluginDigest) || !digest(record5.componentDigest) || record5.surface !== "tool-result" && record5.surface !== "session-sidebar" || !["open", "resolved", "dismissed"].includes(record5.status) || !isPluginUiRevision(record5.revision) || !finite(record5.createdAt) || !finite(record5.updatedAt) || !isJsonRecord(record5.data, PLUGIN_UI_LIMITS.dataBytes))
|
|
771
|
-
return void 0;
|
|
772
|
-
for (const key of ["activeActionRunId", "lastActionRunId"]) {
|
|
773
|
-
if (Object.hasOwn(record5, key) && !nonempty(record5[key])) return void 0;
|
|
774
|
-
}
|
|
775
|
-
if (Object.hasOwn(record5, "dismissal")) {
|
|
776
|
-
const dismissal = record5.dismissal;
|
|
777
|
-
if (!isJsonObject(dismissal) || !exactFields(dismissal, [
|
|
778
|
-
"requestId",
|
|
779
|
-
"requestFingerprint",
|
|
780
|
-
"expectedRevision",
|
|
781
|
-
"revision",
|
|
782
|
-
"dismissedAt"
|
|
783
|
-
]) || !isPluginUiUuid(dismissal.requestId) || !digest(dismissal.requestFingerprint) || !isPluginUiRevision(dismissal.expectedRevision) || !isPluginUiRevision(dismissal.revision) || !finite(dismissal.dismissedAt))
|
|
784
|
-
return void 0;
|
|
785
|
-
}
|
|
786
|
-
return record5;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
675
|
// ../protocol/src/serialization/json.ts
|
|
790
676
|
function isUuid(value) {
|
|
791
677
|
return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
|
|
@@ -2465,10 +2351,11 @@ var ProtocolClient = class {
|
|
|
2465
2351
|
|
|
2466
2352
|
// src/transport/http-transport.ts
|
|
2467
2353
|
var BobanNomiApiError = class extends Error {
|
|
2468
|
-
constructor(message, status, body) {
|
|
2354
|
+
constructor(message, status, body, traceId) {
|
|
2469
2355
|
super(message);
|
|
2470
2356
|
this.status = status;
|
|
2471
2357
|
this.body = body;
|
|
2358
|
+
this.traceId = traceId;
|
|
2472
2359
|
this.name = "BobanNomiApiError";
|
|
2473
2360
|
if (!body || typeof body !== "object" || Array.isArray(body)) return;
|
|
2474
2361
|
const { code, error } = body;
|
|
@@ -2479,6 +2366,7 @@ var BobanNomiApiError = class extends Error {
|
|
|
2479
2366
|
}
|
|
2480
2367
|
status;
|
|
2481
2368
|
body;
|
|
2369
|
+
traceId;
|
|
2482
2370
|
};
|
|
2483
2371
|
function responseField(value, field) {
|
|
2484
2372
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -2555,14 +2443,20 @@ function assertPositiveSafeInteger(value, field) {
|
|
|
2555
2443
|
}
|
|
2556
2444
|
}
|
|
2557
2445
|
async function throwResponseError(response) {
|
|
2446
|
+
const traceHeader = response.headers.get("x-bobannomi-trace-id");
|
|
2447
|
+
const traceId = traceHeader && /^[A-Za-z0-9._:-]{1,128}$/.test(traceHeader) ? traceHeader : void 0;
|
|
2558
2448
|
const text3 = await response.text().catch(() => "");
|
|
2559
2449
|
let body = text3;
|
|
2560
2450
|
try {
|
|
2561
2451
|
body = JSON.parse(text3);
|
|
2562
2452
|
} catch {
|
|
2563
2453
|
}
|
|
2564
|
-
|
|
2565
|
-
|
|
2454
|
+
let message = `BobanNomi API request failed with ${response.status}`;
|
|
2455
|
+
if (body && typeof body === "object") {
|
|
2456
|
+
if ("message" in body && typeof body.message === "string") message = body.message;
|
|
2457
|
+
else if ("error" in body && typeof body.error === "string") message = body.error;
|
|
2458
|
+
}
|
|
2459
|
+
throw new BobanNomiApiError(message, response.status, body, traceId);
|
|
2566
2460
|
}
|
|
2567
2461
|
var HttpTransport = class {
|
|
2568
2462
|
protocolHandshake;
|
|
@@ -5672,7 +5566,6 @@ export {
|
|
|
5672
5566
|
parseMcpCallResultData,
|
|
5673
5567
|
parseUpdateSessionGoalInput2 as parseUpdateSessionGoalInput,
|
|
5674
5568
|
patchSessionRuntimeMetadata,
|
|
5675
|
-
readPluginUiInstance,
|
|
5676
5569
|
readRuntimeMetadata2 as readRuntimeMetadata,
|
|
5677
5570
|
readSessionModelRetryState,
|
|
5678
5571
|
readSessionModelUsage,
|