wicked-core-ts 0.7.4 → 0.7.5
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/index.d.ts +100 -5
- package/package.json +8 -7
package/index.d.ts
CHANGED
|
@@ -311,8 +311,35 @@ export declare class Core {
|
|
|
311
311
|
recallKnowledge(query: string, k: number): Promise<string>
|
|
312
312
|
/** All registered governance policies, as a JSON array of `Policy` objects. */
|
|
313
313
|
listPolicies(): Promise<string>
|
|
314
|
-
/**
|
|
315
|
-
|
|
314
|
+
/**
|
|
315
|
+
* All conformance rules on the store (Pattern + Policy types), as a JSON array of
|
|
316
|
+
* serialized `ConformanceRule` objects — severity-first (critical→info), then weight DESC
|
|
317
|
+
* within a band, then id. The rows carry the unified steering-rule model's fields
|
|
318
|
+
* (steering_type / applies_to / excludes / weight / effect / trigger / obligations /
|
|
319
|
+
* criteria / provenance / …) exactly as the model serializes them — default-valued steering
|
|
320
|
+
* fields are elided on the wire (absent steering_type ⇒ "architecture", absent weight ⇒ 1).
|
|
321
|
+
*
|
|
322
|
+
* Steering facets (the studio Steering surface's list):
|
|
323
|
+
* - `steeringType` filters on the rule's `steering_type` — one of architecture | development |
|
|
324
|
+
* security | testing | operations | compliance | design-ux. A rule authored before the
|
|
325
|
+
* field existed counts as `"architecture"` (the model's serde default); an unknown value
|
|
326
|
+
* REJECTS (fails closed — a typo must not read as "no rules of that type").
|
|
327
|
+
* - `includeRetired: true` adds withdrawn rules (retire-not-delete: they still explain the
|
|
328
|
+
* past decisions that cite them; recall/enforcement never returns them).
|
|
329
|
+
*
|
|
330
|
+
* Both omitted ⇒ the exact pre-0.7.5 behavior (every active rule).
|
|
331
|
+
*/
|
|
332
|
+
listConformanceRules(steeringType?: string | undefined | null, includeRetired?: boolean | undefined | null): Promise<string>
|
|
333
|
+
/**
|
|
334
|
+
* The doctrine RuleSet parents (AW-13 grouping) as a JSON array of
|
|
335
|
+
* `{ domain, rule_ids, rule_count }` rows, domain-sorted. The array length is the wiki
|
|
336
|
+
* meta's `ruleset_count` (crew's `countRuleSets` resolved `null` on engine builds without
|
|
337
|
+
* this binding — "cannot count" must never impersonate "0"); the rows carry `Contains`
|
|
338
|
+
* membership so grouping renders without a second round-trip. Membership is the store's
|
|
339
|
+
* edges verbatim — a retired rule stays listed in its RuleSet (grouping is doc structure,
|
|
340
|
+
* not enforcement). Read-only connection; never blocks the single-writer actor.
|
|
341
|
+
*/
|
|
342
|
+
listRuleSets(): Promise<string>
|
|
316
343
|
/** All conformance claims (governance decisions) on the store, as a JSON array. */
|
|
317
344
|
listConformanceClaims(): Promise<string>
|
|
318
345
|
/**
|
|
@@ -340,10 +367,77 @@ export declare class Core {
|
|
|
340
367
|
upsertPolicy(policyJson: string): Promise<string>
|
|
341
368
|
/**
|
|
342
369
|
* Upsert a conformance rule. `rule_json` is a JSON-serialized `ConformanceRule` object
|
|
343
|
-
* (fields: id, rule_type, statement, severity, confidence, targets, provenance
|
|
344
|
-
*
|
|
370
|
+
* (fields: id, rule_type, statement, severity, confidence, targets, provenance — plus the
|
|
371
|
+
* unified steering-rule fields: steering_type, applies_to, excludes, weight, and the
|
|
372
|
+
* optional effect / trigger / obligations / criteria; a rule without `effect` stays
|
|
373
|
+
* recall-only). The JSON passes through un-projected — the model's own serde is the wire
|
|
374
|
+
* contract, so new steering fields ride this binding without a rebuild. Provenance is
|
|
375
|
+
* first-class for UI/chat-authored rules too (`provenance.source: "ui" | "chat"`), not just
|
|
376
|
+
* doc-ingested `path@sha#id` rows. Validates server-side (INV-C1/C2/C4). Idempotent on
|
|
377
|
+
* stable id.
|
|
345
378
|
*/
|
|
346
379
|
upsertConformanceRule(ruleJson: string): Promise<string>
|
|
380
|
+
/**
|
|
381
|
+
* STEERING batch import (the unified steering-rule model). `batch_json` is a JSON
|
|
382
|
+
* `{ default_type: string | null, entries: [...] }` document where each entry is either a
|
|
383
|
+
* frontmattered markdown doc (`{ kind: "doc", name?, content }` — parsed by the SAME
|
|
384
|
+
* MarkdownAdapter/normalize path `rules ingest --dir` runs, provenance `path@sha#id` refs
|
|
385
|
+
* included) or a ready rule object (`{ kind: "rule", rule }` — the rule JSON passes to the
|
|
386
|
+
* upsert path un-projected, so new model fields ride through without a rebuild).
|
|
387
|
+
* `default_type` is applied as the `steering_type` of every rule whose entry omits one; a
|
|
388
|
+
* rule that names its own type keeps it.
|
|
389
|
+
*
|
|
390
|
+
* Fail-closed PER ENTRY: a bad entry (unparseable doc, invalid rule, INV violation,
|
|
391
|
+
* duplicate id within the batch) rejects ALONE with its reason — the rest still land; only
|
|
392
|
+
* a malformed batch envelope rejects the whole call. Every write goes through the
|
|
393
|
+
* single-writer actor (validate + `register_rule`). Resolves to a JSON array of per-entry
|
|
394
|
+
* results, batch order: `{ index, name?, status: "imported" | "rejected", ids?, error? }`
|
|
395
|
+
* (`ids` = the rule ids the entry minted — a doc can mint several; a rejected entry mints
|
|
396
|
+
* none). This binding is also crew's PRESENCE SENTINEL for the whole steering seam
|
|
397
|
+
* (`steeringSupported()`): it ships with the unified model, so its existence tells crew the
|
|
398
|
+
* engine round-trips the steering fields instead of silently dropping them.
|
|
399
|
+
*/
|
|
400
|
+
steeringImport(batchJson: string): Promise<string>
|
|
401
|
+
/**
|
|
402
|
+
* Governance rules eval — run an eval corpus through the REAL SELECT→DECIDE gate path and
|
|
403
|
+
* score every sample (the engine seam behind crew's `POST /api/v1/testing/evals/run`).
|
|
404
|
+
* `args_json` is `{ type?, corpus?, knowledgeDb?, dbPath }` (camelCase keys are the PINNED
|
|
405
|
+
* binding contract): `type` slices the corpus to one of the 7 steering types; `corpus`
|
|
406
|
+
* names an estate knowledge scope (`evals:<name>` — a corpus landed by
|
|
407
|
+
* [`Core::governance_corpus_import`]) or, omitted, selects the compiled-in default corpus;
|
|
408
|
+
* `knowledgeDb` powers embedding gap hints (absent/unusable ⇒ the report carries
|
|
409
|
+
* `degraded: "facet-only"` — an honest downgrade to keyword hints, never fabricated
|
|
410
|
+
* similarity); `dbPath` is the rules store, opened READ-ONLY — this call never goes through
|
|
411
|
+
* the single-writer actor and never writes either store.
|
|
412
|
+
*
|
|
413
|
+
* Resolves to the `EvalReport` JSON exactly as the engine serializes it (snake_case — crew
|
|
414
|
+
* passes it through verbatim as the pinned wire contract):
|
|
415
|
+
* `{ results: [{ sample: { id, description, kind, steering_type }, expected: "deny"|"allow",
|
|
416
|
+
* fired: [rule-id…], verdict: "caught"|"gap"|"false_positive", nearest_rules? }],
|
|
417
|
+
* summary: { total, caught, gaps, false_positives }, degraded: "facet-only"|null }`.
|
|
418
|
+
*
|
|
419
|
+
* Fail-closed: malformed args, an unknown steering type, a corpus name outside the
|
|
420
|
+
* `evals:` scope, or a missing store reject the Promise with the engine's reason — crew maps
|
|
421
|
+
* those to 400, and gates the whole route on this binding's PRESENCE (absent ⇒ 501).
|
|
422
|
+
*/
|
|
423
|
+
governanceEvals(argsJson: string): Promise<string>
|
|
424
|
+
/**
|
|
425
|
+
* Import an eval corpus into the estate knowledge store (the engine seam behind crew's
|
|
426
|
+
* `POST /api/v1/testing/corpora/import`). `args_json` is `{ name, samples, knowledgeDb? }`
|
|
427
|
+
* (camelCase keys are the PINNED binding contract): `samples` is an array of
|
|
428
|
+
* `{ id, description, kind: "good"|"bad", steering_type, signals: { phase?, tool?, files?,
|
|
429
|
+
* content? } }` — validated fail-closed as a whole corpus (blank/duplicate ids, unknown
|
|
430
|
+
* steering types reject the batch) and landed under scope `evals:<name>`, one chunk per
|
|
431
|
+
* sample, id-keyed (re-import upserts in place) WITH embeddings via the same
|
|
432
|
+
* `KnowledgeEngine` path the rules fan-out uses. `knowledgeDb` defaults to the operator's
|
|
433
|
+
* `~/.wicked-estate/knowledge.db`; tests must always pass a temp path.
|
|
434
|
+
*
|
|
435
|
+
* Resolves to the `ImportReceipt` JSON `{ imported, scope: "evals:<name>", embedded }` —
|
|
436
|
+
* `embedded` is VERIFIED against the durable store after the write handle drops, not
|
|
437
|
+
* asserted. Fail-closed on malformed args (crew maps that to 400; route presence-gates on
|
|
438
|
+
* this binding like [`Core::governance_evals`] — absent ⇒ 501).
|
|
439
|
+
*/
|
|
440
|
+
governanceCorpusImport(argsJson: string): Promise<string>
|
|
347
441
|
/**
|
|
348
442
|
* Withdraw a governance policy from enforcement (FINDING-038 — governance state was otherwise
|
|
349
443
|
* append-only, so a mis-authored policy denied forever).
|
|
@@ -383,7 +477,8 @@ export declare class Core {
|
|
|
383
477
|
registerWorkflow(json: string): Promise<string>
|
|
384
478
|
/**
|
|
385
479
|
* Recall which conformance rules apply to the given `query_json` (a JSON-serialized
|
|
386
|
-
* `RuleQuery` — fields: language, layer, framework, severity, rule_type;
|
|
480
|
+
* `RuleQuery` — fields: language, layer, framework, severity, rule_type, steering_type;
|
|
481
|
+
* all optional).
|
|
387
482
|
* An empty or whitespace `query_json` is treated as an all-rules query (no facet filters).
|
|
388
483
|
* Opens a read-only connection — does not block the single-writer actor. Returns a JSON
|
|
389
484
|
* array of `ConformanceRule` objects, severity-first then id.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wicked-core-ts",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "Node/TypeScript bindings (napi-rs) for wicked-core: drive the in-process orchestration engine from JS/TS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,14 +38,15 @@
|
|
|
38
38
|
"smoke": "node smoke.mjs",
|
|
39
39
|
"smoke:lifecycle": "node smoke-lifecycle.mjs",
|
|
40
40
|
"smoke:terminal": "node smoke-terminal.mjs",
|
|
41
|
-
"smoke:
|
|
41
|
+
"smoke:evals": "node smoke-evals.mjs",
|
|
42
|
+
"smoke:all": "node smoke.mjs && node smoke-lifecycle.mjs && node smoke-terminal.mjs && node smoke-evals.mjs"
|
|
42
43
|
},
|
|
43
44
|
"optionalDependencies": {
|
|
44
|
-
"wicked-core-ts-darwin-arm64": "0.7.
|
|
45
|
-
"wicked-core-ts-darwin-x64": "0.7.
|
|
46
|
-
"wicked-core-ts-linux-arm64-gnu": "0.7.
|
|
47
|
-
"wicked-core-ts-linux-x64-gnu": "0.7.
|
|
48
|
-
"wicked-core-ts-win32-x64-msvc": "0.7.
|
|
45
|
+
"wicked-core-ts-darwin-arm64": "0.7.5",
|
|
46
|
+
"wicked-core-ts-darwin-x64": "0.7.5",
|
|
47
|
+
"wicked-core-ts-linux-arm64-gnu": "0.7.5",
|
|
48
|
+
"wicked-core-ts-linux-x64-gnu": "0.7.5",
|
|
49
|
+
"wicked-core-ts-win32-x64-msvc": "0.7.5"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@napi-rs/cli": "^2.18.4"
|