@vicary/pi-subagents 0.83.1 → 0.84.0-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/CHANGELOG.md +17 -0
- package/bundle/{chunk-YXFJVCOL.js → chunk-4E7BKDTX.js} +3 -3
- package/bundle/{chunk-UFL7IYCW.js → chunk-4MDR6V46.js} +8 -8
- package/bundle/{chunk-AHIFYGR3.js → chunk-67ENPDDA.js} +5 -5
- package/bundle/{chunk-ZVOAMTUQ.js → chunk-AKOIVLA5.js} +3 -3
- package/bundle/{chunk-RNIZLSEA.js → chunk-CGN2TVE7.js} +1 -0
- package/bundle/{chunk-NPIYWVOD.js → chunk-F4AMYP5N.js} +3 -3
- package/bundle/{chunk-C7JMPU5F.js → chunk-HKJLSMXV.js} +1 -1
- package/bundle/{chunk-UYK5MZWE.js → chunk-L3WFKBEI.js} +1 -1
- package/bundle/{chunk-F5DBXJ2G.js → chunk-LGLEH7B6.js} +8 -5
- package/bundle/{chunk-VLFZIN6D.js → chunk-NENDSQUY.js} +2 -2
- package/bundle/{chunk-QP5ZWNIS.js → chunk-PALJGGYC.js} +1 -1
- package/bundle/{chunk-IPGZMQXV.js → chunk-PV63UFUR.js} +5 -5
- package/bundle/{chunk-MABL3FUM.js → chunk-T44HVL5U.js} +1 -1
- package/bundle/{chunk-V6YPYWJP.js → chunk-TE4LHYHN.js} +25 -17
- package/bundle/{chunk-HCSINC66.js → chunk-X2MXCSA5.js} +24 -21
- package/bundle/index.js +1 -1
- package/bundle/preflight.js +2 -2
- package/docs/agents.md +1 -1
- package/docs/configuration.md +6 -6
- package/docs/observability.md +1 -1
- package/docs/tool-reference.md +1 -1
- package/docs/workflows.md +1 -1
- package/package.json +2 -2
- package/src/extension/schemas.js +1 -1
- package/src/runs/background/async-execution.d.ts +3 -1
- package/src/runs/background/async-execution.js +16 -2
- package/src/runs/background/async-retention.d.ts +1 -0
- package/src/runs/background/async-retention.js +16 -10
- package/src/runs/background/auto-drain.d.ts +0 -1
- package/src/runs/background/auto-drain.js +5 -5
- package/src/runs/background/run-child-session.d.ts +2 -0
- package/src/runs/background/run-child-session.js +9 -1
- package/src/runs/background/subagent-runner.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +4 -6
- package/src/runs/foreground/subagent-executor.js +11 -18
- package/src/runs/shared/child-session.d.ts +2 -0
- package/src/runs/shared/child-session.js +1 -0
- package/src/runs/shared/model-resolution-diagnostic.d.ts +11 -0
- package/src/runs/shared/model-resolution-diagnostic.js +25 -0
- package/src/runs/shared/parallel-utils.d.ts +2 -0
- package/src/shared/types.d.ts +5 -6
- package/src/workflows/scripted-workflow.js +2 -0
- package/workflow-script-worker.cjs +449 -175
|
@@ -938,6 +938,7 @@ export async function runSingleStepInner(step, ctx) {
|
|
|
938
938
|
modelVerificationRegistry: step.modelVerificationRegistry,
|
|
939
939
|
modelResponseAliases: step.modelResponseAliases,
|
|
940
940
|
mutationTools: step.mutationTools,
|
|
941
|
+
parentExtensionProvider: step.parentExtensionProvider,
|
|
941
942
|
}));
|
|
942
943
|
launched = true;
|
|
943
944
|
aggregateUsage.input += run.usage.input;
|
|
@@ -6,7 +6,6 @@ import type { MainWatchdogRuntime } from "../../watchdog/runtime.ts";
|
|
|
6
6
|
import { type ModelOrigin } from "../shared/model-resolution.ts";
|
|
7
7
|
import { type ModelScopeConfig } from "../shared/model-scope.ts";
|
|
8
8
|
import { type ChainStep } from "../../shared/settings.ts";
|
|
9
|
-
import { DEFAULT_ASYNC_TIMEOUT_MS } from "../background/async-execution.ts";
|
|
10
9
|
import { type ResolvedSubagentCapabilityCeiling } from "../shared/capability-ceiling.ts";
|
|
11
10
|
import { type ExtensionBindings } from "../shared/extension-bindings.ts";
|
|
12
11
|
import { resolveSubagentResultStatus } from "../../intercom/result-intercom.ts";
|
|
@@ -210,12 +209,10 @@ export declare function shouldSuppressRoutineResultIntercom(input: {
|
|
|
210
209
|
suppressRoutineResultIntercom?: boolean;
|
|
211
210
|
results: SingleResult[];
|
|
212
211
|
}): boolean;
|
|
213
|
-
export declare const DEFAULT_FOREGROUND_TIMEOUT_MS: number;
|
|
214
|
-
export { DEFAULT_ASYNC_TIMEOUT_MS };
|
|
215
212
|
/**
|
|
216
213
|
* Resolve the optional global default runtime deadline from extension config
|
|
217
214
|
* (`config.timeoutMs`). Returns undefined for unset or invalid values so callers
|
|
218
|
-
*
|
|
215
|
+
* use no configured deadline. "Invalid" covers non-positive-integer
|
|
219
216
|
* values and values above `MAX_TIMER_DELAY_MS`; the latter would overflow the
|
|
220
217
|
* Node.js timer and expire the run almost immediately instead of running long.
|
|
221
218
|
*/
|
|
@@ -226,10 +223,10 @@ export declare function resolveForegroundTimeout(params: SubagentParamsLike, def
|
|
|
226
223
|
};
|
|
227
224
|
/**
|
|
228
225
|
* Resolve the effective launch timeout for a single-agent run, applying the
|
|
229
|
-
*
|
|
226
|
+
* configured default when neither the caller nor the agent set one.
|
|
230
227
|
*
|
|
231
228
|
* A global config default (`config.timeoutMs`, passed as `configDefaultTimeoutMs`)
|
|
232
|
-
*
|
|
229
|
+
* applies where a concrete default is configured.
|
|
233
230
|
* The async default is deliberately applied only to plain single-agent launches.
|
|
234
231
|
* Composite launches keep their top-level execution unbounded when no timeout is
|
|
235
232
|
* set — even with a config default — while their runner children resolve separate
|
|
@@ -313,3 +310,4 @@ export declare function createSubagentExecutor(deps: ExecutorDeps): {
|
|
|
313
310
|
/** Scheduled state visible to the current runtime supervisor owner only. */
|
|
314
311
|
getCurrentSupervisorOwnerStates: () => Iterable<SubagentState>;
|
|
315
312
|
};
|
|
313
|
+
export {};
|
|
@@ -29,7 +29,7 @@ import { formatRetainedChildren, listRetainedChildren } from "../background/reta
|
|
|
29
29
|
import { resolveModelScopesForAgent } from "../shared/model-scope.js";
|
|
30
30
|
import { getStepAgents, isParallelStep, isDynamicParallelStep, resolveExistingReadPaths, } from "../../shared/settings.js";
|
|
31
31
|
import { normalizeSkillInput } from "../../agents/skills.js";
|
|
32
|
-
import { buildAsyncRunnerSteps,
|
|
32
|
+
import { buildAsyncRunnerSteps, executeAsyncChain, executeAsyncSingle, formatAsyncStartedMessage, isAsyncAvailable, workflowAwaitedAsyncResultPath } from "../background/async-execution.js";
|
|
33
33
|
import { updateActiveRunIndex } from "../background/active-run-index.js";
|
|
34
34
|
import { steeringReceipt } from "../background/steering.js";
|
|
35
35
|
import { acquireActiveAsyncCapacity, ActiveAsyncCapacityError, getActiveAsyncCapacitySnapshot, resolveAbandonedSlotReleaseAfterMs, resolveMaxActiveAsyncRunsPerSession, transferActiveAsyncCapacity } from "../background/active-async-capacity.js";
|
|
@@ -1018,6 +1018,7 @@ function appendStepToAsyncChain(input) {
|
|
|
1018
1018
|
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
1019
1019
|
parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? undefined,
|
|
1020
1020
|
currentModelProvider: parentModel?.provider,
|
|
1021
|
+
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1021
1022
|
currentModel: parentModel,
|
|
1022
1023
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1023
1024
|
modelScope: discoveredForAppend.modelScope,
|
|
@@ -1505,6 +1506,7 @@ async function resumeExternalJobFollowUp(input) {
|
|
|
1505
1506
|
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
1506
1507
|
parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? undefined,
|
|
1507
1508
|
currentModelProvider: parentModel?.provider,
|
|
1509
|
+
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1508
1510
|
currentModel: parentModel,
|
|
1509
1511
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1510
1512
|
modelScope: input.modelScope,
|
|
@@ -1793,6 +1795,7 @@ async function resumeAsyncRun(input) {
|
|
|
1793
1795
|
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
1794
1796
|
parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? undefined,
|
|
1795
1797
|
currentModelProvider: parentModel?.provider,
|
|
1798
|
+
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1796
1799
|
currentModel: parentModel,
|
|
1797
1800
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1798
1801
|
modelScope,
|
|
@@ -1934,6 +1937,7 @@ async function resumeAsyncRun(input) {
|
|
|
1934
1937
|
parentSessionId: input.ctx.sessionManager.getSessionId() ?? undefined,
|
|
1935
1938
|
parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? undefined,
|
|
1936
1939
|
currentModelProvider: parentModel?.provider,
|
|
1940
|
+
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1937
1941
|
currentModel: parentModel,
|
|
1938
1942
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1939
1943
|
modelScope,
|
|
@@ -2622,16 +2626,6 @@ function validateLaunchOutputSchemaOverrides(params) {
|
|
|
2622
2626
|
}
|
|
2623
2627
|
return undefined;
|
|
2624
2628
|
}
|
|
2625
|
-
export const DEFAULT_FOREGROUND_TIMEOUT_MS = 30 * 60 * 1000;
|
|
2626
|
-
// Async single-agent runs also need a wall-clock backstop: a child whose bash
|
|
2627
|
-
// tool blocks forever (e.g. a background process inheriting the terminal with
|
|
2628
|
-
// no bash `timeout` arg) would otherwise hang the parent indefinitely with
|
|
2629
|
-
// zero signal. Same generous default as foreground; explicit timeoutMs/
|
|
2630
|
-
// maxRuntimeMs and agent-level defaultTimeoutMs remain authoritative.
|
|
2631
|
-
//
|
|
2632
|
-
// Deliberately NOT applied at the workflow level: async scripted workflows
|
|
2633
|
-
// stay unbounded as a whole, while each runner child has its own deadline.
|
|
2634
|
-
export { DEFAULT_ASYNC_TIMEOUT_MS };
|
|
2635
2629
|
/**
|
|
2636
2630
|
* Maximum delay a Node.js timer accepts. Values above the 32-bit signed integer
|
|
2637
2631
|
* ceiling overflow `setTimeout`, which silently clamps the delay to ~1ms and
|
|
@@ -2648,7 +2642,7 @@ function timerDelayOverflowError(name, value) {
|
|
|
2648
2642
|
/**
|
|
2649
2643
|
* Resolve the optional global default runtime deadline from extension config
|
|
2650
2644
|
* (`config.timeoutMs`). Returns undefined for unset or invalid values so callers
|
|
2651
|
-
*
|
|
2645
|
+
* use no configured deadline. "Invalid" covers non-positive-integer
|
|
2652
2646
|
* values and values above `MAX_TIMER_DELAY_MS`; the latter would overflow the
|
|
2653
2647
|
* Node.js timer and expire the run almost immediately instead of running long.
|
|
2654
2648
|
*/
|
|
@@ -2681,10 +2675,10 @@ export function resolveForegroundTimeout(params, defaultTimeoutMs) {
|
|
|
2681
2675
|
}
|
|
2682
2676
|
/**
|
|
2683
2677
|
* Resolve the effective launch timeout for a single-agent run, applying the
|
|
2684
|
-
*
|
|
2678
|
+
* configured default when neither the caller nor the agent set one.
|
|
2685
2679
|
*
|
|
2686
2680
|
* A global config default (`config.timeoutMs`, passed as `configDefaultTimeoutMs`)
|
|
2687
|
-
*
|
|
2681
|
+
* applies where a concrete default is configured.
|
|
2688
2682
|
* The async default is deliberately applied only to plain single-agent launches.
|
|
2689
2683
|
* Composite launches keep their top-level execution unbounded when no timeout is
|
|
2690
2684
|
* set — even with a config default — while their runner children resolve separate
|
|
@@ -2692,9 +2686,7 @@ export function resolveForegroundTimeout(params, defaultTimeoutMs) {
|
|
|
2692
2686
|
*/
|
|
2693
2687
|
export function resolveSingleAgentLaunchTimeout(params, async, configDefaultTimeoutMs) {
|
|
2694
2688
|
const isComposite = (params.chain?.length ?? 0) > 0 || (params.tasks?.length ?? 0) > 0 || params.workflowScript !== undefined;
|
|
2695
|
-
const
|
|
2696
|
-
const asyncSingleDefault = configDefaultTimeoutMs ?? DEFAULT_ASYNC_TIMEOUT_MS;
|
|
2697
|
-
const defaultTimeoutMs = !async ? foregroundDefault : isComposite ? undefined : asyncSingleDefault;
|
|
2689
|
+
const defaultTimeoutMs = !async || !isComposite ? configDefaultTimeoutMs : undefined;
|
|
2698
2690
|
return resolveForegroundTimeout(params, defaultTimeoutMs);
|
|
2699
2691
|
}
|
|
2700
2692
|
function resolveToolBudget(raw, label = "toolBudget", options) {
|
|
@@ -3105,6 +3097,7 @@ async function runAsyncPath(data, deps) {
|
|
|
3105
3097
|
parentSessionId: data.parentPiSessionId,
|
|
3106
3098
|
parentSessionFile: ctx.sessionManager.getSessionFile() ?? undefined,
|
|
3107
3099
|
currentModelProvider: parentModel?.provider,
|
|
3100
|
+
parentProviderRegistry: ctx.modelRegistry,
|
|
3108
3101
|
currentModel: parentModel,
|
|
3109
3102
|
scopedModelIds: data.scopedModelIds,
|
|
3110
3103
|
modelScope: data.modelScope,
|
|
@@ -4939,7 +4932,7 @@ export function createSubagentExecutor(deps) {
|
|
|
4939
4932
|
if (overflowError)
|
|
4940
4933
|
return buildRequestedModeError(requestParams, overflowError);
|
|
4941
4934
|
}
|
|
4942
|
-
const timeout = requestParams.timeoutMs ?? requestParams.maxRuntimeMs ?? (requestParams.async === false ? resolveConfigDefaultTimeoutMs(deps.config.timeoutMs)
|
|
4935
|
+
const timeout = requestParams.timeoutMs ?? requestParams.maxRuntimeMs ?? (requestParams.async === false ? resolveConfigDefaultTimeoutMs(deps.config.timeoutMs) : undefined);
|
|
4943
4936
|
const workflowUsageBudget = validateUsageBudgetConfig(requestParams.usageBudget ?? deps.config.usageBudget, requestParams.usageBudget ? "usageBudget" : "config.usageBudget");
|
|
4944
4937
|
if (workflowUsageBudget.error)
|
|
4945
4938
|
return buildRequestedModeError(requestParams, workflowUsageBudget.error);
|
|
@@ -109,6 +109,8 @@ export interface ChildSession {
|
|
|
109
109
|
readonly modelId: string | undefined;
|
|
110
110
|
/** Provider id of the selected model when this child inherited that provider from the parent's registry instead of loading its extension. */
|
|
111
111
|
readonly inheritedProvider?: string;
|
|
112
|
+
/** Provider id of the selected model when an extension in this child's model runtime registered that provider, at load or later (e.g. on `session_start`). */
|
|
113
|
+
readonly claimedProvider?: string;
|
|
112
114
|
/** Live provider/id of the selected model when Pi marks it virtual (`api === "pi-virtual"`); assistant messages then name the dispatched physical model. */
|
|
113
115
|
readonly virtualModelId?: string;
|
|
114
116
|
readonly contextWindow?: number;
|
|
@@ -633,6 +633,7 @@ export function createDefaultChildSessionFactory(options = {}) {
|
|
|
633
633
|
get sessionId() { return session.sessionId; },
|
|
634
634
|
get modelId() { return session.model ? `${session.model.provider}/${session.model.id}` : undefined; },
|
|
635
635
|
get inheritedProvider() { return session.model && inheritedProviders.has(session.model.provider) ? session.model.provider : undefined; },
|
|
636
|
+
get claimedProvider() { return session.model && !inheritedProviders.has(session.model.provider) && modelRuntime.getRegisteredProviderIds().includes(session.model.provider) ? session.model.provider : undefined; },
|
|
636
637
|
get virtualModelId() { return session.model?.api === "pi-virtual" ? `${session.model.provider}/${session.model.id}` : undefined; },
|
|
637
638
|
get contextWindow() { return session.model?.contextWindow; },
|
|
638
639
|
};
|
|
@@ -31,3 +31,14 @@ export declare function formatChildModelResolutionDiagnostic(diagnostic: ChildMo
|
|
|
31
31
|
export declare function formatInheritedProviderDiagnostic(diagnostic: ChildModelResolutionDiagnostic & {
|
|
32
32
|
provider: string;
|
|
33
33
|
}): string;
|
|
34
|
+
/**
|
|
35
|
+
* Explain a background child that failed before any successful response on a
|
|
36
|
+
* provider a parent extension registered, when that extension did not load in
|
|
37
|
+
* the child. A parent extension can register a provider under a built-in id,
|
|
38
|
+
* so the model still resolves in the child, through the built-in provider
|
|
39
|
+
* rather than the parent's. Whether that caused this failure is unknown here,
|
|
40
|
+
* hence the conditional wording.
|
|
41
|
+
*/
|
|
42
|
+
export declare function formatMissingParentProviderDiagnostic(diagnostic: ChildModelResolutionDiagnostic & {
|
|
43
|
+
provider: string;
|
|
44
|
+
}): string;
|
|
@@ -89,3 +89,28 @@ export function formatInheritedProviderDiagnostic(diagnostic) {
|
|
|
89
89
|
`If ${provider} depends on those hooks, run this agent with \`async: true\` (a background child loads the ambient extensions unless the agent sets \`extensions\`), or load the extension for this agent with \`subagentOnlyExtensions\` or \`extensions\` in the agent frontmatter.`,
|
|
90
90
|
].join("\n");
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Explain a background child that failed before any successful response on a
|
|
94
|
+
* provider a parent extension registered, when that extension did not load in
|
|
95
|
+
* the child. A parent extension can register a provider under a built-in id,
|
|
96
|
+
* so the model still resolves in the child, through the built-in provider
|
|
97
|
+
* rather than the parent's. Whether that caused this failure is unknown here,
|
|
98
|
+
* hence the conditional wording.
|
|
99
|
+
*/
|
|
100
|
+
export function formatMissingParentProviderDiagnostic(diagnostic) {
|
|
101
|
+
const subject = diagnostic.agent ? `Agent '${diagnostic.agent}'` : "Subagent";
|
|
102
|
+
const model = diagnostic.model ? `'${diagnostic.model}'` : "this model";
|
|
103
|
+
const provider = `'${diagnostic.provider}'`;
|
|
104
|
+
const facts = `${subject} ran as a background child without the ambient extensions. In the parent, provider ${provider} for ${model} is registered by an extension that did not load in this child, so the child sent its requests without that extension's provider, through the built-in provider of the same id if there is one.`;
|
|
105
|
+
if (capabilityCeilingDeniesExtensions(diagnostic)) {
|
|
106
|
+
return [
|
|
107
|
+
facts,
|
|
108
|
+
`${denyExtensionsClause(diagnostic)}, so that extension cannot load for this child: listed \`subagentOnlyExtensions\` or \`extensions\` entries are suppressed, and leaving \`extensions\` unset does not enable ambient loading.`,
|
|
109
|
+
`If ${provider} depends on that extension, relax the capability ceiling to allow extensions, or use a model whose provider does not.`,
|
|
110
|
+
].join("\n");
|
|
111
|
+
}
|
|
112
|
+
return [
|
|
113
|
+
facts,
|
|
114
|
+
`If ${provider} depends on that extension, list it in \`subagentOnlyExtensions\` or \`extensions\` in the agent frontmatter, leave \`extensions\` unset so the child loads the ambient extensions, or register it from the host with \`registerRequiredChildExtensions\` so it loads for every launch.`,
|
|
115
|
+
].join("\n");
|
|
116
|
+
}
|
|
@@ -55,6 +55,8 @@ export interface RunnerSubagentStep {
|
|
|
55
55
|
}>;
|
|
56
56
|
modelResponseAliases?: Record<string, string[]>;
|
|
57
57
|
tools?: string[];
|
|
58
|
+
/** Provider of `model` that a parent extension registers; set only when this child loads no ambient extensions. */
|
|
59
|
+
parentExtensionProvider?: string;
|
|
58
60
|
excludeTools?: string[];
|
|
59
61
|
allowNestedSubagents?: boolean;
|
|
60
62
|
/** Resolved selected-agent policy for launches made by this child. */
|
package/src/shared/types.d.ts
CHANGED
|
@@ -2682,12 +2682,11 @@ export interface ExtensionConfig {
|
|
|
2682
2682
|
/** Global cap on simultaneously-running subagent tasks within a single run. Defaults to 20. */
|
|
2683
2683
|
globalConcurrencyLimit?: number;
|
|
2684
2684
|
/**
|
|
2685
|
-
* Global default runtime deadline in milliseconds
|
|
2686
|
-
*
|
|
2687
|
-
*
|
|
2688
|
-
*
|
|
2689
|
-
*
|
|
2690
|
-
* stay unbounded at the top level by design — their children are bounded individually.
|
|
2685
|
+
* Global default runtime deadline in milliseconds for foreground launches and
|
|
2686
|
+
* plain single-agent async runs when neither the call (`timeoutMs`/`maxRuntimeMs`)
|
|
2687
|
+
* nor the selected agent provides a timeout. Without a configured deadline,
|
|
2688
|
+
* these launches are unbounded. Explicit call values and agent frontmatter
|
|
2689
|
+
* defaults still win. Composite async runs stay unbounded at the top level.
|
|
2691
2690
|
* Must be a positive integer; invalid values are ignored.
|
|
2692
2691
|
*/
|
|
2693
2692
|
timeoutMs?: number;
|
|
@@ -780,6 +780,8 @@ export function validateWorkflowScript(script, options = {}) {
|
|
|
780
780
|
if (node !== wrapper && node.async === true && (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression")) {
|
|
781
781
|
errors.push({ message: "workflowScript does not support nested async functions. Use top-level await, plain helper functions that return runs.run(...), or explicit Promise chains.", ...nodeLocation(node) });
|
|
782
782
|
}
|
|
783
|
+
if (node.type === "ImportExpression")
|
|
784
|
+
errors.push({ message: "workflowScript cannot load modules with import().", ...nodeLocation(node) });
|
|
783
785
|
if (directRunsCall(node, "run")) {
|
|
784
786
|
const args = Array.isArray(node.arguments) ? node.arguments : [];
|
|
785
787
|
const keyNode = astNode(args[0]) ? args[0] : undefined;
|