@promptbook/remote-server 0.112.0-71 → 0.112.0-72
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/esm/index.es.js +237 -121
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-3.0/Book.d.ts +6 -0
- package/esm/src/book-components/Chat/utils/getToolCallChipletInfo.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +12 -2
- package/esm/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +1 -0
- package/esm/src/cli/cli-commands/run/prepareRunCommandResources.d.ts +20 -0
- package/esm/src/cli/cli-commands/run/resolveRunInputParameters.d.ts +12 -0
- package/esm/src/cli/cli-commands/run/runCommandAction.d.ts +21 -0
- package/esm/src/cli/cli-commands/run/runPipelineExecution.d.ts +14 -0
- package/esm/src/cli/cli-commands/run.d.ts +1 -1
- package/esm/src/conversion/parsePipeline/applyPipelineHead.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/createInitialPipelineJson.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/createUniqueSectionNameResolver.d.ts +14 -0
- package/esm/src/conversion/parsePipeline/defineParameter.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/extractPipelineDescription.d.ts +6 -0
- package/esm/src/conversion/parsePipeline/finalizeParsedPipeline.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/getPipelineIdentification.d.ts +7 -0
- package/esm/src/conversion/parsePipeline/parsePreparedPipelineSections.d.ts +18 -0
- package/esm/src/conversion/parsePipeline/preparePipelineString.d.ts +8 -0
- package/esm/src/conversion/parsePipeline/processPipelineSection.d.ts +9 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +237 -121
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-3.0/Book.d.ts +6 -0
- package/umd/src/book-components/Chat/utils/getToolCallChipletInfo.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +12 -2
- package/umd/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +1 -0
- package/umd/src/cli/cli-commands/run/prepareRunCommandResources.d.ts +20 -0
- package/umd/src/cli/cli-commands/run/resolveRunInputParameters.d.ts +12 -0
- package/umd/src/cli/cli-commands/run/runCommandAction.d.ts +21 -0
- package/umd/src/cli/cli-commands/run/runPipelineExecution.d.ts +14 -0
- package/umd/src/cli/cli-commands/run.d.ts +1 -1
- package/umd/src/conversion/parsePipeline/applyPipelineHead.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/createInitialPipelineJson.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/createUniqueSectionNameResolver.d.ts +14 -0
- package/umd/src/conversion/parsePipeline/defineParameter.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/extractPipelineDescription.d.ts +6 -0
- package/umd/src/conversion/parsePipeline/finalizeParsedPipeline.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/getPipelineIdentification.d.ts +7 -0
- package/umd/src/conversion/parsePipeline/parsePreparedPipelineSections.d.ts +18 -0
- package/umd/src/conversion/parsePipeline/preparePipelineString.d.ts +8 -0
- package/umd/src/conversion/parsePipeline/processPipelineSection.d.ts +9 -0
- package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* @generated
|
|
51
51
|
* @see https://github.com/webgptorg/promptbook
|
|
52
52
|
*/
|
|
53
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
53
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-72';
|
|
54
54
|
/**
|
|
55
55
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
56
56
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -14955,7 +14955,9 @@
|
|
|
14955
14955
|
};
|
|
14956
14956
|
const mantleRadiusX = size * morphologyProfile.body.bodyRadiusRatio * morphologyProfile.body.horizontalStretch;
|
|
14957
14957
|
const mantleRadiusY = size * morphologyProfile.body.bodyRadiusRatio * morphologyProfile.body.verticalStretch * 1.1;
|
|
14958
|
-
const mantleRadiusZ = size *
|
|
14958
|
+
const mantleRadiusZ = size *
|
|
14959
|
+
morphologyProfile.body.bodyRadiusRatio *
|
|
14960
|
+
(0.9 + (morphologyProfile.body.horizontalStretch - 1) * 0.3);
|
|
14959
14961
|
const underbodyRadiusX = mantleRadiusX * (0.9 + (morphologyProfile.tentacles.rootSpreadScale - 1) * 0.08);
|
|
14960
14962
|
const underbodyRadiusY = mantleRadiusY * (0.44 + morphologyProfile.body.lowerDropRatio * 3.1);
|
|
14961
14963
|
const underbodyRadiusZ = mantleRadiusZ * 0.78;
|
|
@@ -15041,7 +15043,11 @@
|
|
|
15041
15043
|
z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, faceEyeSpacing, faceEyeYOffset),
|
|
15042
15044
|
}, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.7 + eyeRandom() * 0.6, interaction, morphologyProfile.face.eyeStyle);
|
|
15043
15045
|
drawProjectedMouth(context, [
|
|
15044
|
-
{
|
|
15046
|
+
{
|
|
15047
|
+
x: -mouthHalfWidth,
|
|
15048
|
+
y: mouthY,
|
|
15049
|
+
z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, -mouthHalfWidth, mouthY),
|
|
15050
|
+
},
|
|
15045
15051
|
{
|
|
15046
15052
|
x: size * morphologyProfile.face.mouthCenterOffsetRatio,
|
|
15047
15053
|
y: mouthY +
|
|
@@ -15050,7 +15056,11 @@
|
|
|
15050
15056
|
interaction.gazeY * size * 0.01,
|
|
15051
15057
|
z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, size * morphologyProfile.face.mouthCenterOffsetRatio, mouthY),
|
|
15052
15058
|
},
|
|
15053
|
-
{
|
|
15059
|
+
{
|
|
15060
|
+
x: mouthHalfWidth,
|
|
15061
|
+
y: mouthY,
|
|
15062
|
+
z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, mouthHalfWidth, mouthY),
|
|
15063
|
+
},
|
|
15054
15064
|
], mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, palette, size);
|
|
15055
15065
|
},
|
|
15056
15066
|
};
|
|
@@ -15211,7 +15221,8 @@
|
|
|
15211
15221
|
z: anchorPoint.z + Math.cos(orbitAngle) * depthReach * 0.3 + sway * size * 0.012,
|
|
15212
15222
|
};
|
|
15213
15223
|
const controlPointTwo = {
|
|
15214
|
-
x: anchorPoint.x +
|
|
15224
|
+
x: anchorPoint.x +
|
|
15225
|
+
Math.sin(orbitAngle) * lateralReach * (0.82 + morphologyProfile.tentacles.swayScale * 0.12),
|
|
15215
15226
|
y: anchorPoint.y + flowLength * 0.66,
|
|
15216
15227
|
z: anchorPoint.z + Math.cos(orbitAngle) * depthReach * 0.72 + sway * size * 0.02,
|
|
15217
15228
|
};
|
|
@@ -15276,8 +15287,7 @@
|
|
|
15276
15287
|
context.beginPath();
|
|
15277
15288
|
context.moveTo(startPoint.x, startPoint.y);
|
|
15278
15289
|
context.lineTo(endPoint.x, endPoint.y);
|
|
15279
|
-
context.strokeStyle =
|
|
15280
|
-
tentacleStroke.colorBias > 0.6 ? `${palette.secondary}f0` : `${palette.primary}f0`;
|
|
15290
|
+
context.strokeStyle = tentacleStroke.colorBias > 0.6 ? `${palette.secondary}f0` : `${palette.primary}f0`;
|
|
15281
15291
|
context.lineWidth = width;
|
|
15282
15292
|
context.lineCap = 'round';
|
|
15283
15293
|
context.stroke();
|
|
@@ -23472,6 +23482,212 @@
|
|
|
23472
23482
|
* @private internal USE TIMEOUT constant
|
|
23473
23483
|
*/
|
|
23474
23484
|
const MAX_LIST_TIMEOUTS_LIMIT = 100;
|
|
23485
|
+
/**
|
|
23486
|
+
* Creates one formatted timeout-argument validation error.
|
|
23487
|
+
*
|
|
23488
|
+
* @private internal utility of USE TIMEOUT
|
|
23489
|
+
*/
|
|
23490
|
+
function createTimeoutToolArgsError(message) {
|
|
23491
|
+
return new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23492
|
+
${message}
|
|
23493
|
+
`));
|
|
23494
|
+
}
|
|
23495
|
+
/**
|
|
23496
|
+
* Normalizes one optional timeout id string.
|
|
23497
|
+
*
|
|
23498
|
+
* @private internal utility of USE TIMEOUT
|
|
23499
|
+
*/
|
|
23500
|
+
function normalizeOptionalTimeoutId(value) {
|
|
23501
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
23502
|
+
}
|
|
23503
|
+
/**
|
|
23504
|
+
* Parses timeout target selection for tools that accept either `timeoutId` or `allActive: true`.
|
|
23505
|
+
*
|
|
23506
|
+
* @private internal utility of USE TIMEOUT
|
|
23507
|
+
*/
|
|
23508
|
+
function parseTimeoutTargetSelection(args, options) {
|
|
23509
|
+
const timeoutId = normalizeOptionalTimeoutId(args.timeoutId);
|
|
23510
|
+
const allActive = args.allActive === true;
|
|
23511
|
+
if (timeoutId && allActive) {
|
|
23512
|
+
throw createTimeoutToolArgsError(options.bothMessage);
|
|
23513
|
+
}
|
|
23514
|
+
if (allActive) {
|
|
23515
|
+
return { allActive: true };
|
|
23516
|
+
}
|
|
23517
|
+
if (!timeoutId) {
|
|
23518
|
+
throw createTimeoutToolArgsError(options.missingMessage);
|
|
23519
|
+
}
|
|
23520
|
+
return {
|
|
23521
|
+
timeoutId,
|
|
23522
|
+
allActive: false,
|
|
23523
|
+
};
|
|
23524
|
+
}
|
|
23525
|
+
/**
|
|
23526
|
+
* Parses one explicit `dueAt` update value.
|
|
23527
|
+
*
|
|
23528
|
+
* @private internal utility of USE TIMEOUT
|
|
23529
|
+
*/
|
|
23530
|
+
function parseOptionalTimeoutDueAt(value) {
|
|
23531
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
23532
|
+
return undefined;
|
|
23533
|
+
}
|
|
23534
|
+
const normalizedDueAt = value.trim();
|
|
23535
|
+
const dueAtTimestamp = Date.parse(normalizedDueAt);
|
|
23536
|
+
if (!Number.isFinite(dueAtTimestamp)) {
|
|
23537
|
+
throw createTimeoutToolArgsError('Timeout `dueAt` must be one valid ISO timestamp.');
|
|
23538
|
+
}
|
|
23539
|
+
return new Date(dueAtTimestamp).toISOString();
|
|
23540
|
+
}
|
|
23541
|
+
/**
|
|
23542
|
+
* Parses one explicit `extendByMs` update value.
|
|
23543
|
+
*
|
|
23544
|
+
* @private internal utility of USE TIMEOUT
|
|
23545
|
+
*/
|
|
23546
|
+
function parseOptionalTimeoutExtendByMs(value) {
|
|
23547
|
+
if (typeof value !== 'number') {
|
|
23548
|
+
return undefined;
|
|
23549
|
+
}
|
|
23550
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
23551
|
+
throw createTimeoutToolArgsError('Timeout `extendByMs` must be a positive number of milliseconds.');
|
|
23552
|
+
}
|
|
23553
|
+
return Math.floor(value);
|
|
23554
|
+
}
|
|
23555
|
+
/**
|
|
23556
|
+
* Parses one explicit `recurrenceIntervalMs` update value.
|
|
23557
|
+
*
|
|
23558
|
+
* @private internal utility of USE TIMEOUT
|
|
23559
|
+
*/
|
|
23560
|
+
function parseOptionalTimeoutRecurrenceInterval(value) {
|
|
23561
|
+
if (value === null) {
|
|
23562
|
+
return null;
|
|
23563
|
+
}
|
|
23564
|
+
if (typeof value !== 'number') {
|
|
23565
|
+
return undefined;
|
|
23566
|
+
}
|
|
23567
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
23568
|
+
throw createTimeoutToolArgsError('Timeout `recurrenceIntervalMs` must be a positive number of milliseconds or `null`.');
|
|
23569
|
+
}
|
|
23570
|
+
return Math.floor(value);
|
|
23571
|
+
}
|
|
23572
|
+
/**
|
|
23573
|
+
* Parses one explicit `message` update value.
|
|
23574
|
+
*
|
|
23575
|
+
* @private internal utility of USE TIMEOUT
|
|
23576
|
+
*/
|
|
23577
|
+
function parseOptionalTimeoutMessage(value) {
|
|
23578
|
+
if (value === null) {
|
|
23579
|
+
return null;
|
|
23580
|
+
}
|
|
23581
|
+
if (typeof value !== 'string') {
|
|
23582
|
+
return undefined;
|
|
23583
|
+
}
|
|
23584
|
+
const normalizedMessage = value.trim();
|
|
23585
|
+
return normalizedMessage.length > 0 ? normalizedMessage : null;
|
|
23586
|
+
}
|
|
23587
|
+
/**
|
|
23588
|
+
* Parses one explicit `parameters` update value.
|
|
23589
|
+
*
|
|
23590
|
+
* @private internal utility of USE TIMEOUT
|
|
23591
|
+
*/
|
|
23592
|
+
function parseOptionalTimeoutParameters(value) {
|
|
23593
|
+
if (value === undefined) {
|
|
23594
|
+
return undefined;
|
|
23595
|
+
}
|
|
23596
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
23597
|
+
throw createTimeoutToolArgsError('Timeout `parameters` must be one JSON object.');
|
|
23598
|
+
}
|
|
23599
|
+
return value;
|
|
23600
|
+
}
|
|
23601
|
+
/**
|
|
23602
|
+
* Parses one explicit `paused` update value.
|
|
23603
|
+
*
|
|
23604
|
+
* @private internal utility of USE TIMEOUT
|
|
23605
|
+
*/
|
|
23606
|
+
function parseOptionalTimeoutPaused(value) {
|
|
23607
|
+
return typeof value === 'boolean' ? value : undefined;
|
|
23608
|
+
}
|
|
23609
|
+
/**
|
|
23610
|
+
* Parses patch fields for `update_timeout`.
|
|
23611
|
+
*
|
|
23612
|
+
* @private internal utility of USE TIMEOUT
|
|
23613
|
+
*/
|
|
23614
|
+
function parseTimeoutUpdatePatch(args) {
|
|
23615
|
+
const patch = {};
|
|
23616
|
+
const dueAt = parseOptionalTimeoutDueAt(args.dueAt);
|
|
23617
|
+
const extendByMs = parseOptionalTimeoutExtendByMs(args.extendByMs);
|
|
23618
|
+
const recurrenceIntervalMs = parseOptionalTimeoutRecurrenceInterval(args.recurrenceIntervalMs);
|
|
23619
|
+
const message = parseOptionalTimeoutMessage(args.message);
|
|
23620
|
+
const parameters = parseOptionalTimeoutParameters(args.parameters);
|
|
23621
|
+
const paused = parseOptionalTimeoutPaused(args.paused);
|
|
23622
|
+
if (dueAt !== undefined) {
|
|
23623
|
+
patch.dueAt = dueAt;
|
|
23624
|
+
}
|
|
23625
|
+
if (extendByMs !== undefined) {
|
|
23626
|
+
patch.extendByMs = extendByMs;
|
|
23627
|
+
}
|
|
23628
|
+
if (patch.dueAt !== undefined && patch.extendByMs !== undefined) {
|
|
23629
|
+
throw createTimeoutToolArgsError('Timeout update cannot include both `dueAt` and `extendByMs`.');
|
|
23630
|
+
}
|
|
23631
|
+
if (recurrenceIntervalMs !== undefined) {
|
|
23632
|
+
patch.recurrenceIntervalMs = recurrenceIntervalMs;
|
|
23633
|
+
}
|
|
23634
|
+
if (message !== undefined) {
|
|
23635
|
+
patch.message = message;
|
|
23636
|
+
}
|
|
23637
|
+
if (parameters !== undefined) {
|
|
23638
|
+
patch.parameters = parameters;
|
|
23639
|
+
}
|
|
23640
|
+
if (paused !== undefined) {
|
|
23641
|
+
patch.paused = paused;
|
|
23642
|
+
}
|
|
23643
|
+
return patch;
|
|
23644
|
+
}
|
|
23645
|
+
/**
|
|
23646
|
+
* Determines whether the patch contains fields that are only supported for single-timeout updates.
|
|
23647
|
+
*
|
|
23648
|
+
* @private internal utility of USE TIMEOUT
|
|
23649
|
+
*/
|
|
23650
|
+
function hasSingleTimeoutOnlyPatchFields(patch) {
|
|
23651
|
+
return (patch.dueAt !== undefined ||
|
|
23652
|
+
patch.extendByMs !== undefined ||
|
|
23653
|
+
patch.recurrenceIntervalMs !== undefined ||
|
|
23654
|
+
patch.message !== undefined ||
|
|
23655
|
+
patch.parameters !== undefined);
|
|
23656
|
+
}
|
|
23657
|
+
/**
|
|
23658
|
+
* Parses bulk timeout update arguments.
|
|
23659
|
+
*
|
|
23660
|
+
* @private internal utility of USE TIMEOUT
|
|
23661
|
+
*/
|
|
23662
|
+
function parseBulkTimeoutUpdateArgs(patch) {
|
|
23663
|
+
if (patch.paused === undefined) {
|
|
23664
|
+
throw createTimeoutToolArgsError('Bulk timeout update with `allActive: true` requires `paused` to be explicitly set.');
|
|
23665
|
+
}
|
|
23666
|
+
if (hasSingleTimeoutOnlyPatchFields(patch)) {
|
|
23667
|
+
throw createTimeoutToolArgsError('Bulk timeout update only supports the `paused` field.');
|
|
23668
|
+
}
|
|
23669
|
+
return {
|
|
23670
|
+
allActive: true,
|
|
23671
|
+
paused: patch.paused,
|
|
23672
|
+
};
|
|
23673
|
+
}
|
|
23674
|
+
/**
|
|
23675
|
+
* Parses single-timeout update arguments.
|
|
23676
|
+
*
|
|
23677
|
+
* @private internal utility of USE TIMEOUT
|
|
23678
|
+
*/
|
|
23679
|
+
function parseSingleTimeoutUpdateArgs(timeoutId, patch) {
|
|
23680
|
+
if (!timeoutId) {
|
|
23681
|
+
throw createTimeoutToolArgsError('Timeout `timeoutId` is required for single-timeout updates.');
|
|
23682
|
+
}
|
|
23683
|
+
if (Object.keys(patch).length === 0) {
|
|
23684
|
+
throw createTimeoutToolArgsError('Timeout update must include at least one editable field.');
|
|
23685
|
+
}
|
|
23686
|
+
return {
|
|
23687
|
+
timeoutId,
|
|
23688
|
+
patch,
|
|
23689
|
+
};
|
|
23690
|
+
}
|
|
23475
23691
|
/**
|
|
23476
23692
|
* Parses and validates `USE TIMEOUT` tool arguments.
|
|
23477
23693
|
*
|
|
@@ -23498,22 +23714,14 @@
|
|
|
23498
23714
|
* Parses `cancel_timeout` input.
|
|
23499
23715
|
*/
|
|
23500
23716
|
cancel(args) {
|
|
23501
|
-
const
|
|
23502
|
-
|
|
23503
|
-
|
|
23504
|
-
|
|
23505
|
-
|
|
23506
|
-
`));
|
|
23507
|
-
}
|
|
23508
|
-
if (allActive) {
|
|
23717
|
+
const target = parseTimeoutTargetSelection(args, {
|
|
23718
|
+
bothMessage: 'Timeout cancellation must target either one `timeoutId` or `allActive: true`, not both.',
|
|
23719
|
+
missingMessage: 'Timeout `timeoutId` is required unless you pass `allActive: true`.',
|
|
23720
|
+
});
|
|
23721
|
+
if (target.allActive) {
|
|
23509
23722
|
return { allActive: true };
|
|
23510
23723
|
}
|
|
23511
|
-
|
|
23512
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23513
|
-
Timeout \`timeoutId\` is required unless you pass \`allActive: true\`.
|
|
23514
|
-
`));
|
|
23515
|
-
}
|
|
23516
|
-
return { timeoutId };
|
|
23724
|
+
return { timeoutId: target.timeoutId };
|
|
23517
23725
|
},
|
|
23518
23726
|
/**
|
|
23519
23727
|
* Parses `list_timeouts` input.
|
|
@@ -23544,106 +23752,14 @@
|
|
|
23544
23752
|
* Parses `update_timeout` input.
|
|
23545
23753
|
*/
|
|
23546
23754
|
update(args) {
|
|
23547
|
-
const
|
|
23548
|
-
|
|
23549
|
-
|
|
23550
|
-
|
|
23551
|
-
|
|
23552
|
-
|
|
23553
|
-
|
|
23554
|
-
|
|
23555
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23556
|
-
Timeout update requires one \`timeoutId\` or \`allActive: true\`.
|
|
23557
|
-
`));
|
|
23558
|
-
}
|
|
23559
|
-
const patch = {};
|
|
23560
|
-
if (typeof args.dueAt === 'string' && args.dueAt.trim().length > 0) {
|
|
23561
|
-
const normalizedDueAt = args.dueAt.trim();
|
|
23562
|
-
const dueAtTimestamp = Date.parse(normalizedDueAt);
|
|
23563
|
-
if (!Number.isFinite(dueAtTimestamp)) {
|
|
23564
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23565
|
-
Timeout \`dueAt\` must be one valid ISO timestamp.
|
|
23566
|
-
`));
|
|
23567
|
-
}
|
|
23568
|
-
patch.dueAt = new Date(dueAtTimestamp).toISOString();
|
|
23569
|
-
}
|
|
23570
|
-
if (typeof args.extendByMs === 'number') {
|
|
23571
|
-
if (!Number.isFinite(args.extendByMs) || args.extendByMs <= 0) {
|
|
23572
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23573
|
-
Timeout \`extendByMs\` must be a positive number of milliseconds.
|
|
23574
|
-
`));
|
|
23575
|
-
}
|
|
23576
|
-
patch.extendByMs = Math.floor(args.extendByMs);
|
|
23577
|
-
}
|
|
23578
|
-
if (patch.dueAt !== undefined && patch.extendByMs !== undefined) {
|
|
23579
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23580
|
-
Timeout update cannot include both \`dueAt\` and \`extendByMs\`.
|
|
23581
|
-
`));
|
|
23582
|
-
}
|
|
23583
|
-
if (args.recurrenceIntervalMs === null) {
|
|
23584
|
-
patch.recurrenceIntervalMs = null;
|
|
23585
|
-
}
|
|
23586
|
-
else if (typeof args.recurrenceIntervalMs === 'number') {
|
|
23587
|
-
if (!Number.isFinite(args.recurrenceIntervalMs) || args.recurrenceIntervalMs <= 0) {
|
|
23588
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23589
|
-
Timeout \`recurrenceIntervalMs\` must be a positive number of milliseconds or \`null\`.
|
|
23590
|
-
`));
|
|
23591
|
-
}
|
|
23592
|
-
patch.recurrenceIntervalMs = Math.floor(args.recurrenceIntervalMs);
|
|
23593
|
-
}
|
|
23594
|
-
if (args.message === null) {
|
|
23595
|
-
patch.message = null;
|
|
23596
|
-
}
|
|
23597
|
-
else if (typeof args.message === 'string') {
|
|
23598
|
-
const normalizedMessage = args.message.trim();
|
|
23599
|
-
patch.message = normalizedMessage.length > 0 ? normalizedMessage : null;
|
|
23600
|
-
}
|
|
23601
|
-
if (args.parameters !== undefined) {
|
|
23602
|
-
if (!args.parameters || typeof args.parameters !== 'object' || Array.isArray(args.parameters)) {
|
|
23603
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23604
|
-
Timeout \`parameters\` must be one JSON object.
|
|
23605
|
-
`));
|
|
23606
|
-
}
|
|
23607
|
-
patch.parameters = args.parameters;
|
|
23608
|
-
}
|
|
23609
|
-
if (typeof args.paused === 'boolean') {
|
|
23610
|
-
patch.paused = args.paused;
|
|
23611
|
-
}
|
|
23612
|
-
if (allActive) {
|
|
23613
|
-
if (patch.paused === undefined) {
|
|
23614
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23615
|
-
Bulk timeout update with \`allActive: true\` requires \`paused\` to be explicitly set.
|
|
23616
|
-
`));
|
|
23617
|
-
}
|
|
23618
|
-
const hasSingleOnlyPatch = patch.dueAt !== undefined ||
|
|
23619
|
-
patch.extendByMs !== undefined ||
|
|
23620
|
-
patch.recurrenceIntervalMs !== undefined ||
|
|
23621
|
-
patch.message !== undefined ||
|
|
23622
|
-
patch.parameters !== undefined;
|
|
23623
|
-
if (hasSingleOnlyPatch) {
|
|
23624
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23625
|
-
Bulk timeout update only supports the \`paused\` field.
|
|
23626
|
-
`));
|
|
23627
|
-
}
|
|
23628
|
-
return {
|
|
23629
|
-
allActive: true,
|
|
23630
|
-
paused: patch.paused,
|
|
23631
|
-
};
|
|
23632
|
-
}
|
|
23633
|
-
if (!timeoutId) {
|
|
23634
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23635
|
-
Timeout \`timeoutId\` is required for single-timeout updates.
|
|
23636
|
-
`));
|
|
23637
|
-
}
|
|
23638
|
-
if (Object.keys(patch).length === 0) {
|
|
23639
|
-
throw new PipelineExecutionError(_spaceTrim.spaceTrim(`
|
|
23640
|
-
Timeout update must include at least one editable field.
|
|
23641
|
-
`));
|
|
23642
|
-
}
|
|
23643
|
-
return {
|
|
23644
|
-
timeoutId,
|
|
23645
|
-
patch,
|
|
23646
|
-
};
|
|
23755
|
+
const target = parseTimeoutTargetSelection(args, {
|
|
23756
|
+
bothMessage: 'Timeout update must target either one `timeoutId` or `allActive: true`, not both.',
|
|
23757
|
+
missingMessage: 'Timeout update requires one `timeoutId` or `allActive: true`.',
|
|
23758
|
+
});
|
|
23759
|
+
const patch = parseTimeoutUpdatePatch(args);
|
|
23760
|
+
return target.allActive
|
|
23761
|
+
? parseBulkTimeoutUpdateArgs(patch)
|
|
23762
|
+
: parseSingleTimeoutUpdateArgs(target.timeoutId, patch);
|
|
23647
23763
|
},
|
|
23648
23764
|
};
|
|
23649
23765
|
|