@workglow/test-contract 0.6.1
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 +232 -0
- package/dist/ai-provider/assertions/capabilityHonesty.d.ts +7 -0
- package/dist/ai-provider/assertions/dispose.d.ts +7 -0
- package/dist/ai-provider/assertions/inferAdvertisesRegistered.d.ts +15 -0
- package/dist/ai-provider/assertions/inferServesInferred.d.ts +20 -0
- package/dist/ai-provider/assertions/pricingMatchesModality.d.ts +36 -0
- package/dist/ai-provider/assertions/registryCoverage.d.ts +13 -0
- package/dist/ai-provider/assertions/sessionReuse.d.ts +7 -0
- package/dist/ai-provider/assertions/signalHonoring.d.ts +7 -0
- package/dist/ai-provider/assertions/structuredGeneration.d.ts +7 -0
- package/dist/ai-provider/assertions/textGenerationSmoke.d.ts +7 -0
- package/dist/ai-provider/assertions/toolCallAccumulator.d.ts +7 -0
- package/dist/ai-provider/assertions/toolCallMultiTurn.d.ts +7 -0
- package/dist/ai-provider/assertions/usageNormalization.d.ts +61 -0
- package/dist/ai-provider/fixtures.d.ts +8 -0
- package/dist/ai-provider/runAiProviderConformance.d.ts +7 -0
- package/dist/ai-provider/types.d.ts +75 -0
- package/dist/ai-provider.d.ts +25 -0
- package/dist/ai-provider.js +876 -0
- package/dist/ai-provider.js.map +26 -0
- package/dist/browser-context/ConformanceMockContext.d.ts +54 -0
- package/dist/browser-context/assertions/ariaRoundTrip.d.ts +7 -0
- package/dist/browser-context/assertions/capabilityHonesty.d.ts +7 -0
- package/dist/browser-context/assertions/itExpectFail.d.ts +8 -0
- package/dist/browser-context/assertions/networkIntrospection.d.ts +7 -0
- package/dist/browser-context/assertions/tabsLifecycle.d.ts +7 -0
- package/dist/browser-context/fixtures.d.ts +8 -0
- package/dist/browser-context/runIBrowserContextConformance.d.ts +7 -0
- package/dist/browser-context/types.d.ts +48 -0
- package/dist/browser-context.d.ts +18 -0
- package/dist/browser-context.js +567 -0
- package/dist/browser-context.js.map +17 -0
- package/dist/creditExhaustedSkip.d.ts +39 -0
- package/dist/creditExhaustedSkip.js +163 -0
- package/dist/creditExhaustedSkip.js.map +10 -0
- package/dist/entitlement-profile/assertions/denialShape.d.ts +13 -0
- package/dist/entitlement-profile/assertions/dispose.d.ts +16 -0
- package/dist/entitlement-profile/assertions/hierarchyHonoring.d.ts +11 -0
- package/dist/entitlement-profile/assertions/optionalNeverDenied.d.ts +11 -0
- package/dist/entitlement-profile/assertions/requestEntitlementShape.d.ts +12 -0
- package/dist/entitlement-profile/assertions/resourceScoping.d.ts +16 -0
- package/dist/entitlement-profile/assertions/subscribeGrant.d.ts +11 -0
- package/dist/entitlement-profile/assertions/subscribeReload.d.ts +11 -0
- package/dist/entitlement-profile/assertions/subscribeRevocation.d.ts +12 -0
- package/dist/entitlement-profile/assertions/surfaceCoverage.d.ts +7 -0
- package/dist/entitlement-profile/assertions/unsubscribeIdempotent.d.ts +7 -0
- package/dist/entitlement-profile/fixtures.d.ts +21 -0
- package/dist/entitlement-profile/runEntitlementProfileConformance.d.ts +7 -0
- package/dist/entitlement-profile/types.d.ts +45 -0
- package/dist/entitlement-profile.d.ts +23 -0
- package/dist/entitlement-profile.js +436 -0
- package/dist/entitlement-profile.js.map +22 -0
- package/dist/human-connector/MockHumanConnector.d.ts +29 -0
- package/dist/human-connector/assertions/abort.d.ts +7 -0
- package/dist/human-connector/assertions/capabilityHonesty.d.ts +7 -0
- package/dist/human-connector/assertions/concurrentIsolation.d.ts +7 -0
- package/dist/human-connector/assertions/multiTurnFollowUp.d.ts +7 -0
- package/dist/human-connector/assertions/notifyDisplayFastResolve.d.ts +7 -0
- package/dist/human-connector/assertions/roundtrip.d.ts +7 -0
- package/dist/human-connector/fixtures.d.ts +8 -0
- package/dist/human-connector/runHumanConnectorConformance.d.ts +9 -0
- package/dist/human-connector/types.d.ts +91 -0
- package/dist/human-connector.d.ts +19 -0
- package/dist/human-connector.js +843 -0
- package/dist/human-connector.js.map +20 -0
- package/dist/itExpectFail.d.ts +15 -0
- package/dist/itExpectFail.js +180 -0
- package/dist/itExpectFail.js.map +11 -0
- package/dist/storage-migrations/assertions/appliesAndRecords.d.ts +7 -0
- package/dist/storage-migrations/assertions/concurrentRunsSerialize.d.ts +18 -0
- package/dist/storage-migrations/assertions/ensureBookkeepingIdempotent.d.ts +7 -0
- package/dist/storage-migrations/assertions/failedMigrationLeavesNoPartialSchema.d.ts +14 -0
- package/dist/storage-migrations/assertions/failedMigrationNotRecorded.d.ts +7 -0
- package/dist/storage-migrations/assertions/idempotentRun.d.ts +7 -0
- package/dist/storage-migrations/assertions/incrementalApplication.d.ts +7 -0
- package/dist/storage-migrations/runMigrationRunnerContract.d.ts +9 -0
- package/dist/storage-migrations/types.d.ts +78 -0
- package/dist/storage-migrations.d.ts +18 -0
- package/dist/storage-migrations.js +473 -0
- package/dist/storage-migrations.js.map +20 -0
- package/dist/tabular-migrations/assertions/addAndDropIndex.d.ts +7 -0
- package/dist/tabular-migrations/assertions/addColumn.d.ts +7 -0
- package/dist/tabular-migrations/assertions/backfill.d.ts +7 -0
- package/dist/tabular-migrations/assertions/dropColumn.d.ts +7 -0
- package/dist/tabular-migrations/assertions/failedMigrationNotRecorded.d.ts +7 -0
- package/dist/tabular-migrations/assertions/freshDbFastPath.d.ts +7 -0
- package/dist/tabular-migrations/assertions/incrementalApplication.d.ts +7 -0
- package/dist/tabular-migrations/assertions/renameColumn.d.ts +7 -0
- package/dist/tabular-migrations/runTabularMigrationContract.d.ts +8 -0
- package/dist/tabular-migrations/types.d.ts +28 -0
- package/dist/tabular-migrations.d.ts +19 -0
- package/dist/tabular-migrations.js +257 -0
- package/dist/tabular-migrations.js.map +18 -0
- package/dist/tabular-storage/assertions/countMatchesQuery.d.ts +7 -0
- package/dist/tabular-storage/assertions/guardParity.d.ts +25 -0
- package/dist/tabular-storage/assertions/inListCriterion.d.ts +14 -0
- package/dist/tabular-storage/assertions/joinBoundedLeftRead.d.ts +29 -0
- package/dist/tabular-storage/assertions/joinPushdown.d.ts +13 -0
- package/dist/tabular-storage/assertions/notInListCriterion.d.ts +15 -0
- package/dist/tabular-storage/assertions/strategyParity.d.ts +31 -0
- package/dist/tabular-storage/assertions/subscribeToChanges.d.ts +21 -0
- package/dist/tabular-storage/assertions/vectorColumnFormat.d.ts +7 -0
- package/dist/tabular-storage/assertions/withConnectionTransaction.d.ts +7 -0
- package/dist/tabular-storage/assertions/withTransactionRollback.d.ts +7 -0
- package/dist/tabular-storage/fixtures.d.ts +33 -0
- package/dist/tabular-storage/joinFixtures.d.ts +66 -0
- package/dist/tabular-storage/runTabularJoinContract.d.ts +24 -0
- package/dist/tabular-storage/runTabularStorageContract.d.ts +9 -0
- package/dist/tabular-storage/types.d.ts +102 -0
- package/dist/tabular-storage.d.ts +25 -0
- package/dist/tabular-storage.js +1477 -0
- package/dist/tabular-storage.js.map +27 -0
- package/dist/vector-storage/assertions/dimensionValidation.d.ts +17 -0
- package/dist/vector-storage/assertions/legacyEncoding.d.ts +16 -0
- package/dist/vector-storage/assertions/metadataFilter.d.ts +16 -0
- package/dist/vector-storage/assertions/searchOptions.d.ts +16 -0
- package/dist/vector-storage/assertions/shared.d.ts +23 -0
- package/dist/vector-storage/assertions/similarityRanking.d.ts +18 -0
- package/dist/vector-storage/assertions/similaritySearchEvent.d.ts +16 -0
- package/dist/vector-storage/assertions/vectorRoundTrip.d.ts +17 -0
- package/dist/vector-storage/runVectorStorageContract.d.ts +20 -0
- package/dist/vector-storage/types.d.ts +87 -0
- package/dist/vector-storage.d.ts +19 -0
- package/dist/vector-storage.js +412 -0
- package/dist/vector-storage.js.map +21 -0
- package/dist/web-search/assertions/capabilityAgreement.d.ts +23 -0
- package/dist/web-search/assertions/credentialNaming.d.ts +21 -0
- package/dist/web-search/assertions/dateFiltering.d.ts +22 -0
- package/dist/web-search/assertions/domainNormalization.d.ts +24 -0
- package/dist/web-search/assertions/maxResultsCeiling.d.ts +22 -0
- package/dist/web-search/assertions/reportedQuery.d.ts +18 -0
- package/dist/web-search/assertions/signalThreading.d.ts +20 -0
- package/dist/web-search/fixtures.d.ts +40 -0
- package/dist/web-search/runWebSearchProviderConformance.d.ts +24 -0
- package/dist/web-search/types.d.ts +79 -0
- package/dist/web-search.d.ts +19 -0
- package/dist/web-search.js +560 -0
- package/dist/web-search.js.map +18 -0
- package/dist/worker-proxy/assertions/backlogOrdering.d.ts +7 -0
- package/dist/worker-proxy/assertions/disposeTerminatesWorker.d.ts +8 -0
- package/dist/worker-proxy/assertions/errorPropagation.d.ts +7 -0
- package/dist/worker-proxy/assertions/providerCallHelpers.d.ts +23 -0
- package/dist/worker-proxy/browserOnlyStub.d.ts +7 -0
- package/dist/worker-proxy/runWorkerProxyBoundary.d.ts +7 -0
- package/dist/worker-proxy/types.d.ts +47 -0
- package/dist/worker-proxy.d.ts +16 -0
- package/dist/worker-proxy.js +389 -0
- package/dist/worker-proxy.js.map +17 -0
- package/package.json +120 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { IHumanConnector, IHumanRequest, IHumanResponse } from "@workglow/util";
|
|
7
|
+
import type { DataPortSchema } from "@workglow/util/schema";
|
|
8
|
+
/**
|
|
9
|
+
* Stable identifiers for each conformance assertion. Add to `expectedFailures`
|
|
10
|
+
* to mark an assertion as known-failing without skipping it.
|
|
11
|
+
*/
|
|
12
|
+
export type HumanConnectorAssertionId = "roundtrip.accept" | "roundtrip.decline" | "roundtrip.cancel" | "roundtrip.confirm.accept" | "roundtrip.confirm.decline" | "roundtrip.confirm.details" | "roundtrip.confirm.noContent" | "abort.beforeSend" | "abort.midElicit" | "concurrent.isolation" | "notify.fastResolve" | "display.fastResolve" | "multiTurn.followUp" | "capabilityHonesty";
|
|
13
|
+
export interface HumanConnectorCapabilities {
|
|
14
|
+
/** Connector handles `kind: "elicit"` requests with a real human-driven response. */
|
|
15
|
+
readonly elicit: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Connector handles `kind: "confirm"` requests with a real human decision.
|
|
18
|
+
* A connector without a native approval primitive may map it onto its
|
|
19
|
+
* elicitation path and still declare true — what it must not do is answer
|
|
20
|
+
* "accept" without asking anyone.
|
|
21
|
+
*/
|
|
22
|
+
readonly confirm: boolean;
|
|
23
|
+
/** Connector handles `kind: "notify"` requests (fast-resolve, no script consumption). */
|
|
24
|
+
readonly notify: boolean;
|
|
25
|
+
/** Connector handles `kind: "display"` requests (fast-resolve, no script consumption). */
|
|
26
|
+
readonly display: boolean;
|
|
27
|
+
/** Connector implements `followUp()` for multi-turn elicit conversations. */
|
|
28
|
+
readonly multiTurn: boolean;
|
|
29
|
+
/** Connector correctly isolates concurrent in-flight `send()` calls. */
|
|
30
|
+
readonly concurrent: boolean;
|
|
31
|
+
/** Connector honors `AbortSignal` while an elicit is in flight (mid-flight abort). */
|
|
32
|
+
readonly abortMidElicit: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Either an exact response, or a request-aware function. FIFO consumption.
|
|
36
|
+
*/
|
|
37
|
+
export type MockResponseEntry = IHumanResponse | ((req: IHumanRequest) => IHumanResponse | Promise<IHumanResponse>);
|
|
38
|
+
/**
|
|
39
|
+
* Test-side handle for driving the human side of an `IHumanConnector`. Every
|
|
40
|
+
* adapter wired into the conformance suite must expose a `MockResponseScript`
|
|
41
|
+
* — for `MockHumanConnector` it's the connector's own queue; for real
|
|
42
|
+
* adapters (e.g. McpElicitationConnector) the factory wires `push(...)` to
|
|
43
|
+
* the paired UI's response.
|
|
44
|
+
*/
|
|
45
|
+
export interface MockResponseScript {
|
|
46
|
+
/** Push an exact response or a request-aware response function. FIFO. */
|
|
47
|
+
push(entry: MockResponseEntry): void;
|
|
48
|
+
/**
|
|
49
|
+
* Push a deferred handle. The next `send()` blocks until `release(response)`
|
|
50
|
+
* is called. Releasing after the awaiting `send()` has rejected is a no-op.
|
|
51
|
+
*/
|
|
52
|
+
pushDeferred(): {
|
|
53
|
+
release(response: IHumanResponse): void;
|
|
54
|
+
};
|
|
55
|
+
/** Inspect what was sent (in order received). */
|
|
56
|
+
readonly received: ReadonlyArray<IHumanRequest>;
|
|
57
|
+
/** Reset between tests (clears queue and received history). */
|
|
58
|
+
clear(): void;
|
|
59
|
+
}
|
|
60
|
+
export interface HumanConnectorConformanceHandle {
|
|
61
|
+
readonly connector: IHumanConnector;
|
|
62
|
+
readonly script: MockResponseScript;
|
|
63
|
+
dispose(): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
export interface ConformanceFixture {
|
|
66
|
+
/** Default elicit form schema. */
|
|
67
|
+
readonly elicitContentSchema: DataPortSchema;
|
|
68
|
+
/** Default content data the script returns when accepting an elicit. */
|
|
69
|
+
readonly elicitAcceptContent: Record<string, unknown>;
|
|
70
|
+
/** Default notify request payload. */
|
|
71
|
+
readonly notifyRequest: Pick<IHumanRequest, "message" | "contentSchema" | "contentData">;
|
|
72
|
+
/** Default display request payload. */
|
|
73
|
+
readonly displayRequest: Pick<IHumanRequest, "message" | "contentSchema" | "contentData">;
|
|
74
|
+
/** Default confirm request payload — the action awaiting approval. */
|
|
75
|
+
readonly confirmRequest: Pick<IHumanRequest, "message" | "contentSchema" | "contentData">;
|
|
76
|
+
/** Bound for abort propagation (ms). */
|
|
77
|
+
readonly abortGraceMs: number;
|
|
78
|
+
}
|
|
79
|
+
export interface HumanConnectorConformanceOpts {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly skip?: boolean;
|
|
82
|
+
readonly timeout: number;
|
|
83
|
+
readonly factory: () => Promise<HumanConnectorConformanceHandle>;
|
|
84
|
+
readonly capabilities: HumanConnectorCapabilities;
|
|
85
|
+
readonly fixture?: Partial<ConformanceFixture>;
|
|
86
|
+
/**
|
|
87
|
+
* Assertions known to fail. Each named id is wrapped in `it.fails` instead
|
|
88
|
+
* of `it`. Remove the entry once the adapter bug is fixed.
|
|
89
|
+
*/
|
|
90
|
+
readonly expectedFailures?: ReadonlyArray<HumanConnectorAssertionId>;
|
|
91
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Conformance suite for `IHumanConnector` — the round trip of every prompt kind,
|
|
8
|
+
* multi-turn follow-up, concurrency isolation and abort.
|
|
9
|
+
*/
|
|
10
|
+
export * from "./human-connector/MockHumanConnector";
|
|
11
|
+
export * from "./human-connector/fixtures";
|
|
12
|
+
export * from "./human-connector/runHumanConnectorConformance";
|
|
13
|
+
export * from "./human-connector/types";
|
|
14
|
+
export * from "./human-connector/assertions/abort";
|
|
15
|
+
export * from "./human-connector/assertions/capabilityHonesty";
|
|
16
|
+
export * from "./human-connector/assertions/concurrentIsolation";
|
|
17
|
+
export * from "./human-connector/assertions/multiTurnFollowUp";
|
|
18
|
+
export * from "./human-connector/assertions/notifyDisplayFastResolve";
|
|
19
|
+
export * from "./human-connector/assertions/roundtrip";
|