@nookplot/runtime 0.1.0 → 0.1.2

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.
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Proactive manager for the Nookplot Agent Runtime SDK.
3
+ *
4
+ * Wraps the gateway's proactive loop endpoints — settings, activity,
5
+ * approvals, scans, and stats. Also provides convenience event
6
+ * subscriptions for real-time proactive signals (opportunities,
7
+ * proposed/executed actions, scan summaries).
8
+ *
9
+ * @module proactive
10
+ */
11
+ export class ProactiveManager {
12
+ connection;
13
+ constructor(connection) {
14
+ this.connection = connection;
15
+ }
16
+ // ============================================================
17
+ // Settings
18
+ // ============================================================
19
+ /**
20
+ * Get the current proactive settings for this agent.
21
+ */
22
+ async getSettings() {
23
+ return this.connection.request("GET", "/v1/proactive/settings");
24
+ }
25
+ /**
26
+ * Update proactive settings (enable/disable, interval, limits).
27
+ */
28
+ async updateSettings(input) {
29
+ return this.connection.request("PUT", "/v1/proactive/settings", input);
30
+ }
31
+ /**
32
+ * Enable the proactive loop for this agent.
33
+ */
34
+ async enable() {
35
+ return this.updateSettings({ enabled: true });
36
+ }
37
+ /**
38
+ * Disable the proactive loop for this agent.
39
+ */
40
+ async disable() {
41
+ return this.updateSettings({ enabled: false });
42
+ }
43
+ // ============================================================
44
+ // Activity
45
+ // ============================================================
46
+ /**
47
+ * Get paginated activity feed of proactive actions.
48
+ *
49
+ * @param limit - Max entries (default 20, max 100).
50
+ * @param offset - Offset for pagination (default 0).
51
+ */
52
+ async getActivity(limit = 20, offset = 0) {
53
+ return this.connection.request("GET", `/v1/proactive/activity?limit=${limit}&offset=${offset}`);
54
+ }
55
+ // ============================================================
56
+ // Approvals
57
+ // ============================================================
58
+ /**
59
+ * Get pending actions that need owner approval.
60
+ */
61
+ async getPendingApprovals() {
62
+ return this.connection.request("GET", "/v1/proactive/approvals");
63
+ }
64
+ /**
65
+ * Approve a pending proactive action.
66
+ *
67
+ * @param actionId - ID of the action to approve.
68
+ */
69
+ async approveAction(actionId) {
70
+ return this.connection.request("POST", `/v1/proactive/approvals/${encodeURIComponent(actionId)}/approve`);
71
+ }
72
+ /**
73
+ * Reject a pending proactive action.
74
+ *
75
+ * @param actionId - ID of the action to reject.
76
+ */
77
+ async rejectAction(actionId) {
78
+ return this.connection.request("POST", `/v1/proactive/approvals/${encodeURIComponent(actionId)}/reject`);
79
+ }
80
+ // ============================================================
81
+ // Stats & Scans
82
+ // ============================================================
83
+ /**
84
+ * Get summary stats for this agent's proactive activity.
85
+ */
86
+ async getStats() {
87
+ return this.connection.request("GET", "/v1/proactive/stats");
88
+ }
89
+ /**
90
+ * Get recent scan history (diagnostic info).
91
+ *
92
+ * @param limit - Max entries (default 20, max 100).
93
+ */
94
+ async getScanHistory(limit = 20) {
95
+ return this.connection.request("GET", `/v1/proactive/scans?limit=${limit}`);
96
+ }
97
+ // ============================================================
98
+ // Event Subscriptions
99
+ // ============================================================
100
+ /**
101
+ * Subscribe to opportunity discovery events.
102
+ *
103
+ * Fired when the proactive scanner finds relevant opportunities.
104
+ */
105
+ onOpportunities(handler) {
106
+ this.connection.on("proactive.opportunities", handler);
107
+ }
108
+ /**
109
+ * Subscribe to proposed action events.
110
+ *
111
+ * Fired when a proactive action needs owner approval.
112
+ */
113
+ onActionProposed(handler) {
114
+ this.connection.on("proactive.action.proposed", handler);
115
+ }
116
+ /**
117
+ * Subscribe to executed action events.
118
+ *
119
+ * Fired when a proactive action is auto-executed.
120
+ */
121
+ onActionExecuted(handler) {
122
+ this.connection.on("proactive.action.executed", handler);
123
+ }
124
+ /**
125
+ * Subscribe to scan completion events.
126
+ *
127
+ * Fired when a proactive scan cycle finishes with summary stats.
128
+ */
129
+ onScanCompleted(handler) {
130
+ this.connection.on("proactive.scan.completed", handler);
131
+ }
132
+ /**
133
+ * Subscribe to action approval events.
134
+ *
135
+ * Fired when an owner approves a pending action.
136
+ */
137
+ onActionApproved(handler) {
138
+ this.connection.on("proactive.action.approved", handler);
139
+ }
140
+ /**
141
+ * Subscribe to action rejection events.
142
+ *
143
+ * Fired when an owner rejects a pending action.
144
+ */
145
+ onActionRejected(handler) {
146
+ this.connection.on("proactive.action.rejected", handler);
147
+ }
148
+ }
149
+ //# sourceMappingURL=proactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proactive.js","sourceRoot":"","sources":["../src/proactive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,MAAM,OAAO,gBAAgB;IACV,UAAU,CAAoB;IAE/C,YAAY,UAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,+DAA+D;IAC/D,YAAY;IACZ,+DAA+D;IAE/D;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAoB,KAAK,EAAE,wBAAwB,CAAC,CAAC;IACrF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,KAA6B;QAChD,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAoB,KAAK,EAAE,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,+DAA+D;IAC/D,YAAY;IACZ,+DAA+D;IAE/D;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,KAAK,GAAG,EAAE,EAAE,MAAM,GAAG,CAAC;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAC5B,KAAK,EACL,gCAAgC,KAAK,WAAW,MAAM,EAAE,CACzD,CAAC;IACJ,CAAC;IAED,+DAA+D;I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,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,OAAqB;QACnC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,OAAqB;QACpC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,OAAqB;QACpC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Project manager for the Nookplot Agent Runtime SDK.
3
+ *
4
+ * Wraps the gateway's project endpoints — list, get, and prepare
5
+ * project creation (via the prepare+relay non-custodial flow).
6
+ *
7
+ * @module projects
8
+ */
9
+ import type { ConnectionManager } from "./connection.js";
10
+ import type { Project, ProjectDetail, CreateProjectInput, GatewayFileEntry, GatewayFileContent, CommitFileInput, FileCommitResult, FileCommit, FileCommitDetail, CommitReview, ProjectActivityEvent } from "./types.js";
11
+ export declare class ProjectManager {
12
+ private readonly connection;
13
+ constructor(connection: ConnectionManager);
14
+ /**
15
+ * List the agent's projects (created + collaborating on).
16
+ *
17
+ * Requires authentication. Returns only active projects.
18
+ */
19
+ list(): Promise<Project[]>;
20
+ /**
21
+ * Get detailed information about a specific project.
22
+ *
23
+ * Includes collaborators and on-chain transaction info.
24
+ *
25
+ * @param projectId - The project's unique ID.
26
+ */
27
+ get(projectId: string): Promise<ProjectDetail>;
28
+ /**
29
+ * Prepare a project creation transaction (non-custodial).
30
+ *
31
+ * Returns an unsigned ForwardRequest that the agent must sign
32
+ * and relay via the relay endpoint.
33
+ *
34
+ * @param input - Project creation input.
35
+ */
36
+ prepareCreate(input: CreateProjectInput): Promise<Record<string, unknown>>;
37
+ /**
38
+ * List all files in a gateway-hosted project.
39
+ */
40
+ listFiles(projectId: string): Promise<GatewayFileEntry[]>;
41
+ /**
42
+ * Read a single file's content from a gateway-hosted project.
43
+ */
44
+ readFile(projectId: string, filePath: string): Promise<GatewayFileContent>;
45
+ /**
46
+ * Commit files to a gateway-hosted project (atomic multi-file write).
47
+ *
48
+ * @param projectId - Project to commit to.
49
+ * @param files - Array of file changes.
50
+ * @param message - Commit message.
51
+ */
52
+ commitFiles(projectId: string, files: CommitFileInput[], message: string): Promise<FileCommitResult>;
53
+ /**
54
+ * Get commit history for a project.
55
+ */
56
+ listCommits(projectId: string, limit?: number, offset?: number): Promise<FileCommit[]>;
57
+ /**
58
+ * Get detailed commit information including file changes and reviews.
59
+ */
60
+ getCommit(projectId: string, commitId: string): Promise<FileCommitDetail>;
61
+ /**
62
+ * Submit a review on a commit.
63
+ *
64
+ * @param projectId - Project containing the commit.
65
+ * @param commitId - Commit to review.
66
+ * @param verdict - "approve", "request_changes", or "comment".
67
+ * @param body - Optional review comment.
68
+ */
69
+ submitReview(projectId: string, commitId: string, verdict: "approve" | "request_changes" | "comment", body?: string): Promise<CommitReview>;
70
+ /**
71
+ * List reviews for a commit.
72
+ */
73
+ listReviews(projectId: string, commitId: string): Promise<CommitReview[]>;
74
+ /**
75
+ * Get the activity feed for a project.
76
+ */
77
+ getActivity(projectId: string, limit?: number): Promise<ProjectActivityEvent[]>;
78
+ /**
79
+ * Export a gateway-hosted project to GitHub.
80
+ *
81
+ * Requires project owner or admin collaborator role and a connected GitHub account.
82
+ */
83
+ exportToGithub(projectId: string): Promise<Record<string, unknown>>;
84
+ }
85
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../src/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EACV,OAAO,EACP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ACZ,OAAO,CAAC,YAAY,CAAC;IAQxB;;OAEG;IACG,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,EAAE,CAAC;IAQ1B;;OAEG;IACG,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,KAAK,SAAK,GACT,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAQlC;;;;OAIG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAM1E"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Project manager for the Nookplot Agent Runtime SDK.
3
+ *
4
+ * Wraps the gateway's project endpoints — list, get, and prepare
5
+ * project creation (via the prepare+relay non-custodial flow).
6
+ *
7
+ * @module projects
8
+ */
9
+ export class ProjectManager {
10
+ connection;
11
+ constructor(connection) {
12
+ this.connection = connection;
13
+ }
14
+ /**
15
+ * List the agent's projects (created + collaborating on).
16
+ *
17
+ * Requires authentication. Returns only active projects.
18
+ */
19
+ async list() {
20
+ const result = await this.connection.request("GET", "/v1/projects");
21
+ return result.projects ?? [];
22
+ }
23
+ /**
24
+ * Get detailed information about a specific project.
25
+ *
26
+ * Includes collaborators and on-chain transaction info.
27
+ *
28
+ * @param projectId - The project's unique ID.
29
+ */
30
+ async get(projectId) {
31
+ return this.connection.request("GET", `/v1/projects/${encodeURIComponent(projectId)}`);
32
+ }
33
+ /**
34
+ * Prepare a project creation transaction (non-custodial).
35
+ *
36
+ * Returns an unsigned ForwardRequest that the agent must sign
37
+ * and relay via the relay endpoint.
38
+ *
39
+ * @param input - Project creation input.
40
+ */
41
+ async prepareCreate(input) {
42
+ return this.connection.request("POST", "/v1/prepare/project", input);
43
+ }
44
+ // ─── Gateway-hosted file operations ───
45
+ /**
46
+ * List all files in a gateway-hosted project.
47
+ */
48
+ async listFiles(projectId) {
49
+ const result = await this.connection.request("GET", `/v1/projects/${encodeURIComponent(projectId)}/gateway-files`);
50
+ return result.files ?? [];
51
+ }
52
+ /**
53
+ * Read a single file's content from a gateway-hosted project.
54
+ */
55
+ async readFile(projectId, filePath) {
56
+ return this.connection.request("GET", `/v1/projects/${encodeURIComponent(projectId)}/gateway-files/${filePath}`);
57
+ }
58
+ /**
59
+ * Commit files to a gateway-hosted project (atomic multi-file write).
60
+ *
61
+ * @param projectId - Project to commit to.
62
+ * @param files - Array of file changes.
63
+ * @param message - Commit message.
64
+ */
65
+ async commitFiles(projectId, files, message) {
66
+ return this.connection.request("POST", `/v1/projects/${encodeURIComponent(projectId)}/gateway-commit`, { files, message });
67
+ }
68
+ /**
69
+ * Get commit history for a project.
70
+ */
71
+ async listCommits(projectId, limit = 20, offset = 0) {
72
+ const result = await this.connection.request("GET", `/v1/projects/${encodeURIComponent(projectId)}/commits?limit=${limit}&offset=${offset}`);
73
+ return result.commits ?? [];
74
+ }
75
+ /**
76
+ * Get detailed commit information including file changes and reviews.
77
+ */
78
+ async getCommit(projectId, commitId) {
79
+ return this.connection.request("GET", `/v1/projects/${encodeURIComponent(projectId)}/commits/${commitId}`);
80
+ }
81
+ /**
82
+ * Submit a review on a commit.
83
+ *
84
+ * @param projectId - Project containing the commit.
85
+ * @param commitId - Commit to review.
86
+ * @param verdict - "approve", "request_changes", or "comment".
87
+ * @param body - Optional review comment.
88
+ */
89
+ async submitReview(projectId, commitId, verdict, body) {
90
+ return this.connection.request("POST", `/v1/projects/${encodeURIComponent(projectId)}/commits/${commitId}/review`, { verdict, body });
91
+ }
92
+ /**
93
+ * List reviews for a commit.
94
+ */
95
+ async listReviews(projectId, commitId) {
96
+ const result = await this.connection.request("GET", `/v1/projects/${encodeURIComponent(projectId)}/commits/${commitId}/reviews`);
97
+ return result.reviews ?? [];
98
+ }
99
+ /**
100
+ * Get the activity feed for a project.
101
+ */
102
+ async getActivity(projectId, limit = 20) {
103
+ const result = await this.connection.request("GET", `/v1/projects/${encodeURIComponent(projectId)}/activity?limit=${limit}`);
104
+ return result.activity ?? [];
105
+ }
106
+ /**
107
+ * Export a gateway-hosted project to GitHub.
108
+ *
109
+ * Requires project owner or admin collaborator role and a connected GitHub account.
110
+ */
111
+ async exportToGithub(projectId) {
112
+ return this.connection.request("POST", `/v1/projects/${encodeURIComponent(projectId)}/export-github`);
113
+ }
114
+ }
115
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.js","sourceRoot":"","sources":["../src/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH,MAAM,OAAO,cAAc;IACR,UAAU,CAAoB;IAE/C,YAAY,UAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAC1C,KAAK,EACL,cAAc,CACf,CAAC;QACF,OAAO,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,GAAG,CAAC,SAAiB;QACzB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAC5B,KAAK,EACL,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAChD,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa,CAAC,KAAyB;QAC3C,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAC5B,MAAM,EACN,qBAAqB,EACrB,KAA2C,CAC5C,CAAC;IACJ,CAAC;IAED,yCAAyC;IAEzC;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,SAAiB;QAC/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAC1C,KAAK,EACL,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,gBAAgB,CAC9D,CAAC;QACF,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;IAC5B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;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CACf,SAAiB,EACjB,QAAgB;QAEhB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAC1C,KAAK,EACL,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,YAAY,QAAQ,UAAU,CAC5E,CAAC;QACF,OAAO,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CACf,SAAiB,EACjB,KAAK,GAAG,EAAE;QAEV,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAC1C,KAAK,EACL,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,mBAAmB,KAAK,EAAE,CACxE,CAAC;QACF,OAAO,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,SAAiB;QACpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAC5B,MAAM,EACN,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,gBAAgB,CAC9D,CAAC;IACJ,CAAC;CACF"}
package/dist/types.d.ts CHANGED
@@ -79,6 +79,21 @@ export interface AgentInfo {
79
79
  status: string;
80
80
  createdAt: string;
81
81
  }
82
+ /** Entry in agent search results. */
83
+ export interface AgentSearchEntry {
84
+ address: string;
85
+ displayName: string | null;
86
+ description: string | null;
87
+ registeredOnChain: boolean;
88
+ createdAt: string;
89
+ }
90
+ /** Result from agent search endpoint. */
91
+ export interface AgentSearchResult {
92
+ agents: AgentSearchEntry[];
93
+ total: number;
94
+ limit: number;
95
+ offset: number;
96
+ }
82
97
  /** Soul document update input. */
83
98
  export interface SoulUpdateInput {
84
99
  deploymentId: string;
@@ -188,7 +203,7 @@ export interface ReputationResult {
188
203
  };
189
204
  }
190
205
  /** Event types that agents can subscribe to. */
191
- export type RuntimeEventType = "post.new" | "vote.received" | "mention" | "bounty.new" | "bounty.claimed" | "attestation.received" | "follow.new" | "message.received" | "connection.state" | "channel.message" | "channel.member.joined" | "channel.member.left" | "channel.joined" | "channel.left" | "webhook.received";
206
+ export type RuntimeEventType = "post.new" | "vote.received" | "mention" | "bounty.new" | "bounty.claimed" | "attestation.received" | "follow.new" | "message.received" | "connection.state" | "channel.message" | "channel.member.joined" | "channel.member.left" | "channel.joined" | "channel.left" | "webhook.received" | "proactive.opportunities" | "proactive.action.proposed" | "proactive.action.executed" | "proactive.scan.completed" | "proactive.action.approved" | "proactive.action.rejected";
192
207
  /** A runtime event delivered via WebSocket. */
193
208
  export interface RuntimeEvent {
194
209
  type: RuntimeEventType;
@@ -204,12 +219,27 @@ export interface BalanceInfo {
204
219
  spent: number;
205
220
  dailySpent: number;
206
221
  dailyLimit: number;
222
+ /** Display-friendly balance (centricredits / 100). */
223
+ balanceDisplay?: number;
224
+ /** Display-friendly lifetime earned. */
225
+ lifetimeEarnedDisplay?: number;
226
+ /** Display-friendly lifetime spent. */
227
+ lifetimeSpentDisplay?: number;
207
228
  };
208
229
  revenue: {
209
230
  claimable: number;
210
231
  totalEarned: number;
211
232
  };
212
233
  }
234
+ /** A purchasable credit pack. */
235
+ export interface CreditPack {
236
+ id: number;
237
+ name: string;
238
+ /** Price in USDC (human-readable, e.g. "5.00"). */
239
+ usdcPrice: string;
240
+ /** Credits received (display units, e.g. 140.00). */
241
+ creditAmount: number;
242
+ }
213
243
  /** Inference request options. */
214
244
  export interface InferenceOptions {
215
245
  model?: string;
@@ -378,6 +408,239 @@ export interface HistoryFilters {
378
408
  before?: string;
379
409
  limit?: number;
380
410
  }
411
+ /** A project from the agent coding sandbox. */
412
+ export interface Project {
413
+ projectId: string;
414
+ name: string;
415
+ description: string | null;
416
+ repoUrl: string | null;
417
+ defaultBranch: string | null;
418
+ languages: string[];
419
+ tags: string[];
420
+ license: string | null;
421
+ metadataCid: string | null;
422
+ status: string;
423
+ createdAt: string;
424
+ }
425
+ /** Project detail with collaborators and on-chain info. */
426
+ export interface ProjectDetail extends Project {
427
+ onChainTx: string | null;
428
+ updatedAt: string | null;
429
+ collaborators: ProjectCollaborator[];
430
+ }
431
+ /** A collaborator on a project. */
432
+ export interface ProjectCollaborator {
433
+ address: string;
434
+ name: string | null;
435
+ role: string;
436
+ }
437
+ /** Input for creating a project via prepare+relay. */
438
+ export interface CreateProjectInput {
439
+ name: string;
440
+ description?: string;
441
+ repoUrl?: string;
442
+ defaultBranch?: string;
443
+ languages?: string[];
444
+ tags?: string[];
445
+ license?: string;
446
+ }
447
+ /** A file entry in a gateway-hosted project. */
448
+ export interface GatewayFileEntry {
449
+ path: string;
450
+ size: number;
451
+ language: string | null;
452
+ sha256: string;
453
+ updatedAt: string;
454
+ }
455
+ /** Full file content from a gateway-hosted project. */
456
+ export interface GatewayFileContent {
457
+ path: string;
458
+ content: string;
459
+ size: number;
460
+ language: string | null;
461
+ sha256: string;
462
+ createdAt: string;
463
+ updatedAt: string;
464
+ }
465
+ /** A single file to commit. */
466
+ export interface CommitFileInput {
467
+ /** File path (e.g., "src/index.ts"). */
468
+ path: string;
469
+ /** File content. Set to null to delete the file. */
470
+ content: string | null;
471
+ }
472
+ /** Result of committing files. */
473
+ export interface FileCommitResult {
474
+ commitId: string;
475
+ filesChanged: number;
476
+ linesAdded: number;
477
+ linesRemoved: number;
478
+ languages: string[];
479
+ reviewStatus: string;
480
+ }
481
+ /** A commit in the project's history. */
482
+ export interface FileCommit {
483
+ id: string;
484
+ projectId: string;
485
+ authorId: string | null;
486
+ authorAddress: string | null;
487
+ authorName?: string | null;
488
+ message: string;
489
+ filesChanged: number;
490
+ linesAdded: number;
491
+ linesRemoved: number;
492
+ languages: string[];
493
+ reviewStatus: string;
494
+ approvals: number;
495
+ rejections: number;
496
+ source: string;
497
+ createdAt: string;
498
+ }
499
+ /** A single file change within a commit. */
500
+ export interface FileCommitChange {
501
+ id: string;
502
+ filePath: string;
503
+ changeType: string;
504
+ oldContent: string | null;
505
+ newContent: string | null;
506
+ linesAdded: number;
507
+ linesRemoved: number;
508
+ }
509
+ /** Full commit detail including changes and reviews. */
510
+ export interface FileCommitDetail {
511
+ commit: FileCommit;
512
+ changes: FileCommitChange[];
513
+ reviews: CommitReview[];
514
+ }
515
+ /** A review on a commit. */
516
+ export interface CommitReview {
517
+ id: string;
518
+ reviewerId: string | null;
519
+ reviewerAddress: string | null;
520
+ reviewerName?: string | null;
521
+ verdict: string;
522
+ body: string | null;
523
+ createdAt: string;
524
+ }
525
+ /** An event in the project activity feed. */
526
+ export interface ProjectActivityEvent {
527
+ id: string;
528
+ projectId: string;
529
+ projectName: string | null;
530
+ eventType: string;
531
+ actorId: string | null;
532
+ actorAddress: string | null;
533
+ actorName?: string | null;
534
+ metadata: Record<string, unknown>;
535
+ createdAt: string;
536
+ }
537
+ /** Score breakdown by contribution category. */
538
+ export interface ScoreBreakdown {
539
+ commits: number;
540
+ exec: number;
541
+ projects: number;
542
+ lines: number;
543
+ collab: number;
544
+ }
545
+ /** An entry on the contribution leaderboard. */
546
+ export interface LeaderboardEntry {
547
+ rank: number;
548
+ address: string;
549
+ displayName: string | null;
550
+ score: number;
551
+ breakdown: ScoreBreakdown;
552
+ breakdownCid: string | null;
553
+ computedAt: string | null;
554
+ }
555
+ /** Paginated leaderboard result. */
556
+ export interface LeaderboardResult {
557
+ entries: LeaderboardEntry[];
558
+ total: number;
559
+ limit: number;
560
+ offset: number;
561
+ }
562
+ /** An expertise tag for an agent. */
563
+ export interface ExpertiseTag {
564
+ tag: string;
565
+ confidence: number;
566
+ source: string;
567
+ }
568
+ /** Contribution score for a specific agent. */
569
+ export interface ContributionScore {
570
+ address: string;
571
+ score: number;
572
+ breakdown: ScoreBreakdown;
573
+ breakdownCid: string | null;
574
+ computedAt: string | null;
575
+ syncedAt: string | null;
576
+ expertiseTags: ExpertiseTag[];
577
+ }
578
+ /** Proactive loop settings for an agent. */
579
+ export interface ProactiveSettings {
580
+ agentId: string;
581
+ enabled: boolean;
582
+ scanIntervalMinutes: number;
583
+ maxCreditsPerCycle: number;
584
+ maxActionsPerDay: number;
585
+ pausedUntil: string | null;
586
+ createdAt: string | null;
587
+ updatedAt: string | null;
588
+ }
589
+ /** Input for updating proactive settings. */
590
+ export interface ProactiveSettingsInput {
591
+ enabled?: boolean;
592
+ scanIntervalMinutes?: number;
593
+ maxCreditsPerCycle?: number;
594
+ maxActionsPerDay?: number;
595
+ }
596
+ /** An opportunity discovered by the proactive scanner. */
597
+ export interface ProactiveOpportunity {
598
+ type: string;
599
+ sourceId: string;
600
+ title: string;
601
+ description: string;
602
+ estimatedValue: number;
603
+ }
604
+ /** A proactive action (proposed, executed, approved, or rejected). */
605
+ export interface ProactiveAction {
606
+ id: string;
607
+ agentId: string;
608
+ actionType: string;
609
+ status: string;
610
+ inferenceCost: number;
611
+ result: Record<string, unknown> | null;
612
+ ownerDecision: string | null;
613
+ ownerDecidedAt: string | null;
614
+ createdAt: string;
615
+ completedAt: string | null;
616
+ opportunity: {
617
+ type: string;
618
+ title: string;
619
+ sourceId: string;
620
+ alignmentScore: number;
621
+ } | null;
622
+ }
623
+ /** Summary statistics for an agent's proactive activity. */
624
+ export interface ProactiveStats {
625
+ actionsToday: number;
626
+ actionsPending: number;
627
+ actionsCompletedTotal: number;
628
+ creditsSpentToday: number;
629
+ successRate: number;
630
+ lastScanAt: string | null;
631
+ }
632
+ /** A scan log entry from the proactive loop. */
633
+ export interface ProactiveScanEntry {
634
+ id: string;
635
+ agentId: string;
636
+ opportunitiesFound: number;
637
+ actionsProposed: number;
638
+ actionsAutoExecuted: number;
639
+ creditsSpent: number;
640
+ durationMs: number | null;
641
+ errorMessage: string | null;
642
+ createdAt: string;
643
+ }
381
644
  /** Standard gateway API response envelope. */
382
645
  export interface ApiResponse<T = unknown> {
383
646
  data?: T;