@goodandready/dsh-agent-orchestrator 0.1.11 → 0.1.12

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/lib/index.js +31 -7
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -75,6 +75,26 @@ import { syncDefaultPresets } from './pipeline/preset-sync.js'
75
75
  export const name = '@goodandready/dsh-agent-orchestrator'
76
76
  export const inject = ['settings', 'webServer', 'llm', 'tools', 'commands', 'systemPrompt', 'subagents']
77
77
 
78
+ export function isVolatileRef(value) {
79
+ return !!value && typeof value === 'object' && !Array.isArray(value) && typeof value.get === 'function'
80
+ }
81
+
82
+ export function plainConfig(cfg) {
83
+ while (typeof cfg === 'function') {
84
+ cfg = cfg()
85
+ }
86
+ if (isVolatileRef(cfg)) return plainConfig(cfg.get())
87
+ if (!cfg || typeof cfg !== 'object') return cfg
88
+ if (Array.isArray(cfg)) {
89
+ return cfg.map((item) => plainConfig(item))
90
+ }
91
+ const out = {}
92
+ for (const key of Object.keys(cfg)) {
93
+ out[key] = plainConfig(cfg[key])
94
+ }
95
+ return out
96
+ }
97
+
78
98
  export const Config = z.object({
79
99
  enabled: z.boolean().default(true).description('Enable Multi-Agent Orchestrator pipeline dispatcher').volatile(),
80
100
  defaultScenario: z.string().default('auto').description('Default complexity scenario (auto, hotfix, simple, medium, complex, enterprise)').volatile(),
@@ -91,7 +111,7 @@ export const Config = z.object({
91
111
  kanbanSync: (typeof z.any === 'function' ? z.any() : z.object({})).default(null).description('Kanban board synchronization configuration').volatile(),
92
112
  })
93
113
 
94
- export function apply(ctx, config = {}) {
114
+ export function apply(ctx, rawConfig = {}) {
95
115
  const NS = 'dsh-agent-orchestrator'
96
116
  const logger = ctx?.logger || {
97
117
  debug: () => {},
@@ -99,6 +119,7 @@ export function apply(ctx, config = {}) {
99
119
  warn: () => {},
100
120
  error: () => {},
101
121
  }
122
+ const config = plainConfig(rawConfig)
102
123
  let currentSettings = {
103
124
  ...config,
104
125
  disableNestedDelegation: Boolean(config.disableNestedDelegation),
@@ -117,7 +138,8 @@ export function apply(ctx, config = {}) {
117
138
  },
118
139
  }
119
140
 
120
- const applyLoadedConfig = (saved) => {
141
+ const applyLoadedConfig = (rawSaved) => {
142
+ const saved = plainConfig(rawSaved)
121
143
  if (!saved || typeof saved !== 'object') return
122
144
  const mergedRoles = saved.roles || currentSettings.roles || getDefaultRoles()
123
145
  const mergedScenarios = saved.scenarios || currentSettings.scenarios || getDefaultScenarios()
@@ -192,10 +214,11 @@ export function apply(ctx, config = {}) {
192
214
  },
193
215
  persist: async (fullConfig) => {
194
216
  const { ns: targetNs, revision } = resolveNsAndRevision()
217
+ const payload = plainConfig(fullConfig)
195
218
  if (typeof svc.replace === 'function') {
196
- await svc.replace(targetNs, fullConfig, revision)
219
+ await svc.replace(targetNs, payload, revision)
197
220
  } else if (typeof svc.update === 'function') {
198
- await svc.update(targetNs, fullConfig, revision)
221
+ await svc.update(targetNs, payload, revision)
199
222
  } else {
200
223
  throw new Error('Settings service does not support replace or update')
201
224
  }
@@ -240,17 +263,18 @@ export function apply(ctx, config = {}) {
240
263
  }
241
264
 
242
265
  const getConfig = () => currentSettings
243
- const updateConfig = async (partial) => {
266
+ const updateConfig = async (rawPartial) => {
244
267
  if (!settingsAdapter) {
245
268
  throw new Error('Settings service is unavailable')
246
269
  }
247
- const nextSettings = {
270
+ const partial = plainConfig(rawPartial)
271
+ const nextSettings = plainConfig({
248
272
  ...currentSettings,
249
273
  ...partial,
250
274
  kanbanSync: partial?.kanbanSync
251
275
  ? { ...currentSettings.kanbanSync, ...partial.kanbanSync }
252
276
  : currentSettings.kanbanSync,
253
- }
277
+ })
254
278
  await settingsAdapter.persist(nextSettings)
255
279
  currentSettings = nextSettings
256
280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-agent-orchestrator",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Multi-agent task decomposition, DAG workflow orchestration, and prompt caching optimizer for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",