feat: add Pi subagent scheduler and child runtime
This commit is contained in:
@@ -14,6 +14,7 @@ import type {
|
||||
KnownToolDetails,
|
||||
PublicWorkerState,
|
||||
} from './contracts';
|
||||
import { projectSubagentDetailsV1 } from './subagent-protocol';
|
||||
|
||||
export type ConversationInvalidationCode =
|
||||
| 'snapshot-required'
|
||||
@@ -161,19 +162,7 @@ function isKnownToolDetails(value: unknown): value is KnownToolDetails {
|
||||
});
|
||||
}
|
||||
if (record.schema === 'subagent.v1') {
|
||||
return isNonEmptyString(record.dispatchId)
|
||||
&& ['single', 'parallel', 'chain'].includes(String(record.mode))
|
||||
&& Array.isArray(record.tasks)
|
||||
&& record.tasks.every((task) => {
|
||||
const item = asRecord(task);
|
||||
return item !== null
|
||||
&& isNonEmptyString(item.taskId)
|
||||
&& isNonEmptyString(item.agentId)
|
||||
&& ['read-only', 'coding'].includes(String(item.toolProfile))
|
||||
&& ['queued', 'running', 'complete', 'error', 'aborted', 'skipped']
|
||||
.includes(String(item.status))
|
||||
&& (item.usage === undefined || isUsage(item.usage));
|
||||
});
|
||||
return projectSubagentDetailsV1(record) !== undefined;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user