@nextclaw/shared 0.4.21 → 0.4.23
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 +95 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +132 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -142,7 +142,6 @@ type UiShowContentEventPayload = {
|
|
|
142
142
|
};
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region src/types/inbox-delivery.types.d.ts
|
|
145
|
-
declare const INBOX_DELIVERY_SESSION_METADATA_KEY = "inbox_delivery_id";
|
|
146
145
|
type InboxDeliveryContentType = "markdown" | "html";
|
|
147
146
|
type InboxDeliverySource = {
|
|
148
147
|
kind: "agent";
|
|
@@ -163,7 +162,6 @@ type InboxDelivery = {
|
|
|
163
162
|
presentedAt: string | null;
|
|
164
163
|
readAt: string | null;
|
|
165
164
|
archivedAt: string | null;
|
|
166
|
-
conversationSessionId: string | null;
|
|
167
165
|
};
|
|
168
166
|
type InboxDeliveryListView = {
|
|
169
167
|
deliveries: InboxDelivery[];
|
|
@@ -175,11 +173,6 @@ type InboxDeliveryStateAction = "present" | "read" | "mark_unread" | "archive" |
|
|
|
175
173
|
type InboxDeliveryStateUpdate = {
|
|
176
174
|
action: InboxDeliveryStateAction;
|
|
177
175
|
};
|
|
178
|
-
type InboxDeliveryContinueResult = {
|
|
179
|
-
delivery: InboxDelivery;
|
|
180
|
-
sessionId: string;
|
|
181
|
-
created: boolean;
|
|
182
|
-
};
|
|
183
176
|
type InboxDeliveryChangedEventPayload = {
|
|
184
177
|
deliveryId: string;
|
|
185
178
|
operation: "upsert" | "delete";
|
|
@@ -251,6 +244,9 @@ declare const eventKeys: {
|
|
|
251
244
|
sessionKey: string;
|
|
252
245
|
}>;
|
|
253
246
|
readonly uiShowContent: AppEventKey<UiShowContentEventPayload>;
|
|
247
|
+
readonly serverPathChanged: AppEventKey<{
|
|
248
|
+
directoryPath: string;
|
|
249
|
+
}>;
|
|
254
250
|
readonly inboxDeliveryChanged: AppEventKey<InboxDeliveryChangedEventPayload>;
|
|
255
251
|
readonly configReloadStarted: AppEventKey<Record<string, unknown> | undefined>;
|
|
256
252
|
readonly configReloadFinished: AppEventKey<Record<string, unknown> | undefined>;
|
|
@@ -420,6 +416,17 @@ type RuntimeModelSelectionMode = "nextclaw" | "optional" | "runtime-default";
|
|
|
420
416
|
declare function isRuntimeDefaultModelValue(value: unknown): boolean;
|
|
421
417
|
declare function normalizeRuntimeModelSelectionMode(value: unknown): RuntimeModelSelectionMode;
|
|
422
418
|
//#endregion
|
|
419
|
+
//#region src/configs/chat-ui-resource-reference.config.d.ts
|
|
420
|
+
declare const CHAT_UI_RESOURCE_TOKEN_KIND = "ui_resource";
|
|
421
|
+
type ChatUiResourceReference = {
|
|
422
|
+
uri: string;
|
|
423
|
+
resourceKind: string;
|
|
424
|
+
title: string;
|
|
425
|
+
currentUrl: string;
|
|
426
|
+
contentParams?: UiContentParams;
|
|
427
|
+
};
|
|
428
|
+
declare function readChatUiResourceReference(value: unknown): ChatUiResourceReference | null;
|
|
429
|
+
//#endregion
|
|
423
430
|
//#region src/configs/chat-composer-token.config.d.ts
|
|
424
431
|
declare const CHAT_INLINE_TOKENS_METADATA_KEY = "ui_inline_tokens";
|
|
425
432
|
declare const CHAT_INLINE_TOKENS_SCHEMA_VERSION = 2;
|
|
@@ -428,6 +435,7 @@ declare const CHAT_CONVERSATION_EXCERPT_TOKEN_KIND = "conversation_excerpt";
|
|
|
428
435
|
declare const CHAT_WORKSPACE_FILE_TOKEN_KIND = "workspace_file";
|
|
429
436
|
declare const CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND = "workspace_directory";
|
|
430
437
|
declare const CHAT_WORKSPACE_EXCERPT_TOKEN_KIND = "workspace_excerpt";
|
|
438
|
+
declare const CHAT_SYSTEM_OBJECT_TOKEN_KIND = "system_object";
|
|
431
439
|
type ChatSkillSource = "builtin" | "global" | "project" | "workspace";
|
|
432
440
|
type ChatSkillInlineTokenMetadata = {
|
|
433
441
|
kind: "skill";
|
|
@@ -469,12 +477,90 @@ type ChatProjectInlineTokenMetadata = {
|
|
|
469
477
|
label: string;
|
|
470
478
|
rawText: string;
|
|
471
479
|
};
|
|
472
|
-
type
|
|
480
|
+
type ChatSystemObjectInlineTokenMetadata = {
|
|
481
|
+
kind: typeof CHAT_SYSTEM_OBJECT_TOKEN_KIND;
|
|
482
|
+
key: string;
|
|
483
|
+
label: string;
|
|
484
|
+
rawText: string;
|
|
485
|
+
reference: {
|
|
486
|
+
uri: string;
|
|
487
|
+
objectType: string;
|
|
488
|
+
objectId: string;
|
|
489
|
+
label: string;
|
|
490
|
+
description: string | null;
|
|
491
|
+
updatedAt: string;
|
|
492
|
+
version: string;
|
|
493
|
+
assetUri: string;
|
|
494
|
+
fileName: string;
|
|
495
|
+
mimeType: string;
|
|
496
|
+
sizeBytes: number;
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
type ChatUiResourceInlineTokenMetadata = {
|
|
500
|
+
kind: typeof CHAT_UI_RESOURCE_TOKEN_KIND;
|
|
501
|
+
key: string;
|
|
502
|
+
label: string;
|
|
503
|
+
rawText: string;
|
|
504
|
+
reference: ChatUiResourceReference;
|
|
505
|
+
};
|
|
506
|
+
type ChatInlineTokenMetadata = ChatSkillInlineTokenMetadata | ChatProjectInlineTokenMetadata | ChatWorkspaceInlineTokenMetadata | ChatWorkspaceExcerptInlineTokenMetadata | ChatConversationExcerptInlineTokenMetadata | ChatUiResourceInlineTokenMetadata | ChatSystemObjectInlineTokenMetadata;
|
|
473
507
|
type ChatInlineTokensMetadata = {
|
|
474
508
|
schemaVersion: typeof CHAT_INLINE_TOKENS_SCHEMA_VERSION;
|
|
475
509
|
items: ChatInlineTokenMetadata[];
|
|
476
510
|
};
|
|
477
511
|
//#endregion
|
|
512
|
+
//#region src/configs/system-object-reference.config.d.ts
|
|
513
|
+
declare const SYSTEM_OBJECT_REFERENCE_URI_SCHEME = "nextclaw:";
|
|
514
|
+
declare const SYSTEM_OBJECT_REFERENCE_URI_HOST = "objects";
|
|
515
|
+
declare const SYSTEM_OBJECT_TYPE_INBOX_DELIVERY = "inbox-delivery";
|
|
516
|
+
declare const SYSTEM_OBJECT_TYPE_CRON_JOB = "cron-job";
|
|
517
|
+
declare const SYSTEM_OBJECT_REFERENCE_DEFAULT_LIMIT = 20;
|
|
518
|
+
declare const SYSTEM_OBJECT_REFERENCE_MAX_LIMIT = 50;
|
|
519
|
+
type SystemObjectReferenceDisplayText = {
|
|
520
|
+
default: string;
|
|
521
|
+
translations?: Record<string, string>;
|
|
522
|
+
};
|
|
523
|
+
type SystemObjectReferenceGroupIcon = "calendar-clock" | "file" | "inbox";
|
|
524
|
+
type SystemObjectReferenceGroupDescriptor = {
|
|
525
|
+
objectType: string;
|
|
526
|
+
label: SystemObjectReferenceDisplayText;
|
|
527
|
+
description: SystemObjectReferenceDisplayText;
|
|
528
|
+
icon: SystemObjectReferenceGroupIcon;
|
|
529
|
+
order: number;
|
|
530
|
+
};
|
|
531
|
+
type SystemObjectReferenceItem = {
|
|
532
|
+
uri: string;
|
|
533
|
+
objectType: string;
|
|
534
|
+
objectId: string;
|
|
535
|
+
label: string;
|
|
536
|
+
description: string | null;
|
|
537
|
+
updatedAt: string;
|
|
538
|
+
};
|
|
539
|
+
type SystemObjectReferenceGroupView = SystemObjectReferenceGroupDescriptor & {
|
|
540
|
+
items: SystemObjectReferenceItem[];
|
|
541
|
+
total: number;
|
|
542
|
+
};
|
|
543
|
+
type SystemObjectReferenceListView = {
|
|
544
|
+
groups: SystemObjectReferenceGroupView[];
|
|
545
|
+
total: number;
|
|
546
|
+
};
|
|
547
|
+
type SystemObjectResolvedReference = SystemObjectReferenceItem & {
|
|
548
|
+
version: string;
|
|
549
|
+
assetUri: string;
|
|
550
|
+
fileName: string;
|
|
551
|
+
mimeType: string;
|
|
552
|
+
sizeBytes: number;
|
|
553
|
+
};
|
|
554
|
+
type SystemObjectReferenceResolveRequest = {
|
|
555
|
+
uri: string;
|
|
556
|
+
};
|
|
557
|
+
declare function createSystemObjectReferenceUri(objectType: string, objectId: string): string;
|
|
558
|
+
declare function parseSystemObjectReferenceUri(uri: string): {
|
|
559
|
+
objectType: string;
|
|
560
|
+
objectId: string;
|
|
561
|
+
} | null;
|
|
562
|
+
declare function readSystemObjectResolvedReference(value: unknown): SystemObjectResolvedReference | null;
|
|
563
|
+
//#endregion
|
|
478
564
|
//#region src/configs/panel-app-inline-host.config.d.ts
|
|
479
565
|
declare const PANEL_APP_INLINE_HOST_CONTRACT: {
|
|
480
566
|
readonly contentHeightMessageType: "nextclaw:panel-app-content-height";
|
|
@@ -519,5 +605,5 @@ declare function readUiContentParams(value: unknown): UiContentParams | undefine
|
|
|
519
605
|
declare function createUiContentParamsWindowName(params: UiContentParams | undefined): string | undefined;
|
|
520
606
|
declare function appendUiContentParamsBootstrapQuery(url: string, params: UiContentParams | undefined): string;
|
|
521
607
|
//#endregion
|
|
522
|
-
export { type AgentRunContinueIngressPayload, type AgentRunEditMessageIngressPayload, type AgentRunSendIngressPayload, type AgentRunSessionMaterializationMetadata, type AgentRunSessionMessageRequestPayload, type AppEvent, type AppEventEmitOptions, type AppEventEnvelope, type AppEventHandler, type AppEventKey, type AppEventSource, CHAT_CONTINUATION_TARGET_MESSAGE_METADATA_KEY, CHAT_CONVERSATION_EXCERPT_TOKEN_KIND, CHAT_INLINE_TOKENS_METADATA_KEY, CHAT_INLINE_TOKENS_SCHEMA_VERSION, CHAT_PROJECT_TOKEN_KIND, CHAT_SESSION_MATERIALIZATION_METADATA_KEY, CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND, CHAT_WORKSPACE_EXCERPT_TOKEN_KIND, CHAT_WORKSPACE_FILE_TOKEN_KIND, type ChatConversationExcerptInlineTokenMetadata, type ChatInlineTokenMetadata, type ChatInlineTokensMetadata, type ChatProjectInlineTokenMetadata, type ChatSkillInlineTokenMetadata, type ChatSkillSource, type ChatWorkspaceExcerptInlineTokenMetadata, type ChatWorkspaceInlineTokenMetadata, type Cleanup, type Disposable, DisposableOwner, DisposableStore, EventBus, type EventBusOptions, type EventEmitOptions, type EventEnvelope, type EventHandler, type EventKey, type EventSource, type ExtensionChannelCommandExecuteIngressPayload, type ExtensionChannelCommandExecuteResponse, type ExtensionChannelCommandListIngressPayload, type ExtensionChannelCommandListResponse, type ExtensionChannelCommandOption, type ExtensionChannelCommandOptionType, type ExtensionChannelCommandSpec, type ExtensionChannelConfigGetIngressPayload, type ExtensionChannelFileContent, type ExtensionChannelImageContent, type ExtensionChannelMessageContent, type ExtensionChannelMessageSubmitIngressPayload, type ExtensionChannelSubmittedAttachment, type ExtensionChannelTextContent, type ExtensionResponseIngressPayload, type ExtensionRuntimeReadyIngressPayload,
|
|
608
|
+
export { type AgentRunContinueIngressPayload, type AgentRunEditMessageIngressPayload, type AgentRunSendIngressPayload, type AgentRunSessionMaterializationMetadata, type AgentRunSessionMessageRequestPayload, type AppEvent, type AppEventEmitOptions, type AppEventEnvelope, type AppEventHandler, type AppEventKey, type AppEventSource, CHAT_CONTINUATION_TARGET_MESSAGE_METADATA_KEY, CHAT_CONVERSATION_EXCERPT_TOKEN_KIND, CHAT_INLINE_TOKENS_METADATA_KEY, CHAT_INLINE_TOKENS_SCHEMA_VERSION, CHAT_PROJECT_TOKEN_KIND, CHAT_SESSION_MATERIALIZATION_METADATA_KEY, CHAT_SYSTEM_OBJECT_TOKEN_KIND, CHAT_UI_RESOURCE_TOKEN_KIND, CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND, CHAT_WORKSPACE_EXCERPT_TOKEN_KIND, CHAT_WORKSPACE_FILE_TOKEN_KIND, type ChatConversationExcerptInlineTokenMetadata, type ChatInlineTokenMetadata, type ChatInlineTokensMetadata, type ChatProjectInlineTokenMetadata, type ChatSkillInlineTokenMetadata, type ChatSkillSource, type ChatSystemObjectInlineTokenMetadata, type ChatUiResourceInlineTokenMetadata, type ChatUiResourceReference, type ChatWorkspaceExcerptInlineTokenMetadata, type ChatWorkspaceInlineTokenMetadata, type Cleanup, type Disposable, DisposableOwner, DisposableStore, EventBus, type EventBusOptions, type EventEmitOptions, type EventEnvelope, type EventHandler, type EventKey, type EventSource, type ExtensionChannelCommandExecuteIngressPayload, type ExtensionChannelCommandExecuteResponse, type ExtensionChannelCommandListIngressPayload, type ExtensionChannelCommandListResponse, type ExtensionChannelCommandOption, type ExtensionChannelCommandOptionType, type ExtensionChannelCommandSpec, type ExtensionChannelConfigGetIngressPayload, type ExtensionChannelFileContent, type ExtensionChannelImageContent, type ExtensionChannelMessageContent, type ExtensionChannelMessageSubmitIngressPayload, type ExtensionChannelSubmittedAttachment, type ExtensionChannelTextContent, type ExtensionResponseIngressPayload, type ExtensionRuntimeReadyIngressPayload, type InboxDelivery, type InboxDeliveryChangedEventPayload, type InboxDeliveryContentType, type InboxDeliveryListView, type InboxDeliverySource, type InboxDeliveryStateAction, type InboxDeliveryStateUpdate, Ingress, type IngressContext, type IngressEnvelope, type IngressHandler, type InstallationKind, type Key, PANEL_APP_INLINE_HOST_CONTRACT, PANEL_APP_SCROLL_RESTORATION_CONTRACT, RUNTIME_DEFAULT_MODEL_VALUE, type RuntimeModelSelectionMode, SILENT_REPLY_TOKEN, SYSTEM_OBJECT_REFERENCE_DEFAULT_LIMIT, SYSTEM_OBJECT_REFERENCE_MAX_LIMIT, SYSTEM_OBJECT_REFERENCE_URI_HOST, SYSTEM_OBJECT_REFERENCE_URI_SCHEME, SYSTEM_OBJECT_TYPE_CRON_JOB, SYSTEM_OBJECT_TYPE_INBOX_DELIVERY, type SystemObjectReferenceDisplayText, type SystemObjectReferenceGroupDescriptor, type SystemObjectReferenceGroupIcon, type SystemObjectReferenceGroupView, type SystemObjectReferenceItem, type SystemObjectReferenceListView, type SystemObjectReferenceResolveRequest, type SystemObjectResolvedReference, type TypedKey, UI_CONTENT_PARAMS_HOST_CONTRACT, type UiContentParamValue, type UiContentParams, UiContentParamsError, type UiShowContentEventPayload, type UiShowContentFileViewer, type UiShowContentPlacement, type UiShowContentPurpose, type UiShowContentTarget, type Unsubscribe, type UpdateBlockReason, type UpdateFailureStage, type UpdateProgress, type UpdateSnapshot, type UpdateStatus, appendUiContentParamsBootstrapQuery, containsSilentReplyMarker, createAppEventKey, createEventKey, createSystemObjectReferenceUri, createTypedKey, createUiContentParamsWindowName, eventKeys, getKeyId, ingressKeys, isRuntimeDefaultModelValue, isSilentReplyNcpMessage, normalizeRuntimeModelSelectionMode, parseSystemObjectReferenceUri, readChatUiResourceReference, readInlineContentHeight, readSystemObjectResolvedReference, readUiContentParams, toDisposable };
|
|
523
609
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/typed-key.types.ts","../src/types/event-bus.types.ts","../src/services/event-bus.service.ts","../src/services/ingress.service.ts","../src/services/disposable.service.ts","../src/types/ui-show-content.types.ts","../src/types/inbox-delivery.types.ts","../src/types/update.types.ts","../src/configs/event-keys.config.ts","../src/configs/ingress-keys.config.ts","../src/configs/runtime-model.config.ts","../src/configs/chat-composer-token.config.ts","../src/configs/panel-app-inline-host.config.ts","../src/configs/panel-app-scroll-restoration.config.ts","../src/utils/inline-content-height.utils.ts","../src/utils/silent-reply.utils.ts","../src/utils/ui-content-params.utils.ts"],"mappings":";;;KAAY,QAAA;EAAA,SACD,EAAA;EAAA,SACA,KAAA,GAAQ,CAAA;AAAA;AAAA,KAGP,GAAA,gBAAmB,QAAA,CAAS,CAAA;AAAA,iBAExB,cAAA,GAAA,CAAkB,EAAA,WAAa,QAAA,CAAS,CAAA;AAAA,iBAQxC,QAAA,CAAS,GAAA,EAAK,GAAA;;;KCblB,QAAA,MAAc,QAAA,CAAS,CAAA;AAAA,KAEvB,WAAA;AAAA,KAEA,aAAA;EACV,IAAA;EACA,OAAA,EAAS,CAAA;EACT,SAAA;EACA,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C,mBAAA;EAEN,IAAA;EACA,OAAA;IACE,IAAA;IACA,IAAA;IACA,MAAA;IACA,MAAA,EAAQ,uBAAA;IACR,MAAA,GAAS,eAAA;EAAA;AAAA;EAIX,IAAA;EACA,OAAA;IACE,GAAA;EAAA;AAAA;EAIF,IAAA;EACA,OAAA;IACE,KAAA;IACA,IAAA;IACA,MAAA,GAAS,eAAA;EAAA;AAAA;AAAA,KAIL,yBAAA;EACV,EAAA;EACA,UAAA;EACA,MAAA,EAAQ,mBAAA;EACR,KAAA;EACA,OAAA,EAAS,oBAAA;EACT,SAAA,EAAW,sBAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/typed-key.types.ts","../src/types/event-bus.types.ts","../src/services/event-bus.service.ts","../src/services/ingress.service.ts","../src/services/disposable.service.ts","../src/types/ui-show-content.types.ts","../src/types/inbox-delivery.types.ts","../src/types/update.types.ts","../src/configs/event-keys.config.ts","../src/configs/ingress-keys.config.ts","../src/configs/runtime-model.config.ts","../src/configs/chat-ui-resource-reference.config.ts","../src/configs/chat-composer-token.config.ts","../src/configs/system-object-reference.config.ts","../src/configs/panel-app-inline-host.config.ts","../src/configs/panel-app-scroll-restoration.config.ts","../src/utils/inline-content-height.utils.ts","../src/utils/silent-reply.utils.ts","../src/utils/ui-content-params.utils.ts"],"mappings":";;;KAAY,QAAA;EAAA,SACD,EAAA;EAAA,SACA,KAAA,GAAQ,CAAA;AAAA;AAAA,KAGP,GAAA,gBAAmB,QAAA,CAAS,CAAA;AAAA,iBAExB,cAAA,GAAA,CAAkB,EAAA,WAAa,QAAA,CAAS,CAAA;AAAA,iBAQxC,QAAA,CAAS,GAAA,EAAK,GAAA;;;KCblB,QAAA,MAAc,QAAA,CAAS,CAAA;AAAA,KAEvB,WAAA;AAAA,KAEA,aAAA;EACV,IAAA;EACA,OAAA,EAAS,CAAA;EACT,SAAA;EACA,MAAA,GAAS,WAAA;AAAA;AAAA,KAGC,gBAAA;EACV,SAA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@@ var DisposableStore = class {
|
|
|
193
193
|
};
|
|
194
194
|
};
|
|
195
195
|
//#endregion
|
|
196
|
-
//#region src/types/inbox-delivery.types.ts
|
|
197
|
-
const INBOX_DELIVERY_SESSION_METADATA_KEY = "inbox_delivery_id";
|
|
198
|
-
//#endregion
|
|
199
196
|
//#region src/configs/event-keys.config.ts
|
|
200
197
|
function createEventKey(id) {
|
|
201
198
|
return createTypedKey(id);
|
|
@@ -214,6 +211,7 @@ const eventKeys = {
|
|
|
214
211
|
sessionSummaryUpsert: createAppEventKey("session.summary.upsert"),
|
|
215
212
|
sessionSummaryDelete: createAppEventKey("session.summary.delete"),
|
|
216
213
|
uiShowContent: createAppEventKey("ui.show-content"),
|
|
214
|
+
serverPathChanged: createAppEventKey("server-path.changed"),
|
|
217
215
|
inboxDeliveryChanged: createAppEventKey("inbox.delivery.changed"),
|
|
218
216
|
configReloadStarted: createAppEventKey("config.reload.started"),
|
|
219
217
|
configReloadFinished: createAppEventKey("config.reload.finished"),
|
|
@@ -263,37 +261,7 @@ const CHAT_CONVERSATION_EXCERPT_TOKEN_KIND = "conversation_excerpt";
|
|
|
263
261
|
const CHAT_WORKSPACE_FILE_TOKEN_KIND = "workspace_file";
|
|
264
262
|
const CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND = "workspace_directory";
|
|
265
263
|
const CHAT_WORKSPACE_EXCERPT_TOKEN_KIND = "workspace_excerpt";
|
|
266
|
-
|
|
267
|
-
//#region src/configs/panel-app-inline-host.config.ts
|
|
268
|
-
const PANEL_APP_INLINE_HOST_CONTRACT = {
|
|
269
|
-
contentHeightMessageType: "nextclaw:panel-app-content-height",
|
|
270
|
-
displayMode: "card",
|
|
271
|
-
displayModeSearchParam: "nextclawDisplayMode",
|
|
272
|
-
placement: "inline",
|
|
273
|
-
placementSearchParam: "nextclawPlacement"
|
|
274
|
-
};
|
|
275
|
-
//#endregion
|
|
276
|
-
//#region src/configs/panel-app-scroll-restoration.config.ts
|
|
277
|
-
const PANEL_APP_SCROLL_RESTORATION_CONTRACT = {
|
|
278
|
-
restoreScrollMessageType: "nextclaw:panel-app-restore-scroll",
|
|
279
|
-
scrollMessageType: "nextclaw:panel-app-scroll",
|
|
280
|
-
version: 1
|
|
281
|
-
};
|
|
282
|
-
//#endregion
|
|
283
|
-
//#region src/utils/inline-content-height.utils.ts
|
|
284
|
-
function readInlineContentHeight(body, documentElement) {
|
|
285
|
-
return Math.ceil(Math.max(body?.clientHeight ?? 0, body?.offsetHeight ?? 0, body?.scrollHeight ?? 0, documentElement.offsetHeight));
|
|
286
|
-
}
|
|
287
|
-
//#endregion
|
|
288
|
-
//#region src/utils/silent-reply.utils.ts
|
|
289
|
-
const SILENT_REPLY_TOKEN = "<noreply/>";
|
|
290
|
-
const SILENT_REPLY_MARKER_PATTERN = /<\s*noreply\s*\/\s*>/i;
|
|
291
|
-
function containsSilentReplyMarker(text) {
|
|
292
|
-
return Boolean(text && SILENT_REPLY_MARKER_PATTERN.test(text));
|
|
293
|
-
}
|
|
294
|
-
function isSilentReplyNcpMessage(message) {
|
|
295
|
-
return message.role === "assistant" && message.parts.some((part) => (part.type === "text" || part.type === "rich-text") && containsSilentReplyMarker(part.text));
|
|
296
|
-
}
|
|
264
|
+
const CHAT_SYSTEM_OBJECT_TOKEN_KIND = "system_object";
|
|
297
265
|
//#endregion
|
|
298
266
|
//#region src/utils/ui-content-params.utils.ts
|
|
299
267
|
const UI_CONTENT_PARAMS_HOST_CONTRACT = {
|
|
@@ -349,6 +317,135 @@ function appendUiContentParamsBootstrapQuery(url, params) {
|
|
|
349
317
|
return `${pathname}?${query.toString()}${typeof hash === "string" ? `#${hash}` : ""}`;
|
|
350
318
|
}
|
|
351
319
|
//#endregion
|
|
352
|
-
|
|
320
|
+
//#region src/configs/chat-ui-resource-reference.config.ts
|
|
321
|
+
const CHAT_UI_RESOURCE_TOKEN_KIND = "ui_resource";
|
|
322
|
+
const UI_RESOURCE_KIND_MAX_LENGTH = 80;
|
|
323
|
+
const UI_RESOURCE_TITLE_MAX_LENGTH = 512;
|
|
324
|
+
const UI_RESOURCE_URI_MAX_LENGTH = 8192;
|
|
325
|
+
function isRecord$1(value) {
|
|
326
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
327
|
+
}
|
|
328
|
+
function readBoundedString(value, maxLength) {
|
|
329
|
+
if (typeof value !== "string") return null;
|
|
330
|
+
const normalized = value.trim();
|
|
331
|
+
return normalized && normalized.length <= maxLength ? normalized : null;
|
|
332
|
+
}
|
|
333
|
+
function readChatUiResourceReference(value) {
|
|
334
|
+
if (!isRecord$1(value)) return null;
|
|
335
|
+
const uri = readBoundedString(value.uri, UI_RESOURCE_URI_MAX_LENGTH);
|
|
336
|
+
const resourceKind = readBoundedString(value.resourceKind, UI_RESOURCE_KIND_MAX_LENGTH);
|
|
337
|
+
const title = readBoundedString(value.title, UI_RESOURCE_TITLE_MAX_LENGTH);
|
|
338
|
+
const currentUrl = readBoundedString(value.currentUrl, UI_RESOURCE_URI_MAX_LENGTH);
|
|
339
|
+
if (!uri || !resourceKind || !title || !currentUrl) return null;
|
|
340
|
+
try {
|
|
341
|
+
const contentParams = readUiContentParams(value.contentParams);
|
|
342
|
+
return {
|
|
343
|
+
uri,
|
|
344
|
+
resourceKind,
|
|
345
|
+
title,
|
|
346
|
+
currentUrl,
|
|
347
|
+
...contentParams ? { contentParams: structuredClone(contentParams) } : {}
|
|
348
|
+
};
|
|
349
|
+
} catch {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/configs/system-object-reference.config.ts
|
|
355
|
+
const SYSTEM_OBJECT_REFERENCE_URI_SCHEME = "nextclaw:";
|
|
356
|
+
const SYSTEM_OBJECT_REFERENCE_URI_HOST = "objects";
|
|
357
|
+
const SYSTEM_OBJECT_TYPE_INBOX_DELIVERY = "inbox-delivery";
|
|
358
|
+
const SYSTEM_OBJECT_TYPE_CRON_JOB = "cron-job";
|
|
359
|
+
const SYSTEM_OBJECT_REFERENCE_DEFAULT_LIMIT = 20;
|
|
360
|
+
const SYSTEM_OBJECT_REFERENCE_MAX_LIMIT = 50;
|
|
361
|
+
function isRecord(value) {
|
|
362
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
363
|
+
}
|
|
364
|
+
function readString(value) {
|
|
365
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
366
|
+
}
|
|
367
|
+
function createSystemObjectReferenceUri(objectType, objectId) {
|
|
368
|
+
const normalizedType = objectType.trim();
|
|
369
|
+
const normalizedId = objectId.trim();
|
|
370
|
+
if (!normalizedType || !normalizedId) throw new Error("System object type and id must be non-empty.");
|
|
371
|
+
return `nextclaw://${SYSTEM_OBJECT_REFERENCE_URI_HOST}/${encodeURIComponent(normalizedType)}/${encodeURIComponent(normalizedId)}`;
|
|
372
|
+
}
|
|
373
|
+
function parseSystemObjectReferenceUri(uri) {
|
|
374
|
+
try {
|
|
375
|
+
const parsed = new URL(uri.trim());
|
|
376
|
+
if (parsed.protocol !== "nextclaw:" || parsed.host !== "objects" || parsed.search || parsed.hash) return null;
|
|
377
|
+
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
378
|
+
if (segments.length !== 2) return null;
|
|
379
|
+
const objectType = decodeURIComponent(segments[0] ?? "").trim();
|
|
380
|
+
const objectId = decodeURIComponent(segments[1] ?? "").trim();
|
|
381
|
+
return objectType && objectId ? {
|
|
382
|
+
objectType,
|
|
383
|
+
objectId
|
|
384
|
+
} : null;
|
|
385
|
+
} catch {
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
function readSystemObjectResolvedReference(value) {
|
|
390
|
+
if (!isRecord(value)) return null;
|
|
391
|
+
const uri = readString(value.uri);
|
|
392
|
+
const objectType = readString(value.objectType);
|
|
393
|
+
const objectId = readString(value.objectId);
|
|
394
|
+
const label = readString(value.label);
|
|
395
|
+
const updatedAt = readString(value.updatedAt);
|
|
396
|
+
const version = readString(value.version);
|
|
397
|
+
const assetUri = readString(value.assetUri);
|
|
398
|
+
const fileName = readString(value.fileName);
|
|
399
|
+
const mimeType = readString(value.mimeType);
|
|
400
|
+
const { sizeBytes } = value;
|
|
401
|
+
const parsed = uri ? parseSystemObjectReferenceUri(uri) : null;
|
|
402
|
+
if (!uri || !objectType || !objectId || !parsed || parsed.objectType !== objectType || parsed.objectId !== objectId || !label || !updatedAt || !version || !assetUri || !fileName || !mimeType || typeof sizeBytes !== "number" || !Number.isSafeInteger(sizeBytes) || sizeBytes < 0) return null;
|
|
403
|
+
return {
|
|
404
|
+
uri,
|
|
405
|
+
objectType,
|
|
406
|
+
objectId,
|
|
407
|
+
label,
|
|
408
|
+
description: readString(value.description),
|
|
409
|
+
updatedAt,
|
|
410
|
+
version,
|
|
411
|
+
assetUri,
|
|
412
|
+
fileName,
|
|
413
|
+
mimeType,
|
|
414
|
+
sizeBytes
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/configs/panel-app-inline-host.config.ts
|
|
419
|
+
const PANEL_APP_INLINE_HOST_CONTRACT = {
|
|
420
|
+
contentHeightMessageType: "nextclaw:panel-app-content-height",
|
|
421
|
+
displayMode: "card",
|
|
422
|
+
displayModeSearchParam: "nextclawDisplayMode",
|
|
423
|
+
placement: "inline",
|
|
424
|
+
placementSearchParam: "nextclawPlacement"
|
|
425
|
+
};
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/configs/panel-app-scroll-restoration.config.ts
|
|
428
|
+
const PANEL_APP_SCROLL_RESTORATION_CONTRACT = {
|
|
429
|
+
restoreScrollMessageType: "nextclaw:panel-app-restore-scroll",
|
|
430
|
+
scrollMessageType: "nextclaw:panel-app-scroll",
|
|
431
|
+
version: 1
|
|
432
|
+
};
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region src/utils/inline-content-height.utils.ts
|
|
435
|
+
function readInlineContentHeight(body, documentElement) {
|
|
436
|
+
return Math.ceil(Math.max(body?.clientHeight ?? 0, body?.offsetHeight ?? 0, body?.scrollHeight ?? 0, documentElement.offsetHeight));
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/utils/silent-reply.utils.ts
|
|
440
|
+
const SILENT_REPLY_TOKEN = "<noreply/>";
|
|
441
|
+
const SILENT_REPLY_MARKER_PATTERN = /<\s*noreply\s*\/\s*>/i;
|
|
442
|
+
function containsSilentReplyMarker(text) {
|
|
443
|
+
return Boolean(text && SILENT_REPLY_MARKER_PATTERN.test(text));
|
|
444
|
+
}
|
|
445
|
+
function isSilentReplyNcpMessage(message) {
|
|
446
|
+
return message.role === "assistant" && message.parts.some((part) => (part.type === "text" || part.type === "rich-text") && containsSilentReplyMarker(part.text));
|
|
447
|
+
}
|
|
448
|
+
//#endregion
|
|
449
|
+
export { CHAT_CONTINUATION_TARGET_MESSAGE_METADATA_KEY, CHAT_CONVERSATION_EXCERPT_TOKEN_KIND, CHAT_INLINE_TOKENS_METADATA_KEY, CHAT_INLINE_TOKENS_SCHEMA_VERSION, CHAT_PROJECT_TOKEN_KIND, CHAT_SESSION_MATERIALIZATION_METADATA_KEY, CHAT_SYSTEM_OBJECT_TOKEN_KIND, CHAT_UI_RESOURCE_TOKEN_KIND, CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND, CHAT_WORKSPACE_EXCERPT_TOKEN_KIND, CHAT_WORKSPACE_FILE_TOKEN_KIND, DisposableOwner, DisposableStore, EventBus, Ingress, PANEL_APP_INLINE_HOST_CONTRACT, PANEL_APP_SCROLL_RESTORATION_CONTRACT, RUNTIME_DEFAULT_MODEL_VALUE, SILENT_REPLY_TOKEN, SYSTEM_OBJECT_REFERENCE_DEFAULT_LIMIT, SYSTEM_OBJECT_REFERENCE_MAX_LIMIT, SYSTEM_OBJECT_REFERENCE_URI_HOST, SYSTEM_OBJECT_REFERENCE_URI_SCHEME, SYSTEM_OBJECT_TYPE_CRON_JOB, SYSTEM_OBJECT_TYPE_INBOX_DELIVERY, UI_CONTENT_PARAMS_HOST_CONTRACT, UiContentParamsError, appendUiContentParamsBootstrapQuery, containsSilentReplyMarker, createAppEventKey, createEventKey, createSystemObjectReferenceUri, createTypedKey, createUiContentParamsWindowName, eventKeys, getKeyId, ingressKeys, isRuntimeDefaultModelValue, isSilentReplyNcpMessage, normalizeRuntimeModelSelectionMode, parseSystemObjectReferenceUri, readChatUiResourceReference, readInlineContentHeight, readSystemObjectResolvedReference, readUiContentParams, toDisposable };
|
|
353
450
|
|
|
354
451
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/types/typed-key.types.ts","../src/services/event-bus.service.ts","../src/services/ingress.service.ts","../src/services/disposable.service.ts","../src/types/inbox-delivery.types.ts","../src/configs/event-keys.config.ts","../src/configs/ingress-keys.config.ts","../src/configs/runtime-model.config.ts","../src/configs/chat-composer-token.config.ts","../src/configs/panel-app-inline-host.config.ts","../src/configs/panel-app-scroll-restoration.config.ts","../src/utils/inline-content-height.utils.ts","../src/utils/silent-reply.utils.ts","../src/utils/ui-content-params.utils.ts"],"sourcesContent":["export type TypedKey<T = unknown> = {\n readonly id: string;\n readonly _type?: T;\n};\n\nexport type Key<T = unknown> = TypedKey<T> | string;\n\nexport function createTypedKey<T>(id: string): TypedKey<T> {\n const normalizedId = id.trim();\n if (!normalizedId) {\n throw new Error(\"typed key id is required\");\n }\n return { id: normalizedId };\n}\n\nexport function getKeyId(key: Key<unknown>): string {\n return typeof key === \"string\" ? key.trim() : key.id;\n}\n","import type {\n AppEventEmitOptions,\n AppEventEnvelope,\n AppEventHandler,\n AppEventKey,\n EventBusOptions,\n Unsubscribe,\n} from \"../types/event-bus.types.js\";\nimport { getKeyId, type Key } from \"../types/typed-key.types.js\";\n\nexport class EventBus {\n private readonly listeners = new Map<string, Set<AppEventHandler<unknown>>>();\n private readonly globalListeners = new Set<(event: AppEventEnvelope) => void>();\n private listenerCount = 0;\n private readonly onFirstSubscriber?: EventBusOptions[\"onFirstSubscriber\"];\n private readonly onListenerError?: EventBusOptions[\"onListenerError\"];\n private readonly onNoSubscribers?: EventBusOptions[\"onNoSubscribers\"];\n\n constructor(options: EventBusOptions = {}) {\n this.onFirstSubscriber = options.onFirstSubscriber;\n this.onListenerError = options.onListenerError;\n this.onNoSubscribers = options.onNoSubscribers;\n }\n\n emit = <T>(\n key: Key<T>,\n payload: T,\n options: AppEventEmitOptions = {},\n ): void => {\n const envelope: AppEventEnvelope<T> = {\n type: getKeyId(key),\n payload,\n ...(options.emittedAt ? { emittedAt: options.emittedAt } : {}),\n ...(options.source ? { source: options.source } : {}),\n };\n this.emitEnvelope(envelope);\n };\n\n emitEnvelope = <T>(event: AppEventEnvelope<T>): void => {\n const listeners = this.listeners.get(event.type);\n if (listeners) {\n for (const listener of listeners) {\n this.safeInvokeListener(event, listener as AppEventHandler<T>);\n }\n }\n if (this.globalListeners.size === 0) {\n return;\n }\n for (const listener of this.globalListeners) {\n this.safeInvokeGlobalListener(event, listener);\n }\n };\n\n on = <T>(key: AppEventKey<T>, handler: AppEventHandler<T>): Unsubscribe => {\n const keyId = getKeyId(key);\n const listeners = this.listeners.get(keyId) ?? new Set<AppEventHandler<unknown>>();\n const typedHandler = handler as AppEventHandler<unknown>;\n const added = !listeners.has(typedHandler);\n listeners.add(typedHandler);\n this.listeners.set(keyId, listeners);\n if (added) {\n this.registerSubscriber();\n }\n return () => {\n this.off(key, handler);\n };\n };\n\n off = <T>(key: AppEventKey<T>, handler: AppEventHandler<T>): void => {\n const keyId = getKeyId(key);\n const listeners = this.listeners.get(keyId);\n if (!listeners) {\n return;\n }\n const deleted = listeners.delete(handler as AppEventHandler<unknown>);\n if (listeners.size === 0) {\n this.listeners.delete(keyId);\n }\n if (deleted) {\n this.unregisterSubscriber();\n }\n };\n\n once = <T>(key: AppEventKey<T>, handler: AppEventHandler<T>): Unsubscribe => {\n const wrappedHandler: AppEventHandler<T> = (payload, envelope) => {\n unsubscribe();\n handler(payload, envelope);\n };\n const unsubscribe = this.on(key, wrappedHandler);\n return unsubscribe;\n };\n\n subscribeAll = (handler: (event: AppEventEnvelope) => void): Unsubscribe => {\n const added = !this.globalListeners.has(handler);\n this.globalListeners.add(handler);\n if (added) {\n this.registerSubscriber();\n }\n return () => {\n if (this.globalListeners.delete(handler)) {\n this.unregisterSubscriber();\n }\n };\n };\n\n private registerSubscriber = (): void => {\n this.listenerCount += 1;\n if (this.listenerCount === 1) {\n this.onFirstSubscriber?.();\n }\n };\n\n private unregisterSubscriber = (): void => {\n this.listenerCount = Math.max(0, this.listenerCount - 1);\n if (this.listenerCount === 0) {\n this.onNoSubscribers?.();\n }\n };\n\n private safeInvokeListener = <T>(\n event: AppEventEnvelope<T>,\n listener: AppEventHandler<T>,\n ): void => {\n try {\n listener(event.payload, event);\n } catch (error) {\n this.onListenerError?.({\n type: event.type,\n payload: event.payload,\n error,\n });\n }\n };\n\n private safeInvokeGlobalListener = (\n event: AppEventEnvelope,\n listener: (event: AppEventEnvelope) => void,\n ): void => {\n try {\n listener(event);\n } catch (error) {\n this.onListenerError?.({\n type: event.type,\n payload: event.payload,\n error,\n });\n }\n };\n}\n","import { getKeyId, type Key } from \"../types/typed-key.types.js\";\n\nexport type IngressEnvelope<TPayload = unknown> = {\n type: Key<TPayload>;\n extensionId?: string;\n generation?: string;\n payload?: TPayload;\n source?: string;\n};\n\nexport type IngressContext = {\n source: string;\n token?: string | null;\n};\n\nexport type IngressHandler<TPayload = unknown, TResult = unknown> = (\n envelope: IngressEnvelope<TPayload>,\n context: IngressContext,\n) => Promise<TResult> | TResult;\n\nexport class Ingress {\n private readonly handlers = new Map<string, IngressHandler<unknown, unknown>>();\n\n readonly addHandler = <TPayload = unknown, TResult = unknown>(\n type: Key<TPayload>,\n handler: IngressHandler<TPayload, TResult>,\n ): (() => void) => {\n const normalizedType = getKeyId(type);\n if (!normalizedType) {\n throw new Error(\"ingress type is required\");\n }\n this.handlers.set(normalizedType, handler as IngressHandler<unknown, unknown>);\n return () => {\n if (this.handlers.get(normalizedType) === handler) {\n this.handlers.delete(normalizedType);\n }\n };\n };\n\n readonly handle = async <TPayload = unknown, TResult = unknown>(\n envelope: IngressEnvelope<TPayload>,\n context: IngressContext,\n ): Promise<TResult> => {\n const normalizedType = getKeyId(envelope.type);\n const handler = this.handlers.get(normalizedType);\n if (!handler) {\n throw new Error(`Unsupported ingress type: ${normalizedType}`);\n }\n return await (handler as IngressHandler<TPayload, TResult>)(envelope, context);\n };\n}\n","export type Cleanup = () => void;\n\nexport type Disposable = {\n dispose: () => void;\n};\n\nconst once = (cleanup: Cleanup): Cleanup => {\n let disposed = false;\n return () => {\n if (disposed) {\n return;\n }\n disposed = true;\n cleanup();\n };\n};\n\nconst runCleanups = (cleanups: Cleanup[]): void => {\n const errors: unknown[] = [];\n for (const cleanup of cleanups) {\n try {\n cleanup();\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n }\n if (errors.length > 1) {\n throw new AggregateError(errors, \"Failed to run cleanups.\");\n }\n};\n\nexport const toDisposable = (dispose: Cleanup): Disposable => ({\n dispose: once(dispose),\n});\n\nexport abstract class DisposableOwner implements Disposable {\n protected readonly cleanups: Cleanup[] = [];\n private disposed = false;\n\n protected get isDisposed(): boolean {\n return this.disposed;\n }\n\n protected addCleanup = (cleanup: Cleanup): Cleanup => {\n const disposableCleanup = once(cleanup);\n if (this.disposed) {\n disposableCleanup();\n return disposableCleanup;\n }\n this.cleanups.push(disposableCleanup);\n return disposableCleanup;\n };\n\n protected addDisposable = <T extends Disposable>(disposable: T): T => {\n this.addCleanup(() => {\n disposable.dispose();\n });\n return disposable;\n };\n\n dispose = (): void => {\n if (this.disposed) {\n return;\n }\n this.disposed = true;\n const current = this.cleanups.splice(0);\n runCleanups(current.reverse());\n };\n}\n\nexport class DisposableStore implements Disposable {\n private readonly disposables = new Set<Disposable>();\n\n private isDisposed = false;\n\n add = <T extends Disposable>(disposable: T): T => {\n if (this.isDisposed) {\n disposable.dispose();\n return disposable;\n }\n this.disposables.add(disposable);\n return disposable;\n };\n\n clear = (): void => {\n const current = [...this.disposables];\n this.disposables.clear();\n for (const disposable of current.reverse()) {\n disposable.dispose();\n }\n };\n\n dispose = (): void => {\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n this.clear();\n };\n}\n","export const INBOX_DELIVERY_SESSION_METADATA_KEY = \"inbox_delivery_id\";\n\nexport type InboxDeliveryContentType = \"markdown\" | \"html\";\n\nexport type InboxDeliverySource = {\n kind: \"agent\";\n agentId: string | null;\n sessionId: string | null;\n toolCallId: string | null;\n filePath: string | null;\n};\n\nexport type InboxDelivery = {\n id: string;\n title: string;\n summary: string | null;\n content: string;\n contentType: InboxDeliveryContentType;\n source: InboxDeliverySource;\n createdAt: string;\n updatedAt: string;\n presentedAt: string | null;\n readAt: string | null;\n archivedAt: string | null;\n conversationSessionId: string | null;\n};\n\nexport type InboxDeliveryListView = {\n deliveries: InboxDelivery[];\n total: number;\n unreadCount: number;\n unpresentedCount: number;\n};\n\nexport type InboxDeliveryStateAction =\n | \"present\"\n | \"read\"\n | \"mark_unread\"\n | \"archive\"\n | \"restore\";\n\nexport type InboxDeliveryStateUpdate = {\n action: InboxDeliveryStateAction;\n};\n\nexport type InboxDeliveryContinueResult = {\n delivery: InboxDelivery;\n sessionId: string;\n created: boolean;\n};\n\nexport type InboxDeliveryChangedEventPayload = {\n deliveryId: string;\n operation: \"upsert\" | \"delete\";\n};\n","import type { NcpEndpointEvent, NcpSessionSummary } from \"@nextclaw/ncp\";\nimport type { AppEventKey, EventKey } from \"../types/event-bus.types.js\";\nimport { createTypedKey } from \"../types/typed-key.types.js\";\nimport type { UiShowContentEventPayload } from \"../types/ui-show-content.types.js\";\nimport type { InboxDeliveryChangedEventPayload } from \"../types/inbox-delivery.types.js\";\nimport type { UpdateSnapshot } from \"../types/update.types.js\";\n\nexport function createEventKey<T>(id: string): EventKey<T> {\n return createTypedKey<T>(id);\n}\n\nexport function createAppEventKey<T>(id: string): AppEventKey<T> {\n return createTypedKey<T>(id);\n}\n\nexport const eventKeys = {\n configUpdated: createAppEventKey<{ path: string }>(\"config.updated\"),\n channelConfigApplyStatus: createAppEventKey<{\n channel: string;\n status: \"started\" | \"succeeded\" | \"failed\";\n message?: string;\n }>(\"channel.config.apply-status\"),\n sessionUpdated: createAppEventKey<{ sessionKey: string }>(\"session.updated\"),\n sessionRunStatus: createAppEventKey<{\n sessionKey: string;\n status: \"running\" | \"idle\";\n }>(\"session.run-status\"),\n sessionRunQueueUpdated: createAppEventKey<{ sessionKey: string }>(\n \"session.run-queue.updated\",\n ),\n sessionMetadataChanged: createAppEventKey<{\n metadata: Record<string, unknown>;\n mode: \"set\" | \"update\";\n sessionKey: string;\n }>(\"session.metadata.changed\"),\n ncpEvent: createAppEventKey<NcpEndpointEvent>(\"ncp.event\"),\n sessionSummaryUpsert: createAppEventKey<{ summary: NcpSessionSummary }>(\n \"session.summary.upsert\",\n ),\n sessionSummaryDelete: createAppEventKey<{ sessionKey: string }>(\n \"session.summary.delete\",\n ),\n uiShowContent: createAppEventKey<UiShowContentEventPayload>(\"ui.show-content\"),\n inboxDeliveryChanged: createAppEventKey<InboxDeliveryChangedEventPayload>(\n \"inbox.delivery.changed\",\n ),\n configReloadStarted: createAppEventKey<Record<string, unknown> | undefined>(\n \"config.reload.started\",\n ),\n configReloadFinished: createAppEventKey<Record<string, unknown> | undefined>(\n \"config.reload.finished\",\n ),\n error: createAppEventKey<{ message: string; code?: string }>(\"error\"),\n connectionOpen: createAppEventKey<Record<string, never> | undefined>(\n \"connection.open\",\n ),\n connectionClose: createAppEventKey<Record<string, never> | undefined>(\n \"connection.close\",\n ),\n connectionError: createAppEventKey<{ message?: string } | undefined>(\n \"connection.error\",\n ),\n runtimeUpdateSnapshot: createAppEventKey<UpdateSnapshot>(\n \"runtime.update.snapshot\",\n ),\n} as const;\n","import type {\n NcpAgentSendEnvelope,\n NcpMessage,\n NcpMessageAbortPayload,\n NcpMessagePart,\n} from \"@nextclaw/ncp\";\nimport { createTypedKey } from \"../types/typed-key.types.js\";\n\nexport type ExtensionChannelTextContent = {\n type: \"text\";\n text: string;\n};\n\ntype ExtensionChannelResourceRef = {\n url?: string;\n assetUri?: string;\n mimeType?: string;\n name?: string;\n};\n\nexport type ExtensionChannelImageContent = ExtensionChannelResourceRef & { type: \"image\" };\n\nexport type ExtensionChannelFileContent = ExtensionChannelResourceRef & { type: \"file\" };\n\nexport type ExtensionChannelMessageContent =\n | ExtensionChannelTextContent\n | ExtensionChannelImageContent\n | ExtensionChannelFileContent;\n\nexport type ExtensionChannelSubmittedAttachment = ExtensionChannelResourceRef & {\n id?: string;\n path?: string;\n size?: number;\n source?: string;\n status?: \"ready\" | \"remote-only\";\n errorCode?: \"too_large\" | \"download_failed\" | \"http_error\" | \"invalid_payload\";\n};\n\nexport type ExtensionChannelConfigGetIngressPayload = {\n channelId: string;\n};\n\nexport type ExtensionChannelMessageSubmitIngressPayload = {\n channelId: string;\n conversationId: string;\n senderId: string;\n content: ExtensionChannelMessageContent;\n attachments?: ExtensionChannelSubmittedAttachment[];\n metadata?: Record<string, unknown>;\n};\n\nexport type ExtensionChannelCommandOptionType = \"string\" | \"boolean\" | \"number\";\n\nexport type ExtensionChannelCommandOption = {\n name: string;\n description: string;\n type: ExtensionChannelCommandOptionType;\n required?: boolean;\n};\n\nexport type ExtensionChannelCommandSpec = {\n name: string;\n description: string;\n options?: ExtensionChannelCommandOption[];\n};\n\nexport type ExtensionChannelCommandListIngressPayload = {\n channelId: string;\n};\n\nexport type ExtensionChannelCommandListResponse = {\n commands: ExtensionChannelCommandSpec[];\n};\n\nexport type ExtensionChannelCommandExecuteIngressPayload = {\n channelId: string;\n conversationId: string;\n senderId: string;\n commandName?: string;\n rawText?: string;\n args?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n};\n\nexport type ExtensionChannelCommandExecuteResponse = {\n content: string;\n ephemeral?: boolean;\n};\n\nexport type ExtensionResponseIngressPayload =\n | {\n requestId: string;\n ok: true;\n data?: unknown;\n }\n | {\n requestId: string;\n ok: false;\n error: {\n message: string;\n };\n };\n\nexport type ExtensionRuntimeReadyIngressPayload = {\n generation: string;\n pid: number;\n};\n\nexport type AgentRunSessionMessageRequestPayload = {\n message: NcpMessage;\n requestId: string;\n sessionId: string;\n};\n\nexport const CHAT_SESSION_MATERIALIZATION_METADATA_KEY = \"session_materialization\";\nexport const CHAT_CONTINUATION_TARGET_MESSAGE_METADATA_KEY =\n \"chat_continuation_target_message_id\";\n\nexport type AgentRunSessionMaterializationMetadata = {\n kind: \"child\";\n parentSessionId: string;\n inheritContext: true;\n};\n\nexport type AgentRunEditMessageIngressPayload = {\n correlationId?: string;\n message: NcpMessage;\n messageId: string;\n sessionId: string;\n};\n\nexport type AgentRunContinueIngressPayload = {\n correlationId?: string;\n sessionId: string;\n};\n\nexport type AgentRunSendIngressMetadata = Record<string, unknown> & {\n agentRuntimeId?: string;\n agentId?: string;\n projectRoot?: string;\n channel?: string;\n model?: string;\n maxTokens?: number;\n thinkingEffort?: string | null;\n chatId?: string;\n accountId?: string;\n senderId?: string;\n sessionKey?: string;\n label?: string;\n [CHAT_SESSION_MATERIALIZATION_METADATA_KEY]?: AgentRunSessionMaterializationMetadata;\n};\n\nexport type AgentRunSendIngressPayload =\n | (Omit<NcpAgentSendEnvelope, \"metadata\"> & {\n content?: never;\n metadata?: AgentRunSendIngressMetadata;\n peerId?: string;\n })\n | (Omit<NcpAgentSendEnvelope, \"message\" | \"metadata\"> & {\n content: NcpMessagePart[];\n metadata?: AgentRunSendIngressMetadata;\n message?: never;\n peerId?: string;\n });\n\nexport const ingressKeys = {\n extension: {\n channelConfigGet: createTypedKey<ExtensionChannelConfigGetIngressPayload>(\n \"extension.channel.config.get\",\n ),\n channelMessageSubmit:\n createTypedKey<ExtensionChannelMessageSubmitIngressPayload>(\n \"extension.channel.message.submit\",\n ),\n channelCommandList: createTypedKey<ExtensionChannelCommandListIngressPayload>(\n \"extension.channel.command.list\",\n ),\n channelCommandExecute:\n createTypedKey<ExtensionChannelCommandExecuteIngressPayload>(\n \"extension.channel.command.execute\",\n ),\n runtimeReady: createTypedKey<ExtensionRuntimeReadyIngressPayload>(\n \"extension.runtime.ready\",\n ),\n response: createTypedKey<ExtensionResponseIngressPayload>(\"extension.response\"),\n },\n agentRun: {\n send: createTypedKey<AgentRunSendIngressPayload>(\"agent-run.send\"),\n abort: createTypedKey<NcpMessageAbortPayload>(\"agent-run.abort\"),\n editMessage: createTypedKey<AgentRunEditMessageIngressPayload>(\n \"agent-run.edit-message\",\n ),\n continue: createTypedKey<AgentRunContinueIngressPayload>(\n \"agent-run.continue\",\n ),\n sessionMessageRequest:\n createTypedKey<AgentRunSessionMessageRequestPayload>(\n \"agent-run.session-message.request\",\n ),\n },\n} as const;\n","export const RUNTIME_DEFAULT_MODEL_VALUE = \"__nextclaw_runtime_default__\";\n\nexport type RuntimeModelSelectionMode =\n | \"nextclaw\"\n | \"optional\"\n | \"runtime-default\";\n\nexport function isRuntimeDefaultModelValue(value: unknown): boolean {\n return value === RUNTIME_DEFAULT_MODEL_VALUE;\n}\n\nexport function normalizeRuntimeModelSelectionMode(\n value: unknown,\n): RuntimeModelSelectionMode {\n if (value === \"optional\" || value === \"runtime-default\") {\n return value;\n }\n return \"nextclaw\";\n}\n","export const CHAT_INLINE_TOKENS_METADATA_KEY = \"ui_inline_tokens\";\nexport const CHAT_INLINE_TOKENS_SCHEMA_VERSION = 2;\nexport const CHAT_PROJECT_TOKEN_KIND = \"project\";\nexport const CHAT_CONVERSATION_EXCERPT_TOKEN_KIND = \"conversation_excerpt\";\nexport const CHAT_WORKSPACE_FILE_TOKEN_KIND = \"workspace_file\";\nexport const CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND = \"workspace_directory\";\nexport const CHAT_WORKSPACE_EXCERPT_TOKEN_KIND = \"workspace_excerpt\";\n\nexport type ChatSkillSource = \"builtin\" | \"global\" | \"project\" | \"workspace\";\n\nexport type ChatSkillInlineTokenMetadata = {\n kind: \"skill\";\n ref: string;\n name: string;\n source: ChatSkillSource;\n path: string;\n label: string;\n rawText: string;\n};\n\nexport type ChatWorkspaceInlineTokenMetadata = {\n kind:\n | typeof CHAT_WORKSPACE_FILE_TOKEN_KIND\n | typeof CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND;\n key: string;\n label: string;\n rawText: string;\n};\n\nexport type ChatWorkspaceExcerptInlineTokenMetadata = {\n kind: typeof CHAT_WORKSPACE_EXCERPT_TOKEN_KIND;\n key: string;\n path: string;\n label: string;\n excerpt: string;\n startLine: number | null;\n endLine: number | null;\n rawText: string;\n};\n\nexport type ChatConversationExcerptInlineTokenMetadata = {\n kind: typeof CHAT_CONVERSATION_EXCERPT_TOKEN_KIND;\n key: string;\n messageId: string;\n role: \"assistant\" | \"user\";\n label: string;\n excerpt: string;\n rawText: string;\n};\n\nexport type ChatProjectInlineTokenMetadata = {\n kind: typeof CHAT_PROJECT_TOKEN_KIND;\n key: string;\n label: string;\n rawText: string;\n};\n\nexport type ChatInlineTokenMetadata =\n | ChatSkillInlineTokenMetadata\n | ChatProjectInlineTokenMetadata\n | ChatWorkspaceInlineTokenMetadata\n | ChatWorkspaceExcerptInlineTokenMetadata\n | ChatConversationExcerptInlineTokenMetadata;\n\nexport type ChatInlineTokensMetadata = {\n schemaVersion: typeof CHAT_INLINE_TOKENS_SCHEMA_VERSION;\n items: ChatInlineTokenMetadata[];\n};\n","export const PANEL_APP_INLINE_HOST_CONTRACT = {\n contentHeightMessageType: \"nextclaw:panel-app-content-height\",\n displayMode: \"card\",\n displayModeSearchParam: \"nextclawDisplayMode\",\n placement: \"inline\",\n placementSearchParam: \"nextclawPlacement\",\n} as const;\n","export const PANEL_APP_SCROLL_RESTORATION_CONTRACT = {\n restoreScrollMessageType: 'nextclaw:panel-app-restore-scroll',\n scrollMessageType: 'nextclaw:panel-app-scroll',\n version: 1,\n} as const;\n","type InlineContentElement = {\n readonly clientHeight: number;\n readonly offsetHeight: number;\n readonly scrollHeight: number;\n};\n\nexport function readInlineContentHeight(\n body: InlineContentElement | null | undefined,\n documentElement: InlineContentElement,\n): number {\n return Math.ceil(\n Math.max(\n body?.clientHeight ?? 0,\n body?.offsetHeight ?? 0,\n body?.scrollHeight ?? 0,\n documentElement.offsetHeight,\n ),\n );\n}\n","import type { NcpMessage } from \"@nextclaw/ncp\";\n\nexport const SILENT_REPLY_TOKEN = \"<noreply/>\";\n\nconst SILENT_REPLY_MARKER_PATTERN = /<\\s*noreply\\s*\\/\\s*>/i;\n\nexport function containsSilentReplyMarker(text: string | null | undefined): boolean {\n return Boolean(text && SILENT_REPLY_MARKER_PATTERN.test(text));\n}\n\nexport function isSilentReplyNcpMessage(message: NcpMessage): boolean {\n return message.role === \"assistant\" && message.parts.some(\n (part) => (part.type === \"text\" || part.type === \"rich-text\") && containsSilentReplyMarker(part.text),\n );\n}\n","import type {\n UiContentParams,\n UiContentParamValue,\n} from \"../types/ui-show-content.types.js\";\n\nexport const UI_CONTENT_PARAMS_HOST_CONTRACT = {\n bootstrapQueryParam: \"nextclawContentParams\",\n bootstrapQueryValue: \"1\",\n maxDepth: 32,\n maxSerializedBytes: 64 * 1024,\n windowNamePrefix: \"nextclaw:content-params:v1:\",\n} as const;\n\nexport class UiContentParamsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"UiContentParamsError\";\n }\n}\n\nfunction assertJsonValue(\n value: unknown,\n depth: number,\n ancestors: readonly object[],\n): asserts value is UiContentParamValue {\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\"\n ) {\n return;\n }\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) {\n throw new UiContentParamsError(\n \"params must contain only finite numbers.\",\n );\n }\n return;\n }\n if (typeof value !== \"object\") {\n throw new UiContentParamsError(\"params must contain only JSON values.\");\n }\n if (depth >= UI_CONTENT_PARAMS_HOST_CONTRACT.maxDepth) {\n throw new UiContentParamsError(\n `params must not exceed ${UI_CONTENT_PARAMS_HOST_CONTRACT.maxDepth} nested levels.`,\n );\n }\n if (ancestors.includes(value)) {\n throw new UiContentParamsError(\n \"params must not contain circular references.\",\n );\n }\n const nextAncestors = [...ancestors, value];\n if (Array.isArray(value)) {\n for (const item of value) {\n assertJsonValue(item, depth + 1, nextAncestors);\n }\n return;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n throw new UiContentParamsError(\"params must contain only plain objects.\");\n }\n for (const item of Object.values(value)) {\n assertJsonValue(item, depth + 1, nextAncestors);\n }\n}\n\nexport function readUiContentParams(\n value: unknown,\n): UiContentParams | undefined {\n if (typeof value === \"undefined\") {\n return undefined;\n }\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n throw new UiContentParamsError(\"params must be a JSON object.\");\n }\n assertJsonValue(value, 0, []);\n const serialized = JSON.stringify(value);\n const byteLength = new TextEncoder().encode(serialized).byteLength;\n if (byteLength > UI_CONTENT_PARAMS_HOST_CONTRACT.maxSerializedBytes) {\n throw new UiContentParamsError(\n `params must not exceed ${UI_CONTENT_PARAMS_HOST_CONTRACT.maxSerializedBytes} serialized bytes.`,\n );\n }\n return value as UiContentParams;\n}\n\nexport function createUiContentParamsWindowName(\n params: UiContentParams | undefined,\n): string | undefined {\n const normalized = readUiContentParams(params);\n return normalized\n ? `${UI_CONTENT_PARAMS_HOST_CONTRACT.windowNamePrefix}${JSON.stringify(normalized)}`\n : undefined;\n}\n\nexport function appendUiContentParamsBootstrapQuery(\n url: string,\n params: UiContentParams | undefined,\n): string {\n if (!readUiContentParams(params)) {\n return url;\n }\n const [withoutHash, hash] = url.split(\"#\", 2);\n const queryStart = withoutHash.indexOf(\"?\");\n const pathname =\n queryStart >= 0 ? withoutHash.slice(0, queryStart) : withoutHash;\n const query = new URLSearchParams(\n queryStart >= 0 ? withoutHash.slice(queryStart + 1) : \"\",\n );\n query.set(\n UI_CONTENT_PARAMS_HOST_CONTRACT.bootstrapQueryParam,\n U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aAAa,CAAC,OAAO,WAAW,CAAC,aACvC,gCAAgC,mBAC/C,OAAM,IAAI,qBACR,0BAA0B,gCAAgC,mBAAmB,oBAC9E;AAEH,QAAO;;AAGT,SAAgB,gCACd,QACoB;CACpB,MAAM,aAAa,oBAAoB,OAAO;AAC9C,QAAO,aACH,GAAG,gCAAgC,mBAAmB,KAAK,UAAU,WAAW,KAChF,KAAA;;AAGN,SAAgB,oCACd,KACA,QACQ;AACR,KAAI,CAAC,oBAAoB,OAAO,CAC9B,QAAO;CAET,MAAM,CAAC,aAAa,QAAQ,IAAI,MAAM,KAAK,EAAE;CAC7C,MAAM,aAAa,YAAY,QAAQ,IAAI;CAC3C,MAAM,WACJ,cAAc,IAAI,YAAY,MAAM,GAAG,WAAW,GAAG;CACvD,MAAM,QAAQ,IAAI,gBAChB,cAAc,IAAI,YAAY,MAAM,aAAa,EAAE,GAAG,GACvD;AACD,OAAM,IACJ,gCAAgC,qBAChC,gCAAgC,oBACjC;AACD,QAAO,GAAG,SAAS,GAAG,MAAM,UAAU,GACpC,OAAO,SAAS,WAAW,IAAI,SAAS"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["isRecord"],"sources":["../src/types/typed-key.types.ts","../src/services/event-bus.service.ts","../src/services/ingress.service.ts","../src/services/disposable.service.ts","../src/configs/event-keys.config.ts","../src/configs/ingress-keys.config.ts","../src/configs/runtime-model.config.ts","../src/configs/chat-composer-token.config.ts","../src/utils/ui-content-params.utils.ts","../src/configs/chat-ui-resource-reference.config.ts","../src/configs/system-object-reference.config.ts","../src/configs/panel-app-inline-host.config.ts","../src/configs/panel-app-scroll-restoration.config.ts","../src/utils/inline-content-height.utils.ts","../src/utils/silent-reply.utils.ts"],"sourcesContent":["export type TypedKey<T = unknown> = {\n readonly id: string;\n readonly _type?: T;\n};\n\nexport type Key<T = unknown> = TypedKey<T> | string;\n\nexport function createTypedKey<T>(id: string): TypedKey<T> {\n const normalizedId = id.trim();\n if (!normalizedId) {\n throw new Error(\"typed key id is required\");\n }\n return { id: normalizedId };\n}\n\nexport function getKeyId(key: Key<unknown>): string {\n return typeof key === \"string\" ? key.trim() : key.id;\n}\n","import type {\n AppEventEmitOptions,\n AppEventEnvelope,\n AppEventHandler,\n AppEventKey,\n EventBusOptions,\n Unsubscribe,\n} from \"../types/event-bus.types.js\";\nimport { getKeyId, type Key } from \"../types/typed-key.types.js\";\n\nexport class EventBus {\n private readonly listeners = new Map<string, Set<AppEventHandler<unknown>>>();\n private readonly globalListeners = new Set<(event: AppEventEnvelope) => void>();\n private listenerCount = 0;\n private readonly onFirstSubscriber?: EventBusOptions[\"onFirstSubscriber\"];\n private readonly onListenerError?: EventBusOptions[\"onListenerError\"];\n private readonly onNoSubscribers?: EventBusOptions[\"onNoSubscribers\"];\n\n constructor(options: EventBusOptions = {}) {\n this.onFirstSubscriber = options.onFirstSubscriber;\n this.onListenerError = options.onListenerError;\n this.onNoSubscribers = options.onNoSubscribers;\n }\n\n emit = <T>(\n key: Key<T>,\n payload: T,\n options: AppEventEmitOptions = {},\n ): void => {\n const envelope: AppEventEnvelope<T> = {\n type: getKeyId(key),\n payload,\n ...(options.emittedAt ? { emittedAt: options.emittedAt } : {}),\n ...(options.source ? { source: options.source } : {}),\n };\n this.emitEnvelope(envelope);\n };\n\n emitEnvelope = <T>(event: AppEventEnvelope<T>): void => {\n const listeners = this.listeners.get(event.type);\n if (listeners) {\n for (const listener of listeners) {\n this.safeInvokeListener(event, listener as AppEventHandler<T>);\n }\n }\n if (this.globalListeners.size === 0) {\n return;\n }\n for (const listener of this.globalListeners) {\n this.safeInvokeGlobalListener(event, listener);\n }\n };\n\n on = <T>(key: AppEventKey<T>, handler: AppEventHandler<T>): Unsubscribe => {\n const keyId = getKeyId(key);\n const listeners = this.listeners.get(keyId) ?? new Set<AppEventHandler<unknown>>();\n const typedHandler = handler as AppEventHandler<unknown>;\n const added = !listeners.has(typedHandler);\n listeners.add(typedHandler);\n this.listeners.set(keyId, listeners);\n if (added) {\n this.registerSubscriber();\n }\n return () => {\n this.off(key, handler);\n };\n };\n\n off = <T>(key: AppEventKey<T>, handler: AppEventHandler<T>): void => {\n const keyId = getKeyId(key);\n const listeners = this.listeners.get(keyId);\n if (!listeners) {\n return;\n }\n const deleted = listeners.delete(handler as AppEventHandler<unknown>);\n if (listeners.size === 0) {\n this.listeners.delete(keyId);\n }\n if (deleted) {\n this.unregisterSubscriber();\n }\n };\n\n once = <T>(key: AppEventKey<T>, handler: AppEventHandler<T>): Unsubscribe => {\n const wrappedHandler: AppEventHandler<T> = (payload, envelope) => {\n unsubscribe();\n handler(payload, envelope);\n };\n const unsubscribe = this.on(key, wrappedHandler);\n return unsubscribe;\n };\n\n subscribeAll = (handler: (event: AppEventEnvelope) => void): Unsubscribe => {\n const added = !this.globalListeners.has(handler);\n this.globalListeners.add(handler);\n if (added) {\n this.registerSubscriber();\n }\n return () => {\n if (this.globalListeners.delete(handler)) {\n this.unregisterSubscriber();\n }\n };\n };\n\n private registerSubscriber = (): void => {\n this.listenerCount += 1;\n if (this.listenerCount === 1) {\n this.onFirstSubscriber?.();\n }\n };\n\n private unregisterSubscriber = (): void => {\n this.listenerCount = Math.max(0, this.listenerCount - 1);\n if (this.listenerCount === 0) {\n this.onNoSubscribers?.();\n }\n };\n\n private safeInvokeListener = <T>(\n event: AppEventEnvelope<T>,\n listener: AppEventHandler<T>,\n ): void => {\n try {\n listener(event.payload, event);\n } catch (error) {\n this.onListenerError?.({\n type: event.type,\n payload: event.payload,\n error,\n });\n }\n };\n\n private safeInvokeGlobalListener = (\n event: AppEventEnvelope,\n listener: (event: AppEventEnvelope) => void,\n ): void => {\n try {\n listener(event);\n } catch (error) {\n this.onListenerError?.({\n type: event.type,\n payload: event.payload,\n error,\n });\n }\n };\n}\n","import { getKeyId, type Key } from \"../types/typed-key.types.js\";\n\nexport type IngressEnvelope<TPayload = unknown> = {\n type: Key<TPayload>;\n extensionId?: string;\n generation?: string;\n payload?: TPayload;\n source?: string;\n};\n\nexport type IngressContext = {\n source: string;\n token?: string | null;\n};\n\nexport type IngressHandler<TPayload = unknown, TResult = unknown> = (\n envelope: IngressEnvelope<TPayload>,\n context: IngressContext,\n) => Promise<TResult> | TResult;\n\nexport class Ingress {\n private readonly handlers = new Map<string, IngressHandler<unknown, unknown>>();\n\n readonly addHandler = <TPayload = unknown, TResult = unknown>(\n type: Key<TPayload>,\n handler: IngressHandler<TPayload, TResult>,\n ): (() => void) => {\n const normalizedType = getKeyId(type);\n if (!normalizedType) {\n throw new Error(\"ingress type is required\");\n }\n this.handlers.set(normalizedType, handler as IngressHandler<unknown, unknown>);\n return () => {\n if (this.handlers.get(normalizedType) === handler) {\n this.handlers.delete(normalizedType);\n }\n };\n };\n\n readonly handle = async <TPayload = unknown, TResult = unknown>(\n envelope: IngressEnvelope<TPayload>,\n context: IngressContext,\n ): Promise<TResult> => {\n const normalizedType = getKeyId(envelope.type);\n const handler = this.handlers.get(normalizedType);\n if (!handler) {\n throw new Error(`Unsupported ingress type: ${normalizedType}`);\n }\n return await (handler as IngressHandler<TPayload, TResult>)(envelope, context);\n };\n}\n","export type Cleanup = () => void;\n\nexport type Disposable = {\n dispose: () => void;\n};\n\nconst once = (cleanup: Cleanup): Cleanup => {\n let disposed = false;\n return () => {\n if (disposed) {\n return;\n }\n disposed = true;\n cleanup();\n };\n};\n\nconst runCleanups = (cleanups: Cleanup[]): void => {\n const errors: unknown[] = [];\n for (const cleanup of cleanups) {\n try {\n cleanup();\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length === 1) {\n throw errors[0];\n }\n if (errors.length > 1) {\n throw new AggregateError(errors, \"Failed to run cleanups.\");\n }\n};\n\nexport const toDisposable = (dispose: Cleanup): Disposable => ({\n dispose: once(dispose),\n});\n\nexport abstract class DisposableOwner implements Disposable {\n protected readonly cleanups: Cleanup[] = [];\n private disposed = false;\n\n protected get isDisposed(): boolean {\n return this.disposed;\n }\n\n protected addCleanup = (cleanup: Cleanup): Cleanup => {\n const disposableCleanup = once(cleanup);\n if (this.disposed) {\n disposableCleanup();\n return disposableCleanup;\n }\n this.cleanups.push(disposableCleanup);\n return disposableCleanup;\n };\n\n protected addDisposable = <T extends Disposable>(disposable: T): T => {\n this.addCleanup(() => {\n disposable.dispose();\n });\n return disposable;\n };\n\n dispose = (): void => {\n if (this.disposed) {\n return;\n }\n this.disposed = true;\n const current = this.cleanups.splice(0);\n runCleanups(current.reverse());\n };\n}\n\nexport class DisposableStore implements Disposable {\n private readonly disposables = new Set<Disposable>();\n\n private isDisposed = false;\n\n add = <T extends Disposable>(disposable: T): T => {\n if (this.isDisposed) {\n disposable.dispose();\n return disposable;\n }\n this.disposables.add(disposable);\n return disposable;\n };\n\n clear = (): void => {\n const current = [...this.disposables];\n this.disposables.clear();\n for (const disposable of current.reverse()) {\n disposable.dispose();\n }\n };\n\n dispose = (): void => {\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n this.clear();\n };\n}\n","import type { NcpEndpointEvent, NcpSessionSummary } from \"@nextclaw/ncp\";\nimport type { AppEventKey, EventKey } from \"../types/event-bus.types.js\";\nimport { createTypedKey } from \"../types/typed-key.types.js\";\nimport type { UiShowContentEventPayload } from \"../types/ui-show-content.types.js\";\nimport type { InboxDeliveryChangedEventPayload } from \"../types/inbox-delivery.types.js\";\nimport type { UpdateSnapshot } from \"../types/update.types.js\";\n\nexport function createEventKey<T>(id: string): EventKey<T> {\n return createTypedKey<T>(id);\n}\n\nexport function createAppEventKey<T>(id: string): AppEventKey<T> {\n return createTypedKey<T>(id);\n}\n\nexport const eventKeys = {\n configUpdated: createAppEventKey<{ path: string }>(\"config.updated\"),\n channelConfigApplyStatus: createAppEventKey<{\n channel: string;\n status: \"started\" | \"succeeded\" | \"failed\";\n message?: string;\n }>(\"channel.config.apply-status\"),\n sessionUpdated: createAppEventKey<{ sessionKey: string }>(\"session.updated\"),\n sessionRunStatus: createAppEventKey<{\n sessionKey: string;\n status: \"running\" | \"idle\";\n }>(\"session.run-status\"),\n sessionRunQueueUpdated: createAppEventKey<{ sessionKey: string }>(\n \"session.run-queue.updated\",\n ),\n sessionMetadataChanged: createAppEventKey<{\n metadata: Record<string, unknown>;\n mode: \"set\" | \"update\";\n sessionKey: string;\n }>(\"session.metadata.changed\"),\n ncpEvent: createAppEventKey<NcpEndpointEvent>(\"ncp.event\"),\n sessionSummaryUpsert: createAppEventKey<{ summary: NcpSessionSummary }>(\n \"session.summary.upsert\",\n ),\n sessionSummaryDelete: createAppEventKey<{ sessionKey: string }>(\n \"session.summary.delete\",\n ),\n uiShowContent: createAppEventKey<UiShowContentEventPayload>(\"ui.show-content\"),\n serverPathChanged: createAppEventKey<{ directoryPath: string }>(\n \"server-path.changed\",\n ),\n inboxDeliveryChanged: createAppEventKey<InboxDeliveryChangedEventPayload>(\n \"inbox.delivery.changed\",\n ),\n configReloadStarted: createAppEventKey<Record<string, unknown> | undefined>(\n \"config.reload.started\",\n ),\n configReloadFinished: createAppEventKey<Record<string, unknown> | undefined>(\n \"config.reload.finished\",\n ),\n error: createAppEventKey<{ message: string; code?: string }>(\"error\"),\n connectionOpen: createAppEventKey<Record<string, never> | undefined>(\n \"connection.open\",\n ),\n connectionClose: createAppEventKey<Record<string, never> | undefined>(\n \"connection.close\",\n ),\n connectionError: createAppEventKey<{ message?: string } | undefined>(\n \"connection.error\",\n ),\n runtimeUpdateSnapshot: createAppEventKey<UpdateSnapshot>(\n \"runtime.update.snapshot\",\n ),\n} as const;\n","import type {\n NcpAgentSendEnvelope,\n NcpMessage,\n NcpMessageAbortPayload,\n NcpMessagePart,\n} from \"@nextclaw/ncp\";\nimport { createTypedKey } from \"../types/typed-key.types.js\";\n\nexport type ExtensionChannelTextContent = {\n type: \"text\";\n text: string;\n};\n\ntype ExtensionChannelResourceRef = {\n url?: string;\n assetUri?: string;\n mimeType?: string;\n name?: string;\n};\n\nexport type ExtensionChannelImageContent = ExtensionChannelResourceRef & { type: \"image\" };\n\nexport type ExtensionChannelFileContent = ExtensionChannelResourceRef & { type: \"file\" };\n\nexport type ExtensionChannelMessageContent =\n | ExtensionChannelTextContent\n | ExtensionChannelImageContent\n | ExtensionChannelFileContent;\n\nexport type ExtensionChannelSubmittedAttachment = ExtensionChannelResourceRef & {\n id?: string;\n path?: string;\n size?: number;\n source?: string;\n status?: \"ready\" | \"remote-only\";\n errorCode?: \"too_large\" | \"download_failed\" | \"http_error\" | \"invalid_payload\";\n};\n\nexport type ExtensionChannelConfigGetIngressPayload = {\n channelId: string;\n};\n\nexport type ExtensionChannelMessageSubmitIngressPayload = {\n channelId: string;\n conversationId: string;\n senderId: string;\n content: ExtensionChannelMessageContent;\n attachments?: ExtensionChannelSubmittedAttachment[];\n metadata?: Record<string, unknown>;\n};\n\nexport type ExtensionChannelCommandOptionType = \"string\" | \"boolean\" | \"number\";\n\nexport type ExtensionChannelCommandOption = {\n name: string;\n description: string;\n type: ExtensionChannelCommandOptionType;\n required?: boolean;\n};\n\nexport type ExtensionChannelCommandSpec = {\n name: string;\n description: string;\n options?: ExtensionChannelCommandOption[];\n};\n\nexport type ExtensionChannelCommandListIngressPayload = {\n channelId: string;\n};\n\nexport type ExtensionChannelCommandListResponse = {\n commands: ExtensionChannelCommandSpec[];\n};\n\nexport type ExtensionChannelCommandExecuteIngressPayload = {\n channelId: string;\n conversationId: string;\n senderId: string;\n commandName?: string;\n rawText?: string;\n args?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n};\n\nexport type ExtensionChannelCommandExecuteResponse = {\n content: string;\n ephemeral?: boolean;\n};\n\nexport type ExtensionResponseIngressPayload =\n | {\n requestId: string;\n ok: true;\n data?: unknown;\n }\n | {\n requestId: string;\n ok: false;\n error: {\n message: string;\n };\n };\n\nexport type ExtensionRuntimeReadyIngressPayload = {\n generation: string;\n pid: number;\n};\n\nexport type AgentRunSessionMessageRequestPayload = {\n message: NcpMessage;\n requestId: string;\n sessionId: string;\n};\n\nexport const CHAT_SESSION_MATERIALIZATION_METADATA_KEY = \"session_materialization\";\nexport const CHAT_CONTINUATION_TARGET_MESSAGE_METADATA_KEY =\n \"chat_continuation_target_message_id\";\n\nexport type AgentRunSessionMaterializationMetadata = {\n kind: \"child\";\n parentSessionId: string;\n inheritContext: true;\n};\n\nexport type AgentRunEditMessageIngressPayload = {\n correlationId?: string;\n message: NcpMessage;\n messageId: string;\n sessionId: string;\n};\n\nexport type AgentRunContinueIngressPayload = {\n correlationId?: string;\n sessionId: string;\n};\n\nexport type AgentRunSendIngressMetadata = Record<string, unknown> & {\n agentRuntimeId?: string;\n agentId?: string;\n projectRoot?: string;\n channel?: string;\n model?: string;\n maxTokens?: number;\n thinkingEffort?: string | null;\n chatId?: string;\n accountId?: string;\n senderId?: string;\n sessionKey?: string;\n label?: string;\n [CHAT_SESSION_MATERIALIZATION_METADATA_KEY]?: AgentRunSessionMaterializationMetadata;\n};\n\nexport type AgentRunSendIngressPayload =\n | (Omit<NcpAgentSendEnvelope, \"metadata\"> & {\n content?: never;\n metadata?: AgentRunSendIngressMetadata;\n peerId?: string;\n })\n | (Omit<NcpAgentSendEnvelope, \"message\" | \"metadata\"> & {\n content: NcpMessagePart[];\n metadata?: AgentRunSendIngressMetadata;\n message?: never;\n peerId?: string;\n });\n\nexport const ingressKeys = {\n extension: {\n channelConfigGet: createTypedKey<ExtensionChannelConfigGetIngressPayload>(\n \"extension.channel.config.get\",\n ),\n channelMessageSubmit:\n createTypedKey<ExtensionChannelMessageSubmitIngressPayload>(\n \"extension.channel.message.submit\",\n ),\n channelCommandList: createTypedKey<ExtensionChannelCommandListIngressPayload>(\n \"extension.channel.command.list\",\n ),\n channelCommandExecute:\n createTypedKey<ExtensionChannelCommandExecuteIngressPayload>(\n \"extension.channel.command.execute\",\n ),\n runtimeReady: createTypedKey<ExtensionRuntimeReadyIngressPayload>(\n \"extension.runtime.ready\",\n ),\n response: createTypedKey<ExtensionResponseIngressPayload>(\"extension.response\"),\n },\n agentRun: {\n send: createTypedKey<AgentRunSendIngressPayload>(\"agent-run.send\"),\n abort: createTypedKey<NcpMessageAbortPayload>(\"agent-run.abort\"),\n editMessage: createTypedKey<AgentRunEditMessageIngressPayload>(\n \"agent-run.edit-message\",\n ),\n continue: createTypedKey<AgentRunContinueIngressPayload>(\n \"agent-run.continue\",\n ),\n sessionMessageRequest:\n createTypedKey<AgentRunSessionMessageRequestPayload>(\n \"agent-run.session-message.request\",\n ),\n },\n} as const;\n","export const RUNTIME_DEFAULT_MODEL_VALUE = \"__nextclaw_runtime_default__\";\n\nexport type RuntimeModelSelectionMode =\n | \"nextclaw\"\n | \"optional\"\n | \"runtime-default\";\n\nexport function isRuntimeDefaultModelValue(value: unknown): boolean {\n return value === RUNTIME_DEFAULT_MODEL_VALUE;\n}\n\nexport function normalizeRuntimeModelSelectionMode(\n value: unknown,\n): RuntimeModelSelectionMode {\n if (value === \"optional\" || value === \"runtime-default\") {\n return value;\n }\n return \"nextclaw\";\n}\n","import type {\n CHAT_UI_RESOURCE_TOKEN_KIND,\n ChatUiResourceReference,\n} from \"./chat-ui-resource-reference.config.js\";\n\nexport const CHAT_INLINE_TOKENS_METADATA_KEY = \"ui_inline_tokens\";\nexport const CHAT_INLINE_TOKENS_SCHEMA_VERSION = 2;\nexport const CHAT_PROJECT_TOKEN_KIND = \"project\";\nexport const CHAT_CONVERSATION_EXCERPT_TOKEN_KIND = \"conversation_excerpt\";\nexport const CHAT_WORKSPACE_FILE_TOKEN_KIND = \"workspace_file\";\nexport const CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND = \"workspace_directory\";\nexport const CHAT_WORKSPACE_EXCERPT_TOKEN_KIND = \"workspace_excerpt\";\nexport const CHAT_SYSTEM_OBJECT_TOKEN_KIND = \"system_object\";\n\nexport type ChatSkillSource = \"builtin\" | \"global\" | \"project\" | \"workspace\";\n\nexport type ChatSkillInlineTokenMetadata = {\n kind: \"skill\";\n ref: string;\n name: string;\n source: ChatSkillSource;\n path: string;\n label: string;\n rawText: string;\n};\n\nexport type ChatWorkspaceInlineTokenMetadata = {\n kind:\n | typeof CHAT_WORKSPACE_FILE_TOKEN_KIND\n | typeof CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND;\n key: string;\n label: string;\n rawText: string;\n};\n\nexport type ChatWorkspaceExcerptInlineTokenMetadata = {\n kind: typeof CHAT_WORKSPACE_EXCERPT_TOKEN_KIND;\n key: string;\n path: string;\n label: string;\n excerpt: string;\n startLine: number | null;\n endLine: number | null;\n rawText: string;\n};\n\nexport type ChatConversationExcerptInlineTokenMetadata = {\n kind: typeof CHAT_CONVERSATION_EXCERPT_TOKEN_KIND;\n key: string;\n messageId: string;\n role: \"assistant\" | \"user\";\n label: string;\n excerpt: string;\n rawText: string;\n};\n\nexport type ChatProjectInlineTokenMetadata = {\n kind: typeof CHAT_PROJECT_TOKEN_KIND;\n key: string;\n label: string;\n rawText: string;\n};\n\nexport type ChatSystemObjectInlineTokenMetadata = {\n kind: typeof CHAT_SYSTEM_OBJECT_TOKEN_KIND;\n key: string;\n label: string;\n rawText: string;\n reference: {\n uri: string;\n objectType: string;\n objectId: string;\n label: string;\n description: string | null;\n updatedAt: string;\n version: string;\n assetUri: string;\n fileName: string;\n mimeType: string;\n sizeBytes: number;\n };\n};\n\nexport type ChatUiResourceInlineTokenMetadata = {\n kind: typeof CHAT_UI_RESOURCE_TOKEN_KIND;\n key: string;\n label: string;\n rawText: string;\n reference: ChatUiResourceReference;\n};\n\nexport type ChatInlineTokenMetadata =\n | ChatSkillInlineTokenMetadata\n | ChatProjectInlineTokenMetadata\n | ChatWorkspaceInlineTokenMetadata\n | ChatWorkspaceExcerptInlineTokenMetadata\n | ChatConversationExcerptInlineTokenMetadata\n | ChatUiResourceInlineTokenMetadata\n | ChatSystemObjectInlineTokenMetadata;\n\nexport type ChatInlineTokensMetadata = {\n schemaVersion: typeof CHAT_INLINE_TOKENS_SCHEMA_VERSION;\n items: ChatInlineTokenMetadata[];\n};\n","import type {\n UiContentParams,\n UiContentParamValue,\n} from \"../types/ui-show-content.types.js\";\n\nexport const UI_CONTENT_PARAMS_HOST_CONTRACT = {\n bootstrapQueryParam: \"nextclawContentParams\",\n bootstrapQueryValue: \"1\",\n maxDepth: 32,\n maxSerializedBytes: 64 * 1024,\n windowNamePrefix: \"nextclaw:content-params:v1:\",\n} as const;\n\nexport class UiContentParamsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"UiContentParamsError\";\n }\n}\n\nfunction assertJsonValue(\n value: unknown,\n depth: number,\n ancestors: readonly object[],\n): asserts value is UiContentParamValue {\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\"\n ) {\n return;\n }\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) {\n throw new UiContentParamsError(\n \"params must contain only finite numbers.\",\n );\n }\n return;\n }\n if (typeof value !== \"object\") {\n throw new UiContentParamsError(\"params must contain only JSON values.\");\n }\n if (depth >= UI_CONTENT_PARAMS_HOST_CONTRACT.maxDepth) {\n throw new UiContentParamsError(\n `params must not exceed ${UI_CONTENT_PARAMS_HOST_CONTRACT.maxDepth} nested levels.`,\n );\n }\n if (ancestors.includes(value)) {\n throw new UiContentParamsError(\n \"params must not contain circular references.\",\n );\n }\n const nextAncestors = [...ancestors, value];\n if (Array.isArray(value)) {\n for (const item of value) {\n assertJsonValue(item, depth + 1, nextAncestors);\n }\n return;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n throw new UiContentParamsError(\"params must contain only plain objects.\");\n }\n for (const item of Object.values(value)) {\n assertJsonValue(item, depth + 1, nextAncestors);\n }\n}\n\nexport function readUiContentParams(\n value: unknown,\n): UiContentParams | undefined {\n if (typeof value === \"undefined\") {\n return undefined;\n }\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n throw new UiContentParamsError(\"params must be a JSON object.\");\n }\n assertJsonValue(value, 0, []);\n const serialized = JSON.stringify(value);\n const byteLength = new TextEncoder().encode(serialized).byteLength;\n if (byteLength > UI_CONTENT_PARAMS_HOST_CONTRACT.maxSerializedBytes) {\n throw new UiContentParamsError(\n `params must not exceed ${UI_CONTENT_PARAMS_HOST_CONTRACT.maxSerializedBytes} serialized bytes.`,\n );\n }\n return value as UiContentParams;\n}\n\nexport function createUiContentParamsWindowName(\n params: UiContentParams | undefined,\n): string | undefined {\n const normalized = readUiContentParams(params);\n return normalized\n ? `${UI_CONTENT_PARAMS_HOST_CONTRACT.windowNamePrefix}${JSON.stringify(normalized)}`\n : undefined;\n}\n\nexport function appendUiContentParamsBootstrapQuery(\n url: string,\n params: UiContentParams | undefined,\n): string {\n if (!readUiContentParams(params)) {\n return url;\n }\n const [withoutHash, hash] = url.split(\"#\", 2);\n const queryStart = withoutHash.indexOf(\"?\");\n const pathname =\n queryStart >= 0 ? withoutHash.slice(0, queryStart) : withoutHash;\n const query = new URLSearchParams(\n queryStart >= 0 ? withoutHash.slice(queryStart + 1) : \"\",\n );\n query.set(\n UI_CONTENT_PARAMS_HOST_CONTRACT.bootstrapQueryParam,\n UI_CONTENT_PARAMS_HOST_CONTRACT.bootstrapQueryValue,\n );\n return `${pathname}?${query.toString()}${\n typeof hash === \"string\" ? `#${hash}` : \"\"\n }`;\n}\n","import type { UiContentParams } from \"../types/ui-show-content.types.js\";\nimport { readUiContentParams } from \"../utils/ui-content-params.utils.js\";\n\nexport const CHAT_UI_RESOURCE_TOKEN_KIND = \"ui_resource\";\n\nconst UI_RESOURCE_KIND_MAX_LENGTH = 80;\nconst UI_RESOURCE_TITLE_MAX_LENGTH = 512;\nconst UI_RESOURCE_URI_MAX_LENGTH = 8_192;\n\nexport type ChatUiResourceReference = {\n uri: string;\n resourceKind: string;\n title: string;\n currentUrl: string;\n contentParams?: UiContentParams;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction readBoundedString(value: unknown, maxLength: number): string | null {\n if (typeof value !== \"string\") return null;\n const normalized = value.trim();\n return normalized && normalized.length <= maxLength ? normalized : null;\n}\n\nexport function readChatUiResourceReference(\n value: unknown,\n): ChatUiResourceReference | null {\n if (!isRecord(value)) return null;\n const uri = readBoundedString(value.uri, UI_RESOURCE_URI_MAX_LENGTH);\n const resourceKind = readBoundedString(\n value.resourceKind,\n UI_RESOURCE_KIND_MAX_LENGTH,\n );\n const title = readBoundedString(value.title, UI_RESOURCE_TITLE_MAX_LENGTH);\n const currentUrl = readBoundedString(\n value.currentUrl,\n UI_RESOURCE_URI_MAX_LENGTH,\n );\n if (!uri || !resourceKind || !title || !currentUrl) return null;\n try {\n const contentParams = readUiContentParams(value.contentParams);\n return {\n uri,\n resourceKind,\n title,\n currentUrl,\n ...(contentParams ? { contentParams: structuredClone(contentParams) } : {}),\n };\n } catch {\n return null;\n }\n}\n","export const SYSTEM_OBJECT_REFERENCE_URI_SCHEME = \"nextclaw:\";\nexport const SYSTEM_OBJECT_REFERENCE_URI_HOST = \"objects\";\nexport const SYSTEM_OBJECT_TYPE_INBOX_DELIVERY = \"inbox-delivery\";\nexport const SYSTEM_OBJECT_TYPE_CRON_JOB = \"cron-job\";\nexport const SYSTEM_OBJECT_REFERENCE_DEFAULT_LIMIT = 20;\nexport const SYSTEM_OBJECT_REFERENCE_MAX_LIMIT = 50;\n\nexport type SystemObjectReferenceDisplayText = {\n default: string;\n translations?: Record<string, string>;\n};\n\nexport type SystemObjectReferenceGroupIcon = \"calendar-clock\" | \"file\" | \"inbox\";\n\nexport type SystemObjectReferenceGroupDescriptor = {\n objectType: string;\n label: SystemObjectReferenceDisplayText;\n description: SystemObjectReferenceDisplayText;\n icon: SystemObjectReferenceGroupIcon;\n order: number;\n};\n\nexport type SystemObjectReferenceItem = {\n uri: string;\n objectType: string;\n objectId: string;\n label: string;\n description: string | null;\n updatedAt: string;\n};\n\nexport type SystemObjectReferenceGroupView = SystemObjectReferenceGroupDescriptor & {\n items: SystemObjectReferenceItem[];\n total: number;\n};\n\nexport type SystemObjectReferenceListView = {\n groups: SystemObjectReferenceGroupView[];\n total: number;\n};\n\nexport type SystemObjectResolvedReference = SystemObjectReferenceItem & {\n version: string;\n assetUri: string;\n fileName: string;\n mimeType: string;\n sizeBytes: number;\n};\n\nexport type SystemObjectReferenceResolveRequest = {\n uri: string;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction readString(value: unknown): string | null {\n return typeof value === \"string\" && value.trim() ? value.trim() : null;\n}\n\nexport function createSystemObjectReferenceUri(\n objectType: string,\n objectId: string,\n): string {\n const normalizedType = objectType.trim();\n const normalizedId = objectId.trim();\n if (!normalizedType || !normalizedId) {\n throw new Error(\"System object type and id must be non-empty.\");\n }\n return `nextclaw://${SYSTEM_OBJECT_REFERENCE_URI_HOST}/${encodeURIComponent(normalizedType)}/${encodeURIComponent(normalizedId)}`;\n}\n\nexport function parseSystemObjectReferenceUri(\n uri: string,\n): { objectType: string; objectId: string } | null {\n try {\n const parsed = new URL(uri.trim());\n if (\n parsed.protocol !== SYSTEM_OBJECT_REFERENCE_URI_SCHEME ||\n parsed.host !== SYSTEM_OBJECT_REFERENCE_URI_HOST ||\n parsed.search ||\n parsed.hash\n ) {\n return null;\n }\n const segments = parsed.pathname.split(\"/\").filter(Boolean);\n if (segments.length !== 2) {\n return null;\n }\n const objectType = decodeURIComponent(segments[0] ?? \"\").trim();\n const objectId = decodeURIComponent(segments[1] ?? \"\").trim();\n return objectType && objectId ? { objectType, objectId } : null;\n } catch {\n return null;\n }\n}\n\nexport function readSystemObjectResolvedReference(\n value: unknown,\n): SystemObjectResolvedReference | null {\n if (!isRecord(value)) return null;\n const uri = readString(value.uri);\n const objectType = readString(value.objectType);\n const objectId = readString(value.objectId);\n const label = readString(value.label);\n const updatedAt = readString(value.updatedAt);\n const version = readString(value.version);\n const assetUri = readString(value.assetUri);\n const fileName = readString(value.fileName);\n const mimeType = readString(value.mimeType);\n const { sizeBytes } = value;\n const parsed = uri ? parseSystemObjectReferenceUri(uri) : null;\n if (\n !uri || !objectType || !objectId || !parsed ||\n parsed.objectType !== objectType || parsed.objectId !== objectId ||\n !label || !updatedAt || !version || !assetUri || !fileName || !mimeType ||\n typeof sizeBytes !== \"number\" || !Number.isSafeInteger(sizeBytes) || sizeBytes < 0\n ) {\n return null;\n }\n return {\n uri,\n objectType,\n objectId,\n label,\n description: readString(value.description),\n updatedAt,\n version,\n assetUri,\n fileName,\n mimeType,\n sizeBytes,\n };\n}\n","export const PANEL_APP_INLINE_HOST_CONTRACT = {\n contentHeightMessageType: \"nextclaw:panel-app-content-height\",\n displayMode: \"card\",\n displayModeSearchParam: \"nextclawDisplayMode\",\n placement: \"inline\",\n placementSearchParam: \"nextclawPlacement\",\n} as const;\n","export const PANEL_APP_SCROLL_RESTORATION_CONTRACT = {\n restoreScrollMessageType: 'nextclaw:panel-app-restore-scroll',\n scrollMessageType: 'nextclaw:panel-app-scroll',\n version: 1,\n} as const;\n","type InlineContentElement = {\n readonly clientHeight: number;\n readonly offsetHeight: number;\n readonly scrollHeight: number;\n};\n\nexport function readInlineContentHeight(\n body: InlineContentElement | null | undefined,\n documentElement: InlineContentElement,\n): number {\n return Math.ceil(\n Math.max(\n body?.clientHeight ?? 0,\n body?.offsetHeight ?? 0,\n body?.scrollHeight ?? 0,\n documentElement.offsetHeight,\n ),\n );\n}\n","import type { NcpMessage } from \"@nextclaw/ncp\";\n\nexport const SILENT_REPLY_TOKEN = \"<noreply/>\";\n\nconst SILENT_REPLY_MARKER_PATTERN = /<\\s*noreply\\s*\\/\\s*>/i;\n\nexport function containsSilentReplyMarker(text: string | null | undefined): boolean {\n return Boolean(text && SILENT_REPLY_MARKER_PATTERN.test(text));\n}\n\nexport function isSilentReplyNcpMessage(message: NcpMessage): boolean {\n return message.role === \"assistant\" && message.parts.some(\n (part) => (part.type === \"text\" || part.type === \"rich-text\") && containsSilentReplyMarker(part.text),\n );\n}\n"],"mappings":";AAOA,SAAgB,eAAkB,IAAyB;CACzD,MAAM,eAAe,GAAG,MAAM;AAC9B,KAAI,CAAC,aACH,OAAM,IAAI,MAAM,2BAA2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