@suifei/dsh-ai-team 0.4.6 → 0.4.8

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.
Files changed (2) hide show
  1. package/index.js +36 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -50,7 +50,7 @@ export const name = 'ai-team';
50
50
  // 实际使用的服务(含可选服务:缺失时 serviceOf 回退 ctx.get 并返回 undefined)。
51
51
  export const inject = ['webServer', 'permissionPresets', 'sandboxPolicy', 'tools', 'shell', 'agents', 'subagents', 'sessions'];
52
52
 
53
- const VERSION = '0.4.6';
53
+ const VERSION = '0.4.8';
54
54
  const HUMAN_ID = 'mem_human';
55
55
 
56
56
  const SKILLOPT_BACKENDS = ['mock', 'claude', 'codex', 'copilot', 'cursor', 'pi', 'opencode', 'handoff', 'azure_openai'];
@@ -986,8 +986,41 @@ export function apply(ctx, config = {}) {
986
986
  parameters: { project: { type: 'string', description: 'Project directory' } },
987
987
  output: { schema: { type: 'string' }, render: (_args, value) => [{ type: 'text', text: String(value) }] },
988
988
  async execute(args) {
989
- const project = typeof args?.project === 'string' && args.project !== '' ? args.project : process.cwd();
990
- const jobs = listJobs(project);
989
+ // 主动收割:工具调用即驱动(不依赖 PMO 定时器——实测宿主热重载/
990
+ // 重启后 setInterval 可能不重建,工具驱动保证链路可用)。
991
+ const explicit = typeof args?.project === 'string' && args.project !== '' ? args.project : null;
992
+ // job 归属项目数据目录(runtime.dir),显式路径只作为额外搜索根。
993
+ const runtimeRoots = [...(booted?.runtimes?.values?.() ?? [])].map((runtime) => runtime.dir).filter((root) => typeof root === 'string' && root !== '');
994
+ const jobRoots = [...new Set([...runtimeRoots, ...(explicit !== null ? [explicit] : [])])];
995
+ for (const jobRoot of jobRoots) {
996
+ if (typeof jobRoot !== 'string' || jobRoot === '') continue;
997
+ try {
998
+ await reconcileJobs({
999
+ ctx,
1000
+ projectDir: jobRoot,
1001
+ deps: {
1002
+ now: () => Date.now(),
1003
+ provider: (serviceOf(ctx, 'subagents')?.list?.() ?? [])[0],
1004
+ ensureParent: () => ensureParent(),
1005
+ votes: config.skilloptJudgeVotes ?? 3,
1006
+ startChild: async (label, spec) => {
1007
+ const child = await serviceOf(ctx, 'subagents').startActivation({ ...spec, label });
1008
+ return { childId: child.childId, outputStart: child.outputStart ?? null };
1009
+ },
1010
+ readText: (file) => readFileSync(file, 'utf8'),
1011
+ writeText: (file, next) => writeFileSync(file, next, 'utf8'),
1012
+ score: (value) => scoreSkillRubric(value, { measured: false }),
1013
+ appendResult: makeResultAppender({ projectDir: jobRoot }),
1014
+ vcs: await makeVcs({ shell: lazyShellService(ctx), projectDir: jobRoot }),
1015
+ diag: (row) => diag.append(row),
1016
+ },
1017
+ });
1018
+ } catch (error) {
1019
+ diag.append({ ev: 'skillopt.jobs.step.fail', message: error?.message ?? String(error), jobRoot });
1020
+ }
1021
+ }
1022
+ const roots = jobRoots.length > 0 ? jobRoots : [process.cwd()];
1023
+ const jobs = roots.flatMap((jobRoot) => listJobs(jobRoot));
991
1024
  if (jobs.length === 0) return '[skillopt jobs] none';
992
1025
  return ['[skillopt jobs]', ...jobs.map((job) => ` ${job.id} ${job.state} ${job.dimension ?? '-'}${job.decision ? ` verdict=${job.decision.verdict} (${job.decision.better}-${job.decision.worse})` : ''}${job.error ? ` error=${job.error}` : ''}`)].join('\n');
993
1026
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
6
6
  "license": "MIT",