Files
deepseek-harness/website/zh-CN/api/harness/agent-loop.md
lintianle 2cde2a9032 Merge origin/master into feat/website-docs
Conflict resolution notes:
- package.json/run-gates: both sides' new doc-sync gates kept (master's
  scoped-events/readme gates + this branch's website-api/website-yaml);
  js-yaml devDeps deduped (master added them independently).
- pnpm-workspace/knip: website AND python/sdk-runtime entries kept.
- doc-typecheck/verify-type-equiv: master's condensed headers kept, website
  glob retained in both scan scopes.
- vendor/cordis/src/fiber.ts: master's lifecycle-hardening code taken; this
  branch's richer FiberState JSDoc reapplied on top. vendor/README.md logs
  both local modifications (hardening = 6, JSDoc enrichment = 7).
- pnpm-lock: regenerated from master's side (pnpm install).

Post-merge sync the gates forced (the system working as designed):
- verify-website-yaml caught 4 stale plugin names from master's package
  reorg (dsh-stdio-agent -> dsh-stdio-demo, dsh-acp-agent -> dsh-acp-demo);
  8 references fixed across guide/ and develop/.
- gen-website-api picked up master's 6 new services automatically
  (ctx.approval/permission/sandbox/sessionQuery/skills/tasks -> 6 new pages
  + sidebar); api/index.md hub updated to list them.
- AGENTS.md budget ceiling 1370 -> 1400: the website rows (layout line + two
  command lines) and master's own growth collided with the old ceiling; all
  three website rows are load-bearing (new top-level dir, new CI command).
2026-07-16 21:36:43 +08:00

2.0 KiB

ctx.agentLoop

AgentLoop — provided by @deepseek-ai/dsh-agent-loop.

Concrete ReactLoopAgent factory and driver service.

Source

ctx.agentLoop.create(id, options?, meta?)

create(id: AgentId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): ReactLoopAgent

Create an agent on a fresh per-run session, owned by the accessing fiber. Constructor-driven config calls use the loop fiber itself.

  • id — agent registry id.
  • options — concrete loop options.
  • meta — optional fresh-session workspace metadata.

Returns the published running agent.

Source

ctx.agentLoop.createAgent(ownerCtx, options)

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

ctx.agentLoop.resume(ownerCtx, options)

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