@tencent-ai/agent-harness 0.2.0-beta.1 → 0.2.0-beta.2

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 (137) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/cli/CHANGELOG.md +71 -0
  4. package/cli/dist-server/shared.cjs +318 -314
  5. package/cli/dist-server/types/node/acp/acp-protocol.d.ts +40 -12
  6. package/cli/dist-server/types/node/acp/usage-by-category-calculator.d.ts +21 -0
  7. package/cli/dist-server/types/node/cli/stream-json-protocol.d.ts +15 -1
  8. package/cli/dist-server/types/node/data-fs/index.d.ts +13 -1
  9. package/cli/dist-server/types/node/hooks/hook-protocol.d.ts +2 -2
  10. package/cli/dist-server/types/node/server/sessions.d.ts +24 -0
  11. package/cli/dist-server/types/node/server/types.d.ts +6 -0
  12. package/cli/dist-server/types/node/settings/settings-protocol.d.ts +5 -0
  13. package/cli/dist-server/types/node/tools/tool-protocol.d.ts +112 -2
  14. package/cli/dist-server/types/vendor/cbc-core/node/agent/agent-protocol.d.ts +29 -0
  15. package/cli/dist-server/types/vendor/cbc-core/node/agent/agent-service.d.ts +2 -0
  16. package/cli/dist-server/types/vendor/cbc-core/node/agent/index.d.ts +1 -0
  17. package/cli/dist-server/types/vendor/cbc-core/node/agent/interceptors/input-interceptors.d.ts +1 -6
  18. package/cli/dist-server/types/vendor/cbc-core/node/agent/runner-factory.d.ts +31 -11
  19. package/cli/dist-server/types/vendor/cbc-core/node/agent/speaker-label.d.ts +44 -0
  20. package/cli/dist-server/types/vendor/cbc-core/node/agent/tool-call-loop-detector-service.d.ts +5 -4
  21. package/cli/dist-server/types/vendor/cbc-core/node/agent/tool-call-loop-guard-protocol.d.ts +1 -1
  22. package/cli/dist-server/types/vendor/cbc-core/node/agent/tool-call-loop-pattern.d.ts +15 -4
  23. package/cli/dist-server/types/vendor/cbc-core/node/hooks/agent-trigger.d.ts +6 -22
  24. package/cli/dist-server/types/vendor/cbc-core/node/hooks/hook-protocol.d.ts +4 -1
  25. package/cli/dist-server/types/vendor/cbc-core/node/session/idle-queue-drain-service.d.ts +4 -56
  26. package/cli/dist-server/types/vendor/cbc-core/node/session/index.d.ts +3 -0
  27. package/cli/dist-server/types/vendor/cbc-core/node/session/interruption-service.d.ts +55 -9
  28. package/cli/dist-server/types/vendor/cbc-core/node/session/model-response-interceptors.d.ts +18 -0
  29. package/cli/dist-server/types/vendor/cbc-core/node/session/recovery-budget.d.ts +55 -0
  30. package/cli/dist-server/types/vendor/cbc-core/node/session/session-hook-manager.d.ts +15 -0
  31. package/cli/dist-server/types/vendor/cbc-core/node/session/session-manager.d.ts +10 -1
  32. package/cli/dist-server/types/vendor/cbc-core/node/session/session-persistence-error.d.ts +43 -0
  33. package/cli/dist-server/types/vendor/cbc-core/node/session/session-protocol.d.ts +63 -4
  34. package/cli/dist-server/types/vendor/cbc-core/node/session/session-run-state-machine-protocol.d.ts +1 -0
  35. package/cli/dist-server/types/vendor/cbc-core/node/session/session-runtime-lifecycle.d.ts +5 -0
  36. package/cli/dist-server/types/vendor/cbc-core/node/session/session-store.d.ts +150 -4
  37. package/cli/dist-server/types/vendor/cbc-core/node/session/stream-timeout-retry-budget.d.ts +13 -1
  38. package/cli/dist-server/types/vendor/cbc-core/node/utils/history-utils.d.ts +23 -0
  39. package/cli/dist-server/types/vendor/cbc-core/node/utils/index.d.ts +1 -0
  40. package/cli/dist-server/types/vendor/cbc-core/node/utils/message-utils.d.ts +12 -0
  41. package/cli/dist-server/types/vendor/cbc-core/node/utils/model-utils.d.ts +7 -0
  42. package/cli/dist-server/types/vendor/cbc-core/node/utils/queue-dispatch-utils.d.ts +24 -2
  43. package/cli/dist-server/types/vendor/cbc-core/node/utils/session-utils.d.ts +4 -1
  44. package/cli/dist-server/types/vendor/cbc-core/node/utils/string-retention-utils.d.ts +4 -0
  45. package/cli/dist-server/types/vendor/cbc-shared/node/hooks/hook-types.d.ts +7 -1
  46. package/cli/dist-server/types/vendor/cbc-shared/node/index.d.ts +2 -0
  47. package/cli/dist-server/types/vendor/cbc-shared/node/model/model-errors.d.ts +7 -3
  48. package/cli/dist-server/types/vendor/cbc-shared/node/tools/tool-names.d.ts +1 -0
  49. package/cli/dist-server/types/vendor/cbc-shared/node/utils/retry-backoff.d.ts +30 -0
  50. package/cli/dist-server/types/vendor/cbc-shared/node/utils/retry-policy.d.ts +26 -0
  51. package/cli/dist-server/types/workspace/authentication/lib/common/account-scoped-external-link-authentication-provider.d.ts +2 -2
  52. package/cli/dist-server/types/workspace/authentication/lib/common/account-utils.d.ts +25 -0
  53. package/cli/dist-server/types/workspace/authentication/lib/common/authentication-manager.d.ts +2 -2
  54. package/cli/dist-server/types/workspace/authentication/lib/common/authentication-protocol.d.ts +19 -2
  55. package/cli/dist-server/types/workspace/authentication/lib/common/external-link-authentication-provider.d.ts +2 -2
  56. package/cli/dist-server/types/workspace/authentication/lib/common/wx-authentication-provider.d.ts +2 -2
  57. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/agent-protocol.d.ts +29 -0
  58. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/agent-service.d.ts +2 -0
  59. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/index.d.ts +1 -0
  60. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/interceptors/input-interceptors.d.ts +1 -6
  61. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/runner-factory.d.ts +31 -11
  62. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/speaker-label.d.ts +44 -0
  63. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/tool-call-loop-detector-service.d.ts +5 -4
  64. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/tool-call-loop-guard-protocol.d.ts +1 -1
  65. package/cli/dist-server/types/workspace/cbc-core/lib/node/agent/tool-call-loop-pattern.d.ts +15 -4
  66. package/cli/dist-server/types/workspace/cbc-core/lib/node/hooks/agent-trigger.d.ts +6 -22
  67. package/cli/dist-server/types/workspace/cbc-core/lib/node/hooks/hook-protocol.d.ts +4 -1
  68. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/idle-queue-drain-service.d.ts +4 -56
  69. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/index.d.ts +3 -0
  70. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/interruption-service.d.ts +55 -9
  71. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/model-response-interceptors.d.ts +18 -0
  72. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/recovery-budget.d.ts +55 -0
  73. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-hook-manager.d.ts +15 -0
  74. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-manager.d.ts +10 -1
  75. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-persistence-error.d.ts +43 -0
  76. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-protocol.d.ts +63 -4
  77. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-run-state-machine-protocol.d.ts +1 -0
  78. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-runtime-lifecycle.d.ts +5 -0
  79. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/session-store.d.ts +150 -4
  80. package/cli/dist-server/types/workspace/cbc-core/lib/node/session/stream-timeout-retry-budget.d.ts +13 -1
  81. package/cli/dist-server/types/workspace/cbc-core/lib/node/utils/history-utils.d.ts +23 -0
  82. package/cli/dist-server/types/workspace/cbc-core/lib/node/utils/index.d.ts +1 -0
  83. package/cli/dist-server/types/workspace/cbc-core/lib/node/utils/message-utils.d.ts +12 -0
  84. package/cli/dist-server/types/workspace/cbc-core/lib/node/utils/model-utils.d.ts +7 -0
  85. package/cli/dist-server/types/workspace/cbc-core/lib/node/utils/queue-dispatch-utils.d.ts +24 -2
  86. package/cli/dist-server/types/workspace/cbc-core/lib/node/utils/session-utils.d.ts +4 -1
  87. package/cli/dist-server/types/workspace/cbc-core/lib/node/utils/string-retention-utils.d.ts +4 -0
  88. package/cli/dist-server/types/workspace/cbc-shared/lib/node/hooks/hook-types.d.ts +7 -1
  89. package/cli/dist-server/types/workspace/cbc-shared/lib/node/index.d.ts +2 -0
  90. package/cli/dist-server/types/workspace/cbc-shared/lib/node/model/model-errors.d.ts +7 -3
  91. package/cli/dist-server/types/workspace/cbc-shared/lib/node/tools/tool-names.d.ts +1 -0
  92. package/cli/dist-server/types/workspace/cbc-shared/lib/node/utils/retry-backoff.d.ts +30 -0
  93. package/cli/dist-server/types/workspace/cbc-shared/lib/node/utils/retry-policy.d.ts +26 -0
  94. package/cli/dist-server/types/workspace/cbc-workflow/lib/node/workflow/workflow-execution.d.ts +14 -1
  95. package/cli/dist-server/types/workspace/cbc-workflow/lib/node/workflow/workflow-manager.d.ts +7 -0
  96. package/cli/dist-server/types/workspace/cbc-worktree/lib/node/worktree/worktree-session.d.ts +3 -0
  97. package/cli/dist-server/types/workspace/product/lib/common/cloud-product-provider.d.ts +9 -0
  98. package/cli/dist-server/types/workspace/product/lib/common/index.d.ts +1 -0
  99. package/cli/dist-server/types/workspace/product/lib/common/pick-market-skill-id.d.ts +13 -0
  100. package/cli/dist-server/types/workspace/product/lib/common/tool-control-catalog.d.ts +2 -2
  101. package/cli/dist-server/types/workspace/product/lib/common/types/features.d.ts +62 -2
  102. package/cli/dist-server/types/workspace/product/lib/common/types/language-model.d.ts +66 -0
  103. package/cli/dist-server/types/workspace/product/lib/common/types/product.d.ts +7 -1
  104. package/cli/dist-server/types/workspace/sandbox-cli/lib/common/backup-policy.d.ts +10 -1
  105. package/cli/dist-server/types/workspace/sandbox-cli/lib/common/center-protocol.generated.d.ts +370 -4
  106. package/cli/dist-server/types/workspace/sandbox-cli/lib/common/file-policy.d.ts +1 -1
  107. package/cli/dist-server/types/workspace/sandbox-cli/lib/node/sandbox-center-client.d.ts +216 -0
  108. package/cli/package.json +1 -1
  109. package/cli/product.cloudhosted.json +2 -2
  110. package/cli/product.internal.json +259 -40
  111. package/cli/product.ioa.json +333 -148
  112. package/cli/product.json +309 -351
  113. package/cli/product.selfhosted.json +2 -2
  114. package/docs/README.md +1 -0
  115. package/docs/in-process.md +16 -0
  116. package/lib/application/services.d.ts +3 -1
  117. package/lib/application/services.js +1 -1
  118. package/lib/components/sandbox-center.d.mts +2 -0
  119. package/lib/components/sandbox-center.mjs +1 -0
  120. package/lib/components/session-config.d.mts +2 -0
  121. package/lib/components/session-config.mjs +1 -1
  122. package/lib/harness/create-harness.js +1 -1
  123. package/lib/harness/runtime.js +1 -1
  124. package/lib/harness/types.d.ts +3 -0
  125. package/lib/integration/executor-supervisor.js +1 -1
  126. package/lib/public.d.ts +1 -0
  127. package/lib/runtime/sandbox-center.d.ts +21 -0
  128. package/lib/runtime/sandbox-center.js +1 -0
  129. package/lib/server/public.d.ts +1 -0
  130. package/lib/session/agent-backend.d.ts +2 -0
  131. package/lib/session/agent-backend.js +1 -1
  132. package/lib/session/local-fs.js +1 -1
  133. package/lib/session/server-config.js +1 -1
  134. package/lib/session/server-interactions.js +1 -1
  135. package/package.json +25 -15
  136. package/lib/session/local-options.d.ts +0 -50
  137. package/lib/session/local-options.js +0 -1
@@ -1 +1 @@
1
- var c=Object.defineProperty;var u=(a,e)=>c(a,"name",{value:e,configurable:!0});import{AgentHarnessInvalidParamsError as l}from"../server/errors.js";function d(a){return a?.type==="select"&&Array.isArray(a.options)}u(d,"isSelect");export class ServerSessionConfig{static{u(this,"ServerSessionConfig")}constructor(e,t,s,o,i){this.options=e,this.catalog=t,this.project=s,this.restoreProject=o,this.projectContextSize=i,this.agentLocked=!1;const n=e.model??t?.currentValue;if(this.modelExplicit=e.model!==void 0,n&&t&&!t.options.some(r=>r.value===n))throw new l("Agent model is outside the admitted Harness catalog");this.values={model:n,permissionMode:e.permissionMode??e.settings?.permissions?.defaultMode??"default",...e.thinking?{thinking:e.thinking}:{},...e.effort!==void 0?{effort:e.effort}:{},...e.contextWindow!==void 0?{contextWindow:e.contextWindow}:{},...e.agent!==void 0?{agent:e.agent}:{},...e.multitask!==void 0?{multitask:e.multitask}:{},...e.sandboxEnabled!==void 0?{sandboxEnabled:e.sandboxEnabled}:{}}}static async create(e,t,s={}){const{createSessionConfigProjector:o,projectSessionContextSize:i}=await import("#agent-harness-components/session-config"),n=await o(e,{_meta:{"codebuddy.ai":{mainAgentSupport:!0}}});return new ServerSessionConfig(e,t,await o(e,s),n,i)}get queryOptions(){return{...this.values}}copy(){const e=new ServerSessionConfig(this.options,this.catalog,this.project,this.restoreProject,this.projectContextSize);return e.replace(this),e}replace(e){for(const t of Object.keys(this.values))delete this.values[t];Object.assign(this.values,structuredClone(e.values)),this.agentLocked=e.agentLocked,this.modelExplicit=e.modelExplicit}selections(){const e={};for(const t of this.restoreProject({...this.options,...this.values},this.catalog))(typeof t.currentValue=="string"||typeof t.currentValue=="boolean")&&(e[t.configId]=t.currentValue);return e}restore(e){const t=e.model,s=typeof t=="string"&&this.catalog!==void 0&&!this.catalog.options.some(o=>o.value===t);for(const o of["multitask","sandbox","agent","model","mode","context_window","thought_level"]){if(s&&["model","context_window","thought_level"].includes(o))continue;const i=e[o];if(i!==void 0)try{this.apply(typeof i=="boolean"?{sessionId:"",configId:o,type:"boolean",value:i}:{sessionId:"",configId:o,type:"id",value:i},this.restoreProject)}catch(n){if(!(n instanceof l))throw n}}}snapshot(){return this.project({...this.options,...this.values},this.catalog)}contextSize(e){return this.projectContextSize({...this.options,...this.values},e)}update(e){const t=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));return Object.entries(t).every(([s,o])=>this.values[s]===o)?!1:(Object.assign(this.values,t),!0)}lockAgent(){this.agentLocked=!0}initializeBlank(){const e=this.snapshot().find(t=>t.configId==="agent");d(e)&&!this.values.agent&&this.set({sessionId:"",configId:"agent",type:"id",value:e.currentValue})}set(e){this.apply(e,this.project)}apply(e,t){const s=t({...this.options,...this.values},this.catalog).find(i=>i.configId===e.configId);if(s?.type==="boolean"){if(e.type!=="boolean"||typeof e.value!="boolean")throw new l("Agent boolean configuration requires a boolean value");if(e.configId==="multitask"){this.values.multitask=e.value;return}if(e.configId==="sandbox"){this.values.sandboxEnabled=e.value;return}throw new l(`Unsupported Agent configuration option: ${e.configId}`)}if(e.type!=="id"||typeof e.value!="string")throw new l("Agent select configuration requires an option id");if(!(d(s)?s.options.flatMap(i=>"options"in i?i.options:[i]):[]).some(i=>i.value===e.value))throw new l(`Unknown Agent configuration option: ${e.configId}=${e.value}`);switch(e.configId){case"agent":if(this.agentLocked)throw new l("Main Agent can only change in a blank session");if(e.value==="minimal"&&this.values.multitask)throw new l("Disable Multitask before selecting Minimal");if(this.values.agent=e.value,!this.modelExplicit){const i=this.options.product?.agents?.find(n=>n.name===e.value)?.declaredModel;i&&(!this.catalog||this.catalog.options.some(n=>n.value===i))&&(this.values.model=i)}e.value==="minimal"&&this.values.permissionMode==="plan"&&(this.values.permissionMode="default");return;case"mode":this.values.permissionMode=e.value;return;case"model":{this.modelExplicit=!0,this.values.model=e.value,(this.values.thinking!==void 0||this.values.effort!==void 0)&&(this.values.thinking={type:"adaptive"},this.values.effort=null);const i=this.snapshot().find(n=>n.configId==="context_window");this.values.contextWindow!=null&&(!d(i)||!i.options.some(n=>"value"in n&&n.value===String(this.values.contextWindow)))&&(this.values.contextWindow=null);return}case"thought_level":this.values.thinking={type:e.value==="disabled"?"disabled":"adaptive"},this.values.effort=e.value==="disabled"||e.value==="enabled"?null:e.value;return;case"context_window":this.values.contextWindow=Number(e.value);return;default:throw new l(`Unsupported Agent configuration option: ${e.configId}`)}}}
1
+ var r=Object.defineProperty;var u=(a,e)=>r(a,"name",{value:e,configurable:!0});import{AgentHarnessInvalidParamsError as l}from"../server/errors.js";function d(a){return a?.type==="select"&&Array.isArray(a.options)}u(d,"isSelect");export class ServerSessionConfig{static{u(this,"ServerSessionConfig")}constructor(e,t,o,s,n){this.options=e,this.catalog=t,this.project=o,this.restoreProject=s,this.projectContextSize=n,this.agentLocked=!1;const i=e.model??t?.currentValue;if(this.modelExplicit=e.model!==void 0,i&&t&&!t.options.some(c=>c.value===i))throw new l("Agent model is outside the admitted Harness catalog");this.values={model:i,permissionMode:e.permissionMode??e.settings?.permissions?.defaultMode??"default",...e.thinking?{thinking:e.thinking}:{},...e.effort!==void 0?{effort:e.effort}:{},...e.contextWindow!==void 0?{contextWindow:e.contextWindow}:{},...e.agent!==void 0?{agent:e.agent}:{},...e.multitask!==void 0?{multitask:e.multitask}:{},...e.sandboxEnabled!==void 0?{sandboxEnabled:e.sandboxEnabled}:{}}}static async create(e,t,o={}){const{createSessionConfigProjector:s,projectSessionContextSize:n}=await import("#agent-harness-components/session-config"),i=await s(e,{_meta:{"codebuddy.ai":{mainAgentSupport:!0}}});return new ServerSessionConfig(e,t,await s(e,o),i,n)}get queryOptions(){return{...this.values}}copy(){const e=new ServerSessionConfig(this.options,this.catalog,this.project,this.restoreProject,this.projectContextSize);return e.replace(this),e}replace(e){for(const t of Object.keys(this.values))delete this.values[t];Object.assign(this.values,structuredClone(e.values)),this.agentLocked=e.agentLocked,this.modelExplicit=e.modelExplicit}selections(){const e={};for(const t of this.restoreProject({...this.options,...this.values},this.catalog))(typeof t.currentValue=="string"||typeof t.currentValue=="boolean")&&(e[t.configId]=t.currentValue);return e}restore(e){const t=e.model,o=typeof t=="string"&&this.catalog!==void 0&&!this.catalog.options.some(s=>s.value===t);for(const s of["multitask","sandbox","agent","model","mode","context_window","thought_level"]){if(o&&["model","context_window","thought_level"].includes(s))continue;const n=e[s];if(n!==void 0)try{this.apply(typeof n=="boolean"?{sessionId:"",configId:s,type:"boolean",value:n}:{sessionId:"",configId:s,type:"id",value:n},this.restoreProject)}catch(i){if(!(i instanceof l))throw i}}}snapshot(){return this.project({...this.options,...this.values},this.catalog)}contextSize(e){return this.projectContextSize({...this.options,...this.values},e)}update(e){const t=Object.fromEntries(Object.entries(e).filter(([,o])=>o!==void 0));return Object.entries(t).every(([o,s])=>this.values[o]===s)?!1:(Object.assign(this.values,t),!0)}lockAgent(){this.agentLocked=!0}initializeBlank(){const e=this.snapshot().find(t=>t.configId==="agent");d(e)&&!this.values.agent&&this.set({sessionId:"",configId:"agent",type:"id",value:e.currentValue})}set(e){this.apply(e,this.project)}apply(e,t){const o=t({...this.options,...this.values},this.catalog).find(n=>n.configId===e.configId);if(!o)throw new l(`Unknown Agent configuration option: ${e.configId}`);if(o.type==="boolean"){if(e.type!=="boolean"||typeof e.value!="boolean")throw new l("Agent boolean configuration requires a boolean value");if(e.configId==="multitask"){this.values.multitask=e.value;return}if(e.configId==="sandbox"){this.values.sandboxEnabled=e.value;return}throw new l(`Unsupported Agent configuration option: ${e.configId}`)}if(e.type!=="id"||typeof e.value!="string")throw new l("Agent select configuration requires an option id");if(!(d(o)?o.options.flatMap(n=>"options"in n?n.options:[n]):[]).some(n=>n.value===e.value))throw new l(`Unknown Agent configuration option: ${e.configId}=${e.value}`);switch(e.configId){case"agent":if(this.agentLocked)throw new l("Main Agent can only change in a blank session");if(e.value==="minimal"&&this.values.multitask)throw new l("Disable Multitask before selecting Minimal");if(this.values.agent=e.value,!this.modelExplicit){const n=this.options.product?.agents?.find(i=>i.name===e.value)?.declaredModel;n&&(!this.catalog||this.catalog.options.some(i=>i.value===n))&&(this.values.model=n)}e.value==="minimal"&&this.values.permissionMode==="plan"&&(this.values.permissionMode="default");return;case"mode":this.values.permissionMode=e.value;return;case"model":{this.modelExplicit=!0,this.values.model=e.value,(this.values.thinking!==void 0||this.values.effort!==void 0)&&(this.values.thinking={type:"adaptive"},this.values.effort=null);const n=this.snapshot().find(i=>i.configId==="context_window");this.values.contextWindow!=null&&(!d(n)||!n.options.some(i=>"value"in i&&i.value===String(this.values.contextWindow)))&&(this.values.contextWindow=null);return}case"thought_level":this.values.thinking={type:e.value==="disabled"?"disabled":"adaptive"},this.values.effort=e.value==="disabled"||e.value==="enabled"?null:e.value;return;case"context_window":this.values.contextWindow=Number(e.value);return;default:throw new l(`Unsupported Agent configuration option: ${e.configId}`)}}}
@@ -1 +1 @@
1
- var h=Object.defineProperty;var s=(o,t)=>h(o,"name",{value:t,configurable:!0});import{createAskUserQuestionElicitation as q,normalizeAskUserQuestionElicitationAnswers as k}from"#agent-harness-components/question-elicitation";import{abortable as A}from"../internal/async.js";import{isRecord as b}from"../internal/guards.js";function _(o){if(!Array.isArray(o.questions)||o.questions.length===0)throw new Error("AskUserQuestion requires questions");return{questions:o.questions.map(t=>{if(!b(t)||typeof t.question!="string"||!Array.isArray(t.options))throw new Error("Invalid AskUserQuestion question");return{question:t.question,header:typeof t.header=="string"?t.header:"",multiSelect:t.multiSelect===!0,options:t.options.map(a=>{if(!b(a)||typeof a.label!="string")throw new Error("Invalid AskUserQuestion option");return{label:a.label,description:typeof a.description=="string"?a.description:""}})}})}}s(_,"questionsFrom");export function serverCanUseTool(o,t,a){return async(c,n,e)=>{const i=s(r=>({behavior:"deny",message:r}),"deny");if(e.signal.aborted)return i("Interaction cancelled");const{id:g,meta:y}=t(),l=e.origin?{...e.origin.requestId?{"codebuddy.ai/requestId":e.origin.requestId}:{},...e.origin.rootRequestId?{"codebuddy.ai/rootRequestId":e.origin.rootRequestId}:{},...e.origin.subagent?{"codebuddy.ai/subagent":e.origin.subagent}:{}}:y,f=s(async r=>{await a?.(!0,l);try{return await A(r(),e.signal)}finally{e.signal.aborted||await a?.(!1,l)}},"interact");if(c==="AskUserQuestion"){if(!o.clientCapabilities.elicitation?.form)return i("Client does not support form elicitation");const r=_(n),w=await f(()=>o.callbacks.createElicitation(q(r,g,e.toolUseID,l),{signal:e.signal}));return e.signal.aborted||w.action!=="accept"?{...i("User declined to answer"),interrupt:!0}:{behavior:"allow",updatedInput:{...n,answers:k(r,w.content)}}}const d=e.suggestions?.length?structuredClone(e.suggestions):void 0,I={sessionId:g,title:e.title??e.displayName??c,...e.description?{description:e.description}:{},subject:{type:"tool_call",toolCall:{toolCallId:e.toolUseID,title:c,rawInput:n,...e.blockedPath?{locations:[{path:e.blockedPath}]}:{}}},options:[{optionId:"allow_once",name:"Allow once",kind:"allow_once"},...d?[{optionId:"allow_always",name:"Always allow",kind:"allow_always"}]:[],{optionId:"reject_once",name:"Reject",kind:"reject_once"}],_meta:l},u=await f(()=>o.callbacks.requestPermission(I,{signal:e.signal}));return e.signal.aborted||u.outcome.outcome!=="selected"?i("Permission request cancelled"):u.outcome.optionId==="allow_once"?{behavior:"allow",updatedInput:n,decisionClassification:"user_temporary"}:u.outcome.optionId==="allow_always"&&d?{behavior:"allow",updatedInput:n,updatedPermissions:d,decisionClassification:"user_permanent"}:{...i("Permission denied"),decisionClassification:"user_reject"}}}s(serverCanUseTool,"serverCanUseTool");
1
+ var h=Object.defineProperty;var s=(o,t)=>h(o,"name",{value:t,configurable:!0});import{createAskUserQuestionElicitation as q,normalizeAskUserQuestionElicitationAnswers as A}from"#agent-harness-components/question-elicitation";import{abortable as k}from"../internal/async.js";import{isRecord as b}from"../internal/guards.js";function _(o){if(!Array.isArray(o.questions)||o.questions.length===0)throw new Error("AskUserQuestion requires questions");return{questions:o.questions.map(t=>{if(!b(t)||typeof t.question!="string"||!Array.isArray(t.options))throw new Error("Invalid AskUserQuestion question");return{question:t.question,header:typeof t.header=="string"?t.header:"",multiSelect:t.multiSelect===!0,options:t.options.map(a=>{if(!b(a)||typeof a.label!="string")throw new Error("Invalid AskUserQuestion option");return{label:a.label,description:typeof a.description=="string"?a.description:""}})}})}}s(_,"questionsFrom");export function serverCanUseTool(o,t,a){return async(d,n,e)=>{const i=s(r=>({behavior:"deny",message:r}),"deny");if(e.signal.aborted)return i("Interaction cancelled");const{id:g,meta:y}=t(),l=e.origin?{...e.origin.requestId?{"codebuddy.ai/requestId":e.origin.requestId}:{},...e.origin.rootRequestId?{"codebuddy.ai/rootRequestId":e.origin.rootRequestId}:{},...e.origin.subagent?{"codebuddy.ai/subagent":e.origin.subagent}:{}}:y,f=s(async r=>{await a?.(!0,l);try{return await k(r(),e.signal)}finally{e.signal.aborted||await a?.(!1,l)}},"interact");if(d==="AskUserQuestion"){if(!o.clientCapabilities.elicitation?.form)return i("Client does not support form elicitation");const r=_(n),w=await f(()=>o.callbacks.createElicitation(q(r,g,e.toolUseID,l),{signal:e.signal}));return e.signal.aborted||w.action!=="accept"?{...i("User declined to answer"),interrupt:!0}:{behavior:"allow",updatedInput:{...n,answers:A(r,w.content)}}}const c=e.suggestions?.length?structuredClone(e.suggestions):void 0,I={sessionId:g,title:e.title??e.displayName??d,...e.description?{description:e.description}:{},subject:{type:"tool_call",toolCall:{toolCallId:e.toolUseID,title:d,rawInput:n,...e.blockedPath?{locations:[{path:e.blockedPath}]}:{}}},options:[{optionId:"allow_once",name:"Allow once",kind:"allow_once"},...c?[{optionId:"allow_always",name:c.every(r=>r.destination==="session")?"Allow for this session":"Always allow",kind:"allow_always"}]:[],{optionId:"reject_once",name:"Reject",kind:"reject_once"}],_meta:l},u=await f(()=>o.callbacks.requestPermission(I,{signal:e.signal}));return e.signal.aborted||u.outcome.outcome!=="selected"?i("Permission request cancelled"):u.outcome.optionId==="allow_once"?{behavior:"allow",updatedInput:n,decisionClassification:"user_temporary"}:u.outcome.optionId==="allow_always"&&c?{behavior:"allow",updatedInput:n,updatedPermissions:c,decisionClassification:"user_permanent"}:{...i("Permission denied"),decisionClassification:"user_reject"}}}s(serverCanUseTool,"serverCanUseTool");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-ai/agent-harness",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.2.0-beta.2",
4
4
  "description": "Standalone JSON-RPC agent harness backed by CodeBuddy Code",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,6 +36,10 @@
36
36
  "types": "./lib/components/session-config.d.mts",
37
37
  "default": "./lib/components/session-config.mjs"
38
38
  },
39
+ "#agent-harness-components/sandbox-center": {
40
+ "types": "./lib/components/sandbox-center.d.mts",
41
+ "default": "./lib/components/sandbox-center.mjs"
42
+ },
39
43
  "#agent-harness-components/session-replay": {
40
44
  "types": "./lib/components/session-replay.d.mts",
41
45
  "default": "./lib/components/session-replay.mjs"
@@ -144,7 +148,8 @@
144
148
  "executor/lib/types.cjs",
145
149
  "executor/lib/types.d.cts",
146
150
  "lib/**",
147
- "README.md"
151
+ "README.md",
152
+ "CHANGELOG.md"
148
153
  ],
149
154
  "publishConfig": {
150
155
  "access": "public",
@@ -209,16 +214,18 @@
209
214
  "@lydell/node-pty-linux-x64": "1.2.0-beta.14",
210
215
  "@lydell/node-pty-win32-arm64": "1.2.0-beta.14",
211
216
  "@lydell/node-pty-win32-x64": "1.2.0-beta.14",
212
- "@tencent-ai/sandbox-cli-darwin-arm64": "5.7.0-beta.2",
213
- "@tencent-ai/sandbox-cli-darwin-x64": "5.7.0-beta.2",
214
- "@tencent-ai/sandbox-cli-win32-x64": "5.7.0-beta.2",
215
- "@tencent-ai/agent-harness-darwin-arm64": "0.2.0-beta.1",
216
- "@tencent-ai/agent-harness-darwin-x64": "0.2.0-beta.1",
217
- "@tencent-ai/agent-harness-linux-arm64": "0.2.0-beta.1",
218
- "@tencent-ai/agent-harness-linux-arm64-musl": "0.2.0-beta.1",
219
- "@tencent-ai/agent-harness-linux-x64": "0.2.0-beta.1",
220
- "@tencent-ai/agent-harness-linux-x64-musl": "0.2.0-beta.1",
221
- "@tencent-ai/agent-harness-win32-x64": "0.2.0-beta.1"
217
+ "@tencent-ai/sandbox-cli-darwin-arm64": "5.8.0-beta.3",
218
+ "@tencent-ai/sandbox-cli-darwin-x64": "5.8.0-beta.3",
219
+ "@tencent-ai/sandbox-cli-linux-arm64": "5.8.0-beta.3",
220
+ "@tencent-ai/sandbox-cli-linux-x64": "5.8.0-beta.3",
221
+ "@tencent-ai/sandbox-cli-win32-x64": "5.8.0-beta.3",
222
+ "@tencent-ai/agent-harness-darwin-arm64": "0.2.0-beta.2",
223
+ "@tencent-ai/agent-harness-darwin-x64": "0.2.0-beta.2",
224
+ "@tencent-ai/agent-harness-linux-arm64": "0.2.0-beta.2",
225
+ "@tencent-ai/agent-harness-linux-arm64-musl": "0.2.0-beta.2",
226
+ "@tencent-ai/agent-harness-linux-x64": "0.2.0-beta.2",
227
+ "@tencent-ai/agent-harness-linux-x64-musl": "0.2.0-beta.2",
228
+ "@tencent-ai/agent-harness-win32-x64": "0.2.0-beta.2"
222
229
  },
223
230
  "devDependencies": {
224
231
  "@anthropic-ai/sandbox-runtime": "0.0.17",
@@ -233,6 +240,7 @@
233
240
  "@genie/cbc-shared": "0.0.0",
234
241
  "@genie/core": "0.0.0",
235
242
  "@genie/product": "0.0.0",
243
+ "@genie/sandbox-cli": "0.0.0",
236
244
  "@genie/style-guide": "0.0.0",
237
245
  "@genie/telemetry": "0.0.0",
238
246
  "@genie/vitest-config": "0.0.0",
@@ -245,9 +253,11 @@
245
253
  "@oven/bun-linux-x64-musl": "1.4.2",
246
254
  "@oven/bun-windows-x64": "1.4.2",
247
255
  "@rspack/core": "^1.7.6",
248
- "@tencent-ai/sandbox-cli-darwin-arm64": "5.7.0-beta.2",
249
- "@tencent-ai/sandbox-cli-darwin-x64": "5.7.0-beta.2",
250
- "@tencent-ai/sandbox-cli-win32-x64": "5.7.0-beta.2",
256
+ "@tencent-ai/sandbox-cli-darwin-arm64": "5.8.0-beta.3",
257
+ "@tencent-ai/sandbox-cli-darwin-x64": "5.8.0-beta.3",
258
+ "@tencent-ai/sandbox-cli-linux-arm64": "5.8.0-beta.3",
259
+ "@tencent-ai/sandbox-cli-linux-x64": "5.8.0-beta.3",
260
+ "@tencent-ai/sandbox-cli-win32-x64": "5.8.0-beta.3",
251
261
  "@types/node": "22",
252
262
  "@types/sinon": "^10.0.15",
253
263
  "@types/which": "^3.0.4",
@@ -1,50 +0,0 @@
1
- import { Effect } from 'effect';
2
- import { AgentDiscovery } from '../agent-registry/discovery.js';
3
- import type { SessionOpenOptions } from './runtime.js';
4
- /** Host filesystem discovery is assembled here; AgentBackend consumes query inputs. */
5
- export declare const localQueryOptions: (open: SessionOpenOptions) => Effect.Effect<{
6
- _meta?: Record<string, unknown> | null;
7
- cwd?: string;
8
- agent?: string;
9
- multitask?: boolean;
10
- sandboxEnabled?: boolean;
11
- remoteAgentsUrl?: string;
12
- permissionMode?: `${import("../../cli/dist-server/types/node/settings/settings-protocol.js").PermissionMode}`;
13
- model?: string;
14
- contextWindow?: number | null;
15
- tools?: Array<string | import("#agent-harness-codebuddy/server").SdkMcpToolDefinition> | import("../../cli/dist-server/types/node/server/tool-presets.js").ToolsPreset;
16
- allowedTools?: string[];
17
- disallowedTools?: string[];
18
- maxTurns?: number;
19
- abortController?: AbortController;
20
- thinking?: {
21
- type: 'adaptive';
22
- } | {
23
- type: 'enabled';
24
- budget_tokens?: number;
25
- } | {
26
- type: 'disabled';
27
- };
28
- effort?: import("../../cli/dist-server/types/node/settings/settings-protocol.js").ReasoningEffortLevel | null;
29
- maxThinkingTokens?: number;
30
- additionalDirectories?: string[];
31
- persistSession?: boolean;
32
- systemPrompt?: string | string[] | {
33
- type: 'preset';
34
- preset: 'default';
35
- append?: string;
36
- };
37
- includePartialMessages?: boolean;
38
- sandbox?: import("#agent-harness-codebuddy/server").SandboxFactory | import("#agent-harness-codebuddy/server").SandboxDriver;
39
- fs?: import("../../cli/dist-server/types/node/data-fs/index.js").FileSystem;
40
- settings?: import("../../cli/dist-server/types/node/settings/settings-protocol.js").Settings;
41
- mcpServers?: import("../../cli/dist-server/types/node/mcp/mcp-protocol.js").PartialMcpDataValue;
42
- product?: Partial<import("../../cli/dist-server/types/workspace/product/lib/common/product-protocol.js").ProductConfiguration>;
43
- freezeToolsDuringRun?: boolean;
44
- auth?: import("#agent-harness-codebuddy/server").RunAuth;
45
- account?: import("#agent-harness-codebuddy/server").RunAccount;
46
- headers?: Record<string, string>;
47
- canUseTool?: import("../../cli/dist-server/types/node/server/types.js").CanUseTool;
48
- hooks?: import("#agent-harness-codebuddy/server").QueryHooks;
49
- agents: Record<string, import("../../cli/dist-server/types/node/product/agent-conversion-utils.js").ExternalAgentDefinition>;
50
- }, Error, AgentDiscovery>;
@@ -1 +0,0 @@
1
- var a=Object.defineProperty;var t=(o,i)=>a(o,"name",{value:i,configurable:!0});import{Effect as c}from"effect";import{AgentDiscovery as l}from"../agent-registry/discovery.js";import{workspaceQueryOptions as y}from"./agent-backend.js";export const localQueryOptions=c.fn("localQueryOptions")(function*(o){const i=yield*y(o),e=yield*l,r=o.workspace.canonicalCwd,s=yield*c.tryPromise({try:t(n=>e.loadAgentDefinitions(r,{signal:AbortSignal.any([n,o.signal])}),"try"),catch:t(n=>n instanceof Error?n:new Error("Agent definition discovery failed",{cause:n}),"catch")});return{...i,agents:s}});