@burdenoff/microfe-cosmicintersection 2026.1123.1 → 2026.1124.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cosmicintersection/CosmicIntersectionRoutes.js +32 -28
- package/dist/cosmicintersection/CosmicIntersectionRoutes.js.map +1 -1
- package/dist/cosmicintersection/api/cosmicApi.js +1 -7
- package/dist/cosmicintersection/api/cosmicApi.js.map +1 -1
- package/dist/cosmicintersection/components/ReleaseDraftDialog.js +22 -8
- package/dist/cosmicintersection/components/ReleaseDraftDialog.js.map +1 -1
- package/dist/cosmicintersection/components/RunTriageCard.js +22 -6
- package/dist/cosmicintersection/components/RunTriageCard.js.map +1 -1
- package/dist/cosmicintersection/pages/mission/MissionPreviewPage.d.ts +1 -0
- package/dist/cosmicintersection/pages/mission/MissionPreviewPage.js +378 -0
- package/dist/cosmicintersection/pages/mission/MissionPreviewPage.js.map +1 -0
- package/dist/cosmicintersection/pages/mission/missionPreviewInput.d.ts +3 -0
- package/dist/cosmicintersection/pages/mission/missionPreviewInput.js +60 -0
- package/dist/cosmicintersection/pages/mission/missionPreviewInput.js.map +1 -0
- package/dist/cosmicintersection/pages/sources/SourcesPage.js +41 -32
- package/dist/cosmicintersection/pages/sources/SourcesPage.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +76 -0
- package/dist/generated/wspace-operations.js +214 -1
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +27174 -1571
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmicApi.js","names":["onMutationError","error","COS_DATASETS_QUERY","COS_DATASET_QUERY","COS_SOURCES_QUERY","COS_SOURCE_QUERY","COS_COLLECTIONS_QUERY","COS_COLLECTION_QUERY","COS_PIPELINES_QUERY","COS_PIPELINE_QUERY","COS_RUNS_QUERY","COS_RUN_QUERY","COS_PIPELINE_FAILED_RUNS_QUERY","COS_DATASET_SUMMARY_QUERY","COS_RUN_STEPS_QUERY","COS_NOTEBOOKS_QUERY","COS_NOTEBOOK_QUERY","COS_ANALYSES_QUERY","COS_ANALYSIS_QUERY","COS_RELEASES_QUERY","COS_RELEASE_QUERY","COS_ACCESS_GRANTS_QUERY","COS_ACTIVITY_BY_RESOURCE_QUERY","COS_CREATE_DATASET_MUTATION","COS_UPDATE_DATASET_MUTATION","COS_PUBLISH_DATASET_MUTATION","COS_ARCHIVE_DATASET_MUTATION","COS_ADD_SCHEMA_FIELD_MUTATION","COS_CREATE_SOURCE_MUTATION","COS_UPDATE_SOURCE_MUTATION","COS_MARK_SOURCE_SYNCED_MUTATION","COS_ARCHIVE_SOURCE_MUTATION","COS_CREATE_COLLECTION_MUTATION","COS_UPDATE_COLLECTION_MUTATION","COS_ARCHIVE_COLLECTION_MUTATION","COS_CREATE_PIPELINE_MUTATION","COS_UPDATE_PIPELINE_MUTATION","COS_ARCHIVE_PIPELINE_MUTATION","COS_START_RUN_MUTATION","COS_TRANSITION_RUN_MUTATION","COS_ADD_RUN_STEP_MUTATION","COS_CREATE_NOTEBOOK_MUTATION","COS_UPDATE_NOTEBOOK_MUTATION","COS_ARCHIVE_NOTEBOOK_MUTATION","COS_RUN_ANALYSIS_MUTATION","COS_COMPLETE_ANALYSIS_MUTATION","COS_CREATE_RELEASE_MUTATION","COS_PUBLISH_RELEASE_MUTATION","COS_MINT_DOI_MUTATION","COS_GRANT_ACCESS_MUTATION","COS_REVOKE_ACCESS_MUTATION","useCosDatasetsQuery","useQuery","useCosDatasetQuery","id","useCosSourcesQuery","useCosSourceQuery","useCosCollectionsQuery","useCosCollectionQuery","COS_RUNNABLE_WORKFLOWS_QUERY","COS_WORKFLOW_DEFINITION_QUERY","useRunnableWorkflowsQuery","useWorkflowDefinitionQuery","useCosPipelinesQuery","useCosPipelineQuery","useCosRunsQuery","useCosRunQuery","useCosRunStepsQuery","runId","useCosPipelineFailedRunsQuery","pipelineId","options","useCosDatasetSummaryQuery","useCosNotebooksQuery","useCosNotebookQuery","useCosAnalysesQuery","useCosReleasesQuery","useCosAnalysisQuery","useCosReleaseQuery","useCosAccessGrantsQuery","useCosResourceActivityQuery","params","workspaceId","resourceId","useCosCreateDatasetMutation","useMutation","useCosUpdateDatasetMutation","useCosPublishDatasetMutation","useCosArchiveDatasetMutation","useCosAddSchemaFieldMutation","useCosCreateSourceMutation","useCosUpdateSourceMutation","useCosMarkSourceSyncedMutation","useCosArchiveSourceMutation","useCosCreateCollectionMutation","useCosUpdateCollectionMutation","useCosArchiveCollectionMutation","useCosCreatePipelineMutation","useCosUpdatePipelineMutation","useCosArchivePipelineMutation","useCosStartRunMutation","useCosTransitionRunMutation","useCosAddRunStepMutation","useCosCreateNotebookMutation","useCosUpdateNotebookMutation","useCosArchiveNotebookMutation","useCosRunAnalysisMutation","useCosCompleteAnalysisMutation","useCosCreateReleaseMutation","useCosPublishReleaseMutation","useCosMintDoiMutation","useCosGrantAccessMutation","useCosRevokeAccessMutation","COS_AI_PROPOSE_SCHEMA_FIELDS_MUTATION","COS_AI_TRIAGE_RUN_MUTATION","COS_AI_DRAFT_RELEASE_MUTATION","COS_UPDATE_SCHEMA_FIELD_MUTATION","COS_REMOVE_SCHEMA_FIELD_MUTATION","COS_SEMANTIC_SEARCH_QUERY","useCosAiProposeSchemaFieldsMutation","useCosAiTriageRunMutation","useCosAiDraftReleaseMutation","useCosUpdateSchemaFieldMutation","useCosRemoveSchemaFieldMutation","useCosSemanticSearchLazyQuery","useLazyQuery","COS_ARCHIVE_MISSIONS_QUERY","COS_ARCHIVE_SEARCH_QUERY","COS_ARCHIVE_PRODUCTS_QUERY","useCosArchiveMissionsQuery","useCosArchiveSearchLazyQuery","useCosArchiveProductsLazyQuery"],"sources":["../../../src/cosmicintersection/api/cosmicApi.ts"],"sourcesContent":["/**\n * cosmicApi — hand-written typed data layer for the CosmicIntersection MFE.\n *\n * Mirrors the pattern in microfe-eventfullymanaged's eventApi.ts: inline `gql`\n * documents + `@apollo/client/react` hooks, with hand-written response/variables\n * types that track the wspace-cosmicintersection-svc subgraph SDL exactly. The\n * Apollo client is provided by the HOST app shell via React context (integrated\n * mode) — this module never constructs a client. Every `cos*` operation runs on\n * the workspace gateway (the default client in context).\n *\n * Scalar mapping: BigInt -> string, JSON -> Record<string, unknown>,\n * DateTime -> string (ISO).\n */\nimport { gql, type ErrorLike } from '@apollo/client';\nimport { useLazyQuery, useMutation, useQuery } from '@apollo/client/react';\n\nimport { notify } from '../lib/toast';\n\n/**\n * Shared mutation error sink. The gateway client runs with `errorPolicy: 'all'`,\n * so in-band GraphQL errors also invoke `onError`; wiring this on every write\n * mutation guarantees a failure is always surfaced to the user even if a caller\n * forgets to inspect the resolved result.\n */\nconst onMutationError = (error: ErrorLike): void => {\n notify.error('Something went wrong', error.message || 'Please try again.');\n};\n\n// ============================================================================\n// ENUMS (string-literal unions — exact SDL values)\n// ============================================================================\n\nexport type CosDatasetStatus = 'DRAFT' | 'INGESTING' | 'AVAILABLE' | 'DEPRECATED' | 'ARCHIVED';\nexport type CosAccessLevel = 'PUBLIC' | 'WORKSPACE' | 'RESTRICTED' | 'EMBARGOED';\nexport type CosSourceType =\n | 'TELESCOPE'\n | 'SATELLITE'\n | 'GROUND_SENSOR'\n | 'ARCHIVE'\n | 'API'\n | 'STREAM'\n | 'FILE_DROP'\n | 'SIMULATION';\nexport type CosSourceStatus =\n 'CONFIGURING' | 'CONNECTED' | 'SYNCING' | 'DEGRADED' | 'ERROR' | 'DISABLED';\nexport type CosFieldType =\n | 'STRING'\n | 'INTEGER'\n | 'FLOAT'\n | 'BOOLEAN'\n | 'TIMESTAMP'\n | 'COORDINATE'\n | 'SPECTRUM'\n | 'GEOMETRY'\n | 'IMAGE_REF'\n | 'JSON';\nexport type CosPipelineStatus = 'DRAFT' | 'ACTIVE' | 'PAUSED' | 'ARCHIVED';\nexport type CosRunStatus = 'QUEUED' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED';\n/**\n * Full SDL vocabulary. The four geospatial kinds are recognised values a step\n * can already carry (BOFF-4355) — only RASTER_CALC has an execution backend, so\n * they are readable/renderable but are deliberately not offered as authoring\n * options in the add-step form.\n */\nexport type CosStepKind =\n | 'INGEST'\n | 'CALIBRATE'\n | 'TRANSFORM'\n | 'ANALYZE'\n | 'EXPORT'\n | 'NOTIFY'\n | 'RASTER_CALC'\n | 'REPROJECT'\n | 'TILE'\n | 'ZONAL_STATS';\nexport type CosNotebookStatus = 'DRAFT' | 'RUNNING' | 'PUBLISHED' | 'ARCHIVED';\nexport type CosAnalysisStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';\nexport type CosReleaseStatus = 'DRAFT' | 'UNDER_REVIEW' | 'PUBLISHED' | 'RETRACTED';\nexport type CosGrantStatus = 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'REVOKED';\n\n// ============================================================================\n// AI DECISION ENGINE (BOFF-3781 / BOFF-3814) — proposals, never writes.\n// \"AI proposes; scientists review.\" Every cosAi* operation returns a proposal\n// the human accepts through the named domain mutation; nothing here mutates a\n// domain entity. Types mirror wspace-cosmicintersection-svc's ai.gql exactly.\n// ============================================================================\n\nexport type CosTriageAction =\n | 'PROMOTE'\n | 'RERUN_WITH_PARAMS'\n | 'QUARANTINE_DATASET'\n | 'FLAG_SOURCE_DEGRADED'\n | 'INSUFFICIENT_TELEMETRY';\n\nexport type CosTriageSignalSeverity = 'INFO' | 'WARNING' | 'CRITICAL';\nexport type CosTriageEvidenceKind = 'RUN' | 'RUN_METRIC' | 'STEP' | 'SOURCE' | 'BASELINE';\nexport type CosSearchEntityType = 'DATASET' | 'COLLECTION' | 'RELEASE' | 'NOTEBOOK';\nexport type CosSearchEvidenceKind =\n | 'DATASET_TEXT'\n | 'SCHEMA_FIELD'\n | 'SCHEMA_PROVENANCE'\n | 'COVERAGE'\n | 'COVERAGE_WINDOW'\n | 'SOURCE'\n | 'COLLECTION'\n | 'RELEASE_ABSTRACT'\n | 'ANALYSIS_METHOD'\n | 'NOTEBOOK';\nexport type CosSearchLineageKind =\n 'SOURCE' | 'PIPELINE_RUN' | 'PIPELINE_STEP' | 'ANALYSIS' | 'RELEASE';\n\nexport interface CosSchemaFieldSuggestion {\n name: string;\n fieldType: CosFieldType;\n unit?: string | null;\n nullable: boolean;\n position: number;\n description?: string | null;\n /** Drafted provenance note: where the column came from and why it was typed so. */\n provenanceNote: string;\n confidence: number;\n reasons: string[];\n sampledValues: number;\n emptyValues: number;\n /** True when the dataset already defines this name — it is never overwritten. */\n alreadyDefined: boolean;\n existingFieldId?: string | null;\n conflicts: string[];\n}\n\nexport interface CosSchemaFieldProposal {\n datasetId: string;\n sampleOrigin: 'REQUEST' | 'DATASET_CONTEXT' | 'SOURCE_CONFIG';\n sampledRows: number;\n fields: CosSchemaFieldSuggestion[];\n notes: string[];\n /** Id of this run in the shared AI invocation ledger. */\n agentRunId: string;\n engineVersion: string;\n method: string;\n generatedAt: string;\n}\n\nexport interface CosTriageSignal {\n code: string;\n severity: CosTriageSignalSeverity;\n message: string;\n}\n\nexport interface CosTriageEvidence {\n kind: CosTriageEvidenceKind;\n refId: string;\n field: string;\n value: string;\n}\n\nexport interface CosRunTriageMetrics {\n rowsIn?: number | null;\n rowsOut?: number | null;\n anomaliesFlagged?: number | null;\n warnings?: number | null;\n anomalyRate?: number | null;\n rowLossRate?: number | null;\n baselineAnomalyRate?: number | null;\n}\n\nexport interface CosTriageProposedAction {\n /** Name of the existing mutation a person would run; triage never runs it. */\n mutation: string;\n targetId: string;\n arguments: Record<string, unknown>;\n description: string;\n}\n\nexport interface CosRunTriage {\n runId: string;\n action: CosTriageAction;\n confidence: number;\n rationale: string;\n signals: CosTriageSignal[];\n evidence: CosTriageEvidence[];\n metrics: CosRunTriageMetrics;\n suggestedParams?: Record<string, unknown> | null;\n proposedAction?: CosTriageProposedAction | null;\n agentRunId: string;\n engineVersion: string;\n method: string;\n generatedAt: string;\n}\n\nexport interface CosReleaseAuthorSuggestion {\n actorId: string;\n roles: string[];\n contributions: number;\n}\n\nexport interface CosReleaseDraft {\n notebookId: string;\n title: string;\n abstract: string;\n version: string;\n authors: string[];\n authorSuggestions: CosReleaseAuthorSuggestion[];\n license: string;\n licenseRationale: string;\n datasetIds: string[];\n analysisIds: string[];\n warnings: string[];\n notes: string[];\n agentRunId: string;\n engineVersion: string;\n method: string;\n generatedAt: string;\n}\n\nexport interface CosSearchEvidence {\n kind: CosSearchEvidenceKind;\n entityId?: string | null;\n label?: string | null;\n text: string;\n}\n\nexport interface CosSearchLineageNode {\n kind: CosSearchLineageKind;\n id: string;\n label: string;\n relation: string;\n parentId?: string | null;\n}\n\nexport interface CosSearchHit {\n entityType: CosSearchEntityType;\n id: string;\n title: string;\n snippet?: string | null;\n score: number;\n dataset?: CosDataset | null;\n collection?: CosCollection | null;\n release?: CosRelease | null;\n notebook?: CosNotebook | null;\n evidence: CosSearchEvidence[];\n lineage: CosSearchLineageNode[];\n}\n\nexport interface CosSearchResults {\n query: string;\n interpretedTerms: string[];\n expandedTerms: string[];\n timeWindow?: { fromYear: number; toYear: number } | null;\n hits: CosSearchHit[];\n total: number;\n}\n\nexport interface CosSemanticSearchInput {\n query: string;\n entityTypes?: CosSearchEntityType[];\n limit?: number;\n includeLineage?: boolean;\n}\n\nexport interface CosUpdateSchemaFieldInput {\n name?: string;\n fieldType?: CosFieldType;\n unit?: string;\n description?: string;\n nullable?: boolean;\n position?: number;\n provenance?: string;\n}\n\n// ============================================================================\n// ENTITY TYPES\n// ============================================================================\n\n/** Federated wspace-files File stub — only `{ id }` is resolvable in this subgraph. */\nexport interface CosFileRef {\n id: string;\n}\n\n/** An entity selected id-only, where the operation needs its existence, not its body. */\nexport interface CosIdRef {\n id: string;\n}\n\n/**\n * Per-parent cap the subgraph applies to every relation field\n * (`capPerGroup(rows, key, DEFAULT_LIMIT)` in wspace-cosmicintersection-svc's\n * dataloaders — DEFAULT_LIMIT is 50).\n *\n * A relation array of exactly this length means \"at least this many\", NOT an\n * exact total: render it as `50+`, never as a precise count.\n */\nexport const COS_RELATION_PAGE_SIZE = 50;\n\nexport interface CosSchemaField {\n id: string;\n workspaceId: string;\n datasetId: string;\n name: string;\n fieldType: CosFieldType;\n unit?: string | null;\n description?: string | null;\n nullable: boolean;\n position: number;\n provenance?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosDataset {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n status: CosDatasetStatus;\n accessLevel: CosAccessLevel;\n format?: string | null;\n sourceId?: string | null;\n collectionId?: string | null;\n /** BigInt returned as a numeric string. */\n rowCount: string;\n /** BigInt returned as a numeric string. */\n sizeBytes: string;\n version: number;\n lineageCaptured: boolean;\n coverage?: Record<string, unknown> | null;\n ingestedAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relations — only present when the operation selects them (detail queries).\n source?: CosSource | null;\n collection?: CosCollection | null;\n file?: CosFileRef | null;\n schemaFields?: CosSchemaField[];\n}\n\nexport interface CosSource {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n type: CosSourceType;\n status: CosSourceStatus;\n endpoint?: string | null;\n config?: Record<string, unknown> | null;\n lastSyncedAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n datasets?: CosDataset[];\n}\n\nexport interface CosCollection {\n id: string;\n workspaceId: string;\n name: string;\n slug?: string | null;\n description?: string | null;\n isPublic: boolean;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n datasets?: CosDataset[];\n}\n\nexport interface CosPipeline {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n status: CosPipelineStatus;\n /** Ordered science steps (CosStepKind vocabulary). Orchestration lives in the linked canonical workflow. */\n steps?: Record<string, unknown> | null;\n /** Opaque canonical WorkflowDefinition id (wspace-workflow-svc); null = manual runs only. */\n workflowDefinitionId?: string | null;\n lastRunAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n runs?: CosPipelineRun[];\n}\n\nexport interface CosPipelineRun {\n id: string;\n workspaceId: string;\n pipelineId: string;\n runNumber: number;\n status: CosRunStatus;\n datasetId?: string | null;\n /** Opaque canonical WorkflowRun id (wspace-workflow-svc) when the pipeline is automated. */\n workflowRunId?: string | null;\n params?: Record<string, unknown> | null;\n metrics?: Record<string, unknown> | null;\n triggeredBy?: string | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n durationMs?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n // Relations — present only on detail queries.\n pipeline?: CosPipeline | null;\n steps?: CosPipelineStep[];\n}\n\nexport interface CosPipelineStep {\n id: string;\n workspaceId: string;\n runId: string;\n name: string;\n kind: CosStepKind;\n position: number;\n status: CosRunStatus;\n inputs?: Record<string, unknown> | null;\n outputs?: Record<string, unknown> | null;\n logsRef?: string | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n durationMs?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosNotebook {\n id: string;\n workspaceId: string;\n title: string;\n description?: string | null;\n status: CosNotebookStatus;\n runtime?: string | null;\n environment?: Record<string, unknown> | null;\n datasetIds: string[];\n isShared: boolean;\n shareSlug?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relations — present only on detail queries.\n file?: CosFileRef | null;\n analyses?: CosAnalysis[];\n releases?: CosRelease[];\n}\n\nexport interface CosAnalysis {\n id: string;\n workspaceId: string;\n title: string;\n status: CosAnalysisStatus;\n method?: string | null;\n aiAssisted: boolean;\n notebookId?: string | null;\n datasetId?: string | null;\n results?: Record<string, unknown> | null;\n outputFile?: CosFileRef | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosRelease {\n id: string;\n workspaceId: string;\n title: string;\n version: string;\n status: CosReleaseStatus;\n abstract?: string | null;\n authors: string[];\n datasetIds: string[];\n notebookId?: string | null;\n doi?: string | null;\n license?: string | null;\n publishedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosDataAccessGrant {\n id: string;\n workspaceId: string;\n datasetId: string;\n granteeId: string;\n status: CosGrantStatus;\n scopes: string[];\n reason?: string | null;\n grantedAt?: string | null;\n expiresAt?: string | null;\n revokedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ============================================================================\n// PAGINATION / CONNECTIONS\n// ============================================================================\n\nexport interface CosPageInfo {\n hasMore: boolean;\n cursor?: string | null;\n}\n\nexport interface CosConnection<T> {\n items: T[];\n pageInfo: CosPageInfo;\n}\n\n/** Offset-based pagination input (PaginationInput in the SDL; limit defaults to 50). */\nexport interface CosPaginationInput {\n limit?: number;\n offset?: number;\n cursor?: string;\n}\n\n// ============================================================================\n// INPUT TYPES\n// ============================================================================\n\nexport interface CosCreateDatasetInput {\n name: string;\n description?: string;\n status?: CosDatasetStatus;\n accessLevel?: CosAccessLevel;\n format?: string;\n sourceId?: string;\n collectionId?: string;\n fileId?: string;\n coverage?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdateDatasetInput {\n name?: string;\n description?: string;\n accessLevel?: CosAccessLevel;\n format?: string;\n collectionId?: string;\n coverage?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosAddSchemaFieldInput {\n datasetId: string;\n name: string;\n fieldType?: CosFieldType;\n unit?: string;\n description?: string;\n nullable?: boolean;\n position?: number;\n provenance?: string;\n}\n\nexport interface CosCreateSourceInput {\n name: string;\n type?: CosSourceType;\n status?: CosSourceStatus;\n description?: string;\n endpoint?: string;\n credentialRef?: string;\n config?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdateSourceInput {\n name?: string;\n type?: CosSourceType;\n status?: CosSourceStatus;\n description?: string;\n endpoint?: string;\n credentialRef?: string;\n config?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosCreateCollectionInput {\n name: string;\n slug?: string;\n description?: string;\n isPublic?: boolean;\n tags?: string[];\n}\n\n/** All fields optional — only the provided keys are updated (CosUpdateCollectionInput in the SDL). */\nexport interface CosUpdateCollectionInput {\n name?: string;\n slug?: string;\n description?: string;\n isPublic?: boolean;\n tags?: string[];\n}\n\nexport interface CosCreatePipelineInput {\n name: string;\n description?: string;\n /** Ordered science steps (CosStepKind vocabulary). */\n steps?: Record<string, unknown>;\n /** Optional canonical WorkflowDefinition id (wspace-workflow-svc) for real automation. */\n workflowDefinitionId?: string;\n tags?: string[];\n}\n\nexport interface CosUpdatePipelineInput {\n name?: string;\n description?: string;\n status?: CosPipelineStatus;\n steps?: Record<string, unknown>;\n /** Send null to unlink the canonical workflow. */\n workflowDefinitionId?: string | null;\n tags?: string[];\n}\n\nexport interface CosStartRunInput {\n pipelineId: string;\n datasetId?: string;\n params?: Record<string, unknown>;\n}\n\nexport interface CosAddRunStepInput {\n runId: string;\n name: string;\n kind?: CosStepKind;\n inputs?: Record<string, unknown>;\n position?: number;\n}\n\nexport interface CosCreateNotebookInput {\n title: string;\n description?: string;\n runtime?: string;\n environment?: Record<string, unknown>;\n datasetIds?: string[];\n fileId?: string;\n tags?: string[];\n}\n\nexport interface CosUpdateNotebookInput {\n title?: string;\n description?: string;\n status?: CosNotebookStatus;\n runtime?: string;\n environment?: Record<string, unknown>;\n datasetIds?: string[];\n isShared?: boolean;\n shareSlug?: string;\n tags?: string[];\n}\n\nexport interface CosRunAnalysisInput {\n title: string;\n method?: string;\n aiAssisted?: boolean;\n notebookId?: string;\n datasetId?: string;\n}\n\nexport interface CosCreateReleaseInput {\n title: string;\n version?: string;\n abstract?: string;\n authors?: string[];\n datasetIds?: string[];\n notebookId?: string;\n license?: string;\n}\n\nexport interface CosGrantAccessInput {\n datasetId: string;\n granteeId: string;\n scopes?: string[];\n reason?: string;\n expiresAt?: string;\n}\n\n// ============================================================================\n// GQL DOCUMENTS — QUERIES\n// ============================================================================\n\nexport const COS_HEALTH_QUERY = gql`\n query CosHealth {\n cosHealth\n }\n`;\n\nexport const COS_DATASETS_QUERY = gql`\n query CosListDatasets(\n $q: String\n $accessLevel: CosAccessLevel\n $format: String\n $collectionId: ID\n $sourceId: ID\n $status: CosDatasetStatus\n $pagination: PaginationInput\n ) {\n cosListDatasets(\n q: $q\n accessLevel: $accessLevel\n format: $format\n collectionId: $collectionId\n sourceId: $sourceId\n status: $status\n pagination: $pagination\n ) {\n items {\n id\n workspaceId\n name\n description\n status\n accessLevel\n format\n sourceId\n collectionId\n rowCount\n sizeBytes\n version\n lineageCaptured\n ingestedAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_DATASET_QUERY = gql`\n query CosDataset($id: ID!) {\n cosDataset(id: $id) {\n id\n workspaceId\n name\n description\n status\n accessLevel\n format\n sourceId\n collectionId\n rowCount\n sizeBytes\n version\n lineageCaptured\n coverage\n ingestedAt\n tags\n createdAt\n updatedAt\n file {\n id\n }\n source {\n id\n name\n type\n status\n }\n collection {\n id\n name\n slug\n }\n schemaFields {\n id\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n }\n`;\n\nexport const COS_SOURCES_QUERY = gql`\n query CosListSources(\n $type: CosSourceType\n $status: CosSourceStatus\n $pagination: PaginationInput\n ) {\n cosListSources(type: $type, status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n name\n description\n type\n status\n endpoint\n config\n lastSyncedAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_SOURCE_QUERY = gql`\n query CosSource($id: ID!) {\n cosSource(id: $id) {\n id\n workspaceId\n name\n description\n type\n status\n endpoint\n config\n lastSyncedAt\n tags\n createdAt\n updatedAt\n datasets {\n id\n name\n status\n accessLevel\n rowCount\n updatedAt\n }\n }\n }\n`;\n\n/**\n * `datasets` is selected id-only so each card can show how many datasets the\n * collection holds. The subgraph resolves it through `collectionDatasetsLoader`\n * (one batched query for the whole page) and filters to the datasets THIS actor\n * may read, so the length is the caller's visible count — capped at\n * `COS_RELATION_PAGE_SIZE`.\n */\nexport const COS_COLLECTIONS_QUERY = gql`\n query CosListCollections {\n cosListCollections {\n id\n workspaceId\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n datasets {\n id\n }\n }\n }\n`;\n\nexport const COS_COLLECTION_QUERY = gql`\n query CosCollection($id: ID!) {\n cosCollection(id: $id) {\n id\n workspaceId\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_SCHEMA_FIELDS_QUERY = gql`\n query CosListSchemaFields($datasetId: ID!) {\n cosListSchemaFields(datasetId: $datasetId) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_PIPELINES_QUERY = gql`\n query CosListPipelines($status: CosPipelineStatus, $pagination: PaginationInput) {\n cosListPipelines(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n name\n description\n status\n workflowDefinitionId\n lastRunAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_PIPELINE_QUERY = gql`\n query CosPipeline($id: ID!) {\n cosPipeline(id: $id) {\n id\n workspaceId\n name\n description\n status\n steps\n workflowDefinitionId\n lastRunAt\n tags\n createdAt\n updatedAt\n runs {\n id\n runNumber\n status\n datasetId\n workflowRunId\n startedAt\n finishedAt\n durationMs\n createdAt\n }\n }\n }\n`;\n\nexport const COS_RUNS_QUERY = gql`\n query CosListRuns($pipelineId: ID, $status: CosRunStatus, $pagination: PaginationInput) {\n cosListRuns(pipelineId: $pipelineId, status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n pipelineId\n runNumber\n status\n datasetId\n triggeredBy\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_RUN_QUERY = gql`\n query CosRun($id: ID!) {\n cosRun(id: $id) {\n id\n workspaceId\n pipelineId\n runNumber\n status\n datasetId\n workflowRunId\n params\n metrics\n triggeredBy\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n pipeline {\n id\n name\n status\n workflowDefinitionId\n }\n steps {\n id\n runId\n name\n kind\n position\n status\n startedAt\n finishedAt\n durationMs\n errorMessage\n }\n }\n }\n`;\n\n/**\n * Other FAILED runs of the same pipeline, newest first, each with its steps so\n * the caller can name the step that broke. `steps` resolves through\n * `pipelineRunStepsLoader`, so the whole list costs one extra batched query.\n */\nexport const COS_PIPELINE_FAILED_RUNS_QUERY = gql`\n query CosPipelineFailedRuns($pipelineId: ID!, $pagination: PaginationInput) {\n cosListRuns(pipelineId: $pipelineId, status: FAILED, pagination: $pagination) {\n items {\n id\n workspaceId\n pipelineId\n runNumber\n status\n errorMessage\n startedAt\n finishedAt\n createdAt\n updatedAt\n steps {\n id\n runId\n name\n kind\n position\n status\n errorMessage\n }\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\n/**\n * Minimal dataset lookup — resolves an id held on another entity (e.g.\n * `CosPipelineRun.datasetId`, which the SDL exposes as a bare ID with no\n * relation field) to something a human can read. Returns null when the caller\n * has no read access to that dataset, so callers must fall back to the id.\n */\nexport const COS_DATASET_SUMMARY_QUERY = gql`\n query CosDatasetSummary($id: ID!) {\n cosDataset(id: $id) {\n id\n name\n status\n accessLevel\n }\n }\n`;\n\nexport const COS_RUN_STEPS_QUERY = gql`\n query CosListRunSteps($runId: ID!) {\n cosListRunSteps(runId: $runId) {\n id\n workspaceId\n runId\n name\n kind\n position\n status\n inputs\n outputs\n logsRef\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_NOTEBOOKS_QUERY = gql`\n query CosListNotebooks($status: CosNotebookStatus, $pagination: PaginationInput) {\n cosListNotebooks(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n title\n description\n status\n runtime\n datasetIds\n isShared\n shareSlug\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_NOTEBOOK_QUERY = gql`\n query CosNotebook($id: ID!) {\n cosNotebook(id: $id) {\n id\n workspaceId\n title\n description\n status\n runtime\n environment\n datasetIds\n isShared\n shareSlug\n tags\n createdAt\n updatedAt\n file {\n id\n }\n analyses {\n id\n title\n status\n aiAssisted\n method\n createdAt\n }\n releases {\n id\n title\n version\n status\n publishedAt\n }\n }\n }\n`;\n\nexport const COS_ANALYSES_QUERY = gql`\n query CosListAnalyses($datasetId: ID, $notebookId: ID, $status: CosAnalysisStatus) {\n cosListAnalyses(datasetId: $datasetId, notebookId: $notebookId, status: $status) {\n id\n workspaceId\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n results\n outputFile {\n id\n }\n startedAt\n finishedAt\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\n/**\n * One analysis by id, independent of list paging and filters; the analyses\n * page falls back to it when the `?id=` analysis is not in the loaded list.\n */\nexport const COS_ANALYSIS_QUERY = gql`\n query CosAnalysis($id: ID!) {\n cosAnalysis(id: $id) {\n id\n workspaceId\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n results\n outputFile {\n id\n }\n startedAt\n finishedAt\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_RELEASES_QUERY = gql`\n query CosListReleases($status: CosReleaseStatus, $pagination: PaginationInput) {\n cosListReleases(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n title\n version\n status\n abstract\n authors\n datasetIds\n notebookId\n doi\n license\n publishedAt\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\n/**\n * One release by id, independent of list paging and filters. The releases page\n * falls back to it when the `?id=` release is not on the loaded list page, so a\n * deep link or a command-palette Recent entry always reopens the release.\n */\nexport const COS_RELEASE_QUERY = gql`\n query CosRelease($id: ID!) {\n cosRelease(id: $id) {\n id\n workspaceId\n title\n version\n status\n abstract\n authors\n datasetIds\n notebookId\n doi\n license\n publishedAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ACCESS_GRANTS_QUERY = gql`\n query CosListAccessGrants($datasetId: ID, $status: CosGrantStatus) {\n cosListAccessGrants(datasetId: $datasetId, status: $status) {\n id\n workspaceId\n datasetId\n granteeId\n status\n scopes\n reason\n grantedAt\n expiresAt\n revokedAt\n createdAt\n updatedAt\n }\n }\n`;\n\n// ============================================================================\n// PLATFORM REUSE — activity feed (wspace-activity-svc, federated on the\n// workspace supergraph). The cos mutation-audit plugin already writes these\n// ActivityLog rows via be-sdk `trackOperation`; this is the read surface,\n// scoped to a single cos entity by `resourceId`. Only scalar fields are\n// selected so no cross-subgraph entity resolution is required.\n// ============================================================================\n\nexport const COS_ACTIVITY_BY_RESOURCE_QUERY = gql`\n query CosResourceActivity($filter: ActivityLogFilter) {\n getActivities(filter: $filter) {\n id\n action\n description\n resourceType\n resourceId\n userId\n timestamp\n }\n }\n`;\n\n// ============================================================================\n// GQL DOCUMENTS — MUTATIONS\n// ============================================================================\n\nexport const COS_CREATE_DATASET_MUTATION = gql`\n mutation CosCreateDataset($input: CosCreateDatasetInput!) {\n cosCreateDataset(input: $input) {\n id\n name\n status\n accessLevel\n sourceId\n collectionId\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_DATASET_MUTATION = gql`\n mutation CosUpdateDataset($id: ID!, $input: CosUpdateDatasetInput!) {\n cosUpdateDataset(id: $id, input: $input) {\n id\n name\n description\n status\n accessLevel\n format\n collectionId\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_PUBLISH_DATASET_MUTATION = gql`\n mutation CosPublishDataset($id: ID!) {\n cosPublishDataset(id: $id) {\n id\n status\n ingestedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_DATASET_MUTATION = gql`\n mutation CosArchiveDataset($id: ID!) {\n cosArchiveDataset(id: $id)\n }\n`;\n\nexport const COS_ADD_SCHEMA_FIELD_MUTATION = gql`\n mutation CosAddSchemaField($input: CosAddSchemaFieldInput!) {\n cosAddSchemaField(input: $input) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_SOURCE_MUTATION = gql`\n mutation CosCreateSource($input: CosCreateSourceInput!) {\n cosCreateSource(input: $input) {\n id\n name\n type\n status\n endpoint\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_SOURCE_MUTATION = gql`\n mutation CosUpdateSource($id: ID!, $input: CosUpdateSourceInput!) {\n cosUpdateSource(id: $id, input: $input) {\n id\n name\n description\n type\n status\n endpoint\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_MARK_SOURCE_SYNCED_MUTATION = gql`\n mutation CosMarkSourceSynced($id: ID!) {\n cosMarkSourceSynced(id: $id) {\n id\n status\n lastSyncedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_SOURCE_MUTATION = gql`\n mutation CosArchiveSource($id: ID!) {\n cosArchiveSource(id: $id)\n }\n`;\n\nexport const COS_CREATE_COLLECTION_MUTATION = gql`\n mutation CosCreateCollection($input: CosCreateCollectionInput!) {\n cosCreateCollection(input: $input) {\n id\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_COLLECTION_MUTATION = gql`\n mutation CosUpdateCollection($id: ID!, $input: CosUpdateCollectionInput!) {\n cosUpdateCollection(id: $id, input: $input) {\n id\n name\n slug\n description\n isPublic\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_COLLECTION_MUTATION = gql`\n mutation CosArchiveCollection($id: ID!) {\n cosArchiveCollection(id: $id)\n }\n`;\n\nexport const COS_CREATE_PIPELINE_MUTATION = gql`\n mutation CosCreatePipeline($input: CosCreatePipelineInput!) {\n cosCreatePipeline(input: $input) {\n id\n name\n status\n workflowDefinitionId\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_PIPELINE_MUTATION = gql`\n mutation CosUpdatePipeline($id: ID!, $input: CosUpdatePipelineInput!) {\n cosUpdatePipeline(id: $id, input: $input) {\n id\n name\n description\n status\n workflowDefinitionId\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_PIPELINE_MUTATION = gql`\n mutation CosArchivePipeline($id: ID!) {\n cosArchivePipeline(id: $id)\n }\n`;\n\nexport const COS_START_RUN_MUTATION = gql`\n mutation CosStartRun($input: CosStartRunInput!) {\n cosStartRun(input: $input) {\n id\n pipelineId\n runNumber\n status\n datasetId\n workflowRunId\n errorMessage\n startedAt\n createdAt\n }\n }\n`;\n\nexport const COS_TRANSITION_RUN_MUTATION = gql`\n mutation CosTransitionRun($id: ID!, $status: CosRunStatus!) {\n cosTransitionRun(id: $id, status: $status) {\n id\n status\n startedAt\n finishedAt\n durationMs\n updatedAt\n }\n }\n`;\n\nexport const COS_ADD_RUN_STEP_MUTATION = gql`\n mutation CosAddRunStep($input: CosAddRunStepInput!) {\n cosAddRunStep(input: $input) {\n id\n runId\n name\n kind\n position\n status\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_NOTEBOOK_MUTATION = gql`\n mutation CosCreateNotebook($input: CosCreateNotebookInput!) {\n cosCreateNotebook(input: $input) {\n id\n title\n status\n runtime\n datasetIds\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_NOTEBOOK_MUTATION = gql`\n mutation CosUpdateNotebook($id: ID!, $input: CosUpdateNotebookInput!) {\n cosUpdateNotebook(id: $id, input: $input) {\n id\n title\n description\n status\n runtime\n datasetIds\n isShared\n shareSlug\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_NOTEBOOK_MUTATION = gql`\n mutation CosArchiveNotebook($id: ID!) {\n cosArchiveNotebook(id: $id)\n }\n`;\n\nexport const COS_RUN_ANALYSIS_MUTATION = gql`\n mutation CosRunAnalysis($input: CosRunAnalysisInput!) {\n cosRunAnalysis(input: $input) {\n id\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n startedAt\n createdAt\n }\n }\n`;\n\nexport const COS_COMPLETE_ANALYSIS_MUTATION = gql`\n mutation CosCompleteAnalysis(\n $id: ID!\n $status: CosAnalysisStatus!\n $results: JSON\n $outputFileId: ID\n ) {\n cosCompleteAnalysis(id: $id, status: $status, results: $results, outputFileId: $outputFileId) {\n id\n status\n results\n finishedAt\n errorMessage\n outputFile {\n id\n }\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_RELEASE_MUTATION = gql`\n mutation CosCreateRelease($input: CosCreateReleaseInput!) {\n cosCreateRelease(input: $input) {\n id\n title\n version\n status\n authors\n datasetIds\n notebookId\n license\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_PUBLISH_RELEASE_MUTATION = gql`\n mutation CosPublishRelease($id: ID!, $doi: String, $mintDoi: Boolean) {\n cosPublishRelease(id: $id, doi: $doi, mintDoi: $mintDoi) {\n id\n status\n doi\n publishedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_MINT_DOI_MUTATION = gql`\n mutation CosMintDoi($releaseId: ID!) {\n cosMintDoi(releaseId: $releaseId) {\n id\n doi\n state\n mode\n errorMessage\n mintedAt\n }\n }\n`;\n\nexport const COS_GRANT_ACCESS_MUTATION = gql`\n mutation CosGrantAccess($input: CosGrantAccessInput!) {\n cosGrantAccess(input: $input) {\n id\n datasetId\n granteeId\n status\n scopes\n reason\n grantedAt\n expiresAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_REVOKE_ACCESS_MUTATION = gql`\n mutation CosRevokeAccess($id: ID!) {\n cosRevokeAccess(id: $id) {\n id\n status\n revokedAt\n updatedAt\n }\n }\n`;\n\n// ============================================================================\n// RESPONSE / VARIABLES TYPES\n// ============================================================================\n\nexport interface CosHealthQueryData {\n cosHealth: string;\n}\n\nexport interface CosDatasetsQueryData {\n cosListDatasets: CosConnection<CosDataset>;\n}\nexport interface CosDatasetsQueryVars {\n /** Full-text search across dataset name/description/tags (backend `q` arg). */\n q?: string;\n accessLevel?: CosAccessLevel;\n format?: string;\n collectionId?: string;\n sourceId?: string;\n status?: CosDatasetStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosDatasetQueryData {\n cosDataset: CosDataset | null;\n}\n\nexport interface CosSourcesQueryData {\n cosListSources: CosConnection<CosSource>;\n}\nexport interface CosSourcesQueryVars {\n type?: CosSourceType;\n status?: CosSourceStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosSourceQueryData {\n cosSource: CosSource | null;\n}\n\n/**\n * Row shape of `cosListCollections` — same as `CosCollection` except `datasets`\n * is the id-only selection COS_COLLECTIONS_QUERY makes, so the list page can\n * size each collection without over-fetching dataset bodies.\n */\nexport interface CosCollectionListItem extends Omit<CosCollection, 'datasets'> {\n datasets: CosIdRef[];\n}\n\nexport interface CosCollectionsQueryData {\n cosListCollections: CosCollectionListItem[];\n}\n\nexport interface CosCollectionQueryData {\n cosCollection: CosCollection | null;\n}\n\nexport interface CosSchemaFieldsQueryData {\n cosListSchemaFields: CosSchemaField[];\n}\n\nexport interface CosPipelinesQueryData {\n cosListPipelines: CosConnection<CosPipeline>;\n}\nexport interface CosPipelinesQueryVars {\n status?: CosPipelineStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosPipelineQueryData {\n cosPipeline: CosPipeline | null;\n}\n\nexport interface CosRunsQueryData {\n cosListRuns: CosConnection<CosPipelineRun>;\n}\nexport interface CosRunsQueryVars {\n pipelineId?: string;\n status?: CosRunStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosRunQueryData {\n cosRun: CosPipelineRun | null;\n}\n\nexport interface CosRunStepsQueryData {\n cosListRunSteps: CosPipelineStep[];\n}\n\n/** Row of COS_PIPELINE_FAILED_RUNS_QUERY — `steps` is always selected. */\nexport interface CosFailedRunListItem extends Omit<CosPipelineRun, 'steps'> {\n steps: CosPipelineStep[];\n}\n\nexport interface CosPipelineFailedRunsQueryData {\n cosListRuns: CosConnection<CosFailedRunListItem>;\n}\nexport interface CosPipelineFailedRunsQueryVars {\n pipelineId: string;\n pagination?: CosPaginationInput;\n}\n\n/** Just enough of a dataset to render its name in place of a bare id. */\nexport interface CosDatasetSummary {\n id: string;\n name: string;\n status: CosDatasetStatus;\n accessLevel: CosAccessLevel;\n}\n\nexport interface CosDatasetSummaryQueryData {\n cosDataset: CosDatasetSummary | null;\n}\n\nexport interface CosNotebooksQueryData {\n cosListNotebooks: CosConnection<CosNotebook>;\n}\nexport interface CosNotebooksQueryVars {\n status?: CosNotebookStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosNotebookQueryData {\n cosNotebook: CosNotebook | null;\n}\n\nexport interface CosAnalysesQueryData {\n cosListAnalyses: CosAnalysis[];\n}\nexport interface CosAnalysesQueryVars {\n datasetId?: string;\n notebookId?: string;\n status?: CosAnalysisStatus;\n}\n\nexport interface CosAnalysisQueryData {\n cosAnalysis: CosAnalysis | null;\n}\nexport interface CosReleaseQueryData {\n cosRelease: CosRelease | null;\n}\nexport interface CosReleasesQueryData {\n cosListReleases: CosConnection<CosRelease>;\n}\nexport interface CosReleasesQueryVars {\n status?: CosReleaseStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosAccessGrantsQueryData {\n cosListAccessGrants: CosDataAccessGrant[];\n}\nexport interface CosAccessGrantsQueryVars {\n datasetId?: string;\n status?: CosGrantStatus;\n}\n\n/** A single platform activity record (subset of wspace-activity-svc ActivityLog). */\nexport interface CosActivityEntry {\n id: string;\n action: string;\n description?: string | null;\n resourceType?: string | null;\n resourceId?: string | null;\n userId: string;\n timestamp: string;\n}\n\nexport interface CosActivityQueryData {\n getActivities: CosActivityEntry[];\n}\n\n/** Mirrors ActivityLogFilter — only the fields the cos activity panel needs. */\nexport interface CosActivityFilter {\n workspaceId?: string;\n resourceId?: string;\n resourceType?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface CosActivityQueryVars {\n filter?: CosActivityFilter;\n}\n\n// ============================================================================\n// QUERY HOOKS\n// ============================================================================\n\nexport const useCosHealthQuery = () => useQuery<CosHealthQueryData>(COS_HEALTH_QUERY);\n\nexport const useCosDatasetsQuery = (variables: CosDatasetsQueryVars = {}) =>\n useQuery<CosDatasetsQueryData, CosDatasetsQueryVars>(COS_DATASETS_QUERY, { variables });\n\nexport const useCosDatasetQuery = (id: string) =>\n useQuery<CosDatasetQueryData, { id: string }>(COS_DATASET_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosSourcesQuery = (variables: CosSourcesQueryVars = {}) =>\n useQuery<CosSourcesQueryData, CosSourcesQueryVars>(COS_SOURCES_QUERY, { variables });\n\nexport const useCosSourceQuery = (id: string) =>\n useQuery<CosSourceQueryData, { id: string }>(COS_SOURCE_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosCollectionsQuery = () =>\n useQuery<CosCollectionsQueryData>(COS_COLLECTIONS_QUERY);\n\nexport const useCosCollectionQuery = (id: string) =>\n useQuery<CosCollectionQueryData, { id: string }>(COS_COLLECTION_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosSchemaFieldsQuery = (datasetId: string) =>\n useQuery<CosSchemaFieldsQueryData, { datasetId: string }>(COS_SCHEMA_FIELDS_QUERY, {\n variables: { datasetId },\n skip: !datasetId,\n });\n\n// ---------------------------------------------------------------------------\n// Canonical workflows (wspace-workflow-svc) — the pipeline automation link\n// (OVL-09, BOFF-5232). Workflows are owned by the shared engine; CosmicIntersection\n// stores only the chosen definition's opaque id on CosPipeline.workflowDefinitionId.\n// ---------------------------------------------------------------------------\nexport interface CosWorkflowOption {\n id: string;\n name: string;\n workflowKey: string;\n version: string;\n}\n\nexport const COS_RUNNABLE_WORKFLOWS_QUERY = gql`\n query CosRunnableWorkflows($input: ListWorkflowDefinitionsInput!) {\n workflowDefinitions(input: $input) {\n items {\n id\n name\n workflowKey\n version\n }\n total\n hasMore\n }\n }\n`;\n\nexport const COS_WORKFLOW_DEFINITION_QUERY = gql`\n query CosWorkflowDefinition($id: ID!) {\n workflowDefinition(id: $id) {\n id\n name\n workflowKey\n version\n status\n }\n }\n`;\n\n/** One page is plenty for a picker; the engine caps a list at this size. */\nexport const MAX_WORKFLOW_OPTIONS = 100;\n\nexport const useRunnableWorkflowsQuery = () =>\n useQuery<{\n workflowDefinitions: { items: CosWorkflowOption[]; total: number; hasMore: boolean };\n }>(COS_RUNNABLE_WORKFLOWS_QUERY, {\n variables: { input: { status: 'ACTIVE', limit: MAX_WORKFLOW_OPTIONS, offset: 0 } },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useWorkflowDefinitionQuery = (id: string | null | undefined) =>\n useQuery<{ workflowDefinition: (CosWorkflowOption & { status: string }) | null }, { id: string }>(\n COS_WORKFLOW_DEFINITION_QUERY,\n { variables: { id: id ?? '' }, skip: !id }\n );\n\nexport const useCosPipelinesQuery = (variables: CosPipelinesQueryVars = {}) =>\n useQuery<CosPipelinesQueryData, CosPipelinesQueryVars>(COS_PIPELINES_QUERY, { variables });\n\nexport const useCosPipelineQuery = (id: string) =>\n useQuery<CosPipelineQueryData, { id: string }>(COS_PIPELINE_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosRunsQuery = (variables: CosRunsQueryVars = {}) =>\n useQuery<CosRunsQueryData, CosRunsQueryVars>(COS_RUNS_QUERY, { variables });\n\nexport const useCosRunQuery = (id: string) =>\n useQuery<CosRunQueryData, { id: string }>(COS_RUN_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosRunStepsQuery = (runId: string) =>\n useQuery<CosRunStepsQueryData, { runId: string }>(COS_RUN_STEPS_QUERY, {\n variables: { runId },\n skip: !runId,\n });\n\n/**\n * Failed runs of one pipeline. Skipped until a pipelineId is known so the run\n * detail page can call it unconditionally while its own query is still loading.\n */\nexport const useCosPipelineFailedRunsQuery = (\n pipelineId: string | undefined,\n options: { limit?: number; skip?: boolean } = {}\n) =>\n useQuery<CosPipelineFailedRunsQueryData, CosPipelineFailedRunsQueryVars>(\n COS_PIPELINE_FAILED_RUNS_QUERY,\n {\n variables: {\n pipelineId: pipelineId ?? '',\n pagination: { limit: options.limit ?? 20, offset: 0 },\n },\n skip: !pipelineId || options.skip === true,\n }\n );\n\n/** Resolves a dataset id to its name. Returns null data when unreadable. */\nexport const useCosDatasetSummaryQuery = (id: string | null | undefined) =>\n useQuery<CosDatasetSummaryQueryData, { id: string }>(COS_DATASET_SUMMARY_QUERY, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n\nexport const useCosNotebooksQuery = (variables: CosNotebooksQueryVars = {}) =>\n useQuery<CosNotebooksQueryData, CosNotebooksQueryVars>(COS_NOTEBOOKS_QUERY, { variables });\n\nexport const useCosNotebookQuery = (id: string) =>\n useQuery<CosNotebookQueryData, { id: string }>(COS_NOTEBOOK_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosAnalysesQuery = (variables: CosAnalysesQueryVars = {}) =>\n useQuery<CosAnalysesQueryData, CosAnalysesQueryVars>(COS_ANALYSES_QUERY, { variables });\n\nexport const useCosReleasesQuery = (variables: CosReleasesQueryVars = {}) =>\n useQuery<CosReleasesQueryData, CosReleasesQueryVars>(COS_RELEASES_QUERY, { variables });\n\n/** One analysis by id; skipped while `id` is empty or `skip` is set. */\nexport const useCosAnalysisQuery = (\n id: string | null | undefined,\n options: { skip?: boolean } = {}\n) =>\n useQuery<CosAnalysisQueryData, { id: string }>(COS_ANALYSIS_QUERY, {\n variables: { id: id ?? '' },\n skip: !id || options.skip === true,\n });\n\n/** One release by id; skipped while `id` is empty or `skip` is set. */\nexport const useCosReleaseQuery = (\n id: string | null | undefined,\n options: { skip?: boolean } = {}\n) =>\n useQuery<CosReleaseQueryData, { id: string }>(COS_RELEASE_QUERY, {\n variables: { id: id ?? '' },\n skip: !id || options.skip === true,\n });\n\nexport const useCosAccessGrantsQuery = (variables: CosAccessGrantsQueryVars = {}) =>\n useQuery<CosAccessGrantsQueryData, CosAccessGrantsQueryVars>(COS_ACCESS_GRANTS_QUERY, {\n variables,\n });\n\n/**\n * Resource-scoped platform activity for a single cos entity. RBAC on\n * `getActivities` scopes on `filter.workspaceId`, so both a workspaceId and the\n * entity's resourceId are required — the query is skipped until both are known.\n */\nexport const useCosResourceActivityQuery = (params: {\n workspaceId?: string;\n resourceId: string;\n resourceType?: string;\n limit?: number;\n}) => {\n const { workspaceId, resourceId, resourceType, limit = 20 } = params;\n return useQuery<CosActivityQueryData, CosActivityQueryVars>(COS_ACTIVITY_BY_RESOURCE_QUERY, {\n variables: { filter: { workspaceId, resourceId, resourceType, limit } },\n skip: !workspaceId || !resourceId,\n fetchPolicy: 'cache-and-network',\n });\n};\n\n// ============================================================================\n// MUTATION HOOKS\n// ============================================================================\n\nexport const useCosCreateDatasetMutation = () =>\n useMutation<{ cosCreateDataset: CosDataset }, { input: CosCreateDatasetInput }>(\n COS_CREATE_DATASET_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n }\n );\n\nexport const useCosUpdateDatasetMutation = () =>\n useMutation<{ cosUpdateDataset: CosDataset }, { id: string; input: CosUpdateDatasetInput }>(\n COS_UPDATE_DATASET_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n }\n );\n\nexport const useCosPublishDatasetMutation = () =>\n useMutation<{ cosPublishDataset: CosDataset }, { id: string }>(COS_PUBLISH_DATASET_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n });\n\nexport const useCosArchiveDatasetMutation = () =>\n useMutation<{ cosArchiveDataset: boolean }, { id: string }>(COS_ARCHIVE_DATASET_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n });\n\nexport const useCosAddSchemaFieldMutation = () =>\n useMutation<{ cosAddSchemaField: CosSchemaField }, { input: CosAddSchemaFieldInput }>(\n COS_ADD_SCHEMA_FIELD_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosCreateSourceMutation = () =>\n useMutation<{ cosCreateSource: CosSource }, { input: CosCreateSourceInput }>(\n COS_CREATE_SOURCE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_SOURCES_QUERY }] }\n );\n\nexport const useCosUpdateSourceMutation = () =>\n useMutation<{ cosUpdateSource: CosSource }, { id: string; input: CosUpdateSourceInput }>(\n COS_UPDATE_SOURCE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_SOURCES_QUERY }] }\n );\n\nexport const useCosMarkSourceSyncedMutation = () =>\n useMutation<{ cosMarkSourceSynced: CosSource }, { id: string }>(COS_MARK_SOURCE_SYNCED_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_SOURCES_QUERY }],\n });\n\nexport const useCosArchiveSourceMutation = () =>\n useMutation<{ cosArchiveSource: boolean }, { id: string }>(COS_ARCHIVE_SOURCE_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_SOURCES_QUERY }],\n });\n\nexport const useCosCreateCollectionMutation = () =>\n useMutation<{ cosCreateCollection: CosCollection }, { input: CosCreateCollectionInput }>(\n COS_CREATE_COLLECTION_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n }\n );\n\nexport const useCosUpdateCollectionMutation = () =>\n useMutation<\n { cosUpdateCollection: CosCollection },\n { id: string; input: CosUpdateCollectionInput }\n >(COS_UPDATE_COLLECTION_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n });\n\nexport const useCosArchiveCollectionMutation = () =>\n useMutation<{ cosArchiveCollection: boolean }, { id: string }>(COS_ARCHIVE_COLLECTION_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n });\n\nexport const useCosCreatePipelineMutation = () =>\n useMutation<{ cosCreatePipeline: CosPipeline }, { input: CosCreatePipelineInput }>(\n COS_CREATE_PIPELINE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n }\n );\n\nexport const useCosUpdatePipelineMutation = () =>\n useMutation<{ cosUpdatePipeline: CosPipeline }, { id: string; input: CosUpdatePipelineInput }>(\n COS_UPDATE_PIPELINE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n }\n );\n\nexport const useCosArchivePipelineMutation = () =>\n useMutation<{ cosArchivePipeline: boolean }, { id: string }>(COS_ARCHIVE_PIPELINE_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n });\n\nexport const useCosStartRunMutation = () =>\n useMutation<{ cosStartRun: CosPipelineRun }, { input: CosStartRunInput }>(\n COS_START_RUN_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RUNS_QUERY }],\n }\n );\n\nexport const useCosTransitionRunMutation = () =>\n useMutation<{ cosTransitionRun: CosPipelineRun }, { id: string; status: CosRunStatus }>(\n COS_TRANSITION_RUN_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_RUNS_QUERY }] }\n );\n\nexport const useCosAddRunStepMutation = () =>\n useMutation<{ cosAddRunStep: CosPipelineStep }, { input: CosAddRunStepInput }>(\n COS_ADD_RUN_STEP_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosCreateNotebookMutation = () =>\n useMutation<{ cosCreateNotebook: CosNotebook }, { input: CosCreateNotebookInput }>(\n COS_CREATE_NOTEBOOK_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n }\n );\n\nexport const useCosUpdateNotebookMutation = () =>\n useMutation<{ cosUpdateNotebook: CosNotebook }, { id: string; input: CosUpdateNotebookInput }>(\n COS_UPDATE_NOTEBOOK_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n }\n );\n\nexport const useCosArchiveNotebookMutation = () =>\n useMutation<{ cosArchiveNotebook: boolean }, { id: string }>(COS_ARCHIVE_NOTEBOOK_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n });\n\nexport const useCosRunAnalysisMutation = () =>\n useMutation<{ cosRunAnalysis: CosAnalysis }, { input: CosRunAnalysisInput }>(\n COS_RUN_ANALYSIS_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ANALYSES_QUERY }],\n }\n );\n\nexport const useCosCompleteAnalysisMutation = () =>\n useMutation<\n { cosCompleteAnalysis: CosAnalysis },\n {\n id: string;\n status: Extract<CosAnalysisStatus, 'COMPLETED' | 'FAILED'>;\n results?: Record<string, unknown>;\n outputFileId?: string;\n }\n >(COS_COMPLETE_ANALYSIS_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ANALYSES_QUERY }],\n });\n\nexport const useCosCreateReleaseMutation = () =>\n useMutation<{ cosCreateRelease: CosRelease }, { input: CosCreateReleaseInput }>(\n COS_CREATE_RELEASE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n }\n );\n\nexport const useCosPublishReleaseMutation = () =>\n useMutation<{ cosPublishRelease: CosRelease }, { id: string; doi?: string; mintDoi?: boolean }>(\n COS_PUBLISH_RELEASE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n }\n );\n\nexport const useCosMintDoiMutation = () =>\n useMutation<\n {\n cosMintDoi: {\n id: string;\n doi?: string | null;\n state: string;\n mode: string;\n errorMessage?: string | null;\n mintedAt?: string | null;\n };\n },\n { releaseId: string }\n >(COS_MINT_DOI_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n });\n\nexport const useCosGrantAccessMutation = () =>\n useMutation<{ cosGrantAccess: CosDataAccessGrant }, { input: CosGrantAccessInput }>(\n COS_GRANT_ACCESS_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ACCESS_GRANTS_QUERY }],\n }\n );\n\nexport const useCosRevokeAccessMutation = () =>\n useMutation<{ cosRevokeAccess: CosDataAccessGrant }, { id: string }>(COS_REVOKE_ACCESS_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ACCESS_GRANTS_QUERY }],\n });\n\n// ============================================================================\n// AI DECISION ENGINE OPERATIONS (BOFF-3814)\n// ============================================================================\n\n/**\n * Propose one schema field per dataset column. Writes nothing — accepting a\n * suggestion is the separate, human-pressed `cosAddSchemaField` call.\n */\nexport const COS_AI_PROPOSE_SCHEMA_FIELDS_MUTATION = gql`\n mutation CosAiProposeSchemaFields($datasetId: ID!, $sample: CosSchemaSampleInput) {\n cosAiProposeSchemaFields(datasetId: $datasetId, sample: $sample) {\n datasetId\n sampleOrigin\n sampledRows\n fields {\n name\n fieldType\n unit\n nullable\n position\n description\n provenanceNote\n confidence\n reasons\n sampledValues\n emptyValues\n alreadyDefined\n existingFieldId\n conflicts\n }\n notes\n agentRunId\n engineVersion\n method\n generatedAt\n }\n }\n`;\n\n/**\n * Recommend what to do with a finished run, with rationale + the telemetry it\n * read as evidence. Writes nothing — applying the recommendation is the\n * human-pressed mutation named in `proposedAction`.\n */\nexport const COS_AI_TRIAGE_RUN_MUTATION = gql`\n mutation CosAiTriageRun($runId: ID!) {\n cosAiTriageRun(runId: $runId) {\n runId\n action\n confidence\n rationale\n signals {\n code\n severity\n message\n }\n evidence {\n kind\n refId\n field\n value\n }\n metrics {\n rowsIn\n rowsOut\n anomaliesFlagged\n warnings\n anomalyRate\n rowLossRate\n baselineAnomalyRate\n }\n suggestedParams\n proposedAction {\n mutation\n targetId\n arguments\n description\n }\n agentRunId\n engineVersion\n method\n generatedAt\n }\n }\n`;\n\n/**\n * Draft a release from a notebook. Writes nothing — `cosCreateRelease` and\n * the confirmed `cosPublishRelease` stay human actions.\n */\nexport const COS_AI_DRAFT_RELEASE_MUTATION = gql`\n mutation CosAiDraftRelease($notebookId: ID!) {\n cosAiDraftRelease(notebookId: $notebookId) {\n notebookId\n title\n abstract\n version\n authors\n authorSuggestions {\n actorId\n roles\n contributions\n }\n license\n licenseRationale\n datasetIds\n analysisIds\n warnings\n notes\n agentRunId\n engineVersion\n method\n generatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_SCHEMA_FIELD_MUTATION = gql`\n mutation CosUpdateSchemaField($id: ID!, $input: CosUpdateSchemaFieldInput!) {\n cosUpdateSchemaField(id: $id, input: $input) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_REMOVE_SCHEMA_FIELD_MUTATION = gql`\n mutation CosRemoveSchemaField($id: ID!) {\n cosRemoveSchemaField(id: $id)\n }\n`;\n\nexport const COS_SEMANTIC_SEARCH_QUERY = gql`\n query CosSemanticSearch($input: CosSemanticSearchInput!) {\n cosSemanticSearch(input: $input) {\n query\n interpretedTerms\n expandedTerms\n timeWindow {\n fromYear\n toYear\n }\n total\n hits {\n entityType\n id\n title\n snippet\n score\n dataset {\n id\n name\n status\n accessLevel\n format\n }\n collection {\n id\n name\n }\n release {\n id\n title\n status\n }\n notebook {\n id\n title\n status\n }\n evidence {\n kind\n entityId\n label\n text\n }\n lineage {\n kind\n id\n label\n relation\n parentId\n }\n }\n }\n }\n`;\n\nexport const useCosAiProposeSchemaFieldsMutation = () =>\n useMutation<\n { cosAiProposeSchemaFields: CosSchemaFieldProposal },\n { datasetId: string; sample?: { columns?: string[]; rows: unknown } }\n >(COS_AI_PROPOSE_SCHEMA_FIELDS_MUTATION, { errorPolicy: 'all', onError: onMutationError });\n\nexport const useCosAiTriageRunMutation = () =>\n useMutation<{ cosAiTriageRun: CosRunTriage }, { runId: string }>(COS_AI_TRIAGE_RUN_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n });\n\nexport const useCosAiDraftReleaseMutation = () =>\n useMutation<{ cosAiDraftRelease: CosReleaseDraft }, { notebookId: string }>(\n COS_AI_DRAFT_RELEASE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosUpdateSchemaFieldMutation = () =>\n useMutation<\n { cosUpdateSchemaField: CosSchemaField },\n { id: string; input: CosUpdateSchemaFieldInput }\n >(COS_UPDATE_SCHEMA_FIELD_MUTATION, { errorPolicy: 'all', onError: onMutationError });\n\nexport const useCosRemoveSchemaFieldMutation = () =>\n useMutation<{ cosRemoveSchemaField: boolean }, { id: string }>(COS_REMOVE_SCHEMA_FIELD_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n });\n\nexport const useCosSemanticSearchLazyQuery = () =>\n useLazyQuery<{ cosSemanticSearch: CosSearchResults }, { input: CosSemanticSearchInput }>(\n COS_SEMANTIC_SEARCH_QUERY\n );\n\n// ============================================================================\n// ARCHIVE — MAST mission-specific search (BOFF-5786)\n// ============================================================================\n\nexport type CosArchiveMission =\n | 'HST'\n | 'JWST'\n | 'TESS'\n | 'KEPLER'\n | 'K2'\n | 'PANSTARRS'\n | 'GALEX'\n | 'SWIFT'\n | 'IUE'\n | 'FUSE'\n | 'EUVE'\n | 'SPITZER';\n\nexport interface CosArchiveFilterInput {\n column: string;\n values: string[];\n}\n\nexport interface CosArchiveSearchInput {\n missions?: CosArchiveMission[];\n targetName?: string;\n ra?: number;\n dec?: number;\n radiusDeg?: number;\n filters?: CosArchiveFilterInput[];\n limit?: number;\n page?: number;\n}\n\nexport interface CosArchiveProductsInput {\n productGroupId: string;\n productTypes?: string[];\n limit?: number;\n page?: number;\n}\n\nexport interface CosArchiveColumnValue {\n name: string;\n value: string;\n}\n\nexport interface CosArchiveObservation {\n mission: CosArchiveMission | null;\n missionCollection: string;\n observationId: string;\n productGroupId: string;\n targetName: string | null;\n ra: number | null;\n dec: number | null;\n instrument: string | null;\n filters: string | null;\n dataProductType: string | null;\n calibLevel: number | null;\n proposalId: string | null;\n principalInvestigator: string | null;\n startTimeMjd: number | null;\n exposureSec: number | null;\n dataRights: string | null;\n distanceDeg: number | null;\n previewUri: string | null;\n dataUri: string | null;\n previewUrl: string | null;\n dataFileUrl: string | null;\n extraColumns: CosArchiveColumnValue[];\n}\n\nexport interface CosArchiveSearchResults {\n targetName: string | null;\n ra: number | null;\n dec: number | null;\n radiusDeg: number;\n missions: CosArchiveMission[];\n page: number;\n limit: number;\n observations: CosArchiveObservation[];\n total: number;\n}\n\nexport interface CosArchiveProduct {\n uri: string;\n fileName: string;\n productType: string;\n description: string | null;\n mission: string | null;\n dataProductType: string | null;\n sizeBytes: number | null;\n downloadUrl: string;\n}\n\nexport const COS_ARCHIVE_MISSIONS_QUERY = gql`\n query CosArchiveMissions {\n cosArchiveMissions\n }\n`;\n\nexport const COS_ARCHIVE_SEARCH_QUERY = gql`\n query CosSearchArchive($input: CosArchiveSearchInput!) {\n cosSearchArchive(input: $input) {\n targetName\n ra\n dec\n radiusDeg\n missions\n page\n limit\n total\n observations {\n mission\n missionCollection\n observationId\n productGroupId\n targetName\n ra\n dec\n instrument\n filters\n dataProductType\n calibLevel\n proposalId\n principalInvestigator\n startTimeMjd\n exposureSec\n dataRights\n distanceDeg\n previewUri\n dataUri\n previewUrl\n dataFileUrl\n extraColumns {\n name\n value\n }\n }\n }\n }\n`;\n\nexport const COS_ARCHIVE_PRODUCTS_QUERY = gql`\n query CosListArchiveProducts($input: CosArchiveProductsInput!) {\n cosListArchiveProducts(input: $input) {\n uri\n fileName\n productType\n description\n mission\n dataProductType\n sizeBytes\n downloadUrl\n }\n }\n`;\n\nexport const useCosArchiveMissionsQuery = () =>\n useQuery<{ cosArchiveMissions: CosArchiveMission[] }>(COS_ARCHIVE_MISSIONS_QUERY);\n\nexport const useCosArchiveSearchLazyQuery = () =>\n useLazyQuery<{ cosSearchArchive: CosArchiveSearchResults }, { input: CosArchiveSearchInput }>(\n COS_ARCHIVE_SEARCH_QUERY\n );\n\nexport const useCosArchiveProductsLazyQuery = () =>\n useLazyQuery<{ cosListArchiveProducts: CosArchiveProduct[] }, { input: CosArchiveProductsInput }>(\n COS_ARCHIVE_PRODUCTS_QUERY\n );\n"],"mappings":";;;;AAwBA,IAAMA,KAAmB,MAA2B;CAClD,EAAO,MAAM,wBAAwBC,EAAM,WAAW,mBAAmB;AAC3E;AAgpBgC,CAAG;;;;;AAMnC,IAAaC,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CxBC,IAAoB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDvBC,IAAoB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BvBC,IAAmB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;GAkCtBC,IAAwB,CAAG;;;;;;;;;;;;;;;;;GAmB3BC,IAAuB,CAAG;;;;;;;;;;;;;;;AAgBA,CAAG;;;;;;;;;;;;;;;;;;AAmB1C,IAAaC,IAAsB,CAAG;;;;;;;;;;;;;;;;;;;;;GAuBzBC,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BxBC,IAAiB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;GA0BpBC,KAAgB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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yH,WACXpC,EACE8B,IACA;CAAE,aAAa;CAAO,SAASnH;AAAgB,CACjD,GAEW0H,WACXrC,EAGE+B,IAAkC;CAAE,aAAa;CAAO,SAASpH;AAAgB,CAAC,GAEzE2H,WACXtC,EAA+DgC,IAAkC;CAC/F,aAAa;CACb,SAASrH;AACX,CAAC,GAEU4H,WACXC,EACEP,EACF,GAgGWQ,KAA6B,CAAG;;;;GAMhCC,KAA2B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0C9BC,KAA6B,CAAG;;;;;;;;;;;;;GAehCC,WACX7E,EAAsD0E,EAA0B,GAErEI,WACXL,EACEE,EACF,GAEWI,WACXN,EACEG,EACF"}
|
|
1
|
+
{"version":3,"file":"cosmicApi.js","names":["onMutationError","error","COS_DATASETS_QUERY","COS_DATASET_QUERY","COS_SOURCES_QUERY","COS_SOURCE_QUERY","COS_COLLECTIONS_QUERY","COS_COLLECTION_QUERY","COS_PIPELINES_QUERY","COS_PIPELINE_QUERY","COS_RUNS_QUERY","COS_RUN_QUERY","COS_PIPELINE_FAILED_RUNS_QUERY","COS_DATASET_SUMMARY_QUERY","COS_RUN_STEPS_QUERY","COS_NOTEBOOKS_QUERY","COS_NOTEBOOK_QUERY","COS_ANALYSES_QUERY","COS_ANALYSIS_QUERY","COS_RELEASES_QUERY","COS_RELEASE_QUERY","COS_ACCESS_GRANTS_QUERY","COS_ACTIVITY_BY_RESOURCE_QUERY","COS_CREATE_DATASET_MUTATION","COS_UPDATE_DATASET_MUTATION","COS_PUBLISH_DATASET_MUTATION","COS_ARCHIVE_DATASET_MUTATION","COS_ADD_SCHEMA_FIELD_MUTATION","COS_CREATE_SOURCE_MUTATION","COS_UPDATE_SOURCE_MUTATION","COS_MARK_SOURCE_SYNCED_MUTATION","COS_ARCHIVE_SOURCE_MUTATION","COS_CREATE_COLLECTION_MUTATION","COS_UPDATE_COLLECTION_MUTATION","COS_ARCHIVE_COLLECTION_MUTATION","COS_CREATE_PIPELINE_MUTATION","COS_UPDATE_PIPELINE_MUTATION","COS_ARCHIVE_PIPELINE_MUTATION","COS_START_RUN_MUTATION","COS_TRANSITION_RUN_MUTATION","COS_ADD_RUN_STEP_MUTATION","COS_CREATE_NOTEBOOK_MUTATION","COS_UPDATE_NOTEBOOK_MUTATION","COS_ARCHIVE_NOTEBOOK_MUTATION","COS_RUN_ANALYSIS_MUTATION","COS_COMPLETE_ANALYSIS_MUTATION","COS_CREATE_RELEASE_MUTATION","COS_PUBLISH_RELEASE_MUTATION","COS_MINT_DOI_MUTATION","COS_GRANT_ACCESS_MUTATION","COS_REVOKE_ACCESS_MUTATION","useCosDatasetsQuery","useQuery","useCosDatasetQuery","id","useCosSourcesQuery","useCosSourceQuery","useCosCollectionsQuery","useCosCollectionQuery","COS_RUNNABLE_WORKFLOWS_QUERY","COS_WORKFLOW_DEFINITION_QUERY","useRunnableWorkflowsQuery","useWorkflowDefinitionQuery","useCosPipelinesQuery","useCosPipelineQuery","useCosRunsQuery","useCosRunQuery","useCosRunStepsQuery","runId","useCosPipelineFailedRunsQuery","pipelineId","options","useCosDatasetSummaryQuery","useCosNotebooksQuery","useCosNotebookQuery","useCosAnalysesQuery","useCosReleasesQuery","useCosAnalysisQuery","useCosReleaseQuery","useCosAccessGrantsQuery","useCosResourceActivityQuery","params","workspaceId","resourceId","useCosCreateDatasetMutation","useMutation","useCosUpdateDatasetMutation","useCosPublishDatasetMutation","useCosArchiveDatasetMutation","useCosAddSchemaFieldMutation","useCosCreateSourceMutation","useCosUpdateSourceMutation","useCosMarkSourceSyncedMutation","useCosArchiveSourceMutation","useCosCreateCollectionMutation","useCosUpdateCollectionMutation","useCosArchiveCollectionMutation","useCosCreatePipelineMutation","useCosUpdatePipelineMutation","useCosArchivePipelineMutation","useCosStartRunMutation","useCosTransitionRunMutation","useCosAddRunStepMutation","useCosCreateNotebookMutation","useCosUpdateNotebookMutation","useCosArchiveNotebookMutation","useCosRunAnalysisMutation","useCosCompleteAnalysisMutation","useCosCreateReleaseMutation","useCosPublishReleaseMutation","useCosMintDoiMutation","useCosGrantAccessMutation","useCosRevokeAccessMutation","COS_AI_PROPOSE_SCHEMA_FIELDS_MUTATION","COS_AI_TRIAGE_RUN_MUTATION","COS_AI_DRAFT_RELEASE_MUTATION","COS_UPDATE_SCHEMA_FIELD_MUTATION","COS_REMOVE_SCHEMA_FIELD_MUTATION","COS_SEMANTIC_SEARCH_QUERY","useCosAiProposeSchemaFieldsMutation","useCosAiTriageRunMutation","useCosAiDraftReleaseMutation","useCosUpdateSchemaFieldMutation","useCosRemoveSchemaFieldMutation","useCosSemanticSearchLazyQuery","useLazyQuery","COS_ARCHIVE_MISSIONS_QUERY","COS_ARCHIVE_SEARCH_QUERY","COS_ARCHIVE_PRODUCTS_QUERY","useCosArchiveMissionsQuery","useCosArchiveSearchLazyQuery","useCosArchiveProductsLazyQuery"],"sources":["../../../src/cosmicintersection/api/cosmicApi.ts"],"sourcesContent":["/**\n * cosmicApi — hand-written typed data layer for the CosmicIntersection MFE.\n *\n * Mirrors the pattern in microfe-eventfullymanaged's eventApi.ts: inline `gql`\n * documents + `@apollo/client/react` hooks, with hand-written response/variables\n * types that track the wspace-cosmicintersection-svc subgraph SDL exactly. The\n * Apollo client is provided by the HOST app shell via React context (integrated\n * mode) — this module never constructs a client. Every `cos*` operation runs on\n * the workspace gateway (the default client in context).\n *\n * Scalar mapping: BigInt -> string, JSON -> Record<string, unknown>,\n * DateTime -> string (ISO).\n */\nimport { gql, type ErrorLike } from '@apollo/client';\nimport { useLazyQuery, useMutation, useQuery } from '@apollo/client/react';\n\nimport { notify } from '../lib/toast';\n\n/**\n * Shared mutation error sink. The gateway client runs with `errorPolicy: 'all'`,\n * so in-band GraphQL errors also invoke `onError`; wiring this on every write\n * mutation guarantees a failure is always surfaced to the user even if a caller\n * forgets to inspect the resolved result.\n */\nconst onMutationError = (error: ErrorLike): void => {\n notify.error('Something went wrong', error.message || 'Please try again.');\n};\n\n// ============================================================================\n// ENUMS (string-literal unions — exact SDL values)\n// ============================================================================\n\nexport type CosDatasetStatus = 'DRAFT' | 'INGESTING' | 'AVAILABLE' | 'DEPRECATED' | 'ARCHIVED';\nexport type CosAccessLevel = 'PUBLIC' | 'WORKSPACE' | 'RESTRICTED' | 'EMBARGOED';\nexport type CosSourceType =\n | 'TELESCOPE'\n | 'SATELLITE'\n | 'GROUND_SENSOR'\n | 'ARCHIVE'\n | 'API'\n | 'STREAM'\n | 'FILE_DROP'\n | 'SIMULATION';\nexport type CosSourceStatus =\n 'CONFIGURING' | 'CONNECTED' | 'SYNCING' | 'DEGRADED' | 'ERROR' | 'DISABLED';\nexport type CosFieldType =\n | 'STRING'\n | 'INTEGER'\n | 'FLOAT'\n | 'BOOLEAN'\n | 'TIMESTAMP'\n | 'COORDINATE'\n | 'SPECTRUM'\n | 'GEOMETRY'\n | 'IMAGE_REF'\n | 'JSON';\nexport type CosPipelineStatus = 'DRAFT' | 'ACTIVE' | 'PAUSED' | 'ARCHIVED';\nexport type CosRunStatus = 'QUEUED' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED';\n/**\n * Full SDL vocabulary. The four geospatial kinds are recognised values a step\n * can already carry (BOFF-4355) — only RASTER_CALC has an execution backend, so\n * they are readable/renderable but are deliberately not offered as authoring\n * options in the add-step form.\n */\nexport type CosStepKind =\n | 'INGEST'\n | 'CALIBRATE'\n | 'TRANSFORM'\n | 'ANALYZE'\n | 'EXPORT'\n | 'NOTIFY'\n | 'RASTER_CALC'\n | 'REPROJECT'\n | 'TILE'\n | 'ZONAL_STATS';\nexport type CosNotebookStatus = 'DRAFT' | 'RUNNING' | 'PUBLISHED' | 'ARCHIVED';\nexport type CosAnalysisStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';\nexport type CosReleaseStatus = 'DRAFT' | 'UNDER_REVIEW' | 'PUBLISHED' | 'RETRACTED';\nexport type CosGrantStatus = 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'REVOKED';\n\n// ============================================================================\n// AI DECISION ENGINE (BOFF-3781 / BOFF-3814) — proposals, never writes.\n// \"AI proposes; scientists review.\" Every cosAi* operation returns a proposal\n// the human accepts through the named domain mutation; nothing here mutates a\n// domain entity. Types mirror wspace-cosmicintersection-svc's ai.gql exactly.\n// ============================================================================\n\nexport type CosTriageAction =\n | 'PROMOTE'\n | 'RERUN_WITH_PARAMS'\n | 'QUARANTINE_DATASET'\n | 'FLAG_SOURCE_DEGRADED'\n | 'INSUFFICIENT_TELEMETRY';\n\nexport type CosTriageSignalSeverity = 'INFO' | 'WARNING' | 'CRITICAL';\nexport type CosTriageEvidenceKind = 'RUN' | 'RUN_METRIC' | 'STEP' | 'SOURCE' | 'BASELINE';\nexport type CosSearchEntityType = 'DATASET' | 'COLLECTION' | 'RELEASE' | 'NOTEBOOK';\nexport type CosSearchEvidenceKind =\n | 'DATASET_TEXT'\n | 'SCHEMA_FIELD'\n | 'SCHEMA_PROVENANCE'\n | 'COVERAGE'\n | 'COVERAGE_WINDOW'\n | 'SOURCE'\n | 'COLLECTION'\n | 'RELEASE_ABSTRACT'\n | 'ANALYSIS_METHOD'\n | 'NOTEBOOK';\nexport type CosSearchLineageKind =\n 'SOURCE' | 'PIPELINE_RUN' | 'PIPELINE_STEP' | 'ANALYSIS' | 'RELEASE';\n\nexport interface CosSchemaFieldSuggestion {\n name: string;\n fieldType: CosFieldType;\n unit?: string | null;\n nullable: boolean;\n position: number;\n description?: string | null;\n /** Drafted provenance note: where the column came from and why it was typed so. */\n provenanceNote: string;\n confidence: number;\n reasons: string[];\n sampledValues: number;\n emptyValues: number;\n /** True when the dataset already defines this name — it is never overwritten. */\n alreadyDefined: boolean;\n existingFieldId?: string | null;\n conflicts: string[];\n}\n\nexport interface CosSchemaFieldProposal {\n datasetId: string;\n sampleOrigin: 'REQUEST' | 'DATASET_CONTEXT' | 'SOURCE_CONFIG';\n sampledRows: number;\n fields: CosSchemaFieldSuggestion[];\n notes: string[];\n /** Id of this run in the shared AI invocation ledger. */\n agentRunId: string;\n engineVersion: string;\n method: string;\n generatedAt: string;\n}\n\nexport interface CosTriageSignal {\n code: string;\n severity: CosTriageSignalSeverity;\n message: string;\n}\n\nexport interface CosTriageEvidence {\n kind: CosTriageEvidenceKind;\n refId: string;\n field: string;\n value: string;\n}\n\nexport interface CosRunTriageMetrics {\n rowsIn?: number | null;\n rowsOut?: number | null;\n anomaliesFlagged?: number | null;\n warnings?: number | null;\n anomalyRate?: number | null;\n rowLossRate?: number | null;\n baselineAnomalyRate?: number | null;\n}\n\nexport interface CosTriageProposedAction {\n /** Name of the existing mutation a person would run; triage never runs it. */\n mutation: string;\n targetId: string;\n arguments: Record<string, unknown>;\n description: string;\n}\n\nexport interface CosRunTriage {\n runId: string;\n action: CosTriageAction;\n confidence: number;\n rationale: string;\n signals: CosTriageSignal[];\n evidence: CosTriageEvidence[];\n metrics: CosRunTriageMetrics;\n suggestedParams?: Record<string, unknown> | null;\n proposedAction?: CosTriageProposedAction | null;\n agentRunId: string;\n engineVersion: string;\n method: string;\n generatedAt: string;\n}\n\nexport interface CosReleaseAuthorSuggestion {\n actorId: string;\n roles: string[];\n contributions: number;\n}\n\nexport interface CosReleaseDraft {\n notebookId: string;\n title: string;\n abstract: string;\n version: string;\n authors: string[];\n authorSuggestions: CosReleaseAuthorSuggestion[];\n license: string;\n licenseRationale: string;\n datasetIds: string[];\n analysisIds: string[];\n warnings: string[];\n notes: string[];\n agentRunId: string;\n engineVersion: string;\n method: string;\n generatedAt: string;\n}\n\nexport interface CosSearchEvidence {\n kind: CosSearchEvidenceKind;\n entityId?: string | null;\n label?: string | null;\n text: string;\n}\n\nexport interface CosSearchLineageNode {\n kind: CosSearchLineageKind;\n id: string;\n label: string;\n relation: string;\n parentId?: string | null;\n}\n\nexport interface CosSearchHit {\n entityType: CosSearchEntityType;\n id: string;\n title: string;\n snippet?: string | null;\n score: number;\n dataset?: CosDataset | null;\n collection?: CosCollection | null;\n release?: CosRelease | null;\n notebook?: CosNotebook | null;\n evidence: CosSearchEvidence[];\n lineage: CosSearchLineageNode[];\n}\n\nexport interface CosSearchResults {\n query: string;\n interpretedTerms: string[];\n expandedTerms: string[];\n timeWindow?: { fromYear: number; toYear: number } | null;\n hits: CosSearchHit[];\n total: number;\n}\n\nexport interface CosSemanticSearchInput {\n query: string;\n entityTypes?: CosSearchEntityType[];\n limit?: number;\n includeLineage?: boolean;\n}\n\nexport interface CosUpdateSchemaFieldInput {\n name?: string;\n fieldType?: CosFieldType;\n unit?: string;\n description?: string;\n nullable?: boolean;\n position?: number;\n provenance?: string;\n}\n\n// ============================================================================\n// ENTITY TYPES\n// ============================================================================\n\n/** Federated wspace-files File stub — only `{ id }` is resolvable in this subgraph. */\nexport interface CosFileRef {\n id: string;\n}\n\n/** An entity selected id-only, where the operation needs its existence, not its body. */\nexport interface CosIdRef {\n id: string;\n}\n\n/**\n * Per-parent cap the subgraph applies to every relation field\n * (`capPerGroup(rows, key, DEFAULT_LIMIT)` in wspace-cosmicintersection-svc's\n * dataloaders — DEFAULT_LIMIT is 50).\n *\n * A relation array of exactly this length means \"at least this many\", NOT an\n * exact total: render it as `50+`, never as a precise count.\n */\nexport const COS_RELATION_PAGE_SIZE = 50;\n\nexport interface CosSchemaField {\n id: string;\n workspaceId: string;\n datasetId: string;\n name: string;\n fieldType: CosFieldType;\n unit?: string | null;\n description?: string | null;\n nullable: boolean;\n position: number;\n provenance?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosDataset {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n status: CosDatasetStatus;\n accessLevel: CosAccessLevel;\n format?: string | null;\n sourceId?: string | null;\n collectionId?: string | null;\n /** BigInt returned as a numeric string. */\n rowCount: string;\n /** BigInt returned as a numeric string. */\n sizeBytes: string;\n version: number;\n lineageCaptured: boolean;\n coverage?: Record<string, unknown> | null;\n ingestedAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relations — only present when the operation selects them (detail queries).\n source?: CosSource | null;\n collection?: CosCollection | null;\n file?: CosFileRef | null;\n schemaFields?: CosSchemaField[];\n}\n\nexport interface CosSource {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n type: CosSourceType;\n status: CosSourceStatus;\n endpoint?: string | null;\n config?: Record<string, unknown> | null;\n lastSyncedAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n datasets?: CosDataset[];\n}\n\nexport interface CosCollection {\n id: string;\n workspaceId: string;\n name: string;\n slug?: string | null;\n description?: string | null;\n isPublic: boolean;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n datasets?: CosDataset[];\n}\n\nexport interface CosPipeline {\n id: string;\n workspaceId: string;\n name: string;\n description?: string | null;\n status: CosPipelineStatus;\n /** Ordered science steps (CosStepKind vocabulary). Orchestration lives in the linked canonical workflow. */\n steps?: Record<string, unknown> | null;\n /** Opaque canonical WorkflowDefinition id (wspace-workflow-svc); null = manual runs only. */\n workflowDefinitionId?: string | null;\n lastRunAt?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relation — present only on detail queries.\n runs?: CosPipelineRun[];\n}\n\nexport interface CosPipelineRun {\n id: string;\n workspaceId: string;\n pipelineId: string;\n runNumber: number;\n status: CosRunStatus;\n datasetId?: string | null;\n /** Opaque canonical WorkflowRun id (wspace-workflow-svc) when the pipeline is automated. */\n workflowRunId?: string | null;\n params?: Record<string, unknown> | null;\n metrics?: Record<string, unknown> | null;\n triggeredBy?: string | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n durationMs?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n // Relations — present only on detail queries.\n pipeline?: CosPipeline | null;\n steps?: CosPipelineStep[];\n}\n\nexport interface CosPipelineStep {\n id: string;\n workspaceId: string;\n runId: string;\n name: string;\n kind: CosStepKind;\n position: number;\n status: CosRunStatus;\n inputs?: Record<string, unknown> | null;\n outputs?: Record<string, unknown> | null;\n logsRef?: string | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n durationMs?: number | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosNotebook {\n id: string;\n workspaceId: string;\n title: string;\n description?: string | null;\n status: CosNotebookStatus;\n runtime?: string | null;\n environment?: Record<string, unknown> | null;\n datasetIds: string[];\n isShared: boolean;\n shareSlug?: string | null;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n // Relations — present only on detail queries.\n file?: CosFileRef | null;\n analyses?: CosAnalysis[];\n releases?: CosRelease[];\n}\n\nexport interface CosAnalysis {\n id: string;\n workspaceId: string;\n title: string;\n status: CosAnalysisStatus;\n method?: string | null;\n aiAssisted: boolean;\n notebookId?: string | null;\n datasetId?: string | null;\n results?: Record<string, unknown> | null;\n outputFile?: CosFileRef | null;\n startedAt?: string | null;\n finishedAt?: string | null;\n errorMessage?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosRelease {\n id: string;\n workspaceId: string;\n title: string;\n version: string;\n status: CosReleaseStatus;\n abstract?: string | null;\n authors: string[];\n datasetIds: string[];\n notebookId?: string | null;\n doi?: string | null;\n license?: string | null;\n publishedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface CosDataAccessGrant {\n id: string;\n workspaceId: string;\n datasetId: string;\n granteeId: string;\n status: CosGrantStatus;\n scopes: string[];\n reason?: string | null;\n grantedAt?: string | null;\n expiresAt?: string | null;\n revokedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ============================================================================\n// PAGINATION / CONNECTIONS\n// ============================================================================\n\nexport interface CosPageInfo {\n hasMore: boolean;\n cursor?: string | null;\n}\n\nexport interface CosConnection<T> {\n items: T[];\n pageInfo: CosPageInfo;\n}\n\n/** Offset-based pagination input (PaginationInput in the SDL; limit defaults to 50). */\nexport interface CosPaginationInput {\n limit?: number;\n offset?: number;\n cursor?: string;\n}\n\n// ============================================================================\n// INPUT TYPES\n// ============================================================================\n\nexport interface CosCreateDatasetInput {\n name: string;\n description?: string;\n status?: CosDatasetStatus;\n accessLevel?: CosAccessLevel;\n format?: string;\n sourceId?: string;\n collectionId?: string;\n fileId?: string;\n coverage?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdateDatasetInput {\n name?: string;\n description?: string;\n accessLevel?: CosAccessLevel;\n format?: string;\n collectionId?: string;\n coverage?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosAddSchemaFieldInput {\n datasetId: string;\n name: string;\n fieldType?: CosFieldType;\n unit?: string;\n description?: string;\n nullable?: boolean;\n position?: number;\n provenance?: string;\n}\n\nexport interface CosCreateSourceInput {\n name: string;\n type?: CosSourceType;\n status?: CosSourceStatus;\n description?: string;\n endpoint?: string;\n credentialRef?: string;\n config?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosUpdateSourceInput {\n name?: string;\n type?: CosSourceType;\n status?: CosSourceStatus;\n description?: string;\n endpoint?: string;\n credentialRef?: string;\n config?: Record<string, unknown>;\n tags?: string[];\n}\n\nexport interface CosCreateCollectionInput {\n name: string;\n slug?: string;\n description?: string;\n isPublic?: boolean;\n tags?: string[];\n}\n\n/** All fields optional — only the provided keys are updated (CosUpdateCollectionInput in the SDL). */\nexport interface CosUpdateCollectionInput {\n name?: string;\n slug?: string;\n description?: string;\n isPublic?: boolean;\n tags?: string[];\n}\n\nexport interface CosCreatePipelineInput {\n name: string;\n description?: string;\n /** Ordered science steps (CosStepKind vocabulary). */\n steps?: Record<string, unknown>;\n /** Optional canonical WorkflowDefinition id (wspace-workflow-svc) for real automation. */\n workflowDefinitionId?: string;\n tags?: string[];\n}\n\nexport interface CosUpdatePipelineInput {\n name?: string;\n description?: string;\n status?: CosPipelineStatus;\n steps?: Record<string, unknown>;\n /** Send null to unlink the canonical workflow. */\n workflowDefinitionId?: string | null;\n tags?: string[];\n}\n\nexport interface CosStartRunInput {\n pipelineId: string;\n datasetId?: string;\n params?: Record<string, unknown>;\n}\n\nexport interface CosAddRunStepInput {\n runId: string;\n name: string;\n kind?: CosStepKind;\n inputs?: Record<string, unknown>;\n position?: number;\n}\n\nexport interface CosCreateNotebookInput {\n title: string;\n description?: string;\n runtime?: string;\n environment?: Record<string, unknown>;\n datasetIds?: string[];\n fileId?: string;\n tags?: string[];\n}\n\nexport interface CosUpdateNotebookInput {\n title?: string;\n description?: string;\n status?: CosNotebookStatus;\n runtime?: string;\n environment?: Record<string, unknown>;\n datasetIds?: string[];\n isShared?: boolean;\n shareSlug?: string;\n tags?: string[];\n}\n\nexport interface CosRunAnalysisInput {\n title: string;\n method?: string;\n aiAssisted?: boolean;\n notebookId?: string;\n datasetId?: string;\n}\n\nexport interface CosCreateReleaseInput {\n title: string;\n version?: string;\n abstract?: string;\n authors?: string[];\n datasetIds?: string[];\n notebookId?: string;\n license?: string;\n}\n\nexport interface CosGrantAccessInput {\n datasetId: string;\n granteeId: string;\n scopes?: string[];\n reason?: string;\n expiresAt?: string;\n}\n\n// ============================================================================\n// GQL DOCUMENTS — QUERIES\n// ============================================================================\n\nexport const COS_HEALTH_QUERY = gql`\n query CosHealth {\n cosHealth\n }\n`;\n\nexport const COS_DATASETS_QUERY = gql`\n query CosListDatasets(\n $q: String\n $accessLevel: CosAccessLevel\n $format: String\n $collectionId: ID\n $sourceId: ID\n $status: CosDatasetStatus\n $pagination: PaginationInput\n ) {\n cosListDatasets(\n q: $q\n accessLevel: $accessLevel\n format: $format\n collectionId: $collectionId\n sourceId: $sourceId\n status: $status\n pagination: $pagination\n ) {\n items {\n id\n workspaceId\n name\n description\n status\n accessLevel\n format\n sourceId\n collectionId\n rowCount\n sizeBytes\n version\n lineageCaptured\n ingestedAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_DATASET_QUERY = gql`\n query CosDataset($id: ID!) {\n cosDataset(id: $id) {\n id\n workspaceId\n name\n description\n status\n accessLevel\n format\n sourceId\n collectionId\n rowCount\n sizeBytes\n version\n lineageCaptured\n coverage\n ingestedAt\n tags\n createdAt\n updatedAt\n file {\n id\n }\n source {\n id\n name\n type\n status\n }\n collection {\n id\n name\n slug\n }\n schemaFields {\n id\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n }\n`;\n\nexport const COS_SOURCES_QUERY = gql`\n query CosListSources(\n $type: CosSourceType\n $status: CosSourceStatus\n $pagination: PaginationInput\n ) {\n cosListSources(type: $type, status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n name\n description\n type\n status\n endpoint\n config\n lastSyncedAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_SOURCE_QUERY = gql`\n query CosSource($id: ID!) {\n cosSource(id: $id) {\n id\n workspaceId\n name\n description\n type\n status\n endpoint\n config\n lastSyncedAt\n tags\n createdAt\n updatedAt\n datasets {\n id\n name\n status\n accessLevel\n rowCount\n updatedAt\n }\n }\n }\n`;\n\n/**\n * `datasets` is selected id-only so each card can show how many datasets the\n * collection holds. The subgraph resolves it through `collectionDatasetsLoader`\n * (one batched query for the whole page) and filters to the datasets THIS actor\n * may read, so the length is the caller's visible count — capped at\n * `COS_RELATION_PAGE_SIZE`.\n */\nexport const COS_COLLECTIONS_QUERY = gql`\n query CosListCollections {\n cosListCollections {\n id\n workspaceId\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n datasets {\n id\n }\n }\n }\n`;\n\nexport const COS_COLLECTION_QUERY = gql`\n query CosCollection($id: ID!) {\n cosCollection(id: $id) {\n id\n workspaceId\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_SCHEMA_FIELDS_QUERY = gql`\n query CosListSchemaFields($datasetId: ID!) {\n cosListSchemaFields(datasetId: $datasetId) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_PIPELINES_QUERY = gql`\n query CosListPipelines($status: CosPipelineStatus, $pagination: PaginationInput) {\n cosListPipelines(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n name\n description\n status\n workflowDefinitionId\n lastRunAt\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_PIPELINE_QUERY = gql`\n query CosPipeline($id: ID!) {\n cosPipeline(id: $id) {\n id\n workspaceId\n name\n description\n status\n steps\n workflowDefinitionId\n lastRunAt\n tags\n createdAt\n updatedAt\n runs {\n id\n runNumber\n status\n datasetId\n workflowRunId\n startedAt\n finishedAt\n durationMs\n createdAt\n }\n }\n }\n`;\n\nexport const COS_RUNS_QUERY = gql`\n query CosListRuns($pipelineId: ID, $status: CosRunStatus, $pagination: PaginationInput) {\n cosListRuns(pipelineId: $pipelineId, status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n pipelineId\n runNumber\n status\n datasetId\n triggeredBy\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_RUN_QUERY = gql`\n query CosRun($id: ID!) {\n cosRun(id: $id) {\n id\n workspaceId\n pipelineId\n runNumber\n status\n datasetId\n workflowRunId\n params\n metrics\n triggeredBy\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n pipeline {\n id\n name\n status\n workflowDefinitionId\n }\n steps {\n id\n runId\n name\n kind\n position\n status\n startedAt\n finishedAt\n durationMs\n errorMessage\n }\n }\n }\n`;\n\n/**\n * Other FAILED runs of the same pipeline, newest first, each with its steps so\n * the caller can name the step that broke. `steps` resolves through\n * `pipelineRunStepsLoader`, so the whole list costs one extra batched query.\n */\nexport const COS_PIPELINE_FAILED_RUNS_QUERY = gql`\n query CosPipelineFailedRuns($pipelineId: ID!, $pagination: PaginationInput) {\n cosListRuns(pipelineId: $pipelineId, status: FAILED, pagination: $pagination) {\n items {\n id\n workspaceId\n pipelineId\n runNumber\n status\n errorMessage\n startedAt\n finishedAt\n createdAt\n updatedAt\n steps {\n id\n runId\n name\n kind\n position\n status\n errorMessage\n }\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\n/**\n * Minimal dataset lookup — resolves an id held on another entity (e.g.\n * `CosPipelineRun.datasetId`, which the SDL exposes as a bare ID with no\n * relation field) to something a human can read. Returns null when the caller\n * has no read access to that dataset, so callers must fall back to the id.\n */\nexport const COS_DATASET_SUMMARY_QUERY = gql`\n query CosDatasetSummary($id: ID!) {\n cosDataset(id: $id) {\n id\n name\n status\n accessLevel\n }\n }\n`;\n\nexport const COS_RUN_STEPS_QUERY = gql`\n query CosListRunSteps($runId: ID!) {\n cosListRunSteps(runId: $runId) {\n id\n workspaceId\n runId\n name\n kind\n position\n status\n inputs\n outputs\n logsRef\n startedAt\n finishedAt\n durationMs\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_NOTEBOOKS_QUERY = gql`\n query CosListNotebooks($status: CosNotebookStatus, $pagination: PaginationInput) {\n cosListNotebooks(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n title\n description\n status\n runtime\n datasetIds\n isShared\n shareSlug\n tags\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\nexport const COS_NOTEBOOK_QUERY = gql`\n query CosNotebook($id: ID!) {\n cosNotebook(id: $id) {\n id\n workspaceId\n title\n description\n status\n runtime\n environment\n datasetIds\n isShared\n shareSlug\n tags\n createdAt\n updatedAt\n file {\n id\n }\n analyses {\n id\n title\n status\n aiAssisted\n method\n createdAt\n }\n releases {\n id\n title\n version\n status\n publishedAt\n }\n }\n }\n`;\n\nexport const COS_ANALYSES_QUERY = gql`\n query CosListAnalyses($datasetId: ID, $notebookId: ID, $status: CosAnalysisStatus) {\n cosListAnalyses(datasetId: $datasetId, notebookId: $notebookId, status: $status) {\n id\n workspaceId\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n results\n outputFile {\n id\n }\n startedAt\n finishedAt\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\n/**\n * One analysis by id, independent of list paging and filters; the analyses\n * page falls back to it when the `?id=` analysis is not in the loaded list.\n */\nexport const COS_ANALYSIS_QUERY = gql`\n query CosAnalysis($id: ID!) {\n cosAnalysis(id: $id) {\n id\n workspaceId\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n results\n outputFile {\n id\n }\n startedAt\n finishedAt\n errorMessage\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_RELEASES_QUERY = gql`\n query CosListReleases($status: CosReleaseStatus, $pagination: PaginationInput) {\n cosListReleases(status: $status, pagination: $pagination) {\n items {\n id\n workspaceId\n title\n version\n status\n abstract\n authors\n datasetIds\n notebookId\n doi\n license\n publishedAt\n createdAt\n updatedAt\n }\n pageInfo {\n hasMore\n cursor\n }\n }\n }\n`;\n\n/**\n * One release by id, independent of list paging and filters. The releases page\n * falls back to it when the `?id=` release is not on the loaded list page, so a\n * deep link or a command-palette Recent entry always reopens the release.\n */\nexport const COS_RELEASE_QUERY = gql`\n query CosRelease($id: ID!) {\n cosRelease(id: $id) {\n id\n workspaceId\n title\n version\n status\n abstract\n authors\n datasetIds\n notebookId\n doi\n license\n publishedAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ACCESS_GRANTS_QUERY = gql`\n query CosListAccessGrants($datasetId: ID, $status: CosGrantStatus) {\n cosListAccessGrants(datasetId: $datasetId, status: $status) {\n id\n workspaceId\n datasetId\n granteeId\n status\n scopes\n reason\n grantedAt\n expiresAt\n revokedAt\n createdAt\n updatedAt\n }\n }\n`;\n\n// ============================================================================\n// PLATFORM REUSE — activity feed (wspace-activity-svc, federated on the\n// workspace supergraph). The cos mutation-audit plugin already writes these\n// ActivityLog rows via be-sdk `trackOperation`; this is the read surface,\n// scoped to a single cos entity by `resourceId`. Only scalar fields are\n// selected so no cross-subgraph entity resolution is required.\n// ============================================================================\n\nexport const COS_ACTIVITY_BY_RESOURCE_QUERY = gql`\n query CosResourceActivity($filter: ActivityLogFilter) {\n getActivities(filter: $filter) {\n id\n action\n description\n resourceType\n resourceId\n userId\n timestamp\n }\n }\n`;\n\n// ============================================================================\n// GQL DOCUMENTS — MUTATIONS\n// ============================================================================\n\nexport const COS_CREATE_DATASET_MUTATION = gql`\n mutation CosCreateDataset($input: CosCreateDatasetInput!) {\n cosCreateDataset(input: $input) {\n id\n name\n status\n accessLevel\n sourceId\n collectionId\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_DATASET_MUTATION = gql`\n mutation CosUpdateDataset($id: ID!, $input: CosUpdateDatasetInput!) {\n cosUpdateDataset(id: $id, input: $input) {\n id\n name\n description\n status\n accessLevel\n format\n collectionId\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_PUBLISH_DATASET_MUTATION = gql`\n mutation CosPublishDataset($id: ID!) {\n cosPublishDataset(id: $id) {\n id\n status\n ingestedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_DATASET_MUTATION = gql`\n mutation CosArchiveDataset($id: ID!) {\n cosArchiveDataset(id: $id)\n }\n`;\n\nexport const COS_ADD_SCHEMA_FIELD_MUTATION = gql`\n mutation CosAddSchemaField($input: CosAddSchemaFieldInput!) {\n cosAddSchemaField(input: $input) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_SOURCE_MUTATION = gql`\n mutation CosCreateSource($input: CosCreateSourceInput!) {\n cosCreateSource(input: $input) {\n id\n name\n type\n status\n endpoint\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_SOURCE_MUTATION = gql`\n mutation CosUpdateSource($id: ID!, $input: CosUpdateSourceInput!) {\n cosUpdateSource(id: $id, input: $input) {\n id\n name\n description\n type\n status\n endpoint\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_MARK_SOURCE_SYNCED_MUTATION = gql`\n mutation CosMarkSourceSynced($id: ID!) {\n cosMarkSourceSynced(id: $id) {\n id\n status\n lastSyncedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_SOURCE_MUTATION = gql`\n mutation CosArchiveSource($id: ID!) {\n cosArchiveSource(id: $id)\n }\n`;\n\nexport const COS_CREATE_COLLECTION_MUTATION = gql`\n mutation CosCreateCollection($input: CosCreateCollectionInput!) {\n cosCreateCollection(input: $input) {\n id\n name\n slug\n description\n isPublic\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_COLLECTION_MUTATION = gql`\n mutation CosUpdateCollection($id: ID!, $input: CosUpdateCollectionInput!) {\n cosUpdateCollection(id: $id, input: $input) {\n id\n name\n slug\n description\n isPublic\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_COLLECTION_MUTATION = gql`\n mutation CosArchiveCollection($id: ID!) {\n cosArchiveCollection(id: $id)\n }\n`;\n\nexport const COS_CREATE_PIPELINE_MUTATION = gql`\n mutation CosCreatePipeline($input: CosCreatePipelineInput!) {\n cosCreatePipeline(input: $input) {\n id\n name\n status\n workflowDefinitionId\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_PIPELINE_MUTATION = gql`\n mutation CosUpdatePipeline($id: ID!, $input: CosUpdatePipelineInput!) {\n cosUpdatePipeline(id: $id, input: $input) {\n id\n name\n description\n status\n workflowDefinitionId\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_PIPELINE_MUTATION = gql`\n mutation CosArchivePipeline($id: ID!) {\n cosArchivePipeline(id: $id)\n }\n`;\n\nexport const COS_START_RUN_MUTATION = gql`\n mutation CosStartRun($input: CosStartRunInput!) {\n cosStartRun(input: $input) {\n id\n pipelineId\n runNumber\n status\n datasetId\n workflowRunId\n errorMessage\n startedAt\n createdAt\n }\n }\n`;\n\nexport const COS_TRANSITION_RUN_MUTATION = gql`\n mutation CosTransitionRun($id: ID!, $status: CosRunStatus!) {\n cosTransitionRun(id: $id, status: $status) {\n id\n status\n startedAt\n finishedAt\n durationMs\n updatedAt\n }\n }\n`;\n\nexport const COS_ADD_RUN_STEP_MUTATION = gql`\n mutation CosAddRunStep($input: CosAddRunStepInput!) {\n cosAddRunStep(input: $input) {\n id\n runId\n name\n kind\n position\n status\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_NOTEBOOK_MUTATION = gql`\n mutation CosCreateNotebook($input: CosCreateNotebookInput!) {\n cosCreateNotebook(input: $input) {\n id\n title\n status\n runtime\n datasetIds\n tags\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_NOTEBOOK_MUTATION = gql`\n mutation CosUpdateNotebook($id: ID!, $input: CosUpdateNotebookInput!) {\n cosUpdateNotebook(id: $id, input: $input) {\n id\n title\n description\n status\n runtime\n datasetIds\n isShared\n shareSlug\n tags\n updatedAt\n }\n }\n`;\n\nexport const COS_ARCHIVE_NOTEBOOK_MUTATION = gql`\n mutation CosArchiveNotebook($id: ID!) {\n cosArchiveNotebook(id: $id)\n }\n`;\n\nexport const COS_RUN_ANALYSIS_MUTATION = gql`\n mutation CosRunAnalysis($input: CosRunAnalysisInput!) {\n cosRunAnalysis(input: $input) {\n id\n title\n status\n method\n aiAssisted\n notebookId\n datasetId\n startedAt\n createdAt\n }\n }\n`;\n\nexport const COS_COMPLETE_ANALYSIS_MUTATION = gql`\n mutation CosCompleteAnalysis(\n $id: ID!\n $status: CosAnalysisStatus!\n $results: JSON\n $outputFileId: ID\n ) {\n cosCompleteAnalysis(id: $id, status: $status, results: $results, outputFileId: $outputFileId) {\n id\n status\n results\n finishedAt\n errorMessage\n outputFile {\n id\n }\n updatedAt\n }\n }\n`;\n\nexport const COS_CREATE_RELEASE_MUTATION = gql`\n mutation CosCreateRelease($input: CosCreateReleaseInput!) {\n cosCreateRelease(input: $input) {\n id\n title\n version\n status\n authors\n datasetIds\n notebookId\n license\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_PUBLISH_RELEASE_MUTATION = gql`\n mutation CosPublishRelease($id: ID!, $doi: String, $mintDoi: Boolean) {\n cosPublishRelease(id: $id, doi: $doi, mintDoi: $mintDoi) {\n id\n status\n doi\n publishedAt\n updatedAt\n }\n }\n`;\n\nexport const COS_MINT_DOI_MUTATION = gql`\n mutation CosMintDoi($releaseId: ID!) {\n cosMintDoi(releaseId: $releaseId) {\n id\n doi\n state\n mode\n errorMessage\n mintedAt\n }\n }\n`;\n\nexport const COS_GRANT_ACCESS_MUTATION = gql`\n mutation CosGrantAccess($input: CosGrantAccessInput!) {\n cosGrantAccess(input: $input) {\n id\n datasetId\n granteeId\n status\n scopes\n reason\n grantedAt\n expiresAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_REVOKE_ACCESS_MUTATION = gql`\n mutation CosRevokeAccess($id: ID!) {\n cosRevokeAccess(id: $id) {\n id\n status\n revokedAt\n updatedAt\n }\n }\n`;\n\n// ============================================================================\n// RESPONSE / VARIABLES TYPES\n// ============================================================================\n\nexport interface CosHealthQueryData {\n cosHealth: string;\n}\n\nexport interface CosDatasetsQueryData {\n cosListDatasets: CosConnection<CosDataset>;\n}\nexport interface CosDatasetsQueryVars {\n /** Full-text search across dataset name/description/tags (backend `q` arg). */\n q?: string;\n accessLevel?: CosAccessLevel;\n format?: string;\n collectionId?: string;\n sourceId?: string;\n status?: CosDatasetStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosDatasetQueryData {\n cosDataset: CosDataset | null;\n}\n\nexport interface CosSourcesQueryData {\n cosListSources: CosConnection<CosSource>;\n}\nexport interface CosSourcesQueryVars {\n type?: CosSourceType;\n status?: CosSourceStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosSourceQueryData {\n cosSource: CosSource | null;\n}\n\n/**\n * Row shape of `cosListCollections` — same as `CosCollection` except `datasets`\n * is the id-only selection COS_COLLECTIONS_QUERY makes, so the list page can\n * size each collection without over-fetching dataset bodies.\n */\nexport interface CosCollectionListItem extends Omit<CosCollection, 'datasets'> {\n datasets: CosIdRef[];\n}\n\nexport interface CosCollectionsQueryData {\n cosListCollections: CosCollectionListItem[];\n}\n\nexport interface CosCollectionQueryData {\n cosCollection: CosCollection | null;\n}\n\nexport interface CosSchemaFieldsQueryData {\n cosListSchemaFields: CosSchemaField[];\n}\n\nexport interface CosPipelinesQueryData {\n cosListPipelines: CosConnection<CosPipeline>;\n}\nexport interface CosPipelinesQueryVars {\n status?: CosPipelineStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosPipelineQueryData {\n cosPipeline: CosPipeline | null;\n}\n\nexport interface CosRunsQueryData {\n cosListRuns: CosConnection<CosPipelineRun>;\n}\nexport interface CosRunsQueryVars {\n pipelineId?: string;\n status?: CosRunStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosRunQueryData {\n cosRun: CosPipelineRun | null;\n}\n\nexport interface CosRunStepsQueryData {\n cosListRunSteps: CosPipelineStep[];\n}\n\n/** Row of COS_PIPELINE_FAILED_RUNS_QUERY — `steps` is always selected. */\nexport interface CosFailedRunListItem extends Omit<CosPipelineRun, 'steps'> {\n steps: CosPipelineStep[];\n}\n\nexport interface CosPipelineFailedRunsQueryData {\n cosListRuns: CosConnection<CosFailedRunListItem>;\n}\nexport interface CosPipelineFailedRunsQueryVars {\n pipelineId: string;\n pagination?: CosPaginationInput;\n}\n\n/** Just enough of a dataset to render its name in place of a bare id. */\nexport interface CosDatasetSummary {\n id: string;\n name: string;\n status: CosDatasetStatus;\n accessLevel: CosAccessLevel;\n}\n\nexport interface CosDatasetSummaryQueryData {\n cosDataset: CosDatasetSummary | null;\n}\n\nexport interface CosNotebooksQueryData {\n cosListNotebooks: CosConnection<CosNotebook>;\n}\nexport interface CosNotebooksQueryVars {\n status?: CosNotebookStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosNotebookQueryData {\n cosNotebook: CosNotebook | null;\n}\n\nexport interface CosAnalysesQueryData {\n cosListAnalyses: CosAnalysis[];\n}\nexport interface CosAnalysesQueryVars {\n datasetId?: string;\n notebookId?: string;\n status?: CosAnalysisStatus;\n}\n\nexport interface CosAnalysisQueryData {\n cosAnalysis: CosAnalysis | null;\n}\nexport interface CosReleaseQueryData {\n cosRelease: CosRelease | null;\n}\nexport interface CosReleasesQueryData {\n cosListReleases: CosConnection<CosRelease>;\n}\nexport interface CosReleasesQueryVars {\n status?: CosReleaseStatus;\n pagination?: CosPaginationInput;\n}\n\nexport interface CosAccessGrantsQueryData {\n cosListAccessGrants: CosDataAccessGrant[];\n}\nexport interface CosAccessGrantsQueryVars {\n datasetId?: string;\n status?: CosGrantStatus;\n}\n\n/** A single platform activity record (subset of wspace-activity-svc ActivityLog). */\nexport interface CosActivityEntry {\n id: string;\n action: string;\n description?: string | null;\n resourceType?: string | null;\n resourceId?: string | null;\n userId: string;\n timestamp: string;\n}\n\nexport interface CosActivityQueryData {\n getActivities: CosActivityEntry[];\n}\n\n/** Mirrors ActivityLogFilter — only the fields the cos activity panel needs. */\nexport interface CosActivityFilter {\n workspaceId?: string;\n resourceId?: string;\n resourceType?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface CosActivityQueryVars {\n filter?: CosActivityFilter;\n}\n\n// ============================================================================\n// QUERY HOOKS\n// ============================================================================\n\nexport const useCosHealthQuery = () => useQuery<CosHealthQueryData>(COS_HEALTH_QUERY);\n\nexport const useCosDatasetsQuery = (variables: CosDatasetsQueryVars = {}) =>\n useQuery<CosDatasetsQueryData, CosDatasetsQueryVars>(COS_DATASETS_QUERY, { variables });\n\nexport const useCosDatasetQuery = (id: string) =>\n useQuery<CosDatasetQueryData, { id: string }>(COS_DATASET_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosSourcesQuery = (variables: CosSourcesQueryVars = {}) =>\n useQuery<CosSourcesQueryData, CosSourcesQueryVars>(COS_SOURCES_QUERY, { variables });\n\nexport const useCosSourceQuery = (id: string) =>\n useQuery<CosSourceQueryData, { id: string }>(COS_SOURCE_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosCollectionsQuery = () =>\n useQuery<CosCollectionsQueryData>(COS_COLLECTIONS_QUERY);\n\nexport const useCosCollectionQuery = (id: string) =>\n useQuery<CosCollectionQueryData, { id: string }>(COS_COLLECTION_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosSchemaFieldsQuery = (datasetId: string) =>\n useQuery<CosSchemaFieldsQueryData, { datasetId: string }>(COS_SCHEMA_FIELDS_QUERY, {\n variables: { datasetId },\n skip: !datasetId,\n });\n\n// ---------------------------------------------------------------------------\n// Canonical workflows (wspace-workflow-svc) — the pipeline automation link\n// (OVL-09, BOFF-5232). Workflows are owned by the shared engine; CosmicIntersection\n// stores only the chosen definition's opaque id on CosPipeline.workflowDefinitionId.\n// ---------------------------------------------------------------------------\nexport interface CosWorkflowOption {\n id: string;\n name: string;\n workflowKey: string;\n version: string;\n}\n\nexport const COS_RUNNABLE_WORKFLOWS_QUERY = gql`\n query CosRunnableWorkflows($input: ListWorkflowDefinitionsInput!) {\n workflowDefinitions(input: $input) {\n items {\n id\n name\n workflowKey\n version\n }\n total\n hasMore\n }\n }\n`;\n\nexport const COS_WORKFLOW_DEFINITION_QUERY = gql`\n query CosWorkflowDefinition($id: ID!) {\n workflowDefinition(id: $id) {\n id\n name\n workflowKey\n version\n status\n }\n }\n`;\n\n/** One page is plenty for a picker; the engine caps a list at this size. */\nexport const MAX_WORKFLOW_OPTIONS = 100;\n\nexport const useRunnableWorkflowsQuery = () =>\n useQuery<{\n workflowDefinitions: { items: CosWorkflowOption[]; total: number; hasMore: boolean };\n }>(COS_RUNNABLE_WORKFLOWS_QUERY, {\n variables: { input: { status: 'ACTIVE', limit: MAX_WORKFLOW_OPTIONS, offset: 0 } },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useWorkflowDefinitionQuery = (id: string | null | undefined) =>\n useQuery<{ workflowDefinition: (CosWorkflowOption & { status: string }) | null }, { id: string }>(\n COS_WORKFLOW_DEFINITION_QUERY,\n { variables: { id: id ?? '' }, skip: !id }\n );\n\nexport const useCosPipelinesQuery = (variables: CosPipelinesQueryVars = {}) =>\n useQuery<CosPipelinesQueryData, CosPipelinesQueryVars>(COS_PIPELINES_QUERY, { variables });\n\nexport const useCosPipelineQuery = (id: string) =>\n useQuery<CosPipelineQueryData, { id: string }>(COS_PIPELINE_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosRunsQuery = (variables: CosRunsQueryVars = {}) =>\n useQuery<CosRunsQueryData, CosRunsQueryVars>(COS_RUNS_QUERY, { variables });\n\nexport const useCosRunQuery = (id: string) =>\n useQuery<CosRunQueryData, { id: string }>(COS_RUN_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosRunStepsQuery = (runId: string) =>\n useQuery<CosRunStepsQueryData, { runId: string }>(COS_RUN_STEPS_QUERY, {\n variables: { runId },\n skip: !runId,\n });\n\n/**\n * Failed runs of one pipeline. Skipped until a pipelineId is known so the run\n * detail page can call it unconditionally while its own query is still loading.\n */\nexport const useCosPipelineFailedRunsQuery = (\n pipelineId: string | undefined,\n options: { limit?: number; skip?: boolean } = {}\n) =>\n useQuery<CosPipelineFailedRunsQueryData, CosPipelineFailedRunsQueryVars>(\n COS_PIPELINE_FAILED_RUNS_QUERY,\n {\n variables: {\n pipelineId: pipelineId ?? '',\n pagination: { limit: options.limit ?? 20, offset: 0 },\n },\n skip: !pipelineId || options.skip === true,\n }\n );\n\n/** Resolves a dataset id to its name. Returns null data when unreadable. */\nexport const useCosDatasetSummaryQuery = (id: string | null | undefined) =>\n useQuery<CosDatasetSummaryQueryData, { id: string }>(COS_DATASET_SUMMARY_QUERY, {\n variables: { id: id ?? '' },\n skip: !id,\n });\n\nexport const useCosNotebooksQuery = (variables: CosNotebooksQueryVars = {}) =>\n useQuery<CosNotebooksQueryData, CosNotebooksQueryVars>(COS_NOTEBOOKS_QUERY, { variables });\n\nexport const useCosNotebookQuery = (id: string) =>\n useQuery<CosNotebookQueryData, { id: string }>(COS_NOTEBOOK_QUERY, {\n variables: { id },\n skip: !id,\n });\n\nexport const useCosAnalysesQuery = (variables: CosAnalysesQueryVars = {}) =>\n useQuery<CosAnalysesQueryData, CosAnalysesQueryVars>(COS_ANALYSES_QUERY, { variables });\n\nexport const useCosReleasesQuery = (variables: CosReleasesQueryVars = {}) =>\n useQuery<CosReleasesQueryData, CosReleasesQueryVars>(COS_RELEASES_QUERY, { variables });\n\n/** One analysis by id; skipped while `id` is empty or `skip` is set. */\nexport const useCosAnalysisQuery = (\n id: string | null | undefined,\n options: { skip?: boolean } = {}\n) =>\n useQuery<CosAnalysisQueryData, { id: string }>(COS_ANALYSIS_QUERY, {\n variables: { id: id ?? '' },\n skip: !id || options.skip === true,\n });\n\n/** One release by id; skipped while `id` is empty or `skip` is set. */\nexport const useCosReleaseQuery = (\n id: string | null | undefined,\n options: { skip?: boolean } = {}\n) =>\n useQuery<CosReleaseQueryData, { id: string }>(COS_RELEASE_QUERY, {\n variables: { id: id ?? '' },\n skip: !id || options.skip === true,\n });\n\nexport const useCosAccessGrantsQuery = (variables: CosAccessGrantsQueryVars = {}) =>\n useQuery<CosAccessGrantsQueryData, CosAccessGrantsQueryVars>(COS_ACCESS_GRANTS_QUERY, {\n variables,\n });\n\n/**\n * Resource-scoped platform activity for a single cos entity. RBAC on\n * `getActivities` scopes on `filter.workspaceId`, so both a workspaceId and the\n * entity's resourceId are required — the query is skipped until both are known.\n */\nexport const useCosResourceActivityQuery = (params: {\n workspaceId?: string;\n resourceId: string;\n resourceType?: string;\n limit?: number;\n}) => {\n const { workspaceId, resourceId, resourceType, limit = 20 } = params;\n return useQuery<CosActivityQueryData, CosActivityQueryVars>(COS_ACTIVITY_BY_RESOURCE_QUERY, {\n variables: { filter: { workspaceId, resourceId, resourceType, limit } },\n skip: !workspaceId || !resourceId,\n fetchPolicy: 'cache-and-network',\n });\n};\n\n// ============================================================================\n// MUTATION HOOKS\n// ============================================================================\n\nexport const useCosCreateDatasetMutation = () =>\n useMutation<{ cosCreateDataset: CosDataset }, { input: CosCreateDatasetInput }>(\n COS_CREATE_DATASET_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n }\n );\n\nexport const useCosUpdateDatasetMutation = () =>\n useMutation<{ cosUpdateDataset: CosDataset }, { id: string; input: CosUpdateDatasetInput }>(\n COS_UPDATE_DATASET_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n }\n );\n\nexport const useCosPublishDatasetMutation = () =>\n useMutation<{ cosPublishDataset: CosDataset }, { id: string }>(COS_PUBLISH_DATASET_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n });\n\nexport const useCosArchiveDatasetMutation = () =>\n useMutation<{ cosArchiveDataset: boolean }, { id: string }>(COS_ARCHIVE_DATASET_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_DATASETS_QUERY }],\n });\n\nexport const useCosAddSchemaFieldMutation = () =>\n useMutation<{ cosAddSchemaField: CosSchemaField }, { input: CosAddSchemaFieldInput }>(\n COS_ADD_SCHEMA_FIELD_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosCreateSourceMutation = () =>\n useMutation<{ cosCreateSource: CosSource }, { input: CosCreateSourceInput }>(\n COS_CREATE_SOURCE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_SOURCES_QUERY }] }\n );\n\nexport const useCosUpdateSourceMutation = () =>\n useMutation<{ cosUpdateSource: CosSource }, { id: string; input: CosUpdateSourceInput }>(\n COS_UPDATE_SOURCE_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_SOURCES_QUERY }] }\n );\n\nexport const useCosMarkSourceSyncedMutation = () =>\n useMutation<{ cosMarkSourceSynced: CosSource }, { id: string }>(COS_MARK_SOURCE_SYNCED_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_SOURCES_QUERY }],\n });\n\nexport const useCosArchiveSourceMutation = () =>\n useMutation<{ cosArchiveSource: boolean }, { id: string }>(COS_ARCHIVE_SOURCE_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_SOURCES_QUERY }],\n });\n\nexport const useCosCreateCollectionMutation = () =>\n useMutation<{ cosCreateCollection: CosCollection }, { input: CosCreateCollectionInput }>(\n COS_CREATE_COLLECTION_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n }\n );\n\nexport const useCosUpdateCollectionMutation = () =>\n useMutation<\n { cosUpdateCollection: CosCollection },\n { id: string; input: CosUpdateCollectionInput }\n >(COS_UPDATE_COLLECTION_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n });\n\nexport const useCosArchiveCollectionMutation = () =>\n useMutation<{ cosArchiveCollection: boolean }, { id: string }>(COS_ARCHIVE_COLLECTION_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_COLLECTIONS_QUERY }],\n });\n\nexport const useCosCreatePipelineMutation = () =>\n useMutation<{ cosCreatePipeline: CosPipeline }, { input: CosCreatePipelineInput }>(\n COS_CREATE_PIPELINE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n }\n );\n\nexport const useCosUpdatePipelineMutation = () =>\n useMutation<{ cosUpdatePipeline: CosPipeline }, { id: string; input: CosUpdatePipelineInput }>(\n COS_UPDATE_PIPELINE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n }\n );\n\nexport const useCosArchivePipelineMutation = () =>\n useMutation<{ cosArchivePipeline: boolean }, { id: string }>(COS_ARCHIVE_PIPELINE_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_PIPELINES_QUERY }],\n });\n\nexport const useCosStartRunMutation = () =>\n useMutation<{ cosStartRun: CosPipelineRun }, { input: CosStartRunInput }>(\n COS_START_RUN_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RUNS_QUERY }],\n }\n );\n\nexport const useCosTransitionRunMutation = () =>\n useMutation<{ cosTransitionRun: CosPipelineRun }, { id: string; status: CosRunStatus }>(\n COS_TRANSITION_RUN_MUTATION,\n { errorPolicy: 'all', onError: onMutationError, refetchQueries: [{ query: COS_RUNS_QUERY }] }\n );\n\nexport const useCosAddRunStepMutation = () =>\n useMutation<{ cosAddRunStep: CosPipelineStep }, { input: CosAddRunStepInput }>(\n COS_ADD_RUN_STEP_MUTATION,\n { errorPolicy: 'all', onError: onMutationError }\n );\n\nexport const useCosCreateNotebookMutation = () =>\n useMutation<{ cosCreateNotebook: CosNotebook }, { input: CosCreateNotebookInput }>(\n COS_CREATE_NOTEBOOK_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n }\n );\n\nexport const useCosUpdateNotebookMutation = () =>\n useMutation<{ cosUpdateNotebook: CosNotebook }, { id: string; input: CosUpdateNotebookInput }>(\n COS_UPDATE_NOTEBOOK_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n }\n );\n\nexport const useCosArchiveNotebookMutation = () =>\n useMutation<{ cosArchiveNotebook: boolean }, { id: string }>(COS_ARCHIVE_NOTEBOOK_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_NOTEBOOKS_QUERY }],\n });\n\nexport const useCosRunAnalysisMutation = () =>\n useMutation<{ cosRunAnalysis: CosAnalysis }, { input: CosRunAnalysisInput }>(\n COS_RUN_ANALYSIS_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ANALYSES_QUERY }],\n }\n );\n\nexport const useCosCompleteAnalysisMutation = () =>\n useMutation<\n { cosCompleteAnalysis: CosAnalysis },\n {\n id: string;\n status: Extract<CosAnalysisStatus, 'COMPLETED' | 'FAILED'>;\n results?: Record<string, unknown>;\n outputFileId?: string;\n }\n >(COS_COMPLETE_ANALYSIS_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ANALYSES_QUERY }],\n });\n\nexport const useCosCreateReleaseMutation = () =>\n useMutation<{ cosCreateRelease: CosRelease }, { input: CosCreateReleaseInput }>(\n COS_CREATE_RELEASE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n }\n );\n\nexport const useCosPublishReleaseMutation = () =>\n useMutation<{ cosPublishRelease: CosRelease }, { id: string; doi?: string; mintDoi?: boolean }>(\n COS_PUBLISH_RELEASE_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n }\n );\n\nexport const useCosMintDoiMutation = () =>\n useMutation<\n {\n cosMintDoi: {\n id: string;\n doi?: string | null;\n state: string;\n mode: string;\n errorMessage?: string | null;\n mintedAt?: string | null;\n };\n },\n { releaseId: string }\n >(COS_MINT_DOI_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_RELEASES_QUERY }],\n });\n\nexport const useCosGrantAccessMutation = () =>\n useMutation<{ cosGrantAccess: CosDataAccessGrant }, { input: CosGrantAccessInput }>(\n COS_GRANT_ACCESS_MUTATION,\n {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ACCESS_GRANTS_QUERY }],\n }\n );\n\nexport const useCosRevokeAccessMutation = () =>\n useMutation<{ cosRevokeAccess: CosDataAccessGrant }, { id: string }>(COS_REVOKE_ACCESS_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n refetchQueries: [{ query: COS_ACCESS_GRANTS_QUERY }],\n });\n\n// ============================================================================\n// AI DECISION ENGINE OPERATIONS (BOFF-3814)\n// ============================================================================\n\n/**\n * Propose one schema field per dataset column. Writes nothing — accepting a\n * suggestion is the separate, human-pressed `cosAddSchemaField` call.\n */\nexport const COS_AI_PROPOSE_SCHEMA_FIELDS_MUTATION = gql`\n mutation CosAiProposeSchemaFields($datasetId: ID!, $sample: CosSchemaSampleInput) {\n cosAiProposeSchemaFields(datasetId: $datasetId, sample: $sample) {\n datasetId\n sampleOrigin\n sampledRows\n fields {\n name\n fieldType\n unit\n nullable\n position\n description\n provenanceNote\n confidence\n reasons\n sampledValues\n emptyValues\n alreadyDefined\n existingFieldId\n conflicts\n }\n notes\n agentRunId\n engineVersion\n method\n generatedAt\n }\n }\n`;\n\n/**\n * Recommend what to do with a finished run, with rationale + the telemetry it\n * read as evidence. Writes nothing — applying the recommendation is the\n * human-pressed mutation named in `proposedAction`.\n */\nexport const COS_AI_TRIAGE_RUN_MUTATION = gql`\n mutation CosAiTriageRun($runId: ID!) {\n cosAiTriageRun(runId: $runId) {\n runId\n action\n confidence\n rationale\n signals {\n code\n severity\n message\n }\n evidence {\n kind\n refId\n field\n value\n }\n metrics {\n rowsIn\n rowsOut\n anomaliesFlagged\n warnings\n anomalyRate\n rowLossRate\n baselineAnomalyRate\n }\n suggestedParams\n proposedAction {\n mutation\n targetId\n arguments\n description\n }\n agentRunId\n engineVersion\n method\n generatedAt\n }\n }\n`;\n\n/**\n * Draft a release from a notebook. Writes nothing — `cosCreateRelease` and\n * the confirmed `cosPublishRelease` stay human actions.\n */\nexport const COS_AI_DRAFT_RELEASE_MUTATION = gql`\n mutation CosAiDraftRelease($notebookId: ID!) {\n cosAiDraftRelease(notebookId: $notebookId) {\n notebookId\n title\n abstract\n version\n authors\n authorSuggestions {\n actorId\n roles\n contributions\n }\n license\n licenseRationale\n datasetIds\n analysisIds\n warnings\n notes\n agentRunId\n engineVersion\n method\n generatedAt\n }\n }\n`;\n\nexport const COS_UPDATE_SCHEMA_FIELD_MUTATION = gql`\n mutation CosUpdateSchemaField($id: ID!, $input: CosUpdateSchemaFieldInput!) {\n cosUpdateSchemaField(id: $id, input: $input) {\n id\n workspaceId\n datasetId\n name\n fieldType\n unit\n description\n nullable\n position\n provenance\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const COS_REMOVE_SCHEMA_FIELD_MUTATION = gql`\n mutation CosRemoveSchemaField($id: ID!) {\n cosRemoveSchemaField(id: $id)\n }\n`;\n\nexport const COS_SEMANTIC_SEARCH_QUERY = gql`\n query CosSemanticSearch($input: CosSemanticSearchInput!) {\n cosSemanticSearch(input: $input) {\n query\n interpretedTerms\n expandedTerms\n timeWindow {\n fromYear\n toYear\n }\n total\n hits {\n entityType\n id\n title\n snippet\n score\n dataset {\n id\n name\n status\n accessLevel\n format\n }\n collection {\n id\n name\n }\n release {\n id\n title\n status\n }\n notebook {\n id\n title\n status\n }\n evidence {\n kind\n entityId\n label\n text\n }\n lineage {\n kind\n id\n label\n relation\n parentId\n }\n }\n }\n }\n`;\n\nexport const useCosAiProposeSchemaFieldsMutation = () =>\n useMutation<\n { cosAiProposeSchemaFields: CosSchemaFieldProposal },\n { datasetId: string; sample?: { columns?: string[]; rows: unknown } }\n >(COS_AI_PROPOSE_SCHEMA_FIELDS_MUTATION, { errorPolicy: 'all', onError: onMutationError });\n\nexport const useCosAiTriageRunMutation = () =>\n useMutation<{ cosAiTriageRun: CosRunTriage }, { runId: string }>(COS_AI_TRIAGE_RUN_MUTATION, {\n errorPolicy: 'all',\n });\n\nexport const useCosAiDraftReleaseMutation = () =>\n useMutation<{ cosAiDraftRelease: CosReleaseDraft }, { notebookId: string }>(\n COS_AI_DRAFT_RELEASE_MUTATION,\n { errorPolicy: 'all' }\n );\n\nexport const useCosUpdateSchemaFieldMutation = () =>\n useMutation<\n { cosUpdateSchemaField: CosSchemaField },\n { id: string; input: CosUpdateSchemaFieldInput }\n >(COS_UPDATE_SCHEMA_FIELD_MUTATION, { errorPolicy: 'all', onError: onMutationError });\n\nexport const useCosRemoveSchemaFieldMutation = () =>\n useMutation<{ cosRemoveSchemaField: boolean }, { id: string }>(COS_REMOVE_SCHEMA_FIELD_MUTATION, {\n errorPolicy: 'all',\n onError: onMutationError,\n });\n\nexport const useCosSemanticSearchLazyQuery = () =>\n useLazyQuery<{ cosSemanticSearch: CosSearchResults }, { input: CosSemanticSearchInput }>(\n COS_SEMANTIC_SEARCH_QUERY\n );\n\n// ============================================================================\n// ARCHIVE — MAST mission-specific search (BOFF-5786)\n// ============================================================================\n\nexport type CosArchiveMission =\n | 'HST'\n | 'JWST'\n | 'TESS'\n | 'KEPLER'\n | 'K2'\n | 'PANSTARRS'\n | 'GALEX'\n | 'SWIFT'\n | 'IUE'\n | 'FUSE'\n | 'EUVE'\n | 'SPITZER';\n\nexport interface CosArchiveFilterInput {\n column: string;\n values: string[];\n}\n\nexport interface CosArchiveSearchInput {\n missions?: CosArchiveMission[];\n targetName?: string;\n ra?: number;\n dec?: number;\n radiusDeg?: number;\n filters?: CosArchiveFilterInput[];\n limit?: number;\n page?: number;\n}\n\nexport interface CosArchiveProductsInput {\n productGroupId: string;\n productTypes?: string[];\n limit?: number;\n page?: number;\n}\n\nexport interface CosArchiveColumnValue {\n name: string;\n value: string;\n}\n\nexport interface CosArchiveObservation {\n mission: CosArchiveMission | null;\n missionCollection: string;\n observationId: string;\n productGroupId: string;\n targetName: string | null;\n ra: number | null;\n dec: number | null;\n instrument: string | null;\n filters: string | null;\n dataProductType: string | null;\n calibLevel: number | null;\n proposalId: string | null;\n principalInvestigator: string | null;\n startTimeMjd: number | null;\n exposureSec: number | null;\n dataRights: string | null;\n distanceDeg: number | null;\n previewUri: string | null;\n dataUri: string | null;\n previewUrl: string | null;\n dataFileUrl: string | null;\n extraColumns: CosArchiveColumnValue[];\n}\n\nexport interface CosArchiveSearchResults {\n targetName: string | null;\n ra: number | null;\n dec: number | null;\n radiusDeg: number;\n missions: CosArchiveMission[];\n page: number;\n limit: number;\n observations: CosArchiveObservation[];\n total: number;\n}\n\nexport interface CosArchiveProduct {\n uri: string;\n fileName: string;\n productType: string;\n description: string | null;\n mission: string | null;\n dataProductType: string | null;\n sizeBytes: number | null;\n downloadUrl: string;\n}\n\nexport const COS_ARCHIVE_MISSIONS_QUERY = gql`\n query CosArchiveMissions {\n cosArchiveMissions\n }\n`;\n\nexport const COS_ARCHIVE_SEARCH_QUERY = gql`\n query CosSearchArchive($input: CosArchiveSearchInput!) {\n cosSearchArchive(input: $input) {\n targetName\n ra\n dec\n radiusDeg\n missions\n page\n limit\n total\n observations {\n mission\n missionCollection\n observationId\n productGroupId\n targetName\n ra\n dec\n instrument\n filters\n dataProductType\n calibLevel\n proposalId\n principalInvestigator\n startTimeMjd\n exposureSec\n dataRights\n distanceDeg\n previewUri\n dataUri\n previewUrl\n dataFileUrl\n extraColumns {\n name\n value\n }\n }\n }\n }\n`;\n\nexport const COS_ARCHIVE_PRODUCTS_QUERY = gql`\n query CosListArchiveProducts($input: CosArchiveProductsInput!) {\n cosListArchiveProducts(input: $input) {\n uri\n fileName\n productType\n description\n mission\n dataProductType\n sizeBytes\n downloadUrl\n }\n }\n`;\n\nexport const useCosArchiveMissionsQuery = () =>\n useQuery<{ cosArchiveMissions: CosArchiveMission[] }>(COS_ARCHIVE_MISSIONS_QUERY);\n\nexport const useCosArchiveSearchLazyQuery = () =>\n useLazyQuery<{ cosSearchArchive: CosArchiveSearchResults }, { input: CosArchiveSearchInput }>(\n COS_ARCHIVE_SEARCH_QUERY\n );\n\nexport const useCosArchiveProductsLazyQuery = () =>\n useLazyQuery<{ cosListArchiveProducts: CosArchiveProduct[] }, { input: CosArchiveProductsInput }>(\n COS_ARCHIVE_PRODUCTS_QUERY\n );\n"],"mappings":";;;;AAwBA,IAAMA,KAAmB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pC,GACA;CACE,aAAa;CACb,SAASjD;CACT,gBAAgB,CAAC,EAAE,OAAOqB,EAAwB,CAAC;AACrD,CACF,GAEW2F,WACX3B,EAAqEnC,GAA4B;CAC/F,aAAa;CACb,SAASlD;CACT,gBAAgB,CAAC,EAAE,OAAOqB,EAAwB,CAAC;AACrD,CAAC,GAUU4F,KAAwC,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoC3CC,IAA6B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8ChCC,KAAgC,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;GA2BnCC,KAAmC,CAAG;;;;;;;;;;;;;;;;;GAmBtCC,KAAmC,CAAG;;;;GAMtCC,KAA4B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwD/BC,WACXlC,EAGE4B,IAAuC;CAAE,aAAa;CAAO,SAASjH;AAAgB,CAAC,GAE9EwH,WACXnC,EAAiE6B,GAA4B,EAC3F,aAAa,MACf,CAAC,GAEUO,WACXpC,EACE8B,IACA,EAAE,aAAa,MAAM,CACvB,GAEWO,WACXrC,EAGE+B,IAAkC;CAAE,aAAa;CAAO,SAASpH;AAAgB,CAAC,GAEzE2H,WACXtC,EAA+DgC,IAAkC;CAC/F,aAAa;CACb,SAASrH;AACX,CAAC,GAEU4H,WACXC,EACEP,EACF,GAgGWQ,KAA6B,CAAG;;;;GAMhCC,KAA2B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0C9BC,KAA6B,CAAG;;;;;;;;;;;;;GAehCC,WACX7E,EAAsD0E,EAA0B,GAErEI,WACXL,EACEE,EACF,GAEWI,WACXN,EACEG,EACF"}
|
|
@@ -11,17 +11,31 @@ function g({ notebook: g, open: _, onOpenChange: v }) {
|
|
|
11
11
|
let { navigate: y } = n(), [b, { loading: x }] = e(), [S, { loading: C }] = t(), [w, T] = s(null), [E, D] = s(""), [O, k] = s(""), [A, j] = s(""), [M, N] = s(""), [P, F] = s(""), I = o(null), L = x || C, R = (e) => {
|
|
12
12
|
L || (v(e), e || T(null));
|
|
13
13
|
}, z = () => {
|
|
14
|
-
I.current?.abort()
|
|
14
|
+
I.current?.abort();
|
|
15
15
|
}, B = async () => {
|
|
16
|
+
if (I.current) return;
|
|
16
17
|
let e = new AbortController();
|
|
17
18
|
I.current = e;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
try {
|
|
20
|
+
let t = await b({
|
|
21
|
+
variables: { notebookId: g.id },
|
|
22
|
+
context: {
|
|
23
|
+
fetchOptions: { signal: e.signal },
|
|
24
|
+
suppressGlobalErrorEvent: !0
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (e.signal.aborted) return;
|
|
28
|
+
let n = t.data?.cosAiDraftRelease;
|
|
29
|
+
if (t.error || !n) {
|
|
30
|
+
r.error("Could not draft the release", t.error?.message);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
T(n), D(n.title), k(n.abstract), j(n.version), N(n.authors.join(", ")), F(n.license);
|
|
34
|
+
} catch {
|
|
35
|
+
e.signal.aborted || r.error("Could not draft the release", "Please try again.");
|
|
36
|
+
} finally {
|
|
37
|
+
I.current = null;
|
|
38
|
+
}
|
|
25
39
|
}, V = async () => {
|
|
26
40
|
E.trim() ? (await S({ variables: { input: {
|
|
27
41
|
title: E.trim(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReleaseDraftDialog.js","names":["_Fragment","Fragment$1","ReleaseDraftDialog","useCosmicIntersection","draft","drafting","useCosAiDraftReleaseMutation","createRelease","creating","useCosCreateReleaseMutation","proposal","setProposal","useState","title","setTitle","abstract","setAbstract","version","setVersion","authors","setAuthors","license","setLicense","abortRef","useRef","busy","close","onOpenChange","next","cancelDraft","runDraft","controller","response","notebook","submit","author","notify","navigate","open","Button","Sparkles","warning","suggestion","AiGeneratedDisclaimer","Label","Input","event","Textarea","AiRunAttribution"],"sources":["../../../src/cosmicintersection/components/ReleaseDraftDialog.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { Sparkles } from 'lucide-react';\nimport { Button, Input, Label, Textarea } from '@burdenoff/fe-libs/ui';\n\nimport {\n useCosAiDraftReleaseMutation,\n useCosCreateReleaseMutation,\n type CosNotebook,\n type CosReleaseDraft,\n} from '../api/cosmicApi';\nimport { useCosmicIntersection } from '../context/CosmicIntersectionContext';\nimport { notify } from '../lib/toast';\nimport { AiGeneratedDisclaimer, AiRunAttribution } from './AiRunAttribution';\n\n/**\n * Release draft review (BOFF-3814) — \"a citable record is never minted by an\n * agent.\" `cosAiDraftRelease` drafts title/abstract/authors/license from the\n * notebook's own records and writes nothing. The scientist edits every field,\n * then explicitly creates a DRAFT release (`cosCreateRelease`). Publishing —\n * which mints the persistent identifier — stays on the Releases page behind\n * its own confirmation dialog and is untouched here.\n */\nexport function ReleaseDraftDialog({\n notebook,\n open,\n onOpenChange,\n}: {\n notebook: CosNotebook;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}) {\n const { navigate } = useCosmicIntersection();\n const [draft, { loading: drafting }] = useCosAiDraftReleaseMutation();\n const [createRelease, { loading: creating }] = useCosCreateReleaseMutation();\n\n const [proposal, setProposal] = useState<CosReleaseDraft | null>(null);\n const [title, setTitle] = useState('');\n const [abstract, setAbstract] = useState('');\n const [version, setVersion] = useState('');\n const [authors, setAuthors] = useState('');\n const [license, setLicense] = useState('');\n const abortRef = useRef<AbortController | null>(null);\n\n const busy = drafting || creating;\n\n const close = (next: boolean) => {\n if (busy) return;\n onOpenChange(next);\n if (!next) {\n setProposal(null);\n }\n };\n\n const cancelDraft = () => {\n abortRef.current?.abort();\n abortRef.current = null;\n };\n\n const runDraft = async () => {\n const controller = new AbortController();\n abortRef.current = controller;\n const response = await draft({\n variables: { notebookId: notebook.id },\n context: { fetchOptions: { signal: controller.signal } },\n });\n abortRef.current = null;\n const next = response.data?.cosAiDraftRelease;\n if (next) {\n setProposal(next);\n setTitle(next.title);\n setAbstract(next.abstract);\n setVersion(next.version);\n setAuthors(next.authors.join(', '));\n setLicense(next.license);\n }\n };\n\n const submit = async () => {\n if (!title.trim()) {\n notify.error('Title is required', 'A release needs a title before it can be drafted.');\n return;\n }\n const response = await createRelease({\n variables: {\n input: {\n title: title.trim(),\n abstract: abstract.trim() || undefined,\n version: version.trim() || undefined,\n authors: authors\n .split(',')\n .map((author) => author.trim())\n .filter(Boolean),\n license: license.trim() || undefined,\n datasetIds: proposal?.datasetIds ?? notebook.datasetIds,\n notebookId: notebook.id,\n },\n },\n });\n if (response.data?.cosCreateRelease) {\n notify.success('Draft release created', 'Review it on the Releases page before publishing.');\n close(false);\n navigate('releases');\n }\n };\n\n if (!open) {\n return null;\n }\n\n return (\n <div className=\"space-y-4 rounded-card border border-border-default bg-bg-elevated p-5\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Draft release with AI</h2>\n <p className=\"text-sm text-text-secondary\">\n Drafted from “{notebook.title}” and its completed analyses. Nothing is created until you\n confirm, and publishing always stays a separate, explicit step.\n </p>\n </div>\n {proposal ? null : drafting ? (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={cancelDraft}>\n Cancel\n </Button>\n ) : (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => void runDraft()}>\n <Sparkles className=\"size-4\" />\n Draft from notebook\n </Button>\n )}\n </div>\n\n {drafting ? (\n <p role=\"status\" className=\"text-sm text-text-secondary\">\n Reading the notebook, its analyses and its lineage…\n </p>\n ) : null}\n\n {proposal ? (\n <>\n {proposal.warnings.length > 0 ? (\n <ul className=\"space-y-1 rounded-card border border-status-warning-border bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text\">\n {proposal.warnings.map((warning) => (\n <li key={warning}>{warning}</li>\n ))}\n </ul>\n ) : null}\n\n {proposal.authorSuggestions.length > 0 ? (\n <p className=\"text-xs text-text-tertiary\">\n Contribution hints:{' '}\n {proposal.authorSuggestions\n .map((suggestion) => `${suggestion.actorId} (${suggestion.contributions})`)\n .join(', ')}\n . Edit the author list below to change who is credited.\n </p>\n ) : null}\n\n <AiGeneratedDisclaimer />\n\n <div className=\"space-y-3\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-title\">Title</Label>\n <Input\n id=\"cos-draft-title\"\n value={title}\n onChange={(event) => setTitle(event.target.value)}\n />\n </div>\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-abstract\">Abstract</Label>\n <Textarea\n id=\"cos-draft-abstract\"\n value={abstract}\n onChange={(event) => setAbstract(event.target.value)}\n rows={6}\n />\n </div>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-version\">Version</Label>\n <Input\n id=\"cos-draft-version\"\n value={version}\n onChange={(event) => setVersion(event.target.value)}\n />\n </div>\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-license\">License</Label>\n <Input\n id=\"cos-draft-license\"\n value={license}\n onChange={(event) => setLicense(event.target.value)}\n />\n </div>\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-authors\">Authors (comma-separated)</Label>\n <Input\n id=\"cos-draft-authors\"\n value={authors}\n onChange={(event) => setAuthors(event.target.value)}\n />\n </div>\n </div>\n {proposal.licenseRationale ? (\n <p className=\"text-xs text-text-tertiary\">\n License rationale: {proposal.licenseRationale}\n </p>\n ) : null}\n </div>\n\n <AiRunAttribution\n method={proposal.method}\n agentRunId={proposal.agentRunId}\n generatedAt={proposal.generatedAt}\n />\n\n <div className=\"flex flex-wrap items-center gap-2 border-t border-border-default pt-4\">\n <Button type=\"button\" onClick={() => void submit()} disabled={busy}>\n {creating ? 'Creating draft…' : 'Create draft release'}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={() => close(false)} disabled={busy}>\n Discard\n </Button>\n <span className=\"text-xs text-text-tertiary\">\n Creates a DRAFT release only — publishing mints the persistent identifier and asks\n again.\n </span>\n </div>\n </>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgBE,EAAmB,EACjC,aACA,SACA,mBAKC;CACD,IAAM,EAAE,gBAAaC,EAAsB,GACrC,CAACC,GAAO,EAAE,SAASC,OAAcC,EAA6B,GAC9D,CAACC,GAAe,EAAE,SAASC,OAAcC,EAA4B,GAErE,CAACC,GAAUC,KAAeC,EAAiC,IAAI,GAC/D,CAACC,GAAOC,KAAYF,EAAS,EAAE,GAC/B,CAACG,GAAUC,KAAeJ,EAAS,EAAE,GACrC,CAACK,GAASC,KAAcN,EAAS,EAAE,GACnC,CAACO,GAASC,KAAcR,EAAS,EAAE,GACnC,CAACS,GAASC,KAAcV,EAAS,EAAE,GACnCW,IAAWC,EAA+B,IAAI,GAE9CC,IAAOpB,KAAYG,GAEnBkB,KAAS,MAAkB;EAC/B,AAAID,MACJE,EAAaC,CAAI,GACZA,KACHjB,EAAY,IAAI;CAEpB,GAEMkB,UAAoB;EAExB,AADAN,EAAS,SAAS,MAAM,GACxB,EAAS,UAAU;CACrB,GAEMO,IAAW,YAAY;EAC3B,IAAMC,IAAa,IAAI,gBAAgB;EACvC,EAAS,UAAUA;EACnB,IAAMC,IAAW,MAAM5B,EAAM;GAC3B,WAAW,EAAE,YAAY6B,EAAS,GAAG;GACrC,SAAS,EAAE,cAAc,EAAE,QAAQF,EAAW,OAAO,EAAE;EACzD,CAAC;EACD,EAAS,UAAU;EACnB,IAAMH,IAAOI,EAAS,MAAM;EAC5B,AAAIJ,MACFjB,EAAYiB,CAAI,GAChBd,EAASc,EAAK,KAAK,GACnBZ,EAAYY,EAAK,QAAQ,GACzBV,EAAWU,EAAK,OAAO,GACvBR,EAAWQ,EAAK,QAAQ,KAAK,IAAI,CAAC,GAClCN,EAAWM,EAAK,OAAO;CA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SAAc,CAAA,GACjD,kBAACC,GAAD;UACE,IAAG;UACH,OAAOxB;UACP,WAAW,MAAUC,EAAWwB,EAAM,OAAO,KAAK;SACnD,CAAA,CACE;;QACL,kBAAC,OAAD;SAAK,WAAU;SAAf,UAAA,CACE,kBAACF,GAAD;UAAO,SAAQ;UAAoB,UAAA;SAAgC,CAAA,GACnE,kBAACC,GAAD;UACE,IAAG;UACH,OAAO1B;UACP,WAAW,MAAUC,EAAW0B,EAAM,OAAO,KAAK;SACnD,CAAA,CACE;;OACF;;MACJpC,EAAS,mBACR,kBAAC,KAAD;OAAG,WAAU;OAAb,UAAA,CAA0C,uBACpBA,EAAS,gBAC5B;MACD,CAAA,IAAA;KACD;;IAEL,kBAACsC,GAAD;KACE,QAAQtC,EAAS;KACjB,YAAYA,EAAS;KACrB,aAAaA,EAAS;IACvB,CAAA;IAED,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC6B,GAAD;OAAQ,MAAK;OAAS,eAAe,KAAKL,EAAO;OAAG,UAAUT;OAC3D,UAAAjB,IAAW,oBAAoB;MAC1B,CAAA;MACR,kBAAC+B,GAAD;OAAQ,MAAK;OAAS,SAAQ;OAAU,eAAeb,EAAM,EAAK;OAAG,UAAUD;OAAM,UAAA;MAE7E,CAAA;MACR,kBAAC,QAAD;OAAM,WAAU;OAA6B,UAAA;MAGvC,CAAA;KACH;;GACL,EAAA,CAAA,IACA;EACD;C,KA5HE;AA8HX"}
|
|
1
|
+
{"version":3,"file":"ReleaseDraftDialog.js","names":["_Fragment","Fragment$1","ReleaseDraftDialog","useCosmicIntersection","draft","drafting","useCosAiDraftReleaseMutation","createRelease","creating","useCosCreateReleaseMutation","proposal","setProposal","useState","title","setTitle","abstract","setAbstract","version","setVersion","authors","setAuthors","license","setLicense","abortRef","useRef","busy","close","onOpenChange","next","cancelDraft","runDraft","controller","response","notebook","notify","submit","author","navigate","open","Button","Sparkles","warning","suggestion","AiGeneratedDisclaimer","Label","Input","event","Textarea","AiRunAttribution"],"sources":["../../../src/cosmicintersection/components/ReleaseDraftDialog.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { Sparkles } from 'lucide-react';\nimport { Button, Input, Label, Textarea } from '@burdenoff/fe-libs/ui';\n\nimport {\n useCosAiDraftReleaseMutation,\n useCosCreateReleaseMutation,\n type CosNotebook,\n type CosReleaseDraft,\n} from '../api/cosmicApi';\nimport { useCosmicIntersection } from '../context/CosmicIntersectionContext';\nimport { notify } from '../lib/toast';\nimport { AiGeneratedDisclaimer, AiRunAttribution } from './AiRunAttribution';\n\n/**\n * Release draft review (BOFF-3814) — \"a citable record is never minted by an\n * agent.\" `cosAiDraftRelease` drafts title/abstract/authors/license from the\n * notebook's own records and writes nothing. The scientist edits every field,\n * then explicitly creates a DRAFT release (`cosCreateRelease`). Publishing —\n * which mints the persistent identifier — stays on the Releases page behind\n * its own confirmation dialog and is untouched here.\n */\nexport function ReleaseDraftDialog({\n notebook,\n open,\n onOpenChange,\n}: {\n notebook: CosNotebook;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}) {\n const { navigate } = useCosmicIntersection();\n const [draft, { loading: drafting }] = useCosAiDraftReleaseMutation();\n const [createRelease, { loading: creating }] = useCosCreateReleaseMutation();\n\n const [proposal, setProposal] = useState<CosReleaseDraft | null>(null);\n const [title, setTitle] = useState('');\n const [abstract, setAbstract] = useState('');\n const [version, setVersion] = useState('');\n const [authors, setAuthors] = useState('');\n const [license, setLicense] = useState('');\n const abortRef = useRef<AbortController | null>(null);\n\n const busy = drafting || creating;\n\n const close = (next: boolean) => {\n if (busy) return;\n onOpenChange(next);\n if (!next) {\n setProposal(null);\n }\n };\n\n const cancelDraft = () => {\n abortRef.current?.abort();\n };\n\n const runDraft = async () => {\n if (abortRef.current) return;\n const controller = new AbortController();\n abortRef.current = controller;\n try {\n const response = await draft({\n variables: { notebookId: notebook.id },\n context: { fetchOptions: { signal: controller.signal }, suppressGlobalErrorEvent: true },\n });\n if (controller.signal.aborted) return;\n const next = response.data?.cosAiDraftRelease;\n if (response.error || !next) {\n notify.error('Could not draft the release', response.error?.message);\n return;\n }\n setProposal(next);\n setTitle(next.title);\n setAbstract(next.abstract);\n setVersion(next.version);\n setAuthors(next.authors.join(', '));\n setLicense(next.license);\n } catch {\n if (!controller.signal.aborted) {\n notify.error('Could not draft the release', 'Please try again.');\n }\n } finally {\n abortRef.current = null;\n }\n };\n\n const submit = async () => {\n if (!title.trim()) {\n notify.error('Title is required', 'A release needs a title before it can be drafted.');\n return;\n }\n const response = await createRelease({\n variables: {\n input: {\n title: title.trim(),\n abstract: abstract.trim() || undefined,\n version: version.trim() || undefined,\n authors: authors\n .split(',')\n .map((author) => author.trim())\n .filter(Boolean),\n license: license.trim() || undefined,\n datasetIds: proposal?.datasetIds ?? notebook.datasetIds,\n notebookId: notebook.id,\n },\n },\n });\n if (response.data?.cosCreateRelease) {\n notify.success('Draft release created', 'Review it on the Releases page before publishing.');\n close(false);\n navigate('releases');\n }\n };\n\n if (!open) {\n return null;\n }\n\n return (\n <div className=\"space-y-4 rounded-card border border-border-default bg-bg-elevated p-5\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Draft release with AI</h2>\n <p className=\"text-sm text-text-secondary\">\n Drafted from “{notebook.title}” and its completed analyses. Nothing is created until you\n confirm, and publishing always stays a separate, explicit step.\n </p>\n </div>\n {proposal ? null : drafting ? (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={cancelDraft}>\n Cancel\n </Button>\n ) : (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => void runDraft()}>\n <Sparkles className=\"size-4\" />\n Draft from notebook\n </Button>\n )}\n </div>\n\n {drafting ? (\n <p role=\"status\" className=\"text-sm text-text-secondary\">\n Reading the notebook, its analyses and its lineage…\n </p>\n ) : null}\n\n {proposal ? (\n <>\n {proposal.warnings.length > 0 ? (\n <ul className=\"space-y-1 rounded-card border border-status-warning-border bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text\">\n {proposal.warnings.map((warning) => (\n <li key={warning}>{warning}</li>\n ))}\n </ul>\n ) : null}\n\n {proposal.authorSuggestions.length > 0 ? (\n <p className=\"text-xs text-text-tertiary\">\n Contribution hints:{' '}\n {proposal.authorSuggestions\n .map((suggestion) => `${suggestion.actorId} (${suggestion.contributions})`)\n .join(', ')}\n . Edit the author list below to change who is credited.\n </p>\n ) : null}\n\n <AiGeneratedDisclaimer />\n\n <div className=\"space-y-3\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-title\">Title</Label>\n <Input\n id=\"cos-draft-title\"\n value={title}\n onChange={(event) => setTitle(event.target.value)}\n />\n </div>\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-abstract\">Abstract</Label>\n <Textarea\n id=\"cos-draft-abstract\"\n value={abstract}\n onChange={(event) => setAbstract(event.target.value)}\n rows={6}\n />\n </div>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-version\">Version</Label>\n <Input\n id=\"cos-draft-version\"\n value={version}\n onChange={(event) => setVersion(event.target.value)}\n />\n </div>\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-license\">License</Label>\n <Input\n id=\"cos-draft-license\"\n value={license}\n onChange={(event) => setLicense(event.target.value)}\n />\n </div>\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"cos-draft-authors\">Authors (comma-separated)</Label>\n <Input\n id=\"cos-draft-authors\"\n value={authors}\n onChange={(event) => setAuthors(event.target.value)}\n />\n </div>\n </div>\n {proposal.licenseRationale ? (\n <p className=\"text-xs text-text-tertiary\">\n License rationale: {proposal.licenseRationale}\n </p>\n ) : null}\n </div>\n\n <AiRunAttribution\n method={proposal.method}\n agentRunId={proposal.agentRunId}\n generatedAt={proposal.generatedAt}\n />\n\n <div className=\"flex flex-wrap items-center gap-2 border-t border-border-default pt-4\">\n <Button type=\"button\" onClick={() => void submit()} disabled={busy}>\n {creating ? 'Creating draft…' : 'Create draft release'}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={() => close(false)} disabled={busy}>\n Discard\n </Button>\n <span className=\"text-xs text-text-tertiary\">\n Creates a DRAFT release only — publishing mints the persistent identifier and asks\n again.\n </span>\n </div>\n </>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgBE,EAAmB,EACjC,aACA,SACA,mBAKC;CACD,IAAM,EAAE,gBAAaC,EAAsB,GACrC,CAACC,GAAO,EAAE,SAASC,OAAcC,EAA6B,GAC9D,CAACC,GAAe,EAAE,SAASC,OAAcC,EAA4B,GAErE,CAACC,GAAUC,KAAeC,EAAiC,IAAI,GAC/D,CAACC,GAAOC,KAAYF,EAAS,EAAE,GAC/B,CAACG,GAAUC,KAAeJ,EAAS,EAAE,GACrC,CAACK,GAASC,KAAcN,EAAS,EAAE,GACnC,CAACO,GAASC,KAAcR,EAAS,EAAE,GACnC,CAACS,GAASC,KAAcV,EAAS,EAAE,GACnCW,IAAWC,EAA+B,IAAI,GAE9CC,IAAOpB,KAAYG,GAEnBkB,KAAS,MAAkB;EAC/B,AAAID,MACJE,EAAaC,CAAI,GACZA,KACHjB,EAAY,IAAI;CAEpB,GAEMkB,UAAoB;EACxB,EAAS,SAAS,MAAM;CAC1B,GAEMC,IAAW,YAAY;EAC3B,IAAIP,EAAS,SAAS;EACtB,IAAMQ,IAAa,IAAI,gBAAgB;EACvC,EAAS,UAAUA;EACnB,IAAI;GACF,IAAMC,IAAW,MAAM5B,EAAM;IAC3B,WAAW,EAAE,YAAY6B,EAAS,GAAG;IACrC,SAAS;KAAE,cAAc,EAAE,QAAQF,EAAW,OAAO;KAAG,0BAA0B;IAAK;GACzF,CAAC;GACD,IAAIA,EAAW,OAAO,SAAS;GAC/B,IAAMH,IAAOI,EAAS,MAAM;GAC5B,IAAIA,EAAS,SAAS,CAACJ,GAAM;IAC3B,EAAO,MAAM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X"}
|
|
@@ -22,15 +22,31 @@ function w(e) {
|
|
|
22
22
|
}
|
|
23
23
|
function T({ run: T, onChanged: E }) {
|
|
24
24
|
let { navigate: D } = a(), [O, { loading: k }] = e(), [A, { loading: j }] = n(), [M, { loading: N }] = i(), [P, { loading: F }] = r(), [I, { loading: L }] = t(), [R, z] = l(null), [B, V] = l(!1), H = c(null), U = T.status === "SUCCEEDED" || T.status === "FAILED" || T.status === "CANCELLED", W = j || N || F || L, G = () => {
|
|
25
|
-
H.current?.abort()
|
|
25
|
+
H.current?.abort();
|
|
26
26
|
}, K = async () => {
|
|
27
|
+
if (H.current) return;
|
|
27
28
|
let e = new AbortController();
|
|
28
29
|
H.current = e;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
try {
|
|
31
|
+
let t = await O({
|
|
32
|
+
variables: { runId: T.id },
|
|
33
|
+
context: {
|
|
34
|
+
fetchOptions: { signal: e.signal },
|
|
35
|
+
suppressGlobalErrorEvent: !0
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (e.signal.aborted) return;
|
|
39
|
+
let n = t.data?.cosAiTriageRun;
|
|
40
|
+
if (t.error || !n) {
|
|
41
|
+
o.error("Could not triage the run", t.error?.message);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
z(n);
|
|
45
|
+
} catch {
|
|
46
|
+
e.signal.aborted || o.error("Could not triage the run", "Please try again.");
|
|
47
|
+
} finally {
|
|
48
|
+
H.current = null;
|
|
49
|
+
}
|
|
34
50
|
}, q = (e, t) => {
|
|
35
51
|
switch (e) {
|
|
36
52
|
case "RUN":
|