@parall/cli 1.82.0 → 1.84.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 (53) hide show
  1. package/dist/commands/apps-scaffold.d.ts +4 -4
  2. package/dist/commands/apps-scaffold.d.ts.map +1 -1
  3. package/dist/commands/apps-scaffold.js +24 -16
  4. package/dist/commands/apps-template-catalog.d.ts +46 -72
  5. package/dist/commands/apps-template-catalog.d.ts.map +1 -1
  6. package/dist/commands/apps-template-catalog.js +107 -22
  7. package/dist/commands/apps-template-download.d.ts +7 -0
  8. package/dist/commands/apps-template-download.d.ts.map +1 -0
  9. package/dist/commands/apps-template-download.js +116 -0
  10. package/dist/commands/apps-template-init.d.ts +23 -17
  11. package/dist/commands/apps-template-init.d.ts.map +1 -1
  12. package/dist/commands/apps-template-init.js +19 -46
  13. package/dist/commands/apps-template.d.ts +9 -0
  14. package/dist/commands/apps-template.d.ts.map +1 -1
  15. package/dist/commands/apps-template.js +23 -0
  16. package/dist/commands/teams.d.ts +2 -0
  17. package/dist/commands/teams.d.ts.map +1 -1
  18. package/dist/commands/teams.js +42 -6
  19. package/dist/commands/triggers.d.ts.map +1 -1
  20. package/dist/commands/triggers.js +11 -45
  21. package/dist/commands/wiki-changesets.d.ts.map +1 -1
  22. package/dist/commands/wiki-changesets.js +10 -2
  23. package/dist/commands/wiki-edit.d.ts +7 -0
  24. package/dist/commands/wiki-edit.d.ts.map +1 -0
  25. package/dist/commands/wiki-edit.js +50 -0
  26. package/dist/commands/wiki.d.ts.map +1 -1
  27. package/dist/commands/wiki.js +2 -0
  28. package/dist/lib/output.d.ts +7 -0
  29. package/dist/lib/output.d.ts.map +1 -1
  30. package/dist/lib/output.js +14 -0
  31. package/dist/lib/trigger-arguments.d.ts +47 -0
  32. package/dist/lib/trigger-arguments.d.ts.map +1 -0
  33. package/dist/lib/trigger-arguments.js +126 -0
  34. package/dist/lib/wiki-copies.d.ts +18 -0
  35. package/dist/lib/wiki-copies.d.ts.map +1 -0
  36. package/dist/lib/wiki-copies.js +88 -0
  37. package/dist/lib/wiki-edit.d.ts +22 -0
  38. package/dist/lib/wiki-edit.d.ts.map +1 -0
  39. package/dist/lib/wiki-edit.js +74 -0
  40. package/dist/lib/wiki-service-error.d.ts +10 -0
  41. package/dist/lib/wiki-service-error.d.ts.map +1 -0
  42. package/dist/lib/wiki-service-error.js +23 -0
  43. package/dist/lib/wiki-shared.d.ts.map +1 -1
  44. package/dist/lib/wiki-shared.js +2 -1
  45. package/dist/lib/wiki-stale-mounts.d.ts +2 -0
  46. package/dist/lib/wiki-stale-mounts.d.ts.map +1 -0
  47. package/dist/lib/wiki-stale-mounts.js +59 -0
  48. package/dist/lib/wiki-sync.d.ts.map +1 -1
  49. package/dist/lib/wiki-sync.js +4 -59
  50. package/package.json +5 -5
  51. package/dist/commands/apps-template-catalog.gen.d.ts +0 -3
  52. package/dist/commands/apps-template-catalog.gen.d.ts.map +0 -1
  53. package/dist/commands/apps-template-catalog.gen.js +0 -242
@@ -3,8 +3,7 @@ import { promises as fs } from 'node:fs';
3
3
  import { basename, dirname, join, resolve } from 'node:path';
4
4
  import { resolveCredentials } from '../lib/client.js';
5
5
  import { stripPrllScheme } from '../lib/output.js';
6
- import { applyBlock, conflictMessage, findBlock, planBlock } from './apps-blocks.js';
7
- import { applyOverlay, scaffoldProject, sortKeys } from './apps-template.js';
6
+ import { shortVersion } from './apps-template-catalog.js';
8
7
  export async function resolveInitTarget(raw) {
9
8
  const appId = stripPrllScheme(raw.trim());
10
9
  if (!appId.startsWith('app_')) {
@@ -17,53 +16,40 @@ export async function resolveInitTarget(raw) {
17
16
  return { appId, databaseId: database.id, placement: database.placement ?? 'apps' };
18
17
  }
19
18
  /** Why the template cannot be used for this app, or undefined when it can. */
20
- export function templateRefusal(template, target) {
19
+ export function templateRefusal(id, target) {
21
20
  if (target.placement !== 'tidb')
22
21
  return undefined;
23
- return (`The ${template.id} template is written for PostgreSQL, and the Database of ${target.appId} ` +
22
+ return (`The ${id} template is written for PostgreSQL, and the Database of ${target.appId} ` +
24
23
  `(${target.databaseId}) is on TiDB (placement tidb), which speaks MySQL: its tables, SQL and ` +
25
24
  'actions would not run there. Nothing was written. Templates have no MySQL version yet — ' +
26
25
  'tell the person this template cannot be used for this app.');
27
26
  }
28
27
  /** The line init puts under the title of AGENTS.md (in English, as the
29
- * template and its SKILL.md are). */
28
+ * template and its SKILL.md are): which template and version the project
29
+ * was built from. */
30
30
  function skillPointer(template) {
31
- return (`> Built from the app template "${template.intro.name}" (\`${template.id}\`): ` +
32
- 'its pages, actions and tables replace the example described below. ' +
33
- 'For day-to-day work, follow `SKILL.md`.');
31
+ return (`> Built from the app template "${template.intro.name}" (\`${template.id}\`, version ` +
32
+ `\`${shortVersion(template.version)}\`): its pages, actions and tables replace the example ` +
33
+ 'described below. For day-to-day work, follow `SKILL.md`.');
34
34
  }
35
- /** The project's files, sorted by path. */
36
- export function templateProject(name, template) {
37
- const files = new Map(scaffoldProject({ name, actions: true }));
38
- const pkg = files.get('package.json');
39
- applyOverlay(files, template.overlay);
40
- if (files.get('package.json') !== pkg) {
41
- // A template's own dependencies, sorted the way the scaffold's are.
42
- const merged = JSON.parse(files.get('package.json') ?? '{}');
43
- for (const field of ['dependencies', 'devDependencies']) {
44
- if (merged[field])
45
- merged[field] = sortKeys(merged[field]);
46
- }
47
- files.set('package.json', `${JSON.stringify(merged, null, 2)}\n`);
48
- }
35
+ /** The project with the template's skill as SKILL.md and, under the title
36
+ * of AGENTS.md, the line that points to it: what init writes, sorted by
37
+ * path. */
38
+ export function withTemplateSkill(project, template) {
39
+ const files = new Map(project);
49
40
  files.set('SKILL.md', template.skill);
50
- const agents = (files.get('AGENTS.md') ?? '').split('\n');
41
+ const current = files.get('AGENTS.md');
42
+ const agents = (typeof current === 'string' ? current : '').split('\n');
51
43
  const at = agents[0]?.startsWith('# ') ? 1 : 0;
52
44
  agents.splice(at, 0, ...(at ? ['', skillPointer(template)] : [skillPointer(template), '']));
53
45
  files.set('AGENTS.md', agents.join('\n'));
54
46
  return [...files].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
55
47
  }
56
- /** The blocks the template names (_overlay.json `blocks`). */
57
- export function templateBlocks(template) {
58
- const meta = JSON.parse(template.overlay['_overlay.json'] ?? '{}');
59
- return meta.blocks ?? [];
60
- }
61
48
  /**
62
- * Writes the project to out (absent or empty): built beside it, blocks
63
- * added there, then moved into place — a block that cannot be added leaves
64
- * nothing behind.
49
+ * Writes the project to out (absent or empty): built beside it, then moved
50
+ * into place — a write that fails partway leaves nothing behind.
65
51
  */
66
- export async function writeTemplateProject(out, files, blocks) {
52
+ export async function writeTemplateProject(out, files) {
67
53
  const parent = dirname(resolve(out));
68
54
  await fs.mkdir(parent, { recursive: true });
69
55
  // Not mkdtemp: the project keeps the permissions a plain mkdir gives it.
@@ -75,19 +61,6 @@ export async function writeTemplateProject(out, files, blocks) {
75
61
  await fs.mkdir(dirname(target), { recursive: true });
76
62
  await fs.writeFile(target, content);
77
63
  }
78
- for (const name of blocks) {
79
- const block = findBlock(name);
80
- if (!block)
81
- throw new Error(`the template names a block this CLI does not have: ${name}`);
82
- const plan = await planBlock(staging, block);
83
- if (plan.conflicts.length > 0 || plan.actions.conflicts.length > 0) {
84
- throw new Error(conflictMessage(plan));
85
- }
86
- if (plan.manual.length > 0) {
87
- throw new Error(`cannot add ${name}: ${plan.manual.join('; ')}`);
88
- }
89
- await applyBlock(plan);
90
- }
91
64
  try {
92
65
  await fs.rmdir(out);
93
66
  }
@@ -106,7 +79,7 @@ export async function writeTemplateProject(out, files, blocks) {
106
79
  export function templateNextSteps(p) {
107
80
  const app = p.target.appId;
108
81
  return [
109
- `Scaffolded ${p.name} from the ${p.template.id} template (${p.template.intro.name}) in ${p.out}, for ${app}: its Database ${p.target.databaseId} is PostgreSQL.`,
82
+ `Scaffolded ${p.name} from the ${p.template.id} template (${p.template.intro.name}, version ${shortVersion(p.template.version)}) in ${p.out}, for ${app}: its Database ${p.target.databaseId} is PostgreSQL.`,
110
83
  'SKILL.md is the template’s skill and AGENTS.md points to it: follow SKILL.md from here.',
111
84
  '',
112
85
  'Next steps (SKILL.md has the details):',
@@ -12,6 +12,15 @@ export interface ScaffoldOptions {
12
12
  }
13
13
  /** The project's files, sorted by path. */
14
14
  export declare function scaffoldProject(options: ScaffoldOptions): Array<[string, string]>;
15
+ /**
16
+ * Names a project whose app name was left as {{APP_NAME}} — the project a
17
+ * template version carries, scaffold, overlay and blocks already laid
18
+ * together (mini-app-template-registry-design.md §4) — the way
19
+ * scaffoldProject names one: the placeholder takes the name, escaped in HTML
20
+ * files, and package.json's name is the npm-valid form of it. A file given
21
+ * as bytes is not text and is kept as it is.
22
+ */
23
+ export declare function nameProject<C extends string | Uint8Array>(files: ReadonlyArray<readonly [string, C]>, name: string): Array<[string, C | string]>;
15
24
  /** An npm-valid package name from a directory name ("My App" → "my-app"). */
16
25
  export declare function packageName(name: string): string;
17
26
  /** Applies the --actions overlay: _overlay.json's remove list drops base
@@ -1 +1 @@
1
- {"version":3,"file":"apps-template.d.ts","sourceRoot":"","sources":["../../src/commands/apps-template.ts"],"names":[],"mappings":"AA+BA;mBACmB;AACnB,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,OAAO,EAAE,OAAO,CAAC;IACjB;4CACwC;IACxC,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,2CAA2C;AAC3C,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA8BjF;AAMD,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED;;;eAGe;AACf,wBAAgB,YAAY,CAC1B,KAAK,EAAE,GAAG,CAAC,MAAM,E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AC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAoB1C;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAO/D;AAED,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAIxE"}
@@ -57,6 +57,29 @@ export function scaffoldProject(options) {
57
57
  }
58
58
  return out.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
59
59
  }
60
+ /**
61
+ * Names a project whose app name was left as {{APP_NAME}} — the project a
62
+ * template version carries, scaffold, overlay and blocks already laid
63
+ * together (mini-app-template-registry-design.md §4) — the way
64
+ * scaffoldProject names one: the placeholder takes the name, escaped in HTML
65
+ * files, and package.json's name is the npm-valid form of it. A file given
66
+ * as bytes is not text and is kept as it is.
67
+ */
68
+ export function nameProject(files, name) {
69
+ return files.map(([path, content]) => {
70
+ if (typeof content !== 'string')
71
+ return [path, content];
72
+ let named = content;
73
+ if (path === 'package.json') {
74
+ const pkg = JSON.parse(content);
75
+ pkg.name = packageName(name);
76
+ named = `${JSON.stringify(pkg, null, 2)}\n`;
77
+ }
78
+ const value = path.endsWith('.html') ? escapeHtml(name) : name;
79
+ // A function, so a `$&` in the name is not a replacement pattern.
80
+ return [path, named.replace(NAME_PLACEHOLDER, () => value)];
81
+ });
82
+ }
60
83
  function escapeHtml(text) {
61
84
  return text.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
62
85
  }
@@ -1,3 +1,5 @@
1
1
  import { Command } from 'commander';
2
+ /** Accepts team_… or prll://team_…; anything else is refused before a request. */
3
+ export declare function parseTeamId(raw: string, usage: string): string;
2
4
  export declare function registerTeamCommands(program: Command): void;
3
5
  //# sourceMappingURL=teams.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/commands/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAiGpD"}
1
+ {"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/commands/teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAM9D;AAMD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAuIpD"}
@@ -1,8 +1,16 @@
1
1
  import { resolveCredentials } from '../lib/client.js';
2
- import { printJson, printError, stripPrllScheme } from '../lib/output.js';
3
- // Teams are pure permission rosters (ACL subjects for wiki/project ACLs);
4
- // server-side authorization decides who may mutate them — the CLI only
5
- // exposes the same surface the web Teams settings use.
2
+ import { printJson, printError, printProgress, stripPrllScheme } from '../lib/output.js';
3
+ /** Accepts team_… or prll://team_…; anything else is refused before a request. */
4
+ export function parseTeamId(raw, usage) {
5
+ const id = stripPrllScheme(raw.trim());
6
+ if (id.startsWith('team_'))
7
+ return id;
8
+ throw new Error(`parall teams ${usage} takes a team ID (team_… or prll://team_…), got "${raw}". List teams with: parall teams list`);
9
+ }
10
+ // Teams are permission rosters (ACL subjects for wiki/project ACLs) that can
11
+ // nest: a grant to a team reaches the members of every team below it.
12
+ // Server-side authorization decides who may mutate them — the CLI only exposes
13
+ // the same surface the web Teams settings use.
6
14
  export function registerTeamCommands(program) {
7
15
  const teams = program.command('teams').description('Manage permission teams');
8
16
  teams
@@ -32,15 +40,43 @@ export function registerTeamCommands(program) {
32
40
  printError(err);
33
41
  }
34
42
  });
43
+ teams
44
+ .command('move')
45
+ .description('Place a team under another team, or back at the top level (org admin)')
46
+ .argument('<teamId>', 'Team to move (team_... or prll://team_...)')
47
+ .option('--under <parentTeamId>', "Parent team: its grants then reach this team's members")
48
+ .option('--top', 'Move the team to the top level')
49
+ .addHelpText('after', '\nExamples:\n parall teams move team_web --under team_eng\n parall teams move team_web --top\n')
50
+ .action(async (teamArg, opts) => {
51
+ try {
52
+ const teamId = parseTeamId(teamArg, 'move');
53
+ if (Boolean(opts.under) === Boolean(opts.top)) {
54
+ throw new Error(`Pass exactly one of --under or --top, e.g. parall teams move ${teamId} --under <team_…>`);
55
+ }
56
+ const parentId = opts.under ? parseTeamId(opts.under, 'move --under') : null;
57
+ const { client, orgId } = resolveCredentials();
58
+ const team = await client.setTeamParent(orgId, teamId, parentId);
59
+ printJson(team);
60
+ printProgress(parentId
61
+ ? `Moved prll://${teamId} under prll://${parentId}`
62
+ : `Moved prll://${teamId} to the top level`);
63
+ }
64
+ catch (err) {
65
+ printError(err);
66
+ }
67
+ });
35
68
  const members = teams.command('members').description('Manage a team roster');
36
69
  members
37
70
  .command('list')
38
71
  .description('List team members')
39
72
  .argument('<teamId>', 'Team ID')
40
- .action(async (teamId) => {
73
+ .option('--include-subteams', 'Also list members of every team below it (rows carry via_team_id)')
74
+ .action(async (teamId, opts) => {
41
75
  try {
42
76
  const { client, orgId } = resolveCredentials();
43
- const result = await client.getTeamMembers(orgId, stripPrllScheme(teamId));
77
+ const result = await client.getTeamMembers(orgId, stripPrllScheme(teamId), {
78
+ includeSubteams: Boolean(opts.includeSubteams),
79
+ });
44
80
  printJson(result);
45
81
  }
46
82
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../src/commands/triggers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,sBAAsB,EACtB,OAAO,EACP,iBAAiB,EAKlB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,KAAK,wBAAwB,GAAG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,qBAAqB,CACzC,UAAU,EAAE,iBAAiB,EAC7B,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAqBtD;AAkBD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QA4fvD"}
@@ -2,23 +2,13 @@ import { chmod, readFile, writeFile } from 'node:fs/promises';
2
2
  import { readTextFileArg } from '../lib/text-input.js';
3
3
  import { resolveCredentials } from '../lib/client.js';
4
4
  import { printError, printJson, printRefHint, stripPrllScheme } from '../lib/output.js';
5
+ import { FEISHU_FILE_SUBSCRIBE_HELP, parseEnum, parseIds, resolveOwnChannelConnection, triggerCreateSource, triggerSourceKinds, } from '../lib/trigger-arguments.js';
5
6
  const connectionStatuses = ['active', 'disabled'];
6
7
  const triggerStatuses = ['active', 'paused'];
7
- const triggerSourceKinds = ['webhook', 'platform_event'];
8
8
  export const TRIGGERS_FLAG = 'external-triggers';
9
9
  function stripUndefined(obj) {
10
10
  return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
11
11
  }
12
- function parseIds(value, flag) {
13
- const ids = value
14
- .split(',')
15
- .map((s) => stripPrllScheme(s.trim()))
16
- .filter(Boolean);
17
- if (ids.length === 0) {
18
- throw new Error(`${flag} must include at least one ID.`);
19
- }
20
- return ids;
21
- }
22
12
  function parsePositiveInt(value, flag) {
23
13
  if (value === undefined)
24
14
  return undefined;
@@ -29,13 +19,6 @@ function parsePositiveInt(value, flag) {
29
19
  }
30
20
  return parsed;
31
21
  }
32
- function parseEnum(value, allowed, flag) {
33
- if (value === undefined)
34
- return undefined;
35
- if (allowed.includes(value))
36
- return value;
37
- throw new Error(`${flag} must be one of: ${allowed.join(', ')}.`);
38
- }
39
22
  function parseJsonObject(value, flag) {
40
23
  if (value === undefined)
41
24
  return undefined;
@@ -316,8 +299,8 @@ export function registerTriggerCommands(program) {
316
299
  triggers
317
300
  .command('list')
318
301
  .description('List Triggers in the organization')
319
- .option('--connection <connectionId>', 'Filter by Trigger Connection ID')
320
- .option('--source-kind <kind>', 'Filter by source kind: webhook | platform_event')
302
+ .option('--connection <connectionId>', 'Filter by Trigger Connection ID or channel connection (prll://chc_…)')
303
+ .option('--source-kind <kind>', 'Filter by source kind: webhook | platform_event | channel_event')
321
304
  .option('--creator-id <id>', 'Filter by creator user ID')
322
305
  .option('--limit <n>', 'Maximum number of triggers to return', '50')
323
306
  .option('--cursor <cursor>', 'Pagination cursor')
@@ -340,11 +323,13 @@ export function registerTriggerCommands(program) {
340
323
  triggers
341
324
  .command('create')
342
325
  .description('Create a Trigger targeting one or more agents')
343
- .option('--connection <connectionId>', 'Trigger Connection ID (webhook triggers)')
344
- .option('--source-kind <kind>', 'webhook | platform_event (default: webhook)')
345
- .option('--event-types <types>', 'Comma-separated platform event types to subscribe to (platform_event triggers; see platform-schema)')
326
+ .addHelpText('after', FEISHU_FILE_SUBSCRIBE_HELP)
327
+ .option('--connection <connectionId>', 'Trigger Connection ID (webhook), or a channel connection prll://chc_… to subscribe to its non-message events')
328
+ .option('--channel <provider>', 'Your own channel connection: feishu (subscribe to its non-message events, e.g. doc edits; for a document, see "Feishu documents and bitables" below)')
329
+ .option('--source-kind <kind>', 'webhook | platform_event | channel_event (default: channel_event for a channel connection, else webhook)')
330
+ .option('--event-types <types>', "Comma-separated event types: platform events (platform_event; see platform-schema), or the vendor's exact types for a channel connection (e.g. drive.file.edit_v1)")
346
331
  .requiredOption('--name <name>', 'Trigger name')
347
- .requiredOption('--target-ids <ids>', 'Comma-separated target agent user IDs')
332
+ .option('--target-ids <ids>', 'Comma-separated target agent user IDs (a channel connection wakes only its own agent: leave out)')
348
333
  .option('--description <text>', 'Human-facing trigger description')
349
334
  .option('--attached-to-uri <uri>', 'Attach to a prll:// resource URI')
350
335
  .option('--filter <expr>', 'CEL filter expression', 'true')
@@ -358,29 +343,10 @@ export function registerTriggerCommands(program) {
358
343
  try {
359
344
  const { client, orgId } = await resolveTriggerCommandContext();
360
345
  const agentInputTemplate = await resolveTemplate({ ...opts, required: true });
361
- const sourceKind = parseEnum(opts.sourceKind, triggerSourceKinds, '--source-kind') ??
362
- 'webhook';
363
- if (sourceKind === 'webhook' && !opts.connection) {
364
- throw new Error('--connection is required for webhook triggers');
365
- }
366
- if (sourceKind === 'platform_event' && !opts.eventTypes) {
367
- throw new Error('--event-types is required for platform_event triggers');
368
- }
369
- if (sourceKind === 'webhook' && opts.eventTypes) {
370
- throw new Error('--event-types only applies to platform_event triggers');
371
- }
372
- if (sourceKind === 'platform_event' && opts.connection) {
373
- throw new Error('--connection does not apply to platform_event triggers');
374
- }
346
+ const source = await triggerCreateSource(opts, (provider) => resolveOwnChannelConnection(client, orgId, provider));
375
347
  const data = {
376
- ...(sourceKind === 'platform_event'
377
- ? {
378
- source_kind: 'platform_event',
379
- event_types: parseIds(opts.eventTypes, '--event-types'),
380
- }
381
- : { connection_id: stripPrllScheme(opts.connection) }),
348
+ ...source,
382
349
  name: opts.name,
383
- target_agent_ids: parseIds(opts.targetIds, '--target-ids'),
384
350
  filter_expr: opts.filter,
385
351
  agent_input_template: agentInputTemplate ?? '',
386
352
  ...stripUndefined({
@@ -1 +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"}
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;AAYzC,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,OAAO,QAgN1D"}
@@ -1,3 +1,5 @@
1
+ import { retireCopiesOnRefusal, wikiMountRoot } from '../lib/wiki-copies.js';
2
+ import { resolveMountPath, resolveWikiRef } from '../lib/wiki-shared.js';
1
3
  import { resolveCredentials, resolveRuntimeContext } from '../lib/client.js';
2
4
  import { printError, printJson } from '../lib/output.js';
3
5
  import { getWikiChangesetDetail, getWikiChangesetDiff, listWikiChangesets, proposeWikiChangeset, } from '../lib/wiki.js';
@@ -27,14 +29,20 @@ export function registerWikiChangesetCommands(wiki) {
27
29
  const inheritedTitle = options.update && !options.title
28
30
  ? (await getWikiChangesetDetail(ctx, wikiRef, options.update)).changeset.title
29
31
  : undefined;
30
- const result = await proposeWikiChangeset(ctx, wikiRef, {
32
+ // Without a mount root the copy sits where the slug resolves from
33
+ // the working directory; a refusal removes that one.
34
+ const mountRoot = wikiMountRoot(ctx);
35
+ const copy = mountRoot
36
+ ? undefined
37
+ : resolveMountPath((await resolveWikiRef(ctx, wikiRef)).slug);
38
+ const result = await retireCopiesOnRefusal(() => proposeWikiChangeset(ctx, wikiRef, {
31
39
  title: options.title ?? inheritedTitle ?? '',
32
40
  message: options.message,
33
41
  changesetId: options.update,
34
42
  sourceChatId: options.chatId ?? rtx.chatId,
35
43
  sourceMessageId: options.messageId ?? rtx.triggerMessageId,
36
44
  sourceRunId: options.sessionId ?? rtx.sessionId,
37
- });
45
+ }), mountRoot, copy);
38
46
  const verb = options.update ? 'Re-proposed' : 'Created';
39
47
  if (result.auto_merged) {
40
48
  process.stderr.write(`${verb} and auto-merged changeset ${result.changeset.id}\n`);
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * `parall wiki edit`: change one page online, without a local copy
4
+ * (agent-caller-scope-design.md §4.5).
5
+ */
6
+ export declare function registerWikiEditCommand(wiki: Command): void;
7
+ //# sourceMappingURL=wiki-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wiki-edit.d.ts","sourceRoot":"","sources":["../../src/commands/wiki-edit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,QAuDpD"}
@@ -0,0 +1,50 @@
1
+ import { promises as fs } from 'node:fs';
2
+ import { resolveCredentials, resolveRuntimeContext } from '../lib/client.js';
3
+ import { printError, printJson } from '../lib/output.js';
4
+ import { editWikiFileOnline } from '../lib/wiki-edit.js';
5
+ import { isStaleBaseError } from '../lib/wiki-merge.js';
6
+ /**
7
+ * `parall wiki edit`: change one page online, without a local copy
8
+ * (agent-caller-scope-design.md §4.5).
9
+ */
10
+ export function registerWikiEditCommand(wiki) {
11
+ wiki
12
+ .command('edit')
13
+ .description('Change one page online: its whole new content, from a file, goes in as a changeset. No local copy or sync needed.')
14
+ .argument('<path>', 'Page path (e.g. docs/auth.md); a new path creates the page')
15
+ .argument('[wiki]', 'Wiki ID or slug (auto-resolves if org has one wiki)')
16
+ .requiredOption('--file <file>', 'Local file with the full new content (`-` reads stdin)')
17
+ .option('--title <title>', 'Changeset title (default: "Edit <path>")')
18
+ .option('--message <message>', 'Changeset commit message (supports prll:// refs)')
19
+ .option('--chat-id <chatId>', 'Source chat ID for approval workflow')
20
+ .option('--message-id <messageId>', 'Source message ID for approval workflow')
21
+ .option('--session-id <sessionId>', 'Source agent session ID for approval workflow')
22
+ .action(async (pagePath, wikiRef, options) => {
23
+ try {
24
+ const content = options.file === '-' ? await readStdin() : await fs.readFile(options.file);
25
+ const ctx = resolveCredentials();
26
+ const rtx = resolveRuntimeContext();
27
+ const result = await editWikiFileOnline(ctx, wikiRef, pagePath, content, {
28
+ title: options.title,
29
+ message: options.message,
30
+ sourceChatId: options.chatId ?? rtx.chatId,
31
+ sourceMessageId: options.messageId ?? rtx.triggerMessageId,
32
+ sourceRunId: options.sessionId ?? rtx.sessionId,
33
+ });
34
+ process.stderr.write(`${result.action === 'create' ? 'Created' : 'Changed'} ${result.path} in changeset ${result.changeset.id} (${result.status})\n`);
35
+ process.stderr.write(`Next: ${result.next_action}\n`);
36
+ printJson(result);
37
+ }
38
+ catch (error) {
39
+ printError(error, undefined, isStaleBaseError(error)
40
+ ? 'The page changed since you read it: read it again with `parall wiki cat <path> --remote`, redo the edit and run `parall wiki edit` again.'
41
+ : undefined);
42
+ }
43
+ });
44
+ }
45
+ async function readStdin() {
46
+ const chunks = [];
47
+ for await (const chunk of process.stdin)
48
+ chunks.push(Buffer.from(chunk));
49
+ return Buffer.concat(chunks);
50
+ }
@@ -1 +1 @@
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,QA+sBpD"}
1
+ {"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/commands/wiki.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAgtBpD"}
@@ -5,6 +5,7 @@ import { printError, printJson } from '../lib/output.js';
5
5
  import { deleteWikiFile, downloadWikiFile, uploadWikiFile } from '../lib/wiki-files.js';
6
6
  import { getAfcsDiff, getAfcsStatus, getWikiBlob, getWikiLog, getWikiOutline, getWikiSection, getWikiTree, queryWiki, requestWikiAccess, resetWikiWorkspace, listWikis, searchWiki, syncAllMounts, watchMounts, } from '../lib/wiki.js';
7
7
  import { registerWikiCommentCommands } from './wiki-comments.js';
8
+ import { registerWikiEditCommand } from './wiki-edit.js';
8
9
  export function registerWikiCommands(program) {
9
10
  const wiki = program.command('wiki').description('Parall Wiki — read, edit, and propose changes');
10
11
  // ---- CRUD ----
@@ -192,6 +193,7 @@ export function registerWikiCommands(program) {
192
193
  }
193
194
  });
194
195
  registerWikiChangesetCommands(wiki);
196
+ registerWikiEditCommand(wiki);
195
197
  // ---- Binary files (upload / get / delete) ----
196
198
  const file = wiki
197
199
  .command('file')
@@ -73,6 +73,13 @@ export declare function authorshipNextStep(details: unknown): string | undefined
73
73
  * The server sends only the action and the app; the command is the CLI's.
74
74
  */
75
75
  export declare function accessNextStep(action: string | undefined, resourceUri: string | undefined): string | undefined;
76
+ /**
77
+ * Denials an agent meets while its organization keeps agents within what the
78
+ * people they work for can see (agent-caller-scope-design.md §6). The server
79
+ * message is written to be passed on as it is; none is approvable, and
80
+ * retrying or reading the same thing another way gets the same answer.
81
+ */
82
+ export declare const CALLER_SCOPE_NEXT_STEPS: Record<string, string>;
76
83
  /** Prints the error and exits 1. `nextStep` is plain-text guidance printed
77
84
  * after the error line of an API error. */
78
85
  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,O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,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAYpB;AASD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO1D,CAAC;AAEF;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,CAqEP"}
@@ -192,6 +192,17 @@ function readApprovalId(details) {
192
192
  const id = details.approval_id;
193
193
  return typeof id === 'string' && id ? id : undefined;
194
194
  }
195
+ /**
196
+ * Denials an agent meets while its organization keeps agents within what the
197
+ * people they work for can see (agent-caller-scope-design.md §6). The server
198
+ * message is written to be passed on as it is; none is approvable, and
199
+ * retrying or reading the same thing another way gets the same answer.
200
+ */
201
+ export const CALLER_SCOPE_NEXT_STEPS = {
202
+ CALLER_CANNOT_READ: 'Not approvable, and retrying will not help: tell the person you are working for, in your own words, that you cannot read this for them.',
203
+ NO_CALLER: 'Not approvable, and retrying will not help: work nobody asked for cannot read Parall data in this organization.',
204
+ AGENT_ROUTE_CLOSED: 'Not available to agents in this organization; do not look for another way to do it.',
205
+ };
195
206
  /** Prints the error and exits 1. `nextStep` is plain-text guidance printed
196
207
  * after the error line of an API error. */
197
208
  export function printError(err, attemptedPayload, nextStep) {
@@ -244,6 +255,9 @@ export function printError(err, attemptedPayload, nextStep) {
244
255
  console.error(`${lead} First see who can approve it and pick a chat one of them is in (a direct chat with them works):\n parall approvals approvers --action ${err.action} --resource ${resource}${payloadArg} --chat ${chat}\nThen request approval there:\n parall approvals request --action ${err.action} --resource ${resource}${payloadArg} --chat ${chat} --title "..." --reason "..."`);
245
256
  }
246
257
  }
258
+ const callerScopeStep = err.code ? CALLER_SCOPE_NEXT_STEPS[err.code] : undefined;
259
+ if (callerScopeStep)
260
+ console.error(callerScopeStep);
247
261
  if (err.code === 'CARD_NOT_DELETABLE') {
248
262
  const approvalId = readApprovalId(err.extras?.details);
249
263
  console.error(`This card's request is still waiting. Withdraw the request instead:\n parall approvals cancel ${approvalId ?? '<approval_id>'}`);
@@ -0,0 +1,47 @@
1
+ /**
2
+ * `parall triggers` flags turned into request fields: ID lists, enum flags,
3
+ * and the source half of a create request (webhook connection, platform
4
+ * events, or a channel connection's non-message events).
5
+ */
6
+ import type { ChannelConnection, CreateTriggerInput } from '@parall/sdk';
7
+ export declare const triggerSourceKinds: readonly ["webhook", "platform_event", "channel_event"];
8
+ /**
9
+ * How a Feishu file's events start arriving: the help text of `parall
10
+ * triggers create`, where an agent subscribing to a document looks. The
11
+ * person's part is quoted with Feishu's own labels so the agent can relay
12
+ * it as is.
13
+ */
14
+ export declare const FEISHU_FILE_SUBSCRIBE_HELP = "\nFeishu documents and bitables (--channel feishu):\n Feishu sends a file's events only after the app subscribes to that file:\n lark-cli api POST /open-apis/drive/v1/files/<file_token>/subscribe --params '{\"file_type\":\"docx\"}'\n file_type is doc, docx, sheet, bitable or file. For a knowledge-base (wiki)\n page, subscribe the document behind it: lark-cli api GET\n /open-apis/wiki/v2/spaces/get_node --params '{\"token\":\"<page token>\"}' gives\n its obj_token and obj_type.\n\n Only the file's owner or a manager can let the app subscribe. If Feishu\n refuses, tell the person these steps with the labels as quoted, and\n subscribe again once they say it is done: open the file in Feishu, click\n \u300C\u2026\u300D at the top right, then \u300C\u66F4\u591A\u300D \u2192 \u300C\u6DFB\u52A0\u6587\u6863\u5E94\u7528\u300D, search for the app by\n its name, and set the permission to \u300C\u53EF\u7BA1\u7406\u300D \u2014 \u300C\u53EF\u9605\u8BFB\u300D or \u300C\u53EF\u7F16\u8F91\u300D is not\n enough. The app's name: lark-cli api GET /open-apis/bot/v3/info (bot.app_name).\n If Feishu still refuses after they say it is done, they may have added\n another app with the same name: ask them to remove that app from the file\n (in the same \u300C\u6DFB\u52A0\u6587\u6863\u5E94\u7528\u300D list) and add the other one, so the wrong app\n does not keep \u300C\u53EF\u7BA1\u7406\u300D.\n";
15
+ export declare function parseIds(value: string, flag: string): string[];
16
+ export declare function parseEnum<T extends string>(value: string | undefined, allowed: readonly T[], flag: string): T | undefined;
17
+ type OwnChannelConnectionClient = {
18
+ getMe(): Promise<{
19
+ id: string;
20
+ }>;
21
+ listChannelConnections(orgId: string): Promise<{
22
+ connections: ChannelConnection[];
23
+ }>;
24
+ };
25
+ /**
26
+ * The caller's own connection on a channel (`--channel feishu`): the one
27
+ * live connection of that provider bound to the caller. None or several is
28
+ * an error naming the way forward.
29
+ */
30
+ export declare function resolveOwnChannelConnection(client: OwnChannelConnectionClient, orgId: string, provider: string): Promise<string>;
31
+ type TriggerSourceOptions = {
32
+ connection?: string;
33
+ channel?: string;
34
+ sourceKind?: string;
35
+ eventTypes?: string;
36
+ targetIds?: string;
37
+ };
38
+ type TriggerSource = Pick<CreateTriggerInput, 'source_kind' | 'connection_id' | 'channel_connection_id' | 'event_types' | 'target_agent_ids'>;
39
+ /**
40
+ * The source half of a create request. A channel connection (`--connection
41
+ * prll://chc_…`, or `--channel feishu` for your own) subscribes to that
42
+ * connection's non-message events and wakes only its bound agent, so
43
+ * `--target-ids` may be left out there.
44
+ */
45
+ export declare function triggerCreateSource(opts: TriggerSourceOptions, ownChannelConnection: (provider: string) => Promise<string>): Promise<TriggerSource>;
46
+ export {};
47
+ //# sourceMappingURL=trigger-arguments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-arguments.d.ts","sourceRoot":"","sources":["../../src/lib/trigger-arguments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAqB,MAAM,aAAa,CAAC;AAG5F,eAAO,MAAM,kBAAkB,yDAA0D,CAAC;AAG1F;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,o4CAmBtC,CAAC;AAEF,wBAAgB,QAAQ,CA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