@anthusai/papyrus 5.19.0 → 5.19.1

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.
@@ -4,11 +4,11 @@ from __future__ import annotations
4
4
 
5
5
  from typing import Any
6
6
 
7
- from papyrus_content.editorial_checks import GraphQLEditorialStore, Services, handle, load_provider_keys
7
+ from papyrus_content.editorial_checks import GraphQLEditorialStore, Services, event_field_name, handle, load_provider_keys
8
8
 
9
9
  # Amplify passes secrets to Python functions as placeholders; resolve them once per cold start.
10
10
  load_provider_keys()
11
11
 
12
12
 
13
13
  def handler(event: dict[str, Any], _context: Any = None) -> dict[str, Any]:
14
- return handle(event["info"]["fieldName"], event.get("arguments") or {}, Services(store=GraphQLEditorialStore()))
14
+ return handle(event_field_name(event), event.get("arguments") or {}, Services(store=GraphQLEditorialStore()))
@@ -5,6 +5,9 @@ import {ReviewControl,type ReviewControlReview} from 'cyclotron/components/revie
5
5
  import {CyclotronStatusView} from 'cyclotron/components/cyclotron-status';
6
6
  import {assertPublicationScope,publicationScopeKey,publicationReviewPayload,type PublicationStatus,type PublicationHistory,type PublicationHistoryRow,type PublicationReviewPayload} from '../lib/publication-cyclotron';
7
7
 
8
+ /** Steering is offered only when the Cyclotron contract says so; absent means unknown, so off. */
9
+ export function steeringAvailable(status:PublicationStatus):boolean{return status.features?.steering===true;}
10
+
8
11
  function requestId(){
9
12
  const bytes=crypto.getRandomValues(new Uint8Array(16));
10
13
  return Array.from(bytes,value=>value.toString(16).padStart(2,'0')).join('');
@@ -38,7 +41,9 @@ function PublicationControls({mode,status,history,onReview,onSteer}:PublicationP
38
41
  <header><h2 className="text-lg font-semibold">Suggestions · {status.publicationId}</h2><p className="text-sm text-muted-foreground">{mode==='embedded'?'Suggestions and reviews are kept by this site.':'Suggestions and reviews are kept by the shared review service.'}</p></header>
39
42
  {status.outputs.map(output=><section key={`${context}:${output.id}`} aria-label={output.question} className="space-y-3 rounded-md border p-3">
40
43
  <CyclotronStatusView status={status.classifiers[output.id]} classifierName={output.question} variant="card"/>
41
- {onSteer?<button type="button" disabled={Boolean(busy)} onClick={()=>onSteer(output.id)}>Test a rule change</button>:null}
44
+ {onSteer?(steeringAvailable(status)
45
+ ?<button type="button" disabled={Boolean(busy)} onClick={()=>onSteer(output.id)}>Test a rule change</button>
46
+ :<div><button type="button" disabled aria-describedby={`steer-unavailable:${output.id}`}>Test a rule change · Not available yet</button><p id={`steer-unavailable:${output.id}`} className="text-sm text-muted-foreground">Rule changes cannot be tested on this service yet.</p></div>):null}
42
47
  {history.history.map(row=>{
43
48
  const prediction=row.decision.classifiers[output.id];if(!prediction)return null;
44
49
  const key=`${context}:${row.decision.decisionId}:${output.id}:${row.context?.contextId??'legacy'}`;const saved=row.reviews[output.id];const historical=Boolean(row.historicalContext||row.provenanceUnavailable||row.feedbackReconciliationRequired);
@@ -73,7 +73,7 @@ function Controls({session,disabled,refreshSignal}:{session:CurationSession;disa
73
73
  {error?<p role="alert">{error}</p>:null}
74
74
  {snapshot?<PublicationCyclotronPanel mode={session.bootstrap.mode} status={snapshot.status} history={snapshot.history}
75
75
  onReview={canReview?async payload=>{await session.publication.review(payload);await refresh();}:undefined}
76
- onSteer={canSteer&&snapshot.status.features?.steering&&session.bootstrap.bindingRef?classifier=>{setSteering(classifier);setRubric('');setExplanation('');setTrial(null);setSteeringMessage('');}:undefined}/>:null}
76
+ onSteer={canSteer&&session.bootstrap.bindingRef?classifier=>{setSteering(classifier);setRubric('');setExplanation('');setTrial(null);setSteeringMessage('');}:undefined}/>:null}
77
77
  {steering?<form aria-label="Rule change" className="space-y-3 rounded-md border p-3" onSubmit={event=>{event.preventDefault();void steer('evaluate');}}>
78
78
  <h4 className="font-semibold">Test a rule change</h4>
79
79
  <p className="text-sm">A change is tested before it is adopted. Opening this form does not change any existing suggestion.</p>
package/package.json CHANGED
@@ -407,7 +407,7 @@
407
407
  "optional": true
408
408
  }
409
409
  },
410
- "version": "5.19.0",
410
+ "version": "5.19.1",
411
411
  "dependencies": {
412
412
  "@aws-amplify/adapter-nextjs": "^1.7.3",
413
413
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.19.0",
2
+ "version": "5.19.1",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",