@parall/cli 1.93.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.
Files changed (35) hide show
  1. package/dist/commands/apps-publish.d.ts.map +1 -1
  2. package/dist/commands/apps-publish.js +5 -2
  3. package/dist/commands/apps-scaffold.d.ts +3 -2
  4. package/dist/commands/apps-scaffold.d.ts.map +1 -1
  5. package/dist/commands/apps-scaffold.js +13 -4
  6. package/dist/commands/apps-shared-template-compose.d.ts +57 -0
  7. package/dist/commands/apps-shared-template-compose.d.ts.map +1 -0
  8. package/dist/commands/apps-shared-template-compose.js +176 -0
  9. package/dist/commands/apps-shared-template-init.d.ts +13 -0
  10. package/dist/commands/apps-shared-template-init.d.ts.map +1 -0
  11. package/dist/commands/apps-shared-template-init.js +130 -0
  12. package/dist/commands/apps-shared-template-package.d.ts +10 -0
  13. package/dist/commands/apps-shared-template-package.d.ts.map +1 -0
  14. package/dist/commands/apps-shared-template-package.js +112 -0
  15. package/dist/commands/apps-shared-template.d.ts +44 -0
  16. package/dist/commands/apps-shared-template.d.ts.map +1 -0
  17. package/dist/commands/apps-shared-template.js +214 -0
  18. package/dist/commands/apps-template-catalog.d.ts +5 -1
  19. package/dist/commands/apps-template-catalog.d.ts.map +1 -1
  20. package/dist/commands/apps-template-catalog.js +17 -4
  21. package/dist/commands/apps-template-download.d.ts +14 -1
  22. package/dist/commands/apps-template-download.d.ts.map +1 -1
  23. package/dist/commands/apps-template-download.js +6 -4
  24. package/dist/commands/apps-template-ref.d.ts +4 -0
  25. package/dist/commands/apps-template-ref.d.ts.map +1 -0
  26. package/dist/commands/apps-template-ref.js +31 -0
  27. package/dist/commands/apps-template-share-failure.d.ts +22 -0
  28. package/dist/commands/apps-template-share-failure.d.ts.map +1 -0
  29. package/dist/commands/apps-template-share-failure.js +201 -0
  30. package/dist/commands/apps-template-share.d.ts +19 -0
  31. package/dist/commands/apps-template-share.d.ts.map +1 -0
  32. package/dist/commands/apps-template-share.js +278 -0
  33. package/dist/commands/apps-templates.gen.js +1 -1
  34. package/dist/commands/clip.js +8 -0
  35. package/package.json +4 -4
@@ -0,0 +1,278 @@
1
+ import { resolveCredentials } from '../lib/client.js';
2
+ import { printError, printJson, printProgress, stripPrllScheme } from '../lib/output.js';
3
+ import { readTextFileArg } from '../lib/text-input.js';
4
+ import { day } from './apps-shared-template.js';
5
+ import { sharedTemplateId } from './apps-template-ref.js';
6
+ import { shareCommandLine, shareFailure, } from './apps-template-share-failure.js';
7
+ /**
8
+ * `parall app templates share` and `unshare` (mini-app-template-sharing-design.md
9
+ * §6.1): the agent of an app's author or of an org owner/admin shares the
10
+ * app's current version — its source and table structure, never its data —
11
+ * behind one link, with a note on how the team runs the app. The server
12
+ * checks everything that would go out (§5.2) and stores nothing when it finds
13
+ * the app's data or a key's value in it; apps-template-share-failure.ts
14
+ * turns that, and every other refusal, into what to do next. Names and IDs
15
+ * of the organization do not stop a share (§5.3): share lists them after
16
+ * the link as needing no change, so the agent does not clean them out of
17
+ * its own app.
18
+ */
19
+ const NOTE_MAX = 20_000;
20
+ const EXPIRIES = ['7d', '30d', '90d', 'never'];
21
+ const SHARE_HELP = `
22
+ Share only when the app's author or an org owner/admin asks you to; the
23
+ platform checks that too. What is shared is the app's current version: its
24
+ source and the structure of its tables, never its data. Anyone signed in
25
+ who has the link can build their own app from it, here or in another
26
+ organization.
27
+
28
+ The note (Markdown, at most 20,000 characters) is what the other team's
29
+ agent builds from. Write four things:
30
+ 1. What the app does.
31
+ 2. How the team uses it.
32
+ 3. How data gets into it.
33
+ 4. What you do around it: when you are woken, what you read, the rules
34
+ you write by, what you do at what time.
35
+
36
+ The template page shows a clickable demo: the app's real built pages,
37
+ answered from made-up data. Before you publish, write demo/demo.js in the
38
+ project — a plain script, no import or export, shared as written:
39
+
40
+ function createDemo(now) {
41
+ const items = [{ id: 1, title: 'Sample order', status: 'new' }];
42
+ return {
43
+ viewer: { display_name: 'Alex Demo', role: 'member' },
44
+ responders: {
45
+ items_list: () => ({ items }),
46
+ item_close: ({ id }) => {
47
+ const item = items.find((i) => i.id === id);
48
+ if (!item) throw new Error('No such item');
49
+ item.status = 'closed';
50
+ return item;
51
+ },
52
+ },
53
+ };
54
+ }
55
+
56
+ Answer every action in public/manifest.json with what the real action
57
+ returns, and throw new Error('…') where it would fail. A share without
58
+ demo/demo.js in the published source is refused.
59
+
60
+ Before storing anything, the platform compares all of it — the source,
61
+ demo.js and the built pages — with the values in the app's Database and the
62
+ keys you can read. When it finds one, nothing is
63
+ stored and each place is listed: change the app and publish again; leave
64
+ the file out (--exclude <path>); or, for a value that is not data (a status
65
+ name stored as text), let it through (--allow-value <value>). A key's value
66
+ is never let through: read it as ctx.env.<NAME> in the action instead.
67
+
68
+ Names and IDs of your organization — the names of members, channels and the
69
+ organization, Parall IDs, prll:// links — do not stop a share: they are
70
+ shared as they are, and listed as hints once it is done. They need no
71
+ change: the agent that builds from the template replaces them with its own,
72
+ and changing them would change your own app.
73
+
74
+ The link stays open 30 days unless --expires says otherwise, counted again
75
+ from every share. Running this again while the link is open updates the
76
+ same link to the app's current version and the new note; once it has
77
+ expired or been revoked, you get a new link. To revoke it:
78
+ parall app templates unshare --app <app_…>
79
+
80
+ Example:
81
+ parall app templates share --app app_… --note-file note.md`;
82
+ function collect(value, previous) {
83
+ return [...previous, value];
84
+ }
85
+ /** The app of share / unshare: app_… or prll://app_…. Anything else stops
86
+ * before a request, with the command that finds the app. */
87
+ export function parseShareApp(raw, verb) {
88
+ const id = stripPrllScheme(raw.trim());
89
+ if (id.startsWith('app_'))
90
+ return id;
91
+ const shared = sharedTemplateId(raw);
92
+ const fix = shared
93
+ ? `${shared} is a shared template, not an app; ${verb} takes the app it was shared from. Find the app with: parall app list`
94
+ : id.startsWith('adb_')
95
+ ? `${id} is a Database. Its apps: parall db get ${id}`
96
+ : 'Find the app with: parall app list';
97
+ throw new Error(`parall app templates ${verb} --app takes an app ID (app_… or prll://app_…), got "${raw}". ${fix}`);
98
+ }
99
+ /** A path for --exclude, as the source has it: no leading ./ or trailing /. */
100
+ function excludePath(raw) {
101
+ const path = raw
102
+ .trim()
103
+ .replace(/^(\.\/)+/, '')
104
+ .replace(/\/+$/, '');
105
+ if (path === '' || path.startsWith('/') || path.split('/').includes('..')) {
106
+ throw new Error(`--exclude takes a file or folder of the app's source, like db/seed.sql or exports/, got "${raw}"`);
107
+ }
108
+ return path;
109
+ }
110
+ /** The request share sends, checked here first: the note is there and fits,
111
+ * the expiry is one the server offers. Nothing is sent for what was not given. */
112
+ export function shareRequest(opts) {
113
+ if (opts.expires !== undefined && !EXPIRIES.includes(opts.expires)) {
114
+ throw new Error(`--expires must be ${EXPIRIES.join(', ')}; got "${opts.expires}"`);
115
+ }
116
+ const note = readTextFileArg('--note-file', opts.noteFile);
117
+ if (note.trim() === '') {
118
+ throw new Error(`The note in ${opts.noteFile} is empty. Write what the app does, how the team uses it, how data gets into it and what you do around it, then run this again.`);
119
+ }
120
+ const length = [...note].length;
121
+ if (length > NOTE_MAX) {
122
+ throw new Error(`The note in ${opts.noteFile} is ${length} characters, and it can be at most ${NOTE_MAX}. Shorten it and run this again.`);
123
+ }
124
+ if (opts.allowValue.some((value) => value === '')) {
125
+ throw new Error('--allow-value takes the value to let through; an empty one lets nothing through');
126
+ }
127
+ const exclude = [...new Set(opts.exclude.map(excludePath))];
128
+ const allow = [...new Set(opts.allowValue)];
129
+ return {
130
+ note,
131
+ ...(exclude.length > 0 ? { exclude } : {}),
132
+ ...(allow.length > 0 ? { allow_values: allow } : {}),
133
+ ...(opts.expires !== undefined ? { expires: opts.expires } : {}),
134
+ };
135
+ }
136
+ /** How many names and IDs share writes out, and how many places for each;
137
+ * the result's `hints` has every one Parall listed. */
138
+ const HINTS_SHOWN = 30;
139
+ const HINT_PLACES_SHOWN = 3;
140
+ /** What each kind of hint is called, in the order they are written out. */
141
+ const HINT_KINDS = new Map([
142
+ ['org', 'organization name'],
143
+ ['member', 'member name'],
144
+ ['channel', 'channel name'],
145
+ ['parall_id', 'Parall ID'],
146
+ ['parall_link', 'Parall link'],
147
+ ]);
148
+ const HINT_ORDER = [...HINT_KINDS.keys()];
149
+ function isHint(value) {
150
+ const h = value;
151
+ return (typeof h === 'object' &&
152
+ h !== null &&
153
+ typeof h.kind === 'string' &&
154
+ typeof h.where === 'string' &&
155
+ typeof h.line === 'number' &&
156
+ typeof h.text === 'string');
157
+ }
158
+ /** The names and IDs of the organization the template holds as they are
159
+ * (design §5.3), each once with the first places it is in, after a line
160
+ * saying they need no change. None when there are none, or the server is
161
+ * one from before hints. */
162
+ export function shareHints(result) {
163
+ const hints = Array.isArray(result.hints) ? result.hints.filter(isHint) : [];
164
+ if (hints.length === 0)
165
+ return [];
166
+ const found = new Map();
167
+ for (const hint of hints) {
168
+ const key = JSON.stringify([hint.kind, hint.text]);
169
+ const group = found.get(key) ?? { kind: hint.kind, text: hint.text, places: [] };
170
+ found.set(key, group);
171
+ const place = hint.line > 0 ? `${hint.where}:${hint.line}` : hint.where;
172
+ if (!group.places.includes(place))
173
+ group.places.push(place);
174
+ }
175
+ const rank = (kind) => {
176
+ const at = HINT_ORDER.indexOf(kind);
177
+ return at < 0 ? HINT_ORDER.length : at;
178
+ };
179
+ const groups = [...found.values()].sort((a, b) => rank(a.kind) - rank(b.kind));
180
+ const lines = groups.slice(0, HINTS_SHOWN).map(({ kind, text, places }) => {
181
+ const rest = places.length > HINT_PLACES_SHOWN ? ` and ${places.length - HINT_PLACES_SHOWN} more` : '';
182
+ return ` ${HINT_KINDS.get(kind) ?? kind} ${JSON.stringify(text)}: ${places.slice(0, HINT_PLACES_SHOWN).join(', ')}${rest}`;
183
+ });
184
+ const more = [
185
+ ...(groups.length > HINTS_SHOWN
186
+ ? [`${groups.length - HINTS_SHOWN} more (all in the result's "hints")`]
187
+ : []),
188
+ ...(result.hints_truncated === true ? ['more that Parall did not list'] : []),
189
+ ];
190
+ if (more.length > 0)
191
+ lines.push(` … and ${more.join(', and ')}.`);
192
+ return [
193
+ 'These names and IDs of your organization were shared as they are and need no change: the agent that builds from the template replaces them with its own, and changing them would change your own app.',
194
+ ...lines,
195
+ ];
196
+ }
197
+ /** "a", "a and b", "a, b and c". */
198
+ function inWords(items) {
199
+ return items.length > 2
200
+ ? `${items.slice(0, -1).join(', ')} and ${items[items.length - 1]}`
201
+ : items.join(' and ');
202
+ }
203
+ /** What share prints on stderr when it worked: the link, what to tell, and
204
+ * the names and IDs it holds that need no change. */
205
+ export function shareSummary(result, appId) {
206
+ const { share } = result;
207
+ const open = share.expires_at ? `open until ${day(share.expires_at)}` : 'open until revoked';
208
+ const first = result.created
209
+ ? `Shared version ${share.version_seq} of ${appId} as a template, ${open}: ${share.url} (a new link).`
210
+ : `Updated the open link to version ${share.version_seq} of ${appId}, ${open}: ${share.url} (the same link as before).`;
211
+ const hints = shareHints(result);
212
+ const tell = [
213
+ ...(result.removed.length > 0 ? [`what was left out (removed: ${result.removed.length})`] : []),
214
+ ...(result.tables.left_out.length > 0
215
+ ? [`which tables are not in it (tables.left_out: ${result.tables.left_out.join(', ')})`]
216
+ : []),
217
+ ...(hints.length > 0 ? ['which names and IDs of your organization it holds (below)'] : []),
218
+ ];
219
+ return [
220
+ first,
221
+ `Give the person this link${tell.length > 0 ? `, and say ${inWords(tell)}` : ''}.`,
222
+ ...hints,
223
+ ];
224
+ }
225
+ export function registerTemplateShareCommands(templates) {
226
+ templates
227
+ .command('share')
228
+ .description("Share an app as a template: a link anyone signed in can build their own app from (only when the app's author or an org owner/admin asks you)")
229
+ .requiredOption('--app <appId>', 'The app to share (app_… or prll://app_…)')
230
+ .requiredOption('--note-file <path>', "The note, Markdown, from a file ('-' = stdin): what it covers is below")
231
+ .option('--exclude <path>', "A file or folder of the app's source to leave out (repeatable)", collect, [])
232
+ .option('--allow-value <value>', "A value from the app's Database that is not data, to let through (repeatable)", collect, [])
233
+ .option('--expires <period>', 'How long the link stays open: 7d, 30d (default), 90d or never')
234
+ .addHelpText('after', SHARE_HELP)
235
+ .showHelpAfterError('Example: parall app templates share --app app_… --note-file note.md')
236
+ .action(async (opts) => {
237
+ try {
238
+ const appId = parseShareApp(opts.app, 'share');
239
+ const request = shareRequest(opts);
240
+ const { client, orgId } = resolveCredentials();
241
+ let result;
242
+ try {
243
+ result = await client.shareMiniAppTemplate(orgId, appId, request);
244
+ }
245
+ catch (err) {
246
+ const failure = shareFailure(err, appId, shareCommandLine(appId, opts));
247
+ return printError(failure.error, undefined, failure.step);
248
+ }
249
+ printJson(result);
250
+ for (const line of shareSummary(result, appId))
251
+ printProgress(line);
252
+ }
253
+ catch (err) {
254
+ printError(err);
255
+ }
256
+ });
257
+ templates
258
+ .command('unshare')
259
+ .description("Revoke an app's template link: it stops opening at once; apps already built from it are not affected")
260
+ .requiredOption('--app <appId>', 'The app whose link to revoke (app_… or prll://app_…)')
261
+ .showHelpAfterError('Example: parall app templates unshare --app app_…')
262
+ .action(async (opts) => {
263
+ try {
264
+ const appId = parseShareApp(opts.app, 'unshare');
265
+ const { client, orgId } = resolveCredentials();
266
+ const open = await client.getMiniAppTemplateShare(orgId, appId);
267
+ // Revoked even when none was open: one shared meanwhile goes too.
268
+ await client.revokeMiniAppTemplateShare(orgId, appId);
269
+ printJson({ app_id: appId, revoked: open ? { id: open.id, url: open.url } : null });
270
+ printProgress(open
271
+ ? `${open.url} no longer opens; apps already built from it are not affected.`
272
+ : `${appId} had no open template link; nothing changed.`);
273
+ }
274
+ catch (err) {
275
+ printError(err);
276
+ }
277
+ });
278
+ }
@@ -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",
@@ -256,6 +256,14 @@ function registerClipTree(clip) {
256
256
  ...(entry.approved_version_id ? { approved_version_id: entry.approved_version_id } : {}),
257
257
  ...(entry.review_status ? { review_status: entry.review_status } : {}),
258
258
  ...(entry.review_note ? { review_note: entry.review_note } : {}),
259
+ // Your org's own connector: a display-name request awaiting Parall,
260
+ // or why the last one was rejected. Requests are made in the Web app.
261
+ ...(entry.display_name_request
262
+ ? { display_name_request: entry.display_name_request }
263
+ : {}),
264
+ ...(entry.display_name_review_note
265
+ ? { display_name_review_note: entry.display_name_review_note }
266
+ : {}),
259
267
  };
260
268
  printJson(info);
261
269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.93.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/sdk": "1.93.0",
46
- "@parall/agent-core": "1.93.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.93.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",