@actiondock/core 2.4.1 → 2.5.1

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/app/app.js CHANGED
@@ -207,6 +207,13 @@ export class DefaultActionDockApp {
207
207
  }
208
208
  // 3. 读取内存显式注入的 Action 定义
209
209
  for (const [id, act] of this.actionsMap) {
210
+ // 若为当前包完全限定名别名(例如 "pkgId/actionId"),跳过以防与短名 action 重复
211
+ if (id.startsWith(`${this.packageId}/`)) {
212
+ const shortId = id.slice(this.packageId.length + 1);
213
+ if (this.actionsMap.has(shortId) || map.has(shortId)) {
214
+ continue;
215
+ }
216
+ }
210
217
  const existing = map.get(id);
211
218
  const actObj = act;
212
219
  map.set(id, {
@@ -3,13 +3,27 @@ import type { RemoteHealthResult } from "./types.js";
3
3
  /**
4
4
  * 校验在携带认证 Token 时传输层协议是否安全。
5
5
  * 若请求携带认证 Token 且目标为非本地回环的明文 http://,默认报错拒绝。
6
- * 可通过 allowInsecureHttp 选项、ACTIONDOCK_ALLOW_INSECURE_HTTP 环境变量或 --allow-insecure-http 命令行参数豁免。
6
+ * 可通过 allowInsecureHttp 选项、insecure 选项、环境变量或命令行参数豁免。
7
7
  */
8
- export declare function assertSecureTransport(serverUrl: string, token?: string, allowInsecureHttp?: boolean): void;
8
+ export declare function assertSecureTransport(serverUrl: string, token?: string, allowInsecureHttpOrOptions?: boolean | {
9
+ allowInsecureHttp?: boolean;
10
+ insecure?: boolean;
11
+ }, insecureArg?: boolean): void;
12
+ /**
13
+ * 远端请求通用控制选项。
14
+ */
15
+ export interface RemoteClientRequestOptions {
16
+ /** 是否允许通过非回环明文 HTTP 发送认证 Token */
17
+ allowInsecureHttp?: boolean;
18
+ /** 是否跳过服务端 TLS 证书合法性校验 */
19
+ insecure?: boolean;
20
+ /** 自定义底层 HTTP 调度器(平台中立) */
21
+ dispatcher?: unknown;
22
+ }
9
23
  /**
10
24
  * 调用远端 ActionDock 服务端执行 Action 时的选项参数。
11
25
  */
12
- export interface RemoteExecuteOptions {
26
+ export interface RemoteExecuteOptions extends RemoteClientRequestOptions {
13
27
  /** 动态配置覆盖 */
14
28
  configOverrides?: Record<string, unknown>;
15
29
  /** 鉴权 Bearer Token */
@@ -22,8 +36,6 @@ export interface RemoteExecuteOptions {
22
36
  requestId?: string;
23
37
  /** 是否异步触发(202 Accepted 立即返回 runId) */
24
38
  async?: boolean;
25
- /** 是否允许通过非回环明文 HTTP 发送认证 Token */
26
- allowInsecureHttp?: boolean;
27
39
  }
28
40
  /**
29
41
  * 远端 Action 执行结果信封对象。
@@ -37,62 +49,47 @@ export type RemoteExecutionResult<T = unknown> = ExecutionResult<T> & {
37
49
  * @param serverUrl 目标服务端地址
38
50
  * @param token 鉴权 Token(可选)
39
51
  * @param timeoutMs 探测超时时间(默认 5000ms)
52
+ * @param options 传输与安全控制选项
40
53
  */
41
- export declare function checkRemoteHealth(serverUrl: string, token?: string, timeoutMs?: number, options?: {
42
- allowInsecureHttp?: boolean;
43
- }): Promise<RemoteHealthResult>;
54
+ export declare function checkRemoteHealth(serverUrl: string, token?: string, timeoutMs?: number, options?: RemoteClientRequestOptions): Promise<RemoteHealthResult>;
44
55
  export declare function executeRemoteAction<T = unknown>(serverUrl: string, actionId: string, input?: unknown, configOverridesOrOptions?: Record<string, unknown> | RemoteExecuteOptions, tokenArg?: string): Promise<RemoteExecutionResult<T>>;
45
- export declare function fetchRemoteRun(serverUrl: string, runId: string, token?: string, options?: {
46
- allowInsecureHttp?: boolean;
47
- }): Promise<RunRecord>;
48
- export declare function cancelRemoteRun(serverUrl: string, runId: string, token?: string, reason?: string, options?: {
49
- allowInsecureHttp?: boolean;
50
- }): Promise<{
56
+ export declare function fetchRemoteRun(serverUrl: string, runId: string, token?: string, options?: RemoteClientRequestOptions): Promise<RunRecord>;
57
+ export declare function cancelRemoteRun(serverUrl: string, runId: string, token?: string, reason?: string, options?: RemoteClientRequestOptions): Promise<{
51
58
  ok: boolean;
52
59
  runId: string;
53
60
  status: string;
54
61
  }>;
55
- export declare function fetchRemoteActions(serverUrl: string, token?: string, intent?: string, options?: {
56
- allowInsecureHttp?: boolean;
57
- }): Promise<Array<{
62
+ export declare function fetchRemoteActions(serverUrl: string, token?: string, intent?: string, options?: RemoteClientRequestOptions): Promise<Array<{
58
63
  id: string;
59
64
  description: string;
60
65
  packageId?: string;
61
66
  }>>;
62
- export declare function fetchRemoteActionShow(serverUrl: string, actionId: string, token?: string, options?: {
63
- allowInsecureHttp?: boolean;
64
- }): Promise<any>;
67
+ export declare function fetchRemoteActionShow(serverUrl: string, actionId: string, token?: string, options?: RemoteClientRequestOptions): Promise<any>;
65
68
  export declare function fetchRemoteInfo(serverUrl: string, token?: string, options?: {
66
69
  intent?: string;
67
70
  package?: string;
68
71
  tree?: boolean;
69
- allowInsecureHttp?: boolean;
70
- }): Promise<any>;
71
- export declare function fetchRemoteDoctor(serverUrl: string, token?: string, targetPackage?: string, options?: {
72
- allowInsecureHttp?: boolean;
73
- }): Promise<any>;
72
+ } & RemoteClientRequestOptions): Promise<any>;
73
+ export declare function fetchRemoteDoctor(serverUrl: string, token?: string, targetPackage?: string, options?: RemoteClientRequestOptions): Promise<any>;
74
74
  export declare function fetchRemotePlaybooks(serverUrl: string, token?: string, options?: {
75
75
  intent?: string;
76
76
  package?: string;
77
- allowInsecureHttp?: boolean;
78
- }): Promise<Array<{
77
+ } & RemoteClientRequestOptions): Promise<Array<{
79
78
  id: string;
80
79
  description: string;
81
80
  actions: string[];
82
81
  packageId: string;
83
82
  filePath: string;
84
83
  }>>;
85
- export declare function fetchRemotePlaybookShow(serverUrl: string, playbookId: string, token?: string, options?: {
86
- allowInsecureHttp?: boolean;
87
- }): Promise<any>;
84
+ export declare function fetchRemotePlaybookShow(playbookId: string, token?: string, options?: RemoteClientRequestOptions): Promise<any>;
85
+ export declare function fetchRemotePlaybookShow(serverUrl: string, playbookId: string, token?: string, options?: RemoteClientRequestOptions): Promise<any>;
88
86
  export declare function fetchRemoteRuns(serverUrl: string, token?: string, options?: {
89
87
  status?: string;
90
88
  actionId?: string;
91
89
  packageId?: string;
92
90
  intent?: string;
93
91
  limit?: number;
94
- allowInsecureHttp?: boolean;
95
- }): Promise<{
92
+ } & RemoteClientRequestOptions): Promise<{
96
93
  ok: boolean;
97
94
  total: number;
98
95
  items: RunRecord[];
@@ -101,8 +98,7 @@ export declare function clearRemoteRuns(serverUrl: string, token?: string, optio
101
98
  packageId?: string;
102
99
  actionId?: string;
103
100
  status?: string;
104
- allowInsecureHttp?: boolean;
105
- }): Promise<{
101
+ } & RemoteClientRequestOptions): Promise<{
106
102
  ok: boolean;
107
103
  clearedCount: number;
108
104
  }>;
@@ -111,8 +107,7 @@ export declare function fetchRemoteStateList(serverUrl: string, token?: string,
111
107
  action?: string;
112
108
  namespace?: string;
113
109
  prefix?: string;
114
- allowInsecureHttp?: boolean;
115
- }): Promise<{
110
+ } & RemoteClientRequestOptions): Promise<{
116
111
  ok: boolean;
117
112
  packageId: string;
118
113
  keys: string[];
@@ -121,42 +116,30 @@ export declare function getRemoteStateKey(serverUrl: string, key: string, token?
121
116
  package?: string;
122
117
  action?: string;
123
118
  namespace?: string;
124
- allowInsecureHttp?: boolean;
125
- }): Promise<any>;
119
+ } & RemoteClientRequestOptions): Promise<any>;
126
120
  export declare function setRemoteStateKey(serverUrl: string, key: string, value: unknown, token?: string, options?: {
127
121
  package?: string;
128
122
  action?: string;
129
123
  namespace?: string;
130
124
  ttl?: number;
131
- allowInsecureHttp?: boolean;
132
- }): Promise<any>;
125
+ } & RemoteClientRequestOptions): Promise<any>;
133
126
  export declare function deleteRemoteStateKey(serverUrl: string, key: string, token?: string, options?: {
134
127
  package?: string;
135
128
  action?: string;
136
129
  namespace?: string;
137
- allowInsecureHttp?: boolean;
138
- }): Promise<any>;
130
+ } & RemoteClientRequestOptions): Promise<any>;
139
131
  export declare function clearRemoteState(serverUrl: string, token?: string, options?: {
140
132
  package?: string;
141
133
  action?: string;
142
134
  namespace?: string;
143
135
  prefix?: string;
144
136
  all?: boolean;
145
- allowInsecureHttp?: boolean;
146
- }): Promise<{
137
+ } & RemoteClientRequestOptions): Promise<{
147
138
  ok: boolean;
148
139
  packageId: string;
149
140
  clearedCount: number;
150
141
  }>;
151
- export declare function fetchRemoteConfig(serverUrl: string, token?: string, packageId?: string, options?: {
152
- allowInsecureHttp?: boolean;
153
- }): Promise<any>;
154
- export declare function setRemoteConfig(serverUrl: string, key: string, value: unknown, token?: string, packageId?: string, options?: {
155
- allowInsecureHttp?: boolean;
156
- }): Promise<any>;
157
- export declare function deleteRemoteConfig(serverUrl: string, key: string, token?: string, packageId?: string, options?: {
158
- allowInsecureHttp?: boolean;
159
- }): Promise<any>;
160
- export declare function fetchRemoteConfigEnv(serverUrl: string, token?: string, packageId?: string, options?: {
161
- allowInsecureHttp?: boolean;
162
- }): Promise<any>;
142
+ export declare function fetchRemoteConfig(serverUrl: string, token?: string, packageId?: string, options?: RemoteClientRequestOptions): Promise<any>;
143
+ export declare function setRemoteConfig(serverUrl: string, key: string, value: unknown, token?: string, packageId?: string, options?: RemoteClientRequestOptions): Promise<any>;
144
+ export declare function deleteRemoteConfig(serverUrl: string, key: string, token?: string, packageId?: string, options?: RemoteClientRequestOptions): Promise<any>;
145
+ export declare function fetchRemoteConfigEnv(serverUrl: string, token?: string, packageId?: string, options?: RemoteClientRequestOptions): Promise<any>;
@@ -2,20 +2,33 @@ import { randomUUID } from "node:crypto";
2
2
  import { normalizeServerUrl } from "./manager.js";
3
3
  import { ACTION_CANCELLED, ACTION_TIMEOUT, NETWORK_ERROR } from "../errors.js";
4
4
  import { isLoopbackHost } from "../server/security.js";
5
+ import { getInsecureDispatcher } from "../server/dispatcher.js";
5
6
  /**
6
7
  * 校验在携带认证 Token 时传输层协议是否安全。
7
8
  * 若请求携带认证 Token 且目标为非本地回环的明文 http://,默认报错拒绝。
8
- * 可通过 allowInsecureHttp 选项、ACTIONDOCK_ALLOW_INSECURE_HTTP 环境变量或 --allow-insecure-http 命令行参数豁免。
9
+ * 可通过 allowInsecureHttp 选项、insecure 选项、环境变量或命令行参数豁免。
9
10
  */
10
- export function assertSecureTransport(serverUrl, token, allowInsecureHttp) {
11
+ export function assertSecureTransport(serverUrl, token, allowInsecureHttpOrOptions, insecureArg) {
11
12
  if (!token || !token.trim()) {
12
13
  return;
13
14
  }
14
- const allow = allowInsecureHttp === true ||
15
+ let allowInsecureHttp = false;
16
+ let insecure = false;
17
+ if (typeof allowInsecureHttpOrOptions === "object" && allowInsecureHttpOrOptions !== null) {
18
+ allowInsecureHttp = Boolean(allowInsecureHttpOrOptions.allowInsecureHttp);
19
+ insecure = Boolean(allowInsecureHttpOrOptions.insecure);
20
+ }
21
+ else {
22
+ allowInsecureHttp = Boolean(allowInsecureHttpOrOptions);
23
+ insecure = Boolean(insecureArg);
24
+ }
25
+ const allow = allowInsecureHttp ||
26
+ insecure ||
15
27
  (typeof process !== "undefined" &&
16
28
  (process.env?.ACTIONDOCK_ALLOW_INSECURE_HTTP === "true" ||
17
29
  process.env?.ACTIONDOCK_ALLOW_INSECURE_HTTP === "1" ||
18
- process.argv?.includes("--allow-insecure-http")));
30
+ process.env?.ACTIONDOCK_INSECURE === "true" ||
31
+ process.env?.ACTIONDOCK_INSECURE === "1"));
19
32
  if (allow) {
20
33
  return;
21
34
  }
@@ -51,28 +64,35 @@ function buildHeaders(token) {
51
64
  * @param serverUrl 目标服务端地址
52
65
  * @param token 鉴权 Token(可选)
53
66
  * @param timeoutMs 探测超时时间(默认 5000ms)
67
+ * @param options 传输与安全控制选项
54
68
  */
55
69
  export async function checkRemoteHealth(serverUrl, token, timeoutMs = 5000, options) {
56
70
  const startTime = Date.now();
57
71
  let timer;
58
72
  try {
59
- assertSecureTransport(serverUrl, token, options?.allowInsecureHttp);
73
+ assertSecureTransport(serverUrl, token, {
74
+ allowInsecureHttp: options?.allowInsecureHttp,
75
+ insecure: options?.insecure,
76
+ });
60
77
  const base = normalizeServerUrl(serverUrl);
61
78
  const v2Url = `${base}/api/v2/health`;
62
79
  const controller = new AbortController();
63
80
  timer = setTimeout(() => controller.abort(), timeoutMs);
64
- let res = await fetch(v2Url, {
81
+ const fetchInit = {
65
82
  method: "GET",
66
83
  headers: buildHeaders(token),
67
84
  signal: controller.signal,
68
- });
85
+ };
86
+ if (options?.dispatcher) {
87
+ fetchInit.dispatcher = options.dispatcher;
88
+ }
89
+ else if (options?.insecure) {
90
+ fetchInit.dispatcher = getInsecureDispatcher();
91
+ }
92
+ let res = await fetch(v2Url, fetchInit);
69
93
  if (res.status === 404) {
70
94
  try {
71
- const v1Res = await fetch(`${base}/api/v1/health`, {
72
- method: "GET",
73
- headers: buildHeaders(token),
74
- signal: controller.signal,
75
- });
95
+ const v1Res = await fetch(`${base}/api/v1/health`, fetchInit);
76
96
  if (v1Res.ok || v1Res.status !== 404) {
77
97
  res = v1Res;
78
98
  }
@@ -120,6 +140,8 @@ export async function executeRemoteAction(serverUrl, actionId, input = {}, confi
120
140
  let isAsync = false;
121
141
  let requestId;
122
142
  let allowInsecureHttp;
143
+ let insecure;
144
+ let dispatcher;
123
145
  if (configOverridesOrOptions && typeof configOverridesOrOptions === "object") {
124
146
  if ("token" in configOverridesOrOptions ||
125
147
  "timeoutMs" in configOverridesOrOptions ||
@@ -127,7 +149,9 @@ export async function executeRemoteAction(serverUrl, actionId, input = {}, confi
127
149
  "async" in configOverridesOrOptions ||
128
150
  "requestId" in configOverridesOrOptions ||
129
151
  "configOverrides" in configOverridesOrOptions ||
130
- "allowInsecureHttp" in configOverridesOrOptions) {
152
+ "allowInsecureHttp" in configOverridesOrOptions ||
153
+ "insecure" in configOverridesOrOptions ||
154
+ "dispatcher" in configOverridesOrOptions) {
131
155
  const opts = configOverridesOrOptions;
132
156
  configOverrides = opts.configOverrides;
133
157
  token = opts.token ?? tokenArg;
@@ -136,12 +160,14 @@ export async function executeRemoteAction(serverUrl, actionId, input = {}, confi
136
160
  isAsync = Boolean(opts.async);
137
161
  requestId = opts.requestId;
138
162
  allowInsecureHttp = opts.allowInsecureHttp;
163
+ insecure = opts.insecure;
164
+ dispatcher = opts.dispatcher;
139
165
  }
140
166
  else {
141
167
  configOverrides = configOverridesOrOptions;
142
168
  }
143
169
  }
144
- assertSecureTransport(serverUrl, token, allowInsecureHttp);
170
+ assertSecureTransport(serverUrl, token, { allowInsecureHttp, insecure });
145
171
  const base = normalizeServerUrl(serverUrl);
146
172
  const v2Url = `${base}/api/v2/actions/${encodeURIComponent(actionId)}/run`;
147
173
  const executionPayload = {};
@@ -187,22 +213,24 @@ export async function executeRemoteAction(serverUrl, actionId, input = {}, confi
187
213
  controller.abort();
188
214
  }, timeoutMs);
189
215
  }
216
+ const fetchInit = {
217
+ method: "POST",
218
+ headers,
219
+ body: reqBody,
220
+ signal: controller.signal,
221
+ };
222
+ if (dispatcher) {
223
+ fetchInit.dispatcher = dispatcher;
224
+ }
225
+ else if (insecure) {
226
+ fetchInit.dispatcher = getInsecureDispatcher();
227
+ }
190
228
  let res;
191
229
  try {
192
- res = await fetch(v2Url, {
193
- method: "POST",
194
- headers,
195
- body: reqBody,
196
- signal: controller.signal,
197
- });
230
+ res = await fetch(v2Url, fetchInit);
198
231
  if (res.status === 404) {
199
232
  try {
200
- const v1Res = await fetch(`${base}/api/v1/actions/${encodeURIComponent(actionId)}/run`, {
201
- method: "POST",
202
- headers,
203
- body: reqBody,
204
- signal: controller.signal,
205
- });
233
+ const v1Res = await fetch(`${base}/api/v1/actions/${encodeURIComponent(actionId)}/run`, fetchInit);
206
234
  if (v1Res.ok || v1Res.status !== 404) {
207
235
  res = v1Res;
208
236
  }
@@ -273,7 +301,10 @@ export async function executeRemoteAction(serverUrl, actionId, input = {}, confi
273
301
  }
274
302
  }
275
303
  async function fetchRemoteJson(serverUrl, path, token, options = {}) {
276
- assertSecureTransport(serverUrl, token, options.allowInsecureHttp);
304
+ assertSecureTransport(serverUrl, token, {
305
+ allowInsecureHttp: options.allowInsecureHttp,
306
+ insecure: options.insecure,
307
+ });
277
308
  const base = normalizeServerUrl(serverUrl);
278
309
  const normalizedPath = path.startsWith("/") ? path : `/${path}`;
279
310
  const url = `${base}${normalizedPath}`;
@@ -284,19 +315,22 @@ async function fetchRemoteJson(serverUrl, path, token, options = {}) {
284
315
  if (options.body !== undefined) {
285
316
  headers["Content-Type"] = "application/json";
286
317
  }
287
- let res = await fetch(url, {
318
+ const fetchInit = {
288
319
  method,
289
320
  headers,
290
321
  body: options.body !== undefined ? JSON.stringify(options.body) : undefined,
291
- });
322
+ };
323
+ if (options.dispatcher) {
324
+ fetchInit.dispatcher = options.dispatcher;
325
+ }
326
+ else if (options.insecure) {
327
+ fetchInit.dispatcher = getInsecureDispatcher();
328
+ }
329
+ let res = await fetch(url, fetchInit);
292
330
  if (res.status === 404 && normalizedPath.startsWith("/api/v2/")) {
293
331
  const v1Path = normalizedPath.replace("/api/v2/", "/api/v1/");
294
332
  try {
295
- const v1Res = await fetch(`${base}${v1Path}`, {
296
- method,
297
- headers,
298
- body: options.body !== undefined ? JSON.stringify(options.body) : undefined,
299
- });
333
+ const v1Res = await fetch(`${base}${v1Path}`, fetchInit);
300
334
  if (v1Res.ok || v1Res.status !== 404) {
301
335
  res = v1Res;
302
336
  }
@@ -322,6 +356,8 @@ export async function fetchRemoteRun(serverUrl, runId, token, options) {
322
356
  return fetchRemoteJson(serverUrl, `/api/v2/runs/${encodeURIComponent(runId)}`, token, {
323
357
  errorPrefix: `Failed to fetch remote run '${runId}'`,
324
358
  allowInsecureHttp: options?.allowInsecureHttp,
359
+ insecure: options?.insecure,
360
+ dispatcher: options?.dispatcher,
325
361
  });
326
362
  }
327
363
  export async function cancelRemoteRun(serverUrl, runId, token, reason, options) {
@@ -330,6 +366,8 @@ export async function cancelRemoteRun(serverUrl, runId, token, reason, options)
330
366
  body: { reason },
331
367
  errorPrefix: `Failed to cancel remote run '${runId}'`,
332
368
  allowInsecureHttp: options?.allowInsecureHttp,
369
+ insecure: options?.insecure,
370
+ dispatcher: options?.dispatcher,
333
371
  });
334
372
  }
335
373
  export async function fetchRemoteActions(serverUrl, token, intent, options) {
@@ -337,12 +375,16 @@ export async function fetchRemoteActions(serverUrl, token, intent, options) {
337
375
  return fetchRemoteJson(serverUrl, `/api/v2/actions${query}`, token, {
338
376
  errorPrefix: "Failed to fetch remote actions",
339
377
  allowInsecureHttp: options?.allowInsecureHttp,
378
+ insecure: options?.insecure,
379
+ dispatcher: options?.dispatcher,
340
380
  });
341
381
  }
342
382
  export async function fetchRemoteActionShow(serverUrl, actionId, token, options) {
343
383
  return fetchRemoteJson(serverUrl, `/api/v2/actions/${encodeURIComponent(actionId)}`, token, {
344
384
  errorPrefix: `Failed to fetch remote action '${actionId}'`,
345
385
  allowInsecureHttp: options?.allowInsecureHttp,
386
+ insecure: options?.insecure,
387
+ dispatcher: options?.dispatcher,
346
388
  });
347
389
  }
348
390
  export async function fetchRemoteInfo(serverUrl, token, options) {
@@ -357,6 +399,8 @@ export async function fetchRemoteInfo(serverUrl, token, options) {
357
399
  return fetchRemoteJson(serverUrl, `/api/v2/info${qs}`, token, {
358
400
  errorPrefix: "Failed to fetch remote info",
359
401
  allowInsecureHttp: options?.allowInsecureHttp,
402
+ insecure: options?.insecure,
403
+ dispatcher: options?.dispatcher,
360
404
  });
361
405
  }
362
406
  export async function fetchRemoteDoctor(serverUrl, token, targetPackage, options) {
@@ -364,6 +408,8 @@ export async function fetchRemoteDoctor(serverUrl, token, targetPackage, options
364
408
  return fetchRemoteJson(serverUrl, `/api/v2/doctor${query}`, token, {
365
409
  errorPrefix: "Failed to fetch remote doctor report",
366
410
  allowInsecureHttp: options?.allowInsecureHttp,
411
+ insecure: options?.insecure,
412
+ dispatcher: options?.dispatcher,
367
413
  });
368
414
  }
369
415
  export async function fetchRemotePlaybooks(serverUrl, token, options) {
@@ -376,12 +422,26 @@ export async function fetchRemotePlaybooks(serverUrl, token, options) {
376
422
  return fetchRemoteJson(serverUrl, `/api/v2/playbooks${qs}`, token, {
377
423
  errorPrefix: "Failed to fetch remote playbooks",
378
424
  allowInsecureHttp: options?.allowInsecureHttp,
425
+ insecure: options?.insecure,
426
+ dispatcher: options?.dispatcher,
379
427
  });
380
428
  }
381
- export async function fetchRemotePlaybookShow(serverUrl, playbookId, token, options) {
429
+ export async function fetchRemotePlaybookShow(serverUrlOrPlaybookId, playbookIdOrToken, tokenOrOptions, optionsArg) {
430
+ let serverUrl = serverUrlOrPlaybookId;
431
+ let playbookId = playbookIdOrToken || "";
432
+ let token;
433
+ let options = optionsArg;
434
+ if (typeof tokenOrOptions === "object") {
435
+ options = tokenOrOptions;
436
+ }
437
+ else if (typeof tokenOrOptions === "string") {
438
+ token = tokenOrOptions;
439
+ }
382
440
  return fetchRemoteJson(serverUrl, `/api/v2/playbooks/${encodeURIComponent(playbookId)}`, token, {
383
441
  errorPrefix: `Failed to fetch remote playbook '${playbookId}'`,
384
442
  allowInsecureHttp: options?.allowInsecureHttp,
443
+ insecure: options?.insecure,
444
+ dispatcher: options?.dispatcher,
385
445
  });
386
446
  }
387
447
  export async function fetchRemoteRuns(serverUrl, token, options) {
@@ -400,6 +460,8 @@ export async function fetchRemoteRuns(serverUrl, token, options) {
400
460
  return fetchRemoteJson(serverUrl, `/api/v2/runs${qs}`, token, {
401
461
  errorPrefix: "Failed to fetch remote runs",
402
462
  allowInsecureHttp: options?.allowInsecureHttp,
463
+ insecure: options?.insecure,
464
+ dispatcher: options?.dispatcher,
403
465
  });
404
466
  }
405
467
  export async function clearRemoteRuns(serverUrl, token, options) {
@@ -408,6 +470,8 @@ export async function clearRemoteRuns(serverUrl, token, options) {
408
470
  body: options || {},
409
471
  errorPrefix: "Failed to clear remote runs",
410
472
  allowInsecureHttp: options?.allowInsecureHttp,
473
+ insecure: options?.insecure,
474
+ dispatcher: options?.dispatcher,
411
475
  });
412
476
  }
413
477
  export async function fetchRemoteStateList(serverUrl, token, options) {
@@ -424,6 +488,8 @@ export async function fetchRemoteStateList(serverUrl, token, options) {
424
488
  return fetchRemoteJson(serverUrl, `/api/v2/state${qs}`, token, {
425
489
  errorPrefix: "Failed to list remote state keys",
426
490
  allowInsecureHttp: options?.allowInsecureHttp,
491
+ insecure: options?.insecure,
492
+ dispatcher: options?.dispatcher,
427
493
  });
428
494
  }
429
495
  export async function getRemoteStateKey(serverUrl, key, token, options) {
@@ -438,6 +504,8 @@ export async function getRemoteStateKey(serverUrl, key, token, options) {
438
504
  return fetchRemoteJson(serverUrl, `/api/v2/state/${encodeURIComponent(key)}${qs}`, token, {
439
505
  errorPrefix: `Failed to fetch remote state key '${key}'`,
440
506
  allowInsecureHttp: options?.allowInsecureHttp,
507
+ insecure: options?.insecure,
508
+ dispatcher: options?.dispatcher,
441
509
  });
442
510
  }
443
511
  export async function setRemoteStateKey(serverUrl, key, value, token, options) {
@@ -452,6 +520,8 @@ export async function setRemoteStateKey(serverUrl, key, value, token, options) {
452
520
  },
453
521
  errorPrefix: `Failed to set remote state key '${key}'`,
454
522
  allowInsecureHttp: options?.allowInsecureHttp,
523
+ insecure: options?.insecure,
524
+ dispatcher: options?.dispatcher,
455
525
  });
456
526
  }
457
527
  export async function deleteRemoteStateKey(serverUrl, key, token, options) {
@@ -467,6 +537,8 @@ export async function deleteRemoteStateKey(serverUrl, key, token, options) {
467
537
  method: "DELETE",
468
538
  errorPrefix: `Failed to delete remote state key '${key}'`,
469
539
  allowInsecureHttp: options?.allowInsecureHttp,
540
+ insecure: options?.insecure,
541
+ dispatcher: options?.dispatcher,
470
542
  });
471
543
  }
472
544
  export async function clearRemoteState(serverUrl, token, options) {
@@ -475,6 +547,8 @@ export async function clearRemoteState(serverUrl, token, options) {
475
547
  body: options || {},
476
548
  errorPrefix: "Failed to clear remote state",
477
549
  allowInsecureHttp: options?.allowInsecureHttp,
550
+ insecure: options?.insecure,
551
+ dispatcher: options?.dispatcher,
478
552
  });
479
553
  }
480
554
  export async function fetchRemoteConfig(serverUrl, token, packageId, options) {
@@ -482,6 +556,8 @@ export async function fetchRemoteConfig(serverUrl, token, packageId, options) {
482
556
  return fetchRemoteJson(serverUrl, `/api/v2/config${query}`, token, {
483
557
  errorPrefix: "Failed to fetch remote config",
484
558
  allowInsecureHttp: options?.allowInsecureHttp,
559
+ insecure: options?.insecure,
560
+ dispatcher: options?.dispatcher,
485
561
  });
486
562
  }
487
563
  export async function setRemoteConfig(serverUrl, key, value, token, packageId, options) {
@@ -490,6 +566,8 @@ export async function setRemoteConfig(serverUrl, key, value, token, packageId, o
490
566
  body: { key, value, package: packageId },
491
567
  errorPrefix: `Failed to set remote config '${key}'`,
492
568
  allowInsecureHttp: options?.allowInsecureHttp,
569
+ insecure: options?.insecure,
570
+ dispatcher: options?.dispatcher,
493
571
  });
494
572
  }
495
573
  export async function deleteRemoteConfig(serverUrl, key, token, packageId, options) {
@@ -498,6 +576,8 @@ export async function deleteRemoteConfig(serverUrl, key, token, packageId, optio
498
576
  method: "DELETE",
499
577
  errorPrefix: `Failed to delete remote config '${key}'`,
500
578
  allowInsecureHttp: options?.allowInsecureHttp,
579
+ insecure: options?.insecure,
580
+ dispatcher: options?.dispatcher,
501
581
  });
502
582
  }
503
583
  export async function fetchRemoteConfigEnv(serverUrl, token, packageId, options) {
@@ -505,5 +585,7 @@ export async function fetchRemoteConfigEnv(serverUrl, token, packageId, options)
505
585
  return fetchRemoteJson(serverUrl, `/api/v2/config/env${query}`, token, {
506
586
  errorPrefix: "Failed to fetch remote config env checks",
507
587
  allowInsecureHttp: options?.allowInsecureHttp,
588
+ insecure: options?.insecure,
589
+ dispatcher: options?.dispatcher,
508
590
  });
509
591
  }
@@ -20,6 +20,7 @@ export declare function loadProfiles(customHome?: string): ProfilesConfig;
20
20
  */
21
21
  export declare function saveProfiles(data: ProfilesConfig, customHome?: string): void;
22
22
  export declare function addProfile(name: string, entry: ProfileEntry, customHome?: string): void;
23
+ export declare function updateProfile(name: string, entry: Partial<ProfileEntry>, customHome?: string): void;
23
24
  export declare function removeProfile(name: string, customHome?: string): boolean;
24
25
  export declare function useProfile(name: string, customHome?: string): void;
25
26
  export declare function getProfile(name: string, customHome?: string): ProfileEntry | undefined;
@@ -44,4 +45,6 @@ export declare function resolveTarget(options?: {
44
45
  profile?: string;
45
46
  server?: string;
46
47
  token?: string;
48
+ insecure?: boolean;
49
+ allowInsecureHttp?: boolean;
47
50
  }, customHome?: string): ResolvedTarget;