@uipath/maestro-builder-sdk 6.82.2 → 6.82.3

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.
@@ -1,5 +1,9 @@
1
1
  import type { BindingsV2Document, InlineAgentFiles } from './bindings-v2.js';
2
2
  /** Read a `bindings_v2.json`, or `undefined` when absent or unparseable. */
3
3
  export declare function readBindingsV2(path: string): BindingsV2Document | undefined;
4
- /** Read one inline agent's directory the way refresh does; `undefined` when it has no readable `agent.json`. */
4
+ /**
5
+ * Read one inline agent's directory the way refresh does; `undefined` when it has no readable `agent.json`.
6
+ * A resource with `isEnabled: false` is read too, as refresh reads it: its binding rows stay
7
+ * declared, which `uip agent validate` requires (see compile's `disableStaleResource`, #1380).
8
+ */
5
9
  export declare function readInlineAgentFiles(agentDir: string): InlineAgentFiles | undefined;
@@ -19,7 +19,11 @@ export function readBindingsV2(path) {
19
19
  return undefined;
20
20
  }
21
21
  }
22
- /** Read one inline agent's directory the way refresh does; `undefined` when it has no readable `agent.json`. */
22
+ /**
23
+ * Read one inline agent's directory the way refresh does; `undefined` when it has no readable `agent.json`.
24
+ * A resource with `isEnabled: false` is read too, as refresh reads it: its binding rows stay
25
+ * declared, which `uip agent validate` requires (see compile's `disableStaleResource`, #1380).
26
+ */
23
27
  export function readInlineAgentFiles(agentDir) {
24
28
  let agent;
25
29
  try {
@@ -279,8 +279,7 @@ export async function run(argv) {
279
279
  catch (error) {
280
280
  // Studio Web's project file system refuses deletes. Only a surviving file keeps its row: a later compile skips a folder with no resource.json.
281
281
  if (existsSync(file)) {
282
- console.error(`compile: could not remove stale ${relative(outDir, file)} (${error instanceof Error ? error.message : String(error)}); `
283
- + 'it is still declared as a resource of this agent until it is deleted.');
282
+ disableStaleResource(file, body, relative(outDir, file), error);
284
283
  continue;
285
284
  }
286
285
  }
@@ -345,6 +344,33 @@ function draftWarning(d) {
345
344
  };
346
345
  }
347
346
  runWhenInvokedDirectly(import.meta.url, 'compile', run);
347
+ /**
348
+ * Turn off a stale agent tool the host would not delete (#1380) by rewriting it
349
+ * with `isEnabled: false`; adding the tool back writes `isEnabled: true` again.
350
+ *
351
+ * A context is only warned about: its storage schema drops `isEnabled`, so the
352
+ * context would stay active. The resource's `bindings_v2.json` rows stay either
353
+ * way: `uip agent validate --inline-in-flow` requires them.
354
+ */
355
+ function disableStaleResource(file, body, shown, refused) {
356
+ const reason = refused instanceof Error ? refused.message : String(refused);
357
+ const stillActive = (why) => console.error(`compile: could not remove stale ${shown} (${reason})${why}; `
358
+ + 'it is still an active resource of this agent until it is deleted.');
359
+ if (body.$resourceType !== 'tool')
360
+ return stillActive('');
361
+ if (body.isEnabled === false) {
362
+ console.log(`compile: kept stale ${shown} disabled (isEnabled: false); it could not be removed (${reason})`);
363
+ return;
364
+ }
365
+ try {
366
+ writeJsonFile(file, { ...body, isEnabled: false });
367
+ }
368
+ catch (error) {
369
+ return stillActive(` or disable it (${error instanceof Error ? error.message : String(error)})`);
370
+ }
371
+ console.log(`compile: disabled stale ${shown} (isEnabled: false): it could not be removed (${reason}). `
372
+ + 'The agent no longer calls it; delete its folder to drop it for good.');
373
+ }
348
374
  /** A JSON file's contents, or `undefined` when it is missing or unreadable. */
349
375
  function readJsonOrUndefined(path) {
350
376
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.82.2",
3
+ "version": "6.82.3",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -103,5 +103,5 @@
103
103
  "@types/node": "^22.7.0",
104
104
  "esbuild": "^0.28.1"
105
105
  },
106
- "gitref": "73a1011c5e63e206f2c92ec533af173c62af6d3f"
106
+ "gitref": "e0b86864208ddfdb8a4694661944938cfe588fe7"
107
107
  }