@acontext/acontext 0.0.21 → 0.1.1
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/dist/agent/base.d.ts +2 -1
- package/dist/agent/disk.d.ts +8 -7
- package/dist/agent/disk.js +16 -7
- package/dist/agent/index.d.ts +2 -0
- package/dist/agent/index.js +2 -0
- package/dist/agent/prompts.d.ts +6 -0
- package/dist/agent/prompts.js +100 -0
- package/dist/agent/sandbox.d.ts +102 -0
- package/dist/agent/sandbox.js +309 -0
- package/dist/agent/skill.d.ts +2 -8
- package/dist/agent/skill.js +26 -26
- package/dist/agent/text-editor.d.ts +44 -0
- package/dist/agent/text-editor.js +201 -0
- package/dist/client-types.d.ts +1 -0
- package/dist/client.d.ts +3 -4
- package/dist/client.js +6 -6
- package/dist/resources/disks.d.ts +12 -0
- package/dist/resources/disks.js +24 -0
- package/dist/resources/index.d.ts +1 -2
- package/dist/resources/index.js +1 -2
- package/dist/resources/sandboxes.d.ts +51 -0
- package/dist/resources/sandboxes.js +70 -0
- package/dist/resources/sessions.d.ts +1 -17
- package/dist/resources/sessions.js +0 -26
- package/dist/resources/skills.d.ts +14 -1
- package/dist/resources/skills.js +17 -0
- package/dist/resources/users.d.ts +2 -2
- package/dist/resources/users.js +2 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.js +1 -2
- package/dist/types/sandbox.d.ts +64 -0
- package/dist/types/sandbox.js +41 -0
- package/dist/types/session.d.ts +0 -12
- package/dist/types/session.js +1 -8
- package/dist/types/skill.d.ts +7 -0
- package/dist/types/skill.js +7 -1
- package/dist/types/tool.d.ts +0 -4
- package/dist/types/tool.js +1 -4
- package/dist/types/user.d.ts +0 -2
- package/dist/types/user.js +0 -1
- package/package.json +8 -8
- package/dist/resources/blocks.d.ts +0 -33
- package/dist/resources/blocks.js +0 -85
- package/dist/resources/spaces.d.ts +0 -68
- package/dist/resources/spaces.js +0 -109
- package/dist/types/block.d.ts +0 -18
- package/dist/types/block.js +0 -20
- package/dist/types/space.d.ts +0 -67
- package/dist/types/space.js +0 -44
package/dist/types/session.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type definitions for session, message, and task resources.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EditStrategySchema = exports.MiddleOutStrategySchema = exports.MiddleOutParamsSchema = exports.TokenLimitStrategySchema = exports.TokenLimitParamsSchema = exports.RemoveToolResultStrategySchema = exports.RemoveToolCallParamsStrategySchema = exports.RemoveToolCallParamsParamsSchema = exports.RemoveToolResultParamsSchema = exports.MessageObservingStatusSchema = exports.TokenCountsSchema = exports.
|
|
6
|
+
exports.EditStrategySchema = exports.MiddleOutStrategySchema = exports.MiddleOutParamsSchema = exports.TokenLimitStrategySchema = exports.TokenLimitParamsSchema = exports.RemoveToolResultStrategySchema = exports.RemoveToolCallParamsStrategySchema = exports.RemoveToolCallParamsParamsSchema = exports.RemoveToolResultParamsSchema = exports.MessageObservingStatusSchema = exports.TokenCountsSchema = exports.GetTasksOutputSchema = exports.GetMessagesOutputSchema = exports.PublicURLSchema = exports.ListSessionsOutputSchema = exports.TaskSchema = exports.TaskDataSchema = exports.SessionSchema = exports.MessageSchema = exports.PartSchema = exports.AssetSchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
exports.AssetSchema = zod_1.z.object({
|
|
9
9
|
bucket: zod_1.z.string(),
|
|
@@ -37,7 +37,6 @@ exports.SessionSchema = zod_1.z.object({
|
|
|
37
37
|
project_id: zod_1.z.string(),
|
|
38
38
|
user_id: zod_1.z.string().nullable().optional(),
|
|
39
39
|
disable_task_tracking: zod_1.z.boolean(),
|
|
40
|
-
space_id: zod_1.z.string().nullable(),
|
|
41
40
|
configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable(),
|
|
42
41
|
created_at: zod_1.z.string(),
|
|
43
42
|
updated_at: zod_1.z.string(),
|
|
@@ -51,7 +50,6 @@ exports.TaskDataSchema = zod_1.z.object({
|
|
|
51
50
|
task_description: zod_1.z.string(),
|
|
52
51
|
progresses: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
53
52
|
user_preferences: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
54
|
-
sop_thinking: zod_1.z.string().nullable().optional(),
|
|
55
53
|
});
|
|
56
54
|
exports.TaskSchema = zod_1.z.object({
|
|
57
55
|
id: zod_1.z.string(),
|
|
@@ -61,7 +59,6 @@ exports.TaskSchema = zod_1.z.object({
|
|
|
61
59
|
data: exports.TaskDataSchema,
|
|
62
60
|
status: zod_1.z.string(),
|
|
63
61
|
is_planning: zod_1.z.boolean(),
|
|
64
|
-
space_digested: zod_1.z.boolean(),
|
|
65
62
|
created_at: zod_1.z.string(),
|
|
66
63
|
updated_at: zod_1.z.string(),
|
|
67
64
|
});
|
|
@@ -96,10 +93,6 @@ exports.GetTasksOutputSchema = zod_1.z.object({
|
|
|
96
93
|
next_cursor: zod_1.z.string().nullable().optional(),
|
|
97
94
|
has_more: zod_1.z.boolean(),
|
|
98
95
|
});
|
|
99
|
-
exports.LearningStatusSchema = zod_1.z.object({
|
|
100
|
-
space_digested_count: zod_1.z.number(),
|
|
101
|
-
not_space_digested_count: zod_1.z.number(),
|
|
102
|
-
});
|
|
103
96
|
exports.TokenCountsSchema = zod_1.z.object({
|
|
104
97
|
total_tokens: zod_1.z.number(),
|
|
105
98
|
});
|
package/dist/types/skill.d.ts
CHANGED
|
@@ -45,3 +45,10 @@ export declare const GetSkillFileRespSchema: z.ZodObject<{
|
|
|
45
45
|
}, z.core.$strip>>>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
47
|
export type GetSkillFileResp = z.infer<typeof GetSkillFileRespSchema>;
|
|
48
|
+
export declare const DownloadSkillToSandboxRespSchema: z.ZodObject<{
|
|
49
|
+
success: z.ZodBoolean;
|
|
50
|
+
dir_path: z.ZodString;
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
description: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type DownloadSkillToSandboxResp = z.infer<typeof DownloadSkillToSandboxRespSchema>;
|
package/dist/types/skill.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type definitions for skill resources.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GetSkillFileRespSchema = exports.ListSkillsOutputSchema = exports.SkillCatalogItemSchema = exports.SkillSchema = exports.FileInfoSchema = void 0;
|
|
6
|
+
exports.DownloadSkillToSandboxRespSchema = exports.GetSkillFileRespSchema = exports.ListSkillsOutputSchema = exports.SkillCatalogItemSchema = exports.SkillSchema = exports.FileInfoSchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
const common_1 = require("./common");
|
|
9
9
|
exports.FileInfoSchema = zod_1.z.object({
|
|
@@ -35,3 +35,9 @@ exports.GetSkillFileRespSchema = zod_1.z.object({
|
|
|
35
35
|
url: zod_1.z.string().nullable().optional(),
|
|
36
36
|
content: common_1.FileContentSchema.nullable().optional(),
|
|
37
37
|
});
|
|
38
|
+
exports.DownloadSkillToSandboxRespSchema = zod_1.z.object({
|
|
39
|
+
success: zod_1.z.boolean(),
|
|
40
|
+
dir_path: zod_1.z.string(),
|
|
41
|
+
name: zod_1.z.string(),
|
|
42
|
+
description: zod_1.z.string(),
|
|
43
|
+
});
|
package/dist/types/tool.d.ts
CHANGED
|
@@ -17,7 +17,3 @@ export declare const FlagResponseSchema: z.ZodObject<{
|
|
|
17
17
|
errmsg: z.ZodString;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
19
|
export type FlagResponse = z.infer<typeof FlagResponseSchema>;
|
|
20
|
-
export declare const InsertBlockResponseSchema: z.ZodObject<{
|
|
21
|
-
id: z.ZodString;
|
|
22
|
-
}, z.core.$strip>;
|
|
23
|
-
export type InsertBlockResponse = z.infer<typeof InsertBlockResponseSchema>;
|
package/dist/types/tool.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Type definitions for tool resources.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.FlagResponseSchema = exports.ToolReferenceDataSchema = exports.ToolRenameItemSchema = void 0;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
exports.ToolRenameItemSchema = zod_1.z.object({
|
|
9
9
|
oldName: zod_1.z.string(),
|
|
@@ -17,6 +17,3 @@ exports.FlagResponseSchema = zod_1.z.object({
|
|
|
17
17
|
status: zod_1.z.number(),
|
|
18
18
|
errmsg: zod_1.z.string(),
|
|
19
19
|
});
|
|
20
|
-
exports.InsertBlockResponseSchema = zod_1.z.object({
|
|
21
|
-
id: zod_1.z.string(),
|
|
22
|
-
});
|
package/dist/types/user.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export declare const ListUsersOutputSchema: z.ZodObject<{
|
|
|
23
23
|
}, z.core.$strip>;
|
|
24
24
|
export type ListUsersOutput = z.infer<typeof ListUsersOutputSchema>;
|
|
25
25
|
export declare const UserResourceCountsSchema: z.ZodObject<{
|
|
26
|
-
spaces_count: z.ZodNumber;
|
|
27
26
|
sessions_count: z.ZodNumber;
|
|
28
27
|
disks_count: z.ZodNumber;
|
|
29
28
|
skills_count: z.ZodNumber;
|
|
@@ -31,7 +30,6 @@ export declare const UserResourceCountsSchema: z.ZodObject<{
|
|
|
31
30
|
export type UserResourceCounts = z.infer<typeof UserResourceCountsSchema>;
|
|
32
31
|
export declare const GetUserResourcesOutputSchema: z.ZodObject<{
|
|
33
32
|
counts: z.ZodObject<{
|
|
34
|
-
spaces_count: z.ZodNumber;
|
|
35
33
|
sessions_count: z.ZodNumber;
|
|
36
34
|
disks_count: z.ZodNumber;
|
|
37
35
|
skills_count: z.ZodNumber;
|
package/dist/types/user.js
CHANGED
|
@@ -18,7 +18,6 @@ exports.ListUsersOutputSchema = zod_1.z.object({
|
|
|
18
18
|
has_more: zod_1.z.boolean(),
|
|
19
19
|
});
|
|
20
20
|
exports.UserResourceCountsSchema = zod_1.z.object({
|
|
21
|
-
spaces_count: zod_1.z.number(),
|
|
22
21
|
sessions_count: zod_1.z.number(),
|
|
23
22
|
disks_count: zod_1.z.number(),
|
|
24
23
|
skills_count: zod_1.z.number(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acontext/acontext",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "TypeScript SDK for the Acontext API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
"url": "https://github.com/memodb-io/Acontext"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"zod": "^4.
|
|
29
|
+
"zod": "^4.3.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/jest": "^30.0.0",
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
35
|
-
"@typescript-eslint/parser": "^8.
|
|
36
|
-
"eslint": "^9.39.
|
|
33
|
+
"@types/node": "^25.0.9",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^8.53.1",
|
|
35
|
+
"@typescript-eslint/parser": "^8.53.1",
|
|
36
|
+
"eslint": "^9.39.2",
|
|
37
37
|
"jest": "^30.2.0",
|
|
38
|
-
"ts-jest": "^29.4.
|
|
39
|
-
"tsx": "^4.
|
|
38
|
+
"ts-jest": "^29.4.6",
|
|
39
|
+
"tsx": "^4.21.0",
|
|
40
40
|
"typescript": "^5.9.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Block endpoints.
|
|
3
|
-
*/
|
|
4
|
-
import { RequesterProtocol } from '../client-types';
|
|
5
|
-
import { Block } from '../types';
|
|
6
|
-
import { InsertBlockResponse } from '../types/tool';
|
|
7
|
-
export declare class BlocksAPI {
|
|
8
|
-
private requester;
|
|
9
|
-
constructor(requester: RequesterProtocol);
|
|
10
|
-
list(spaceId: string, options?: {
|
|
11
|
-
parentId?: string | null;
|
|
12
|
-
blockType?: string | null;
|
|
13
|
-
}): Promise<Block[]>;
|
|
14
|
-
create(spaceId: string, options: {
|
|
15
|
-
blockType: string;
|
|
16
|
-
parentId?: string | null;
|
|
17
|
-
title?: string | null;
|
|
18
|
-
props?: Record<string, unknown> | null;
|
|
19
|
-
}): Promise<InsertBlockResponse>;
|
|
20
|
-
delete(spaceId: string, blockId: string): Promise<void>;
|
|
21
|
-
getProperties(spaceId: string, blockId: string): Promise<Block>;
|
|
22
|
-
updateProperties(spaceId: string, blockId: string, options: {
|
|
23
|
-
title?: string | null;
|
|
24
|
-
props?: Record<string, unknown> | null;
|
|
25
|
-
}): Promise<void>;
|
|
26
|
-
move(spaceId: string, blockId: string, options: {
|
|
27
|
-
parentId?: string | null;
|
|
28
|
-
sort?: number | null;
|
|
29
|
-
}): Promise<void>;
|
|
30
|
-
updateSort(spaceId: string, blockId: string, options: {
|
|
31
|
-
sort: number;
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
}
|
package/dist/resources/blocks.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Block endpoints.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BlocksAPI = void 0;
|
|
7
|
-
const types_1 = require("../types");
|
|
8
|
-
const tool_1 = require("../types/tool");
|
|
9
|
-
class BlocksAPI {
|
|
10
|
-
constructor(requester) {
|
|
11
|
-
this.requester = requester;
|
|
12
|
-
}
|
|
13
|
-
async list(spaceId, options) {
|
|
14
|
-
const params = {};
|
|
15
|
-
if (options?.parentId !== undefined && options?.parentId !== null) {
|
|
16
|
-
params.parent_id = options.parentId;
|
|
17
|
-
}
|
|
18
|
-
if (options?.blockType !== undefined && options?.blockType !== null) {
|
|
19
|
-
params.type = options.blockType;
|
|
20
|
-
}
|
|
21
|
-
const data = await this.requester.request('GET', `/space/${spaceId}/block`, {
|
|
22
|
-
params: Object.keys(params).length > 0 ? params : undefined,
|
|
23
|
-
});
|
|
24
|
-
return Array.isArray(data) ? data.map((item) => types_1.BlockSchema.parse(item)) : [];
|
|
25
|
-
}
|
|
26
|
-
async create(spaceId, options) {
|
|
27
|
-
const payload = { type: options.blockType };
|
|
28
|
-
if (options.parentId !== undefined && options.parentId !== null) {
|
|
29
|
-
payload.parent_id = options.parentId;
|
|
30
|
-
}
|
|
31
|
-
if (options.title !== undefined && options.title !== null) {
|
|
32
|
-
payload.title = options.title;
|
|
33
|
-
}
|
|
34
|
-
if (options.props !== undefined && options.props !== null) {
|
|
35
|
-
payload.props = options.props;
|
|
36
|
-
}
|
|
37
|
-
const data = await this.requester.request('POST', `/space/${spaceId}/block`, {
|
|
38
|
-
jsonData: payload,
|
|
39
|
-
});
|
|
40
|
-
return tool_1.InsertBlockResponseSchema.parse(data);
|
|
41
|
-
}
|
|
42
|
-
async delete(spaceId, blockId) {
|
|
43
|
-
await this.requester.request('DELETE', `/space/${spaceId}/block/${blockId}`);
|
|
44
|
-
}
|
|
45
|
-
async getProperties(spaceId, blockId) {
|
|
46
|
-
const data = await this.requester.request('GET', `/space/${spaceId}/block/${blockId}/properties`);
|
|
47
|
-
return types_1.BlockSchema.parse(data);
|
|
48
|
-
}
|
|
49
|
-
async updateProperties(spaceId, blockId, options) {
|
|
50
|
-
const payload = {};
|
|
51
|
-
if (options.title !== undefined && options.title !== null) {
|
|
52
|
-
payload.title = options.title;
|
|
53
|
-
}
|
|
54
|
-
if (options.props !== undefined && options.props !== null) {
|
|
55
|
-
payload.props = options.props;
|
|
56
|
-
}
|
|
57
|
-
if (Object.keys(payload).length === 0) {
|
|
58
|
-
throw new Error('title or props must be provided');
|
|
59
|
-
}
|
|
60
|
-
await this.requester.request('PUT', `/space/${spaceId}/block/${blockId}/properties`, {
|
|
61
|
-
jsonData: payload,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
async move(spaceId, blockId, options) {
|
|
65
|
-
const payload = {};
|
|
66
|
-
if (options.parentId !== undefined && options.parentId !== null) {
|
|
67
|
-
payload.parent_id = options.parentId;
|
|
68
|
-
}
|
|
69
|
-
if (options.sort !== undefined && options.sort !== null) {
|
|
70
|
-
payload.sort = options.sort;
|
|
71
|
-
}
|
|
72
|
-
if (Object.keys(payload).length === 0) {
|
|
73
|
-
throw new Error('parentId or sort must be provided');
|
|
74
|
-
}
|
|
75
|
-
await this.requester.request('PUT', `/space/${spaceId}/block/${blockId}/move`, {
|
|
76
|
-
jsonData: payload,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async updateSort(spaceId, blockId, options) {
|
|
80
|
-
await this.requester.request('PUT', `/space/${spaceId}/block/${blockId}/sort`, {
|
|
81
|
-
jsonData: { sort: options.sort },
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.BlocksAPI = BlocksAPI;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Spaces endpoints.
|
|
3
|
-
*/
|
|
4
|
-
import { RequesterProtocol } from '../client-types';
|
|
5
|
-
import { ExperienceConfirmation, ListExperienceConfirmationsOutput, ListSpacesOutput, Space, SpaceSearchResult } from '../types';
|
|
6
|
-
export declare class SpacesAPI {
|
|
7
|
-
private requester;
|
|
8
|
-
constructor(requester: RequesterProtocol);
|
|
9
|
-
list(options?: {
|
|
10
|
-
user?: string | null;
|
|
11
|
-
limit?: number | null;
|
|
12
|
-
cursor?: string | null;
|
|
13
|
-
timeDesc?: boolean | null;
|
|
14
|
-
}): Promise<ListSpacesOutput>;
|
|
15
|
-
create(options?: {
|
|
16
|
-
user?: string | null;
|
|
17
|
-
configs?: Record<string, unknown>;
|
|
18
|
-
}): Promise<Space>;
|
|
19
|
-
delete(spaceId: string): Promise<void>;
|
|
20
|
-
updateConfigs(spaceId: string, options: {
|
|
21
|
-
configs: Record<string, unknown>;
|
|
22
|
-
}): Promise<void>;
|
|
23
|
-
getConfigs(spaceId: string): Promise<Space>;
|
|
24
|
-
/**
|
|
25
|
-
* Perform experience search within a space.
|
|
26
|
-
*
|
|
27
|
-
* This is the most advanced search option that can operate in two modes:
|
|
28
|
-
* - fast: Quick semantic search (default)
|
|
29
|
-
* - agentic: Iterative search with AI-powered refinement
|
|
30
|
-
*
|
|
31
|
-
* @param spaceId - The UUID of the space
|
|
32
|
-
* @param options - Search options
|
|
33
|
-
* @returns SpaceSearchResult containing cited blocks and optional final answer
|
|
34
|
-
*/
|
|
35
|
-
experienceSearch(spaceId: string, options: {
|
|
36
|
-
query: string;
|
|
37
|
-
limit?: number | null;
|
|
38
|
-
mode?: 'fast' | 'agentic' | null;
|
|
39
|
-
semanticThreshold?: number | null;
|
|
40
|
-
maxIterations?: number | null;
|
|
41
|
-
}): Promise<SpaceSearchResult>;
|
|
42
|
-
/**
|
|
43
|
-
* Get all unconfirmed experiences in a space with cursor-based pagination.
|
|
44
|
-
*
|
|
45
|
-
* @param spaceId - The UUID of the space
|
|
46
|
-
* @param options - Pagination options
|
|
47
|
-
* @returns ListExperienceConfirmationsOutput containing the list of experience confirmations and pagination information
|
|
48
|
-
*/
|
|
49
|
-
getUnconfirmedExperiences(spaceId: string, options?: {
|
|
50
|
-
limit?: number | null;
|
|
51
|
-
cursor?: string | null;
|
|
52
|
-
timeDesc?: boolean | null;
|
|
53
|
-
}): Promise<ListExperienceConfirmationsOutput>;
|
|
54
|
-
/**
|
|
55
|
-
* Confirm an experience confirmation.
|
|
56
|
-
*
|
|
57
|
-
* If save is false, delete the row. If save is true, get the data first,
|
|
58
|
-
* then delete the row.
|
|
59
|
-
*
|
|
60
|
-
* @param spaceId - The UUID of the space
|
|
61
|
-
* @param experienceId - The UUID of the experience confirmation
|
|
62
|
-
* @param options - Confirmation options
|
|
63
|
-
* @returns ExperienceConfirmation object if save is true, null otherwise
|
|
64
|
-
*/
|
|
65
|
-
confirmExperience(spaceId: string, experienceId: string, options: {
|
|
66
|
-
save: boolean;
|
|
67
|
-
}): Promise<ExperienceConfirmation | null>;
|
|
68
|
-
}
|
package/dist/resources/spaces.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Spaces endpoints.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SpacesAPI = void 0;
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
const types_1 = require("../types");
|
|
9
|
-
class SpacesAPI {
|
|
10
|
-
constructor(requester) {
|
|
11
|
-
this.requester = requester;
|
|
12
|
-
}
|
|
13
|
-
async list(options) {
|
|
14
|
-
const params = (0, utils_1.buildParams)({
|
|
15
|
-
user: options?.user ?? null,
|
|
16
|
-
limit: options?.limit ?? null,
|
|
17
|
-
cursor: options?.cursor ?? null,
|
|
18
|
-
time_desc: options?.timeDesc ?? null,
|
|
19
|
-
});
|
|
20
|
-
const data = await this.requester.request('GET', '/space', {
|
|
21
|
-
params: Object.keys(params).length > 0 ? params : undefined,
|
|
22
|
-
});
|
|
23
|
-
return types_1.ListSpacesOutputSchema.parse(data);
|
|
24
|
-
}
|
|
25
|
-
async create(options) {
|
|
26
|
-
const payload = {};
|
|
27
|
-
if (options?.user !== undefined && options?.user !== null) {
|
|
28
|
-
payload.user = options.user;
|
|
29
|
-
}
|
|
30
|
-
if (options?.configs !== undefined) {
|
|
31
|
-
payload.configs = options.configs;
|
|
32
|
-
}
|
|
33
|
-
const data = await this.requester.request('POST', '/space', {
|
|
34
|
-
jsonData: Object.keys(payload).length > 0 ? payload : undefined,
|
|
35
|
-
});
|
|
36
|
-
return types_1.SpaceSchema.parse(data);
|
|
37
|
-
}
|
|
38
|
-
async delete(spaceId) {
|
|
39
|
-
await this.requester.request('DELETE', `/space/${spaceId}`);
|
|
40
|
-
}
|
|
41
|
-
async updateConfigs(spaceId, options) {
|
|
42
|
-
const payload = { configs: options.configs };
|
|
43
|
-
await this.requester.request('PUT', `/space/${spaceId}/configs`, {
|
|
44
|
-
jsonData: payload,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
async getConfigs(spaceId) {
|
|
48
|
-
const data = await this.requester.request('GET', `/space/${spaceId}/configs`);
|
|
49
|
-
return types_1.SpaceSchema.parse(data);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Perform experience search within a space.
|
|
53
|
-
*
|
|
54
|
-
* This is the most advanced search option that can operate in two modes:
|
|
55
|
-
* - fast: Quick semantic search (default)
|
|
56
|
-
* - agentic: Iterative search with AI-powered refinement
|
|
57
|
-
*
|
|
58
|
-
* @param spaceId - The UUID of the space
|
|
59
|
-
* @param options - Search options
|
|
60
|
-
* @returns SpaceSearchResult containing cited blocks and optional final answer
|
|
61
|
-
*/
|
|
62
|
-
async experienceSearch(spaceId, options) {
|
|
63
|
-
const params = (0, utils_1.buildParams)({
|
|
64
|
-
query: options.query,
|
|
65
|
-
limit: options.limit ?? null,
|
|
66
|
-
mode: options.mode ?? null,
|
|
67
|
-
semantic_threshold: options.semanticThreshold ?? null,
|
|
68
|
-
max_iterations: options.maxIterations ?? null,
|
|
69
|
-
});
|
|
70
|
-
const data = await this.requester.request('GET', `/space/${spaceId}/experience_search`, { params: Object.keys(params).length > 0 ? params : undefined });
|
|
71
|
-
return types_1.SpaceSearchResultSchema.parse(data);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Get all unconfirmed experiences in a space with cursor-based pagination.
|
|
75
|
-
*
|
|
76
|
-
* @param spaceId - The UUID of the space
|
|
77
|
-
* @param options - Pagination options
|
|
78
|
-
* @returns ListExperienceConfirmationsOutput containing the list of experience confirmations and pagination information
|
|
79
|
-
*/
|
|
80
|
-
async getUnconfirmedExperiences(spaceId, options) {
|
|
81
|
-
const params = (0, utils_1.buildParams)({
|
|
82
|
-
limit: options?.limit ?? null,
|
|
83
|
-
cursor: options?.cursor ?? null,
|
|
84
|
-
time_desc: options?.timeDesc ?? null,
|
|
85
|
-
});
|
|
86
|
-
const data = await this.requester.request('GET', `/space/${spaceId}/experience_confirmations`, { params: Object.keys(params).length > 0 ? params : undefined });
|
|
87
|
-
return types_1.ListExperienceConfirmationsOutputSchema.parse(data);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Confirm an experience confirmation.
|
|
91
|
-
*
|
|
92
|
-
* If save is false, delete the row. If save is true, get the data first,
|
|
93
|
-
* then delete the row.
|
|
94
|
-
*
|
|
95
|
-
* @param spaceId - The UUID of the space
|
|
96
|
-
* @param experienceId - The UUID of the experience confirmation
|
|
97
|
-
* @param options - Confirmation options
|
|
98
|
-
* @returns ExperienceConfirmation object if save is true, null otherwise
|
|
99
|
-
*/
|
|
100
|
-
async confirmExperience(spaceId, experienceId, options) {
|
|
101
|
-
const payload = { save: options.save };
|
|
102
|
-
const data = await this.requester.request('PUT', `/space/${spaceId}/experience_confirmations/${experienceId}`, { jsonData: payload });
|
|
103
|
-
if (data === null || data === undefined) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
return types_1.ExperienceConfirmationSchema.parse(data);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
exports.SpacesAPI = SpacesAPI;
|
package/dist/types/block.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for block resources.
|
|
3
|
-
*/
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
export declare const BlockSchema: z.ZodType<Block>;
|
|
6
|
-
export type Block = {
|
|
7
|
-
id: string;
|
|
8
|
-
space_id: string;
|
|
9
|
-
type: string;
|
|
10
|
-
parent_id?: string | null;
|
|
11
|
-
title: string;
|
|
12
|
-
props: Record<string, unknown>;
|
|
13
|
-
sort: number;
|
|
14
|
-
is_archived: boolean;
|
|
15
|
-
created_at: string;
|
|
16
|
-
updated_at: string;
|
|
17
|
-
children?: Block[] | null;
|
|
18
|
-
};
|
package/dist/types/block.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Type definitions for block resources.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BlockSchema = void 0;
|
|
7
|
-
const zod_1 = require("zod");
|
|
8
|
-
exports.BlockSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
9
|
-
id: zod_1.z.string(),
|
|
10
|
-
space_id: zod_1.z.string(),
|
|
11
|
-
type: zod_1.z.string(),
|
|
12
|
-
parent_id: zod_1.z.string().nullable().optional(),
|
|
13
|
-
title: zod_1.z.string(),
|
|
14
|
-
props: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
15
|
-
sort: zod_1.z.number(),
|
|
16
|
-
is_archived: zod_1.z.boolean(),
|
|
17
|
-
created_at: zod_1.z.string(),
|
|
18
|
-
updated_at: zod_1.z.string(),
|
|
19
|
-
children: zod_1.z.array(exports.BlockSchema).nullable().optional(),
|
|
20
|
-
}));
|
package/dist/types/space.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for space resources.
|
|
3
|
-
*/
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
export declare const SpaceSchema: z.ZodObject<{
|
|
6
|
-
id: z.ZodString;
|
|
7
|
-
project_id: z.ZodString;
|
|
8
|
-
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
-
configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
10
|
-
created_at: z.ZodString;
|
|
11
|
-
updated_at: z.ZodString;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export type Space = z.infer<typeof SpaceSchema>;
|
|
14
|
-
export declare const ListSpacesOutputSchema: z.ZodObject<{
|
|
15
|
-
items: z.ZodArray<z.ZodObject<{
|
|
16
|
-
id: z.ZodString;
|
|
17
|
-
project_id: z.ZodString;
|
|
18
|
-
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19
|
-
configs: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
20
|
-
created_at: z.ZodString;
|
|
21
|
-
updated_at: z.ZodString;
|
|
22
|
-
}, z.core.$strip>>;
|
|
23
|
-
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
-
has_more: z.ZodBoolean;
|
|
25
|
-
}, z.core.$strip>;
|
|
26
|
-
export type ListSpacesOutput = z.infer<typeof ListSpacesOutputSchema>;
|
|
27
|
-
export declare const SearchResultBlockItemSchema: z.ZodObject<{
|
|
28
|
-
block_id: z.ZodString;
|
|
29
|
-
title: z.ZodString;
|
|
30
|
-
type: z.ZodString;
|
|
31
|
-
props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
32
|
-
distance: z.ZodNullable<z.ZodNumber>;
|
|
33
|
-
}, z.core.$strip>;
|
|
34
|
-
export type SearchResultBlockItem = z.infer<typeof SearchResultBlockItemSchema>;
|
|
35
|
-
export declare const SpaceSearchResultSchema: z.ZodObject<{
|
|
36
|
-
cited_blocks: z.ZodArray<z.ZodObject<{
|
|
37
|
-
block_id: z.ZodString;
|
|
38
|
-
title: z.ZodString;
|
|
39
|
-
type: z.ZodString;
|
|
40
|
-
props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
41
|
-
distance: z.ZodNullable<z.ZodNumber>;
|
|
42
|
-
}, z.core.$strip>>;
|
|
43
|
-
final_answer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
-
}, z.core.$strip>;
|
|
45
|
-
export type SpaceSearchResult = z.infer<typeof SpaceSearchResultSchema>;
|
|
46
|
-
export declare const ExperienceConfirmationSchema: z.ZodObject<{
|
|
47
|
-
id: z.ZodString;
|
|
48
|
-
space_id: z.ZodString;
|
|
49
|
-
task_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
-
experience_data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
51
|
-
created_at: z.ZodString;
|
|
52
|
-
updated_at: z.ZodString;
|
|
53
|
-
}, z.core.$strip>;
|
|
54
|
-
export type ExperienceConfirmation = z.infer<typeof ExperienceConfirmationSchema>;
|
|
55
|
-
export declare const ListExperienceConfirmationsOutputSchema: z.ZodObject<{
|
|
56
|
-
items: z.ZodArray<z.ZodObject<{
|
|
57
|
-
id: z.ZodString;
|
|
58
|
-
space_id: z.ZodString;
|
|
59
|
-
task_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
-
experience_data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
61
|
-
created_at: z.ZodString;
|
|
62
|
-
updated_at: z.ZodString;
|
|
63
|
-
}, z.core.$strip>>;
|
|
64
|
-
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
|
-
has_more: z.ZodBoolean;
|
|
66
|
-
}, z.core.$strip>;
|
|
67
|
-
export type ListExperienceConfirmationsOutput = z.infer<typeof ListExperienceConfirmationsOutputSchema>;
|
package/dist/types/space.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Type definitions for space resources.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ListExperienceConfirmationsOutputSchema = exports.ExperienceConfirmationSchema = exports.SpaceSearchResultSchema = exports.SearchResultBlockItemSchema = exports.ListSpacesOutputSchema = exports.SpaceSchema = void 0;
|
|
7
|
-
const zod_1 = require("zod");
|
|
8
|
-
exports.SpaceSchema = zod_1.z.object({
|
|
9
|
-
id: zod_1.z.string(),
|
|
10
|
-
project_id: zod_1.z.string(),
|
|
11
|
-
user_id: zod_1.z.string().nullable().optional(),
|
|
12
|
-
configs: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).nullable(),
|
|
13
|
-
created_at: zod_1.z.string(),
|
|
14
|
-
updated_at: zod_1.z.string(),
|
|
15
|
-
});
|
|
16
|
-
exports.ListSpacesOutputSchema = zod_1.z.object({
|
|
17
|
-
items: zod_1.z.array(exports.SpaceSchema),
|
|
18
|
-
next_cursor: zod_1.z.string().nullable().optional(),
|
|
19
|
-
has_more: zod_1.z.boolean(),
|
|
20
|
-
});
|
|
21
|
-
exports.SearchResultBlockItemSchema = zod_1.z.object({
|
|
22
|
-
block_id: zod_1.z.string(),
|
|
23
|
-
title: zod_1.z.string(),
|
|
24
|
-
type: zod_1.z.string(),
|
|
25
|
-
props: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
26
|
-
distance: zod_1.z.number().nullable(),
|
|
27
|
-
});
|
|
28
|
-
exports.SpaceSearchResultSchema = zod_1.z.object({
|
|
29
|
-
cited_blocks: zod_1.z.array(exports.SearchResultBlockItemSchema),
|
|
30
|
-
final_answer: zod_1.z.string().nullable().optional(),
|
|
31
|
-
});
|
|
32
|
-
exports.ExperienceConfirmationSchema = zod_1.z.object({
|
|
33
|
-
id: zod_1.z.string(),
|
|
34
|
-
space_id: zod_1.z.string(),
|
|
35
|
-
task_id: zod_1.z.string().nullable().optional(),
|
|
36
|
-
experience_data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
37
|
-
created_at: zod_1.z.string(),
|
|
38
|
-
updated_at: zod_1.z.string(),
|
|
39
|
-
});
|
|
40
|
-
exports.ListExperienceConfirmationsOutputSchema = zod_1.z.object({
|
|
41
|
-
items: zod_1.z.array(exports.ExperienceConfirmationSchema),
|
|
42
|
-
next_cursor: zod_1.z.string().nullable().optional(),
|
|
43
|
-
has_more: zod_1.z.boolean(),
|
|
44
|
-
});
|