@deepraxis/sdk 0.1.1-dev.cc34a92 → 0.1.1-dev.cc84163
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/METHODS.md +533 -1
- package/README.md +4 -4
- package/dist/core/credentials.d.ts +12 -3
- package/dist/core/credentials.js +22 -2
- package/dist/core/errors.d.ts +6 -0
- package/dist/core/errors.js +8 -0
- package/dist/core/transport.d.ts +1 -1
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.js +1 -1
- package/dist/generated/sdk.gen.d.ts +1253 -66
- package/dist/generated/sdk.gen.js +4254 -1052
- package/dist/generated/types.gen.d.ts +61770 -42020
- package/dist/helpers/browser-actions.d.ts +84 -0
- package/dist/helpers/browser-actions.js +141 -0
- package/dist/helpers/browser-connect.d.ts +26 -2
- package/dist/helpers/browser-connect.js +263 -25
- package/dist/helpers/browser-decisions.d.ts +44 -0
- package/dist/helpers/browser-decisions.js +53 -0
- package/dist/helpers/browser-documentation.d.ts +1 -1
- package/dist/helpers/browser-documentation.js +20 -11
- package/dist/operations.generated.d.ts +35 -16413
- package/dist/operations.generated.js +11342 -4540
- package/dist/resources.generated.d.ts +396 -9
- package/dist/resources.generated.js +332 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Models, agents, sandboxes, search, data and automation, typed end to end.**
|
|
6
6
|
|
|
7
|
-
The official TypeScript SDK for [
|
|
7
|
+
The official TypeScript SDK for [Praxis](https://deepraxis.com), the cloud where AI agents are built, run and hosted.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@deepraxis/sdk)
|
|
10
10
|
[](https://bundlephobia.com/package/@deepraxis/sdk)
|
|
@@ -33,7 +33,7 @@ console.log(completion.choices[0]?.message.content);
|
|
|
33
33
|
## Why this SDK
|
|
34
34
|
|
|
35
35
|
- **The whole platform, one client.** About 350 operations across models, agents, sandboxes,
|
|
36
|
-
|
|
36
|
+
browsers, web search, databases, knowledge bases, files, media, automation and hosted
|
|
37
37
|
applications, generated from the same contract as the API.
|
|
38
38
|
- **Types from the contract.** Every path, query, body and response is typed, including the
|
|
39
39
|
events of each stream, so your editor knows what comes back.
|
|
@@ -122,7 +122,7 @@ conversation with it, on its own machine.
|
|
|
122
122
|
```ts
|
|
123
123
|
const { sandboxes } = praxis.sandbox;
|
|
124
124
|
const sandbox = await sandboxes.create({
|
|
125
|
-
body: { templateID: 'base' },
|
|
125
|
+
body: { templateID: 'base', autoPause: false }, // ends at its timeout; autoPause: true keeps a long-lived computer
|
|
126
126
|
});
|
|
127
127
|
const result = await sandboxes.commands.run({
|
|
128
128
|
path: { sandbox_id: sandbox.sandboxID },
|
|
@@ -276,5 +276,5 @@ sandboxes, search, data, automation and the rest of the platform.
|
|
|
276
276
|
|
|
277
277
|
[Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0). Copyright 2026 南京深度实践人工智能科技有限公司 (Deepractice).
|
|
278
278
|
|
|
279
|
-
"Praxis"
|
|
279
|
+
"Praxis" and "Deepraxis" are trademarks of Deepractice; the license does not grant
|
|
280
280
|
rights to use them.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default credential chain for code running on a Praxis computer (ticket-5367):
|
|
3
|
-
* PRAXIS_API_TOKEN environment variable, then
|
|
4
|
-
*
|
|
2
|
+
* Default credential chain for code running on a Praxis computer (ticket-5367, ADR-098 §2):
|
|
3
|
+
* the PRAXIS_API_TOKEN environment variable, then the login file of the environment,
|
|
4
|
+
* `~/.praxis/cli/<env>.json` — the one file `praxis login` writes for a person and the platform writes
|
|
5
|
+
* for a managed login. Resolved at call time so a token the platform renewed in the file is picked up
|
|
6
|
+
* by an already-running process.
|
|
5
7
|
*/
|
|
6
8
|
export interface ResolvedCredentials {
|
|
7
9
|
token?: string;
|
|
@@ -9,6 +11,13 @@ export interface ResolvedCredentials {
|
|
|
9
11
|
}
|
|
10
12
|
type Env = Record<string, string | undefined>;
|
|
11
13
|
type ReadFile = (path: string) => string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Which environment's login file applies: PRAXIS_ENV when it names one, otherwise a `-develop.` host in
|
|
16
|
+
* PRAXIS_API_URL means develop and any other host production — the rule apps/cli/src/config/env.ts
|
|
17
|
+
* applies. A PRAXIS_ENV that is not a plain name is no environment at all and is ignored. Pure.
|
|
18
|
+
*/
|
|
19
|
+
export declare function credentialsEnv(env: Env): string;
|
|
20
|
+
/** The one login file, the same path the CLI reads for this environment. Null without a home directory. Pure. */
|
|
12
21
|
export declare function credentialsPath(env: Env): string | null;
|
|
13
22
|
export declare function resolveDefaultCredentials(env?: Env, readFile?: ReadFile): ResolvedCredentials;
|
|
14
23
|
export {};
|
package/dist/core/credentials.js
CHANGED
|
@@ -8,9 +8,29 @@ function defaultReadFile(path) {
|
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Which environment's login file applies: PRAXIS_ENV when it names one, otherwise a `-develop.` host in
|
|
13
|
+
* PRAXIS_API_URL means develop and any other host production — the rule apps/cli/src/config/env.ts
|
|
14
|
+
* applies. A PRAXIS_ENV that is not a plain name is no environment at all and is ignored. Pure.
|
|
15
|
+
*/
|
|
16
|
+
export function credentialsEnv(env) {
|
|
17
|
+
const declared = nonEmpty(env.PRAXIS_ENV);
|
|
18
|
+
if (declared && /^[A-Za-z0-9_-]+$/.test(declared))
|
|
19
|
+
return declared;
|
|
20
|
+
const apiUrl = nonEmpty(env.PRAXIS_API_URL);
|
|
21
|
+
if (apiUrl) {
|
|
22
|
+
try {
|
|
23
|
+
if (new URL(apiUrl).hostname.includes('-develop.'))
|
|
24
|
+
return 'develop';
|
|
25
|
+
}
|
|
26
|
+
catch { /* a malformed URL is not evidence of develop */ }
|
|
27
|
+
}
|
|
28
|
+
return 'production';
|
|
29
|
+
}
|
|
30
|
+
/** The one login file, the same path the CLI reads for this environment. Null without a home directory. Pure. */
|
|
11
31
|
export function credentialsPath(env) {
|
|
12
32
|
const home = nonEmpty(env.HOME) ?? nonEmpty(env.USERPROFILE);
|
|
13
|
-
return home ? `${home.replace(
|
|
33
|
+
return home ? `${home.replace(/[/\\]+$/, '')}/.praxis/cli/${credentialsEnv(env)}.json` : null;
|
|
14
34
|
}
|
|
15
35
|
export function resolveDefaultCredentials(env = globalThis.process?.env ?? {}, readFile = defaultReadFile) {
|
|
16
36
|
const envToken = nonEmpty(env.PRAXIS_API_TOKEN);
|
|
@@ -23,7 +43,7 @@ export function resolveDefaultCredentials(env = globalThis.process?.env ?? {}, r
|
|
|
23
43
|
return envUrl ? { apiUrl: envUrl } : {};
|
|
24
44
|
try {
|
|
25
45
|
const file = JSON.parse(text);
|
|
26
|
-
const token = nonEmpty(file.
|
|
46
|
+
const token = nonEmpty(file.access_token);
|
|
27
47
|
const apiUrl = envUrl ?? nonEmpty(file.api_url);
|
|
28
48
|
return { ...(token ? { token } : {}), ...(apiUrl ? { apiUrl } : {}) };
|
|
29
49
|
}
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export interface ProblemDetails {
|
|
|
9
9
|
requestId?: string;
|
|
10
10
|
message?: string;
|
|
11
11
|
param?: string | null;
|
|
12
|
+
/** ticket-681 — the documentation page the failure points at, and the exact section to read. */
|
|
13
|
+
docUrl?: string;
|
|
14
|
+
describe?: string;
|
|
12
15
|
raw?: unknown;
|
|
13
16
|
}
|
|
14
17
|
/** Pure normalization shared by HTTP clients and the automation call ledger.
|
|
@@ -26,6 +29,9 @@ export declare class PraxisError extends Error {
|
|
|
26
29
|
readonly errors: unknown[];
|
|
27
30
|
readonly requestId?: string;
|
|
28
31
|
readonly param?: string | null;
|
|
32
|
+
/** ticket-681 — the documented page and the exact section an agent should read to fix the call. */
|
|
33
|
+
readonly docUrl?: string;
|
|
34
|
+
readonly describe?: string;
|
|
29
35
|
readonly raw?: unknown;
|
|
30
36
|
constructor(problem?: ProblemDetails, options?: ErrorOptions);
|
|
31
37
|
static fromResponse(response: Response, body: unknown): PraxisError;
|
package/dist/core/errors.js
CHANGED
|
@@ -16,6 +16,9 @@ export function problemFrom(status, headers, body, statusText) {
|
|
|
16
16
|
param: typeof param === 'string' ? param : param === null || nested.param === null ? null : undefined,
|
|
17
17
|
errors: Array.isArray(value.errors) ? value.errors : [],
|
|
18
18
|
requestId: headers.get('x-request-id') ?? string(value.requestId) ?? string(value.request_id),
|
|
19
|
+
// Both spellings reach here: the own face writes snake_case, an in-process problem keeps docUrl.
|
|
20
|
+
docUrl: string(nested.doc_url) ?? string(value.doc_url) ?? string(nested.docUrl) ?? string(value.docUrl),
|
|
21
|
+
describe: string(nested.describe) ?? string(value.describe),
|
|
19
22
|
raw: body,
|
|
20
23
|
};
|
|
21
24
|
}
|
|
@@ -28,6 +31,9 @@ export class PraxisError extends Error {
|
|
|
28
31
|
errors;
|
|
29
32
|
requestId;
|
|
30
33
|
param;
|
|
34
|
+
/** ticket-681 — the documented page and the exact section an agent should read to fix the call. */
|
|
35
|
+
docUrl;
|
|
36
|
+
describe;
|
|
31
37
|
raw;
|
|
32
38
|
constructor(problem = {}, options) {
|
|
33
39
|
super(problem.message ?? problem.detail ?? problem.title ?? `Praxis request failed${problem.status ? ` (${problem.status})` : ''}`, options);
|
|
@@ -40,6 +46,8 @@ export class PraxisError extends Error {
|
|
|
40
46
|
this.errors = problem.errors ?? [];
|
|
41
47
|
this.requestId = problem.requestId;
|
|
42
48
|
this.param = problem.param;
|
|
49
|
+
this.docUrl = problem.docUrl;
|
|
50
|
+
this.describe = problem.describe;
|
|
43
51
|
this.raw = problem.raw;
|
|
44
52
|
}
|
|
45
53
|
static fromResponse(response, body) {
|
package/dist/core/transport.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SSEEvent } from './sse.js';
|
|
2
2
|
export interface PraxisOptions {
|
|
3
|
-
/** Explicit key. Omitted on a Praxis computer: PRAXIS_API_TOKEN, then
|
|
3
|
+
/** Explicit key. Omitted on a Praxis computer: PRAXIS_API_TOKEN, then the login file `~/.praxis/cli/<env>.json`, are used. */
|
|
4
4
|
apiKey?: string;
|
|
5
5
|
baseUrl?: string;
|
|
6
6
|
timeoutMs?: number;
|