@harapter/core 0.1.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/LICENSE +201 -0
- package/README.md +111 -0
- package/dist/contracts.d.ts +258 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +2 -0
- package/dist/contracts.js.map +1 -0
- package/dist/errors.d.ts +37 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/extensions.d.ts +29 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +59 -0
- package/dist/extensions.js.map +1 -0
- package/dist/identifiers.d.ts +38 -0
- package/dist/identifiers.d.ts.map +1 -0
- package/dist/identifiers.js +45 -0
- package/dist/identifiers.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/ownership.d.ts +18 -0
- package/dist/ownership.d.ts.map +1 -0
- package/dist/ownership.js +34 -0
- package/dist/ownership.js.map +1 -0
- package/dist/registry.d.ts +27 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +234 -0
- package/dist/registry.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AA6BA;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,CAAmB;IACvB,SAAS,CAAU;IACnB,UAAU,CAAyB;IACnC,SAAS,CAAwB;IACjC,YAAY,CAAqB;IACjC,OAAO,CAAgD;IAEhE;;;;OAIG;IACH,YACE,IAAsB,EACtB,OAAe,EACf,OAA4B;QAE5B,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,KAAK,YAAY,YAAY,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ProviderExtensionDescriptor, ProviderExtensionRegistry } from './contracts.js';
|
|
2
|
+
import type { ProviderId } from './identifiers.js';
|
|
3
|
+
/** Mutable Adapter-side registry exposed to callers through read-only lookup. */
|
|
4
|
+
export declare class ExtensionRegistry implements ProviderExtensionRegistry {
|
|
5
|
+
private readonly ownerProviderId;
|
|
6
|
+
private readonly entries;
|
|
7
|
+
/** @param ownerProviderId - Provider allowed to register entries. */
|
|
8
|
+
constructor(ownerProviderId: ProviderId);
|
|
9
|
+
/**
|
|
10
|
+
* Register one typed extension until its disposer runs.
|
|
11
|
+
* @param descriptor - Provider-owned discoverable metadata.
|
|
12
|
+
* @param value - Typed extension implementation.
|
|
13
|
+
* @returns Idempotent disposer for this exact registration.
|
|
14
|
+
*/
|
|
15
|
+
register(descriptor: ProviderExtensionDescriptor, value: unknown): () => void;
|
|
16
|
+
/** @returns Detached descriptors in registration order. */
|
|
17
|
+
list(): readonly ProviderExtensionDescriptor[];
|
|
18
|
+
/**
|
|
19
|
+
* @param name - Provider-namespaced extension name.
|
|
20
|
+
* @returns Whether the extension is registered.
|
|
21
|
+
*/
|
|
22
|
+
has(name: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @param name - Provider-namespaced extension name.
|
|
25
|
+
* @returns The registered typed implementation, if present.
|
|
26
|
+
*/
|
|
27
|
+
get<T>(name: string, guard?: (value: unknown) => value is T): T | undefined;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../src/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAOnD,iFAAiF;AACjF,qBAAa,iBAAkB,YAAW,yBAAyB;IAIrD,OAAO,CAAC,QAAQ,CAAC,eAAe;IAH5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAE7D,qEAAqE;gBACxC,eAAe,EAAE,UAAU;IAExD;;;;;OAKG;IACH,QAAQ,CACN,UAAU,EAAE,2BAA2B,EACvC,KAAK,EAAE,OAAO,GACb,MAAM,IAAI;IA4Bb,2DAA2D;IAC3D,IAAI,IAAI,SAAS,2BAA2B,EAAE;IAM9C;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS;CAO5E"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { HarnessError } from './errors.js';
|
|
2
|
+
/** Mutable Adapter-side registry exposed to callers through read-only lookup. */
|
|
3
|
+
export class ExtensionRegistry {
|
|
4
|
+
ownerProviderId;
|
|
5
|
+
entries = new Map();
|
|
6
|
+
/** @param ownerProviderId - Provider allowed to register entries. */
|
|
7
|
+
constructor(ownerProviderId) {
|
|
8
|
+
this.ownerProviderId = ownerProviderId;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Register one typed extension until its disposer runs.
|
|
12
|
+
* @param descriptor - Provider-owned discoverable metadata.
|
|
13
|
+
* @param value - Typed extension implementation.
|
|
14
|
+
* @returns Idempotent disposer for this exact registration.
|
|
15
|
+
*/
|
|
16
|
+
register(descriptor, value) {
|
|
17
|
+
if (descriptor.providerId !== this.ownerProviderId) {
|
|
18
|
+
throw new HarnessError('invalid_request', 'Extension Provider does not match its registry owner.', { retryable: false, providerId: this.ownerProviderId });
|
|
19
|
+
}
|
|
20
|
+
if (this.entries.has(descriptor.name)) {
|
|
21
|
+
throw new HarnessError('invalid_request', `Extension ${descriptor.name} is already registered.`, { retryable: false, providerId: this.ownerProviderId });
|
|
22
|
+
}
|
|
23
|
+
const entry = {
|
|
24
|
+
descriptor: { ...descriptor },
|
|
25
|
+
value,
|
|
26
|
+
};
|
|
27
|
+
this.entries.set(descriptor.name, entry);
|
|
28
|
+
return () => {
|
|
29
|
+
if (this.entries.get(descriptor.name) === entry) {
|
|
30
|
+
this.entries.delete(descriptor.name);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** @returns Detached descriptors in registration order. */
|
|
35
|
+
list() {
|
|
36
|
+
return [...this.entries.values()].map(({ descriptor }) => ({
|
|
37
|
+
...descriptor,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param name - Provider-namespaced extension name.
|
|
42
|
+
* @returns Whether the extension is registered.
|
|
43
|
+
*/
|
|
44
|
+
has(name) {
|
|
45
|
+
return this.entries.has(name);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @param name - Provider-namespaced extension name.
|
|
49
|
+
* @returns The registered typed implementation, if present.
|
|
50
|
+
*/
|
|
51
|
+
get(name, guard) {
|
|
52
|
+
const value = this.entries.get(name)?.value;
|
|
53
|
+
if (value === undefined || (guard !== undefined && !guard(value))) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../src/extensions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,iFAAiF;AACjF,MAAM,OAAO,iBAAiB;IAIC;IAHZ,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE7D,qEAAqE;IACrE,YAA6B,eAA2B;QAA3B,oBAAe,GAAf,eAAe,CAAY;IAAG,CAAC;IAE5D;;;;;OAKG;IACH,QAAQ,CACN,UAAuC,EACvC,KAAc;QAEd,IAAI,UAAU,CAAC,UAAU,KAAK,IAAI,CAAC,eAAe,EAAE,CAAC;YACnD,MAAM,IAAI,YAAY,CACpB,iBAAiB,EACjB,uDAAuD,EACvD,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,CACvD,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,YAAY,CACpB,iBAAiB,EACjB,aAAa,UAAU,CAAC,IAAI,yBAAyB,EACrD,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,CACvD,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAmB;YAC5B,UAAU,EAAE,EAAE,GAAG,UAAU,EAAE;YAC7B,KAAK;SACN,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzC,OAAO,GAAG,EAAE;YACV,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;gBAChD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACvC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,2DAA2D;IAC3D,IAAI;QACF,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;YACzD,GAAG,UAAU;SACd,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,GAAG,CAAI,IAAY,EAAE,KAAsC;QACzD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;QAC5C,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAClE,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,KAAU,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare const opaqueIdentifier: unique symbol;
|
|
2
|
+
type OpaqueIdentifier<Name extends string> = string & {
|
|
3
|
+
readonly [opaqueIdentifier]: Name;
|
|
4
|
+
};
|
|
5
|
+
/** Stable identifier for a dynamically registered Provider Adapter. */
|
|
6
|
+
export type ProviderId = OpaqueIdentifier<'ProviderId'>;
|
|
7
|
+
/** Stable host-scoped identifier for one connection profile. */
|
|
8
|
+
export type ProfileId = OpaqueIdentifier<'ProfileId'>;
|
|
9
|
+
/** Opaque Provider-owned session identifier. */
|
|
10
|
+
export type ProviderSessionId = OpaqueIdentifier<'ProviderSessionId'>;
|
|
11
|
+
/** Client-scoped identifier for one portable run. */
|
|
12
|
+
export type RunId = OpaqueIdentifier<'RunId'>;
|
|
13
|
+
/**
|
|
14
|
+
* Validate and brand a Provider identifier without assigning meaning to it.
|
|
15
|
+
* @param value - Dynamic Provider identifier.
|
|
16
|
+
* @returns The unchanged opaque identifier.
|
|
17
|
+
*/
|
|
18
|
+
export declare function providerId(value: string): ProviderId;
|
|
19
|
+
/**
|
|
20
|
+
* Validate and brand a Profile identifier.
|
|
21
|
+
* @param value - Host-scoped Profile identifier.
|
|
22
|
+
* @returns The unchanged opaque identifier.
|
|
23
|
+
*/
|
|
24
|
+
export declare function profileId(value: string): ProfileId;
|
|
25
|
+
/**
|
|
26
|
+
* Validate and brand an opaque Provider session identifier.
|
|
27
|
+
* @param value - Provider-native identifier.
|
|
28
|
+
* @returns The unchanged opaque identifier.
|
|
29
|
+
*/
|
|
30
|
+
export declare function providerSessionId(value: string): ProviderSessionId;
|
|
31
|
+
/**
|
|
32
|
+
* Validate and brand a client-scoped run identifier.
|
|
33
|
+
* @param value - Run identifier.
|
|
34
|
+
* @returns The unchanged opaque identifier.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runId(value: string): RunId;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=identifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,gBAAgB,EAAE,OAAO,MAAM,CAAC;AAE9C,KAAK,gBAAgB,CAAC,IAAI,SAAS,MAAM,IAAI,MAAM,GAAG;IACpD,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;CACnC,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAExD,gEAAgE;AAChE,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAEtD,gDAAgD;AAChD,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;AAEtE,qDAAqD;AACrD,MAAM,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAU9C;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAGpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAGlD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAGlE;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAG1C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { HarnessError } from './errors.js';
|
|
2
|
+
function validateIdentifier(value, label) {
|
|
3
|
+
if (value.length === 0 || value.trim() !== value) {
|
|
4
|
+
throw new HarnessError('invalid_request', `${label} is invalid.`, {
|
|
5
|
+
retryable: false,
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Validate and brand a Provider identifier without assigning meaning to it.
|
|
11
|
+
* @param value - Dynamic Provider identifier.
|
|
12
|
+
* @returns The unchanged opaque identifier.
|
|
13
|
+
*/
|
|
14
|
+
export function providerId(value) {
|
|
15
|
+
validateIdentifier(value, 'providerId');
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validate and brand a Profile identifier.
|
|
20
|
+
* @param value - Host-scoped Profile identifier.
|
|
21
|
+
* @returns The unchanged opaque identifier.
|
|
22
|
+
*/
|
|
23
|
+
export function profileId(value) {
|
|
24
|
+
validateIdentifier(value, 'profileId');
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validate and brand an opaque Provider session identifier.
|
|
29
|
+
* @param value - Provider-native identifier.
|
|
30
|
+
* @returns The unchanged opaque identifier.
|
|
31
|
+
*/
|
|
32
|
+
export function providerSessionId(value) {
|
|
33
|
+
validateIdentifier(value, 'providerSessionId');
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Validate and brand a client-scoped run identifier.
|
|
38
|
+
* @param value - Run identifier.
|
|
39
|
+
* @returns The unchanged opaque identifier.
|
|
40
|
+
*/
|
|
41
|
+
export function runId(value) {
|
|
42
|
+
validateIdentifier(value, 'runId');
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=identifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAoB3C,SAAS,kBAAkB,CAAC,KAAa,EAAE,KAAa;IACtD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC;QACjD,MAAM,IAAI,YAAY,CAAC,iBAAiB,EAAE,GAAG,KAAK,cAAc,EAAE;YAChE,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,kBAAkB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACxC,OAAO,KAAmB,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACvC,OAAO,KAAkB,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IAC/C,OAAO,KAA0B,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,KAAc,CAAC;AACxB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { CancelResult, CapabilityManifest, CapabilityMode, CapabilityProbeOptions, CapabilityRequirement, CapabilityStatus, ClientDescriptor, CompatibilityWarning, ConnectionKind, CreateSessionInput, HarnessClient, HarnessEvent, HarnessEventType, HarnessInput, HarnessProfile, HarnessRun, HarnessSession, InputPart, InteractionRequest, InteractionResponse, ModelSelection, ProviderAdapterFactory, ProviderConnection, ProviderDescriptor, ProviderExtensionDescriptor, ProviderExtensionRegistry, RunOptions, RunRef, RunResult, SecretRef, SessionRef, UsageSummary, WorkspaceRef, } from './contracts.js';
|
|
2
|
+
export { HarnessError, isHarnessError, type HarnessErrorCode, type HarnessErrorOptions, } from './errors.js';
|
|
3
|
+
export { ExtensionRegistry } from './extensions.js';
|
|
4
|
+
export { profileId, providerId, providerSessionId, runId, type ProfileId, type ProviderId, type ProviderSessionId, type RunId, } from './identifiers.js';
|
|
5
|
+
export { assertSessionCompatibility, assertSessionOwnership, } from './ownership.js';
|
|
6
|
+
export { HarnessRegistry } from './registry.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,MAAM,EACN,SAAS,EACT,SAAS,EACT,UAAU,EACV,YAAY,EACZ,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,KAAK,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,KAAK,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { HarnessError, isHarnessError, } from './errors.js';
|
|
2
|
+
export { ExtensionRegistry } from './extensions.js';
|
|
3
|
+
export { profileId, providerId, providerSessionId, runId, } from './identifiers.js';
|
|
4
|
+
export { assertSessionCompatibility, assertSessionOwnership, } from './ownership.js';
|
|
5
|
+
export { HarnessRegistry } from './registry.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmCA,OAAO,EACL,YAAY,EACZ,cAAc,GAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,KAAK,GAKN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SessionRef } from './contracts.js';
|
|
2
|
+
import type { ProfileId, ProviderId } from './identifiers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Refuse a Session reference that is not owned by the active Provider/Profile.
|
|
5
|
+
* Adapters call this before sending any resume traffic.
|
|
6
|
+
* @param ref - Opaque Session reference supplied by a host.
|
|
7
|
+
* @param expectedProviderId - Active Adapter identity.
|
|
8
|
+
* @param expectedProfileId - Active Profile identity.
|
|
9
|
+
*/
|
|
10
|
+
export declare function assertSessionOwnership(ref: SessionRef, expectedProviderId: ProviderId, expectedProfileId: ProfileId): void;
|
|
11
|
+
/**
|
|
12
|
+
* Refuse a Session reference created under another runtime compatibility
|
|
13
|
+
* identity. Adapters call this when they emit a compatibility reference.
|
|
14
|
+
* @param ref - Opaque Session reference supplied by a host.
|
|
15
|
+
* @param expectedCompatibilityRef - Active runtime or protocol fingerprint.
|
|
16
|
+
*/
|
|
17
|
+
export declare function assertSessionCompatibility(ref: SessionRef, expectedCompatibilityRef: string): void;
|
|
18
|
+
//# sourceMappingURL=ownership.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../src/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,UAAU,EACf,kBAAkB,EAAE,UAAU,EAC9B,iBAAiB,EAAE,SAAS,GAC3B,IAAI,CAeN;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,UAAU,EACf,wBAAwB,EAAE,MAAM,GAC/B,IAAI,CAYN"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HarnessError } from './errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Refuse a Session reference that is not owned by the active Provider/Profile.
|
|
4
|
+
* Adapters call this before sending any resume traffic.
|
|
5
|
+
* @param ref - Opaque Session reference supplied by a host.
|
|
6
|
+
* @param expectedProviderId - Active Adapter identity.
|
|
7
|
+
* @param expectedProfileId - Active Profile identity.
|
|
8
|
+
*/
|
|
9
|
+
export function assertSessionOwnership(ref, expectedProviderId, expectedProfileId) {
|
|
10
|
+
if (ref.providerId !== expectedProviderId ||
|
|
11
|
+
ref.profileId !== expectedProfileId) {
|
|
12
|
+
throw new HarnessError('session_provider_mismatch', 'Session reference is not owned by the active Provider and Profile.', {
|
|
13
|
+
retryable: false,
|
|
14
|
+
providerId: expectedProviderId,
|
|
15
|
+
profileId: expectedProfileId,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Refuse a Session reference created under another runtime compatibility
|
|
21
|
+
* identity. Adapters call this when they emit a compatibility reference.
|
|
22
|
+
* @param ref - Opaque Session reference supplied by a host.
|
|
23
|
+
* @param expectedCompatibilityRef - Active runtime or protocol fingerprint.
|
|
24
|
+
*/
|
|
25
|
+
export function assertSessionCompatibility(ref, expectedCompatibilityRef) {
|
|
26
|
+
if (ref.compatibilityRef !== expectedCompatibilityRef) {
|
|
27
|
+
throw new HarnessError('session_provider_mismatch', 'Session reference is not compatible with the active runtime.', {
|
|
28
|
+
retryable: false,
|
|
29
|
+
providerId: ref.providerId,
|
|
30
|
+
profileId: ref.profileId,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ownership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownership.js","sourceRoot":"","sources":["../src/ownership.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,GAAe,EACf,kBAA8B,EAC9B,iBAA4B;IAE5B,IACE,GAAG,CAAC,UAAU,KAAK,kBAAkB;QACrC,GAAG,CAAC,SAAS,KAAK,iBAAiB,EACnC,CAAC;QACD,MAAM,IAAI,YAAY,CACpB,2BAA2B,EAC3B,oEAAoE,EACpE;YACE,SAAS,EAAE,KAAK;YAChB,UAAU,EAAE,kBAAkB;YAC9B,SAAS,EAAE,iBAAiB;SAC7B,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,GAAe,EACf,wBAAgC;IAEhC,IAAI,GAAG,CAAC,gBAAgB,KAAK,wBAAwB,EAAE,CAAC;QACtD,MAAM,IAAI,YAAY,CACpB,2BAA2B,EAC3B,8DAA8D,EAC9D;YACE,SAAS,EAAE,KAAK;YAChB,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HarnessClient, HarnessProfile, ProviderAdapterFactory, ProviderDescriptor } from './contracts.js';
|
|
2
|
+
import type { ProviderId } from './identifiers.js';
|
|
3
|
+
/** Dynamic Provider Adapter registry with Profile and capability validation. */
|
|
4
|
+
export declare class HarnessRegistry {
|
|
5
|
+
private readonly entries;
|
|
6
|
+
/**
|
|
7
|
+
* Register one Provider Adapter factory.
|
|
8
|
+
* @param factory - Independently versioned Adapter factory.
|
|
9
|
+
*/
|
|
10
|
+
register(factory: ProviderAdapterFactory): void;
|
|
11
|
+
/** @param providerId - Dynamic Provider identifier to remove. */
|
|
12
|
+
unregister(providerId: ProviderId): void;
|
|
13
|
+
/** @returns Detached descriptors in registration order. */
|
|
14
|
+
listProviders(): readonly ProviderDescriptor[];
|
|
15
|
+
/**
|
|
16
|
+
* @param providerId - Dynamic Provider identifier.
|
|
17
|
+
* @returns A detached descriptor when registered.
|
|
18
|
+
*/
|
|
19
|
+
getProvider(providerId: ProviderId): ProviderDescriptor | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Connect a Profile and reject inconsistent identity or required capabilities.
|
|
22
|
+
* @param profile - Host-owned connection configuration.
|
|
23
|
+
* @returns A validated active Client.
|
|
24
|
+
*/
|
|
25
|
+
connect(profile: HarnessProfile): Promise<HarnessClient>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAOnD,gFAAgF;AAChF,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwC;IAEhE;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI;IAa/C,iEAAiE;IACjE,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAIxC,2DAA2D;IAC3D,aAAa,IAAI,SAAS,kBAAkB,EAAE;IAM9C;;;OAGG;IACH,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,kBAAkB,GAAG,SAAS;IAKnE;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAoH/D"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { HarnessError, isHarnessError } from './errors.js';
|
|
2
|
+
/** Dynamic Provider Adapter registry with Profile and capability validation. */
|
|
3
|
+
export class HarnessRegistry {
|
|
4
|
+
entries = new Map();
|
|
5
|
+
/**
|
|
6
|
+
* Register one Provider Adapter factory.
|
|
7
|
+
* @param factory - Independently versioned Adapter factory.
|
|
8
|
+
*/
|
|
9
|
+
register(factory) {
|
|
10
|
+
const descriptor = cloneDescriptor(factory.descriptor());
|
|
11
|
+
validateDescriptor(descriptor);
|
|
12
|
+
if (this.entries.has(descriptor.providerId)) {
|
|
13
|
+
throw new HarnessError('invalid_request', `Provider ${descriptor.providerId} is already registered.`, { retryable: false, providerId: descriptor.providerId });
|
|
14
|
+
}
|
|
15
|
+
this.entries.set(descriptor.providerId, { descriptor, factory });
|
|
16
|
+
}
|
|
17
|
+
/** @param providerId - Dynamic Provider identifier to remove. */
|
|
18
|
+
unregister(providerId) {
|
|
19
|
+
this.entries.delete(providerId);
|
|
20
|
+
}
|
|
21
|
+
/** @returns Detached descriptors in registration order. */
|
|
22
|
+
listProviders() {
|
|
23
|
+
return [...this.entries.values()].map(({ descriptor }) => cloneDescriptor(descriptor));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @param providerId - Dynamic Provider identifier.
|
|
27
|
+
* @returns A detached descriptor when registered.
|
|
28
|
+
*/
|
|
29
|
+
getProvider(providerId) {
|
|
30
|
+
const descriptor = this.entries.get(providerId)?.descriptor;
|
|
31
|
+
return descriptor === undefined ? undefined : cloneDescriptor(descriptor);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Connect a Profile and reject inconsistent identity or required capabilities.
|
|
35
|
+
* @param profile - Host-owned connection configuration.
|
|
36
|
+
* @returns A validated active Client.
|
|
37
|
+
*/
|
|
38
|
+
async connect(profile) {
|
|
39
|
+
const requestedProfile = cloneProfile(profile);
|
|
40
|
+
validateProfile(requestedProfile);
|
|
41
|
+
const entry = this.entries.get(requestedProfile.providerId);
|
|
42
|
+
if (entry === undefined) {
|
|
43
|
+
throw new HarnessError('provider_not_found', `Provider ${requestedProfile.providerId} is not registered.`, {
|
|
44
|
+
retryable: false,
|
|
45
|
+
providerId: requestedProfile.providerId,
|
|
46
|
+
profileId: requestedProfile.profileId,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (!entry.descriptor.connectionKinds.includes(requestedProfile.connection.kind)) {
|
|
50
|
+
throw new HarnessError('profile_invalid', `Provider ${requestedProfile.providerId} does not accept ${requestedProfile.connection.kind} connections.`, {
|
|
51
|
+
retryable: false,
|
|
52
|
+
providerId: requestedProfile.providerId,
|
|
53
|
+
profileId: requestedProfile.profileId,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
let client;
|
|
57
|
+
try {
|
|
58
|
+
client = await entry.factory.connect(cloneProfile(requestedProfile));
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (isHarnessError(error))
|
|
62
|
+
throw error;
|
|
63
|
+
throw new HarnessError('connection_failed', 'Provider connection failed before a Client became available.', {
|
|
64
|
+
retryable: true,
|
|
65
|
+
providerId: requestedProfile.providerId,
|
|
66
|
+
profileId: requestedProfile.profileId,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const clientDescriptor = await probeConnectedClient(client, requestedProfile, 'descriptor', () => client.descriptor());
|
|
70
|
+
if (!isRecord(clientDescriptor) ||
|
|
71
|
+
clientDescriptor['providerId'] !== requestedProfile.providerId ||
|
|
72
|
+
clientDescriptor['profileId'] !== requestedProfile.profileId ||
|
|
73
|
+
clientDescriptor['connectionKind'] !== requestedProfile.connection.kind) {
|
|
74
|
+
return rejectConnectedClient(client, new HarnessError('provider_api_incompatible', 'Connected Client identity does not match the requested Profile.', {
|
|
75
|
+
retryable: false,
|
|
76
|
+
providerId: requestedProfile.providerId,
|
|
77
|
+
profileId: requestedProfile.profileId,
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
const manifest = await probeConnectedClient(client, requestedProfile, 'capabilities', () => client.capabilities());
|
|
81
|
+
if (!isCapabilityManifest(manifest) ||
|
|
82
|
+
manifest.providerId !== requestedProfile.providerId ||
|
|
83
|
+
manifest.profileId !== requestedProfile.profileId) {
|
|
84
|
+
return rejectConnectedClient(client, new HarnessError('provider_api_incompatible', 'Capability identity does not match the requested Profile.', {
|
|
85
|
+
retryable: false,
|
|
86
|
+
providerId: requestedProfile.providerId,
|
|
87
|
+
profileId: requestedProfile.profileId,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
const unmet = findUnmetCapability(manifest, requestedProfile);
|
|
91
|
+
if (unmet !== undefined) {
|
|
92
|
+
return rejectConnectedClient(client, new HarnessError('unsupported_capability', `Required capability ${unmet} is unavailable.`, {
|
|
93
|
+
retryable: false,
|
|
94
|
+
providerId: requestedProfile.providerId,
|
|
95
|
+
profileId: requestedProfile.profileId,
|
|
96
|
+
details: { capability: unmet },
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
return client;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function cloneProfile(profile) {
|
|
103
|
+
return {
|
|
104
|
+
profileId: profile.profileId,
|
|
105
|
+
displayName: profile.displayName,
|
|
106
|
+
providerId: profile.providerId,
|
|
107
|
+
connection: cloneConnection(profile.connection),
|
|
108
|
+
...(profile.providerOptions === undefined
|
|
109
|
+
? {}
|
|
110
|
+
: { providerOptions: { ...profile.providerOptions } }),
|
|
111
|
+
...(profile.requiredCapabilities === undefined
|
|
112
|
+
? {}
|
|
113
|
+
: {
|
|
114
|
+
requiredCapabilities: profile.requiredCapabilities.map((requirement) => ({
|
|
115
|
+
name: requirement.name,
|
|
116
|
+
...(requirement.acceptedModes === undefined
|
|
117
|
+
? {}
|
|
118
|
+
: { acceptedModes: [...requirement.acceptedModes] }),
|
|
119
|
+
})),
|
|
120
|
+
}),
|
|
121
|
+
...(profile.metadata === undefined
|
|
122
|
+
? {}
|
|
123
|
+
: { metadata: { ...profile.metadata } }),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function cloneConnection(connection) {
|
|
127
|
+
switch (connection.kind) {
|
|
128
|
+
case 'sdk':
|
|
129
|
+
return { ...connection };
|
|
130
|
+
case 'process':
|
|
131
|
+
return {
|
|
132
|
+
...connection,
|
|
133
|
+
...(connection.args === undefined
|
|
134
|
+
? {}
|
|
135
|
+
: { args: [...connection.args] }),
|
|
136
|
+
...(connection.envRefs === undefined
|
|
137
|
+
? {}
|
|
138
|
+
: {
|
|
139
|
+
envRefs: Object.fromEntries(Object.entries(connection.envRefs).map(([name, ref]) => [
|
|
140
|
+
name,
|
|
141
|
+
{ ...ref },
|
|
142
|
+
])),
|
|
143
|
+
}),
|
|
144
|
+
};
|
|
145
|
+
case 'endpoint':
|
|
146
|
+
case 'local_socket':
|
|
147
|
+
return {
|
|
148
|
+
...connection,
|
|
149
|
+
...(connection.authRef === undefined
|
|
150
|
+
? {}
|
|
151
|
+
: { authRef: { ...connection.authRef } }),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function cloneDescriptor(descriptor) {
|
|
156
|
+
return {
|
|
157
|
+
...descriptor,
|
|
158
|
+
connectionKinds: [...descriptor.connectionKinds],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function validateDescriptor(descriptor) {
|
|
162
|
+
if (descriptor.providerId.length === 0 ||
|
|
163
|
+
descriptor.displayName.trim().length === 0 ||
|
|
164
|
+
descriptor.connectionKinds.length === 0) {
|
|
165
|
+
throw new HarnessError('invalid_request', 'Provider descriptor is incomplete.', { retryable: false, providerId: descriptor.providerId });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function validateProfile(profile) {
|
|
169
|
+
if (profile.profileId.length === 0 ||
|
|
170
|
+
profile.providerId.length === 0 ||
|
|
171
|
+
profile.displayName.trim().length === 0) {
|
|
172
|
+
throw new HarnessError('profile_invalid', 'Profile is incomplete.', {
|
|
173
|
+
retryable: false,
|
|
174
|
+
providerId: profile.providerId,
|
|
175
|
+
profileId: profile.profileId,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function findUnmetCapability(manifest, profile) {
|
|
180
|
+
for (const requirement of profile.requiredCapabilities ?? []) {
|
|
181
|
+
const acceptedModes = requirement.acceptedModes ?? ['native'];
|
|
182
|
+
const observed = manifest.capabilities[requirement.name];
|
|
183
|
+
if (!isRecord(observed) ||
|
|
184
|
+
typeof observed.mode !== 'string' ||
|
|
185
|
+
!acceptedModes.includes(observed.mode)) {
|
|
186
|
+
return requirement.name;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
function isCapabilityManifest(value) {
|
|
192
|
+
return (isRecord(value) &&
|
|
193
|
+
typeof value['providerId'] === 'string' &&
|
|
194
|
+
typeof value['profileId'] === 'string' &&
|
|
195
|
+
isRecord(value['capabilities']) &&
|
|
196
|
+
typeof value['observedAt'] === 'string');
|
|
197
|
+
}
|
|
198
|
+
function isRecord(value) {
|
|
199
|
+
return typeof value === 'object' && value !== null;
|
|
200
|
+
}
|
|
201
|
+
async function probeConnectedClient(client, profile, stage, probe) {
|
|
202
|
+
try {
|
|
203
|
+
return await probe();
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
return rejectConnectedClient(client, isHarnessError(error)
|
|
207
|
+
? error
|
|
208
|
+
: new HarnessError('provider_api_incompatible', `Connected Client ${stage} probe failed.`, {
|
|
209
|
+
retryable: false,
|
|
210
|
+
providerId: profile.providerId,
|
|
211
|
+
profileId: profile.profileId,
|
|
212
|
+
details: { stage },
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
async function rejectConnectedClient(client, validationError) {
|
|
217
|
+
try {
|
|
218
|
+
await client.close();
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
throw new HarnessError('connection_failed', 'Connected Client failed validation and did not close cleanly.', {
|
|
222
|
+
retryable: false,
|
|
223
|
+
...(validationError.providerId === undefined
|
|
224
|
+
? {}
|
|
225
|
+
: { providerId: validationError.providerId }),
|
|
226
|
+
...(validationError.profileId === undefined
|
|
227
|
+
? {}
|
|
228
|
+
: { profileId: validationError.profileId }),
|
|
229
|
+
details: { validationCode: validationError.code },
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
throw validationError;
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ3D,gFAAgF;AAChF,MAAM,OAAO,eAAe;IACT,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;IAEhE;;;OAGG;IACH,QAAQ,CAAC,OAA+B;QACtC,MAAM,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACzD,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,YAAY,CACpB,iBAAiB,EACjB,YAAY,UAAU,CAAC,UAAU,yBAAyB,EAC1D,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,UAAU,EAAE,CACxD,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,iEAAiE;IACjE,UAAU,CAAC,UAAsB;QAC/B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED,2DAA2D;IAC3D,aAAa;QACX,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CACvD,eAAe,CAAC,UAAU,CAAC,CAC5B,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,WAAW,CAA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KAAK,UAAU,qBAAqB,CAClC,MAAqB,EACrB,eAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,YAAY,CACpB,mBAAmB,EACnB,+DAA+D,EAC/D;YACE,SAAS,EAAE,KAAK;YAChB,GAAG,CAAC,eAAe,CAAC,UAAU,KAAK,SAAS;gBAC1C,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,UAAU,EAAE,CAAC;YAC/C,GAAG,CAAC,eAAe,CAAC,SAAS,KAAK,SAAS;gBACzC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC;YAC7C,OAAO,EAAE,EAAE,cAAc,EAAE,eAAe,CAAC,IAAI,EAAE;SAClD,CACF,CAAC;IACJ,CAAC;IACD,MAAM,eAAe,CAAC;AACxB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@harapter/core",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Provider-agnostic portable contracts and registry for Harapter.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"harness",
|
|
8
|
+
"ai",
|
|
9
|
+
"typescript"
|
|
10
|
+
],
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/yunfeizhu/harapter.git",
|
|
15
|
+
"directory": "packages/core"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/yunfeizhu/harapter/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/yunfeizhu/harapter#readme",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=24"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"provenance": true,
|
|
40
|
+
"registry": "https://registry.npmjs.org/",
|
|
41
|
+
"tag": "next"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc --project tsconfig.build.json"
|
|
45
|
+
}
|
|
46
|
+
}
|