@klarkxy/dsh-deep-view 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +23 -0
- package/README.md +25 -2
- package/cordis.patch.yml +5 -0
- package/docs/README.zh-CN.md +26 -0
- package/icon.svg +6 -0
- package/lib/answer-text.d.ts +15 -0
- package/lib/answer-text.js +110 -0
- package/lib/answer-text.js.map +1 -0
- package/lib/answers.d.ts +49 -0
- package/lib/answers.js +60 -0
- package/lib/answers.js.map +1 -0
- package/lib/client.inner.cjs +3423 -0
- package/lib/client.inner.cjs.map +1 -0
- package/lib/client.js +3432 -0
- package/lib/contracts.d.ts +2 -0
- package/lib/contracts.js +12 -0
- package/lib/contracts.js.map +1 -0
- package/lib/contracts2.d.ts +103 -0
- package/lib/copy.d.ts +37 -0
- package/lib/copy.js +69 -0
- package/lib/copy.js.map +1 -0
- package/lib/core.d.ts +57 -0
- package/lib/core.js +2 -0
- package/lib/core2.js +1079 -0
- package/lib/core2.js.map +1 -0
- package/lib/index.d.ts +104 -0
- package/lib/index.js +1153 -0
- package/lib/index.js.map +1 -0
- package/lib/widget.d.ts +71 -0
- package/lib/widget.js +1365 -0
- package/lib/widget.js.map +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +152 -4
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../dsh-plugin-kit/src/log-shared.ts","../../dsh-plugin-kit/src/logger.ts","../../dsh-plugin-kit/src/host-rpc.ts","../src/index.ts"],"sourcesContent":["export type PluginLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fault'\n\nexport const PLUGIN_LOG_LEVELS: readonly PluginLogLevel[] = ['debug', 'info', 'warn', 'error', 'fault']\nexport const DEFAULT_PLUGIN_LOG_LEVEL: PluginLogLevel = 'info'\nexport const PLUGIN_LOG_MAX_MESSAGE_CHARS = 16_000\nexport const PLUGIN_LOG_MAX_CONTEXT_CHARS = 8_000\n\nexport type PluginLogScalar = string | number | boolean | null\nexport type PluginLogContext = Record<string, PluginLogScalar | undefined>\n\nexport interface PluginLogInput {\n level: PluginLogLevel\n event: string\n message: string\n context?: PluginLogContext\n error?: unknown\n}\n\nexport interface PluginLogError {\n name: string\n message: string\n stack?: string\n code?: string\n}\n\nexport interface PluginLogEntry {\n version: 1\n at: string\n level: PluginLogLevel\n source: string\n surface: 'host' | 'client'\n profile?: string\n event: string\n message: string\n pid?: number\n context?: Record<string, PluginLogScalar>\n error?: PluginLogError\n}\n\nexport interface PluginLogger {\n readonly source: string\n readonly file: string | null\n readonly lastWriteError: string | null\n debug(event: string, message: string, context?: PluginLogContext): boolean\n info(event: string, message: string, context?: PluginLogContext): boolean\n warn(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean\n error(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean\n fault(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean\n write(input: PluginLogInput): boolean\n child(context: PluginLogContext): PluginLogger\n}\n\nconst SOURCE_RE = /^[a-z][a-z0-9-]{0,63}$/\nconst EVENT_RE = /^[a-z][a-z0-9._-]{0,127}$/\nconst CONTEXT_KEY_RE = /^[a-zA-Z][a-zA-Z0-9._-]{0,63}$/\nconst SECRET_KEY_RE = /(?:api[_-]?key|access[_-]?token|refresh[_-]?token|bearer|authorization|cookie|set[_-]?cookie|nonce|credential|private[_-]?key|password|secret|app[_-]?secret|client[_-]?secret|z_c0|d_c0)$/i\n\nconst CHAT_PAYLOAD_RE =\n /\"role\"\\s*:\\s*\"(?:system|user|assistant|tool)\"|\"(?:messages|content|prompt|input_text|input_image|image_url)\"\\s*:\\s*[\\[{\"']/i\nconst CREDENTIAL_BODY_RE =\n /-----BEGIN (?:RSA |EC |OPENSSH |PRIVATE )?PRIVATE KEY-----|\"type\"\\s*:\\s*\"service_account\"|credentials\\.json|\\.dsh[/\\\\](?:credentials|auth)/i\nconst AUTH_HEADER_RE = /\\b(Authorization|Proxy-Authorization|Cookie|Set-Cookie)\\s*:\\s*[^\\r\\n]*/gi\nconst BEARER_RE = /\\bBearer\\s+[A-Za-z0-9._\\-+=/]{8,}/g\nconst SECRET_FIELD_RE =\n /([\"']?(?:api[_-]?key|access[_-]?token|refresh[_-]?token|token|bearer|authorization|cookie|set-cookie|nonce|credential|private[_-]?key|password|secret|app[_-]?secret|client[_-]?secret|password|z_c0|d_c0)[\"']?\\s*[:=]\\s*)(?:\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|[^\\s,&;}]+)/gi\nconst SECRET_QUERY_RE =\n /([?&](?:token|api[_-]?key|key|secret|password|bootstrap|code|sig|signature|credential|password)=)[^\\s&#\"']+/gi\nconst URL_CREDENTIAL_RE = /\\b(https?:\\/\\/)[^\\s/:@]+:[^\\s/@]+@/gi\nconst BOOTSTRAP_RE = /\\/bootstrap\\/[^\\s\"'?&#]+/gi\nconst KNOWN_TOKEN_RE = /\\b(?:sk-[A-Za-z0-9_-]{10,}|gh[pousr]_[A-Za-z0-9_]{16,}|github_pat_[A-Za-z0-9_]{20,}|tvly-[A-Za-z0-9_-]{10,}|AKIA[0-9A-Z]{16})\\b/g\nconst PATH_RE = /(?:[A-Za-z]:\\\\|\\\\\\\\)[^\\s\"'`<>|]+|(?:\\/(?:home|Users|tmp|var|root)\\/|~\\/)[^\\s\"'`<>|]+/g\n\nexport function isPluginLogLevel(value: unknown): value is PluginLogLevel {\n return typeof value === 'string' && (PLUGIN_LOG_LEVELS as readonly string[]).includes(value)\n}\n\nexport function pluginLogLevelEnabled(level: PluginLogLevel, minimum: PluginLogLevel): boolean {\n return PLUGIN_LOG_LEVELS.indexOf(level) >= PLUGIN_LOG_LEVELS.indexOf(minimum)\n}\n\nexport function normalizePluginLogSource(raw: string): string {\n const stripped = String(raw || '').trim().replace(/^@[^/]+\\//, '').toLowerCase()\n .replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '')\n const prefixed = /^[a-z]/.test(stripped) ? stripped : `p-${stripped}`\n const bounded = prefixed.slice(0, 64).replace(/-+$/g, '')\n return SOURCE_RE.test(bounded) ? bounded : 'dsh-plugin'\n}\n\nexport function normalizePluginLogEvent(raw: string): string {\n const cleaned = String(raw || '').trim().toLowerCase()\n .replace(/[^a-z0-9._-]+/g, '-').replace(/^[^a-z]+/, '').slice(0, 128)\n return EVENT_RE.test(cleaned) ? cleaned : 'plugin.event'\n}\n\n/**\n * Parse a level specification like `debug` or `dsh-zhihu=debug,dsh-dot:warn,info`.\n * Source-specific rules win over a bare fallback level.\n */\nexport function parsePluginLogLevel(\n spec: string | undefined | null,\n source?: string,\n fallback: PluginLogLevel = DEFAULT_PLUGIN_LOG_LEVEL,\n): PluginLogLevel {\n if (!spec || typeof spec !== 'string') return fallback\n const normalizedSource = source ? normalizePluginLogSource(source) : undefined\n let wildcard: PluginLogLevel | undefined\n for (const token of spec.split(',').map(part => part.trim()).filter(Boolean)) {\n const lowered = token.toLowerCase()\n if (isPluginLogLevel(lowered)) {\n wildcard = lowered\n continue\n }\n const match = /^([^=:]+)[=:]([a-z]+)$/i.exec(token)\n if (!match) continue\n const target = match[1]!.trim()\n const candidate = match[2]!.trim().toLowerCase()\n if (!isPluginLogLevel(candidate)) continue\n if (target === '*') {\n wildcard = candidate\n continue\n }\n if (normalizedSource && normalizePluginLogSource(target) === normalizedSource) {\n return candidate\n }\n }\n return wildcard ?? fallback\n}\n\nexport function sanitizePluginLogText(text: string, maxChars = PLUGIN_LOG_MAX_MESSAGE_CHARS): string {\n if (!text) return ''\n if (CREDENTIAL_BODY_RE.test(text)) return '[omitted credential material]'\n if (CHAT_PAYLOAD_RE.test(text)) return '[omitted chat payload]'\n const redacted = text\n .replace(AUTH_HEADER_RE, '$1: [redacted]')\n .replace(BEARER_RE, 'Bearer [redacted]')\n .replace(SECRET_FIELD_RE, (full, prefix: string) => {\n const value = full.slice(prefix.length)\n if (value.startsWith('\"')) return `${prefix}\"[redacted]\"`\n if (value.startsWith(\"'\")) return `${prefix}'[redacted]'`\n return `${prefix}[redacted]`\n })\n .replace(SECRET_QUERY_RE, '$1[redacted]')\n .replace(URL_CREDENTIAL_RE, '$1[redacted]@')\n .replace(BOOTSTRAP_RE, '/bootstrap/[redacted]')\n .replace(KNOWN_TOKEN_RE, '[redacted]')\n .replace(PATH_RE, '[path]')\n return truncateLogText(redacted, maxChars)\n}\n\nexport function sanitizePluginLogContext(\n input: PluginLogContext | undefined,\n): Record<string, PluginLogScalar> | undefined {\n if (!input) return undefined\n const output: Record<string, PluginLogScalar> = {}\n for (const [key, value] of Object.entries(input).slice(0, 32)) {\n if (value === undefined || !CONTEXT_KEY_RE.test(key)) continue\n if (typeof value === 'number' && !Number.isFinite(value)) continue\n if (SECRET_KEY_RE.test(key)) {\n output[key] = '[redacted]'\n continue\n }\n output[key] = typeof value === 'string' ? sanitizePluginLogText(value, 1_000) : value\n }\n if (!Object.keys(output).length) return undefined\n const encoded = JSON.stringify(output)\n if (encoded.length <= PLUGIN_LOG_MAX_CONTEXT_CHARS) return output\n return { omitted: true, reason: 'Diagnostic context exceeded its size limit.' }\n}\n\nexport function sanitizePluginLogError(error: unknown): PluginLogError | undefined {\n if (error === undefined) return undefined\n const row = error && typeof error === 'object'\n ? error as { name?: unknown; message?: unknown; stack?: unknown; code?: unknown }\n : {}\n const rawMessage = typeof row.message === 'string' ? row.message : String(error)\n const result: PluginLogError = {\n name: typeof row.name === 'string' && row.name.trim() ? truncateLogText(row.name.trim(), 100) : 'Error',\n message: sanitizePluginLogText(rawMessage) || 'Unknown error',\n }\n if (typeof row.stack === 'string' && row.stack.trim()) {\n result.stack = sanitizePluginLogText(row.stack, 24_000)\n }\n if (typeof row.code === 'string' && /^[A-Za-z0-9_./:-]{1,100}$/.test(row.code)) {\n result.code = row.code\n } else if (typeof row.code === 'number' && Number.isFinite(row.code)) {\n result.code = String(row.code)\n }\n return result\n}\n\nexport function mergePluginLogContext(\n base: PluginLogContext | undefined,\n extra: PluginLogContext | undefined,\n): PluginLogContext | undefined {\n if (!base) return extra\n if (!extra) return base\n return { ...base, ...extra }\n}\n\nexport function buildPluginLogEntry(\n input: PluginLogInput,\n meta: {\n at: Date\n source: string\n surface: 'host' | 'client'\n profile?: string\n pid?: number\n correlation?: PluginLogContext\n },\n): PluginLogEntry {\n const entry: PluginLogEntry = {\n version: 1,\n at: meta.at.toISOString(),\n level: isPluginLogLevel(input.level) ? input.level : 'info',\n source: normalizePluginLogSource(meta.source),\n surface: meta.surface,\n ...(meta.profile ? { profile: meta.profile } : {}),\n event: normalizePluginLogEvent(input.event),\n message: sanitizePluginLogText(input.message || 'No diagnostic message was provided.', PLUGIN_LOG_MAX_MESSAGE_CHARS),\n ...(meta.pid !== undefined ? { pid: meta.pid } : {}),\n }\n const context = sanitizePluginLogContext(mergePluginLogContext(meta.correlation, input.context))\n if (context) entry.context = context\n const error = sanitizePluginLogError(input.error)\n if (error) entry.error = error\n return entry\n}\n\nexport function createChildPluginLogger(parent: PluginLogger, bound: PluginLogContext): PluginLogger {\n return {\n get source() { return parent.source },\n get file() { return parent.file },\n get lastWriteError() { return parent.lastWriteError },\n debug: (event, message, context) => parent.debug(event, message, mergePluginLogContext(bound, context)),\n info: (event, message, context) => parent.info(event, message, mergePluginLogContext(bound, context)),\n warn: (event, message, error, context) => parent.warn(event, message, error, mergePluginLogContext(bound, context)),\n error: (event, message, error, context) => parent.error(event, message, error, mergePluginLogContext(bound, context)),\n fault: (event, message, error, context) => parent.fault(event, message, error, mergePluginLogContext(bound, context)),\n write: input => parent.write({ ...input, context: mergePluginLogContext(bound, input.context) }),\n child: next => createChildPluginLogger(parent, mergePluginLogContext(bound, next) ?? {}),\n }\n}\n\nexport function truncateLogText(text: string, maxChars: number): string {\n if (text.length <= maxChars) return text\n const marker = '[truncated]\\n'\n if (maxChars <= marker.length) return text.slice(0, Math.max(0, maxChars))\n return `${marker}${text.slice(-(maxChars - marker.length))}`\n}\n","import { AsyncLocalStorage } from 'node:async_hooks'\nimport {\n appendFileSync, closeSync, existsSync, lstatSync, mkdirSync, openSync,\n readSync, readdirSync, realpathSync, renameSync, unlinkSync,\n} from 'node:fs'\nimport { homedir } from 'node:os'\nimport { basename, dirname, join, resolve, sep } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport {\n DEFAULT_PLUGIN_LOG_LEVEL, buildPluginLogEntry, createChildPluginLogger,\n mergePluginLogContext, normalizePluginLogSource, parsePluginLogLevel,\n pluginLogLevelEnabled, sanitizePluginLogText,\n type PluginLogContext, type PluginLogEntry, type PluginLogInput,\n type PluginLogLevel, type PluginLogger,\n} from './log-shared.ts'\n\nexport * from './log-shared.ts'\n\nexport const PLUGIN_LOG_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000\nexport const PLUGIN_LOG_MAX_FILE_BYTES = 100 * 1024 * 1024\nexport const PLUGIN_LOG_MAX_ARCHIVE_BYTES = 100 * 1024 * 1024\nexport const PLUGIN_LOG_RECENT_LIMIT = 200\n\nconst PROFILE_RE = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/\nconst ARCHIVE_RE = /^[a-z][a-z0-9-]{0,63}\\.\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}\\.\\d{3}Z\\.\\d+\\.\\d+\\.jsonl$/\n\nconst correlationStorage = new AsyncLocalStorage<PluginLogContext>()\nconst processFileLoggers = new Map<string, RotatingPluginLogger>()\nlet operationSequence = 0\n\nexport interface RotatingPluginLoggerOptions {\n directory?: string\n home?: string\n profile?: string\n minimumLevel?: PluginLogLevel\n env?: NodeJS.ProcessEnv\n now?: () => Date\n pid?: number\n maxFileBytes?: number\n maxArchiveBytes?: number\n maxAgeMs?: number\n recentLimit?: number\n forwardHostWarnError?: boolean\n}\n\nexport interface InstallPluginLoggerOptions extends RotatingPluginLoggerOptions {\n loadedContext?: PluginLogContext\n}\n\ntype HostContextLike = {\n baseUrl?: unknown\n get?: (name: string, ...rest: unknown[]) => unknown\n effect?: (callback: () => () => void | Promise<void>, label?: string) => unknown\n logger?: {\n warn?: (...args: unknown[]) => void\n error?: (...args: unknown[]) => void\n }\n}\n\nexport function safeProfileName(profile: string | undefined | null): string {\n const trimmed = String(profile ?? '').trim()\n if (PROFILE_RE.test(trimmed)) return trimmed.toLowerCase()\n const cleaned = trimmed.toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 64)\n return cleaned && PROFILE_RE.test(cleaned) ? cleaned : 'default'\n}\n\nexport function pluginLogDirectory(home: string, profile = 'default'): string {\n return join(resolve(home), 'logs', 'plugins', safeProfileName(profile))\n}\n\nexport function resolveHostLogTarget(\n ctx: unknown,\n options: Pick<RotatingPluginLoggerOptions, 'directory' | 'home' | 'profile' | 'env'> = {},\n): { directory: string | null; anchor: string | null; profile?: string } {\n const env = options.env ?? process.env\n if (options.directory?.trim()) {\n const dir = resolve(options.directory.trim())\n return { directory: dir, anchor: dir, ...(options.profile ? { profile: safeProfileName(options.profile) } : {}) }\n }\n if (options.home?.trim()) {\n const home = resolve(options.home.trim())\n const profile = safeProfileName(options.profile)\n return { directory: pluginLogDirectory(home, profile), anchor: home, profile }\n }\n if (env.DSH_PLUGIN_LOG_DIR?.trim()) {\n const dir = resolve(env.DSH_PLUGIN_LOG_DIR.trim())\n return { directory: dir, anchor: dir, ...(options.profile ? { profile: safeProfileName(options.profile) } : {}) }\n }\n const host = ctx && typeof ctx === 'object' ? ctx as HostContextLike : undefined\n let profileCtx: { home?: unknown; name?: unknown; dir?: unknown } | undefined\n try {\n profileCtx = host?.get?.('profileContext', false) as typeof profileCtx\n } catch {\n try { profileCtx = host?.get?.('profileContext') as typeof profileCtx } catch { profileCtx = undefined }\n }\n if (\n typeof profileCtx?.home === 'string' && profileCtx.home.trim()\n && typeof profileCtx.dir === 'string' && profileCtx.dir.trim()\n ) {\n const home = resolve(profileCtx.home.trim())\n const dir = resolve(profileCtx.dir.trim())\n if (isInside(home, dir)) {\n const profile = safeProfileName(typeof profileCtx.name === 'string' ? profileCtx.name : basename(dir))\n return { directory: pluginLogDirectory(home, profile), anchor: home, profile }\n }\n }\n const inUnitTest = Boolean(env.VITEST || env.NODE_TEST_CONTEXT)\n if (!inUnitTest && typeof host?.baseUrl === 'string' && host.baseUrl.trim()) {\n const basePath = pathFromBaseUrl(host.baseUrl)\n const configuredHome = resolve((env.DSH_HOME?.trim() || join(homedir(), '.dsh')).trim())\n const profilesRoot = join(configuredHome, 'profiles')\n if (basePath && isInside(profilesRoot, basePath) && !samePath(profilesRoot, basePath)) {\n const rel = basePath.slice(profilesRoot.length).replace(/^[/\\\\]+/, '')\n const firstSegment = rel.split(/[/\\\\]/)[0]\n if (firstSegment) {\n const profile = safeProfileName(firstSegment)\n return { directory: pluginLogDirectory(configuredHome, profile), anchor: configuredHome, profile }\n }\n }\n }\n return { directory: null, anchor: null, ...(options.profile ? { profile: safeProfileName(options.profile) } : {}) }\n}\n\n/**\n * Synchronous, append-only rotating JSONL logger modeled on DSH Spaces\n * diagnostics: 7-day or 100 MiB active rotation, 7-day / 100 MiB archive\n * retention, secret and path redaction, and non-throwing write resilience.\n */\nexport class RotatingPluginLogger implements PluginLogger {\n readonly source: string\n readonly file: string | null\n private lastError: string | null = null\n private size = 0\n private openedAt = 0\n private initialized = false\n private writing = false\n private sequence = 0\n private loggedWriteFailure = false\n private readonly recent: PluginLogEntry[] = []\n private readonly directory: string | null\n private readonly anchor: string | null\n private readonly profile: string | undefined\n private readonly minimum: PluginLogLevel\n private readonly now: () => Date\n private readonly pid: number\n private readonly maxFileBytes: number\n private readonly maxArchiveBytes: number\n private readonly maxAgeMs: number\n private readonly recentLimit: number\n\n constructor(source: string, options: RotatingPluginLoggerOptions & { anchor?: string | null } = {}) {\n this.source = normalizePluginLogSource(source)\n const env = options.env ?? process.env\n const resolved = options.directory !== undefined || options.home !== undefined\n ? resolveHostLogTarget(undefined, options)\n : { directory: null, anchor: options.anchor ?? null, profile: options.profile }\n this.directory = resolved.directory\n this.anchor = options.anchor ?? resolved.anchor\n this.profile = options.profile ?? resolved.profile\n this.file = this.directory ? join(this.directory, `${this.source}.jsonl`) : null\n this.minimum = options.minimumLevel ?? parsePluginLogLevel(env.DSH_PLUGIN_LOG_LEVEL, this.source, DEFAULT_PLUGIN_LOG_LEVEL)\n this.now = options.now ?? (() => new Date())\n this.pid = options.pid ?? process.pid\n this.maxFileBytes = options.maxFileBytes ?? PLUGIN_LOG_MAX_FILE_BYTES\n this.maxArchiveBytes = options.maxArchiveBytes ?? PLUGIN_LOG_MAX_ARCHIVE_BYTES\n this.maxAgeMs = options.maxAgeMs ?? PLUGIN_LOG_MAX_AGE_MS\n this.recentLimit = Math.max(1, options.recentLimit ?? PLUGIN_LOG_RECENT_LIMIT)\n }\n\n get lastWriteError(): string | null {\n return this.lastError\n }\n\n recentEntries(limit = this.recentLimit): PluginLogEntry[] {\n return this.recent.slice(-Math.max(0, limit))\n }\n\n debug(event: string, message: string, context?: PluginLogContext): boolean {\n return this.write({ level: 'debug', event, message, ...(context ? { context } : {}) })\n }\n\n info(event: string, message: string, context?: PluginLogContext): boolean {\n return this.write({ level: 'info', event, message, ...(context ? { context } : {}) })\n }\n\n warn(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean {\n return this.write({\n level: 'warn', event, message,\n ...(error !== undefined ? { error } : {}),\n ...(context ? { context } : {}),\n })\n }\n\n error(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean {\n return this.write({\n level: 'error', event, message,\n ...(error !== undefined ? { error } : {}),\n ...(context ? { context } : {}),\n })\n }\n\n fault(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean {\n return this.write({\n level: 'fault', event, message,\n ...(error !== undefined ? { error } : {}),\n ...(context ? { context } : {}),\n })\n }\n\n child(context: PluginLogContext): PluginLogger {\n return createChildPluginLogger(this, context)\n }\n\n write(input: PluginLogInput): boolean {\n if (!pluginLogLevelEnabled(input.level, this.minimum) || this.writing) return false\n const at = this.now()\n let entry: PluginLogEntry\n let line: string\n try {\n entry = buildPluginLogEntry(input, {\n at,\n source: this.source,\n surface: 'host',\n profile: this.profile,\n pid: this.pid,\n correlation: correlationStorage.getStore(),\n })\n line = `${JSON.stringify(entry)}\\n`\n } catch {\n return false\n }\n this.pushRecent(entry)\n if (!this.directory || !this.file) return true\n this.writing = true\n try {\n this.openManagedDirectory()\n this.prepare(at)\n if (\n this.size > 0\n && (this.size + Buffer.byteLength(line) > this.maxFileBytes || at.getTime() - this.openedAt >= this.maxAgeMs)\n ) {\n this.rotate(at)\n }\n appendFileSync(this.file, line, { encoding: 'utf8', mode: 0o600 })\n this.size += Buffer.byteLength(line)\n this.prune(at)\n this.lastError = null\n this.loggedWriteFailure = false\n return true\n } catch (error) {\n const detail = sanitizePluginLogText(error instanceof Error ? error.message : String(error), 500)\n this.lastError = `The plugin diagnostic log could not be written: ${detail}`\n this.initialized = false\n if (!this.loggedWriteFailure) {\n this.loggedWriteFailure = true\n try {\n process.stderr.write(`DSH Plugin (${this.source}): ${this.lastError}. The original operation continues unchanged.\\n`)\n } catch {\n // Broken stderr must never affect caller behavior.\n }\n }\n return false\n } finally {\n this.writing = false\n }\n }\n\n private pushRecent(entry: PluginLogEntry): void {\n this.recent.push(entry)\n const overflow = this.recent.length - this.recentLimit\n if (overflow > 0) this.recent.splice(0, overflow)\n }\n\n private prepare(at: Date): void {\n if (this.initialized || !this.file) return\n this.openManagedDirectory()\n const stat = this.regularFile(this.file)\n this.size = stat?.size ?? 0\n const stamps = stat ? [stat.birthtimeMs, stat.mtimeMs].filter(value => value > 0) : []\n this.openedAt = stamps.length ? Math.min(...stamps) : at.getTime()\n this.initialized = true\n }\n\n private rotate(at: Date): void {\n if (!this.directory || !this.file) return\n const stamp = at.toISOString().replace(/:/g, '-')\n const name = `${this.source}.${stamp}.${this.pid}.${this.sequence++}.jsonl`\n if (!ARCHIVE_RE.test(name)) throw new Error('Diagnostic log archive name is invalid.')\n const archive = join(this.directory, name)\n if (lexists(archive)) throw new Error('Diagnostic log archive already exists.')\n try {\n renameSync(this.file, archive)\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code\n if (code === 'ENOENT') {\n this.size = 0\n this.openedAt = at.getTime()\n return\n }\n throw error\n }\n this.size = 0\n this.openedAt = at.getTime()\n }\n\n private rotateStaleActive(at: Date): void {\n if (!this.file) return\n const stat = this.regularFile(this.file)\n if (!stat || stat.size === 0) return\n if (at.getTime() - stat.mtimeMs < this.maxAgeMs) return\n this.rotate(at)\n }\n\n private prune(at: Date): void {\n if (!this.directory) return\n this.rotateStaleActive(at)\n const archives: Array<{ name: string; size: number; mtime: number }> = []\n let total = 0\n for (const name of readdirSync(this.directory)) {\n if (!ARCHIVE_RE.test(name) || !name.startsWith(`${this.source}.`)) continue\n const file = join(this.directory, name)\n const stat = lstatSync(file)\n if (stat.isSymbolicLink() || !stat.isFile()) throw new Error('Diagnostic log archive is not a regular file.')\n if (at.getTime() - stat.mtimeMs >= this.maxAgeMs) {\n try { unlinkSync(file) } catch { /* concurrent prune */ }\n continue\n }\n archives.push({ name, size: stat.size, mtime: stat.mtimeMs })\n total += stat.size\n }\n archives.sort((left, right) => left.mtime - right.mtime || left.name.localeCompare(right.name))\n while (total > this.maxArchiveBytes && archives.length) {\n const oldest = archives.shift()!\n try { unlinkSync(join(this.directory, oldest.name)) } catch { /* concurrent prune */ }\n total -= oldest.size\n }\n }\n\n private openManagedDirectory(): void {\n if (!this.directory) return\n if (this.anchor) {\n const anchorStat = existsSync(this.anchor) ? lstatSync(this.anchor) : undefined\n if (anchorStat?.isSymbolicLink()) throw new Error('Diagnostic log anchor cannot be a symbolic link.')\n }\n mkdirSync(this.directory, { recursive: true, mode: 0o700 })\n const stat = lstatSync(this.directory)\n if (stat.isSymbolicLink() || !stat.isDirectory()) {\n throw new Error('Diagnostic log directory is not a real directory.')\n }\n const realDir = realpathSync(this.directory)\n if (this.anchor) {\n const realAnchor = realpathSync(this.anchor)\n if (!isInside(realAnchor, realDir)) {\n throw new Error('Diagnostic log directory escaped its managed root.')\n }\n }\n }\n\n private regularFile(file: string): { size: number; birthtimeMs: number; mtimeMs: number } | undefined {\n try {\n const stat = lstatSync(file)\n if (stat.isSymbolicLink() || !stat.isFile()) throw new Error('Diagnostic log is not a regular file.')\n const expected = join(realpathSync(dirname(file)), basename(file))\n if (!samePath(realpathSync(file), expected)) throw new Error('Diagnostic log path could not be verified.')\n return stat\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined\n throw error\n }\n }\n}\n\nexport function createPluginLogger(\n ctxOrSource: unknown,\n maybeSource?: string | RotatingPluginLoggerOptions,\n maybeOptions?: RotatingPluginLoggerOptions,\n): PluginLogger {\n const hasCtx = typeof ctxOrSource !== 'string'\n const ctx = hasCtx ? ctxOrSource : undefined\n const source = hasCtx ? String(maybeSource ?? 'dsh-plugin') : ctxOrSource\n const options = (hasCtx ? maybeOptions : maybeSource as RotatingPluginLoggerOptions | undefined) ?? {}\n const normalized = normalizePluginLogSource(source)\n const target = resolveHostLogTarget(ctx, options)\n\n let backing: RotatingPluginLogger\n const canShare = Boolean(\n target.directory\n && options.minimumLevel === undefined\n && options.now === undefined\n && options.pid === undefined\n && options.maxFileBytes === undefined\n && options.maxArchiveBytes === undefined\n && options.maxAgeMs === undefined,\n )\n if (canShare && target.directory) {\n const key = resolve(target.directory, `${normalized}.jsonl`)\n let shared = processFileLoggers.get(key)\n if (!shared) {\n shared = new RotatingPluginLogger(normalized, {\n ...options,\n directory: target.directory,\n anchor: target.anchor,\n profile: target.profile,\n })\n processFileLoggers.set(key, shared)\n }\n backing = shared\n } else {\n backing = new RotatingPluginLogger(normalized, {\n ...options,\n ...(target.directory ? { directory: target.directory, anchor: target.anchor } : {}),\n ...(target.profile ? { profile: target.profile } : {}),\n })\n }\n\n if (options.forwardHostWarnError === false || !ctx || typeof ctx !== 'object') {\n return backing\n }\n return wrapWithHostForwarding(backing, ctx as HostContextLike)\n}\n\nexport function installPluginLogger(\n ctx: unknown,\n source: string,\n options: InstallPluginLoggerOptions = {},\n): PluginLogger {\n const logger = createPluginLogger(ctx, source, options)\n logger.info('plugin.loaded', 'Host plugin initialized.', options.loadedContext)\n const host = ctx && typeof ctx === 'object' ? ctx as HostContextLike : undefined\n if (typeof host?.effect === 'function') {\n try {\n host.effect(() => () => {\n logger.debug('plugin.disposed', 'Host plugin disposed.')\n }, `${logger.source}.logger`)\n } catch {\n // Non-Cordis or mock effect implementation.\n }\n }\n return logger\n}\n\nfunction wrapWithHostForwarding(backing: PluginLogger, host: HostContextLike): PluginLogger {\n const forward = (input: PluginLogInput) => {\n if (input.level !== 'warn' && input.level !== 'error' && input.level !== 'fault') return\n try {\n const hostLogger = host.logger\n if (!hostLogger) return\n const detail = input.error instanceof Error\n ? `${input.message} (${input.error.message})`\n : input.error !== undefined\n ? `${input.message} (${String(input.error)})`\n : input.message\n const text = sanitizePluginLogText(`${backing.source} [${input.event}]: ${detail}`, 1_000)\n if (input.level === 'warn') {\n if (typeof hostLogger.warn === 'function') hostLogger.warn(text)\n } else if (typeof hostLogger.error === 'function') {\n hostLogger.error(text)\n } else if (typeof hostLogger.warn === 'function') {\n hostLogger.warn(text)\n }\n } catch {\n // Host logger forwarding is best-effort.\n }\n }\n const wrapped: PluginLogger = {\n get source() { return backing.source },\n get file() { return backing.file },\n get lastWriteError() { return backing.lastWriteError },\n debug: (event, message, context) => backing.debug(event, message, context),\n info: (event, message, context) => backing.info(event, message, context),\n warn: (event, message, error, context) => {\n const wrote = backing.warn(event, message, error, context)\n forward({ level: 'warn', event, message, error, context })\n return wrote\n },\n error: (event, message, error, context) => {\n const wrote = backing.error(event, message, error, context)\n forward({ level: 'error', event, message, error, context })\n return wrote\n },\n fault: (event, message, error, context) => {\n const wrote = backing.fault(event, message, error, context)\n forward({ level: 'fault', event, message, error, context })\n return wrote\n },\n write: input => {\n const wrote = backing.write(input)\n forward(input)\n return wrote\n },\n child: context => createChildPluginLogger(wrapped, context),\n }\n return wrapped\n}\n\nexport function nextPluginOperationId(prefix = 'op'): string {\n return `${normalizePluginLogSource(prefix)}-${process.pid}-${++operationSequence}`\n}\n\nexport function currentPluginLogContext(): PluginLogContext | undefined {\n return correlationStorage.getStore()\n}\n\nexport function withPluginLogContext<T>(context: PluginLogContext, action: () => T): T {\n const merged = mergePluginLogContext(correlationStorage.getStore(), context) ?? {}\n return correlationStorage.run(merged, action)\n}\n\nexport async function pluginLogStep<T>(\n logger: PluginLogger,\n step: string,\n context: PluginLogContext | undefined,\n action: () => Promise<T>,\n completedLevel: PluginLogLevel = 'debug',\n): Promise<T> {\n const started = Date.now()\n const base = { ...context, step }\n logger.debug('step.started', 'Operation step started.', base)\n try {\n const result = await action()\n logger.write({\n level: completedLevel,\n event: 'step.completed',\n message: 'Operation step completed.',\n context: { ...base, durationMs: Date.now() - started },\n })\n return result\n } catch (error) {\n logger.error('step.failed', 'Operation step failed.', error, {\n ...base,\n durationMs: Date.now() - started,\n })\n throw error\n }\n}\n\nexport function pluginLogSyncStep<T>(\n logger: PluginLogger,\n step: string,\n context: PluginLogContext | undefined,\n action: () => T,\n completedLevel: PluginLogLevel = 'debug',\n): T {\n const started = Date.now()\n const base = { ...context, step }\n logger.debug('step.started', 'Operation step started.', base)\n try {\n const result = action()\n logger.write({\n level: completedLevel,\n event: 'step.completed',\n message: 'Operation step completed.',\n context: { ...base, durationMs: Date.now() - started },\n })\n return result\n } catch (error) {\n logger.error('step.failed', 'Operation step failed.', error, {\n ...base,\n durationMs: Date.now() - started,\n })\n throw error\n }\n}\n\nexport function readPluginLogTail(file: string, maxBytes = 256 * 1024): string {\n const stat = lstatSync(file)\n if (stat.isSymbolicLink() || !stat.isFile()) throw new Error('Diagnostic log is not a regular file.')\n if (stat.size <= 0 || maxBytes <= 0) return ''\n const length = Math.min(stat.size, maxBytes)\n const descriptor = openSync(file, 'r')\n try {\n const buffer = Buffer.alloc(length)\n const read = readSync(descriptor, buffer, 0, buffer.length, stat.size - length)\n let text = buffer.subarray(0, read).toString('utf8')\n if (stat.size > length) {\n const newline = text.indexOf('\\n')\n text = newline === -1 ? '' : text.slice(newline + 1)\n }\n return text\n } finally {\n closeSync(descriptor)\n }\n}\n\nfunction lexists(file: string): boolean {\n try {\n lstatSync(file)\n return true\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false\n throw error\n }\n}\n\nfunction pathFromBaseUrl(baseUrl: string): string | null {\n try {\n return baseUrl.includes('://') ? resolve(fileURLToPath(baseUrl)) : resolve(baseUrl)\n } catch {\n return null\n }\n}\n\nfunction samePath(left: string, right: string): boolean {\n const a = resolve(left)\n const b = resolve(right)\n return process.platform === 'win32' ? a.toLowerCase() === b.toLowerCase() : a === b\n}\n\nfunction isInside(root: string, target: string): boolean {\n const rootResolved = resolve(root)\n const targetResolved = resolve(target)\n if (samePath(rootResolved, targetResolved)) return true\n const prefix = rootResolved.endsWith(sep) ? rootResolved : rootResolved + sep\n return process.platform === 'win32'\n ? targetResolved.toLowerCase().startsWith(prefix.toLowerCase())\n : targetResolved.startsWith(prefix)\n}\n","import type { IncomingMessage, ServerResponse } from 'node:http'\nimport type { RpcResult } from './contracts.ts'\nimport { nextPluginOperationId, withPluginLogContext, type PluginLogger } from './logger.ts'\n\nexport interface HostRpcContext {\n webServer: { register(route: { kind: 'prefix'; path: string; handler(req: IncomingMessage, res: ServerResponse): void | Promise<void> }): () => void }\n connection: { requestRejection?: (request: IncomingMessage) => number | undefined }\n}\n\ntype Rejection = { status: number; body?: string }\n\nexport interface HostRpcTransportOptions {\n maxBodyBytes?: number\n isEndpoint?: (endpoint: string) => boolean\n caseInsensitiveContentType?: boolean\n emptyBodyAsNull?: boolean\n beforeBody?: (request: IncomingMessage, endpoint: string) => Rejection | undefined\n errorBody?: (status: number, error?: unknown) => string | undefined\n logger?: PluginLogger\n}\n\nexport interface HostRpcOptions extends HostRpcTransportOptions {\n requirePayload?: boolean\n}\n\n/** The shared authenticated HTTP boundary. Each plugin still owns its RPC envelope semantics. */\nexport function registerHostRpcTransport(\n ctx: HostRpcContext,\n channel: string,\n dispatch: (endpoint: string, body: unknown, signal: AbortSignal, response: ServerResponse) => void | Promise<void>,\n options: HostRpcTransportOptions = {},\n): () => void {\n const bodyLimit = options.maxBodyBytes ?? 64 * 1024\n if (!Number.isSafeInteger(bodyLimit) || bodyLimit <= 0) throw new Error('Invalid RPC body limit')\n const isEndpoint = options.isEndpoint ?? ((endpoint: string) => /^[a-z.]+$/.test(endpoint))\n const log = options.logger\n return ctx.webServer.register({ kind: 'prefix', path: channel, handler: async (req, res) => {\n const reject = (status: number, error?: unknown, override?: string) => {\n if (res.destroyed) return\n if (status === 413) res.writeHead(status, { connection: 'close' })\n else res.writeHead(status)\n res.end(override ?? options.errorBody?.(status, error) ?? (status === 500 ? 'rpc request failed' : ''))\n }\n let endpoint = ''\n try {\n // Host admission always runs before plugin-specific checks or body reads.\n if (typeof ctx.connection.requestRejection !== 'function') {\n log?.error('rpc.admission.unavailable', 'Host RPC admission policy is unavailable.', undefined, { channel, status: 503 })\n reject(503)\n return\n }\n const rejection = ctx.connection.requestRejection(req)\n if (rejection !== undefined) {\n log?.warn('rpc.admission.rejected', 'Host RPC request rejected by connection policy.', undefined, { channel, status: rejection })\n reject(rejection)\n return\n }\n const pathname = new URL(req.url ?? '/', 'http://dsh.internal').pathname\n endpoint = pathname.startsWith(`${channel}/`) ? pathname.slice(channel.length + 1) : ''\n if (req.method !== 'POST' || !isEndpoint(endpoint)) {\n log?.debug('rpc.route.rejected', 'Host RPC route or method rejected.', { channel, endpoint: endpoint || null, method: req.method ?? null, status: 404 })\n reject(404)\n return\n }\n const contentType = String(req.headers['content-type'] ?? '').split(';', 1)[0]?.trim()\n if ((options.caseInsensitiveContentType ? contentType.toLowerCase() : contentType) !== 'application/json') {\n log?.debug('rpc.content-type.rejected', 'Host RPC content-type rejected.', { channel, endpoint, status: 415 })\n reject(415); return\n }\n const guarded = options.beforeBody?.(req, endpoint)\n if (guarded) {\n log?.debug('rpc.guard.rejected', 'Host RPC request rejected before body read.', { channel, endpoint, status: guarded.status })\n reject(guarded.status, undefined, guarded.body)\n return\n }\n\n const controller = new AbortController()\n res.on('close', () => { if (!res.writableEnded) controller.abort() })\n const chunks: Buffer[] = []\n let size = 0\n for await (const chunk of req) {\n const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)\n size += buffer.length\n if (size > bodyLimit) {\n log?.warn('rpc.body.too-large', 'Host RPC request exceeded body limit.', undefined, { channel, endpoint, maxBodyBytes: bodyLimit })\n reject(413); req.destroy(); return\n }\n chunks.push(buffer)\n }\n let body: unknown\n try { body = JSON.parse(Buffer.concat(chunks).toString('utf8') || (options.emptyBodyAsNull ? 'null' : '')) }\n catch {\n log?.debug('rpc.body.invalid-json', 'Host RPC request body is not valid JSON.', { channel, endpoint, status: 400 })\n reject(400)\n return\n }\n if (log) {\n await withPluginLogContext(\n { rpcChannel: channel, rpcEndpoint: endpoint, operationId: nextPluginOperationId('rpc') },\n () => dispatch(endpoint, body, controller.signal, res),\n )\n } else {\n await dispatch(endpoint, body, controller.signal, res)\n }\n } catch (error) {\n log?.error('rpc.dispatch.failed', 'Unhandled host RPC handler error.', error, { channel, endpoint: endpoint || null, status: 500 })\n reject(500, error)\n }\n } })\n}\n\n/** Write the native Connection response envelope after a plugin has handled a request. */\nexport function sendHostRpcResponse(response: ServerResponse, rpcId: string, result: unknown, noStore = true): void {\n if (response.destroyed) return\n response.writeHead(200, { 'content-type': 'application/json', ...(noStore ? { 'cache-control': 'no-store' } : {}) })\n response.end(JSON.stringify({ type: 'server-response', rpcId, result }))\n}\n\n/** Safe host RPC registration. Missing requestRejection fails closed. */\nexport function registerHostRpc<R extends RpcResult = RpcResult>(\n ctx: HostRpcContext,\n channel: string,\n call: (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<R>,\n options: HostRpcOptions = {},\n): () => void {\n const log = options.logger\n return registerHostRpcTransport(ctx, channel, async (endpoint, body, signal, res) => {\n if (!body || typeof body !== 'object' || Array.isArray(body)) {\n log?.debug('rpc.envelope.invalid', 'Host RPC envelope must be a JSON object.', { channel, endpoint })\n res.writeHead(400); res.end(); return\n }\n const request = body as Record<string, unknown>\n if (request.type !== 'client-request' || request.method !== endpoint || typeof request.rpcId !== 'string'\n || (options.requirePayload && !Object.hasOwn(request, 'payload'))) {\n log?.debug('rpc.envelope.invalid', 'Host RPC envelope failed validation.', { channel, endpoint })\n res.writeHead(400); res.end(); return\n }\n const started = Date.now()\n const raw = await call(endpoint, request.payload, signal)\n const durationMs = Date.now() - started\n if (raw.ok) {\n log?.debug('rpc.call.completed', 'Host RPC call succeeded.', { channel, endpoint, durationMs })\n } else {\n log?.warn('rpc.call.error', 'Host RPC call returned an application error.', undefined, {\n channel, endpoint, code: raw.error?.code ?? null, durationMs,\n })\n }\n const result = raw.ok ? raw : { ...raw, error: { details: {}, ...raw.error } }\n sendHostRpcResponse(res, request.rpcId, result)\n }, options)\n}\n","import { randomUUID } from 'node:crypto'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { ObjectJsonSchema } from '@deepseek-ai/dsh-tools'\nimport { createUserMessage } from '@deepseek-ai/dsh-llm'\nimport { registerHostRpc, type HostRpcContext } from '@klarkxy/dsh-plugin-kit/host-rpc'\nimport { installPluginLogger, type PluginLogger } from '@klarkxy/dsh-plugin-kit/logger'\nimport { checkShownView, validateViewAnswer, viewSummary } from './core/index.js'\nimport { answerText } from './answer-text.ts'\nimport { HOST_SERVICE, PLUGIN_NAME, RPC_CHANNEL, VIEW_OWNER, isRecord, type DeepViewHost, type PendingView, type RpcResult, type ShownView, type ViewNode, type ViewPresentation, type ViewAnswerMetadata } from './contracts.ts'\n\nexport const name = 'deep-view'\nexport const inject = ['tools', 'sessionController', 'sessions', 'agents', 'connection', 'webServer'] as const\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context { [HOST_SERVICE]: DeepViewHost }\n}\n\nconst MAX_REDIRECTS = 256\n\nexport function resolveSessionId(redirects: ReadonlyMap<string, string>, sessionId: string): string {\n let current = sessionId\n const seen = new Set<string>()\n while (!seen.has(current)) {\n seen.add(current)\n const next = redirects.get(current)\n if (!next) break\n current = next\n }\n return current\n}\n\nexport function handoffPendingSession(\n pending: Map<string, PendingView>,\n redirects: Map<string, string>,\n fromSessionId: string,\n toSessionId: string,\n): boolean {\n if (!short(fromSessionId, 200) || !short(toSessionId, 200) || fromSessionId === toSessionId) return false\n const source = resolveSessionId(redirects, fromSessionId)\n const target = resolveSessionId(redirects, toSessionId)\n if (source === target) return false\n redirects.set(source, target)\n if (fromSessionId !== source) redirects.set(fromSessionId, target)\n while (redirects.size > MAX_REDIRECTS) {\n const oldest = redirects.keys().next().value\n if (oldest === undefined) break\n redirects.delete(oldest)\n }\n const record = pending.get(source)\n if (!record) return false\n pending.delete(source)\n if (pending.has(target)) return false\n pending.set(target, { ...record, sessionId: target })\n return true\n}\n\ntype AgentLike = {\n id: string\n session: unknown\n followup(message: ReturnType<typeof createUserMessage>): void\n}\n// The real `agents` service returns the runtime Agent type; our local narrow\n// shape cannot feed includes() against it, so compare by id.\nconst isLiveRoot = (host: Host, agent: AgentLike | undefined) => agent !== undefined && host.agents.roots().some(root => (root as unknown as AgentLike).id === agent.id)\ntype Host = Context & HostRpcContext & {\n tools: {\n get(name: string, scope?: object): unknown\n register(definition: Record<string, unknown>): () => void\n }\n agents: { get(id: string): AgentLike | undefined; roots(): AgentLike[] }\n sessionController: { resolveAgent(id: string): Promise<{ agent?: AgentLike; error?: { message?: string } }> }\n sessions: { flush(session: unknown): Promise<boolean> }\n logger?: { warn(message: string, ...args: unknown[]): void }\n}\nconst ok = <T,>(value: T): RpcResult<T> => ({ ok: true, value })\nconst fail = (code: string, message: string): RpcResult<never> => ({ ok: false, error: { code, message } })\nconst short = (value: unknown, max = 160): value is string => typeof value === 'string' && value.length > 0 && value.length <= max\nconst checkedShown = (title: unknown, view: unknown) => checkShownView(title, view) as ShownView | { error: string }\nconst isShown = (value: ShownView | { error: string }): value is ShownView => !('error' in value)\n\n// The host snapshots presentationMeta as JSON on every result, so a result\n// without a card reports null; undefined fails the whole call as invalid output.\nfunction presentation(args: unknown, value: unknown): ViewPresentation | null {\n if (!isRecord(value) || value.owner !== VIEW_OWNER || !['shown', 'pending'].includes(String(value.status))) return null\n const shown = checkedShown(isRecord(args) ? args.title : undefined, isRecord(args) ? args.view : undefined)\n if (!isShown(shown)) return null\n return {\n owner: VIEW_OWNER, ...(short(value.viewId, 80) ? { viewId: value.viewId } : {}),\n ...shown, awaitReply: value.awaitReply === true,\n }\n}\n\nexport function createShowViewTool(\n host: Host,\n pending: Map<string, PendingView>,\n makeId: () => string = randomUUID,\n logger?: PluginLogger,\n): Record<string, unknown> {\n return {\n name: 'show_view',\n description: [\n 'Attach one card below your final reply when a visual or interactive form beats prose: compared numbers, a trend, a share, progress; an estimate with user-adjustable inputs; or a choice the user answers afterwards (use ask_user_question when you cannot continue without it).',\n 'Prefer plain Markdown otherwise. Call once, then finish the reply; the card is not yet visible when this tool returns.',\n 'Never end on the call, wait or poll, repeat the card JSON, or claim the user saw it. Answers accept one reply, sent as the next user message. Never collect keys, tokens or passwords.',\n ].join(' '),\n // tools.register() takes raw JSON Schema; the per-field DSL is only for defineTool().\n parameters: {\n type: 'object',\n properties: {\n title: { type: 'string', description: 'Short heading above the card.' },\n view: { type: 'object', additionalProperties: true, description: [\n 'One ViewNode, nodes nest under stack|row(children,let?).',\n 'Display: text,metric{label,value},table{columns:[{key,label}],rows:[[cell]]},chart{kind:bar|hbar|line|area|donut,categories,series:[{name?,values}]},progress{percent|value+max},callout{text},sources{items:[{label,url}]}.',\n 'Inputs: slider,number,choice,toggle{id,label,value}. A {\"=\":\"expr\"} formula replaces a value or cell, reading input ids and let names.',\n 'Answers(need await_reply true): options{id,options:[{label,description?}],multi?},confirm{id},form{id,fields:[{id,label,placeholder?}]},submit{id,label}. No html.',\n ].join(' ') },\n await_reply: { type: 'boolean', description: 'Whether this card asks the user for a response.' },\n },\n required: ['view'],\n } satisfies ObjectJsonSchema,\n output: {\n schema: { type: 'object', properties: { owner: { type: 'string', const: VIEW_OWNER }, status: { type: 'string' }, viewId: { type: 'string' }, awaitReply: { type: 'boolean' }, summary: { type: 'string' } }, required: ['owner', 'status', 'awaitReply', 'summary'], additionalProperties: false },\n render: (_args: unknown, value: { summary?: string }) => [{ type: 'text', text: String(value.summary ?? '') }],\n presentationMeta: presentation,\n },\n async execute(args: unknown, exec: { agent?: AgentLike; callId?: string; concludeTurn(): void }) {\n const input = isRecord(args) ? args : {}\n const shown = checkedShown(input.title, input.view)\n if (!isShown(shown)) {\n logger?.debug('view.invalid', 'Rejected invalid show_view arguments.', {\n sessionId: exec.agent?.id ?? null,\n reason: shown.error,\n })\n return { owner: VIEW_OWNER, status: 'invalid', awaitReply: false, summary: shown.error }\n }\n if (typeof input.await_reply !== 'undefined' && typeof input.await_reply !== 'boolean') {\n return { owner: VIEW_OWNER, status: 'invalid', awaitReply: false, summary: 'await_reply: expected true or false' }\n }\n const awaitReply = input.await_reply ?? shown.interactive\n if (awaitReply !== shown.interactive) {\n return { owner: VIEW_OWNER, status: 'invalid', awaitReply: false, summary: shown.interactive ? 'This card has answer controls; omit await_reply or set it true.' : 'A display-only card cannot wait for an answer; omit await_reply or set it false.' }\n }\n const id = exec.agent?.id\n const agent = id === undefined ? undefined : host.agents.get(id)\n if (awaitReply && !isLiveRoot(host, agent)) {\n logger?.debug('view.non-root-rejected', 'Rejected interactive show_view outside a live root session.', {\n sessionId: id ?? null,\n })\n return { owner: VIEW_OWNER, status: 'invalid', awaitReply: false, summary: 'An interactive view only works in a live root session. Put the question or decision in your response instead.' }\n }\n let viewId: string | undefined\n if (awaitReply && agent) {\n viewId = makeId()\n // set() alone replaces an earlier unanswered card: the old card becomes\n // stale and its pending record points at the newest view only.\n pending.set(agent.id, { id: viewId, sessionId: agent.id, ...(exec.callId ? { callId: exec.callId } : {}), ...shown })\n }\n logger?.info('view.prepared', 'Prepared Deep View card.', {\n sessionId: agent?.id ?? id ?? null,\n viewId: viewId ?? null,\n awaitReply,\n })\n return {\n owner: VIEW_OWNER, status: awaitReply ? 'pending' : 'shown', ...(viewId ? { viewId } : {}), awaitReply,\n // A tool result is process data. The completed-turn reply surface owns\n // the card, so the model must still produce its final answer.\n summary: `Card prepared for the final reply. Finish with a concise final answer; do not call this tool again for the same card.${awaitReply ? ' The user can answer the card after your reply finishes; do not wait or poll.' : ''} ${viewSummary(shown.view)}`,\n }\n },\n isConcurrencySafe: () => false,\n }\n}\n\nexport function createRpc(\n host: Host,\n pending: Map<string, PendingView>,\n redirects: ReadonlyMap<string, string> = new Map(),\n logger?: PluginLogger,\n) {\n const claims = new Set<string>()\n return async (endpoint: string, payload: unknown, signal: AbortSignal): Promise<RpcResult> => {\n if (!isRecord(payload) || !short(payload.sessionId, 200)) return fail('bad-request', 'A bounded sessionId is required')\n const sessionId = resolveSessionId(redirects, payload.sessionId)\n const record = pending.get(sessionId)\n if (endpoint === 'pending') return ok(record?.callId === payload.callId || payload.callId === undefined ? record ?? null : null)\n if (endpoint === 'dismiss') {\n if (record && record.id === payload.viewId) {\n pending.delete(sessionId)\n logger?.debug('view.dismissed', 'Dismissed pending Deep View card.', { sessionId, viewId: record.id })\n }\n return ok(true)\n }\n if (endpoint !== 'reply') return fail('not-found', 'Unknown Deep View endpoint')\n if (!record || !short(payload.viewId, 80) || payload.viewId !== record.id || !short(payload.action, 160) || !isRecord(payload.values)) {\n logger?.debug('reply.stale', 'Rejected reply for stale or closed Deep View card.', { sessionId })\n return fail('stale', 'This view is no longer open')\n }\n if (claims.has(record.id)) return fail('busy', 'This view is already being answered')\n const checked = validateViewAnswer(record.view as ViewNode, payload.action, payload.values) as { error?: string } & Record<string, unknown>\n if (checked.error !== undefined) {\n logger?.debug('reply.invalid', 'Rejected invalid Deep View reply.', {\n sessionId,\n viewId: record.id,\n action: payload.action,\n reason: checked.error,\n })\n return fail('invalid', checked.error)\n }\n claims.add(record.id)\n pending.delete(sessionId)\n // Exact-once: the record is restored only when followup never appended a\n // user message. Once appended, a failed checkpoint may lose the card from\n // disk, but re-adding the record would let a retry send the same user\n // answer a second time. Restoration lives in the finally so cancellation\n // returns, resolve failures and append failures share one path.\n let appended = false\n try {\n if (signal.aborted) return fail('cancelled', 'The request was cancelled')\n // A live root answers directly. Plugin-owned root sessions (for example a\n // chat drawn by its own plugin under the subagent origin) are refused by the\n // session controller, so it is only asked to resume sessions that are not live.\n const live = host.agents.get(sessionId)\n const resolved = isLiveRoot(host, live) ? { agent: live } : await host.sessionController.resolveAgent(sessionId)\n const agent = resolved.agent\n if (!agent || host.agents.get(agent.id) !== agent || !host.agents.roots().some(root => (root as unknown as AgentLike).id === agent.id)) throw new Error(('error' in resolved ? resolved.error?.message : undefined) ?? 'The session is not a live root session')\n if (signal.aborted) return fail('cancelled', 'The request was cancelled')\n // Text and answer facts share one durable message: neither can survive\n // without the other, and fork/history boundaries preserve their pairing.\n const deepView: ViewAnswerMetadata = {\n owner: VIEW_OWNER, version: 1,\n answer: { id: record.id, action: payload.action, values: checked },\n }\n agent.followup(createUserMessage({\n content: [{ type: 'text', text: answerText(record, payload.action, checked) }],\n source: { kind: 'user', deepView },\n }))\n appended = true\n await host.sessions.flush(agent.session)\n logger?.info('reply.submitted', 'Submitted Deep View reply to live session.', {\n sessionId: agent.id,\n viewId: record.id,\n action: payload.action,\n })\n return ok({ answered: true })\n } catch (error) {\n logger?.error('reply.failed', 'Failed to deliver Deep View reply.', error, {\n sessionId,\n viewId: record.id,\n action: payload.action,\n appended,\n })\n return fail('internal', error instanceof Error ? error.message : String(error))\n } finally {\n if (!appended && !pending.has(sessionId)) pending.set(sessionId, record)\n claims.delete(record.id)\n }\n }\n}\n\nexport async function apply(ctx: Context): Promise<void> {\n const host = ctx as unknown as Host\n const logger = installPluginLogger(ctx, PLUGIN_NAME, { forwardHostWarnError: false })\n const pending = new Map<string, PendingView>()\n const redirects = new Map<string, string>()\n ctx.provide(HOST_SERVICE, {\n handoffSession: (fromSessionId, toSessionId) => {\n const moved = handoffPendingSession(pending, redirects, fromSessionId, toSessionId)\n if (moved) logger.debug('session.handoff', 'Moved pending Deep View card across session handoff.', { fromSessionId, toSessionId })\n return moved\n },\n })\n ctx.effect(() => {\n if (host.tools.get('show_view')) {\n logger.warn('tool.already-registered', 'show_view is already registered by another plugin; skipping registration.')\n host.logger?.warn('deep-view: show_view is already registered by another plugin; this bundle stays disabled for its own tool')\n return () => {}\n }\n try {\n return host.tools.register(createShowViewTool(host, pending, randomUUID, logger))\n }\n catch (error) {\n logger.warn('tool.register-failed', 'show_view tool registration failed.', error)\n host.logger?.warn('deep-view: show_view registration skipped: %s', error instanceof Error ? error.message : String(error))\n return () => {}\n }\n }, 'deep-view.tool')\n // Only admission events are observed, never scanned. A new human message closes a stale card.\n ctx.effect(() => ctx.on('session/event', (session: { id: string }, event: { type: string; data?: unknown }) => {\n if (event.type !== 'user/message' || !isRecord(event.data) || !isRecord(event.data.source) || event.data.source.kind !== 'user') return\n pending.delete(resolveSessionId(redirects, session.id))\n }), 'deep-view.close-pending')\n ctx.effect(() => registerHostRpc(host, RPC_CHANNEL, createRpc(host, pending, redirects, logger), { maxBodyBytes: 24 * 1024, logger }), 'deep-view.rpc')\n}\n"],"mappings":";;;;;;;;;;;AAEA,MAAa,oBAA+C;CAAC;CAAS;CAAQ;CAAQ;CAAS;AAAO;AACtG,MAAa,2BAA2C;AACxD,MAAa,+BAA+B;AAgD5C,MAAM,YAAY;AAClB,MAAM,WAAW;AACjB,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AAEtB,MAAM,kBACJ;AACF,MAAM,qBACJ;AACF,MAAM,iBAAiB;AACvB,MAAM,YAAY;AAClB,MAAM,kBACJ;AACF,MAAM,kBACJ;AACF,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AACrB,MAAM,iBAAiB;AACvB,MAAM,UAAU;AAEhB,SAAgB,iBAAiB,OAAyC;CACxE,OAAO,OAAO,UAAU,YAAa,kBAAwC,SAAS,KAAK;AAC7F;AAEA,SAAg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mBAAmB,wDAAwD;GAAE;GAAe;EAAY,CAAC;EACjI,OAAO;CACT,EACF,CAAC;CACD,IAAI,aAAa;EACf,IAAI,KAAK,MAAM,IAAI,WAAW,GAAG;GAC/B,OAAO,KAAK,2BAA2B,2EAA2E;GAClH,KAAK,QAAQ,KAAK,2GAA2G;GAC7H,aAAa,CAAC;EAChB;EACA,IAAI;GACF,OAAO,KAAK,MAAM,SAAS,mBAAmB,MAAM,SAAS,YAAY,MAAM,CAAC;EAClF,SACO,OAAO;GACZ,OAAO,KAAK,wBAAwB,uCAAuC,KAAK;GAChF,KAAK,QAAQ,KAAK,iDAAiD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;GACzH,aAAa,CAAC;EAChB;CACF,GAAG,gBAAgB;CAEnB,IAAI,aAAa,IAAI,GAAG,kBAAkB,SAAyB,UAA4C;EAC7G,IAAI,MAAM,SAAS,kBAAkB,CAAC,SAAS,MAAM,IAAI,KAAK,CAAC,SAAS,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,OAAO,SAAS,QAAQ;EACjI,QAAQ,OAAO,iBAAiB,WAAW,QAAQ,EAAE,CAAC;CACxD,CAAC,GAAG,yBAAyB;CAC7B,IAAI,aAAa,gBAAgB,MAAM,aAAa,UAAU,MAAM,SAAS,WAAW,MAAM,GAAG;EAAE,cAAc;EAAW;CAAO,CAAC,GAAG,eAAe;AACxJ"}
|
package/lib/widget.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { g as ViewNode } from "./contracts2.js";
|
|
2
|
+
import { ComponentType } from "react";
|
|
3
|
+
//#region src/ui.d.ts
|
|
4
|
+
type ViewT = (key: string, params?: Record<string, unknown>) => string;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/chart.d.ts
|
|
7
|
+
type ChartHandle = {
|
|
8
|
+
label: string | null;
|
|
9
|
+
asTable: boolean;
|
|
10
|
+
toggleTable(): void;
|
|
11
|
+
copy(): void;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/widget.d.ts
|
|
15
|
+
type MarkdownProps = {
|
|
16
|
+
text: string;
|
|
17
|
+
streaming?: boolean;
|
|
18
|
+
labels: ViewLabels;
|
|
19
|
+
variant?: 'body' | 'compact';
|
|
20
|
+
};
|
|
21
|
+
type ViewLabels = {
|
|
22
|
+
code: {
|
|
23
|
+
copyLabel: string;
|
|
24
|
+
copiedLabel: string;
|
|
25
|
+
toolbarLabels?: {
|
|
26
|
+
codeLabel: string;
|
|
27
|
+
wrapLabel: string;
|
|
28
|
+
unwrapLabel: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
footnotes: string;
|
|
32
|
+
};
|
|
33
|
+
type Answer = {
|
|
34
|
+
id: string;
|
|
35
|
+
action: string;
|
|
36
|
+
values: Record<string, unknown>;
|
|
37
|
+
};
|
|
38
|
+
type WidgetCardProps = {
|
|
39
|
+
title?: string;
|
|
40
|
+
view: ViewNode;
|
|
41
|
+
onSubmit?: (action: string, values: Record<string, unknown>) => void;
|
|
42
|
+
onDismiss?: () => void;
|
|
43
|
+
busy?: boolean;
|
|
44
|
+
settled?: boolean;
|
|
45
|
+
answer?: Answer | null;
|
|
46
|
+
t?: ViewT;
|
|
47
|
+
labels?: ViewLabels;
|
|
48
|
+
Markdown?: ComponentType<MarkdownProps>;
|
|
49
|
+
localOnly?: boolean;
|
|
50
|
+
};
|
|
51
|
+
type Ctx = {
|
|
52
|
+
values: Record<string, unknown>;
|
|
53
|
+
setInput(id: string, value: unknown): void;
|
|
54
|
+
lookup(name: string): unknown;
|
|
55
|
+
locked: boolean;
|
|
56
|
+
answerLocked: boolean;
|
|
57
|
+
busy: boolean;
|
|
58
|
+
settled: boolean;
|
|
59
|
+
answer?: Answer | null;
|
|
60
|
+
onSubmit?: (action: string, values: Record<string, unknown>) => void;
|
|
61
|
+
registerChart(key: string, handle: ChartHandle): (() => void) | void;
|
|
62
|
+
refreshCharts(): void;
|
|
63
|
+
};
|
|
64
|
+
declare function WidgetView({ view, onSubmit, settled, answer, busy, registerChart, refreshCharts, t, labels, Markdown }: Omit<WidgetCardProps, 'title'> & {
|
|
65
|
+
registerChart: Ctx['registerChart'];
|
|
66
|
+
refreshCharts: () => void;
|
|
67
|
+
}): import("react").JSX.Element;
|
|
68
|
+
declare function WidgetCard({ title, view, onSubmit, onDismiss, busy, settled, answer, t, labels, Markdown, localOnly }: WidgetCardProps): import("react").JSX.Element;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { Answer, MarkdownProps, ViewLabels, WidgetCard, WidgetCardProps, WidgetView };
|
|
71
|
+
//# sourceMappingURL=widget.d.ts.map
|