@engini/sdk 0.26.0 → 0.28.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/README.md +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/resources/connections.d.ts +8 -4
- package/dist/resources/connections.js +9 -5
- package/dist/resources/opa.d.ts +2 -0
- package/dist/resources/opa.js +2 -1
- package/dist/resources/tools.d.ts +7 -1
- package/dist/resources/tools.js +13 -4
- package/dist/types.d.ts +9 -17
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -85,6 +85,9 @@ console.log(agent.token); // a credential - store it, do not log it
|
|
|
85
85
|
const a = await client.opa.get(agent.agentId);
|
|
86
86
|
console.log(a.status, a.version, a.lastSeenAt);
|
|
87
87
|
|
|
88
|
+
// Only agents changed at or after a point in time (CLI: engini opa list --updated-after <iso>)
|
|
89
|
+
const recent = await client.opa.list({ updatedAfter: "2026-10-01T00:00:00Z" });
|
|
90
|
+
|
|
88
91
|
// Change its log level; the agent picks it up on its next poll
|
|
89
92
|
const r = await client.opa.update(agent.agentId, { logLevel: "Debug" });
|
|
90
93
|
if (!r.appliedToAgent) console.log("stored; the agent is not Online yet");
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { Toolset } from "./toolset.js";
|
|
|
13
13
|
export type { ConnectionBinding, ToolsetExecuteOptions } from "./toolset.js";
|
|
14
14
|
export { File } from "./files.js";
|
|
15
15
|
export type { FileWire } from "./files.js";
|
|
16
|
-
export type { ToolSchema, Filter, Sort, ToolExecuteResult, Application, ApplicationDetail, Connection, ConnectionDetail, ConnectionObject, WhoAmI,
|
|
16
|
+
export type { ToolSchema, Filter, Sort, ToolExecuteResult, Application, ApplicationDetail, Connection, ConnectionDetail, ConnectionObject, WhoAmI, SignInStatusResponse, } from "./types.js";
|
|
17
17
|
export type { ToolsetConnectionDto, ToolsetConnectionRequest, ToolsetDto } from "@engini/client";
|
|
18
18
|
export type { AuthProviderResponse, AuthProviderFieldValue, AuthProviderFieldDefinition, AuthProviderSourceApplication, AuthProviderSourceMethod, AuthProviderRedirectUriResponse, CreateAuthProviderRequest, UpdateAuthProviderRequest, UsableAuthProvider, } from "@engini/client";
|
|
19
19
|
export type { OnPremAgentListItem as OpaAgentListItem, OnPremAgentDetail as OpaAgentDetail, OnPremAgentSettings as OpaAgentSettings, OnPremAgentTokenResponse as OpaAgentTokenResponse, OnPremAgentCreateResponse as OpaAgentCreateResponse, OnPremAgentReleaseManifest as OpaReleaseManifest, CreateOnPremAgentRequest as CreateOpaAgentRequest, UpdateOnPremAgentRequest as UpdateOpaAgentRequest, } from "@engini/client";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Connections resource — listing, defaults, name→id resolution, and the creation
|
|
3
|
-
* flow (sign-in
|
|
3
|
+
* flow (sign-in-status/create/check/refresh/objects/select + the
|
|
4
4
|
* `waitForRefresh` poll helper) that backs the interactive `engini connect` CLI.
|
|
5
5
|
* See `docs/superpowers/specs/2026-06-18-cli-connect-flow-design.md`.
|
|
6
6
|
*/
|
|
7
7
|
import { type ConnectionObject, type ConnectionReplaceResult, type ConnectionPublicDetail, type ConnectionPublicListItem, type DefaultConnectionDto, type RefreshStatusResponse, type SignInUrlResponse } from "@engini/client";
|
|
8
8
|
import { type Transport } from "../http.js";
|
|
9
|
-
import type {
|
|
9
|
+
import type { SignInStatusResponse } from "../types.js";
|
|
10
10
|
/**
|
|
11
11
|
* Whether a refresh status is terminal (finished, error, or otherwise not running).
|
|
12
12
|
* Unknown descriptions count as terminal — erring that way avoids hanging on a
|
|
@@ -94,8 +94,12 @@ export declare class ConnectionsResource {
|
|
|
94
94
|
environment?: string;
|
|
95
95
|
authProviderId?: number;
|
|
96
96
|
}): Promise<SignInUrlResponse>;
|
|
97
|
-
/**
|
|
98
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Poll an OAuth2 sign-in by `state`. Token-free: `status` is `pending` until `signed_in`
|
|
99
|
+
* (or `failed` / `cancelled` / `expired`), then `create` with `oauthState` - the server
|
|
100
|
+
* reads the credentials from the sign-in itself.
|
|
101
|
+
*/
|
|
102
|
+
getSignInStatus(state: string): Promise<SignInStatusResponse>;
|
|
99
103
|
/**
|
|
100
104
|
* Create a connection; returns the full connection detail.
|
|
101
105
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Connections resource — listing, defaults, name→id resolution, and the creation
|
|
3
|
-
* flow (sign-in
|
|
3
|
+
* flow (sign-in-status/create/check/refresh/objects/select + the
|
|
4
4
|
* `waitForRefresh` poll helper) that backs the interactive `engini connect` CLI.
|
|
5
5
|
* See `docs/superpowers/specs/2026-06-18-cli-connect-flow-design.md`.
|
|
6
6
|
*/
|
|
7
|
-
import { connectionsGetConnection, connectionsDeleteConnection, connectionsGetConnections, connectionsGetDefaultConnections, connectionsSetDefaultConnection, connectionsClearDefaultConnection, connectionsGetSignInUrl,
|
|
7
|
+
import { connectionsGetConnection, connectionsDeleteConnection, connectionsGetConnections, connectionsGetDefaultConnections, connectionsSetDefaultConnection, connectionsClearDefaultConnection, connectionsGetSignInUrl, connectionsGetSignInStatus, connectionsCreateConnection, connectionsCheckConnection, connectionsRefreshObjects, connectionsGetRefreshStatus, connectionsGetConnectionObjects, connectionsSelectObjects, connectionsUpdateConnection, connectionsReplaceConnection, } from "@engini/client";
|
|
8
8
|
import { call } from "../http.js";
|
|
9
9
|
import { paginate, collect } from "../pagination.js";
|
|
10
10
|
import { EnginiConnectionError, EnginiTimeoutError, EnginiToolsetError } from "../errors.js";
|
|
@@ -220,9 +220,13 @@ export class ConnectionsResource {
|
|
|
220
220
|
},
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
-
/**
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
/**
|
|
224
|
+
* Poll an OAuth2 sign-in by `state`. Token-free: `status` is `pending` until `signed_in`
|
|
225
|
+
* (or `failed` / `cancelled` / `expired`), then `create` with `oauthState` - the server
|
|
226
|
+
* reads the credentials from the sign-in itself.
|
|
227
|
+
*/
|
|
228
|
+
async getSignInStatus(state) {
|
|
229
|
+
return call(connectionsGetSignInStatus, {
|
|
226
230
|
client: this.client._transport,
|
|
227
231
|
path: { state },
|
|
228
232
|
});
|
package/dist/resources/opa.d.ts
CHANGED
|
@@ -40,10 +40,12 @@ export declare class OpaResource {
|
|
|
40
40
|
* `status` is one of `WaitingForConnection`, `Online`, `Offline` or `Disabled`
|
|
41
41
|
* (case-insensitive on the wire; an unknown value is a 400, not a silently-ignored
|
|
42
42
|
* filter). `name` is a substring match.
|
|
43
|
+
* `updatedAfter` (ISO 8601 datetime) keeps agents changed at or after that instant (include `Z` or an offset).
|
|
43
44
|
*/
|
|
44
45
|
list(params?: {
|
|
45
46
|
status?: string;
|
|
46
47
|
name?: string;
|
|
48
|
+
updatedAfter?: string;
|
|
47
49
|
}): Promise<OnPremAgentListItem[]>;
|
|
48
50
|
/**
|
|
49
51
|
* One agent's status, self-reported version, last heartbeat and settings.
|
package/dist/resources/opa.js
CHANGED
|
@@ -40,12 +40,13 @@ export class OpaResource {
|
|
|
40
40
|
* `status` is one of `WaitingForConnection`, `Online`, `Offline` or `Disabled`
|
|
41
41
|
* (case-insensitive on the wire; an unknown value is a 400, not a silently-ignored
|
|
42
42
|
* filter). `name` is a substring match.
|
|
43
|
+
* `updatedAfter` (ISO 8601 datetime) keeps agents changed at or after that instant (include `Z` or an offset).
|
|
43
44
|
*/
|
|
44
45
|
async list(params = {}) {
|
|
45
46
|
const transport = this.client._transport;
|
|
46
47
|
return collect(paginate((offset, top) => call(onPremAgentsListAgents, {
|
|
47
48
|
client: transport,
|
|
48
|
-
query: { offset, top, status: params.status, name: params.name },
|
|
49
|
+
query: { offset, top, status: params.status, name: params.name, updatedAfter: params.updatedAfter },
|
|
49
50
|
})));
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
@@ -26,7 +26,13 @@ export declare class ToolsResource {
|
|
|
26
26
|
private readonly client;
|
|
27
27
|
constructor(client: ToolsClient);
|
|
28
28
|
get(options?: ToolsGetOptions): Promise<ToolSchema[]>;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* `connectionId` returns the schema as that connection sees it. Such a call bypasses
|
|
31
|
+
* the cache both ways: the cache is keyed by slug alone, so serving it would return
|
|
32
|
+
* the wrong connection's schema and writing it would poison later slug-only lookups
|
|
33
|
+
* (the `supports*` gate in `execute`).
|
|
34
|
+
*/
|
|
35
|
+
getOne(toolSlug: string, applicationSlug?: string, connectionId?: number): Promise<ToolSchema>;
|
|
30
36
|
execute(toolSlug: string, args?: Record<string, unknown>, options?: ToolsExecuteOptions): Promise<ToolExecuteResult>;
|
|
31
37
|
private gate;
|
|
32
38
|
private discoverSlugs;
|
package/dist/resources/tools.js
CHANGED
|
@@ -29,16 +29,25 @@ export class ToolsResource {
|
|
|
29
29
|
pairs = pairs.slice(0, options.limit);
|
|
30
30
|
return Promise.all(pairs.map(([slug, app]) => this.getOne(slug, app)));
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* `connectionId` returns the schema as that connection sees it. Such a call bypasses
|
|
34
|
+
* the cache both ways: the cache is keyed by slug alone, so serving it would return
|
|
35
|
+
* the wrong connection's schema and writing it would poison later slug-only lookups
|
|
36
|
+
* (the `supports*` gate in `execute`).
|
|
37
|
+
*/
|
|
38
|
+
async getOne(toolSlug, applicationSlug, connectionId) {
|
|
33
39
|
const cached = this.client._toolCache.get(toolSlug);
|
|
34
|
-
if (cached)
|
|
40
|
+
if (cached && connectionId === undefined)
|
|
35
41
|
return cached;
|
|
36
42
|
const detail = await call(toolsGetTool, {
|
|
37
43
|
client: this.client._transport,
|
|
38
44
|
path: { toolSlug },
|
|
39
|
-
query: applicationSlug !== undefined
|
|
45
|
+
query: applicationSlug !== undefined || connectionId !== undefined
|
|
46
|
+
? { applicationSlug, connectionId }
|
|
47
|
+
: undefined,
|
|
40
48
|
});
|
|
41
|
-
|
|
49
|
+
if (connectionId === undefined)
|
|
50
|
+
this.client._toolCache.set(toolSlug, detail);
|
|
42
51
|
return detail;
|
|
43
52
|
}
|
|
44
53
|
async execute(toolSlug, args = {}, options = {}) {
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Canonical, provider-agnostic tool schema and execution result types.
|
|
3
3
|
* Bound to the autogen `@engini/client` models — the SDK's public surface.
|
|
4
4
|
*/
|
|
5
|
-
import type { ToolDetailDto, ActivityCondition, ActivitySort, ApplicationDto, ApplicationDetailDto, ConnectionPublicListItem, ConnectionPublicDetail, ConnectionObject as ConnectionObjectModel, WhoAmIResponse,
|
|
5
|
+
import type { ToolDetailDto, ActivityCondition, ActivitySort, ApplicationDto, ApplicationDetailDto, ConnectionPublicListItem, ConnectionPublicDetail, ConnectionObject as ConnectionObjectModel, WhoAmIResponse, SignInStatusResponse as ClientSignInStatusResponse } from "@engini/client";
|
|
6
6
|
/** Canonical tool schema (== client `ToolDetailDto`; carries `inputSchema` + `supports*`). */
|
|
7
7
|
export type ToolSchema = ToolDetailDto;
|
|
8
8
|
/** A connector application summary (== client `ApplicationDto`). */
|
|
@@ -18,23 +18,15 @@ export type ConnectionObject = ConnectionObjectModel;
|
|
|
18
18
|
/** Authenticated caller identity (== client `WhoAmIResponse`). */
|
|
19
19
|
export type WhoAmI = WhoAmIResponse;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* connection field discovered from the signed-in org
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `@engini/client`'s generated `AccessTokenResponse` now declares `fieldOptions` itself
|
|
29
|
-
* (required, non-null — the C# DTO is `= new()`), so this is a straight re-export, not
|
|
30
|
-
* a local intersection. That non-nullability is deliberate, not an oversight: the merged
|
|
31
|
-
* server (`ConnectionsController.cs`, terminal poll) maps a failed/empty lookup to `{}`
|
|
32
|
-
* explicitly, so **absent is the only signal of an older server** (one that predates
|
|
33
|
-
* WorkflowApi #1401); `{}` means the lookup ran and found no options, same as "the field
|
|
34
|
-
* genuinely has none". A failed lookup is indistinguishable from "no options" once it's
|
|
35
|
-
* on the wire (logged server-side, not surfaced here) - same as it is from absent.
|
|
21
|
+
* Sign-in status poll response. Carries no provider token: `fieldOptions` holds legal values for
|
|
22
|
+
* a declared connection field discovered from the signed-in org, shaped
|
|
23
|
+
* `{ [fieldName]: { [valueToSave]: labelToShow } }` (e.g. Salesforce's `ApiVersionUrl` ->
|
|
24
|
+
* `{ "/services/data/v60.0": "60.0" }` - the KEY is what `create`/`update` must send, the VALUE is
|
|
25
|
+
* only a display label), and `derivedFields` names the connection fields the server fills from the
|
|
26
|
+
* sign-in, so a caller must not ask for or post them. `createOutcome` (`connected` / `failed` /
|
|
27
|
+
* null) reports a create already made with this state and is separate from `status`.
|
|
36
28
|
*/
|
|
37
|
-
export type
|
|
29
|
+
export type SignInStatusResponse = ClientSignInStatusResponse;
|
|
38
30
|
/** Execute-time filter condition (gated by `supportsFilters`). */
|
|
39
31
|
export type Filter = ActivityCondition;
|
|
40
32
|
/** Execute-time sort directive (gated by `supportsSort`). */
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@engini/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Engini SDK — agent-first ergonomic layer over the Engini Public API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"test": "vitest run"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@engini/client": "0.
|
|
30
|
+
"@engini/client": "0.14.0",
|
|
31
31
|
"undici": "^6.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|