needle-cloud 2.5.0 → 2.6.0
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/CHANGELOG.md +11 -1
- package/README.md +46 -1
- package/dist/cli-65a6a5f1.js +1 -0
- package/dist/cli.esm.js +1 -1
- package/dist/cli.send-logs.discovery-0e806cf7.js +1 -0
- package/dist/index.d.ts +137 -19
- package/dist/index.esm.js +1 -1
- package/package.json +1 -2
- package/dist/cli-b841fbf0.js +0 -1
- package/dist/cli.send-logs.discovery-d2ef0523.js +0 -1
package/dist/cli.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node-fetch";import"@web-std/file";import"node:crypto";export{p as program}from"./cli-
|
|
1
|
+
import"node-fetch";import"@web-std/file";import"node:crypto";export{p as program}from"./cli-65a6a5f1.js";import"fs";import"dotenv";import"ora";import"commander";import"child_process";import"open";import"path";import"node:fs";import"node:fs/promises";import"node:os";import"node:path";import"util";import"stream";import"http";import"https";import"url";import"crypto";import"net";import"tls";import"assert";import"tty";import"os";import"events";import"http2";import"zlib";import"node:readline/promises";import"@logto/node";import"node:readline";import"node:stream";import"node:zlib";import"express";import"ws";import"minimatch";import"body-parser";import"node:child_process";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as t,readdirSync as o,statSync as r}from"node:fs";import{dirname as i,join as e}from"node:path";import{g as n}from"./cli-65a6a5f1.js";import"node-fetch";import"@web-std/file";import"node:crypto";import"commander";import"fs";import"child_process";import"open";import"path";import"ora";import"node:fs/promises";import"node:os";import"util";import"stream";import"http";import"https";import"url";import"crypto";import"net";import"tls";import"assert";import"tty";import"os";import"events";import"http2";import"zlib";import"node:readline/promises";import"dotenv";import"@logto/node";import"node:readline";import"node:stream";import"node:zlib";import"express";import"ws";import"minimatch";import"body-parser";import"node:child_process";function p(){var p;let m;try{m=n()}catch{return null}const s=null==(p=m)||null==(p=p.entries)?void 0:p[0];if(!s)return null;if(!s.log_location)return null;if("unity"!==s.editor&&"blender"!==s.editor)return null;if(!t(s.log_location))return null;const l=s.log_location,c=function(t,i){const n=new Set([i]);try{for(const i of o(t)){if(!i.toLowerCase().endsWith(".log"))continue;const o=e(t,i);try{if(!r(o).isFile())continue}catch{continue}n.add(o)}}catch{}return[...n]}(i(l),l);return{editor:s.editor,path:l,paths:c}}export{p as findActiveEditorLog};
|
package/dist/index.d.ts
CHANGED
|
@@ -159,10 +159,15 @@ type AiTokenUsageInfo = {
|
|
|
159
159
|
|
|
160
160
|
type RecentChatsResponse$1 = {
|
|
161
161
|
data: Array<{
|
|
162
|
+
chat_id: string,
|
|
162
163
|
slug: string,
|
|
163
164
|
topic: string,
|
|
164
165
|
created_at: string,
|
|
165
166
|
updated_at?: string,
|
|
167
|
+
/** Total saved messages in the session, including user and AI messages. */
|
|
168
|
+
message_count: number,
|
|
169
|
+
/** Person who started the shared session. */
|
|
170
|
+
started_by: { id: string; name: string | null } | null,
|
|
166
171
|
}>
|
|
167
172
|
}
|
|
168
173
|
|
|
@@ -228,7 +233,6 @@ type ChatMessage = {
|
|
|
228
233
|
attachments?: ChatMessageAttachment[],
|
|
229
234
|
metadata?: {
|
|
230
235
|
tokens?: { input: number, output: number },
|
|
231
|
-
model?: string,
|
|
232
236
|
/** True while the AI is still streaming a response. Absent or false when the message is complete. */
|
|
233
237
|
is_partial?: boolean,
|
|
234
238
|
/** True when the user stopped generation mid-stream. */
|
|
@@ -296,11 +300,27 @@ type AICompletionOptions = {
|
|
|
296
300
|
/** Response of a one-shot completion (POST /v1/ai/completions). */
|
|
297
301
|
type AICompletionResponse = {
|
|
298
302
|
text: string,
|
|
299
|
-
/** The model that served the completion (server-resolved). */
|
|
300
|
-
model: string,
|
|
301
303
|
token_usage: AiTokenUsageInfo,
|
|
302
304
|
}
|
|
303
305
|
|
|
306
|
+
/** JSON data supplied as context or instructions for an evaluation. */
|
|
307
|
+
type AIEvaluationValue = string | number | boolean | null | AIEvaluationValue[] | { [key: string]: AIEvaluationValue };
|
|
308
|
+
type AIEvaluationState$1 = string | AIEvaluationValue[] | { [key: string]: AIEvaluationValue };
|
|
309
|
+
/** A focused question to evaluate against the supplied state. */
|
|
310
|
+
type AIEvaluationQuestion$1 =
|
|
311
|
+
| { type: "boolean", instructions: AIEvaluationState$1, criteria?: { true?: string, false?: string } }
|
|
312
|
+
| { type: "choice", instructions: AIEvaluationState$1, criteria: Record<string, string | null> }
|
|
313
|
+
| { type: "score", instructions: AIEvaluationState$1, criteria: string[] };
|
|
314
|
+
/** Up to 32 named questions, answered together against the same state. */
|
|
315
|
+
type AIEvaluationQuestions$1 = Record<string, AIEvaluationQuestion$1>;
|
|
316
|
+
type AIEvaluationAnswer$1 =
|
|
317
|
+
| { type: "boolean", probability: number }
|
|
318
|
+
| { type: "choice", choice: string, probabilities: Record<string, number>, confidence: number }
|
|
319
|
+
| { type: "score", score: number, probabilities: Record<string, number>, confidence: number };
|
|
320
|
+
/** Answers use the question IDs from the request. Quota usage reflects discounted evaluation billing. */
|
|
321
|
+
type AIEvaluationResponse$1 = { answers: Record<string, AIEvaluationAnswer$1>, token_usage: AiTokenUsageInfo };
|
|
322
|
+
type AIEvaluationOptions$1 = { signal?: AbortSignal };
|
|
323
|
+
|
|
304
324
|
/**
|
|
305
325
|
* Discriminated union for events yielded by the SSE chat stream.
|
|
306
326
|
*
|
|
@@ -586,13 +606,15 @@ type ChatSessionSendOptions$1 = {
|
|
|
586
606
|
}
|
|
587
607
|
|
|
588
608
|
/**
|
|
589
|
-
* @typedef {{ name: string, mimetype: string, buffer:
|
|
609
|
+
* @typedef {{ name: string, mimetype: string, buffer:ArrayBuffer | Uint8Array }} Filelike
|
|
590
610
|
* @typedef {import("../web.types.js").AuthData} AuthData
|
|
591
611
|
*/
|
|
592
612
|
/**
|
|
593
613
|
* @param {Array<Filelike>} files
|
|
594
614
|
* @param {{org?:string|null} & { name?:string, abort?:AbortSignal, authToken?:string|null, type?:"upload"|"deployment",
|
|
595
615
|
* content_id?:string, thumbnail?:File,
|
|
616
|
+
* verify?:import("@needle-tools/cloud-sdk/types").UploadFilesOptions["verify"],
|
|
617
|
+
* progress?:(args:import("@needle-tools/cloud-sdk/types").ProgressEventArgs)=>void,
|
|
596
618
|
* metadata?:import("@needle-tools/cloud-sdk/types").JobMetadata }} opts
|
|
597
619
|
* `metadata` records where this upload came from — the change that produced it, what
|
|
598
620
|
* built it, and anything else you want to keep with it. It shows on the version in
|
|
@@ -627,6 +649,8 @@ declare function uploadFiles(files: Array<Filelike>, opts: {
|
|
|
627
649
|
type?: "upload" | "deployment";
|
|
628
650
|
content_id?: string;
|
|
629
651
|
thumbnail?: File;
|
|
652
|
+
verify?: _needle_tools_cloud_sdk_types.UploadFilesOptions["verify"];
|
|
653
|
+
progress?: (args: _needle_tools_cloud_sdk_types.ProgressEventArgs) => void;
|
|
630
654
|
metadata?: _needle_tools_cloud_sdk_types.JobMetadata;
|
|
631
655
|
}): Promise<{
|
|
632
656
|
error: string;
|
|
@@ -640,7 +664,7 @@ declare function uploadFiles(files: Array<Filelike>, opts: {
|
|
|
640
664
|
type Filelike = {
|
|
641
665
|
name: string;
|
|
642
666
|
mimetype: string;
|
|
643
|
-
buffer:
|
|
667
|
+
buffer: ArrayBuffer | Uint8Array;
|
|
644
668
|
};
|
|
645
669
|
type AuthData = AuthData$1;
|
|
646
670
|
|
|
@@ -817,6 +841,17 @@ declare function createChatSession(options?: ChatSessionOptions$1, authOpts?: Ch
|
|
|
817
841
|
* @returns {Promise<import("@needle-tools/cloud-sdk/types/api.ai.js").AICompletionResponse>}
|
|
818
842
|
*/
|
|
819
843
|
declare function aiComplete(message: string, options?: AICompletionOptions, authOpts?: ChatAuthOpts): Promise<AICompletionResponse>;
|
|
844
|
+
/**
|
|
845
|
+
* Evaluate state against focused questions without creating a chat or executing actions.
|
|
846
|
+
* Evaluation usage counts toward the team's AI quota at a discounted rate.
|
|
847
|
+
* @experimental This API may change in future releases.
|
|
848
|
+
* @param {import('@needle-tools/cloud-sdk/types/api.ai.js').AIEvaluationState} state
|
|
849
|
+
* @param {import('@needle-tools/cloud-sdk/types/api.ai.js').AIEvaluationQuestions} questions
|
|
850
|
+
* @param {import('@needle-tools/cloud-sdk/types/api.ai.js').AIEvaluationOptions} [options]
|
|
851
|
+
* @param {ChatAuthOpts} [authOpts]
|
|
852
|
+
* @returns {Promise<import('@needle-tools/cloud-sdk/types/api.ai.js').AIEvaluationResponse>}
|
|
853
|
+
*/
|
|
854
|
+
declare function aiEvaluate(state: AIEvaluationState$1, questions: AIEvaluationQuestions$1, options?: AIEvaluationOptions$1, authOpts?: ChatAuthOpts): Promise<AIEvaluationResponse$1>;
|
|
820
855
|
type ChatAuthOpts = {
|
|
821
856
|
org?: string;
|
|
822
857
|
authToken?: string;
|
|
@@ -826,6 +861,64 @@ type ChatSessionOptions = ChatSessionOptions$1;
|
|
|
826
861
|
type ChatSessionHandle = ChatSessionHandle$1;
|
|
827
862
|
type ChatSessionSendOptions = ChatSessionSendOptions$1;
|
|
828
863
|
type ToolDefinition = ToolDefinition$1;
|
|
864
|
+
type AIEvaluationState = AIEvaluationState$1;
|
|
865
|
+
type AIEvaluationQuestion = AIEvaluationQuestion$1;
|
|
866
|
+
type AIEvaluationQuestions = AIEvaluationQuestions$1;
|
|
867
|
+
type AIEvaluationAnswer = AIEvaluationAnswer$1;
|
|
868
|
+
type AIEvaluationResponse = AIEvaluationResponse$1;
|
|
869
|
+
type AIEvaluationOptions = AIEvaluationOptions$1;
|
|
870
|
+
|
|
871
|
+
declare type LogLevel = "none" | "info" | "debug";
|
|
872
|
+
|
|
873
|
+
declare type ProgressEventArgs = {
|
|
874
|
+
/** Bytes uploaded */
|
|
875
|
+
uploadedBytes: number,
|
|
876
|
+
/** Total bytes to upload / total size of all files */
|
|
877
|
+
totalBytes: number,
|
|
878
|
+
/** Progress of total upload in normalized range */
|
|
879
|
+
progress01: number,
|
|
880
|
+
/** File that is currently being uploaded */
|
|
881
|
+
fileName: string,
|
|
882
|
+
/** The size of the file being uploaded in bytes */
|
|
883
|
+
fileSize: number,
|
|
884
|
+
/** The progress in normalized range for this file upload */
|
|
885
|
+
fileProgress01: number,
|
|
886
|
+
/** The index of the file being uploaded */
|
|
887
|
+
fileIndex: number,
|
|
888
|
+
/** The number of files being uploaded */
|
|
889
|
+
totalFiles: number,
|
|
890
|
+
/** Elapsed time since the upload started */
|
|
891
|
+
elapsedTime: number,
|
|
892
|
+
estimatedTimeLeft: number,
|
|
893
|
+
/** Estimate until finished */
|
|
894
|
+
estimatedTimeLeftDisplay: string,
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
declare type UploadFilesOptions = {
|
|
898
|
+
/** Upload to a specific view */
|
|
899
|
+
content_id?: string,
|
|
900
|
+
parent_job_id?: string,
|
|
901
|
+
/** The project name or a view id */
|
|
902
|
+
name?: string,
|
|
903
|
+
type?: Extract<JobType, "upload" | "conversion" | "deployment">,
|
|
904
|
+
/** Content type for the upload. If omitted, material-only glTF/GLB and
|
|
905
|
+
* environment maps are detected automatically. For recognized assets,
|
|
906
|
+
* an explicit type must match the file's contents. */
|
|
907
|
+
content_type?: Extract<ContentType, "material" | "3d-asset" | "hdri">,
|
|
908
|
+
/** Whether the upload should receive the standard post-upload processing
|
|
909
|
+
* jobs (asset optimization and related derived formats). Defaults to true.
|
|
910
|
+
* Pass false to store the files exactly as uploaded, with no jobs
|
|
911
|
+
* scheduled. */
|
|
912
|
+
optimizations?: boolean,
|
|
913
|
+
/** Verify stored file names and sizes before completion. Defaults to false.
|
|
914
|
+
* Storage listing failures are retried; exhaustion logs a warning and allows completion. */
|
|
915
|
+
verify?: boolean,
|
|
916
|
+
abort?: AbortSignal,
|
|
917
|
+
loglevel?: LogLevel,
|
|
918
|
+
onStart?: (id: string, content_id: string) => void,
|
|
919
|
+
/** The progress event is called for each file being uploaded and may be called multiple times for each file while the file is being uploaded */
|
|
920
|
+
progress?: (args: ProgressEventArgs) => void,
|
|
921
|
+
}
|
|
829
922
|
|
|
830
923
|
type TriggerType = "web" | "cli";
|
|
831
924
|
|
|
@@ -907,6 +1000,8 @@ declare type OptimizationParameters = {
|
|
|
907
1000
|
|
|
908
1001
|
declare type UploadParameters = {
|
|
909
1002
|
total_files: number,
|
|
1003
|
+
/** Opt in to best-effort storage verification at completion. */
|
|
1004
|
+
verify?: UploadFilesOptions["verify"],
|
|
910
1005
|
/** Injected by createJob when a parent job is referenced */
|
|
911
1006
|
job_identifier?: string,
|
|
912
1007
|
}
|
|
@@ -1638,6 +1733,14 @@ type UpdateContentRequestBody = {
|
|
|
1638
1733
|
};
|
|
1639
1734
|
};
|
|
1640
1735
|
|
|
1736
|
+
/** Response from moving a content item to Trash.
|
|
1737
|
+
* Deletion immediately frees total storage capacity but does not refund monthly usage.
|
|
1738
|
+
*/
|
|
1739
|
+
type DeleteContentResponse = {
|
|
1740
|
+
identifier: string;
|
|
1741
|
+
message: string;
|
|
1742
|
+
};
|
|
1743
|
+
|
|
1641
1744
|
/**
|
|
1642
1745
|
* List publicly discoverable content items on Needle Cloud.
|
|
1643
1746
|
*
|
|
@@ -1744,6 +1847,16 @@ declare function updateContent(identifier: string, data: {
|
|
|
1744
1847
|
} & Omit<UpdateContentRequestBody, "upload_thumbnail" | "password" | "is_public">): Promise<{
|
|
1745
1848
|
success: boolean;
|
|
1746
1849
|
}>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Move a content item to the trash. It can be restored through Needle Cloud.
|
|
1852
|
+
* @param {string} identifier
|
|
1853
|
+
* @param {{ org?: string, authToken?: string }} [opts]
|
|
1854
|
+
* @returns {Promise<import("@needle-tools/cloud-sdk/types/api.content").DeleteContentResponse>}
|
|
1855
|
+
*/
|
|
1856
|
+
declare function deleteContent(identifier: string, opts?: {
|
|
1857
|
+
org?: string;
|
|
1858
|
+
authToken?: string;
|
|
1859
|
+
}): Promise<DeleteContentResponse>;
|
|
1747
1860
|
|
|
1748
1861
|
/**
|
|
1749
1862
|
* Generate a 3D model from a text prompt and wait until it is ready.
|
|
@@ -2223,14 +2336,10 @@ declare function getProjectPromotions(project: string, opts?: {
|
|
|
2223
2336
|
|
|
2224
2337
|
/**
|
|
2225
2338
|
* Start the checkout process
|
|
2226
|
-
* @param {
|
|
2339
|
+
* @param {import("@needle-tools/cloud-sdk/types").StartCheckoutSessionOptions} args
|
|
2340
|
+
* @returns {Promise<import("@needle-tools/cloud-sdk/types").StartCheckoutSessionResult>}
|
|
2227
2341
|
*/
|
|
2228
|
-
declare function startCheckoutSession(args:
|
|
2229
|
-
price_id: string;
|
|
2230
|
-
}): Promise<{
|
|
2231
|
-
ok: boolean;
|
|
2232
|
-
status: number;
|
|
2233
|
-
}>;
|
|
2342
|
+
declare function startCheckoutSession(args: _needle_tools_cloud_sdk_types.StartCheckoutSessionOptions): Promise<_needle_tools_cloud_sdk_types.StartCheckoutSessionResult>;
|
|
2234
2343
|
|
|
2235
2344
|
/**
|
|
2236
2345
|
* Public price lookup. Deliberately kept in its own module, free of any auth
|
|
@@ -2287,7 +2396,7 @@ type GetProductInformationOptions = _needle_tools_cloud_sdk_types.GetProductInfo
|
|
|
2287
2396
|
* @typedef {import("@needle-tools/cloud-sdk/types").CheckoutProductOptions} CheckoutProductOptions
|
|
2288
2397
|
*/
|
|
2289
2398
|
/**
|
|
2290
|
-
* Start a checkout
|
|
2399
|
+
* Start a checkout and return its Stripe URL and correlation identifier.
|
|
2291
2400
|
*
|
|
2292
2401
|
* Returns the url rather than navigating, so the caller decides: a web app can
|
|
2293
2402
|
* assign `location.href`, an editor can open a tab and poll for the license on
|
|
@@ -2297,13 +2406,22 @@ type GetProductInformationOptions = _needle_tools_cloud_sdk_types.GetProductInfo
|
|
|
2297
2406
|
* Authenticated: the server derives the buyer from the token, which is what makes
|
|
2298
2407
|
* prefilling — and locking — the checkout email safe.
|
|
2299
2408
|
*
|
|
2409
|
+
* Track the returned checkoutId with your checkout-start event. Confirm purchases
|
|
2410
|
+
* from a verified payment notification, not from opening or returning from the URL.
|
|
2411
|
+
*
|
|
2412
|
+
* @example
|
|
2413
|
+
* const checkout = await checkoutProduct("Needle Inspector", {
|
|
2414
|
+
* tracking: { source: "export_gltf", attemptId: crypto.randomUUID() },
|
|
2415
|
+
* });
|
|
2416
|
+
* if (checkout) {
|
|
2417
|
+
* // Record checkout.checkoutId with your analytics, then open checkout.url.
|
|
2418
|
+
* }
|
|
2419
|
+
*
|
|
2300
2420
|
* @param {string} product product name, e.g. "needle_inspector"
|
|
2301
2421
|
* @param {CheckoutProductOptions} [options]
|
|
2302
|
-
* @returns {Promise<
|
|
2422
|
+
* @returns {Promise<import("@needle-tools/cloud-sdk/types").CheckoutProductResult | null>}
|
|
2303
2423
|
*/
|
|
2304
|
-
declare function checkoutProduct(product: string, options?: CheckoutProductOptions): Promise<
|
|
2305
|
-
url: string;
|
|
2306
|
-
} | null>;
|
|
2424
|
+
declare function checkoutProduct(product: string, options?: CheckoutProductOptions): Promise<_needle_tools_cloud_sdk_types.CheckoutProductResult | null>;
|
|
2307
2425
|
/**
|
|
2308
2426
|
* Purchase flow BY PRODUCT NAME.
|
|
2309
2427
|
*
|
|
@@ -2323,5 +2441,5 @@ declare namespace AuthScopes {
|
|
|
2323
2441
|
let All: string[];
|
|
2324
2442
|
}
|
|
2325
2443
|
|
|
2326
|
-
export { Auth, AuthScopes, NeedleLoginButton, aiComplete, archiveProject, checkProjectBlobs, checkoutProduct, cloneProject, completeProjectBlobUpload, createChatSession, createProject, deleteProject, generate3dAsset, getContent, getDeployments, getProductInformation, getProjectDeployments, getProjectHead, getProjectPromotions, getPublicContent, getUserLicenses, listChats, listContent, listProjectRevisions, listProjects, listPublicContent, ownsProduct, promoteProjectAsset, pullProjectRevision, pushProjectRevision, recordProjectDeployment, requestProjectBlobDownload, requestProjectBlobUpload, restoreProject, startCheckoutSession, unarchiveProject, updateContent, updateProject, updateProjectRevision, uploadFiles };
|
|
2327
|
-
export type { AuthData, AuthInitOpts, ChatAuthOpts, ChatSessionHandle, ChatSessionOptions, ChatSessionSendOptions, Deployment, Filelike, LogtoUserCustomData, RecentChatsResponse, ResourceUrl, ToolDefinition, UserInfoResponse };
|
|
2444
|
+
export { Auth, AuthScopes, NeedleLoginButton, aiComplete, aiEvaluate, archiveProject, checkProjectBlobs, checkoutProduct, cloneProject, completeProjectBlobUpload, createChatSession, createProject, deleteContent, deleteProject, generate3dAsset, getContent, getDeployments, getProductInformation, getProjectDeployments, getProjectHead, getProjectPromotions, getPublicContent, getUserLicenses, listChats, listContent, listProjectRevisions, listProjects, listPublicContent, ownsProduct, promoteProjectAsset, pullProjectRevision, pushProjectRevision, recordProjectDeployment, requestProjectBlobDownload, requestProjectBlobUpload, restoreProject, startCheckoutSession, unarchiveProject, updateContent, updateProject, updateProjectRevision, uploadFiles };
|
|
2445
|
+
export type { AIEvaluationAnswer, AIEvaluationOptions, AIEvaluationQuestion, AIEvaluationQuestions, AIEvaluationResponse, AIEvaluationState, AuthData, AuthInitOpts, ChatAuthOpts, ChatSessionHandle, ChatSessionOptions, ChatSessionSendOptions, Deployment, Filelike, LogtoUserCustomData, RecentChatsResponse, ResourceUrl, ToolDefinition, UserInfoResponse };
|