@crewx/sdk 0.9.0-rc.178 → 0.9.0-rc.179

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.
@@ -0,0 +1,69 @@
1
+ export interface AppUiToolCall {
2
+ readonly name: string;
3
+ readonly arguments?: Readonly<Record<string, unknown>>;
4
+ }
5
+ export interface AppUiCallOptions {
6
+ readonly timeout?: number;
7
+ readonly resetTimeoutOnProgress?: boolean;
8
+ readonly onprogress?: (progress: AppUiProgress) => void;
9
+ }
10
+ export interface AppUiProgress {
11
+ readonly progress: number;
12
+ readonly total?: number;
13
+ readonly message?: string;
14
+ }
15
+ export interface AppUiToolResult {
16
+ readonly isError?: boolean;
17
+ readonly structuredContent?: Readonly<Record<string, unknown>>;
18
+ }
19
+ export interface AppUiToolCaller {
20
+ callServerTool(params: AppUiToolCall, options?: AppUiCallOptions): Promise<AppUiToolResult>;
21
+ }
22
+ export declare class CrewxAppToolError extends Error {
23
+ readonly code: string;
24
+ constructor(code: string, message?: string);
25
+ }
26
+ export interface AppUiShareResult {
27
+ readonly shareId: string;
28
+ readonly url: string;
29
+ readonly revision: number;
30
+ readonly status: 'active';
31
+ readonly viewer: 'app' | 'markdown';
32
+ }
33
+ export interface AppUiFileEntry {
34
+ readonly ref: string;
35
+ readonly version: string;
36
+ readonly bytes: number;
37
+ }
38
+ export interface AppUiFilesListResult {
39
+ readonly files: readonly AppUiFileEntry[];
40
+ readonly next?: string;
41
+ }
42
+ export interface AppUiFileReadResult {
43
+ readonly ref: string;
44
+ readonly text: string;
45
+ readonly version: string;
46
+ }
47
+ export interface AppUiFileWriteResult {
48
+ readonly ref: string;
49
+ readonly version: string;
50
+ }
51
+ export interface AppUiShareInput {
52
+ readonly ref: string;
53
+ readonly onprogress?: (progress: AppUiProgress) => void;
54
+ }
55
+ export interface AppUiListFilesInput {
56
+ readonly prefix?: string;
57
+ readonly after?: string;
58
+ }
59
+ export interface AppUiWriteFileInput {
60
+ readonly ref: string;
61
+ readonly text: string;
62
+ readonly expectedVersion: string | null;
63
+ }
64
+ export declare function share(app: AppUiToolCaller, input: AppUiShareInput): Promise<AppUiShareResult>;
65
+ export declare function listFiles(app: AppUiToolCaller, input?: AppUiListFilesInput): Promise<AppUiFilesListResult>;
66
+ export declare function readFile(app: AppUiToolCaller, input: {
67
+ readonly ref: string;
68
+ }): Promise<AppUiFileReadResult>;
69
+ export declare function writeFile(app: AppUiToolCaller, input: AppUiWriteFileInput): Promise<AppUiFileWriteResult>;
@@ -0,0 +1 @@
1
+ 'use strict';var i=class extends Error{code;constructor(e,t=e){super(t),this.name="CrewxAppToolError",this.code=e;}},u=1200*1e3;function g(r,e){return s(r,{name:"crewx_docs_share",arguments:{ref:e.ref}},{timeout:u,resetTimeoutOnProgress:true,onprogress:e.onprogress??(()=>{})})}function y(r,e={}){return s(r,{name:"crewx_files_list",arguments:{...e}})}function f(r,e){return s(r,{name:"crewx_files_read",arguments:{ref:e.ref}})}function A(r,e){return s(r,{name:"crewx_files_write",arguments:{ref:e.ref,text:e.text,expectedVersion:e.expectedVersion}})}async function s(r,e,t){let n=t===void 0?await r.callServerTool(e):await r.callServerTool(e,t);if(n.isError===true){let l=n.structuredContent?.error,o=a(l)?l:void 0,p=typeof o?.code=="string"?o.code:"TOOL_ERROR",d=typeof o?.message=="string"?o.message:p;throw new i(p,d)}if(!a(n.structuredContent))throw new i("TOOL_RESULT_INVALID",`${e.name} returned no structured result`);return n.structuredContent}function a(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}exports.CrewxAppToolError=i;exports.listFiles=y;exports.readFile=f;exports.share=g;exports.writeFile=A;