@covia/covia-sdk 1.14.0 → 1.16.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 +121 -10
- package/dist/index.d.ts +121 -10
- package/dist/index.js +70 -27
- package/dist/index.mjs +70 -28
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -174,7 +174,9 @@ declare abstract class Asset {
|
|
|
174
174
|
*/
|
|
175
175
|
getContent(): Promise<ReadableStream<Uint8Array> | null>;
|
|
176
176
|
/**
|
|
177
|
-
* Get the URL for downloading asset content
|
|
177
|
+
* Get the URL for downloading asset content. Resolves any reference form
|
|
178
|
+
* this asset was addressed by, via the venue's canonical any-ref content
|
|
179
|
+
* route (covia#368).
|
|
178
180
|
* @returns {string} The URL for downloading the asset content
|
|
179
181
|
*/
|
|
180
182
|
getContentURL(): string;
|
|
@@ -368,7 +370,6 @@ interface AgentManagerVenue extends VenueRequestContext {
|
|
|
368
370
|
read(path: string, maxSize?: number): Promise<WorkspaceReadResult>;
|
|
369
371
|
slice(path: string, offset?: number, limit?: number): Promise<WorkspaceSliceResult>;
|
|
370
372
|
};
|
|
371
|
-
lastKnownStatus?: StatusData;
|
|
372
373
|
}
|
|
373
374
|
declare class AgentManager {
|
|
374
375
|
private venue;
|
|
@@ -376,7 +377,10 @@ declare class AgentManager {
|
|
|
376
377
|
private agentSseSupported;
|
|
377
378
|
constructor(venue: AgentManagerVenue);
|
|
378
379
|
/** Whether the venue serves `GET /api/v1/agents`: no if a probe already
|
|
379
|
-
* 404'd
|
|
380
|
+
* 404'd. No version fast-path — a venue's self-reported version is weaker
|
|
381
|
+
* evidence than its answer to the request (an embedded venue can report
|
|
382
|
+
* its host application's version instead of its own; see covia-sdk#36).
|
|
383
|
+
* Rely purely on the lazy 404 latch, same as UserManager.usersGet. */
|
|
380
384
|
private supportsAgentsGet;
|
|
381
385
|
/** A job-free agents GET that rejects when the endpoint is unavailable. */
|
|
382
386
|
private agentsGet;
|
|
@@ -521,8 +525,11 @@ declare class AssetManager {
|
|
|
521
525
|
*/
|
|
522
526
|
putContent(assetId: string, content: BodyInit): Promise<ContentHashResult>;
|
|
523
527
|
/**
|
|
524
|
-
* Get asset content
|
|
525
|
-
*
|
|
528
|
+
* Get asset content. Resolves any reference form the metadata endpoint
|
|
529
|
+
* does — a bare hash, `a/<hash>`, a workspace/operation path, or a
|
|
530
|
+
* DID-qualified URL — via the venue's canonical `GET /api/v1/content/{ref}`
|
|
531
|
+
* (covia#368), not the hash-only legacy `assets/{id}/content` route.
|
|
532
|
+
* @param assetId - Asset reference (any form)
|
|
526
533
|
*/
|
|
527
534
|
getContent(assetId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
528
535
|
/**
|
|
@@ -581,7 +588,6 @@ declare class OperationManager {
|
|
|
581
588
|
|
|
582
589
|
interface WorkspaceManagerVenue extends VenueRequestContext {
|
|
583
590
|
operations: OperationRunner;
|
|
584
|
-
lastKnownStatus?: StatusData;
|
|
585
591
|
}
|
|
586
592
|
/**
|
|
587
593
|
* Workspace (lattice) operations against a venue.
|
|
@@ -609,9 +615,10 @@ declare class WorkspaceManager {
|
|
|
609
615
|
private _values;
|
|
610
616
|
/**
|
|
611
617
|
* Whether the venue serves `GET /api/v1/values/*`: no if a probe already
|
|
612
|
-
* 404'd
|
|
613
|
-
*
|
|
614
|
-
*
|
|
618
|
+
* 404'd. No version fast-path — a venue's self-reported version is weaker
|
|
619
|
+
* evidence than its answer to the request (an embedded venue can report
|
|
620
|
+
* its host application's version instead of its own; see covia-sdk#36).
|
|
621
|
+
* Rely purely on the lazy 404 latch, same as UserManager.usersGet.
|
|
615
622
|
*/
|
|
616
623
|
private supportsValues;
|
|
617
624
|
private unsupported;
|
|
@@ -828,6 +835,47 @@ declare class UserManager {
|
|
|
828
835
|
revokeAuthenticator(key: string, did?: string, ucans?: string[]): Promise<AuthenticatorRevokeResult>;
|
|
829
836
|
}
|
|
830
837
|
|
|
838
|
+
interface OpOps {
|
|
839
|
+
run<T = unknown>(assetId: string, input?: unknown, options?: InvokeOptions): Promise<T>;
|
|
840
|
+
invoke(assetId: string, input?: unknown, options?: InvokeOptions): Promise<Job>;
|
|
841
|
+
}
|
|
842
|
+
interface A2AManagerVenue {
|
|
843
|
+
operations: OpOps;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Bring-your-own-agent (A2A): import a remote A2A endpoint or another Covia
|
|
847
|
+
* agent as an immutable agent Asset, then task it. Both calls persist a Job
|
|
848
|
+
* (the venue records the import and mirrors the remote Task's lifecycle onto
|
|
849
|
+
* `send`'s Job) — there is no job-free surface here.
|
|
850
|
+
*/
|
|
851
|
+
declare class A2AManager {
|
|
852
|
+
private venue;
|
|
853
|
+
constructor(venue: A2AManagerVenue);
|
|
854
|
+
/**
|
|
855
|
+
* Register a remote A2A endpoint or Covia agent as an immutable agent
|
|
856
|
+
* Asset, with a mutable binding at `w/a2a/agents/<name>`. Waits for the
|
|
857
|
+
* import to complete and returns its result directly.
|
|
858
|
+
*/
|
|
859
|
+
importAgent(input: A2AImportAgentInput): Promise<A2AImportAgentResult>;
|
|
860
|
+
/**
|
|
861
|
+
* Task an imported agent. Returns the raw Job rather than waiting for a
|
|
862
|
+
* result: the local Job mirrors the remote Task's lifecycle, so a reply
|
|
863
|
+
* that pauses (INPUT_REQUIRED, AUTH_REQUIRED) is a paused Job the caller
|
|
864
|
+
* inspects and continues via `job.sendMessage()` — the same shape as any
|
|
865
|
+
* other paused job, not a special case for A2A. Once the Job reaches a
|
|
866
|
+
* terminal state, `job.output` is the final remote `A2ATask`.
|
|
867
|
+
*
|
|
868
|
+
* @param agent Imported agent reference — `w/a2a/agents/<name>` or its
|
|
869
|
+
* immutable `did:.../a/<hash>` id.
|
|
870
|
+
* @param message An A2A Message: `{ role, parts, messageId? }`.
|
|
871
|
+
* @param options.taskId Continue an existing remote Task instead of
|
|
872
|
+
* starting a new one.
|
|
873
|
+
*/
|
|
874
|
+
send(agent: string, message: A2AMessage, options?: {
|
|
875
|
+
taskId?: string;
|
|
876
|
+
}): Promise<Job>;
|
|
877
|
+
}
|
|
878
|
+
|
|
831
879
|
/**
|
|
832
880
|
* Resolve a non-DID venue id into the ordered list of base URLs that
|
|
833
881
|
* {@link Venue.connect} will try in turn. Explicit `http(s)://` inputs are
|
|
@@ -884,6 +932,7 @@ declare class Venue implements VenueInterface {
|
|
|
884
932
|
private _memory?;
|
|
885
933
|
private _dlfs?;
|
|
886
934
|
private _users?;
|
|
935
|
+
private _a2a?;
|
|
887
936
|
get adapters(): AdapterManager;
|
|
888
937
|
get agents(): AgentManager;
|
|
889
938
|
get jobs(): JobManager;
|
|
@@ -896,6 +945,7 @@ declare class Venue implements VenueInterface {
|
|
|
896
945
|
get memory(): MemoryManager;
|
|
897
946
|
get dlfs(): DLFSManager;
|
|
898
947
|
get users(): UserManager;
|
|
948
|
+
get a2a(): A2AManager;
|
|
899
949
|
constructor(options?: VenueOptions);
|
|
900
950
|
/**
|
|
901
951
|
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
@@ -1853,6 +1903,67 @@ declare class AgentSessionNotFoundError extends CoviaError {
|
|
|
1853
1903
|
readonly sessionId: string;
|
|
1854
1904
|
constructor(agentId: string, sessionId: string);
|
|
1855
1905
|
}
|
|
1906
|
+
/** Stored authentication binding for an imported A2A agent — a reference to
|
|
1907
|
+
* a secret, never a literal credential. */
|
|
1908
|
+
interface A2AAuthRef {
|
|
1909
|
+
/** Agent Card-declared API key or Bearer scheme name. */
|
|
1910
|
+
scheme?: string;
|
|
1911
|
+
/** Bearer auth needed to discover a private card. */
|
|
1912
|
+
kind?: 'bearer';
|
|
1913
|
+
/** `s/<name>` — the stored secret this binds to. */
|
|
1914
|
+
secret: string;
|
|
1915
|
+
}
|
|
1916
|
+
interface A2AImportAgentInput {
|
|
1917
|
+
/** Local alias matching `[a-z0-9-]{1,64}`; creates `w/a2a/agents/<name>`. */
|
|
1918
|
+
name: string;
|
|
1919
|
+
/** Base URL of a standard external A2A agent. Exactly one of `url`/`coviaAgent`. */
|
|
1920
|
+
url?: string;
|
|
1921
|
+
/** Covia grid agent address: local `g/<agentId>` or full `<ownerDID>/g/<agentId>`. */
|
|
1922
|
+
coviaAgent?: string;
|
|
1923
|
+
/** Base URL of the venue hosting `coviaAgent` — required for a full address. */
|
|
1924
|
+
venue?: string;
|
|
1925
|
+
auth?: A2AAuthRef;
|
|
1926
|
+
}
|
|
1927
|
+
/** The immutable asset DID URL, mutable workspace binding, and exact agent
|
|
1928
|
+
* asset hash from importing an agent. */
|
|
1929
|
+
interface A2AImportAgentResult {
|
|
1930
|
+
/** Mutable workspace binding, e.g. `w/a2a/agents/venue-b-bot`. */
|
|
1931
|
+
path?: string;
|
|
1932
|
+
/** Immutable agent-asset hash. */
|
|
1933
|
+
a2aAgentAsset?: string;
|
|
1934
|
+
/** Whether the binding was written. */
|
|
1935
|
+
stored?: boolean;
|
|
1936
|
+
/** Full immutable DID URL of the agent asset. */
|
|
1937
|
+
id?: string;
|
|
1938
|
+
}
|
|
1939
|
+
/** One part of an A2A message/artifact (v1 wire format). */
|
|
1940
|
+
interface A2APart {
|
|
1941
|
+
type?: string;
|
|
1942
|
+
kind?: string;
|
|
1943
|
+
text?: string;
|
|
1944
|
+
data?: unknown;
|
|
1945
|
+
}
|
|
1946
|
+
interface A2AMessage {
|
|
1947
|
+
role: string;
|
|
1948
|
+
parts: A2APart[];
|
|
1949
|
+
messageId?: string;
|
|
1950
|
+
}
|
|
1951
|
+
/** The remote A2A Task snapshot a send mirrors onto the local Job's output —
|
|
1952
|
+
* final when the Job reaches a terminal state, a live snapshot while paused. */
|
|
1953
|
+
interface A2ATask {
|
|
1954
|
+
id?: string;
|
|
1955
|
+
contextId?: string;
|
|
1956
|
+
status?: {
|
|
1957
|
+
state?: string;
|
|
1958
|
+
timestamp?: string;
|
|
1959
|
+
};
|
|
1960
|
+
artifacts?: {
|
|
1961
|
+
artifactId?: string;
|
|
1962
|
+
parts?: A2APart[];
|
|
1963
|
+
}[];
|
|
1964
|
+
history?: A2AMessage[];
|
|
1965
|
+
[key: string]: unknown;
|
|
1966
|
+
}
|
|
1856
1967
|
|
|
1857
1968
|
/** Parse a Retry-After header (delta-seconds or HTTP-date) to ms from now. */
|
|
1858
1969
|
declare function parseRetryAfterMs(header: string | null, nowMs: number): number;
|
|
@@ -2147,4 +2258,4 @@ declare function grant(ownerPrivateKey: Uint8Array, audienceDID: string, withRes
|
|
|
2147
2258
|
*/
|
|
2148
2259
|
declare function relayDelegation(privateKey: Uint8Array, venueDID: string, lifetimeSeconds: number, caps?: UCANCapability[]): string;
|
|
2149
2260
|
|
|
2150
|
-
export { type AdapterInfo, AdapterManager, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentCycleEndEvent, type AgentCycleStartEvent, type AgentDeleteInput, type AgentDeleteResult, type AgentEvent, type AgentEventEnvelope, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInferenceEndEvent, type AgentInferenceStartEvent, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentRenameSessionResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, type AgentRunEndEvent, type AgentRunStartEvent, type AgentSession, type AgentSessionListOptions, type AgentSessionMetadata, AgentSessionNotFoundError, type AgentSessionPage, AgentStatus, type AgentStatusEvent, type AgentSuspendResult, type AgentToolResultEvent, type AgentToolStartEvent, 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 };
|
|
2261
|
+
export { type A2AAuthRef, type A2AImportAgentInput, type A2AImportAgentResult, A2AManager, type A2AMessage, type A2APart, type A2ATask, type AdapterInfo, AdapterManager, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentCycleEndEvent, type AgentCycleStartEvent, type AgentDeleteInput, type AgentDeleteResult, type AgentEvent, type AgentEventEnvelope, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInferenceEndEvent, type AgentInferenceStartEvent, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentRenameSessionResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, type AgentRunEndEvent, type AgentRunStartEvent, type AgentSession, type AgentSessionListOptions, type AgentSessionMetadata, AgentSessionNotFoundError, type AgentSessionPage, AgentStatus, type AgentStatusEvent, type AgentSuspendResult, type AgentToolResultEvent, type AgentToolStartEvent, 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
|
@@ -174,7 +174,9 @@ declare abstract class Asset {
|
|
|
174
174
|
*/
|
|
175
175
|
getContent(): Promise<ReadableStream<Uint8Array> | null>;
|
|
176
176
|
/**
|
|
177
|
-
* Get the URL for downloading asset content
|
|
177
|
+
* Get the URL for downloading asset content. Resolves any reference form
|
|
178
|
+
* this asset was addressed by, via the venue's canonical any-ref content
|
|
179
|
+
* route (covia#368).
|
|
178
180
|
* @returns {string} The URL for downloading the asset content
|
|
179
181
|
*/
|
|
180
182
|
getContentURL(): string;
|
|
@@ -368,7 +370,6 @@ interface AgentManagerVenue extends VenueRequestContext {
|
|
|
368
370
|
read(path: string, maxSize?: number): Promise<WorkspaceReadResult>;
|
|
369
371
|
slice(path: string, offset?: number, limit?: number): Promise<WorkspaceSliceResult>;
|
|
370
372
|
};
|
|
371
|
-
lastKnownStatus?: StatusData;
|
|
372
373
|
}
|
|
373
374
|
declare class AgentManager {
|
|
374
375
|
private venue;
|
|
@@ -376,7 +377,10 @@ declare class AgentManager {
|
|
|
376
377
|
private agentSseSupported;
|
|
377
378
|
constructor(venue: AgentManagerVenue);
|
|
378
379
|
/** Whether the venue serves `GET /api/v1/agents`: no if a probe already
|
|
379
|
-
* 404'd
|
|
380
|
+
* 404'd. No version fast-path — a venue's self-reported version is weaker
|
|
381
|
+
* evidence than its answer to the request (an embedded venue can report
|
|
382
|
+
* its host application's version instead of its own; see covia-sdk#36).
|
|
383
|
+
* Rely purely on the lazy 404 latch, same as UserManager.usersGet. */
|
|
380
384
|
private supportsAgentsGet;
|
|
381
385
|
/** A job-free agents GET that rejects when the endpoint is unavailable. */
|
|
382
386
|
private agentsGet;
|
|
@@ -521,8 +525,11 @@ declare class AssetManager {
|
|
|
521
525
|
*/
|
|
522
526
|
putContent(assetId: string, content: BodyInit): Promise<ContentHashResult>;
|
|
523
527
|
/**
|
|
524
|
-
* Get asset content
|
|
525
|
-
*
|
|
528
|
+
* Get asset content. Resolves any reference form the metadata endpoint
|
|
529
|
+
* does — a bare hash, `a/<hash>`, a workspace/operation path, or a
|
|
530
|
+
* DID-qualified URL — via the venue's canonical `GET /api/v1/content/{ref}`
|
|
531
|
+
* (covia#368), not the hash-only legacy `assets/{id}/content` route.
|
|
532
|
+
* @param assetId - Asset reference (any form)
|
|
526
533
|
*/
|
|
527
534
|
getContent(assetId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
528
535
|
/**
|
|
@@ -581,7 +588,6 @@ declare class OperationManager {
|
|
|
581
588
|
|
|
582
589
|
interface WorkspaceManagerVenue extends VenueRequestContext {
|
|
583
590
|
operations: OperationRunner;
|
|
584
|
-
lastKnownStatus?: StatusData;
|
|
585
591
|
}
|
|
586
592
|
/**
|
|
587
593
|
* Workspace (lattice) operations against a venue.
|
|
@@ -609,9 +615,10 @@ declare class WorkspaceManager {
|
|
|
609
615
|
private _values;
|
|
610
616
|
/**
|
|
611
617
|
* Whether the venue serves `GET /api/v1/values/*`: no if a probe already
|
|
612
|
-
* 404'd
|
|
613
|
-
*
|
|
614
|
-
*
|
|
618
|
+
* 404'd. No version fast-path — a venue's self-reported version is weaker
|
|
619
|
+
* evidence than its answer to the request (an embedded venue can report
|
|
620
|
+
* its host application's version instead of its own; see covia-sdk#36).
|
|
621
|
+
* Rely purely on the lazy 404 latch, same as UserManager.usersGet.
|
|
615
622
|
*/
|
|
616
623
|
private supportsValues;
|
|
617
624
|
private unsupported;
|
|
@@ -828,6 +835,47 @@ declare class UserManager {
|
|
|
828
835
|
revokeAuthenticator(key: string, did?: string, ucans?: string[]): Promise<AuthenticatorRevokeResult>;
|
|
829
836
|
}
|
|
830
837
|
|
|
838
|
+
interface OpOps {
|
|
839
|
+
run<T = unknown>(assetId: string, input?: unknown, options?: InvokeOptions): Promise<T>;
|
|
840
|
+
invoke(assetId: string, input?: unknown, options?: InvokeOptions): Promise<Job>;
|
|
841
|
+
}
|
|
842
|
+
interface A2AManagerVenue {
|
|
843
|
+
operations: OpOps;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Bring-your-own-agent (A2A): import a remote A2A endpoint or another Covia
|
|
847
|
+
* agent as an immutable agent Asset, then task it. Both calls persist a Job
|
|
848
|
+
* (the venue records the import and mirrors the remote Task's lifecycle onto
|
|
849
|
+
* `send`'s Job) — there is no job-free surface here.
|
|
850
|
+
*/
|
|
851
|
+
declare class A2AManager {
|
|
852
|
+
private venue;
|
|
853
|
+
constructor(venue: A2AManagerVenue);
|
|
854
|
+
/**
|
|
855
|
+
* Register a remote A2A endpoint or Covia agent as an immutable agent
|
|
856
|
+
* Asset, with a mutable binding at `w/a2a/agents/<name>`. Waits for the
|
|
857
|
+
* import to complete and returns its result directly.
|
|
858
|
+
*/
|
|
859
|
+
importAgent(input: A2AImportAgentInput): Promise<A2AImportAgentResult>;
|
|
860
|
+
/**
|
|
861
|
+
* Task an imported agent. Returns the raw Job rather than waiting for a
|
|
862
|
+
* result: the local Job mirrors the remote Task's lifecycle, so a reply
|
|
863
|
+
* that pauses (INPUT_REQUIRED, AUTH_REQUIRED) is a paused Job the caller
|
|
864
|
+
* inspects and continues via `job.sendMessage()` — the same shape as any
|
|
865
|
+
* other paused job, not a special case for A2A. Once the Job reaches a
|
|
866
|
+
* terminal state, `job.output` is the final remote `A2ATask`.
|
|
867
|
+
*
|
|
868
|
+
* @param agent Imported agent reference — `w/a2a/agents/<name>` or its
|
|
869
|
+
* immutable `did:.../a/<hash>` id.
|
|
870
|
+
* @param message An A2A Message: `{ role, parts, messageId? }`.
|
|
871
|
+
* @param options.taskId Continue an existing remote Task instead of
|
|
872
|
+
* starting a new one.
|
|
873
|
+
*/
|
|
874
|
+
send(agent: string, message: A2AMessage, options?: {
|
|
875
|
+
taskId?: string;
|
|
876
|
+
}): Promise<Job>;
|
|
877
|
+
}
|
|
878
|
+
|
|
831
879
|
/**
|
|
832
880
|
* Resolve a non-DID venue id into the ordered list of base URLs that
|
|
833
881
|
* {@link Venue.connect} will try in turn. Explicit `http(s)://` inputs are
|
|
@@ -884,6 +932,7 @@ declare class Venue implements VenueInterface {
|
|
|
884
932
|
private _memory?;
|
|
885
933
|
private _dlfs?;
|
|
886
934
|
private _users?;
|
|
935
|
+
private _a2a?;
|
|
887
936
|
get adapters(): AdapterManager;
|
|
888
937
|
get agents(): AgentManager;
|
|
889
938
|
get jobs(): JobManager;
|
|
@@ -896,6 +945,7 @@ declare class Venue implements VenueInterface {
|
|
|
896
945
|
get memory(): MemoryManager;
|
|
897
946
|
get dlfs(): DLFSManager;
|
|
898
947
|
get users(): UserManager;
|
|
948
|
+
get a2a(): A2AManager;
|
|
899
949
|
constructor(options?: VenueOptions);
|
|
900
950
|
/**
|
|
901
951
|
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
@@ -1853,6 +1903,67 @@ declare class AgentSessionNotFoundError extends CoviaError {
|
|
|
1853
1903
|
readonly sessionId: string;
|
|
1854
1904
|
constructor(agentId: string, sessionId: string);
|
|
1855
1905
|
}
|
|
1906
|
+
/** Stored authentication binding for an imported A2A agent — a reference to
|
|
1907
|
+
* a secret, never a literal credential. */
|
|
1908
|
+
interface A2AAuthRef {
|
|
1909
|
+
/** Agent Card-declared API key or Bearer scheme name. */
|
|
1910
|
+
scheme?: string;
|
|
1911
|
+
/** Bearer auth needed to discover a private card. */
|
|
1912
|
+
kind?: 'bearer';
|
|
1913
|
+
/** `s/<name>` — the stored secret this binds to. */
|
|
1914
|
+
secret: string;
|
|
1915
|
+
}
|
|
1916
|
+
interface A2AImportAgentInput {
|
|
1917
|
+
/** Local alias matching `[a-z0-9-]{1,64}`; creates `w/a2a/agents/<name>`. */
|
|
1918
|
+
name: string;
|
|
1919
|
+
/** Base URL of a standard external A2A agent. Exactly one of `url`/`coviaAgent`. */
|
|
1920
|
+
url?: string;
|
|
1921
|
+
/** Covia grid agent address: local `g/<agentId>` or full `<ownerDID>/g/<agentId>`. */
|
|
1922
|
+
coviaAgent?: string;
|
|
1923
|
+
/** Base URL of the venue hosting `coviaAgent` — required for a full address. */
|
|
1924
|
+
venue?: string;
|
|
1925
|
+
auth?: A2AAuthRef;
|
|
1926
|
+
}
|
|
1927
|
+
/** The immutable asset DID URL, mutable workspace binding, and exact agent
|
|
1928
|
+
* asset hash from importing an agent. */
|
|
1929
|
+
interface A2AImportAgentResult {
|
|
1930
|
+
/** Mutable workspace binding, e.g. `w/a2a/agents/venue-b-bot`. */
|
|
1931
|
+
path?: string;
|
|
1932
|
+
/** Immutable agent-asset hash. */
|
|
1933
|
+
a2aAgentAsset?: string;
|
|
1934
|
+
/** Whether the binding was written. */
|
|
1935
|
+
stored?: boolean;
|
|
1936
|
+
/** Full immutable DID URL of the agent asset. */
|
|
1937
|
+
id?: string;
|
|
1938
|
+
}
|
|
1939
|
+
/** One part of an A2A message/artifact (v1 wire format). */
|
|
1940
|
+
interface A2APart {
|
|
1941
|
+
type?: string;
|
|
1942
|
+
kind?: string;
|
|
1943
|
+
text?: string;
|
|
1944
|
+
data?: unknown;
|
|
1945
|
+
}
|
|
1946
|
+
interface A2AMessage {
|
|
1947
|
+
role: string;
|
|
1948
|
+
parts: A2APart[];
|
|
1949
|
+
messageId?: string;
|
|
1950
|
+
}
|
|
1951
|
+
/** The remote A2A Task snapshot a send mirrors onto the local Job's output —
|
|
1952
|
+
* final when the Job reaches a terminal state, a live snapshot while paused. */
|
|
1953
|
+
interface A2ATask {
|
|
1954
|
+
id?: string;
|
|
1955
|
+
contextId?: string;
|
|
1956
|
+
status?: {
|
|
1957
|
+
state?: string;
|
|
1958
|
+
timestamp?: string;
|
|
1959
|
+
};
|
|
1960
|
+
artifacts?: {
|
|
1961
|
+
artifactId?: string;
|
|
1962
|
+
parts?: A2APart[];
|
|
1963
|
+
}[];
|
|
1964
|
+
history?: A2AMessage[];
|
|
1965
|
+
[key: string]: unknown;
|
|
1966
|
+
}
|
|
1856
1967
|
|
|
1857
1968
|
/** Parse a Retry-After header (delta-seconds or HTTP-date) to ms from now. */
|
|
1858
1969
|
declare function parseRetryAfterMs(header: string | null, nowMs: number): number;
|
|
@@ -2147,4 +2258,4 @@ declare function grant(ownerPrivateKey: Uint8Array, audienceDID: string, withRes
|
|
|
2147
2258
|
*/
|
|
2148
2259
|
declare function relayDelegation(privateKey: Uint8Array, venueDID: string, lifetimeSeconds: number, caps?: UCANCapability[]): string;
|
|
2149
2260
|
|
|
2150
|
-
export { type AdapterInfo, AdapterManager, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentCycleEndEvent, type AgentCycleStartEvent, type AgentDeleteInput, type AgentDeleteResult, type AgentEvent, type AgentEventEnvelope, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInferenceEndEvent, type AgentInferenceStartEvent, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentRenameSessionResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, type AgentRunEndEvent, type AgentRunStartEvent, type AgentSession, type AgentSessionListOptions, type AgentSessionMetadata, AgentSessionNotFoundError, type AgentSessionPage, AgentStatus, type AgentStatusEvent, type AgentSuspendResult, type AgentToolResultEvent, type AgentToolStartEvent, 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 };
|
|
2261
|
+
export { type A2AAuthRef, type A2AImportAgentInput, type A2AImportAgentResult, A2AManager, type A2AMessage, type A2APart, type A2ATask, type AdapterInfo, AdapterManager, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentCycleEndEvent, type AgentCycleStartEvent, type AgentDeleteInput, type AgentDeleteResult, type AgentEvent, type AgentEventEnvelope, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInferenceEndEvent, type AgentInferenceStartEvent, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentRenameSessionResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, type AgentRunEndEvent, type AgentRunStartEvent, type AgentSession, type AgentSessionListOptions, type AgentSessionMetadata, AgentSessionNotFoundError, type AgentSessionPage, AgentStatus, type AgentStatusEvent, type AgentSuspendResult, type AgentToolResultEvent, type AgentToolStartEvent, 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
|
@@ -1157,7 +1157,10 @@ function createEdDSAJWT(privateKey, lifetimeSeconds = 300, audience) {
|
|
|
1157
1157
|
sub: did,
|
|
1158
1158
|
iss: did,
|
|
1159
1159
|
iat: nowSecs,
|
|
1160
|
-
|
|
1160
|
+
// Floored defensively — lifetimeSeconds has no integer enforcement at
|
|
1161
|
+
// the type level, and a float exp claim can fail JWT validation on
|
|
1162
|
+
// servers that require a bare integer Unix timestamp (covia-sdk#46).
|
|
1163
|
+
exp: Math.floor(nowSecs + lifetimeSeconds)
|
|
1161
1164
|
};
|
|
1162
1165
|
if (audience) claims.aud = audience;
|
|
1163
1166
|
const payload = JSON.stringify(claims);
|
|
@@ -1712,12 +1715,6 @@ function venueStream(venue, path, options = {}) {
|
|
|
1712
1715
|
}
|
|
1713
1716
|
|
|
1714
1717
|
// src/venue-features.ts
|
|
1715
|
-
function versionAtLeast(version, major, minor) {
|
|
1716
|
-
const m = version?.match(/^(\d+)\.(\d+)/);
|
|
1717
|
-
if (!m) return true;
|
|
1718
|
-
const [maj, min] = [Number(m[1]), Number(m[2])];
|
|
1719
|
-
return maj > major || maj === major && min >= minor;
|
|
1720
|
-
}
|
|
1721
1718
|
var ROUTE_MISSING_404 = /\bEndpoint (GET|POST|PUT|DELETE|PATCH|HEAD) /;
|
|
1722
1719
|
|
|
1723
1720
|
// src/values-util.ts
|
|
@@ -1772,13 +1769,11 @@ var AgentManager = class {
|
|
|
1772
1769
|
this.agentSseSupported = true;
|
|
1773
1770
|
}
|
|
1774
1771
|
/** Whether the venue serves `GET /api/v1/agents`: no if a probe already
|
|
1775
|
-
* 404'd
|
|
1772
|
+
* 404'd. No version fast-path — a venue's self-reported version is weaker
|
|
1773
|
+
* evidence than its answer to the request (an embedded venue can report
|
|
1774
|
+
* its host application's version instead of its own; see covia-sdk#36).
|
|
1775
|
+
* Rely purely on the lazy 404 latch, same as UserManager.usersGet. */
|
|
1776
1776
|
supportsAgentsGet() {
|
|
1777
|
-
if (!this.agentsGetSupported) return false;
|
|
1778
|
-
const status = this.venue.lastKnownStatus;
|
|
1779
|
-
if (status && (!status.version || !versionAtLeast(status.version, 0, 4))) {
|
|
1780
|
-
this.agentsGetSupported = false;
|
|
1781
|
-
}
|
|
1782
1777
|
return this.agentsGetSupported;
|
|
1783
1778
|
}
|
|
1784
1779
|
/** A job-free agents GET that rejects when the endpoint is unavailable. */
|
|
@@ -2270,11 +2265,13 @@ var Asset = class {
|
|
|
2270
2265
|
return this._assets.getContent(this.id);
|
|
2271
2266
|
}
|
|
2272
2267
|
/**
|
|
2273
|
-
* Get the URL for downloading asset content
|
|
2268
|
+
* Get the URL for downloading asset content. Resolves any reference form
|
|
2269
|
+
* this asset was addressed by, via the venue's canonical any-ref content
|
|
2270
|
+
* route (covia#368).
|
|
2274
2271
|
* @returns {string} The URL for downloading the asset content
|
|
2275
2272
|
*/
|
|
2276
2273
|
getContentURL() {
|
|
2277
|
-
return `${this.venue.baseUrl}/api/v1/
|
|
2274
|
+
return `${this.venue.baseUrl}/api/v1/content/${this.id}`;
|
|
2278
2275
|
}
|
|
2279
2276
|
/**
|
|
2280
2277
|
* Execute the operation and await its result.
|
|
@@ -2451,14 +2448,17 @@ var AssetManager = class {
|
|
|
2451
2448
|
}
|
|
2452
2449
|
}
|
|
2453
2450
|
/**
|
|
2454
|
-
* Get asset content
|
|
2455
|
-
*
|
|
2451
|
+
* Get asset content. Resolves any reference form the metadata endpoint
|
|
2452
|
+
* does — a bare hash, `a/<hash>`, a workspace/operation path, or a
|
|
2453
|
+
* DID-qualified URL — via the venue's canonical `GET /api/v1/content/{ref}`
|
|
2454
|
+
* (covia#368), not the hash-only legacy `assets/{id}/content` route.
|
|
2455
|
+
* @param assetId - Asset reference (any form)
|
|
2456
2456
|
*/
|
|
2457
2457
|
async getContent(assetId) {
|
|
2458
2458
|
try {
|
|
2459
2459
|
const response = await venueStream(
|
|
2460
2460
|
this.venue,
|
|
2461
|
-
`/api/v1/
|
|
2461
|
+
`/api/v1/content/${assetId}`,
|
|
2462
2462
|
{ contentType: null }
|
|
2463
2463
|
);
|
|
2464
2464
|
return response.body;
|
|
@@ -2598,16 +2598,12 @@ var WorkspaceManager = class {
|
|
|
2598
2598
|
}
|
|
2599
2599
|
/**
|
|
2600
2600
|
* Whether the venue serves `GET /api/v1/values/*`: no if a probe already
|
|
2601
|
-
* 404'd
|
|
2602
|
-
*
|
|
2603
|
-
*
|
|
2601
|
+
* 404'd. No version fast-path — a venue's self-reported version is weaker
|
|
2602
|
+
* evidence than its answer to the request (an embedded venue can report
|
|
2603
|
+
* its host application's version instead of its own; see covia-sdk#36).
|
|
2604
|
+
* Rely purely on the lazy 404 latch, same as UserManager.usersGet.
|
|
2604
2605
|
*/
|
|
2605
2606
|
supportsValues() {
|
|
2606
|
-
if (!this.valuesSupported) return false;
|
|
2607
|
-
const status = this.venue.lastKnownStatus;
|
|
2608
|
-
if (status && (!status.version || !versionAtLeast(status.version, 0, 3))) {
|
|
2609
|
-
this.valuesSupported = false;
|
|
2610
|
-
}
|
|
2611
2607
|
return this.valuesSupported;
|
|
2612
2608
|
}
|
|
2613
2609
|
unsupported(feature) {
|
|
@@ -2970,6 +2966,44 @@ var UserManager = class {
|
|
|
2970
2966
|
}
|
|
2971
2967
|
};
|
|
2972
2968
|
|
|
2969
|
+
// src/A2AManager.ts
|
|
2970
|
+
var IMPORT_AGENT_OP = "v/ops/a2a/import-agent";
|
|
2971
|
+
var SEND_OP = "v/ops/a2a/send";
|
|
2972
|
+
var A2AManager = class {
|
|
2973
|
+
constructor(venue) {
|
|
2974
|
+
this.venue = venue;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Register a remote A2A endpoint or Covia agent as an immutable agent
|
|
2978
|
+
* Asset, with a mutable binding at `w/a2a/agents/<name>`. Waits for the
|
|
2979
|
+
* import to complete and returns its result directly.
|
|
2980
|
+
*/
|
|
2981
|
+
async importAgent(input) {
|
|
2982
|
+
return this.venue.operations.run(IMPORT_AGENT_OP, input);
|
|
2983
|
+
}
|
|
2984
|
+
/**
|
|
2985
|
+
* Task an imported agent. Returns the raw Job rather than waiting for a
|
|
2986
|
+
* result: the local Job mirrors the remote Task's lifecycle, so a reply
|
|
2987
|
+
* that pauses (INPUT_REQUIRED, AUTH_REQUIRED) is a paused Job the caller
|
|
2988
|
+
* inspects and continues via `job.sendMessage()` — the same shape as any
|
|
2989
|
+
* other paused job, not a special case for A2A. Once the Job reaches a
|
|
2990
|
+
* terminal state, `job.output` is the final remote `A2ATask`.
|
|
2991
|
+
*
|
|
2992
|
+
* @param agent Imported agent reference — `w/a2a/agents/<name>` or its
|
|
2993
|
+
* immutable `did:.../a/<hash>` id.
|
|
2994
|
+
* @param message An A2A Message: `{ role, parts, messageId? }`.
|
|
2995
|
+
* @param options.taskId Continue an existing remote Task instead of
|
|
2996
|
+
* starting a new one.
|
|
2997
|
+
*/
|
|
2998
|
+
async send(agent, message, options) {
|
|
2999
|
+
return this.venue.operations.invoke(SEND_OP, {
|
|
3000
|
+
agent,
|
|
3001
|
+
message,
|
|
3002
|
+
...options?.taskId !== void 0 && { taskId: options.taskId }
|
|
3003
|
+
});
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
3006
|
+
|
|
2973
3007
|
// src/Agent.ts
|
|
2974
3008
|
var Agent = class _Agent {
|
|
2975
3009
|
constructor(id, venue) {
|
|
@@ -3178,6 +3212,9 @@ var Venue = class _Venue {
|
|
|
3178
3212
|
get users() {
|
|
3179
3213
|
return this._users ?? (this._users = new UserManager(this));
|
|
3180
3214
|
}
|
|
3215
|
+
get a2a() {
|
|
3216
|
+
return this._a2a ?? (this._a2a = new A2AManager(this));
|
|
3217
|
+
}
|
|
3181
3218
|
/**
|
|
3182
3219
|
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
3183
3220
|
* venue is auth-gated (status answers 401/403 — public access disabled), the
|
|
@@ -3487,7 +3524,12 @@ function createUCANJWT(privateKey, audienceDID, att, lifetimeSeconds, proofs = [
|
|
|
3487
3524
|
ucv: UCV_VERSION,
|
|
3488
3525
|
att,
|
|
3489
3526
|
prf: proofs,
|
|
3490
|
-
|
|
3527
|
+
// Floored even though nowSecs already is: lifetimeSeconds is a public
|
|
3528
|
+
// number param with no integer enforcement, and Convex's JSON reader
|
|
3529
|
+
// only decodes a bare integer as CVMLong — a float exp (e.g. a caller
|
|
3530
|
+
// passing Date.now()/1000 + n instead of an integer offset) becomes a
|
|
3531
|
+
// CVMDouble the venue's UcanJwtValidator rejects outright (covia-sdk#46).
|
|
3532
|
+
exp: lifetimeSeconds === null ? null : Math.floor(nowSecs + lifetimeSeconds)
|
|
3491
3533
|
};
|
|
3492
3534
|
const signingInput = `${base64UrlEncode(encoder2.encode(header))}.${base64UrlEncode(encoder2.encode(JSON.stringify(claims)))}`;
|
|
3493
3535
|
const signature = sign(encoder2.encode(signingInput), privateKey);
|
|
@@ -3509,6 +3551,7 @@ function relayDelegation(privateKey, venueDID, lifetimeSeconds, caps = []) {
|
|
|
3509
3551
|
(*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
|
|
3510
3552
|
*/
|
|
3511
3553
|
|
|
3554
|
+
exports.A2AManager = A2AManager;
|
|
3512
3555
|
exports.AdapterManager = AdapterManager;
|
|
3513
3556
|
exports.Agent = Agent;
|
|
3514
3557
|
exports.AgentManager = AgentManager;
|
package/dist/index.mjs
CHANGED
|
@@ -1155,7 +1155,10 @@ function createEdDSAJWT(privateKey, lifetimeSeconds = 300, audience) {
|
|
|
1155
1155
|
sub: did,
|
|
1156
1156
|
iss: did,
|
|
1157
1157
|
iat: nowSecs,
|
|
1158
|
-
|
|
1158
|
+
// Floored defensively — lifetimeSeconds has no integer enforcement at
|
|
1159
|
+
// the type level, and a float exp claim can fail JWT validation on
|
|
1160
|
+
// servers that require a bare integer Unix timestamp (covia-sdk#46).
|
|
1161
|
+
exp: Math.floor(nowSecs + lifetimeSeconds)
|
|
1159
1162
|
};
|
|
1160
1163
|
if (audience) claims.aud = audience;
|
|
1161
1164
|
const payload = JSON.stringify(claims);
|
|
@@ -1710,12 +1713,6 @@ function venueStream(venue, path, options = {}) {
|
|
|
1710
1713
|
}
|
|
1711
1714
|
|
|
1712
1715
|
// src/venue-features.ts
|
|
1713
|
-
function versionAtLeast(version, major, minor) {
|
|
1714
|
-
const m = version?.match(/^(\d+)\.(\d+)/);
|
|
1715
|
-
if (!m) return true;
|
|
1716
|
-
const [maj, min] = [Number(m[1]), Number(m[2])];
|
|
1717
|
-
return maj > major || maj === major && min >= minor;
|
|
1718
|
-
}
|
|
1719
1716
|
var ROUTE_MISSING_404 = /\bEndpoint (GET|POST|PUT|DELETE|PATCH|HEAD) /;
|
|
1720
1717
|
|
|
1721
1718
|
// src/values-util.ts
|
|
@@ -1770,13 +1767,11 @@ var AgentManager = class {
|
|
|
1770
1767
|
this.agentSseSupported = true;
|
|
1771
1768
|
}
|
|
1772
1769
|
/** Whether the venue serves `GET /api/v1/agents`: no if a probe already
|
|
1773
|
-
* 404'd
|
|
1770
|
+
* 404'd. No version fast-path — a venue's self-reported version is weaker
|
|
1771
|
+
* evidence than its answer to the request (an embedded venue can report
|
|
1772
|
+
* its host application's version instead of its own; see covia-sdk#36).
|
|
1773
|
+
* Rely purely on the lazy 404 latch, same as UserManager.usersGet. */
|
|
1774
1774
|
supportsAgentsGet() {
|
|
1775
|
-
if (!this.agentsGetSupported) return false;
|
|
1776
|
-
const status = this.venue.lastKnownStatus;
|
|
1777
|
-
if (status && (!status.version || !versionAtLeast(status.version, 0, 4))) {
|
|
1778
|
-
this.agentsGetSupported = false;
|
|
1779
|
-
}
|
|
1780
1775
|
return this.agentsGetSupported;
|
|
1781
1776
|
}
|
|
1782
1777
|
/** A job-free agents GET that rejects when the endpoint is unavailable. */
|
|
@@ -2268,11 +2263,13 @@ var Asset = class {
|
|
|
2268
2263
|
return this._assets.getContent(this.id);
|
|
2269
2264
|
}
|
|
2270
2265
|
/**
|
|
2271
|
-
* Get the URL for downloading asset content
|
|
2266
|
+
* Get the URL for downloading asset content. Resolves any reference form
|
|
2267
|
+
* this asset was addressed by, via the venue's canonical any-ref content
|
|
2268
|
+
* route (covia#368).
|
|
2272
2269
|
* @returns {string} The URL for downloading the asset content
|
|
2273
2270
|
*/
|
|
2274
2271
|
getContentURL() {
|
|
2275
|
-
return `${this.venue.baseUrl}/api/v1/
|
|
2272
|
+
return `${this.venue.baseUrl}/api/v1/content/${this.id}`;
|
|
2276
2273
|
}
|
|
2277
2274
|
/**
|
|
2278
2275
|
* Execute the operation and await its result.
|
|
@@ -2449,14 +2446,17 @@ var AssetManager = class {
|
|
|
2449
2446
|
}
|
|
2450
2447
|
}
|
|
2451
2448
|
/**
|
|
2452
|
-
* Get asset content
|
|
2453
|
-
*
|
|
2449
|
+
* Get asset content. Resolves any reference form the metadata endpoint
|
|
2450
|
+
* does — a bare hash, `a/<hash>`, a workspace/operation path, or a
|
|
2451
|
+
* DID-qualified URL — via the venue's canonical `GET /api/v1/content/{ref}`
|
|
2452
|
+
* (covia#368), not the hash-only legacy `assets/{id}/content` route.
|
|
2453
|
+
* @param assetId - Asset reference (any form)
|
|
2454
2454
|
*/
|
|
2455
2455
|
async getContent(assetId) {
|
|
2456
2456
|
try {
|
|
2457
2457
|
const response = await venueStream(
|
|
2458
2458
|
this.venue,
|
|
2459
|
-
`/api/v1/
|
|
2459
|
+
`/api/v1/content/${assetId}`,
|
|
2460
2460
|
{ contentType: null }
|
|
2461
2461
|
);
|
|
2462
2462
|
return response.body;
|
|
@@ -2596,16 +2596,12 @@ var WorkspaceManager = class {
|
|
|
2596
2596
|
}
|
|
2597
2597
|
/**
|
|
2598
2598
|
* Whether the venue serves `GET /api/v1/values/*`: no if a probe already
|
|
2599
|
-
* 404'd
|
|
2600
|
-
*
|
|
2601
|
-
*
|
|
2599
|
+
* 404'd. No version fast-path — a venue's self-reported version is weaker
|
|
2600
|
+
* evidence than its answer to the request (an embedded venue can report
|
|
2601
|
+
* its host application's version instead of its own; see covia-sdk#36).
|
|
2602
|
+
* Rely purely on the lazy 404 latch, same as UserManager.usersGet.
|
|
2602
2603
|
*/
|
|
2603
2604
|
supportsValues() {
|
|
2604
|
-
if (!this.valuesSupported) return false;
|
|
2605
|
-
const status = this.venue.lastKnownStatus;
|
|
2606
|
-
if (status && (!status.version || !versionAtLeast(status.version, 0, 3))) {
|
|
2607
|
-
this.valuesSupported = false;
|
|
2608
|
-
}
|
|
2609
2605
|
return this.valuesSupported;
|
|
2610
2606
|
}
|
|
2611
2607
|
unsupported(feature) {
|
|
@@ -2968,6 +2964,44 @@ var UserManager = class {
|
|
|
2968
2964
|
}
|
|
2969
2965
|
};
|
|
2970
2966
|
|
|
2967
|
+
// src/A2AManager.ts
|
|
2968
|
+
var IMPORT_AGENT_OP = "v/ops/a2a/import-agent";
|
|
2969
|
+
var SEND_OP = "v/ops/a2a/send";
|
|
2970
|
+
var A2AManager = class {
|
|
2971
|
+
constructor(venue) {
|
|
2972
|
+
this.venue = venue;
|
|
2973
|
+
}
|
|
2974
|
+
/**
|
|
2975
|
+
* Register a remote A2A endpoint or Covia agent as an immutable agent
|
|
2976
|
+
* Asset, with a mutable binding at `w/a2a/agents/<name>`. Waits for the
|
|
2977
|
+
* import to complete and returns its result directly.
|
|
2978
|
+
*/
|
|
2979
|
+
async importAgent(input) {
|
|
2980
|
+
return this.venue.operations.run(IMPORT_AGENT_OP, input);
|
|
2981
|
+
}
|
|
2982
|
+
/**
|
|
2983
|
+
* Task an imported agent. Returns the raw Job rather than waiting for a
|
|
2984
|
+
* result: the local Job mirrors the remote Task's lifecycle, so a reply
|
|
2985
|
+
* that pauses (INPUT_REQUIRED, AUTH_REQUIRED) is a paused Job the caller
|
|
2986
|
+
* inspects and continues via `job.sendMessage()` — the same shape as any
|
|
2987
|
+
* other paused job, not a special case for A2A. Once the Job reaches a
|
|
2988
|
+
* terminal state, `job.output` is the final remote `A2ATask`.
|
|
2989
|
+
*
|
|
2990
|
+
* @param agent Imported agent reference — `w/a2a/agents/<name>` or its
|
|
2991
|
+
* immutable `did:.../a/<hash>` id.
|
|
2992
|
+
* @param message An A2A Message: `{ role, parts, messageId? }`.
|
|
2993
|
+
* @param options.taskId Continue an existing remote Task instead of
|
|
2994
|
+
* starting a new one.
|
|
2995
|
+
*/
|
|
2996
|
+
async send(agent, message, options) {
|
|
2997
|
+
return this.venue.operations.invoke(SEND_OP, {
|
|
2998
|
+
agent,
|
|
2999
|
+
message,
|
|
3000
|
+
...options?.taskId !== void 0 && { taskId: options.taskId }
|
|
3001
|
+
});
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
|
|
2971
3005
|
// src/Agent.ts
|
|
2972
3006
|
var Agent = class _Agent {
|
|
2973
3007
|
constructor(id, venue) {
|
|
@@ -3176,6 +3210,9 @@ var Venue = class _Venue {
|
|
|
3176
3210
|
get users() {
|
|
3177
3211
|
return this._users ?? (this._users = new UserManager(this));
|
|
3178
3212
|
}
|
|
3213
|
+
get a2a() {
|
|
3214
|
+
return this._a2a ?? (this._a2a = new A2AManager(this));
|
|
3215
|
+
}
|
|
3179
3216
|
/**
|
|
3180
3217
|
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
3181
3218
|
* venue is auth-gated (status answers 401/403 — public access disabled), the
|
|
@@ -3485,7 +3522,12 @@ function createUCANJWT(privateKey, audienceDID, att, lifetimeSeconds, proofs = [
|
|
|
3485
3522
|
ucv: UCV_VERSION,
|
|
3486
3523
|
att,
|
|
3487
3524
|
prf: proofs,
|
|
3488
|
-
|
|
3525
|
+
// Floored even though nowSecs already is: lifetimeSeconds is a public
|
|
3526
|
+
// number param with no integer enforcement, and Convex's JSON reader
|
|
3527
|
+
// only decodes a bare integer as CVMLong — a float exp (e.g. a caller
|
|
3528
|
+
// passing Date.now()/1000 + n instead of an integer offset) becomes a
|
|
3529
|
+
// CVMDouble the venue's UcanJwtValidator rejects outright (covia-sdk#46).
|
|
3530
|
+
exp: lifetimeSeconds === null ? null : Math.floor(nowSecs + lifetimeSeconds)
|
|
3489
3531
|
};
|
|
3490
3532
|
const signingInput = `${base64UrlEncode(encoder2.encode(header))}.${base64UrlEncode(encoder2.encode(JSON.stringify(claims)))}`;
|
|
3491
3533
|
const signature = sign(encoder2.encode(signingInput), privateKey);
|
|
@@ -3507,4 +3549,4 @@ function relayDelegation(privateKey, venueDID, lifetimeSeconds, caps = []) {
|
|
|
3507
3549
|
(*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
|
|
3508
3550
|
*/
|
|
3509
3551
|
|
|
3510
|
-
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 };
|
|
3552
|
+
export { A2AManager, 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 };
|