@oh-my-dsh/auto-team 0.1.4 → 0.2.0

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/lib/index.js CHANGED
@@ -1,787 +1,370 @@
1
- import schema from "@deepseek-ai/schemastery";
2
- import { createMessage } from "@deepseek-ai/dsh-llm";
3
- import { appendPluginRecord, pluginRecordOf } from "@deepseek-ai/dsh-session";
4
- import { z } from "zod";
5
- import { defineTool } from "@deepseek-ai/dsh-tools";
6
- import path from "node:path";
7
- //#region src/policy.ts
8
- const MIN_FACTOR = 1;
9
- const MAX_FACTOR = 5;
10
- const FACTOR_RANGE = 4;
11
- /** Clamp one finite factor to 1..5 and normalize it to 0..1. */
12
- function normalizeFactor(name, value) {
13
- if (!Number.isFinite(value)) throw new TypeError(`difficulty factor "${name}" must be a finite number`);
14
- return (Math.min(MAX_FACTOR, Math.max(MIN_FACTOR, value)) - MIN_FACTOR) / FACTOR_RANGE;
1
+ import Schema from "@deepseek-ai/schemastery";
2
+ import paths from "node:path";
3
+ //#region src/worktree-path.ts
4
+ function filePath(args) {
5
+ if (args === null || typeof args !== "object" || !("file_path" in args)) return;
6
+ const { file_path: path } = args;
7
+ if (typeof path === "string" && path.trim() !== "") return path;
15
8
  }
16
- /** Reject negative or non-finite weights and an all-zero set. */
17
- function validateWeights(weights) {
18
- let total = 0;
19
- for (const value of Object.values(weights)) {
20
- if (!Number.isFinite(value) || value < 0) throw new TypeError("score weights must be finite and non-negative");
21
- total += value;
22
- }
23
- if (total <= 0) throw new TypeError("score weights must have a positive total");
24
- }
25
- /** Weighted 0..1 difficulty score. */
26
- function scoreAssessment(assessment, weights) {
27
- validateWeights(weights);
28
- const total = weights.scope + weights.parallelism + weights.ambiguity + weights.risk + weights.expectedSteps;
29
- return (normalizeFactor("scope", assessment.scope) * weights.scope + normalizeFactor("parallelism", assessment.parallelism) * weights.parallelism + normalizeFactor("ambiguity", assessment.ambiguity) * weights.ambiguity + normalizeFactor("risk", assessment.risk) * weights.risk + normalizeFactor("expectedSteps", assessment.expectedSteps) * weights.expectedSteps) / total;
9
+ function absoluteFilePath(args) {
10
+ const path = filePath(args);
11
+ if (path === void 0 || !paths.isAbsolute(path)) return;
12
+ if (process.platform === "win32" && paths.win32.parse(path).root.length <= 1) return;
13
+ return path;
30
14
  }
31
- /**
32
- * Effective trigger threshold; a user-triggered goal lowers it by the
33
- * configured factor.
34
- */
35
- function effectiveThreshold(baseThreshold, manualGoal, manualGoalFactor) {
36
- if (!Number.isFinite(baseThreshold) || baseThreshold < 0 || baseThreshold > 1) throw new TypeError("threshold must be between 0 and 1");
37
- if (!Number.isFinite(manualGoalFactor) || manualGoalFactor < 0 || manualGoalFactor > 1) throw new TypeError("manualGoalFactor must be between 0 and 1");
38
- let threshold = baseThreshold;
39
- if (manualGoal) threshold = baseThreshold * manualGoalFactor;
40
- return Math.min(1, Math.max(0, threshold));
15
+ async function insideWorktree(fs, file, options) {
16
+ const { cwd, signal } = options;
17
+ const [root, marker, target] = await Promise.all([
18
+ fs.resolve(cwd, options),
19
+ fs.resolve(".git", options),
20
+ fs.resolve(file, options)
21
+ ]);
22
+ if (paths.relative(cwd, fs.processPath(root)) !== "" || !fs.contains(root, target) || !fs.contains(root, marker) || fs.contains(marker, target)) return false;
23
+ const [directory, gitLink] = await Promise.all([fs.lstat(cwd, options, signal), fs.lstat(".git", options, signal)]);
24
+ return directory?.type === "directory" && gitLink?.type === "file" && !fs.contains(target, root);
41
25
  }
42
- /** Compare a score with the effective threshold. */
43
- function decideTeam(score, threshold) {
44
- if (score >= threshold) return "team";
45
- return "solo";
26
+ function instructionPath(cwd, file) {
27
+ if (file === void 0) return;
28
+ const { root } = paths.parse(file);
29
+ if (process.platform === "win32" && root !== "" && (root.length <= 1 || !paths.isAbsolute(file))) return;
30
+ const target = paths.resolve(cwd, file);
31
+ const parts = paths.relative(cwd, target).split(paths.sep);
32
+ if (process.platform === "win32" && parts.some((part) => /[ .:]$|:/u.test(part))) return;
33
+ const [first, second] = parts.map((part) => {
34
+ if (process.platform === "win32") return part.toLowerCase();
35
+ return part;
36
+ });
37
+ if (parts.length === 1) {
38
+ const instructions = paths.join(cwd, "AGENTS.md");
39
+ if (paths.relative(instructions, target) === "") return target;
40
+ }
41
+ if (first === ".agents" && second !== void 0 && second !== "worktrees") return target;
46
42
  }
47
- /** Score one assessment and freeze the decision. */
48
- function createScoreDecision(assessment, options) {
49
- const threshold = effectiveThreshold(options.threshold, options.manualGoal, options.manualGoalFactor);
50
- const score = scoreAssessment(assessment, options.weights);
51
- return {
52
- score,
53
- threshold,
54
- manualGoal: options.manualGoal,
55
- decision: decideTeam(score, threshold)
56
- };
43
+ async function resolvesToInstruction(fs, { rawPath, candidate }, options) {
44
+ try {
45
+ const [root, target] = await Promise.all([fs.resolve(options.cwd, options), fs.resolve(rawPath, options)]);
46
+ return paths.relative(options.cwd, fs.processPath(root)) === "" && fs.contains(root, target) && paths.relative(candidate, fs.processPath(target)) === "";
47
+ } catch {
48
+ return false;
49
+ }
57
50
  }
58
51
  //#endregion
59
- //#region src/config.ts
60
- /**
61
- * Serializable configuration, schema, and direct-call defaults for auto-team.
62
- *
63
- * @module @oh-my-dsh/auto-team/config
64
- */
65
- const DEFAULT_WEIGHTS = {
66
- scope: .3,
67
- parallelism: .25,
68
- ambiguity: .15,
69
- risk: .15,
70
- expectedSteps: .15
71
- };
72
- const DEFAULT_THRESHOLD = .55;
73
- const DEFAULT_MANUAL_GOAL_FACTOR = .6;
74
- const DEFAULT_REPORTING_AGENT_NAME = "reporter";
75
- const DEFAULT_REPORTING_PROVIDER = "spawn";
76
- const DEFAULT_GOAL_MAX_ROUNDS = 256;
77
- const DEFAULT_ENFORCE_LEAD_NO_CODE = true;
78
- const DEFAULT_LEAD_DENIED_TOOLS = ["write", "edit"];
79
- const REPORTER_NAME_PATTERN = /^[a-z][a-z0-9-]*$/u;
80
- const UNIT_RANGE = {
81
- min: 0,
82
- max: 1
83
- };
84
- /** Loader-visible configuration schema and defaults. */
85
- const Config = schema.object({
86
- message: schema.string().default("auto-team loaded"),
87
- threshold: schema.number().min(0).max(1).default(DEFAULT_THRESHOLD),
88
- manualGoalFactor: schema.number().min(0).max(1).default(DEFAULT_MANUAL_GOAL_FACTOR),
89
- weights: schema.object({
90
- scope: schema.number().min(0).max(1).default(DEFAULT_WEIGHTS.scope),
91
- parallelism: schema.number().min(0).max(1).default(DEFAULT_WEIGHTS.parallelism),
92
- ambiguity: schema.number().min(0).max(1).default(DEFAULT_WEIGHTS.ambiguity),
93
- risk: schema.number().min(0).max(1).default(DEFAULT_WEIGHTS.risk),
94
- expectedSteps: schema.number().min(0).max(1).default(DEFAULT_WEIGHTS.expectedSteps)
95
- }),
96
- reportingAgentName: schema.string().pattern(REPORTER_NAME_PATTERN).default(DEFAULT_REPORTING_AGENT_NAME),
97
- reportingProvider: schema.string().default(DEFAULT_REPORTING_PROVIDER),
98
- goalMaxRounds: schema.natural().min(1).default(DEFAULT_GOAL_MAX_ROUNDS),
99
- enforceLeadNoCode: schema.boolean().default(DEFAULT_ENFORCE_LEAD_NO_CODE),
100
- leadDeniedTools: schema.array(schema.string()).default([...DEFAULT_LEAD_DENIED_TOOLS])
101
- });
102
- /** Validate one finite number against an inclusive range. */
103
- function numberInRange(name, value, range) {
104
- if (!Number.isFinite(value) || value < range.min || value > range.max) throw new TypeError(`${name} must be between ${range.min} and ${range.max}`);
105
- return value;
52
+ //#region src/execution.ts
53
+ const leadDenied = "Auto Team: Lead coordinates, reviews, and integrates. Delegate implementation to local execution agents.";
54
+ const worktreeRequired = "Auto Team: use the official Worktree tool in this agent session to create and enter its own worktree before writing. If unavailable, stop writes and ask the Lead to check the profile or arrange a separate workspace.";
55
+ const pathDenied = "Auto Team: write or edit an absolute file_path inside this session’s verified worktree; do not write to the Git worktree marker.";
56
+ const instructionGuidance = "The current workspace’s root AGENTS.md and .agents/ guidance files are exempt from Auto Team’s write checks; .agents/worktrees/ is not. Native permissions still apply.";
57
+ const stateChanged = "Auto Team: the execution or worktree state changed before this write. Recheck the current team, goal, and worktree before retrying.";
58
+ function executionOf(ctx, agent) {
59
+ if (agent === void 0) return;
60
+ try {
61
+ const root = ctx.subagents.rootOf(agent);
62
+ if (!ctx.agentTeams.isEnabled(root)) return;
63
+ const goal = ctx.goals.get(root);
64
+ if (goal?.phase !== "active" || goal.activation !== "armed") return;
65
+ if (root === agent) return {
66
+ root,
67
+ goal,
68
+ role: "lead"
69
+ };
70
+ return {
71
+ root,
72
+ goal,
73
+ role: "worker"
74
+ };
75
+ } catch {
76
+ return;
77
+ }
106
78
  }
107
- /** Merge partial factor weights over the defaults and validate the total. */
108
- function resolveWeights(config) {
109
- const weights = {
110
- scope: config.weights?.scope ?? DEFAULT_WEIGHTS.scope,
111
- parallelism: config.weights?.parallelism ?? DEFAULT_WEIGHTS.parallelism,
112
- ambiguity: config.weights?.ambiguity ?? DEFAULT_WEIGHTS.ambiguity,
113
- risk: config.weights?.risk ?? DEFAULT_WEIGHTS.risk,
114
- expectedSteps: config.weights?.expectedSteps ?? DEFAULT_WEIGHTS.expectedSteps
115
- };
116
- validateWeights(weights);
117
- return weights;
79
+ function worktreeOf(ctx, { session }) {
80
+ try {
81
+ const cwd = ctx.workingDirectory.get(session);
82
+ const { worktree = [] } = ctx.sessionProjections.snapshot(session, ["worktree"]).values;
83
+ const matches = worktree.filter((entry) => entry.owned && entry.worktree.path === cwd);
84
+ if (matches.length === 1) return matches[0]?.worktree;
85
+ } catch {}
118
86
  }
119
- /** Resolve and validate the reporting teammate name. */
120
- function resolveReportingAgentName(config) {
121
- const name = config.reportingAgentName ?? DEFAULT_REPORTING_AGENT_NAME;
122
- if (!REPORTER_NAME_PATTERN.test(name) || name === "lead") throw new TypeError("reportingAgentName must be lower-kebab-case and must not be \"lead\"");
123
- return name;
87
+ function worktreeGuidance(ctx, agent) {
88
+ if (worktreeOf(ctx, agent) !== void 0) return "Use your current owned worktree.";
89
+ if (ctx.tools.get("create_worktree", agent) !== void 0) return "Use create_worktree in your own session with a unique branch name and the agreed local base commit.";
90
+ if (ctx.tools.get("enter_worktree", agent) !== void 0) return "Use enter_worktree in your own session with a unique name and an explicit local from commit; do not enter an existing checkout.";
91
+ return "The official worktree tool is unavailable. Stop before writing implementation files and tell the Lead.";
124
92
  }
125
- /** Resolve and validate the goal round cap. */
126
- function resolveGoalMaxRounds(config) {
127
- const rounds = config.goalMaxRounds ?? DEFAULT_GOAL_MAX_ROUNDS;
128
- if (!Number.isSafeInteger(rounds) || rounds < 1) throw new TypeError("goalMaxRounds must be a positive safe integer");
129
- return rounds;
93
+ function guidance(ctx, agent, restrictWrites) {
94
+ const execution = executionOf(ctx, agent);
95
+ if (execution === void 0 || agent === void 0) return "";
96
+ const condition = "Auto Team applies only while the root session has native Agent Teams enabled and a live, active goal.";
97
+ if (!restrictWrites(execution.root)) {
98
+ const nativeOnly = "Auto Team write restrictions are off; native permissions still apply.";
99
+ if (execution.role === "lead") return `${condition} Coordinate independent tasks, review results, and integrate only as authorized. ${nativeOnly}`;
100
+ return `Coordinate changes with the Lead, avoid overwriting other agents’ work, and report results through native team communication. ${nativeOnly}`;
101
+ }
102
+ if (execution.role === "lead") return `${condition} As Lead, assign independent tasks to local execution agents with separate worktrees, a base commit, and acceptance criteria. Coordinate, review their diffs and tests, and integrate only as authorized; do not implement changes yourself or bypass write restrictions with other tools. Do not force parallelism for inseparable work. ${instructionGuidance}`;
103
+ return [
104
+ condition,
105
+ worktreeGuidance(ctx, agent),
106
+ instructionGuidance,
107
+ "Implement and verify only in your own worktree, using absolute file paths; do not bypass write restrictions with shell or other tools. Report the branch, changes, test results, and unresolved issues to the Lead using native team communication."
108
+ ].join(" ");
130
109
  }
131
- /** Resolve and validate the two score thresholds. */
132
- function resolveThresholds(config) {
133
- return {
134
- threshold: numberInRange("threshold", config.threshold ?? DEFAULT_THRESHOLD, UNIT_RANGE),
135
- manualGoalFactor: numberInRange("manualGoalFactor", config.manualGoalFactor ?? DEFAULT_MANUAL_GOAL_FACTOR, UNIT_RANGE)
136
- };
110
+ function isProtected(name) {
111
+ return name === "write" || name === "edit";
137
112
  }
138
- /** Resolve the same defaults for direct callers that bypass Cordis Loader. */
139
- function resolveConfig(config = {}) {
113
+ function deny(reason) {
140
114
  return {
141
- message: config.message ?? "auto-team loaded",
142
- ...resolveThresholds(config),
143
- weights: resolveWeights(config),
144
- reportingAgentName: resolveReportingAgentName(config),
145
- reportingProvider: config.reportingProvider ?? DEFAULT_REPORTING_PROVIDER,
146
- goalMaxRounds: resolveGoalMaxRounds(config),
147
- enforceLeadNoCode: config.enforceLeadNoCode ?? DEFAULT_ENFORCE_LEAD_NO_CODE,
148
- leadDeniedTools: [...config.leadDeniedTools ?? DEFAULT_LEAD_DENIED_TOOLS]
115
+ isError: true,
116
+ content: [{
117
+ type: "text",
118
+ text: reason
119
+ }],
120
+ error: { message: reason }
149
121
  };
150
122
  }
151
- //#endregion
152
- //#region src/projection.ts
153
- const SCORE_RECORD_TYPE = "plugin:auto-team/score";
154
- const RESET_RECORD_TYPE = "plugin:auto-team/reset";
155
- const scoreRecordSchema = z.object({
156
- score: z.number().min(0).max(1),
157
- threshold: z.number().min(0).max(1),
158
- manualGoal: z.boolean(),
159
- decision: z.enum(["team", "solo"]),
160
- goal: z.enum([
161
- "started",
162
- "reused",
163
- "none"
164
- ])
165
- });
166
- const autoTeamProjectionStateSchema = z.object({
167
- score: scoreRecordSchema.optional(),
168
- failure: z.string().optional()
169
- });
170
- /** Fold the first score after the latest reset into one durable decision. */
171
- function applyAutoTeamProjection(state, event) {
172
- const record = pluginRecordOf(event);
173
- if (record === void 0) return state;
174
- if (record.type === RESET_RECORD_TYPE) {
175
- if (state.score === void 0) return state;
176
- return {
177
- ...state,
178
- score: void 0
179
- };
123
+ function currentDirectory(ctx, agent) {
124
+ try {
125
+ return ctx.workingDirectory.get(agent.session);
126
+ } catch {
127
+ return;
180
128
  }
181
- if (record.type !== SCORE_RECORD_TYPE) return state;
182
- if (state.score !== void 0) return state;
183
- const parsed = scoreRecordSchema.safeParse(record.data);
184
- if (!parsed.success) return {
185
- ...state,
186
- failure: parsed.error.message
187
- };
188
- return {
189
- ...state,
190
- score: parsed.data
191
- };
192
129
  }
193
- /** Host-only projection definition for the auto-team score. */
194
- const autoTeamProjectionDefinition = {
195
- key: "autoTeam",
196
- stateSchema: autoTeamProjectionStateSchema,
197
- init: () => ({}),
198
- apply: applyAutoTeamProjection,
199
- stateVersion: 1
200
- };
201
- //#endregion
202
- //#region src/prompt.ts
203
- /**
204
- * Model-facing policy and teammate prompts for auto-team.
205
- *
206
- * @module @oh-my-dsh/auto-team/prompt
207
- */
208
- /** Steering text used whenever no score is recorded, including after a reset. */
209
- const NO_SCORE_STEER_TEXT = `Auto Team: no score is recorded. Call auto_team_score now with the current task's difficulty factors and objective; the turn stays open until the decision is recorded.`;
210
- /** System prompt section that states the Lead's auto-team obligations. */
211
- function policyText(reportingAgentName, leadDeniedTools) {
212
- return `Auto Team policy
213
-
214
- You are the Team Lead for a long task. Call auto_team_score before anything else in the first round. The call takes:
215
- - scope, parallelism, ambiguity, risk, expected_steps: integers from 1 (low) to 5 (high)
216
- - objective: the task goal in its ordinary, universal meaning
217
-
218
- The first turn stays open until the tool records a decision. The result carries the team or solo decision and the goal and reporter status. The numeric score and threshold stay host-side; treat them as unavailable and act on the returned decision.
219
-
220
- If the decision is solo, continue as a normal single agent.
221
-
222
- If the decision is team:
223
- - Your role is the Main Git repository and the team. Code changes belong to execution agents. The Lead's ${leadDeniedTools.join(", ")} calls are denied in Team mode. Treat that gate as a policy check: use pwsh, run_code, and other tools for review, tests, and inspection only.
224
- - The plugin starts or reuses the goal and ensures a reporting agent named "${reportingAgentName}".
225
- - The reporter writes directly to the user on its own cadence. Monitor the team on your own schedule, and keep execution moving while details are resolved.
226
- - Create shared tasks with disjoint write scopes, then spawn execution agents. Each execution agent creates its own worktree for its task before editing; the Lead works in the main checkout.
227
- - Let the goal runtime drive multi-round continuation; follow its rounds.
228
- - After the workers finish, review the final diff and run the tests in the main checkout.`;
130
+ function writeDenial(ctx, { name, agent, arguments: args }, restrictWrites) {
131
+ if (!isProtected(name) || agent === void 0) return;
132
+ const cwd = currentDirectory(ctx, agent);
133
+ if (cwd !== void 0 && instructionPath(cwd, filePath(args)) !== void 0) return;
134
+ const execution = executionOf(ctx, agent);
135
+ if (execution === void 0 || !restrictWrites(execution.root)) return;
136
+ if (execution.role === "lead") return leadDenied;
137
+ if (worktreeOf(ctx, agent) === void 0) return worktreeRequired;
229
138
  }
230
- /** Initial prompt for the dedicated reporting teammate. */
231
- function reporterPrompt() {
232
- return `You are the reporting agent for an auto-team task. Your reader is the user. The Lead monitors the team on its own schedule.
233
-
234
- Each turn ends after one update or one answer.
235
-
236
- - Status update: read list_agents and team_task_list once, then write one concise update for the user covering what changed, what is blocked, and what the user needs to decide.
237
- - Detail question: answer the user's question directly.
238
-
239
- Write the result in your reply to the user. Then end the turn and wait for the user's next message. Your work is status, questions, and coordination; code changes belong to execution agents.`;
139
+ async function verifiedInstructionDirectory(ctx, { agent, arguments: args }, signal) {
140
+ const cwd = currentDirectory(ctx, agent);
141
+ const rawPath = filePath(args);
142
+ if (cwd === void 0 || rawPath === void 0) return;
143
+ const candidate = instructionPath(cwd, rawPath);
144
+ if (candidate !== void 0 && await resolvesToInstruction(ctx.fs, {
145
+ rawPath,
146
+ candidate
147
+ }, {
148
+ cwd,
149
+ signal
150
+ })) return cwd;
151
+ }
152
+ function sameExecution(previous, current) {
153
+ return current?.root === previous.root && current.goal.id === previous.goal.id && current.goal.revision === previous.goal.revision;
154
+ }
155
+ function sameWorktree(previous, current) {
156
+ return current?.path === previous.path && current.branch === previous.branch && current.baseCommit === previous.baseCommit;
240
157
  }
241
- //#endregion
242
- //#region src/tool.ts
243
158
  /**
244
- * Model-facing scoring tool. The numeric score and threshold are never part of
245
- * the tool result.
246
- *
247
- * @module @oh-my-dsh/auto-team/tool
159
+ * Share one live execution decision between prompt assembly and the native tool
160
+ * pipeline.
248
161
  */
249
- /** Build the one-shot scoring tool for a Lead agent scope. */
250
- function scoreTool(autoTeam, onScored) {
251
- return defineTool({
252
- name: "auto_team_score",
253
- description: "Record the assessment. Call when no decision exists.",
254
- parameters: {
255
- scope: {
256
- type: "integer",
257
- required: true,
258
- enum: [
259
- 1,
260
- 2,
261
- 3,
262
- 4,
263
- 5
264
- ],
265
- description: "Expected change scope, from 1 low to 5 high."
266
- },
267
- parallelism: {
268
- type: "integer",
269
- required: true,
270
- enum: [
271
- 1,
272
- 2,
273
- 3,
274
- 4,
275
- 5
276
- ],
277
- description: "How much independent work can run in parallel, from 1 low to 5 high."
278
- },
279
- ambiguity: {
280
- type: "integer",
281
- required: true,
282
- enum: [
283
- 1,
284
- 2,
285
- 3,
286
- 4,
287
- 5
288
- ],
289
- description: "How much requirements or design uncertainty remains, from 1 low to 5 high."
290
- },
291
- risk: {
292
- type: "integer",
293
- required: true,
294
- enum: [
295
- 1,
296
- 2,
297
- 3,
298
- 4,
299
- 5
300
- ],
301
- description: "How costly a wrong change would be, from 1 low to 5 high."
302
- },
303
- expected_steps: {
304
- type: "integer",
305
- required: true,
306
- enum: [
307
- 1,
308
- 2,
309
- 3,
310
- 4,
311
- 5
312
- ],
313
- description: "Expected length of the task, from 1 short to 5 long."
314
- },
315
- objective: {
316
- type: "string",
317
- required: true,
318
- description: "The task goal in its ordinary, universal meaning. Used only when auto-team starts a goal."
319
- }
320
- },
321
- output: {
322
- schema: {
323
- type: "object",
324
- additionalProperties: false,
325
- properties: {
326
- decision: {
327
- type: "string",
328
- required: true,
329
- enum: ["team", "solo"]
330
- },
331
- goal: {
332
- type: "string",
333
- required: true,
334
- enum: [
335
- "started",
336
- "reused",
337
- "none"
338
- ]
339
- },
340
- reporter: { type: "string" }
341
- }
342
- },
343
- render: (_args, value) => [{
344
- type: "text",
345
- text: JSON.stringify(value)
346
- }]
347
- },
348
- async execute(args, exec) {
349
- const { agent } = exec;
350
- if (agent === void 0) throw new Error("auto_team_score requires a calling Agent");
351
- const result = await autoTeam.score(agent, {
352
- assessment: {
353
- scope: args.scope,
354
- parallelism: args.parallelism,
355
- ambiguity: args.ambiguity,
356
- risk: args.risk,
357
- expectedSteps: args.expected_steps
358
- },
359
- objective: args.objective,
360
- signal: exec.signal
162
+ function installExecution(ctx, restrictWrites) {
163
+ const lifetime = new AbortController();
164
+ ctx.effect(() => () => {
165
+ lifetime.abort();
166
+ });
167
+ ctx.effect(() => ctx.systemPrompt.section({
168
+ name: "auto-team:execution",
169
+ order: ctx.systemPrompt.getSectionOrder("TEAM_POLICY"),
170
+ text: ({ agent }) => guidance(ctx, agent, restrictWrites)
171
+ }));
172
+ ctx.effect(() => ctx.tools.guard((exec) => writeDenial(ctx, exec, restrictWrites)));
173
+ ctx.on("tools/execute", async (exec, next) => {
174
+ const { agent, name, signal } = exec;
175
+ if (!isProtected(name) || agent === void 0 || signal.aborted) return next();
176
+ const execution = executionOf(ctx, agent);
177
+ if (execution === void 0 || !restrictWrites(execution.root)) return next();
178
+ const checkSignal = AbortSignal.any([signal, lifetime.signal]);
179
+ const worktree = worktreeOf(ctx, agent);
180
+ const instructionCwd = await verifiedInstructionDirectory(ctx, {
181
+ agent,
182
+ arguments: exec.arguments
183
+ }, checkSignal);
184
+ if (signal.aborted) return next();
185
+ if (lifetime.signal.aborted) return deny(stateChanged);
186
+ if (instructionCwd !== void 0) {
187
+ if (currentDirectory(ctx, agent) !== instructionCwd) return deny(stateChanged);
188
+ return next();
189
+ }
190
+ if (execution.role === "lead") return deny(leadDenied);
191
+ if (worktree === void 0) return deny(worktreeRequired);
192
+ const file = absoluteFilePath(exec.arguments);
193
+ if (file === void 0) return deny(pathDenied);
194
+ let inside = false;
195
+ try {
196
+ inside = await insideWorktree(ctx.fs, file, {
197
+ cwd: worktree.path,
198
+ signal: checkSignal
361
199
  });
362
- onScored?.();
363
- return result;
200
+ } catch {
201
+ inside = false;
364
202
  }
203
+ if (signal.aborted) return next();
204
+ if (lifetime.signal.aborted) return deny(stateChanged);
205
+ const current = executionOf(ctx, agent);
206
+ const currentTree = worktreeOf(ctx, agent);
207
+ if (!sameExecution(execution, current) || !restrictWrites(execution.root) || !sameWorktree(worktree, currentTree)) return deny(stateChanged);
208
+ if (!inside) return deny(pathDenied);
209
+ return next();
365
210
  });
366
211
  }
367
- function registerScoreTool(tools, autoTeam) {
368
- const holder = { dispose: () => void 0 };
369
- const dispose = () => {
370
- holder.dispose();
371
- };
372
- holder.dispose = tools.register(scoreTool(autoTeam, dispose));
373
- return holder.dispose;
374
- }
375
- //#endregion
376
- //#region src/reset-command.ts
377
- /** Build the user-facing score reset command. */
378
- function createResetCommand(autoTeam) {
379
- return {
380
- name: "auto-team-reset",
381
- description: "Clear the frozen Auto Team score for this session.",
382
- handler: (invocation) => {
383
- if (autoTeam.decisionOf(invocation.agent) === void 0) return {
384
- kind: "error",
385
- text: "No frozen Auto Team score exists in this session."
386
- };
387
- autoTeam.reset(invocation.agent);
388
- registerScoreTool(invocation.agent.ctx.tools, autoTeam);
389
- const message = invocation.rawInput.trim();
390
- if (message.length > 0) invocation.agent.steer(createMessage({
391
- role: "user",
392
- content: [{
393
- type: "text",
394
- text: message
395
- }],
396
- source: { kind: "user" }
397
- }));
398
- return { kind: "success" };
399
- }
400
- };
401
- }
402
- /** Structural guard for the optional host commands service. */
403
- function isCommandRuntime(value) {
404
- if (typeof value !== "object" || value === null || !("register" in value)) return false;
405
- return typeof value.register === "function";
406
- }
407
212
  //#endregion
408
- //#region src/auto-team.ts
409
- /** Host-side auto-team state and operations. */
410
- var AutoTeam = class {
411
- records = /* @__PURE__ */ new WeakMap();
412
- resets = /* @__PURE__ */ new Set();
413
- deps;
414
- config;
415
- constructor(deps, config) {
416
- this.deps = deps;
417
- this.config = config;
418
- }
419
- /** Whether this agent already has a frozen score. */
420
- hasScore(agent) {
421
- return !this.resets.has(agent) && this.records.has(agent);
422
- }
423
- /** Seed a record restored from durable storage without scoring again. */
424
- restore(agent, record) {
425
- if (!this.resets.has(agent) && !this.records.has(agent)) this.records.set(agent, record);
426
- }
427
- /** The frozen team decision, when this agent has one. */
428
- decisionOf(agent) {
429
- if (this.resets.has(agent)) return;
430
- return (this.records.get(agent) ?? this.deps.store.read(agent))?.decision;
431
- }
432
- /** Clear the frozen score after a user-triggered reset. */
433
- reset(agent) {
434
- this.deps.store.reset(agent);
435
- this.records.delete(agent);
436
- this.resets.add(agent);
437
- }
438
- /**
439
- * Score one task, freeze the decision, then start or reuse its goal and
440
- * ensure the reporting teammate.
441
- */
442
- async score(agent, request) {
443
- let existing = this.records.get(agent) ?? this.deps.store.read(agent);
444
- if (this.resets.has(agent)) existing = void 0;
445
- if (existing !== void 0) {
446
- this.records.set(agent, existing);
447
- return await this.finish(agent, existing, request.signal);
448
- }
449
- const currentGoal = this.deps.goals.get(agent);
450
- let existingGoal = currentGoal;
451
- if (currentGoal?.phase === "complete") existingGoal = void 0;
452
- const manualGoal = existingGoal !== void 0;
453
- const decision = createScoreDecision(request.assessment, {
454
- weights: this.config.weights,
455
- threshold: this.config.threshold,
456
- manualGoal,
457
- manualGoalFactor: this.config.manualGoalFactor
458
- });
459
- let goal = "none";
460
- if (decision.decision === "team" && existingGoal === void 0) goal = this.startGoal(agent, request.objective);
461
- else if (existingGoal !== void 0) goal = "reused";
462
- const record = {
463
- score: decision.score,
464
- threshold: decision.threshold,
465
- manualGoal,
466
- decision: decision.decision,
467
- goal
468
- };
469
- this.deps.store.write(agent, record);
470
- this.records.set(agent, record);
471
- this.resets.delete(agent);
472
- return await this.finish(agent, record, request.signal);
473
- }
474
- /** Create the auto-started goal and return the reported action. */
475
- startGoal(agent, objective) {
476
- const trimmed = objective.trim();
477
- if (trimmed.length === 0) throw new TypeError("objective is required when auto-team starts a goal");
478
- this.deps.goals.create(agent, {
479
- objective: trimmed,
480
- maxGoalRounds: this.config.goalMaxRounds
481
- });
482
- return "started";
483
- }
484
- /** Add the reporter result to a frozen record, provisioning it when needed. */
485
- async finish(agent, record, signal) {
486
- if (record.decision === "solo") return {
487
- decision: "solo",
488
- goal: record.goal
489
- };
490
- const reporter = await this.ensureReporter(agent, signal);
491
- return {
492
- decision: "team",
493
- goal: record.goal,
494
- reporter
495
- };
496
- }
497
- /** Reuse an existing reporting teammate or spawn one. */
498
- async ensureReporter(agent, signal) {
499
- const name = this.config.reportingAgentName;
500
- const existing = this.deps.team.listMembers(agent).find((member) => member.name === name);
501
- if (existing !== void 0) return existing.name;
502
- return (await this.deps.team.spawnReporter(agent, {
503
- name,
504
- description: "User-facing status reporter for the auto team",
505
- prompt: reporterPrompt(),
506
- provider: this.config.reportingProvider,
507
- signal
508
- })).name;
509
- }
213
+ //#region src/parallelism.ts
214
+ const minParallelism = 0;
215
+ const maxParallelism = 8;
216
+ const defaults = {
217
+ enabled: false,
218
+ restrictWrites: true,
219
+ lower: minParallelism,
220
+ upper: maxParallelism
510
221
  };
511
- //#endregion
512
- //#region src/services.ts
513
- /** Read the goal service or fail with a plugin-specific message. */
514
- function goalService(ctx) {
515
- const service = ctx.get("goals");
516
- if (service === void 0) throw new Error("auto-team: goals service is unavailable");
517
- return service;
518
- }
519
- /** Read the Team service or fail with a plugin-specific message. */
520
- function teamService(ctx) {
521
- const service = ctx.get("agentTeams");
522
- if (service === void 0) throw new Error("auto-team: agentTeams service is unavailable");
523
- return service;
524
- }
525
- /** Build the goal, team, and durable score ports from Cordis services. */
526
- function createAutoTeam(ctx, config) {
527
- return new AutoTeam({
528
- goals: {
529
- get: (agent) => goalService(ctx).get(agent),
530
- create: (agent, request) => goalService(ctx).create(agent, request)
531
- },
532
- team: {
533
- listMembers: (agent) => teamService(ctx).listMembers(agent),
534
- spawnReporter: async (agent, request) => {
535
- return { name: (await teamService(ctx).spawnTeammate(agent, {
536
- name: request.name,
537
- description: request.description,
538
- prompt: [{
539
- type: "text",
540
- text: request.prompt
541
- }],
542
- context: "fresh",
543
- provider: request.provider,
544
- signal: request.signal
545
- })).member.name };
546
- }
547
- },
548
- store: {
549
- read: (agent) => ctx.get("sessionProjections")?.stateOf(agent.session, "autoTeam")?.score,
550
- write: (agent, record) => {
551
- appendPluginRecord(agent.session, "plugin:auto-team/score", record);
552
- },
553
- reset: (agent) => {
554
- appendPluginRecord(agent.session, "plugin:auto-team/reset", { at: Date.now() });
555
- }
556
- }
557
- }, config);
222
+ function rootOf(ctx, agent) {
223
+ try {
224
+ return ctx.subagents.rootOf(agent);
225
+ } catch {
226
+ return;
227
+ }
558
228
  }
559
- //#endregion
560
- //#region src/worker-guard.ts
561
- /**
562
- * Worker write/edit gate: a successful worktree is required, and when the host
563
- * returns its path, edits must stay inside it.
564
- *
565
- * @module @oh-my-dsh/auto-team/worker-guard
566
- */
567
- /** Read a write or edit file path from its tool arguments. */
568
- function filePathOf(args) {
569
- if (typeof args !== "object" || args === null || !("file_path" in args)) return;
570
- const filePath = args.file_path;
571
- if (typeof filePath === "string") return filePath;
229
+ function runningIn(ctx, root) {
230
+ let running = 0;
231
+ for (const member of ctx.agents.list()) if (member !== root && member.status === "running" && rootOf(ctx, member) === root) running += 1;
232
+ return running;
572
233
  }
573
- /** Read the worktree path from a create_worktree canonical value. */
574
- function worktreePathOf(value) {
575
- if (typeof value !== "object" || value === null || !("path" in value)) return;
576
- const worktreePath = value.path;
577
- if (typeof worktreePath === "string") return worktreePath;
234
+ function leadHint(ctx, root, settings) {
235
+ if (!settings.enabled || rootOf(ctx, root) !== root || !ctx.agentTeams.isEnabled(root)) return "";
236
+ const goal = ctx.goals.get(root);
237
+ if (goal?.phase !== "active" || goal.activation !== "armed") return "";
238
+ const running = runningIn(ctx, root);
239
+ if (running < settings.lower) return [
240
+ `Auto Team parallelism: ${running} running local subagents, below the lower bound ${settings.lower}.`,
241
+ "If independent work can be split safely, consider delegating it to additional local subagents",
242
+ "through the native team workflow, within host limits and approvals. Do not force parallelism."
243
+ ].join(" ");
244
+ if (running > settings.upper) return [
245
+ `Auto Team parallelism: ${running} running local subagents, above the upper bound ${settings.upper}.`,
246
+ "Let active work continue; do not stop, rush, or archive active tasks.",
247
+ "Review only already completed worktrees and branches for safe cleanup. First verify that no processes use them",
248
+ "and that no uncommitted, untracked, ignored, or unintegrated work would be lost. Retain anything uncertain",
249
+ "and require user authorization and native approvals before any destructive change."
250
+ ].join(" ");
251
+ return "";
578
252
  }
579
- /** Whether target resolves inside root. */
580
- function isInside(root, target) {
581
- const relative = path.relative(path.resolve(root), path.resolve(target));
582
- return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
253
+ function isRecord(value) {
254
+ return typeof value === "object" && value !== null && !Array.isArray(value);
583
255
  }
584
- /** Require one execution teammate to work inside its own worktree. */
585
- function installWorkerGuard(agent, root, autoTeam) {
586
- let hasWorktree = false;
587
- let worktreePath = void 0;
588
- const disposers = [];
589
- const register = (dispose) => {
590
- disposers.push(dispose);
591
- };
592
- try {
593
- const pre = agent.ctx.on("tools/pre-execute", async (exec, next) => {
594
- if (exec.agent === agent && autoTeam.decisionOf(root) === "team" && (exec.name === "write" || exec.name === "edit")) {
595
- if (!hasWorktree) return {
596
- kind: "deny",
597
- reason: "auto-team: create your own worktree with create_worktree before editing files"
598
- };
599
- if (worktreePath !== void 0) {
600
- const filePath = filePathOf(exec.arguments);
601
- if (filePath === void 0) return {
602
- kind: "deny",
603
- reason: "auto-team: write and edit require a file_path so the worktree guard can verify it"
604
- };
605
- if (!path.isAbsolute(filePath)) return {
606
- kind: "deny",
607
- reason: "auto-team: use an absolute file path inside your registered worktree"
608
- };
609
- if (!isInside(worktreePath, filePath)) return {
610
- kind: "deny",
611
- reason: `auto-team: edit path is outside your worktree: ${worktreePath}`
612
- };
613
- }
614
- }
615
- return await next();
616
- });
617
- register(() => {
618
- pre();
619
- });
620
- const post = agent.ctx.on("tools/post-execute", async (exec, result, next) => {
621
- if (exec.agent === agent && exec.name === "create_worktree" && !result.isError) {
622
- hasWorktree = true;
623
- const registered = worktreePathOf(result.value);
624
- if (registered !== void 0) worktreePath = registered;
625
- }
626
- return await next();
627
- });
628
- register(() => {
629
- post();
630
- });
631
- } catch (error) {
632
- for (const dispose of disposers.toReversed()) dispose();
633
- throw error;
634
- }
635
- return () => {
636
- for (const dispose of disposers.toReversed()) dispose();
637
- };
256
+ function isBound(value) {
257
+ return typeof value === "number" && Number.isInteger(value) && value >= minParallelism && value <= maxParallelism;
638
258
  }
639
- //#endregion
640
- //#region src/runtime.ts
641
- /** Create the production runtime adapter from a scoped Cordis context. */
642
- function createPluginRuntime(ctx) {
259
+ function settingsPatch(payload, current) {
260
+ const { enabled = current.enabled, restrictWrites = current.restrictWrites, lower = current.lower, upper = current.upper } = payload;
261
+ if (typeof enabled !== "boolean" || typeof restrictWrites !== "boolean" || !isBound(lower) || !isBound(upper) || lower > upper) return;
643
262
  return {
644
- info: (message) => {
645
- ctx.logger.info(message);
646
- },
647
- warn: (message) => {
648
- ctx.logger.warn(message);
649
- }
263
+ enabled,
264
+ restrictWrites,
265
+ lower,
266
+ upper
650
267
  };
651
268
  }
652
- /** Install the prompt, scoring tool, and stop guard in one Lead scope. */
653
- function installLead(options) {
654
- const { agent, autoTeam, config } = options;
655
- const systemPrompt = agent.ctx.systemPrompt;
656
- const tools = agent.ctx.tools;
657
- const disposers = [];
658
- const register = (dispose) => {
659
- disposers.push(dispose);
660
- };
661
- try {
662
- register(systemPrompt.section({
663
- name: "auto-team:policy",
664
- order: systemPrompt.getSectionOrder("TEAM_POLICY"),
665
- text: policyText(config.reportingAgentName, config.leadDeniedTools)
666
- }));
667
- if (!autoTeam.hasScore(agent)) register(registerScoreTool(tools, autoTeam));
668
- const stop = agent.ctx.on("agent/turn-stopping", () => {
669
- if (autoTeam.hasScore(agent)) return;
670
- agent.steer(createMessage({
671
- role: "user",
672
- content: [{
673
- type: "text",
674
- text: NO_SCORE_STEER_TEXT
675
- }],
676
- source: { kind: "user" }
677
- }));
678
- });
679
- register(() => {
680
- stop();
681
- });
682
- if (config.enforceLeadNoCode) {
683
- const guard = agent.ctx.on("tools/pre-execute", async (exec, next) => {
684
- if (exec.agent !== agent || autoTeam.decisionOf(agent) !== "team" || !config.leadDeniedTools.includes(exec.name)) return await next();
685
- return {
686
- kind: "deny",
687
- reason: "auto-team: the Lead must delegate code changes to an execution agent"
688
- };
689
- });
690
- register(() => {
691
- guard();
692
- });
269
+ function failure(code, message) {
270
+ return {
271
+ ok: false,
272
+ error: {
273
+ code,
274
+ message,
275
+ details: {}
693
276
  }
694
- } catch (error) {
695
- for (const dispose of disposers.toReversed()) dispose();
696
- throw error;
697
- }
698
- return () => {
699
- for (const dispose of disposers.toReversed()) dispose();
700
277
  };
701
278
  }
702
- /** Read the services needed by the install path without assuming load order. */
703
- function servicesReady(ctx) {
704
- return ctx.get("agentTeams") !== void 0 && ctx.get("goals") !== void 0 && ctx.get("tools") !== void 0 && ctx.get("systemPrompt") !== void 0;
705
- }
706
- /** Apply auto-team to the host; unmanaged scopes stay untouched. */
707
- function apply(ctx, config) {
708
- const resolved = resolveConfig(config);
709
- const runtime = createPluginRuntime(ctx);
710
- runtime.info(resolved.message);
711
- const autoTeam = createAutoTeam(ctx, resolved);
712
- const installed = /* @__PURE__ */ new Map();
713
- let warned = false;
714
- let projectionRegistered = false;
715
- let resetCommandRegistered = false;
716
- const ensureProjection = () => {
717
- if (projectionRegistered) return;
718
- const registry = ctx.get("sessionProjections");
719
- if (registry === void 0) return;
720
- ctx.effect(() => registry.register(autoTeamProjectionDefinition), "auto-team.projection()");
721
- projectionRegistered = true;
722
- };
723
- ensureProjection();
724
- const ensureResetCommand = () => {
725
- if (resetCommandRegistered) return;
726
- const commands = ctx.get("commands");
727
- if (!isCommandRuntime(commands)) return;
728
- ctx.effect(() => commands.register(createResetCommand(autoTeam)), "auto-team.reset-command()");
729
- resetCommandRegistered = true;
730
- };
731
- ensureResetCommand();
732
- const install = (agent) => {
733
- if (installed.has(agent)) return;
734
- ensureProjection();
735
- if (!servicesReady(ctx)) {
736
- if (!warned) {
737
- runtime.warn("auto-team: host services are unavailable; waiting for agent and goal services");
738
- warned = true;
739
- }
740
- return;
279
+ const getEndpoint = "auto-team/parallelism/get";
280
+ const updateEndpoint = "auto-team/parallelism/update";
281
+ const getFields = /* @__PURE__ */ new Set(["sessionId"]);
282
+ const updateFields = /* @__PURE__ */ new Set([
283
+ "sessionId",
284
+ "enabled",
285
+ "restrictWrites",
286
+ "lower",
287
+ "upper"
288
+ ]);
289
+ /** Register the root-only advisory and the optional native browser RPC channel. */
290
+ function installParallelism(ctx) {
291
+ const settings = /* @__PURE__ */ new WeakMap();
292
+ ctx.effect(() => ctx.systemPrompt.section({
293
+ name: "auto-team:parallelism",
294
+ order: ctx.systemPrompt.getSectionOrder("TEAM_POLICY"),
295
+ text: ({ agent }) => {
296
+ if (agent === void 0) return "";
297
+ return leadHint(ctx, agent, settings.get(agent.session) ?? defaults);
741
298
  }
742
- const membership = ctx.get("agentTeams")?.tryMembership(agent);
743
- if (membership === void 0) return;
744
- if (membership.role === "teammate") {
745
- if (membership.name !== resolved.reportingAgentName) installed.set(agent, installWorkerGuard(agent, membership.root, autoTeam));
746
- return;
299
+ }));
300
+ const dispatch = (endpoint, payload, signal) => {
301
+ if (signal.aborted) return failure("gateway/cancelled", "Parallelism request cancelled.");
302
+ const update = endpoint === updateEndpoint;
303
+ if (!update && endpoint !== getEndpoint) return failure("gateway/not-found", "Unknown parallelism operation.");
304
+ let fields = getFields;
305
+ if (update) fields = updateFields;
306
+ if (!isRecord(payload) || typeof payload.sessionId !== "string" || payload.sessionId === "" || Object.keys(payload).some((key) => !fields.has(key))) return failure("gateway/bad-request", "Expected an explicit session ID and valid parallelism fields.");
307
+ const root = ctx.agents.list().find((agent) => agent.id === payload.sessionId);
308
+ if (root === void 0 || rootOf(ctx, root) !== root) return failure("auto-team/session-unavailable", "The requested session is not a live local root.");
309
+ let next = settings.get(root.session) ?? defaults;
310
+ const running = runningIn(ctx, root);
311
+ if (update) {
312
+ const patch = settingsPatch(payload, next);
313
+ if (patch === void 0) return failure("gateway/bad-request", "Expected boolean switches and ordered integer bounds from 0 to 8.");
314
+ settings.set(root.session, patch);
315
+ next = patch;
747
316
  }
748
- const restored = ctx.get("sessionProjections")?.stateOf(agent.session, "autoTeam")?.score;
749
- if (restored !== void 0 && restored !== null) autoTeam.restore(agent, restored);
750
- installed.set(agent, installLead({
751
- agent,
752
- autoTeam,
753
- config: resolved
754
- }));
317
+ return {
318
+ ok: true,
319
+ value: {
320
+ ...next,
321
+ running
322
+ }
323
+ };
755
324
  };
756
- for (const agent of ctx.get("agents")?.list() ?? []) install(agent);
757
- ctx.on("agent/created", ({ agent }) => {
758
- install(agent);
759
- });
760
- ctx.on("agent/disposed", ({ agent }) => {
761
- installed.get(agent)?.();
762
- installed.delete(agent);
763
- });
764
- ctx.on("internal/service", (name) => {
765
- if (name !== "agentTeams" && name !== "goals" && name !== "tools" && name !== "systemPrompt" && name !== "sessionProjections" && name !== "commands") return;
766
- ensureProjection();
767
- ensureResetCommand();
768
- for (const agent of ctx.get("agents")?.list() ?? []) install(agent);
325
+ ctx.inject(["connection"], (web) => {
326
+ for (const endpoint of [getEndpoint, updateEndpoint]) web.connection.fetch.register({
327
+ path: `/api/${endpoint}`,
328
+ methods: ["POST"],
329
+ requestBody: "buffered",
330
+ async fetch(request) {
331
+ const body = await request.json().catch(() => false);
332
+ if (!isRecord(body) || body.type !== "client-request" || body.method !== endpoint || typeof body.rpcId !== "string") return new Response("Invalid request", { status: 400 });
333
+ const result = dispatch(endpoint, body.payload, request.signal);
334
+ return Response.json({
335
+ type: "server-response",
336
+ rpcId: body.rpcId,
337
+ result
338
+ });
339
+ }
340
+ });
769
341
  });
770
- ctx.effect(() => () => {
771
- for (const dispose of installed.values()) dispose();
772
- installed.clear();
773
- }, "auto-team.install()");
342
+ return (root) => (settings.get(root.session) ?? defaults).restrictWrites;
774
343
  }
775
344
  //#endregion
776
345
  //#region src/index.ts
346
+ /** Existing Cordis row identity. */
347
+ const name = "auto-team";
348
+ /** Services supplied by the native DSH profile, never started by this plugin. */
349
+ const inject = [
350
+ "agentTeams",
351
+ "agents",
352
+ "goals",
353
+ "subagents",
354
+ "systemPrompt",
355
+ "tools",
356
+ "sessionProjections",
357
+ "workingDirectory",
358
+ "fs"
359
+ ];
360
+ const Config = Schema.object({ message: Schema.string().default("auto-team loaded") });
777
361
  /**
778
- * Standalone function plugin for DeepSeek Harness.
779
- *
780
- * @module @oh-my-dsh/auto-team
362
+ * Install fiber-owned execution rules without changing native team or goal
363
+ * state.
781
364
  */
782
- /** Cordis plugin name; keep this stable after publishing. */
783
- const name = "auto-team";
784
- /** Services that must exist before the plugin is applied. */
785
- const inject = [];
365
+ function apply(ctx, config) {
366
+ installExecution(ctx, installParallelism(ctx));
367
+ ctx.logger.info(config.message);
368
+ }
786
369
  //#endregion
787
370
  export { Config, apply, inject, name };