@parall/cli 1.67.0 → 1.68.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 (41) hide show
  1. package/dist/commands/agents.d.ts +2 -0
  2. package/dist/commands/agents.d.ts.map +1 -1
  3. package/dist/commands/apps-db.d.ts +8 -0
  4. package/dist/commands/apps-db.d.ts.map +1 -0
  5. package/dist/commands/apps-db.js +17 -0
  6. package/dist/commands/apps-publish.d.ts +23 -0
  7. package/dist/commands/apps-publish.d.ts.map +1 -0
  8. package/dist/commands/apps-publish.js +288 -0
  9. package/dist/commands/apps-scaffold.d.ts +9 -0
  10. package/dist/commands/apps-scaffold.d.ts.map +1 -0
  11. package/dist/commands/apps-scaffold.js +379 -0
  12. package/dist/commands/apps.d.ts +9 -5
  13. package/dist/commands/apps.d.ts.map +1 -1
  14. package/dist/commands/apps.js +31 -32
  15. package/dist/commands/clip.d.ts.map +1 -1
  16. package/dist/commands/clip.js +55 -10
  17. package/dist/commands/db-plane.d.ts +41 -0
  18. package/dist/commands/db-plane.d.ts.map +1 -0
  19. package/dist/commands/db-plane.js +237 -0
  20. package/dist/commands/dbs.d.ts +16 -0
  21. package/dist/commands/dbs.d.ts.map +1 -0
  22. package/dist/commands/dbs.js +147 -0
  23. package/dist/commands/triggers.d.ts +14 -1
  24. package/dist/commands/triggers.d.ts.map +1 -1
  25. package/dist/commands/triggers.js +64 -0
  26. package/dist/commands/watch.d.ts +1 -1
  27. package/dist/commands/watch.d.ts.map +1 -1
  28. package/dist/commands/watch.js +21 -11
  29. package/dist/commands/wiki-changesets.d.ts +3 -0
  30. package/dist/commands/wiki-changesets.d.ts.map +1 -0
  31. package/dist/commands/wiki-changesets.js +176 -0
  32. package/dist/commands/wiki.d.ts.map +1 -1
  33. package/dist/commands/wiki.js +4 -173
  34. package/dist/index.js +2 -0
  35. package/dist/lib/wiki-tool-definition.d.ts +23 -0
  36. package/dist/lib/wiki-tool-definition.d.ts.map +1 -0
  37. package/dist/lib/wiki-tool-definition.js +17 -0
  38. package/dist/lib/wiki-tools.d.ts +2 -24
  39. package/dist/lib/wiki-tools.d.ts.map +1 -1
  40. package/dist/lib/wiki-tools.js +11 -16
  41. package/package.json +6 -4
@@ -2,10 +2,13 @@ import { resolveCredentials } from '../lib/client.js';
2
2
  import { printError, printJson } from '../lib/output.js';
3
3
  // ---------------------------------------------------------------------------
4
4
  // `parall watch` — what the agent receives from each channel and thread
5
- // (agent-attention-design §4.1 / §4.5). Two values:
5
+ // (agent-attention-design §4.1 / §4.5). Values:
6
6
  // all every message
7
7
  // mentions only what addresses you (@, @all/@allagent, a person's DM, …)
8
- // and a temporary flip: `<value> until <time>` receives <value> until then
8
+ // smart what addresses you, plus the messages smart routing picks for
9
+ // you (group chats only, where the deployment offers it; no
10
+ // `until` to or from it — smart-attention-design)
11
+ // and a temporary flip between all and mentions: `<value> until <time>` receives <value> until then
9
12
  // and goes back to the other value. `--catch-up` on `mentions until` asks
10
13
  // for one wake when the mute lapses with unread activity.
11
14
  // Targets: a chat (cht_), a thread root (msg_) or an external IM
@@ -16,29 +19,33 @@ import { printError, printJson } from '../lib/output.js';
16
19
  // A temporary setting needs the runtime contract — older runtimes get 422
17
20
  // RUNTIME_CONTRACT_REQUIRED.
18
21
  // ---------------------------------------------------------------------------
19
- const LEVELS = ['all', 'mentions'];
22
+ const LEVELS = ['all', 'mentions', 'smart'];
23
+ const VALUE_HELP = 'all | mentions [until <time>] | smart';
20
24
  export function normalizeTargetUri(input) {
21
25
  const trimmed = input.trim();
22
26
  return trimmed.startsWith('prll://') ? trimmed : `prll://${trimmed}`;
23
27
  }
24
28
  /**
25
- * Parse `all | mentions [until <when>]` into a request body. `until`
29
+ * Parse `all | mentions [until <when>] | smart` into a request body. `until`
26
30
  * accepts an RFC 3339 time, `tomorrow` (09:00 local next day), or a relative
27
31
  * duration such as `2h`, `90m`, `1d`. Throws on anything else.
28
32
  */
29
33
  export function parseLevelArgs(args, now = new Date()) {
30
34
  const [head, ...rest] = args.map((a) => a.trim()).filter(Boolean);
31
35
  if (!head)
32
- throw new Error('value required: all | mentions [until <time>]');
36
+ throw new Error(`value required: ${VALUE_HELP}`);
33
37
  const word = head.toLowerCase();
34
38
  if (!LEVELS.includes(word)) {
35
- throw new Error(`unknown value "${args.join(' ')}": use all | mentions [until <time>]`);
39
+ throw new Error(`unknown value "${args.join(' ')}": use ${VALUE_HELP}`);
36
40
  }
37
41
  const level = word;
38
42
  if (rest.length === 0)
39
43
  return { level };
40
44
  if (rest[0]?.toLowerCase() !== 'until') {
41
- throw new Error(`unknown value "${args.join(' ')}": use all | mentions [until <time>]`);
45
+ throw new Error(`unknown value "${args.join(' ')}": use ${VALUE_HELP}`);
46
+ }
47
+ if (level === 'smart') {
48
+ throw new Error('smart takes no until: it is a resting value (set mentions or all for a while instead)');
42
49
  }
43
50
  const when = rest.slice(1).join(' ');
44
51
  if (!when)
@@ -70,7 +77,7 @@ const UNWATCH_HINT = "You left this thread: replies, being the root author or be
70
77
  export function registerWatchCommands(program) {
71
78
  const watch = program
72
79
  .command('watch')
73
- .description('What you receive from each channel and thread: all | mentions [until <time>]')
80
+ .description('What you receive from each channel and thread: all | mentions [until <time>] | smart')
74
81
  .argument('[target]', 'prll:// thread root or task to follow')
75
82
  .option('--until <time>', 'follow a thread only until then (tomorrow | 2h | RFC 3339)')
76
83
  .action(async (target, opts, cmd) => {
@@ -90,7 +97,7 @@ export function registerWatchCommands(program) {
90
97
  return;
91
98
  }
92
99
  if (!id.startsWith('msg_')) {
93
- throw new Error('watch takes a thread root (msg_) or a task (tsk_); for a chat or external conversation use `parall watch set <target> all|mentions`');
100
+ throw new Error('watch takes a thread root (msg_) or a task (tsk_); for a chat or external conversation use `parall watch set <target> all|mentions|smart`');
94
101
  }
95
102
  const body = { target_uri: uri, level: 'all' };
96
103
  if (opts.until)
@@ -115,9 +122,9 @@ export function registerWatchCommands(program) {
115
122
  });
116
123
  watch
117
124
  .command('set')
118
- .description('Set what you receive on a chat, thread root or external conversation: all | mentions [until <time>]')
125
+ .description('Set what you receive on a chat, thread root or external conversation: all | mentions [until <time>]; on a group chat also smart (addressed to you, plus what smart routing picks)')
119
126
  .argument('<target>', 'prll:// URI: chat (cht_), thread root (msg_) or external conversation (chv_)')
120
- .argument('<value...>', 'all | mentions [until tomorrow|2h|RFC3339]')
127
+ .argument('<value...>', 'all | mentions [until tomorrow|2h|RFC3339] | smart')
121
128
  .option('--catch-up', 'with `mentions until`: one wake when the mute lapses with unread activity')
122
129
  .action(async (target, value, opts) => {
123
130
  try {
@@ -126,6 +133,9 @@ export function registerWatchCommands(program) {
126
133
  throw new Error('tasks carry no setting: use `parall watch <task>` / `parall unwatch <task>`');
127
134
  }
128
135
  const parsed = parseLevelArgs(value);
136
+ if (parsed.level === 'smart' && !uri.slice('prll://'.length).startsWith('cht_')) {
137
+ throw new Error('smart applies to group chats (cht_) only');
138
+ }
129
139
  const body = { target_uri: uri, ...parsed };
130
140
  if (opts.catchUp) {
131
141
  if (parsed.level !== 'mentions' || !parsed.until) {
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerWikiChangesetCommands(wiki: Command): void;
3
+ //# sourceMappingURL=wiki-changesets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wiki-changesets.d.ts","sourceRoot":"","sources":["../../src/commands/wiki-changesets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,OAAO,QAqM1D"}
@@ -0,0 +1,176 @@
1
+ import { resolveCredentials, resolveRuntimeContext } from '../lib/client.js';
2
+ import { printError, printJson } from '../lib/output.js';
3
+ import { getWikiChangesetDetail, getWikiChangesetDiff, listWikiChangesets, proposeWikiChangeset, } from '../lib/wiki.js';
4
+ export function registerWikiChangesetCommands(wiki) {
5
+ // ---- Changeset subcommands ----
6
+ const changeset = wiki.command('changeset').description('Manage wiki changesets (proposals)');
7
+ changeset
8
+ .command('create')
9
+ .description('Create a new changeset from local workspace changes.')
10
+ .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
11
+ .option('--title <title>', 'Changeset title (required for new changesets)')
12
+ .option('--message <message>', 'Changeset commit message (supports prll:// refs)')
13
+ .option('--update <changesetId>', 'Re-propose an existing rejected/conflict changeset (title is inherited)')
14
+ .option('--chat-id <chatId>', 'Source chat ID for approval workflow')
15
+ .option('--message-id <messageId>', 'Source message ID for approval workflow')
16
+ .option('--session-id <sessionId>', 'Source agent session ID for approval workflow')
17
+ .action(async (wikiRef, options) => {
18
+ try {
19
+ if (!options.update && !options.title) {
20
+ process.stderr.write('Error: --title is required when creating a new changeset.\n');
21
+ process.stderr.write(' Use --update <id> to re-propose a rejected/conflict changeset (title inherited).\n');
22
+ process.exit(1);
23
+ }
24
+ const ctx = resolveCredentials();
25
+ const rtx = resolveRuntimeContext();
26
+ // Inherit title from existing changeset when re-proposing via --update
27
+ const inheritedTitle = options.update && !options.title
28
+ ? (await getWikiChangesetDetail(ctx, wikiRef, options.update)).changeset.title
29
+ : undefined;
30
+ const result = await proposeWikiChangeset(ctx, wikiRef, {
31
+ title: options.title ?? inheritedTitle ?? '',
32
+ message: options.message,
33
+ changesetId: options.update,
34
+ sourceChatId: options.chatId ?? rtx.chatId,
35
+ sourceMessageId: options.messageId ?? rtx.triggerMessageId,
36
+ sourceRunId: options.sessionId ?? rtx.sessionId,
37
+ });
38
+ const verb = options.update ? 'Re-proposed' : 'Created';
39
+ if (result.auto_merged) {
40
+ process.stderr.write(`${verb} and auto-merged changeset ${result.changeset.id}\n`);
41
+ }
42
+ else {
43
+ process.stderr.write(`${verb} changeset ${result.changeset.id} (${result.status})\n`);
44
+ }
45
+ process.stderr.write(`Changed files: ${result.changed_paths.join(', ')}\n`);
46
+ if (result.stale_recovery) {
47
+ const moved = result.stale_recovery.stale_paths.join(', ') || 'server check';
48
+ process.stderr.write(`Server had moved since your last sync (${moved}); re-synced and re-proposed automatically.\n`);
49
+ }
50
+ process.stderr.write(`Next: ${result.next_action}\n`);
51
+ printJson(result);
52
+ }
53
+ catch (error) {
54
+ printError(error);
55
+ }
56
+ });
57
+ changeset
58
+ .command('list')
59
+ .description('List all changesets. Shows ID, status, title, and date.')
60
+ .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
61
+ .action(async (wikiRef) => {
62
+ try {
63
+ const ctx = resolveCredentials();
64
+ const result = await listWikiChangesets(ctx, wikiRef);
65
+ if (result.changesets.length === 0) {
66
+ process.stderr.write('No changesets found.\n');
67
+ }
68
+ else {
69
+ for (const cs of result.changesets) {
70
+ process.stderr.write(`${cs.id} ${cs.status.toUpperCase().padEnd(10)} "${cs.title}" ${cs.created_at}\n`);
71
+ }
72
+ }
73
+ printJson(result);
74
+ }
75
+ catch (error) {
76
+ printError(error);
77
+ }
78
+ });
79
+ changeset
80
+ .command('show')
81
+ .description('Show changeset detail including status, changed files, and feedback.')
82
+ .argument('<changesetId>', 'Changeset ID')
83
+ .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
84
+ .action(async (changesetId, wikiRef) => {
85
+ try {
86
+ const ctx = resolveCredentials();
87
+ const result = await getWikiChangesetDetail(ctx, wikiRef, changesetId);
88
+ const cs = result.changeset;
89
+ process.stderr.write(`Changeset: ${cs.id}\n`);
90
+ process.stderr.write(`Status: ${cs.status.toUpperCase()}\n`);
91
+ process.stderr.write(`Title: ${cs.title}\n`);
92
+ if (cs.message)
93
+ process.stderr.write(`Message: ${cs.message}\n`);
94
+ process.stderr.write(`Created: ${cs.created_at}\n`);
95
+ process.stderr.write(`Updated: ${cs.updated_at}\n`);
96
+ if (cs.changed_paths.length > 0) {
97
+ process.stderr.write('Changed files:\n');
98
+ for (const p of cs.changed_paths)
99
+ process.stderr.write(` ${p}\n`);
100
+ }
101
+ if (cs.last_error) {
102
+ process.stderr.write(`\nFeedback: ${cs.last_error}\n`);
103
+ if (cs.status === 'rejected') {
104
+ process.stderr.write('\nTo fix: edit the file(s), then run:\n' +
105
+ ` parall wiki changeset create --update ${cs.id}\n`);
106
+ }
107
+ else if (cs.status === 'conflict') {
108
+ process.stderr.write('\nTo resolve: run `parall wiki sync`, fix conflicts, then:\n' +
109
+ ` parall wiki changeset create --update ${cs.id}\n`);
110
+ }
111
+ }
112
+ printJson(result);
113
+ }
114
+ catch (error) {
115
+ printError(error);
116
+ }
117
+ });
118
+ changeset
119
+ .command('diff')
120
+ .description('Show the diff of a changeset.')
121
+ .argument('<changesetId>', 'Changeset ID')
122
+ .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
123
+ .option('--raw', 'Print only the unified diff patch')
124
+ .action(async (changesetId, wikiRef, options) => {
125
+ try {
126
+ const ctx = resolveCredentials();
127
+ const result = await getWikiChangesetDiff(ctx, wikiRef, changesetId);
128
+ if (options?.raw) {
129
+ process.stdout.write(result.diff.patch);
130
+ if (result.diff.patch && !result.diff.patch.endsWith('\n'))
131
+ process.stdout.write('\n');
132
+ return;
133
+ }
134
+ printJson(result);
135
+ }
136
+ catch (error) {
137
+ printError(error);
138
+ }
139
+ });
140
+ changeset
141
+ .command('merge')
142
+ .description('Merge a changeset into the wiki default branch')
143
+ .argument('<changesetId>', 'Changeset ID')
144
+ .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
145
+ .action(async (changesetId, wikiRef) => {
146
+ try {
147
+ const ctx = resolveCredentials();
148
+ const { resolveWikiRefOrDefault } = await import('../lib/wiki.js');
149
+ const wiki = await resolveWikiRefOrDefault(ctx, wikiRef);
150
+ const result = await ctx.client.mergeWikiChangeset(ctx.orgId, wiki.id, changesetId);
151
+ process.stderr.write(`Merged changeset ${result.id} — "${result.title}"\n`);
152
+ printJson(result);
153
+ }
154
+ catch (error) {
155
+ printError(error);
156
+ }
157
+ });
158
+ changeset
159
+ .command('close')
160
+ .description('Close a changeset without merging')
161
+ .argument('<changesetId>', 'Changeset ID')
162
+ .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
163
+ .action(async (changesetId, wikiRef) => {
164
+ try {
165
+ const ctx = resolveCredentials();
166
+ const { resolveWikiRefOrDefault } = await import('../lib/wiki.js');
167
+ const wiki = await resolveWikiRefOrDefault(ctx, wikiRef);
168
+ const result = await ctx.client.closeWikiChangeset(ctx.orgId, wiki.id, changesetId);
169
+ process.stderr.write(`Closed changeset ${result.id}\n`);
170
+ printJson(result);
171
+ }
172
+ catch (error) {
173
+ printError(error);
174
+ }
175
+ });
176
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/commands/wiki.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAy4BpD"}
1
+ {"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/commands/wiki.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAssBpD"}
@@ -1,8 +1,9 @@
1
+ import { registerWikiChangesetCommands } from './wiki-changesets.js';
1
2
  import { promises as fs } from 'node:fs';
2
- import { resolveCredentials, resolveRuntimeContext } from '../lib/client.js';
3
+ import { resolveCredentials } from '../lib/client.js';
3
4
  import { printError, printJson } from '../lib/output.js';
4
5
  import { deleteWikiFile, downloadWikiFile, uploadWikiFile } from '../lib/wiki-files.js';
5
- import { getAfcsDiff, getAfcsStatus, getWikiBlob, getWikiChangesetDetail, getWikiChangesetDiff, getWikiLog, getWikiOutline, getWikiSection, getWikiTree, listWikiChangesets, queryWiki, requestWikiAccess, resetWikiWorkspace, listWikis, proposeWikiChangeset, searchWiki, syncAllMounts, watchMounts, } from '../lib/wiki.js';
6
+ import { getAfcsDiff, getAfcsStatus, getWikiBlob, getWikiLog, getWikiOutline, getWikiSection, getWikiTree, queryWiki, requestWikiAccess, resetWikiWorkspace, listWikis, searchWiki, syncAllMounts, watchMounts, } from '../lib/wiki.js';
6
7
  import { registerWikiCommentCommands } from './wiki-comments.js';
7
8
  export function registerWikiCommands(program) {
8
9
  const wiki = program.command('wiki').description('Parall Wiki — read, edit, and propose changes');
@@ -190,177 +191,7 @@ export function registerWikiCommands(program) {
190
191
  printError(error);
191
192
  }
192
193
  });
193
- // ---- Changeset subcommands ----
194
- const changeset = wiki.command('changeset').description('Manage wiki changesets (proposals)');
195
- changeset
196
- .command('create')
197
- .description('Create a new changeset from local workspace changes.')
198
- .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
199
- .option('--title <title>', 'Changeset title (required for new changesets)')
200
- .option('--message <message>', 'Changeset commit message (supports prll:// refs)')
201
- .option('--update <changesetId>', 'Re-propose an existing rejected/conflict changeset (title is inherited)')
202
- .option('--chat-id <chatId>', 'Source chat ID for approval workflow')
203
- .option('--message-id <messageId>', 'Source message ID for approval workflow')
204
- .option('--session-id <sessionId>', 'Source agent session ID for approval workflow')
205
- .action(async (wikiRef, options) => {
206
- try {
207
- if (!options.update && !options.title) {
208
- process.stderr.write('Error: --title is required when creating a new changeset.\n');
209
- process.stderr.write(' Use --update <id> to re-propose a rejected/conflict changeset (title inherited).\n');
210
- process.exit(1);
211
- }
212
- const ctx = resolveCredentials();
213
- const rtx = resolveRuntimeContext();
214
- // Inherit title from existing changeset when re-proposing via --update
215
- const inheritedTitle = options.update && !options.title
216
- ? (await getWikiChangesetDetail(ctx, wikiRef, options.update)).changeset.title
217
- : undefined;
218
- const result = await proposeWikiChangeset(ctx, wikiRef, {
219
- title: options.title ?? inheritedTitle ?? '',
220
- message: options.message,
221
- changesetId: options.update,
222
- sourceChatId: options.chatId ?? rtx.chatId,
223
- sourceMessageId: options.messageId ?? rtx.triggerMessageId,
224
- sourceRunId: options.sessionId ?? rtx.sessionId,
225
- });
226
- const verb = options.update ? 'Re-proposed' : 'Created';
227
- if (result.auto_merged) {
228
- process.stderr.write(`${verb} and auto-merged changeset ${result.changeset.id}\n`);
229
- }
230
- else {
231
- process.stderr.write(`${verb} changeset ${result.changeset.id} (${result.status})\n`);
232
- }
233
- process.stderr.write(`Changed files: ${result.changed_paths.join(', ')}\n`);
234
- if (result.stale_recovery) {
235
- const moved = result.stale_recovery.stale_paths.join(', ') || 'server check';
236
- process.stderr.write(`Server had moved since your last sync (${moved}); re-synced and re-proposed automatically.\n`);
237
- }
238
- process.stderr.write(`Next: ${result.next_action}\n`);
239
- printJson(result);
240
- }
241
- catch (error) {
242
- printError(error);
243
- }
244
- });
245
- changeset
246
- .command('list')
247
- .description('List all changesets. Shows ID, status, title, and date.')
248
- .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
249
- .action(async (wikiRef) => {
250
- try {
251
- const ctx = resolveCredentials();
252
- const result = await listWikiChangesets(ctx, wikiRef);
253
- if (result.changesets.length === 0) {
254
- process.stderr.write('No changesets found.\n');
255
- }
256
- else {
257
- for (const cs of result.changesets) {
258
- process.stderr.write(`${cs.id} ${cs.status.toUpperCase().padEnd(10)} "${cs.title}" ${cs.created_at}\n`);
259
- }
260
- }
261
- printJson(result);
262
- }
263
- catch (error) {
264
- printError(error);
265
- }
266
- });
267
- changeset
268
- .command('show')
269
- .description('Show changeset detail including status, changed files, and feedback.')
270
- .argument('<changesetId>', 'Changeset ID')
271
- .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
272
- .action(async (changesetId, wikiRef) => {
273
- try {
274
- const ctx = resolveCredentials();
275
- const result = await getWikiChangesetDetail(ctx, wikiRef, changesetId);
276
- const cs = result.changeset;
277
- process.stderr.write(`Changeset: ${cs.id}\n`);
278
- process.stderr.write(`Status: ${cs.status.toUpperCase()}\n`);
279
- process.stderr.write(`Title: ${cs.title}\n`);
280
- if (cs.message)
281
- process.stderr.write(`Message: ${cs.message}\n`);
282
- process.stderr.write(`Created: ${cs.created_at}\n`);
283
- process.stderr.write(`Updated: ${cs.updated_at}\n`);
284
- if (cs.changed_paths.length > 0) {
285
- process.stderr.write('Changed files:\n');
286
- for (const p of cs.changed_paths)
287
- process.stderr.write(` ${p}\n`);
288
- }
289
- if (cs.last_error) {
290
- process.stderr.write(`\nFeedback: ${cs.last_error}\n`);
291
- if (cs.status === 'rejected') {
292
- process.stderr.write('\nTo fix: edit the file(s), then run:\n' +
293
- ` parall wiki changeset create --update ${cs.id}\n`);
294
- }
295
- else if (cs.status === 'conflict') {
296
- process.stderr.write('\nTo resolve: run `parall wiki sync`, fix conflicts, then:\n' +
297
- ` parall wiki changeset create --update ${cs.id}\n`);
298
- }
299
- }
300
- printJson(result);
301
- }
302
- catch (error) {
303
- printError(error);
304
- }
305
- });
306
- changeset
307
- .command('diff')
308
- .description('Show the diff of a changeset.')
309
- .argument('<changesetId>', 'Changeset ID')
310
- .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
311
- .option('--raw', 'Print only the unified diff patch')
312
- .action(async (changesetId, wikiRef, options) => {
313
- try {
314
- const ctx = resolveCredentials();
315
- const result = await getWikiChangesetDiff(ctx, wikiRef, changesetId);
316
- if (options?.raw) {
317
- process.stdout.write(result.diff.patch);
318
- if (result.diff.patch && !result.diff.patch.endsWith('\n'))
319
- process.stdout.write('\n');
320
- return;
321
- }
322
- printJson(result);
323
- }
324
- catch (error) {
325
- printError(error);
326
- }
327
- });
328
- changeset
329
- .command('merge')
330
- .description('Merge a changeset into the wiki default branch')
331
- .argument('<changesetId>', 'Changeset ID')
332
- .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
333
- .action(async (changesetId, wikiRef) => {
334
- try {
335
- const ctx = resolveCredentials();
336
- const { resolveWikiRefOrDefault } = await import('../lib/wiki.js');
337
- const wiki = await resolveWikiRefOrDefault(ctx, wikiRef);
338
- const result = await ctx.client.mergeWikiChangeset(ctx.orgId, wiki.id, changesetId);
339
- process.stderr.write(`Merged changeset ${result.id} — "${result.title}"\n`);
340
- printJson(result);
341
- }
342
- catch (error) {
343
- printError(error);
344
- }
345
- });
346
- changeset
347
- .command('close')
348
- .description('Close a changeset without merging')
349
- .argument('<changesetId>', 'Changeset ID')
350
- .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
351
- .action(async (changesetId, wikiRef) => {
352
- try {
353
- const ctx = resolveCredentials();
354
- const { resolveWikiRefOrDefault } = await import('../lib/wiki.js');
355
- const wiki = await resolveWikiRefOrDefault(ctx, wikiRef);
356
- const result = await ctx.client.closeWikiChangeset(ctx.orgId, wiki.id, changesetId);
357
- process.stderr.write(`Closed changeset ${result.id}\n`);
358
- printJson(result);
359
- }
360
- catch (error) {
361
- printError(error);
362
- }
363
- });
194
+ registerWikiChangesetCommands(wiki);
364
195
  // ---- Binary files (upload / get / delete) ----
365
196
  const file = wiki
366
197
  .command('file')
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import { createRequire } from 'module';
4
4
  import { registerAgentCommands } from './commands/agents.js';
5
5
  import { registerApprovalCommands } from './commands/approvals.js';
6
6
  import { registerAppCommands } from './commands/apps.js';
7
+ import { registerDbCommands } from './commands/dbs.js';
7
8
  import { registerBrowserCommands } from './commands/browser.js';
8
9
  import { registerChatCommands } from './commands/chats.js';
9
10
  import { registerClipCommands } from './commands/clip.js';
@@ -47,6 +48,7 @@ registerTaskCommands(program);
47
48
  registerCommentCommands(program);
48
49
  registerLabelCommands(program);
49
50
  registerAppCommands(program);
51
+ registerDbCommands(program);
50
52
  registerProjectCommands(program);
51
53
  registerProfileCommands(program);
52
54
  registerTeamCommands(program);
@@ -0,0 +1,23 @@
1
+ import * as z from 'zod/v4';
2
+ export type WikiToolExecutionResult = {
3
+ structuredContent: Record<string, unknown>;
4
+ text: string;
5
+ };
6
+ export type WikiToolDefinition = {
7
+ name: string;
8
+ title: string;
9
+ description: string;
10
+ readOnly: boolean;
11
+ inputSchema: z.ZodRawShape;
12
+ outputSchema: z.ZodRawShape;
13
+ handler: (args: Record<string, unknown>) => Promise<WikiToolExecutionResult>;
14
+ };
15
+ /** Pretty-print a value as 2-space-indented JSON for a tool's human-readable `text` field. */
16
+ export declare function jsonText(value: unknown): string;
17
+ /**
18
+ * Wrap a tool definition so its handler validates raw args against the tool's
19
+ * `inputSchema` before running. Returns a copy with the handler replaced; the
20
+ * wrapped handler throws a Zod parse error on invalid/missing input.
21
+ */
22
+ export declare function finalizeWikiTool(tool: WikiToolDefinition): WikiToolDefinition;
23
+ //# sourceMappingURL=wiki-tool-definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wiki-tool-definition.d.ts","sourceRoot":"","sources":["../../src/lib/wiki-tool-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,MAAM,uBAAuB,GAAG;IACpC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC;IAC3B,YAAY,EAAE,CAAC,CAAC,WAAW,CAAC;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC9E,CAAC;AAEF,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CAM7E"}
@@ -0,0 +1,17 @@
1
+ import * as z from 'zod/v4';
2
+ /** Pretty-print a value as 2-space-indented JSON for a tool's human-readable `text` field. */
3
+ export function jsonText(value) {
4
+ return JSON.stringify(value, null, 2);
5
+ }
6
+ /**
7
+ * Wrap a tool definition so its handler validates raw args against the tool's
8
+ * `inputSchema` before running. Returns a copy with the handler replaced; the
9
+ * wrapped handler throws a Zod parse error on invalid/missing input.
10
+ */
11
+ export function finalizeWikiTool(tool) {
12
+ const inputParser = z.object(tool.inputSchema);
13
+ return {
14
+ ...tool,
15
+ handler: async (args) => tool.handler(inputParser.parse(args ?? {})),
16
+ };
17
+ }
@@ -1,28 +1,6 @@
1
- import * as z from 'zod/v4';
1
+ import { type WikiToolDefinition } from './wiki-tool-definition.js';
2
+ export type { WikiToolDefinition, WikiToolExecutionResult } from './wiki-tool-definition.js';
2
3
  import { type ParallContext } from './wiki.js';
3
- /**
4
- * Shared Parall wiki native tool registry.
5
- *
6
- * Single source of truth for the wiki tool surface consumed by:
7
- * - the MCP server (`commands/mcp.ts`), which registers each definition
8
- * - the eval harness (`@parall/eval`), which benchmarks the real tools
9
- *
10
- * Keep the schemas and handlers here behavior-identical to what the MCP
11
- * server used to define inline. Do not fork an eval-only clone.
12
- */
13
- export type WikiToolExecutionResult = {
14
- structuredContent: Record<string, unknown>;
15
- text: string;
16
- };
17
- export type WikiToolDefinition = {
18
- name: string;
19
- title: string;
20
- description: string;
21
- readOnly: boolean;
22
- inputSchema: z.ZodRawShape;
23
- outputSchema: z.ZodRawShape;
24
- handler: (args: Record<string, unknown>) => Promise<WikiToolExecutionResult>;
25
- };
26
4
  /**
27
5
  * Build the full wiki native tool registry bound to a Parall context (credentials,
28
6
  * agent env, local mount). Returns one definition per wiki capability (list, tree,
@@ -1 +1 @@
1
- {"version":3,"file":"wiki-tools.d.ts","sourceRoot":"","sources":["../../src/lib/wiki-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EASL,KAAK,aAAa,EAInB,MAAM,WAAW,CAAC;AAUnB;;;;;;;;;GASG;AAEH,MAAM,MAAM,uBAAuB,GAAG;IACpC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC;IAC3B,YAAY,EAAE,CAAC,CAAC,WAAW,CAAC;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC9E,CAAC;AAmCF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,kBAAkB,EAAE,CAosBvE"}
1
+ {"version":3,"file":"wiki-tools.d.ts","sourceRoot":"","sources":["../../src/lib/wiki-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAChG,YAAY,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAK7F,OAAO,EASL,KAAK,aAAa,EAInB,MAAM,WAAW,CAAC;AAoCnB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,kBAAkB,EAAE,CAosBvE"}
@@ -1,3 +1,4 @@
1
+ import { finalizeWikiTool, jsonText } from './wiki-tool-definition.js';
1
2
  import { promises as fs } from 'node:fs';
2
3
  import * as z from 'zod/v4';
3
4
  import { resolveRuntimeContext } from './client.js';
@@ -10,10 +11,16 @@ import { getWikiBlob, getWikiChangesetDiff, getWikiOutline, getWikiSection, getW
10
11
  * `wiki file get` has no such cap (it streams to stdout / a file).
11
12
  */
12
13
  const WIKI_FILE_INLINE_MAX_BYTES = 64 * 1024;
13
- /** Pretty-print a value as 2-space-indented JSON for a tool's human-readable `text` field. */
14
- function jsonText(value) {
15
- return JSON.stringify(value, null, 2);
16
- }
14
+ /**
15
+ * Shared Parall wiki native tool registry.
16
+ *
17
+ * Single source of truth for the wiki tool surface consumed by:
18
+ * - the MCP server (`commands/mcp.ts`), which registers each definition
19
+ * - the eval harness (`@parall/eval`), which benchmarks the real tools
20
+ *
21
+ * Keep the schemas and handlers here behavior-identical to what the MCP
22
+ * server used to define inline. Do not fork an eval-only clone.
23
+ */
17
24
  /**
18
25
  * Strictly decode base64 from a tool argument. `Buffer.from(s, 'base64')` is
19
26
  * lenient — it silently drops non-base64 characters and tolerates wrong-length
@@ -28,18 +35,6 @@ function decodeBase64Strict(value) {
28
35
  }
29
36
  return Buffer.from(normalized, 'base64');
30
37
  }
31
- /**
32
- * Wrap a tool definition so its handler validates raw args against the tool's
33
- * `inputSchema` before running. Returns a copy with the handler replaced; the
34
- * wrapped handler throws a Zod parse error on invalid/missing input.
35
- */
36
- function finalizeWikiTool(tool) {
37
- const inputParser = z.object(tool.inputSchema);
38
- return {
39
- ...tool,
40
- handler: async (args) => tool.handler(inputParser.parse(args ?? {})),
41
- };
42
- }
43
38
  /**
44
39
  * Build the full wiki native tool registry bound to a Parall context (credentials,
45
40
  * agent env, local mount). Returns one definition per wiki capability (list, tree,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.67.0",
3
+ "version": "1.68.0",
4
4
  "description": "CLI client for Parall — universal agent & human access to Parall API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,16 +36,18 @@
36
36
  "diff": "^8.0.3",
37
37
  "js-yaml": "^4.1.0",
38
38
  "node-diff3": "3.2.1",
39
+ "tar-stream": "^3.2.1",
39
40
  "zod": "^4.3.6",
40
- "@parall/agent-core": "1.67.0",
41
- "@parall/sdk": "1.67.0"
41
+ "@parall/agent-core": "1.68.0",
42
+ "@parall/sdk": "1.68.0"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@types/js-yaml": "^4.0.9",
45
46
  "@types/node": "^22.0.0",
47
+ "@types/tar-stream": "^3.1.4",
46
48
  "esbuild": "^0.25.0",
47
49
  "typescript": "^5.7.0",
48
- "@parall/agent-core": "1.67.0"
50
+ "@parall/agent-core": "1.68.0"
49
51
  },
50
52
  "scripts": {
51
53
  "build": "tsc",