driver.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env node
  2. /** Inspect the public Codex provider composition without invoking the product. */
  3. import { boot, resolveConfigPath } from '@deepseek-ai/dsh-app-boot'
  4. import type {} from '@deepseek-ai/dsh-subagent'
  5. import type {} from '@deepseek-ai/dsh-tools'
  6. const configPath = process.argv[2]
  7. if (configPath === undefined) {
  8. throw new Error('subagent-codex Loader composition driver requires a config path')
  9. }
  10. let starts = 0
  11. const ctx = await boot(
  12. 'subagent-codex-loader-composition',
  13. resolveConfigPath(configPath, undefined),
  14. undefined,
  15. (hostCtx) => {
  16. hostCtx.on('subagent/start', () => {
  17. starts += 1
  18. })
  19. },
  20. )
  21. try {
  22. const provider = ctx.subagents.getProvider('codex')
  23. if (provider === undefined) throw new Error('Codex provider was not registered')
  24. const tool = ctx.tools.schemas().find(schema => schema.name === 'subagent_codex')
  25. if (tool === undefined) throw new Error('subagent_codex tool was not registered')
  26. const properties = tool.parameters.properties
  27. if (typeof properties !== 'object' || properties === null || Array.isArray(properties)) {
  28. throw new Error('subagent_codex tool has invalid parameter properties')
  29. }
  30. process.stdout.write(`${JSON.stringify({
  31. providers: ctx.subagents.list(),
  32. provider: {
  33. name: provider.name,
  34. capabilities: provider.capabilities,
  35. inheritsParentContext: provider.inheritsParentContext,
  36. },
  37. tool: {
  38. name: tool.name,
  39. parameterNames: Object.keys(properties).sort(),
  40. required: tool.parameters.required,
  41. },
  42. starts,
  43. })}\n`)
  44. } finally {
  45. await ctx.fiber.dispose()
  46. }