@nextclaw/shared 0.4.11 → 0.4.12
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 +22 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -184,6 +184,9 @@ declare const eventKeys: {
|
|
|
184
184
|
sessionKey: string;
|
|
185
185
|
status: "running" | "idle";
|
|
186
186
|
}>;
|
|
187
|
+
readonly sessionRunQueueUpdated: AppEventKey<{
|
|
188
|
+
sessionKey: string;
|
|
189
|
+
}>;
|
|
187
190
|
readonly sessionMetadataChanged: AppEventKey<{
|
|
188
191
|
metadata: Record<string, unknown>;
|
|
189
192
|
mode: "set" | "update";
|
|
@@ -349,14 +352,30 @@ declare function normalizeRuntimeModelSelectionMode(value: unknown): RuntimeMode
|
|
|
349
352
|
//#endregion
|
|
350
353
|
//#region src/configs/chat-composer-token.config.d.ts
|
|
351
354
|
declare const CHAT_INLINE_TOKENS_METADATA_KEY = "ui_inline_tokens";
|
|
355
|
+
declare const CHAT_INLINE_TOKENS_SCHEMA_VERSION = 2;
|
|
352
356
|
declare const CHAT_WORKSPACE_FILE_TOKEN_KIND = "workspace_file";
|
|
353
357
|
declare const CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND = "workspace_directory";
|
|
354
|
-
type
|
|
355
|
-
|
|
358
|
+
type ChatSkillSource = "builtin" | "global" | "project" | "workspace";
|
|
359
|
+
type ChatSkillInlineTokenMetadata = {
|
|
360
|
+
kind: "skill";
|
|
361
|
+
ref: string;
|
|
362
|
+
name: string;
|
|
363
|
+
source: ChatSkillSource;
|
|
364
|
+
path: string;
|
|
365
|
+
label: string;
|
|
366
|
+
rawText: string;
|
|
367
|
+
};
|
|
368
|
+
type ChatWorkspaceInlineTokenMetadata = {
|
|
369
|
+
kind: typeof CHAT_WORKSPACE_FILE_TOKEN_KIND | typeof CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND;
|
|
356
370
|
key: string;
|
|
357
371
|
label: string;
|
|
358
372
|
rawText: string;
|
|
359
373
|
};
|
|
374
|
+
type ChatInlineTokenMetadata = ChatSkillInlineTokenMetadata | ChatWorkspaceInlineTokenMetadata;
|
|
375
|
+
type ChatInlineTokensMetadata = {
|
|
376
|
+
schemaVersion: typeof CHAT_INLINE_TOKENS_SCHEMA_VERSION;
|
|
377
|
+
items: ChatInlineTokenMetadata[];
|
|
378
|
+
};
|
|
360
379
|
//#endregion
|
|
361
380
|
//#region src/configs/panel-app-inline-host.config.d.ts
|
|
362
381
|
declare const PANEL_APP_INLINE_HOST_CONTRACT: {
|
|
@@ -375,5 +394,5 @@ type InlineContentElement = {
|
|
|
375
394
|
};
|
|
376
395
|
declare function readInlineContentHeight(body: InlineContentElement | null | undefined, documentElement: InlineContentElement): number;
|
|
377
396
|
//#endregion
|
|
378
|
-
export { type AgentRunSendIngressPayload, type AgentRunSessionMaterializationMetadata, type AgentRunSessionMessageRequestPayload, type AppEvent, type AppEventEmitOptions, type AppEventEnvelope, type AppEventHandler, type AppEventKey, type AppEventSource, CHAT_INLINE_TOKENS_METADATA_KEY, CHAT_SESSION_MATERIALIZATION_METADATA_KEY, CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND, CHAT_WORKSPACE_FILE_TOKEN_KIND, type ChatInlineTokenMetadata, 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, Ingress, type IngressContext, type IngressEnvelope, type IngressHandler, type InstallationKind, type Key, PANEL_APP_INLINE_HOST_CONTRACT, RUNTIME_DEFAULT_MODEL_VALUE, type RuntimeModelSelectionMode, type TypedKey, type UiShowContentEventPayload, type UiShowContentFileViewer, type UiShowContentPlacement, type UiShowContentPurpose, type UiShowContentTarget, type Unsubscribe, type UpdateBlockReason, type UpdateFailureStage, type UpdateProgress, type UpdateSnapshot, type UpdateStatus, createAppEventKey, createEventKey, createTypedKey, eventKeys, getKeyId, ingressKeys, isRuntimeDefaultModelValue, normalizeRuntimeModelSelectionMode, readInlineContentHeight, toDisposable };
|
|
397
|
+
export { type AgentRunSendIngressPayload, type AgentRunSessionMaterializationMetadata, type AgentRunSessionMessageRequestPayload, type AppEvent, type AppEventEmitOptions, type AppEventEnvelope, type AppEventHandler, type AppEventKey, type AppEventSource, CHAT_INLINE_TOKENS_METADATA_KEY, CHAT_INLINE_TOKENS_SCHEMA_VERSION, CHAT_SESSION_MATERIALIZATION_METADATA_KEY, CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND, CHAT_WORKSPACE_FILE_TOKEN_KIND, type ChatInlineTokenMetadata, type ChatInlineTokensMetadata, type ChatSkillInlineTokenMetadata, type ChatSkillSource, 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, Ingress, type IngressContext, type IngressEnvelope, type IngressHandler, type InstallationKind, type Key, PANEL_APP_INLINE_HOST_CONTRACT, RUNTIME_DEFAULT_MODEL_VALUE, type RuntimeModelSelectionMode, type TypedKey, type UiShowContentEventPayload, type UiShowContentFileViewer, type UiShowContentPlacement, type UiShowContentPurpose, type UiShowContentTarget, type Unsubscribe, type UpdateBlockReason, type UpdateFailureStage, type UpdateProgress, type UpdateSnapshot, type UpdateStatus, createAppEventKey, createEventKey, createTypedKey, eventKeys, getKeyId, ingressKeys, isRuntimeDefaultModelValue, normalizeRuntimeModelSelectionMode, readInlineContentHeight, toDisposable };
|
|
379
398
|
//# 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/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/utils/inline-content-height.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,SAAA;EACA,MAAA,GAAS,WAAA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AAA;AAAA,KAII,yBAAA;EACV,EAAA;EACA,UAAA;EACA,MAAA,EAAQ,mBAAA;EACR,KAAA;EACA,OAAA,EAAS,oBAAA;EACT,SAAA,EAAW,sBAAA;AAAA;;;KClCD,YAAA;AAAA,KAYA,gBAAA;AAAA,KAMA,iBAAA;AAAA,KAKA,kBAAA;AAAA,KAEA,cAAA;EACV,eAAA;EACA,UAAA;EACA,OAAA;AAAA;AAAA,KAGU,cAAA;EACV,MAAA,EAAQ,YAAA;EACR,gBAAA,EAAkB,gBAAA;EAClB,OAAA;EACA,WAAA;EACA,cAAA;EACA,gBAAA;EACA,iBAAA;EACA,kBAAA;EACA,eAAA;EACA,aAAA;EACA,QAAA,EAAU,cAAA;EACV,aAAA;EACA,eAAA;EACA,WAAA,EAAa,iBAAA;EACb,eAAA;EACA,YAAA;EACA,YAAA,GAAe,kBAAA;EACf,iBAAA;AAAA;;;iBC3Cc,cAAA,GAAA,CAAkB,EAAA,WAAa,QAAA,CAAS,CAAA;AAAA,iBAIxC,iBAAA,GAAA,CAAqB,EAAA,WAAa,WAAA,CAAY,CAAA;AAAA,cAIjD,SAAA;EAAA
|
|
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/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/utils/inline-content-height.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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AAA,CAAK,oBAAA;EACJ,OAAA;EACA,QAAA,GAAW,2BAAA;EACX,MAAA;AAAA,MAED,IAAA,CAAK,oBAAA;EACJ,OAAA,EAAS,cAAA;EACT,QAAA,GAAW,2BAAA;EACX,OAAA;EACA,MAAA;AAAA;AAAA,cAGO,WAAA;EAAA;;;;;;;;;;;;;;;cClJA,2BAAA;AAAA,KAED,yBAAA;AAAA,iBAKI,0BAAA,CAA2B,KAAA;AAAA,iBAI3B,kCAAA,CACd,KAAA,YACC,yBAAA;;;cCbU,+BAAA;AAAA,cACA,iCAAA;AAAA,cACA,8BAAA;AAAA,cACA,mCAAA;AAAA,KAED,eAAA;AAAA,KAEA,4BAAA;EACV,IAAA;EACA,GAAA;EACA,IAAA;EACA,MAAA,EAAQ,eAAA;EACR,IAAA;EACA,KAAA;EACA,OAAA;AAAA;AAAA,KAGU,gCAAA;EACV,IAAA,SACW,8BAAA,UACA,mCAAA;EACX,GAAA;EACA,KAAA;EACA,OAAA;AAAA;AAAA,KAGU,uBAAA,GACR,4BAAA,GACA,gCAAA;AAAA,KAEQ,wBAAA;EACV,aAAA,SAAsB,iCAAA;EACtB,KAAA,EAAO,uBAAA;AAAA;;;cChCI,8BAAA;EAAA;;;;;;;;KCAR,oBAAA;EAAA,SACM,YAAA;EAAA,SACA,YAAA;EAAA,SACA,YAAA;AAAA;AAAA,iBAGK,uBAAA,CACd,IAAA,EAAM,oBAAA,qBACN,eAAA,EAAiB,oBAAA"}
|
package/dist/index.js
CHANGED
|
@@ -205,6 +205,7 @@ const eventKeys = {
|
|
|
205
205
|
channelConfigApplyStatus: createAppEventKey("channel.config.apply-status"),
|
|
206
206
|
sessionUpdated: createAppEventKey("session.updated"),
|
|
207
207
|
sessionRunStatus: createAppEventKey("session.run-status"),
|
|
208
|
+
sessionRunQueueUpdated: createAppEventKey("session.run-queue.updated"),
|
|
208
209
|
sessionMetadataChanged: createAppEventKey("session.metadata.changed"),
|
|
209
210
|
ncpEvent: createAppEventKey("ncp.event"),
|
|
210
211
|
sessionSummaryUpsert: createAppEventKey("session.summary.upsert"),
|
|
@@ -248,6 +249,7 @@ function normalizeRuntimeModelSelectionMode(value) {
|
|
|
248
249
|
//#endregion
|
|
249
250
|
//#region src/configs/chat-composer-token.config.ts
|
|
250
251
|
const CHAT_INLINE_TOKENS_METADATA_KEY = "ui_inline_tokens";
|
|
252
|
+
const CHAT_INLINE_TOKENS_SCHEMA_VERSION = 2;
|
|
251
253
|
const CHAT_WORKSPACE_FILE_TOKEN_KIND = "workspace_file";
|
|
252
254
|
const CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND = "workspace_directory";
|
|
253
255
|
//#endregion
|
|
@@ -265,6 +267,6 @@ function readInlineContentHeight(body, documentElement) {
|
|
|
265
267
|
return Math.ceil(Math.max(body?.clientHeight ?? 0, body?.offsetHeight ?? 0, body?.scrollHeight ?? 0, documentElement.offsetHeight));
|
|
266
268
|
}
|
|
267
269
|
//#endregion
|
|
268
|
-
export { CHAT_INLINE_TOKENS_METADATA_KEY, CHAT_SESSION_MATERIALIZATION_METADATA_KEY, CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND, CHAT_WORKSPACE_FILE_TOKEN_KIND, DisposableOwner, DisposableStore, EventBus, Ingress, PANEL_APP_INLINE_HOST_CONTRACT, RUNTIME_DEFAULT_MODEL_VALUE, createAppEventKey, createEventKey, createTypedKey, eventKeys, getKeyId, ingressKeys, isRuntimeDefaultModelValue, normalizeRuntimeModelSelectionMode, readInlineContentHeight, toDisposable };
|
|
270
|
+
export { CHAT_INLINE_TOKENS_METADATA_KEY, CHAT_INLINE_TOKENS_SCHEMA_VERSION, CHAT_SESSION_MATERIALIZATION_METADATA_KEY, CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND, CHAT_WORKSPACE_FILE_TOKEN_KIND, DisposableOwner, DisposableStore, EventBus, Ingress, PANEL_APP_INLINE_HOST_CONTRACT, RUNTIME_DEFAULT_MODEL_VALUE, createAppEventKey, createEventKey, createTypedKey, eventKeys, getKeyId, ingressKeys, isRuntimeDefaultModelValue, normalizeRuntimeModelSelectionMode, readInlineContentHeight, toDisposable };
|
|
269
271
|
|
|
270
272
|
//# 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/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/utils/inline-content-height.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 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 { 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 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 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 AgentRunSessionMessageRequestPayload = {\n message: NcpMessage;\n requestId: string;\n sessionId: string;\n};\n\nexport const CHAT_SESSION_MATERIALIZATION_METADATA_KEY = \"session_materialization\";\n\nexport type AgentRunSessionMaterializationMetadata = {\n kind: \"child\";\n parentSessionId: string;\n inheritContext: true;\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 response: createTypedKey<ExtensionResponseIngressPayload>(\"extension.response\"),\n },\n agentRun: {\n send: createTypedKey<AgentRunSendIngressPayload>(\"agent-run.send\"),\n abort: createTypedKey<NcpMessageAbortPayload>(\"agent-run.abort\"),\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_WORKSPACE_FILE_TOKEN_KIND = \"workspace_file\";\nexport const CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND = \"workspace_directory\";\n\nexport type ChatInlineTokenMetadata = {\n kind: string;\n key: string;\n label: string;\n rawText: string;\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","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"],"mappings":";AAOA,SAAgB,eAAkB,IAAyB;CACzD,MAAM,eAAe,GAAG,MAAM;AAC9B,KAAI,CAAC,aACH,OAAM,IAAI,MAAM,2BAA2B;AAE7C,QAAO,EAAE,IAAI,cAAc;;AAG7B,SAAgB,SAAS,KAA2B;A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mCACd,OAC2B;AAC3B,KAAI,UAAU,cAAc,UAAU,kBACpC,QAAO;AAET,QAAO;;;;ACjBT,MAAa,kCAAkC;AAC/C,MAAa,iCAAiC;AAC9C,MAAa,sCAAsC;;;ACFnD,MAAa,iCAAiC;CAC5C,0BAA0B;CAC1B,aAAa;CACb,wBAAwB;CACxB,WAAW;CACX,sBAAsB;CACvB;;;ACAD,SAAgB,wBACd,MACA,iBACQ;AACR,QAAO,KAAK,KACV,KAAK,IACH,MAAM,gBAAgB,GACtB,MAAM,gBAAgB,GACtB,MAAM,gBAAgB,GACtB,gBAAgB,aACjB,CACF"}
|
|
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/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/utils/inline-content-height.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 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 { 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 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 AgentRunSessionMessageRequestPayload = {\n message: NcpMessage;\n requestId: string;\n sessionId: string;\n};\n\nexport const CHAT_SESSION_MATERIALIZATION_METADATA_KEY = \"session_materialization\";\n\nexport type AgentRunSessionMaterializationMetadata = {\n kind: \"child\";\n parentSessionId: string;\n inheritContext: true;\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 response: createTypedKey<ExtensionResponseIngressPayload>(\"extension.response\"),\n },\n agentRun: {\n send: createTypedKey<AgentRunSendIngressPayload>(\"agent-run.send\"),\n abort: createTypedKey<NcpMessageAbortPayload>(\"agent-run.abort\"),\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_WORKSPACE_FILE_TOKEN_KIND = \"workspace_file\";\nexport const CHAT_WORKSPACE_DIRECTORY_TOKEN_KIND = \"workspace_directory\";\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 ChatInlineTokenMetadata =\n | ChatSkillInlineTokenMetadata\n | ChatWorkspaceInlineTokenMetadata;\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","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"],"mappings":";AAOA,SAAgB,eAAkB,IAAyB;CACzD,MAAM,eAAe,GAAG,MAAM;AAC9B,KAAI,CAAC,aACH,OAAM,IAAI,MAAM,2BAA2B;AAE7C,QAAO,EAAE,IAAI,cAAc;;AAG7B,SAAgB,SAAS,KAA2B;AAClD,QAAO,OAAO,QAAQ,WAAW,IAAI,MAAM,GAAG,IAAI;;;;ACNpD,IAAa,WAAb,MAAsB;CACpB,4BAA6B,IAAI,KAA4C;CAC7E,kCAAmC,IAAI,KAAwC;CAC/E,gBAAwB;CACxB;CACA;CACA;CAEA,YAAY,UAA2B,EAAE,EAAE;AACzC,OAAK,oBAAoB,QAAQ;AACjC,OAAK,kBAAkB,QAAQ;AAC/B,OAAK,kBAAkB,QAAQ;;CAGjC,QACE,KACA,SACA,UAA+B,EAAE,KACxB;EACT,MAAM,WAAgC;GACpC,MAAM,SAAS,IAAI;GACnB;GACA,GAAI,QAAQ,YAAY,EAAE,WAAW,QAAQ,WAAW,GAAG,EAAE;GAC7D,GAAI,QAAQ,SAAS,EAAE,QAAQ,QAAQ,QAA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
2
2
|
"name": "@nextclaw/shared",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared lightweight primitives and contracts for NextClaw packages.",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@nextclaw/ncp": "0.7.
|
|
18
|
+
"@nextclaw/ncp": "0.7.11"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.17.6",
|