Skip to content

Commit 92a7d13

Browse files
feat: Polish and publish the Config Registry API
Stainless-Generated-From: 3d8a50cc016bcb9c3bf48df787a8dcdd23acdebf
1 parent 725bcc8 commit 92a7d13

5 files changed

Lines changed: 43 additions & 17 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 163
1+
configured_endpoints: 164

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Methods:
9393

9494
- <code title="get /config-registry/analyses/{id}">client.configRegistry.analyses.<a href="./src/resources/config-registry/analyses.ts">retrieve</a>(id) -> ConfigRegistryResponse</code>
9595
- <code title="get /config-registry/analyses">client.configRegistry.analyses.<a href="./src/resources/config-registry/analyses.ts">list</a>({ ...params }) -> AnalysisSummariesOffsetPagination</code>
96+
- <code title="post /config-registry/analyses/{id}/cancel">client.configRegistry.analyses.<a href="./src/resources/config-registry/analyses.ts">cancel</a>(id) -> ConfigRegistryResponse</code>
9697

9798
# Browsers
9899

src/resources/config-registry/analyses.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ export class Analyses extends APIResource {
4747
{ query, ...options },
4848
);
4949
}
50+
51+
/**
52+
* Requests cancellation of a running project-scoped analysis. Cancellation is
53+
* asynchronous; poll the analysis until its status becomes canceled. Repeating the
54+
* request after the analysis reaches a terminal state returns the existing
55+
* outcome.
56+
*
57+
* @example
58+
* ```ts
59+
* const configRegistryResponse =
60+
* await client.configRegistry.analyses.cancel('id');
61+
* ```
62+
*/
63+
cancel(id: string, options?: RequestOptions): APIPromise<ConfigRegistryAPI.ConfigRegistryResponse> {
64+
return this._client.post(path`/config-registry/analyses/${id}/cancel`, options);
65+
}
5066
}
5167

5268
export interface AnalysisListParams extends OffsetPaginationParams {

src/resources/config-registry/config-registry.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ export interface Evidence {
214214
success_rate: number;
215215

216216
/**
217-
* Most recent contributing run where this config met the success threshold.
218-
* Omitted for knowledge assembled from runs that did not independently meet the
219-
* threshold.
217+
* Most recent contributing run whose evidence supported recommending this
218+
* configuration. Omitted when no individual run independently met the
219+
* recommendation threshold.
220220
*/
221-
last_verified_at?: string | null;
221+
last_supported_at?: string | null;
222222
}
223223

224224
export interface LookupRequest {
@@ -459,7 +459,9 @@ export interface Recommendation {
459459
evidence: Evidence;
460460

461461
/**
462-
* Specificity of knowledge matched for this recommendation.
462+
* Specificity of knowledge matched for this recommendation. Exact matches use
463+
* knowledge for the requested target; host and domain matches use broader fallback
464+
* knowledge.
463465
*/
464466
match_scope: 'exact' | 'host' | 'domain';
465467

@@ -474,13 +476,6 @@ export interface Recommendation {
474476
proxy: Proxy;
475477

476478
type: 'recommendation';
477-
478-
/**
479-
* Exact matches meet the evidence threshold; host and domain fallbacks are
480-
* inferred. Check evidence.last_verified_at for successful verification age and
481-
* last_observed_at for the latest evidence.
482-
*/
483-
verification: 'verified' | 'inferred';
484479
}
485480

486481
/**
@@ -548,8 +543,9 @@ export interface ResolveRequest {
548543
* any non-HTTPS destination as off-site and will not drive an http one. Kernel
549544
* uses it to drive the browser further into the site, where it can observe
550545
* protections that only appear once a session interacts. When this target already
551-
* has a verified configuration, the run confirms that one instead of re-deriving
552-
* the whole matrix, so supplying an intent narrows what can be recommended.
546+
* has a recommended configuration, the run confirms that one instead of
547+
* re-deriving the whole matrix, so supplying an intent narrows what can be
548+
* recommended.
553549
*/
554550
intent?: string;
555551
}
@@ -615,8 +611,9 @@ export interface ConfigRegistryResolveParams {
615611
* any non-HTTPS destination as off-site and will not drive an http one. Kernel
616612
* uses it to drive the browser further into the site, where it can observe
617613
* protections that only appear once a session interacts. When this target already
618-
* has a verified configuration, the run confirms that one instead of re-deriving
619-
* the whole matrix, so supplying an intent narrows what can be recommended.
614+
* has a recommended configuration, the run confirms that one instead of
615+
* re-deriving the whole matrix, so supplying an intent narrows what can be
616+
* recommended.
620617
*/
621618
intent?: string;
622619
}

tests/api-resources/config-registry/analyses.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,16 @@ describe('resource analyses', () => {
4646
),
4747
).rejects.toThrow(Kernel.NotFoundError);
4848
});
49+
50+
// Mock server tests are disabled
51+
test.skip('cancel', async () => {
52+
const responsePromise = client.configRegistry.analyses.cancel('id');
53+
const rawResponse = await responsePromise.asResponse();
54+
expect(rawResponse).toBeInstanceOf(Response);
55+
const response = await responsePromise;
56+
expect(response).not.toBeInstanceOf(Response);
57+
const dataAndResponse = await responsePromise.withResponse();
58+
expect(dataAndResponse.data).toBe(response);
59+
expect(dataAndResponse.response).toBe(rawResponse);
60+
});
4961
});

0 commit comments

Comments
 (0)