@parall/cli 1.61.0 → 1.62.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.
- package/dist/commands/clip.d.ts.map +1 -1
- package/dist/commands/clip.js +21 -18
- package/dist/commands/triggers.d.ts +19 -0
- package/dist/commands/triggers.d.ts.map +1 -0
- package/dist/commands/{external-triggers.js → triggers.js} +96 -95
- package/dist/index.js +2 -2
- package/package.json +4 -4
- package/dist/commands/external-triggers.d.ts +0 -19
- package/dist/commands/external-triggers.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../src/commands/clip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../src/commands/clip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqMpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA+iBpD"}
|
package/dist/commands/clip.js
CHANGED
|
@@ -26,12 +26,21 @@ function connectionAnnotations(conn, deviceById) {
|
|
|
26
26
|
out.target = 'desktop';
|
|
27
27
|
out.device = device.name;
|
|
28
28
|
out.device_status = device.status;
|
|
29
|
+
out.layer = device.managed_by === 'member' ? 'personal' : 'org';
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
if (!conn.alias)
|
|
32
33
|
out.hint = NO_ALIAS_HINT;
|
|
33
34
|
return out;
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The rows an exec may target. A Browser Alias keeps its own connection row
|
|
38
|
+
* on the clip it installed (`connection_kind: 'browser_alias'`); ordinary exec
|
|
39
|
+
* never resolves it, so discovery must not advertise it as a `--connection`.
|
|
40
|
+
*/
|
|
41
|
+
function execTargets(conns) {
|
|
42
|
+
return conns.filter((c) => c.connection_kind !== 'browser_alias');
|
|
43
|
+
}
|
|
35
44
|
/** Compact connection form for discovery output (`clip list`). */
|
|
36
45
|
function summarizeConnection(conn, deviceById) {
|
|
37
46
|
return {
|
|
@@ -166,7 +175,7 @@ export function registerClipCommands(program) {
|
|
|
166
175
|
};
|
|
167
176
|
try {
|
|
168
177
|
const resp = await client.listClipConnections(orgId, c.id);
|
|
169
|
-
row.connections = (resp.data ?? []).map((conn) => summarizeConnection(conn, deviceById));
|
|
178
|
+
row.connections = execTargets(resp.data ?? []).map((conn) => summarizeConnection(conn, deviceById));
|
|
170
179
|
}
|
|
171
180
|
catch (err) {
|
|
172
181
|
// One clip's broken connections read must not take down
|
|
@@ -349,7 +358,7 @@ export function registerClipCommands(program) {
|
|
|
349
358
|
// A Go nil slice serializes as `null`, not `[]` — normalize so an
|
|
350
359
|
// empty result always prints `[]` (ts/AGENTS.md § Cross-Language
|
|
351
360
|
// Contract Edge Cases).
|
|
352
|
-
const conns = resp.data ?? [];
|
|
361
|
+
const conns = execTargets(resp.data ?? []);
|
|
353
362
|
const deviceById = conns.some((c) => c.device_id)
|
|
354
363
|
? await loadDeviceIndex(client, orgId)
|
|
355
364
|
: new Map();
|
|
@@ -456,33 +465,28 @@ export function registerClipCommands(program) {
|
|
|
456
465
|
.allowExcessArguments(true)
|
|
457
466
|
.argument('[legacy...]')
|
|
458
467
|
.action(() => {
|
|
459
|
-
printError(new Error('`clip invoke` was removed with the v2 clip service. Execute with `parall clip exec <clip> <command> [json-args] --connection <ccn_|alias
|
|
468
|
+
printError(new Error('`clip invoke` was removed with the v2 clip service. Execute with `parall clip exec <clip> <command> [json-args] --connection <ccn_|alias>`; discover clips and connections with `parall clip list`.'));
|
|
460
469
|
});
|
|
461
470
|
clip
|
|
462
471
|
.command('exec')
|
|
463
|
-
.description('Execute a registry (Edge) clip command
|
|
472
|
+
.description('Execute a registry (Edge) clip command through an EXPLICIT connection: --connection <ccn_|alias> is the only target form — a desktop device, a cloud/hosted profile and an MCP server are all reached through the connection bound to the clip. Omitting it is an error')
|
|
464
473
|
.argument('<clip>', 'Clip name in the org clip registry')
|
|
465
474
|
.argument('<command>', 'Command name to execute')
|
|
466
475
|
.argument('[args]', 'Command arguments (JSON string or plain text)')
|
|
467
|
-
.option('--connection <ref>', 'Clip connection id (ccn_…) or alias — discover them with `parall clip connections <clip>`. REQUIRED
|
|
468
|
-
.option('--edge <edgeId>', 'A desktop (BYOC) device you own. Mutually exclusive with --connection')
|
|
476
|
+
.option('--connection <ref>', 'Clip connection id (ccn_…) or alias — discover them with `parall clip connections <clip>`. REQUIRED for every exec: the connection is the unit access is granted on (who may run this clip through which account), and with several accounts it names WHICH one you act as')
|
|
469
477
|
.option('--profile <name>', 'Browser profile (with --connection it may only restate the granted one)')
|
|
470
478
|
.option('--timeout <ms>', 'Execution timeout in milliseconds', '30000')
|
|
471
479
|
.option('--args-file <path>', "Read command args as JSON from a file ('-' = stdin) — shell-safe channel for quote-heavy JSON. Mutually exclusive with the [args] positional")
|
|
472
480
|
.action(async (clipName, command, args, opts) => {
|
|
473
481
|
try {
|
|
474
482
|
const { client, orgId } = resolveCredentials();
|
|
475
|
-
// Explicit
|
|
476
|
-
// server
|
|
477
|
-
//
|
|
478
|
-
//
|
|
479
|
-
//
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
printError(new Error('clip exec needs an explicit target: --connection <ccn_|alias> (cloud/MCP profiles — discover with `parall clip connections <clip>`) or --edge <edgeId> (a desktop device you own). The legacy no-flag form resolved to whichever of your own desktop devices was online; name the target instead.'));
|
|
483
|
-
}
|
|
484
|
-
if (opts?.connection && opts?.edge) {
|
|
485
|
-
printError(new Error('--connection and --edge are mutually exclusive — pass exactly one target'));
|
|
483
|
+
// Explicit connection only, refused locally before any request. The
|
|
484
|
+
// server answers the same thing (400 CONNECTION_REQUIRED): the
|
|
485
|
+
// device selectors — `--edge` and the no-flag desktop fallback — are
|
|
486
|
+
// retired, because a connection is the unit exec access is granted
|
|
487
|
+
// on, for humans and agents alike.
|
|
488
|
+
if (!opts?.connection) {
|
|
489
|
+
printError(new Error("clip exec needs --connection <ccn_|alias> — discover this clip's connections with `parall clip connections <clip>`. (`--edge` and the no-flag desktop fallback were retired: every exec, on a desktop device too, goes through the connection bound to the clip.)"));
|
|
486
490
|
}
|
|
487
491
|
let parsedArgs;
|
|
488
492
|
if (opts?.argsFile !== undefined) {
|
|
@@ -527,7 +531,6 @@ export function registerClipCommands(program) {
|
|
|
527
531
|
command,
|
|
528
532
|
args: parsedArgs,
|
|
529
533
|
connection: opts?.connection,
|
|
530
|
-
edge_id: opts?.edge,
|
|
531
534
|
profile: opts?.profile,
|
|
532
535
|
timeout: timeoutMs,
|
|
533
536
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TriggerConnection } from '@parall/sdk';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
export declare const TRIGGERS_FLAG = "external-triggers";
|
|
4
|
+
type TriggerFeatureFlagClient = {
|
|
5
|
+
getFeatureFlags(orgId: string): Promise<{
|
|
6
|
+
flags: Record<string, boolean | string | number>;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
type IngressTokenOutputOptions = {
|
|
10
|
+
tokenFile?: string;
|
|
11
|
+
showToken?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function isFeatureFlagEnabled(value: boolean | string | number | undefined): boolean;
|
|
14
|
+
export declare function requireTriggersEnabled(client: TriggerFeatureFlagClient, orgId: string): Promise<void>;
|
|
15
|
+
export declare function validateIngressTokenOutputOptions(opts: IngressTokenOutputOptions): void;
|
|
16
|
+
export declare function connectionTokenOutput(connection: TriggerConnection, opts: IngressTokenOutputOptions): Promise<TriggerConnection | Record<string, unknown>>;
|
|
17
|
+
export declare function registerTriggerCommands(program: Command): void;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=triggers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../src/commands/triggers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EAIlB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,KAAK,wBAAwB,GAAG;IAC9B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/F,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAsDF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAM1F;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,wBAAwB,EAChC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAKf;AAQD,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAKvF;AAED,wBAAsB,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,QAsZvD"}
|
|
@@ -3,7 +3,7 @@ import { resolveCredentials } from '../lib/client.js';
|
|
|
3
3
|
import { printError, printJson, printRefHint, stripPrllScheme } from '../lib/output.js';
|
|
4
4
|
const connectionStatuses = ['active', 'disabled'];
|
|
5
5
|
const triggerStatuses = ['active', 'paused'];
|
|
6
|
-
export const
|
|
6
|
+
export const TRIGGERS_FLAG = 'external-triggers';
|
|
7
7
|
function stripUndefined(obj) {
|
|
8
8
|
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
|
|
9
9
|
}
|
|
@@ -54,15 +54,15 @@ export function isFeatureFlagEnabled(value) {
|
|
|
54
54
|
(typeof value === 'string' && value !== '') ||
|
|
55
55
|
(typeof value === 'number' && value !== 0));
|
|
56
56
|
}
|
|
57
|
-
export async function
|
|
57
|
+
export async function requireTriggersEnabled(client, orgId) {
|
|
58
58
|
const res = await client.getFeatureFlags(orgId);
|
|
59
|
-
if (!isFeatureFlagEnabled(res.flags[
|
|
60
|
-
throw new Error('
|
|
59
|
+
if (!isFeatureFlagEnabled(res.flags[TRIGGERS_FLAG])) {
|
|
60
|
+
throw new Error('Triggers are disabled for this organization.');
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
async function
|
|
63
|
+
async function resolveTriggerCommandContext() {
|
|
64
64
|
const ctx = resolveCredentials();
|
|
65
|
-
await
|
|
65
|
+
await requireTriggersEnabled(ctx.client, ctx.orgId);
|
|
66
66
|
return ctx;
|
|
67
67
|
}
|
|
68
68
|
export function validateIngressTokenOutputOptions(opts) {
|
|
@@ -106,19 +106,20 @@ async function resolveTemplate(opts) {
|
|
|
106
106
|
throw new Error('Provide --template or --template-file.');
|
|
107
107
|
return undefined;
|
|
108
108
|
}
|
|
109
|
-
export function
|
|
110
|
-
const
|
|
111
|
-
.command('
|
|
112
|
-
.
|
|
113
|
-
|
|
109
|
+
export function registerTriggerCommands(program) {
|
|
110
|
+
const triggers = program
|
|
111
|
+
.command('triggers')
|
|
112
|
+
.alias('external-triggers')
|
|
113
|
+
.description('Manage Triggers (incoming platform triggers for agents)');
|
|
114
|
+
triggers
|
|
114
115
|
.command('connections')
|
|
115
|
-
.description('List
|
|
116
|
+
.description('List Trigger Connections in the organization')
|
|
116
117
|
.option('--limit <n>', 'Maximum number of connections to return', '50')
|
|
117
118
|
.option('--cursor <cursor>', 'Pagination cursor')
|
|
118
119
|
.action(async (opts) => {
|
|
119
120
|
try {
|
|
120
|
-
const { client, orgId } = await
|
|
121
|
-
const result = await client.
|
|
121
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
122
|
+
const result = await client.listTriggerConnections(orgId, stripUndefined({
|
|
122
123
|
limit: parsePositiveInt(opts.limit, '--limit'),
|
|
123
124
|
cursor: opts.cursor,
|
|
124
125
|
}));
|
|
@@ -128,17 +129,17 @@ export function registerExternalTriggerCommands(program) {
|
|
|
128
129
|
printError(err);
|
|
129
130
|
}
|
|
130
131
|
});
|
|
131
|
-
|
|
132
|
+
triggers
|
|
132
133
|
.command('create-connection')
|
|
133
|
-
.description('Create
|
|
134
|
+
.description('Create a Trigger Connection and return its incoming endpoint')
|
|
134
135
|
.requiredOption('--name <name>', 'Connection display name')
|
|
135
136
|
.option('--token-file <path>', 'Write the one-time token to a file with mode 0600')
|
|
136
137
|
.option('--show-token', 'Print the one-time token to stdout')
|
|
137
138
|
.action(async (opts) => {
|
|
138
139
|
try {
|
|
139
140
|
validateIngressTokenOutputOptions(opts);
|
|
140
|
-
const { client, orgId } = await
|
|
141
|
-
const result = await client.
|
|
141
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
142
|
+
const result = await client.createTriggerConnection(orgId, {
|
|
142
143
|
display_name: opts.name,
|
|
143
144
|
});
|
|
144
145
|
printJson(await connectionTokenOutput(result, opts));
|
|
@@ -148,29 +149,29 @@ export function registerExternalTriggerCommands(program) {
|
|
|
148
149
|
printError(err);
|
|
149
150
|
}
|
|
150
151
|
});
|
|
151
|
-
|
|
152
|
+
triggers
|
|
152
153
|
.command('connection')
|
|
153
|
-
.description('Get
|
|
154
|
-
.argument('<connectionId>', '
|
|
154
|
+
.description('Get a Trigger Connection by ID')
|
|
155
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
155
156
|
.action(async (connectionId) => {
|
|
156
157
|
try {
|
|
157
|
-
const { client, orgId } = await
|
|
158
|
-
const result = await client.
|
|
158
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
159
|
+
const result = await client.getTriggerConnection(orgId, stripPrllScheme(connectionId));
|
|
159
160
|
printJson(result);
|
|
160
161
|
}
|
|
161
162
|
catch (err) {
|
|
162
163
|
printError(err);
|
|
163
164
|
}
|
|
164
165
|
});
|
|
165
|
-
|
|
166
|
+
triggers
|
|
166
167
|
.command('update-connection')
|
|
167
|
-
.description('Update
|
|
168
|
-
.argument('<connectionId>', '
|
|
168
|
+
.description('Update a Trigger Connection')
|
|
169
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
169
170
|
.option('--name <name>', 'Connection display name')
|
|
170
171
|
.option('--status <status>', 'active | disabled')
|
|
171
172
|
.action(async (connectionId, opts) => {
|
|
172
173
|
try {
|
|
173
|
-
const { client, orgId } = await
|
|
174
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
174
175
|
const patch = stripUndefined({
|
|
175
176
|
display_name: opts.name,
|
|
176
177
|
status: parseEnum(opts.status, connectionStatuses, '--status'),
|
|
@@ -179,24 +180,24 @@ export function registerExternalTriggerCommands(program) {
|
|
|
179
180
|
printError(new Error('No fields to update. Provide at least one option.'));
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
|
-
const result = await client.
|
|
183
|
+
const result = await client.updateTriggerConnection(orgId, stripPrllScheme(connectionId), patch);
|
|
183
184
|
printJson(result);
|
|
184
185
|
}
|
|
185
186
|
catch (err) {
|
|
186
187
|
printError(err);
|
|
187
188
|
}
|
|
188
189
|
});
|
|
189
|
-
|
|
190
|
+
triggers
|
|
190
191
|
.command('regenerate-connection-token')
|
|
191
192
|
.description('Regenerate a connection ingress token; old webhook URLs stop working')
|
|
192
|
-
.argument('<connectionId>', '
|
|
193
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
193
194
|
.option('--token-file <path>', 'Write the one-time token to a file with mode 0600')
|
|
194
195
|
.option('--show-token', 'Print the one-time token to stdout')
|
|
195
196
|
.action(async (connectionId, opts) => {
|
|
196
197
|
try {
|
|
197
198
|
validateIngressTokenOutputOptions(opts);
|
|
198
|
-
const { client, orgId } = await
|
|
199
|
-
const result = await client.
|
|
199
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
200
|
+
const result = await client.regenerateTriggerConnectionIngressToken(orgId, stripPrllScheme(connectionId));
|
|
200
201
|
printJson(await connectionTokenOutput(result, opts));
|
|
201
202
|
printRefHint(result.id, 'Regenerated');
|
|
202
203
|
}
|
|
@@ -204,45 +205,45 @@ export function registerExternalTriggerCommands(program) {
|
|
|
204
205
|
printError(err);
|
|
205
206
|
}
|
|
206
207
|
});
|
|
207
|
-
|
|
208
|
+
triggers
|
|
208
209
|
.command('delete-connection')
|
|
209
|
-
.description('Archive
|
|
210
|
-
.argument('<connectionId>', '
|
|
210
|
+
.description('Archive a Trigger Connection')
|
|
211
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
211
212
|
.action(async (connectionId) => {
|
|
212
213
|
try {
|
|
213
|
-
const { client, orgId } = await
|
|
214
|
-
await client.
|
|
214
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
215
|
+
await client.deleteTriggerConnection(orgId, stripPrllScheme(connectionId));
|
|
215
216
|
printJson({ ok: true });
|
|
216
217
|
}
|
|
217
218
|
catch (err) {
|
|
218
219
|
printError(err);
|
|
219
220
|
}
|
|
220
221
|
});
|
|
221
|
-
|
|
222
|
+
triggers
|
|
222
223
|
.command('schema')
|
|
223
224
|
.description('Inspect CEL/template variables supported by a connection')
|
|
224
|
-
.argument('<connectionId>', '
|
|
225
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
225
226
|
.action(async (connectionId) => {
|
|
226
227
|
try {
|
|
227
|
-
const { client, orgId } = await
|
|
228
|
-
const result = await client.
|
|
228
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
229
|
+
const result = await client.getTriggerSchema(orgId, stripPrllScheme(connectionId));
|
|
229
230
|
printJson(result);
|
|
230
231
|
}
|
|
231
232
|
catch (err) {
|
|
232
233
|
printError(err);
|
|
233
234
|
}
|
|
234
235
|
});
|
|
235
|
-
|
|
236
|
+
triggers
|
|
236
237
|
.command('list')
|
|
237
|
-
.description('List
|
|
238
|
-
.option('--connection <connectionId>', 'Filter by
|
|
238
|
+
.description('List Triggers in the organization')
|
|
239
|
+
.option('--connection <connectionId>', 'Filter by Trigger Connection ID')
|
|
239
240
|
.option('--creator-id <id>', 'Filter by creator user ID')
|
|
240
241
|
.option('--limit <n>', 'Maximum number of triggers to return', '50')
|
|
241
242
|
.option('--cursor <cursor>', 'Pagination cursor')
|
|
242
243
|
.action(async (opts) => {
|
|
243
244
|
try {
|
|
244
|
-
const { client, orgId } = await
|
|
245
|
-
const result = await client.
|
|
245
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
246
|
+
const result = await client.listTriggers(orgId, stripUndefined({
|
|
246
247
|
connection_id: opts.connection ? stripPrllScheme(opts.connection) : undefined,
|
|
247
248
|
creator_id: opts.creatorId ? stripPrllScheme(opts.creatorId) : undefined,
|
|
248
249
|
limit: parsePositiveInt(opts.limit, '--limit'),
|
|
@@ -254,10 +255,10 @@ export function registerExternalTriggerCommands(program) {
|
|
|
254
255
|
printError(err);
|
|
255
256
|
}
|
|
256
257
|
});
|
|
257
|
-
|
|
258
|
+
triggers
|
|
258
259
|
.command('create')
|
|
259
|
-
.description('Create
|
|
260
|
-
.requiredOption('--connection <connectionId>', '
|
|
260
|
+
.description('Create a Trigger targeting one or more agents')
|
|
261
|
+
.requiredOption('--connection <connectionId>', 'Trigger Connection ID')
|
|
261
262
|
.requiredOption('--name <name>', 'Trigger name')
|
|
262
263
|
.requiredOption('--target-ids <ids>', 'Comma-separated target agent user IDs')
|
|
263
264
|
.option('--description <text>', 'Human-facing trigger description')
|
|
@@ -271,7 +272,7 @@ export function registerExternalTriggerCommands(program) {
|
|
|
271
272
|
.option('--client-context-json <json>', 'JSON object stored with the trigger')
|
|
272
273
|
.action(async (opts) => {
|
|
273
274
|
try {
|
|
274
|
-
const { client, orgId } = await
|
|
275
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
275
276
|
const agentInputTemplate = await resolveTemplate({ ...opts, required: true });
|
|
276
277
|
const data = {
|
|
277
278
|
connection_id: stripPrllScheme(opts.connection),
|
|
@@ -288,7 +289,7 @@ export function registerExternalTriggerCommands(program) {
|
|
|
288
289
|
client_context: parseJsonObject(opts.clientContextJson, '--client-context-json'),
|
|
289
290
|
}),
|
|
290
291
|
};
|
|
291
|
-
const result = await client.
|
|
292
|
+
const result = await client.createTrigger(orgId, data);
|
|
292
293
|
printJson(result);
|
|
293
294
|
printRefHint(result.id);
|
|
294
295
|
}
|
|
@@ -296,24 +297,24 @@ export function registerExternalTriggerCommands(program) {
|
|
|
296
297
|
printError(err);
|
|
297
298
|
}
|
|
298
299
|
});
|
|
299
|
-
|
|
300
|
+
triggers
|
|
300
301
|
.command('get')
|
|
301
|
-
.description('Get
|
|
302
|
-
.argument('<triggerId>', '
|
|
302
|
+
.description('Get a Trigger by ID')
|
|
303
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
303
304
|
.action(async (triggerId) => {
|
|
304
305
|
try {
|
|
305
|
-
const { client, orgId } = await
|
|
306
|
-
const result = await client.
|
|
306
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
307
|
+
const result = await client.getTrigger(orgId, stripPrllScheme(triggerId));
|
|
307
308
|
printJson(result);
|
|
308
309
|
}
|
|
309
310
|
catch (err) {
|
|
310
311
|
printError(err);
|
|
311
312
|
}
|
|
312
313
|
});
|
|
313
|
-
|
|
314
|
+
triggers
|
|
314
315
|
.command('update')
|
|
315
|
-
.description('Update
|
|
316
|
-
.argument('<triggerId>', '
|
|
316
|
+
.description('Update a Trigger')
|
|
317
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
317
318
|
.option('--name <name>', 'Trigger name')
|
|
318
319
|
.option('--description <text>', 'Human-facing trigger description')
|
|
319
320
|
.option('--status <status>', 'active | paused')
|
|
@@ -331,7 +332,7 @@ export function registerExternalTriggerCommands(program) {
|
|
|
331
332
|
.option('--client-context-json <json>', 'JSON object stored with the trigger')
|
|
332
333
|
.action(async (triggerId, opts) => {
|
|
333
334
|
try {
|
|
334
|
-
const { client, orgId } = await
|
|
335
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
335
336
|
const conflicts = [
|
|
336
337
|
[opts.attachedToUri, opts.clearAttachedTo, '--attached-to-uri', '--clear-attached-to'],
|
|
337
338
|
[opts.maxRuns, opts.clearMaxRuns, '--max-runs', '--clear-max-runs'],
|
|
@@ -364,21 +365,21 @@ export function registerExternalTriggerCommands(program) {
|
|
|
364
365
|
printError(new Error('No fields to update. Provide at least one option.'));
|
|
365
366
|
return;
|
|
366
367
|
}
|
|
367
|
-
const result = await client.
|
|
368
|
+
const result = await client.updateTrigger(orgId, stripPrllScheme(triggerId), patch);
|
|
368
369
|
printJson(result);
|
|
369
370
|
}
|
|
370
371
|
catch (err) {
|
|
371
372
|
printError(err);
|
|
372
373
|
}
|
|
373
374
|
});
|
|
374
|
-
|
|
375
|
+
triggers
|
|
375
376
|
.command('pause')
|
|
376
|
-
.description('Pause
|
|
377
|
-
.argument('<triggerId>', '
|
|
377
|
+
.description('Pause a Trigger')
|
|
378
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
378
379
|
.action(async (triggerId) => {
|
|
379
380
|
try {
|
|
380
|
-
const { client, orgId } = await
|
|
381
|
-
const result = await client.
|
|
381
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
382
|
+
const result = await client.updateTrigger(orgId, stripPrllScheme(triggerId), {
|
|
382
383
|
status: 'paused',
|
|
383
384
|
});
|
|
384
385
|
printJson(result);
|
|
@@ -387,14 +388,14 @@ export function registerExternalTriggerCommands(program) {
|
|
|
387
388
|
printError(err);
|
|
388
389
|
}
|
|
389
390
|
});
|
|
390
|
-
|
|
391
|
+
triggers
|
|
391
392
|
.command('resume')
|
|
392
|
-
.description('Resume a paused
|
|
393
|
-
.argument('<triggerId>', '
|
|
393
|
+
.description('Resume a paused Trigger')
|
|
394
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
394
395
|
.action(async (triggerId) => {
|
|
395
396
|
try {
|
|
396
|
-
const { client, orgId } = await
|
|
397
|
-
const result = await client.
|
|
397
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
398
|
+
const result = await client.updateTrigger(orgId, stripPrllScheme(triggerId), {
|
|
398
399
|
status: 'active',
|
|
399
400
|
});
|
|
400
401
|
printJson(result);
|
|
@@ -403,30 +404,30 @@ export function registerExternalTriggerCommands(program) {
|
|
|
403
404
|
printError(err);
|
|
404
405
|
}
|
|
405
406
|
});
|
|
406
|
-
|
|
407
|
+
triggers
|
|
407
408
|
.command('delete')
|
|
408
|
-
.description('Archive
|
|
409
|
-
.argument('<triggerId>', '
|
|
409
|
+
.description('Archive a Trigger')
|
|
410
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
410
411
|
.action(async (triggerId) => {
|
|
411
412
|
try {
|
|
412
|
-
const { client, orgId } = await
|
|
413
|
-
await client.
|
|
413
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
414
|
+
await client.deleteTrigger(orgId, stripPrllScheme(triggerId));
|
|
414
415
|
printJson({ ok: true });
|
|
415
416
|
}
|
|
416
417
|
catch (err) {
|
|
417
418
|
printError(err);
|
|
418
419
|
}
|
|
419
420
|
});
|
|
420
|
-
|
|
421
|
+
triggers
|
|
421
422
|
.command('runs')
|
|
422
|
-
.description('List run history for
|
|
423
|
-
.argument('<triggerId>', '
|
|
423
|
+
.description('List run history for a Trigger')
|
|
424
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
424
425
|
.option('--limit <n>', 'Maximum number of runs to return', '50')
|
|
425
426
|
.option('--cursor <cursor>', 'Pagination cursor')
|
|
426
427
|
.action(async (triggerId, opts) => {
|
|
427
428
|
try {
|
|
428
|
-
const { client, orgId } = await
|
|
429
|
-
const result = await client.
|
|
429
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
430
|
+
const result = await client.listTriggerRuns(orgId, stripUndefined({
|
|
430
431
|
trigger_id: stripPrllScheme(triggerId),
|
|
431
432
|
limit: parsePositiveInt(opts.limit, '--limit'),
|
|
432
433
|
cursor: opts.cursor,
|
|
@@ -437,30 +438,30 @@ export function registerExternalTriggerCommands(program) {
|
|
|
437
438
|
printError(err);
|
|
438
439
|
}
|
|
439
440
|
});
|
|
440
|
-
|
|
441
|
+
triggers
|
|
441
442
|
.command('run')
|
|
442
|
-
.description('Get a single
|
|
443
|
-
.argument('<runId>', '
|
|
443
|
+
.description('Get a single Trigger run')
|
|
444
|
+
.argument('<runId>', 'Trigger Run ID (xrn_...)')
|
|
444
445
|
.action(async (runId) => {
|
|
445
446
|
try {
|
|
446
|
-
const { client, orgId } = await
|
|
447
|
-
const result = await client.
|
|
447
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
448
|
+
const result = await client.getTriggerRun(orgId, stripPrllScheme(runId));
|
|
448
449
|
printJson(result);
|
|
449
450
|
}
|
|
450
451
|
catch (err) {
|
|
451
452
|
printError(err);
|
|
452
453
|
}
|
|
453
454
|
});
|
|
454
|
-
|
|
455
|
+
triggers
|
|
455
456
|
.command('events')
|
|
456
|
-
.description('List incoming events received by
|
|
457
|
-
.option('--connection <connectionId>', 'Filter by
|
|
457
|
+
.description('List incoming events received by Trigger Connections')
|
|
458
|
+
.option('--connection <connectionId>', 'Filter by Trigger Connection ID')
|
|
458
459
|
.option('--limit <n>', 'Maximum number of events to return', '50')
|
|
459
460
|
.option('--cursor <cursor>', 'Pagination cursor')
|
|
460
461
|
.action(async (opts) => {
|
|
461
462
|
try {
|
|
462
|
-
const { client, orgId } = await
|
|
463
|
-
const result = await client.
|
|
463
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
464
|
+
const result = await client.listTriggerIngressEvents(orgId, stripUndefined({
|
|
464
465
|
connection_id: opts.connection ? stripPrllScheme(opts.connection) : undefined,
|
|
465
466
|
limit: parsePositiveInt(opts.limit, '--limit'),
|
|
466
467
|
cursor: opts.cursor,
|
|
@@ -471,14 +472,14 @@ export function registerExternalTriggerCommands(program) {
|
|
|
471
472
|
printError(err);
|
|
472
473
|
}
|
|
473
474
|
});
|
|
474
|
-
|
|
475
|
+
triggers
|
|
475
476
|
.command('event')
|
|
476
477
|
.description('Get a single incoming event by ID')
|
|
477
|
-
.argument('<eventId>', '
|
|
478
|
+
.argument('<eventId>', 'Trigger Event ID (xin_...)')
|
|
478
479
|
.action(async (eventId) => {
|
|
479
480
|
try {
|
|
480
|
-
const { client, orgId } = await
|
|
481
|
-
const result = await client.
|
|
481
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
482
|
+
const result = await client.getTriggerIngressEvent(orgId, stripPrllScheme(eventId));
|
|
482
483
|
printJson(result);
|
|
483
484
|
}
|
|
484
485
|
catch (err) {
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { registerProjectCommands } from './commands/projects.js';
|
|
|
13
13
|
import { registerProfileCommands } from './commands/profile.js';
|
|
14
14
|
import { registerTeamCommands } from './commands/teams.js';
|
|
15
15
|
import { registerScheduleCommands } from './commands/schedules.js';
|
|
16
|
-
import {
|
|
16
|
+
import { registerTriggerCommands } from './commands/triggers.js';
|
|
17
17
|
import { registerUserCommands } from './commands/users.js';
|
|
18
18
|
import { registerWikiCommands } from './commands/wiki.js';
|
|
19
19
|
import { registerMcpCommands } from './commands/mcp.js';
|
|
@@ -47,7 +47,7 @@ registerProjectCommands(program);
|
|
|
47
47
|
registerProfileCommands(program);
|
|
48
48
|
registerTeamCommands(program);
|
|
49
49
|
registerScheduleCommands(program);
|
|
50
|
-
|
|
50
|
+
registerTriggerCommands(program);
|
|
51
51
|
registerUserCommands(program);
|
|
52
52
|
registerWikiCommands(program);
|
|
53
53
|
registerMcpCommands(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"description": "CLI client for Parall — universal agent & human access to Parall API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"js-yaml": "^4.1.0",
|
|
38
38
|
"node-diff3": "3.2.1",
|
|
39
39
|
"zod": "^4.3.6",
|
|
40
|
-
"@parall/agent-core": "1.
|
|
41
|
-
"@parall/sdk": "1.
|
|
40
|
+
"@parall/agent-core": "1.62.0",
|
|
41
|
+
"@parall/sdk": "1.62.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/js-yaml": "^4.0.9",
|
|
45
45
|
"@types/node": "^22.0.0",
|
|
46
46
|
"typescript": "^5.7.0",
|
|
47
|
-
"@parall/agent-core": "1.
|
|
47
|
+
"@parall/agent-core": "1.62.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsc",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ExternalConnection } from '@parall/sdk';
|
|
2
|
-
import type { Command } from 'commander';
|
|
3
|
-
export declare const EXTERNAL_TRIGGERS_FLAG = "external-triggers";
|
|
4
|
-
type ExternalTriggerFeatureFlagClient = {
|
|
5
|
-
getFeatureFlags(orgId: string): Promise<{
|
|
6
|
-
flags: Record<string, boolean | string | number>;
|
|
7
|
-
}>;
|
|
8
|
-
};
|
|
9
|
-
type IngressTokenOutputOptions = {
|
|
10
|
-
tokenFile?: string;
|
|
11
|
-
showToken?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export declare function isFeatureFlagEnabled(value: boolean | string | number | undefined): boolean;
|
|
14
|
-
export declare function requireExternalTriggersEnabled(client: ExternalTriggerFeatureFlagClient, orgId: string): Promise<void>;
|
|
15
|
-
export declare function validateIngressTokenOutputOptions(opts: IngressTokenOutputOptions): void;
|
|
16
|
-
export declare function connectionTokenOutput(connection: ExternalConnection, opts: IngressTokenOutputOptions): Promise<ExternalConnection | Record<string, unknown>>;
|
|
17
|
-
export declare function registerExternalTriggerCommands(program: Command): void;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=external-triggers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"external-triggers.d.ts","sourceRoot":"","sources":["../../src/commands/external-triggers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAInB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAE1D,KAAK,gCAAgC,GAAG;IACtC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/F,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAsDF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAM1F;AAED,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,gCAAgC,EACxC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAKf;AAQD,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAKvF;AAED,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,kBAAkB,EAC9B,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAqBvD;AAkBD,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,OAAO,QAqZ/D"}
|