@parall/cli 1.94.0 → 1.95.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.
@@ -46,7 +46,7 @@ export const TEMPLATE_BASE = {
46
46
  "src/index.css": "/* Tailwind v4 + shadcn/ui theme. Everything is bundled: the font comes\n from @fontsource-variable/geist (woff2 files land in dist/assets), Chinese\n text falls back to the system's CJK font. Light/dark follows the viewer's\n system setting (prefers-color-scheme); Parall does not pass a theme. */\n@import 'tailwindcss';\n@import 'tw-animate-css';\n@import '@fontsource-variable/geist';\n\n:root {\n color-scheme: light dark;\n --radius: 0.625rem;\n --background: oklch(1 0 0);\n --foreground: oklch(0.145 0 0);\n --card: oklch(1 0 0);\n --card-foreground: oklch(0.145 0 0);\n --popover: oklch(1 0 0);\n --popover-foreground: oklch(0.145 0 0);\n --primary: oklch(0.205 0 0);\n --primary-foreground: oklch(0.985 0 0);\n --secondary: oklch(0.97 0 0);\n --secondary-foreground: oklch(0.205 0 0);\n --muted: oklch(0.97 0 0);\n --muted-foreground: oklch(0.556 0 0);\n --accent: oklch(0.97 0 0);\n --accent-foreground: oklch(0.205 0 0);\n --destructive: oklch(0.577 0.245 27.325);\n --success: oklch(0.6 0.13 155);\n --warning: oklch(0.7 0.15 70);\n --border: oklch(0.922 0 0);\n --input: oklch(0.922 0 0);\n --ring: oklch(0.708 0 0);\n --chart-1: oklch(0.646 0.222 41.116);\n --chart-2: oklch(0.6 0.118 184.704);\n --chart-3: oklch(0.398 0.07 227.392);\n --chart-4: oklch(0.828 0.189 84.429);\n --chart-5: oklch(0.769 0.188 70.08);\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --background: oklch(0.145 0 0);\n --foreground: oklch(0.985 0 0);\n --card: oklch(0.205 0 0);\n --card-foreground: oklch(0.985 0 0);\n --popover: oklch(0.205 0 0);\n --popover-foreground: oklch(0.985 0 0);\n --primary: oklch(0.922 0 0);\n --primary-foreground: oklch(0.205 0 0);\n --secondary: oklch(0.269 0 0);\n --secondary-foreground: oklch(0.985 0 0);\n --muted: oklch(0.269 0 0);\n --muted-foreground: oklch(0.708 0 0);\n --accent: oklch(0.269 0 0);\n --accent-foreground: oklch(0.985 0 0);\n --destructive: oklch(0.704 0.191 22.216);\n --success: oklch(0.72 0.15 155);\n --warning: oklch(0.8 0.15 75);\n --border: oklch(1 0 0 / 10%);\n --input: oklch(1 0 0 / 15%);\n --ring: oklch(0.556 0 0);\n --chart-1: oklch(0.488 0.243 264.376);\n --chart-2: oklch(0.696 0.17 162.48);\n --chart-3: oklch(0.769 0.188 70.08);\n --chart-4: oklch(0.627 0.265 303.9);\n --chart-5: oklch(0.645 0.246 16.439);\n }\n}\n\n@theme inline {\n --font-sans:\n 'Geist Variable', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC',\n 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', sans-serif;\n --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;\n --radius-sm: calc(var(--radius) - 4px);\n --radius-md: calc(var(--radius) - 2px);\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 4px);\n --color-background: var(--background);\n --color-foreground: var(--foreground);\n --color-card: var(--card);\n --color-card-foreground: var(--card-foreground);\n --color-popover: var(--popover);\n --color-popover-foreground: var(--popover-foreground);\n --color-primary: var(--primary);\n --color-primary-foreground: var(--primary-foreground);\n --color-secondary: var(--secondary);\n --color-secondary-foreground: var(--secondary-foreground);\n --color-muted: var(--muted);\n --color-muted-foreground: var(--muted-foreground);\n --color-accent: var(--accent);\n --color-accent-foreground: var(--accent-foreground);\n --color-destructive: var(--destructive);\n --color-success: var(--success);\n --color-warning: var(--warning);\n --color-border: var(--border);\n --color-input: var(--input);\n --color-ring: var(--ring);\n --color-chart-1: var(--chart-1);\n --color-chart-2: var(--chart-2);\n --color-chart-3: var(--chart-3);\n --color-chart-4: var(--chart-4);\n --color-chart-5: var(--chart-5);\n}\n\n@layer base {\n * {\n @apply border-border outline-ring/50;\n }\n html {\n -webkit-text-size-adjust: 100%;\n -webkit-tap-highlight-color: transparent;\n }\n body {\n @apply min-h-svh bg-background font-sans text-foreground antialiased;\n }\n button:not(:disabled),\n [role='button']:not(:disabled) {\n cursor: pointer;\n }\n /* Phones zoom into inputs under 16px; keep them at 16px on small screens. */\n @media (max-width: 767px) {\n input,\n select,\n textarea {\n font-size: 16px !important;\n }\n }\n}\n\n@utility no-scrollbar {\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n}\n",
47
47
  "src/lib/errors.ts": "import { t } from '@/lib/messages';\nimport type { BridgeError } from '@/parall';\n\nexport interface DescribedError {\n /** What to tell the viewer. */\n message: string;\n /** A second line with what to do, when there is one. */\n hint?: string;\n /** The server's error code (ACTION_FAILED, RATE_LIMITED…), if any. */\n code?: string;\n /** The invocation (aci_…) to quote when reporting the problem. */\n invocationId?: string;\n}\n\n/**\n * Turns what parall.action rejected with into text for the viewer. An\n * ActionError thrown by an action arrives as ACTION_FAILED with the\n * action's own message; other failures get a message by their code.\n */\nexport function describeError(err: unknown): DescribedError {\n const e = err as Partial<BridgeError> | null;\n const code = typeof e?.code === 'string' ? e.code : undefined;\n const details = e?.details ?? {};\n const invocation = details.invocation_id;\n const invocationId = typeof invocation === 'string' ? invocation : undefined;\n const raw = typeof e?.message === 'string' && e.message !== '' ? e.message : t('errorTitle');\n switch (code) {\n case 'ACTION_FAILED':\n return { message: raw, code, invocationId };\n case 'HOST_TIMEOUT':\n case 'HOST_UNAVAILABLE':\n case 'ACTION_RUNTIME_UNAVAILABLE':\n return { message: t('errorOffline'), code, invocationId };\n case 'RATE_LIMITED':\n return { message: t('errorRateLimited'), code, invocationId };\n case 'ACTION_TIMEOUT':\n return { message: t('errorTimeout'), code, invocationId };\n case 'APP_VERSION_CHANGED':\n return { message: t('errorVersionChanged'), code, invocationId };\n case 'NOT_GRANTED':\n return {\n message: t('errorNotGranted'),\n hint: t('errorNotGrantedHint'),\n code,\n invocationId,\n };\n case 'PERMISSION_DENIED':\n // The viewer can only view this app: Parall refused a write action.\n // Hide such buttons with useCanEdit(); this is what a page says when\n // one was not hidden.\n return { message: t('errorViewOnly'), code, invocationId };\n default:\n return { message: raw, code, invocationId };\n }\n}\n",
48
48
  "src/lib/format.ts": "import { formatLocale } from '@/lib/i18n';\n\nconst dateTime = new Intl.DateTimeFormat(formatLocale, {\n dateStyle: 'medium',\n timeStyle: 'short',\n});\nconst dateOnly = new Intl.DateTimeFormat(formatLocale, { dateStyle: 'medium' });\nconst relative = new Intl.RelativeTimeFormat(formatLocale, { numeric: 'auto' });\n\n/** Accepts what actions return for timestamptz and date columns (ISO\n * strings) and Date objects; anything unreadable formats as ''. */\nfunction toDate(value: string | number | Date | null | undefined): Date | null {\n if (value === null || value === undefined || value === '') return null;\n const date = value instanceof Date ? value : new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\nexport function formatDateTime(value: string | number | Date | null | undefined): string {\n const date = toDate(value);\n return date ? dateTime.format(date) : '';\n}\n\nexport function formatDate(value: string | number | Date | null | undefined): string {\n const date = toDate(value);\n return date ? dateOnly.format(date) : '';\n}\n\nconst UNITS: Array<[Intl.RelativeTimeFormatUnit, number]> = [\n ['year', 365 * 24 * 3600],\n ['month', 30 * 24 * 3600],\n ['week', 7 * 24 * 3600],\n ['day', 24 * 3600],\n ['hour', 3600],\n ['minute', 60],\n];\n\n/** \"3 hours ago\" / \"3 小时前\"; under a minute reads as \"now\". */\nexport function formatRelative(value: string | number | Date | null | undefined): string {\n const date = toDate(value);\n if (!date) return '';\n const seconds = Math.round((date.getTime() - Date.now()) / 1000);\n for (const [unit, size] of UNITS) {\n if (Math.abs(seconds) >= size) return relative.format(Math.round(seconds / size), unit);\n }\n return relative.format(0, 'second');\n}\n",
49
- "src/lib/i18n.ts": "/**\n * The language of the text this app shows. Parall does not pass one, so the\n * viewer's browser language decides: Chinese for zh-*, English otherwise.\n * Pin a language by setting FORCED_LOCALE.\n */\nexport type Locale = 'zh' | 'en';\n\nconst FORCED_LOCALE: Locale | null = null;\n\n/** The viewer's browser language (en-GB, fr-FR, zh-TW…), if known. Use it for\n * conventions that are not words, such as the first day of the week. */\nexport const browserLocale: string | undefined =\n typeof navigator === 'undefined'\n ? undefined\n : (navigator.languages?.[0] ?? navigator.language ?? undefined);\n\nexport const locale: Locale = FORCED_LOCALE ?? (/^zh\\b/i.test(browserLocale ?? '') ? 'zh' : 'en');\n\n/** The BCP 47 tag dates and times are written with, always in the texts'\n * language so an English sentence never holds French month names: zh-CN for\n * Chinese (the texts are Simplified Chinese); for English the browser's own\n * English tag (en-GB keeps day/month order), else en-US. */\nexport const formatLocale: string =\n locale === 'zh'\n ? 'zh-CN'\n : browserLocale && /^en\\b/i.test(browserLocale)\n ? browserLocale\n : 'en-US';\n\ntype Vars = Record<string, string | number>;\n\n/**\n * Declares a module's texts in both languages and returns its t(). The zh\n * table must have every key of the en one:\n *\n * const t = defineMessages({\n * en: { title: 'Tasks', count: '{n} open' },\n * zh: { title: '任务', count: '{n} 个未完成' },\n * });\n * t('count', { n: 3 });\n */\nexport function defineMessages<T extends Record<string, string>>(messages: {\n en: T;\n zh: { [K in keyof T]: string };\n}): (key: keyof T, vars?: Vars) => string {\n const table: Record<keyof T, string> = messages[locale];\n return (key, vars) => {\n const text = table[key] ?? messages.en[key] ?? String(key);\n if (!vars) return text;\n return text.replace(/\\{(\\w+)\\}/g, (match, name: string) =>\n name in vars ? String(vars[name]) : match,\n );\n };\n}\n",
49
+ "src/lib/i18n.ts": "/**\n * The language of the text this app shows. Parall does not pass one, so the\n * viewer's browser language decides: Chinese for zh-*, English otherwise.\n * Pin a language by setting FORCED_LOCALE.\n */\nexport type Locale = 'zh' | 'en';\n\nconst FORCED_LOCALE: Locale | null = null;\n\n/** The viewer's browser language (en-GB, fr-FR, zh-TW…), if known. Use it for\n * conventions that are not words, such as the first day of the week. */\nexport const browserLocale: string | undefined =\n typeof navigator === 'undefined'\n ? undefined\n : (navigator.languages?.[0] ?? navigator.language ?? undefined);\n\nfunction pickLocale(): Locale {\n return FORCED_LOCALE ?? (/^zh\\b/i.test(browserLocale ?? '') ? 'zh' : 'en');\n}\n\n// Through a function: set straight from a pinned FORCED_LOCALE, locale's type\n// would narrow to that one language, and comparing it with the other (as\n// formatLocale does) would fail the type check.\nexport const locale: Locale = pickLocale();\n\n/** The BCP 47 tag dates and times are written with, always in the texts'\n * language so an English sentence never holds French month names: zh-CN for\n * Chinese (the texts are Simplified Chinese); for English the browser's own\n * English tag (en-GB keeps day/month order), else en-US. */\nexport const formatLocale: string =\n locale === 'zh'\n ? 'zh-CN'\n : browserLocale && /^en\\b/i.test(browserLocale)\n ? browserLocale\n : 'en-US';\n\ntype Vars = Record<string, string | number>;\n\n/**\n * Declares a module's texts in both languages and returns its t(). The zh\n * table must have every key of the en one:\n *\n * const t = defineMessages({\n * en: { title: 'Tasks', count: '{n} open' },\n * zh: { title: '任务', count: '{n} 个未完成' },\n * });\n * t('count', { n: 3 });\n */\nexport function defineMessages<T extends Record<string, string>>(messages: {\n en: T;\n zh: { [K in keyof T]: string };\n}): (key: keyof T, vars?: Vars) => string {\n const table: Record<keyof T, string> = messages[locale];\n return (key, vars) => {\n const text = table[key] ?? messages.en[key] ?? String(key);\n if (!vars) return text;\n return text.replace(/\\{(\\w+)\\}/g, (match, name: string) =>\n name in vars ? String(vars[name]) : match,\n );\n };\n}\n",
50
50
  "src/lib/keys.ts": "import type { KeyboardEvent } from 'react';\n\n/**\n * Runs fn when Enter is pressed in a field — the way to \"submit\" here.\n * Parall's Web and Desktop host run the page in a frame without\n * allow-forms, so a <form> never submits and its onSubmit never fires:\n * give the save button type=\"button\" and onClick, and put onEnter(save) on\n * single-line inputs. Enter that confirms an input method's composition\n * (Chinese, Japanese…) is left alone — Safari and WebKit views send that\n * Enter after the composition has ended, flagged only by keyCode 229.\n */\nexport function onEnter(fn: () => void) {\n return (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (event.nativeEvent.isComposing || event.keyCode === 229) return;\n event.preventDefault();\n fn();\n };\n}\n",
51
51
  "src/lib/messages.ts": "import { defineMessages } from '@/lib/i18n';\n\n/** The template's own texts: states, dialogs and the shell. */\nexport const t = defineMessages({\n en: {\n loading: 'Loading…',\n retry: 'Try again',\n cancel: 'Cancel',\n save: 'Save',\n saving: 'Saving…',\n delete: 'Delete',\n deleting: 'Deleting…',\n edit: 'Edit',\n close: 'Close',\n back: 'Back',\n search: 'Search',\n confirm: 'Confirm',\n you: 'You',\n errorTitle: 'Something went wrong',\n errorOffline: 'Parall did not answer. Check the connection and try again.',\n errorRateLimited: 'Too many requests right now. Wait a moment and try again.',\n errorTimeout:\n 'This took too long. Try again; if you were saving, check first whether it was saved.',\n errorVersionChanged: 'This app was just updated. Reload it to continue.',\n errorNotGranted: 'This page runs without its actions here.',\n errorNotGrantedHint: 'Start it with parall app dev --dist dist --app <app_…> to call them.',\n errorViewOnly:\n 'You can only view this app, so your change was not saved. To change its data, ask one of its authors or an org owner/admin to let you edit it.',\n viewOnly: 'You can only view this app.',\n errorReference: 'Reference: {id}',\n hostMissingTitle: 'Open this app in Parall',\n hostMissingBody:\n 'This page talks to Parall through its host. Open it from Parall, or try it locally with parall app dev --dist dist.',\n connecting: 'Connecting to Parall…',\n },\n zh: {\n loading: '加载中…',\n retry: '重试',\n cancel: '取消',\n save: '保存',\n saving: '保存中…',\n delete: '删除',\n deleting: '删除中…',\n edit: '编辑',\n close: '关闭',\n back: '返回',\n search: '搜索',\n confirm: '确定',\n you: '我',\n errorTitle: '出错了',\n errorOffline: '没有收到 Parall 的回应,请检查网络后重试。',\n errorRateLimited: '请求太频繁,请稍等片刻再试。',\n errorTimeout: '处理超时。请重试;如果刚才在保存,先确认是否已经保存。',\n errorVersionChanged: '这个应用刚刚更新了,重新加载后继续。',\n errorNotGranted: '这里运行的页面没有连上它的 action。',\n errorNotGrantedHint: '用 parall app dev --dist dist --app <app_…> 启动后即可调用。',\n errorViewOnly:\n '你只能查看这个应用,刚才的修改没有保存。要改数据,请它的作者或组织 owner / admin 把你设成「可改」。',\n viewOnly: '你只能查看这个应用。',\n errorReference: '编号:{id}',\n hostMissingTitle: '请在 Parall 里打开这个应用',\n hostMissingBody:\n '这个页面通过 Parall 宿主读写数据。请从 Parall 打开它,或用 parall app dev --dist dist 在本地试用。',\n connecting: '正在连接 Parall…',\n },\n});\n",
52
52
  "src/lib/utils.ts": "import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/** Merges Tailwind classes, later ones winning (shadcn/ui's cn). */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.94.0",
3
+ "version": "1.95.0",
4
4
  "description": "CLI client for Parall — universal agent & human access to Parall API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,8 +42,8 @@
42
42
  "node-diff3": "3.2.1",
43
43
  "tar-stream": "^3.2.1",
44
44
  "zod": "^4.3.6",
45
- "@parall/agent-core": "1.94.0",
46
- "@parall/sdk": "1.94.0"
45
+ "@parall/agent-core": "1.95.0",
46
+ "@parall/sdk": "1.95.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@dnd-kit/core": "6.3.1",
@@ -71,7 +71,7 @@
71
71
  "tw-animate-css": "1.4.0",
72
72
  "typescript": "^5.7.0",
73
73
  "vite": "6.4.1",
74
- "@parall/agent-core": "1.94.0"
74
+ "@parall/agent-core": "1.95.0"
75
75
  },
76
76
  "scripts": {
77
77
  "build": "node scripts/generate-miniapp-sdk.mjs --check && node scripts/generate-local-runner.mjs --check && node scripts/generate-app-templates.mjs --check && tsc",