needle-cloud 1.10.2 → 1.10.3-dev.1455a0e

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,74 @@
1
+ /**
2
+ * List recent AI chats for the authenticated user.
3
+ * @param {{ org?: string }} [opts]
4
+ * @returns {Promise<import("@needle-tools/cloud-sdk/types/api.ai").RecentChatsResponse>}
5
+ */
6
+ export function listChats(opts?: {
7
+ org?: string;
8
+ }): Promise<import("@needle-tools/cloud-sdk/types/api.ai").RecentChatsResponse>;
9
+ /**
10
+ * Read an AI chat by slug. Returns JSON with messages by default.
11
+ * When `reconnect: true`, attempts to reconnect to an active SSE stream.
12
+ * @overload
13
+ * @param {string} slug
14
+ * @param {{ org?: string, offset?: number, limit?: number, personal?: boolean, reconnect?: false }} [opts]
15
+ * @returns {Promise<import("@needle-tools/cloud-sdk/types/api.ai").AIChatGETResponse>}
16
+ */
17
+ /**
18
+ * @overload
19
+ * @param {string} slug
20
+ * @param {{ org?: string, personal?: boolean, reconnect: true, signal?: AbortSignal }} opts
21
+ * @returns {Promise<AsyncGenerator<import("@needle-tools/cloud-sdk/types/api.ai").ChatStreamEvent> | null>}
22
+ */
23
+ /**
24
+ * @param {string} slug
25
+ * @param {{ org?: string, offset?: number, limit?: number, personal?: boolean, reconnect?: boolean, signal?: AbortSignal }} [opts]
26
+ * @returns {Promise<import("@needle-tools/cloud-sdk/types/api.ai").AIChatGETResponse | AsyncGenerator<import("@needle-tools/cloud-sdk/types/api.ai").ChatStreamEvent> | null>}
27
+ */
28
+ export function readChat(slug: string, opts?: {
29
+ org?: string;
30
+ offset?: number;
31
+ limit?: number;
32
+ personal?: boolean;
33
+ reconnect?: boolean;
34
+ signal?: AbortSignal;
35
+ }): Promise<import("@needle-tools/cloud-sdk/types/api.ai").AIChatGETResponse | AsyncGenerator<import("@needle-tools/cloud-sdk/types/api.ai").ChatStreamEvent> | null>;
36
+ /**
37
+ * Send a message to an AI chat.
38
+ * @overload
39
+ * @param {string} slug
40
+ * @param {string} message
41
+ * @param {{ org?: string, stream?: false, source?: string, personal?: boolean, full_url?: string, pathname?: string }} [opts]
42
+ * @returns {Promise<import("@needle-tools/cloud-sdk/types/api.ai").AIChatSyncResponse>}
43
+ */
44
+ /**
45
+ * @overload
46
+ * @param {string} slug
47
+ * @param {string} message
48
+ * @param {{ org?: string, stream: true, source?: string, personal?: boolean, full_url?: string, pathname?: string }} opts
49
+ * @returns {Promise<AsyncGenerator<import("@needle-tools/cloud-sdk/types/api.ai").ChatStreamEvent>>}
50
+ */
51
+ /**
52
+ * @param {string} slug
53
+ * @param {string} message
54
+ * @param {{ org?: string, stream?: boolean, source?: string, personal?: boolean, full_url?: string, pathname?: string }} [opts]
55
+ * @returns {Promise<import("@needle-tools/cloud-sdk/types/api.ai").AIChatSyncResponse | AsyncGenerator<import("@needle-tools/cloud-sdk/types/api.ai").ChatStreamEvent>>}
56
+ */
57
+ export function sendChatMessage(slug: string, message: string, opts?: {
58
+ org?: string;
59
+ stream?: boolean;
60
+ source?: string;
61
+ personal?: boolean;
62
+ full_url?: string;
63
+ pathname?: string;
64
+ }): Promise<import("@needle-tools/cloud-sdk/types/api.ai").AIChatSyncResponse | AsyncGenerator<import("@needle-tools/cloud-sdk/types/api.ai").ChatStreamEvent>>;
65
+ /**
66
+ * Interrupt an active AI generation for the given chat slug.
67
+ * @param {string} slug
68
+ * @param {{ org?: string, personal?: boolean }} [opts]
69
+ * @returns {Promise<void>}
70
+ */
71
+ export function interruptChat(slug: string, opts?: {
72
+ org?: string;
73
+ personal?: boolean;
74
+ }): Promise<void>;
@@ -1,21 +1,3 @@
1
- /**
2
- * Unfortunately this doesnt get properly bundles in the final output so we have to write the types below directly
3
- * @typedef {import("@needle-tools/cloud-sdk/types").JobType} JobType
4
- * @typedef {import("@needle-tools/cloud-sdk/types").JobStatus} JobStatus
5
- */
6
- /**
7
- * @param {{ org?:string } & ({ name?: string, view_id?:string } | { page: number, limit: number })} opts
8
- * @returns {Promise<Array<import("../web.types.js").Upload>>}
9
- */
10
- export function getUploads(opts: {
11
- org?: string;
12
- } & ({
13
- name?: string;
14
- view_id?: string;
15
- } | {
16
- page: number;
17
- limit: number;
18
- })): Promise<Array<import("../web.types.js").Upload>>;
19
1
  /**
20
2
  * @param {{ org?:string } & { offset?:number, limit?: number }} opts
21
3
  * @returns {Promise<Array<Deployment>>}
@@ -45,14 +27,6 @@ export function getUserLicenses(opts: {
45
27
  export function ownsProduct(opts: {
46
28
  product?: string | string[];
47
29
  }): Promise<boolean>;
48
- /**
49
- * Unfortunately this doesnt get properly bundles in the final output so we have to write the types below directly
50
- */
51
- export type JobType = import("@needle-tools/cloud-sdk/types").JobType;
52
- /**
53
- * Unfortunately this doesnt get properly bundles in the final output so we have to write the types below directly
54
- */
55
- export type JobStatus = import("@needle-tools/cloud-sdk/types").JobStatus;
56
30
  export type Deployment = {
57
31
  name: string;
58
32
  url: string;
@@ -1,3 +1,4 @@
1
1
  export * from "./upload.js";
2
2
  export * from "./get.js";
3
+ export * from "./chat.js";
3
4
  export { startCheckoutSession } from "./checkout.js";
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @param {Array<Filelike>} files
7
7
  * @param {{org?:string|null} & { name?:string, abort?:AbortSignal, }} opts
8
- * @returns {Promise<{error:string} | {job_id:string, view_id:string, url?:string | null, skipped?:boolean}>}
8
+ * @returns {Promise<{error:string} | {job_id:string, content_id:string, url?:string | null, skipped?:boolean}>}
9
9
  */
10
10
  export function uploadFiles(files: Array<Filelike>, opts: {
11
11
  org?: string | null;
@@ -16,7 +16,7 @@ export function uploadFiles(files: Array<Filelike>, opts: {
16
16
  error: string;
17
17
  } | {
18
18
  job_id: string;
19
- view_id: string;
19
+ content_id: string;
20
20
  url?: string | null;
21
21
  skipped?: boolean;
22
22
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "needle-cloud",
3
- "version": "1.10.2",
3
+ "version": "1.10.3-dev.1455a0e",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "needle-cloud": "./bin/cli.js"
@@ -31,14 +31,12 @@
31
31
  "devDependencies": {
32
32
  "@needle-tools/cloud-sdk": "1.0.0-alpha",
33
33
  "concurrently": "^9.0.1",
34
- "microbundle": "^0.15.1",
35
- "vitest": "^2.1.1"
34
+ "microbundle": "^0.15.1"
36
35
  },
37
36
  "engines": {
38
37
  "node": ">= 18"
39
38
  },
40
39
  "scripts": {
41
- "test": "vitest",
42
40
  "install-local-deps": "cd ../needle-share-sdk && npm install",
43
41
  "deploy:main": "npm run deploy -- --tag main",
44
42
  "deploy": "npm run dist & npm publish --access public",
@@ -48,10 +46,10 @@
48
46
  "dev:web": "microbundle watch -i ./src/index.js -o dist/index.js --format esm --generateTypes --target web --no-compress",
49
47
  "dev:node": "microbundle watch -i ./src/cli.js -o dist/cli.js --format esm --target node --no-compress",
50
48
  "dist": "npx --yes rimraf dist && npm run dist:web && npm run dist:node",
51
- "dist:web": "microbundle -i ./src/index.js -o dist/index.js --format esm --generateTypes --target web --sourcemap true --compress true --define api_endpoint=https://cloud.needle.tools/api,cloud_base_url=https://cloud.needle.tools",
52
- "dist:web-preview": "microbundle -i ./src/index.js -o dist/index.js --format esm --generateTypes --target web --sourcemap true --compress true --define api_endpoint=https://cloud-staging.needle.tools/api,cloud_base_url=https://cloud-staging.needle.tools",
53
- "dist:node": "microbundle -i ./src/cli.js -o dist/cli.js --format esm --generateTypes --target node --sourcemap false --compress --define api_endpoint=https://cloud.needle.tools/api,cloud_base_url=https://cloud.needle.tools",
54
- "dist:node-preview": "microbundle -i ./src/cli.js -o dist/cli.js --format esm --generateTypes --target node --sourcemap false --compress --define api_endpoint=https://cloud-staging.needle.tools/api,cloud_base_url=https://cloud-staging.needle.tools",
49
+ "dist:web": "microbundle -i ./src/index.js -o dist/index.js --format esm --generateTypes --target web --sourcemap false --compress true --define api_endpoint=https://cloud.needle.tools/api,cloud_base_url=https://cloud.needle.tools,logto_endpoint=https://auth.needle.tools,logto_app_id=2stnsoa6a1b0gwc7lra55,logto_app_secret=seV1T6iKBKLlttjdk25I2px43ZCEHnPJ",
50
+ "dist:web-preview": "microbundle -i ./src/index.js -o dist/index.js --format esm --generateTypes --target web --sourcemap false --compress true --define api_endpoint=https://cloud-staging.needle.tools/api,cloud_base_url=https://cloud-staging.needle.tools,logto_endpoint=https://auth.needle.tools,logto_app_id=2stnsoa6a1b0gwc7lra55,logto_app_secret=seV1T6iKBKLlttjdk25I2px43ZCEHnPJ",
51
+ "dist:node": "microbundle -i ./src/cli.js -o dist/cli.js --format esm --target node --generateTypes false --sourcemap false --compress --define api_endpoint=https://cloud.needle.tools/api,cloud_base_url=https://cloud.needle.tools,logto_endpoint=https://auth.needle.tools,logto_app_id=2stnsoa6a1b0gwc7lra55,logto_app_secret=seV1T6iKBKLlttjdk25I2px43ZCEHnPJ",
52
+ "dist:node-preview": "microbundle -i ./src/cli.js -o dist/cli.js --format esm --target node --generateTypes false --sourcemap false --compress --define api_endpoint=https://cloud-staging.needle.tools/api,cloud_base_url=https://cloud-staging.needle.tools,logto_endpoint=https://auth.needle.tools,logto_app_id=2stnsoa6a1b0gwc7lra55,logto_app_secret=seV1T6iKBKLlttjdk25I2px43ZCEHnPJ",
55
53
  "dev:mcp": "npx --yes @modelcontextprotocol/inspector mcp-inspector http://localhost:8424/mcp"
56
54
  },
57
55
  "files": [
@@ -65,4 +63,4 @@
65
63
  "access": "public",
66
64
  "registry": "https://registry.npmjs.org/"
67
65
  }
68
- }
66
+ }