A TUI run against an unreachable endpoint failed with only 'fetch failed':
undici wraps transport failures in a bare TypeError whose diagnosis lives
on .cause, and every diagnostic seam rendered only error.message. The
readline front door additionally rendered failed turns as pure silence.
- dsh-llm: new errorChain(value) renders the full cause chain and
AggregateError members with circular/hostile-coercion containment.
- llm-deepseek: pre-response transport failures throw LlmError('NETWORK')
naming the endpoint and chaining the fetch TypeError; aborts keep their
DOMException so the loop still classifies them as cancellation.
- agent-loop: durable turn/end error messages and logger warnings render
through errorChain; local renderThrown copies removed.
- ui-stdio: failure turn/end reasons now render ([turn failed <code>],
[turn aborted], [turn rejected], output-token-limit); startup-failure
logs use errorChain.
- ui-tui: agent/error notices and the startup-failure line use errorChain.
77 lines
2.9 KiB
Markdown
77 lines
2.9 KiB
Markdown
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
|
|
|
|
# ctx.agentLoop
|
|
|
|
`AgentLoop` — provided by `@deepseek-ai/dsh-agent-loop`.
|
|
|
|
Concrete agent factory and driver service.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-loop/src/index.ts#L398)
|
|
|
|
### ctx.agentLoop.create(id, options?, meta?)
|
|
|
|
```ts website-api
|
|
/**
|
|
* Create an agent and session under one caller-supplied identity, owned by
|
|
* the accessing fiber. Constructor-driven config calls mint a fresh combined
|
|
* id before entering this boundary.
|
|
* @param id - shared agent/session identity.
|
|
* @param options - concrete loop options.
|
|
* @param meta - optional fresh-session workspace metadata.
|
|
* @returns the published running agent.
|
|
*/
|
|
create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent
|
|
```
|
|
|
|
Create an agent and session under one caller-supplied identity, owned by the accessing fiber. Constructor-driven config calls mint a fresh combined id before entering this boundary.
|
|
|
|
- `id` — shared agent/session identity.
|
|
- `options` — concrete loop options.
|
|
- `meta` — optional fresh-session workspace metadata.
|
|
|
|
**Returns** the published running agent.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-loop/src/index.ts#L533)
|
|
|
|
### ctx.agentLoop.createAgent(ownerCtx, options)
|
|
|
|
```ts website-api
|
|
/**
|
|
* Create an owned agent on a caller-supplied session id.
|
|
* @param ownerCtx - caller context that structurally owns the transaction.
|
|
* @param options - identities, session seed/metadata, loop options, setup, and cancellation.
|
|
* @returns the published handle.
|
|
*/
|
|
async createAgent(ownerCtx: Context, options: CreateAgentOptions): Promise<AgentHandle>
|
|
```
|
|
|
|
Create an owned agent on a caller-supplied session id.
|
|
|
|
- `ownerCtx` — caller context that structurally owns the transaction.
|
|
- `options` — identities, session seed/metadata, loop options, setup, and cancellation.
|
|
|
|
**Returns** the published handle.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-loop/src/index.ts#L555)
|
|
|
|
### ctx.agentLoop.resume(ownerCtx, options)
|
|
|
|
```ts website-api
|
|
/**
|
|
* Resume an owned agent from the configured persistence service.
|
|
* @param ownerCtx - caller context that owns load, setup, and the live lifecycle.
|
|
* @param options - persisted identity, loop options, setup, and cancellation.
|
|
* @returns the published handle.
|
|
*/
|
|
async resume(ownerCtx: Context, options: ResumeAgentOptions): Promise<AgentHandle>
|
|
```
|
|
|
|
Resume an owned agent from the configured persistence service.
|
|
|
|
- `ownerCtx` — caller context that owns load, setup, and the live lifecycle.
|
|
- `options` — persisted identity, loop options, setup, and cancellation.
|
|
|
|
**Returns** the published handle.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-loop/src/index.ts#L587)
|