@hcmai/sdk 0.26.0 → 0.26.3

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/dist/index.d.ts CHANGED
@@ -2786,6 +2786,7 @@ declare function validateWorkspaceFiles(http: AxiosInstance, workspaceKey: strin
2786
2786
  content: string;
2787
2787
  }[], deletedPaths?: string[]): Promise<WorkspacePreflightResult>;
2788
2788
  declare function deleteWorkspaceFile(http: AxiosInstance, fileId: string): Promise<void>;
2789
+ declare function isWorkspaceRelativePath(value: unknown): value is string;
2789
2790
 
2790
2791
  interface MiniInitArgs {
2791
2792
  appCode: string;
@@ -2889,6 +2890,41 @@ declare function inferMiniWritableTemplateOptionsFromModel(description: ModelDes
2889
2890
  todayDefaultFields: string[];
2890
2891
  };
2891
2892
 
2893
+ declare const WORKSPACE_DELIVERY_PROTOCOL = 1;
2894
+ interface WorkspaceInspection {
2895
+ protocolVersion: 1;
2896
+ workspaceKey: string;
2897
+ complete: true;
2898
+ totalFiles: number;
2899
+ totalBytes: number;
2900
+ maxFilesPerRequest: number;
2901
+ capabilities: Record<string, unknown>;
2902
+ entries?: Array<WorkspaceFileItem & {
2903
+ protected?: boolean;
2904
+ }>;
2905
+ hashes?: Array<{
2906
+ relativePath: string;
2907
+ exists: boolean;
2908
+ contentHash?: string;
2909
+ }>;
2910
+ [key: string]: unknown;
2911
+ }
2912
+ declare function workspaceDeliveryError(reason: string, message: string): CliError;
2913
+ declare function workspaceActionPayload(value: unknown): Record<string, unknown>;
2914
+ declare function workspaceObjectActionBase(http: AxiosInstance, workspaceKey: string): Promise<string>;
2915
+ declare function inspectWorkspaceFiles(http: AxiosInstance, workspaceKey: string, options: {
2916
+ includeEntries: boolean;
2917
+ hashPaths: string[];
2918
+ }): Promise<WorkspaceInspection>;
2919
+ declare function readWorkspaceInspection(result: Record<string, unknown>, workspaceKey: string, options: {
2920
+ includeEntries: boolean;
2921
+ hashPaths: string[];
2922
+ }): WorkspaceInspection;
2923
+ declare function saveWorkspaceFileContentChecked(http: AxiosInstance, fileId: string, content: string, expectedContentHash: string): Promise<WorkspaceFileItem>;
2924
+ declare function deleteWorkspaceFileChecked(http: AxiosInstance, fileId: string, expectedContentHash: string): Promise<Record<string, unknown>>;
2925
+ declare function isSha256(value: unknown): value is string;
2926
+ declare function nonnegativeInteger(value: unknown): value is number;
2927
+
2892
2928
  /**
2893
2929
  * DataPackage 单文件制品打包(ADR-323 能力 B,`hcm datapackage pack`)。
2894
2930
  *
@@ -7086,4 +7122,4 @@ type ParsedRef = {
7086
7122
  declare function parseRef(raw: string, project: string, casesSlug?: string): ParsedRef | null;
7087
7123
  declare const firstLine: (s: string) => string;
7088
7124
 
7089
- 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, COLUMN_SLOT_REBIND_SQL_KEYS, COLUMN_SLOT_SQL_KEYS, 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 ColumnSlotAvailability, type ColumnSlotRef, type ColumnSlotRequestOpts, type ColumnSlotSqlKey, type ColumnSlotSqlParams, type ColumnSlotSqlView, type ColumnSlotsView, 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, type JiraHistory, 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_RUNTIME_SDK_VERSION as MINI_APP_RUNTIME_SDK_VERSION, MINI_CONTEXT_FILE, MINI_CONTEXT_KIND, MINI_CONTEXT_VERSION, MINI_PULL_MANIFEST_FILE, MINI_REMOTE_ROOT, MINI_RUNTIME_SDK_VERSION, 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 MiniVerifyPreflight, 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 OccupiedColumnSlot, 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 TenantReconcileReceipt, 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, WORKSPACE_KEY_HEADER, WORK_DIRNAME, WRITE_RECOVERY_WORDS, type WaitResult, WorkLayout, type WorkspaceFileContent, type WorkspaceFileItem, type WorkspaceFileListResult, type WorkspacePreflightIssue, type WorkspacePreflightResult, 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, collectMiniPushWrites, 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, getColumnSlotSql, getColumnSlots, 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, reconcileTenant, 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, validateWorkspaceFiles, valueState, valuesRoundCaveat, verifyAttention, verifyRc, verifyText, waitForInstallRun, watchBrowserAuthorization, workspaceLayer, writeChangeState, writeImportPlan, writeRisk };
7125
+ 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, COLUMN_SLOT_REBIND_SQL_KEYS, COLUMN_SLOT_SQL_KEYS, 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 ColumnSlotAvailability, type ColumnSlotRef, type ColumnSlotRequestOpts, type ColumnSlotSqlKey, type ColumnSlotSqlParams, type ColumnSlotSqlView, type ColumnSlotsView, 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, type JiraHistory, 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_RUNTIME_SDK_VERSION as MINI_APP_RUNTIME_SDK_VERSION, MINI_CONTEXT_FILE, MINI_CONTEXT_KIND, MINI_CONTEXT_VERSION, MINI_PULL_MANIFEST_FILE, MINI_REMOTE_ROOT, MINI_RUNTIME_SDK_VERSION, 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 MiniVerifyPreflight, 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 OccupiedColumnSlot, 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 TenantReconcileReceipt, 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, WORKSPACE_DELIVERY_PROTOCOL, WORKSPACE_KEY_HEADER, WORK_DIRNAME, WRITE_RECOVERY_WORDS, type WaitResult, WorkLayout, type WorkspaceFileContent, type WorkspaceFileItem, type WorkspaceFileListResult, type WorkspaceInspection, type WorkspacePreflightIssue, type WorkspacePreflightResult, 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, collectMiniPushWrites, commandsFor, compareFingerprint, computeFingerprint, computeReconSourceKey, contentHash, conversationStateFile, conversationWebSocketEndpoint, create, createConversation, createHttpClient, createJiraClient, createV4Reducer, createWorkspaceFile, credentialsFile, defaultDownloadDir, defaultMiniRequiredScopes, deleteDocument, deleteEnv, deleteIdentity, deleteTenantMeta, deleteWorkspaceFile, deleteWorkspaceFileChecked, 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, getColumnSlotSql, getColumnSlots, getMiniStatus, getScriptTask, getSettingDomain, getTenantMeta, globalConfigFile, guessMimeType, handshakeRejectedError, hasPendingImpersonationSessions, hcmConfigDir, hitRank, httpProbe, identitiesDir, identityDir, identityKnown, identityMetaFile, inferMiniWritableTemplateOptionsFromModel, initMiniAppProject, inspectRound, inspectWorkspaceFiles, installDataPackageArtifact, installDataPackageArtifactAsync, isDelegationToolName, isLocalName, isReadOnly, isServerSlidingSession, isSha256, isSupersededItem, isTempEnv, isTerminalRunStatus, isWorkspaceRelativePath, 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, nonnegativeInteger, 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, readWorkspaceInspection, rebind, rebindPayload, reconcileTenant, 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, saveWorkspaceFileContentChecked, scriptDryRun, seedBaselines, seedMappingPath, seedWorkDir, sendMessageAndStream, shelfPartition, snakeToCamel, startImpersonation, tenantSegment, toAcceptLanguage, toJson, toOrigin, toPrincipal, toTable, toYaml, truncateDisplay, unbindPayload, update, uploadDocument, validateCliAuthorizationUrl, validateMetaContent, validateMiniProject, validateScriptManifest, validateWorkspaceFiles, valueState, valuesRoundCaveat, verifyAttention, verifyRc, verifyText, waitForInstallRun, watchBrowserAuthorization, workspaceActionPayload, workspaceDeliveryError, workspaceLayer, workspaceObjectActionBase, writeChangeState, writeImportPlan, writeRisk };
package/dist/index.js CHANGED
@@ -4552,8 +4552,31 @@ async function listWorkspaceFiles(http, workspaceKey, options = {}) {
4552
4552
  }
4553
4553
  });
4554
4554
  }
4555
+ const data = content.map(toWorkspaceFileItem);
4556
+ if (total !== data.length || new Set(data.map((file) => file.relativePath)).size !== data.length || new Set(data.map((file) => file.id)).size !== data.length) {
4557
+ throw new CliError({
4558
+ code: "NETWORK_ERROR" /* NETWORK_ERROR */,
4559
+ message: `\u5DE5\u4F5C\u533A\u6587\u4EF6\u6E05\u5355\u4E0D\u5B8C\u6574\uFF1A\u6536\u5230 ${data.length} \u6761\uFF0C\u603B\u6570 ${total}\uFF1B\u672A\u6267\u884C\u5199\u5165\u6216\u91CD\u5EFA\u540C\u6B65\u57FA\u7EBF\u3002`,
4560
+ context: {
4561
+ reason: "INCOMPLETE_WORKSPACE_FILE_LIST",
4562
+ workspaceKey,
4563
+ nextStep: "\u5F53\u524D mini \u540C\u6B65\u4E0D\u652F\u6301\u5B8C\u6574\u5206\u9875\uFF1B\u7F29\u5C0F\u5DE5\u4F5C\u533A\u6216\u5347\u7EA7\u5177\u5907\u5B8C\u6574\u6E05\u5355\u80FD\u529B\u7684\u670D\u52A1\u4E0E CLI \u540E\u91CD\u8BD5\u3002\u4FDD\u7559\u672C\u5730\u76EE\u5F55\u548C\u57FA\u7EBF\u3002"
4564
+ }
4565
+ });
4566
+ }
4567
+ if (data.some((file) => !file.id.trim() || file.workspaceKey !== workspaceKey || !isWorkspaceRelativePath(file.relativePath))) {
4568
+ throw new CliError({
4569
+ code: "NETWORK_ERROR" /* NETWORK_ERROR */,
4570
+ message: "\u5DE5\u4F5C\u533A\u6587\u4EF6\u6E05\u5355\u5305\u542B\u65E0\u6548 ID\u3001\u5F52\u5C5E\u6216\u8DEF\u5F84\uFF1B\u4E0D\u80FD\u636E\u6B64\u5224\u5B9A\u6587\u4EF6\u4E0D\u5B58\u5728\u3002",
4571
+ context: {
4572
+ reason: "INVALID_WORKSPACE_FILE_LIST",
4573
+ workspaceKey,
4574
+ nextStep: "\u6838\u5BF9\u670D\u52A1\u7AEF\u5B8C\u6574\u6E05\u5355\u53CA\u6743\u9650\u540E\u91CD\u8BD5\uFF1B\u4FDD\u7559\u672C\u5730\u76EE\u5F55\u548C\u57FA\u7EBF\u3002"
4575
+ }
4576
+ });
4577
+ }
4555
4578
  return {
4556
- data: content.map(toWorkspaceFileItem),
4579
+ data,
4557
4580
  total
4558
4581
  };
4559
4582
  }
@@ -4598,7 +4621,7 @@ function toWorkspaceFileItem(value) {
4598
4621
  workspaceKey: stringOr(obj.workspaceKey),
4599
4622
  relativePath: stringOr(obj.relativePath),
4600
4623
  fileType: stringOrUndefined(obj.fileType),
4601
- fileSize: numberOr(obj.fileSize, 0),
4624
+ fileSize: typeof obj.fileSize === "number" && Number.isFinite(obj.fileSize) ? obj.fileSize : void 0,
4602
4625
  content: typeof obj.content === "string" ? obj.content : void 0,
4603
4626
  lastModified: primitiveOrNull(obj.lastModified)
4604
4627
  };
@@ -4661,8 +4684,9 @@ function stringOr(value) {
4661
4684
  function stringOrUndefined(value) {
4662
4685
  return value == null ? void 0 : stringOr(value);
4663
4686
  }
4664
- function numberOr(value, fallback) {
4665
- return typeof value === "number" && Number.isFinite(value) ? value : fallback;
4687
+ function isWorkspaceRelativePath(value) {
4688
+ if (typeof value !== "string" || !value || value.startsWith("/") || value.includes("\\") || value.includes("\0")) return false;
4689
+ return value.replace(/\/$/, "").split("/").every((segment) => !!segment && segment !== "." && segment !== "..");
4666
4690
  }
4667
4691
  function primitiveOrNull(value) {
4668
4692
  if (typeof value === "number" || typeof value === "string") return value;
@@ -7224,6 +7248,94 @@ function toPosix(value) {
7224
7248
  return value.replace(/\\/g, "/");
7225
7249
  }
7226
7250
 
7251
+ // src/mini/workspace-delivery.ts
7252
+ var WORKSPACE_DELIVERY_PROTOCOL = 1;
7253
+ var WORKSPACE = "/api/models/TenantExtensionWorkspace";
7254
+ var FILE = "/api/models/TenantExtensionWorkspaceFile";
7255
+ function workspaceDeliveryError(reason, message) {
7256
+ return new CliError({
7257
+ code: "NETWORK_ERROR" /* NETWORK_ERROR */,
7258
+ message,
7259
+ context: { reason, nextStep: "\u5347\u7EA7 Core \u81F3 workspace delivery \u534F\u8BAE 1\uFF0C\u6838\u5BF9\u670D\u52A1\u7AEF\u56DE\u6267\u540E\u91CD\u65B0\u9884\u68C0\uFF1B\u672C\u6B21\u4E0D\u964D\u7EA7\u4E3A\u65E0\u6761\u4EF6\u5199\u5165\uFF0C\u4FDD\u7559\u672C\u5730\u76EE\u5F55\u4E0E\u57FA\u7EBF\u3002" }
7260
+ });
7261
+ }
7262
+ function workspaceActionPayload(value) {
7263
+ const raw = value && typeof value === "object" ? value : {};
7264
+ const data = "data" in raw ? raw.data : raw;
7265
+ if (!data || typeof data !== "object" || Array.isArray(data)) {
7266
+ throw workspaceDeliveryError("INVALID_WORKSPACE_DELIVERY_RECEIPT", "\u5DE5\u4F5C\u533A\u64CD\u4F5C\u672A\u8FD4\u56DE\u6709\u6548\u56DE\u6267\uFF1B\u7ED3\u679C\u672A\u77E5\u3002");
7267
+ }
7268
+ return data;
7269
+ }
7270
+ async function workspaceObjectActionBase(http, workspaceKey) {
7271
+ const response = await http.get(WORKSPACE, { params: {
7272
+ filter: `workspaceKey:eq:${workspaceKey}`,
7273
+ page: 0,
7274
+ size: 2,
7275
+ fields: "id,workspaceKey"
7276
+ } });
7277
+ const rows = response.data?.content;
7278
+ if (!Array.isArray(rows) || response.data?.totalElements !== 1 || rows.length !== 1 || rows[0]?.workspaceKey !== workspaceKey || typeof rows[0]?.id !== "string" || !rows[0].id.trim()) {
7279
+ throw workspaceDeliveryError("INVALID_WORKSPACE_IDENTITY", `\u5F53\u524D\u79DF\u6237\u672A\u552F\u4E00\u786E\u8BA4\u5F00\u53D1\u7A7A\u95F4 ${workspaceKey}\uFF1B\u6CA1\u6709\u6267\u884C\u53D8\u66F4\u3002`);
7280
+ }
7281
+ return `${WORKSPACE}/${encodeURIComponent(rows[0].id)}/action`;
7282
+ }
7283
+ async function inspectWorkspaceFiles(http, workspaceKey, options) {
7284
+ const action3 = await workspaceObjectActionBase(http, workspaceKey);
7285
+ const response = await http.post(`${action3}/inspect-files`, { form: options });
7286
+ return readWorkspaceInspection(workspaceActionPayload(response.data), workspaceKey, options);
7287
+ }
7288
+ function readWorkspaceInspection(result, workspaceKey, options) {
7289
+ const capabilities = result.capabilities;
7290
+ if (result.protocolVersion !== 1 || result.workspaceKey !== workspaceKey || result.complete !== true || !nonnegativeInteger(result.totalFiles) || !nonnegativeInteger(result.totalBytes) || !nonnegativeInteger(result.maxFilesPerRequest) || result.maxFilesPerRequest === 0 || !capabilities || typeof capabilities !== "object" || Array.isArray(capabilities)) {
7291
+ throw workspaceDeliveryError("INVALID_WORKSPACE_INSPECTION", "inspect-files \u7F3A\u5C11\u534F\u8BAE\u3001\u5B8C\u6574\u6027\u3001\u89C4\u6A21\u6216\u80FD\u529B\u56DE\u6267\uFF1B\u4E0D\u80FD\u5C06\u672A\u77E5\u5F53\u4F5C\u7A7A\u7A7A\u95F4\u3002");
7292
+ }
7293
+ if (options.includeEntries) {
7294
+ const entries = result.entries;
7295
+ if (!Array.isArray(entries) || entries.length !== result.totalFiles || entries.length > Number(result.maxFilesPerRequest) || new Set(entries.map((item) => item?.relativePath)).size !== entries.length || new Set(entries.map((item) => item?.id)).size !== entries.length) {
7296
+ throw workspaceDeliveryError("INCOMPLETE_WORKSPACE_FILE_LIST", "inspect-files \u6E05\u5355\u7F3A\u5931\u3001\u622A\u65AD\u6216\u91CD\u590D\uFF1B\u672A\u6267\u884C\u53D8\u66F4\u3002");
7297
+ }
7298
+ if (entries.some((item) => !item || typeof item.id !== "string" || !item.id.trim() || item.workspaceKey !== workspaceKey || !isWorkspaceRelativePath(item.relativePath) || !nonnegativeInteger(item.fileSize))) {
7299
+ throw workspaceDeliveryError("INVALID_WORKSPACE_INSPECTION", "inspect-files \u6E05\u5355\u542B\u65E0\u6548\u5F52\u5C5E\u3001\u8DEF\u5F84\u3001ID \u6216\u5B57\u8282\u6570\u3002");
7300
+ }
7301
+ if (entries.reduce((total, item) => total + item.fileSize, 0) !== result.totalBytes) {
7302
+ throw workspaceDeliveryError("INVALID_WORKSPACE_INSPECTION", "inspect-files \u9010\u9879\u5B57\u8282\u6570\u4E0E\u603B\u5B57\u8282\u6570\u4E0D\u7B26\u3002");
7303
+ }
7304
+ }
7305
+ if (capabilities.contentHashes === true) {
7306
+ const hashes = result.hashes;
7307
+ const requested = new Set(options.hashPaths);
7308
+ if (!Array.isArray(hashes) || hashes.length !== requested.size || new Set(hashes.map((item) => item?.relativePath)).size !== hashes.length || hashes.some((item) => !item || !requested.has(item.relativePath) || typeof item.exists !== "boolean" || item.exists && !isSha256(item.contentHash) || !item.exists && item.contentHash != null)) {
7309
+ throw workspaceDeliveryError("INVALID_WORKSPACE_INSPECTION", "inspect-files \u5019\u9009\u54C8\u5E0C\u56DE\u6267\u672A\u5B8C\u6574\u8986\u76D6\u8BF7\u6C42\u8DEF\u5F84\uFF1B\u4E0D\u80FD\u63A8\u65AD\u8FDC\u7AEF\u5185\u5BB9\u3002");
7310
+ }
7311
+ if (options.includeEntries) {
7312
+ const present = new Set(result.entries.map((item) => item.relativePath));
7313
+ if (hashes.some((item) => item.exists !== present.has(item.relativePath))) {
7314
+ throw workspaceDeliveryError("INVALID_WORKSPACE_INSPECTION", "inspect-files \u5019\u9009\u5B58\u5728\u6027\u4E0E\u5B8C\u6574\u6E05\u5355\u4E0D\u4E00\u81F4\u3002");
7315
+ }
7316
+ }
7317
+ }
7318
+ return result;
7319
+ }
7320
+ async function saveWorkspaceFileContentChecked(http, fileId, content, expectedContentHash) {
7321
+ const response = await http.post(`${FILE}/${encodeURIComponent(fileId)}/action/save-content-checked`, {
7322
+ form: { content, expectedContentHash }
7323
+ }, { __skipRetry: true });
7324
+ return workspaceActionPayload(response.data);
7325
+ }
7326
+ async function deleteWorkspaceFileChecked(http, fileId, expectedContentHash) {
7327
+ const response = await http.post(`${FILE}/${encodeURIComponent(fileId)}/action/delete-checked`, {
7328
+ form: { expectedContentHash }
7329
+ }, { __skipRetry: true });
7330
+ return workspaceActionPayload(response.data);
7331
+ }
7332
+ function isSha256(value) {
7333
+ return typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
7334
+ }
7335
+ function nonnegativeInteger(value) {
7336
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
7337
+ }
7338
+
7227
7339
  // src/datapackage/pack.ts
7228
7340
  import * as fsp2 from "fs/promises";
7229
7341
  import * as fs11 from "fs";
@@ -26912,6 +27024,7 @@ export {
26912
27024
  WAIVER_REPLAY,
26913
27025
  WARNED_ROUND_STATES,
26914
27026
  WORKSPACES_PATH,
27027
+ WORKSPACE_DELIVERY_PROTOCOL,
26915
27028
  WORKSPACE_KEY_HEADER,
26916
27029
  WORK_DIRNAME,
26917
27030
  WRITE_RECOVERY_WORDS,
@@ -26979,6 +27092,7 @@ export {
26979
27092
  deleteIdentity,
26980
27093
  deleteTenantMeta,
26981
27094
  deleteWorkspaceFile,
27095
+ deleteWorkspaceFileChecked,
26982
27096
  deliveryRunFields,
26983
27097
  deriveNamelessToolLabel,
26984
27098
  describeNonBmpHits,
@@ -27046,15 +27160,18 @@ export {
27046
27160
  inferMiniWritableTemplateOptionsFromModel,
27047
27161
  initMiniAppProject,
27048
27162
  inspectRound,
27163
+ inspectWorkspaceFiles,
27049
27164
  installDataPackageArtifact,
27050
27165
  installDataPackageArtifactAsync,
27051
27166
  isDelegationToolName,
27052
27167
  isLocalName,
27053
27168
  isReadOnly,
27054
27169
  isServerSlidingSession,
27170
+ isSha256,
27055
27171
  isSupersededItem,
27056
27172
  isTempEnv,
27057
27173
  isTerminalRunStatus,
27174
+ isWorkspaceRelativePath,
27058
27175
  isZeroNetwork,
27059
27176
  jiraTokenHelp,
27060
27177
  jiraTokenSource,
@@ -27097,6 +27214,7 @@ export {
27097
27214
  needsRefresh,
27098
27215
  newRoundId,
27099
27216
  nonBmpHitLines,
27217
+ nonnegativeInteger,
27100
27218
  normalizeAndAssertEndpoint,
27101
27219
  normalizeEndpoint,
27102
27220
  normalizeOrigin,
@@ -27136,6 +27254,7 @@ export {
27136
27254
  readMiniContext,
27137
27255
  readPullManifest,
27138
27256
  readSessionPrincipal,
27257
+ readWorkspaceInspection,
27139
27258
  rebind,
27140
27259
  rebindPayload,
27141
27260
  reconcileTenant,
@@ -27184,6 +27303,7 @@ export {
27184
27303
  saveProfile,
27185
27304
  saveTenantMeta,
27186
27305
  saveWorkspaceFileContent,
27306
+ saveWorkspaceFileContentChecked,
27187
27307
  scriptDryRun,
27188
27308
  seedBaselines,
27189
27309
  seedMappingPath,
@@ -27215,7 +27335,10 @@ export {
27215
27335
  verifyText,
27216
27336
  waitForInstallRun,
27217
27337
  watchBrowserAuthorization,
27338
+ workspaceActionPayload,
27339
+ workspaceDeliveryError,
27218
27340
  workspaceLayer,
27341
+ workspaceObjectActionBase,
27219
27342
  writeChangeState,
27220
27343
  writeImportPlan,
27221
27344
  writeRisk