@hcmai/sdk 0.21.12 → 0.21.14

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.
package/README.md CHANGED
@@ -15,3 +15,20 @@ import { HcmClient } from '@hcmai/sdk';
15
15
 
16
16
  Node.js 22 or newer is required. Source and release automation are maintained in
17
17
  [CNB](https://cnb.cool/hcm/hcm_nx_cli).
18
+
19
+ ## DataPackage fixture v1
20
+
21
+ `hcm import` and `parseFixture` share the versioned, JSON-serializable
22
+ `DATA_PACKAGE_FIXTURE_SCHEMA_V1` export (`urn:hcmai:data-package-fixture:v1`).
23
+ Its canonical declaration is `key_field: code`, identifying one real business key.
24
+ The legacy `key: [code]` declaration is accepted with a deprecation warning in the
25
+ parsed fixture, import result, and CLI stderr. Composite keys and simultaneous
26
+ `key` / `key_field` declarations are rejected before any request is sent.
27
+ Full DataPackage manifests use the server installer's `models[].keys` contract.
28
+
29
+ ```typescript
30
+ import { DATA_PACKAGE_FIXTURE_SCHEMA_V1, parseFixture } from '@hcmai/sdk';
31
+
32
+ const fixture = parseFixture(JSON.stringify(DATA_PACKAGE_FIXTURE_SCHEMA_V1.examples[0]));
33
+ // Surface fixture.warnings and runImport(...).warnings to SDK callers.
34
+ ```
package/dist/index.d.ts CHANGED
@@ -392,6 +392,8 @@ interface Fixture {
392
392
  items: Array<Record<string, unknown>>;
393
393
  /** 来源文件路径,仅用于报错定位 */
394
394
  sourcePath?: string;
395
+ /** 输入兼容提示,由解析器产生;调用方应向使用者显示。 */
396
+ warnings?: string[];
395
397
  }
396
398
  type RowStatus = 'created' | 'updated' | 'skipped' | 'failed';
397
399
  interface RowResult {
@@ -422,6 +424,8 @@ interface ImportResult {
422
424
  skipped: number;
423
425
  failed: number;
424
426
  rows: RowResult[];
427
+ /** 包含输入格式弃用提示;有提示时才出现,不能伪装成无告警。 */
428
+ warnings?: string[];
425
429
  /** Model:key → uuid(已解析引用快照) */
426
430
  refs: Record<string, string>;
427
431
  /**
@@ -502,6 +506,71 @@ declare function resolveRefs(record: Record<string, unknown>, store: RefStore):
502
506
  /** 解析 + 校验单个 data fixture(对齐 spec §10 校验项 1–4)。 */
503
507
  declare function parseFixture(yamlText: string, sourcePath?: string): Fixture;
504
508
 
509
+ /** hcm import 的公开 fixture v1 契约;完整 DataPackage manifest 由服务端装包器处理。 */
510
+ declare const DATA_PACKAGE_FIXTURE_SCHEMA_V1: {
511
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
512
+ readonly $id: "urn:hcmai:data-package-fixture:v1";
513
+ readonly title: "DataPackage fixture v1";
514
+ readonly type: "object";
515
+ readonly required: readonly ["model", "count", "items"];
516
+ readonly $defs: {
517
+ readonly nonEmptyString: {
518
+ readonly type: "string";
519
+ readonly pattern: "\\S";
520
+ };
521
+ };
522
+ readonly properties: {
523
+ readonly model: {
524
+ readonly $ref: "#/$defs/nonEmptyString";
525
+ };
526
+ readonly key_field: {
527
+ readonly $ref: "#/$defs/nonEmptyString";
528
+ readonly description: "key_field 声明单一真实业务键,例如 key_field: code;hcm import v1 不支持复合业务键。";
529
+ };
530
+ readonly key: {
531
+ readonly type: "array";
532
+ readonly minItems: 1;
533
+ readonly maxItems: 1;
534
+ readonly items: {
535
+ readonly $ref: "#/$defs/nonEmptyString";
536
+ };
537
+ readonly deprecated: true;
538
+ readonly description: "旧 key: [code] 仅兼容单元素数组,读取时给出弃用告警;请迁移到 key_field: code。";
539
+ };
540
+ readonly count: {
541
+ readonly type: "integer";
542
+ readonly minimum: 0;
543
+ };
544
+ readonly items: {
545
+ readonly type: "array";
546
+ readonly items: {
547
+ readonly type: "object";
548
+ };
549
+ };
550
+ };
551
+ readonly oneOf: readonly [{
552
+ readonly required: readonly ["key_field"];
553
+ readonly not: {
554
+ readonly required: readonly ["key"];
555
+ };
556
+ }, {
557
+ readonly required: readonly ["key"];
558
+ readonly not: {
559
+ readonly required: readonly ["key_field"];
560
+ };
561
+ }];
562
+ readonly additionalProperties: true;
563
+ readonly examples: readonly [{
564
+ readonly model: "OrgUnit";
565
+ readonly key_field: "code";
566
+ readonly count: 1;
567
+ readonly items: readonly [{
568
+ readonly code: "org-sales";
569
+ readonly name: "销售部";
570
+ }];
571
+ }];
572
+ };
573
+
505
574
  /** runner 只依赖 client 的这四个方法,便于单测 stub。 */
506
575
  interface ImportClient {
507
576
  findIdByKey(model: string, keyField: string, keyValue: string): Promise<string | null>;
@@ -6808,4 +6877,4 @@ type ParsedRef = {
6808
6877
  declare function parseRef(raw: string, project: string, casesSlug?: string): ParsedRef | null;
6809
6878
  declare const firstLine: (s: string) => string;
6810
6879
 
6811
- export { ADVISORY_CODES, AGREEING_VERDICTS, APPLY_CAVEAT, APPLY_PROBLEM_CODES, PROBLEM_CODES as ARTIFACT_PROBLEM_CODES, AUTH_INFO_PATH, AUTH_SESSION_INFO_PATH, type ActionEffectClass, type ActionHttpMethod, type ActionInput, type ActionMeta, type ActionResult, type ActionScope, type AdminResetPasswordRequest, type AdminResetPasswordResult, type AnyStreamEvent, ApplyInvariantError, ApplyPremiseError, type ApplyReport, type ApprovalConfirmPayload, type ApprovalRejectPayload, type ArtifactInstallClient, type AttachmentMeta, type AuthScheme, BINDING_RESTORED, BINDING_STATES, BINDING_STILL_UNBOUND, BINDING_UNKNOWN, BINDING_UNTOUCHED, BINDING_WORDS, BLIND_SPOTS, BLOCKING_CODES, BUCKETS, type BaselineCandidate, type BindingState, type BootstrapReconcileResult, type BootstrapTenantRequest, type BootstrapTenantResult, type BrowserAuthorization, type BrowserAuthorizationWatch, type BrowserStatusProbe, CARRIER_BLIND, CARRIER_HIT, CARRIER_KEYS, CARRIER_LABELS, CARRIER_MISS, CARRIER_UNAVAILABLE, CARRIER_VERDICTS, CASES_REPO_SLUG, CASES_REPO_URL, CAUSE_INCOMPLETE_CURRENT, CHANGE_NOT_WRITTEN, CHANGE_STATES, CHANGE_UNKNOWN, CHANGE_WRITTEN, CHECK_GROUPS, CLI_AUTHORIZE_PATH, CLI_EXCHANGE_PATH, CLI_STATUS_PATH, CLI_VERIFICATION_PATH, CNB_FAVICON_URL, CNB_ORIGIN, CODE_BINDING_ELSEWHERE, CODE_BINDING_OFF, CODE_BINDING_UNREADABLE, CODE_COMMANDS, CODE_FIELDS_MISSING, CODE_FIELDS_UNREADABLE, CODE_NOT_ON_ACTIVE, CODE_NO_FIELDS_NAMED, CODE_PROBE_UNAUTHENTICATED, CODE_PROBE_UNREADABLE, CODE_RESTORE_NOT_EFFECTIVE, CODE_RESTORE_READBACK_UNREADABLE, CODE_RESTORE_REFUSED, CODE_STEP, CODE_UNBIND_NOT_EFFECTIVE, CODE_UNBIND_READBACK_UNREADABLE, CODE_UNBIND_REFUSED, CODE_WORDS, CONTROL_BUFFER_LIMIT, CREDENTIAL_STORE_MODES, type CacheClearResult, type CacheStats, type CarrierKey, type CarrierResult, type CarrierVerdict, type CarryOver, type Catalog, type ChangePasswordInput, type ChangeState, type ChironCategory, type ChironManifest, type ChironSkill, type ChironSkillFile, type ChironStage, type ClearMetaCacheOpts, type CliAuthorizationRejection, type CliAuthorizationSession, CliError, CliErrorCode, type CliErrorInit, type ClientAuthContext, type ClientCredentialsInput, type ConnectionMessage, type ControlChannelEnvelope, type ConversationListItem, type ConversationListResult, type ConversationState, type CreateResult, type CreatedConversation, type CredentialStoreMode, DATA_PACKAGE_MODELS, DEBT_PREFIX, DEBT_UNKNOWN, DEFAULT_AGENT_ID, DEFAULT_ARTIFACT_CATEGORY, DEFAULT_SESSION_TTL_SECONDS, PREMISE_CODES as DELIVERY_PREMISE_CODES, DEV_MODE_PATH, DIMENSION_LABELS, DRY_RUN_NOTE, DRY_RUN_TAIL, type DataPackageInstallRunView, type DataPackageInstallView, type Premise$1 as DeliveryPremise, type DeliveryRun, type DescribeOpts, type DeviceAuthorization, DriftDetected, EFFECT_ACCOUNTING_ONLY, EFFECT_READ_ONLY, EFFECT_UNKNOWN, EFFECT_WRITES, ENUM_SHOW, ENV_FILE, EXEMPTIBLE_CODES, EXEMPTION_CODES, EXEMPTION_REQUIRED_KEYS, EXTENSION_SOURCE_HEADER, type EndpointNormalization, type EnvConfig, type EnvSource, type EnvironmentSafety, ExitCode, FIND_LIMIT, MAX_BYTES as FIND_MAX_BYTES, FORCE_STALE_FLAG, FORCE_STALE_FLAG_TEXT, type FieldEnumValue, type FieldMeta, type Finding, type Fingerprint, type Fixture, type FormatOptions, GATE_COMPONENTS, type GlobalConfig, HANDSHAKE_AUTH_ERROR_HEADER, HANDSHAKE_CONVERSATION_QUERY_PARAM, HANDSHAKE_TOKEN_QUERY_PARAM, HCM_FIELD_RAW_KEYS, HCM_LANG_ENV, HcmClient, type HcmClientOpts, type HttpClientOptions, IMPERSONATION_ACTIVE_PATH, IMPERSONATION_START_PATH, IMPORT_PLAN_FILE, INIT_EXIT_CODES, type IdentityMeta, type ImportClient, type ImportOptions, type ImportPlan, type ImportResult, type InitExitName, type InstallAcceptedResult, type InstallArtifactResult, type InteractionAnswerPayload, type InteractionDecision, type InteractionOutcome, type InteractionRequest, type InteractionResolved, JIRA_BASE, JIRA_KEYCHAIN, JIRA_PROJECT, JIRA_TOKEN_FILE, JOURNAL_FILE, JOURNAL_STOP_KINDS, JOURNAL_STOP_UNKNOWN, type JiraAllowedValue, JiraClient, type JiraClientOptions, type JiraComment, type JiraFieldMeta, type JiraFields, JiraHttpError, type JiraIssue, type JiraIssueTypeMeta, type JiraNamed, JiraNonBmpContentError, type JiraProject, type JiraRemoteLink, type JiraStatusFlow, type JiraTokenLookup, type JiraTokenSource, type JiraTransition, type JiraTransitionField, type JiraUser, Journal, JournalError, KIT_CARRY_OVER_KEY, KIT_CRAWLED_AT_FILE, KIT_MATCHED_ON, type KeyResolution, LAYER_ACTIVE, LEASE_FILE, LEDGER_MISSING_WORD, LEDGER_ONLY_FLAG, type LastAssistantTarget, LayoutContainmentError, Lease, LeaseViolation, type LifecycleResult, type ListTenantMetaOpts, type LoginOutcome, MANIFEST_PATH, MAPPING_FILE, MAX_MANIFEST_PAGES, MAX_SOURCE_PROBES, META_CACHE_PATH, META_JOURNAL_FILE, META_PATH, META_SCHEMA_SOURCE_COMMIT, STEPS as META_VERIFY_STEPS, STEP_DIFF as META_VERIFY_STEP_DIFF, STEPS$1 as META_WRITE_STEPS, METHOD_REPO_DISPLAY, METHOD_REPO_SLUG, METHOD_REPO_URL, MINI_APP_RUNTIME_SDK_VERSION, MINI_CONTEXT_FILE, MINI_CONTEXT_KIND, MINI_CONTEXT_VERSION, MINI_PULL_MANIFEST_FILE, MINI_REMOTE_ROOT, MINI_STATE_DIR, MODELS_PATH, MODEL_META_PATH, MappingError, type MessageClass, type MessageCreatePayload, type MessageStreamHandle, type MetaClient, type MetaIssue, type MetaIssueSeverity, type StepResult as MetaStepResult, type MetaValidationResult, type MigrationSummary, type MiniFileSnapshot, type MiniInitArgs, type MiniLocalFile, type MiniLocalStatus, type MiniPreviewTarget, type MiniProjectContext, type MiniPullArgs, type MiniPullManifest, type MiniPullResult, type MiniPushArgs, type MiniPushConflict, type MiniPushOperation, type MiniPushPlanItem, type MiniPushResult, type MiniSmokeCheckArgs, type MiniSmokeFetch, type MiniSmokeFetchResponse, type MiniSmokeResult, type MiniSmokeTargetKind, type MiniSmokeTargetResult, type MiniStatusEntry, type MiniSurface, type MiniTemplateArgs, type MiniTemplateKind, type MiniValidationResult, type MiniVerifyAgentReport, type MiniVerifyBrowserAcceptance, type MiniVerifyChangedFile, type MiniVerifyNextAction, type MiniVerifyPlan, type MiniVerifyPreviewUrl, type MiniVerifyReport, type MiniVerifySummary, type MiniWritableTemplateConfig, type ModelDescription, type ModelEntry, type ModelQueryDsl, NETWORK_GATES, NEXT_STEP, NON_BMP_RULE_NOTE, NOT_COVERED_LAYER1, NOT_COVERED_LAYER2, NOT_COVERED_SELF, type NonBmpHit, OFFLINE_COMMANDS, ON_EXISTING, type OneShotOpts, type OneShotResult, type OneShotToolCall, type Outcome, type OutputFormat, PASSWORD_CHANGE_REQUIRED, PLAN_JSON_KEYS, PLAN_PROBLEM_CODES, PREMISES, PREMISE_CLIENT, PREMISE_IDENTITY, PREMISE_JOURNAL_HAS_ENTRIES, PREMISE_JOURNAL_ON_DISK, PREMISE_KEY_FIELDS, PREMISE_PLAN_READABLE, PREMISE_ROWS_TO_CHECK, PREMISE_UNMET, PREMISE_WORDS, PROACTIVE_REFRESH_MARGIN_SECONDS, PRODUCT_STATE_WORDS, type PackOptions, type PackResult, type PairingLoginInput, type ParsedPlaceholder, type ParsedRef, type PasswordChangeChallenge, type PasswordLoginInput, type PatLoginInput, type PendingInteraction, type PlanProblem, PlanReadError, type PlannedRow, type Principal, type ProfileConfig, type ProjectEnv, type ProjectEnvFile, type QueryResult, RC_DECIDING_FIELDS, RC_DECIDING_REPORT_FIELDS, REASON_BASELINE_ROUND_NOT_COMPLETE, VERDICTS$1 as RECONCILE_VERDICTS, RECOVERY_WORDS, REJECTED_BEFORE_ROUTING_CODE, REQUIRED_SECTIONS, RESPOND_TIMEOUT_MS, RESTORE_CODES, RISK_CODES, RISK_FILE, ROUND_ANCHORS, ROUND_EXIT_CODES, ROUND_STAMPED_PRODUCTS, ROUND_STATES, ROUND_SUBCOMMAND, ROUND_WARNINGS, ROUND_WARNING_FALLBACK, type ReconIdentity, ReconLayout, type ReconProbe, type ReconSummary, type Reconciliation, RefStore, type RefreshInput, type RelationMeta, type RemoveResult, type RepoRef, type ResolvedEnvContext, type ResolvedProjectEnvironment, type ResponseCompletedPayload, type ResponseFailedPayload, type ResponsePartDeltaPayload, type ResponseStartedPayload, RestoreFailed, type ResumeSummary, type ResumeTurn, type Risk, type RiskProblem, type RoundPremise, type RoundResult, type RoundState, type RowResult, type RowStatus, type RunMetaChangeArgs, SDK_VERSION, SERVER_ERROR_GRACE_MS, STATUSES, STEP_NOTHING, STEP_PROBE, STEP_REBIND, STEP_RECORD, STEP_STOP, STEP_UNBIND, SUPERSEDED_STATUS, SYNTH_FOOTNOTE, SYNTH_MARK, type SaveMetaResult, type ScriptDryRunRequest, type ScriptDryRunResult, type ScriptLogPage, type ScriptLogQuery, type ScriptManifestValidationResult, type ScriptTaskView, type SeedPathArgs, type SendMessageOpts, type ServerErrorFrame, type SessionPrincipal, type SettingItem, type SettingWrite, type StreamCancelPayload, type StreamCommand, type StreamCommandEnvelope, type StreamCommandType, type StreamEventEnvelope, type StreamEventType, TEMP_ENV_NAME, TENANT_META_FILE_PATH, CONFIG as TRIAGE_CONFIG, GAP as TRIAGE_GAP, VERDICTS as TRIAGE_VERDICTS, TargetModelNotFound, type TaskProgressPayload, type TenantMetaEntry, type TenantResetReceipt, type TimelineItemLite, type TokenRecord, TokenStore, type ToolCallFailedPayload, type ToolCallResultPayload, type ToolCallStartedPayload, type TriageEntry, type TriageProblem, type TriageProblemRow, type TriageRoundResult, type TriageVerdict, USER_LOOKUP_PATH, type UndeterminedReason, type V4RenderSink, type V4StreamEventType, VALUE_CELL_MISSING, VALUE_FOOTNOTE, VALUE_STATE_DISABLED, VALUE_STATE_FOOTNOTE, VALUE_STATE_UNKNOWN, VERDICTS$2 as VERDICTS, VERDICT_DIVERGED, VERDICT_INCOMPARABLE, VERDICT_SAME, VERDICT_WORDS, CODES as VERIFY_ACTIVE_CODES, VERIFY_CODES, VERIFY_CRASHED, VERIFY_OK, VERIFY_WORDS, VERSION_PATH, ValueHints, type ValuesResult, type VerifyResult, WAIVER_REPLAY, WARNED_ROUND_STATES, WORKSPACES_PATH, WORK_DIRNAME, WRITE_RECOVERY_WORDS, type WaitResult, WorkLayout, type WorkspaceFileContent, type WorkspaceFileItem, type WorkspaceFileListResult, WsClient, type WsClientOpts, absoluteDownloadUrl, acquireLease, adminResetPassword, applyPlan, applyRc, applyReportText, applyReportToJson, archiveDir, askedTheDatabase, assertDangerWrite, assertExpectedTenant, assertNotReservedEnvName, assertSafeReferencePath, assertSafeSkillFilePath, assertSafeSkillId, assertUsableEndpoint, baselineRoundPremise, bootstrapTenant, buildAnswer, buildCarrierResult, buildConfirm, buildDeliveryRun, buildHandshakeUrl, buildInterrupt, buildMiniAppTemplateFiles, buildMiniPreviewTargets, buildMiniVerifyAgentReport, buildReconciliation, buildReject, buildResumeSummary, buildSteer, camelizeKeys, changePassword, checkCoherence, classifyEffect, classifyMessage, classifyStatus, clearMetaCache, clearModelCache, cliAuthorizationExpired, commandsFor, compareFingerprint, computeFingerprint, computeReconSourceKey, contentHash, conversationStateFile, conversationWebSocketEndpoint, create, createConversation, createHttpClient, createJiraClient, createV4Reducer, createWorkspaceFile, credentialsFile, defaultDownloadDir, defaultMiniRequiredScopes, deleteDocument, deleteEnv, deleteIdentity, deleteTenantMeta, deleteWorkspaceFile, deliveryRunFields, deriveNamelessToolLabel, describeNonBmpHits, describePrincipal, describeWaiver, detectDelegationPause, detectDirectInteractionPending, detectPasswordChangeChallenge, diagnoseRejectedBeforeRouting, discardedColumnLines, discoverProjectEnv, displayWidth, downloadDocument, enforceDriftGate, ensureSessionFresh, envDir, envFile, envsDir, exchangeBrowserAuthorization, existingJournalStop, exitCodeFor, explainJacksonError, extractNextSteps, fetchConversationTimeline, fetchConversationTimelineStrict, fetchInstallRun, fetchRecentConversations, fetchReconIdentity, fetchSkillCatalog, fetchSkillFile, fetchSkillMarkdown, fetchSkillReference, fieldByName, filterByStage, find, findEnvByEndpoint, findLastAssistantSeq, findLastAssistantTarget, findNonBmpChars, firstLine, flattenSkills, formatMetaIssues, formatMiniVerifyReport, formatObject, formatRows, fromAxiosError, getCacheStats, getMiniStatus, getScriptTask, getSettingDomain, getTenantMeta, globalConfigFile, guessMimeType, handshakeRejectedError, hasPendingImpersonationSessions, hcmConfigDir, hitRank, httpProbe, identitiesDir, identityDir, identityKnown, identityMetaFile, inferMiniWritableTemplateOptionsFromModel, initMiniAppProject, inspectRound, installDataPackageArtifact, installDataPackageArtifactAsync, isDelegationToolName, isLocalName, isReadOnly, isServerSlidingSession, isSupersededItem, isTempEnv, isTerminalRunStatus, isZeroNetwork, jiraTokenHelp, jiraTokenSource, jiraTokenUnreadable, journalNote, judgeDrift, layerDetail, ledgerOnlySignpost, linkedRepoRefs, listEnvs, listIdentities, listModels, listPendingInteractions, listProfiles, listTenantMeta, listWorkspaceFiles, loadCatalog, loadConversationState, loadEnv, loadExemptions, loadGlobalConfig, loadIdentity, loadMapping, loadProfile, loadRecordedFingerprint, loadRows, loadWorkspaceFileContent, loginClientCredentials, loginPairing, loginPassword, loginPat, matchNote, matchSkills, matchedDimensions, metaFileUrl, metaKindFromPath, migrateLegacyProfiles, modelEntries, modelKeys, needsRefresh, newRoundId, nonBmpHitLines, normalizeAndAssertEndpoint, normalizeEndpoint, normalizeOrigin, normalizeReferences, notAsked, oneShot, packDataPackage, parseConfirmToolName, parseEnvYaml, parseFixture, parseInteractionRequest, parseInteractionResolved, parsePlaceholder, parseRef, parseSettingAssignment, parseSkillFrontmatter, parseSkillRequirements, patchSettingDomain, planFromArtifacts, planProblemLines, planRc, planSummaryLine, planVsBaselinePremise, pollDeviceAuthorization, printResolvedEnvironment, probeAll, probeConversationHandshake, probeDoctorEndpoint, probeDoctorLayer, probeExtensionSource, profileDir, profileFile, pullMiniAppProject, pushMiniAppProject, queryScriptLogs, readImportPlan, readMiniContext, readPullManifest, readSessionPrincipal, rebind, rebindPayload, refreshToken, releasePendingImpersonationSessions, remove, renameIdentity, renderEnvYaml, renderFind, renderRound, renderTriage, renderValues, replHistoryFile, repoIssueUrl, requestCliAuthorization, resetSettingItem, resetTenant, resolveActiveEnv, resolveActiveIdentity, resolveActiveProfile, resolveAllSkillsInstallOrder, resolveBaselineDir, resolveChironBase, resolveCredentialStoreMode, resolveEnvContext, resolveItemKeys, resolveProjectEnvironment, resolveRefs, resolveSkillInstallOrder, respondToInteraction, riskFromArtifacts, roundAge, roundWarning, runActiveVerify, runImport, runMetaChange, runMiniSmokeChecks, runRecon, runTriageRound, safeCliAuthorizationError, safeSegment, saveConversationState, saveEnv, saveGlobalConfig, saveIdentity, saveProfile, saveTenantMeta, saveWorkspaceFileContent, scriptDryRun, seedBaselines, seedMappingPath, seedWorkDir, sendMessageAndStream, shelfPartition, snakeToCamel, startImpersonation, tenantSegment, toAcceptLanguage, toJson, toOrigin, toPrincipal, toTable, toYaml, truncateDisplay, unbindPayload, update, uploadDocument, validateCliAuthorizationUrl, validateMetaContent, validateMiniProject, validateScriptManifest, valueState, valuesRoundCaveat, verifyAttention, verifyRc, verifyText, waitForInstallRun, watchBrowserAuthorization, workspaceLayer, writeChangeState, writeImportPlan, writeRisk };
6880
+ export { ADVISORY_CODES, AGREEING_VERDICTS, APPLY_CAVEAT, APPLY_PROBLEM_CODES, PROBLEM_CODES as ARTIFACT_PROBLEM_CODES, AUTH_INFO_PATH, AUTH_SESSION_INFO_PATH, type ActionEffectClass, type ActionHttpMethod, type ActionInput, type ActionMeta, type ActionResult, type ActionScope, type AdminResetPasswordRequest, type AdminResetPasswordResult, type AnyStreamEvent, ApplyInvariantError, ApplyPremiseError, type ApplyReport, type ApprovalConfirmPayload, type ApprovalRejectPayload, type ArtifactInstallClient, type AttachmentMeta, type AuthScheme, BINDING_RESTORED, BINDING_STATES, BINDING_STILL_UNBOUND, BINDING_UNKNOWN, BINDING_UNTOUCHED, BINDING_WORDS, BLIND_SPOTS, BLOCKING_CODES, BUCKETS, type BaselineCandidate, type BindingState, type BootstrapReconcileResult, type BootstrapTenantRequest, type BootstrapTenantResult, type BrowserAuthorization, type BrowserAuthorizationWatch, type BrowserStatusProbe, CARRIER_BLIND, CARRIER_HIT, CARRIER_KEYS, CARRIER_LABELS, CARRIER_MISS, CARRIER_UNAVAILABLE, CARRIER_VERDICTS, CASES_REPO_SLUG, CASES_REPO_URL, CAUSE_INCOMPLETE_CURRENT, CHANGE_NOT_WRITTEN, CHANGE_STATES, CHANGE_UNKNOWN, CHANGE_WRITTEN, CHECK_GROUPS, CLI_AUTHORIZE_PATH, CLI_EXCHANGE_PATH, CLI_STATUS_PATH, CLI_VERIFICATION_PATH, CNB_FAVICON_URL, CNB_ORIGIN, CODE_BINDING_ELSEWHERE, CODE_BINDING_OFF, CODE_BINDING_UNREADABLE, CODE_COMMANDS, CODE_FIELDS_MISSING, CODE_FIELDS_UNREADABLE, CODE_NOT_ON_ACTIVE, CODE_NO_FIELDS_NAMED, CODE_PROBE_UNAUTHENTICATED, CODE_PROBE_UNREADABLE, CODE_RESTORE_NOT_EFFECTIVE, CODE_RESTORE_READBACK_UNREADABLE, CODE_RESTORE_REFUSED, CODE_STEP, CODE_UNBIND_NOT_EFFECTIVE, CODE_UNBIND_READBACK_UNREADABLE, CODE_UNBIND_REFUSED, CODE_WORDS, CONTROL_BUFFER_LIMIT, CREDENTIAL_STORE_MODES, type CacheClearResult, type CacheStats, type CarrierKey, type CarrierResult, type CarrierVerdict, type CarryOver, type Catalog, type ChangePasswordInput, type ChangeState, type ChironCategory, type ChironManifest, type ChironSkill, type ChironSkillFile, type ChironStage, type ClearMetaCacheOpts, type CliAuthorizationRejection, type CliAuthorizationSession, CliError, CliErrorCode, type CliErrorInit, type ClientAuthContext, type ClientCredentialsInput, type ConnectionMessage, type ControlChannelEnvelope, type ConversationListItem, type ConversationListResult, type ConversationState, type CreateResult, type CreatedConversation, type CredentialStoreMode, DATA_PACKAGE_FIXTURE_SCHEMA_V1, DATA_PACKAGE_MODELS, DEBT_PREFIX, DEBT_UNKNOWN, DEFAULT_AGENT_ID, DEFAULT_ARTIFACT_CATEGORY, DEFAULT_SESSION_TTL_SECONDS, PREMISE_CODES as DELIVERY_PREMISE_CODES, DEV_MODE_PATH, DIMENSION_LABELS, DRY_RUN_NOTE, DRY_RUN_TAIL, type DataPackageInstallRunView, type DataPackageInstallView, type Premise$1 as DeliveryPremise, type DeliveryRun, type DescribeOpts, type DeviceAuthorization, DriftDetected, EFFECT_ACCOUNTING_ONLY, EFFECT_READ_ONLY, EFFECT_UNKNOWN, EFFECT_WRITES, ENUM_SHOW, ENV_FILE, EXEMPTIBLE_CODES, EXEMPTION_CODES, EXEMPTION_REQUIRED_KEYS, EXTENSION_SOURCE_HEADER, type EndpointNormalization, type EnvConfig, type EnvSource, type EnvironmentSafety, ExitCode, FIND_LIMIT, MAX_BYTES as FIND_MAX_BYTES, FORCE_STALE_FLAG, FORCE_STALE_FLAG_TEXT, type FieldEnumValue, type FieldMeta, type Finding, type Fingerprint, type Fixture, type FormatOptions, GATE_COMPONENTS, type GlobalConfig, HANDSHAKE_AUTH_ERROR_HEADER, HANDSHAKE_CONVERSATION_QUERY_PARAM, HANDSHAKE_TOKEN_QUERY_PARAM, HCM_FIELD_RAW_KEYS, HCM_LANG_ENV, HcmClient, type HcmClientOpts, type HttpClientOptions, IMPERSONATION_ACTIVE_PATH, IMPERSONATION_START_PATH, IMPORT_PLAN_FILE, INIT_EXIT_CODES, type IdentityMeta, type ImportClient, type ImportOptions, type ImportPlan, type ImportResult, type InitExitName, type InstallAcceptedResult, type InstallArtifactResult, type InteractionAnswerPayload, type InteractionDecision, type InteractionOutcome, type InteractionRequest, type InteractionResolved, JIRA_BASE, JIRA_KEYCHAIN, JIRA_PROJECT, JIRA_TOKEN_FILE, JOURNAL_FILE, JOURNAL_STOP_KINDS, JOURNAL_STOP_UNKNOWN, type JiraAllowedValue, JiraClient, type JiraClientOptions, type JiraComment, type JiraFieldMeta, type JiraFields, JiraHttpError, type JiraIssue, type JiraIssueTypeMeta, type JiraNamed, JiraNonBmpContentError, type JiraProject, type JiraRemoteLink, type JiraStatusFlow, type JiraTokenLookup, type JiraTokenSource, type JiraTransition, type JiraTransitionField, type JiraUser, Journal, JournalError, KIT_CARRY_OVER_KEY, KIT_CRAWLED_AT_FILE, KIT_MATCHED_ON, type KeyResolution, LAYER_ACTIVE, LEASE_FILE, LEDGER_MISSING_WORD, LEDGER_ONLY_FLAG, type LastAssistantTarget, LayoutContainmentError, Lease, LeaseViolation, type LifecycleResult, type ListTenantMetaOpts, type LoginOutcome, MANIFEST_PATH, MAPPING_FILE, MAX_MANIFEST_PAGES, MAX_SOURCE_PROBES, META_CACHE_PATH, META_JOURNAL_FILE, META_PATH, META_SCHEMA_SOURCE_COMMIT, STEPS as META_VERIFY_STEPS, STEP_DIFF as META_VERIFY_STEP_DIFF, STEPS$1 as META_WRITE_STEPS, METHOD_REPO_DISPLAY, METHOD_REPO_SLUG, METHOD_REPO_URL, MINI_APP_RUNTIME_SDK_VERSION, MINI_CONTEXT_FILE, MINI_CONTEXT_KIND, MINI_CONTEXT_VERSION, MINI_PULL_MANIFEST_FILE, MINI_REMOTE_ROOT, MINI_STATE_DIR, MODELS_PATH, MODEL_META_PATH, MappingError, type MessageClass, type MessageCreatePayload, type MessageStreamHandle, type MetaClient, type MetaIssue, type MetaIssueSeverity, type StepResult as MetaStepResult, type MetaValidationResult, type MigrationSummary, type MiniFileSnapshot, type MiniInitArgs, type MiniLocalFile, type MiniLocalStatus, type MiniPreviewTarget, type MiniProjectContext, type MiniPullArgs, type MiniPullManifest, type MiniPullResult, type MiniPushArgs, type MiniPushConflict, type MiniPushOperation, type MiniPushPlanItem, type MiniPushResult, type MiniSmokeCheckArgs, type MiniSmokeFetch, type MiniSmokeFetchResponse, type MiniSmokeResult, type MiniSmokeTargetKind, type MiniSmokeTargetResult, type MiniStatusEntry, type MiniSurface, type MiniTemplateArgs, type MiniTemplateKind, type MiniValidationResult, type MiniVerifyAgentReport, type MiniVerifyBrowserAcceptance, type MiniVerifyChangedFile, type MiniVerifyNextAction, type MiniVerifyPlan, type MiniVerifyPreviewUrl, type MiniVerifyReport, type MiniVerifySummary, type MiniWritableTemplateConfig, type ModelDescription, type ModelEntry, type ModelQueryDsl, NETWORK_GATES, NEXT_STEP, NON_BMP_RULE_NOTE, NOT_COVERED_LAYER1, NOT_COVERED_LAYER2, NOT_COVERED_SELF, type NonBmpHit, OFFLINE_COMMANDS, ON_EXISTING, type OneShotOpts, type OneShotResult, type OneShotToolCall, type Outcome, type OutputFormat, PASSWORD_CHANGE_REQUIRED, PLAN_JSON_KEYS, PLAN_PROBLEM_CODES, PREMISES, PREMISE_CLIENT, PREMISE_IDENTITY, PREMISE_JOURNAL_HAS_ENTRIES, PREMISE_JOURNAL_ON_DISK, PREMISE_KEY_FIELDS, PREMISE_PLAN_READABLE, PREMISE_ROWS_TO_CHECK, PREMISE_UNMET, PREMISE_WORDS, PROACTIVE_REFRESH_MARGIN_SECONDS, PRODUCT_STATE_WORDS, type PackOptions, type PackResult, type PairingLoginInput, type ParsedPlaceholder, type ParsedRef, type PasswordChangeChallenge, type PasswordLoginInput, type PatLoginInput, type PendingInteraction, type PlanProblem, PlanReadError, type PlannedRow, type Principal, type ProfileConfig, type ProjectEnv, type ProjectEnvFile, type QueryResult, RC_DECIDING_FIELDS, RC_DECIDING_REPORT_FIELDS, REASON_BASELINE_ROUND_NOT_COMPLETE, VERDICTS$1 as RECONCILE_VERDICTS, RECOVERY_WORDS, REJECTED_BEFORE_ROUTING_CODE, REQUIRED_SECTIONS, RESPOND_TIMEOUT_MS, RESTORE_CODES, RISK_CODES, RISK_FILE, ROUND_ANCHORS, ROUND_EXIT_CODES, ROUND_STAMPED_PRODUCTS, ROUND_STATES, ROUND_SUBCOMMAND, ROUND_WARNINGS, ROUND_WARNING_FALLBACK, type ReconIdentity, ReconLayout, type ReconProbe, type ReconSummary, type Reconciliation, RefStore, type RefreshInput, type RelationMeta, type RemoveResult, type RepoRef, type ResolvedEnvContext, type ResolvedProjectEnvironment, type ResponseCompletedPayload, type ResponseFailedPayload, type ResponsePartDeltaPayload, type ResponseStartedPayload, RestoreFailed, type ResumeSummary, type ResumeTurn, type Risk, type RiskProblem, type RoundPremise, type RoundResult, type RoundState, type RowResult, type RowStatus, type RunMetaChangeArgs, SDK_VERSION, SERVER_ERROR_GRACE_MS, STATUSES, STEP_NOTHING, STEP_PROBE, STEP_REBIND, STEP_RECORD, STEP_STOP, STEP_UNBIND, SUPERSEDED_STATUS, SYNTH_FOOTNOTE, SYNTH_MARK, type SaveMetaResult, type ScriptDryRunRequest, type ScriptDryRunResult, type ScriptLogPage, type ScriptLogQuery, type ScriptManifestValidationResult, type ScriptTaskView, type SeedPathArgs, type SendMessageOpts, type ServerErrorFrame, type SessionPrincipal, type SettingItem, type SettingWrite, type StreamCancelPayload, type StreamCommand, type StreamCommandEnvelope, type StreamCommandType, type StreamEventEnvelope, type StreamEventType, TEMP_ENV_NAME, TENANT_META_FILE_PATH, CONFIG as TRIAGE_CONFIG, GAP as TRIAGE_GAP, VERDICTS as TRIAGE_VERDICTS, TargetModelNotFound, type TaskProgressPayload, type TenantMetaEntry, type TenantResetReceipt, type TimelineItemLite, type TokenRecord, TokenStore, type ToolCallFailedPayload, type ToolCallResultPayload, type ToolCallStartedPayload, type TriageEntry, type TriageProblem, type TriageProblemRow, type TriageRoundResult, type TriageVerdict, USER_LOOKUP_PATH, type UndeterminedReason, type V4RenderSink, type V4StreamEventType, VALUE_CELL_MISSING, VALUE_FOOTNOTE, VALUE_STATE_DISABLED, VALUE_STATE_FOOTNOTE, VALUE_STATE_UNKNOWN, VERDICTS$2 as VERDICTS, VERDICT_DIVERGED, VERDICT_INCOMPARABLE, VERDICT_SAME, VERDICT_WORDS, CODES as VERIFY_ACTIVE_CODES, VERIFY_CODES, VERIFY_CRASHED, VERIFY_OK, VERIFY_WORDS, VERSION_PATH, ValueHints, type ValuesResult, type VerifyResult, WAIVER_REPLAY, WARNED_ROUND_STATES, WORKSPACES_PATH, WORK_DIRNAME, WRITE_RECOVERY_WORDS, type WaitResult, WorkLayout, type WorkspaceFileContent, type WorkspaceFileItem, type WorkspaceFileListResult, WsClient, type WsClientOpts, absoluteDownloadUrl, acquireLease, adminResetPassword, applyPlan, applyRc, applyReportText, applyReportToJson, archiveDir, askedTheDatabase, assertDangerWrite, assertExpectedTenant, assertNotReservedEnvName, assertSafeReferencePath, assertSafeSkillFilePath, assertSafeSkillId, assertUsableEndpoint, baselineRoundPremise, bootstrapTenant, buildAnswer, buildCarrierResult, buildConfirm, buildDeliveryRun, buildHandshakeUrl, buildInterrupt, buildMiniAppTemplateFiles, buildMiniPreviewTargets, buildMiniVerifyAgentReport, buildReconciliation, buildReject, buildResumeSummary, buildSteer, camelizeKeys, changePassword, checkCoherence, classifyEffect, classifyMessage, classifyStatus, clearMetaCache, clearModelCache, cliAuthorizationExpired, commandsFor, compareFingerprint, computeFingerprint, computeReconSourceKey, contentHash, conversationStateFile, conversationWebSocketEndpoint, create, createConversation, createHttpClient, createJiraClient, createV4Reducer, createWorkspaceFile, credentialsFile, defaultDownloadDir, defaultMiniRequiredScopes, deleteDocument, deleteEnv, deleteIdentity, deleteTenantMeta, deleteWorkspaceFile, deliveryRunFields, deriveNamelessToolLabel, describeNonBmpHits, describePrincipal, describeWaiver, detectDelegationPause, detectDirectInteractionPending, detectPasswordChangeChallenge, diagnoseRejectedBeforeRouting, discardedColumnLines, discoverProjectEnv, displayWidth, downloadDocument, enforceDriftGate, ensureSessionFresh, envDir, envFile, envsDir, exchangeBrowserAuthorization, existingJournalStop, exitCodeFor, explainJacksonError, extractNextSteps, fetchConversationTimeline, fetchConversationTimelineStrict, fetchInstallRun, fetchRecentConversations, fetchReconIdentity, fetchSkillCatalog, fetchSkillFile, fetchSkillMarkdown, fetchSkillReference, fieldByName, filterByStage, find, findEnvByEndpoint, findLastAssistantSeq, findLastAssistantTarget, findNonBmpChars, firstLine, flattenSkills, formatMetaIssues, formatMiniVerifyReport, formatObject, formatRows, fromAxiosError, getCacheStats, getMiniStatus, getScriptTask, getSettingDomain, getTenantMeta, globalConfigFile, guessMimeType, handshakeRejectedError, hasPendingImpersonationSessions, hcmConfigDir, hitRank, httpProbe, identitiesDir, identityDir, identityKnown, identityMetaFile, inferMiniWritableTemplateOptionsFromModel, initMiniAppProject, inspectRound, installDataPackageArtifact, installDataPackageArtifactAsync, isDelegationToolName, isLocalName, isReadOnly, isServerSlidingSession, isSupersededItem, isTempEnv, isTerminalRunStatus, isZeroNetwork, jiraTokenHelp, jiraTokenSource, jiraTokenUnreadable, journalNote, judgeDrift, layerDetail, ledgerOnlySignpost, linkedRepoRefs, listEnvs, listIdentities, listModels, listPendingInteractions, listProfiles, listTenantMeta, listWorkspaceFiles, loadCatalog, loadConversationState, loadEnv, loadExemptions, loadGlobalConfig, loadIdentity, loadMapping, loadProfile, loadRecordedFingerprint, loadRows, loadWorkspaceFileContent, loginClientCredentials, loginPairing, loginPassword, loginPat, matchNote, matchSkills, matchedDimensions, metaFileUrl, metaKindFromPath, migrateLegacyProfiles, modelEntries, modelKeys, needsRefresh, newRoundId, nonBmpHitLines, normalizeAndAssertEndpoint, normalizeEndpoint, normalizeOrigin, normalizeReferences, notAsked, oneShot, packDataPackage, parseConfirmToolName, parseEnvYaml, parseFixture, parseInteractionRequest, parseInteractionResolved, parsePlaceholder, parseRef, parseSettingAssignment, parseSkillFrontmatter, parseSkillRequirements, patchSettingDomain, planFromArtifacts, planProblemLines, planRc, planSummaryLine, planVsBaselinePremise, pollDeviceAuthorization, printResolvedEnvironment, probeAll, probeConversationHandshake, probeDoctorEndpoint, probeDoctorLayer, probeExtensionSource, profileDir, profileFile, pullMiniAppProject, pushMiniAppProject, queryScriptLogs, readImportPlan, readMiniContext, readPullManifest, readSessionPrincipal, rebind, rebindPayload, refreshToken, releasePendingImpersonationSessions, remove, renameIdentity, renderEnvYaml, renderFind, renderRound, renderTriage, renderValues, replHistoryFile, repoIssueUrl, requestCliAuthorization, resetSettingItem, resetTenant, resolveActiveEnv, resolveActiveIdentity, resolveActiveProfile, resolveAllSkillsInstallOrder, resolveBaselineDir, resolveChironBase, resolveCredentialStoreMode, resolveEnvContext, resolveItemKeys, resolveProjectEnvironment, resolveRefs, resolveSkillInstallOrder, respondToInteraction, riskFromArtifacts, roundAge, roundWarning, runActiveVerify, runImport, runMetaChange, runMiniSmokeChecks, runRecon, runTriageRound, safeCliAuthorizationError, safeSegment, saveConversationState, saveEnv, saveGlobalConfig, saveIdentity, saveProfile, saveTenantMeta, saveWorkspaceFileContent, scriptDryRun, seedBaselines, seedMappingPath, seedWorkDir, sendMessageAndStream, shelfPartition, snakeToCamel, startImpersonation, tenantSegment, toAcceptLanguage, toJson, toOrigin, toPrincipal, toTable, toYaml, truncateDisplay, unbindPayload, update, uploadDocument, validateCliAuthorizationUrl, validateMetaContent, validateMiniProject, validateScriptManifest, valueState, valuesRoundCaveat, verifyAttention, verifyRc, verifyText, waitForInstallRun, watchBrowserAuthorization, workspaceLayer, writeChangeState, writeImportPlan, writeRisk };
package/dist/index.js CHANGED
@@ -2004,7 +2004,42 @@ function resolveRefs(record, store) {
2004
2004
 
2005
2005
  // src/import/parse.ts
2006
2006
  import yaml6, { JSON_SCHEMA } from "js-yaml";
2007
- var REQUIRED = ["model", "key_field", "count", "items"];
2007
+
2008
+ // src/import/schema.ts
2009
+ var DATA_PACKAGE_FIXTURE_SCHEMA_V1 = {
2010
+ $schema: "https://json-schema.org/draft/2020-12/schema",
2011
+ $id: "urn:hcmai:data-package-fixture:v1",
2012
+ title: "DataPackage fixture v1",
2013
+ type: "object",
2014
+ required: ["model", "count", "items"],
2015
+ $defs: { nonEmptyString: { type: "string", pattern: "\\S" } },
2016
+ properties: {
2017
+ model: { $ref: "#/$defs/nonEmptyString" },
2018
+ key_field: {
2019
+ $ref: "#/$defs/nonEmptyString",
2020
+ description: "key_field \u58F0\u660E\u5355\u4E00\u771F\u5B9E\u4E1A\u52A1\u952E\uFF0C\u4F8B\u5982 key_field: code\uFF1Bhcm import v1 \u4E0D\u652F\u6301\u590D\u5408\u4E1A\u52A1\u952E\u3002"
2021
+ },
2022
+ key: {
2023
+ type: "array",
2024
+ minItems: 1,
2025
+ maxItems: 1,
2026
+ items: { $ref: "#/$defs/nonEmptyString" },
2027
+ deprecated: true,
2028
+ description: "\u65E7 key: [code] \u4EC5\u517C\u5BB9\u5355\u5143\u7D20\u6570\u7EC4\uFF0C\u8BFB\u53D6\u65F6\u7ED9\u51FA\u5F03\u7528\u544A\u8B66\uFF1B\u8BF7\u8FC1\u79FB\u5230 key_field: code\u3002"
2029
+ },
2030
+ count: { type: "integer", minimum: 0 },
2031
+ items: { type: "array", items: { type: "object" } }
2032
+ },
2033
+ oneOf: [
2034
+ { required: ["key_field"], not: { required: ["key"] } },
2035
+ { required: ["key"], not: { required: ["key_field"] } }
2036
+ ],
2037
+ additionalProperties: true,
2038
+ examples: [{ model: "OrgUnit", key_field: "code", count: 1, items: [{ code: "org-sales", name: "\u9500\u552E\u90E8" }] }]
2039
+ };
2040
+
2041
+ // src/import/parse.ts
2042
+ var nonEmptyString = (value) => typeof value === "string" && new RegExp(DATA_PACKAGE_FIXTURE_SCHEMA_V1.$defs.nonEmptyString.pattern).test(value);
2008
2043
  function parseFixture(yamlText, sourcePath) {
2009
2044
  const where = sourcePath ? ` (${sourcePath})` : "";
2010
2045
  const fail2 = (message) => {
@@ -2020,23 +2055,49 @@ function parseFixture(yamlText, sourcePath) {
2020
2055
  return fail2("fixture \u4E3A\u7A7A\u6216\u4E0D\u662F mapping");
2021
2056
  }
2022
2057
  const doc = parsed;
2023
- for (const f of REQUIRED) {
2058
+ for (const f of DATA_PACKAGE_FIXTURE_SCHEMA_V1.required) {
2024
2059
  if (doc[f] === void 0) return fail2(`fixture \u7F3A\u5FC5\u9700\u5B57\u6BB5 "${f}"`);
2025
2060
  }
2061
+ if (!nonEmptyString(doc.model)) return fail2('"model" \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32');
2026
2062
  if (!Array.isArray(doc.items)) return fail2('"items" \u5FC5\u987B\u662F list');
2027
2063
  if (!Number.isInteger(doc.count)) return fail2('"count" \u5FC5\u987B\u662F\u6574\u6570');
2064
+ if (doc.count < DATA_PACKAGE_FIXTURE_SCHEMA_V1.properties.count.minimum) return fail2('"count" \u4E0D\u80FD\u5C0F\u4E8E 0');
2028
2065
  if (doc.items.length !== doc.count) {
2029
2066
  return fail2(`count mismatch: count=${doc.count} \u4F46 items \u6709 ${doc.items.length}`);
2030
2067
  }
2031
- const keyField = doc.key_field;
2068
+ const hasKeyField = Object.hasOwn(doc, "key_field");
2069
+ const hasLegacyKey = Object.hasOwn(doc, "key");
2070
+ if (hasKeyField && hasLegacyKey) return fail2("\u4E0D\u80FD\u540C\u65F6\u58F0\u660E key_field \u4E0E key\uFF1B\u8BF7\u53EA\u4FDD\u7559 key_field");
2071
+ if (!hasKeyField && !hasLegacyKey) return fail2('fixture \u7F3A\u5FC5\u9700\u5B57\u6BB5 "key_field"\uFF1B\u4F8B\u5982 key_field: code');
2072
+ let keyField;
2073
+ const warnings = [];
2074
+ if (hasLegacyKey) {
2075
+ const keys = doc.key;
2076
+ if (Array.isArray(keys) && keys.length > DATA_PACKAGE_FIXTURE_SCHEMA_V1.properties.key.maxItems) {
2077
+ return fail2("hcm import v1 \u4E0D\u652F\u6301\u590D\u5408\u4E1A\u52A1\u952E\uFF1B\u8BF7\u58F0\u660E\u5355\u4E00\u771F\u5B9E\u552F\u4E00\u7684 key_field\uFF0C\u6216\u5728\u5B8C\u6574 DataPackage manifest \u4E2D\u58F0\u660E models[].keys \u5E76\u8D70 hcm datapackage install");
2078
+ }
2079
+ if (!Array.isArray(keys) || keys.length !== DATA_PACKAGE_FIXTURE_SCHEMA_V1.properties.key.minItems || !nonEmptyString(keys[0])) {
2080
+ return fail2('"key" \u5FC5\u987B\u662F\u5355\u5143\u7D20\u6570\u7EC4\uFF0C\u5143\u7D20\u987B\u4E3A\u975E\u7A7A\u5B57\u7B26\u4E32\uFF1B\u8BF7\u4F7F\u7528 key_field: code');
2081
+ }
2082
+ keyField = keys[0];
2083
+ warnings.push(`key \u5DF2\u5F03\u7528\uFF1B\u8BF7\u6539\u4E3A key_field: ${keyField}\uFF08\u5DF2\u6309\u5355\u4E00\u4E1A\u52A1\u952E\u517C\u5BB9\u8BFB\u53D6\uFF09${where}`);
2084
+ } else {
2085
+ if (!nonEmptyString(doc.key_field)) return fail2('"key_field" \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u6BB5\u540D\u5B57\u7B26\u4E32');
2086
+ keyField = doc.key_field;
2087
+ }
2032
2088
  const seen = /* @__PURE__ */ new Set();
2033
- for (const item of doc.items) {
2089
+ for (const [index, item] of doc.items.entries()) {
2090
+ if (!item || typeof item !== "object" || Array.isArray(item)) return fail2(`items[${index}] \u5FC5\u987B\u662F mapping`);
2034
2091
  const k = item[keyField];
2035
- if (k === void 0 || k === null || k === "") return fail2(`item \u7F3A key_field "${keyField}"`);
2092
+ if (!Object.hasOwn(item, keyField) || k === void 0 || k === null || k === "") return fail2(`item \u7F3A key_field "${keyField}"`);
2036
2093
  if (seen.has(String(k))) return fail2(`duplicate key "${k}" in ${String(doc.model)}`);
2037
2094
  seen.add(String(k));
2038
2095
  }
2039
- return { ...doc, sourcePath };
2096
+ const fixture = { ...doc, key_field: keyField, sourcePath };
2097
+ delete fixture.key;
2098
+ delete fixture.warnings;
2099
+ if (warnings.length > 0) fixture.warnings = warnings;
2100
+ return fixture;
2040
2101
  }
2041
2102
 
2042
2103
  // src/import/runner.ts
@@ -2046,6 +2107,7 @@ async function runImport(client, fixtures, opts = {}) {
2046
2107
  const rows = [];
2047
2108
  const tally = { created: 0, updated: 0, skipped: 0, failed: 0 };
2048
2109
  const refsFromTarget = [];
2110
+ const warnings = fixtures.flatMap((fixture) => fixture.warnings ?? []);
2049
2111
  const knownKeysOf = /* @__PURE__ */ new Map();
2050
2112
  const fieldNamesUnverified = [];
2051
2113
  const result = () => ({
@@ -2053,6 +2115,7 @@ async function runImport(client, fixtures, opts = {}) {
2053
2115
  rows,
2054
2116
  refs: store.snapshot(),
2055
2117
  refsFromTarget: [...refsFromTarget],
2118
+ ...warnings.length > 0 ? { warnings: [...warnings] } : {},
2056
2119
  fieldNamesUnverified: [...fieldNamesUnverified]
2057
2120
  });
2058
2121
  const knownKeysFor = async (model) => {
@@ -13701,6 +13764,40 @@ function walk2(root, schema, value, segs, kind, issues, depth) {
13701
13764
  }
13702
13765
  }
13703
13766
  }
13767
+ function validateScriptActionNames(doc, issues) {
13768
+ if (!doc || typeof doc !== "object" || !Array.isArray(doc.actions))
13769
+ return;
13770
+ const reserved = /* @__PURE__ */ new Set(["list", "get", "create", "update", "delete"]);
13771
+ const visited = /* @__PURE__ */ new Set();
13772
+ const visit = (raw, path24) => {
13773
+ if (!raw || typeof raw !== "object" || Array.isArray(raw) || visited.has(raw)) return;
13774
+ visited.add(raw);
13775
+ const action3 = raw;
13776
+ const type = typeof action3.type === "string" ? action3.type.toLowerCase() : action3.type;
13777
+ if (type === "script" && typeof action3.key === "string" && reserved.has(action3.key.trim().toLowerCase())) {
13778
+ issues.push({
13779
+ severity: "error",
13780
+ path: `${path24}.key`,
13781
+ message: `E_SCRIPT_ACTION_RESERVED_KEY: \u811A\u672C Action key '${action3.key}' \u4E0E CRUD \u4FDD\u7559\u540D\u51B2\u7A81\uFF08list/get/create/update/delete\uFF09`,
13782
+ hint: "\u6539\u7528\u4E1A\u52A1\u8BED\u4E49 key\uFF08\u5982 createBusinessRequest\uFF09\uFF0C\u5E76\u663E\u5F0F\u6388\u6743 action:<key>\uFF1BCRUD \u6743\u9650\u4E0E\u81EA\u5B9A\u4E49 Action \u6743\u9650\u72EC\u7ACB"
13783
+ });
13784
+ }
13785
+ if (type != null && type !== "composite") return;
13786
+ const composite = action3.composite;
13787
+ if (!composite || typeof composite !== "object") return;
13788
+ const steps = composite.steps;
13789
+ if (!Array.isArray(steps)) return;
13790
+ steps.forEach((step, index) => {
13791
+ const stepPath = `${path24}.composite.steps[${index}]`;
13792
+ visit(step, stepPath);
13793
+ if (step && typeof step === "object" && !Object.hasOwn(step, "type")) {
13794
+ visit(step.action, `${stepPath}.action`);
13795
+ }
13796
+ });
13797
+ };
13798
+ const actions = doc.actions;
13799
+ actions.forEach((action3, index) => visit(action3, `actions[${index}]`));
13800
+ }
13704
13801
  function validateMetaContent(metaPath2, content) {
13705
13802
  const issues = [];
13706
13803
  const kind = metaKindFromPath(metaPath2);
@@ -13751,6 +13848,7 @@ function validateMetaContent(metaPath2, content) {
13751
13848
  });
13752
13849
  return mk();
13753
13850
  }
13851
+ validateScriptActionNames(doc, issues);
13754
13852
  walk2(schema, schema, doc, [], kind, issues, 0);
13755
13853
  const rawLines = content.split("\n");
13756
13854
  for (const issue of issues) {
@@ -25796,6 +25894,7 @@ export {
25796
25894
  CREDENTIAL_STORE_MODES,
25797
25895
  CliError,
25798
25896
  CliErrorCode,
25897
+ DATA_PACKAGE_FIXTURE_SCHEMA_V1,
25799
25898
  DATA_PACKAGE_MODELS,
25800
25899
  DEBT_PREFIX,
25801
25900
  DEBT_UNKNOWN,