@kindgi/client 0.1.2 → 0.1.4-rc.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.cjs CHANGED
@@ -107,6 +107,8 @@ function fromWire(body) {
107
107
  case "provider-already-registered":
108
108
  case "proposal-invalid-state-transition":
109
109
  case "approval-not-decided":
110
+ case "slug-conflict":
111
+ case "project-default-already-exists":
110
112
  return { code: "conflict", message, reason: code };
111
113
  case "invalid-request":
112
114
  case "validation-failed":
@@ -461,6 +463,16 @@ function makeAgentsClient(transport) {
461
463
  idempotencyKey: options.idempotencyKey
462
464
  }
463
465
  });
466
+ },
467
+ async derive(agentId, input, options) {
468
+ return transport.request({
469
+ method: "POST",
470
+ path: `/v1/agents/${seg(agentId)}/versions`,
471
+ body: input,
472
+ ...options?.idempotencyKey !== void 0 && {
473
+ idempotencyKey: options.idempotencyKey
474
+ }
475
+ });
464
476
  }
465
477
  },
466
478
  async reinstateVersion(agentId, version, options) {
@@ -480,6 +492,20 @@ function makeAgentsClient(transport) {
480
492
  };
481
493
  }
482
494
 
495
+ // src/scope-wire.ts
496
+ function scopeForBody(scope) {
497
+ if (scope.kind === "tenant") return { kind: "tenant" };
498
+ if (scope.kind === "org") return { kind: "org", orgId: scope.orgId };
499
+ return { kind: "project", projectId: scope.projectId };
500
+ }
501
+ function scopeToQuery(scope) {
502
+ if (scope.kind === "tenant") return { scopeKind: "tenant" };
503
+ if (scope.kind === "org") {
504
+ return { scopeKind: "org", scopeId: scope.orgId };
505
+ }
506
+ return { scopeKind: "project", scopeId: scope.projectId };
507
+ }
508
+
483
509
  // src/status-query.ts
484
510
  function singleStatusQuery(method, status) {
485
511
  if (status === void 0) return void 0;
@@ -506,6 +532,7 @@ function makeApprovalsClient(transport) {
506
532
  ...filter?.limit !== void 0 && { limit: filter.limit },
507
533
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
508
534
  ...statusParam !== void 0 && { status: statusParam },
535
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
509
536
  ...filter?.requiredRole !== void 0 && { requiredRole: filter.requiredRole },
510
537
  ...filter?.createdAfter !== void 0 && {
511
538
  createdAfter: filter.createdAfter
@@ -811,6 +838,72 @@ function makeAuthClient(transport) {
811
838
  };
812
839
  }
813
840
 
841
+ // src/resources/blocks.ts
842
+ function makeBlocksClient(transport) {
843
+ const seg = (s) => encodeURIComponent(s);
844
+ return {
845
+ async publish(input, options) {
846
+ return transport.request({
847
+ method: "POST",
848
+ path: "/v1/blocks",
849
+ body: { ...input, projectId: options.projectId },
850
+ ...options.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
851
+ });
852
+ },
853
+ async list(filter) {
854
+ return transport.request({
855
+ method: "GET",
856
+ path: "/v1/blocks",
857
+ query: {
858
+ ...filter?.limit !== void 0 && { limit: filter.limit },
859
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
860
+ ...filter?.kind !== void 0 && { kind: filter.kind },
861
+ ...filter?.name !== void 0 && { name: filter.name },
862
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope)
863
+ }
864
+ });
865
+ },
866
+ async get(blockId) {
867
+ return transport.request({ method: "GET", path: `/v1/blocks/${seg(blockId)}` });
868
+ },
869
+ versions: {
870
+ async list(blockId, filter) {
871
+ return transport.request({
872
+ method: "GET",
873
+ path: `/v1/blocks/${seg(blockId)}/versions`,
874
+ query: {
875
+ ...filter?.limit !== void 0 && { limit: filter.limit },
876
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
877
+ ...filter?.includeTombstoned !== void 0 && {
878
+ includeTombstoned: filter.includeTombstoned
879
+ }
880
+ }
881
+ });
882
+ },
883
+ async get(blockId, version) {
884
+ return transport.request({
885
+ method: "GET",
886
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}`
887
+ });
888
+ },
889
+ async unregister(blockId, version, options) {
890
+ return transport.request({
891
+ method: "POST",
892
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}/unregister`,
893
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
894
+ });
895
+ },
896
+ async reinstate(blockId, version, options) {
897
+ return transport.request({
898
+ method: "POST",
899
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}/reinstate`,
900
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
901
+ });
902
+ }
903
+ }
904
+ };
905
+ }
906
+
814
907
  // src/resources/capabilities.ts
815
908
  function makeCapabilitiesClient(transport) {
816
909
  return {
@@ -964,6 +1057,7 @@ function makeConversationsClient(transport) {
964
1057
  body: {
965
1058
  agentId: input.agentId,
966
1059
  agentVersion: input.agentVersion,
1060
+ ...input.projectId !== void 0 && { projectId: input.projectId },
967
1061
  ...input.title !== void 0 && { title: input.title },
968
1062
  ...input.scope !== void 0 && { scope: input.scope },
969
1063
  ...input.participantId !== void 0 && { participantId: input.participantId },
@@ -989,6 +1083,7 @@ function makeConversationsClient(transport) {
989
1083
  ...filter?.limit !== void 0 && { limit: filter.limit },
990
1084
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
991
1085
  ...statusParam !== void 0 && { status: statusParam },
1086
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
992
1087
  ...filter?.agent !== void 0 && { agentId: filter.agent }
993
1088
  }
994
1089
  });
@@ -1025,6 +1120,29 @@ function makeConversationsClient(transport) {
1025
1120
  }
1026
1121
 
1027
1122
  // src/resources/cost.ts
1123
+ function filterQuery(filter) {
1124
+ const scope = filter.scope !== void 0 ? scopeToQuery(filter.scope) : void 0;
1125
+ return {
1126
+ ...filter.runId !== void 0 && { runId: filter.runId },
1127
+ ...filter.includeDescendants === true && { includeDescendants: "true" },
1128
+ ...filter.rootRunId !== void 0 && { rootRunId: filter.rootRunId },
1129
+ ...filter.agentId !== void 0 && { agentId: filter.agentId },
1130
+ ...filter.conversationId !== void 0 && {
1131
+ conversationId: filter.conversationId
1132
+ },
1133
+ ...filter.category !== void 0 && { category: filter.category },
1134
+ ...filter.providerId !== void 0 && {
1135
+ providerId: filter.providerId
1136
+ },
1137
+ ...filter.model !== void 0 && { model: filter.model },
1138
+ ...filter.servedModel !== void 0 && { servedModel: filter.servedModel },
1139
+ ...scope !== void 0 && { scopeKind: scope.scopeKind },
1140
+ ...scope?.scopeId !== void 0 && { scopeId: scope.scopeId },
1141
+ ...filter.from !== void 0 && { from: filter.from },
1142
+ ...filter.to !== void 0 && { to: filter.to },
1143
+ ...filter.includeRawUsage === true && { include: "rawUsage" }
1144
+ };
1145
+ }
1028
1146
  function makeCostClient(transport) {
1029
1147
  return {
1030
1148
  usage: {
@@ -1035,17 +1153,7 @@ function makeCostClient(transport) {
1035
1153
  query: {
1036
1154
  ...filter?.limit !== void 0 && { limit: filter.limit },
1037
1155
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1038
- ...filter?.runId !== void 0 && { runId: filter.runId },
1039
- ...filter?.agentId !== void 0 && { agentId: filter.agentId },
1040
- ...filter?.conversationId !== void 0 && {
1041
- conversationId: filter.conversationId
1042
- },
1043
- ...filter?.category !== void 0 && { category: filter.category },
1044
- ...filter?.providerId !== void 0 && {
1045
- providerId: filter.providerId
1046
- },
1047
- ...filter?.from !== void 0 && { from: filter.from },
1048
- ...filter?.to !== void 0 && { to: filter.to }
1156
+ ...filterQuery(filter ?? {})
1049
1157
  }
1050
1158
  });
1051
1159
  return {
@@ -1055,29 +1163,23 @@ function makeCostClient(transport) {
1055
1163
  }
1056
1164
  };
1057
1165
  },
1058
- async get(recordId) {
1166
+ async get(recordId, options) {
1059
1167
  return transport.request({
1060
1168
  method: "GET",
1061
- path: `/v1/cost/records/${encodeURIComponent(recordId)}`
1169
+ path: `/v1/cost/records/${encodeURIComponent(recordId)}`,
1170
+ ...options?.includeRawUsage === true && { query: { include: "rawUsage" } }
1062
1171
  });
1063
1172
  },
1064
1173
  async summary(input) {
1174
+ const { from, to, groupBy, ...filter } = input;
1065
1175
  return transport.request({
1066
1176
  method: "GET",
1067
1177
  path: "/v1/cost/aggregate",
1068
1178
  query: {
1069
- from: input.from,
1070
- to: input.to,
1071
- ...input.groupBy !== void 0 && { groupBy: input.groupBy.join(",") },
1072
- ...input.category !== void 0 && { category: input.category },
1073
- ...input.providerId !== void 0 && {
1074
- providerId: input.providerId
1075
- },
1076
- ...input.agentId !== void 0 && { agentId: input.agentId },
1077
- ...input.runId !== void 0 && { runId: input.runId },
1078
- ...input.conversationId !== void 0 && {
1079
- conversationId: input.conversationId
1080
- }
1179
+ ...filterQuery(filter),
1180
+ from,
1181
+ to,
1182
+ ...groupBy !== void 0 && { groupBy: groupBy.join(",") }
1081
1183
  }
1082
1184
  });
1083
1185
  }
@@ -1151,20 +1253,6 @@ function makeDeploymentsClient(transport) {
1151
1253
  };
1152
1254
  }
1153
1255
 
1154
- // src/scope-wire.ts
1155
- function scopeForBody(scope) {
1156
- if (scope.kind === "tenant") return { kind: "tenant" };
1157
- if (scope.kind === "org") return { kind: "org", orgId: scope.orgId };
1158
- return { kind: "project", projectId: scope.projectId };
1159
- }
1160
- function scopeToQuery(scope) {
1161
- if (scope.kind === "tenant") return { scopeKind: "tenant" };
1162
- if (scope.kind === "org") {
1163
- return { scopeKind: "org", scopeId: scope.orgId };
1164
- }
1165
- return { scopeKind: "project", scopeId: scope.projectId };
1166
- }
1167
-
1168
1256
  // src/resources/env.ts
1169
1257
  function makeEnvClient(transport) {
1170
1258
  return {
@@ -1368,6 +1456,24 @@ function makeEvalSuitesClient(transport) {
1368
1456
  path: `/v1/eval-suites/${seg(suiteId)}`
1369
1457
  });
1370
1458
  },
1459
+ async buildFromJudgments(suiteId, input, options) {
1460
+ return transport.request({
1461
+ method: "POST",
1462
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/from-judgments`,
1463
+ body: input,
1464
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1465
+ });
1466
+ },
1467
+ async listCases(suiteId, version, query) {
1468
+ return transport.request({
1469
+ method: "GET",
1470
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/${seg(version)}/cases`,
1471
+ query: {
1472
+ ...query?.limit !== void 0 && { limit: query.limit },
1473
+ ...query?.cursor !== void 0 && { cursor: query.cursor }
1474
+ }
1475
+ });
1476
+ },
1371
1477
  versions: {
1372
1478
  async list(suiteId, filter) {
1373
1479
  return transport.request({
@@ -1751,6 +1857,115 @@ function makeIdentityClient(transport) {
1751
1857
  };
1752
1858
  }
1753
1859
 
1860
+ // src/resources/judge-classes.ts
1861
+ function scopeQuery(scope) {
1862
+ if (scope.kind === "tenant") return { scopeKind: "tenant" };
1863
+ if (scope.kind === "project") return { scopeKind: "project", projectId: scope.projectId };
1864
+ return { scopeKind: "agent", projectId: scope.projectId, agentId: scope.agentId };
1865
+ }
1866
+ function makeJudgeClassesClient(transport) {
1867
+ const withKey = (options) => options?.idempotencyKey !== void 0 ? { idempotencyKey: options.idempotencyKey } : {};
1868
+ return {
1869
+ async create(input, options) {
1870
+ return transport.request({
1871
+ method: "POST",
1872
+ path: "/v1/judge-classes",
1873
+ body: input,
1874
+ ...withKey(options)
1875
+ });
1876
+ },
1877
+ async list(filter) {
1878
+ const page = await transport.request({
1879
+ method: "GET",
1880
+ path: "/v1/judge-classes",
1881
+ query: {
1882
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1883
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1884
+ ...filter?.scope !== void 0 && scopeQuery(filter.scope)
1885
+ }
1886
+ });
1887
+ return {
1888
+ items: page.data,
1889
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
1890
+ };
1891
+ },
1892
+ async get(judgeClassId) {
1893
+ return transport.request({
1894
+ method: "GET",
1895
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}`
1896
+ });
1897
+ },
1898
+ async update(judgeClassId, input, options) {
1899
+ return transport.request({
1900
+ method: "PATCH",
1901
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}`,
1902
+ body: input,
1903
+ ...withKey(options)
1904
+ });
1905
+ },
1906
+ async unregister(judgeClassId, options) {
1907
+ await transport.request({
1908
+ method: "POST",
1909
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}/unregister`,
1910
+ body: {},
1911
+ discardResponse: true,
1912
+ ...withKey(options)
1913
+ });
1914
+ }
1915
+ };
1916
+ }
1917
+
1918
+ // src/resources/judgments.ts
1919
+ function makeJudgmentsClient(transport) {
1920
+ return {
1921
+ async create(input, options) {
1922
+ return transport.request({
1923
+ method: "POST",
1924
+ path: "/v1/judgments",
1925
+ body: input,
1926
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1927
+ });
1928
+ },
1929
+ async list(filter) {
1930
+ const page = await transport.request({
1931
+ method: "GET",
1932
+ path: "/v1/judgments",
1933
+ query: {
1934
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1935
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1936
+ ...filter?.runId !== void 0 && { runId: filter.runId },
1937
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
1938
+ ...filter?.agentVersion !== void 0 && { agentVersion: filter.agentVersion },
1939
+ ...filter?.flowId !== void 0 && { flowId: filter.flowId },
1940
+ ...filter?.verdict !== void 0 && { verdict: filter.verdict },
1941
+ ...filter?.judgeClassId !== void 0 && { judgeClassId: filter.judgeClassId },
1942
+ ...filter?.participantId !== void 0 && { participantId: filter.participantId },
1943
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope)
1944
+ }
1945
+ });
1946
+ return {
1947
+ items: page.data,
1948
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
1949
+ };
1950
+ },
1951
+ async get(judgmentId) {
1952
+ return transport.request({
1953
+ method: "GET",
1954
+ path: `/v1/judgments/${encodeURIComponent(judgmentId)}`
1955
+ });
1956
+ },
1957
+ async unregister(judgmentId, options) {
1958
+ await transport.request({
1959
+ method: "POST",
1960
+ path: `/v1/judgments/${encodeURIComponent(judgmentId)}/unregister`,
1961
+ body: {},
1962
+ discardResponse: true,
1963
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1964
+ });
1965
+ }
1966
+ };
1967
+ }
1968
+
1754
1969
  // src/resources/mcp.ts
1755
1970
  function makeMcpClient(transport) {
1756
1971
  return {
@@ -2327,6 +2542,7 @@ function makeProvenanceClient(transport) {
2327
2542
  query: {
2328
2543
  ...filter?.limit !== void 0 && { limit: filter.limit },
2329
2544
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2545
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
2330
2546
  ...filter?.runId !== void 0 && { runId: filter.runId },
2331
2547
  ...filter?.agentId !== void 0 && {
2332
2548
  agentId: filter.agentId
@@ -2582,10 +2798,14 @@ function makeRunsClient(transport) {
2582
2798
  query: {
2583
2799
  ...filter?.limit !== void 0 && { limit: filter.limit },
2584
2800
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2801
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
2585
2802
  ...filter?.parentRunId !== void 0 && {
2586
2803
  parentRunId: filter.parentRunId
2587
2804
  },
2588
2805
  ...filter?.topLevel !== void 0 && { topLevel: String(filter.topLevel) },
2806
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
2807
+ ...filter?.replays !== void 0 && { replays: filter.replays },
2808
+ ...filter?.evalRunId !== void 0 && { evalRunId: filter.evalRunId },
2589
2809
  ...filter?.includeOutput === true && { include: "output" }
2590
2810
  }
2591
2811
  });
@@ -3779,7 +3999,10 @@ function createClient(options) {
3779
3999
  compliance: makeComplianceClient(transport),
3780
4000
  audit: makeAuditClient(transport),
3781
4001
  evalSuites: makeEvalSuitesClient(transport),
4002
+ blocks: makeBlocksClient(transport),
3782
4003
  evalRuns: makeEvalRunsClient(transport),
4004
+ judgments: makeJudgmentsClient(transport),
4005
+ judgeClasses: makeJudgeClassesClient(transport),
3783
4006
  users: makeUsersClient(transport),
3784
4007
  identity: makeIdentityClient(transport),
3785
4008
  auth: makeAuthClient(transport),