@lalalic/markcut 3.2.55 → 3.2.57

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.
@@ -3,7 +3,7 @@ const ID = /^[A-Za-z0-9_-]{1,128}$/;
3
3
  const SOURCE = /^job\/[A-Za-z0-9_-]+\/task\/[A-Za-z0-9_-]+\/execution\/[A-Za-z0-9_-]+$/;
4
4
  const RECORD = value => value && typeof value === "object" && !Array.isArray(value);
5
5
  const INTERACTIVE_TYPE = "task.interactive_decision";
6
- const REVIEW_FIELDS = ["decision","feedback","comments","revision","revisionId","contentHash","commitSha","previewId","requestId","idempotencyKey"];
6
+ const REVIEW_FIELDS = ["decision","feedback","comments","revision","revisionId","contentHash","commitSha","invocationId","previewId","requestId","idempotencyKey"];
7
7
  function copyData(value) {
8
8
  if (!RECORD(value)) throw new Error("eventTemplate.data must be an object");
9
9
  // No executable values or reserved overrides can be shipped in a template.
@@ -37,29 +37,27 @@ export function normalizeReviewConfig(value) {
37
37
  const interactive=data.interactive;
38
38
  if (!match || !RECORD(interactive) || interactive.jobId!==match[1] ||
39
39
  interactive.taskId!==match[2] || interactive.executionId!==match[3] ||
40
- !ID.test(interactive.invocationId||"") ||
41
40
  REVIEW_FIELDS.some(field=>Object.hasOwn(interactive,field)))
42
41
  throw new Error("Invalid task.interactive_decision event template");
43
- if (!/^[a-f0-9]{40}$/.test(value.commitSha||"")) throw new Error("Event review requires full Git Commit SHA");
44
- return {delivery:"event",commitSha:value.commitSha,eventTemplate:{
42
+ if (value.commitSha !== undefined) throw new Error('Git SHA is not a Review field');
43
+ return {delivery:"event",eventTemplate:{
45
44
  type:template.type,source:template.source,data,
46
45
  }};
47
46
  }
48
47
  export function eventForReview(config,review) {
49
48
  const {eventTemplate:template}=normalizeReviewConfig(config);
50
49
  if (!template) throw new Error("Event mode required");
51
- if (!RECORD(review) || !ID.test(review.requestId || "") || !/^[a-f0-9]{40}$/.test(review.commitSha || "")
50
+ if (!RECORD(review) || !ID.test(review.requestId || "")
52
51
  || !["approved","changes_requested"].includes(review.decision)
53
52
  || !ID.test(review.idempotencyKey || "") || !Array.isArray(review.comments))
54
53
  throw new Error("Invalid review result");
55
- if (review.commitSha !== config.commitSha)throw new Error("Review Commit SHA differs from immutable preview request");
54
+ if (review.commitSha !== undefined || review.invocationId !== undefined) throw new Error('Review identity is Task execution only');
56
55
  const details=template.data.interactive;
57
56
  const feedback=typeof review.feedback==="string" ? review.feedback :
58
57
  review.comments.map(comment=>comment.text).filter(value=>typeof value==="string").join("\n");
59
58
  return {type:INTERACTIVE_TYPE,source:template.source,data:{
60
59
  ...template.data,
61
60
  interactive:{...details,
62
- revision:review.commitSha,commitSha:review.commitSha,
63
61
  previewId:review.previewId,requestId:review.requestId,
64
62
  decision:review.decision,feedback,comments:structuredClone(review.comments),
65
63
  idempotencyKey:review.idempotencyKey},
@@ -47,19 +47,25 @@ registerAppTool(
47
47
  server,
48
48
  TOOL_NAME,
49
49
  {
50
- description: "Compile and publish an immutable Markcut preview revision for this ChatGPT conversation. Review delivery defaults to ui/message, or submits an authorized caller-bound event when explicitly configured. Event-mode decisions bind the verified 40-character Git Commit SHA, not the compiled-media cache hash.",
50
+ description: "Compile and publish an immutable Markcut preview revision for this ChatGPT conversation. Review delivery defaults to ui/message, or submits an authorized caller-bound event when explicitly configured. Event-mode decisions bind only the current Relay Task execution; compiled media is used for playback.",
51
51
  inputSchema: z.object({
52
- path: z.string().describe("Absolute .md path or NeoY HTTPS mounted file URL"),
53
- review: z.object({delivery:z.enum(["text","event"]).optional(),commitSha:z.string().regex(/^[a-f0-9]{40}$/).optional(),eventTemplate:z.object({type:z.string(),source:z.string(),data:z.record(z.string(),z.unknown())}).optional()}).optional(),
54
- relay: z.object({jobId:z.string(),taskId:z.union([z.string(),z.number()]),executionId:z.string().optional()}).optional().describe("Optional Agents Relay task correlation. No Relay dependency for standalone ChatGPT/Work reviews."),
52
+ path: z.string().describe("Absolute .md path or NeoY HTTPS mounted file URL; Neo Wrapper also accepts single local image/audio/video files"),
53
+ readonly: z.boolean().optional().describe("View-only preview: no review controls, Relay binding, Git checkpoint, or mobile review notification."),
54
+ review: z.object({delivery:z.enum(["text","event"]).optional(),eventTemplate:z.object({type:z.string(),source:z.string(),data:z.record(z.string(),z.unknown())}).optional(),
55
+ relay:z.object({jobId:z.string(),taskId:z.union([z.string(),z.number()]),executionId:z.string().optional()}).optional().describe("Optional managed review correlation; no Relay needed for standalone review."),
56
+ }).optional(),
55
57
  }),
56
58
  _meta: {
57
59
  ui: { resourceUri: RESOURCE_URI },
58
60
  },
59
61
  },
60
- async ({ path, relay, review }) => {
62
+ async ({ path, review, readonly }) => {
63
+ const relay=review?.relay;
61
64
  try {
62
- const operation=startCompileOperation(path,relay,normalizeReviewConfig(review));
65
+ if (readonly && review !== undefined)
66
+ throw new Error("Read-only preview cannot request Relay or review delivery");
67
+ const config={...normalizeReviewConfig(review),...(readonly ? {readonly:true} : {})};
68
+ const operation=startCompileOperation(path,relay,config);
63
69
  const payload={...operation,...(relay ? {relay} : {})};
64
70
  return {
65
71
  content: [{ type: "text", text: `Compilation started: ${operation.path}` }],