-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtypes.ts
More file actions
86 lines (76 loc) · 2.13 KB
/
types.ts
File metadata and controls
86 lines (76 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* AgentStack types — portable agent, task, payment, and reputation coordination.
*
* Mirrors the `agentstack` capability spec in the Profullstack Shared AppKit OpenSpec
* (profullstack-web/openspec/specs/agentstack).
*/
export type TaskStatus =
| "pending"
| "queued"
| "running"
| "blocked"
| "complete"
| "failed"
| "cancelled";
/** DID method shared across CoinPay-linked Profullstack apps. */
export const DID_METHOD = "did:coinpay";
export type DidKind = "user" | "agent";
/** A portable, DID-addressable task that can move across apps. */
export interface DidTask {
id: string;
ownerDid: string;
assigneeDid?: string;
sourceApp: string;
title: string;
description?: string;
status: TaskStatus;
paymentIntentId?: string;
escrowId?: string;
reputationEventId?: string;
metadata?: Record<string, unknown>;
createdAt: string;
updatedAt: string;
}
/** A registered agent identity that can be delegated tasks. */
export interface AgentProfile {
did: string;
name: string;
sourceApp: string;
inboxUrl?: string;
taskEndpoint?: string;
supportedProtocols: string[];
reputationScore?: number;
metadata?: Record<string, unknown>;
}
/** A grant authorizing an agent to act on an owner's behalf. */
export interface DelegationGrant {
id: string;
ownerDid: string;
agentDid: string;
scopes: string[];
expiresAt?: string;
createdAt: string;
}
export type AgentStackEvent =
| { type: "agent.registered"; agent: AgentProfile }
| { type: "task.created"; task: DidTask }
| { type: "task.assigned"; task: DidTask }
| { type: "task.updated"; task: DidTask }
| { type: "delegation.granted"; grant: DelegationGrant }
| { type: "delegation.revoked"; grant: DelegationGrant };
export type AgentStackListener = (event: AgentStackEvent) => void;
export interface CreateTaskInput {
ownerDid: string;
sourceApp: string;
title: string;
description?: string;
assigneeDid?: string;
paymentIntentId?: string;
escrowId?: string;
metadata?: Record<string, unknown>;
}
export interface AgentStackSnapshot {
agents: AgentProfile[];
tasks: DidTask[];
delegations: DelegationGrant[];
}