@parall/cli 1.78.0 → 1.80.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 (64) hide show
  1. package/dist/commands/apps-access.d.ts +8 -0
  2. package/dist/commands/apps-access.d.ts.map +1 -0
  3. package/dist/commands/apps-access.js +151 -0
  4. package/dist/commands/apps-actions-sdk.generated.d.ts +1 -1
  5. package/dist/commands/apps-actions-sdk.generated.d.ts.map +1 -1
  6. package/dist/commands/apps-actions-sdk.generated.js +1 -1
  7. package/dist/commands/apps-actions.d.ts +5 -3
  8. package/dist/commands/apps-actions.d.ts.map +1 -1
  9. package/dist/commands/apps-actions.js +11 -4
  10. package/dist/commands/apps-add.js +1 -1
  11. package/dist/commands/apps-blocks.d.ts.map +1 -1
  12. package/dist/commands/apps-blocks.js +8 -0
  13. package/dist/commands/apps-dev-page.d.ts +2 -0
  14. package/dist/commands/apps-dev-page.d.ts.map +1 -1
  15. package/dist/commands/apps-dev-page.js +3 -3
  16. package/dist/commands/apps-dev-server.d.ts +10 -1
  17. package/dist/commands/apps-dev-server.d.ts.map +1 -1
  18. package/dist/commands/apps-dev-server.js +26 -3
  19. package/dist/commands/apps-dev.d.ts +12 -1
  20. package/dist/commands/apps-dev.d.ts.map +1 -1
  21. package/dist/commands/apps-dev.js +25 -10
  22. package/dist/commands/apps-page-sdk.generated.d.ts +1 -1
  23. package/dist/commands/apps-page-sdk.generated.d.ts.map +1 -1
  24. package/dist/commands/apps-page-sdk.generated.js +1 -1
  25. package/dist/commands/apps-placement.d.ts +13 -0
  26. package/dist/commands/apps-placement.d.ts.map +1 -0
  27. package/dist/commands/apps-placement.js +20 -0
  28. package/dist/commands/apps-scaffold.d.ts +7 -1
  29. package/dist/commands/apps-scaffold.d.ts.map +1 -1
  30. package/dist/commands/apps-scaffold.js +88 -30
  31. package/dist/commands/apps-template-catalog.d.ts +85 -0
  32. package/dist/commands/apps-template-catalog.d.ts.map +1 -0
  33. package/dist/commands/apps-template-catalog.gen.d.ts +3 -0
  34. package/dist/commands/apps-template-catalog.gen.d.ts.map +1 -0
  35. package/dist/commands/apps-template-catalog.gen.js +228 -0
  36. package/dist/commands/apps-template-catalog.js +49 -0
  37. package/dist/commands/apps-template-init.d.ts +39 -0
  38. package/dist/commands/apps-template-init.d.ts.map +1 -0
  39. package/dist/commands/apps-template-init.js +118 -0
  40. package/dist/commands/apps-template.d.ts +11 -0
  41. package/dist/commands/apps-template.d.ts.map +1 -1
  42. package/dist/commands/apps-template.js +18 -7
  43. package/dist/commands/apps-templates.gen.d.ts +1 -0
  44. package/dist/commands/apps-templates.gen.d.ts.map +1 -1
  45. package/dist/commands/apps-templates.gen.js +27 -18
  46. package/dist/commands/apps.d.ts +3 -2
  47. package/dist/commands/apps.d.ts.map +1 -1
  48. package/dist/commands/apps.js +15 -4
  49. package/dist/commands/chat-connections.d.ts +11 -0
  50. package/dist/commands/chat-connections.d.ts.map +1 -0
  51. package/dist/commands/chat-connections.js +162 -0
  52. package/dist/commands/chats.d.ts.map +1 -1
  53. package/dist/commands/chats.js +6 -1
  54. package/dist/commands/db-plane.d.ts.map +1 -1
  55. package/dist/commands/db-plane.js +10 -6
  56. package/dist/commands/dbs.d.ts +3 -2
  57. package/dist/commands/dbs.d.ts.map +1 -1
  58. package/dist/commands/dbs.js +10 -5
  59. package/dist/commands/search.d.ts.map +1 -1
  60. package/dist/commands/search.js +1 -1
  61. package/dist/lib/output.d.ts +11 -0
  62. package/dist/lib/output.d.ts.map +1 -1
  63. package/dist/lib/output.js +32 -5
  64. package/package.json +5 -5
@@ -1,7 +1,8 @@
1
1
  import type { Command } from 'commander';
2
2
  /** Mini App entity: an agent-authored app of the organization, attached to
3
- * a Database (docs/engineering-design/mini-app-design.md). Every org member
4
- * opens every app; its authors manage it. This file manages the entity and
3
+ * a Database (docs/engineering-design/mini-app-design.md). How far each
4
+ * member reaches into an app is its access setting (`app access …`,
5
+ * apps-access.ts); its authors manage it. This file manages the entity and
5
6
  * its author roster; `app db …` (apps-db.ts) is the app alias of the data
6
7
  * plane, `parall db …` (dbs.ts) the Database itself; publish / versions /
7
8
  * rollback / pull live in apps-publish.ts, the scaffold + local dev host
@@ -1 +1 @@
1
- {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC;;;;;;;;;;kEAUkE;AAClE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,QA+LnD"}
1
+ {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoBzC;;;;;;;;;;;kEAWkE;AAClE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,QA0MnD"}
@@ -1,16 +1,19 @@
1
1
  import { resolveCredentials } from '../lib/client.js';
2
- import { printError, printJson, printRefHint, stripPrllScheme } from '../lib/output.js';
2
+ import { printError, printJson, printProgress, printRefHint, stripPrllScheme, } from '../lib/output.js';
3
+ import { parseMemberLevel, registerAppAccessCommands } from './apps-access.js';
3
4
  import { registerAppActionCommands } from './apps-actions.js';
4
5
  import { registerAppAddCommand } from './apps-add.js';
5
6
  import { appAndArg, appIdFrom, withApp } from './apps-args.js';
6
7
  import { registerAppCheckCommand } from './apps-check.js';
7
8
  import { registerAppDBCommands } from './apps-db.js';
8
9
  import { registerAppDevCommand } from './apps-dev.js';
10
+ import { placementHint } from './apps-placement.js';
9
11
  import { registerAppPublishCommands } from './apps-publish.js';
10
12
  import { registerAppScaffoldCommands } from './apps-scaffold.js';
11
13
  /** Mini App entity: an agent-authored app of the organization, attached to
12
- * a Database (docs/engineering-design/mini-app-design.md). Every org member
13
- * opens every app; its authors manage it. This file manages the entity and
14
+ * a Database (docs/engineering-design/mini-app-design.md). How far each
15
+ * member reaches into an app is its access setting (`app access …`,
16
+ * apps-access.ts); its authors manage it. This file manages the entity and
14
17
  * its author roster; `app db …` (apps-db.ts) is the app alias of the data
15
18
  * plane, `parall db …` (dbs.ts) the Database itself; publish / versions /
16
19
  * rollback / pull live in apps-publish.ts, the scaffold + local dev host
@@ -30,6 +33,7 @@ export function registerAppCommands(program) {
30
33
  registerAppDevCommand(app);
31
34
  registerAppCheckCommand(app);
32
35
  registerAppActionCommands(app);
36
+ registerAppAccessCommands(app);
33
37
  app
34
38
  .command('list')
35
39
  .description("List the organization's Mini Apps")
@@ -65,9 +69,9 @@ export function registerAppCommands(program) {
65
69
  .option('--slug <slug>', 'URL slug (lowercase kebab-case; derived from the name when omitted)')
66
70
  .option('--description <text>', 'App description')
67
71
  .option('--database <dbId>', 'Attach to an existing Database of the organization (adb_…; author of one of its apps or org owner/admin); default: create one named after the app')
72
+ .option('--members <level>', 'How far everyone else in the organization reaches into the app from the start: none, read or write (default write; none keeps even its name from them — see parall app access --help)')
68
73
  .action(async (opts) => {
69
74
  try {
70
- const { client, orgId } = resolveCredentials();
71
75
  const data = { name: opts.name };
72
76
  if (opts.slug)
73
77
  data.slug = opts.slug;
@@ -75,9 +79,16 @@ export function registerAppCommands(program) {
75
79
  data.description = opts.description;
76
80
  if (opts.database)
77
81
  data.database_id = stripPrllScheme(opts.database);
82
+ if (opts.members !== undefined) {
83
+ data.member_access = parseMemberLevel(opts.members, '--members');
84
+ }
85
+ const { client, orgId } = resolveCredentials();
78
86
  const result = await client.createMiniApp(orgId, data);
79
87
  printJson(result);
80
88
  printRefHint(result.id);
89
+ if (result.database_id) {
90
+ printProgress(placementHint(result.database_id, result.placement, result.id));
91
+ }
81
92
  }
82
93
  catch (err) {
83
94
  printError(err);
@@ -0,0 +1,11 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Cross-org channel commands under `chats` (cross-org-channel-design.md §十二):
4
+ * inviting people from other orgs, answering one's own invitations, and the
5
+ * orgs a channel is connected to. Invitations are addressed to the account,
6
+ * so accepting names which of the caller's orgs joins (default PRLL_ORG_ID).
7
+ * Connecting, disconnecting and approving a reconnect are a person's
8
+ * decisions; the server refuses them for agents, which can only read.
9
+ */
10
+ export declare function registerChatConnectionCommands(chats: Command): void;
11
+ //# sourceMappingURL=chat-connections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-connections.d.ts","sourceRoot":"","sources":["../../src/commands/chat-connections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBzC;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,QAwJ5D"}
@@ -0,0 +1,162 @@
1
+ import { resolveCredentials } from '../lib/client.js';
2
+ import { printError, printJson, printProgress, stripPrllScheme } from '../lib/output.js';
3
+ /** Who must approve a pending reconnect; an older server sends no side. */
4
+ function reconnectNote(side) {
5
+ switch (side) {
6
+ case 'host':
7
+ return "Your organization had been disconnected by the channel's organization; it is back once that organization's channel owner or admin approves.";
8
+ case 'member_org':
9
+ return 'Your organization had disconnected itself from this channel; it is back once one of its admins runs "parall chats connections approve".';
10
+ default:
11
+ return 'Your organization had been disconnected from this channel; it is back once the side that disconnected it approves (see "parall chats connections list").';
12
+ }
13
+ }
14
+ /**
15
+ * Cross-org channel commands under `chats` (cross-org-channel-design.md §十二):
16
+ * inviting people from other orgs, answering one's own invitations, and the
17
+ * orgs a channel is connected to. Invitations are addressed to the account,
18
+ * so accepting names which of the caller's orgs joins (default PRLL_ORG_ID).
19
+ * Connecting, disconnecting and approving a reconnect are a person's
20
+ * decisions; the server refuses them for agents, which can only read.
21
+ */
22
+ export function registerChatConnectionCommands(chats) {
23
+ chats
24
+ .command('invite')
25
+ .description('Invite a person from another organization into a channel by email')
26
+ .argument('<chatId>', 'Chat ID')
27
+ .requiredOption('--email <email>', "The person's email address")
28
+ .action(async (chatId, opts) => {
29
+ try {
30
+ const { client, orgId } = resolveCredentials();
31
+ printJson(await client.createChatInvitation(orgId, stripPrllScheme(chatId), opts.email));
32
+ }
33
+ catch (err) {
34
+ printError(err);
35
+ }
36
+ });
37
+ const invitations = chats
38
+ .command('invitations')
39
+ .description('Channel invitations from other organizations');
40
+ invitations
41
+ .command('list')
42
+ .description("List your pending invitations, or a channel's pending invitations with --chat")
43
+ .option('--chat <chatId>', "List this channel's pending invitations instead (its own org)")
44
+ .action(async (opts) => {
45
+ try {
46
+ const { client, orgId } = resolveCredentials();
47
+ printJson({
48
+ data: opts.chat
49
+ ? await client.listChatInvitations(orgId, stripPrllScheme(opts.chat))
50
+ : await client.getMyChatInvitations(),
51
+ });
52
+ }
53
+ catch (err) {
54
+ printError(err);
55
+ }
56
+ });
57
+ invitations
58
+ .command('accept')
59
+ .description('Accept an invitation, joining the channel as one of your organizations')
60
+ .argument('<invitationId>', 'Invitation ID (chi_…)')
61
+ .option('--as-org <orgId>', 'Which of your organizations joins (default: PRLL_ORG_ID)')
62
+ .action(async (invitationId, opts) => {
63
+ try {
64
+ const { client, orgId } = resolveCredentials();
65
+ const result = await client.acceptChatInvitation(invitationId, opts.asOrg ?? orgId);
66
+ printJson(result);
67
+ if (result.reconnect_pending)
68
+ printProgress(reconnectNote(result.reconnect_waits_for));
69
+ }
70
+ catch (err) {
71
+ printError(err);
72
+ }
73
+ });
74
+ invitations
75
+ .command('decline')
76
+ .description('Decline an invitation')
77
+ .argument('<invitationId>', 'Invitation ID (chi_…)')
78
+ .action(async (invitationId) => {
79
+ try {
80
+ const { client } = resolveCredentials();
81
+ printJson(await client.declineChatInvitation(invitationId));
82
+ }
83
+ catch (err) {
84
+ printError(err);
85
+ }
86
+ });
87
+ invitations
88
+ .command('revoke')
89
+ .description("Withdraw a pending invitation to one of your organization's channels")
90
+ .argument('<chatId>', 'Chat ID')
91
+ .argument('<invitationId>', 'Invitation ID (chi_…)')
92
+ .action(async (chatId, invitationId) => {
93
+ try {
94
+ const { client, orgId } = resolveCredentials();
95
+ await client.revokeChatInvitation(orgId, stripPrllScheme(chatId), invitationId);
96
+ printJson({ ok: true });
97
+ }
98
+ catch (err) {
99
+ printError(err);
100
+ }
101
+ });
102
+ const connections = chats
103
+ .command('connections')
104
+ .description('Organizations a shared channel is connected to');
105
+ connections
106
+ .command('list')
107
+ .description('List the organizations connected to a channel and their status')
108
+ .argument('<chatId>', 'Chat ID')
109
+ .action(async (chatId) => {
110
+ try {
111
+ const { client, orgId } = resolveCredentials();
112
+ printJson({ data: await client.listChatConnections(orgId, stripPrllScheme(chatId)) });
113
+ }
114
+ catch (err) {
115
+ printError(err);
116
+ }
117
+ });
118
+ const target = '--org <orgId>';
119
+ const targetHelp = "The connected organization (default: your own, PRLL_ORG_ID). From the channel's own organization, name the other organization";
120
+ connections
121
+ .command('disconnect')
122
+ .description("Disconnect an organization from a channel: its people and agents lose the channel at once. An org admin can disconnect their own organization; the channel's owner or admin can disconnect any other")
123
+ .argument('<chatId>', 'Chat ID')
124
+ .option(target, targetHelp)
125
+ .action(async (chatId, opts) => {
126
+ try {
127
+ const { client, orgId } = resolveCredentials();
128
+ printJson(await client.disconnectChatOrg(orgId, stripPrllScheme(chatId), opts.org ?? orgId));
129
+ }
130
+ catch (err) {
131
+ printError(err);
132
+ }
133
+ });
134
+ connections
135
+ .command('approve')
136
+ .description('Let a disconnected organization back in after it accepted a new invitation; only the side that disconnected it can')
137
+ .argument('<chatId>', 'Chat ID')
138
+ .option(target, targetHelp)
139
+ .action(async (chatId, opts) => {
140
+ try {
141
+ const { client, orgId } = resolveCredentials();
142
+ printJson(await client.approveChatReconnect(orgId, stripPrllScheme(chatId), opts.org ?? orgId));
143
+ }
144
+ catch (err) {
145
+ printError(err);
146
+ }
147
+ });
148
+ connections
149
+ .command('decline')
150
+ .description("Turn down a disconnected organization's reconnect; it stays disconnected")
151
+ .argument('<chatId>', 'Chat ID')
152
+ .option(target, targetHelp)
153
+ .action(async (chatId, opts) => {
154
+ try {
155
+ const { client, orgId } = resolveCredentials();
156
+ printJson(await client.declineChatReconnect(orgId, stripPrllScheme(chatId), opts.org ?? orgId));
157
+ }
158
+ catch (err) {
159
+ printError(err);
160
+ }
161
+ });
162
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/commands/chats.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAoRpD"}
1
+ {"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/commands/chats.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA6RpD"}
@@ -1,6 +1,7 @@
1
1
  import { ApiError } from '@parall/sdk';
2
2
  import { resolveCredentials } from '../lib/client.js';
3
3
  import { printJson, printError, printRefHint, stripPrllScheme } from '../lib/output.js';
4
+ import { registerChatConnectionCommands } from './chat-connections.js';
4
5
  /** Strict command grammar for --visibility; membership/discoverability
5
6
  * semantics stay the server's domain. */
6
7
  function resolveVisibilityFlag(value) {
@@ -254,7 +255,10 @@ export function registerChatCommands(program) {
254
255
  printJson({ ok: true });
255
256
  }
256
257
  catch (err) {
257
- printError(err);
258
+ // Someone from another organization joins a channel by invitation.
259
+ printError(err, undefined, err instanceof ApiError && err.code === 'NOT_ORG_MEMBER'
260
+ ? `To bring in someone from another organization, invite them by email: parall chats invite ${stripPrllScheme(chatId)} --email <their email>`
261
+ : undefined);
258
262
  }
259
263
  });
260
264
  members
@@ -272,4 +276,5 @@ export function registerChatCommands(program) {
272
276
  printError(err);
273
277
  }
274
278
  });
279
+ registerChatConnectionCommands(chats);
275
280
  }
@@ -1 +1 @@
1
- {"version":3,"file":"db-plane.d.ts","sourceRoot":"","sources":["../../src/commands/db-plane.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAUV,eAAe,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC;;;4DAG4D;AAC5D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,KAAK,GAAG,IAAI,CAAC;IACtB;qBACiB;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD;AAgBD;;;;;;;;mDAQmD;AACnD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,QAiMlF;AAgED;;;4BAG4B;AAC5B,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,eAAe,EAAE,GAAG,SAAS,CASpF"}
1
+ {"version":3,"file":"db-plane.d.ts","sourceRoot":"","sources":["../../src/commands/db-plane.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAUV,eAAe,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC;;;4DAG4D;AAC5D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,KAAK,GAAG,IAAI,CAAC;IACtB;qBACiB;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD;AAgBD;;;;;;;;mDAQmD;AACnD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,QAmNlF;AAgED;;;4BAG4B;AAC5B,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,eAAe,EAAE,GAAG,SAAS,CASpF"}
@@ -44,7 +44,7 @@ export function registerDataPlaneCommands(group, binding) {
44
44
  .description('Run one read-only statement (attached-app author or org owner/admin)')))
45
45
  .option('--sql <sql>', 'SQL text')
46
46
  .option('--file <path>', 'Read the SQL from a file (- for stdin)')
47
- .option('--param <value...>', 'Positional parameters $1..$n; JSON values (42, "text", true, null) or bare text')
47
+ .option('--param <value...>', 'Positional parameters, $1..$n (? on a Database on TiDB: one value each, in order); JSON values (42, "text", true, null) or bare text')
48
48
  .action(async (name, opts) => {
49
49
  try {
50
50
  checkJsonOutput(opts.output);
@@ -62,7 +62,7 @@ export function registerDataPlaneCommands(group, binding) {
62
62
  .description('Run statements in one transaction: data writes or schema changes (snapshot first); attached-app author or org owner/admin')))
63
63
  .option('--sql <sql>', 'SQL text (several statements separated by ;)')
64
64
  .option('--file <path>', 'Read the SQL from a file (- for stdin)')
65
- .option('--param <value...>', 'Positional parameters $1..$n (single statement only)')
65
+ .option('--param <value...>', 'Positional parameters, $1..$n (? on a Database on TiDB); single statement only')
66
66
  .option('--dry-run', 'Execute inside the transaction and roll back')
67
67
  .action(async (name, opts) => {
68
68
  try {
@@ -113,7 +113,9 @@ export function registerDataPlaneCommands(group, binding) {
113
113
  printError(err);
114
114
  }
115
115
  });
116
- withTarget(group.command('dump').description('Plain-SQL pg_dump of the schema (or one table)'))
116
+ withTarget(group
117
+ .command('dump')
118
+ .description('Plain-SQL pg_dump of the schema (or one table); not available yet for a Database on TiDB (PLACEMENT_UNSUPPORTED)'))
117
119
  .option('--table <name>', 'Only this table')
118
120
  .option('--out <file>', 'Write the dump to a file instead of stdout')
119
121
  .option('--output <file>', 'Same as --out')
@@ -154,7 +156,9 @@ export function registerDataPlaneCommands(group, binding) {
154
156
  printError(err);
155
157
  }
156
158
  });
157
- jsonOutput(withTarget(group.command('snapshots').description('Restore points taken before schema changes'))).action(async (name, opts) => {
159
+ jsonOutput(withTarget(group
160
+ .command('snapshots')
161
+ .description('Restore points taken before schema changes and restores (on TiDB: moments of its history, not files; restorable for about 23 hours)'))).action(async (name, opts) => {
158
162
  try {
159
163
  checkJsonOutput(opts.output);
160
164
  const ctx = resolveCredentials();
@@ -166,8 +170,8 @@ export function registerDataPlaneCommands(group, binding) {
166
170
  });
167
171
  jsonOutput(withTarget(group
168
172
  .command('restore')
169
- .description('Replace the schema with a snapshot; the current state is snapshotted first')))
170
- .requiredOption('--to <logId>', 'log_id of the snapshot (see `snapshots`)')
173
+ .description('Put the tables and their rows back as they were before a log entry; every write after it is undone. On PostgreSQL the current state is snapshotted first; on TiDB the restore is itself a log entry, so restoring to before it undoes it')))
174
+ .requiredOption('--to <logId>', 'log_id to go back to before: a snapshot (see `snapshots`); on TiDB, any `log` entry with a data_seq from about the last 24 hours')
171
175
  .action(async (name, opts) => {
172
176
  try {
173
177
  checkJsonOutput(opts.output);
@@ -2,8 +2,9 @@ import type { Command } from 'commander';
2
2
  /** Database entity: a PostgreSQL schema of its own inside the org's
3
3
  * database on the apps instance (docs/engineering-design/mini-app-design.md
4
4
  * §4, §5). Databases belong to the organization; apps of the org attach to
5
- * one, and it may also stand alone. This file manages the entity (visible
6
- * to every org member); the raw-SQL data plane (query / exec / schema / …)
5
+ * one, and it may also stand alone. This file manages the entity (seen by
6
+ * whoever can open one of the apps on it, by every member while no app is
7
+ * on it, and by org owners/admins); the raw-SQL data plane (query / exec / schema / …)
7
8
  * is db-plane.ts — a construction surface for attached-app authors and org
8
9
  * owners/admins — mounted here and under `parall app db`, both taking the
9
10
  * target as an argument, --db or --app (db-target.ts). Every command
@@ -1 +1 @@
1
- {"version":3,"file":"dbs.d.ts","sourceRoot":"","sources":["../../src/commands/dbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC;;;;;;;;;8EAS8E;AAC9E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,QA0FlD"}
1
+ {"version":3,"file":"dbs.d.ts","sourceRoot":"","sources":["../../src/commands/dbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC;;;;;;;;;;8EAU8E;AAC9E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,QA+FlD"}
@@ -1,13 +1,15 @@
1
1
  import { resolveCredentials } from '../lib/client.js';
2
- import { printError, printJson, printRefHint, stripPrllScheme } from '../lib/output.js';
2
+ import { printError, printJson, printProgress, printRefHint, stripPrllScheme, } from '../lib/output.js';
3
+ import { placementHint } from './apps-placement.js';
3
4
  import { registerDataPlaneCommands } from './db-plane.js';
4
5
  import { resolveDatabaseId } from './db-target.js';
5
6
  const DEPRECATED_PROJECT = 'Deprecated and ignored: Databases belong to the organization and names are unique in it';
6
7
  /** Database entity: a PostgreSQL schema of its own inside the org's
7
8
  * database on the apps instance (docs/engineering-design/mini-app-design.md
8
9
  * §4, §5). Databases belong to the organization; apps of the org attach to
9
- * one, and it may also stand alone. This file manages the entity (visible
10
- * to every org member); the raw-SQL data plane (query / exec / schema / …)
10
+ * one, and it may also stand alone. This file manages the entity (seen by
11
+ * whoever can open one of the apps on it, by every member while no app is
12
+ * on it, and by org owners/admins); the raw-SQL data plane (query / exec / schema / …)
11
13
  * is db-plane.ts — a construction surface for attached-app authors and org
12
14
  * owners/admins — mounted here and under `parall app db`, both taking the
13
15
  * target as an argument, --db or --app (db-target.ts). Every command
@@ -22,7 +24,7 @@ export function registerDbCommands(program) {
22
24
  extraOptions: [{ flag: '--project <projectId>', help: DEPRECATED_PROJECT }],
23
25
  });
24
26
  db.command('list')
25
- .description("List the organization's Databases")
27
+ .description("List the organization's Databases you can see: those of apps you can open, and those no app is on")
26
28
  .option('--project <projectId>', DEPRECATED_PROJECT)
27
29
  .action(async () => {
28
30
  try {
@@ -39,7 +41,9 @@ export function registerDbCommands(program) {
39
41
  try {
40
42
  const ctx = resolveCredentials();
41
43
  const id = await resolveDatabaseId(ctx, databaseFrom(idOrName, opts.db));
42
- printJson(await ctx.client.getMiniAppDatabase(ctx.orgId, id));
44
+ const result = await ctx.client.getMiniAppDatabase(ctx.orgId, id);
45
+ printJson(result);
46
+ printProgress(placementHint(result.id, result.placement));
43
47
  }
44
48
  catch (err) {
45
49
  printError(err);
@@ -59,6 +63,7 @@ export function registerDbCommands(program) {
59
63
  const result = await client.createMiniAppDatabase(orgId, data);
60
64
  printJson(result);
61
65
  printRefHint(result.id);
66
+ printProgress(placementHint(result.id, result.placement));
62
67
  }
63
68
  catch (err) {
64
69
  printError(err);
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASrE;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,CA+B/E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAkCtD"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASrE;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,CA+B/E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAoCtD"}
@@ -74,7 +74,7 @@ export function buildSearchParams(query, opts) {
74
74
  export function registerSearchCommands(program) {
75
75
  program
76
76
  .command('search')
77
- .description('Unified semantic search across messages, tasks, wiki, and comments (org-scoped)')
77
+ .description('Unified semantic search across messages, tasks, wiki, and comments in the organization, including channels it shares with other organizations')
78
78
  .argument('<query>', 'Search query')
79
79
  .option('--types <list>', 'Comma-separated entity types: m[essage], t[ask], w[iki], c[omment] (default: all)')
80
80
  .option('--channel <chatId>', 'Narrow MESSAGE results to one chat — tasks/wiki unaffected (prll://cht_… or cht_…)')
@@ -62,6 +62,17 @@ export declare function projectRosterNextStep(details: unknown): string | undefi
62
62
  * the generic guidance.
63
63
  */
64
64
  export declare function authorshipNextStep(details: unknown): string | undefined;
65
+ /**
66
+ * Plain-text next step for a Mini App access denial
67
+ * (mini-app-access-design.md §6.2): a 403 `PERMISSION_DENIED` naming
68
+ * `app.read` (the caller cannot open the app) or `app.action.write` (they
69
+ * can only view it) on a `prll://app_…`. Neither is approvable; the way in
70
+ * is a higher level on the app's access list, which its authors and org
71
+ * owners/admins can give. Someone who cannot open the app cannot read its
72
+ * author roster either, so that step names whoever sent the app instead.
73
+ * The server sends only the action and the app; the command is the CLI's.
74
+ */
75
+ export declare function accessNextStep(action: string | undefined, resourceUri: string | undefined): string | undefined;
65
76
  /** Prints the error and exits 1. `nextStep` is plain-text guidance printed
66
77
  * after the error line of an API error. */
67
78
  export declare function printError(err: unknown, attemptedPayload?: Record<string, unknown>, nextStep?: string): never;
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAoB3C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAW5E;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAe1E;AAaD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAWvE;AASD;2CAC2C;AAC3C,wBAAgB,UAAU,CACxB,GAAG,EAAE,OAAO,EACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,QAAQ,CAAC,EAAE,MAAM,GAChB,KAAK,CAgEP"}
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAoB3C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAW5E;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAe1E;AAaD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAWvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAYpB;AASD;2CAC2C;AAC3C,wBAAgB,UAAU,CACxB,GAAG,EAAE,OAAO,EACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,QAAQ,CAAC,EAAE,MAAM,GAChB,KAAK,CAmEP"}
@@ -161,6 +161,30 @@ export function authorshipNextStep(details) {
161
161
  : `The authors of any of ${apps.map((id) => `prll://${id}`).join(', ')}`;
162
162
  return `${whose} and org owners/admins can do this. To become an author, ask one of its authors (parall app authors list ${app}) or an org owner/admin to run:\n parall app authors add ${app} ${user}`;
163
163
  }
164
+ /**
165
+ * Plain-text next step for a Mini App access denial
166
+ * (mini-app-access-design.md §6.2): a 403 `PERMISSION_DENIED` naming
167
+ * `app.read` (the caller cannot open the app) or `app.action.write` (they
168
+ * can only view it) on a `prll://app_…`. Neither is approvable; the way in
169
+ * is a higher level on the app's access list, which its authors and org
170
+ * owners/admins can give. Someone who cannot open the app cannot read its
171
+ * author roster either, so that step names whoever sent the app instead.
172
+ * The server sends only the action and the app; the command is the CLI's.
173
+ */
174
+ export function accessNextStep(action, resourceUri) {
175
+ if (!resourceUri?.startsWith('prll://app_'))
176
+ return undefined;
177
+ const me = process.env.PRLL_AGENT_ID?.trim();
178
+ const user = me?.startsWith('usr_') ? me : '<your user ID (parall whoami)>';
179
+ switch (action) {
180
+ case 'app.read':
181
+ return `You cannot open ${resourceUri}. Ask whoever sent it to you, one of its authors or an org owner/admin to run:\n parall app access add ${resourceUri} ${user} --level read`;
182
+ case 'app.action.write':
183
+ return `You can only view ${resourceUri}, so its write actions are refused. To be able to change it, ask one of its authors (parall app authors list ${resourceUri}) or an org owner/admin to run:\n parall app access add ${resourceUri} ${user} --level write`;
184
+ default:
185
+ return undefined;
186
+ }
187
+ }
164
188
  /** The request a refused card delete names (`details.approval_id`). */
165
189
  function readApprovalId(details) {
166
190
  if (!details || typeof details !== 'object')
@@ -182,12 +206,15 @@ export function printError(err, attemptedPayload, nextStep) {
182
206
  ...(err.approvable !== undefined ? { approvable: err.approvable } : {}),
183
207
  ...(err.extras ? { extras: err.extras } : {}),
184
208
  }));
185
- // Project-roster and Mini App authorship denials: the fix is joining the
186
- // project or being added as an author (each its own action), not an
187
- // approval of what was refused — so these replace the approval guidance
188
- // below rather than adding to it.
209
+ // Project-roster, Mini App authorship and Mini App access denials: the
210
+ // fix is joining the project, being added as an author or being given a
211
+ // level on the app (each its own action), not an approval of what was
212
+ // refused — so these replace the approval guidance below rather than
213
+ // adding to it.
189
214
  const rosterStep = err.code === 'PERMISSION_DENIED'
190
- ? (projectRosterNextStep(err.extras?.details) ?? authorshipNextStep(err.extras?.details))
215
+ ? (projectRosterNextStep(err.extras?.details) ??
216
+ authorshipNextStep(err.extras?.details) ??
217
+ accessNextStep(err.action, err.resourceUri))
191
218
  : undefined;
192
219
  if (rosterStep) {
193
220
  console.error(rosterStep);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.78.0",
3
+ "version": "1.80.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.78.0",
46
- "@parall/agent-core": "1.78.0"
45
+ "@parall/agent-core": "1.80.0",
46
+ "@parall/sdk": "1.80.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@dnd-kit/core": "6.3.1",
@@ -71,10 +71,10 @@
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.78.0"
74
+ "@parall/agent-core": "1.80.0"
75
75
  },
76
76
  "scripts": {
77
- "build": "node scripts/generate-miniapp-sdk.mjs --check && node scripts/generate-local-runner.mjs --check && node scripts/generate-app-templates.mjs --check && tsc",
77
+ "build": "node scripts/generate-miniapp-sdk.mjs --check && node scripts/generate-local-runner.mjs --check && node scripts/generate-app-templates.mjs --check && node scripts/generate-app-template-catalog.mjs --check && tsc",
78
78
  "dev": "tsc --watch",
79
79
  "test": "pnpm run build && node --test test/*.test.mjs",
80
80
  "bundle": "node scripts/bundle.mjs"