@extrovert.dev/sdk 0.1.0-pre.8 → 0.1.0-pre.9
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 +4 -4
- package/dist/index.cjs +28 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -8
- package/dist/index.d.ts +18 -8
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* on 429/5xx, honors `Retry-After`, and surfaces every failure as a typed {@link ApiError}.
|
|
7
7
|
*/
|
|
8
8
|
/** The library version, surfaced in the User-Agent. Kept in sync with package.json by build. */
|
|
9
|
-
declare const SDK_VERSION = "0.1.0-pre.
|
|
9
|
+
declare const SDK_VERSION = "0.1.0-pre.9";
|
|
10
10
|
interface RetryOptions {
|
|
11
11
|
/** Max retry attempts for idempotent requests on 429/5xx/network errors. Default 2. */
|
|
12
12
|
maxRetries: number;
|
|
@@ -930,6 +930,12 @@ interface ListReviewEventsParams {
|
|
|
930
930
|
* agent-attributed: the deliberate cross-agent-404 exception. Opaque ids only.
|
|
931
931
|
*/
|
|
932
932
|
interface Category {
|
|
933
|
+
/** Logical accepted messages in this authorized project, counted by creation time. */
|
|
934
|
+
message_count_7d?: number;
|
|
935
|
+
message_count_30d?: number;
|
|
936
|
+
message_count_90d?: number;
|
|
937
|
+
last_used_at?: string;
|
|
938
|
+
pending_review_count?: number;
|
|
933
939
|
id: string;
|
|
934
940
|
name: string;
|
|
935
941
|
description: string;
|
|
@@ -946,6 +952,9 @@ interface Category {
|
|
|
946
952
|
}
|
|
947
953
|
/** Browse filter for the category registry (spec §5.5). */
|
|
948
954
|
interface ListCategoriesParams {
|
|
955
|
+
sort?: "popular" | "messages_7d" | "messages_90d" | "last_used" | "pending_reviews" | "name";
|
|
956
|
+
limit?: number;
|
|
957
|
+
page?: string;
|
|
949
958
|
/** Pure lexical substring filter over name+description (every token must match; NO LLM). */
|
|
950
959
|
match?: string;
|
|
951
960
|
}
|
|
@@ -1232,8 +1241,8 @@ interface RuleSnapshot extends Page<Rule> {
|
|
|
1232
1241
|
*
|
|
1233
1242
|
* Layering (org/project): an agent-plane save is ALWAYS project-layer: the saved
|
|
1234
1243
|
* rule's `rule_layer` is `project`, bound to the calling key's project. There is no
|
|
1235
|
-
* settable `rule_layer` here:
|
|
1236
|
-
*
|
|
1244
|
+
* settable `rule_layer` here: this method cannot create org-layer rules. Use learnFromReview for
|
|
1245
|
+
* authenticated reviewer feedback, including organization house style.
|
|
1237
1246
|
* (`scope: "general"` still means a house-style rule WITHIN the project layer :
|
|
1238
1247
|
* `scope` is the category axis, `rule_layer` is the ownership axis.)
|
|
1239
1248
|
*/
|
|
@@ -2262,6 +2271,7 @@ declare class MockBackend {
|
|
|
2262
2271
|
* is a pure lexical filter (every token must appear in name+description) - NO LLM,
|
|
2263
2272
|
* mirroring the server.
|
|
2264
2273
|
*/
|
|
2274
|
+
private categoryUsage;
|
|
2265
2275
|
listCategories(params?: ListCategoriesParams): Page<Category>;
|
|
2266
2276
|
/** Get one category (mock), or undefined when not found. */
|
|
2267
2277
|
getCategory(categoryId: string): Category | undefined;
|
|
@@ -3286,8 +3296,8 @@ declare class Rules {
|
|
|
3286
3296
|
/**
|
|
3287
3297
|
* Save / edit a rule (append-only by supersession; D11). An agent-plane save is
|
|
3288
3298
|
* ALWAYS project-layer: the saved rule's `rule_layer` is `project`, bound to the
|
|
3289
|
-
* key's project. For
|
|
3290
|
-
*
|
|
3299
|
+
* key's project. For all authenticated reviewer feedback use learnFromReview at the intended
|
|
3300
|
+
* organization, project, or category scope. This method is project maintenance only.
|
|
3291
3301
|
*/
|
|
3292
3302
|
save(req: SaveRuleRequest, signal?: AbortSignal): Promise<Rule>;
|
|
3293
3303
|
/** Promote a rule between the category and general/house-style layers. */
|
|
@@ -3990,7 +4000,7 @@ declare function signWebhook(secret: string, body: string, timestampSeconds: num
|
|
|
3990
4000
|
*
|
|
3991
4001
|
* ## Provisional, pre-1.0 (0.x)
|
|
3992
4002
|
*
|
|
3993
|
-
* {@link CONTRACT_VERSION} is **`0.1.0-pre.
|
|
4003
|
+
* {@link CONTRACT_VERSION} is **`0.1.0-pre.9`** - a deliberately **provisional**, pre-1.0
|
|
3994
4004
|
* contract. It is open and documented, but it MAY still evolve before 1.0: there
|
|
3995
4005
|
* are no external users yet, and the **D20 shared-pool auto-send governor** is a
|
|
3996
4006
|
* hard prerequisite before onboarding external users. Pin the version; expect
|
|
@@ -4047,12 +4057,12 @@ interface DiffJson {
|
|
|
4047
4057
|
/**
|
|
4048
4058
|
* The published version of the Extrovert Review-Loop open contract (D14).
|
|
4049
4059
|
*
|
|
4050
|
-
* **`0.1.0-pre.
|
|
4060
|
+
* **`0.1.0-pre.9` - PROVISIONAL, pre-1.0.** Versioned *with the SDK* (this package's
|
|
4051
4061
|
* `package.json` version) and aligned to the openapi `info.version`. Open and
|
|
4052
4062
|
* documented, but MAY still evolve before 1.0 (no external users yet; the D20
|
|
4053
4063
|
* shared-pool governor is required before external users). Pin it.
|
|
4054
4064
|
*/
|
|
4055
|
-
declare const CONTRACT_VERSION: "0.1.0-pre.
|
|
4065
|
+
declare const CONTRACT_VERSION: "0.1.0-pre.9";
|
|
4056
4066
|
/** The stability posture of a published contract version. */
|
|
4057
4067
|
type ContractStability = "provisional" | "stable";
|
|
4058
4068
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* on 429/5xx, honors `Retry-After`, and surfaces every failure as a typed {@link ApiError}.
|
|
7
7
|
*/
|
|
8
8
|
/** The library version, surfaced in the User-Agent. Kept in sync with package.json by build. */
|
|
9
|
-
declare const SDK_VERSION = "0.1.0-pre.
|
|
9
|
+
declare const SDK_VERSION = "0.1.0-pre.9";
|
|
10
10
|
interface RetryOptions {
|
|
11
11
|
/** Max retry attempts for idempotent requests on 429/5xx/network errors. Default 2. */
|
|
12
12
|
maxRetries: number;
|
|
@@ -930,6 +930,12 @@ interface ListReviewEventsParams {
|
|
|
930
930
|
* agent-attributed: the deliberate cross-agent-404 exception. Opaque ids only.
|
|
931
931
|
*/
|
|
932
932
|
interface Category {
|
|
933
|
+
/** Logical accepted messages in this authorized project, counted by creation time. */
|
|
934
|
+
message_count_7d?: number;
|
|
935
|
+
message_count_30d?: number;
|
|
936
|
+
message_count_90d?: number;
|
|
937
|
+
last_used_at?: string;
|
|
938
|
+
pending_review_count?: number;
|
|
933
939
|
id: string;
|
|
934
940
|
name: string;
|
|
935
941
|
description: string;
|
|
@@ -946,6 +952,9 @@ interface Category {
|
|
|
946
952
|
}
|
|
947
953
|
/** Browse filter for the category registry (spec §5.5). */
|
|
948
954
|
interface ListCategoriesParams {
|
|
955
|
+
sort?: "popular" | "messages_7d" | "messages_90d" | "last_used" | "pending_reviews" | "name";
|
|
956
|
+
limit?: number;
|
|
957
|
+
page?: string;
|
|
949
958
|
/** Pure lexical substring filter over name+description (every token must match; NO LLM). */
|
|
950
959
|
match?: string;
|
|
951
960
|
}
|
|
@@ -1232,8 +1241,8 @@ interface RuleSnapshot extends Page<Rule> {
|
|
|
1232
1241
|
*
|
|
1233
1242
|
* Layering (org/project): an agent-plane save is ALWAYS project-layer: the saved
|
|
1234
1243
|
* rule's `rule_layer` is `project`, bound to the calling key's project. There is no
|
|
1235
|
-
* settable `rule_layer` here:
|
|
1236
|
-
*
|
|
1244
|
+
* settable `rule_layer` here: this method cannot create org-layer rules. Use learnFromReview for
|
|
1245
|
+
* authenticated reviewer feedback, including organization house style.
|
|
1237
1246
|
* (`scope: "general"` still means a house-style rule WITHIN the project layer :
|
|
1238
1247
|
* `scope` is the category axis, `rule_layer` is the ownership axis.)
|
|
1239
1248
|
*/
|
|
@@ -2262,6 +2271,7 @@ declare class MockBackend {
|
|
|
2262
2271
|
* is a pure lexical filter (every token must appear in name+description) - NO LLM,
|
|
2263
2272
|
* mirroring the server.
|
|
2264
2273
|
*/
|
|
2274
|
+
private categoryUsage;
|
|
2265
2275
|
listCategories(params?: ListCategoriesParams): Page<Category>;
|
|
2266
2276
|
/** Get one category (mock), or undefined when not found. */
|
|
2267
2277
|
getCategory(categoryId: string): Category | undefined;
|
|
@@ -3286,8 +3296,8 @@ declare class Rules {
|
|
|
3286
3296
|
/**
|
|
3287
3297
|
* Save / edit a rule (append-only by supersession; D11). An agent-plane save is
|
|
3288
3298
|
* ALWAYS project-layer: the saved rule's `rule_layer` is `project`, bound to the
|
|
3289
|
-
* key's project. For
|
|
3290
|
-
*
|
|
3299
|
+
* key's project. For all authenticated reviewer feedback use learnFromReview at the intended
|
|
3300
|
+
* organization, project, or category scope. This method is project maintenance only.
|
|
3291
3301
|
*/
|
|
3292
3302
|
save(req: SaveRuleRequest, signal?: AbortSignal): Promise<Rule>;
|
|
3293
3303
|
/** Promote a rule between the category and general/house-style layers. */
|
|
@@ -3990,7 +4000,7 @@ declare function signWebhook(secret: string, body: string, timestampSeconds: num
|
|
|
3990
4000
|
*
|
|
3991
4001
|
* ## Provisional, pre-1.0 (0.x)
|
|
3992
4002
|
*
|
|
3993
|
-
* {@link CONTRACT_VERSION} is **`0.1.0-pre.
|
|
4003
|
+
* {@link CONTRACT_VERSION} is **`0.1.0-pre.9`** - a deliberately **provisional**, pre-1.0
|
|
3994
4004
|
* contract. It is open and documented, but it MAY still evolve before 1.0: there
|
|
3995
4005
|
* are no external users yet, and the **D20 shared-pool auto-send governor** is a
|
|
3996
4006
|
* hard prerequisite before onboarding external users. Pin the version; expect
|
|
@@ -4047,12 +4057,12 @@ interface DiffJson {
|
|
|
4047
4057
|
/**
|
|
4048
4058
|
* The published version of the Extrovert Review-Loop open contract (D14).
|
|
4049
4059
|
*
|
|
4050
|
-
* **`0.1.0-pre.
|
|
4060
|
+
* **`0.1.0-pre.9` - PROVISIONAL, pre-1.0.** Versioned *with the SDK* (this package's
|
|
4051
4061
|
* `package.json` version) and aligned to the openapi `info.version`. Open and
|
|
4052
4062
|
* documented, but MAY still evolve before 1.0 (no external users yet; the D20
|
|
4053
4063
|
* shared-pool governor is required before external users). Pin it.
|
|
4054
4064
|
*/
|
|
4055
|
-
declare const CONTRACT_VERSION: "0.1.0-pre.
|
|
4065
|
+
declare const CONTRACT_VERSION: "0.1.0-pre.9";
|
|
4056
4066
|
/** The stability posture of a published contract version. */
|
|
4057
4067
|
type ContractStability = "provisional" | "stable";
|
|
4058
4068
|
/**
|
package/dist/index.js
CHANGED
|
@@ -266,7 +266,7 @@ var CURRENT_API_VERSION = "2026-06-23";
|
|
|
266
266
|
var API_VERSION_HEADER = "Extrovert-Version";
|
|
267
267
|
|
|
268
268
|
// src/http.ts
|
|
269
|
-
var SDK_VERSION = "0.1.0-pre.
|
|
269
|
+
var SDK_VERSION = "0.1.0-pre.9";
|
|
270
270
|
function buildUrl(baseUrl, path, query) {
|
|
271
271
|
const base = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
272
272
|
const rel = path.startsWith("/") ? path : `/${path}`;
|
|
@@ -1819,8 +1819,21 @@ var MockBackend = class {
|
|
|
1819
1819
|
* is a pure lexical filter (every token must appear in name+description) - NO LLM,
|
|
1820
1820
|
* mirroring the server.
|
|
1821
1821
|
*/
|
|
1822
|
+
categoryUsage(category) {
|
|
1823
|
+
const now2 = Date.now();
|
|
1824
|
+
const rows = [...this.state.reviews.values()].filter((r) => r.category_id === category.id && Date.parse(r.created_at) <= now2);
|
|
1825
|
+
const count = (days) => rows.filter((r) => Date.parse(r.created_at) >= now2 - days * 864e5).length;
|
|
1826
|
+
return {
|
|
1827
|
+
...category,
|
|
1828
|
+
message_count_7d: count(7),
|
|
1829
|
+
message_count_30d: count(30),
|
|
1830
|
+
message_count_90d: count(90),
|
|
1831
|
+
last_used_at: rows.map((r) => r.created_at).sort().slice(-1)[0],
|
|
1832
|
+
pending_review_count: rows.filter((r) => ["needs_review", "in_review", "chatting", "rejected", "stale", "approved"].includes(r.state)).length
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1822
1835
|
listCategories(params = {}) {
|
|
1823
|
-
let items = [...this.state.categories.values()].filter((c) => !c.merged_into).sort((a, b) => b.created_at.localeCompare(a.created_at));
|
|
1836
|
+
let items = [...this.state.categories.values()].filter((c) => !c.merged_into).map((c) => this.categoryUsage(c)).sort((a, b) => b.created_at.localeCompare(a.created_at));
|
|
1824
1837
|
const tokens = (params.match ?? "").trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
1825
1838
|
if (tokens.length) {
|
|
1826
1839
|
items = items.filter((c) => {
|
|
@@ -1828,15 +1841,22 @@ var MockBackend = class {
|
|
|
1828
1841
|
return tokens.every((t) => hay.includes(t));
|
|
1829
1842
|
});
|
|
1830
1843
|
}
|
|
1831
|
-
|
|
1844
|
+
const field = { messages_7d: "message_count_7d", messages_90d: "message_count_90d", pending_reviews: "pending_review_count" }[params.sort] ?? "message_count_30d";
|
|
1845
|
+
items.sort((a, b) => (params.sort === "name" ? a.name.toLowerCase().localeCompare(b.name.toLowerCase()) : params.sort === "last_used" ? 0 : (b[field] ?? 0) - (a[field] ?? 0)) || (b.last_used_at ?? "").localeCompare(a.last_used_at ?? "") || a.id.localeCompare(b.id));
|
|
1846
|
+
const offset = params.page ? JSON.parse(Buffer.from(params.page, "base64url").toString()).o : 0;
|
|
1847
|
+
const total = items.length, limit = params.limit ?? 100;
|
|
1848
|
+
const next = offset + limit < total ? Buffer.from(JSON.stringify({ o: offset + limit, v: 1 })).toString("base64url") : void 0;
|
|
1849
|
+
return { items: items.slice(offset, offset + limit), total, next_cursor: next };
|
|
1832
1850
|
}
|
|
1833
1851
|
/** Get one category (mock), or undefined when not found. */
|
|
1834
1852
|
getCategory(categoryId) {
|
|
1835
|
-
|
|
1853
|
+
const category = this.state.categories.get(categoryId);
|
|
1854
|
+
return category ? this.categoryUsage(category) : void 0;
|
|
1836
1855
|
}
|
|
1837
1856
|
/** Propose a category (mock): stands immediately, author_kind=agent (D9). */
|
|
1838
1857
|
proposeCategory(req) {
|
|
1839
1858
|
const name = req.name.trim();
|
|
1859
|
+
if ([...this.state.categories.values()].some((c) => !c.merged_into && c.name.toLowerCase() === name.toLowerCase())) throw new ConflictError({ status: 409, code: "conflict", message: "Category name already exists; browse and reuse it." });
|
|
1840
1860
|
if (!name) {
|
|
1841
1861
|
throw new ValidationError({ status: 400, code: "invalid", message: "name is required" });
|
|
1842
1862
|
}
|
|
@@ -3804,7 +3824,7 @@ var HttpTransport = class {
|
|
|
3804
3824
|
});
|
|
3805
3825
|
}
|
|
3806
3826
|
listCategories(params, signal) {
|
|
3807
|
-
return this.call({ method: "GET", path: "/v1/categories", query: {
|
|
3827
|
+
return this.call({ method: "GET", path: "/v1/categories", query: { ...params }, signal });
|
|
3808
3828
|
}
|
|
3809
3829
|
getCategory(categoryId, signal) {
|
|
3810
3830
|
return this.call({ method: "GET", path: `/v1/categories/${encodeURIComponent(categoryId)}`, signal });
|
|
@@ -5313,8 +5333,8 @@ var Rules = class {
|
|
|
5313
5333
|
/**
|
|
5314
5334
|
* Save / edit a rule (append-only by supersession; D11). An agent-plane save is
|
|
5315
5335
|
* ALWAYS project-layer: the saved rule's `rule_layer` is `project`, bound to the
|
|
5316
|
-
* key's project. For
|
|
5317
|
-
*
|
|
5336
|
+
* key's project. For all authenticated reviewer feedback use learnFromReview at the intended
|
|
5337
|
+
* organization, project, or category scope. This method is project maintenance only.
|
|
5318
5338
|
*/
|
|
5319
5339
|
save(req, signal) {
|
|
5320
5340
|
return this.ctx.transport.saveRule(req, signal);
|
|
@@ -5591,7 +5611,7 @@ async function signWebhook(secret, body, timestampSeconds) {
|
|
|
5591
5611
|
}
|
|
5592
5612
|
|
|
5593
5613
|
// src/contract.ts
|
|
5594
|
-
var CONTRACT_VERSION = "0.1.0-pre.
|
|
5614
|
+
var CONTRACT_VERSION = "0.1.0-pre.9";
|
|
5595
5615
|
var CONTRACT_MANIFEST = {
|
|
5596
5616
|
name: "extrovert.review-loop",
|
|
5597
5617
|
version: CONTRACT_VERSION,
|