@superblocksteam/sdk-api 2.0.177-next.0 → 2.0.178-next.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/api/definition.test.js +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/files.d.ts +2 -2
- package/dist/files.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/agentcore/client.d.ts +21 -0
- package/dist/integrations/agentcore/client.d.ts.map +1 -0
- package/dist/integrations/agentcore/client.js +109 -0
- package/dist/integrations/agentcore/client.js.map +1 -0
- package/dist/integrations/agentcore/client.test.d.ts +2 -0
- package/dist/integrations/agentcore/client.test.d.ts.map +1 -0
- package/dist/integrations/agentcore/client.test.js +115 -0
- package/dist/integrations/agentcore/client.test.js.map +1 -0
- package/dist/integrations/agentcore/index.d.ts +3 -0
- package/dist/integrations/agentcore/index.d.ts.map +1 -0
- package/dist/integrations/agentcore/index.js +2 -0
- package/dist/integrations/agentcore/index.js.map +1 -0
- package/dist/integrations/agentcore/types.d.ts +43 -0
- package/dist/integrations/agentcore/types.d.ts.map +1 -0
- package/dist/integrations/agentcore/types.js +2 -0
- package/dist/integrations/agentcore/types.js.map +1 -0
- package/dist/integrations/athena/client.d.ts.map +1 -1
- package/dist/integrations/base/graphql-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/rest-api-client-base.d.ts.map +1 -1
- package/dist/integrations/base/rest-api-client-base.js.map +1 -1
- package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/types.d.ts.map +1 -1
- package/dist/integrations/bigquery/client.d.ts.map +1 -1
- package/dist/integrations/cockroachdb/client.d.ts.map +1 -1
- package/dist/integrations/cosmosdb/client.d.ts.map +1 -1
- package/dist/integrations/cosmosdb/client.test.js.map +1 -1
- package/dist/integrations/databricks/client.d.ts.map +1 -1
- package/dist/integrations/declarations.d.ts +10 -0
- package/dist/integrations/declarations.d.ts.map +1 -1
- package/dist/integrations/declarations.js +9 -0
- package/dist/integrations/declarations.js.map +1 -1
- package/dist/integrations/documentation.js.map +1 -1
- package/dist/integrations/documentation.test.js.map +1 -1
- package/dist/integrations/dynamodb/client.d.ts.map +1 -1
- package/dist/integrations/dynamodb/client.test.js.map +1 -1
- package/dist/integrations/gcs/client.d.ts.map +1 -1
- package/dist/integrations/gsheets/client.d.ts.map +1 -1
- package/dist/integrations/index.d.ts +3 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/lakebase/client.d.ts.map +1 -1
- package/dist/integrations/mariadb/client.d.ts.map +1 -1
- package/dist/integrations/mcpintegration/client.d.ts.map +1 -1
- package/dist/integrations/mcpintegration/client.test.js.map +1 -1
- package/dist/integrations/mongodb/client.d.ts.map +1 -1
- package/dist/integrations/mssql/client.d.ts.map +1 -1
- package/dist/integrations/mysql/client.d.ts.map +1 -1
- package/dist/integrations/oracledb/client.d.ts.map +1 -1
- package/dist/integrations/postgres/client.d.ts.map +1 -1
- package/dist/integrations/redshift/client.d.ts.map +1 -1
- package/dist/integrations/registry.d.ts +1 -0
- package/dist/integrations/registry.d.ts.map +1 -1
- package/dist/integrations/registry.js +4 -0
- package/dist/integrations/registry.js.map +1 -1
- package/dist/integrations/restapiintegration/client.test.js +1 -1
- package/dist/integrations/restapiintegration/client.test.js.map +1 -1
- package/dist/integrations/s3/client.d.ts.map +1 -1
- package/dist/integrations/salesforce/client.d.ts.map +1 -1
- package/dist/integrations/slack/client.d.ts.map +1 -1
- package/dist/integrations/smtp/client.d.ts.map +1 -1
- package/dist/integrations/snowflake/client.d.ts.map +1 -1
- package/dist/integrations/snowflake/types.d.ts +1 -1
- package/dist/integrations/snowflake/types.d.ts.map +1 -1
- package/dist/runtime/errors.d.ts.map +1 -1
- package/dist/runtime/errors.js.map +1 -1
- package/package.json +9 -6
- package/src/api/definition.test.ts +1 -1
- package/src/api/definition.ts +2 -2
- package/src/index.ts +9 -0
- package/src/integrations/agentcore/README.md +49 -0
- package/src/integrations/agentcore/client.test.ts +166 -0
- package/src/integrations/agentcore/client.ts +168 -0
- package/src/integrations/agentcore/docs.manifest.json +5 -0
- package/src/integrations/agentcore/index.ts +8 -0
- package/src/integrations/agentcore/types.ts +56 -0
- package/src/integrations/declarations.ts +16 -0
- package/src/integrations/index.ts +10 -0
- package/src/integrations/registry.ts +5 -0
- package/src/integrations/restapiintegration/client.test.ts +1 -1
- package/src/integrations/snowflake/types.ts +1 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import { RestApiValidationError } from "../../errors.js";
|
|
5
|
+
import { IntegrationError } from "../../runtime/errors.js";
|
|
6
|
+
import type { IntegrationConfig } from "../types.js";
|
|
7
|
+
import { AgentCoreClientImpl } from "./client.js";
|
|
8
|
+
|
|
9
|
+
const TEST_CONFIG: IntegrationConfig = {
|
|
10
|
+
id: "agentcore-test-id",
|
|
11
|
+
name: "Triage",
|
|
12
|
+
pluginId: "agentcore",
|
|
13
|
+
configuration: {},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const harnessResult = {
|
|
17
|
+
text: "done",
|
|
18
|
+
toolCalls: [
|
|
19
|
+
{ name: "lookup", toolUseId: "tool-1", result: "ok", failed: false },
|
|
20
|
+
],
|
|
21
|
+
stopReason: "end_turn",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const replySchema = z.object({ reply: z.string() });
|
|
25
|
+
|
|
26
|
+
function createClient(result: unknown) {
|
|
27
|
+
const executeQuery = vi.fn().mockResolvedValue(result);
|
|
28
|
+
return {
|
|
29
|
+
client: new AgentCoreClientImpl(TEST_CONFIG, executeQuery),
|
|
30
|
+
executeQuery,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe("AgentCoreClientImpl", () => {
|
|
35
|
+
it("sends a harness prompt and returns the result without its kind tag", async () => {
|
|
36
|
+
const harness = createClient({ kind: "harness", ...harnessResult });
|
|
37
|
+
const result = await harness.client.invokeHarness("the ticket", {
|
|
38
|
+
sessionKey: "ticket-1",
|
|
39
|
+
label: "Triage",
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
expect(result).toEqual(harnessResult);
|
|
43
|
+
expect(harness.executeQuery).toHaveBeenCalledWith(
|
|
44
|
+
{ prompt: "the ticket", sessionKey: "ticket-1" },
|
|
45
|
+
undefined,
|
|
46
|
+
{ label: "Triage" },
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("rejects a harness result without the harness tag", async () => {
|
|
51
|
+
await expect(
|
|
52
|
+
createClient(harnessResult).client.invokeHarness("the ticket"),
|
|
53
|
+
).rejects.toBeInstanceOf(RestApiValidationError);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("rejects a blank prompt without calling the worker", async () => {
|
|
57
|
+
const harness = createClient({ kind: "harness", ...harnessResult });
|
|
58
|
+
await expect(harness.client.invokeHarness(" ")).rejects.toBeInstanceOf(
|
|
59
|
+
RestApiValidationError,
|
|
60
|
+
);
|
|
61
|
+
expect(harness.executeQuery).not.toHaveBeenCalled();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("sends a runtime JSON payload and returns the validated response", async () => {
|
|
65
|
+
const runtime = createClient({
|
|
66
|
+
kind: "runtime",
|
|
67
|
+
response: { reply: "done" },
|
|
68
|
+
});
|
|
69
|
+
const reply = await runtime.client.invokeAgentRuntime(
|
|
70
|
+
{ ticket: "the ticket" },
|
|
71
|
+
replySchema,
|
|
72
|
+
{ contentType: "application/json", accept: "application/json" },
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
expect(reply).toEqual({ reply: "done" });
|
|
76
|
+
expect(runtime.executeQuery).toHaveBeenCalledWith(
|
|
77
|
+
{
|
|
78
|
+
payload: '{"ticket":"the ticket"}',
|
|
79
|
+
contentType: "application/json",
|
|
80
|
+
accept: "application/json",
|
|
81
|
+
},
|
|
82
|
+
undefined,
|
|
83
|
+
undefined,
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("rejects a runtime response that misses the schema", async () => {
|
|
88
|
+
await expect(
|
|
89
|
+
createClient({
|
|
90
|
+
kind: "runtime",
|
|
91
|
+
response: { reply: 1 },
|
|
92
|
+
}).client.invokeAgentRuntime({ ticket: "the ticket" }, replySchema),
|
|
93
|
+
).rejects.toBeInstanceOf(RestApiValidationError);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("rejects a runtime result without the runtime tag", async () => {
|
|
97
|
+
await expect(
|
|
98
|
+
createClient({ reply: "done" }).client.invokeAgentRuntime(
|
|
99
|
+
{ ticket: "the ticket" },
|
|
100
|
+
replySchema,
|
|
101
|
+
),
|
|
102
|
+
).rejects.toBeInstanceOf(RestApiValidationError);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("rejects a blank runtime payload without calling the worker", async () => {
|
|
106
|
+
const runtime = createClient({ kind: "runtime", response: {} });
|
|
107
|
+
await expect(
|
|
108
|
+
runtime.client.invokeAgentRuntime(" ", replySchema),
|
|
109
|
+
).rejects.toBeInstanceOf(RestApiValidationError);
|
|
110
|
+
expect(runtime.executeQuery).not.toHaveBeenCalled();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("rejects a payload JSON cannot encode without calling the worker", async () => {
|
|
114
|
+
const runtime = createClient({ kind: "runtime", response: {} });
|
|
115
|
+
await expect(
|
|
116
|
+
runtime.client.invokeAgentRuntime(() => "reply", replySchema),
|
|
117
|
+
).rejects.toBeInstanceOf(RestApiValidationError);
|
|
118
|
+
expect(runtime.executeQuery).not.toHaveBeenCalled();
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it.each([
|
|
122
|
+
[
|
|
123
|
+
"a circular object",
|
|
124
|
+
(() => {
|
|
125
|
+
const payload: Record<string, unknown> = {};
|
|
126
|
+
payload.self = payload;
|
|
127
|
+
return payload;
|
|
128
|
+
})(),
|
|
129
|
+
],
|
|
130
|
+
["a BigInt", { count: BigInt(1) }],
|
|
131
|
+
])("rejects %s without calling the worker", async (_, payload) => {
|
|
132
|
+
const runtime = createClient({ kind: "runtime", response: {} });
|
|
133
|
+
await expect(
|
|
134
|
+
runtime.client.invokeAgentRuntime(payload, replySchema),
|
|
135
|
+
).rejects.toThrow(/Payload cannot be sent as JSON/);
|
|
136
|
+
await expect(
|
|
137
|
+
runtime.client.invokeAgentRuntime(payload, replySchema),
|
|
138
|
+
).rejects.toBeInstanceOf(RestApiValidationError);
|
|
139
|
+
expect(runtime.executeQuery).not.toHaveBeenCalled();
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it("wraps worker failures with the integration name and operation", async () => {
|
|
143
|
+
const cause = new Error("AccessDeniedException");
|
|
144
|
+
const executeQuery = vi.fn().mockRejectedValue(cause);
|
|
145
|
+
const client = new AgentCoreClientImpl(TEST_CONFIG, executeQuery);
|
|
146
|
+
|
|
147
|
+
await expect(client.invokeHarness("the ticket")).rejects.toMatchObject({
|
|
148
|
+
name: "IntegrationError",
|
|
149
|
+
integrationName: "Triage",
|
|
150
|
+
operation: "invokeHarness",
|
|
151
|
+
});
|
|
152
|
+
const error = await client
|
|
153
|
+
.invokeAgentRuntime({ ticket: "1" }, replySchema)
|
|
154
|
+
.catch((e: unknown) => e);
|
|
155
|
+
expect(error).toBeInstanceOf(IntegrationError);
|
|
156
|
+
expect(error).toMatchObject({ operation: "invokeAgentRuntime" });
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("rethrows an IntegrationError from the worker unchanged", async () => {
|
|
160
|
+
const original = new IntegrationError("Triage", "execute");
|
|
161
|
+
const executeQuery = vi.fn().mockRejectedValue(original);
|
|
162
|
+
const client = new AgentCoreClientImpl(TEST_CONFIG, executeQuery);
|
|
163
|
+
|
|
164
|
+
await expect(client.invokeHarness("the ticket")).rejects.toBe(original);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Amazon Bedrock AgentCore client.
|
|
3
|
+
*
|
|
4
|
+
* The step fields match the worker plugin. They are declared here because the
|
|
5
|
+
* published types package does not include the plugin yet.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
RestApiValidationError,
|
|
12
|
+
restApiValidationErrorFromZodError,
|
|
13
|
+
} from "../../errors.js";
|
|
14
|
+
import { IntegrationError } from "../../runtime/errors.js";
|
|
15
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
16
|
+
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
17
|
+
import type {
|
|
18
|
+
AgentCoreClient,
|
|
19
|
+
AgentCoreInvokeAgentRuntimeOptions,
|
|
20
|
+
AgentCoreInvokeHarnessOptions,
|
|
21
|
+
AgentCoreInvokeHarnessResult,
|
|
22
|
+
} from "./types.js";
|
|
23
|
+
|
|
24
|
+
const HarnessResultSchema = z.object({
|
|
25
|
+
kind: z.literal("harness"),
|
|
26
|
+
text: z.string(),
|
|
27
|
+
toolCalls: z.array(
|
|
28
|
+
z.object({
|
|
29
|
+
name: z.string(),
|
|
30
|
+
toolUseId: z.string().optional(),
|
|
31
|
+
result: z.string(),
|
|
32
|
+
failed: z.boolean(),
|
|
33
|
+
}),
|
|
34
|
+
),
|
|
35
|
+
stopReason: z.string(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const RuntimeResultSchema = z.object({
|
|
39
|
+
kind: z.literal("runtime"),
|
|
40
|
+
response: z.unknown(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function payloadText(payload: unknown): string {
|
|
44
|
+
if (typeof payload === "string") {
|
|
45
|
+
return payload;
|
|
46
|
+
}
|
|
47
|
+
if (payload === undefined) {
|
|
48
|
+
return "";
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
return JSON.stringify(payload) ?? "";
|
|
52
|
+
} catch (error) {
|
|
53
|
+
throw new RestApiValidationError(
|
|
54
|
+
`Payload cannot be sent as JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
55
|
+
{ data: payload, zodError: new z.ZodError([]) },
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class AgentCoreClientImpl
|
|
61
|
+
implements AgentCoreClient, IntegrationClientImpl
|
|
62
|
+
{
|
|
63
|
+
readonly config: IntegrationConfig;
|
|
64
|
+
private readonly executeQuery: QueryExecutor;
|
|
65
|
+
|
|
66
|
+
constructor(config: IntegrationConfig, executeQuery: QueryExecutor) {
|
|
67
|
+
this.config = config;
|
|
68
|
+
this.executeQuery = executeQuery;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get name(): string {
|
|
72
|
+
return this.config.name;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get pluginId(): string {
|
|
76
|
+
return this.config.pluginId;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async invokeHarness(
|
|
80
|
+
prompt: string,
|
|
81
|
+
options?: AgentCoreInvokeHarnessOptions,
|
|
82
|
+
): Promise<AgentCoreInvokeHarnessResult> {
|
|
83
|
+
if (prompt.trim() === "") {
|
|
84
|
+
throw new RestApiValidationError("Prompt is required.", {
|
|
85
|
+
data: prompt,
|
|
86
|
+
zodError: new z.ZodError([]),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const result = await this.run(
|
|
90
|
+
"invokeHarness",
|
|
91
|
+
{
|
|
92
|
+
prompt,
|
|
93
|
+
...(options?.sessionKey ? { sessionKey: options.sessionKey } : {}),
|
|
94
|
+
},
|
|
95
|
+
options?.label,
|
|
96
|
+
);
|
|
97
|
+
const parsed = HarnessResultSchema.safeParse(result);
|
|
98
|
+
if (!parsed.success) {
|
|
99
|
+
throw restApiValidationErrorFromZodError(
|
|
100
|
+
"AgentCore invokeHarness returned an unexpected result",
|
|
101
|
+
parsed.error,
|
|
102
|
+
result,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
const { text, toolCalls, stopReason } = parsed.data;
|
|
106
|
+
return { text, toolCalls, stopReason };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async invokeAgentRuntime<T>(
|
|
110
|
+
payload: unknown,
|
|
111
|
+
schema: z.ZodType<T>,
|
|
112
|
+
options?: AgentCoreInvokeAgentRuntimeOptions,
|
|
113
|
+
): Promise<T> {
|
|
114
|
+
const body = payloadText(payload);
|
|
115
|
+
if (body.trim() === "") {
|
|
116
|
+
throw new RestApiValidationError("Payload is required.", {
|
|
117
|
+
data: payload,
|
|
118
|
+
zodError: new z.ZodError([]),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const result = await this.run(
|
|
122
|
+
"invokeAgentRuntime",
|
|
123
|
+
{
|
|
124
|
+
payload: body,
|
|
125
|
+
...(options?.contentType ? { contentType: options.contentType } : {}),
|
|
126
|
+
...(options?.accept ? { accept: options.accept } : {}),
|
|
127
|
+
...(options?.sessionKey ? { sessionKey: options.sessionKey } : {}),
|
|
128
|
+
},
|
|
129
|
+
options?.label,
|
|
130
|
+
);
|
|
131
|
+
const runtime = RuntimeResultSchema.safeParse(result);
|
|
132
|
+
if (!runtime.success) {
|
|
133
|
+
throw restApiValidationErrorFromZodError(
|
|
134
|
+
"AgentCore invokeAgentRuntime returned an unexpected result",
|
|
135
|
+
runtime.error,
|
|
136
|
+
result,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
const parsed = schema.safeParse(runtime.data.response);
|
|
140
|
+
if (!parsed.success) {
|
|
141
|
+
throw restApiValidationErrorFromZodError(
|
|
142
|
+
"AgentCore runtime response failed validation",
|
|
143
|
+
parsed.error,
|
|
144
|
+
runtime.data.response,
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
return parsed.data;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private async run(
|
|
151
|
+
operation: string,
|
|
152
|
+
request: Record<string, unknown>,
|
|
153
|
+
label: string | undefined,
|
|
154
|
+
): Promise<unknown> {
|
|
155
|
+
try {
|
|
156
|
+
return await this.executeQuery(request, undefined, trace(label));
|
|
157
|
+
} catch (error) {
|
|
158
|
+
if (error instanceof IntegrationError) {
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
throw new IntegrationError(this.config.name, operation, error);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function trace(label: string | undefined): TraceMetadata | undefined {
|
|
167
|
+
return label ? { label } : undefined;
|
|
168
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import type { BaseIntegrationClient } from "../../types.js";
|
|
4
|
+
|
|
5
|
+
/** One tool the harness ran while answering. */
|
|
6
|
+
export interface AgentCoreToolCall {
|
|
7
|
+
name: string;
|
|
8
|
+
toolUseId?: string;
|
|
9
|
+
result: string;
|
|
10
|
+
failed: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** What a harness call returns after the stream finishes. */
|
|
14
|
+
export interface AgentCoreInvokeHarnessResult {
|
|
15
|
+
text: string;
|
|
16
|
+
toolCalls: AgentCoreToolCall[];
|
|
17
|
+
stopReason: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface AgentCoreInvokeHarnessOptions {
|
|
21
|
+
/** Stable key for this conversation. Omitted keys get a new session on each call. */
|
|
22
|
+
sessionKey?: string;
|
|
23
|
+
/** Shown in the Trace View. */
|
|
24
|
+
label?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AgentCoreInvokeAgentRuntimeOptions {
|
|
28
|
+
sessionKey?: string;
|
|
29
|
+
/** Defaults to application/json on the worker when omitted. */
|
|
30
|
+
contentType?: string;
|
|
31
|
+
/** Response content type to request. Defaults to application/json on the worker. */
|
|
32
|
+
accept?: string;
|
|
33
|
+
label?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface AgentCoreClient extends BaseIntegrationClient {
|
|
37
|
+
/**
|
|
38
|
+
* Call a harness agent with a prompt.
|
|
39
|
+
* The integration's agent ARN must be a harness ARN.
|
|
40
|
+
*/
|
|
41
|
+
invokeHarness(
|
|
42
|
+
prompt: string,
|
|
43
|
+
options?: AgentCoreInvokeHarnessOptions,
|
|
44
|
+
): Promise<AgentCoreInvokeHarnessResult>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Call a runtime agent with a payload and validate the response.
|
|
48
|
+
* Objects are sent as JSON. A string is sent unchanged.
|
|
49
|
+
* The integration's agent ARN must be a runtime ARN.
|
|
50
|
+
*/
|
|
51
|
+
invokeAgentRuntime<T>(
|
|
52
|
+
payload: unknown,
|
|
53
|
+
schema: z.ZodType<T>,
|
|
54
|
+
options?: AgentCoreInvokeAgentRuntimeOptions,
|
|
55
|
+
): Promise<T>;
|
|
56
|
+
}
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
import type { AgentCoreClient } from "./agentcore/index.js";
|
|
34
35
|
import type { AirtableClient } from "./airtable/index.js";
|
|
35
36
|
import type { AnthropicClient } from "./anthropic/index.js";
|
|
36
37
|
import type { AsanaClient } from "./asana/index.js";
|
|
@@ -339,6 +340,9 @@ export type SnowflakePostgresRef = IntegrationRef<
|
|
|
339
340
|
/** Reference to an SMTP integration */
|
|
340
341
|
export type SmtpRef = IntegrationRef<"smtp", SmtpClient>;
|
|
341
342
|
|
|
343
|
+
/** Reference to an Amazon Bedrock AgentCore integration */
|
|
344
|
+
export type AgentCoreRef = IntegrationRef<"agentcore", AgentCoreClient>;
|
|
345
|
+
|
|
342
346
|
/** Reference to an MCP Server integration */
|
|
343
347
|
export type McpIntegrationRef = IntegrationRef<"mcpintegration", McpClient>;
|
|
344
348
|
|
|
@@ -1043,6 +1047,18 @@ export function smtp<T extends string>(id: LiteralString<T>): SmtpRef {
|
|
|
1043
1047
|
return createRef<"smtp", SmtpClient, T>("smtp", id);
|
|
1044
1048
|
}
|
|
1045
1049
|
|
|
1050
|
+
/**
|
|
1051
|
+
* Declare an Amazon Bedrock AgentCore integration.
|
|
1052
|
+
*
|
|
1053
|
+
* @param id - The integration ID (UUID)
|
|
1054
|
+
* @returns An integration reference for use in the API config
|
|
1055
|
+
*/
|
|
1056
|
+
export function agentcore<T extends string>(
|
|
1057
|
+
id: LiteralString<T>,
|
|
1058
|
+
): AgentCoreRef {
|
|
1059
|
+
return createRef<"agentcore", AgentCoreClient, T>("agentcore", id);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1046
1062
|
/**
|
|
1047
1063
|
* Declare an MCP Server integration.
|
|
1048
1064
|
*
|
|
@@ -65,6 +65,7 @@ export {
|
|
|
65
65
|
bigquery,
|
|
66
66
|
mongodb,
|
|
67
67
|
dynamodb,
|
|
68
|
+
agentcore,
|
|
68
69
|
cosmosdb,
|
|
69
70
|
s3,
|
|
70
71
|
gcs,
|
|
@@ -145,6 +146,7 @@ export {
|
|
|
145
146
|
type LakebaseRef,
|
|
146
147
|
type SnowflakePostgresRef,
|
|
147
148
|
type SmtpRef,
|
|
149
|
+
type AgentCoreRef,
|
|
148
150
|
type McpIntegrationRef,
|
|
149
151
|
type RestApiIntegrationRef,
|
|
150
152
|
} from "./declarations.js";
|
|
@@ -368,6 +370,14 @@ export type {
|
|
|
368
370
|
DynamoDBScanOptions,
|
|
369
371
|
} from "./dynamodb/index.js";
|
|
370
372
|
export { DynamoDBClientImpl } from "./dynamodb/index.js";
|
|
373
|
+
export type {
|
|
374
|
+
AgentCoreClient,
|
|
375
|
+
AgentCoreInvokeAgentRuntimeOptions,
|
|
376
|
+
AgentCoreInvokeHarnessOptions,
|
|
377
|
+
AgentCoreInvokeHarnessResult,
|
|
378
|
+
AgentCoreToolCall,
|
|
379
|
+
} from "./agentcore/index.js";
|
|
380
|
+
export { AgentCoreClientImpl } from "./agentcore/index.js";
|
|
371
381
|
|
|
372
382
|
// CosmosDB client
|
|
373
383
|
export type { CosmosDBClient, CosmosDBQueryOptions } from "./cosmosdb/index.js";
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* and provides factory functions for creating clients.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { AgentCoreClientImpl } from "./agentcore/index.js";
|
|
8
9
|
import { AirtableClientImpl } from "./airtable/index.js";
|
|
9
10
|
import { AnthropicClientImpl } from "./anthropic/index.js";
|
|
10
11
|
import { AsanaClientImpl } from "./asana/index.js";
|
|
@@ -127,6 +128,7 @@ export const SUPPORTED_PLUGINS = {
|
|
|
127
128
|
// REST API integrations
|
|
128
129
|
mongodb: "mongodb",
|
|
129
130
|
dynamodb: "dynamodb",
|
|
131
|
+
agentcore: "agentcore",
|
|
130
132
|
cosmosdb: "cosmosdb",
|
|
131
133
|
s3: "s3",
|
|
132
134
|
gcs: "gcs",
|
|
@@ -382,6 +384,9 @@ export function createClient(
|
|
|
382
384
|
case SUPPORTED_PLUGINS.dynamodb:
|
|
383
385
|
return new DynamoDBClientImpl(config, executeQuery);
|
|
384
386
|
|
|
387
|
+
case SUPPORTED_PLUGINS.agentcore:
|
|
388
|
+
return new AgentCoreClientImpl(config, executeQuery);
|
|
389
|
+
|
|
385
390
|
case SUPPORTED_PLUGINS.cosmosdb:
|
|
386
391
|
return new CosmosDBClientImpl(config, executeQuery);
|
|
387
392
|
|
|
@@ -471,11 +471,11 @@ describe("RestApiIntegrationPluginClientImpl", () => {
|
|
|
471
471
|
workerBufferPayload(PDF_BYTES),
|
|
472
472
|
);
|
|
473
473
|
|
|
474
|
-
// @ts-expect-error binary responses do not take a response schema
|
|
475
474
|
const withResponse = binaryClient.apiRequest(
|
|
476
475
|
{
|
|
477
476
|
method: "GET",
|
|
478
477
|
path: "/file.pdf",
|
|
478
|
+
// @ts-expect-error binary responses do not take a response schema
|
|
479
479
|
responseType: "binary",
|
|
480
480
|
},
|
|
481
481
|
{ response: z.instanceof(Uint8Array) },
|