Generated
Vendored
+8
File diff suppressed because one or more lines are too long
Generated
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
||||
import{randomUUID as T}from"node:crypto";var b=19e5;var _=2e6;var w=4e3;var v="omitted_for_size";var C="omitted_for_output_error";var S=T();var A=process;var k=A._send?.bind(process);var h=process.send?.bind(process);var y=A.reallyExit?.bind(process)??process.exit.bind(process);var J=performance.now();var P=import("@oai/artifact-tool");var l;var g=false;P.then(()=>{l=performance.now()-J;E({type:"ready",workerInstanceId:S,runtimeImportMs:l},n=>{if(n)y(1)})},n=>{p({type:"startup-error",error:{message:O(n instanceof Error?n.message:String(n))}})});process.once("message",n=>{if(!M(n)){p({type:"startup-error",error:{message:"Artifact session worker received an invalid request."}});return}void N(n.requestId,n.args)});process.on("disconnect",()=>{y(0)});function E(n,e){try{if(k){k(n,void 0,{swallowErrors:false},e);return}if(h){h(n,e);return}}catch(t){e(t instanceof Error?t:new Error(String(t)));return}e(new Error("Artifact session worker IPC is unavailable."))}function p(n){if(g)return;g=true;E(n,e=>{y(e?1:0)})}function M(n){if(!n||typeof n!=="object")return false;const e=n;return e.type==="run"&&typeof e.requestId==="string"&&!!e.args&&typeof e.args==="object"}async function N(n,e){let t=false;let o=null;try{const i=await P;const s=e.artifactType==="presentation"?i.Presentation:i.Workbook;if(!s||typeof s.run!=="function"){throw new Error(`The bundled Artifact Tool runtime does not expose ${e.artifactType==="presentation"?"Presentation":"Workbook"}.run.`)}const r=j(e.code);const c=performance.now();const u=await s.run(e.target,async f=>{const I=x(f);const m=await r(f,I,e.input,e.artifactType==="spreadsheet"?f:void 0,e.artifactType==="presentation"?f:void 0);o=V(m,b,"Artifact session callback result");t=true;return m},F({create:e.create,sessionRoot:e.sessionRoot,snapshotPath:e.snapshotPath,title:e.title,sourcePath:e.sourcePath,outputDirectory:e.outputDirectory,summary:e.summary,authorClientId:e.authorClientId}));const a=B(u.outputs);if(!a){$(o,u.outputs)}const d=L(e.artifactType,u,o,a,{target:e.target,runMs:performance.now()-c});p({type:"result",requestId:n,ok:true,value:d})}catch(i){p({type:"result",requestId:n,ok:false,outcome:t?"unknown":"not_committed",error:{message:O(i instanceof Error?i.message:String(i))}})}}function j(n){const e=Object.getPrototypeOf(async function(){}).constructor;return new e("artifact","session","input","workbook","presentation",`"use strict";
|
||||
${n}`)}function x(n){const e=n.session;const t=e?.info??{};const o={...t,info:t,viewState:e?.viewState??t.viewState};if(Array.isArray(e?.selectedElementAids)){o["selectedElementAids"]=[...e.selectedElementAids]}if(Array.isArray(e?.selectedRanges)){o["selectedRanges"]=[...e.selectedRanges]}for(const i of["inspect","resolve","help"]){const s=n[i];if(typeof s==="function"){o[i]=s.bind(n)}}return Object.freeze(o)}function F(n){return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==void 0))}function L(n,e,t,o,i){const s=o?void 0:R(t,b);const r={status:o?C:v};const c={ok:true,committed:e.response!==void 0,artifactType:n,target:i.target,sessionId:e.info.sessionId,stateVersion:e.info.stateVersion,snapshotPath:e.info.snapshotPath,sourcePath:e.info.sourcePath,viewState:e.info.viewState,outputDirectory:e.info.outputDirectory,timing:{runMs:i.runMs,runtimeImportMs:l},workerInstanceId:S,workerPid:process.pid};const u=[...s===void 0?[]:[{...c,outputs:e.outputs,result:s}],{...c,outputs:e.outputs,result:r,resultOmitted:true},{...c,outputs:[],outputsOmitted:true,outputCount:e.outputs.length,result:r,resultOmitted:true}];for(const a of u){const d=R(a,_);if(d!==void 0)return d}return{ok:true,committed:e.response!==void 0,artifactType:n,sessionId:D(e.info.sessionId),stateVersion:q(e.info.stateVersion),metadataOmitted:true,outputs:[],outputsOmitted:true,outputCount:e.outputs.length,result:r,resultOmitted:true}}function D(n){if(n===void 0||n===null)return n;if(typeof n!=="string")return void 0;if(n.length<=1e3)return n;return`${n.slice(0,999)}\u2026`}function q(n){return typeof n==="number"&&Number.isFinite(n)?n:void 0}function V(n,e,t){if(n===void 0)return null;const o=JSON.stringify(n);if(o===void 0)return null;if(Buffer.byteLength(o)>e){throw new Error(`${t} exceeds the ${e}-byte limit.`)}return JSON.parse(o)}function $(n,e){try{const t=new Map;for(const s of e){const r=U(s);if(r===void 0)continue;t.set(r.path,t.has(r.path)?void 0:r)}if(t.size===0)return;const o=[n];const i=new Set;while(o.length>0){const s=o.pop();if(!s||typeof s!=="object"||i.has(s))continue;i.add(s);if(Array.isArray(s)){for(let u=0;u<s.length;u+=1){o.push(s[u])}continue}const r=s;const c=r["path"];if(typeof c==="string"){const u=t.get(c);if(u!==void 0&&W(r,u)){r["status"]="saved";delete r["message"]}}for(const u of Object.values(r)){o.push(u)}}}catch{}}function B(n){for(const e of n){if(!e||typeof e!=="object"||Array.isArray(e))continue;const t=e["status"];if(t==="error"||t==="conflict")return true}return false}function U(n){if(!n||typeof n!=="object"||Array.isArray(n)){return void 0}const e=n;if(e["kind"]!=="render"&&e["kind"]!=="export"&&e["kind"]!=="inspect"||typeof e["fileName"]!=="string"||typeof e["contentType"]!=="string"||typeof e["byteLength"]!=="number"||!Number.isFinite(e["byteLength"])||e["status"]!=="saved"||typeof e["path"]!=="string"){return void 0}return{kind:e["kind"],fileName:e["fileName"],contentType:e["contentType"],byteLength:e["byteLength"],path:e["path"]}}function W(n,e){if(n["status"]!=="pending"||typeof n["path"]!=="string"){return false}if(n["path"]!==e.path){return false}return e.kind==="inspect"?typeof n["recordCount"]==="number"&&Number.isFinite(n["recordCount"])&&n["recordCount"]>=0&&typeof n["truncated"]==="boolean"&&!!n["metadata"]&&typeof n["metadata"]==="object"&&!Array.isArray(n["metadata"]):n["fileName"]===e.fileName&&n["contentType"]===e.contentType&&n["byteLength"]===e.byteLength}function R(n,e){let t;try{t=JSON.stringify(n)}catch{return void 0}if(t===void 0||Buffer.byteLength(t)>e){return void 0}return JSON.parse(t)}function O(n){if(n.length<=w)return n;return`${n.slice(0,w-1)}\u2026`}
|
||||
Generated
Vendored
+2
File diff suppressed because one or more lines are too long
Generated
Vendored
+3000
File diff suppressed because one or more lines are too long
Generated
Vendored
+2994
File diff suppressed because one or more lines are too long
Generated
Vendored
+2993
File diff suppressed because one or more lines are too long
Generated
Vendored
+54
File diff suppressed because one or more lines are too long
Generated
Vendored
+3365
File diff suppressed because one or more lines are too long
Generated
Vendored
BIN
Binary file not shown.
Generated
Vendored
+2
File diff suppressed because one or more lines are too long
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
||||
var s=Symbol.for("@oai/granola/presentation-jsx.element");var r=Symbol.for("@oai/granola/presentation-jsx.fragment");function o(e,t,...a){return n(e,t)}function n(e,t){if(typeof e==="function"){return e(t)}return{$$type:s,type:e,props:t}}export{r as Fragment,o as jsxDEV};
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
||||
var s=Symbol.for("@oai/granola/presentation-jsx.element");var r=Symbol.for("@oai/granola/presentation-jsx.fragment");function o(e,t){return n(e,t)}function a(e,t){return n(e,t)}function n(e,t){if(typeof e==="function"){return e(t)}return{$$type:s,type:e,props:t}}export{r as Fragment,o as jsx,a as jsxs};
|
||||
Reference in New Issue
Block a user