@demicodes/agent 0.23.0 → 0.24.1

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/dist/index.d.mts CHANGED
@@ -672,6 +672,11 @@ declare class ChildSupervisor<State = unknown> {
672
672
  private notifyIdleParent;
673
673
  private childEnvironment;
674
674
  private createChildEnvironment;
675
+ /**
676
+ * No name means the unnamed inherit profile: the parent harness, model, Host
677
+ * and commands, always available and never configurable. A name must match a
678
+ * declared profile; "default" is not a name.
679
+ */
675
680
  private resolveProfile;
676
681
  private configuredProfileNames;
677
682
  private subagentPreamble;
package/dist/index.mjs CHANGED
@@ -2751,6 +2751,13 @@ var AgentDirectory = class {
2751
2751
  return [await build(this.rootId(), null, null, null, this.root.supervisor)];
2752
2752
  }
2753
2753
  };
2754
+ /** The reserved word a harness may not use as a profile name: it is not a profile, it is the absence of one. */
2755
+ const INHERIT_PROFILE_NAME = "default";
2756
+ const INHERIT_PROFILE_LABEL = "(inherit)";
2757
+ const INHERIT_PROFILE = {
2758
+ name: INHERIT_PROFILE_LABEL,
2759
+ description: "Inherits the parent harness, model, Host, and commands."
2760
+ };
2754
2761
  /**
2755
2762
  * Per-session subagent supervisor. Every session — root or subagent — owns one
2756
2763
  * and carries the identical `demi agent` command tree, so spawn nests to any
@@ -2767,6 +2774,7 @@ var ChildSupervisor = class ChildSupervisor {
2767
2774
  parentSession = null;
2768
2775
  isDisposed = false;
2769
2776
  constructor(options) {
2777
+ if (options.profiles?.some((profile) => profile.name === INHERIT_PROFILE_NAME)) throw new Error(`subagent profile name "${INHERIT_PROFILE_NAME}" is reserved: omitting --profile already inherits the parent`);
2770
2778
  this.options = options;
2771
2779
  }
2772
2780
  attachParent(session) {
@@ -2798,7 +2806,7 @@ var ChildSupervisor = class ChildSupervisor {
2798
2806
  failureOutput: "non-zero exit with the abort or failure reason on stderr",
2799
2807
  input: {
2800
2808
  prompt: z.string().optional().describe(SPAWN_PROMPT_DESCRIPTION),
2801
- profile: z.string().optional().describe(`Named subagent profile configured at harness assembly. Available: ${profileNames.join(", ")}.`),
2809
+ profile: z.string().optional().describe(`Named subagent profile configured at harness assembly; omit to inherit the parent's model, prompt, Host and commands. Available: ${profileNames.length > 0 ? profileNames.join(", ") : "none"}.`),
2802
2810
  description: z.string().optional().describe("Short UI title distinguishing concurrent children."),
2803
2811
  "no-subagents": z.boolean().optional().describe("Forbid this child from spawning subagents of its own; it can still send, steer, list, and show.")
2804
2812
  },
@@ -3123,6 +3131,7 @@ var ChildSupervisor = class ChildSupervisor {
3123
3131
  if (!meta?.closedPhase) throw new Error(`no archived subagent "${id}" (see \`demi agent list\`)`);
3124
3132
  const checkpoint = await this.childSessionStore(id).loadCheckpoint();
3125
3133
  if (!checkpoint) throw new Error(`archived subagent "${id}" has no checkpoint left`);
3134
+ this.resolveProfile(meta.profileName ?? void 0);
3126
3135
  const liveMeta = {
3127
3136
  description: meta.description,
3128
3137
  profileName: meta.profileName,
@@ -3174,7 +3183,7 @@ var ChildSupervisor = class ChildSupervisor {
3174
3183
  const profile = this.resolveProfile(input.profileName);
3175
3184
  const id = createId();
3176
3185
  const metadata = parent.actionMetadata();
3177
- const profileName = input.profileName ?? (this.options.profiles ? profile.name : null);
3186
+ const profileName = input.profileName ?? null;
3178
3187
  const spawnedAt = Date.now();
3179
3188
  const canSpawnSubagents = !input.isSpawnForbidden && profile.canSpawnSubagents !== false;
3180
3189
  const { job, runtime } = this.assembleJob({
@@ -3587,25 +3596,20 @@ var ChildSupervisor = class ChildSupervisor {
3587
3596
  commands: job.commandRegistry
3588
3597
  });
3589
3598
  }
3599
+ /**
3600
+ * No name means the unnamed inherit profile: the parent harness, model, Host
3601
+ * and commands, always available and never configurable. A name must match a
3602
+ * declared profile; "default" is not a name.
3603
+ */
3590
3604
  resolveProfile(name) {
3591
- const profiles = this.options.profiles;
3592
- const implicitDefault = {
3593
- name: "default",
3594
- description: "Inherits the parent harness, model, Host, and commands."
3595
- };
3596
- if (!profiles || profiles.length === 0) {
3597
- if (name !== void 0 && name !== "default") throw new Error(`unknown profile "${name}" (available: default)`);
3598
- return implicitDefault;
3599
- }
3600
- const target = name ?? "default";
3601
- const profile = profiles.find((candidate) => candidate.name === target);
3605
+ if (name === void 0) return INHERIT_PROFILE;
3606
+ const profile = this.options.profiles?.find((candidate) => candidate.name === name);
3602
3607
  if (profile) return profile;
3603
- if (name === void 0) return implicitDefault;
3604
- throw new Error(`unknown profile "${name}" (available: ${this.configuredProfileNames().join(", ")})`);
3608
+ const names = this.configuredProfileNames();
3609
+ throw new Error(`unknown profile "${name}" (available: ${names.length > 0 ? names.join(", ") : "none; omit --profile to inherit the parent"})`);
3605
3610
  }
3606
3611
  configuredProfileNames() {
3607
- const names = (this.options.profiles ?? []).map((profile) => profile.name);
3608
- return names.includes("default") ? names : ["default", ...names];
3612
+ return (this.options.profiles ?? []).map((profile) => profile.name);
3609
3613
  }
3610
3614
  subagentPreamble(childId) {
3611
3615
  return [
@@ -3711,7 +3715,7 @@ var ChildSupervisor = class ChildSupervisor {
3711
3715
  job.phase,
3712
3716
  `up ${formatDuration(now - job.spawnedAt)}`,
3713
3717
  `last-event ${formatDuration(now - job.lastEventAt)} ago`,
3714
- `profile=${job.profileName ?? "default"}`,
3718
+ `profile=${job.profileName ?? INHERIT_PROFILE_LABEL}`,
3715
3719
  job.description ? `"${job.description}"` : "(no description)",
3716
3720
  `execution=${execution}`,
3717
3721
  `activity=${this.activityOf(job, execution)}`
@@ -3724,7 +3728,7 @@ var ChildSupervisor = class ChildSupervisor {
3724
3728
  `id: ${job.id}`,
3725
3729
  `parent: ${this.ownerId()}`,
3726
3730
  `description: ${job.description || "(none)"}`,
3727
- `profile: ${job.profileName ?? "default"}`,
3731
+ `profile: ${job.profileName ?? INHERIT_PROFILE_LABEL}`,
3728
3732
  `phase: ${job.phase}`,
3729
3733
  `elapsed: ${formatDuration(now - job.spawnedAt)}`,
3730
3734
  `execution: ${execution} (for ${formatDuration(this.executionForMs(job, execution, now))})`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@demicodes/agent",
3
3
  "description": "Session runtime and transport-neutral client and server protocol for Demi.",
4
- "version": "0.23.0",
4
+ "version": "0.24.1",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "exports": {
@@ -19,10 +19,10 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@demicodes/core": "^0.23.0",
23
- "@demicodes/provider": "^0.23.0",
24
- "@demicodes/shell": "^0.23.0",
25
- "@demicodes/utils": "^0.23.0",
22
+ "@demicodes/core": "^0.24.1",
23
+ "@demicodes/provider": "^0.24.1",
24
+ "@demicodes/shell": "^0.24.1",
25
+ "@demicodes/utils": "^0.24.1",
26
26
  "zod": "^4.0.0"
27
27
  },
28
28
  "license": "Apache-2.0",