ashr-labs 0.4.3 → 0.6.0
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/cli.js +3 -3
- package/dist/client.d.ts +13 -0
- package/dist/client.js +29 -1
- package/dist/index.d.ts +1 -1
- package/dist/models.d.ts +15 -0
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -439,7 +439,7 @@ async function main() {
|
|
|
439
439
|
print(` is auto-detected from your project.\n`);
|
|
440
440
|
print(` You can also set ASHR_LABS_API_KEY in your environment`);
|
|
441
441
|
print(` and run ${DIM}npx ashr-labs${RESET} with no arguments.\n`);
|
|
442
|
-
print(` Get your key at ${BOLD}https://
|
|
442
|
+
print(` Get your key at ${BOLD}https://lab.ashr.io → API Keys${RESET}\n`);
|
|
443
443
|
process.exit(0);
|
|
444
444
|
}
|
|
445
445
|
// Find the API key: first positional arg that starts with tp_, or env var
|
|
@@ -451,12 +451,12 @@ async function main() {
|
|
|
451
451
|
if (!apiKey) {
|
|
452
452
|
print(`\n${BOLD}${ASHR_BLUE} ashr labs${RESET}\n`);
|
|
453
453
|
print(` Usage: ${BOLD}npx ashr-labs <api-key>${RESET}\n`);
|
|
454
|
-
print(` Get your key at https://
|
|
454
|
+
print(` Get your key at https://lab.ashr.io → API Keys\n`);
|
|
455
455
|
process.exit(1);
|
|
456
456
|
}
|
|
457
457
|
if (!apiKey.startsWith("tp_")) {
|
|
458
458
|
print(`\n${YELLOW} Invalid API key — must start with tp_${RESET}`);
|
|
459
|
-
print(` Get one at https://
|
|
459
|
+
print(` Get one at https://lab.ashr.io → API Keys\n`);
|
|
460
460
|
process.exit(1);
|
|
461
461
|
}
|
|
462
462
|
print("");
|
package/dist/client.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare class AshrLabsClient {
|
|
|
5
5
|
private _tenantId;
|
|
6
6
|
private _userId;
|
|
7
7
|
private _session;
|
|
8
|
+
private _notes;
|
|
8
9
|
constructor(apiKey: string, baseUrl?: string, timeout?: number);
|
|
9
10
|
static fromEnv(timeout?: number): AshrLabsClient;
|
|
10
11
|
private _ensureSession;
|
|
@@ -133,6 +134,18 @@ export declare class AshrLabsClient {
|
|
|
133
134
|
listRequests(tenantId?: number | null, status?: string | null, limit?: number, cursor?: number | null): Promise<Record<string, unknown>>;
|
|
134
135
|
listApiKeys(includeInactive?: boolean): Promise<Record<string, unknown>[]>;
|
|
135
136
|
revokeApiKey(apiKeyId: number): Promise<Record<string, unknown>>;
|
|
137
|
+
/**
|
|
138
|
+
* Get cached SDK notes from the last init() or getNotes() call.
|
|
139
|
+
* Notes are platform advisories that may affect how you configure or run your agent.
|
|
140
|
+
*/
|
|
141
|
+
get notes(): Record<string, unknown>[];
|
|
142
|
+
/**
|
|
143
|
+
* Fetch fresh SDK notes from the platform.
|
|
144
|
+
*
|
|
145
|
+
* @param agentId - Optional agent ID to also include agent-targeted notes.
|
|
146
|
+
* @returns List of active notes for your tenant.
|
|
147
|
+
*/
|
|
148
|
+
getNotes(agentId?: number | null): Promise<Record<string, unknown>[]>;
|
|
136
149
|
init(): Promise<Record<string, unknown>>;
|
|
137
150
|
healthCheck(): Promise<Record<string, unknown>>;
|
|
138
151
|
waitForRequest(requestId: number, timeout?: number, pollInterval?: number): Promise<Record<string, unknown>>;
|
package/dist/client.js
CHANGED
|
@@ -7,6 +7,7 @@ export class AshrLabsClient {
|
|
|
7
7
|
_tenantId = null;
|
|
8
8
|
_userId = null;
|
|
9
9
|
_session = null;
|
|
10
|
+
_notes = [];
|
|
10
11
|
constructor(apiKey, baseUrl = DEFAULT_BASE_URL, timeout = 30) {
|
|
11
12
|
if (!apiKey || !apiKey.startsWith("tp_")) {
|
|
12
13
|
throw new Error("Invalid API key format. API keys must start with 'tp_'");
|
|
@@ -19,7 +20,7 @@ export class AshrLabsClient {
|
|
|
19
20
|
const apiKey = process.env.ASHR_LABS_API_KEY;
|
|
20
21
|
if (!apiKey) {
|
|
21
22
|
throw new Error("ASHR_LABS_API_KEY environment variable is not set. " +
|
|
22
|
-
"Create an API key at https://
|
|
23
|
+
"Create an API key at https://lab.ashr.io → API Keys.");
|
|
23
24
|
}
|
|
24
25
|
const baseUrl = process.env.ASHR_LABS_BASE_URL ?? DEFAULT_BASE_URL;
|
|
25
26
|
return new AshrLabsClient(apiKey, baseUrl, timeout);
|
|
@@ -32,6 +33,8 @@ export class AshrLabsClient {
|
|
|
32
33
|
const user = this._session.user;
|
|
33
34
|
this._tenantId = tenant.id;
|
|
34
35
|
this._userId = user.id;
|
|
36
|
+
this._notes =
|
|
37
|
+
this._session.notes ?? [];
|
|
35
38
|
}
|
|
36
39
|
async _resolveTenantId(tenantId) {
|
|
37
40
|
if (tenantId != null)
|
|
@@ -361,6 +364,31 @@ export class AshrLabsClient {
|
|
|
361
364
|
return this._makeRequest("revoke_api_key", { api_key_id: apiKeyId });
|
|
362
365
|
}
|
|
363
366
|
// =========================================================================
|
|
367
|
+
// SDK Notes
|
|
368
|
+
// =========================================================================
|
|
369
|
+
/**
|
|
370
|
+
* Get cached SDK notes from the last init() or getNotes() call.
|
|
371
|
+
* Notes are platform advisories that may affect how you configure or run your agent.
|
|
372
|
+
*/
|
|
373
|
+
get notes() {
|
|
374
|
+
return this._notes;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Fetch fresh SDK notes from the platform.
|
|
378
|
+
*
|
|
379
|
+
* @param agentId - Optional agent ID to also include agent-targeted notes.
|
|
380
|
+
* @returns List of active notes for your tenant.
|
|
381
|
+
*/
|
|
382
|
+
async getNotes(agentId) {
|
|
383
|
+
const params = {};
|
|
384
|
+
if (agentId != null)
|
|
385
|
+
params.agent_id = agentId;
|
|
386
|
+
const response = await this._makeRequest("get_sdk_notes", params);
|
|
387
|
+
this._notes =
|
|
388
|
+
response.notes ?? [];
|
|
389
|
+
return this._notes;
|
|
390
|
+
}
|
|
391
|
+
// =========================================================================
|
|
364
392
|
// Session Operations
|
|
365
393
|
// =========================================================================
|
|
366
394
|
async init() {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { AshrLabsClient } from "./client.js";
|
|
2
2
|
export { AshrLabsError, AuthenticationError, AuthorizationError, NotFoundError, ValidationError, RateLimitError, ServerError, } from "./exceptions.js";
|
|
3
|
-
export type { User, Tenant, Session, Dataset, Run, Request, APIKey, ToolCall, ExpectedResponse, Action, Scenario, ObservabilityObservation, ObservabilityTrace, VmLogEntry, VmStream, KernelViewport, KernelActionData, KernelEventData, KernelVmMetadata, KernelVmStream, } from "./models.js";
|
|
3
|
+
export type { User, Tenant, Session, SdkNote, Dataset, Run, Request, APIKey, ToolCall, ExpectedResponse, Action, Scenario, ObservabilityObservation, ObservabilityTrace, VmLogEntry, VmStream, KernelViewport, KernelActionData, KernelEventData, KernelVmMetadata, KernelVmStream, } from "./models.js";
|
|
4
4
|
export { KERNEL_ACTION_TYPES, KERNEL_EVENT_TYPES, } from "./models.js";
|
|
5
5
|
export type { KernelActionType, KernelEventType, } from "./models.js";
|
|
6
6
|
export { Trace, Span, Generation } from "./tracing.js";
|
package/dist/models.d.ts
CHANGED
|
@@ -12,6 +12,21 @@ export interface Tenant {
|
|
|
12
12
|
tenant_name?: string;
|
|
13
13
|
is_active?: boolean;
|
|
14
14
|
}
|
|
15
|
+
export interface SdkNote {
|
|
16
|
+
id?: number;
|
|
17
|
+
created_at?: string;
|
|
18
|
+
updated_at?: string;
|
|
19
|
+
title?: string;
|
|
20
|
+
content?: string;
|
|
21
|
+
category?: string;
|
|
22
|
+
severity?: string;
|
|
23
|
+
tenant_id?: number | null;
|
|
24
|
+
agent_id?: number | null;
|
|
25
|
+
active_from?: string;
|
|
26
|
+
expires_at?: string | null;
|
|
27
|
+
is_archived?: boolean;
|
|
28
|
+
note_metadata?: Record<string, unknown>;
|
|
29
|
+
}
|
|
15
30
|
export interface Session {
|
|
16
31
|
status: string;
|
|
17
32
|
user: User;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ashr-labs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "TypeScript SDK for the Ashr Labs API — agent testing & evaluation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"devDependencies": {
|
|
33
|
+
"@onkernel/sdk": "^0.44.0",
|
|
33
34
|
"@types/node": "^25.3.5",
|
|
35
|
+
"playwright": "^1.58.2",
|
|
34
36
|
"typescript": "^5.4.0",
|
|
35
37
|
"vitest": "^3.0.0"
|
|
36
38
|
},
|