@xdxer/dingtalk-agent 0.1.5-beta.13 → 0.1.5-beta.15

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.
@@ -6,7 +6,7 @@ import { dirname, isAbsolute, join, parse, relative, resolve } from 'node:path';
6
6
  import { bootstrap } from './bootstrap.js';
7
7
  import { digest, stableStringify } from './events.js';
8
8
  import { prepareOpenCodeEvalAgent, resolveOpenCodeEvalAgent, readOpenCodeVersion, runOpenCodeEvaluation, runOpenCodePrompt, loadProbeCorePassed, OPENCODE_LOAD_PROBE_PROMPT, } from './opencode-evals.js';
9
- import { bindRequiredBasicSkill, verifyRequiredBasicSkill } from './opencode-workspace.js';
9
+ import { bindRequiredBasicSkill, DEFAULT_OPENCODE_MODEL, verifyRequiredBasicSkill, } from './opencode-workspace.js';
10
10
  import { countInstructionsForPath } from './instruction-path.js';
11
11
  import { resolvePackageRoot } from './package-root.js';
12
12
  import { bundledSkillPath, isBasicSkillName } from './skill-manager.js';
@@ -125,7 +125,7 @@ export function auditAgent(root, options = {}) {
125
125
  const staticPrerequisitesReady = checks
126
126
  .filter((item) => item.blocking)
127
127
  .every((item) => item.level === 'pass');
128
- const effectiveModel = options.model || 'deepseek/deepseek-chat';
128
+ const effectiveModel = options.model || DEFAULT_OPENCODE_MODEL;
129
129
  const loadTargetHash = currentLoadTargetHash(rootReal, options, requiredSkills, effectiveModel);
130
130
  let loadReport = null;
131
131
  let loadReportPath = '';
@@ -705,6 +705,7 @@ function executeInheritanceProbe(sourceRoot, model, command, timeoutMs, reportEv
705
705
  realpathIfExists(referenceExecution.toolPaths[0]) === referenceReal;
706
706
  const definitionRaw = persistProbeExecution(reportEvidenceRoot, 'definition', definitionExecution);
707
707
  const referenceRaw = persistProbeExecution(reportEvidenceRoot, 'reference', referenceExecution);
708
+ const referenceAnswerPassed = terminalSingleProbeAnswer(referenceExecution.answer, expectedReference);
708
709
  const result = {
709
710
  passed: Boolean(definitionInstruction) && basicResolvedCount === 1 &&
710
711
  definitionPermissionPassed && referencePermissionPassed &&
@@ -712,7 +713,7 @@ function executeInheritanceProbe(sourceRoot, model, command, timeoutMs, reportEv
712
713
  definitionExecution.toolCalls === 0 &&
713
714
  definitionExecution.answer.trim() === expectedDefinition &&
714
715
  referenceExecution.exitCode === 0 && referenceExecution.directoryMatched &&
715
- referenceExecution.answer.trim() === expectedReference &&
716
+ referenceAnswerPassed &&
716
717
  referenceRead && referenceFullRead && referenceToolsScoped,
717
718
  definition: executionProbeSummary(definitionExecution, expectedDefinition, {
718
719
  nativeRule: definitionInstruction,
@@ -727,7 +728,7 @@ function executeInheritanceProbe(sourceRoot, model, command, timeoutMs, reportEv
727
728
  permissionPassed: referencePermissionPassed,
728
729
  evalAgent: referenceEvalAgent,
729
730
  raw: referenceRaw,
730
- }, sandbox),
731
+ }, sandbox, 'terminal-single-probe'),
731
732
  host: {
732
733
  model,
733
734
  openCodeVersion: preflight.openCodeVersion,
@@ -758,13 +759,19 @@ function initializeProbeWorktree(workspace) {
758
759
  throw new Error(`继承探针无法初始化隔离 git worktree: ${child.error?.message || String(child.stderr || child.stdout || '').trim()}`);
759
760
  }
760
761
  }
761
- function executionProbeSummary(execution, expected, extra, sandbox) {
762
+ function executionProbeSummary(execution, expected, extra, sandbox, answerContract = 'exact') {
763
+ const answer = execution.answer.trim();
764
+ const answerPassed = answerContract === 'terminal-single-probe'
765
+ ? terminalSingleProbeAnswer(answer, expected)
766
+ : answer === expected;
762
767
  return {
763
768
  passed: execution.exitCode === 0 && execution.directoryMatched &&
764
- execution.answer.trim() === expected,
765
- exact: execution.answer.trim() === expected,
769
+ answerPassed,
770
+ exact: answer === expected,
771
+ answerContract,
772
+ terminalSingleProbe: terminalSingleProbeAnswer(answer, expected),
766
773
  expected,
767
- answer: execution.answer.trim(),
774
+ answer,
768
775
  exitCode: execution.exitCode,
769
776
  directoryMatched: execution.directoryMatched,
770
777
  sessionId: execution.sessionId,
@@ -780,6 +787,15 @@ function executionProbeSummary(execution, expected, extra, sandbox) {
780
787
  ...extra,
781
788
  };
782
789
  }
790
+ function terminalSingleProbeAnswer(answer, expected) {
791
+ if (typeof answer !== 'string' || typeof expected !== 'string' || !expected)
792
+ return false;
793
+ const normalized = answer.trim();
794
+ const lines = normalized.split(/\r?\n/);
795
+ const probeTokens = normalized.match(/dta-(?:definition|reference|load)-probe=[^\s`]+/g) || [];
796
+ return lines.at(-1) === expected &&
797
+ probeTokens.length === 1 && probeTokens[0] === expected;
798
+ }
783
799
  function persistProbeExecution(reportRoot, name, execution) {
784
800
  const evidenceRoot = join(reportRoot, 'inheritance-probes');
785
801
  mkdirSync(evidenceRoot, { recursive: true });
@@ -1048,7 +1064,8 @@ function verifyLoadReport(root, reportPath, report, basic, definitionInstruction
1048
1064
  const referencePassed = reference.path ===
1049
1065
  '.agents/skills/dta-basic-behavior/references/risk-authority-and-privacy.md' &&
1050
1066
  validRandomProbe(reference.expected, 'dta-reference-probe') &&
1051
- reference.answer === reference.expected && reference.exitCode === 0 &&
1067
+ terminalSingleProbeAnswer(reference.answer, reference.expected) &&
1068
+ reference.exitCode === 0 &&
1052
1069
  reference.directoryMatched === true && referenceRead && referenceFullRead &&
1053
1070
  reference.fullRead === true && referenceToolsScoped &&
1054
1071
  reference.permissionPassed === true &&
@@ -1104,7 +1121,8 @@ function verifyLoadReport(root, reportPath, report, basic, definitionInstruction
1104
1121
  }
1105
1122
  if (!referencePassed) {
1106
1123
  failureSummary.push('inheritance.reference: ' +
1107
- `answer=${reference.answer === reference.expected ? 'exact' : 'mismatch'} ` +
1124
+ `answer=${terminalSingleProbeAnswer(reference.answer, reference.expected)
1125
+ ? 'terminal-single-probe' : 'mismatch'} ` +
1108
1126
  `exitCode=${reference.exitCode ?? '?'} durationMs=${reference.durationMs ?? '?'} ` +
1109
1127
  `fullRead=${reference.fullRead === true}`);
1110
1128
  }