@gleanwork/api-client 0.13.12 → 0.13.14
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/commonjs/hooks/registration.d.ts +1 -1
- package/dist/commonjs/hooks/registration.d.ts.map +1 -1
- package/dist/commonjs/hooks/registration.js +32 -1
- package/dist/commonjs/hooks/registration.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/agentsusagebydepartmentinsight.d.ts +9 -0
- package/dist/commonjs/models/components/agentsusagebydepartmentinsight.d.ts.map +1 -1
- package/dist/commonjs/models/components/agentsusagebydepartmentinsight.js +3 -0
- package/dist/commonjs/models/components/agentsusagebydepartmentinsight.js.map +1 -1
- package/dist/commonjs/models/components/sensitiveinfotype.d.ts +3 -0
- package/dist/commonjs/models/components/sensitiveinfotype.d.ts.map +1 -1
- package/dist/commonjs/models/components/sensitiveinfotype.js +3 -0
- package/dist/commonjs/models/components/sensitiveinfotype.js.map +1 -1
- package/dist/esm/hooks/registration.d.ts +1 -1
- package/dist/esm/hooks/registration.d.ts.map +1 -1
- package/dist/esm/hooks/registration.js +32 -1
- package/dist/esm/hooks/registration.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/agentsusagebydepartmentinsight.d.ts +9 -0
- package/dist/esm/models/components/agentsusagebydepartmentinsight.d.ts.map +1 -1
- package/dist/esm/models/components/agentsusagebydepartmentinsight.js +3 -0
- package/dist/esm/models/components/agentsusagebydepartmentinsight.js.map +1 -1
- package/dist/esm/models/components/sensitiveinfotype.d.ts +3 -0
- package/dist/esm/models/components/sensitiveinfotype.d.ts.map +1 -1
- package/dist/esm/models/components/sensitiveinfotype.js +3 -0
- package/dist/esm/models/components/sensitiveinfotype.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/examples/src/agentWithFileUpload.example.ts +32 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/hooks/registration.ts +38 -2
- package/src/lib/config.ts +2 -2
- package/src/models/components/agentsusagebydepartmentinsight.ts +11 -0
- package/src/models/components/sensitiveinfotype.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../src/hooks/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../src/hooks/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,YAAY,CAAC;AA4CnD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,QAKrC"}
|
|
@@ -6,10 +6,41 @@ exports.initHooks = initHooks;
|
|
|
6
6
|
* Any hooks you wish to add should be registered in the initHooks function. Feel free to define them
|
|
7
7
|
* in this file or in separate files in the hooks folder.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
const agentFileUploadErrorHook = {
|
|
10
|
+
afterError: async (hookCtx, response, error) => {
|
|
11
|
+
if ((hookCtx.operationID === 'createAndWaitRun' ||
|
|
12
|
+
hookCtx.operationID === 'createAndStreamRun') &&
|
|
13
|
+
response?.status === 400) {
|
|
14
|
+
const errorMessage = String(error);
|
|
15
|
+
// The API returns "Not enough user permissions" when it fails to parse the file ID string
|
|
16
|
+
if (errorMessage.includes('permission')) {
|
|
17
|
+
return {
|
|
18
|
+
response,
|
|
19
|
+
error: new Error(`Agent file upload error: When using agents with file inputs, you must follow a two-step process:\n` +
|
|
20
|
+
`\n1. First, upload files using client.chat.uploadFiles():\n` +
|
|
21
|
+
` const uploadResult = await glean.client.chat.uploadFiles({\n` +
|
|
22
|
+
` files: [fileBlob]\n` +
|
|
23
|
+
` });\n` +
|
|
24
|
+
`\n2. Then, pass the returned file IDs (not Blob/File objects) in the input field:\n` +
|
|
25
|
+
` const result = await glean.client.agents.run({\n` +
|
|
26
|
+
` agentId: '<agent-id>',\n` +
|
|
27
|
+
` input: {\n` +
|
|
28
|
+
` myFile: uploadResult.files[0].id // Use the file ID\n` +
|
|
29
|
+
` }\n` +
|
|
30
|
+
` });\n` +
|
|
31
|
+
`\nFor a complete example, see: examples/src/agentWithFileUpload.example.ts\n` +
|
|
32
|
+
`Documentation: https://developers.glean.com/api/client-api/agents/overview\n` +
|
|
33
|
+
`\nOriginal error: ${errorMessage}`),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return { response, error };
|
|
38
|
+
},
|
|
39
|
+
};
|
|
10
40
|
function initHooks(hooks) {
|
|
11
41
|
// Add hooks by calling hooks.register{ClientInit/BeforeCreateRequest/BeforeRequest/AfterSuccess/AfterError}Hook
|
|
12
42
|
// with an instance of a hook that implements that specific Hook interface
|
|
13
43
|
// Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
|
|
44
|
+
hooks.registerAfterErrorHook(agentFileUploadErrorHook);
|
|
14
45
|
}
|
|
15
46
|
//# sourceMappingURL=registration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/hooks/registration.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/hooks/registration.ts"],"names":[],"mappings":";;AA4CA,8BAKC;AA/CD;;;;GAIG;AAEH,MAAM,wBAAwB,GAAmB;IAC/C,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;QAC7C,IACE,CAAC,OAAO,CAAC,WAAW,KAAK,kBAAkB;YACzC,OAAO,CAAC,WAAW,KAAK,oBAAoB,CAAC;YAC/C,QAAQ,EAAE,MAAM,KAAK,GAAG,EACxB,CAAC;YACD,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,0FAA0F;YAC1F,IAAI,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;gBACxC,OAAO;oBACL,QAAQ;oBACR,KAAK,EAAE,IAAI,KAAK,CACd,oGAAoG;wBAClG,6DAA6D;wBAC7D,iEAAiE;wBACjE,0BAA0B;wBAC1B,UAAU;wBACV,qFAAqF;wBACrF,qDAAqD;wBACrD,+BAA+B;wBAC/B,iBAAiB;wBACjB,+DAA+D;wBAC/D,UAAU;wBACV,UAAU;wBACV,8EAA8E;wBAC9E,8EAA8E;wBAC9E,qBAAqB,YAAY,EAAE,CACtC;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;CACF,CAAC;AAEF,SAAgB,SAAS,CAAC,KAAY;IACpC,gHAAgH;IAChH,0EAA0E;IAC1E,4FAA4F;IAC5F,KAAK,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -35,8 +35,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
35
35
|
export declare const SDK_METADATA: {
|
|
36
36
|
readonly language: "typescript";
|
|
37
37
|
readonly openapiDocVersion: "0.9.0";
|
|
38
|
-
readonly sdkVersion: "0.13.
|
|
38
|
+
readonly sdkVersion: "0.13.14";
|
|
39
39
|
readonly genVersion: "2.760.2";
|
|
40
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.13.
|
|
40
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.14 2.760.2 0.9.0 @gleanwork/api-client";
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -34,8 +34,8 @@ function serverURLFromOptions(options) {
|
|
|
34
34
|
exports.SDK_METADATA = {
|
|
35
35
|
language: "typescript",
|
|
36
36
|
openapiDocVersion: "0.9.0",
|
|
37
|
-
sdkVersion: "0.13.
|
|
37
|
+
sdkVersion: "0.13.14",
|
|
38
38
|
genVersion: "2.760.2",
|
|
39
|
-
userAgent: "speakeasy-sdk/typescript 0.13.
|
|
39
|
+
userAgent: "speakeasy-sdk/typescript 0.13.14 2.760.2 0.9.0 @gleanwork/api-client",
|
|
40
40
|
};
|
|
41
41
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v3";
|
|
2
2
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
+
import { IconConfig } from "./iconconfig.js";
|
|
4
5
|
export type AgentsUsageByDepartmentInsight = {
|
|
5
6
|
/**
|
|
6
7
|
* Name of the department
|
|
@@ -26,6 +27,14 @@ export type AgentsUsageByDepartmentInsight = {
|
|
|
26
27
|
* Name of the agent to be shown in the agent column in this department over the specified time period.
|
|
27
28
|
*/
|
|
28
29
|
agentName?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Defines how to render an icon
|
|
32
|
+
*/
|
|
33
|
+
icon?: IconConfig | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates whether the agent has been deleted
|
|
36
|
+
*/
|
|
37
|
+
isDeleted?: boolean | undefined;
|
|
29
38
|
};
|
|
30
39
|
/** @internal */
|
|
31
40
|
export declare const AgentsUsageByDepartmentInsight$inboundSchema: z.ZodType<AgentsUsageByDepartmentInsight, z.ZodTypeDef, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsusagebydepartmentinsight.d.ts","sourceRoot":"","sources":["../../../../src/models/components/agentsusagebydepartmentinsight.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"agentsusagebydepartmentinsight.d.ts","sourceRoot":"","sources":["../../../../src/models/components/agentsusagebydepartmentinsight.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,UAAU,EAA4B,MAAM,iBAAiB,CAAC;AAEvE,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,4CAA4C,EAAE,CAAC,CAAC,OAAO,CAClE,8BAA8B,EAC9B,CAAC,CAAC,UAAU,EACZ,OAAO,CAUP,CAAC;AAEH,wBAAgB,sCAAsC,CACpD,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAMrE"}
|
|
@@ -40,6 +40,7 @@ exports.AgentsUsageByDepartmentInsight$inboundSchema = void 0;
|
|
|
40
40
|
exports.agentsUsageByDepartmentInsightFromJSON = agentsUsageByDepartmentInsightFromJSON;
|
|
41
41
|
const z = __importStar(require("zod/v3"));
|
|
42
42
|
const schemas_js_1 = require("../../lib/schemas.js");
|
|
43
|
+
const iconconfig_js_1 = require("./iconconfig.js");
|
|
43
44
|
/** @internal */
|
|
44
45
|
exports.AgentsUsageByDepartmentInsight$inboundSchema = z.object({
|
|
45
46
|
department: z.string().optional(),
|
|
@@ -48,6 +49,8 @@ exports.AgentsUsageByDepartmentInsight$inboundSchema = z.object({
|
|
|
48
49
|
runCount: z.number().int().optional(),
|
|
49
50
|
agentId: z.string().optional(),
|
|
50
51
|
agentName: z.string().optional(),
|
|
52
|
+
icon: iconconfig_js_1.IconConfig$inboundSchema.optional(),
|
|
53
|
+
isDeleted: z.boolean().optional(),
|
|
51
54
|
});
|
|
52
55
|
function agentsUsageByDepartmentInsightFromJSON(jsonString) {
|
|
53
56
|
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentsUsageByDepartmentInsight$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentsUsageByDepartmentInsight' from JSON`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsusagebydepartmentinsight.js","sourceRoot":"","sources":["../../../../src/models/components/agentsusagebydepartmentinsight.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"agentsusagebydepartmentinsight.js","sourceRoot":"","sources":["../../../../src/models/components/agentsusagebydepartmentinsight.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DH,wFAQC;AAjED,0CAA4B;AAC5B,qDAAiD;AAGjD,mDAAuE;AAqCvE,gBAAgB;AACH,QAAA,4CAA4C,GAIrD,CAAC,CAAC,MAAM,CAAC;IACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,IAAI,EAAE,wCAAwB,CAAC,QAAQ,EAAE;IACzC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEH,SAAgB,sCAAsC,CACpD,UAAkB;IAElB,OAAO,IAAA,sBAAS,EACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,oDAA4C,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACxE,4DAA4D,CAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -8,6 +8,9 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
8
8
|
export declare const LikelihoodThreshold: {
|
|
9
9
|
readonly Likely: "LIKELY";
|
|
10
10
|
readonly VeryLikely: "VERY_LIKELY";
|
|
11
|
+
readonly Possible: "POSSIBLE";
|
|
12
|
+
readonly Unlikely: "UNLIKELY";
|
|
13
|
+
readonly VeryUnlikely: "VERY_UNLIKELY";
|
|
11
14
|
};
|
|
12
15
|
/**
|
|
13
16
|
* @deprecated enum: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitiveinfotype.d.ts","sourceRoot":"","sources":["../../../../src/models/components/sensitiveinfotype.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"sensitiveinfotype.d.ts","sourceRoot":"","sources":["../../../../src/models/components/sensitiveinfotype.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEzE,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACtD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,iCAAiC,EAAE,CAAC,CAAC,aAAa,CAC7D,OAAO,mBAAmB,CACS,CAAC;AACtC,gBAAgB;AAChB,eAAO,MAAM,kCAAkC,EAAE,CAAC,CAAC,aAAa,CAC9D,OAAO,mBAAmB,CACS,CAAC;AAEtC,gBAAgB;AAChB,eAAO,MAAM,+BAA+B,EAAE,CAAC,CAAC,OAAO,CACrD,iBAAiB,EACjB,CAAC,CAAC,UAAU,EACZ,OAAO,CAIP,CAAC;AACH,gBAAgB;AAChB,MAAM,MAAM,0BAA0B,GAAG;IACvC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,gCAAgC,EAAE,CAAC,CAAC,OAAO,CACtD,0BAA0B,EAC1B,CAAC,CAAC,UAAU,EACZ,iBAAiB,CAIjB,CAAC;AAEH,wBAAgB,uBAAuB,CACrC,iBAAiB,EAAE,iBAAiB,GACnC,MAAM,CAIR;AACD,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAMxD"}
|
|
@@ -47,6 +47,9 @@ const schemas_js_1 = require("../../lib/schemas.js");
|
|
|
47
47
|
exports.LikelihoodThreshold = {
|
|
48
48
|
Likely: "LIKELY",
|
|
49
49
|
VeryLikely: "VERY_LIKELY",
|
|
50
|
+
Possible: "POSSIBLE",
|
|
51
|
+
Unlikely: "UNLIKELY",
|
|
52
|
+
VeryUnlikely: "VERY_UNLIKELY",
|
|
50
53
|
};
|
|
51
54
|
/** @internal */
|
|
52
55
|
exports.LikelihoodThreshold$inboundSchema = z.nativeEnum(exports.LikelihoodThreshold);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitiveinfotype.js","sourceRoot":"","sources":["../../../../src/models/components/sensitiveinfotype.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"sensitiveinfotype.js","sourceRoot":"","sources":["../../../../src/models/components/sensitiveinfotype.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEH,0DAMC;AACD,8DAQC;AAjFD,0CAA4B;AAC5B,qDAAiD;AAKjD;;GAEG;AACU,QAAA,mBAAmB,GAAG;IACjC,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,aAAa;IACzB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,eAAe;CACrB,CAAC;AAiBX,gBAAgB;AACH,QAAA,iCAAiC,GAE1C,CAAC,CAAC,UAAU,CAAC,2BAAmB,CAAC,CAAC;AACtC,gBAAgB;AACH,QAAA,kCAAkC,GAE3C,yCAAiC,CAAC;AAEtC,gBAAgB;AACH,QAAA,+BAA+B,GAIxC,CAAC,CAAC,MAAM,CAAC;IACX,mBAAmB,EAAE,yCAAiC,CAAC,QAAQ,EAAE;IACjE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAOH,gBAAgB;AACH,QAAA,gCAAgC,GAIzC,CAAC,CAAC,MAAM,CAAC;IACX,mBAAmB,EAAE,0CAAkC,CAAC,QAAQ,EAAE;IAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAEH,SAAgB,uBAAuB,CACrC,iBAAoC;IAEpC,OAAO,IAAI,CAAC,SAAS,CACnB,wCAAgC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAC1D,CAAC;AACJ,CAAC;AACD,SAAgB,yBAAyB,CACvC,UAAkB;IAElB,OAAO,IAAA,sBAAS,EACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,uCAA+B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC3D,+CAA+C,CAChD,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../src/hooks/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../src/hooks/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,YAAY,CAAC;AA4CnD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,QAKrC"}
|
|
@@ -3,10 +3,41 @@
|
|
|
3
3
|
* Any hooks you wish to add should be registered in the initHooks function. Feel free to define them
|
|
4
4
|
* in this file or in separate files in the hooks folder.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
const agentFileUploadErrorHook = {
|
|
7
|
+
afterError: async (hookCtx, response, error) => {
|
|
8
|
+
if ((hookCtx.operationID === 'createAndWaitRun' ||
|
|
9
|
+
hookCtx.operationID === 'createAndStreamRun') &&
|
|
10
|
+
response?.status === 400) {
|
|
11
|
+
const errorMessage = String(error);
|
|
12
|
+
// The API returns "Not enough user permissions" when it fails to parse the file ID string
|
|
13
|
+
if (errorMessage.includes('permission')) {
|
|
14
|
+
return {
|
|
15
|
+
response,
|
|
16
|
+
error: new Error(`Agent file upload error: When using agents with file inputs, you must follow a two-step process:\n` +
|
|
17
|
+
`\n1. First, upload files using client.chat.uploadFiles():\n` +
|
|
18
|
+
` const uploadResult = await glean.client.chat.uploadFiles({\n` +
|
|
19
|
+
` files: [fileBlob]\n` +
|
|
20
|
+
` });\n` +
|
|
21
|
+
`\n2. Then, pass the returned file IDs (not Blob/File objects) in the input field:\n` +
|
|
22
|
+
` const result = await glean.client.agents.run({\n` +
|
|
23
|
+
` agentId: '<agent-id>',\n` +
|
|
24
|
+
` input: {\n` +
|
|
25
|
+
` myFile: uploadResult.files[0].id // Use the file ID\n` +
|
|
26
|
+
` }\n` +
|
|
27
|
+
` });\n` +
|
|
28
|
+
`\nFor a complete example, see: examples/src/agentWithFileUpload.example.ts\n` +
|
|
29
|
+
`Documentation: https://developers.glean.com/api/client-api/agents/overview\n` +
|
|
30
|
+
`\nOriginal error: ${errorMessage}`),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { response, error };
|
|
35
|
+
},
|
|
36
|
+
};
|
|
7
37
|
export function initHooks(hooks) {
|
|
8
38
|
// Add hooks by calling hooks.register{ClientInit/BeforeCreateRequest/BeforeRequest/AfterSuccess/AfterError}Hook
|
|
9
39
|
// with an instance of a hook that implements that specific Hook interface
|
|
10
40
|
// Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
|
|
41
|
+
hooks.registerAfterErrorHook(agentFileUploadErrorHook);
|
|
11
42
|
}
|
|
12
43
|
//# sourceMappingURL=registration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/hooks/registration.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/hooks/registration.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,wBAAwB,GAAmB;IAC/C,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;QAC7C,IACE,CAAC,OAAO,CAAC,WAAW,KAAK,kBAAkB;YACzC,OAAO,CAAC,WAAW,KAAK,oBAAoB,CAAC;YAC/C,QAAQ,EAAE,MAAM,KAAK,GAAG,EACxB,CAAC;YACD,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,0FAA0F;YAC1F,IAAI,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;gBACxC,OAAO;oBACL,QAAQ;oBACR,KAAK,EAAE,IAAI,KAAK,CACd,oGAAoG;wBAClG,6DAA6D;wBAC7D,iEAAiE;wBACjE,0BAA0B;wBAC1B,UAAU;wBACV,qFAAqF;wBACrF,qDAAqD;wBACrD,+BAA+B;wBAC/B,iBAAiB;wBACjB,+DAA+D;wBAC/D,UAAU;wBACV,UAAU;wBACV,8EAA8E;wBAC9E,8EAA8E;wBAC9E,qBAAqB,YAAY,EAAE,CACtC;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,SAAS,CAAC,KAAY;IACpC,gHAAgH;IAChH,0EAA0E;IAC1E,4FAA4F;IAC5F,KAAK,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/esm/lib/config.d.ts
CHANGED
|
@@ -35,8 +35,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
35
35
|
export declare const SDK_METADATA: {
|
|
36
36
|
readonly language: "typescript";
|
|
37
37
|
readonly openapiDocVersion: "0.9.0";
|
|
38
|
-
readonly sdkVersion: "0.13.
|
|
38
|
+
readonly sdkVersion: "0.13.14";
|
|
39
39
|
readonly genVersion: "2.760.2";
|
|
40
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.13.
|
|
40
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.13.14 2.760.2 0.9.0 @gleanwork/api-client";
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/esm/lib/config.js
CHANGED
|
@@ -30,8 +30,8 @@ export function serverURLFromOptions(options) {
|
|
|
30
30
|
export const SDK_METADATA = {
|
|
31
31
|
language: "typescript",
|
|
32
32
|
openapiDocVersion: "0.9.0",
|
|
33
|
-
sdkVersion: "0.13.
|
|
33
|
+
sdkVersion: "0.13.14",
|
|
34
34
|
genVersion: "2.760.2",
|
|
35
|
-
userAgent: "speakeasy-sdk/typescript 0.13.
|
|
35
|
+
userAgent: "speakeasy-sdk/typescript 0.13.14 2.760.2 0.9.0 @gleanwork/api-client",
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v3";
|
|
2
2
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
+
import { IconConfig } from "./iconconfig.js";
|
|
4
5
|
export type AgentsUsageByDepartmentInsight = {
|
|
5
6
|
/**
|
|
6
7
|
* Name of the department
|
|
@@ -26,6 +27,14 @@ export type AgentsUsageByDepartmentInsight = {
|
|
|
26
27
|
* Name of the agent to be shown in the agent column in this department over the specified time period.
|
|
27
28
|
*/
|
|
28
29
|
agentName?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Defines how to render an icon
|
|
32
|
+
*/
|
|
33
|
+
icon?: IconConfig | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates whether the agent has been deleted
|
|
36
|
+
*/
|
|
37
|
+
isDeleted?: boolean | undefined;
|
|
29
38
|
};
|
|
30
39
|
/** @internal */
|
|
31
40
|
export declare const AgentsUsageByDepartmentInsight$inboundSchema: z.ZodType<AgentsUsageByDepartmentInsight, z.ZodTypeDef, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsusagebydepartmentinsight.d.ts","sourceRoot":"","sources":["../../../../src/models/components/agentsusagebydepartmentinsight.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"agentsusagebydepartmentinsight.d.ts","sourceRoot":"","sources":["../../../../src/models/components/agentsusagebydepartmentinsight.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,UAAU,EAA4B,MAAM,iBAAiB,CAAC;AAEvE,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,4CAA4C,EAAE,CAAC,CAAC,OAAO,CAClE,8BAA8B,EAC9B,CAAC,CAAC,UAAU,EACZ,OAAO,CAUP,CAAC;AAEH,wBAAgB,sCAAsC,CACpD,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAMrE"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as z from "zod/v3";
|
|
5
5
|
import { safeParse } from "../../lib/schemas.js";
|
|
6
|
+
import { IconConfig$inboundSchema } from "./iconconfig.js";
|
|
6
7
|
/** @internal */
|
|
7
8
|
export const AgentsUsageByDepartmentInsight$inboundSchema = z.object({
|
|
8
9
|
department: z.string().optional(),
|
|
@@ -11,6 +12,8 @@ export const AgentsUsageByDepartmentInsight$inboundSchema = z.object({
|
|
|
11
12
|
runCount: z.number().int().optional(),
|
|
12
13
|
agentId: z.string().optional(),
|
|
13
14
|
agentName: z.string().optional(),
|
|
15
|
+
icon: IconConfig$inboundSchema.optional(),
|
|
16
|
+
isDeleted: z.boolean().optional(),
|
|
14
17
|
});
|
|
15
18
|
export function agentsUsageByDepartmentInsightFromJSON(jsonString) {
|
|
16
19
|
return safeParse(jsonString, (x) => AgentsUsageByDepartmentInsight$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentsUsageByDepartmentInsight' from JSON`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsusagebydepartmentinsight.js","sourceRoot":"","sources":["../../../../src/models/components/agentsusagebydepartmentinsight.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"agentsusagebydepartmentinsight.js","sourceRoot":"","sources":["../../../../src/models/components/agentsusagebydepartmentinsight.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAc,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAqCvE,gBAAgB;AAChB,MAAM,CAAC,MAAM,4CAA4C,GAIrD,CAAC,CAAC,MAAM,CAAC;IACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,IAAI,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IACzC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,sCAAsC,CACpD,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,4CAA4C,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACxE,4DAA4D,CAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -8,6 +8,9 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
8
8
|
export declare const LikelihoodThreshold: {
|
|
9
9
|
readonly Likely: "LIKELY";
|
|
10
10
|
readonly VeryLikely: "VERY_LIKELY";
|
|
11
|
+
readonly Possible: "POSSIBLE";
|
|
12
|
+
readonly Unlikely: "UNLIKELY";
|
|
13
|
+
readonly VeryUnlikely: "VERY_UNLIKELY";
|
|
11
14
|
};
|
|
12
15
|
/**
|
|
13
16
|
* @deprecated enum: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitiveinfotype.d.ts","sourceRoot":"","sources":["../../../../src/models/components/sensitiveinfotype.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"sensitiveinfotype.d.ts","sourceRoot":"","sources":["../../../../src/models/components/sensitiveinfotype.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEzE,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACtD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,iCAAiC,EAAE,CAAC,CAAC,aAAa,CAC7D,OAAO,mBAAmB,CACS,CAAC;AACtC,gBAAgB;AAChB,eAAO,MAAM,kCAAkC,EAAE,CAAC,CAAC,aAAa,CAC9D,OAAO,mBAAmB,CACS,CAAC;AAEtC,gBAAgB;AAChB,eAAO,MAAM,+BAA+B,EAAE,CAAC,CAAC,OAAO,CACrD,iBAAiB,EACjB,CAAC,CAAC,UAAU,EACZ,OAAO,CAIP,CAAC;AACH,gBAAgB;AAChB,MAAM,MAAM,0BAA0B,GAAG;IACvC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,gCAAgC,EAAE,CAAC,CAAC,OAAO,CACtD,0BAA0B,EAC1B,CAAC,CAAC,UAAU,EACZ,iBAAiB,CAIjB,CAAC;AAEH,wBAAgB,uBAAuB,CACrC,iBAAiB,EAAE,iBAAiB,GACnC,MAAM,CAIR;AACD,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAMxD"}
|
|
@@ -9,6 +9,9 @@ import { safeParse } from "../../lib/schemas.js";
|
|
|
9
9
|
export const LikelihoodThreshold = {
|
|
10
10
|
Likely: "LIKELY",
|
|
11
11
|
VeryLikely: "VERY_LIKELY",
|
|
12
|
+
Possible: "POSSIBLE",
|
|
13
|
+
Unlikely: "UNLIKELY",
|
|
14
|
+
VeryUnlikely: "VERY_UNLIKELY",
|
|
12
15
|
};
|
|
13
16
|
/** @internal */
|
|
14
17
|
export const LikelihoodThreshold$inboundSchema = z.nativeEnum(LikelihoodThreshold);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitiveinfotype.js","sourceRoot":"","sources":["../../../../src/models/components/sensitiveinfotype.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKjD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"sensitiveinfotype.js","sourceRoot":"","sources":["../../../../src/models/components/sensitiveinfotype.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKjD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,aAAa;IACzB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,eAAe;CACrB,CAAC;AAiBX,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAE1C,CAAC,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACtC,gBAAgB;AAChB,MAAM,CAAC,MAAM,kCAAkC,GAE3C,iCAAiC,CAAC;AAEtC,gBAAgB;AAChB,MAAM,CAAC,MAAM,+BAA+B,GAIxC,CAAC,CAAC,MAAM,CAAC;IACX,mBAAmB,EAAE,iCAAiC,CAAC,QAAQ,EAAE;IACjE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAOH,gBAAgB;AAChB,MAAM,CAAC,MAAM,gCAAgC,GAIzC,CAAC,CAAC,MAAM,CAAC;IACX,mBAAmB,EAAE,kCAAkC,CAAC,QAAQ,EAAE;IAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAEH,MAAM,UAAU,uBAAuB,CACrC,iBAAoC;IAEpC,OAAO,IAAI,CAAC,SAAS,CACnB,gCAAgC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAC1D,CAAC;AACJ,CAAC;AACD,MAAM,UAAU,yBAAyB,CACvC,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,+BAA+B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC3D,+CAA+C,CAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { config } from 'dotenv';
|
|
2
|
+
config();
|
|
3
|
+
import { Glean } from '@gleanwork/api-client';
|
|
4
|
+
|
|
5
|
+
const glean = new Glean({
|
|
6
|
+
domain: process.env['GLEAN_DOMAIN'] ?? '',
|
|
7
|
+
apiToken: process.env['GLEAN_BEARER_AUTH'] ?? '',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
async function run() {
|
|
11
|
+
// 1. Upload the file first
|
|
12
|
+
const fileBlob = new Blob(['name,role\nAlice,Engineer'], { type: 'text/csv' });
|
|
13
|
+
|
|
14
|
+
const uploadResponse = await glean.client.chat.uploadFiles({
|
|
15
|
+
files: [fileBlob as any],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const fileId = uploadResponse.files[0].id;
|
|
19
|
+
console.log(`File uploaded: ${fileId}`);
|
|
20
|
+
|
|
21
|
+
// 2. Pass the file ID (NOT the blob) to the agent
|
|
22
|
+
const result = await glean.client.agents.run({
|
|
23
|
+
agentId: process.env['GLEAN_AGENT_ID']!,
|
|
24
|
+
input: {
|
|
25
|
+
file_input: fileId, // ✅ Pass the ID string
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
console.log('Agent run result:', result);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
run();
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Hooks } from
|
|
1
|
+
import { Hooks, AfterErrorHook } from './types.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* This file is only ever generated once on the first generation and then is free to be modified.
|
|
@@ -6,9 +6,45 @@ import { Hooks } from "./types.js";
|
|
|
6
6
|
* in this file or in separate files in the hooks folder.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const agentFileUploadErrorHook: AfterErrorHook = {
|
|
10
|
+
afterError: async (hookCtx, response, error) => {
|
|
11
|
+
if (
|
|
12
|
+
(hookCtx.operationID === 'createAndWaitRun' ||
|
|
13
|
+
hookCtx.operationID === 'createAndStreamRun') &&
|
|
14
|
+
response?.status === 400
|
|
15
|
+
) {
|
|
16
|
+
const errorMessage = String(error);
|
|
17
|
+
// The API returns "Not enough user permissions" when it fails to parse the file ID string
|
|
18
|
+
if (errorMessage.includes('permission')) {
|
|
19
|
+
return {
|
|
20
|
+
response,
|
|
21
|
+
error: new Error(
|
|
22
|
+
`Agent file upload error: When using agents with file inputs, you must follow a two-step process:\n` +
|
|
23
|
+
`\n1. First, upload files using client.chat.uploadFiles():\n` +
|
|
24
|
+
` const uploadResult = await glean.client.chat.uploadFiles({\n` +
|
|
25
|
+
` files: [fileBlob]\n` +
|
|
26
|
+
` });\n` +
|
|
27
|
+
`\n2. Then, pass the returned file IDs (not Blob/File objects) in the input field:\n` +
|
|
28
|
+
` const result = await glean.client.agents.run({\n` +
|
|
29
|
+
` agentId: '<agent-id>',\n` +
|
|
30
|
+
` input: {\n` +
|
|
31
|
+
` myFile: uploadResult.files[0].id // Use the file ID\n` +
|
|
32
|
+
` }\n` +
|
|
33
|
+
` });\n` +
|
|
34
|
+
`\nFor a complete example, see: examples/src/agentWithFileUpload.example.ts\n` +
|
|
35
|
+
`Documentation: https://developers.glean.com/api/client-api/agents/overview\n` +
|
|
36
|
+
`\nOriginal error: ${errorMessage}`
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { response, error };
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
10
45
|
export function initHooks(hooks: Hooks) {
|
|
11
46
|
// Add hooks by calling hooks.register{ClientInit/BeforeCreateRequest/BeforeRequest/AfterSuccess/AfterError}Hook
|
|
12
47
|
// with an instance of a hook that implements that specific Hook interface
|
|
13
48
|
// Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
|
|
49
|
+
hooks.registerAfterErrorHook(agentFileUploadErrorHook);
|
|
14
50
|
}
|
package/src/lib/config.ts
CHANGED
|
@@ -68,8 +68,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
68
68
|
export const SDK_METADATA = {
|
|
69
69
|
language: "typescript",
|
|
70
70
|
openapiDocVersion: "0.9.0",
|
|
71
|
-
sdkVersion: "0.13.
|
|
71
|
+
sdkVersion: "0.13.14",
|
|
72
72
|
genVersion: "2.760.2",
|
|
73
73
|
userAgent:
|
|
74
|
-
"speakeasy-sdk/typescript 0.13.
|
|
74
|
+
"speakeasy-sdk/typescript 0.13.14 2.760.2 0.9.0 @gleanwork/api-client",
|
|
75
75
|
} as const;
|
|
@@ -6,6 +6,7 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
7
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import { IconConfig, IconConfig$inboundSchema } from "./iconconfig.js";
|
|
9
10
|
|
|
10
11
|
export type AgentsUsageByDepartmentInsight = {
|
|
11
12
|
/**
|
|
@@ -32,6 +33,14 @@ export type AgentsUsageByDepartmentInsight = {
|
|
|
32
33
|
* Name of the agent to be shown in the agent column in this department over the specified time period.
|
|
33
34
|
*/
|
|
34
35
|
agentName?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Defines how to render an icon
|
|
38
|
+
*/
|
|
39
|
+
icon?: IconConfig | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates whether the agent has been deleted
|
|
42
|
+
*/
|
|
43
|
+
isDeleted?: boolean | undefined;
|
|
35
44
|
};
|
|
36
45
|
|
|
37
46
|
/** @internal */
|
|
@@ -46,6 +55,8 @@ export const AgentsUsageByDepartmentInsight$inboundSchema: z.ZodType<
|
|
|
46
55
|
runCount: z.number().int().optional(),
|
|
47
56
|
agentId: z.string().optional(),
|
|
48
57
|
agentName: z.string().optional(),
|
|
58
|
+
icon: IconConfig$inboundSchema.optional(),
|
|
59
|
+
isDeleted: z.boolean().optional(),
|
|
49
60
|
});
|
|
50
61
|
|
|
51
62
|
export function agentsUsageByDepartmentInsightFromJSON(
|
|
@@ -14,6 +14,9 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
14
14
|
export const LikelihoodThreshold = {
|
|
15
15
|
Likely: "LIKELY",
|
|
16
16
|
VeryLikely: "VERY_LIKELY",
|
|
17
|
+
Possible: "POSSIBLE",
|
|
18
|
+
Unlikely: "UNLIKELY",
|
|
19
|
+
VeryUnlikely: "VERY_UNLIKELY",
|
|
17
20
|
} as const;
|
|
18
21
|
/**
|
|
19
22
|
* @deprecated enum: This will be removed in a future release, please migrate away from it as soon as possible.
|