@atlanai/sdk 0.2.3 → 0.2.4
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/client.d.ts +16 -2
- package/dist/client.js +118 -9
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +23 -1
- package/dist/evals.d.ts +130 -7
- package/dist/evals.js +724 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -1
- package/dist/resources.d.ts +10 -0
- package/dist/resources.js +54 -4
- package/dist/tracing/version.d.ts +1 -1
- package/dist/tracing/version.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export type { ResourceMap, ResourceRoots } from "./resource-types";
|
|
|
6
6
|
export { AtlanAPIError } from "./errors";
|
|
7
7
|
export { operationManifest, operations } from "./operations";
|
|
8
8
|
export type { Operation, OperationManifest, ServiceContract } from "./operations";
|
|
9
|
-
export { CONTEXT_MANIFEST_SCHEMA, Eval, EvalRun, createContextManifest, resolveDataset, startExperiment, } from "./evals";
|
|
10
|
-
export type { ContextItem, ContextManifest, ContextManifestItem, EvalCase, EvalCaseResult, EvalData, EvalHooks, EvalOptions, EvalResultWithSummary, EvalScorer, EvalScorerArgs, EvalScorerReturn, EvalSummary, EvalTraceLogger, EvalTraceSpan, Evaluator, ScoreValue, StartExperimentOptions, } from "./evals";
|
|
9
|
+
export { CONTEXT_MANIFEST_SCHEMA, Eval, EvalRun, createContextManifest, experimentTraces, pushDataset, pushRecords, recordExperimentSession, recordName, resolveDataset, startExperiment, verifyExperiment, } from "./evals";
|
|
10
|
+
export type { ContextItem, ContextManifest, ContextManifestItem, DatasetPush, EvalCase, EvalCaseResult, EvalData, EvalHooks, EvalOptions, EvalResultWithSummary, EvalScorer, EvalScorerArgs, EvalScorerReturn, EvalSummary, EvalTraceLogger, EvalTraceSpan, Evaluator, ExperimentTracesOptions, ExperimentVerification, RecordExperimentSessionOptions, RecordPush, ScoreValue, StartExperimentOptions, VerificationCheck, VerifyExperimentOptions, } from "./evals";
|
|
11
11
|
export * as rawAgent from "./raw/agent/index";
|
|
12
12
|
export * as rawAPI from "./raw/api/index";
|
|
13
13
|
export * as rawEval from "./raw/eval/index";
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.rawSkill = exports.rawSecret = exports.rawRegistry = exports.rawOTel = exports.rawModel = exports.rawMCP = exports.rawFile = exports.rawEval = exports.rawAPI = exports.rawAgent = exports.startExperiment = exports.resolveDataset = exports.createContextManifest = exports.EvalRun = exports.Eval = exports.CONTEXT_MANIFEST_SCHEMA = exports.operations = exports.operationManifest = exports.AtlanAPIError = exports.resourceMap = exports.buildResources = exports.createService = exports.ServiceNamespace = exports.AtlanClient = void 0;
|
|
36
|
+
exports.rawSkill = exports.rawSecret = exports.rawRegistry = exports.rawOTel = exports.rawModel = exports.rawMCP = exports.rawFile = exports.rawEval = exports.rawAPI = exports.rawAgent = exports.verifyExperiment = exports.startExperiment = exports.resolveDataset = exports.recordName = exports.recordExperimentSession = exports.pushRecords = exports.pushDataset = exports.experimentTraces = exports.createContextManifest = exports.EvalRun = exports.Eval = exports.CONTEXT_MANIFEST_SCHEMA = exports.operations = exports.operationManifest = exports.AtlanAPIError = exports.resourceMap = exports.buildResources = exports.createService = exports.ServiceNamespace = exports.AtlanClient = void 0;
|
|
37
37
|
var client_1 = require("./client");
|
|
38
38
|
Object.defineProperty(exports, "AtlanClient", { enumerable: true, get: function () { return client_1.AtlanClient; } });
|
|
39
39
|
Object.defineProperty(exports, "ServiceNamespace", { enumerable: true, get: function () { return client_1.ServiceNamespace; } });
|
|
@@ -51,8 +51,14 @@ Object.defineProperty(exports, "CONTEXT_MANIFEST_SCHEMA", { enumerable: true, ge
|
|
|
51
51
|
Object.defineProperty(exports, "Eval", { enumerable: true, get: function () { return evals_1.Eval; } });
|
|
52
52
|
Object.defineProperty(exports, "EvalRun", { enumerable: true, get: function () { return evals_1.EvalRun; } });
|
|
53
53
|
Object.defineProperty(exports, "createContextManifest", { enumerable: true, get: function () { return evals_1.createContextManifest; } });
|
|
54
|
+
Object.defineProperty(exports, "experimentTraces", { enumerable: true, get: function () { return evals_1.experimentTraces; } });
|
|
55
|
+
Object.defineProperty(exports, "pushDataset", { enumerable: true, get: function () { return evals_1.pushDataset; } });
|
|
56
|
+
Object.defineProperty(exports, "pushRecords", { enumerable: true, get: function () { return evals_1.pushRecords; } });
|
|
57
|
+
Object.defineProperty(exports, "recordExperimentSession", { enumerable: true, get: function () { return evals_1.recordExperimentSession; } });
|
|
58
|
+
Object.defineProperty(exports, "recordName", { enumerable: true, get: function () { return evals_1.recordName; } });
|
|
54
59
|
Object.defineProperty(exports, "resolveDataset", { enumerable: true, get: function () { return evals_1.resolveDataset; } });
|
|
55
60
|
Object.defineProperty(exports, "startExperiment", { enumerable: true, get: function () { return evals_1.startExperiment; } });
|
|
61
|
+
Object.defineProperty(exports, "verifyExperiment", { enumerable: true, get: function () { return evals_1.verifyExperiment; } });
|
|
56
62
|
exports.rawAgent = __importStar(require("./raw/agent/index"));
|
|
57
63
|
exports.rawAPI = __importStar(require("./raw/api/index"));
|
|
58
64
|
exports.rawEval = __importStar(require("./raw/eval/index"));
|
package/dist/resources.d.ts
CHANGED
|
@@ -60,6 +60,16 @@ export interface Resource {
|
|
|
60
60
|
readonly operations: Readonly<Record<string, string>>;
|
|
61
61
|
readonly [member: string]: ResourceOperation | Resource | string | Readonly<Record<string, string>>;
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Refuse to return a bulk write that achieved nothing as a success.
|
|
65
|
+
*
|
|
66
|
+
* A bulk endpoint answers 207: each slot carries its own status, and partial
|
|
67
|
+
* success is the point, so one failed slot is the caller's business and is
|
|
68
|
+
* left alone. A batch where no slot succeeded is different. It changed
|
|
69
|
+
* nothing, it is never what the caller wanted, and returning it as an ordinary
|
|
70
|
+
* value is how a whole dataset ends up silently empty.
|
|
71
|
+
*/
|
|
72
|
+
export declare function raiseIfNothingSucceeded(result: unknown): void;
|
|
63
73
|
/**
|
|
64
74
|
* Build the top-level resources, nesting children under their parents.
|
|
65
75
|
*
|
package/dist/resources.js
CHANGED
|
@@ -17,8 +17,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.resourceMap = void 0;
|
|
20
|
+
exports.raiseIfNothingSucceeded = raiseIfNothingSucceeded;
|
|
20
21
|
exports.buildResources = buildResources;
|
|
21
22
|
const resources_json_1 = __importDefault(require("./resources.json"));
|
|
23
|
+
const errors_1 = require("./errors");
|
|
22
24
|
const SCHEMA_VERSION = 1;
|
|
23
25
|
exports.resourceMap = resources_json_1.default;
|
|
24
26
|
if (exports.resourceMap.schema_version !== SCHEMA_VERSION) {
|
|
@@ -49,6 +51,53 @@ function isPlainObject(value) {
|
|
|
49
51
|
* guessed: a lone object argument carrying any of the expected property names
|
|
50
52
|
* is passed straight through.
|
|
51
53
|
*/
|
|
54
|
+
/** The per-item status on a multi-status slot, if this is one. */
|
|
55
|
+
function slotStatus(item) {
|
|
56
|
+
if (!isPlainObject(item))
|
|
57
|
+
return undefined;
|
|
58
|
+
const status = item.statusCode ?? item.status_code;
|
|
59
|
+
return typeof status === "number" ? status : undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Refuse to return a bulk write that achieved nothing as a success.
|
|
63
|
+
*
|
|
64
|
+
* A bulk endpoint answers 207: each slot carries its own status, and partial
|
|
65
|
+
* success is the point, so one failed slot is the caller's business and is
|
|
66
|
+
* left alone. A batch where no slot succeeded is different. It changed
|
|
67
|
+
* nothing, it is never what the caller wanted, and returning it as an ordinary
|
|
68
|
+
* value is how a whole dataset ends up silently empty.
|
|
69
|
+
*/
|
|
70
|
+
function raiseIfNothingSucceeded(result) {
|
|
71
|
+
const items = isPlainObject(result) ? result.items : undefined;
|
|
72
|
+
if (!Array.isArray(items) || items.length === 0)
|
|
73
|
+
return;
|
|
74
|
+
const statuses = items.map(slotStatus);
|
|
75
|
+
// Only a multi-status envelope: every slot has to carry its own status.
|
|
76
|
+
if (statuses.some((status) => status === undefined))
|
|
77
|
+
return;
|
|
78
|
+
if (statuses.some((status) => status !== undefined && status >= 200 && status < 300))
|
|
79
|
+
return;
|
|
80
|
+
const codes = [...new Set(statuses.map(String))].sort();
|
|
81
|
+
const explanation = `none of the ${items.length} items in this batch was accepted ` +
|
|
82
|
+
`(per-item status: ${codes.join(", ")}); read items[].error for why`;
|
|
83
|
+
throw new errors_1.AtlanAPIError({
|
|
84
|
+
status: statuses[0] ?? 207,
|
|
85
|
+
code: "bulk_all_rejected",
|
|
86
|
+
title: "Every item in the batch was rejected",
|
|
87
|
+
detail: explanation,
|
|
88
|
+
// As a hint, not a detail: this text is client-authored, so the rule
|
|
89
|
+
// keeping server prose out of the message does not apply.
|
|
90
|
+
hint: explanation,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** Wrap an operation so a batch that achieved nothing cannot return quietly. */
|
|
94
|
+
function guarded(operation) {
|
|
95
|
+
return (async (...args) => {
|
|
96
|
+
const result = await operation(...args);
|
|
97
|
+
raiseIfNothingSucceeded(result);
|
|
98
|
+
return result;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
52
101
|
function positionalCall(forwarded, detail, workspace) {
|
|
53
102
|
const bodyKey = detail.typescript_body;
|
|
54
103
|
const pathKeys = [...detail.route.matchAll(/\{(\w+)\}/g)].map((match) => camelCase(match[1]));
|
|
@@ -56,11 +105,12 @@ function positionalCall(forwarded, detail, workspace) {
|
|
|
56
105
|
// alone let `get(agentId)` pass a bare string where the generated client
|
|
57
106
|
// wanted an object: no error, and the wrong resource fetched.
|
|
58
107
|
const workspaceKey = detail.workspace_parameter?.typescript;
|
|
59
|
-
if (bodyKey === undefined && pathKeys.length === 0 && workspaceKey === undefined)
|
|
60
|
-
return forwarded;
|
|
108
|
+
if (bodyKey === undefined && pathKeys.length === 0 && workspaceKey === undefined) {
|
|
109
|
+
return guarded(forwarded);
|
|
110
|
+
}
|
|
61
111
|
const arity = pathKeys.length + (bodyKey === undefined ? 0 : 1);
|
|
62
112
|
const expected = new Set(bodyKey === undefined ? pathKeys : [...pathKeys, bodyKey]);
|
|
63
|
-
return ((...args) => {
|
|
113
|
+
return guarded(((...args) => {
|
|
64
114
|
const values = args;
|
|
65
115
|
if (values.length === 1 && isPlainObject(values[0])) {
|
|
66
116
|
const keys = Object.keys(values[0]);
|
|
@@ -81,7 +131,7 @@ function positionalCall(forwarded, detail, workspace) {
|
|
|
81
131
|
if (workspaceKey !== undefined && workspace !== undefined)
|
|
82
132
|
options[workspaceKey] = workspace;
|
|
83
133
|
return forwarded(options);
|
|
84
|
-
});
|
|
134
|
+
}));
|
|
85
135
|
}
|
|
86
136
|
function buildResource(path, entry, service, children, workspace) {
|
|
87
137
|
const operations = {};
|
package/dist/tracing/version.js
CHANGED
|
@@ -4,4 +4,4 @@ exports.SDK_VERSION = exports.SDK_LANGUAGE = void 0;
|
|
|
4
4
|
/** SDK identity (SPEC §2.2, §5.1). Kept in sync with package.json — the
|
|
5
5
|
* version test fails the build on drift. */
|
|
6
6
|
exports.SDK_LANGUAGE = "typescript";
|
|
7
|
-
exports.SDK_VERSION = "0.2.
|
|
7
|
+
exports.SDK_VERSION = "0.2.4";
|