@agent-os-sdk/client 0.1.1 → 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.
Files changed (62) hide show
  1. package/dist/client/AgentOsClient.d.ts +28 -4
  2. package/dist/client/AgentOsClient.d.ts.map +1 -1
  3. package/dist/client/AgentOsClient.js +40 -3
  4. package/dist/generated/openapi.d.ts +93 -0
  5. package/dist/generated/openapi.d.ts.map +1 -1
  6. package/dist/index.d.ts +9 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +10 -0
  9. package/dist/modules/approvals.d.ts +78 -0
  10. package/dist/modules/approvals.d.ts.map +1 -0
  11. package/dist/modules/approvals.js +157 -0
  12. package/dist/modules/artifacts.d.ts +100 -0
  13. package/dist/modules/artifacts.d.ts.map +1 -0
  14. package/dist/modules/artifacts.js +217 -0
  15. package/dist/modules/budgets.d.ts +104 -0
  16. package/dist/modules/budgets.d.ts.map +1 -0
  17. package/dist/modules/budgets.js +161 -0
  18. package/dist/modules/builder.d.ts +2 -2
  19. package/dist/modules/builder.d.ts.map +1 -1
  20. package/dist/modules/builder.js +5 -5
  21. package/dist/modules/capabilities.d.ts +68 -0
  22. package/dist/modules/capabilities.d.ts.map +1 -0
  23. package/dist/modules/capabilities.js +113 -0
  24. package/dist/modules/deployments.d.ts +110 -0
  25. package/dist/modules/deployments.d.ts.map +1 -0
  26. package/dist/modules/deployments.js +230 -0
  27. package/dist/modules/flows.d.ts +104 -0
  28. package/dist/modules/flows.d.ts.map +1 -0
  29. package/dist/modules/flows.js +190 -0
  30. package/dist/modules/handoff.d.ts +88 -0
  31. package/dist/modules/handoff.d.ts.map +1 -0
  32. package/dist/modules/handoff.js +128 -0
  33. package/dist/modules/incidents.d.ts +133 -0
  34. package/dist/modules/incidents.d.ts.map +1 -0
  35. package/dist/modules/incidents.js +231 -0
  36. package/dist/modules/members.d.ts +5 -0
  37. package/dist/modules/members.d.ts.map +1 -1
  38. package/dist/modules/members.js +10 -0
  39. package/dist/modules/policies.d.ts +103 -0
  40. package/dist/modules/policies.d.ts.map +1 -0
  41. package/dist/modules/policies.js +180 -0
  42. package/dist/modules/runs.d.ts.map +1 -1
  43. package/dist/modules/tenants.d.ts +4 -0
  44. package/dist/modules/tenants.d.ts.map +1 -1
  45. package/dist/modules/tenants.js +8 -0
  46. package/package.json +49 -48
  47. package/src/client/AgentOsClient.ts +45 -7
  48. package/src/generated/openapi.ts +93 -0
  49. package/src/generated/swagger.json +107 -0
  50. package/src/index.ts +11 -0
  51. package/src/modules/approvals.ts +210 -0
  52. package/src/modules/artifacts.ts +287 -0
  53. package/src/modules/budgets.ts +236 -0
  54. package/src/modules/builder.ts +3 -3
  55. package/src/modules/capabilities.ts +176 -0
  56. package/src/modules/deployments.ts +315 -0
  57. package/src/modules/flows.ts +259 -0
  58. package/src/modules/handoff.ts +204 -0
  59. package/src/modules/incidents.ts +339 -0
  60. package/src/modules/members.ts +11 -0
  61. package/src/modules/policies.ts +258 -0
  62. package/src/modules/tenants.ts +9 -0
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Policies Module - Governance Rules
3
+ *
4
+ * // MOCK - This module contains mock implementations for future features
5
+ *
6
+ * Defines and evaluates policies that control agent behavior.
7
+ * Enables enterprise governance and compliance.
8
+ */
9
+
10
+ import type { RawClient, APIResponse } from "../client/raw.js";
11
+
12
+ // ============================================================================
13
+ // Types
14
+ // ============================================================================
15
+
16
+ export type PolicyType = "allow" | "deny" | "require_approval" | "audit";
17
+ export type PolicyScope = "tenant" | "workspace" | "agent" | "run";
18
+
19
+ export interface Policy {
20
+ id: string;
21
+ name: string;
22
+ description?: string;
23
+ type: PolicyType;
24
+ scope: PolicyScope;
25
+ scope_id?: string;
26
+ conditions: PolicyCondition[];
27
+ actions: PolicyAction[];
28
+ priority: number;
29
+ enabled: boolean;
30
+ created_at: string;
31
+ updated_at: string;
32
+ }
33
+
34
+ export interface PolicyCondition {
35
+ field: string;
36
+ operator: "eq" | "neq" | "in" | "not_in" | "gt" | "lt" | "contains" | "regex";
37
+ value: unknown;
38
+ }
39
+
40
+ export interface PolicyAction {
41
+ type: "block" | "allow" | "require_approval" | "log" | "alert" | "modify";
42
+ config?: Record<string, unknown>;
43
+ }
44
+
45
+ export interface PolicyEvaluationInput {
46
+ action: string;
47
+ resource: string;
48
+ context: Record<string, unknown>;
49
+ }
50
+
51
+ export interface PolicyEvaluationResult {
52
+ allowed: boolean;
53
+ matched_policies: string[];
54
+ required_approvals: string[];
55
+ warnings: string[];
56
+ audit_entries: PolicyAuditEntry[];
57
+ }
58
+
59
+ export interface PolicyAuditEntry {
60
+ policy_id: string;
61
+ policy_name: string;
62
+ decision: "allow" | "deny" | "pending_approval";
63
+ reason: string;
64
+ evaluated_at: string;
65
+ }
66
+
67
+ export interface PolicyListResponse {
68
+ items: Policy[];
69
+ total: number;
70
+ }
71
+
72
+ // ============================================================================
73
+ // Module
74
+ // ============================================================================
75
+
76
+ export class PoliciesModule {
77
+ constructor(private client: RawClient, private headers: () => Record<string, string>) { }
78
+
79
+ // MOCK - Simulated list
80
+ /**
81
+ * List all policies.
82
+ */
83
+ async list(params?: {
84
+ scope?: PolicyScope;
85
+ enabled?: boolean;
86
+ }): Promise<APIResponse<PolicyListResponse>> {
87
+ // MOCK - Returns simulated data
88
+ const mockPolicies: PolicyListResponse = {
89
+ items: [
90
+ {
91
+ id: "policy_1",
92
+ name: "Block External Email",
93
+ description: "Prevent agents from sending external emails without approval",
94
+ type: "require_approval",
95
+ scope: "tenant",
96
+ conditions: [
97
+ { field: "action", operator: "eq", value: "send_email" },
98
+ { field: "recipient.domain", operator: "not_in", value: ["company.com"] },
99
+ ],
100
+ actions: [
101
+ { type: "require_approval", config: { approver_role: "admin" } },
102
+ ],
103
+ priority: 100,
104
+ enabled: true,
105
+ created_at: new Date(Date.now() - 86400000).toISOString(),
106
+ updated_at: new Date().toISOString(),
107
+ },
108
+ {
109
+ id: "policy_2",
110
+ name: "Audit All Tool Calls",
111
+ description: "Log all tool calls for compliance",
112
+ type: "audit",
113
+ scope: "tenant",
114
+ conditions: [
115
+ { field: "action", operator: "eq", value: "tool_call" },
116
+ ],
117
+ actions: [
118
+ { type: "log" },
119
+ ],
120
+ priority: 50,
121
+ enabled: true,
122
+ created_at: new Date(Date.now() - 86400000).toISOString(),
123
+ updated_at: new Date().toISOString(),
124
+ },
125
+ ],
126
+ total: 2,
127
+ };
128
+ return { data: mockPolicies, error: undefined, response: new Response() };
129
+ }
130
+
131
+ // MOCK - Simulated get
132
+ /**
133
+ * Get a policy by ID.
134
+ */
135
+ async get(policyId: string): Promise<APIResponse<Policy>> {
136
+ // MOCK - Returns simulated data
137
+ const mockPolicy: Policy = {
138
+ id: policyId,
139
+ name: "Block External Email",
140
+ description: "Prevent agents from sending external emails without approval",
141
+ type: "require_approval",
142
+ scope: "tenant",
143
+ conditions: [
144
+ { field: "action", operator: "eq", value: "send_email" },
145
+ ],
146
+ actions: [
147
+ { type: "require_approval" },
148
+ ],
149
+ priority: 100,
150
+ enabled: true,
151
+ created_at: new Date(Date.now() - 86400000).toISOString(),
152
+ updated_at: new Date().toISOString(),
153
+ };
154
+ return { data: mockPolicy, error: undefined, response: new Response() };
155
+ }
156
+
157
+ // MOCK - Simulated create
158
+ /**
159
+ * Create a new policy.
160
+ */
161
+ async create(body: {
162
+ name: string;
163
+ description?: string;
164
+ type: PolicyType;
165
+ scope: PolicyScope;
166
+ scope_id?: string;
167
+ conditions: PolicyCondition[];
168
+ actions: PolicyAction[];
169
+ priority?: number;
170
+ }): Promise<APIResponse<Policy>> {
171
+ // MOCK - Returns simulated data
172
+ const mockPolicy: Policy = {
173
+ id: `policy_${Date.now()}`,
174
+ name: body.name,
175
+ description: body.description,
176
+ type: body.type,
177
+ scope: body.scope,
178
+ scope_id: body.scope_id,
179
+ conditions: body.conditions,
180
+ actions: body.actions,
181
+ priority: body.priority || 50,
182
+ enabled: true,
183
+ created_at: new Date().toISOString(),
184
+ updated_at: new Date().toISOString(),
185
+ };
186
+ return { data: mockPolicy, error: undefined, response: new Response() };
187
+ }
188
+
189
+ // MOCK - Simulated update
190
+ /**
191
+ * Update a policy.
192
+ */
193
+ async update(policyId: string, body: Partial<Policy>): Promise<APIResponse<Policy>> {
194
+ // MOCK - Returns simulated data
195
+ const mockPolicy: Policy = {
196
+ id: policyId,
197
+ name: body.name || "Updated Policy",
198
+ type: body.type || "allow",
199
+ scope: body.scope || "tenant",
200
+ conditions: body.conditions || [],
201
+ actions: body.actions || [],
202
+ priority: body.priority || 50,
203
+ enabled: body.enabled ?? true,
204
+ created_at: new Date(Date.now() - 86400000).toISOString(),
205
+ updated_at: new Date().toISOString(),
206
+ };
207
+ return { data: mockPolicy, error: undefined, response: new Response() };
208
+ }
209
+
210
+ // MOCK - Simulated delete
211
+ /**
212
+ * Delete a policy.
213
+ */
214
+ async delete(policyId: string): Promise<APIResponse<void>> {
215
+ // MOCK - Returns success
216
+ return { data: undefined, error: undefined, response: new Response() };
217
+ }
218
+
219
+ // MOCK - Simulated evaluate
220
+ /**
221
+ * Evaluate policies against an action (simulation).
222
+ */
223
+ async evaluate(input: PolicyEvaluationInput): Promise<APIResponse<PolicyEvaluationResult>> {
224
+ // MOCK - Returns simulated evaluation
225
+ const mockResult: PolicyEvaluationResult = {
226
+ allowed: true,
227
+ matched_policies: ["policy_2"],
228
+ required_approvals: [],
229
+ warnings: [],
230
+ audit_entries: [
231
+ {
232
+ policy_id: "policy_2",
233
+ policy_name: "Audit All Tool Calls",
234
+ decision: "allow",
235
+ reason: "Action logged for audit",
236
+ evaluated_at: new Date().toISOString(),
237
+ },
238
+ ],
239
+ };
240
+ return { data: mockResult, error: undefined, response: new Response() };
241
+ }
242
+
243
+ // MOCK - Simulated enforce
244
+ /**
245
+ * Enforce policies (apply to current context).
246
+ */
247
+ async enforce(runId: string): Promise<APIResponse<PolicyEvaluationResult>> {
248
+ // MOCK - Returns simulated enforcement
249
+ const mockResult: PolicyEvaluationResult = {
250
+ allowed: true,
251
+ matched_policies: [],
252
+ required_approvals: [],
253
+ warnings: [],
254
+ audit_entries: [],
255
+ };
256
+ return { data: mockResult, error: undefined, response: new Response() };
257
+ }
258
+ }
@@ -24,6 +24,15 @@ export interface TenantListResponse {
24
24
  export class TenantsModule {
25
25
  constructor(private client: RawClient, private headers: () => Record<string, string>) { }
26
26
 
27
+ /**
28
+ * List all tenants the user has access to.
29
+ */
30
+ async list(): Promise<APIResponse<Tenant[]>> {
31
+ return this.client.GET<Tenant[]>("/v1/api/tenants", {
32
+ headers: this.headers(),
33
+ });
34
+ }
35
+
27
36
  /**
28
37
  * Get the current tenant.
29
38
  */