@xano/developer-mcp 1.0.40 → 1.0.42
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/README.md +47 -84
- package/dist/cli_docs/index.js +7 -2
- package/dist/lib.d.ts +1 -3
- package/dist/lib.js +1 -4
- package/dist/meta_api_docs/format.d.ts +0 -4
- package/dist/meta_api_docs/format.js +0 -15
- package/dist/meta_api_docs/format.test.js +7 -9
- package/dist/meta_api_docs/index.js +10 -3
- package/dist/tools/index.d.ts +3 -5
- package/dist/tools/index.js +2 -9
- package/dist/tools/validate_xanoscript.js +10 -5
- package/dist/tools/xanoscript_docs.js +11 -5
- package/dist/xanoscript_docs/docs_index.json +70 -1
- package/dist/xanoscript_docs/integrations/cloud-storage.md +59 -3
- package/dist/xanoscript_docs/integrations/redis.md +28 -8
- package/dist/xanoscript_docs/integrations/search.md +39 -3
- package/dist/xanoscript_docs/integrations/utilities.md +25 -0
- package/dist/xanoscript_docs/security.md +39 -0
- package/dist/xanoscript_docs/syntax.md +411 -4
- package/dist/xanoscript_docs/version.json +2 -2
- package/package.json +1 -1
- package/dist/run_api_docs/format.d.ts +0 -6
- package/dist/run_api_docs/format.js +0 -8
- package/dist/run_api_docs/format.test.d.ts +0 -1
- package/dist/run_api_docs/format.test.js +0 -86
- package/dist/run_api_docs/index.d.ts +0 -52
- package/dist/run_api_docs/index.js +0 -90
- package/dist/run_api_docs/index.test.d.ts +0 -1
- package/dist/run_api_docs/index.test.js +0 -127
- package/dist/run_api_docs/topics/data.d.ts +0 -2
- package/dist/run_api_docs/topics/data.js +0 -104
- package/dist/run_api_docs/topics/history.d.ts +0 -2
- package/dist/run_api_docs/topics/history.js +0 -93
- package/dist/run_api_docs/topics/run.d.ts +0 -2
- package/dist/run_api_docs/topics/run.js +0 -110
- package/dist/run_api_docs/topics/session.d.ts +0 -2
- package/dist/run_api_docs/topics/session.js +0 -166
- package/dist/run_api_docs/topics/start.d.ts +0 -2
- package/dist/run_api_docs/topics/start.js +0 -97
- package/dist/run_api_docs/topics/workflows.d.ts +0 -2
- package/dist/run_api_docs/topics/workflows.js +0 -140
- package/dist/tools/run_api_docs.d.ts +0 -46
- package/dist/tools/run_api_docs.js +0 -69
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { topics, getTopicNames, getTopicDescriptions, handleRunApiDocs, runApiDocsToolDefinition, } from "./index.js";
|
|
3
|
-
describe("run_api_docs/index", () => {
|
|
4
|
-
describe("topics", () => {
|
|
5
|
-
it("should have all expected topics", () => {
|
|
6
|
-
const expectedTopics = [
|
|
7
|
-
"start",
|
|
8
|
-
"run",
|
|
9
|
-
"session",
|
|
10
|
-
"history",
|
|
11
|
-
"data",
|
|
12
|
-
"workflows",
|
|
13
|
-
];
|
|
14
|
-
expect(Object.keys(topics)).toEqual(expectedTopics);
|
|
15
|
-
});
|
|
16
|
-
it("should have valid TopicDoc structure for each topic", () => {
|
|
17
|
-
for (const [key, doc] of Object.entries(topics)) {
|
|
18
|
-
expect(doc).toHaveProperty("topic");
|
|
19
|
-
expect(doc).toHaveProperty("title");
|
|
20
|
-
expect(doc).toHaveProperty("description");
|
|
21
|
-
expect(typeof doc.topic).toBe("string");
|
|
22
|
-
expect(typeof doc.title).toBe("string");
|
|
23
|
-
expect(typeof doc.description).toBe("string");
|
|
24
|
-
expect(doc.topic).toBe(key);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
describe("getTopicNames", () => {
|
|
29
|
-
it("should return all topic names", () => {
|
|
30
|
-
const names = getTopicNames();
|
|
31
|
-
expect(names).toEqual(Object.keys(topics));
|
|
32
|
-
});
|
|
33
|
-
it("should return an array of strings", () => {
|
|
34
|
-
const names = getTopicNames();
|
|
35
|
-
expect(Array.isArray(names)).toBe(true);
|
|
36
|
-
names.forEach((name) => {
|
|
37
|
-
expect(typeof name).toBe("string");
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
describe("getTopicDescriptions", () => {
|
|
42
|
-
it("should return formatted topic descriptions", () => {
|
|
43
|
-
const descriptions = getTopicDescriptions();
|
|
44
|
-
expect(typeof descriptions).toBe("string");
|
|
45
|
-
expect(descriptions).toContain("- start:");
|
|
46
|
-
expect(descriptions).toContain("- run:");
|
|
47
|
-
expect(descriptions).toContain("- session:");
|
|
48
|
-
});
|
|
49
|
-
it("should include all topics", () => {
|
|
50
|
-
const descriptions = getTopicDescriptions();
|
|
51
|
-
for (const key of Object.keys(topics)) {
|
|
52
|
-
expect(descriptions).toContain(`- ${key}:`);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
describe("handleRunApiDocs", () => {
|
|
57
|
-
it("should return error for undefined topic", () => {
|
|
58
|
-
const result = handleRunApiDocs(undefined);
|
|
59
|
-
expect(result).toContain('Error: Unknown topic "undefined"');
|
|
60
|
-
expect(result).toContain("Available topics:");
|
|
61
|
-
});
|
|
62
|
-
it("should return error for unknown topic", () => {
|
|
63
|
-
const result = handleRunApiDocs("nonexistent");
|
|
64
|
-
expect(result).toContain('Error: Unknown topic "nonexistent"');
|
|
65
|
-
expect(result).toContain("Available topics:");
|
|
66
|
-
});
|
|
67
|
-
it("should return documentation for valid topic", () => {
|
|
68
|
-
const result = handleRunApiDocs("start");
|
|
69
|
-
expect(result).not.toContain("Error:");
|
|
70
|
-
});
|
|
71
|
-
it("should return run documentation", () => {
|
|
72
|
-
const result = handleRunApiDocs("run");
|
|
73
|
-
expect(result).toContain("Run Execution");
|
|
74
|
-
expect(result).toContain("/run/exec");
|
|
75
|
-
});
|
|
76
|
-
it("should return session documentation", () => {
|
|
77
|
-
const result = handleRunApiDocs("session");
|
|
78
|
-
expect(result).toContain("Session");
|
|
79
|
-
});
|
|
80
|
-
it("should use default detail_level of detailed", () => {
|
|
81
|
-
const result = handleRunApiDocs("run");
|
|
82
|
-
expect(result).toContain("**Parameters:**");
|
|
83
|
-
});
|
|
84
|
-
it("should respect overview detail_level", () => {
|
|
85
|
-
const result = handleRunApiDocs("run", "overview");
|
|
86
|
-
expect(result).toContain("Run Execution");
|
|
87
|
-
});
|
|
88
|
-
it("should respect examples detail_level", () => {
|
|
89
|
-
const result = handleRunApiDocs("run", "examples");
|
|
90
|
-
expect(result).toContain("**Example:**");
|
|
91
|
-
});
|
|
92
|
-
it("should include schemas by default", () => {
|
|
93
|
-
const result = handleRunApiDocs("run");
|
|
94
|
-
expect(result).toContain("## Schemas");
|
|
95
|
-
});
|
|
96
|
-
it("should exclude schemas when includeSchemas is false", () => {
|
|
97
|
-
const result = handleRunApiDocs("run", "detailed", false);
|
|
98
|
-
expect(result).not.toContain("## Schemas");
|
|
99
|
-
});
|
|
100
|
-
it("should use Run API base URL", () => {
|
|
101
|
-
const result = handleRunApiDocs("run");
|
|
102
|
-
expect(result).toContain("https://app.dev.xano.com/api:run/");
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
describe("runApiDocsToolDefinition", () => {
|
|
106
|
-
it("should have required tool properties", () => {
|
|
107
|
-
expect(runApiDocsToolDefinition).toHaveProperty("name", "run_api_docs");
|
|
108
|
-
expect(runApiDocsToolDefinition).toHaveProperty("description");
|
|
109
|
-
expect(runApiDocsToolDefinition).toHaveProperty("inputSchema");
|
|
110
|
-
});
|
|
111
|
-
it("should mention fixed base URL in description", () => {
|
|
112
|
-
expect(runApiDocsToolDefinition.description).toContain("https://app.dev.xano.com/api:run/");
|
|
113
|
-
});
|
|
114
|
-
it("should have valid inputSchema", () => {
|
|
115
|
-
const schema = runApiDocsToolDefinition.inputSchema;
|
|
116
|
-
expect(schema.type).toBe("object");
|
|
117
|
-
expect(schema.properties).toHaveProperty("topic");
|
|
118
|
-
expect(schema.properties).toHaveProperty("detail_level");
|
|
119
|
-
expect(schema.properties).toHaveProperty("include_schemas");
|
|
120
|
-
expect(schema.required).toEqual(["topic"]);
|
|
121
|
-
});
|
|
122
|
-
it("should include all topic names in enum", () => {
|
|
123
|
-
const topicEnum = runApiDocsToolDefinition.inputSchema.properties.topic.enum;
|
|
124
|
-
expect(topicEnum).toEqual(getTopicNames());
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
});
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
export const dataDoc = {
|
|
2
|
-
topic: "data",
|
|
3
|
-
title: "Session Data Export",
|
|
4
|
-
description: `The sink endpoint provides complete data export from session backups. This is the "kitchen sink" - everything from a session's database state in a single JSON response.
|
|
5
|
-
|
|
6
|
-
## Prerequisites
|
|
7
|
-
- Session must have been hibernated at least once (backup must exist)
|
|
8
|
-
- Hibernation creates a complete snapshot of all tables and data
|
|
9
|
-
|
|
10
|
-
## Use Cases
|
|
11
|
-
- Export complete session state for analysis
|
|
12
|
-
- Backup data before session termination
|
|
13
|
-
- Transfer data between sessions
|
|
14
|
-
- Debugging and auditing
|
|
15
|
-
|
|
16
|
-
## Data Included
|
|
17
|
-
- All table schemas
|
|
18
|
-
- All table data/records
|
|
19
|
-
- Complete as single JSON object`,
|
|
20
|
-
ai_hints: `- Session must be hibernated before sink is available
|
|
21
|
-
- Hibernation happens automatically after project timeout or manually
|
|
22
|
-
- Large datasets may take time to export - be patient
|
|
23
|
-
- Use for complete data snapshots, not real-time queries
|
|
24
|
-
- Data is read-only - cannot modify via sink endpoint
|
|
25
|
-
- Public sessions can export without authentication`,
|
|
26
|
-
endpoints: [
|
|
27
|
-
{
|
|
28
|
-
method: "GET",
|
|
29
|
-
path: "/session/{session_id}/sink",
|
|
30
|
-
tool_name: "getSessionSink",
|
|
31
|
-
description: "Get full backup data from a session as JSON. Returns the complete 'kitchen sink' - all table schemas and data in one response. Session must have been hibernated at least once.",
|
|
32
|
-
parameters: [
|
|
33
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
34
|
-
],
|
|
35
|
-
example: {
|
|
36
|
-
method: "GET",
|
|
37
|
-
path: "/session/session-uuid-here/sink"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
schemas: {
|
|
42
|
-
SinkResponse: {
|
|
43
|
-
type: "object",
|
|
44
|
-
properties: {
|
|
45
|
-
tables: {
|
|
46
|
-
type: "object",
|
|
47
|
-
description: "Map of table names to their data",
|
|
48
|
-
additionalProperties: {
|
|
49
|
-
type: "object",
|
|
50
|
-
properties: {
|
|
51
|
-
schema: { type: "array", description: "Field definitions" },
|
|
52
|
-
records: { type: "array", description: "All records in the table" }
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
metadata: {
|
|
57
|
-
type: "object",
|
|
58
|
-
properties: {
|
|
59
|
-
session_id: { type: "uuid", description: "Source session" },
|
|
60
|
-
exported_at: { type: "timestamp", description: "Export timestamp" },
|
|
61
|
-
size: { type: "integer", description: "Backup size in bytes" }
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
examples: [
|
|
68
|
-
{
|
|
69
|
-
title: "Export session data",
|
|
70
|
-
description: "Get all data from a hibernated session",
|
|
71
|
-
request: {
|
|
72
|
-
method: "GET",
|
|
73
|
-
path: "/session/abc123-session-uuid/sink",
|
|
74
|
-
headers: { "Authorization": "Bearer <token>" }
|
|
75
|
-
},
|
|
76
|
-
response: {
|
|
77
|
-
tables: {
|
|
78
|
-
users: {
|
|
79
|
-
schema: [
|
|
80
|
-
{ name: "id", type: "int" },
|
|
81
|
-
{ name: "email", type: "text" },
|
|
82
|
-
{ name: "name", type: "text" }
|
|
83
|
-
],
|
|
84
|
-
records: [
|
|
85
|
-
{ id: 1, email: "alice@example.com", name: "Alice" },
|
|
86
|
-
{ id: 2, email: "bob@example.com", name: "Bob" }
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
orders: {
|
|
90
|
-
schema: [
|
|
91
|
-
{ name: "id", type: "int" },
|
|
92
|
-
{ name: "user_id", type: "int" },
|
|
93
|
-
{ name: "total", type: "decimal" }
|
|
94
|
-
],
|
|
95
|
-
records: [
|
|
96
|
-
{ id: 1, user_id: 1, total: 99.99 }
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
related_topics: ["session", "workflows"]
|
|
104
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export const historyDoc = {
|
|
2
|
-
topic: "history",
|
|
3
|
-
title: "Run History & Document Analysis",
|
|
4
|
-
description: `Endpoints for viewing run execution history and analyzing XanoScript documents before execution.
|
|
5
|
-
|
|
6
|
-
## Use Cases
|
|
7
|
-
- **Run History**: Review past executions, track patterns, audit usage
|
|
8
|
-
- **Document Analysis**: Validate scripts, understand structure before execution
|
|
9
|
-
|
|
10
|
-
## History Features
|
|
11
|
-
- Paginated access to run history
|
|
12
|
-
- Sorted by creation time (newest first)
|
|
13
|
-
- Includes run metadata and configuration`,
|
|
14
|
-
ai_hints: `- Use doc/info to validate scripts before execution
|
|
15
|
-
- History is sorted by created_at descending (newest first)
|
|
16
|
-
- Check existing runs before creating duplicates with same script
|
|
17
|
-
- Use pagination for large history sets (default 20 per page, max 100)
|
|
18
|
-
- Document info reveals functions, services, and jobs defined in a script`,
|
|
19
|
-
endpoints: [
|
|
20
|
-
{
|
|
21
|
-
method: "GET",
|
|
22
|
-
path: "/project/{project_id}/run",
|
|
23
|
-
tool_name: "getRunHistory",
|
|
24
|
-
description: "List run execution history for a project with pagination. Returns runs sorted by creation time (newest first).",
|
|
25
|
-
parameters: [
|
|
26
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
27
|
-
{ name: "page", type: "integer", default: 1, description: "Page number (min: 1)" },
|
|
28
|
-
{ name: "per_page", type: "integer", default: 20, description: "Items per page (1-100)" }
|
|
29
|
-
],
|
|
30
|
-
example: {
|
|
31
|
-
method: "GET",
|
|
32
|
-
path: "/project/abc123-uuid/run?page=1&per_page=20"
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
method: "POST",
|
|
37
|
-
path: "/project/{project_id}/doc/info",
|
|
38
|
-
tool_name: "getDocInfo",
|
|
39
|
-
description: "Parse and analyze a XanoScript document. Returns metadata about the document including defined functions, services, and jobs. Use this to validate scripts before execution.",
|
|
40
|
-
parameters: [
|
|
41
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project context" }
|
|
42
|
-
],
|
|
43
|
-
request_body: {
|
|
44
|
-
type: "application/json",
|
|
45
|
-
properties: {
|
|
46
|
-
doc: { type: "text", required: true, description: "XanoScript document content to analyze" }
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
example: {
|
|
50
|
-
method: "POST",
|
|
51
|
-
path: "/project/abc123-uuid/doc/info",
|
|
52
|
-
body: {
|
|
53
|
-
doc: "job my_job {\n input { text name }\n response = \"Hello, \" + $input.name\n}\n\nservice my_service {\n // service code\n}"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
schemas: {
|
|
59
|
-
RunHistoryItem: {
|
|
60
|
-
type: "object",
|
|
61
|
-
properties: {
|
|
62
|
-
id: { type: "uuid", description: "Run identifier" },
|
|
63
|
-
name: { type: "text", description: "Run name" },
|
|
64
|
-
type: { type: "enum", enum: ["job", "service"], description: "Run type" },
|
|
65
|
-
sig: { type: "text", description: "Document signature" },
|
|
66
|
-
project_id: { type: "uuid", description: "Project reference" },
|
|
67
|
-
user_id: { type: "integer", description: "Owner user ID" },
|
|
68
|
-
created_at: { type: "timestamp", description: "Creation time" },
|
|
69
|
-
updated_at: { type: "timestamp", description: "Last update time" }
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
DocInfo: {
|
|
73
|
-
type: "object",
|
|
74
|
-
properties: {
|
|
75
|
-
functions: { type: "array", description: "Defined functions" },
|
|
76
|
-
services: { type: "array", description: "Defined services" },
|
|
77
|
-
jobs: { type: "array", description: "Defined jobs" },
|
|
78
|
-
valid: { type: "boolean", description: "Whether document is valid" },
|
|
79
|
-
errors: { type: "array", description: "Parsing errors if any" }
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
PaginatedResponse: {
|
|
83
|
-
type: "object",
|
|
84
|
-
properties: {
|
|
85
|
-
items: { type: "array", description: "List of runs" },
|
|
86
|
-
curPage: { type: "integer", description: "Current page number" },
|
|
87
|
-
nextPage: { type: "integer", description: "Next page number or null" },
|
|
88
|
-
prevPage: { type: "integer", description: "Previous page number or null" }
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
related_topics: ["run", "session", "workflows"]
|
|
93
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
export const runDoc = {
|
|
2
|
-
topic: "run",
|
|
3
|
-
title: "Run Execution",
|
|
4
|
-
description: `Endpoints for executing XanoScript runs. Runs are executable XanoScript documents that can be jobs (one-time execution) or services (long-running processes).
|
|
5
|
-
|
|
6
|
-
## Run Types
|
|
7
|
-
- **Job**: Executes once and terminates. Use for data processing, migrations, one-time tasks.
|
|
8
|
-
- **Service**: Runs persistently in a tenant. Use for APIs, webhooks, background workers.
|
|
9
|
-
|
|
10
|
-
## Execution Flow
|
|
11
|
-
1. Submit XanoScript document via \`/run/exec\`
|
|
12
|
-
2. System creates a session to track execution
|
|
13
|
-
3. Session progresses through states: pending → processing → running → complete/error
|
|
14
|
-
4. Retrieve results from the session
|
|
15
|
-
|
|
16
|
-
## Templates
|
|
17
|
-
The \`template\` parameter controls resource allocation:
|
|
18
|
-
- \`small\`: Default, suitable for most workloads
|
|
19
|
-
- Additional templates may be available for larger workloads`,
|
|
20
|
-
ai_hints: `- Include complete XanoScript in the 'doc' parameter
|
|
21
|
-
- Use 'args' to pass dynamic data to runs (available as $args in XanoScript)
|
|
22
|
-
- Use 'env' to override environment variables for this execution
|
|
23
|
-
- Template affects resource allocation - use "small" for typical workloads
|
|
24
|
-
- Re-executing a run reuses its stored configuration with optional overrides
|
|
25
|
-
- Check the session state after execution to verify success`,
|
|
26
|
-
endpoints: [
|
|
27
|
-
{
|
|
28
|
-
method: "POST",
|
|
29
|
-
path: "/project/{project_id}/run/exec",
|
|
30
|
-
tool_name: "run",
|
|
31
|
-
description: "Execute a new XanoScript run. Creates a session to track execution and returns the result.",
|
|
32
|
-
parameters: [
|
|
33
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" }
|
|
34
|
-
],
|
|
35
|
-
request_body: {
|
|
36
|
-
type: "application/json",
|
|
37
|
-
properties: {
|
|
38
|
-
doc: { type: "text", required: true, description: "XanoScript document content" },
|
|
39
|
-
args: { type: "json", description: "Arguments passed to the job (default: {})" },
|
|
40
|
-
env: { type: "json", description: "Environment variable overrides (default: {})" },
|
|
41
|
-
template: { type: "text", description: "Execution template (default: 'small')" },
|
|
42
|
-
logs: { type: "json[]", description: "Execution logs array (default: [])" }
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
example: {
|
|
46
|
-
method: "POST",
|
|
47
|
-
path: "/project/abc123-uuid/run/exec",
|
|
48
|
-
body: {
|
|
49
|
-
doc: "job process_data {\n input { json items }\n response = $input.items.map(i => i.value * 2)\n}",
|
|
50
|
-
args: { items: [{ value: 1 }, { value: 2 }, { value: 3 }] },
|
|
51
|
-
template: "small"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
method: "POST",
|
|
57
|
-
path: "/project/{project_id}/run/{run_id}/exec",
|
|
58
|
-
description: "Re-execute an existing run by its ID. Uses the stored run configuration with optional argument and environment overrides.",
|
|
59
|
-
parameters: [
|
|
60
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
61
|
-
{ name: "run_id", type: "uuid", required: true, in: "path", description: "Run UUID to re-execute" }
|
|
62
|
-
],
|
|
63
|
-
request_body: {
|
|
64
|
-
type: "application/json",
|
|
65
|
-
properties: {
|
|
66
|
-
args: { type: "json", description: "Override arguments (default: {})" },
|
|
67
|
-
env: { type: "json", description: "Override environment variables (default: {})" },
|
|
68
|
-
template: { type: "text", description: "Execution template (default: 'small')" },
|
|
69
|
-
logs: { type: "json[]", description: "Execution logs array (default: [])" }
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
example: {
|
|
73
|
-
method: "POST",
|
|
74
|
-
path: "/project/abc123-uuid/run/run456-uuid/exec",
|
|
75
|
-
body: {
|
|
76
|
-
args: { updated_value: 100 },
|
|
77
|
-
template: "small"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
schemas: {
|
|
83
|
-
Run: {
|
|
84
|
-
type: "object",
|
|
85
|
-
properties: {
|
|
86
|
-
id: { type: "uuid", description: "Unique run identifier" },
|
|
87
|
-
name: { type: "text", description: "Run name" },
|
|
88
|
-
type: { type: "enum", enum: ["job", "service"], description: "Run type" },
|
|
89
|
-
doc: { type: "text", description: "XanoScript document content" },
|
|
90
|
-
args: { type: "json", description: "Stored arguments" },
|
|
91
|
-
project_id: { type: "uuid", description: "Associated project" },
|
|
92
|
-
user_id: { type: "integer", description: "Owner user ID" },
|
|
93
|
-
sig: { type: "text", description: "Document signature/hash" },
|
|
94
|
-
created_at: { type: "timestamp", description: "Creation time" },
|
|
95
|
-
updated_at: { type: "timestamp", description: "Last update time" }
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
ExecutionResult: {
|
|
99
|
-
type: "object",
|
|
100
|
-
properties: {
|
|
101
|
-
session_id: { type: "uuid", description: "Created session ID" },
|
|
102
|
-
state: { type: "enum", enum: ["pending", "processing", "running", "error", "complete"] },
|
|
103
|
-
response: { type: "any", description: "Execution result" },
|
|
104
|
-
error_msg: { type: "text", description: "Error message if failed" },
|
|
105
|
-
logs: { type: "json[]", description: "Execution logs" }
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
related_topics: ["session", "history", "workflows"]
|
|
110
|
-
};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
export const sessionDoc = {
|
|
2
|
-
topic: "session",
|
|
3
|
-
title: "Session Management",
|
|
4
|
-
description: `Sessions are active runtime execution contexts with isolated state. Each run execution creates a session that tracks the execution lifecycle, timing metrics, and results.
|
|
5
|
-
|
|
6
|
-
## Session States
|
|
7
|
-
- \`pending\`: Awaiting execution
|
|
8
|
-
- \`processing\`: Setting up execution environment
|
|
9
|
-
- \`running\`: Active execution in progress
|
|
10
|
-
- \`error\`: Execution failed
|
|
11
|
-
- \`complete\`: Execution finished successfully
|
|
12
|
-
|
|
13
|
-
## Access Levels
|
|
14
|
-
- \`private\`: Requires authentication and project ownership
|
|
15
|
-
- \`public\`: Accessible without authentication
|
|
16
|
-
|
|
17
|
-
## Session Lifecycle
|
|
18
|
-
1. **Creation**: Session created when a run is executed
|
|
19
|
-
2. **Execution**: Session progresses through states
|
|
20
|
-
3. **Hibernation**: Long-running services may hibernate after timeout
|
|
21
|
-
4. **Termination**: Sessions can be stopped manually or auto-cleanup
|
|
22
|
-
|
|
23
|
-
## Timing Metrics
|
|
24
|
-
Sessions track detailed timing information:
|
|
25
|
-
- \`boot_time\`: Environment setup time
|
|
26
|
-
- \`pre_time\`: Pre-execution processing
|
|
27
|
-
- \`main_time\`: Main execution duration
|
|
28
|
-
- \`post_time\`: Post-execution cleanup
|
|
29
|
-
- \`total_time\`: Complete execution time`,
|
|
30
|
-
ai_hints: `- Check session state before performing operations
|
|
31
|
-
- Only "service" type sessions can be re-executed with new documents
|
|
32
|
-
- Public sessions are accessible without auth - use for sharing results
|
|
33
|
-
- Sessions auto-hibernate after project timeout (default: 1 hour)
|
|
34
|
-
- Use /stop endpoint to gracefully terminate running sessions
|
|
35
|
-
- Cannot stop sessions already in "error" or "complete" state`,
|
|
36
|
-
endpoints: [
|
|
37
|
-
{
|
|
38
|
-
method: "GET",
|
|
39
|
-
path: "/project/{project_id}/run/session",
|
|
40
|
-
tool_name: "getProjectSessions",
|
|
41
|
-
description: "List all active sessions for a project with pagination.",
|
|
42
|
-
parameters: [
|
|
43
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
44
|
-
{ name: "page", type: "integer", default: 1, description: "Page number (min: 1)" }
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
method: "GET",
|
|
49
|
-
path: "/project/{project_id}/run/{run_id}/session",
|
|
50
|
-
tool_name: "getRunSessions",
|
|
51
|
-
description: "List all sessions for a specific run.",
|
|
52
|
-
parameters: [
|
|
53
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
54
|
-
{ name: "run_id", type: "uuid", required: true, in: "path", description: "Run UUID" },
|
|
55
|
-
{ name: "page", type: "integer", default: 1, description: "Page number (min: 1)" }
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
method: "GET",
|
|
60
|
-
path: "/session/{session_id}",
|
|
61
|
-
tool_name: "getSession",
|
|
62
|
-
description: "Get detailed information about a session including status, run config, and timing metrics. Public sessions don't require authentication.",
|
|
63
|
-
parameters: [
|
|
64
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
method: "POST",
|
|
69
|
-
path: "/session/{session_id}/access",
|
|
70
|
-
tool_name: "setSessionAccess",
|
|
71
|
-
description: "Update the access level of a session (public or private).",
|
|
72
|
-
parameters: [
|
|
73
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
74
|
-
],
|
|
75
|
-
request_body: {
|
|
76
|
-
type: "application/json",
|
|
77
|
-
properties: {
|
|
78
|
-
access: { type: "enum", required: true, description: "Access level: 'public' or 'private'" }
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
example: {
|
|
82
|
-
method: "POST",
|
|
83
|
-
path: "/session/session-uuid/access",
|
|
84
|
-
body: { access: "public" }
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
method: "POST",
|
|
89
|
-
path: "/session/{session_id}/exec",
|
|
90
|
-
description: "Re-execute on an existing service session with a new XanoScript document. Reuses the session's resources (tenant). Only works on 'service' type sessions with a valid tenant.",
|
|
91
|
-
parameters: [
|
|
92
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
93
|
-
],
|
|
94
|
-
request_body: {
|
|
95
|
-
type: "application/json",
|
|
96
|
-
properties: {
|
|
97
|
-
doc: { type: "text", required: true, description: "New XanoScript document" },
|
|
98
|
-
args: { type: "json", description: "Arguments (default: {})" },
|
|
99
|
-
env: { type: "json", description: "Environment overrides (default: {})" }
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
example: {
|
|
103
|
-
method: "POST",
|
|
104
|
-
path: "/session/session-uuid/exec",
|
|
105
|
-
body: {
|
|
106
|
-
doc: "job updated_logic {\n response = \"New execution on existing session\"\n}",
|
|
107
|
-
args: {}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
method: "PATCH",
|
|
113
|
-
path: "/session/{session_id}",
|
|
114
|
-
tool_name: "updateSessionRun",
|
|
115
|
-
description: "Update the run name associated with a session.",
|
|
116
|
-
parameters: [
|
|
117
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
118
|
-
],
|
|
119
|
-
request_body: {
|
|
120
|
-
type: "application/json",
|
|
121
|
-
properties: {
|
|
122
|
-
name: { type: "text", required: true, description: "New run name (min 1 character)" }
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
method: "POST",
|
|
128
|
-
path: "/project/{project_id}/run/{run_id}/session/{session_id}/stop",
|
|
129
|
-
tool_name: "stopSession",
|
|
130
|
-
description: "Stop and tear down a running session. Creates a backup before deletion. Cannot stop sessions already in 'error' or 'complete' state.",
|
|
131
|
-
parameters: [
|
|
132
|
-
{ name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
|
|
133
|
-
{ name: "run_id", type: "uuid", required: true, in: "path", description: "Run UUID" },
|
|
134
|
-
{ name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
],
|
|
138
|
-
schemas: {
|
|
139
|
-
Session: {
|
|
140
|
-
type: "object",
|
|
141
|
-
properties: {
|
|
142
|
-
id: { type: "uuid", description: "Session identifier" },
|
|
143
|
-
run_id: { type: "uuid", description: "Associated run" },
|
|
144
|
-
state: { type: "enum", enum: ["pending", "processing", "running", "error", "complete"], description: "Current state" },
|
|
145
|
-
access: { type: "enum", enum: ["private", "public"], description: "Access level" },
|
|
146
|
-
doc: { type: "text", description: "Executed XanoScript" },
|
|
147
|
-
version: { type: "integer", description: "Document version" },
|
|
148
|
-
response: { type: "json", description: "Execution response" },
|
|
149
|
-
error_msg: { type: "text", description: "Error message if failed" },
|
|
150
|
-
logs: { type: "json[]", description: "Execution logs" },
|
|
151
|
-
label: { type: "text", description: "Session label" },
|
|
152
|
-
tenant_id: { type: "integer", description: "Runtime tenant reference" },
|
|
153
|
-
hibernate_at: { type: "timestamp", description: "Hibernation timestamp" },
|
|
154
|
-
pre_time: { type: "decimal", description: "Pre-execution time" },
|
|
155
|
-
post_time: { type: "decimal", description: "Post-execution time" },
|
|
156
|
-
main_time: { type: "decimal", description: "Main execution time" },
|
|
157
|
-
boot_time: { type: "decimal", description: "Boot time" },
|
|
158
|
-
total_time: { type: "decimal", description: "Total execution time" },
|
|
159
|
-
backup: { type: "object", description: "Backup info with resource and size" },
|
|
160
|
-
created_at: { type: "timestamp", description: "Creation time" },
|
|
161
|
-
updated_at: { type: "timestamp", description: "Last update time" }
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
related_topics: ["run", "data", "workflows"]
|
|
166
|
-
};
|