@covia/covia-sdk 1.4.0 → 1.5.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/LICENSE.md +190 -21
- package/README.md +592 -533
- package/dist/index.d.mts +128 -2
- package/dist/index.d.ts +128 -2
- package/dist/index.js +145 -5
- package/dist/index.mjs +144 -6
- package/package.json +66 -66
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
declare class Agent {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly venue: VenueInterface;
|
|
4
|
+
private _agents;
|
|
5
|
+
constructor(id: string, venue: VenueInterface);
|
|
6
|
+
request(input?: any, wait?: boolean | number): Promise<AgentRequestResult>;
|
|
7
|
+
message(message: any): Promise<AgentMessageResult>;
|
|
8
|
+
chat(message: any, sessionId?: string): Promise<AgentChatResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a ChatSession bound to this agent.
|
|
11
|
+
* @param sessionId - Optional session ID to resume an existing session
|
|
12
|
+
*/
|
|
13
|
+
chatSession(sessionId?: string): ChatSession;
|
|
14
|
+
trigger(): Promise<AgentTriggerResult>;
|
|
15
|
+
query(): Promise<AgentQueryResult>;
|
|
16
|
+
suspend(): Promise<AgentSuspendResult>;
|
|
17
|
+
resume(autoWake?: boolean): Promise<AgentSuspendResult>;
|
|
18
|
+
update(options: {
|
|
19
|
+
config?: Record<string, any>;
|
|
20
|
+
state?: Record<string, any>;
|
|
21
|
+
}): Promise<any>;
|
|
22
|
+
cancelTask(taskId: string): Promise<any>;
|
|
23
|
+
info(): Promise<AgentInfoResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Fork this agent into a new agent.
|
|
26
|
+
* @param agentId - ID for the new forked agent
|
|
27
|
+
* @param options - Fork options
|
|
28
|
+
* @returns A new Agent instance for the forked agent
|
|
29
|
+
*/
|
|
30
|
+
fork(agentId: string, options?: {
|
|
31
|
+
config?: Record<string, any>;
|
|
32
|
+
includeTimeline?: boolean;
|
|
33
|
+
overwrite?: boolean;
|
|
34
|
+
}): Promise<Agent>;
|
|
35
|
+
context(task?: any): Promise<string>;
|
|
36
|
+
delete(remove?: boolean): Promise<AgentDeleteResult>;
|
|
37
|
+
}
|
|
38
|
+
declare class ChatSession {
|
|
39
|
+
readonly agent: Agent;
|
|
40
|
+
private _sessionId;
|
|
41
|
+
constructor(agent: Agent, sessionId?: string);
|
|
42
|
+
/** The session ID, or undefined if no message has been sent yet and no ID was provided. */
|
|
43
|
+
get sessionId(): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Send a message on this session.
|
|
46
|
+
* On the first call (when no sessionId is set), the server mints a new session.
|
|
47
|
+
* The returned sessionId is captured and reused for all subsequent calls.
|
|
48
|
+
*/
|
|
49
|
+
send(message: any): Promise<AgentChatResult>;
|
|
50
|
+
}
|
|
51
|
+
|
|
1
52
|
declare class Job {
|
|
2
53
|
id: string;
|
|
3
54
|
venue: VenueInterface;
|
|
@@ -244,6 +295,11 @@ declare class AgentManager {
|
|
|
244
295
|
resume(agentId: string, autoWake?: boolean): Promise<AgentSuspendResult>;
|
|
245
296
|
update(input: AgentUpdateInput): Promise<any>;
|
|
246
297
|
cancelTask(agentId: string, taskId: string): Promise<any>;
|
|
298
|
+
info(agentId: string): Promise<AgentInfoResult>;
|
|
299
|
+
fork(input: AgentForkInput): Promise<AgentForkResult>;
|
|
300
|
+
context(agentId: string, task?: any): Promise<string>;
|
|
301
|
+
completeTask(result?: any): Promise<AgentCompleteTaskResult>;
|
|
302
|
+
failTask(error: string): Promise<AgentFailTaskResult>;
|
|
247
303
|
}
|
|
248
304
|
|
|
249
305
|
interface JobManagerVenue {
|
|
@@ -271,6 +327,9 @@ interface AssetManagerVenue {
|
|
|
271
327
|
auth: {
|
|
272
328
|
apply(headers: Record<string, string>): void;
|
|
273
329
|
};
|
|
330
|
+
operations: {
|
|
331
|
+
run(assetId: string, input: any): Promise<any>;
|
|
332
|
+
};
|
|
274
333
|
}
|
|
275
334
|
declare class AssetManager {
|
|
276
335
|
private venue;
|
|
@@ -308,6 +367,12 @@ declare class AssetManager {
|
|
|
308
367
|
* @param assetId - Asset identifier
|
|
309
368
|
*/
|
|
310
369
|
getContent(assetId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
370
|
+
/**
|
|
371
|
+
* Pin a resolvable value into the content-addressed asset store.
|
|
372
|
+
* Idempotent — same value produces the same hash.
|
|
373
|
+
* @param path - Source address (hex hash, /a/<hash>, /o/<name>, /v/<path>, DID URL, or workspace path)
|
|
374
|
+
*/
|
|
375
|
+
pin(path: string): Promise<AssetPinResult>;
|
|
311
376
|
/**
|
|
312
377
|
* Clear the asset cache.
|
|
313
378
|
*/
|
|
@@ -330,7 +395,7 @@ declare class OperationManager {
|
|
|
330
395
|
list(): Promise<OperationInfo[]>;
|
|
331
396
|
/**
|
|
332
397
|
* Get details of a named operation
|
|
333
|
-
* @param name - Operation name (e.g., "
|
|
398
|
+
* @param name - Operation name (e.g., "v/ops/schema/infer")
|
|
334
399
|
*/
|
|
335
400
|
get(name: string): Promise<OperationInfo>;
|
|
336
401
|
/**
|
|
@@ -364,6 +429,8 @@ declare class WorkspaceManager {
|
|
|
364
429
|
append(path: string, value: any): Promise<WorkspaceAppendResult>;
|
|
365
430
|
list(path?: string, limit?: number, offset?: number): Promise<WorkspaceListResult>;
|
|
366
431
|
slice(path: string, offset?: number, limit?: number): Promise<WorkspaceSliceResult>;
|
|
432
|
+
copy(from: string, to: string): Promise<WorkspaceCopyResult>;
|
|
433
|
+
inspect(paths: string | string[], budget?: number, compact?: boolean): Promise<WorkspaceInspectResult>;
|
|
367
434
|
}
|
|
368
435
|
|
|
369
436
|
interface UCANManagerVenue {
|
|
@@ -450,6 +517,13 @@ declare class Venue implements VenueInterface {
|
|
|
450
517
|
* @returns {Promise<Job>}
|
|
451
518
|
*/
|
|
452
519
|
getJob(jobId: string): Promise<Job>;
|
|
520
|
+
/**
|
|
521
|
+
* Get a lazy Agent handle for the given agent ID.
|
|
522
|
+
* No network round-trip — the agent is not verified to exist.
|
|
523
|
+
* @param agentId - Agent identifier
|
|
524
|
+
* @returns {Agent} An Agent instance bound to this venue
|
|
525
|
+
*/
|
|
526
|
+
agent(agentId: string): Agent;
|
|
453
527
|
/**
|
|
454
528
|
* List secret names
|
|
455
529
|
* @returns {Promise<string[]>}
|
|
@@ -528,6 +602,7 @@ interface VenueInterface {
|
|
|
528
602
|
listSecrets(): Promise<string[]>;
|
|
529
603
|
putSecret(name: string, value: string): Promise<void>;
|
|
530
604
|
deleteSecret(name: string): Promise<void>;
|
|
605
|
+
agent(agentId: string): Agent;
|
|
531
606
|
close(): void;
|
|
532
607
|
}
|
|
533
608
|
type AssetID = string;
|
|
@@ -761,6 +836,57 @@ interface AgentCancelTaskInput {
|
|
|
761
836
|
agentId: string;
|
|
762
837
|
taskId: string;
|
|
763
838
|
}
|
|
839
|
+
interface AgentInfoResult {
|
|
840
|
+
agentId: string;
|
|
841
|
+
status: string;
|
|
842
|
+
config?: Record<string, any>;
|
|
843
|
+
stateConfig?: Record<string, any>;
|
|
844
|
+
timelineLength?: number;
|
|
845
|
+
tasks?: number;
|
|
846
|
+
error?: string;
|
|
847
|
+
}
|
|
848
|
+
interface AgentForkInput {
|
|
849
|
+
sourceId: string;
|
|
850
|
+
agentId: string;
|
|
851
|
+
config?: Record<string, any>;
|
|
852
|
+
includeTimeline?: boolean;
|
|
853
|
+
overwrite?: boolean;
|
|
854
|
+
}
|
|
855
|
+
interface AgentForkResult {
|
|
856
|
+
agentId: string;
|
|
857
|
+
status: string;
|
|
858
|
+
created: boolean;
|
|
859
|
+
forkedFrom: string;
|
|
860
|
+
}
|
|
861
|
+
interface AgentContextInput {
|
|
862
|
+
agentId: string;
|
|
863
|
+
task?: any;
|
|
864
|
+
}
|
|
865
|
+
interface AgentCompleteTaskResult {
|
|
866
|
+
agentId: string;
|
|
867
|
+
taskId: string;
|
|
868
|
+
status: string;
|
|
869
|
+
}
|
|
870
|
+
interface AgentFailTaskResult {
|
|
871
|
+
agentId: string;
|
|
872
|
+
taskId: string;
|
|
873
|
+
status: string;
|
|
874
|
+
}
|
|
875
|
+
interface AssetPinResult {
|
|
876
|
+
path: string;
|
|
877
|
+
hash: string;
|
|
878
|
+
}
|
|
879
|
+
interface WorkspaceCopyResult {
|
|
880
|
+
copied: boolean;
|
|
881
|
+
}
|
|
882
|
+
interface WorkspaceInspectInput {
|
|
883
|
+
paths: string | string[];
|
|
884
|
+
budget?: number;
|
|
885
|
+
compact?: boolean;
|
|
886
|
+
}
|
|
887
|
+
interface WorkspaceInspectResult {
|
|
888
|
+
result: any;
|
|
889
|
+
}
|
|
764
890
|
interface WorkspaceReadInput {
|
|
765
891
|
path: string;
|
|
766
892
|
maxSize?: number;
|
|
@@ -1037,4 +1163,4 @@ declare function decodePublicKey(multikey: string): Uint8Array;
|
|
|
1037
1163
|
*/
|
|
1038
1164
|
declare function didFromPublicKey(publicKey: Uint8Array): string;
|
|
1039
1165
|
|
|
1040
|
-
export { type AdapterInfo, type AdaptersResult, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentQueryInput, type AgentQueryResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListOptions, AssetManager, type AssetMetadata, AssetNotFoundError, Auth, BearerAuth, type ContentDetails, type ContentHashResult, CoviaConnectionError, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, DataAsset, type FunctionInfo, type FunctionsResult, Grid, GridError, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type StatsData, type StatusData, type UCANAttenuation, type UCANIssueInput, type UCANIssueResult, UCANManager, Venue, type VenueConstructor, type VenueData, type VenueInterface, type VenueOptions, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceDeleteInput, type WorkspaceDeleteResult, type WorkspaceListInput, type WorkspaceListResult, WorkspaceManager, type WorkspaceReadInput, type WorkspaceReadResult, type WorkspaceSliceInput, type WorkspaceSliceResult, type WorkspaceWriteInput, type WorkspaceWriteResult, createSSEEvent, decodePublicKey, didFromPublicKey, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getParsedAssetId, hexToPrivateKey, isJobComplete, isJobFinished, isJobPaused, logger, parseSSEStream, privateKeyToHex };
|
|
1166
|
+
export { type AdapterInfo, 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 AgentQueryInput, type AgentQueryResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListOptions, AssetManager, type AssetMetadata, AssetNotFoundError, type AssetPinResult, Auth, BearerAuth, ChatSession, type ContentDetails, type ContentHashResult, CoviaConnectionError, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, DataAsset, type FunctionInfo, type FunctionsResult, Grid, GridError, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type StatsData, type StatusData, type UCANAttenuation, type UCANIssueInput, type UCANIssueResult, UCANManager, Venue, type VenueConstructor, type VenueData, type VenueInterface, type VenueOptions, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceCopyResult, 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, createSSEEvent, decodePublicKey, didFromPublicKey, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getParsedAssetId, hexToPrivateKey, isJobComplete, isJobFinished, isJobPaused, logger, parseSSEStream, privateKeyToHex };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
declare class Agent {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly venue: VenueInterface;
|
|
4
|
+
private _agents;
|
|
5
|
+
constructor(id: string, venue: VenueInterface);
|
|
6
|
+
request(input?: any, wait?: boolean | number): Promise<AgentRequestResult>;
|
|
7
|
+
message(message: any): Promise<AgentMessageResult>;
|
|
8
|
+
chat(message: any, sessionId?: string): Promise<AgentChatResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a ChatSession bound to this agent.
|
|
11
|
+
* @param sessionId - Optional session ID to resume an existing session
|
|
12
|
+
*/
|
|
13
|
+
chatSession(sessionId?: string): ChatSession;
|
|
14
|
+
trigger(): Promise<AgentTriggerResult>;
|
|
15
|
+
query(): Promise<AgentQueryResult>;
|
|
16
|
+
suspend(): Promise<AgentSuspendResult>;
|
|
17
|
+
resume(autoWake?: boolean): Promise<AgentSuspendResult>;
|
|
18
|
+
update(options: {
|
|
19
|
+
config?: Record<string, any>;
|
|
20
|
+
state?: Record<string, any>;
|
|
21
|
+
}): Promise<any>;
|
|
22
|
+
cancelTask(taskId: string): Promise<any>;
|
|
23
|
+
info(): Promise<AgentInfoResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Fork this agent into a new agent.
|
|
26
|
+
* @param agentId - ID for the new forked agent
|
|
27
|
+
* @param options - Fork options
|
|
28
|
+
* @returns A new Agent instance for the forked agent
|
|
29
|
+
*/
|
|
30
|
+
fork(agentId: string, options?: {
|
|
31
|
+
config?: Record<string, any>;
|
|
32
|
+
includeTimeline?: boolean;
|
|
33
|
+
overwrite?: boolean;
|
|
34
|
+
}): Promise<Agent>;
|
|
35
|
+
context(task?: any): Promise<string>;
|
|
36
|
+
delete(remove?: boolean): Promise<AgentDeleteResult>;
|
|
37
|
+
}
|
|
38
|
+
declare class ChatSession {
|
|
39
|
+
readonly agent: Agent;
|
|
40
|
+
private _sessionId;
|
|
41
|
+
constructor(agent: Agent, sessionId?: string);
|
|
42
|
+
/** The session ID, or undefined if no message has been sent yet and no ID was provided. */
|
|
43
|
+
get sessionId(): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Send a message on this session.
|
|
46
|
+
* On the first call (when no sessionId is set), the server mints a new session.
|
|
47
|
+
* The returned sessionId is captured and reused for all subsequent calls.
|
|
48
|
+
*/
|
|
49
|
+
send(message: any): Promise<AgentChatResult>;
|
|
50
|
+
}
|
|
51
|
+
|
|
1
52
|
declare class Job {
|
|
2
53
|
id: string;
|
|
3
54
|
venue: VenueInterface;
|
|
@@ -244,6 +295,11 @@ declare class AgentManager {
|
|
|
244
295
|
resume(agentId: string, autoWake?: boolean): Promise<AgentSuspendResult>;
|
|
245
296
|
update(input: AgentUpdateInput): Promise<any>;
|
|
246
297
|
cancelTask(agentId: string, taskId: string): Promise<any>;
|
|
298
|
+
info(agentId: string): Promise<AgentInfoResult>;
|
|
299
|
+
fork(input: AgentForkInput): Promise<AgentForkResult>;
|
|
300
|
+
context(agentId: string, task?: any): Promise<string>;
|
|
301
|
+
completeTask(result?: any): Promise<AgentCompleteTaskResult>;
|
|
302
|
+
failTask(error: string): Promise<AgentFailTaskResult>;
|
|
247
303
|
}
|
|
248
304
|
|
|
249
305
|
interface JobManagerVenue {
|
|
@@ -271,6 +327,9 @@ interface AssetManagerVenue {
|
|
|
271
327
|
auth: {
|
|
272
328
|
apply(headers: Record<string, string>): void;
|
|
273
329
|
};
|
|
330
|
+
operations: {
|
|
331
|
+
run(assetId: string, input: any): Promise<any>;
|
|
332
|
+
};
|
|
274
333
|
}
|
|
275
334
|
declare class AssetManager {
|
|
276
335
|
private venue;
|
|
@@ -308,6 +367,12 @@ declare class AssetManager {
|
|
|
308
367
|
* @param assetId - Asset identifier
|
|
309
368
|
*/
|
|
310
369
|
getContent(assetId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
370
|
+
/**
|
|
371
|
+
* Pin a resolvable value into the content-addressed asset store.
|
|
372
|
+
* Idempotent — same value produces the same hash.
|
|
373
|
+
* @param path - Source address (hex hash, /a/<hash>, /o/<name>, /v/<path>, DID URL, or workspace path)
|
|
374
|
+
*/
|
|
375
|
+
pin(path: string): Promise<AssetPinResult>;
|
|
311
376
|
/**
|
|
312
377
|
* Clear the asset cache.
|
|
313
378
|
*/
|
|
@@ -330,7 +395,7 @@ declare class OperationManager {
|
|
|
330
395
|
list(): Promise<OperationInfo[]>;
|
|
331
396
|
/**
|
|
332
397
|
* Get details of a named operation
|
|
333
|
-
* @param name - Operation name (e.g., "
|
|
398
|
+
* @param name - Operation name (e.g., "v/ops/schema/infer")
|
|
334
399
|
*/
|
|
335
400
|
get(name: string): Promise<OperationInfo>;
|
|
336
401
|
/**
|
|
@@ -364,6 +429,8 @@ declare class WorkspaceManager {
|
|
|
364
429
|
append(path: string, value: any): Promise<WorkspaceAppendResult>;
|
|
365
430
|
list(path?: string, limit?: number, offset?: number): Promise<WorkspaceListResult>;
|
|
366
431
|
slice(path: string, offset?: number, limit?: number): Promise<WorkspaceSliceResult>;
|
|
432
|
+
copy(from: string, to: string): Promise<WorkspaceCopyResult>;
|
|
433
|
+
inspect(paths: string | string[], budget?: number, compact?: boolean): Promise<WorkspaceInspectResult>;
|
|
367
434
|
}
|
|
368
435
|
|
|
369
436
|
interface UCANManagerVenue {
|
|
@@ -450,6 +517,13 @@ declare class Venue implements VenueInterface {
|
|
|
450
517
|
* @returns {Promise<Job>}
|
|
451
518
|
*/
|
|
452
519
|
getJob(jobId: string): Promise<Job>;
|
|
520
|
+
/**
|
|
521
|
+
* Get a lazy Agent handle for the given agent ID.
|
|
522
|
+
* No network round-trip — the agent is not verified to exist.
|
|
523
|
+
* @param agentId - Agent identifier
|
|
524
|
+
* @returns {Agent} An Agent instance bound to this venue
|
|
525
|
+
*/
|
|
526
|
+
agent(agentId: string): Agent;
|
|
453
527
|
/**
|
|
454
528
|
* List secret names
|
|
455
529
|
* @returns {Promise<string[]>}
|
|
@@ -528,6 +602,7 @@ interface VenueInterface {
|
|
|
528
602
|
listSecrets(): Promise<string[]>;
|
|
529
603
|
putSecret(name: string, value: string): Promise<void>;
|
|
530
604
|
deleteSecret(name: string): Promise<void>;
|
|
605
|
+
agent(agentId: string): Agent;
|
|
531
606
|
close(): void;
|
|
532
607
|
}
|
|
533
608
|
type AssetID = string;
|
|
@@ -761,6 +836,57 @@ interface AgentCancelTaskInput {
|
|
|
761
836
|
agentId: string;
|
|
762
837
|
taskId: string;
|
|
763
838
|
}
|
|
839
|
+
interface AgentInfoResult {
|
|
840
|
+
agentId: string;
|
|
841
|
+
status: string;
|
|
842
|
+
config?: Record<string, any>;
|
|
843
|
+
stateConfig?: Record<string, any>;
|
|
844
|
+
timelineLength?: number;
|
|
845
|
+
tasks?: number;
|
|
846
|
+
error?: string;
|
|
847
|
+
}
|
|
848
|
+
interface AgentForkInput {
|
|
849
|
+
sourceId: string;
|
|
850
|
+
agentId: string;
|
|
851
|
+
config?: Record<string, any>;
|
|
852
|
+
includeTimeline?: boolean;
|
|
853
|
+
overwrite?: boolean;
|
|
854
|
+
}
|
|
855
|
+
interface AgentForkResult {
|
|
856
|
+
agentId: string;
|
|
857
|
+
status: string;
|
|
858
|
+
created: boolean;
|
|
859
|
+
forkedFrom: string;
|
|
860
|
+
}
|
|
861
|
+
interface AgentContextInput {
|
|
862
|
+
agentId: string;
|
|
863
|
+
task?: any;
|
|
864
|
+
}
|
|
865
|
+
interface AgentCompleteTaskResult {
|
|
866
|
+
agentId: string;
|
|
867
|
+
taskId: string;
|
|
868
|
+
status: string;
|
|
869
|
+
}
|
|
870
|
+
interface AgentFailTaskResult {
|
|
871
|
+
agentId: string;
|
|
872
|
+
taskId: string;
|
|
873
|
+
status: string;
|
|
874
|
+
}
|
|
875
|
+
interface AssetPinResult {
|
|
876
|
+
path: string;
|
|
877
|
+
hash: string;
|
|
878
|
+
}
|
|
879
|
+
interface WorkspaceCopyResult {
|
|
880
|
+
copied: boolean;
|
|
881
|
+
}
|
|
882
|
+
interface WorkspaceInspectInput {
|
|
883
|
+
paths: string | string[];
|
|
884
|
+
budget?: number;
|
|
885
|
+
compact?: boolean;
|
|
886
|
+
}
|
|
887
|
+
interface WorkspaceInspectResult {
|
|
888
|
+
result: any;
|
|
889
|
+
}
|
|
764
890
|
interface WorkspaceReadInput {
|
|
765
891
|
path: string;
|
|
766
892
|
maxSize?: number;
|
|
@@ -1037,4 +1163,4 @@ declare function decodePublicKey(multikey: string): Uint8Array;
|
|
|
1037
1163
|
*/
|
|
1038
1164
|
declare function didFromPublicKey(publicKey: Uint8Array): string;
|
|
1039
1165
|
|
|
1040
|
-
export { type AdapterInfo, type AdaptersResult, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentQueryInput, type AgentQueryResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListOptions, AssetManager, type AssetMetadata, AssetNotFoundError, Auth, BearerAuth, type ContentDetails, type ContentHashResult, CoviaConnectionError, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, DataAsset, type FunctionInfo, type FunctionsResult, Grid, GridError, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type StatsData, type StatusData, type UCANAttenuation, type UCANIssueInput, type UCANIssueResult, UCANManager, Venue, type VenueConstructor, type VenueData, type VenueInterface, type VenueOptions, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceDeleteInput, type WorkspaceDeleteResult, type WorkspaceListInput, type WorkspaceListResult, WorkspaceManager, type WorkspaceReadInput, type WorkspaceReadResult, type WorkspaceSliceInput, type WorkspaceSliceResult, type WorkspaceWriteInput, type WorkspaceWriteResult, createSSEEvent, decodePublicKey, didFromPublicKey, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getParsedAssetId, hexToPrivateKey, isJobComplete, isJobFinished, isJobPaused, logger, parseSSEStream, privateKeyToHex };
|
|
1166
|
+
export { type AdapterInfo, 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 AgentQueryInput, type AgentQueryResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListOptions, AssetManager, type AssetMetadata, AssetNotFoundError, type AssetPinResult, Auth, BearerAuth, ChatSession, type ContentDetails, type ContentHashResult, CoviaConnectionError, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, DataAsset, type FunctionInfo, type FunctionsResult, Grid, GridError, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type StatsData, type StatusData, type UCANAttenuation, type UCANIssueInput, type UCANIssueResult, UCANManager, Venue, type VenueConstructor, type VenueData, type VenueInterface, type VenueOptions, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceCopyResult, 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, createSSEEvent, decodePublicKey, didFromPublicKey, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getParsedAssetId, hexToPrivateKey, isJobComplete, isJobFinished, isJobPaused, logger, parseSSEStream, privateKeyToHex };
|
package/dist/index.js
CHANGED
|
@@ -1373,7 +1373,19 @@ var AgentManager = class {
|
|
|
1373
1373
|
return this.venue.operations.run("v/ops/agent/trigger", { agentId });
|
|
1374
1374
|
}
|
|
1375
1375
|
async query(agentId) {
|
|
1376
|
-
|
|
1376
|
+
const read = (path) => this.venue.operations.run("v/ops/covia/read", { path }).catch(() => ({ value: null }));
|
|
1377
|
+
const [info, timelineRes, stateRes, inboxRes] = await Promise.all([
|
|
1378
|
+
this.venue.operations.run("v/ops/agent/info", { agentId }),
|
|
1379
|
+
read(`g/${agentId}/timeline`),
|
|
1380
|
+
read(`g/${agentId}/state`),
|
|
1381
|
+
read(`g/${agentId}/inbox`)
|
|
1382
|
+
]);
|
|
1383
|
+
return {
|
|
1384
|
+
...info,
|
|
1385
|
+
timeline: Array.isArray(timelineRes.value) ? timelineRes.value : [],
|
|
1386
|
+
state: stateRes.value ?? {},
|
|
1387
|
+
inbox: Array.isArray(inboxRes.value) ? inboxRes.value : []
|
|
1388
|
+
};
|
|
1377
1389
|
}
|
|
1378
1390
|
async list(includeTerminated) {
|
|
1379
1391
|
return this.venue.operations.run("v/ops/agent/list", { includeTerminated });
|
|
@@ -1393,6 +1405,21 @@ var AgentManager = class {
|
|
|
1393
1405
|
async cancelTask(agentId, taskId) {
|
|
1394
1406
|
return this.venue.operations.run("v/ops/agent/cancel-task", { agentId, taskId });
|
|
1395
1407
|
}
|
|
1408
|
+
async info(agentId) {
|
|
1409
|
+
return this.venue.operations.run("v/ops/agent/info", { agentId });
|
|
1410
|
+
}
|
|
1411
|
+
async fork(input) {
|
|
1412
|
+
return this.venue.operations.run("v/ops/agent/fork", input);
|
|
1413
|
+
}
|
|
1414
|
+
async context(agentId, task) {
|
|
1415
|
+
return this.venue.operations.run("v/ops/agent/context", { agentId, task });
|
|
1416
|
+
}
|
|
1417
|
+
async completeTask(result) {
|
|
1418
|
+
return this.venue.operations.run("v/ops/agent/complete-task", { result });
|
|
1419
|
+
}
|
|
1420
|
+
async failTask(error) {
|
|
1421
|
+
return this.venue.operations.run("v/ops/agent/fail-task", { error });
|
|
1422
|
+
}
|
|
1396
1423
|
};
|
|
1397
1424
|
|
|
1398
1425
|
// src/Job.ts
|
|
@@ -1546,11 +1573,15 @@ var JobManager = class {
|
|
|
1546
1573
|
this.venue = venue;
|
|
1547
1574
|
}
|
|
1548
1575
|
async list() {
|
|
1549
|
-
return fetchWithError(`${this.venue.baseUrl}/api/v1/jobs
|
|
1576
|
+
return fetchWithError(`${this.venue.baseUrl}/api/v1/jobs`, {
|
|
1577
|
+
headers: this._buildHeaders()
|
|
1578
|
+
});
|
|
1550
1579
|
}
|
|
1551
1580
|
async get(jobId) {
|
|
1552
1581
|
try {
|
|
1553
|
-
const data = await fetchWithError(`${this.venue.baseUrl}/api/v1/jobs/${jobId}
|
|
1582
|
+
const data = await fetchWithError(`${this.venue.baseUrl}/api/v1/jobs/${jobId}`, {
|
|
1583
|
+
headers: this._buildHeaders()
|
|
1584
|
+
});
|
|
1554
1585
|
return new Job(jobId, this.venue, data);
|
|
1555
1586
|
} catch (error) {
|
|
1556
1587
|
if (error instanceof NotFoundError) {
|
|
@@ -1828,6 +1859,14 @@ var AssetManager = class {
|
|
|
1828
1859
|
throw error;
|
|
1829
1860
|
}
|
|
1830
1861
|
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Pin a resolvable value into the content-addressed asset store.
|
|
1864
|
+
* Idempotent — same value produces the same hash.
|
|
1865
|
+
* @param path - Source address (hex hash, /a/<hash>, /o/<name>, /v/<path>, DID URL, or workspace path)
|
|
1866
|
+
*/
|
|
1867
|
+
async pin(path) {
|
|
1868
|
+
return this.venue.operations.run("v/ops/asset/pin", { path });
|
|
1869
|
+
}
|
|
1831
1870
|
/**
|
|
1832
1871
|
* Clear the asset cache.
|
|
1833
1872
|
*/
|
|
@@ -1854,7 +1893,7 @@ var OperationManager = class {
|
|
|
1854
1893
|
}
|
|
1855
1894
|
/**
|
|
1856
1895
|
* Get details of a named operation
|
|
1857
|
-
* @param name - Operation name (e.g., "
|
|
1896
|
+
* @param name - Operation name (e.g., "v/ops/schema/infer")
|
|
1858
1897
|
*/
|
|
1859
1898
|
async get(name) {
|
|
1860
1899
|
return fetchWithError(`${this.venue.baseUrl}/api/v1/operations/${name}`);
|
|
@@ -1920,6 +1959,12 @@ var WorkspaceManager = class {
|
|
|
1920
1959
|
async slice(path, offset, limit) {
|
|
1921
1960
|
return this.venue.operations.run("v/ops/covia/slice", { path, offset, limit });
|
|
1922
1961
|
}
|
|
1962
|
+
async copy(from, to) {
|
|
1963
|
+
return this.venue.operations.run("v/ops/covia/copy", { from, to });
|
|
1964
|
+
}
|
|
1965
|
+
async inspect(paths, budget, compact) {
|
|
1966
|
+
return this.venue.operations.run("v/ops/covia/inspect", { paths, budget, compact });
|
|
1967
|
+
}
|
|
1923
1968
|
};
|
|
1924
1969
|
|
|
1925
1970
|
// src/UCANManager.ts
|
|
@@ -1958,6 +2003,90 @@ var SecretManager = class {
|
|
|
1958
2003
|
return this.venue.deleteSecret(name);
|
|
1959
2004
|
}
|
|
1960
2005
|
};
|
|
2006
|
+
|
|
2007
|
+
// src/Agent.ts
|
|
2008
|
+
var Agent = class _Agent {
|
|
2009
|
+
constructor(id, venue) {
|
|
2010
|
+
this.id = id;
|
|
2011
|
+
this.venue = venue;
|
|
2012
|
+
this._agents = venue.agents;
|
|
2013
|
+
}
|
|
2014
|
+
async request(input, wait) {
|
|
2015
|
+
return this._agents.request(this.id, input, wait);
|
|
2016
|
+
}
|
|
2017
|
+
async message(message) {
|
|
2018
|
+
return this._agents.message(this.id, message);
|
|
2019
|
+
}
|
|
2020
|
+
async chat(message, sessionId) {
|
|
2021
|
+
return this._agents.chat(this.id, message, sessionId);
|
|
2022
|
+
}
|
|
2023
|
+
/**
|
|
2024
|
+
* Create a ChatSession bound to this agent.
|
|
2025
|
+
* @param sessionId - Optional session ID to resume an existing session
|
|
2026
|
+
*/
|
|
2027
|
+
chatSession(sessionId) {
|
|
2028
|
+
return new ChatSession(this, sessionId);
|
|
2029
|
+
}
|
|
2030
|
+
async trigger() {
|
|
2031
|
+
return this._agents.trigger(this.id);
|
|
2032
|
+
}
|
|
2033
|
+
async query() {
|
|
2034
|
+
return this._agents.query(this.id);
|
|
2035
|
+
}
|
|
2036
|
+
async suspend() {
|
|
2037
|
+
return this._agents.suspend(this.id);
|
|
2038
|
+
}
|
|
2039
|
+
async resume(autoWake) {
|
|
2040
|
+
return this._agents.resume(this.id, autoWake);
|
|
2041
|
+
}
|
|
2042
|
+
async update(options) {
|
|
2043
|
+
return this._agents.update({ agentId: this.id, ...options });
|
|
2044
|
+
}
|
|
2045
|
+
async cancelTask(taskId) {
|
|
2046
|
+
return this._agents.cancelTask(this.id, taskId);
|
|
2047
|
+
}
|
|
2048
|
+
async info() {
|
|
2049
|
+
return this._agents.info(this.id);
|
|
2050
|
+
}
|
|
2051
|
+
/**
|
|
2052
|
+
* Fork this agent into a new agent.
|
|
2053
|
+
* @param agentId - ID for the new forked agent
|
|
2054
|
+
* @param options - Fork options
|
|
2055
|
+
* @returns A new Agent instance for the forked agent
|
|
2056
|
+
*/
|
|
2057
|
+
async fork(agentId, options) {
|
|
2058
|
+
await this._agents.fork({ sourceId: this.id, agentId, ...options });
|
|
2059
|
+
return new _Agent(agentId, this.venue);
|
|
2060
|
+
}
|
|
2061
|
+
async context(task) {
|
|
2062
|
+
return this._agents.context(this.id, task);
|
|
2063
|
+
}
|
|
2064
|
+
async delete(remove) {
|
|
2065
|
+
return this._agents.delete(this.id, remove);
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
2068
|
+
var ChatSession = class {
|
|
2069
|
+
constructor(agent, sessionId) {
|
|
2070
|
+
this.agent = agent;
|
|
2071
|
+
this._sessionId = sessionId;
|
|
2072
|
+
}
|
|
2073
|
+
/** The session ID, or undefined if no message has been sent yet and no ID was provided. */
|
|
2074
|
+
get sessionId() {
|
|
2075
|
+
return this._sessionId;
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Send a message on this session.
|
|
2079
|
+
* On the first call (when no sessionId is set), the server mints a new session.
|
|
2080
|
+
* The returned sessionId is captured and reused for all subsequent calls.
|
|
2081
|
+
*/
|
|
2082
|
+
async send(message) {
|
|
2083
|
+
const result = await this.agent.chat(message, this._sessionId);
|
|
2084
|
+
this._sessionId = result.sessionId;
|
|
2085
|
+
return result;
|
|
2086
|
+
}
|
|
2087
|
+
};
|
|
2088
|
+
|
|
2089
|
+
// src/Venue.ts
|
|
1961
2090
|
var webResolver = webDidResolver.getResolver();
|
|
1962
2091
|
var resolver = new didResolver.Resolver(webResolver);
|
|
1963
2092
|
var Venue = class _Venue {
|
|
@@ -2066,6 +2195,15 @@ var Venue = class _Venue {
|
|
|
2066
2195
|
async getJob(jobId) {
|
|
2067
2196
|
return this.jobs.get(jobId);
|
|
2068
2197
|
}
|
|
2198
|
+
/**
|
|
2199
|
+
* Get a lazy Agent handle for the given agent ID.
|
|
2200
|
+
* No network round-trip — the agent is not verified to exist.
|
|
2201
|
+
* @param agentId - Agent identifier
|
|
2202
|
+
* @returns {Agent} An Agent instance bound to this venue
|
|
2203
|
+
*/
|
|
2204
|
+
agent(agentId) {
|
|
2205
|
+
return new Agent(agentId, this);
|
|
2206
|
+
}
|
|
2069
2207
|
/**
|
|
2070
2208
|
* List secret names
|
|
2071
2209
|
* @returns {Promise<string[]>}
|
|
@@ -2074,7 +2212,7 @@ var Venue = class _Venue {
|
|
|
2074
2212
|
const result = await fetchWithError(`${this.baseUrl}/api/v1/secrets`, {
|
|
2075
2213
|
headers: this._buildHeaders()
|
|
2076
2214
|
});
|
|
2077
|
-
return result.items;
|
|
2215
|
+
return Array.isArray(result.items) ? result.items : [];
|
|
2078
2216
|
}
|
|
2079
2217
|
/**
|
|
2080
2218
|
* Store a secret value
|
|
@@ -2172,6 +2310,7 @@ var Grid = class {
|
|
|
2172
2310
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
2173
2311
|
*/
|
|
2174
2312
|
|
|
2313
|
+
exports.Agent = Agent;
|
|
2175
2314
|
exports.AgentManager = AgentManager;
|
|
2176
2315
|
exports.AgentStatus = AgentStatus;
|
|
2177
2316
|
exports.Asset = Asset;
|
|
@@ -2179,6 +2318,7 @@ exports.AssetManager = AssetManager;
|
|
|
2179
2318
|
exports.AssetNotFoundError = AssetNotFoundError;
|
|
2180
2319
|
exports.Auth = Auth;
|
|
2181
2320
|
exports.BearerAuth = BearerAuth;
|
|
2321
|
+
exports.ChatSession = ChatSession;
|
|
2182
2322
|
exports.CoviaConnectionError = CoviaConnectionError;
|
|
2183
2323
|
exports.CoviaError = CoviaError;
|
|
2184
2324
|
exports.CoviaTimeoutError = CoviaTimeoutError;
|