@auctra/sdk 0.7.11 → 0.7.13
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/CHANGELOG.md +15 -0
- package/dist/cjs/action.js +21 -0
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/types.js +1 -1
- package/dist/esm/action.d.ts +17 -0
- package/dist/esm/action.d.ts.map +1 -1
- package/dist/esm/action.js +20 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.js +1 -1
- package/package.json +1 -1
- package/src/action.ts +37 -0
- package/src/index.ts +1 -1
- package/src/types.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.13
|
|
4
|
+
|
|
5
|
+
**Security — mandatory proxy + MCP gateway (SEC-P0-001 / P0-002)**
|
|
6
|
+
|
|
7
|
+
- Document MANDATORY lease-gated proxy for consequential tools.
|
|
8
|
+
- Pair with `@auctra/mcp-gateway@0.1.9` `REQUIRE_MCP_GATEWAY` stamp; org `require_mcp_gateway`.
|
|
9
|
+
- Scheduled release mints execution leases (SEC-P1-005).
|
|
10
|
+
|
|
11
|
+
## 0.7.12
|
|
12
|
+
|
|
13
|
+
**Feature — withExecutionLease bypass closure**
|
|
14
|
+
|
|
15
|
+
- `withExecutionLease(client, decision, fn)` — require ALLOW + `execution_lease`, consume once, then side effect.
|
|
16
|
+
- Pairs with fail-closed lease mint on high/critical ALLOW and production MCP require.
|
|
17
|
+
|
|
3
18
|
## 0.7.11
|
|
4
19
|
|
|
5
20
|
**Feature — approval nonce on require_approval (TEST-004)**
|
package/dist/cjs/action.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onAllowed = onAllowed;
|
|
4
4
|
exports.assertAllowed = assertAllowed;
|
|
5
|
+
exports.withExecutionLease = withExecutionLease;
|
|
5
6
|
exports.assertAuthorityLive = assertAuthorityLive;
|
|
6
7
|
/**
|
|
7
8
|
* Run a side-effect callback only when `decision === "allowed"`.
|
|
@@ -23,6 +24,26 @@ function assertAllowed(decision) {
|
|
|
23
24
|
(decision.reason ? ` (${decision.reason})` : ""));
|
|
24
25
|
}
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Bypass-closure helper (TEST-018): require ALLOW + execution_lease, consume once, then run.
|
|
29
|
+
* Credential proxies must use this (or mcp-gateway) so standing secrets never sit in the agent.
|
|
30
|
+
*/
|
|
31
|
+
async function withExecutionLease(client, decision, callback, options) {
|
|
32
|
+
assertAllowed(decision);
|
|
33
|
+
const token = decision.execution_lease?.token;
|
|
34
|
+
if (!token) {
|
|
35
|
+
throw new Error("Auctra refused side effect: execution_lease missing — configure AUCTRA_EXECUTION_LEASE_SECRET and a lease-gated proxy");
|
|
36
|
+
}
|
|
37
|
+
const consumed = await client.consumeExecutionLease({
|
|
38
|
+
lease: token,
|
|
39
|
+
expectedActionType: options?.expectedActionType ?? decision.execution_lease?.action_type,
|
|
40
|
+
});
|
|
41
|
+
if (!consumed.ok) {
|
|
42
|
+
throw new Error(`Auctra refused side effect: execution lease consume failed` +
|
|
43
|
+
(consumed.error ? ` (${consumed.error})` : ""));
|
|
44
|
+
}
|
|
45
|
+
return callback(decision);
|
|
46
|
+
}
|
|
26
47
|
/**
|
|
27
48
|
* Engine 07/11 — re-check authority liveness before a delayed side effect (TOCTOU).
|
|
28
49
|
* Returns false when the mandate is revoked/expired so integrators can skip local execution.
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertAuthorityLive = exports.assertAllowed = exports.onAllowed = exports.Auctra = exports.verifyDecisionArtifact = exports.verifyMandateArtifact = exports.AuctraApiError = exports.DEFAULT_BASE_URL = exports.AUCTRA_SDK_VERSION = void 0;
|
|
3
|
+
exports.withExecutionLease = exports.assertAuthorityLive = exports.assertAllowed = exports.onAllowed = exports.Auctra = exports.verifyDecisionArtifact = exports.verifyMandateArtifact = exports.AuctraApiError = exports.DEFAULT_BASE_URL = exports.AUCTRA_SDK_VERSION = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @auctra/sdk — Stage 1.0 public surface.
|
|
6
6
|
*
|
|
@@ -20,3 +20,4 @@ var action_js_1 = require("./action.js");
|
|
|
20
20
|
Object.defineProperty(exports, "onAllowed", { enumerable: true, get: function () { return action_js_1.onAllowed; } });
|
|
21
21
|
Object.defineProperty(exports, "assertAllowed", { enumerable: true, get: function () { return action_js_1.assertAllowed; } });
|
|
22
22
|
Object.defineProperty(exports, "assertAuthorityLive", { enumerable: true, get: function () { return action_js_1.assertAuthorityLive; } });
|
|
23
|
+
Object.defineProperty(exports, "withExecutionLease", { enumerable: true, get: function () { return action_js_1.withExecutionLease; } });
|
package/dist/cjs/types.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
/** @auctra/sdk — Authority Protocol client (Stage 1.0 modular layout). */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.DEFAULT_BASE_URL = exports.AUCTRA_SDK_VERSION = void 0;
|
|
5
|
-
exports.AUCTRA_SDK_VERSION = "0.7.
|
|
5
|
+
exports.AUCTRA_SDK_VERSION = "0.7.13";
|
|
6
6
|
/** Production API + console host (Architecture A: colocated on app.auctra.tech). */
|
|
7
7
|
exports.DEFAULT_BASE_URL = "https://app.auctra.tech";
|
package/dist/esm/action.d.ts
CHANGED
|
@@ -12,6 +12,23 @@ export declare function onAllowed<T>(decision: EvaluateActionResponse, callback:
|
|
|
12
12
|
export declare function assertAllowed(decision: EvaluateActionResponse): asserts decision is EvaluateActionResponse & {
|
|
13
13
|
decision: "allowed";
|
|
14
14
|
};
|
|
15
|
+
export type ExecutionLeaseConsumer = {
|
|
16
|
+
consumeExecutionLease: (input: {
|
|
17
|
+
lease: string;
|
|
18
|
+
expectedActionType?: string;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
ok: boolean;
|
|
21
|
+
error?: string;
|
|
22
|
+
reason_codes?: string[];
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Bypass-closure helper (TEST-018): require ALLOW + execution_lease, consume once, then run.
|
|
27
|
+
* Credential proxies must use this (or mcp-gateway) so standing secrets never sit in the agent.
|
|
28
|
+
*/
|
|
29
|
+
export declare function withExecutionLease<T>(client: ExecutionLeaseConsumer, decision: EvaluateActionResponse, callback: (allowed: EvaluateActionResponse) => Promise<T> | T, options?: {
|
|
30
|
+
expectedActionType?: string;
|
|
31
|
+
}): Promise<T>;
|
|
15
32
|
export type AuthorityLivenessClient = {
|
|
16
33
|
getAuthorityLiveness: (authorityId: string) => Promise<{
|
|
17
34
|
live: boolean;
|
package/dist/esm/action.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,QAAQ,EAAE,sBAAsB,EAChC,QAAQ,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAC5D,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAGxB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,sBAAsB,GAC/B,OAAO,CAAC,QAAQ,IAAI,sBAAsB,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAOtE;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,oBAAoB,EAAE,CAAC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,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAC7D,OAAO,CAAC,EAAE;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC,OAAO,CAAC,CAAC,CAAC,CAmBZ;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3F,CAAC;AAEF;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAG5C"}
|
package/dist/esm/action.js
CHANGED
|
@@ -18,6 +18,26 @@ export function assertAllowed(decision) {
|
|
|
18
18
|
(decision.reason ? ` (${decision.reason})` : ""));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Bypass-closure helper (TEST-018): require ALLOW + execution_lease, consume once, then run.
|
|
23
|
+
* Credential proxies must use this (or mcp-gateway) so standing secrets never sit in the agent.
|
|
24
|
+
*/
|
|
25
|
+
export async function withExecutionLease(client, decision, callback, options) {
|
|
26
|
+
assertAllowed(decision);
|
|
27
|
+
const token = decision.execution_lease?.token;
|
|
28
|
+
if (!token) {
|
|
29
|
+
throw new Error("Auctra refused side effect: execution_lease missing — configure AUCTRA_EXECUTION_LEASE_SECRET and a lease-gated proxy");
|
|
30
|
+
}
|
|
31
|
+
const consumed = await client.consumeExecutionLease({
|
|
32
|
+
lease: token,
|
|
33
|
+
expectedActionType: options?.expectedActionType ?? decision.execution_lease?.action_type,
|
|
34
|
+
});
|
|
35
|
+
if (!consumed.ok) {
|
|
36
|
+
throw new Error(`Auctra refused side effect: execution lease consume failed` +
|
|
37
|
+
(consumed.error ? ` (${consumed.error})` : ""));
|
|
38
|
+
}
|
|
39
|
+
return callback(decision);
|
|
40
|
+
}
|
|
21
41
|
/**
|
|
22
42
|
* Engine 07/11 — re-check authority liveness before a delayed side effect (TOCTOU).
|
|
23
43
|
* Returns false when the mandate is revoked/expired so integrators can skip local execution.
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export { AUCTRA_SDK_VERSION, DEFAULT_BASE_URL } from "./types.js";
|
|
|
8
8
|
export type * from "./types.js";
|
|
9
9
|
export { AuctraApiError, verifyMandateArtifact, verifyDecisionArtifact } from "./artifacts.js";
|
|
10
10
|
export { Auctra } from "./client.js";
|
|
11
|
-
export { onAllowed, assertAllowed, assertAuthorityLive } from "./action.js";
|
|
11
|
+
export { onAllowed, assertAllowed, assertAuthorityLive, withExecutionLease } from "./action.js";
|
|
12
12
|
export type { AuthorityLivenessClient } from "./action.js";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAClE,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAClE,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAChG,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
export { AUCTRA_SDK_VERSION, DEFAULT_BASE_URL } from "./types.js";
|
|
8
8
|
export { AuctraApiError, verifyMandateArtifact, verifyDecisionArtifact } from "./artifacts.js";
|
|
9
9
|
export { Auctra } from "./client.js";
|
|
10
|
-
export { onAllowed, assertAllowed, assertAuthorityLive } from "./action.js";
|
|
10
|
+
export { onAllowed, assertAllowed, assertAuthorityLive, withExecutionLease } from "./action.js";
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @auctra/sdk — Authority Protocol client (Stage 1.0 modular layout). */
|
|
2
|
-
export declare const AUCTRA_SDK_VERSION = "0.7.
|
|
2
|
+
export declare const AUCTRA_SDK_VERSION = "0.7.13";
|
|
3
3
|
/** Production API + console host (Architecture A: colocated on app.auctra.tech). */
|
|
4
4
|
export declare const DEFAULT_BASE_URL = "https://app.auctra.tech";
|
|
5
5
|
export type AgentEnvironment = "dev" | "staging" | "production";
|
package/dist/esm/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** @auctra/sdk — Authority Protocol client (Stage 1.0 modular layout). */
|
|
2
|
-
export const AUCTRA_SDK_VERSION = "0.7.
|
|
2
|
+
export const AUCTRA_SDK_VERSION = "0.7.13";
|
|
3
3
|
/** Production API + console host (Architecture A: colocated on app.auctra.tech). */
|
|
4
4
|
export const DEFAULT_BASE_URL = "https://app.auctra.tech";
|
package/package.json
CHANGED
package/src/action.ts
CHANGED
|
@@ -28,6 +28,43 @@ export function assertAllowed(
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
export type ExecutionLeaseConsumer = {
|
|
32
|
+
consumeExecutionLease: (input: {
|
|
33
|
+
lease: string;
|
|
34
|
+
expectedActionType?: string;
|
|
35
|
+
}) => Promise<{ ok: boolean; error?: string; reason_codes?: string[] }>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Bypass-closure helper (TEST-018): require ALLOW + execution_lease, consume once, then run.
|
|
40
|
+
* Credential proxies must use this (or mcp-gateway) so standing secrets never sit in the agent.
|
|
41
|
+
*/
|
|
42
|
+
export async function withExecutionLease<T>(
|
|
43
|
+
client: ExecutionLeaseConsumer,
|
|
44
|
+
decision: EvaluateActionResponse,
|
|
45
|
+
callback: (allowed: EvaluateActionResponse) => Promise<T> | T,
|
|
46
|
+
options?: { expectedActionType?: string },
|
|
47
|
+
): Promise<T> {
|
|
48
|
+
assertAllowed(decision);
|
|
49
|
+
const token = decision.execution_lease?.token;
|
|
50
|
+
if (!token) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
"Auctra refused side effect: execution_lease missing — configure AUCTRA_EXECUTION_LEASE_SECRET and a lease-gated proxy",
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
const consumed = await client.consumeExecutionLease({
|
|
56
|
+
lease: token,
|
|
57
|
+
expectedActionType: options?.expectedActionType ?? decision.execution_lease?.action_type,
|
|
58
|
+
});
|
|
59
|
+
if (!consumed.ok) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`Auctra refused side effect: execution lease consume failed` +
|
|
62
|
+
(consumed.error ? ` (${consumed.error})` : ""),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return callback(decision);
|
|
66
|
+
}
|
|
67
|
+
|
|
31
68
|
export type AuthorityLivenessClient = {
|
|
32
69
|
getAuthorityLiveness: (authorityId: string) => Promise<{ live: boolean; status: string }>;
|
|
33
70
|
};
|
package/src/index.ts
CHANGED
|
@@ -8,5 +8,5 @@ export { AUCTRA_SDK_VERSION, DEFAULT_BASE_URL } from "./types.js";
|
|
|
8
8
|
export type * from "./types.js";
|
|
9
9
|
export { AuctraApiError, verifyMandateArtifact, verifyDecisionArtifact } from "./artifacts.js";
|
|
10
10
|
export { Auctra } from "./client.js";
|
|
11
|
-
export { onAllowed, assertAllowed, assertAuthorityLive } from "./action.js";
|
|
11
|
+
export { onAllowed, assertAllowed, assertAuthorityLive, withExecutionLease } from "./action.js";
|
|
12
12
|
export type { AuthorityLivenessClient } from "./action.js";
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @auctra/sdk — Authority Protocol client (Stage 1.0 modular layout). */
|
|
2
2
|
|
|
3
|
-
export const AUCTRA_SDK_VERSION = "0.7.
|
|
3
|
+
export const AUCTRA_SDK_VERSION = "0.7.13";
|
|
4
4
|
|
|
5
5
|
/** Production API + console host (Architecture A: colocated on app.auctra.tech). */
|
|
6
6
|
export const DEFAULT_BASE_URL = "https://app.auctra.tech";
|