docs: reserve seam for complete capabilities
This commit is contained in:
@@ -62,7 +62,7 @@ function parseHeadlessSpec(text: string, source: string): HeadlessCreateSpec {
|
||||
* Load a headless spec from `--config-json` (inline) or `--config` (a JSON file),
|
||||
* returning `undefined` when neither is supplied.
|
||||
* @param args - parsed create args.
|
||||
* @param readFileText - file reader seam for tests.
|
||||
* @param readFileText - File-reader hook for tests.
|
||||
* @returns the resolved args + feature plan, or `undefined` for interactive runs.
|
||||
*/
|
||||
export async function resolveHeadless(
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface CommandTelemetryEvent {
|
||||
success: boolean
|
||||
}
|
||||
|
||||
/** Injectable consent and delivery seams for tests. */
|
||||
/** Injectable consent and delivery hooks for tests. */
|
||||
export interface CommandTelemetryDeps {
|
||||
resolve?: (cwd: string) => Promise<ConsentDecision>
|
||||
reporter?: Pick<TelemetryReporter, 'report' | 'flush'>
|
||||
@@ -36,7 +36,7 @@ export interface CommandTelemetryDeps {
|
||||
* telemetry event, draining in-flight sends before returning. Swallows every
|
||||
* error so telemetry can never change a command's result.
|
||||
* @param event - the command lifecycle facts.
|
||||
* @param deps - consent and delivery seams; defaults hit the real endpoint.
|
||||
* @param deps - Consent and delivery hooks; defaults hit the real endpoint.
|
||||
*/
|
||||
export async function reportCommandTelemetry(
|
||||
event: CommandTelemetryEvent,
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/scaffold/server/README.md
|
||||
README.md: 0afb3a38ece57f74729a218dc85348fa6c7fa529
|
||||
README.zh.md: 5305434abbd83eb230dcdd81e72120d96da26cda
|
||||
README.md: 9c53946f4112e9ce8e17590c2ff91fb4b8c2ef74
|
||||
README.zh.md: 270691f859426dbdc6ca9d8f05049d290eaa8e1b
|
||||
|
||||
@@ -10,7 +10,7 @@ The `jsonrpc` plugin serves newline-delimited JSON-RPC over stdio so out-of-proc
|
||||
|
||||
## Config
|
||||
|
||||
`maxTokensAsSuccess` defaults to `false` and affects only the deployment-mapped status on `subagent.finished`; root-session prompts have no prompt-level status. `JsonRpcConfig.input`, `output`, and `exit` are runtime-only transport seams; production uses process stdio and `process.exit`.
|
||||
`maxTokensAsSuccess` defaults to `false` and affects only the deployment-mapped status on `subagent.finished`; root-session prompts have no prompt-level status. `JsonRpcConfig.input`, `output`, and `exit` are runtime-only transport hooks; production uses process stdio and `process.exit`.
|
||||
|
||||
## stdout is the protocol
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
## 配置
|
||||
|
||||
`maxTokensAsSuccess` 默认为 `false`,且只影响 `subagent.finished` 上由部署映射的状态;根会话提示词没有提示词级状态。`JsonRpcConfig.input`、`output` 和 `exit` 是仅供运行时使用的传输 seam;生产环境使用进程 stdio 和 `process.exit`。
|
||||
`maxTokensAsSuccess` 默认为 `false`,且只影响 `subagent.finished` 上由部署映射的状态;根会话提示词没有提示词级状态。`JsonRpcConfig.input`、`output` 和 `exit` 是仅供运行时使用的传输钩子;生产环境使用进程 stdio 和 `process.exit`。
|
||||
|
||||
## stdout 即协议
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export const name = 'jsonrpc'
|
||||
// Only the agent factory is required; initialize reads the optional LLM seam with ctx.get().
|
||||
export const inject = ['agents']
|
||||
|
||||
/** JSON-RPC deployment config plus runtime-only test seams. */
|
||||
/** JSON-RPC deployment config plus runtime-only test hooks. */
|
||||
export interface JsonRpcConfig {
|
||||
/** Report max-token turn/subagent termination as a successful SDK result. */
|
||||
maxTokensAsSuccess?: boolean
|
||||
@@ -53,11 +53,11 @@ export function apply(ctx: Context, config: JsonRpcConfig): void {
|
||||
// Protocol shutdown owns the complete runtime process, so it must await the
|
||||
// root lifecycle (including persistence) before exiting.
|
||||
const rootFiber = ctx.root.fiber
|
||||
/* v8 ignore next -- production stdio wiring; tests always inject the runtime seams */
|
||||
/* v8 ignore next -- production stdio wiring; tests always inject the runtime hooks */
|
||||
const input = config.input ?? process.stdin
|
||||
/* v8 ignore next -- production stdio wiring; tests always inject the runtime seams */
|
||||
/* v8 ignore next -- production stdio wiring; tests always inject the runtime hooks */
|
||||
const output = config.output ?? process.stdout
|
||||
/* v8 ignore next -- production exit wiring; tests always inject the runtime seams */
|
||||
/* v8 ignore next -- production exit wiring; tests always inject the runtime hooks */
|
||||
const exit = config.exit ?? ((code: number): void => { process.exit(code) })
|
||||
|
||||
const transport = new JsonRpcLineTransport(input, output)
|
||||
|
||||
@@ -11,7 +11,7 @@ import SessionPersistenceJsonl from '@deepseek-ai/dsh-session-persistence-jsonl'
|
||||
import * as jsonrpc from '../src/index.ts'
|
||||
|
||||
/**
|
||||
* Mount the real namespace plugin with in-memory stdio and exit seams. Covers
|
||||
* Mount the real namespace plugin with in-memory stdio and exit hooks. Covers
|
||||
* the full transport/server path, response-before-exit shutdown exactly once,
|
||||
* and bare-fiber disposal without process exit.
|
||||
*/
|
||||
|
||||
@@ -27,11 +27,11 @@ export const ANONYMOUS_ID_FILE_NAME = 'telemetry.json'
|
||||
|
||||
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
||||
|
||||
/** Ambient seams for locating and generating the id; every field has a default. */
|
||||
/** Ambient hooks for locating and generating the id; every field has a default. */
|
||||
export interface AnonymousIdOptions {
|
||||
/** Environment consulted for `DSH_HOME`; defaults to `process.env`. */
|
||||
env?: NodeJS.ProcessEnv
|
||||
/** UUID generator; defaults to `crypto.randomUUID` (test seam). */
|
||||
/** UUID generator; defaults to `crypto.randomUUID` (test hook). */
|
||||
randomUUID?: () => string
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export interface AnonymousIdOptions {
|
||||
* Delegates to {@link resolveDshHome} so telemetry shares the harness's one
|
||||
* home-resolution policy (`DSH_HOME` > `~/.dsh`) instead of maintaining a
|
||||
* second config-directory convention.
|
||||
* @param options - environment seam.
|
||||
* @param options - Environment hook.
|
||||
* @returns absolute harness home path.
|
||||
*/
|
||||
export function globalConfigDir(options: AnonymousIdOptions = {}): string {
|
||||
@@ -74,7 +74,7 @@ async function readPersistedId(file: string): Promise<AnonymousId | undefined> {
|
||||
* Return the harness home's anonymous id, creating and persisting one on first use.
|
||||
* Persistence is best-effort: a write failure still returns a usable id for the
|
||||
* current run so telemetry is never blocked by config-dir permissions.
|
||||
* @param options - config-location and UUID-generation seams.
|
||||
* @param options - config-location and UUID-generation hooks.
|
||||
* @returns the stable per-harness-home anonymous id.
|
||||
*/
|
||||
export async function getOrCreateAnonymousId(options: AnonymousIdOptions = {}): Promise<AnonymousId> {
|
||||
|
||||
@@ -45,7 +45,7 @@ interface TelemetryEnvelope extends TelemetryPayload {
|
||||
sentAt: string
|
||||
}
|
||||
|
||||
/** Injectable seams for {@link TelemetryReporter}; every field has a default. */
|
||||
/** Injectable dependencies for {@link TelemetryReporter}; every field has a default. */
|
||||
export interface TelemetryReporterOptions {
|
||||
/** Collection endpoint; defaults to {@link DSH_TELEMETRY_ENDPOINT}. */
|
||||
endpoint?: string
|
||||
@@ -71,7 +71,7 @@ export class TelemetryReporter {
|
||||
readonly #now: () => number
|
||||
readonly #inflight = new Set<Promise<DeliveryOutcome>>()
|
||||
|
||||
/** @param options - endpoint, transport, id provider, and timing seams. */
|
||||
/** @param options - endpoint, transport, id provider, and timing dependencies. */
|
||||
constructor(options: TelemetryReporterOptions = {}) {
|
||||
this.#endpoint = options.endpoint ?? DSH_TELEMETRY_ENDPOINT
|
||||
this.#fetch = options.fetch ?? globalThis.fetch
|
||||
|
||||
Reference in New Issue
Block a user