@covia/covia-sdk 1.11.0 → 1.13.0
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/dist/index.d.mts +136 -1
- package/dist/index.d.ts +136 -1
- package/dist/index.js +123 -0
- package/dist/index.mjs +122 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -735,6 +735,74 @@ declare class MemoryManager {
|
|
|
735
735
|
forget(number: number, path?: string): Promise<MemoryChange>;
|
|
736
736
|
}
|
|
737
737
|
|
|
738
|
+
interface DLFSManagerVenue extends VenueRequestContext {
|
|
739
|
+
lastKnownStatus?: StatusData;
|
|
740
|
+
}
|
|
741
|
+
declare class DLFSManager {
|
|
742
|
+
private venue;
|
|
743
|
+
private dlfsSupported;
|
|
744
|
+
constructor(venue: DLFSManagerVenue);
|
|
745
|
+
/** A job-free DLFS metadata GET that rejects when the endpoint is unavailable. */
|
|
746
|
+
private dlfsGet;
|
|
747
|
+
/**
|
|
748
|
+
* List the caller's DLFS drives, vault included. **Job-free** on covia
|
|
749
|
+
* venues serving `GET /api/v1/dlfs/drives` (covia#253).
|
|
750
|
+
*/
|
|
751
|
+
listDrives(): Promise<DLFSDrivesResult>;
|
|
752
|
+
/**
|
|
753
|
+
* List one directory of a drive. **Job-free** on covia venues serving
|
|
754
|
+
* `GET /api/v1/dlfs/list` (covia#253). Own drives by bare name only —
|
|
755
|
+
* cross-user DID-URL drive addressing isn't supported by this manager.
|
|
756
|
+
*/
|
|
757
|
+
list(drive: string, path?: string): Promise<DLFSListResult>;
|
|
758
|
+
/**
|
|
759
|
+
* Job-free file content — `GET /api/v1/content/dlfs/<drive>/<path>`, the
|
|
760
|
+
* same route the venue's generic asset-content resolver already serves
|
|
761
|
+
* (DLFSAdapter implements ContentProvider). Real streamed bytes with a
|
|
762
|
+
* correct Content-Type, not the JSON/base64 shape `dlfs:read` returns.
|
|
763
|
+
*/
|
|
764
|
+
getContent(drive: string, path: string): Promise<ReadableStream<Uint8Array>>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
interface UserManagerVenue extends VenueRequestContext {
|
|
768
|
+
operations: OperationRunner;
|
|
769
|
+
lastKnownStatus?: StatusData;
|
|
770
|
+
}
|
|
771
|
+
declare class UserManager {
|
|
772
|
+
private venue;
|
|
773
|
+
private usersSupported;
|
|
774
|
+
constructor(venue: UserManagerVenue);
|
|
775
|
+
/** A job-free users GET that rejects when the endpoint is unavailable. */
|
|
776
|
+
private usersGet;
|
|
777
|
+
/**
|
|
778
|
+
* List registered venue users. **Job-free** on covia venues serving
|
|
779
|
+
* `GET /api/v1/users` (covia#255) — synchronous, no Job persisted.
|
|
780
|
+
* Operator-only: throws a `GridError` with `statusCode` 403 for a
|
|
781
|
+
* signed-in caller that is not the venue itself and holds no venue-issued
|
|
782
|
+
* delegation over `<venueDID>/users` — that is an expected, common
|
|
783
|
+
* outcome to branch on, not a bug.
|
|
784
|
+
*/
|
|
785
|
+
list(): Promise<UserListResult>;
|
|
786
|
+
/**
|
|
787
|
+
* Get one registered user. The caller's own DID needs no operator
|
|
788
|
+
* authority; any other DID does (403 otherwise).
|
|
789
|
+
*/
|
|
790
|
+
info(did: string): Promise<UserInfo>;
|
|
791
|
+
/**
|
|
792
|
+
* List a venue-managed user's authenticators, active and revoked
|
|
793
|
+
* tombstones alike — revocation is a status transition in place, never a
|
|
794
|
+
* deletion. The caller's own DID needs no operator authority; any other
|
|
795
|
+
* DID does (403 otherwise).
|
|
796
|
+
*/
|
|
797
|
+
listAuthenticators(did: string): Promise<AuthenticationKeysResult>;
|
|
798
|
+
/**
|
|
799
|
+
* Revoke one of a venue-managed user's authenticators. A mutation, so —
|
|
800
|
+
* unlike the reads above — this goes through `operations.run` and mints a
|
|
801
|
+
* Job, matching every other write in this SDK (e.g. `SecretManager.set`).
|
|
802
|
+
*/
|
|
803
|
+
revokeAuthenticator(key: string, did?: string, ucans?: string[]): Promise<AuthenticatorRevokeResult>;
|
|
804
|
+
}
|
|
805
|
+
|
|
738
806
|
/**
|
|
739
807
|
* Resolve a non-DID venue id into the ordered list of base URLs that
|
|
740
808
|
* {@link Venue.connect} will try in turn. Explicit `http(s)://` inputs are
|
|
@@ -789,6 +857,8 @@ declare class Venue implements VenueInterface {
|
|
|
789
857
|
private _secrets?;
|
|
790
858
|
private _skills?;
|
|
791
859
|
private _memory?;
|
|
860
|
+
private _dlfs?;
|
|
861
|
+
private _users?;
|
|
792
862
|
get adapters(): AdapterManager;
|
|
793
863
|
get agents(): AgentManager;
|
|
794
864
|
get jobs(): JobManager;
|
|
@@ -799,6 +869,8 @@ declare class Venue implements VenueInterface {
|
|
|
799
869
|
get secrets(): SecretManager;
|
|
800
870
|
get skills(): SkillManager;
|
|
801
871
|
get memory(): MemoryManager;
|
|
872
|
+
get dlfs(): DLFSManager;
|
|
873
|
+
get users(): UserManager;
|
|
802
874
|
constructor(options?: VenueOptions);
|
|
803
875
|
/**
|
|
804
876
|
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
@@ -1043,6 +1115,12 @@ interface StatusData {
|
|
|
1043
1115
|
/** Venue platform version (e.g. "0.3.0"). Absent on venues before 0.3. */
|
|
1044
1116
|
version?: string;
|
|
1045
1117
|
stats?: StatsData;
|
|
1118
|
+
/** Curated admission-policy fields (#255) — safe to state to any caller.
|
|
1119
|
+
* Absent on venues before this shipped; treat as unknown, not false. */
|
|
1120
|
+
access?: {
|
|
1121
|
+
public: boolean;
|
|
1122
|
+
userAutoCreate: boolean;
|
|
1123
|
+
};
|
|
1046
1124
|
}
|
|
1047
1125
|
interface StatsData {
|
|
1048
1126
|
assets?: number;
|
|
@@ -1483,6 +1561,63 @@ interface SecretExtractResult {
|
|
|
1483
1561
|
name: string;
|
|
1484
1562
|
value: string;
|
|
1485
1563
|
}
|
|
1564
|
+
interface DLFSEntry {
|
|
1565
|
+
name: string;
|
|
1566
|
+
type: "file" | "directory";
|
|
1567
|
+
size?: number;
|
|
1568
|
+
modified?: string;
|
|
1569
|
+
}
|
|
1570
|
+
interface DLFSDrivesResult {
|
|
1571
|
+
drives: string[];
|
|
1572
|
+
}
|
|
1573
|
+
interface DLFSListResult {
|
|
1574
|
+
entries: DLFSEntry[];
|
|
1575
|
+
warnings?: string[];
|
|
1576
|
+
}
|
|
1577
|
+
interface UserSummary {
|
|
1578
|
+
did: string;
|
|
1579
|
+
registered: boolean;
|
|
1580
|
+
/** True for a venue-managed named account (a did:web identity minted from
|
|
1581
|
+
* a username); false/absent for a plain registered DID. */
|
|
1582
|
+
managed?: boolean;
|
|
1583
|
+
meta?: Record<string, unknown>;
|
|
1584
|
+
}
|
|
1585
|
+
interface UserListResult {
|
|
1586
|
+
users: UserSummary[];
|
|
1587
|
+
total: number;
|
|
1588
|
+
}
|
|
1589
|
+
interface UserInfo {
|
|
1590
|
+
did: string;
|
|
1591
|
+
registered: boolean;
|
|
1592
|
+
managed?: boolean;
|
|
1593
|
+
meta?: Record<string, unknown>;
|
|
1594
|
+
}
|
|
1595
|
+
/** One authenticator's lifecycle record. Revocation is a status transition
|
|
1596
|
+
* in place — a revoked entry is retained forever, never deleted, so the
|
|
1597
|
+
* key's full add/revoke history stays visible as an audit tombstone. */
|
|
1598
|
+
interface AuthenticationKeyEntry {
|
|
1599
|
+
status: "active" | "revoked";
|
|
1600
|
+
/** Epoch millis. */
|
|
1601
|
+
addedAt: number;
|
|
1602
|
+
/** Actor DID that added this key. */
|
|
1603
|
+
addedBy: string;
|
|
1604
|
+
label?: string;
|
|
1605
|
+
/** Epoch millis, present only once status is "revoked". */
|
|
1606
|
+
revokedAt?: number;
|
|
1607
|
+
/** Actor DID that revoked this key, present only once status is "revoked". */
|
|
1608
|
+
revokedBy?: string;
|
|
1609
|
+
}
|
|
1610
|
+
/** Keyed by the authenticator's own `did:key:...` string. */
|
|
1611
|
+
type AuthenticationKeysMap = Record<string, AuthenticationKeyEntry>;
|
|
1612
|
+
interface AuthenticationKeysResult {
|
|
1613
|
+
did: string;
|
|
1614
|
+
authenticationKeys: AuthenticationKeysMap;
|
|
1615
|
+
}
|
|
1616
|
+
interface AuthenticatorRevokeResult {
|
|
1617
|
+
did: string;
|
|
1618
|
+
key: string;
|
|
1619
|
+
revoked: boolean;
|
|
1620
|
+
}
|
|
1486
1621
|
interface FunctionInfo {
|
|
1487
1622
|
name: string;
|
|
1488
1623
|
id: string;
|
|
@@ -1890,4 +2025,4 @@ declare function grant(ownerPrivateKey: Uint8Array, audienceDID: string, withRes
|
|
|
1890
2025
|
*/
|
|
1891
2026
|
declare function relayDelegation(privateKey: Uint8Array, venueDID: string, lifetimeSeconds: number, caps?: UCANCapability[]): string;
|
|
1892
2027
|
|
|
1893
|
-
export { type AdapterInfo, AdapterManager, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentRenameSessionResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, type AgentSession, type AgentSessionListOptions, type AgentSessionMetadata, AgentSessionNotFoundError, type AgentSessionPage, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListItem, type AssetListOptions, AssetManager, type AssetMetadata, type AssetMetadataStore, AssetNotFoundError, type AssetPinResult, type AssetSummary, Auth, BasicAuth, BearerAuth, ChatSession, type ConnectionAttempt, type ContentDetails, type ContentHashResult, CoviaConnectionError, type CoviaConnectionErrorOptions, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, type DIDURL, DataAsset, Ed25519Auth, type ExpandedAssetList, type FunctionInfo, type FunctionsResult, Grid, GridError, type GroupCount, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, type MemoryChange, type MemoryEntry, MemoryManager, type MyAssetList, Namespace, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, type OperationRunner, RateLimitError, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type Skill, type SkillFacet, SkillManager, type SkillMetadata, type StatsData, type StatusData, type UCANAttenuation, type UCANCapability, type UCANIssueInput, type UCANIssueResult, UCANManager, type UCANVerifyResult, UnsupportedVenueFeatureError, VENUE_RELAY, Venue, type VenueConstructor, type VenueData, VenueIdentityChangedError, type VenueInterface, type VenueOptions, type WorkspaceAggregateResult, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceCopyResult, type WorkspaceCountResult, type WorkspaceDeleteInput, type WorkspaceDeleteResult, type WorkspaceInspectInput, type WorkspaceInspectResult, type WorkspaceListInput, type WorkspaceListResult, WorkspaceManager, type WorkspaceReadInput, type WorkspaceReadResult, type WorkspaceSliceInput, type WorkspaceSliceResult, type WorkspaceWriteInput, type WorkspaceWriteResult, assetHash, createSSEEvent, createUCANJWT, decodePublicKey, didFor, didFromPublicKey, didMethod, didUrl, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getAssetMetadataStore, getParsedAssetId, grant, hexToPrivateKey, identityToken, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseRetryAfterMs, parseSSEStream, privateKeyToHex, relayDelegation, retryDelayMs, setAssetMetadataStore, venueBaseUrlCandidates };
|
|
2028
|
+
export { type AdapterInfo, AdapterManager, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentRenameSessionResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, type AgentSession, type AgentSessionListOptions, type AgentSessionMetadata, AgentSessionNotFoundError, type AgentSessionPage, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListItem, type AssetListOptions, AssetManager, type AssetMetadata, type AssetMetadataStore, AssetNotFoundError, type AssetPinResult, type AssetSummary, Auth, type AuthenticationKeyEntry, type AuthenticationKeysMap, type AuthenticationKeysResult, type AuthenticatorRevokeResult, BasicAuth, BearerAuth, ChatSession, type ConnectionAttempt, type ContentDetails, type ContentHashResult, CoviaConnectionError, type CoviaConnectionErrorOptions, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, type DIDURL, type DLFSDrivesResult, type DLFSEntry, type DLFSListResult, DLFSManager, DataAsset, Ed25519Auth, type ExpandedAssetList, type FunctionInfo, type FunctionsResult, Grid, GridError, type GroupCount, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, type MemoryChange, type MemoryEntry, MemoryManager, type MyAssetList, Namespace, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, type OperationRunner, RateLimitError, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type Skill, type SkillFacet, SkillManager, type SkillMetadata, type StatsData, type StatusData, type UCANAttenuation, type UCANCapability, type UCANIssueInput, type UCANIssueResult, UCANManager, type UCANVerifyResult, UnsupportedVenueFeatureError, type UserInfo, type UserListResult, UserManager, type UserSummary, VENUE_RELAY, Venue, type VenueConstructor, type VenueData, VenueIdentityChangedError, type VenueInterface, type VenueOptions, type WorkspaceAggregateResult, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceCopyResult, type WorkspaceCountResult, type WorkspaceDeleteInput, type WorkspaceDeleteResult, type WorkspaceInspectInput, type WorkspaceInspectResult, type WorkspaceListInput, type WorkspaceListResult, WorkspaceManager, type WorkspaceReadInput, type WorkspaceReadResult, type WorkspaceSliceInput, type WorkspaceSliceResult, type WorkspaceWriteInput, type WorkspaceWriteResult, assetHash, createSSEEvent, createUCANJWT, decodePublicKey, didFor, didFromPublicKey, didMethod, didUrl, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getAssetMetadataStore, getParsedAssetId, grant, hexToPrivateKey, identityToken, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseRetryAfterMs, parseSSEStream, privateKeyToHex, relayDelegation, retryDelayMs, setAssetMetadataStore, venueBaseUrlCandidates };
|
package/dist/index.d.ts
CHANGED
|
@@ -735,6 +735,74 @@ declare class MemoryManager {
|
|
|
735
735
|
forget(number: number, path?: string): Promise<MemoryChange>;
|
|
736
736
|
}
|
|
737
737
|
|
|
738
|
+
interface DLFSManagerVenue extends VenueRequestContext {
|
|
739
|
+
lastKnownStatus?: StatusData;
|
|
740
|
+
}
|
|
741
|
+
declare class DLFSManager {
|
|
742
|
+
private venue;
|
|
743
|
+
private dlfsSupported;
|
|
744
|
+
constructor(venue: DLFSManagerVenue);
|
|
745
|
+
/** A job-free DLFS metadata GET that rejects when the endpoint is unavailable. */
|
|
746
|
+
private dlfsGet;
|
|
747
|
+
/**
|
|
748
|
+
* List the caller's DLFS drives, vault included. **Job-free** on covia
|
|
749
|
+
* venues serving `GET /api/v1/dlfs/drives` (covia#253).
|
|
750
|
+
*/
|
|
751
|
+
listDrives(): Promise<DLFSDrivesResult>;
|
|
752
|
+
/**
|
|
753
|
+
* List one directory of a drive. **Job-free** on covia venues serving
|
|
754
|
+
* `GET /api/v1/dlfs/list` (covia#253). Own drives by bare name only —
|
|
755
|
+
* cross-user DID-URL drive addressing isn't supported by this manager.
|
|
756
|
+
*/
|
|
757
|
+
list(drive: string, path?: string): Promise<DLFSListResult>;
|
|
758
|
+
/**
|
|
759
|
+
* Job-free file content — `GET /api/v1/content/dlfs/<drive>/<path>`, the
|
|
760
|
+
* same route the venue's generic asset-content resolver already serves
|
|
761
|
+
* (DLFSAdapter implements ContentProvider). Real streamed bytes with a
|
|
762
|
+
* correct Content-Type, not the JSON/base64 shape `dlfs:read` returns.
|
|
763
|
+
*/
|
|
764
|
+
getContent(drive: string, path: string): Promise<ReadableStream<Uint8Array>>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
interface UserManagerVenue extends VenueRequestContext {
|
|
768
|
+
operations: OperationRunner;
|
|
769
|
+
lastKnownStatus?: StatusData;
|
|
770
|
+
}
|
|
771
|
+
declare class UserManager {
|
|
772
|
+
private venue;
|
|
773
|
+
private usersSupported;
|
|
774
|
+
constructor(venue: UserManagerVenue);
|
|
775
|
+
/** A job-free users GET that rejects when the endpoint is unavailable. */
|
|
776
|
+
private usersGet;
|
|
777
|
+
/**
|
|
778
|
+
* List registered venue users. **Job-free** on covia venues serving
|
|
779
|
+
* `GET /api/v1/users` (covia#255) — synchronous, no Job persisted.
|
|
780
|
+
* Operator-only: throws a `GridError` with `statusCode` 403 for a
|
|
781
|
+
* signed-in caller that is not the venue itself and holds no venue-issued
|
|
782
|
+
* delegation over `<venueDID>/users` — that is an expected, common
|
|
783
|
+
* outcome to branch on, not a bug.
|
|
784
|
+
*/
|
|
785
|
+
list(): Promise<UserListResult>;
|
|
786
|
+
/**
|
|
787
|
+
* Get one registered user. The caller's own DID needs no operator
|
|
788
|
+
* authority; any other DID does (403 otherwise).
|
|
789
|
+
*/
|
|
790
|
+
info(did: string): Promise<UserInfo>;
|
|
791
|
+
/**
|
|
792
|
+
* List a venue-managed user's authenticators, active and revoked
|
|
793
|
+
* tombstones alike — revocation is a status transition in place, never a
|
|
794
|
+
* deletion. The caller's own DID needs no operator authority; any other
|
|
795
|
+
* DID does (403 otherwise).
|
|
796
|
+
*/
|
|
797
|
+
listAuthenticators(did: string): Promise<AuthenticationKeysResult>;
|
|
798
|
+
/**
|
|
799
|
+
* Revoke one of a venue-managed user's authenticators. A mutation, so —
|
|
800
|
+
* unlike the reads above — this goes through `operations.run` and mints a
|
|
801
|
+
* Job, matching every other write in this SDK (e.g. `SecretManager.set`).
|
|
802
|
+
*/
|
|
803
|
+
revokeAuthenticator(key: string, did?: string, ucans?: string[]): Promise<AuthenticatorRevokeResult>;
|
|
804
|
+
}
|
|
805
|
+
|
|
738
806
|
/**
|
|
739
807
|
* Resolve a non-DID venue id into the ordered list of base URLs that
|
|
740
808
|
* {@link Venue.connect} will try in turn. Explicit `http(s)://` inputs are
|
|
@@ -789,6 +857,8 @@ declare class Venue implements VenueInterface {
|
|
|
789
857
|
private _secrets?;
|
|
790
858
|
private _skills?;
|
|
791
859
|
private _memory?;
|
|
860
|
+
private _dlfs?;
|
|
861
|
+
private _users?;
|
|
792
862
|
get adapters(): AdapterManager;
|
|
793
863
|
get agents(): AgentManager;
|
|
794
864
|
get jobs(): JobManager;
|
|
@@ -799,6 +869,8 @@ declare class Venue implements VenueInterface {
|
|
|
799
869
|
get secrets(): SecretManager;
|
|
800
870
|
get skills(): SkillManager;
|
|
801
871
|
get memory(): MemoryManager;
|
|
872
|
+
get dlfs(): DLFSManager;
|
|
873
|
+
get users(): UserManager;
|
|
802
874
|
constructor(options?: VenueOptions);
|
|
803
875
|
/**
|
|
804
876
|
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
@@ -1043,6 +1115,12 @@ interface StatusData {
|
|
|
1043
1115
|
/** Venue platform version (e.g. "0.3.0"). Absent on venues before 0.3. */
|
|
1044
1116
|
version?: string;
|
|
1045
1117
|
stats?: StatsData;
|
|
1118
|
+
/** Curated admission-policy fields (#255) — safe to state to any caller.
|
|
1119
|
+
* Absent on venues before this shipped; treat as unknown, not false. */
|
|
1120
|
+
access?: {
|
|
1121
|
+
public: boolean;
|
|
1122
|
+
userAutoCreate: boolean;
|
|
1123
|
+
};
|
|
1046
1124
|
}
|
|
1047
1125
|
interface StatsData {
|
|
1048
1126
|
assets?: number;
|
|
@@ -1483,6 +1561,63 @@ interface SecretExtractResult {
|
|
|
1483
1561
|
name: string;
|
|
1484
1562
|
value: string;
|
|
1485
1563
|
}
|
|
1564
|
+
interface DLFSEntry {
|
|
1565
|
+
name: string;
|
|
1566
|
+
type: "file" | "directory";
|
|
1567
|
+
size?: number;
|
|
1568
|
+
modified?: string;
|
|
1569
|
+
}
|
|
1570
|
+
interface DLFSDrivesResult {
|
|
1571
|
+
drives: string[];
|
|
1572
|
+
}
|
|
1573
|
+
interface DLFSListResult {
|
|
1574
|
+
entries: DLFSEntry[];
|
|
1575
|
+
warnings?: string[];
|
|
1576
|
+
}
|
|
1577
|
+
interface UserSummary {
|
|
1578
|
+
did: string;
|
|
1579
|
+
registered: boolean;
|
|
1580
|
+
/** True for a venue-managed named account (a did:web identity minted from
|
|
1581
|
+
* a username); false/absent for a plain registered DID. */
|
|
1582
|
+
managed?: boolean;
|
|
1583
|
+
meta?: Record<string, unknown>;
|
|
1584
|
+
}
|
|
1585
|
+
interface UserListResult {
|
|
1586
|
+
users: UserSummary[];
|
|
1587
|
+
total: number;
|
|
1588
|
+
}
|
|
1589
|
+
interface UserInfo {
|
|
1590
|
+
did: string;
|
|
1591
|
+
registered: boolean;
|
|
1592
|
+
managed?: boolean;
|
|
1593
|
+
meta?: Record<string, unknown>;
|
|
1594
|
+
}
|
|
1595
|
+
/** One authenticator's lifecycle record. Revocation is a status transition
|
|
1596
|
+
* in place — a revoked entry is retained forever, never deleted, so the
|
|
1597
|
+
* key's full add/revoke history stays visible as an audit tombstone. */
|
|
1598
|
+
interface AuthenticationKeyEntry {
|
|
1599
|
+
status: "active" | "revoked";
|
|
1600
|
+
/** Epoch millis. */
|
|
1601
|
+
addedAt: number;
|
|
1602
|
+
/** Actor DID that added this key. */
|
|
1603
|
+
addedBy: string;
|
|
1604
|
+
label?: string;
|
|
1605
|
+
/** Epoch millis, present only once status is "revoked". */
|
|
1606
|
+
revokedAt?: number;
|
|
1607
|
+
/** Actor DID that revoked this key, present only once status is "revoked". */
|
|
1608
|
+
revokedBy?: string;
|
|
1609
|
+
}
|
|
1610
|
+
/** Keyed by the authenticator's own `did:key:...` string. */
|
|
1611
|
+
type AuthenticationKeysMap = Record<string, AuthenticationKeyEntry>;
|
|
1612
|
+
interface AuthenticationKeysResult {
|
|
1613
|
+
did: string;
|
|
1614
|
+
authenticationKeys: AuthenticationKeysMap;
|
|
1615
|
+
}
|
|
1616
|
+
interface AuthenticatorRevokeResult {
|
|
1617
|
+
did: string;
|
|
1618
|
+
key: string;
|
|
1619
|
+
revoked: boolean;
|
|
1620
|
+
}
|
|
1486
1621
|
interface FunctionInfo {
|
|
1487
1622
|
name: string;
|
|
1488
1623
|
id: string;
|
|
@@ -1890,4 +2025,4 @@ declare function grant(ownerPrivateKey: Uint8Array, audienceDID: string, withRes
|
|
|
1890
2025
|
*/
|
|
1891
2026
|
declare function relayDelegation(privateKey: Uint8Array, venueDID: string, lifetimeSeconds: number, caps?: UCANCapability[]): string;
|
|
1892
2027
|
|
|
1893
|
-
export { type AdapterInfo, AdapterManager, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentRenameSessionResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, type AgentSession, type AgentSessionListOptions, type AgentSessionMetadata, AgentSessionNotFoundError, type AgentSessionPage, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListItem, type AssetListOptions, AssetManager, type AssetMetadata, type AssetMetadataStore, AssetNotFoundError, type AssetPinResult, type AssetSummary, Auth, BasicAuth, BearerAuth, ChatSession, type ConnectionAttempt, type ContentDetails, type ContentHashResult, CoviaConnectionError, type CoviaConnectionErrorOptions, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, type DIDURL, DataAsset, Ed25519Auth, type ExpandedAssetList, type FunctionInfo, type FunctionsResult, Grid, GridError, type GroupCount, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, type MemoryChange, type MemoryEntry, MemoryManager, type MyAssetList, Namespace, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, type OperationRunner, RateLimitError, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type Skill, type SkillFacet, SkillManager, type SkillMetadata, type StatsData, type StatusData, type UCANAttenuation, type UCANCapability, type UCANIssueInput, type UCANIssueResult, UCANManager, type UCANVerifyResult, UnsupportedVenueFeatureError, VENUE_RELAY, Venue, type VenueConstructor, type VenueData, VenueIdentityChangedError, type VenueInterface, type VenueOptions, type WorkspaceAggregateResult, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceCopyResult, type WorkspaceCountResult, type WorkspaceDeleteInput, type WorkspaceDeleteResult, type WorkspaceInspectInput, type WorkspaceInspectResult, type WorkspaceListInput, type WorkspaceListResult, WorkspaceManager, type WorkspaceReadInput, type WorkspaceReadResult, type WorkspaceSliceInput, type WorkspaceSliceResult, type WorkspaceWriteInput, type WorkspaceWriteResult, assetHash, createSSEEvent, createUCANJWT, decodePublicKey, didFor, didFromPublicKey, didMethod, didUrl, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getAssetMetadataStore, getParsedAssetId, grant, hexToPrivateKey, identityToken, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseRetryAfterMs, parseSSEStream, privateKeyToHex, relayDelegation, retryDelayMs, setAssetMetadataStore, venueBaseUrlCandidates };
|
|
2028
|
+
export { type AdapterInfo, AdapterManager, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentRenameSessionResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, type AgentSession, type AgentSessionListOptions, type AgentSessionMetadata, AgentSessionNotFoundError, type AgentSessionPage, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListItem, type AssetListOptions, AssetManager, type AssetMetadata, type AssetMetadataStore, AssetNotFoundError, type AssetPinResult, type AssetSummary, Auth, type AuthenticationKeyEntry, type AuthenticationKeysMap, type AuthenticationKeysResult, type AuthenticatorRevokeResult, BasicAuth, BearerAuth, ChatSession, type ConnectionAttempt, type ContentDetails, type ContentHashResult, CoviaConnectionError, type CoviaConnectionErrorOptions, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, type DIDURL, type DLFSDrivesResult, type DLFSEntry, type DLFSListResult, DLFSManager, DataAsset, Ed25519Auth, type ExpandedAssetList, type FunctionInfo, type FunctionsResult, Grid, GridError, type GroupCount, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, type MemoryChange, type MemoryEntry, MemoryManager, type MyAssetList, Namespace, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, type OperationRunner, RateLimitError, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type Skill, type SkillFacet, SkillManager, type SkillMetadata, type StatsData, type StatusData, type UCANAttenuation, type UCANCapability, type UCANIssueInput, type UCANIssueResult, UCANManager, type UCANVerifyResult, UnsupportedVenueFeatureError, type UserInfo, type UserListResult, UserManager, type UserSummary, VENUE_RELAY, Venue, type VenueConstructor, type VenueData, VenueIdentityChangedError, type VenueInterface, type VenueOptions, type WorkspaceAggregateResult, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceCopyResult, type WorkspaceCountResult, type WorkspaceDeleteInput, type WorkspaceDeleteResult, type WorkspaceInspectInput, type WorkspaceInspectResult, type WorkspaceListInput, type WorkspaceListResult, WorkspaceManager, type WorkspaceReadInput, type WorkspaceReadResult, type WorkspaceSliceInput, type WorkspaceSliceResult, type WorkspaceWriteInput, type WorkspaceWriteResult, assetHash, createSSEEvent, createUCANJWT, decodePublicKey, didFor, didFromPublicKey, didMethod, didUrl, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getAssetMetadataStore, getParsedAssetId, grant, hexToPrivateKey, identityToken, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseRetryAfterMs, parseSSEStream, privateKeyToHex, relayDelegation, retryDelayMs, setAssetMetadataStore, venueBaseUrlCandidates };
|
package/dist/index.js
CHANGED
|
@@ -2798,6 +2798,121 @@ var MemoryManager = class {
|
|
|
2798
2798
|
}
|
|
2799
2799
|
};
|
|
2800
2800
|
|
|
2801
|
+
// src/DLFSManager.ts
|
|
2802
|
+
var DLFSManager = class {
|
|
2803
|
+
constructor(venue) {
|
|
2804
|
+
this.venue = venue;
|
|
2805
|
+
// Whether this venue serves GET /api/v1/dlfs/* — flipped on a route-missing
|
|
2806
|
+
// 404 so a pre-#253 venue pays the probe once, not one failed GET per read.
|
|
2807
|
+
this.dlfsSupported = true;
|
|
2808
|
+
}
|
|
2809
|
+
/** A job-free DLFS metadata GET that rejects when the endpoint is unavailable. */
|
|
2810
|
+
async dlfsGet(path) {
|
|
2811
|
+
if (!this.dlfsSupported) throw new UnsupportedVenueFeatureError("venue DLFS browsing");
|
|
2812
|
+
try {
|
|
2813
|
+
return await venueJson(this.venue, `/api/v1/dlfs${path}`);
|
|
2814
|
+
} catch (e) {
|
|
2815
|
+
if (!(e instanceof NotFoundError)) throw e;
|
|
2816
|
+
if (!ROUTE_MISSING_404.test(e.message)) throw e;
|
|
2817
|
+
this.dlfsSupported = false;
|
|
2818
|
+
throw new UnsupportedVenueFeatureError("venue DLFS browsing");
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
/**
|
|
2822
|
+
* List the caller's DLFS drives, vault included. **Job-free** on covia
|
|
2823
|
+
* venues serving `GET /api/v1/dlfs/drives` (covia#253).
|
|
2824
|
+
*/
|
|
2825
|
+
async listDrives() {
|
|
2826
|
+
return this.dlfsGet("/drives");
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* List one directory of a drive. **Job-free** on covia venues serving
|
|
2830
|
+
* `GET /api/v1/dlfs/list` (covia#253). Own drives by bare name only —
|
|
2831
|
+
* cross-user DID-URL drive addressing isn't supported by this manager.
|
|
2832
|
+
*/
|
|
2833
|
+
async list(drive, path) {
|
|
2834
|
+
const qs = new URLSearchParams({ drive, ...path ? { path } : {} });
|
|
2835
|
+
return this.dlfsGet(`/list?${qs}`);
|
|
2836
|
+
}
|
|
2837
|
+
/**
|
|
2838
|
+
* Job-free file content — `GET /api/v1/content/dlfs/<drive>/<path>`, the
|
|
2839
|
+
* same route the venue's generic asset-content resolver already serves
|
|
2840
|
+
* (DLFSAdapter implements ContentProvider). Real streamed bytes with a
|
|
2841
|
+
* correct Content-Type, not the JSON/base64 shape `dlfs:read` returns.
|
|
2842
|
+
*/
|
|
2843
|
+
async getContent(drive, path) {
|
|
2844
|
+
const segments = path.split("/").filter(Boolean).map(encodeURIComponent).join("/");
|
|
2845
|
+
const response = await venueStream(
|
|
2846
|
+
this.venue,
|
|
2847
|
+
`/api/v1/content/dlfs/${encodeURIComponent(drive)}/${segments}`
|
|
2848
|
+
);
|
|
2849
|
+
if (!response.body) throw new Error("Empty response body for DLFS content read");
|
|
2850
|
+
return response.body;
|
|
2851
|
+
}
|
|
2852
|
+
};
|
|
2853
|
+
|
|
2854
|
+
// src/UserManager.ts
|
|
2855
|
+
var UserManager = class {
|
|
2856
|
+
constructor(venue) {
|
|
2857
|
+
this.venue = venue;
|
|
2858
|
+
// Whether this venue serves GET /api/v1/users — flipped on a route-missing
|
|
2859
|
+
// 404 so a pre-#255 venue pays the probe once, not one failed GET per read.
|
|
2860
|
+
this.usersSupported = true;
|
|
2861
|
+
}
|
|
2862
|
+
/** A job-free users GET that rejects when the endpoint is unavailable. */
|
|
2863
|
+
async usersGet(path) {
|
|
2864
|
+
if (!this.usersSupported) throw new UnsupportedVenueFeatureError("venue users");
|
|
2865
|
+
try {
|
|
2866
|
+
return await venueJson(this.venue, `/api/v1/users${path}`);
|
|
2867
|
+
} catch (e) {
|
|
2868
|
+
if (!(e instanceof NotFoundError)) throw e;
|
|
2869
|
+
const routeMissing = path === "" || ROUTE_MISSING_404.test(e.message);
|
|
2870
|
+
if (!routeMissing) throw e;
|
|
2871
|
+
this.usersSupported = false;
|
|
2872
|
+
throw new UnsupportedVenueFeatureError("venue users");
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
/**
|
|
2876
|
+
* List registered venue users. **Job-free** on covia venues serving
|
|
2877
|
+
* `GET /api/v1/users` (covia#255) — synchronous, no Job persisted.
|
|
2878
|
+
* Operator-only: throws a `GridError` with `statusCode` 403 for a
|
|
2879
|
+
* signed-in caller that is not the venue itself and holds no venue-issued
|
|
2880
|
+
* delegation over `<venueDID>/users` — that is an expected, common
|
|
2881
|
+
* outcome to branch on, not a bug.
|
|
2882
|
+
*/
|
|
2883
|
+
async list() {
|
|
2884
|
+
return this.usersGet("");
|
|
2885
|
+
}
|
|
2886
|
+
/**
|
|
2887
|
+
* Get one registered user. The caller's own DID needs no operator
|
|
2888
|
+
* authority; any other DID does (403 otherwise).
|
|
2889
|
+
*/
|
|
2890
|
+
async info(did) {
|
|
2891
|
+
return this.usersGet(`/${encodeURIComponent(did)}`);
|
|
2892
|
+
}
|
|
2893
|
+
/**
|
|
2894
|
+
* List a venue-managed user's authenticators, active and revoked
|
|
2895
|
+
* tombstones alike — revocation is a status transition in place, never a
|
|
2896
|
+
* deletion. The caller's own DID needs no operator authority; any other
|
|
2897
|
+
* DID does (403 otherwise).
|
|
2898
|
+
*/
|
|
2899
|
+
async listAuthenticators(did) {
|
|
2900
|
+
return this.usersGet(`/${encodeURIComponent(did)}/authentications`);
|
|
2901
|
+
}
|
|
2902
|
+
/**
|
|
2903
|
+
* Revoke one of a venue-managed user's authenticators. A mutation, so —
|
|
2904
|
+
* unlike the reads above — this goes through `operations.run` and mints a
|
|
2905
|
+
* Job, matching every other write in this SDK (e.g. `SecretManager.set`).
|
|
2906
|
+
*/
|
|
2907
|
+
async revokeAuthenticator(key, did, ucans) {
|
|
2908
|
+
return this.venue.operations.run(
|
|
2909
|
+
"v/ops/user/authentication-revoke",
|
|
2910
|
+
{ did, key },
|
|
2911
|
+
{ ucans }
|
|
2912
|
+
);
|
|
2913
|
+
}
|
|
2914
|
+
};
|
|
2915
|
+
|
|
2801
2916
|
// src/Agent.ts
|
|
2802
2917
|
var Agent = class _Agent {
|
|
2803
2918
|
constructor(id, venue) {
|
|
@@ -2996,6 +3111,12 @@ var Venue = class _Venue {
|
|
|
2996
3111
|
get memory() {
|
|
2997
3112
|
return this._memory ?? (this._memory = new MemoryManager(this));
|
|
2998
3113
|
}
|
|
3114
|
+
get dlfs() {
|
|
3115
|
+
return this._dlfs ?? (this._dlfs = new DLFSManager(this));
|
|
3116
|
+
}
|
|
3117
|
+
get users() {
|
|
3118
|
+
return this._users ?? (this._users = new UserManager(this));
|
|
3119
|
+
}
|
|
2999
3120
|
/**
|
|
3000
3121
|
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
3001
3122
|
* venue is auth-gated (status answers 401/403 — public access disabled), the
|
|
@@ -3343,6 +3464,7 @@ exports.CoviaConnectionError = CoviaConnectionError;
|
|
|
3343
3464
|
exports.CoviaError = CoviaError;
|
|
3344
3465
|
exports.CoviaTimeoutError = CoviaTimeoutError;
|
|
3345
3466
|
exports.CredentialsHTTP = CredentialsHTTP;
|
|
3467
|
+
exports.DLFSManager = DLFSManager;
|
|
3346
3468
|
exports.DataAsset = DataAsset;
|
|
3347
3469
|
exports.Ed25519Auth = Ed25519Auth;
|
|
3348
3470
|
exports.Grid = Grid;
|
|
@@ -3365,6 +3487,7 @@ exports.SecretManager = SecretManager;
|
|
|
3365
3487
|
exports.SkillManager = SkillManager;
|
|
3366
3488
|
exports.UCANManager = UCANManager;
|
|
3367
3489
|
exports.UnsupportedVenueFeatureError = UnsupportedVenueFeatureError;
|
|
3490
|
+
exports.UserManager = UserManager;
|
|
3368
3491
|
exports.VENUE_RELAY = VENUE_RELAY;
|
|
3369
3492
|
exports.Venue = Venue;
|
|
3370
3493
|
exports.VenueIdentityChangedError = VenueIdentityChangedError;
|
package/dist/index.mjs
CHANGED
|
@@ -2796,6 +2796,121 @@ var MemoryManager = class {
|
|
|
2796
2796
|
}
|
|
2797
2797
|
};
|
|
2798
2798
|
|
|
2799
|
+
// src/DLFSManager.ts
|
|
2800
|
+
var DLFSManager = class {
|
|
2801
|
+
constructor(venue) {
|
|
2802
|
+
this.venue = venue;
|
|
2803
|
+
// Whether this venue serves GET /api/v1/dlfs/* — flipped on a route-missing
|
|
2804
|
+
// 404 so a pre-#253 venue pays the probe once, not one failed GET per read.
|
|
2805
|
+
this.dlfsSupported = true;
|
|
2806
|
+
}
|
|
2807
|
+
/** A job-free DLFS metadata GET that rejects when the endpoint is unavailable. */
|
|
2808
|
+
async dlfsGet(path) {
|
|
2809
|
+
if (!this.dlfsSupported) throw new UnsupportedVenueFeatureError("venue DLFS browsing");
|
|
2810
|
+
try {
|
|
2811
|
+
return await venueJson(this.venue, `/api/v1/dlfs${path}`);
|
|
2812
|
+
} catch (e) {
|
|
2813
|
+
if (!(e instanceof NotFoundError)) throw e;
|
|
2814
|
+
if (!ROUTE_MISSING_404.test(e.message)) throw e;
|
|
2815
|
+
this.dlfsSupported = false;
|
|
2816
|
+
throw new UnsupportedVenueFeatureError("venue DLFS browsing");
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* List the caller's DLFS drives, vault included. **Job-free** on covia
|
|
2821
|
+
* venues serving `GET /api/v1/dlfs/drives` (covia#253).
|
|
2822
|
+
*/
|
|
2823
|
+
async listDrives() {
|
|
2824
|
+
return this.dlfsGet("/drives");
|
|
2825
|
+
}
|
|
2826
|
+
/**
|
|
2827
|
+
* List one directory of a drive. **Job-free** on covia venues serving
|
|
2828
|
+
* `GET /api/v1/dlfs/list` (covia#253). Own drives by bare name only —
|
|
2829
|
+
* cross-user DID-URL drive addressing isn't supported by this manager.
|
|
2830
|
+
*/
|
|
2831
|
+
async list(drive, path) {
|
|
2832
|
+
const qs = new URLSearchParams({ drive, ...path ? { path } : {} });
|
|
2833
|
+
return this.dlfsGet(`/list?${qs}`);
|
|
2834
|
+
}
|
|
2835
|
+
/**
|
|
2836
|
+
* Job-free file content — `GET /api/v1/content/dlfs/<drive>/<path>`, the
|
|
2837
|
+
* same route the venue's generic asset-content resolver already serves
|
|
2838
|
+
* (DLFSAdapter implements ContentProvider). Real streamed bytes with a
|
|
2839
|
+
* correct Content-Type, not the JSON/base64 shape `dlfs:read` returns.
|
|
2840
|
+
*/
|
|
2841
|
+
async getContent(drive, path) {
|
|
2842
|
+
const segments = path.split("/").filter(Boolean).map(encodeURIComponent).join("/");
|
|
2843
|
+
const response = await venueStream(
|
|
2844
|
+
this.venue,
|
|
2845
|
+
`/api/v1/content/dlfs/${encodeURIComponent(drive)}/${segments}`
|
|
2846
|
+
);
|
|
2847
|
+
if (!response.body) throw new Error("Empty response body for DLFS content read");
|
|
2848
|
+
return response.body;
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
|
|
2852
|
+
// src/UserManager.ts
|
|
2853
|
+
var UserManager = class {
|
|
2854
|
+
constructor(venue) {
|
|
2855
|
+
this.venue = venue;
|
|
2856
|
+
// Whether this venue serves GET /api/v1/users — flipped on a route-missing
|
|
2857
|
+
// 404 so a pre-#255 venue pays the probe once, not one failed GET per read.
|
|
2858
|
+
this.usersSupported = true;
|
|
2859
|
+
}
|
|
2860
|
+
/** A job-free users GET that rejects when the endpoint is unavailable. */
|
|
2861
|
+
async usersGet(path) {
|
|
2862
|
+
if (!this.usersSupported) throw new UnsupportedVenueFeatureError("venue users");
|
|
2863
|
+
try {
|
|
2864
|
+
return await venueJson(this.venue, `/api/v1/users${path}`);
|
|
2865
|
+
} catch (e) {
|
|
2866
|
+
if (!(e instanceof NotFoundError)) throw e;
|
|
2867
|
+
const routeMissing = path === "" || ROUTE_MISSING_404.test(e.message);
|
|
2868
|
+
if (!routeMissing) throw e;
|
|
2869
|
+
this.usersSupported = false;
|
|
2870
|
+
throw new UnsupportedVenueFeatureError("venue users");
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
/**
|
|
2874
|
+
* List registered venue users. **Job-free** on covia venues serving
|
|
2875
|
+
* `GET /api/v1/users` (covia#255) — synchronous, no Job persisted.
|
|
2876
|
+
* Operator-only: throws a `GridError` with `statusCode` 403 for a
|
|
2877
|
+
* signed-in caller that is not the venue itself and holds no venue-issued
|
|
2878
|
+
* delegation over `<venueDID>/users` — that is an expected, common
|
|
2879
|
+
* outcome to branch on, not a bug.
|
|
2880
|
+
*/
|
|
2881
|
+
async list() {
|
|
2882
|
+
return this.usersGet("");
|
|
2883
|
+
}
|
|
2884
|
+
/**
|
|
2885
|
+
* Get one registered user. The caller's own DID needs no operator
|
|
2886
|
+
* authority; any other DID does (403 otherwise).
|
|
2887
|
+
*/
|
|
2888
|
+
async info(did) {
|
|
2889
|
+
return this.usersGet(`/${encodeURIComponent(did)}`);
|
|
2890
|
+
}
|
|
2891
|
+
/**
|
|
2892
|
+
* List a venue-managed user's authenticators, active and revoked
|
|
2893
|
+
* tombstones alike — revocation is a status transition in place, never a
|
|
2894
|
+
* deletion. The caller's own DID needs no operator authority; any other
|
|
2895
|
+
* DID does (403 otherwise).
|
|
2896
|
+
*/
|
|
2897
|
+
async listAuthenticators(did) {
|
|
2898
|
+
return this.usersGet(`/${encodeURIComponent(did)}/authentications`);
|
|
2899
|
+
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Revoke one of a venue-managed user's authenticators. A mutation, so —
|
|
2902
|
+
* unlike the reads above — this goes through `operations.run` and mints a
|
|
2903
|
+
* Job, matching every other write in this SDK (e.g. `SecretManager.set`).
|
|
2904
|
+
*/
|
|
2905
|
+
async revokeAuthenticator(key, did, ucans) {
|
|
2906
|
+
return this.venue.operations.run(
|
|
2907
|
+
"v/ops/user/authentication-revoke",
|
|
2908
|
+
{ did, key },
|
|
2909
|
+
{ ucans }
|
|
2910
|
+
);
|
|
2911
|
+
}
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2799
2914
|
// src/Agent.ts
|
|
2800
2915
|
var Agent = class _Agent {
|
|
2801
2916
|
constructor(id, venue) {
|
|
@@ -2994,6 +3109,12 @@ var Venue = class _Venue {
|
|
|
2994
3109
|
get memory() {
|
|
2995
3110
|
return this._memory ?? (this._memory = new MemoryManager(this));
|
|
2996
3111
|
}
|
|
3112
|
+
get dlfs() {
|
|
3113
|
+
return this._dlfs ?? (this._dlfs = new DLFSManager(this));
|
|
3114
|
+
}
|
|
3115
|
+
get users() {
|
|
3116
|
+
return this._users ?? (this._users = new UserManager(this));
|
|
3117
|
+
}
|
|
2997
3118
|
/**
|
|
2998
3119
|
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
2999
3120
|
* venue is auth-gated (status answers 401/403 — public access disabled), the
|
|
@@ -3325,4 +3446,4 @@ function relayDelegation(privateKey, venueDID, lifetimeSeconds, caps = []) {
|
|
|
3325
3446
|
(*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
|
|
3326
3447
|
*/
|
|
3327
3448
|
|
|
3328
|
-
export { AdapterManager, Agent, AgentManager, AgentSessionNotFoundError, AgentStatus, Asset, AssetManager, AssetNotFoundError, Auth, BasicAuth, BearerAuth, ChatSession, CoviaConnectionError, CoviaError, CoviaTimeoutError, CredentialsHTTP, DataAsset, Ed25519Auth, Grid, GridError, Job, JobFailedError, JobManager, JobNotFoundError, JobStatus, KeyPairAuth, MemoryManager, Namespace, NoAuth, NotFoundError, Operation, OperationManager, RateLimitError, RunStatus, SecretManager, SkillManager, UCANManager, UnsupportedVenueFeatureError, VENUE_RELAY, Venue, VenueIdentityChangedError, WorkspaceManager, assetHash, createSSEEvent, createUCANJWT, decodePublicKey, didFor, didFromPublicKey, didMethod, didUrl, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getAssetMetadataStore, getParsedAssetId, grant, hexToPrivateKey, identityToken, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseRetryAfterMs, parseSSEStream, privateKeyToHex, relayDelegation, retryDelayMs, setAssetMetadataStore, venueBaseUrlCandidates };
|
|
3449
|
+
export { AdapterManager, Agent, AgentManager, AgentSessionNotFoundError, AgentStatus, Asset, AssetManager, AssetNotFoundError, Auth, BasicAuth, BearerAuth, ChatSession, CoviaConnectionError, CoviaError, CoviaTimeoutError, CredentialsHTTP, DLFSManager, DataAsset, Ed25519Auth, Grid, GridError, Job, JobFailedError, JobManager, JobNotFoundError, JobStatus, KeyPairAuth, MemoryManager, Namespace, NoAuth, NotFoundError, Operation, OperationManager, RateLimitError, RunStatus, SecretManager, SkillManager, UCANManager, UnsupportedVenueFeatureError, UserManager, VENUE_RELAY, Venue, VenueIdentityChangedError, WorkspaceManager, assetHash, createSSEEvent, createUCANJWT, decodePublicKey, didFor, didFromPublicKey, didMethod, didUrl, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getAssetMetadataStore, getParsedAssetId, grant, hexToPrivateKey, identityToken, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseRetryAfterMs, parseSSEStream, privateKeyToHex, relayDelegation, retryDelayMs, setAssetMetadataStore, venueBaseUrlCandidates };
|