@fishwithcat/dsh-agent 0.2.2-alpha.2 → 0.2.2-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -18,8 +18,8 @@
18
18
  en: 7d1ae2375bd4fbfc
19
19
  zh: b6b4b2e943174cb2
20
20
  /deepseek-ai-dsh-agent/use-this-package/create-or-resume-an-agent:
21
- en: 26d49c76bce41e30
22
- zh: 9710f54e24b190d1
21
+ en: a62e2d3dd8c32597
22
+ zh: 646f48ab401d5941
23
23
  /deepseek-ai-dsh-agent/use-this-package/select-a-model:
24
24
  en: 85b0ff72a187110f
25
25
  zh: 3f61c1568d27b8bc
package/README.md CHANGED
@@ -29,7 +29,7 @@ Mount `dsh-agent` with `dsh-session-projection`: it provides `ctx.agents`, the `
29
29
 
30
30
  ### Create or resume an agent
31
31
 
32
- `ctx.agents.create()` builds a fresh agent and session under one identity; `ctx.agents.resume()` loads a persisted session and rebuilds the agent on it. Both delegate to the registered factory and return an `AgentHandle` — the only object that can tear that agent down. See [`AgentFactory`](src/index.ts) for publication and failure-cleanup timing. Set `parentAgent` in either operation's options to make the result a runtime child; omit it for a runtime root. `get(id)`, `list()`, and `roots()` find live agents, and `isOwnedBy(id, parent)` tests that exact live relation.
32
+ `ctx.agents.create()` builds a fresh agent and session under one identity; `ctx.agents.resume()` loads a persisted session and rebuilds the agent on it. Both delegate to the registered factory and return an `AgentHandle` — the only object that can tear that agent down. See [`AgentFactory`](src/index.ts) for publication and failure-cleanup timing. `get(id)` and `list()` find live agents. The [subagent service](../../subagent/subagent/README.md) owns delegated execution and runtime tree membership.
33
33
 
34
34
  ```text
35
35
  const handle = await ctx.agents.create({
package/README.zh.md CHANGED
@@ -29,7 +29,7 @@ kind: "package-reference"
29
29
 
30
30
  ### 创建或恢复 agent
31
31
 
32
- `ctx.agents.create()` 在一个身份下构建全新 agent 与会话;`ctx.agents.resume()` 加载持久化会话并在此基础上重建 agent。两者都委托给已注册工厂,并返回 `AgentHandle`——唯一能拆除该 agent 的对象。发布和失败清理的时序见 [`AgentFactory`](src/index.ts)。在任一操作的 options 中设置 `parentAgent`,可使结果成为运行时子级;省略它则得到运行时根级。`get(id)`、`list()` 与 `roots()` 用于查找实时 agent;`isOwnedBy(id, parent)` 用于检验这项确切的实时所有权关系。
32
+ `ctx.agents.create()` 在一个身份下构建全新 agent 与会话;`ctx.agents.resume()` 加载持久化会话并在此基础上重建 agent。两者都委托给已注册工厂,并返回 `AgentHandle`——唯一能拆除该 agent 的对象。发布和失败清理的时序见 [`AgentFactory`](src/index.ts)。`get(id)` 与 `list()` 用于查找实时 agent。[subagent 服务](../../subagent/subagent/README.zh.md) 拥有委派执行和运行时树成员关系。
33
33
 
34
34
  ```text
35
35
  const handle = await ctx.agents.create({
package/lib/index.js CHANGED
@@ -662,7 +662,7 @@ var AgentRegistry = class extends Service {
662
662
  * agent): this constructs the agent and its session. Rejects if no factory is
663
663
  * registered or creation/setup fails. The resolved {@link AgentHandle} lets
664
664
  * the owner tear down exactly this agent.
665
- * @param options - shared identity, optional live parent, session seed/metadata, and agent options.
665
+ * @param options - shared identity, session seed/metadata, and agent options.
666
666
  * @returns the handle after setup, rollback-covered publication, and loop start complete.
667
667
  */
668
668
  async create(options) {
@@ -675,7 +675,7 @@ var AgentRegistry = class extends Service {
675
675
  * Load a persisted session and resume an agent on it through the registered
676
676
  * factory. Rejects if no factory is registered; the factory rejects if
677
677
  * session persistence is not configured or persistence/setup fails.
678
- * @param options - persisted identity, optional live parent, configuration, and setup.
678
+ * @param options - persisted identity, configuration, and setup.
679
679
  * @returns the handle after setup, rollback-covered publication, and loop start complete.
680
680
  */
681
681
  async resume(options) {
@@ -691,8 +691,7 @@ var AgentRegistry = class extends Service {
691
691
  * (`scopeTarget(agent, agent)`): the subject is the agent in hand, so the
692
692
  * emits are scope-filtered regardless of which context invoked `register`
693
693
  * (calling through `agent.ctx` scopes EFFECTS; dispatch scoping always
694
- * requires passing the carrier). The entry is a runtime root; factory-backed
695
- * creation uses `options.parentAgent` for child ownership. Await the registration before using the agent.
694
+ * requires passing the carrier). Await registration before using the agent.
696
695
  * @param agent - the already-constructed agent to record in the store.
697
696
  * @returns the awaitable Cordis effect disposer (single-shot; a repeat call
698
697
  * returns undefined without awaiting an in-flight teardown). Exact
@@ -705,7 +704,7 @@ var AgentRegistry = class extends Service {
705
704
  */
706
705
  register(agent) {
707
706
  return this.ctx.effect(async function* () {
708
- yield this.enter(agent, void 0);
707
+ yield this.enter(agent);
709
708
  await this.announce(agent, "startup");
710
709
  }.bind(this), "agents.register()");
711
710
  }
@@ -716,15 +715,12 @@ var AgentRegistry = class extends Service {
716
715
  * returned detach closure into its pre-installed composite teardown before
717
716
  * calling {@link announce}. Ordinary callers use {@link register}.
718
717
  * @param agent - the prepared, unpublished agent.
719
- * @param owner - explicitly supplied live runtime owner, or
720
- * undefined for a top-level runtime root. This is runtime ownership, not
721
- * the resumed session's durable parent lineage.
722
718
  * @returns an idempotent closure that removes this exact entry and emits
723
719
  * `agent/disposed` with listener failures contained. When called from a
724
720
  * `agent/created` listener, removal and disposal wait until the serial
725
721
  * creation dispatch settles.
726
722
  */
727
- enter(agent, owner) {
723
+ enter(agent) {
728
724
  const id = agent.id;
729
725
  if (id !== agent.session.id) throw new Error(`agent id "${id}" does not match session id "${agent.session.id}"`);
730
726
  const carrier = scopeTarget(agent, agent);
@@ -732,7 +728,6 @@ var AgentRegistry = class extends Service {
732
728
  const entry = {
733
729
  id,
734
730
  agent,
735
- owner,
736
731
  carrier,
737
732
  announced: false,
738
733
  announcing: false,
@@ -812,32 +807,12 @@ var AgentRegistry = class extends Service {
812
807
  return this.store.get(id)?.agent;
813
808
  }
814
809
  /**
815
- * Test whether a live agent was created through one exact parent agent's
816
- * scoped context. Runtime ownership is independent of durable session
817
- * lineage and remains unambiguous when unrelated providers reuse an id.
818
- * @param id - the candidate child agent's shared agent/session id.
819
- * @param owner - the expected runtime creator agent.
820
- * @returns true only while the exact child entry is live under that owner.
821
- */
822
- isOwnedBy(id, owner) {
823
- return this.store.get(id)?.owner === owner;
824
- }
825
- /**
826
810
  * All live agents, in registration order.
827
811
  * @returns a fresh array; mutating it does not affect the registry.
828
812
  */
829
813
  list() {
830
814
  return [...this.store.values()].map((entry) => entry.agent);
831
815
  }
832
- /**
833
- * All live top-level agents in registration order. A top-level agent was
834
- * created without an owning agent context; durable session lineage does not
835
- * affect this runtime relation, so a resumed fork may still be a root.
836
- * @returns a fresh array; mutating it does not affect the registry.
837
- */
838
- roots() {
839
- return [...this.store.values()].filter((entry) => entry.owner === void 0).map((entry) => entry.agent);
840
- }
841
816
  /** Reject new initiator boundaries while inherited continuations drain. */
842
817
  closeInitiators() {
843
818
  if (this.initiatorState === "active") this.initiatorState = "closing";
@@ -50,8 +50,6 @@ export type AgentSetup = (agentCtx: Context, agent: Agent) => AgentSetupCommit |
50
50
  export interface CreateAgentOptions {
51
51
  /** The live agent/session identity. */
52
52
  readonly sessionId: SessionId;
53
- /** Live parent Agent for runtime ownership; omit for a root Agent. */
54
- readonly parentAgent?: Agent;
55
53
  /**
56
54
  * Session creation metadata: validated absolute `cwd`, `parentSession`
57
55
  * fork lineage, the `isSeeded` fork marker, the coarse `origin`
@@ -112,8 +110,6 @@ export interface CreateAgentOptions {
112
110
  export interface ResumeAgentOptions {
113
111
  /** The persisted session id to load and use as the live agent/session identity. */
114
112
  readonly resumeSessionId: SessionId;
115
- /** Live parent Agent for runtime ownership; omit for a root Agent. */
116
- readonly parentAgent?: Agent;
117
113
  /** Route fallback and output controls; see {@link AgentOptions} for live accessor semantics. */
118
114
  readonly agentOptions?: AgentOptions;
119
115
  /** Optional creation-only cancellation signal for persistence load/setup; detached before return. */
@@ -172,7 +168,7 @@ export interface AgentFactory {
172
168
  * transaction and resulting lifecycle to that owner; it must not infer
173
169
  * ownership from the factory object's registration context.
174
170
  * @param ownerCtx - caller-bound context that owns the transaction and live handle.
175
- * @param options - agent/session identity, configuration, optional live parent, and setup.
171
+ * @param options - agent/session identity, configuration, and setup.
176
172
  * @returns the owned handle after setup and both creation announcements complete.
177
173
  */
178
174
  createAgent(ownerCtx: Context, options: CreateAgentOptions): Promise<AgentHandle>;
@@ -184,7 +180,7 @@ export interface AgentFactory {
184
180
  * Initialization cleanup and publication follow the same timing as
185
181
  * {@link createAgent}.
186
182
  * @param ownerCtx - caller-bound context that owns load, setup, and the live handle.
187
- * @param options - persisted identity, configuration, optional live parent, and setup.
183
+ * @param options - persisted identity, configuration, and setup.
188
184
  * @returns the owned handle after setup, both announcements, and loop start complete.
189
185
  */
190
186
  resume(ownerCtx: Context, options: ResumeAgentOptions): Promise<AgentHandle>;
@@ -287,7 +283,7 @@ export declare class AgentRegistry extends Service {
287
283
  * agent): this constructs the agent and its session. Rejects if no factory is
288
284
  * registered or creation/setup fails. The resolved {@link AgentHandle} lets
289
285
  * the owner tear down exactly this agent.
290
- * @param options - shared identity, optional live parent, session seed/metadata, and agent options.
286
+ * @param options - shared identity, session seed/metadata, and agent options.
291
287
  * @returns the handle after setup, rollback-covered publication, and loop start complete.
292
288
  */
293
289
  create(options: CreateAgentOptions): Promise<AgentHandle>;
@@ -295,7 +291,7 @@ export declare class AgentRegistry extends Service {
295
291
  * Load a persisted session and resume an agent on it through the registered
296
292
  * factory. Rejects if no factory is registered; the factory rejects if
297
293
  * session persistence is not configured or persistence/setup fails.
298
- * @param options - persisted identity, optional live parent, configuration, and setup.
294
+ * @param options - persisted identity, configuration, and setup.
299
295
  * @returns the handle after setup, rollback-covered publication, and loop start complete.
300
296
  */
301
297
  resume(options: ResumeAgentOptions): Promise<AgentHandle>;
@@ -306,8 +302,7 @@ export declare class AgentRegistry extends Service {
306
302
  * (`scopeTarget(agent, agent)`): the subject is the agent in hand, so the
307
303
  * emits are scope-filtered regardless of which context invoked `register`
308
304
  * (calling through `agent.ctx` scopes EFFECTS; dispatch scoping always
309
- * requires passing the carrier). The entry is a runtime root; factory-backed
310
- * creation uses `options.parentAgent` for child ownership. Await the registration before using the agent.
305
+ * requires passing the carrier). Await registration before using the agent.
311
306
  * @param agent - the already-constructed agent to record in the store.
312
307
  * @returns the awaitable Cordis effect disposer (single-shot; a repeat call
313
308
  * returns undefined without awaiting an in-flight teardown). Exact
@@ -326,15 +321,12 @@ export declare class AgentRegistry extends Service {
326
321
  * returned detach closure into its pre-installed composite teardown before
327
322
  * calling {@link announce}. Ordinary callers use {@link register}.
328
323
  * @param agent - the prepared, unpublished agent.
329
- * @param owner - explicitly supplied live runtime owner, or
330
- * undefined for a top-level runtime root. This is runtime ownership, not
331
- * the resumed session's durable parent lineage.
332
324
  * @returns an idempotent closure that removes this exact entry and emits
333
325
  * `agent/disposed` with listener failures contained. When called from a
334
326
  * `agent/created` listener, removal and disposal wait until the serial
335
327
  * creation dispatch settles.
336
328
  */
337
- enter(agent: Agent, owner: Agent | undefined): () => void;
329
+ enter(agent: Agent): () => void;
338
330
  /** Remove one exact entered agent and emit its paired disposal when announced. */
339
331
  private detachEntered;
340
332
  /** Emit the paired disposal edge through the entry's stable carrier. */
@@ -356,27 +348,11 @@ export declare class AgentRegistry extends Service {
356
348
  * @returns the agent, or undefined when no live agent has that id.
357
349
  */
358
350
  get(id: SessionId): Agent | undefined;
359
- /**
360
- * Test whether a live agent was created through one exact parent agent's
361
- * scoped context. Runtime ownership is independent of durable session
362
- * lineage and remains unambiguous when unrelated providers reuse an id.
363
- * @param id - the candidate child agent's shared agent/session id.
364
- * @param owner - the expected runtime creator agent.
365
- * @returns true only while the exact child entry is live under that owner.
366
- */
367
- isOwnedBy(id: SessionId, owner: Agent): boolean;
368
351
  /**
369
352
  * All live agents, in registration order.
370
353
  * @returns a fresh array; mutating it does not affect the registry.
371
354
  */
372
355
  list(): Agent[];
373
- /**
374
- * All live top-level agents in registration order. A top-level agent was
375
- * created without an owning agent context; durable session lineage does not
376
- * affect this runtime relation, so a resumed fork may still be a root.
377
- * @returns a fresh array; mutating it does not affect the registry.
378
- */
379
- roots(): Agent[];
380
356
  /** Reject new initiator boundaries while inherited continuations drain. */
381
357
  private closeInitiators;
382
358
  /** Wait for returned-Promise boundaries, then invalidate retained references. */
@@ -185,7 +185,7 @@ export class AgentRegistry extends Service {
185
185
  * agent): this constructs the agent and its session. Rejects if no factory is
186
186
  * registered or creation/setup fails. The resolved {@link AgentHandle} lets
187
187
  * the owner tear down exactly this agent.
188
- * @param options - shared identity, optional live parent, session seed/metadata, and agent options.
188
+ * @param options - shared identity, session seed/metadata, and agent options.
189
189
  * @returns the handle after setup, rollback-covered publication, and loop start complete.
190
190
  */
191
191
  async create(options) {
@@ -203,7 +203,7 @@ export class AgentRegistry extends Service {
203
203
  * Load a persisted session and resume an agent on it through the registered
204
204
  * factory. Rejects if no factory is registered; the factory rejects if
205
205
  * session persistence is not configured or persistence/setup fails.
206
- * @param options - persisted identity, optional live parent, configuration, and setup.
206
+ * @param options - persisted identity, configuration, and setup.
207
207
  * @returns the handle after setup, rollback-covered publication, and loop start complete.
208
208
  */
209
209
  async resume(options) {
@@ -220,8 +220,7 @@ export class AgentRegistry extends Service {
220
220
  * (`scopeTarget(agent, agent)`): the subject is the agent in hand, so the
221
221
  * emits are scope-filtered regardless of which context invoked `register`
222
222
  * (calling through `agent.ctx` scopes EFFECTS; dispatch scoping always
223
- * requires passing the carrier). The entry is a runtime root; factory-backed
224
- * creation uses `options.parentAgent` for child ownership. Await the registration before using the agent.
223
+ * requires passing the carrier). Await registration before using the agent.
225
224
  * @param agent - the already-constructed agent to record in the store.
226
225
  * @returns the awaitable Cordis effect disposer (single-shot; a repeat call
227
226
  * returns undefined without awaiting an in-flight teardown). Exact
@@ -234,7 +233,7 @@ export class AgentRegistry extends Service {
234
233
  */
235
234
  register(agent) {
236
235
  return this.ctx.effect(async function* () {
237
- yield this.enter(agent, undefined);
236
+ yield this.enter(agent);
238
237
  await this.announce(agent, 'startup');
239
238
  }.bind(this), 'agents.register()');
240
239
  }
@@ -245,15 +244,12 @@ export class AgentRegistry extends Service {
245
244
  * returned detach closure into its pre-installed composite teardown before
246
245
  * calling {@link announce}. Ordinary callers use {@link register}.
247
246
  * @param agent - the prepared, unpublished agent.
248
- * @param owner - explicitly supplied live runtime owner, or
249
- * undefined for a top-level runtime root. This is runtime ownership, not
250
- * the resumed session's durable parent lineage.
251
247
  * @returns an idempotent closure that removes this exact entry and emits
252
248
  * `agent/disposed` with listener failures contained. When called from a
253
249
  * `agent/created` listener, removal and disposal wait until the serial
254
250
  * creation dispatch settles.
255
251
  */
256
- enter(agent, owner) {
252
+ enter(agent) {
257
253
  const id = agent.id;
258
254
  if (id !== agent.session.id) {
259
255
  throw new Error(`agent id "${id}" does not match session id "${agent.session.id}"`);
@@ -266,7 +262,6 @@ export class AgentRegistry extends Service {
266
262
  const entry = {
267
263
  id,
268
264
  agent,
269
- owner,
270
265
  carrier,
271
266
  announced: false,
272
267
  announcing: false,
@@ -366,17 +361,6 @@ export class AgentRegistry extends Service {
366
361
  get(id) {
367
362
  return this.store.get(id)?.agent;
368
363
  }
369
- /**
370
- * Test whether a live agent was created through one exact parent agent's
371
- * scoped context. Runtime ownership is independent of durable session
372
- * lineage and remains unambiguous when unrelated providers reuse an id.
373
- * @param id - the candidate child agent's shared agent/session id.
374
- * @param owner - the expected runtime creator agent.
375
- * @returns true only while the exact child entry is live under that owner.
376
- */
377
- isOwnedBy(id, owner) {
378
- return this.store.get(id)?.owner === owner;
379
- }
380
364
  /**
381
365
  * All live agents, in registration order.
382
366
  * @returns a fresh array; mutating it does not affect the registry.
@@ -384,17 +368,6 @@ export class AgentRegistry extends Service {
384
368
  list() {
385
369
  return [...this.store.values()].map(entry => entry.agent);
386
370
  }
387
- /**
388
- * All live top-level agents in registration order. A top-level agent was
389
- * created without an owning agent context; durable session lineage does not
390
- * affect this runtime relation, so a resumed fork may still be a root.
391
- * @returns a fresh array; mutating it does not affect the registry.
392
- */
393
- roots() {
394
- return [...this.store.values()]
395
- .filter(entry => entry.owner === undefined)
396
- .map(entry => entry.agent);
397
- }
398
371
  /** Reject new initiator boundaries while inherited continuations drain. */
399
372
  closeInitiators() {
400
373
  if (this.initiatorState === 'active')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fishwithcat/dsh-agent",
3
3
  "description": "Agent interface, registry, initiator scope, and event vocabulary for the DeepSeek Harness",
4
- "version": "0.2.2-alpha.2",
4
+ "version": "0.2.2-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -34,15 +34,15 @@
34
34
  ],
35
35
  "license": "MIT",
36
36
  "peerDependencies": {
37
- "@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
38
- "@deepseek-ai/dsh-scope": "0.2.2-alpha.2",
39
- "@deepseek-ai/dsh-session": "0.2.2-alpha.2",
40
- "@deepseek-ai/dsh-session-projection": "0.2.2-alpha.2",
41
- "@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.2",
42
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-alpha.2",
43
- "@deepseek-ai/dsh-util-values": "0.2.2-alpha.2",
44
- "@deepseek-ai/dsh-workspace": "0.2.2-alpha.2",
45
- "@deepseek-ai/cordis": "~4.0.6-alpha.1"
37
+ "@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
38
+ "@deepseek-ai/dsh-scope": "0.2.2-alpha.3",
39
+ "@deepseek-ai/dsh-session": "0.2.2-alpha.3",
40
+ "@deepseek-ai/dsh-session-projection": "0.2.2-alpha.3",
41
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
42
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-alpha.3",
43
+ "@deepseek-ai/dsh-util-values": "0.2.2-alpha.3",
44
+ "@deepseek-ai/dsh-workspace": "0.2.2-alpha.3",
45
+ "@deepseek-ai/cordis": "~4.0.6-alpha.2"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "@deepseek-ai/dsh-workspace": {
@@ -50,19 +50,19 @@
50
50
  }
51
51
  },
52
52
  "devDependencies": {
53
- "@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
54
- "@deepseek-ai/dsh-scope": "0.2.2-alpha.2",
55
- "@deepseek-ai/dsh-session": "0.2.2-alpha.2",
56
- "@deepseek-ai/dsh-session-projection": "0.2.2-alpha.2",
57
- "@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.2",
58
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-alpha.2",
59
- "@deepseek-ai/dsh-typert-registry": "0.2.2-alpha.2",
60
- "@deepseek-ai/dsh-util-values": "0.2.2-alpha.2",
61
- "@deepseek-ai/dsh-workspace": "0.2.2-alpha.2",
62
- "@deepseek-ai/cordis": "~4.0.6-alpha.1"
53
+ "@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
54
+ "@deepseek-ai/dsh-scope": "0.2.2-alpha.3",
55
+ "@deepseek-ai/dsh-session": "0.2.2-alpha.3",
56
+ "@deepseek-ai/dsh-session-projection": "0.2.2-alpha.3",
57
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
58
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-alpha.3",
59
+ "@deepseek-ai/dsh-typert-registry": "0.2.2-alpha.3",
60
+ "@deepseek-ai/dsh-util-values": "0.2.2-alpha.3",
61
+ "@deepseek-ai/dsh-workspace": "0.2.2-alpha.3",
62
+ "@deepseek-ai/cordis": "~4.0.6-alpha.2"
63
63
  },
64
64
  "dependencies": {
65
- "@deepseek-ai/dsh-brand": "0.2.2-alpha.2",
65
+ "@deepseek-ai/dsh-brand": "0.2.2-alpha.3",
66
66
  "zod": "4.4.3"
67
67
  }
68
68
  }