@sema-agent/core 1.450.0 → 1.451.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.
@@ -892,6 +892,7 @@ export async function prepareTask(spec, deps, sessions, resume, _memorySelector,
892
892
  parentModel: () => harnessRef.current?.getModel(),
893
893
  ...(spec.getApiKeyAndHeaders !== undefined ? { parentGetApiKeyAndHeaders: spec.getApiKeyAndHeaders } : {}),
894
894
  principal: spec.principal,
895
+ oneShot: spec.oneShot,
895
896
  workflowDepth: internals?.workflowDepth,
896
897
  parentCwd: taskRootPath,
897
898
  parentThinking: () => harnessRef.current?.getThinkingLevel() ?? thinking,
@@ -231,6 +231,7 @@ export interface TaskSpec {
231
231
  images?: ImageInput[];
232
232
  sessionId?: string;
233
233
  requireExistingSession?: boolean;
234
+ oneShot?: boolean;
234
235
  clientContext?: {
235
236
  timeZone?: string;
236
237
  userEmail?: string;
@@ -78,6 +78,7 @@ export interface RunWorkflowToolDeps {
78
78
  sizeGuideline?: WorkflowSizeGuideline;
79
79
  sourceTaskId?: string;
80
80
  principal?: string;
81
+ oneShot?: boolean;
81
82
  workflowDepth?: number;
82
83
  parentCwd?: string;
83
84
  parentThinking?: () => import("../core/types.js").TaskSpec["thinking"];
@@ -524,10 +524,16 @@ export async function createRunWorkflowTool(d) {
524
524
  ...(persistedScriptPath !== undefined ? { scriptPath: persistedScriptPath } : {}),
525
525
  note: (() => {
526
526
  const pollExpr = d.taskRegistry ? `TaskOutput({ task_id: "${runId}" })` : undefined;
527
+ const blockingPollExpr = d.taskRegistry ? `TaskOutput({ task_id: "${runId}", block: true })` : undefined;
527
528
  const journalRef = d.journalStore?.locator?.(runId, taskScope ?? d.scope ?? "");
528
529
  const carries = pollExpr
529
530
  ? ` A terminal ${pollExpr} reply carries its result AND per-agent rows — read them${journalRef !== undefined ? ` (full journal: ${journalRef})` : ""} before assuming an empty or unexpected result.`
530
531
  : "";
532
+ if (d.oneShot === true) {
533
+ return blockingPollExpr
534
+ ? `This is a ONE-SHOT submission (e.g. headless \`-p\`) — there is no later turn for a background notification to land in, so do NOT end your turn expecting one. Actively wait instead: ${blockingPollExpr}. If it is still running after the wait, wait again (bounded) rather than ending the turn, or write out your best available answer now if you are near your own time budget.${carries}`
535
+ : "This is a one-shot submission (e.g. headless `-p`) and no poll path is available — the workflow's outcome may not be recoverable after this turn ends.";
536
+ }
531
537
  if (d.notifier) {
532
538
  return `The workflow runs asynchronously. You will be NOTIFIED when it completes (the notification carries the result). End your turn and wait — do not poll unless the user asks for progress.${carries}`;
533
539
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "1.450.0",
3
+ "version": "1.451.0",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",