mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
refactor(move): move the batch runner and batch policy into @agent-device/command-registry (#2388)
* refactor(command-registry): move the batch runner and batch policy into @agent-device/command-registry * chore(gates): re-point the sdk-batch chunk groups and fallow baseline at the command-registry batch module
This commit is contained in:
committed by
GitHub
parent
367e795ee7
commit
527a56a6e7
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"finding_counts": {
|
||||
"packages/command-registry/src/batch.ts": {
|
||||
"complexity_moderate": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"src/__tests__/cli-config.test.ts": {
|
||||
"crap_high": {
|
||||
"count": 1
|
||||
@@ -89,11 +94,6 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"src/core/batch.ts": {
|
||||
"complexity_moderate": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"src/core/dispatch.ts": {
|
||||
"complexity_critical": {
|
||||
"count": 1
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"description": "The command descriptor registry: the single declaration of every command's surface, runtime-use, batch, timeout, and platform-execution traits, plus the catalogs and projections derived from it.",
|
||||
"dependencies": {
|
||||
"@agent-device/contracts": "workspace:*",
|
||||
"@agent-device/kernel": "workspace:*",
|
||||
"@agent-device/selectors": "workspace:*"
|
||||
},
|
||||
"exports": {
|
||||
@@ -61,6 +62,14 @@
|
||||
"./wait-positionals": {
|
||||
"types": "./src/wait-positionals.ts",
|
||||
"default": "./src/wait-positionals.ts"
|
||||
},
|
||||
"./batch": {
|
||||
"types": "./src/batch.ts",
|
||||
"default": "./src/batch.ts"
|
||||
},
|
||||
"./batch-policy": {
|
||||
"types": "./src/batch-policy.ts",
|
||||
"default": "./src/batch-policy.ts"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { deriveStructuredBatchCommandNames } from '@agent-device/command-registry/derive';
|
||||
import { commandDescriptors } from '@agent-device/command-registry/registry';
|
||||
import { deriveStructuredBatchCommandNames } from './derive.ts';
|
||||
import { commandDescriptors } from './registry.ts';
|
||||
import { AppError } from '@agent-device/kernel/errors';
|
||||
|
||||
/**
|
||||
@@ -3,9 +3,11 @@ import type { SessionRuntimeHints } from '@agent-device/kernel/contracts';
|
||||
/**
|
||||
* One step of a daemon batch, as submitted.
|
||||
*
|
||||
* Declared here rather than in `core/batch.ts` because the public API vocabulary
|
||||
* (`contracts/client-replay.ts`) is stated in terms of it, and `core/` sits above contracts. The
|
||||
* `runtime` field used to be written as `DaemonRequest['runtime']`, which pulled the whole daemon
|
||||
* Declared here rather than in `@agent-device/command-registry/batch` because the public API
|
||||
* vocabulary (`contracts/client-replay.ts`) is stated in terms of it, and contracts sits below
|
||||
* command-registry.
|
||||
*
|
||||
* The `runtime` field used to be written as `DaemonRequest['runtime']`, which pulled the whole daemon
|
||||
* request type in to say `SessionRuntimeHints` — the same type, one zone lower.
|
||||
*/
|
||||
export type DaemonBatchStep = {
|
||||
|
||||
Generated
+3
@@ -231,6 +231,9 @@ importers:
|
||||
'@agent-device/contracts':
|
||||
specifier: workspace:*
|
||||
version: link:../contracts
|
||||
'@agent-device/kernel':
|
||||
specifier: workspace:*
|
||||
version: link:../kernel
|
||||
'@agent-device/selectors':
|
||||
specifier: workspace:*
|
||||
version: link:../selectors
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import { STRUCTURED_BATCH_COMMAND_NAMES } from '../core/batch-policy.ts';
|
||||
import { STRUCTURED_BATCH_COMMAND_NAMES } from '@agent-device/command-registry/batch-policy';
|
||||
import {
|
||||
INTERNAL_COMMANDS,
|
||||
listCliCommandNames,
|
||||
|
||||
@@ -9,7 +9,7 @@ import { AppError } from '@agent-device/kernel/errors';
|
||||
import {
|
||||
BATCH_AVAILABLE_COMMANDS_HINT,
|
||||
readStructuredBatchCommandName,
|
||||
} from '../core/batch-policy.ts';
|
||||
} from '@agent-device/command-registry/batch-policy';
|
||||
import { assertAllowedKeys } from '../commands/input-readers.ts';
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ export type { AlertAction } from '@agent-device/contracts/alert-contract';
|
||||
export type { AppleOS } from '@agent-device/kernel/device';
|
||||
// fallow-ignore-next-line unused-type
|
||||
export type { JsonObject } from '@agent-device/contracts/client';
|
||||
export type { BatchRunResult } from '../core/batch.ts';
|
||||
export type { BatchRunResult } from '@agent-device/command-registry/batch';
|
||||
|
||||
import type {
|
||||
AgentDeviceCapabilitiesResult,
|
||||
@@ -138,7 +138,7 @@ import type {
|
||||
MetroReloadResult,
|
||||
} from '@agent-device/contracts/remote';
|
||||
|
||||
import type { BatchRunResult } from '../core/batch.ts';
|
||||
import type { BatchRunResult } from '@agent-device/command-registry/batch';
|
||||
|
||||
import type {
|
||||
AgentArtifactsResult,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { defineCommandFacet, defineCommandFamilyFromFacets } from '../family/typ
|
||||
import { commonToClientOptions } from '../common-input-fields.ts';
|
||||
import { batchCliOutputFormatters } from './output.ts';
|
||||
import { createBatchCommandMetadata, type BatchCommandStep, type BatchInput } from './metadata.ts';
|
||||
import { STRUCTURED_BATCH_COMMAND_NAMES } from '../../core/batch-policy.ts';
|
||||
import { STRUCTURED_BATCH_COMMAND_NAMES } from '@agent-device/command-registry/batch-policy';
|
||||
import { createBatchDaemonWriter } from './projection.ts';
|
||||
|
||||
const batchCommandMetadata = createBatchCommandMetadata();
|
||||
|
||||
@@ -12,7 +12,7 @@ import { type SessionRuntimeHints } from '@agent-device/kernel/contracts';
|
||||
import {
|
||||
STRUCTURED_BATCH_COMMAND_NAMES,
|
||||
readStructuredBatchCommandName,
|
||||
} from '../../core/batch-policy.ts';
|
||||
} from '@agent-device/command-registry/batch-policy';
|
||||
import { type CommandMetadata, type JsonSchema } from '../command-contract.ts';
|
||||
import {
|
||||
customField,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BatchRunResult, BatchStepResult } from '../../core/batch.ts';
|
||||
import type { BatchRunResult, BatchStepResult } from '@agent-device/command-registry/batch';
|
||||
import { readCommandMessage } from '@agent-device/kernel/success-text';
|
||||
import type { CliOutput } from '../command-contract.ts';
|
||||
import { resultOutput, type CliOutputFormatter } from '../output-common.ts';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog';
|
||||
import {
|
||||
STRUCTURED_BATCH_COMMAND_NAMES,
|
||||
readStructuredBatchCommandName,
|
||||
} from '../../core/batch-policy.ts';
|
||||
} from '@agent-device/command-registry/batch-policy';
|
||||
import {
|
||||
parseBatchStepRuntime,
|
||||
readBatchStepInputObject,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { runBatch } from '../../core/batch.ts';
|
||||
import { runBatch } from '@agent-device/command-registry/batch';
|
||||
import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../daemon-request.ts';
|
||||
|
||||
export async function runBatchCommands(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { SessionAction } from '@agent-device/contracts/session';
|
||||
import type { CommandFlags } from '@agent-device/contracts/command';
|
||||
import type { DaemonInvokeFn, DaemonRequest, DaemonResponse } from '../../daemon-request.ts';
|
||||
import { mergeParentFlags } from '../../../core/batch.ts';
|
||||
import { mergeParentFlags } from '@agent-device/command-registry/batch';
|
||||
import { AppError, normalizeError } from '@agent-device/kernel/errors';
|
||||
import {
|
||||
gesturePayloadFromPositionals,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'vitest';
|
||||
import type { AgentDeviceClient } from '../../client/client-types.ts';
|
||||
import { STRUCTURED_BATCH_COMMAND_NAMES } from '../../core/batch-policy.ts';
|
||||
import { STRUCTURED_BATCH_COMMAND_NAMES } from '@agent-device/command-registry/batch-policy';
|
||||
import { findCommandMetadata } from '../../commands/command-metadata.ts';
|
||||
import { createCommandToolExecutor } from '../command-tools.ts';
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
type CommandName,
|
||||
} from '../commands/command-metadata.ts';
|
||||
import { mcpBody } from '../commands/command-text.ts';
|
||||
import { resolveStructuredBatchCommandName } from '../core/batch-policy.ts';
|
||||
import { resolveStructuredBatchCommandName } from '@agent-device/command-registry/batch-policy';
|
||||
import {
|
||||
resolveCommandRecordsSessionAction,
|
||||
resolveCommandTimeoutPolicy,
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export { runBatch } from '../core/batch.ts';
|
||||
export { runBatch } from '@agent-device/command-registry/batch';
|
||||
|
||||
+10
-2
@@ -32,8 +32,16 @@ const publicSdkChunkGroups = [
|
||||
/packages[\\/]kernel[\\/]src[\\/]snapshot\.ts$/,
|
||||
],
|
||||
['sdk-io', /src[\\/]io\.d\.[cm]?ts$/, /src[\\/]io\.ts$/],
|
||||
['sdk-batch', /src[\\/]batch-policy\.d\.[cm]?ts$/, /src[\\/]batch-policy\.ts$/],
|
||||
['sdk-batch-runner', /src[\\/]core[\\/]batch\.d\.[cm]?ts$/, /src[\\/]core[\\/]batch\.ts$/],
|
||||
[
|
||||
'sdk-batch',
|
||||
/packages[\\/]command-registry[\\/]src[\\/]batch-policy\.d\.[cm]?ts$/,
|
||||
/packages[\\/]command-registry[\\/]src[\\/]batch-policy\.ts$/,
|
||||
],
|
||||
[
|
||||
'sdk-batch-runner',
|
||||
/packages[\\/]command-registry[\\/]src[\\/]batch\.d\.[cm]?ts$/,
|
||||
/packages[\\/]command-registry[\\/]src[\\/]batch\.ts$/,
|
||||
],
|
||||
['sdk-finders', /src[\\/]finders\.d\.[cm]?ts$/, /src[\\/]finders\.ts$/],
|
||||
[
|
||||
'sdk-android-adb',
|
||||
|
||||
Reference in New Issue
Block a user